Compare commits
No commits in common. "817974577684b5c3905faa384bf8cd4315eae516" and "master" have entirely different histories.
8179745776
...
master
27
.classpath
27
.classpath
@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
44
.gitignore
vendored
44
.gitignore
vendored
@ -1,44 +0,0 @@
|
|||||||
######################################################################
|
|
||||||
# Build Tools
|
|
||||||
|
|
||||||
.gradle
|
|
||||||
/build/
|
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
target/
|
|
||||||
!.mvn/wrapper/maven-wrapper.jar
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# IDE
|
|
||||||
|
|
||||||
### STS ###
|
|
||||||
.apt_generated
|
|
||||||
.factorypath
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
|
|
||||||
### JRebel ###
|
|
||||||
rebel.xml
|
|
||||||
### NetBeans ###
|
|
||||||
nbproject/private/
|
|
||||||
build/*
|
|
||||||
nbbuild/
|
|
||||||
dist/
|
|
||||||
nbdist/
|
|
||||||
.nb-gradle/
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# Others
|
|
||||||
*.log
|
|
||||||
*.xml.versionsBackup
|
|
||||||
*.swp
|
|
||||||
|
|
||||||
!*/build/*.java
|
|
||||||
!*/build/*.html
|
|
||||||
!*/build/*.xml
|
|
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Binary file not shown.
1
.mvn/wrapper/maven-wrapper.properties
vendored
1
.mvn/wrapper/maven-wrapper.properties
vendored
@ -1 +0,0 @@
|
|||||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
|
|
23
.project
23
.project
@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>blueland-plateform</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
@ -1,5 +0,0 @@
|
|||||||
### 工程模块说明 ###
|
|
||||||
1. model:实例类
|
|
||||||
2. core:核心类,其他工程共享
|
|
||||||
3. web: 应用、模块、模型、自定义表单数据服务
|
|
||||||
4. render:静态页面渲染、物理表模型及数据处理
|
|
33
crm-internation/.gitignore
vendored
33
crm-internation/.gitignore
vendored
@ -1,33 +0,0 @@
|
|||||||
HELP.md
|
|
||||||
target/
|
|
||||||
!.mvn/wrapper/maven-wrapper.jar
|
|
||||||
!**/src/main/**/target/
|
|
||||||
!**/src/test/**/target/
|
|
||||||
|
|
||||||
### 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/
|
|
||||||
!**/src/main/**/build/
|
|
||||||
!**/src/test/**/build/
|
|
||||||
|
|
||||||
### VS Code ###
|
|
||||||
.vscode/
|
|
316
crm-internation/mvnw
vendored
316
crm-internation/mvnw
vendored
@ -1,316 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
# or more contributor license agreements. See the NOTICE file
|
|
||||||
# distributed with this work for additional information
|
|
||||||
# regarding copyright ownership. The ASF licenses this file
|
|
||||||
# to you under the Apache License, Version 2.0 (the
|
|
||||||
# "License"); you may not use this file except in compliance
|
|
||||||
# with the License. You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing,
|
|
||||||
# software distributed under the License is distributed on an
|
|
||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
# KIND, either express or implied. See the License for the
|
|
||||||
# specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Maven Start Up Batch script
|
|
||||||
#
|
|
||||||
# Required ENV vars:
|
|
||||||
# ------------------
|
|
||||||
# JAVA_HOME - location of a JDK home dir
|
|
||||||
#
|
|
||||||
# Optional ENV vars
|
|
||||||
# -----------------
|
|
||||||
# M2_HOME - location of maven2's installed home dir
|
|
||||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
|
||||||
# e.g. to debug Maven itself, use
|
|
||||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
|
||||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
|
||||||
|
|
||||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
|
||||||
. /usr/local/etc/mavenrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f /etc/mavenrc ] ; then
|
|
||||||
. /etc/mavenrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$HOME/.mavenrc" ] ; then
|
|
||||||
. "$HOME/.mavenrc"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# OS specific support. $var _must_ be set to either true or false.
|
|
||||||
cygwin=false;
|
|
||||||
darwin=false;
|
|
||||||
mingw=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN*) cygwin=true ;;
|
|
||||||
MINGW*) mingw=true;;
|
|
||||||
Darwin*) darwin=true
|
|
||||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
|
||||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
|
||||||
if [ -z "$JAVA_HOME" ]; then
|
|
||||||
if [ -x "/usr/libexec/java_home" ]; then
|
|
||||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
|
||||||
else
|
|
||||||
export JAVA_HOME="/Library/Java/Home"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] ; then
|
|
||||||
if [ -r /etc/gentoo-release ] ; then
|
|
||||||
JAVA_HOME=`java-config --jre-home`
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$M2_HOME" ] ; then
|
|
||||||
## resolve links - $0 may be a link to maven's home
|
|
||||||
PRG="$0"
|
|
||||||
|
|
||||||
# need this for relative symlinks
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG="`dirname "$PRG"`/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
saveddir=`pwd`
|
|
||||||
|
|
||||||
M2_HOME=`dirname "$PRG"`/..
|
|
||||||
|
|
||||||
# make it fully qualified
|
|
||||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
|
||||||
|
|
||||||
cd "$saveddir"
|
|
||||||
# echo Using m2 at $M2_HOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
|
||||||
if $cygwin ; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
|
||||||
[ -n "$CLASSPATH" ] &&
|
|
||||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
|
||||||
if $mingw ; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ]; then
|
|
||||||
javaExecutable="`which javac`"
|
|
||||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
|
||||||
# readlink(1) is not available as standard on Solaris 10.
|
|
||||||
readLink=`which readlink`
|
|
||||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
|
||||||
if $darwin ; then
|
|
||||||
javaHome="`dirname \"$javaExecutable\"`"
|
|
||||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
|
||||||
else
|
|
||||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
|
||||||
fi
|
|
||||||
javaHome="`dirname \"$javaExecutable\"`"
|
|
||||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
|
||||||
JAVA_HOME="$javaHome"
|
|
||||||
export JAVA_HOME
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVACMD" ] ; then
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
||||||
else
|
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD="`\\unset -f command; \\command -v java`"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
|
||||||
echo " We cannot execute $JAVACMD" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] ; then
|
|
||||||
echo "Warning: JAVA_HOME environment variable is not set."
|
|
||||||
fi
|
|
||||||
|
|
||||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
|
||||||
|
|
||||||
# traverses directory structure from process work directory to filesystem root
|
|
||||||
# first directory with .mvn subdirectory is considered project base directory
|
|
||||||
find_maven_basedir() {
|
|
||||||
|
|
||||||
if [ -z "$1" ]
|
|
||||||
then
|
|
||||||
echo "Path not specified to find_maven_basedir"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
basedir="$1"
|
|
||||||
wdir="$1"
|
|
||||||
while [ "$wdir" != '/' ] ; do
|
|
||||||
if [ -d "$wdir"/.mvn ] ; then
|
|
||||||
basedir=$wdir
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
|
||||||
if [ -d "${wdir}" ]; then
|
|
||||||
wdir=`cd "$wdir/.."; pwd`
|
|
||||||
fi
|
|
||||||
# end of workaround
|
|
||||||
done
|
|
||||||
echo "${basedir}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# concatenates all lines of a file
|
|
||||||
concat_lines() {
|
|
||||||
if [ -f "$1" ]; then
|
|
||||||
echo "$(tr -s '\n' ' ' < "$1")"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
|
||||||
if [ -z "$BASE_DIR" ]; then
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
|
||||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
|
||||||
##########################################################################################
|
|
||||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
|
||||||
fi
|
|
||||||
if [ -n "$MVNW_REPOURL" ]; then
|
|
||||||
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
|
||||||
else
|
|
||||||
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
|
||||||
fi
|
|
||||||
while IFS="=" read key value; do
|
|
||||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
|
||||||
esac
|
|
||||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Downloading from: $jarUrl"
|
|
||||||
fi
|
|
||||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
|
||||||
if $cygwin; then
|
|
||||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
if command -v wget > /dev/null; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Found wget ... using wget"
|
|
||||||
fi
|
|
||||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
|
||||||
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
|
||||||
else
|
|
||||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
|
||||||
fi
|
|
||||||
elif command -v curl > /dev/null; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Found curl ... using curl"
|
|
||||||
fi
|
|
||||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
|
||||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
|
||||||
else
|
|
||||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Falling back to using Java to download"
|
|
||||||
fi
|
|
||||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
|
||||||
# For Cygwin, switch paths to Windows format before running javac
|
|
||||||
if $cygwin; then
|
|
||||||
javaClass=`cygpath --path --windows "$javaClass"`
|
|
||||||
fi
|
|
||||||
if [ -e "$javaClass" ]; then
|
|
||||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
|
||||||
fi
|
|
||||||
# Compiling the Java class
|
|
||||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
|
||||||
fi
|
|
||||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
|
||||||
# Running the downloader
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo " - Running MavenWrapperDownloader.java ..."
|
|
||||||
fi
|
|
||||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
##########################################################################################
|
|
||||||
# End of extension
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo $MAVEN_PROJECTBASEDIR
|
|
||||||
fi
|
|
||||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
|
||||||
if $cygwin; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
|
||||||
[ -n "$CLASSPATH" ] &&
|
|
||||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
|
||||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
|
||||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Provide a "standardized" way to retrieve the CLI args that will
|
|
||||||
# work with both Windows and non-Windows executions.
|
|
||||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
|
||||||
export MAVEN_CMD_LINE_ARGS
|
|
||||||
|
|
||||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
|
||||||
|
|
||||||
exec "$JAVACMD" \
|
|
||||||
$MAVEN_OPTS \
|
|
||||||
$MAVEN_DEBUG_OPTS \
|
|
||||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
|
||||||
"-Dmaven.home=${M2_HOME}" \
|
|
||||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
|
||||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
|
@ -1,99 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>2.7.17</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
<groupId>net.rzdata</groupId>
|
|
||||||
<artifactId>crm-internation</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<name>crm-internation</name>
|
|
||||||
<description>crm翻译</description>
|
|
||||||
<properties>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
|
||||||
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
|
|
||||||
<version>4.3.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.afterturn</groupId>
|
|
||||||
<artifactId>easypoi-spring-boot-starter</artifactId>
|
|
||||||
<version>4.4.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.hutool</groupId>
|
|
||||||
<artifactId>hutool-all</artifactId>
|
|
||||||
<version>5.8.22</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.mybatis-flex</groupId>
|
|
||||||
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
|
|
||||||
<version>1.7.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
|
||||||
<version>1.2.20</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
|
||||||
<version>8.0.32</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- for test only -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<optional>true</optional>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>fastjson</artifactId>
|
|
||||||
<version>2.0.42</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.tencentcloudapi</groupId>
|
|
||||||
<artifactId>tencentcloud-sdk-java</artifactId>
|
|
||||||
<version>3.1.900</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<excludes>
|
|
||||||
<exclude>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
</exclude>
|
|
||||||
</excludes>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
46
mvnw
vendored
Normal file → Executable file
46
mvnw
vendored
Normal file → Executable file
@ -8,7 +8,7 @@
|
|||||||
# "License"); you may not use this file except in compliance
|
# "License"); you may not use this file except in compliance
|
||||||
# with the License. You may obtain a copy of the License at
|
# with the License. You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing,
|
# Unless required by applicable law or agreed to in writing,
|
||||||
# software distributed under the License is distributed on an
|
# software distributed under the License is distributed on an
|
||||||
@ -19,7 +19,7 @@
|
|||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Maven2 Start Up Batch script
|
# Maven Start Up Batch script
|
||||||
#
|
#
|
||||||
# Required ENV vars:
|
# Required ENV vars:
|
||||||
# ------------------
|
# ------------------
|
||||||
@ -36,6 +36,10 @@
|
|||||||
|
|
||||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||||
|
|
||||||
|
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||||
|
. /usr/local/etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f /etc/mavenrc ] ; then
|
if [ -f /etc/mavenrc ] ; then
|
||||||
. /etc/mavenrc
|
. /etc/mavenrc
|
||||||
fi
|
fi
|
||||||
@ -114,7 +118,6 @@ if $mingw ; then
|
|||||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||||
[ -n "$JAVA_HOME" ] &&
|
[ -n "$JAVA_HOME" ] &&
|
||||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||||
# TODO classpath?
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ]; then
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
@ -146,7 +149,7 @@ if [ -z "$JAVACMD" ] ; then
|
|||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="`which java`"
|
JAVACMD="`\\unset -f command; \\command -v java`"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -212,7 +215,11 @@ else
|
|||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||||
fi
|
fi
|
||||||
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
|
if [ -n "$MVNW_REPOURL" ]; then
|
||||||
|
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
else
|
||||||
|
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
fi
|
||||||
while IFS="=" read key value; do
|
while IFS="=" read key value; do
|
||||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||||
esac
|
esac
|
||||||
@ -221,22 +228,38 @@ else
|
|||||||
echo "Downloading from: $jarUrl"
|
echo "Downloading from: $jarUrl"
|
||||||
fi
|
fi
|
||||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
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 command -v wget > /dev/null; then
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo "Found wget ... using wget"
|
echo "Found wget ... using wget"
|
||||||
fi
|
fi
|
||||||
wget "$jarUrl" -O "$wrapperJarPath"
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
fi
|
||||||
elif command -v curl > /dev/null; then
|
elif command -v curl > /dev/null; then
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo "Found curl ... using curl"
|
echo "Found curl ... using curl"
|
||||||
fi
|
fi
|
||||||
curl -o "$wrapperJarPath" "$jarUrl"
|
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
|
else
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
echo "Falling back to using Java to download"
|
echo "Falling back to using Java to download"
|
||||||
fi
|
fi
|
||||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
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 "$javaClass" ]; then
|
||||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
@ -277,10 +300,17 @@ if $cygwin; then
|
|||||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||||
fi
|
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
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
exec "$JAVACMD" \
|
exec "$JAVACMD" \
|
||||||
$MAVEN_OPTS \
|
$MAVEN_OPTS \
|
||||||
|
$MAVEN_DEBUG_OPTS \
|
||||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||||
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
"-Dmaven.home=${M2_HOME}" \
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||||
|
161
mvnw.cmd
vendored
161
mvnw.cmd
vendored
@ -1,161 +0,0 @@
|
|||||||
@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 http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@REM
|
|
||||||
@REM Unless required by applicable law or agreed to in writing,
|
|
||||||
@REM software distributed under the License is distributed on an
|
|
||||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
@REM KIND, either express or implied. See the License for the
|
|
||||||
@REM specific language governing permissions and limitations
|
|
||||||
@REM under the License.
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
@REM Maven2 Start Up Batch script
|
|
||||||
@REM
|
|
||||||
@REM Required ENV vars:
|
|
||||||
@REM JAVA_HOME - location of a JDK home dir
|
|
||||||
@REM
|
|
||||||
@REM Optional ENV vars
|
|
||||||
@REM M2_HOME - location of maven2's installed home dir
|
|
||||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
|
||||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
|
|
||||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
|
||||||
@REM e.g. to debug Maven itself, use
|
|
||||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
|
||||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
|
||||||
@echo off
|
|
||||||
@REM set title of command window
|
|
||||||
title %0
|
|
||||||
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
|
|
||||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
|
||||||
|
|
||||||
@REM set %HOME% to equivalent of $HOME
|
|
||||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
|
||||||
|
|
||||||
@REM Execute a user defined script before this one
|
|
||||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
|
||||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
|
||||||
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
|
||||||
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
|
||||||
:skipRcPre
|
|
||||||
|
|
||||||
@setlocal
|
|
||||||
|
|
||||||
set ERROR_CODE=0
|
|
||||||
|
|
||||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
|
||||||
@setlocal
|
|
||||||
|
|
||||||
@REM ==== START VALIDATION ====
|
|
||||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo Error: JAVA_HOME not found in your environment. >&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
|
||||||
echo location of your Java installation. >&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
:OkJHome
|
|
||||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
|
||||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
|
||||||
echo location of your Java installation. >&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
@REM ==== END VALIDATION ====
|
|
||||||
|
|
||||||
:init
|
|
||||||
|
|
||||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
|
||||||
@REM Fallback to current working directory if not found.
|
|
||||||
|
|
||||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
|
||||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
|
||||||
|
|
||||||
set EXEC_DIR=%CD%
|
|
||||||
set WDIR=%EXEC_DIR%
|
|
||||||
:findBaseDir
|
|
||||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
|
||||||
cd ..
|
|
||||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
|
||||||
set WDIR=%CD%
|
|
||||||
goto findBaseDir
|
|
||||||
|
|
||||||
:baseDirFound
|
|
||||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
|
||||||
cd "%EXEC_DIR%"
|
|
||||||
goto endDetectBaseDir
|
|
||||||
|
|
||||||
:baseDirNotFound
|
|
||||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
|
||||||
cd "%EXEC_DIR%"
|
|
||||||
|
|
||||||
:endDetectBaseDir
|
|
||||||
|
|
||||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
|
||||||
|
|
||||||
@setlocal EnableExtensions EnableDelayedExpansion
|
|
||||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
|
||||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
|
||||||
|
|
||||||
:endReadAdditionalConfig
|
|
||||||
|
|
||||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
|
||||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
|
||||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
|
||||||
|
|
||||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
|
|
||||||
FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
|
|
||||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
|
||||||
)
|
|
||||||
|
|
||||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
|
||||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
|
||||||
if exist %WRAPPER_JAR% (
|
|
||||||
echo Found %WRAPPER_JAR%
|
|
||||||
) else (
|
|
||||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
|
||||||
echo Downloading from: %DOWNLOAD_URL%
|
|
||||||
powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
|
|
||||||
echo Finished downloading %WRAPPER_JAR%
|
|
||||||
)
|
|
||||||
@REM End of extension
|
|
||||||
|
|
||||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
|
||||||
if ERRORLEVEL 1 goto error
|
|
||||||
goto end
|
|
||||||
|
|
||||||
:error
|
|
||||||
set ERROR_CODE=1
|
|
||||||
|
|
||||||
:end
|
|
||||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
|
||||||
|
|
||||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
|
||||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
|
||||||
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
|
||||||
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
|
||||||
:skipRcPost
|
|
||||||
|
|
||||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
|
||||||
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
|
||||||
|
|
||||||
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
|
||||||
|
|
||||||
exit /B %ERROR_CODE%
|
|
188
pom.xml
188
pom.xml
@ -1,101 +1,99 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<groupId>com.blueland</groupId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>blueland-plateform</artifactId>
|
<parent>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<name>blueland-plateform</name>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<description>快速开发平台</description>
|
<version>2.7.17</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>net.rzdata</groupId>
|
||||||
|
<artifactId>crm-internation</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>crm-internation</name>
|
||||||
|
<description>crm翻译</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
|
||||||
|
<version>4.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.afterturn</groupId>
|
||||||
|
<artifactId>easypoi-spring-boot-starter</artifactId>
|
||||||
|
<version>4.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.22</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<properties>
|
<dependency>
|
||||||
<java.version>1.8</java.version>
|
<groupId>com.mybatis-flex</groupId>
|
||||||
<spring.boot.version>2.5.6</spring.boot.version>
|
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
|
||||||
<!-- <spring.boot.version>2.3.10.RELEASE</spring.boot.version>-->
|
<version>1.7.3</version>
|
||||||
<!-- <spring.boot.version>2.1.2.RELEASE</spring.boot.version>-->
|
</dependency>
|
||||||
<mybatis.spring.version>2.0.0</mybatis.spring.version>
|
<dependency>
|
||||||
<druid.version>1.1.21</druid.version>
|
<groupId>com.alibaba</groupId>
|
||||||
<hibernate-validator.version>5.4.2.Final</hibernate-validator.version>
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
<fastjson.version>1.2.56</fastjson.version>
|
<version>1.2.20</version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
</dependency>
|
||||||
<pagehelper.version>5.1.10</pagehelper.version>
|
<dependency>
|
||||||
<!-- <spring-swagger.version>2.8.0</spring-swagger.version>-->
|
<groupId>com.mysql</groupId>
|
||||||
<spring-security-oauth2.version>2.3.5.RELEASE</spring-security-oauth2.version>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
<oauth2-autoconfigure.version>2.1.3.RELEASE</oauth2-autoconfigure.version>
|
<version>8.0.32</version>
|
||||||
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
|
</dependency>
|
||||||
<pinyin4j.version>2.5.0</pinyin4j.version>
|
<!-- for test only -->
|
||||||
<commons-lang3.version>3.3.2</commons-lang3.version>
|
<dependency>
|
||||||
<!-- <blueland-framework-core.version>0.4</blueland-framework-core.version>-->
|
<groupId>org.projectlombok</groupId>
|
||||||
<ognl.version>3.2</ognl.version>
|
<artifactId>lombok</artifactId>
|
||||||
<guava.version>27.1-jre</guava.version>
|
<optional>true</optional>
|
||||||
<!--
|
</dependency>
|
||||||
<blueland-workflow-sdk.version>0.0.8</blueland-workflow-sdk.version>
|
<dependency>
|
||||||
-->
|
<groupId>org.springframework.boot</groupId>
|
||||||
<joda.time.version>2.9.7</joda.time.version>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<okhttp.version>3.6.0</okhttp.version>
|
<scope>test</scope>
|
||||||
<sdk.version>1.2</sdk.version>
|
</dependency>
|
||||||
<!-- <swagger-bootstrap-ui.version>1.9.1</swagger-bootstrap-ui.version>-->
|
<dependency>
|
||||||
<easypoi-base.version>4.1.0</easypoi-base.version>
|
<groupId>com.alibaba</groupId>
|
||||||
<easypoi-web.version>4.1.0</easypoi-web.version>
|
<artifactId>fastjson</artifactId>
|
||||||
<easypoi-annotation.version>4.1.0</easypoi-annotation.version>
|
<version>2.0.42</version>
|
||||||
<mybatis-plus.version>3.4.3.4</mybatis-plus.version>
|
</dependency>
|
||||||
<springfox-swagger2.version>2.9.2</springfox-swagger2.version>
|
<dependency>
|
||||||
<knife4j.version>3.0.3</knife4j.version>
|
<groupId>com.tencentcloudapi</groupId>
|
||||||
</properties>
|
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||||
|
<version>3.1.900</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<dependencyManagement>
|
<build>
|
||||||
<dependencies>
|
<plugins>
|
||||||
<!-- SpringBoot的依赖配置-->
|
<plugin>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<version>${spring.boot.version}</version>
|
<configuration>
|
||||||
<type>pom</type>
|
<excludes>
|
||||||
<scope>import</scope>
|
<exclude>
|
||||||
</dependency>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
|
||||||
<version>${mybatis-plus.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-extension</artifactId>
|
|
||||||
<version>${mybatis-plus.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
<modules>
|
|
||||||
<module>usm-web</module>
|
|
||||||
<module>usm-model</module>
|
|
||||||
<module>usm-core</module>
|
|
||||||
<module>usm-render</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>public</id>
|
|
||||||
<name>aliyun nexus</name>
|
|
||||||
<url>https://maven.aliyun.com/repository/public/</url>
|
|
||||||
<releases>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</releases>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<pluginRepositories>
|
|
||||||
<pluginRepository>
|
|
||||||
<id>public</id>
|
|
||||||
<name>aliyun nexus</name>
|
|
||||||
<url>https://maven.aliyun.com/repository/public/</url>
|
|
||||||
<releases>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</releases>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</pluginRepository>
|
|
||||||
</pluginRepositories>
|
|
||||||
</project>
|
</project>
|
@ -257,20 +257,6 @@ public class InternationalServiceImpl extends ServiceImpl<InternationalMapper, I
|
|||||||
false), International::getName)));
|
false), International::getName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
International international = new International();
|
|
||||||
international.setCode("client.msg");
|
|
||||||
international.setName("客户端");
|
|
||||||
List<International> list = Arrays.asList(international);
|
|
||||||
Map<String, Map<String, String>> collect = list.stream()
|
|
||||||
.collect(Collectors.groupingBy(el -> StrUtil.subBefore(el.getCode(),
|
|
||||||
".",
|
|
||||||
false), Collectors.toMap(el -> StrUtil.subAfter(el.getCode(),
|
|
||||||
".",
|
|
||||||
false), International::getName)));
|
|
||||||
System.out.println(collect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean tenantIdCopy(String sourceLang, String tenantId) {
|
public Boolean tenantIdCopy(String sourceLang, String tenantId) {
|
||||||
List<International> list = listByLang(sourceLang, tenantId, "").stream()
|
List<International> list = listByLang(sourceLang, tenantId, "").stream()
|
||||||
@ -285,7 +271,7 @@ public class InternationalServiceImpl extends ServiceImpl<InternationalMapper, I
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
boolean flag = saveBatch(list);
|
boolean flag = saveBatch(list);
|
||||||
if (flag) {
|
if(flag){
|
||||||
RedisUtil.hashMultiSet(sourceLang, list);
|
RedisUtil.hashMultiSet(sourceLang, list);
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
@ -23,8 +23,7 @@ logging:
|
|||||||
mybatis-flex:
|
mybatis-flex:
|
||||||
type-aliases-package: com.blueland.common.core.domain
|
type-aliases-package: com.blueland.common.core.domain
|
||||||
|
|
||||||
log:
|
|
||||||
path: ./logs/crm-internation
|
|
||||||
|
|
||||||
knife4j:
|
knife4j:
|
||||||
enable: true
|
enable: true
|
43
src/main/resources/application.yml
Normal file
43
src/main/resources/application.yml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
druid:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
username: crm
|
||||||
|
password: crm@123
|
||||||
|
url: jdbc:mysql://192.168.1.13:3308/crm_usm?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||||
|
# redis:
|
||||||
|
# host: localhost
|
||||||
|
# port: 6379
|
||||||
|
redis:
|
||||||
|
database: 9
|
||||||
|
host: 192.168.1.169
|
||||||
|
password: ''
|
||||||
|
tm:
|
||||||
|
secretId: AKIDVotjKflbCYjgOr53xb093h6FApFQN5Yl
|
||||||
|
secretKey: 1oMfqmSt52kDRYR4SaUAbmiOp1yf8MM7
|
||||||
|
server:
|
||||||
|
port: 8080
|
||||||
|
servlet:
|
||||||
|
context-path: /crm-internation
|
||||||
|
session:
|
||||||
|
cookie:
|
||||||
|
name: crm-internation
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
net.rzdata.internation: debug
|
||||||
|
mybatis-flex:
|
||||||
|
type-aliases-package: com.blueland.common.core.domain
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
knife4j:
|
||||||
|
enable: true
|
||||||
|
openapi:
|
||||||
|
title: 国际化接口文档
|
||||||
|
group:
|
||||||
|
test1:
|
||||||
|
group-name: 国际化
|
||||||
|
api-rule: package
|
||||||
|
api-rule-resources:
|
||||||
|
- com.blueland.common.core.controller
|
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
|
|
||||||
<fileset name="all" enabled="true" check-config-name="Google Checks" local="false">
|
|
||||||
<file-match-pattern match-pattern="." include-pattern="true"/>
|
|
||||||
</fileset>
|
|
||||||
</fileset-config>
|
|
@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
25
usm-core/.gitignore
vendored
25
usm-core/.gitignore
vendored
@ -1,25 +0,0 @@
|
|||||||
### Java template
|
|
||||||
# Compiled class file
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# Log file
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# BlueJ files
|
|
||||||
*.ctxt
|
|
||||||
|
|
||||||
# Mobile Tools for Java (J2ME)
|
|
||||||
.mtj.tmp/
|
|
||||||
|
|
||||||
# Package Files #
|
|
||||||
*.jar
|
|
||||||
*.war
|
|
||||||
*.nar
|
|
||||||
*.ear
|
|
||||||
*.zip
|
|
||||||
*.tar.gz
|
|
||||||
*.rar
|
|
||||||
target/
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
|
||||||
hs_err_pid*
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>blueland-plateform-core</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>com.genuitec.eclipse.springframework.springbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>com.genuitec.eclipse.springframework.springnature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
201
usm-core/pom.xml
201
usm-core/pom.xml
@ -1,201 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.blueland</groupId>
|
|
||||||
<artifactId>blueland-plateform</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<artifactId>usm-core</artifactId>
|
|
||||||
<name>usm-core</name>
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
|
||||||
<version>2.5.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.hutool</groupId>
|
|
||||||
<artifactId>hutool-all</artifactId>
|
|
||||||
<version>5.7.14</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.blueland</groupId>
|
|
||||||
<artifactId>usm-model</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- <dependency>
|
|
||||||
<groupId>nl.bitwalker</groupId>
|
|
||||||
<artifactId>UserAgentUtils</artifactId>
|
|
||||||
<version>1.2.4</version>
|
|
||||||
</dependency> -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.blueland</groupId>
|
|
||||||
<artifactId>doc-cloud-sdk</artifactId>
|
|
||||||
<version>${sdk.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.blueland</groupId>-->
|
|
||||||
<!-- <artifactId>blueland-framework-core</artifactId>-->
|
|
||||||
<!-- <version>${blueland-framework-core.version}</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- excel -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>easyexcel</artifactId>
|
|
||||||
<version>2.1.4</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
|
|
||||||
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
|
|
||||||
<!-- <version>${mybatis.spring.version}</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
|
||||||
<version>${druid.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.github.pagehelper</groupId>-->
|
|
||||||
<!-- <artifactId>pagehelper-spring-boot-starter</artifactId>-->
|
|
||||||
<!-- <version>${pagehelper.version}</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.github.pagehelper</groupId>-->
|
|
||||||
<!-- <artifactId>pagehelper</artifactId>-->
|
|
||||||
<!-- <version>5.1.10</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>fastjson</artifactId>
|
|
||||||
<version>${fastjson.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>io.springfox</groupId>-->
|
|
||||||
<!-- <artifactId>springfox-swagger2</artifactId>-->
|
|
||||||
<!-- <version>${spring-swagger.version}</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.github.xiaoymin</groupId>-->
|
|
||||||
<!-- <artifactId>swagger-bootstrap-ui</artifactId>-->
|
|
||||||
<!-- <version>${swagger-bootstrap-ui.version}</version>-->
|
|
||||||
<!-- </dependency> -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
|
||||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
|
||||||
<version>${knife4j.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
|
||||||
<optional>true</optional>
|
|
||||||
</dependency>
|
|
||||||
<!-- mybatis end -->
|
|
||||||
<!-- commons管理 start -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>ognl</groupId>
|
|
||||||
<artifactId>ognl</artifactId>
|
|
||||||
<version>${ognl.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.guava</groupId>
|
|
||||||
<artifactId>guava</artifactId>
|
|
||||||
<version>${guava.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>joda-time</groupId>-->
|
|
||||||
<!-- <artifactId>joda-time</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
|
||||||
<artifactId>okhttp</artifactId>
|
|
||||||
<version>${okhttp.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Quartz定时任务 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.shardingsphere</groupId>
|
|
||||||
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
|
|
||||||
<version>4.0.0-RC1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-extension</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
@ -1,22 +0,0 @@
|
|||||||
package com.blueland.annotation;
|
|
||||||
|
|
||||||
|
|
||||||
import com.blueland.enums.Version;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @program: crm
|
|
||||||
* @description:
|
|
||||||
* @author: bigtian
|
|
||||||
* @create: 2022-01-02 10:17
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
|
||||||
@Documented
|
|
||||||
public @interface ApiVersion {
|
|
||||||
|
|
||||||
Version[] groups();
|
|
||||||
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
package com.blueland.annotation;
|
|
||||||
|
|
||||||
import com.blueland.constant.CommonConstant;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @program: usm
|
|
||||||
* @description: 日志记录
|
|
||||||
* 支持获取path参数,以及@RequestBody参数,
|
|
||||||
* 如果是@RequestBody参数,则放置在第一个参数位
|
|
||||||
* @author: bigtian
|
|
||||||
* @create: 2021-12-30 10:04
|
|
||||||
*/
|
|
||||||
@Target({ElementType.METHOD})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
public @interface Log {
|
|
||||||
/**
|
|
||||||
* 租户
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
// String appId() default "sys";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日志类型
|
|
||||||
*/
|
|
||||||
CommonConstant.LogType logType() default CommonConstant.LogType.OPERATE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 业务类型
|
|
||||||
*/
|
|
||||||
String busiType() default "日志记录";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作类型
|
|
||||||
*/
|
|
||||||
String opType() default "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统类型 web app render job export
|
|
||||||
*/
|
|
||||||
String type() default "";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,199 +0,0 @@
|
|||||||
package com.blueland.aop;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.blueland.annotation.Log;
|
|
||||||
import com.blueland.constant.CommonConstant;
|
|
||||||
import com.blueland.core.util.AccessUtil;
|
|
||||||
import com.blueland.core.util.StringUtil;
|
|
||||||
import com.blueland.core.util.UserUtils;
|
|
||||||
import com.blueland.bo.SysOplogEntity;
|
|
||||||
import com.blueland.bo.SysPvlogEntity;
|
|
||||||
import com.blueland.model.TPfSysOplog;
|
|
||||||
import com.blueland.model.TPfSysPvlog;
|
|
||||||
import com.blueland.service.impl.SysOplogServiceImpl;
|
|
||||||
import com.blueland.service.impl.SysPvlogServiceImpl;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.aspectj.lang.JoinPoint;
|
|
||||||
import org.aspectj.lang.annotation.AfterReturning;
|
|
||||||
import org.aspectj.lang.annotation.AfterThrowing;
|
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 日志记录
|
|
||||||
* @author: bigTian
|
|
||||||
* @create: 2021-10-28 14:48
|
|
||||||
*/
|
|
||||||
@Aspect
|
|
||||||
@Component
|
|
||||||
@Slf4j
|
|
||||||
public class LogAspect {
|
|
||||||
private final String expCheckPoint = "@annotation(com.blueland.annotation.Log)";
|
|
||||||
private final static String prefix = "执行方法:";
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysOplogServiceImpl sysOplogService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysPvlogServiceImpl sysPvlogService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置切点
|
|
||||||
*/
|
|
||||||
@Pointcut(expCheckPoint)
|
|
||||||
public void expCheckPoint() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 抛出异常后
|
|
||||||
*
|
|
||||||
* @param point
|
|
||||||
* @param ex
|
|
||||||
*/
|
|
||||||
@AfterThrowing(pointcut = "expCheckPoint()", throwing = "ex")
|
|
||||||
public void doAfterThrowing(JoinPoint point, Exception ex) throws Exception {
|
|
||||||
log(point, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void log(JoinPoint point, boolean isSuccess) throws Exception {
|
|
||||||
MethodSignature signature = (MethodSignature) point.getSignature();
|
|
||||||
Method currentMhd = signature.getMethod();
|
|
||||||
String currentMethodName = point.getTarget().getClass().getSimpleName() + "." + currentMhd.getName();
|
|
||||||
Log logs = currentMhd.getAnnotation(Log.class);
|
|
||||||
String code = logs.logType().getCode();
|
|
||||||
//操作日志
|
|
||||||
if (CommonConstant.LogType.OPERATE.getCode().equals(code)) {
|
|
||||||
operate(point, isSuccess, logs, currentMethodName);
|
|
||||||
} else if (CommonConstant.LogType.PAGEVIEW.getCode().equals(code)) {
|
|
||||||
// 浏览日志
|
|
||||||
pageView(point, logs, currentMethodName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pageView(JoinPoint point, Log logs, String currentMtdName) throws Exception {
|
|
||||||
HttpServletRequest request = UserUtils.getRequest();
|
|
||||||
String aceessIp = AccessUtil.getAccessIp(request);
|
|
||||||
String aceessUrl = AccessUtil.getAccessUrl(request);
|
|
||||||
String aceessSource = AccessUtil.getAccessSource(request);
|
|
||||||
String aceessDevice = AccessUtil.getAccessDevice(request);
|
|
||||||
String aceessBrowse = AccessUtil.getAccessBrowse(request);
|
|
||||||
//获取请求头的 iv_user
|
|
||||||
String ivUser = UserUtils.getIvUser();
|
|
||||||
TPfSysPvlog pvlog = new TPfSysPvlog();
|
|
||||||
pvlog.setUserId(StringUtil.notEmpty(ivUser) ? ivUser : "unknown");
|
|
||||||
pvlog.setUserName(StringUtil.notEmpty(ivUser) ? ivUser : "unknown");
|
|
||||||
pvlog.setBizId(getBusiId(point, logs));
|
|
||||||
pvlog.setBizType(currentMtdName);
|
|
||||||
pvlog.setAceessTitle(logs.busiType());
|
|
||||||
pvlog.setAceessIp(aceessIp);
|
|
||||||
pvlog.setAceessUrl(aceessUrl);
|
|
||||||
pvlog.setAceessTime(new Date());
|
|
||||||
pvlog.setAceessSource(aceessSource);
|
|
||||||
pvlog.setAceessDevice(aceessDevice);
|
|
||||||
pvlog.setAceessBrowse(aceessBrowse);
|
|
||||||
pvlog.setAppId(ObjectUtil.isNotEmpty(UserUtils.getTenantId())?UserUtils.getTenantId():"sys");
|
|
||||||
pvlog.setRemark(prefix + point.getSignature().getName());
|
|
||||||
try {
|
|
||||||
sysPvlogService.save(pvlog);
|
|
||||||
}catch (Exception e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作日志
|
|
||||||
*
|
|
||||||
* @param point
|
|
||||||
* @param isSuccess
|
|
||||||
* @param logs
|
|
||||||
*/
|
|
||||||
private void operate(JoinPoint point, boolean isSuccess, Log logs, String currentMethodName) throws Exception {
|
|
||||||
String ivUser = UserUtils.getIvUser();
|
|
||||||
String type = logs.type();
|
|
||||||
HttpServletRequest request = UserUtils.getRequest();
|
|
||||||
String aceessIp = AccessUtil.getAccessIp(request);
|
|
||||||
String aceessBrowse = AccessUtil.getAccessBrowse(request);
|
|
||||||
TPfSysOplog oplog = new TPfSysOplog();
|
|
||||||
oplog.setAceessIp(aceessIp);
|
|
||||||
oplog.setAceessBrowse(aceessBrowse);
|
|
||||||
oplog.setCreateTime(new Date());
|
|
||||||
oplog.setBizId(getBusiId(point, logs));
|
|
||||||
oplog.setBizType(currentMethodName);
|
|
||||||
String str = JSONUtil.toJsonStr(point.getArgs());
|
|
||||||
if (str.length() > 4000) {
|
|
||||||
str = StrUtil.sub(str, 0, 3900);
|
|
||||||
}
|
|
||||||
oplog.setContent(str);
|
|
||||||
oplog.setStatus(isSuccess ? CommonConstant.RESULT_SUCCESS : CommonConstant.RESULT_FAILED);
|
|
||||||
oplog.setType(type);
|
|
||||||
oplog.setUserId(StringUtil.notEmpty(ivUser) ? ivUser : "unknown");
|
|
||||||
oplog.setUserName(StringUtil.notEmpty(ivUser) ? ivUser : "unknown");
|
|
||||||
oplog.setRemark(prefix + point.getSignature().getName());
|
|
||||||
oplog.setAppId(ObjectUtil.isNotEmpty(UserUtils.getTenantId())?UserUtils.getTenantId():"sys");
|
|
||||||
try {
|
|
||||||
sysOplogService.save(oplog);
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSysId(Object[] objects) {
|
|
||||||
// 从请求参数中获取租户id
|
|
||||||
if (ObjectUtil.isNotEmpty(objects) && objects.length > 1) {
|
|
||||||
JSONObject jsonObject = JSONUtil.parseObj(objects[1]);
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonObject) && ObjectUtil.isNotEmpty(jsonObject.get("appId"))) {
|
|
||||||
return jsonObject.get("appId").toString();
|
|
||||||
} else {
|
|
||||||
return "sys";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "sys";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 正常执行
|
|
||||||
*
|
|
||||||
* @param point
|
|
||||||
*/
|
|
||||||
@AfterReturning("expCheckPoint()")
|
|
||||||
public void successLog(JoinPoint point) throws Exception {
|
|
||||||
log(point, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取BusiId
|
|
||||||
*
|
|
||||||
* @param point
|
|
||||||
* @param logs
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public String getBusiId(JoinPoint point, Log logs) throws Exception {
|
|
||||||
Object[] args = point.getArgs();
|
|
||||||
String busiId = "";
|
|
||||||
if(ObjectUtil.isNotEmpty(args)) {
|
|
||||||
if (args.length > 1) {
|
|
||||||
busiId = JSONUtil.toJsonStr(args[1]);
|
|
||||||
} else {
|
|
||||||
busiId = JSONUtil.toJsonStr(args[0]);
|
|
||||||
}
|
|
||||||
if (busiId.length() > 400) {
|
|
||||||
busiId = StrUtil.sub(busiId, 0, 399);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return busiId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package com.blueland.config;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm;
|
|
||||||
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author leijie.gao
|
|
||||||
* @since 2020-05-27
|
|
||||||
*/
|
|
||||||
public class Default2PreciseShardingAlgorithm implements PreciseShardingAlgorithm<String> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param targetTableNames sharding 逻辑表 分表规则
|
|
||||||
* @param shardingVal PreciseShardingValue(logicTableName=真实表, columnName=company_id, value=company_id_value)
|
|
||||||
* @return {{@link String}}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String doSharding(Collection<String> targetTableNames, PreciseShardingValue<String> shardingVal) {
|
|
||||||
/**
|
|
||||||
* tableNames 对应分片库中所有分片表的集合
|
|
||||||
* shardingValue 为分片属性,其中 logicTableName 为逻辑表,columnName 分片健(字段),value 为从 SQL 中解析出的分片健的值
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 取模算法,分片健 % 表数量
|
|
||||||
*/
|
|
||||||
Integer month = DateUtil.month(new Date()) + 1;
|
|
||||||
|
|
||||||
return "t_pf_sys_pvlog_" + month;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package com.blueland.config;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm;
|
|
||||||
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author leijie.gao
|
|
||||||
* @since 2020-05-27
|
|
||||||
*/
|
|
||||||
public class DefaultPreciseShardingAlgorithm implements PreciseShardingAlgorithm<String> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param targetTableNames sharding 逻辑表 分表规则
|
|
||||||
* @param shardingVal PreciseShardingValue(logicTableName=真实表, columnName=company_id, value=company_id_value)
|
|
||||||
* @return {{@link String}}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String doSharding(Collection<String> targetTableNames, PreciseShardingValue<String> shardingVal) {
|
|
||||||
/**
|
|
||||||
* tableNames 对应分片库中所有分片表的集合
|
|
||||||
* shardingValue 为分片属性,其中 logicTableName 为逻辑表,columnName 分片健(字段),value 为从 SQL 中解析出的分片健的值
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 取模算法,分片健 % 表数量
|
|
||||||
*/
|
|
||||||
Integer month = DateUtil.month(new Date()) + 1;
|
|
||||||
|
|
||||||
return "t_pf_sys_oplog_" + month;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
package com.blueland.config;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
|
||||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
|
||||||
import org.springframework.cache.interceptor.KeyGenerator;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
|
||||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
|
||||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "spring.redis")
|
|
||||||
public class RedisConfig extends CachingConfigurerSupport{
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private LettuceConnectionFactory lettuceConnectionFactory;
|
|
||||||
|
|
||||||
private String host;
|
|
||||||
private int port;
|
|
||||||
private int timeout;
|
|
||||||
private String password;
|
|
||||||
private int maxActive;
|
|
||||||
private int maxWait;
|
|
||||||
private int maxIdle;
|
|
||||||
private int minIdle;
|
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public KeyGenerator wiselyKeyGenerator(){
|
|
||||||
return new KeyGenerator() {
|
|
||||||
@Override
|
|
||||||
public Object generate(Object target, Method method, Object... params) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append(target.getClass().getName());
|
|
||||||
sb.append(method.getName());
|
|
||||||
for (Object obj : params) {
|
|
||||||
sb.append(obj.toString());
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RedisTemplate配置
|
|
||||||
*
|
|
||||||
* @param lettuceConnectionFactory
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public RedisTemplate<String, Object> redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) {
|
|
||||||
// 设置序列化
|
|
||||||
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
|
|
||||||
ObjectMapper om = new ObjectMapper();
|
|
||||||
om.setVisibility(PropertyAccessor.ALL, Visibility.ANY);
|
|
||||||
om.enableDefaultTyping(DefaultTyping.NON_FINAL);
|
|
||||||
jackson2JsonRedisSerializer.setObjectMapper(om);
|
|
||||||
// 配置redisTemplate
|
|
||||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<String, Object>();
|
|
||||||
redisTemplate.setConnectionFactory(lettuceConnectionFactory);
|
|
||||||
RedisSerializer<?> stringSerializer = new StringRedisSerializer();
|
|
||||||
// key序列化
|
|
||||||
redisTemplate.setKeySerializer(stringSerializer);
|
|
||||||
// value序列化
|
|
||||||
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
|
|
||||||
// Hash key序列化
|
|
||||||
redisTemplate.setHashKeySerializer(stringSerializer);
|
|
||||||
// Hash value序列化
|
|
||||||
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
|
|
||||||
redisTemplate.afterPropertiesSet();
|
|
||||||
return redisTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @Bean
|
|
||||||
// public CacheManager cacheManager(LettuceConnectionFactory factory) {
|
|
||||||
// // 配置序列化(缓存默认有效期 6小时)
|
|
||||||
// RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofHours(6));
|
|
||||||
// RedisCacheConfiguration redisCacheConfiguration = config.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer()))
|
|
||||||
// .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer()));
|
|
||||||
//
|
|
||||||
// // 以锁写入的方式创建RedisCacheWriter对象
|
|
||||||
// //RedisCacheWriter writer = RedisCacheWriter.lockingRedisCacheWriter(factory);
|
|
||||||
// // 创建默认缓存配置对象
|
|
||||||
// /* 默认配置,设置缓存有效期 1小时*/
|
|
||||||
// //RedisCacheConfiguration defaultCacheConfig = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofHours(1));
|
|
||||||
// /* 自定义配置test:demo 的超时时间为 5分钟*/
|
|
||||||
// RedisCacheManager cacheManager = RedisCacheManager.builder(RedisCacheWriter.lockingRedisCacheWriter(factory)).cacheDefaults(redisCacheConfiguration)
|
|
||||||
// .withInitialCacheConfigurations(singletonMap("test:demo", RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofMinutes(5)).disableCachingNullValues()))
|
|
||||||
// .transactionAware().build();
|
|
||||||
// return cacheManager;
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
@ -1,150 +0,0 @@
|
|||||||
package com.blueland.config;
|
|
||||||
|
|
||||||
|
|
||||||
import com.blueland.annotation.ApiVersion;
|
|
||||||
import com.blueland.enums.Version;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.Primary;
|
|
||||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
|
||||||
import org.springframework.plugin.core.OrderAwarePluginRegistry;
|
|
||||||
import org.springframework.plugin.core.PluginRegistry;
|
|
||||||
import springfox.documentation.RequestHandler;
|
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
|
||||||
import springfox.documentation.builders.PathSelectors;
|
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
|
||||||
import springfox.documentation.service.ApiInfo;
|
|
||||||
import springfox.documentation.service.Contact;
|
|
||||||
import springfox.documentation.spi.DocumentationType;
|
|
||||||
import springfox.documentation.spi.service.DocumentationPlugin;
|
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
|
||||||
import springfox.documentation.spring.web.plugins.DocumentationPluginsManager;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.StreamSupport;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swagger3Config
|
|
||||||
*
|
|
||||||
* @author bigtian
|
|
||||||
* @date 2021/4/16 16:50
|
|
||||||
*/
|
|
||||||
@Primary //自动装配时当出现多个Bean候选者时,被注解为@Primary的Bean将作为首选者,否则将抛出异常。(只对接口的多个实现生效)覆盖swagger自己的配置
|
|
||||||
@Configuration //定义配置类
|
|
||||||
//@EnableKnife4j //开启Knife4j
|
|
||||||
public class SwaggerDocumentationPluginsManager extends DocumentationPluginsManager {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<DocumentationPlugin> documentationPlugins() throws IllegalStateException {
|
|
||||||
List<DocumentationPlugin> plugins = registry().getPlugins();
|
|
||||||
ensureNoDuplicateGroups(plugins);
|
|
||||||
return plugins.isEmpty() ? Collections.singleton(this.defaultDocumentationPlugin()) : plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ensureNoDuplicateGroups(List<DocumentationPlugin> allPlugins) throws IllegalStateException {
|
|
||||||
Map<String, List<DocumentationPlugin>> plugins = allPlugins.stream().collect(Collectors.groupingBy((input) -> {
|
|
||||||
return Optional.ofNullable(input.getGroupName()).orElse("default");
|
|
||||||
}, LinkedHashMap::new, Collectors.toList()));
|
|
||||||
Iterable<String> duplicateGroups = plugins.entrySet().stream().filter((input) -> {
|
|
||||||
return (input.getValue()).size() > 1;
|
|
||||||
}).map(Map.Entry::getKey).collect(Collectors.toList());
|
|
||||||
if (StreamSupport.stream(duplicateGroups.spliterator(), false).count() > 0L) {
|
|
||||||
throw new IllegalStateException(String.format("Multiple Dockets with the same group name are not supported. The following duplicate groups were discovered. %s", String.join(",", duplicateGroups)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private DocumentationPlugin defaultDocumentationPlugin() {
|
|
||||||
return new Docket(DocumentationType.OAS_30);
|
|
||||||
}
|
|
||||||
|
|
||||||
private SwaggerPluginRegistry registry() {
|
|
||||||
List<Docket> list = new ArrayList<>();
|
|
||||||
list.add(createRestApi());
|
|
||||||
Version[] versions = Version.values();
|
|
||||||
if (versions.length > 0) {
|
|
||||||
for (Version version : versions) {
|
|
||||||
Docket docket = new Docket(DocumentationType.OAS_30)
|
|
||||||
// 指定构建api文档的详细信息的方法:apiInfo()
|
|
||||||
.apiInfo(apiInfo(version.getVersion()))
|
|
||||||
.groupName(version.getVersion())
|
|
||||||
.select()
|
|
||||||
.apis(requestHandler -> {
|
|
||||||
//获取rest上的注解
|
|
||||||
Optional<ApiVersion> controllerAnnotation = requestHandler.findControllerAnnotation(ApiVersion.class);
|
|
||||||
// 如果rest上有ApiVersion注解,则不扫描类中方法,否则扫描类中方法
|
|
||||||
if (!controllerAnnotation.isPresent()) {
|
|
||||||
return findMehotds(version, requestHandler);
|
|
||||||
}
|
|
||||||
boolean flag = Arrays.asList(controllerAnnotation.get().groups()).contains(version);
|
|
||||||
if (!flag) {
|
|
||||||
return findMehotds(version, requestHandler);
|
|
||||||
}
|
|
||||||
return flag;
|
|
||||||
})
|
|
||||||
.paths(PathSelectors.any())
|
|
||||||
.build();
|
|
||||||
list.add(docket);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new SwaggerPluginRegistry(list, new AnnotationAwareOrderComparator());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean findMehotds(Version version, RequestHandler requestHandler) {
|
|
||||||
Optional<ApiVersion> apiVersion = requestHandler.findAnnotation(ApiVersion.class);
|
|
||||||
if (!apiVersion.isPresent()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Arrays.asList(apiVersion.get().groups()).contains(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Docket createRestApi() {
|
|
||||||
return new Docket(DocumentationType.OAS_30)
|
|
||||||
.apiInfo(apiInfo())
|
|
||||||
.groupName("All API")
|
|
||||||
.select()
|
|
||||||
.apis(RequestHandlerSelectors.basePackage("com.blueland"))
|
|
||||||
.paths(PathSelectors.any())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ApiInfo apiInfo(String version) {
|
|
||||||
return new ApiInfoBuilder()
|
|
||||||
.contact(new Contact("sys", null, null))
|
|
||||||
// 设置页面标题
|
|
||||||
.title("USM接口文档")
|
|
||||||
.version(version)
|
|
||||||
// 设置接口描述
|
|
||||||
.description("通用框架接口")
|
|
||||||
// 设置联系方式
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ApiInfo apiInfo() {
|
|
||||||
return new ApiInfoBuilder()
|
|
||||||
.contact(new Contact("sys", null, null))
|
|
||||||
// 设置页面标题
|
|
||||||
.title("USM接口文档")
|
|
||||||
// 设置接口描述
|
|
||||||
.description("通用框架接口")
|
|
||||||
// 设置联系方式
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SwaggerPluginRegistry
|
|
||||||
*
|
|
||||||
* @author bigtian
|
|
||||||
* @date 2021/4/16 16:55
|
|
||||||
*/
|
|
||||||
class SwaggerPluginRegistry extends OrderAwarePluginRegistry<DocumentationPlugin, DocumentationType> implements PluginRegistry<DocumentationPlugin, DocumentationType> {
|
|
||||||
|
|
||||||
protected SwaggerPluginRegistry(List<Docket> plugins, Comparator<? super DocumentationPlugin> comparator) {
|
|
||||||
super(plugins, comparator);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DocumentationPlugin> getPlugins() {
|
|
||||||
return super.getPlugins();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
package com.blueland.constant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @auther xcy
|
|
||||||
* @create 2022-04-08 8:57
|
|
||||||
*/
|
|
||||||
public class CommonConstant {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日志类型
|
|
||||||
*/
|
|
||||||
public enum LogType {
|
|
||||||
OPERATE("操作日志", "operate"),
|
|
||||||
AUDIT("审计日志", "audit"),
|
|
||||||
BUSI("业务日志", "busi"),
|
|
||||||
INTERFACE("接口日志", "interface"),
|
|
||||||
PAGEVIEW("浏览日志", "pageview");
|
|
||||||
private String name;
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
LogType(String name, String code) {
|
|
||||||
this.name = name;
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(String code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对接结果
|
|
||||||
*/
|
|
||||||
public static String RESULT_SUCCESS = "success";//成功
|
|
||||||
public static String RESULT_FAILED = "failed";//失败
|
|
||||||
public static String RESULT_PROCESSED = "processed";//处理中
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作类型
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static final String SAVE = "save"; // 新增
|
|
||||||
|
|
||||||
public static final String UPDATE = "update"; // 修改
|
|
||||||
|
|
||||||
public static final String DELETE = "delete"; // 删除
|
|
||||||
|
|
||||||
public static final String SEARCH = "search"; // 查询
|
|
||||||
|
|
||||||
public static final String EXPORT = "export"; // 导入导出
|
|
||||||
|
|
||||||
public static final String JOB = "job"; // 暂停
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package com.blueland.constant;
|
|
||||||
|
|
||||||
public class Constant {
|
|
||||||
/**
|
|
||||||
* 组织编辑类型
|
|
||||||
*/
|
|
||||||
public static final String ORGWORKTYPE_OTHER = "other"; // 其他
|
|
||||||
public static final String ORGWORKTYPE_SELL = "sell"; // 销售组织
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户
|
|
||||||
*/
|
|
||||||
public static final String TENANTID_BIO = "BIO"; // 生科
|
|
||||||
public static final String TENANTID_IVD = "IVD"; // 医疗
|
|
||||||
|
|
||||||
public static final String QY = "QY"; // 启用
|
|
||||||
public static final String JY = "JY"; // 禁用
|
|
||||||
|
|
||||||
public static final String MAIN = "main"; // 主岗
|
|
||||||
public static final String PART_TIME = "parttime"; //兼岗
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ERP配置前缀
|
|
||||||
*/
|
|
||||||
public static final String ERP = "ERP_";
|
|
||||||
/**
|
|
||||||
* 部门配置前缀
|
|
||||||
*/
|
|
||||||
public static final String ORG_APP = "ORG_APP";
|
|
||||||
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
package com.blueland.constant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: redis定义key
|
|
||||||
* @author: bigTian
|
|
||||||
* @create: 2021-11-18 09:28
|
|
||||||
*/
|
|
||||||
public class RedisConstant {
|
|
||||||
/**
|
|
||||||
* 数据字典
|
|
||||||
*/
|
|
||||||
public static final String SYS_DICT_CACHE = "crm:dict:cache";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通配符
|
|
||||||
*/
|
|
||||||
public static final String WILDCARD = "*";
|
|
||||||
/**
|
|
||||||
* 分割符
|
|
||||||
*/
|
|
||||||
public static final String DIVISION = ":";
|
|
||||||
/**
|
|
||||||
* 部门
|
|
||||||
*/
|
|
||||||
public static final String SYS_DEPT = "SYS:DEPT";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 任岗编码 -> 员工信息
|
|
||||||
*/
|
|
||||||
public static final String SYS_STAFF = "SYS:STAFF";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户id:菜单类型type:菜单id -> 菜单实体
|
|
||||||
*/
|
|
||||||
public static final String SYS_MENU = "SYS:MENU";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* usm redis前缀
|
|
||||||
*/
|
|
||||||
public static final String SYS = "SYS";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典key
|
|
||||||
*/
|
|
||||||
public static final String SYS_DICT = "SYS:DICT";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 角色key
|
|
||||||
*/
|
|
||||||
public static final String SYS_ROLE = "SYS:ROLE";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户id:角色id -> List<菜单redisKey(租户id:菜单类型type:菜单id)>
|
|
||||||
*/
|
|
||||||
public static final String SYS_MENU_ID = "SYS:MENU_ID";
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package com.blueland.constant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @auther xcy
|
|
||||||
* @create 2022-05-25 10:03
|
|
||||||
*/
|
|
||||||
public class ResponseConstant {
|
|
||||||
public static final String RESULT_CODE_SUCCESS_MSG = "操作成功!";
|
|
||||||
public static final int RESULT_CODE_SUCCESS_CODE = 200;
|
|
||||||
public static final int RESULT_CODE_ERROR_CODE = 400;
|
|
||||||
public static final int RESULT_SERVER_ERR_CODE = 500;
|
|
||||||
}
|
|
@ -1,263 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import cn.hutool.http.useragent.Browser;
|
|
||||||
import cn.hutool.http.useragent.UserAgent;
|
|
||||||
import cn.hutool.http.useragent.UserAgentUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class AccessUtil {
|
|
||||||
/**
|
|
||||||
* 获取当前网络ip
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getAccessIp2(HttpServletRequest request) {
|
|
||||||
String ipAddress = request.getHeader("x-forwarded-for");
|
|
||||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
||||||
ipAddress = request.getHeader("Proxy-Client-IP");
|
|
||||||
}
|
|
||||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
||||||
ipAddress = request.getHeader("WL-Proxy-Client-IP");
|
|
||||||
}
|
|
||||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
||||||
ipAddress = request.getRemoteAddr();
|
|
||||||
if (ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")) {
|
|
||||||
//根据网卡取本机配置的IP
|
|
||||||
InetAddress inet = null;
|
|
||||||
try {
|
|
||||||
inet = InetAddress.getLocalHost();
|
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
ipAddress = inet.getHostAddress();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
|
|
||||||
//"***.***.***.***".length() = 15
|
|
||||||
if (ipAddress != null && ipAddress.length() > 15) {
|
|
||||||
if (ipAddress.indexOf(",") > 0) {
|
|
||||||
ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ipAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getAccessIp(HttpServletRequest request) {
|
|
||||||
String ip = request.getHeader("x-forwarded-for");
|
|
||||||
if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) {
|
|
||||||
// 多次反向代理后会有多个ip值,第一个ip才是真实ip
|
|
||||||
if (ip.indexOf(",") != -1) {
|
|
||||||
ip = ip.split(",")[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("X-Forwarded-For");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("Proxy-Client-IP");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_X_FORWARDED");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_X_CLUSTER_CLIENT_IP");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_CLIENT_IP");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_FORWARDED_FOR");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_FORWARDED");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_VIA");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("REMOTE_ADDR");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("X-Real-IP");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getRemoteAddr();
|
|
||||||
}
|
|
||||||
if (ip.equals("0:0:0:0:0:0:0:1")) {
|
|
||||||
ip = "本地";
|
|
||||||
}
|
|
||||||
return ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取网页url
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getAccessUrl(HttpServletRequest request) {
|
|
||||||
String url = "";
|
|
||||||
url = request.getScheme() + "://" + request.getServerName()
|
|
||||||
+ ":" + request.getServerPort()
|
|
||||||
+ request.getServletPath();
|
|
||||||
if (request.getQueryString() != null) {
|
|
||||||
url += "?" + request.getQueryString();
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取网页标题
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getAccessTitle(HttpServletRequest request){
|
|
||||||
//获取htmlUrl网址网页的源码
|
|
||||||
String htmlSource = getHtmlSource(getAccessUrl(request));
|
|
||||||
if (StringUtil.isEmpty(htmlSource)){
|
|
||||||
return "该url为接口调用,无标题";
|
|
||||||
}
|
|
||||||
return getTitle(htmlSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取访问来源
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getAccessSource(HttpServletRequest request){
|
|
||||||
/**
|
|
||||||
* android : 所有android设备
|
|
||||||
* mac os : iphone ipad
|
|
||||||
* windows phone:Nokia等windows系统的手机
|
|
||||||
*/
|
|
||||||
String[] deviceArray = new String[]{"android","mac os","windows phone"};
|
|
||||||
//获取http头信息
|
|
||||||
String requestHeader = request.getHeader("User-Agent");
|
|
||||||
if (requestHeader == null){
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
requestHeader = requestHeader.toLowerCase();
|
|
||||||
for(int i=0;i<deviceArray.length;i++){
|
|
||||||
if(requestHeader.indexOf(deviceArray[i])>0){
|
|
||||||
return "APP";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "PC";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取访问设备
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getAccessDevice(HttpServletRequest request){
|
|
||||||
String agent= request.getHeader("User-Agent");
|
|
||||||
if (StringUtil.isEmpty(agent)){
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
//安卓系统
|
|
||||||
if(agent.contains("Android")){
|
|
||||||
return "android";
|
|
||||||
}else if(agent.contains("iPhone")||agent.contains("iPod")||agent.contains("iPad")){
|
|
||||||
return "ios";
|
|
||||||
}
|
|
||||||
return "Others";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取浏览器信息
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getAccessBrowse(HttpServletRequest request){
|
|
||||||
String agent = request.getHeader("User-Agent");
|
|
||||||
if (StringUtil.isEmpty(agent)){
|
|
||||||
return "type:unknown;version:unknown";
|
|
||||||
}
|
|
||||||
//解析agent字符串
|
|
||||||
UserAgent userAgent = UserAgentUtil.parse(agent);
|
|
||||||
//获取浏览器对象
|
|
||||||
Browser browser = userAgent.getBrowser();
|
|
||||||
return "type:"+browser.getName()+";version:"+userAgent.getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据网址返回网页的源码
|
|
||||||
* @param htmlUrl
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getHtmlSource(String htmlUrl){
|
|
||||||
URL url;
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
try{
|
|
||||||
url = new URL(htmlUrl);
|
|
||||||
//读取网页全部内容
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), "utf-8"));
|
|
||||||
String temp;
|
|
||||||
while ((temp = in.readLine()) != null)
|
|
||||||
{
|
|
||||||
sb.append(temp);
|
|
||||||
}
|
|
||||||
in.close();
|
|
||||||
}catch (MalformedURLException e) {
|
|
||||||
// log.error("URL格式有问题!");
|
|
||||||
}catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 从html源码(字符串)中获取标题
|
|
||||||
* @param htmlSource
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getTitle(String htmlSource){
|
|
||||||
List<String> list = new ArrayList<String>();
|
|
||||||
String title = "";
|
|
||||||
//Pattern pa = Pattern.compile("<title>.*?</title>", Pattern.CANON_EQ);也可以
|
|
||||||
//源码中标题正则表达式
|
|
||||||
Pattern pa = Pattern.compile("<title>.*?</title>");
|
|
||||||
Matcher ma = pa.matcher(htmlSource);
|
|
||||||
while (ma.find())//寻找符合el的字串
|
|
||||||
{
|
|
||||||
list.add(ma.group());//将符合el的字串加入到list中
|
|
||||||
}
|
|
||||||
for (int i = 0; i < list.size(); i++)
|
|
||||||
{
|
|
||||||
title = title + list.get(i);
|
|
||||||
}
|
|
||||||
return outTag(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 去掉html源码中的标签
|
|
||||||
* @param s
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String outTag(String s)
|
|
||||||
{
|
|
||||||
return s.replaceAll("<.*?>", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,177 +0,0 @@
|
|||||||
//package com.blueland.core.util;
|
|
||||||
//
|
|
||||||
//import java.security.interfaces.RSAKey;
|
|
||||||
//import java.time.Duration;
|
|
||||||
//import java.time.Instant;
|
|
||||||
//import java.util.Map;
|
|
||||||
//
|
|
||||||
//import org.apache.http.HttpHeaders;
|
|
||||||
//import org.apache.http.client.methods.HttpGet;
|
|
||||||
//import org.apache.http.client.methods.HttpPost;
|
|
||||||
//import org.apache.http.entity.StringEntity;
|
|
||||||
//import org.apache.http.message.BasicHeader;
|
|
||||||
//import org.apache.http.protocol.HTTP;
|
|
||||||
//import com.alibaba.fastjson.JSONArray;
|
|
||||||
//import gateway.api.*;
|
|
||||||
//
|
|
||||||
//import lombok.extern.slf4j.Slf4j;
|
|
||||||
//
|
|
||||||
//@Slf4j
|
|
||||||
//// @Service
|
|
||||||
//public class Apigateway {
|
|
||||||
//
|
|
||||||
// // KEY
|
|
||||||
// private static final String TestAppToken = "5Zaex1VJp1LiXHV54bvoQtam3SAcKbbL";
|
|
||||||
//
|
|
||||||
// // 应用RSA私钥(PEM格式)
|
|
||||||
// private final String TestPrivatePem = "-----BEGIN RSA PRIVATE KEY-----\n"
|
|
||||||
// + "MIICXAIBAAKBgQDYjFY9ceLar5FJqtkey3YqWnp5jyjulqRj1L4wM8RFqJ68LdqQ\n"
|
|
||||||
// + "q3bkjg/EROJIrqFH+QIcql2X4+XDxHjxElJm/rbr4aVJVWP96gd2dlQE42rijAyh\n"
|
|
||||||
// + "Sfe+1pOaWoHtO98qbs75wt7WqhBhqfApMLJHK5gtx2y5R/Klfcau2X/z1wIDAQAB\n"
|
|
||||||
// + "AoGAfSP0foO+9mO5UVojKPGpcuZgmrkJjX+OtoZt9kskJKFCQjs5cJs2FPSn1eN8\n"
|
|
||||||
// + "5UXNvFsBRnGJrsorsIts3NuatAw1TgmR2l4nYaQAQBzik2l+bPX9cn39DZwD8xRt\n"
|
|
||||||
// + "mB0kgwj0S4Pf2tC2hKRYEDGNUkRBTsNgkDDQyTOfP4298UkCQQD0K+vcrMv3idVa\n"
|
|
||||||
// + "TDO1Ihd7xbUi3Fob7OHxLWudaDZ7T/jnaMcsbJooJHD1WKLOEfCd63A0GviepbvH\n"
|
|
||||||
// + "lZGa+6Z1AkEA4wnYjwar4o4Yjy2OJEbi6DDBsJQ2h0bbBfSfmunXBEjd/GVgZSya\n"
|
|
||||||
// + "T6LOu8QBUJ2fPY7e1zxlTFu/8UCzRtIfmwJAZHD42lMeqFpDsJxuHNHEVT70Dz4T\n"
|
|
||||||
// + "ty8PlpV3kk2/M6SnIBJC9GxMUb0D1nk6p4hLsbqa8mQx55kHkMdfGSDxzQJBAJPJ\n"
|
|
||||||
// + "QPI5AYIDxPDOUoxCqElEE5CBqcz8zm1eAtawCIp9dCJrSwgQtJHKBJAs0j5Lm/BS\n"
|
|
||||||
// + "I7QvWDEQOC0uVIRxGqkCQC5kGzQqjdw0F8xsJcqdzTt9X29VdNrwJWl0IdBK8gXt\n"
|
|
||||||
// + "5HYkBZa3PSaeDz+YpVtYUt5HO25VbBM0PTZEpkuezLU=\n" + "-----END RSA PRIVATE KEY-----";
|
|
||||||
//
|
|
||||||
// private volatile static Apigateway singleton = new Apigateway();
|
|
||||||
//
|
|
||||||
// private Apigateway() {
|
|
||||||
// loadJwtContext();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static Apigateway getInstance() {
|
|
||||||
// return singleton;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private JwtContext jwtContext;
|
|
||||||
// private Instant createTime = Instant.now();
|
|
||||||
//
|
|
||||||
// private void loadJwtContext() {
|
|
||||||
// jwtContext = JwtContext.create(TestAppToken, (RSAKey) RSAUtils.parsePrivateKeyFromPEM(TestPrivatePem), 1200);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private JwtToken createJwtToken() {
|
|
||||||
// // 生成的jwt令牌可多次使用,为安全起见请设置令牌过期时间。
|
|
||||||
// Instant currDate = Instant.now();
|
|
||||||
// if (Duration.between(currDate, createTime).getSeconds() >= 1100) {
|
|
||||||
// loadJwtContext();
|
|
||||||
// }
|
|
||||||
// JwtToken jwt_token = jwtContext.createJwtToken();
|
|
||||||
//// log.error("token:"+jwt_token.toAuthorizationString());
|
|
||||||
// return jwt_token;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private final static String APPLICATION_JSON = "application/json";
|
|
||||||
// public static final String CHARSET = "UTF-8";
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * HTTP Get 获取内容
|
|
||||||
// *
|
|
||||||
// * @param url请求的url地址
|
|
||||||
// * ?之前的地址
|
|
||||||
// * @param params请求的参数
|
|
||||||
// * @param charset编码格式
|
|
||||||
// * @return 页面内容
|
|
||||||
// */
|
|
||||||
// public String sendGet(String url, Map<String, Object> params) {
|
|
||||||
// String apiUrl = url;
|
|
||||||
// if (params != null && params.size() > 0) {
|
|
||||||
// StringBuffer param = new StringBuffer();
|
|
||||||
// int i = 0;
|
|
||||||
// for (String key : params.keySet()) {
|
|
||||||
// if (i == 0)
|
|
||||||
// param.append("?");
|
|
||||||
// else
|
|
||||||
// param.append("&");
|
|
||||||
// param.append(key).append("=").append(params.get(key));
|
|
||||||
// i++;
|
|
||||||
// }
|
|
||||||
// apiUrl += param;
|
|
||||||
// }
|
|
||||||
// HttpGet httpget = null;
|
|
||||||
//
|
|
||||||
// String result = null;
|
|
||||||
// try {
|
|
||||||
//
|
|
||||||
// httpget = new HttpGet(apiUrl);
|
|
||||||
// httpget.addHeader(HttpHeaders.AUTHORIZATION, createJwtToken().toAuthorizationString());
|
|
||||||
// if (ViaGatewayUtlis.isAppRequestViaGateway()) {
|
|
||||||
// ViaGatewayUtlis.copyRequestChainForHttpClient(httpget);
|
|
||||||
// } else {
|
|
||||||
// ViaGatewayUtlis.firstRequestChainForHttpClient(httpget);
|
|
||||||
// }
|
|
||||||
// result = HttpClientHelper.requestExecute(httpget, HttpClientHelper.RESPONSE_STRING_EXTRACTOR);
|
|
||||||
//
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// log.error("apigateway->sendget->请求出错: " + e.getMessage(), e);
|
|
||||||
// }
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * HTTP Post 获取内容
|
|
||||||
// *
|
|
||||||
// * @param url请求的url地址
|
|
||||||
// * ?之前的地址
|
|
||||||
// * @param params请求的参数
|
|
||||||
// * @param charset编码格式
|
|
||||||
// * @return 页面内容
|
|
||||||
// */
|
|
||||||
// public String sendPost(String url, Map<String, Object> params) {
|
|
||||||
// String param = JSONArray.toJSON(params).toString();
|
|
||||||
//
|
|
||||||
// return post(url, param);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String post(String url, String postData) {
|
|
||||||
// String result = "";
|
|
||||||
// HttpPost httppost = null;
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
//
|
|
||||||
// httppost = new HttpPost(url);
|
|
||||||
// httppost.addHeader(HttpHeaders.AUTHORIZATION, createJwtToken().toAuthorizationString());
|
|
||||||
// if (ViaGatewayUtlis.isAppRequestViaGateway()) {
|
|
||||||
// ViaGatewayUtlis.copyRequestChainForHttpClient(httppost);
|
|
||||||
// } else {
|
|
||||||
// ViaGatewayUtlis.firstRequestChainForHttpClient(httppost);
|
|
||||||
// }
|
|
||||||
// httppost.addHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON);
|
|
||||||
// StringEntity entity = new StringEntity(postData, "UTF-8");
|
|
||||||
// entity.setContentType(APPLICATION_JSON);
|
|
||||||
// entity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON));
|
|
||||||
// httppost.setEntity(entity);
|
|
||||||
// result = HttpClientHelper.requestExecute(httppost, HttpClientHelper.RESPONSE_STRING_EXTRACTOR);
|
|
||||||
// } catch (Exception ex) {
|
|
||||||
// log.error("apigateway->sendget->请求出错: " + ex.getMessage(), ex);
|
|
||||||
// }
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void main(String[] args) {
|
|
||||||
// String url="https://crm.vazyme.com/blueland-plateform-render/staff/substaffs?staffType=VAZYME&orgId=40280c8164f445ff0164f47266dd005b&staffStatus=QY&queryStaff=&pageNum=1&pageSize=10";
|
|
||||||
// String result="";
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// result=Apigateway.getInstance().sendGet(url, null);
|
|
||||||
// log.error("result:"+result);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// log.error("请求出错:" + e.getMessage(), e);
|
|
||||||
// }
|
|
||||||
//// try {
|
|
||||||
//// log.info(HttpClientHelper.requestExecute(new HttpGet("http://www.baidu.com"),
|
|
||||||
//// HttpClientHelper.RESPONSE_STRING_EXTRACTOR));
|
|
||||||
//// } catch (Exception e) {
|
|
||||||
//// log.error("请求出错: " + e.getMessage(), e);
|
|
||||||
//// } finally {
|
|
||||||
//// HttpClientHelper.destorySingletonHttpClientObjects();
|
|
||||||
//// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
@ -1,66 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.copier.BeanCopier;
|
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* bean深拷贝工具
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
public class BeanCopyUtils {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单对象基于class创建拷贝
|
|
||||||
*
|
|
||||||
* @param source 数据来源实体
|
|
||||||
* @param copyOptions copy条件
|
|
||||||
* @param desc 描述对象 转换后的对象
|
|
||||||
* @return desc
|
|
||||||
*/
|
|
||||||
public static <T, V> V oneCopy(T source, CopyOptions copyOptions, Class<V> desc) {
|
|
||||||
V v = ReflectUtil.newInstanceIfPossible(desc);
|
|
||||||
return oneCopy(source, copyOptions, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单对象基于对象创建拷贝
|
|
||||||
*
|
|
||||||
* @param source 数据来源实体
|
|
||||||
* @param copyOptions copy条件
|
|
||||||
* @param desc 转换后的对象
|
|
||||||
* @return desc
|
|
||||||
*/
|
|
||||||
public static <T, V> V oneCopy(T source, CopyOptions copyOptions, V desc) {
|
|
||||||
if (ObjectUtil.isNull(source)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return BeanCopier.create(source, desc, copyOptions).copy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表对象基于class创建拷贝
|
|
||||||
*
|
|
||||||
* @param sourceList 数据来源实体列表
|
|
||||||
* @param copyOptions copy条件
|
|
||||||
* @param desc 描述对象 转换后的对象
|
|
||||||
* @return desc
|
|
||||||
*/
|
|
||||||
public static <T, V> List<V> listCopy(List<T> sourceList, CopyOptions copyOptions, Class<V> desc) {
|
|
||||||
if (ObjectUtil.isNull(sourceList)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (CollUtil.isEmpty(sourceList)) {
|
|
||||||
return CollUtil.newArrayList();
|
|
||||||
}
|
|
||||||
return sourceList.stream()
|
|
||||||
.map(source -> oneCopy(source, copyOptions, desc))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.springframework.ui.freemarker.FreeMarkerConfigurationFactory;
|
|
||||||
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
|
|
||||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
|
||||||
|
|
||||||
import freemarker.template.Template;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class FreemarkerUtil {
|
|
||||||
|
|
||||||
static FreeMarkerConfigurer result = new FreeMarkerConfigurer();
|
|
||||||
static {
|
|
||||||
initFreemarkerConfig();
|
|
||||||
}
|
|
||||||
public static void initFreemarkerConfig() {
|
|
||||||
try {
|
|
||||||
FreeMarkerConfigurationFactory factory = new FreeMarkerConfigurationFactory();
|
|
||||||
factory.setTemplateLoaderPaths("classpath:/ftl/");
|
|
||||||
factory.setDefaultEncoding("UTF-8");
|
|
||||||
freemarker.template.Configuration configuration = factory.createConfiguration();
|
|
||||||
configuration.setClassicCompatible(true);
|
|
||||||
result.setConfiguration(configuration);
|
|
||||||
Properties settings = new Properties();
|
|
||||||
settings.put("template_update_delay", "0");
|
|
||||||
settings.put("default_encoding", "UTF-8");
|
|
||||||
settings.put("number_format", "0.##########");
|
|
||||||
settings.put("datetime_format", "yyyy-MM-dd HH:mm:ss");
|
|
||||||
settings.put("classic_compatible", true);
|
|
||||||
settings.put("template_exception_handler", "ignore");
|
|
||||||
result.setFreemarkerSettings(settings);
|
|
||||||
}
|
|
||||||
catch(Exception ex) {
|
|
||||||
// log.error("initFreemarkerConfig====",ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String processTemplateString(String templateName,Map model) {
|
|
||||||
try {
|
|
||||||
Template tpl = result.getConfiguration().getTemplate(templateName);
|
|
||||||
return FreeMarkerTemplateUtils.processTemplateIntoString(tpl, model);
|
|
||||||
}catch(Exception e) {
|
|
||||||
// log.error("processTemplateString====",e);
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
public class HashUtil {
|
|
||||||
|
|
||||||
public static int rsHash(String value) {
|
|
||||||
int one = 378551;
|
|
||||||
int two = 63689;
|
|
||||||
int hash = 0;
|
|
||||||
for (int i = 0; i < value.length(); i++) {
|
|
||||||
hash = hash * two + value.charAt(i);
|
|
||||||
two = two * one;
|
|
||||||
}
|
|
||||||
return (hash & 0x7FFFFFFF);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,124 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.springframework.http.HttpEntity;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpMethod;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class HttpUtils {
|
|
||||||
|
|
||||||
|
|
||||||
private static HttpUtils instance;
|
|
||||||
|
|
||||||
private RestTemplate restTemplate = new RestTemplate();
|
|
||||||
|
|
||||||
private HttpUtils() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HttpUtils getInstance() {
|
|
||||||
if (null == instance) {
|
|
||||||
instance = new HttpUtils();
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> T postForObject(String url, Object requestParameter,
|
|
||||||
Map<String, String> requestHeaders, Class<T> responseType,String authorization) {
|
|
||||||
String result = exchange(url, HttpMethod.POST, requestParameter, requestHeaders, authorization);
|
|
||||||
|
|
||||||
return JsonUtil.convertJsonStrToBean(result, responseType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> List<T> postForList(String url, Object requestParameter,
|
|
||||||
Map<String, String> requestHeaders, Class<T> responseType,String authorization) {
|
|
||||||
String result = exchange(url, HttpMethod.POST, requestParameter, requestHeaders, authorization);
|
|
||||||
|
|
||||||
return JsonUtil.convertJsonStrToList(result, responseType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> T putForObject(String url, Object requestParameter,
|
|
||||||
Map<String, String> requestHeaders, Class<T> responseType,String authorization) {
|
|
||||||
String result = exchange(url, HttpMethod.PUT, requestParameter, requestHeaders, authorization);
|
|
||||||
|
|
||||||
return JsonUtil.convertJsonStrToBean(result, responseType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> T getForObject(String url, Map<String, String> requestHeaders, Class<T> responseType,String authorization) {
|
|
||||||
String result = exchange(url, HttpMethod.GET, null, requestHeaders, authorization);
|
|
||||||
|
|
||||||
return JsonUtil.convertJsonStrToBean(result, responseType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> List<T> getForList(String url, Map<String, String> requestHeaders,
|
|
||||||
Class<T> responseType,String authorization) {
|
|
||||||
String result = exchange(url, HttpMethod.GET, null, requestHeaders, authorization);
|
|
||||||
|
|
||||||
return JsonUtil.convertJsonStrToList(result, responseType);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String exchange(String url, HttpMethod httpMethod, Object requestParameter,
|
|
||||||
Map<String, String> requestHeaders,String authorization) {
|
|
||||||
String result = "";
|
|
||||||
HttpHeaders httpHeaders = new HttpHeaders();
|
|
||||||
ensureDefaultHeader(httpMethod, httpHeaders);
|
|
||||||
if (null != requestHeaders) {
|
|
||||||
for (Entry<String, String> entry : requestHeaders.entrySet()) {
|
|
||||||
httpHeaders.add(entry.getKey(), entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(StringUtil.notEmpty(authorization)) {
|
|
||||||
httpHeaders.add(HttpHeaders.AUTHORIZATION, "Bearer "+ authorization);
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpEntity<Object> httpEntity;
|
|
||||||
if (null != requestParameter) {
|
|
||||||
httpEntity = new HttpEntity<Object>(requestParameter, httpHeaders);
|
|
||||||
} else {
|
|
||||||
httpEntity = new HttpEntity<Object>(httpHeaders);
|
|
||||||
}
|
|
||||||
//System.setProperty("javax.net.debug", "all");
|
|
||||||
System.out.println("url:"+url);
|
|
||||||
if(url.startsWith("https://")) {
|
|
||||||
// log.debug("https start,url=" + url);
|
|
||||||
restTemplate = new RestTemplate(new HttpsClientRequestFactory());
|
|
||||||
result = restTemplate.exchange(url, httpMethod, httpEntity, String.class).getBody();
|
|
||||||
// log.debug("https end,url=" + url);
|
|
||||||
}else {
|
|
||||||
// log.debug("http start,url=" + url);
|
|
||||||
restTemplate = new RestTemplate();
|
|
||||||
result = restTemplate.exchange(url, httpMethod, httpEntity, String.class)
|
|
||||||
.getBody();
|
|
||||||
// log.debug("http end,url=" + url);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ensureDefaultHeader(HttpMethod httpMethod, HttpHeaders httpHeaders) {
|
|
||||||
if (HttpMethod.POST == httpMethod) {
|
|
||||||
httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String []args){
|
|
||||||
System.out.println("test");
|
|
||||||
Map<String, String> requestHeaders= new HashMap(1);
|
|
||||||
requestHeaders.put(HttpHeaders.AUTHORIZATION, "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCQ0FuMkNIRGtvU0RKdjdJcDBrMFdqVkhVUm85NElTRiJ9.zzJtS7TYaaLy-VIANMU96SOw2r9driz-0Qxy-To9ko8");
|
|
||||||
// String url2 = "https://crm.vazyme.com/blueland-plateform-render/role/BIO/role/leader/users/luob";
|
|
||||||
String url2 = "http://47.100.56.159:38081/blueland-plateform-render/role/BIO/role/leader/users/luob";
|
|
||||||
// String res = getInstance().getForObject(url2, requestHeaders, String.class,"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCQ0FuMkNIRGtvU0RKdjdJcDBrMFdqVkhVUm85NElTRiJ9.zzJtS7TYaaLy-VIANMU96SOw2r9driz-0Qxy-To9ko8");
|
|
||||||
String res = getInstance().getForObject(url2, requestHeaders, String.class,"");
|
|
||||||
System.out.println(res);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,130 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.Socket;
|
|
||||||
|
|
||||||
import javax.net.ssl.HostnameVerifier;
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import javax.net.ssl.SSLSession;
|
|
||||||
import javax.net.ssl.SSLSocket;
|
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
|
||||||
import javax.net.ssl.TrustManager;
|
|
||||||
|
|
||||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 声明:此代码摘录自https://blog.csdn.net/wltsysterm/article/details/80977455
|
|
||||||
* 声明:关于Socket的相关知识,本人会在后面的闲暇时间进行学习整理,请持续关注博客更新
|
|
||||||
*
|
|
||||||
* @author JustryDeng
|
|
||||||
* @DATE 2018年9月8日 下午4:34:02
|
|
||||||
*/
|
|
||||||
public class HttpsClientRequestFactory extends SimpleClientHttpRequestFactory {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void prepareConnection(HttpURLConnection connection, String httpMethod) {
|
|
||||||
try {
|
|
||||||
if (!(connection instanceof HttpsURLConnection)) {
|
|
||||||
throw new RuntimeException("An instance of HttpsURLConnection is expected");
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpsURLConnection httpsConnection = (HttpsURLConnection) connection;
|
|
||||||
|
|
||||||
TrustManager[] trustAllCerts = new TrustManager[]{ new MyX509TrustManager()};
|
|
||||||
|
|
||||||
System.setProperty("https.protocols", "TLSv1.2");
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
|
|
||||||
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
|
|
||||||
httpsConnection.setSSLSocketFactory(new MyCustomSSLSocketFactory(sslContext.getSocketFactory()));
|
|
||||||
/* SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
|
|
||||||
sslContext.init(null,null,null);
|
|
||||||
SSLContext.setDefault(sslContext); */
|
|
||||||
|
|
||||||
httpsConnection.setHostnameVerifier(new HostnameVerifier() {
|
|
||||||
@Override
|
|
||||||
public boolean verify(String s, SSLSession sslSession) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
super.prepareConnection(httpsConnection, httpMethod);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We need to invoke sslSocket.setEnabledProtocols(new String[] {"SSLv3"});
|
|
||||||
* see http://www.oracle.com/technetwork/java/javase/documentation/cve-2014-3566-2342133.html (Java 8 section)
|
|
||||||
*/
|
|
||||||
// SSLSocketFactory用于创建 SSLSockets
|
|
||||||
private static class MyCustomSSLSocketFactory extends SSLSocketFactory {
|
|
||||||
|
|
||||||
private final SSLSocketFactory delegate;
|
|
||||||
|
|
||||||
public MyCustomSSLSocketFactory(SSLSocketFactory delegate) {
|
|
||||||
this.delegate = delegate;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回默认启用的密码套件。除非一个列表启用,对SSL连接的握手会使用这些密码套件。
|
|
||||||
// 这些默认的服务的最低质量要求保密保护和服务器身份验证
|
|
||||||
@Override
|
|
||||||
public String[] getDefaultCipherSuites() {
|
|
||||||
return delegate.getDefaultCipherSuites();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回的密码套件可用于SSL连接启用的名字
|
|
||||||
@Override
|
|
||||||
public String[] getSupportedCipherSuites() {
|
|
||||||
return delegate.getSupportedCipherSuites();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Socket createSocket(final Socket socket, final String host, final int port,
|
|
||||||
final boolean autoClose) throws IOException {
|
|
||||||
final Socket underlyingSocket = delegate.createSocket(socket, host, port, autoClose);
|
|
||||||
return overrideProtocol(underlyingSocket);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Socket createSocket(final String host, final int port) throws IOException {
|
|
||||||
final Socket underlyingSocket = delegate.createSocket(host, port);
|
|
||||||
return overrideProtocol(underlyingSocket);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Socket createSocket(final String host, final int port, final InetAddress localAddress,
|
|
||||||
final int localPort) throws
|
|
||||||
IOException {
|
|
||||||
final Socket underlyingSocket = delegate.createSocket(host, port, localAddress, localPort);
|
|
||||||
return overrideProtocol(underlyingSocket);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Socket createSocket(final InetAddress host, final int port) throws IOException {
|
|
||||||
final Socket underlyingSocket = delegate.createSocket(host, port);
|
|
||||||
return overrideProtocol(underlyingSocket);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Socket createSocket(final InetAddress host, final int port, final InetAddress localAddress,
|
|
||||||
final int localPort) throws
|
|
||||||
IOException {
|
|
||||||
final Socket underlyingSocket = delegate.createSocket(host, port, localAddress, localPort);
|
|
||||||
return overrideProtocol(underlyingSocket);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Socket overrideProtocol(final Socket socket) {
|
|
||||||
if (!(socket instanceof SSLSocket)) {
|
|
||||||
throw new RuntimeException("An instance of SSLSocket is expected");
|
|
||||||
}
|
|
||||||
((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1"});
|
|
||||||
return socket;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,197 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class IPWhiteListUtil {
|
|
||||||
|
|
||||||
// IP的正则
|
|
||||||
private static Pattern pattern = Pattern
|
|
||||||
.compile("(1\\d{1,2}|2[0-4]\\d|25[0-5]|\\d{1,2})\\." + "(1\\d{1,2}|2[0-4]\\d|25[0-5]|\\d{1,2})\\."
|
|
||||||
+ "(1\\d{1,2}|2[0-4]\\d|25[0-5]|\\d{1,2})\\." + "(1\\d{1,2}|2[0-4]\\d|25[0-5]|\\d{1,2})");
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* getAvaliIpList:(根据IP白名单设置获取可用的IP列表).
|
|
||||||
*
|
|
||||||
* @date 2017-4-17 下午02:50:20
|
|
||||||
* @param ipConfig
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static Set<String> getAvaliIpList(String allowIp) {
|
|
||||||
|
|
||||||
Set<String> ipList = new HashSet<String>();
|
|
||||||
for (String allow : allowIp.replaceAll("\\s", "").split(";")) {
|
|
||||||
if (allow.indexOf("*") > -1) {
|
|
||||||
String[] ips = allow.split("\\.");
|
|
||||||
String[] from = new String[] { "0", "0", "0", "0" };
|
|
||||||
String[] end = new String[] { "255", "255", "255", "255" };
|
|
||||||
List<String> tem = new ArrayList<String>();
|
|
||||||
for (int i = 0; i < ips.length; i++)
|
|
||||||
if (ips[i].indexOf("*") > -1) {
|
|
||||||
tem = complete(ips[i]);
|
|
||||||
from[i] = null;
|
|
||||||
end[i] = null;
|
|
||||||
} else {
|
|
||||||
from[i] = ips[i];
|
|
||||||
end[i] = ips[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuffer fromIP = new StringBuffer();
|
|
||||||
StringBuffer endIP = new StringBuffer();
|
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
if (from[i] != null) {
|
|
||||||
fromIP.append(from[i]).append(".");
|
|
||||||
endIP.append(end[i]).append(".");
|
|
||||||
} else {
|
|
||||||
fromIP.append("[*].");
|
|
||||||
endIP.append("[*].");
|
|
||||||
}
|
|
||||||
fromIP.deleteCharAt(fromIP.length() - 1);
|
|
||||||
endIP.deleteCharAt(endIP.length() - 1);
|
|
||||||
|
|
||||||
for (String s : tem) {
|
|
||||||
String ip = fromIP.toString().replace("[*]", s.split(";")[0]) + "-"
|
|
||||||
+ endIP.toString().replace("[*]", s.split(";")[1]);
|
|
||||||
if (validate(ip)) {
|
|
||||||
ipList.add(ip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (validate(allow)) {
|
|
||||||
ipList.add(allow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return ipList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对单个IP节点进行范围限定
|
|
||||||
*
|
|
||||||
* @param arg
|
|
||||||
* @return 返回限定后的IP范围,格式为List[10;19, 100;199]
|
|
||||||
*/
|
|
||||||
private static List<String> complete(String arg) {
|
|
||||||
List<String> com = new ArrayList<String>();
|
|
||||||
if (arg.length() == 1) {
|
|
||||||
com.add("0;255");
|
|
||||||
} else if (arg.length() == 2) {
|
|
||||||
String s1 = complete(arg, 1);
|
|
||||||
if (s1 != null)
|
|
||||||
com.add(s1);
|
|
||||||
String s2 = complete(arg, 2);
|
|
||||||
if (s2 != null)
|
|
||||||
com.add(s2);
|
|
||||||
} else {
|
|
||||||
String s1 = complete(arg, 1);
|
|
||||||
if (s1 != null)
|
|
||||||
com.add(s1);
|
|
||||||
}
|
|
||||||
return com;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String complete(String arg, int length) {
|
|
||||||
String from = "";
|
|
||||||
String end = "";
|
|
||||||
if (length == 1) {
|
|
||||||
from = arg.replace("*", "0");
|
|
||||||
end = arg.replace("*", "9");
|
|
||||||
} else {
|
|
||||||
from = arg.replace("*", "00");
|
|
||||||
end = arg.replace("*", "99");
|
|
||||||
}
|
|
||||||
if (Integer.valueOf(from) > 255)
|
|
||||||
return null;
|
|
||||||
if (Integer.valueOf(end) > 255)
|
|
||||||
end = "255";
|
|
||||||
return from + ";" + end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在添加至白名单时进行格式校验
|
|
||||||
*
|
|
||||||
* @param ip
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static boolean validate(String ip) {
|
|
||||||
for (String s : ip.split("-"))
|
|
||||||
if (!pattern.matcher(s).matches()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* checkLoginIP:(根据IP,及可用Ip列表来判断ip是否包含在白名单之中).
|
|
||||||
*
|
|
||||||
* @date 2017-4-17 下午03:01:03
|
|
||||||
* @param ip
|
|
||||||
* @param ipList
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static boolean checkLoginIP(String ip, Set<String> ipList) {
|
|
||||||
if (ipList.isEmpty() || ipList.contains(ip))
|
|
||||||
return true;
|
|
||||||
else {
|
|
||||||
for (String allow : ipList) {
|
|
||||||
if (allow.indexOf("-") > -1) {
|
|
||||||
String[] from = allow.split("-")[0].split("\\.");
|
|
||||||
String[] end = allow.split("-")[1].split("\\.");
|
|
||||||
String[] tag = ip.split("\\.");
|
|
||||||
|
|
||||||
// 对IP从左到右进行逐段匹配
|
|
||||||
boolean check = true;
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
int s = Integer.valueOf(from[i]);
|
|
||||||
int t = Integer.valueOf(tag[i]);
|
|
||||||
int e = Integer.valueOf(end[i]);
|
|
||||||
if (!(s <= t && t <= e)) {
|
|
||||||
check = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (check) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* checkLoginIP:(根据IP地址,及IP白名单设置规则判断IP是否包含在白名单).
|
|
||||||
*
|
|
||||||
* @date 2017-4-17 下午03:01:37
|
|
||||||
* @param ip
|
|
||||||
* @param ipWhiteConfig
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean checkLoginIP(String ip, String ipWhiteConfig) {
|
|
||||||
Set<String> ipList = getAvaliIpList(ipWhiteConfig);
|
|
||||||
return checkLoginIP(ip, ipList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
String ipWhilte = "10.158.1.*;"; // 设置一个IP范围
|
|
||||||
boolean flag = IPWhiteListUtil.checkLoginIP("10.158.1.13", ipWhilte);
|
|
||||||
boolean flag2 = IPWhiteListUtil.checkLoginIP("192.168.1.2", ipWhilte);
|
|
||||||
boolean flag3 = IPWhiteListUtil.checkLoginIP("192.168.3.16", ipWhilte);
|
|
||||||
boolean flag4 = IPWhiteListUtil.checkLoginIP("192.168.3.17", ipWhilte);
|
|
||||||
System.out.println(flag); // true
|
|
||||||
System.out.println(flag2); // false
|
|
||||||
System.out.println(flag3); // false
|
|
||||||
System.out.println(flag4); // true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
@Slf4j
|
|
||||||
public class IdentifierGenerator {
|
|
||||||
|
|
||||||
public static String CODE_TYPE_APPLY = "apply";
|
|
||||||
/**
|
|
||||||
* 根据长度生成随机字符串
|
|
||||||
* @param len
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String genRandStr(int len)
|
|
||||||
{
|
|
||||||
String rand = "" ;
|
|
||||||
int readomWordIndex = 0 ;
|
|
||||||
String[] readomWord = { "0","1","2","3","4","5","6","7","8","9",
|
|
||||||
"a","b","c","d","e","f","g","h","i","j",
|
|
||||||
"k","l","m","n","o","p","q","r","s","t",
|
|
||||||
"u","v","w","x","y","z","A","B","C","D",
|
|
||||||
"E","F","G","H","I","J","K","L","M","N",
|
|
||||||
"O","P","Q","R","S","T","U","V","W","X",
|
|
||||||
"Y","Z"
|
|
||||||
};
|
|
||||||
for(int i = 0 ; i < len ; i ++)
|
|
||||||
{
|
|
||||||
readomWordIndex = (int)(Math.random() * 52);
|
|
||||||
rand += readomWord[readomWordIndex];
|
|
||||||
}
|
|
||||||
return rand ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据长度随机生成数字串
|
|
||||||
* @param len
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String genRandNumber(int len)
|
|
||||||
{
|
|
||||||
String rand = "" ;
|
|
||||||
int readomWordIndex = 0 ;
|
|
||||||
String[] readomWord = { "0","1","2","3","4","5","6","7","8","9"};
|
|
||||||
for(int i = 0 ; i < len ; i ++)
|
|
||||||
{
|
|
||||||
readomWordIndex = (int)(Math.random() * 10);
|
|
||||||
rand += readomWord[readomWordIndex];
|
|
||||||
}
|
|
||||||
return rand ;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createPrimaryKeySeq () {
|
|
||||||
String currentTimeMillisStr = new Long(System.currentTimeMillis()).toString();
|
|
||||||
return currentTimeMillisStr + genRandStr(25);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createCodeByType(String type){
|
|
||||||
String result = "";
|
|
||||||
if(CODE_TYPE_APPLY.equals(type)){
|
|
||||||
result = "ZHSQ"+String.format("%tY%<tm%<td%03d", new Date(), Integer.parseInt(genRandNumber(2)));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
try {
|
|
||||||
System.out.println(IdentifierGenerator.createPrimaryKeySeq());
|
|
||||||
} catch (Exception e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
// log.error(e.getMessage(),e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.TypeReference;
|
|
||||||
|
|
||||||
public class JsonUtil {
|
|
||||||
/**
|
|
||||||
* 将json转化成map
|
|
||||||
* @param jsonStr
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Map<String, Object> convertJsonStrToMap(String jsonStr){
|
|
||||||
|
|
||||||
Map<String, Object> map = JSON.parseObject(
|
|
||||||
jsonStr,new TypeReference<Map<String, Object>>(){} );
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Map> convertJsonStrToMapArray(String jsonStr){
|
|
||||||
return JSON.parseArray(jsonStr, Map.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String mapToJson(Map map) {
|
|
||||||
String string = "{";
|
|
||||||
for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
|
|
||||||
Entry e = (Entry) it.next();
|
|
||||||
string += "'" + e.getKey() + "':";
|
|
||||||
string += "'" + e.getValue() + "',";
|
|
||||||
}
|
|
||||||
string = string.substring(0, string.lastIndexOf(","));
|
|
||||||
string += "}";
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:把JSON数据转换成指定的java对象
|
|
||||||
* @param jsonData JSON数据
|
|
||||||
* @param clazz 指定的java对象
|
|
||||||
* @return 指定的java对象
|
|
||||||
*/
|
|
||||||
public static <T> T convertJsonStrToBean(String jsonData, Class<T> clazz) {
|
|
||||||
return JSON.parseObject(jsonData, clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:把java对象转换成JSON数据
|
|
||||||
* @param object java对象
|
|
||||||
* @return JSON数据
|
|
||||||
*/
|
|
||||||
public static String convertBeanToJsonStr(Object object) {
|
|
||||||
return JSON.toJSONString(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:把JSON数据转换成指定的java对象列表
|
|
||||||
* @param jsonData JSON数据
|
|
||||||
* @param clazz 指定的java对象
|
|
||||||
* @return List<T>
|
|
||||||
*/
|
|
||||||
public static <T> List<T> convertJsonStrToList(String jsonData, Class<T> clazz) {
|
|
||||||
return JSON.parseArray(jsonData, clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,220 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import com.blueland.model.TPfSysOplog;
|
|
||||||
import com.blueland.service.ISysOplogService;
|
|
||||||
import com.blueland.service.impl.SysOplogServiceImpl;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import com.blueland.bo.SysOplogEntity;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日志操作
|
|
||||||
*@author zhengTao
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class LogUtil {
|
|
||||||
|
|
||||||
private static ISysOplogService sysOplogService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysOplogService sysOplogService2;
|
|
||||||
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void beforeInit() {
|
|
||||||
sysOplogService = sysOplogService2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param request 请求
|
|
||||||
* @param bizId 业务ID
|
|
||||||
* @param bizType 业务类型
|
|
||||||
* @param type 操作类型
|
|
||||||
* @param content 操作内容
|
|
||||||
* @param status 操作状态:成功:success,失败:failed
|
|
||||||
* @param remark 备注
|
|
||||||
*/
|
|
||||||
public static void addSysOplog(HttpServletRequest request, String bizId, String bizType, String type,
|
|
||||||
String content, String status, String sys, String remark) {
|
|
||||||
TPfSysOplog oplog = new TPfSysOplog();
|
|
||||||
if(null != request) {
|
|
||||||
String userAgent = request.getHeader("USER-AGENT");
|
|
||||||
if(StringUtil.isEmpty(userAgent)) {
|
|
||||||
userAgent = request.getHeader("User-Agent");
|
|
||||||
}
|
|
||||||
String userId = request.getHeader("iv-user");
|
|
||||||
String aceessIp = getRemoteAddr(request);
|
|
||||||
String aceessBrowse = getBrowserName(userAgent);
|
|
||||||
oplog.setUserId(null!=userId?userId:"");
|
|
||||||
oplog.setUserName("");
|
|
||||||
oplog.setAceessIp(aceessIp!=null?aceessIp:"");
|
|
||||||
oplog.setAceessBrowse(aceessBrowse!=null?aceessBrowse:"");
|
|
||||||
}else {
|
|
||||||
oplog.setUserId("admin");
|
|
||||||
oplog.setUserName("管理员");
|
|
||||||
oplog.setAceessIp("");
|
|
||||||
oplog.setAceessBrowse("");
|
|
||||||
}
|
|
||||||
oplog.setBizId(bizId);
|
|
||||||
oplog.setBizType(bizType);
|
|
||||||
oplog.setType(type);
|
|
||||||
oplog.setContent(content);
|
|
||||||
oplog.setStatus(status);
|
|
||||||
oplog.setCreateTime(new Date());
|
|
||||||
oplog.setAppId("sys");
|
|
||||||
oplog.setRemark(remark);
|
|
||||||
try {
|
|
||||||
sysOplogService.save(oplog);
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param userId 操作人ID
|
|
||||||
* @param userName 操作人姓名
|
|
||||||
* @param request 请求
|
|
||||||
* @param bizId 业务ID
|
|
||||||
* @param bizType 业务类型
|
|
||||||
* @param type 操作类型
|
|
||||||
* @param content 操作内容
|
|
||||||
* @param status 操作状态:成功:success,失败:failed
|
|
||||||
* @param remark 备注
|
|
||||||
*/
|
|
||||||
public static void addSysOplog4Render(HttpServletRequest request,
|
|
||||||
String userId,String userName,String bizId, String bizType, String type,
|
|
||||||
String content, String status, String sys, String remark) {
|
|
||||||
TPfSysOplog oplog = new TPfSysOplog();
|
|
||||||
if(null != request) {
|
|
||||||
String userAgent = request.getHeader("USER-AGENT");
|
|
||||||
if(StringUtil.isEmpty(userAgent)) {
|
|
||||||
userAgent = request.getHeader("User-Agent");
|
|
||||||
}
|
|
||||||
if(StringUtil.isEmpty(userId)) {
|
|
||||||
userId = request.getHeader("iv-user");
|
|
||||||
}
|
|
||||||
String aceessIp = getRemoteAddr(request);
|
|
||||||
String aceessBrowse = getBrowserName(userAgent);
|
|
||||||
oplog.setUserName(userName);
|
|
||||||
oplog.setUserId(null!=userId?userId:"");
|
|
||||||
oplog.setAceessIp(aceessIp!=null?aceessIp:"");
|
|
||||||
oplog.setAceessBrowse(aceessBrowse!=null?aceessBrowse:"");
|
|
||||||
}else {
|
|
||||||
oplog.setUserId("admin");
|
|
||||||
oplog.setUserName("管理员");
|
|
||||||
oplog.setAceessIp("127.0.0.1");
|
|
||||||
oplog.setAceessBrowse("");
|
|
||||||
}
|
|
||||||
oplog.setCreateTime(new Date());
|
|
||||||
oplog.setBizId(bizId);
|
|
||||||
oplog.setBizType(bizType);
|
|
||||||
oplog.setType(type);
|
|
||||||
oplog.setContent(content);
|
|
||||||
oplog.setStatus(status);
|
|
||||||
oplog.setAceessIp(sys);
|
|
||||||
oplog.setRemark(remark);
|
|
||||||
try {
|
|
||||||
sysOplogService.save(oplog);
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getBrowserName(String agent) {
|
|
||||||
if(agent.indexOf("msie 7")>0){
|
|
||||||
return "ie7";
|
|
||||||
}else if(agent.indexOf("msie 8")>0){
|
|
||||||
return "ie8";
|
|
||||||
}else if(agent.indexOf("msie 9")>0){
|
|
||||||
return "ie9";
|
|
||||||
}else if(agent.indexOf("msie 10")>0){
|
|
||||||
return "ie10";
|
|
||||||
}else if(agent.indexOf("msie")>0){
|
|
||||||
return "ie";
|
|
||||||
}else if(agent.indexOf("opera")>0){
|
|
||||||
return "opera";
|
|
||||||
}else if(agent.indexOf("Chrome")>0){
|
|
||||||
return "Chrome";
|
|
||||||
}else if(agent.indexOf("firefox")>0 || agent.indexOf("Firefox") > 0){
|
|
||||||
return "firefox";
|
|
||||||
}else if(agent.indexOf("webkit")>0){
|
|
||||||
return "webkit";
|
|
||||||
}else if(agent.indexOf("QQBrowser")>0){
|
|
||||||
return "QQBrowser";
|
|
||||||
}else if(agent.indexOf("360SE")>0){
|
|
||||||
return "360SE";
|
|
||||||
}else if(agent.indexOf("gecko")>0 && agent.indexOf("rv:11")>0){
|
|
||||||
return "ie11";
|
|
||||||
}else{
|
|
||||||
return "Others";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取客户端ip地址(可以穿透代理)
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getRemoteAddr(HttpServletRequest request) {
|
|
||||||
String ip = request.getHeader("x-forwarded-for");
|
|
||||||
if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) {
|
|
||||||
// 多次反向代理后会有多个ip值,第一个ip才是真实ip
|
|
||||||
if (ip.indexOf(",") != -1) {
|
|
||||||
ip = ip.split(",")[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("X-Forwarded-For");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("Proxy-Client-IP");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_X_FORWARDED");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_X_CLUSTER_CLIENT_IP");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_CLIENT_IP");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_FORWARDED_FOR");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_FORWARDED");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("HTTP_VIA");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("REMOTE_ADDR");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getHeader("X-Real-IP");
|
|
||||||
}
|
|
||||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
|
||||||
ip = request.getRemoteAddr();
|
|
||||||
}
|
|
||||||
if (ip.equals("0:0:0:0:0:0:0:1")) {
|
|
||||||
ip = "本地";
|
|
||||||
}
|
|
||||||
return ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class MapUtil {
|
|
||||||
/**
|
|
||||||
* javaBean 转 Map
|
|
||||||
* @param object object需要转换的javabean
|
|
||||||
* @return 转换结果map
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static Map<String, Object> beanToMap(Object object) throws Exception {
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
|
||||||
Class cls = object.getClass();
|
|
||||||
Field[] fields = cls.getDeclaredFields();
|
|
||||||
for (Field field : fields) {
|
|
||||||
field.setAccessible(true);
|
|
||||||
map.put(field.getName(), field.get(object));
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param map 需要转换的map
|
|
||||||
* @param cls 目标javaBean的类对象
|
|
||||||
* @return 目标类object
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static Object mapToBean(Map<String, Object> map, Class cls) throws Exception {
|
|
||||||
Object object = cls.newInstance();
|
|
||||||
for (String key : map.keySet()) {
|
|
||||||
Field temFiels = cls.getDeclaredField(key);
|
|
||||||
temFiels.setAccessible(true);
|
|
||||||
temFiels.set(object, map.get(key));
|
|
||||||
}
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将一个map组成的list转成实体类bean组成的list
|
|
||||||
* @param mapList 存了map对象的list
|
|
||||||
* @param clazz 需要将这些map转成哪个实体类对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static <T> List<T> convertMapListToBeanList(List<Map> mapList, Class<T> clazz){
|
|
||||||
List<T> list=new ArrayList<T>();
|
|
||||||
for(Map map:mapList){
|
|
||||||
try {
|
|
||||||
T obj=clazz.newInstance();//创建bean的实例对象
|
|
||||||
for(Object o:map.keySet()){//遍历map的key
|
|
||||||
for(Method m:clazz.getMethods()){//遍历bean的类中的方法,找到set方法进行赋值
|
|
||||||
if(m.getName().toLowerCase().equals("set"+o.toString().toLowerCase())){
|
|
||||||
if(o.toString().indexOf("Time") != -1){
|
|
||||||
continue;
|
|
||||||
}else{
|
|
||||||
m.invoke(obj, map.get(o));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.add(obj);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InstantiationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public class Md5Util {
|
|
||||||
/**
|
|
||||||
* String转MD5
|
|
||||||
* @param psw
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static Logger log = LoggerFactory.getLogger(Md5Util.class);
|
|
||||||
public static String StringToMd5(String psw) {
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
|
||||||
md5.update(psw.getBytes("UTF-8"));
|
|
||||||
byte[] encryption = md5.digest();
|
|
||||||
|
|
||||||
StringBuffer strBuf = new StringBuffer();
|
|
||||||
for (int i = 0; i < encryption.length; i++) {
|
|
||||||
if (Integer.toHexString(0xff & encryption[i]).length() == 1) {
|
|
||||||
strBuf.append("0").append(Integer.toHexString(0xff & encryption[i]));
|
|
||||||
} else {
|
|
||||||
strBuf.append(Integer.toHexString(0xff & encryption[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return strBuf.toString();
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
return "";
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static String getPhpMd5(byte[] buffer) {
|
|
||||||
String s = null;
|
|
||||||
MessageDigest md = null;
|
|
||||||
|
|
||||||
char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
|
||||||
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("MD5");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
log.error("getPhpMd5:buffer="+buffer,e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
md.update(buffer);
|
|
||||||
byte[] datas = md.digest(); // 16个字节的长整数
|
|
||||||
char[] str = new char[2 * 16];
|
|
||||||
int k = 0;
|
|
||||||
for (int i = 0; i < 16; i++) {
|
|
||||||
byte b = datas[i];
|
|
||||||
str[k++] = hexChars[b >>> 4 & 0xf];// 高4位
|
|
||||||
str[k++] = hexChars[b & 0xf];// 低4位
|
|
||||||
}
|
|
||||||
s = new String(str);
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import java.security.cert.CertificateException;
|
|
||||||
import java.security.cert.X509Certificate;
|
|
||||||
|
|
||||||
import javax.net.ssl.X509TrustManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 59552
|
|
||||||
* @version 创建时间:2019年6月27日 上午11:29:34
|
|
||||||
* 类说明
|
|
||||||
*/
|
|
||||||
public class MyX509TrustManager implements X509TrustManager {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public X509Certificate[] getAcceptedIssuers() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,702 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import com.blueland.constant.RedisConstant;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import lombok.val;
|
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.core.Cursor;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.data.redis.core.ScanOptions;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class RedisUtils {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisTemplate redisTemplate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 指定缓存失效时间
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean expire(String key, long time) {
|
|
||||||
try {
|
|
||||||
if (time > 0) {
|
|
||||||
redisTemplate.expire(key, time, TimeUnit.SECONDS);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据key 获取过期时间
|
|
||||||
*
|
|
||||||
* @param key 键 不能为null
|
|
||||||
* @return 时间(秒) 返回0代表为永久有效
|
|
||||||
*/
|
|
||||||
public long getExpire(String key) {
|
|
||||||
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断key是否存在
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return true 存在 false不存在
|
|
||||||
*/
|
|
||||||
public boolean hasKey(String key) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.hasKey(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除缓存
|
|
||||||
*
|
|
||||||
* @param key 可以传一个值 或多个
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void del(String... key) {
|
|
||||||
if (key != null && key.length > 0) {
|
|
||||||
if (key.length == 1) {
|
|
||||||
redisTemplate.delete(key[0]);
|
|
||||||
} else {
|
|
||||||
redisTemplate.delete(CollectionUtils.arrayToList(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================String=============================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 普通缓存获取
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return 值
|
|
||||||
*/
|
|
||||||
public Object get(String key) {
|
|
||||||
return key == null ? null : redisTemplate.opsForValue().get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取值
|
|
||||||
* @param key
|
|
||||||
* @param claz
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public <T> T get(String key, Class<T> claz) {
|
|
||||||
return key == null ? null : (T) redisTemplate.opsForValue().get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 普通缓存放入
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @return true成功 false失败
|
|
||||||
*/
|
|
||||||
public boolean set(String key, Object value) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForValue().set(key, value);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 普通缓存放入并设置时间
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
|
|
||||||
* @return true成功 false 失败
|
|
||||||
*/
|
|
||||||
public boolean set(String key, Object value, long time) {
|
|
||||||
try {
|
|
||||||
if (time > 0) {
|
|
||||||
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
|
|
||||||
} else {
|
|
||||||
set(key, value);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 递增
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param by 要增加几(大于0)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long incr(String key, long delta) {
|
|
||||||
if (delta < 0) {
|
|
||||||
throw new RuntimeException("递增因子必须大于0");
|
|
||||||
}
|
|
||||||
return redisTemplate.opsForValue().increment(key, delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 递增,默认加1
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long incr(String key) {
|
|
||||||
return redisTemplate.opsForValue().increment(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 递减
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param by 要减少几(小于0)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long decr(String key, long delta) {
|
|
||||||
if (delta < 0) {
|
|
||||||
throw new RuntimeException("递减因子必须大于0");
|
|
||||||
}
|
|
||||||
return redisTemplate.opsForValue().decrement(key, delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 递减
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long decr(String key) {
|
|
||||||
return redisTemplate.opsForValue().decrement(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================Map=================================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HashGet
|
|
||||||
*
|
|
||||||
* @param key 键 不能为null
|
|
||||||
* @param item 项 不能为null
|
|
||||||
* @return 值
|
|
||||||
*/
|
|
||||||
public Object hget(String key, String item) {
|
|
||||||
return redisTemplate.opsForHash().get(key, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> List<T> multiGet(String key, List<String> item, Class<T> claz) {
|
|
||||||
return redisTemplate.opsForHash().multiGet(key, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> T hget(String key,String item, Class<T> claz) {
|
|
||||||
return (T) redisTemplate.opsForHash().get(key, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取hashKey对应的所有键值
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return 对应的多个键值
|
|
||||||
*/
|
|
||||||
public Map<Object, Object> hmget(String key) {
|
|
||||||
return redisTemplate.opsForHash().entries(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HashSet
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param map 对应多个键值
|
|
||||||
* @return true 成功 false 失败
|
|
||||||
*/
|
|
||||||
public boolean hmset(String key, Map<String, Object> map) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForHash().putAll(key, map);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HashSet 并设置时间
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param map 对应多个键值
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @return true成功 false失败
|
|
||||||
*/
|
|
||||||
public boolean hmset(String key, Map<String, Object> map, long time) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForHash().putAll(key, map);
|
|
||||||
if (time > 0) {
|
|
||||||
expire(key, time);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 向一张hash表中放入数据,如果不存在将创建
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param item 项
|
|
||||||
* @param value 值
|
|
||||||
* @return true 成功 false失败
|
|
||||||
*/
|
|
||||||
public boolean hset(String key, String item, Object value) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForHash().put(key, item, value);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 向一张hash表中放入数据,如果不存在将创建
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param item 项
|
|
||||||
* @param value 值
|
|
||||||
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
|
|
||||||
* @return true 成功 false失败
|
|
||||||
*/
|
|
||||||
public boolean hset(String key, String item, Object value, long time) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForHash().put(key, item, value);
|
|
||||||
if (time > 0) {
|
|
||||||
expire(key, time);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除hash表中的值
|
|
||||||
*
|
|
||||||
* @param key 键 不能为null
|
|
||||||
* @param item 项 可以使多个 不能为null
|
|
||||||
*/
|
|
||||||
public void hdel(String key, Object... item) {
|
|
||||||
redisTemplate.opsForHash().delete(key, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断hash表中是否有该项的值
|
|
||||||
*
|
|
||||||
* @param key 键 不能为null
|
|
||||||
* @param item 项 不能为null
|
|
||||||
* @return true 存在 false不存在
|
|
||||||
*/
|
|
||||||
public boolean hHasKey(String key, String item) {
|
|
||||||
return redisTemplate.opsForHash().hasKey(key, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hash递增 如果不存在,就会创建一个 并把新增后的值返回
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param item 项
|
|
||||||
* @param by 要增加几(大于0)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public double hincr(String key, String item, double by) {
|
|
||||||
return redisTemplate.opsForHash().increment(key, item, by);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hash递减
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param item 项
|
|
||||||
* @param by 要减少记(小于0)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public double hdecr(String key, String item, double by) {
|
|
||||||
return redisTemplate.opsForHash().increment(key, item, -by);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================set=============================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据key获取Set中的所有值
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Set<Object> sGet(String key) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForSet().members(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据value从一个set中查询,是否存在
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @return true 存在 false不存在
|
|
||||||
*/
|
|
||||||
public boolean sHasKey(String key, Object value) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForSet().isMember(key, value);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将数据放入set缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param values 值 可以是多个
|
|
||||||
* @return 成功个数
|
|
||||||
*/
|
|
||||||
public long sSet(String key, Object... values) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForSet().add(key, values);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将set数据放入缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @param values 值 可以是多个
|
|
||||||
* @return 成功个数
|
|
||||||
*/
|
|
||||||
public long sSetAndTime(String key, long time, Object... values) {
|
|
||||||
try {
|
|
||||||
Long count = redisTemplate.opsForSet().add(key, values);
|
|
||||||
if (time > 0) {
|
|
||||||
expire(key, time);
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取set缓存的长度
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long sGetSetSize(String key) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForSet().size(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除值为value的
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param values 值 可以是多个
|
|
||||||
* @return 移除的个数
|
|
||||||
*/
|
|
||||||
public long setRemove(String key, Object... values) {
|
|
||||||
try {
|
|
||||||
Long count = redisTemplate.opsForSet().remove(key, values);
|
|
||||||
return count;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ===============================list=================================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取list缓存的内容
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param start 开始
|
|
||||||
* @param end 结束 0 到 -1代表所有值
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<Object> lGet(String key, long start, long end) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForList().range(key, start, end);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取list缓存的长度
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long lGetListSize(String key) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForList().size(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过索引 获取list中的值
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Object lGetIndex(String key, long index) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForList().index(key, index);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将list放入缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean lSet(String key, Object value) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForList().rightPush(key, value);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将list放入缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean lSet(String key, Object value, long time) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForList().rightPush(key, value);
|
|
||||||
if (time > 0) {
|
|
||||||
expire(key, time);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将list放入缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean lSet(String key, List<Object> value) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForList().rightPushAll(key, value);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将list放入缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean lSet(String key, List<Object> value, long time) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForList().rightPushAll(key, value);
|
|
||||||
if (time > 0) {
|
|
||||||
expire(key, time);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据索引修改list中的某条数据
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param index 索引
|
|
||||||
* @param value 值
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean lUpdateIndex(String key, long index, Object value) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForList().set(key, index, value);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除N个值为value
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param count 移除多少个
|
|
||||||
* @param value 值
|
|
||||||
* @return 移除的个数
|
|
||||||
*/
|
|
||||||
public long lRemove(String key, long count, Object value) {
|
|
||||||
try {
|
|
||||||
Long remove = redisTemplate.opsForList().remove(key, count, value);
|
|
||||||
return remove;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取数组中第一条数据 并移除redis中的值
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Object getFirstList(String key) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForList().leftPop(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取数组中最后一条数据 并移除redis中的值
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Object getLastList(String key) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForList().rightPop(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游标获取相关key:
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
*/
|
|
||||||
public Map hashEntries(String key) {
|
|
||||||
return redisTemplate.opsForHash().entries(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 扫描key,支持模糊
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param options
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Cursor hashScan(String key, ScanOptions options) {
|
|
||||||
return redisTemplate.opsForHash().scan(key, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取所有key
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Set getAllKey(String key) {
|
|
||||||
return key == null ? null : redisTemplate.keys(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取hash所有values
|
|
||||||
*/
|
|
||||||
public <T> List<T> hValues(String key, Class<T> claz) {
|
|
||||||
|
|
||||||
return (List<T>) redisTemplate.opsForHash().values(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hash putAll
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
public void hPutAll(String key, Map data) {
|
|
||||||
redisTemplate.opsForHash().putAll(key, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据key 删除所有数据
|
|
||||||
* @param key
|
|
||||||
*/
|
|
||||||
public void deleteAll(String key) {
|
|
||||||
redisTemplate.delete(key);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数.
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
public class ReflectUtils extends ReflectUtil {
|
|
||||||
|
|
||||||
private static final String SETTER_PREFIX = "set";
|
|
||||||
|
|
||||||
private static final String GETTER_PREFIX = "get";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 调用Getter方法.
|
|
||||||
* 支持多级,如:对象名.对象名.方法
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <E> E invokeGetter(Object obj, String propertyName) {
|
|
||||||
Object object = obj;
|
|
||||||
for (String name : StringUtils.split(propertyName, ".")) {
|
|
||||||
String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name);
|
|
||||||
object = invoke(object, getterMethodName);
|
|
||||||
}
|
|
||||||
return (E) object;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 调用Setter方法, 仅匹配方法名。
|
|
||||||
* 支持多级,如:对象名.对象名.方法
|
|
||||||
*/
|
|
||||||
public static <E> void invokeSetter(Object obj, String propertyName, E value) {
|
|
||||||
Object object = obj;
|
|
||||||
String[] names = StringUtils.split(propertyName, ".");
|
|
||||||
for (int i = 0; i < names.length; i++) {
|
|
||||||
if (i < names.length - 1) {
|
|
||||||
String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]);
|
|
||||||
object = invoke(object, getterMethodName);
|
|
||||||
} else {
|
|
||||||
String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]);
|
|
||||||
Method method = getMethodByName(object.getClass(), setterMethodName);
|
|
||||||
invoke(object, method, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,167 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import com.blueland.constant.RedisConstant;
|
|
||||||
import com.blueland.bo.DictEntity;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.core.Cursor;
|
|
||||||
import org.springframework.data.redis.core.ScanOptions;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 字典工具类型
|
|
||||||
* @author: bigTian
|
|
||||||
* @create: 2021-10-28 09:36
|
|
||||||
*/
|
|
||||||
@Component("remoteDictUtils")
|
|
||||||
@Slf4j
|
|
||||||
public class RemoteDictUtils {
|
|
||||||
@Autowired
|
|
||||||
private RedisUtils redisUtils;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据appid和字典父Code返回对应的子数据
|
|
||||||
*
|
|
||||||
* @param parentCode 字典父Code
|
|
||||||
* @param appId 租户id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<DictEntity> getDictByParentCodeAndAppId(String appId, String parentCode) {
|
|
||||||
Map<String, DictEntity> parentMap = getParentMap(appId, parentCode);
|
|
||||||
ArrayList<DictEntity> list = new ArrayList<>(parentMap.values());
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
list.sort(Comparator.comparing(DictEntity::getSort));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据appid返回对应的子数据
|
|
||||||
*
|
|
||||||
* @param appId 租户id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<DictEntity> getDictByAppId(String appId) {
|
|
||||||
Map<String, DictEntity> parentMap = getAppMap(appId);
|
|
||||||
ArrayList<DictEntity> list = new ArrayList<>(parentMap.values());
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
list.sort(Comparator.comparing(DictEntity::getSort));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* excel导入,以名称为key
|
|
||||||
*
|
|
||||||
* @param parentCode 字典父Code
|
|
||||||
* @param appId 租户id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Map<String, DictEntity> getDictByNames(String appId, String parentCode) {
|
|
||||||
Map<String, DictEntity> parentMap = getParentMap(appId, parentCode);
|
|
||||||
parentMap = parentMap.values().stream().collect(Collectors.toMap(DictEntity::getDictName, el -> el));
|
|
||||||
return parentMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回所有的字典数据
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Map<String, Map<String, Map<String, DictEntity>>> getDictMaps() {
|
|
||||||
return redisUtils.hashEntries(RedisConstant.SYS_DICT_CACHE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据父级code和字典code查询
|
|
||||||
*
|
|
||||||
* @param parentCode 父级code
|
|
||||||
* @param code 需要查询的字典code
|
|
||||||
* @param appId 租户id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public DictEntity getDict(String appId, String parentCode, String code) {
|
|
||||||
Map<String, DictEntity> parentMap = getParentMap(appId, parentCode);
|
|
||||||
return parentMap.get(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据租户id和父code查询相关字典
|
|
||||||
*
|
|
||||||
* @param appId
|
|
||||||
* @param parentCode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Map<String, DictEntity> getParentMap(String appId, String parentCode) {
|
|
||||||
Map<String, DictEntity> appIdMaps = new HashMap<>();
|
|
||||||
ScanOptions options = new ScanOptions.ScanOptionsBuilder()
|
|
||||||
.match(appId + RedisConstant.DIVISION + parentCode + RedisConstant.DIVISION + RedisConstant.WILDCARD)
|
|
||||||
.count(100)
|
|
||||||
.build();
|
|
||||||
Cursor<Map.Entry<String, DictEntity>> cursor = redisUtils.hashScan(RedisConstant.SYS_DICT_CACHE, options);
|
|
||||||
Map.Entry<String, DictEntity> entry = null;
|
|
||||||
DictEntity value = null;
|
|
||||||
while (cursor.hasNext()) {
|
|
||||||
entry = cursor.next();
|
|
||||||
value = entry.getValue();
|
|
||||||
appIdMaps.putIfAbsent(value.getDictCode(), value);
|
|
||||||
}
|
|
||||||
cursor.close();
|
|
||||||
return appIdMaps;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据租户id查询相关字典
|
|
||||||
*
|
|
||||||
* @param appId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Map<String, DictEntity> getAppMap(String appId) {
|
|
||||||
Map<String, DictEntity> appIdMaps = new HashMap<>();
|
|
||||||
ScanOptions options = new ScanOptions.ScanOptionsBuilder()
|
|
||||||
.match(appId + RedisConstant.DIVISION + RedisConstant.WILDCARD)
|
|
||||||
.count(100)
|
|
||||||
.build();
|
|
||||||
Cursor<Map.Entry<String, DictEntity>> cursor = redisUtils.hashScan(RedisConstant.SYS_DICT_CACHE, options);
|
|
||||||
Map.Entry<String, DictEntity> entry = null;
|
|
||||||
DictEntity value = null;
|
|
||||||
while (cursor.hasNext()) {
|
|
||||||
entry = cursor.next();
|
|
||||||
value = entry.getValue();
|
|
||||||
appIdMaps.putIfAbsent(value.getDictCode(), value);
|
|
||||||
}
|
|
||||||
cursor.close();
|
|
||||||
return appIdMaps;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据租户id和父code查询相关字典
|
|
||||||
*
|
|
||||||
* @param appId
|
|
||||||
* @param code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Map<String, DictEntity> getDict(String appId, String code) {
|
|
||||||
Map<String, DictEntity> appIdMaps = new HashMap<>();
|
|
||||||
ScanOptions options = new ScanOptions.ScanOptionsBuilder()
|
|
||||||
.match(appId + RedisConstant.DIVISION + RedisConstant.WILDCARD + RedisConstant.DIVISION + code)
|
|
||||||
.count(100)
|
|
||||||
.build();
|
|
||||||
Cursor<Map.Entry<String, DictEntity>> cursor = redisUtils.hashScan(RedisConstant.SYS_DICT_CACHE, options);
|
|
||||||
Map.Entry<String, DictEntity> entry = null;
|
|
||||||
DictEntity value = null;
|
|
||||||
while (cursor.hasNext()) {
|
|
||||||
entry = cursor.next();
|
|
||||||
value = entry.getValue();
|
|
||||||
appIdMaps.putIfAbsent(value.getDictCode(), value);
|
|
||||||
}
|
|
||||||
cursor.close();
|
|
||||||
return appIdMaps;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,495 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.io.Writer;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.sql.Clob;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author luobo
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class StringUtil {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测字符串是否不为空(null,"","null")
|
|
||||||
* @param s
|
|
||||||
* @return 不为空则返回true,否则返回false
|
|
||||||
*/
|
|
||||||
public static boolean notEmpty(String s){
|
|
||||||
return s!=null && !"".equals(s) && !"null".equals(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测字符串是否为空(null,"","null")
|
|
||||||
* @param s
|
|
||||||
* @return 为空则返回true,不否则返回false
|
|
||||||
*/
|
|
||||||
public static boolean isEmpty(String s){
|
|
||||||
return s==null || "".equals(s) || "null".equals(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字符串转换为字符串数组
|
|
||||||
* @param str 字符串
|
|
||||||
* @param splitRegex 分隔符
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String[] str2StrArray(String str,String splitRegex){
|
|
||||||
if(isEmpty(str)){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return str.split(splitRegex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用默认的分隔符(,)将字符串转换为字符串数组
|
|
||||||
* @param str 字符串
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String[] str2StrArray(String str){
|
|
||||||
return str2StrArray(str,",\\s*");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换成整形,出现数字格式异常默认为defaultValue
|
|
||||||
* @param object
|
|
||||||
* @param defaultValue
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static int toInt(Object object,int defaultValue){
|
|
||||||
if(null == object){
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return Integer.parseInt(""+object);
|
|
||||||
} catch (NumberFormatException notint) {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换成整形,出现数字格式异常默认<EFBFBD>?
|
|
||||||
* @param object
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static int toInt(Object object){
|
|
||||||
return toInt(object,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static String toNumricStr(Integer num,Integer digits){
|
|
||||||
String numstr = num.toString();
|
|
||||||
while (numstr.length() < digits){
|
|
||||||
numstr = "0"+numstr;
|
|
||||||
}
|
|
||||||
return numstr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void main(String [] args){
|
|
||||||
String str="一、卷包车间平面7台综合测试仪需要进行数据采集,要求:1、采集卷接生产过程进行在线质量检测的检测数据。2、将采集数据集成至工艺质量系统,对数据进行分析统计,生成相应报表。3、将采集到的数据集成至卷包数采系统,在卷包数采工控机数采终端能实时查询。\r\n二、检测仪器自动采集与数据应用升级改造:1、新进红外水分安装采集和分析模块,2、填充值采集模块,3、红外校准零点记录与跟踪,4、报表生成,5、对比分析模块,6、目前在用系统升级\r\n三、系统集成";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @方法名: handleTextArea
|
|
||||||
* @描述:处理一个实体中的属性,如果是String,则进行转义,以方便前台换行显示
|
|
||||||
* @作者:高星
|
|
||||||
* @时间:2015-8-7 上午9:51:57
|
|
||||||
* @参数:@param obj
|
|
||||||
* @返回值:void
|
|
||||||
*/
|
|
||||||
public void handleTextArea(Object obj){
|
|
||||||
if(obj!=null && obj instanceof Map){
|
|
||||||
Map<String,Object> map=((Map<String, Object>)obj);
|
|
||||||
Set<String> keySet=map.keySet();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换textarea 中提交的数据在页面中按照textarea中一样的格式进行换行显示
|
|
||||||
* @param textarea
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String textarea2html(String textarea){
|
|
||||||
if(null != textarea){
|
|
||||||
return textarea.replaceAll("\n", "<br/>").replace(" ", " ");
|
|
||||||
}
|
|
||||||
return textarea;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将字符串中HTML字符转换成TEXT类型字符
|
|
||||||
* @param text
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String textEncode(String text){
|
|
||||||
if(text == null)
|
|
||||||
return "";
|
|
||||||
text = text.replaceAll("<br/>", "\r\n");
|
|
||||||
text = text.replaceAll("", "");
|
|
||||||
text = text.replaceAll("&", "&") ;
|
|
||||||
text = text.replaceAll(""", "\"") ;
|
|
||||||
text = text.replaceAll("<", "<") ;
|
|
||||||
text = text.replaceAll(">", ">") ;
|
|
||||||
text = text.replaceAll("’", "'") ;
|
|
||||||
text = text.replaceAll(" "," ");
|
|
||||||
text = text.replaceAll(" ","\t");
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 将字符串中TEXT类型字符转换成HTML字符
|
|
||||||
* @param text
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String textDecode(String text){
|
|
||||||
if(text == null)
|
|
||||||
return "";
|
|
||||||
text = text.replaceAll("","");
|
|
||||||
text = text.replaceAll("&","&") ;
|
|
||||||
text = text.replaceAll("\"",""") ;
|
|
||||||
text = text.replaceAll( "<","<");
|
|
||||||
text = text.replaceAll(">",">");
|
|
||||||
text = text.replaceAll("'","’") ;
|
|
||||||
text = text.replaceAll(" "," ");
|
|
||||||
text = text.replaceAll("\\\\t"," ");
|
|
||||||
text = text.replaceAll("\r\n","<br/>");
|
|
||||||
text = text.replaceAll("\\r\\n","<br/>");
|
|
||||||
text = text.replaceAll("\\\r\\\n","<br/>");
|
|
||||||
text = text.replaceAll("\\\\r\\\\n","<br/>");
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handleText(Object obj){
|
|
||||||
if(obj!=null && obj instanceof Map){
|
|
||||||
Map map=(Map)obj;
|
|
||||||
Set<String> keySet=map.keySet();
|
|
||||||
for(String key:keySet){
|
|
||||||
Object item=map.get(key);
|
|
||||||
if(item!=null && item instanceof String){
|
|
||||||
map.put(key,StringUtil.textDecode((String)item));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
obj=map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取字符串的实际长度(按字节长度,如一个中文长度为2)
|
|
||||||
*
|
|
||||||
* @param str
|
|
||||||
* 待返回长度的字符串
|
|
||||||
* @return 字符串的字节长度
|
|
||||||
*/
|
|
||||||
public static int getStrRealLength(String str) {
|
|
||||||
|
|
||||||
if (str == null)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int length = 0;
|
|
||||||
|
|
||||||
char[] chars = str.toCharArray();
|
|
||||||
|
|
||||||
for (char ch : chars) {
|
|
||||||
|
|
||||||
if (ch <= 127) {
|
|
||||||
length++;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
length += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
|
|
||||||
//求两个字符串数组的并集,利用set的元素唯一性
|
|
||||||
public static String[] union(String[] arr1, String[] arr2) {
|
|
||||||
Set<String> set = new HashSet<String>();
|
|
||||||
for (String str : arr1) {
|
|
||||||
set.add(str);
|
|
||||||
}
|
|
||||||
for (String str : arr2) {
|
|
||||||
set.add(str);
|
|
||||||
}
|
|
||||||
String[] result = {};
|
|
||||||
return set.toArray(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
//求两个数组的交集
|
|
||||||
public static String[] intersect(String[] arr1, String[] arr2) {
|
|
||||||
Map<String, Boolean> map = new HashMap<String, Boolean>();
|
|
||||||
LinkedList<String> list = new LinkedList<String>();
|
|
||||||
for (String str : arr1) {
|
|
||||||
if (!map.containsKey(str)) {
|
|
||||||
map.put(str, Boolean.FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (String str : arr2) {
|
|
||||||
if (map.containsKey(str)) {
|
|
||||||
map.put(str, Boolean.TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Entry<String, Boolean> e : map.entrySet()) {
|
|
||||||
if (e.getValue().equals(Boolean.TRUE)) {
|
|
||||||
list.add(e.getKey());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String[] result = {};
|
|
||||||
return list.toArray(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
//求两个数组的差集
|
|
||||||
public static String[] minus(String[] arr1, String[] arr2) {
|
|
||||||
LinkedList<String> list = new LinkedList<String>();
|
|
||||||
LinkedList<String> history = new LinkedList<String>();
|
|
||||||
String[] longerArr = arr1;
|
|
||||||
String[] shorterArr = arr2;
|
|
||||||
//找出较长的数组来减较短的数组
|
|
||||||
if (arr1.length > arr2.length) {
|
|
||||||
longerArr = arr2;
|
|
||||||
shorterArr = arr1;
|
|
||||||
}
|
|
||||||
for (String str : longerArr) {
|
|
||||||
if (!list.contains(str)) {
|
|
||||||
list.add(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (String str : shorterArr) {
|
|
||||||
if (list.contains(str)) {
|
|
||||||
history.add(str);
|
|
||||||
list.remove(str);
|
|
||||||
} else {
|
|
||||||
if (!history.contains(str)) {
|
|
||||||
list.add(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String[] result = {};
|
|
||||||
return list.toArray(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String convertToString(Object obj,String defaultValue){
|
|
||||||
if(obj==null){
|
|
||||||
return defaultValue;
|
|
||||||
}else{
|
|
||||||
return obj.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @方法名: strToList
|
|
||||||
* @描述:将以特定分隔符分割的字符串转为为List
|
|
||||||
* @作者:高星
|
|
||||||
* @时间:2014-10-13 上午9:51:08
|
|
||||||
* @参数:@param ids
|
|
||||||
* @参数:@param seperator
|
|
||||||
* @参数:@return
|
|
||||||
* @返回值:List
|
|
||||||
*/
|
|
||||||
public static List<String> strToList(String ids,String seperator){
|
|
||||||
List<String> idList=new ArrayList<String>();
|
|
||||||
if(StringUtils.isNotBlank(ids)){
|
|
||||||
String[] idArr=ids.split(seperator);
|
|
||||||
for(String id:idArr){
|
|
||||||
if(StringUtils.isNotBlank(id)){
|
|
||||||
idList.add(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return idList;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @方法名: clobToStr
|
|
||||||
* @描述:将Clob字段转化为字符串
|
|
||||||
* @作者:高星
|
|
||||||
* @时间:2014-10-31 下午3:36:43
|
|
||||||
* @参数:@param clob
|
|
||||||
* @参数:@return
|
|
||||||
* @返回值:String
|
|
||||||
*/
|
|
||||||
public static String clobToStr(Clob clob){
|
|
||||||
String result="";
|
|
||||||
try {
|
|
||||||
result= (clob != null ? clob.getSubString(1, (int) clob.length()) :"");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Clob strToClob(String str, Clob lob) throws Exception {
|
|
||||||
Method methodToInvoke = lob.getClass().getMethod(
|
|
||||||
"getCharacterOutputStream", (Class[]) null);
|
|
||||||
Writer writer = (Writer) methodToInvoke.invoke(lob, (Object[]) null);
|
|
||||||
writer.write(str);
|
|
||||||
writer.close();
|
|
||||||
return lob;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能: 按照指定字节长度截取字符串并选择在后面是否加...
|
|
||||||
*
|
|
||||||
* @param str
|
|
||||||
* 需要截取的字符串
|
|
||||||
* @param offset
|
|
||||||
* 需要截取的字节长度,不包括追加的…
|
|
||||||
* @param addEllipsis
|
|
||||||
* 是否添加省略号… true 是 false 否
|
|
||||||
* @return String 截取后的字符串
|
|
||||||
*/
|
|
||||||
public static String getSubStr(String str,int offset,boolean addEllipsis) {
|
|
||||||
if (str == null)
|
|
||||||
return "";
|
|
||||||
int realLength = getStrRealLength(str);
|
|
||||||
if (realLength <= offset) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
int length = 0;
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
char[] chars = str.toCharArray();
|
|
||||||
int ii = 0;
|
|
||||||
while (length < offset) {
|
|
||||||
char ch = chars[ii++];
|
|
||||||
if (ch <= 127) {
|
|
||||||
length++;
|
|
||||||
} else {
|
|
||||||
length += 2;
|
|
||||||
}
|
|
||||||
sb.append(ch);
|
|
||||||
}
|
|
||||||
if(addEllipsis==true){
|
|
||||||
sb.append("…");
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean contains(String str1,String str2,String separator){
|
|
||||||
boolean b=false;
|
|
||||||
if(StringUtils.isNotBlank(str1) && StringUtils.isNotBlank(str2)){
|
|
||||||
if(null!=separator){
|
|
||||||
b=str1.indexOf(separator+str2+separator)>-1;
|
|
||||||
}else{
|
|
||||||
b=str1.indexOf(str2)>-1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handleMapListData(List<Map<String,Object>> dataList){
|
|
||||||
if(dataList!=null && dataList.size()>0){
|
|
||||||
for(int i=0;i<dataList.size();i++){
|
|
||||||
Map<String,Object> item=dataList.get(i);
|
|
||||||
Set<String> keySet=item.keySet();
|
|
||||||
for(String key:keySet){
|
|
||||||
Object value=item.get(key);
|
|
||||||
String className=value.getClass().getSimpleName();
|
|
||||||
if("clob".equals(className.toLowerCase())){
|
|
||||||
item.put(key,StringUtil.clobToStr((Clob) item.get(key)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static Long handleDiscountMoney(Long discount){
|
|
||||||
return Math.abs(discount)/100;
|
|
||||||
}
|
|
||||||
|
|
||||||
//取类似10m 10gi 100s中的数字,特点都是数字开头最后是字符. add by wfz 2017-03-28
|
|
||||||
public static int getNumber(String data){
|
|
||||||
data=data.trim();
|
|
||||||
if(isEmpty(data))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int index = 0;
|
|
||||||
for(int i = 0; i < data.length(); i++){
|
|
||||||
if (!Character.isDigit(data.charAt(i))){
|
|
||||||
index = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String valueStr="0";
|
|
||||||
String unitStr="m";
|
|
||||||
if(index==0)
|
|
||||||
{
|
|
||||||
valueStr= data;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
valueStr=data.substring(0,index);//计量数字
|
|
||||||
unitStr=data.substring(index);//计量单位 mi m g gi
|
|
||||||
}
|
|
||||||
int intValue=Integer.valueOf(valueStr);
|
|
||||||
int result=intValue;
|
|
||||||
if(notEmpty(unitStr))
|
|
||||||
{
|
|
||||||
unitStr=unitStr.toLowerCase();
|
|
||||||
switch (unitStr) {
|
|
||||||
case "m":
|
|
||||||
case "mi":
|
|
||||||
result=intValue;
|
|
||||||
break;
|
|
||||||
case "g":
|
|
||||||
result=intValue*1024;
|
|
||||||
break;
|
|
||||||
case "gi":
|
|
||||||
result=intValue*1000;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 内存转换为g并取整
|
|
||||||
* unit 转换单位1000或1024
|
|
||||||
* divCount 除的次数 k转要除以2次
|
|
||||||
* add by wfz 2017-07-13
|
|
||||||
*/
|
|
||||||
public static String memoryCalc(double mem,Integer unit,Integer divCount )
|
|
||||||
{
|
|
||||||
double result=mem;
|
|
||||||
for(int i=1;i<=divCount;i++)
|
|
||||||
{
|
|
||||||
result=result/unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
NumberFormat nf = NumberFormat.getNumberInstance();
|
|
||||||
|
|
||||||
|
|
||||||
// 保留两位小数
|
|
||||||
nf.setMaximumFractionDigits(2);
|
|
||||||
|
|
||||||
|
|
||||||
// 如果不需要四舍五入,可以使用RoundingMode.DOWN
|
|
||||||
nf.setRoundingMode(RoundingMode.UP);
|
|
||||||
|
|
||||||
|
|
||||||
return nf.format(result);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Date long2Date( long time )
|
|
||||||
{
|
|
||||||
Calendar c = Calendar.getInstance();
|
|
||||||
c.setTimeInMillis( time );
|
|
||||||
return c.getTime();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,354 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.lang.Validator;
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.ReUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字符串工具类
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取参数不为空值
|
|
||||||
*
|
|
||||||
* @param value defaultValue 要判断的value
|
|
||||||
* @return value 返回值
|
|
||||||
*/
|
|
||||||
public static <T> T nvl(T value, T defaultValue) {
|
|
||||||
return ObjectUtil.defaultIfNull(value, defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取参数不为空值
|
|
||||||
*
|
|
||||||
* @param str defaultValue 要判断的value
|
|
||||||
* @return value 返回值
|
|
||||||
*/
|
|
||||||
public static String blankToDefault(String str, String defaultValue) {
|
|
||||||
return StrUtil.blankToDefault(str, defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个Collection是否为空, 包含List,Set,Queue
|
|
||||||
*
|
|
||||||
* @param coll 要判断的Collection
|
|
||||||
* @return true:为空 false:非空
|
|
||||||
*/
|
|
||||||
public static boolean isEmpty(Collection<?> coll) {
|
|
||||||
return CollUtil.isEmpty(coll);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个Collection是否非空,包含List,Set,Queue
|
|
||||||
*
|
|
||||||
* @param coll 要判断的Collection
|
|
||||||
* @return true:非空 false:空
|
|
||||||
*/
|
|
||||||
public static boolean isNotEmpty(Collection<?> coll) {
|
|
||||||
return !isEmpty(coll);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个对象数组是否为空
|
|
||||||
*
|
|
||||||
* @param objects 要判断的对象数组
|
|
||||||
* * @return true:为空 false:非空
|
|
||||||
*/
|
|
||||||
public static boolean isEmpty(Object[] objects) {
|
|
||||||
return ArrayUtil.isEmpty(objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个对象数组是否非空
|
|
||||||
*
|
|
||||||
* @param objects 要判断的对象数组
|
|
||||||
* @return true:非空 false:空
|
|
||||||
*/
|
|
||||||
public static boolean isNotEmpty(Object[] objects) {
|
|
||||||
return !isEmpty(objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个对象是否为空
|
|
||||||
*
|
|
||||||
* @param object 要判断的对象数组
|
|
||||||
* * @return true:为空 false:非空
|
|
||||||
*/
|
|
||||||
public static boolean isEmpty(Object object) {
|
|
||||||
return ObjectUtil.isEmpty(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个对象是否非空
|
|
||||||
*
|
|
||||||
* @param object 要判断的对象数组
|
|
||||||
* @return true:非空 false:空
|
|
||||||
*/
|
|
||||||
public static boolean isNotEmpty(Object object) {
|
|
||||||
return !isEmpty(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个Map是否为空
|
|
||||||
*
|
|
||||||
* @param map 要判断的Map
|
|
||||||
* @return true:为空 false:非空
|
|
||||||
*/
|
|
||||||
public static boolean isEmpty(Map<?, ?> map) {
|
|
||||||
return MapUtil.isEmpty(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个Map是否为空
|
|
||||||
*
|
|
||||||
* @param map 要判断的Map
|
|
||||||
* @return true:非空 false:空
|
|
||||||
*/
|
|
||||||
public static boolean isNotEmpty(Map<?, ?> map) {
|
|
||||||
return !isEmpty(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个字符串是否为空串
|
|
||||||
*
|
|
||||||
* @param str String
|
|
||||||
* @return true:为空 false:非空
|
|
||||||
*/
|
|
||||||
public static boolean isEmpty(String str) {
|
|
||||||
return StrUtil.isEmpty(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个字符串是否为非空串
|
|
||||||
*
|
|
||||||
* @param str String
|
|
||||||
* @return true:非空串 false:空串
|
|
||||||
*/
|
|
||||||
public static boolean isNotEmpty(String str) {
|
|
||||||
return !isEmpty(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个对象是否为空
|
|
||||||
*
|
|
||||||
* @param object Object
|
|
||||||
* @return true:为空 false:非空
|
|
||||||
*/
|
|
||||||
public static boolean isNull(Object object) {
|
|
||||||
return ObjectUtil.isNull(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个对象是否非空
|
|
||||||
*
|
|
||||||
* @param object Object
|
|
||||||
* @return true:非空 false:空
|
|
||||||
*/
|
|
||||||
public static boolean isNotNull(Object object) {
|
|
||||||
return !isNull(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * 判断一个对象是否是数组类型(Java基本型别的数组)
|
|
||||||
*
|
|
||||||
* @param object 对象
|
|
||||||
* @return true:是数组 false:不是数组
|
|
||||||
*/
|
|
||||||
public static boolean isArray(Object object) {
|
|
||||||
return ArrayUtil.isArray(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 去空格
|
|
||||||
*/
|
|
||||||
public static String trim(String str) {
|
|
||||||
return StrUtil.trim(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 截取字符串
|
|
||||||
*
|
|
||||||
* @param str 字符串
|
|
||||||
* @param start 开始
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public static String substring(final String str, int start) {
|
|
||||||
return substring(str, start, str.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 截取字符串
|
|
||||||
*
|
|
||||||
* @param str 字符串
|
|
||||||
* @param start 开始
|
|
||||||
* @param end 结束
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public static String substring(final String str, int start, int end) {
|
|
||||||
return StrUtil.sub(str, start, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 格式化文本, {} 表示占位符<br>
|
|
||||||
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
|
|
||||||
* 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
|
|
||||||
* 例:<br>
|
|
||||||
* 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
|
|
||||||
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
|
|
||||||
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
|
|
||||||
*
|
|
||||||
* @param template 文本模板,被替换的部分用 {} 表示
|
|
||||||
* @param params 参数值
|
|
||||||
* @return 格式化后的文本
|
|
||||||
*/
|
|
||||||
public static String format(String template, Object... params) {
|
|
||||||
return StrUtil.format(template, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否为http(s)://开头
|
|
||||||
*
|
|
||||||
* @param link 链接
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public static boolean ishttp(String link) {
|
|
||||||
return Validator.isUrl(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字符串转set
|
|
||||||
*
|
|
||||||
* @param str 字符串
|
|
||||||
* @param sep 分隔符
|
|
||||||
* @return set集合
|
|
||||||
*/
|
|
||||||
public static Set<String> str2Set(String str, String sep) {
|
|
||||||
return new HashSet<>(str2List(str, sep, true, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字符串转list
|
|
||||||
*
|
|
||||||
* @param str 字符串
|
|
||||||
* @param sep 分隔符
|
|
||||||
* @param filterBlank 过滤纯空白
|
|
||||||
* @param trim 去掉首尾空白
|
|
||||||
* @return list集合
|
|
||||||
*/
|
|
||||||
public static List<String> str2List(String str, String sep, boolean filterBlank, boolean trim) {
|
|
||||||
List<String> list = new ArrayList<>();
|
|
||||||
if (isEmpty(str)) {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 过滤空白字符串
|
|
||||||
if (filterBlank && isBlank(str)) {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
String[] split = str.split(sep);
|
|
||||||
for (String string : split) {
|
|
||||||
if (filterBlank && isBlank(string)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (trim) {
|
|
||||||
string = trim(string);
|
|
||||||
}
|
|
||||||
list.add(string);
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写
|
|
||||||
*
|
|
||||||
* @param cs 指定字符串
|
|
||||||
* @param searchCharSequences 需要检查的字符串数组
|
|
||||||
* @return 是否包含任意一个字符串
|
|
||||||
*/
|
|
||||||
public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) {
|
|
||||||
return StrUtil.containsAnyIgnoreCase(cs, searchCharSequences);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 驼峰转下划线命名
|
|
||||||
*/
|
|
||||||
public static String toUnderScoreCase(String str) {
|
|
||||||
return StrUtil.toUnderlineCase(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否包含字符串
|
|
||||||
*
|
|
||||||
* @param str 验证字符串
|
|
||||||
* @param strs 字符串组
|
|
||||||
* @return 包含返回true
|
|
||||||
*/
|
|
||||||
public static boolean inStringIgnoreCase(String str, String... strs) {
|
|
||||||
return StrUtil.equalsAnyIgnoreCase(str, strs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
|
|
||||||
*
|
|
||||||
* @param name 转换前的下划线大写方式命名的字符串
|
|
||||||
* @return 转换后的驼峰式命名的字符串
|
|
||||||
*/
|
|
||||||
public static String convertToCamelCase(String name) {
|
|
||||||
return StrUtil.upperFirst(StrUtil.toCamelCase(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 驼峰式命名法 例如:user_name->userName
|
|
||||||
*/
|
|
||||||
public static String toCamelCase(String s) {
|
|
||||||
return StrUtil.toCamelCase(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查找指定字符串是否匹配指定字符串列表中的任意一个字符串
|
|
||||||
*
|
|
||||||
* @param str 指定字符串
|
|
||||||
* @param strs 需要检查的字符串数组
|
|
||||||
* @return 是否匹配
|
|
||||||
*/
|
|
||||||
public static boolean matches(String str, List<String> strs) {
|
|
||||||
if (isEmpty(str) || isEmpty(strs)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (String pattern : strs) {
|
|
||||||
if (isMatch(pattern, str)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断url是否与规则配置:
|
|
||||||
* ? 表示单个字符;
|
|
||||||
* * 表示一层路径内的任意字符串,不可跨层级;
|
|
||||||
* ** 表示任意层路径;
|
|
||||||
*
|
|
||||||
* @param pattern 匹配规则
|
|
||||||
* @param url 需要匹配的url
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean isMatch(String pattern, String url) {
|
|
||||||
return ReUtil.isMatch(pattern, url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <T> T cast(Object obj) {
|
|
||||||
return (T) obj;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,132 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
//import nl.bitwalker.useragentutils.Browser;
|
|
||||||
//import nl.bitwalker.useragentutils.DeviceType;
|
|
||||||
//import nl.bitwalker.useragentutils.UserAgent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户代理字符串识别工具
|
|
||||||
* @author ThinkGem
|
|
||||||
* @version 2014-6-13
|
|
||||||
*/
|
|
||||||
public class UserAgentUtils {
|
|
||||||
// /**
|
|
||||||
// * 获取用户代理对象
|
|
||||||
// * @param request
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static UserAgent getUserAgent(HttpServletRequest request){
|
|
||||||
// return UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
|
|
||||||
// }
|
|
||||||
// /**
|
|
||||||
// * 获取设备类型
|
|
||||||
// * @param request
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static DeviceType getDeviceType(HttpServletRequest request){
|
|
||||||
// return getUserAgent(request).getOperatingSystem().getDeviceType();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 是否是PC
|
|
||||||
// * @param request
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static boolean isComputer(HttpServletRequest request){
|
|
||||||
// return DeviceType.COMPUTER.equals(getDeviceType(request));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 是否是手机
|
|
||||||
// * @param request
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static boolean isMobile(HttpServletRequest request){
|
|
||||||
// return DeviceType.MOBILE.equals(getDeviceType(request));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 是否是平板
|
|
||||||
// * @param request
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static boolean isTablet(HttpServletRequest request){
|
|
||||||
// return DeviceType.TABLET.equals(getDeviceType(request));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 是否是手机和平板
|
|
||||||
// * @param request
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static boolean isMobileOrTablet(HttpServletRequest request){
|
|
||||||
// DeviceType deviceType = getDeviceType(request);
|
|
||||||
// return DeviceType.MOBILE.equals(deviceType) || DeviceType.TABLET.equals(deviceType);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 获取浏览类型
|
|
||||||
// * @param request
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static Browser getBrowser(HttpServletRequest request){
|
|
||||||
// return getUserAgent(request).getBrowser();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 是否IE版本是否小于等于IE8
|
|
||||||
// * @param request
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static boolean isLteIE8(HttpServletRequest request){
|
|
||||||
// Browser browser = getBrowser(request);
|
|
||||||
// return Browser.IE5.equals(browser) || Browser.IE6.equals(browser)
|
|
||||||
// || Browser.IE7.equals(browser) || Browser.IE8.equals(browser);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 获取当前用户
|
|
||||||
// * @return 取不到返回 new User()
|
|
||||||
// */
|
|
||||||
// public static PubUserEntity getUser(){
|
|
||||||
// PubUserEntity user = getUsers();
|
|
||||||
// if (user != null) {
|
|
||||||
// return user;
|
|
||||||
// }
|
|
||||||
// // 如果没有登录,则返回实例化空的User对象。
|
|
||||||
// return new PubUserEntity();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 获取当前用户
|
|
||||||
// *
|
|
||||||
// * @return 取不到返回 new User()
|
|
||||||
// */
|
|
||||||
// public static PubUserEntity getUsers() {
|
|
||||||
// return (PubUserEntity) getHttpServletRequest().getSession().getAttribute("iv-user");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 获得当前的Servlet请求对象
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static HttpServletRequest getHttpServletRequest() {
|
|
||||||
// ServletRequestAttributes sa = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
||||||
// if (sa == null) return null;
|
|
||||||
// return sa.getRequest();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 获取当前用户
|
|
||||||
// * @return 取不到返回 new User()
|
|
||||||
// */
|
|
||||||
// public static PubUserEntity getUserByNull(){
|
|
||||||
// PubUserEntity user = getUser();
|
|
||||||
// if (user != null) {
|
|
||||||
// return user;
|
|
||||||
// }
|
|
||||||
// // 如果没有登录,则返回null
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
}
|
|
@ -1,124 +0,0 @@
|
|||||||
package com.blueland.core.util;
|
|
||||||
|
|
||||||
import com.blueland.bo.TucStaffEntity;
|
|
||||||
import com.blueland.model.TUcStaff;
|
|
||||||
import com.blueland.service.ITucStaffService;
|
|
||||||
import com.blueland.service.impl.TucStaffServiceImpl;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description 用户工具类
|
|
||||||
* @Date 2021/7/22 1:30 下午
|
|
||||||
* @Created BigTian
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class UserUtils {
|
|
||||||
private static ITucStaffService tucStaffServiceImpl;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ITucStaffService tucStaffServiceImpl2;
|
|
||||||
|
|
||||||
public static String getEmpno() {
|
|
||||||
return getUser().getStaffNum();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
tucStaffServiceImpl = tucStaffServiceImpl2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取iv-userId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getIvUser() {
|
|
||||||
HttpServletRequest request = getRequest();
|
|
||||||
return Optional.ofNullable(request)
|
|
||||||
.map(el -> el.getHeader("iv-user"))
|
|
||||||
.orElse("luob");
|
|
||||||
//.orElseThrow(() -> new BusinessException("请求头中没有iv-user"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取租户id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
// tenantid
|
|
||||||
public static String getTenantId() {
|
|
||||||
HttpServletRequest request = getRequest();
|
|
||||||
return Optional.ofNullable(request)
|
|
||||||
.map(el -> el.getHeader("tenantid"))
|
|
||||||
.orElseThrow(() -> new RuntimeException("请求头中没有tenantid"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取租户id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getAppId() {
|
|
||||||
HttpServletRequest request = getRequest();
|
|
||||||
return Optional.ofNullable(request)
|
|
||||||
.map(el -> el.getHeader("tenantid"))
|
|
||||||
.orElse("");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取岗位id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
// staffPostCode
|
|
||||||
public static String getPostCode() {
|
|
||||||
HttpServletRequest request = getRequest();
|
|
||||||
return Optional.ofNullable(request)
|
|
||||||
.map(el -> el.getHeader("staffPostCode"))
|
|
||||||
.orElseThrow(() -> new RuntimeException("请求头中没有staffPostCode"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前登录人信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static TUcStaff getUser() {
|
|
||||||
TucStaffEntity model = new TucStaffEntity();
|
|
||||||
model.setStaffNum(getIvUser());
|
|
||||||
return tucStaffServiceImpl.get(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取请求属性
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static ServletRequestAttributes getRequestAttr() {
|
|
||||||
return (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取request
|
|
||||||
*/
|
|
||||||
public static HttpServletRequest getRequest() {
|
|
||||||
ServletRequestAttributes attributes = getRequestAttr();
|
|
||||||
return Optional.ofNullable(attributes).
|
|
||||||
map(ServletRequestAttributes::getRequest)
|
|
||||||
.orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取response
|
|
||||||
*/
|
|
||||||
public static HttpServletResponse getResponse() {
|
|
||||||
ServletRequestAttributes attributes = getRequestAttr();
|
|
||||||
return attributes.getResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPfAdminUser;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.blueland.bo.AdminUserEntity;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AdminUserDao extends BaseMapper<TPfAdminUser> {
|
|
||||||
/**
|
|
||||||
* 根据条件查询查询tagAdminUser列表
|
|
||||||
*/
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
public List<AdminUserEntity> findAdminUserListByParams(@Param("bo") Map<String,Object> tagAdminUser);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过bizId 删除数据
|
|
||||||
* @param bizId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int deleteAdminUserByBizId(String bizId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量插入
|
|
||||||
* @param list
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int insertBatchAdminUser(List<AdminUserEntity> list);
|
|
||||||
|
|
||||||
public int batchDeleteByAppId(String[] appIds);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
public List<AdminUserEntity> findAdminOrgListByParams(@Param("bo")Map<String, Object> params);
|
|
||||||
|
|
||||||
public AdminUserEntity getByAppidAndUsercode(@Param(value="appId")String appId, @Param(value="userCode")String userCode);
|
|
||||||
|
|
||||||
List<AdminUserEntity> findList(@Param("bo") AdminUserEntity entity);
|
|
||||||
|
|
||||||
Page<AdminUserEntity> findPage(@Param("page") Page<AdminUserEntity> page,@Param("bo") AdminUserEntity entity);
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import com.blueland.bo.AppEntity;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AppDao extends BaseMapper<AppEntity> {
|
|
||||||
|
|
||||||
List<AppEntity> findList(@Param("bo") AppEntity bo);
|
|
||||||
|
|
||||||
Page<AppEntity> findPage(@Param("page") Page<AppEntity> page,@Param("bo") AppEntity entity);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPfApplicationDb;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import com.blueland.bo.AppDatabaseEntity;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AppDatabaseDao extends BaseMapper<TPfApplicationDb> {
|
|
||||||
/**
|
|
||||||
* 通过appId 删除数据
|
|
||||||
*/
|
|
||||||
int deleteAppDatabaseByAppId(String appId);
|
|
||||||
|
|
||||||
AppDatabaseEntity findList(@Param("bo") Map<String, Object> params);
|
|
||||||
|
|
||||||
int batchDeleteByAppId(String[] appIds);
|
|
||||||
|
|
||||||
List<AppDatabaseEntity> findListNew(@Param("bo") AppDatabaseEntity bo);
|
|
||||||
|
|
||||||
Page<AppDatabaseEntity> findPage(@Param("page") Page<AppDatabaseEntity> page, @Param("bo") AppDatabaseEntity bo);
|
|
||||||
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPfApplication;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.blueland.bo.ApplicationEntity;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
public interface ApplicationDao extends BaseMapper<TPfApplication> {
|
|
||||||
/**
|
|
||||||
* 根据条件查询查询tagApplication列表
|
|
||||||
*/
|
|
||||||
List<ApplicationEntity> findApplicationListByParams(@Param("bo") Map<String, Object> tagApplication);
|
|
||||||
|
|
||||||
Page<ApplicationEntity> findApplicationPageByParams(@Param("page") Page<ApplicationEntity> page, @Param("bo") Map<String, Object> tagApplication);
|
|
||||||
|
|
||||||
Integer batchDelete(String[] appIds);
|
|
||||||
|
|
||||||
//应用关联模块所有数据
|
|
||||||
List<Map<String, Object>> appLinkModule();
|
|
||||||
|
|
||||||
//获取用户所有有权限的应用
|
|
||||||
List<ApplicationEntity> findApplicationListByUser(@Param(value = "userId") String userId);
|
|
||||||
|
|
||||||
List<ApplicationEntity> findList(@Param("bo") ApplicationEntity entity);
|
|
||||||
|
|
||||||
Page<ApplicationEntity> findPage(@Param("page")Page<ApplicationEntity> page, @Param("bo") ApplicationEntity entity);
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.bo.AreaEntity;
|
|
||||||
import com.blueland.model.TArea;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AreaDao extends BaseMapper<TArea> {
|
|
||||||
|
|
||||||
/*根据条件查询列表*/
|
|
||||||
List<AreaEntity> getList(@Param("bo") Map<String, Object> area);
|
|
||||||
|
|
||||||
Page<AreaEntity> findPage(@Param("page")Page<AreaEntity> page, @Param("bo") Map<String, Object> area);
|
|
||||||
|
|
||||||
AreaEntity getbyid(String id);
|
|
||||||
|
|
||||||
int updateArea(AreaEntity model);
|
|
||||||
|
|
||||||
List<AreaEntity> queryArea();
|
|
||||||
|
|
||||||
int insetArea(AreaEntity areaEntity);
|
|
||||||
|
|
||||||
void deleteArea(String id);
|
|
||||||
|
|
||||||
//查询不含顶级的所有数据
|
|
||||||
List<AreaEntity> queryall();
|
|
||||||
|
|
||||||
void saveBatch(@Param("list")List<AreaEntity> list);
|
|
||||||
|
|
||||||
//查询所有数据
|
|
||||||
List<AreaEntity> selectList();
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 代码自动生成工具
|
|
||||||
* @version 1.0
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.bo.*;
|
|
||||||
|
|
||||||
import com.blueland.model.TPfAttachment;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AttachmentDao extends BaseMapper<TPfAttachment> {
|
|
||||||
|
|
||||||
void updateAttachment(AttachmentEntity atta);
|
|
||||||
|
|
||||||
List<AttachmentEntity> findPageList(@Param("bo") AttachmentEntity attachmentEntity);
|
|
||||||
|
|
||||||
Page<AttachmentEntity> findPage(@Param("page") Page<AttachmentEntity> page, @Param("bo")AttachmentEntity attachmentEntity);
|
|
||||||
|
|
||||||
List<AttachmentEntity> findList(@Param("bo")AttachmentEntity attachmentEntity);
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPfAuth;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.blueland.bo.AuthEntity;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AuthDao extends BaseMapper<TPfAuth> {
|
|
||||||
|
|
||||||
int findAuthByMenuIdRoleId(@Param("menuId")String menuId, @Param("roleId")String roleId);
|
|
||||||
|
|
||||||
void deleteRole(@Param("roleId")String roleId, @Param("appId")String appId);
|
|
||||||
|
|
||||||
List<AuthEntity> getListByRoleId(@Param("roleId")String roleId);
|
|
||||||
|
|
||||||
List<AuthEntity> findList(@Param("bo") AuthEntity bo);
|
|
||||||
|
|
||||||
Page<AuthEntity> findPage(@Param("page")Page<AuthEntity> page, @Param("bo") AuthEntity entity);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
void deleteAuthByAppId(@Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<AuthEntity> findListByAppId(@Param("appId") String appId);
|
|
||||||
}
|
|
@ -1,87 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 代码自动生成工具
|
|
||||||
* @version 1.0
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPfDict;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import com.blueland.bo.DictEntity;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface DictDao extends BaseMapper<TPfDict> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件查询查询字典列表
|
|
||||||
*/
|
|
||||||
List<DictEntity> findDictPageListByParams(@Param("bo") Map<String, Object> dict);
|
|
||||||
|
|
||||||
Page<DictEntity> findDictPagePageByParams(@Param("page") Page<DictEntity> page, @Param("bo") Map<String, Object> dict);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增dict
|
|
||||||
*
|
|
||||||
* @param dict
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int insertDict(DictEntity dict);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改dict
|
|
||||||
*
|
|
||||||
* @param dict
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int updateDict(DictEntity dict);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刪除dict
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int deleteDictById(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刪除dict
|
|
||||||
*
|
|
||||||
* @param dictCode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int deleteDicts(String dictCode);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<DictEntity> getList(@Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
void deleteDictByAppId(@Param("appId")String appId);
|
|
||||||
|
|
||||||
List<DictEntity> getDictList();
|
|
||||||
|
|
||||||
List<DictEntity> getDictListByCode(@Param("code") String code, @Param("parentCode") String parentCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ids获取字典
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DictEntity> findByIds(@Param("ids") String[] ids);
|
|
||||||
|
|
||||||
List<DictEntity> findDictPageListByAppId(@Param("appId") String appId);
|
|
||||||
|
|
||||||
List<DictEntity> findList(@Param("bo") DictEntity bo);
|
|
||||||
|
|
||||||
Page<DictEntity> findPage(@Param("page") Page<DictEntity> page, @Param("bo") DictEntity entity);
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 代码自动生成工具
|
|
||||||
* @version 1.0
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.bo.*;
|
|
||||||
|
|
||||||
import com.blueland.model.TPfMenu;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface MenuDao extends BaseMapper<TPfMenu> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有数据列表
|
|
||||||
* @param appId
|
|
||||||
* @param parentId
|
|
||||||
* @return
|
|
||||||
* 根据appId获取菜单
|
|
||||||
*/
|
|
||||||
public List<MenuEntity> findAppIdMenuList(@Param("appId") String appId, @Param("parentId") String parentId);
|
|
||||||
|
|
||||||
public List<MenuEntity> getMenu(@Param("appId")String appId,@Param("userId") String userId,@Param("menuType") String menuType, @Param("menuId")String menuId);
|
|
||||||
|
|
||||||
public List<MenuEntity> getMenuIsOpenStatus(String appId);
|
|
||||||
|
|
||||||
public List<MenuEntity> getMenuAll(@Param("appId")String appId, @Param("menuName")String menuName, @Param("parentName")String parentName,@Param("menuType")String menuType);
|
|
||||||
|
|
||||||
public List<MenuEntity> getMenuTop(@Param("appId")String appId, @Param("menuName")String menuName, @Param("parentName")String parentName,@Param("menuType")String menuType);
|
|
||||||
|
|
||||||
public List<MenuEntity> getMenuNoTop(@Param("appId")String appId, @Param("menuName")String menuName, @Param("parentName")String parentName,@Param("menuType")String menuType);
|
|
||||||
|
|
||||||
public List<Map<String, Object>> findListByPid(String pid);
|
|
||||||
|
|
||||||
public List<MenuEntity> getParent(@Param("menuId")String menuId,@Param("appId") String appId);
|
|
||||||
|
|
||||||
public List<MenuEntity> listRoleMenu(String appId);
|
|
||||||
|
|
||||||
public List<MenuEntity> getParentRole(@Param("menuId")String menuId,@Param("appId") String appId,@Param("roleId") String roleId);
|
|
||||||
|
|
||||||
public int getMenuLevel(String menuParentId);
|
|
||||||
|
|
||||||
public List<MenuEntity> getMenuCode(@Param("menuCode")String menuCode, @Param("userId")String userId,@Param("appId")String appId,@Param("menuType")String menuType);
|
|
||||||
|
|
||||||
public List<MenuEntity> getButtonByMenuCode(@Param("menuCode")String menuCode);
|
|
||||||
|
|
||||||
public List<MenuEntity> getMenuByRoleIdAndAppId(@Param("appId") String appId,@Param("roleId") String roleId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 据staffcode和appid查询改员工的一级菜单、操作权限目录
|
|
||||||
* @param appId
|
|
||||||
* @param staffCode
|
|
||||||
* @return
|
|
||||||
* @author hpp
|
|
||||||
* @Time 2021年5月18日 上午9:47:59
|
|
||||||
*/
|
|
||||||
public List<MenuEntity> getMenuTopByStaffCode(@Param("appId") String appId, @Param("staffCode") String staffCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看该员工所拥有的下家菜单、操作权限
|
|
||||||
* @param menuId
|
|
||||||
* @param appId
|
|
||||||
* @param staffCode
|
|
||||||
* @return
|
|
||||||
* @author hpp
|
|
||||||
* @Time 2021年5月18日 上午10:29:10
|
|
||||||
*/
|
|
||||||
public List<MenuEntity> getParentByStaffCode(@Param("menuId")String menuId, @Param("appId")String appId, @Param("staffCode")String staffCode);
|
|
||||||
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<RoleMenuRedisDTO> findListRoleMenu(@Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<MenuEntity> findMenuList(@Param("appId") String appId);
|
|
||||||
|
|
||||||
List<MenuEntity> findList( @Param("bo") MenuEntity bo);
|
|
||||||
|
|
||||||
Page<MenuEntity> findPage(@Param("page")Page<MenuEntity> page, @Param("bo") MenuEntity entity);
|
|
||||||
// 6.0.0
|
|
||||||
|
|
||||||
List<MenuEntity> getMenuByPostCode(@Param("appId")String appId,@Param("postCode") String postCode,@Param("menuType") String menuType, @Param("menuId")String menuId);
|
|
||||||
|
|
||||||
List<MenuEntity> getMenuBuCode(@Param("menuCode")String menuCode, @Param("postCode")String postCode,@Param("appId")String appId,@Param("menuType")String menuType);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
void deleteMenuByAppId(@Param("appId") String appId);
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPfModule;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import com.blueland.bo.ModuleEntity;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface ModuleDao extends BaseMapper<TPfModule> {
|
|
||||||
|
|
||||||
//根据appId查询模块列表
|
|
||||||
List<ModuleEntity> findModuleListByAppId(String appId);
|
|
||||||
|
|
||||||
List<ModuleEntity> findList(@Param("bo") ModuleEntity bo);
|
|
||||||
|
|
||||||
Page<ModuleEntity> findPage(@Param("page") Page<ModuleEntity> page, @Param("bo") ModuleEntity entity);
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 代码自动生成工具
|
|
||||||
* @version 1.0
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.bo.Org;
|
|
||||||
import com.blueland.bo.TreeEntity;
|
|
||||||
import com.blueland.model.TUcOrg;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
@Mapper
|
|
||||||
public interface OrgDao extends BaseMapper<TUcOrg> {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPfParameter;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.blueland.bo.ParameterEntity;
|
|
||||||
import com.blueland.bo.RoleEntity;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface ParameterDao extends BaseMapper<TPfParameter> {
|
|
||||||
|
|
||||||
List<RoleEntity> findPageList(@Param("bo") Map<String, Object> queryParams);
|
|
||||||
|
|
||||||
Page<ParameterEntity> findPageListNew(@Param("page") Page<ParameterEntity> page, @Param("bo") Map<String, Object> queryParams);
|
|
||||||
|
|
||||||
List<ParameterEntity> parameterListPage(@Param("bo") Map<String, Object> queryParams);
|
|
||||||
|
|
||||||
Page<ParameterEntity> parameterPage(@Param("page") Page<ParameterEntity> page, @Param("bo") Map<String, Object> queryParams);
|
|
||||||
|
|
||||||
//20190724 add
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
ParameterEntity getByKey(@Param(value="key")String key);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
String getValueByKey(@Param("key") String key);
|
|
||||||
/**
|
|
||||||
* 获取对象
|
|
||||||
* @param obj
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
ParameterEntity getObj(@Param("bo") ParameterEntity obj);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<ParameterEntity> findList(@Param("bo") ParameterEntity bo);
|
|
||||||
|
|
||||||
Page<ParameterEntity> findPage(@Param("page")Page<ParameterEntity> page, @Param("bo") ParameterEntity entity);
|
|
||||||
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 代码自动生成工具
|
|
||||||
* @version 1.0
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import com.blueland.bo.Org;
|
|
||||||
import com.blueland.bo.PubOrgEntity;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface PubOrgDao extends BaseMapper<PubOrgEntity> {
|
|
||||||
|
|
||||||
List<Org> getListNoPage(@Param("bo") Org org);
|
|
||||||
|
|
||||||
List<PubOrgEntity> findList(@Param("bo") PubOrgEntity bo);
|
|
||||||
|
|
||||||
Page<PubOrgEntity> findPage(@Param("page") Page<PubOrgEntity> page, @Param("bo") PubOrgEntity entity);
|
|
||||||
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 代码自动生成工具
|
|
||||||
* @version 1.0
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPubUser;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import com.blueland.bo.PubUserEntity;
|
|
||||||
import com.blueland.bo.RoleUserRest;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface PubUserDao extends BaseMapper<TPubUser> {
|
|
||||||
|
|
||||||
List<RoleUserRest> getAppRoleUser(@Param("bo")Map<String, Object> params);
|
|
||||||
|
|
||||||
Page<RoleUserRest> getAppRoleUserPage(@Param("page") Page<RoleUserRest> page, @Param("bo")Map<String, Object> params);
|
|
||||||
|
|
||||||
List<PubUserEntity> findList(@Param("bo")PubUserEntity bo);
|
|
||||||
|
|
||||||
Page<PubUserEntity> findPage(@Param("page") Page<PubUserEntity> page, @Param("bo")PubUserEntity entity);
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.blueland.bo.AppIdUserIdAppIdRoleIdDTO;
|
|
||||||
import com.blueland.bo.Role2userEntity;
|
|
||||||
import com.blueland.model.TPfRole2user;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface Role2userDao extends BaseMapper<TPfRole2user> {
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<AppIdUserIdAppIdRoleIdDTO> findListRoleId(@Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
void deleteByAppId(@Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<TPfRole2user> selectListByAppId(@Param("appId") String appId);
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 代码自动生成工具
|
|
||||||
* @version 1.0
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPfRole;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.blueland.bo.Role2userEntity;
|
|
||||||
import com.blueland.bo.RoleEntity;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface RoleDao extends BaseMapper<TPfRole> {
|
|
||||||
|
|
||||||
List<RoleEntity> getAppRole(Map<String,Object> map);
|
|
||||||
|
|
||||||
Page<RoleEntity> getAppRolePage(@Param("page") Page<RoleEntity> page, @Param("bo") Map<String,Object> map);
|
|
||||||
|
|
||||||
void deleteRole(Map<String, Object> queryParams);
|
|
||||||
|
|
||||||
List<RoleEntity> findRoleUserBy(Map<String, Object> map);
|
|
||||||
|
|
||||||
List<RoleEntity> findRolesByUser(@Param("appId")String appId, @Param("userId")String userId);
|
|
||||||
|
|
||||||
int findUserId(RoleEntity model, String userId);
|
|
||||||
|
|
||||||
int findUserId(@Param("appId")String appId, @Param("roleId")String roleId,@Param("userId")String userId);
|
|
||||||
|
|
||||||
void saveUser(Role2userEntity role2user);
|
|
||||||
|
|
||||||
int deleteUserId(@Param("appId")String appId, @Param("roleId")String roleId,@Param("userId")String userId);
|
|
||||||
|
|
||||||
int findAppidByRoleId(@Param("appId")String appId, @Param("roleId")String roleId);
|
|
||||||
|
|
||||||
void deluser(@Param("roleId")String roleId, @Param("appId")String appId);
|
|
||||||
|
|
||||||
List<RoleEntity> findRoleTenantidByUserid(@Param("userId")String userId);
|
|
||||||
|
|
||||||
List<RoleEntity> findList(@Param("bo")RoleEntity bo);
|
|
||||||
|
|
||||||
Page<RoleEntity> findPage(@Param("page") Page<RoleEntity> page,@Param("bo") RoleEntity entity);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<RoleEntity> findRolesByPostCode(@Param("appId")String appId, @Param("postCode")String postCode);
|
|
||||||
|
|
||||||
List<RoleEntity> findRoleAllByPostCode(@Param("postCode")String postCode);
|
|
||||||
|
|
||||||
List<RoleEntity> findRoleUserByCode(@Param("appId")String appId, @Param("roleId")String roleId, @Param("postCode")String postCode);
|
|
||||||
|
|
||||||
int deleteByPostCode(@Param("appId")String appId, @Param("roleId")String roleId,@Param("postCode")String postCode);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
void deleteByAppId(@Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<RoleEntity> findListByAppId(@Param("appId")String appId);
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 代码自动生成工具
|
|
||||||
* @version 1.0
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.bo.RoleUserRest;
|
|
||||||
import com.blueland.bo.TreeEntity;
|
|
||||||
import com.blueland.bo.TucStaffEntity;
|
|
||||||
import com.blueland.model.TUcStaff;
|
|
||||||
import com.blueland.vo.StaffPostVO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
@Mapper
|
|
||||||
public interface StaffDao extends BaseMapper<TUcStaff> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPfSysOplog;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import com.blueland.bo.SysOplogEntity;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface SysOplogDao extends BaseMapper<TPfSysOplog> {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件查询查询列表
|
|
||||||
*/
|
|
||||||
List<SysOplogEntity> findSysOplogListByParams(@Param("bo")Map<String, Object> tagSysOplog);
|
|
||||||
|
|
||||||
Page<SysOplogEntity> findSysOplogPageByParams(@Param("page") Page<SysOplogEntity> page, @Param("bo")Map<String, Object> tagSysOplog);
|
|
||||||
|
|
||||||
List<SysOplogEntity> findList(@Param("bo")SysOplogEntity bo);
|
|
||||||
|
|
||||||
Page<SysOplogEntity> findPage(@Param("page") Page<SysOplogEntity> page, @Param("bo")SysOplogEntity entity);
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.model.TPfSysPvlog;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import com.blueland.bo.SysPvlogEntity;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface SysPvlogDao extends BaseMapper<TPfSysPvlog> {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件查询查询列表
|
|
||||||
*/
|
|
||||||
List<SysPvlogEntity> findSysPvlogListByParams(@Param("bo") Map<String, Object> tagSysPvlog);
|
|
||||||
|
|
||||||
Page<SysPvlogEntity> findSysPvlogPageByParams(@Param("page") Page<SysPvlogEntity> page, @Param("bo") Map<String, Object> tagSysPvlog);
|
|
||||||
|
|
||||||
List<SysPvlogEntity> findList(@Param("bo") SysPvlogEntity bo);
|
|
||||||
|
|
||||||
Page<SysPvlogEntity> findPage(@Param("page") Page<SysPvlogEntity> page, @Param("bo") SysPvlogEntity entity);
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.bo.SysTimetaskEntity;
|
|
||||||
import com.blueland.model.TPfSysTimetask;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface SysTimetaskDao extends BaseMapper<TPfSysTimetask> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件查询查询列表
|
|
||||||
*/
|
|
||||||
List<SysTimetaskEntity> findSysTimetaskListByParams(@Param("bo") Map<String, Object> tagSysTimetask);
|
|
||||||
|
|
||||||
Page<SysTimetaskEntity> findSysTimetaskPageByParams(@Param("page") Page<SysTimetaskEntity> page, @Param("bo") Map<String, Object> tagSysTimetask);
|
|
||||||
|
|
||||||
List<SysTimetaskEntity> findList(@Param("bo")SysTimetaskEntity bo);
|
|
||||||
|
|
||||||
Page<SysTimetaskEntity> findPage(@Param("page") Page<SysTimetaskEntity> page, @Param("bo") SysTimetaskEntity entity);
|
|
||||||
}
|
|
@ -1,85 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 代码自动生成工具
|
|
||||||
* @version 1.0
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.bo.*;
|
|
||||||
|
|
||||||
|
|
||||||
import com.blueland.model.TUcOrg;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface TucOrgDao extends BaseMapper<TUcOrg> {
|
|
||||||
|
|
||||||
List<Org> getListNoPage(@Param("bo") Org entity);
|
|
||||||
|
|
||||||
Page<Org> getOrgPage(@Param("page") Page<Org> page, @Param("bo") Org org);
|
|
||||||
|
|
||||||
List<Org> getOrgChildLst(@Param("bo") Org org);
|
|
||||||
|
|
||||||
Page<Org> getOrgChildPage(@Param("page") Page<Org> page, @Param("bo") Org org);
|
|
||||||
|
|
||||||
List<Org> findOrgIdList(@Param("bo") Org org);
|
|
||||||
|
|
||||||
List<TreeEntity> searchOrg(@Param("bo") Org org);
|
|
||||||
|
|
||||||
List<Org> getChildLstByOrgId(@Param(value = "orgId") String orgId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据组织类型查询所有组织
|
|
||||||
* @param startDeptcode
|
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
* @author hpp
|
|
||||||
* @Time 2020年12月7日 上午10:34:29
|
|
||||||
*/
|
|
||||||
List<Map<String, String>> getOrgByWorktype(@Param(value = "startDeptcode") String startDeptcode, @Param(value = "orgworktype") String orgworktype);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 只查询部门code和名称
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<Org> list(@Param("appId") String appId);
|
|
||||||
|
|
||||||
Org getOne(@Param("bo") Org org);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
Org getByAppId(@Param("bo") Org org);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<Org> findList(@Param("bo") Org org);
|
|
||||||
|
|
||||||
Page<Org> findPage(@Param("page") Page<Org> page, @Param("bo") Org org);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
Integer countOrgById(@Param("id") String id, @Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
void deleteOrgByAppId(@Param("appId") String appId);
|
|
||||||
|
|
||||||
String getTopOrgId();
|
|
||||||
|
|
||||||
String getSellOrgId(@Param("deptCode") String deptCode);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
String getAppIdByParentId(@Param("parentId") String parentId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
String getOrgIdByAppId(@Param("appId") String appId, @Param("deptId") String deptId);
|
|
||||||
|
|
||||||
Org getByOgId(@Param("orgId") String orgId);
|
|
||||||
|
|
||||||
Org getByOgIdAndType(@Param("orgId") String orgId, @Param("type") String type);
|
|
||||||
}
|
|
@ -1,140 +0,0 @@
|
|||||||
package com.blueland.dao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 代码自动生成工具
|
|
||||||
* @version 1.0
|
|
||||||
* @since
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.blueland.bo.TreeEntity;
|
|
||||||
import com.blueland.model.TUcStaff;
|
|
||||||
import com.blueland.vo.StaffNumVO;
|
|
||||||
import com.blueland.vo.StaffPostVO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.blueland.bo.RoleUserRest;
|
|
||||||
import com.blueland.bo.TucStaffEntity;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface TucStaffDao extends BaseMapper<TUcStaff> {
|
|
||||||
|
|
||||||
List<TucStaffEntity> getStaffInfoByOrgTop(@Param("bo")TucStaffEntity staff);
|
|
||||||
|
|
||||||
Page<TucStaffEntity> getStaffInfoByOrgTopPage(@Param("page") Page<TucStaffEntity> page, @Param("bo")TucStaffEntity staff);
|
|
||||||
|
|
||||||
List<TucStaffEntity> getSubStaffs(@Param("bo")TucStaffEntity entity);
|
|
||||||
|
|
||||||
Page<TucStaffEntity> getSubStaffsPage(@Param("page")Page<TucStaffEntity> page, @Param("bo")TucStaffEntity entity);
|
|
||||||
|
|
||||||
void deleteByCode(String staffCode);
|
|
||||||
|
|
||||||
void updateByCode(TucStaffEntity model);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
void updateByNum(TucStaffEntity model);
|
|
||||||
|
|
||||||
List<RoleUserRest> getAppRoleUser(@Param("bo")Map<String, Object> params);
|
|
||||||
|
|
||||||
Page<RoleUserRest> getAppRoleUserPage(@Param("page") Page<RoleUserRest> page, @Param("bo")Map<String, Object> params);
|
|
||||||
|
|
||||||
Page<RoleUserRest> getAppRoleUserPage2(@Param("page") Page<RoleUserRest> page, @Param("bo")Map<String, Object> params);
|
|
||||||
|
|
||||||
//20200728 add
|
|
||||||
List<TucStaffEntity> getAppRoleUserList(@Param("bo")Map<String, Object> params);
|
|
||||||
|
|
||||||
List<TreeEntity> searchUser(@Param("bo")TucStaffEntity tucStaffEntity);
|
|
||||||
|
|
||||||
List<TreeEntity> searchUser4deptId(@Param("bo")TucStaffEntity tucStaffEntity);
|
|
||||||
|
|
||||||
List<TucStaffEntity> getStaffByOrgs(@Param("bo")TucStaffEntity entity);
|
|
||||||
|
|
||||||
Page<TucStaffEntity> getStaffByOrgsPage(@Param("page") Page<TucStaffEntity> page, @Param("bo")TucStaffEntity entity);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据顶级orgId条件查询人员
|
|
||||||
* @param tucStaffEntity
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<TucStaffEntity> findListByName(@Param("bo")TucStaffEntity tucStaffEntity);
|
|
||||||
|
|
||||||
//20200907 add
|
|
||||||
TucStaffEntity getByStaffCode(String staffCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据
|
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
* @author hpp
|
|
||||||
* @Time 2020年10月27日 下午5:55:10
|
|
||||||
*/
|
|
||||||
List<TucStaffEntity> getByStaffcodes(@Param("staffcodes") List<String> staffcodes);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
void updateDeptnameByDeptid(@Param("deptname") String deptname, @Param("deptcode") String deptcode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据设备码来清空设备码
|
|
||||||
* @param staffPhoneBak
|
|
||||||
*/
|
|
||||||
void updateByStaffPhoneBak(@Param("staffPhoneBak") String staffPhoneBak);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据直接上级员工号查询直接上级
|
|
||||||
* @param staffFax
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
TucStaffEntity getByStaffFax(@Param("staffFax") String staffFax);
|
|
||||||
|
|
||||||
|
|
||||||
List<TucStaffEntity> getStaffList(@Param("name") String name);
|
|
||||||
|
|
||||||
List<TucStaffEntity> getListByCodes(@Param("codes") List<String> codes);
|
|
||||||
|
|
||||||
List<TucStaffEntity> findListStaffCodeStaffNum();
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<TucStaffEntity> findListQY(@Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<TucStaffEntity> findList(@Param("bo") TucStaffEntity bo);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<TucStaffEntity> findListByRoleAndStaffCode(@Param("codes") List<String> codes);
|
|
||||||
|
|
||||||
Page<TucStaffEntity> findPage(@Param("page")Page<TucStaffEntity> page, @Param("bo")TucStaffEntity bo);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<StaffPostVO> findStaffPostList(@Param("staffCode") String staffCode);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
List<StaffPostVO> findStaffPostList2(@Param("staffCode") String staffCode);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
void deleteByPostCode(@Param("postCode") String postCode);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
TucStaffEntity getByPostCode(@Param("postCode") String postCode, @Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
TucStaffEntity selectStaffByNumAndDept(@Param("staffNum") String staffNum, @Param("deptId") String deptId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
TucStaffEntity selectStaffByNum(@Param("staffNum")String staffNum);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
Integer countStaff(@Param("id") String id, @Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
Integer countStaffByNum(@Param("num") String num, @Param("appId") String appId);
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
void deleteStaffByAppId(@Param("appId") String appId);
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package com.blueland.enums;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @program: crm
|
|
||||||
* @description: crm版本管理
|
|
||||||
* @author: bigtian
|
|
||||||
* @create: 2022-01-04 10:46
|
|
||||||
*/
|
|
||||||
public enum Version {
|
|
||||||
SIX("v6.0.0");
|
|
||||||
private String version;
|
|
||||||
|
|
||||||
Version(String version) {
|
|
||||||
this.version = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersion() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVersion(String version) {
|
|
||||||
this.version = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
package com.blueland.handler;
|
|
||||||
|
|
||||||
import cn.hutool.core.exceptions.ValidateException;
|
|
||||||
import com.blueland.result.R;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import static com.blueland.constant.ResponseConstant.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author BigTian
|
|
||||||
* @Description 异常统一处理类
|
|
||||||
* @Date 2021/10/20 10:45 上午
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestControllerAdvice
|
|
||||||
public class GlobalExceptionHandler {
|
|
||||||
|
|
||||||
public static final String ERROR_MESSAGE = "访问路径:{},错误信息:{},错误行数:{}";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理属性检验异常
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(ArithmeticException.class)
|
|
||||||
public R arithmeticExceptionHandler(HttpServletRequest request, ArithmeticException e) {
|
|
||||||
log.error(ERROR_MESSAGE, request.getRequestURI(), e.getMessage(), e.getStackTrace()[0]);
|
|
||||||
e.printStackTrace();
|
|
||||||
return R.fail(RESULT_SERVER_ERR_CODE, e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理运行时异常
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(RuntimeException.class)
|
|
||||||
public R arithmeticExceptionHandler(HttpServletRequest request, RuntimeException e) {
|
|
||||||
log.error(ERROR_MESSAGE, request.getRequestURI(), e.getMessage(), e.getStackTrace()[0]);
|
|
||||||
e.printStackTrace();
|
|
||||||
return R.fail(RESULT_SERVER_ERR_CODE, e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 空指针异常
|
|
||||||
* @param request
|
|
||||||
* @param e
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(NullPointerException.class)
|
|
||||||
public R nullPointerException(HttpServletRequest request, NullPointerException e) {
|
|
||||||
log.error(ERROR_MESSAGE, request.getRequestURI(), e.getMessage(), e.getStackTrace()[0]);
|
|
||||||
e.printStackTrace();
|
|
||||||
return R.fail(RESULT_SERVER_ERR_CODE, "操作失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 有效验证异常
|
|
||||||
* @param request
|
|
||||||
* @param e
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(ValidateException.class)
|
|
||||||
public R validateException(HttpServletRequest request, ValidateException e) {
|
|
||||||
log.error(ERROR_MESSAGE, request.getRequestURI(), e.getMessage(), e.getStackTrace()[0]);
|
|
||||||
e.printStackTrace();
|
|
||||||
return R.fail(RESULT_SERVER_ERR_CODE, "会话过期,请重新登录");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(Exception.class)
|
|
||||||
public R exception(HttpServletRequest request, Exception e) {
|
|
||||||
log.error(ERROR_MESSAGE, request.getRequestURI(), e.getMessage(), e.getStackTrace()[0]);
|
|
||||||
e.printStackTrace();
|
|
||||||
return R.fail(RESULT_SERVER_ERR_CODE, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
package com.blueland.mybatisplus;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
|
||||||
import com.blueland.core.util.UserUtils;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import net.sf.jsqlparser.expression.Expression;
|
|
||||||
import net.sf.jsqlparser.expression.StringValue;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class CommonTenantHandler implements TenantLineHandler {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取租户ID
|
|
||||||
*
|
|
||||||
* @return 租户ID
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Expression getTenantId() {
|
|
||||||
try{
|
|
||||||
return new StringValue(UserUtils.getTenantId());
|
|
||||||
}
|
|
||||||
catch(Exception ex){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取租户字段名称
|
|
||||||
*
|
|
||||||
* @return 租户字段名称
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getTenantIdColumn() {
|
|
||||||
return TenantProperties.getInstance().getColumn();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 过滤租户表
|
|
||||||
*
|
|
||||||
* @param tableName 表名
|
|
||||||
* @return 是否进行过滤 返回true 表示不进行多租户处理
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean ignoreTable(String tableName) {
|
|
||||||
if (!TenantProperties.getInstance().getEnable()){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return TenantProperties.getInstance().getIgnoreTables().contains(tableName);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package com.blueland.mybatisplus;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
|
||||||
import com.blueland.core.util.UserUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.ibatis.reflection.MetaObject;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MP注入处理器
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021/4/25
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void insertFill(MetaObject metaObject) {
|
|
||||||
try {
|
|
||||||
//根据属性名字设置要填充的值
|
|
||||||
if (metaObject.hasGetter("appId") && ObjectUtil.isEmpty(metaObject.getValue("appId"))) {
|
|
||||||
this.setFieldValByName("appId", UserUtils.getAppId(), metaObject);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("自动注入异常 => " + e.getMessage());
|
|
||||||
}
|
|
||||||
updateFill(metaObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateFill(MetaObject metaObject) {
|
|
||||||
try {
|
|
||||||
//根据属性名字设置要填充的值
|
|
||||||
if (metaObject.hasGetter("appId") && ObjectUtil.isEmpty(metaObject.getValue("appId"))) {
|
|
||||||
this.setFieldValByName("appId", UserUtils.getAppId(), metaObject);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("自动注入异常 => " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user