diff --git a/.gitignore b/.gitignore index f938eab5..14f81db9 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,3 @@ target *logs/ .metadata -adc-da-main/** \ No newline at end of file diff --git a/adc-da-main/.gitignore b/adc-da-main/.gitignore new file mode 100644 index 00000000..549e00a2 --- /dev/null +++ b/adc-da-main/.gitignore @@ -0,0 +1,33 @@ +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/ diff --git a/adc-da-main/.mvn/wrapper/MavenWrapperDownloader.java b/adc-da-main/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 00000000..a45eb6ba --- /dev/null +++ b/adc-da-main/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,118 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if (mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if (mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if (!outputFile.getParentFile().exists()) { + if (!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/adc-da-main/.mvn/wrapper/maven-wrapper.jar b/adc-da-main/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 00000000..2cc7d4a5 Binary files /dev/null and b/adc-da-main/.mvn/wrapper/maven-wrapper.jar differ diff --git a/adc-da-main/.mvn/wrapper/maven-wrapper.properties b/adc-da-main/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 00000000..642d572c --- /dev/null +++ b/adc-da-main/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/adc-da-main/mvnw b/adc-da-main/mvnw new file mode 100644 index 00000000..a16b5431 --- /dev/null +++ b/adc-da-main/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# 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 /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/adc-da-main/mvnw.cmd b/adc-da-main/mvnw.cmd new file mode 100644 index 00000000..c8d43372 --- /dev/null +++ b/adc-da-main/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/adc-da-main/pom.xml b/adc-da-main/pom.xml new file mode 100644 index 00000000..bb363e53 --- /dev/null +++ b/adc-da-main/pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + + + com.adc + foton-slrs-system-rest + 3.0.0 + + com.adc + adc-da-main + adc-da-main + laws system rest main + + jar + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter + + + com.adc + adc-da-slrs + 3.0.0 + + + com.adc + adc-da-activiti + 3.0.0 + + + com.adc + adc-da-sys + 3.0.0 + + + com.adc + adc-da-base + 3.0.0 + + + com.adc + adc-da-jwtLogin + 3.1.0 + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + 2.2.0.RELEASE + + + + org.springframework.cloud + spring-cloud-starter-openfeign + 2.2.0.RELEASE + + + + + + + + + + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + + diff --git a/adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java b/adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java new file mode 100644 index 00000000..f2d62d02 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java @@ -0,0 +1,22 @@ +package com.adc.da; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +@EnableEurekaClient +@EnableFeignClients +@ServletComponentScan +@SpringBootApplication(exclude = SecurityAutoConfiguration.class) +@MapperScan(value = {"com.adc.da.file.store"}) +public class AdcDaApplication { + + public static void main(String[] args) { + SpringApplication.run(AdcDaApplication.class, args); + } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/ServletInitializer.java b/adc-da-main/src/main/java/com/adc/da/ServletInitializer.java new file mode 100644 index 00000000..9413d00e --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/ServletInitializer.java @@ -0,0 +1,16 @@ +package com.adc.da; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * Springboot打war包的启动口 + */ +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + // 注意这里要指向原先用main方法执行的Application启动类 + return builder.sources(AdcDaApplication.class); + } +} \ No newline at end of file diff --git a/adc-da-main/src/main/java/com/adc/da/main/advice/AdcDaBaseExceptionAdvice.java b/adc-da-main/src/main/java/com/adc/da/main/advice/AdcDaBaseExceptionAdvice.java new file mode 100644 index 00000000..59b6ce91 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/advice/AdcDaBaseExceptionAdvice.java @@ -0,0 +1,38 @@ +package com.adc.da.main.advice; + +import com.adc.da.exception.AdcDaBaseException; +import com.adc.da.http.ResponseMessage; +import com.adc.da.http.ResponseMessageCodeEnum; +import com.adc.da.http.Result; +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +@Slf4j +@ControllerAdvice +@Order(value=4) +public class AdcDaBaseExceptionAdvice { + + + @ResponseStatus(HttpStatus.OK) + @ExceptionHandler(AdcDaBaseException.class) + @ResponseBody + public ResponseMessage handlerAdcDaBaseException(AdcDaBaseException exception) { + log.warn(exception.getMessage(), exception); + return Result.error(exception.getErrorCode(), exception.getMessage()); + } + + @ResponseStatus(HttpStatus.OK) + @ExceptionHandler(Exception.class) + @ResponseBody + public ResponseMessage handlerAdcDaBaseException(Exception exception) { + log.error(exception.getMessage(), exception); + // TODO 在数据库中记录程序异常,这个地方的异常是未处理的异常,需要管理员查看并进行处理以防重复出现 + return Result.error(ResponseMessageCodeEnum.ERROR.getCode(), "程序异常,请重试。如果重复出现请联系管理员处理!"); + } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/advice/ShiroExceptionAdvice.java b/adc-da-main/src/main/java/com/adc/da/main/advice/ShiroExceptionAdvice.java new file mode 100644 index 00000000..65bed1de --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/advice/ShiroExceptionAdvice.java @@ -0,0 +1,41 @@ +package com.adc.da.main.advice; + +import com.adc.da.http.ResponseMessage; +import com.adc.da.http.Result; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.IncorrectCredentialsException; +import org.apache.shiro.authc.UnknownAccountException; +import org.apache.shiro.authz.UnauthenticatedException; +import org.apache.shiro.authz.UnauthorizedException; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +@Slf4j +@ControllerAdvice +@Order(value=2) +public class ShiroExceptionAdvice { + + + @ResponseStatus(HttpStatus.UNAUTHORIZED) + @ExceptionHandler({AuthenticationException.class, UnknownAccountException.class, + UnauthenticatedException.class, IncorrectCredentialsException.class}) + @ResponseBody + public ResponseMessage unauthorized(Exception exception) { + log.warn(exception.getMessage(), exception); + log.info("catch UnknownAccountException"); + return Result.error("A404", "无权访问"); + } + + @ResponseStatus(HttpStatus.UNAUTHORIZED) + @ExceptionHandler(UnauthorizedException.class) + @ResponseBody + public ResponseMessage unauthorized1(UnauthorizedException exception) { + log.warn(exception.getMessage(), exception); + return Result.error("A404","无权访问"); + } +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/DefinitionUrlConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/DefinitionUrlConfig.java new file mode 100644 index 00000000..2f338bb1 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/DefinitionUrlConfig.java @@ -0,0 +1,44 @@ +package com.adc.da.main.config; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * shiro 自定义URL规则设置 + */ +public class DefinitionUrlConfig { + + + + /** + * 匿名用户,无需登录 + */ + private static final String ANON = "anon"; + + + + // 拦截器 + //rest:比如/admins/user/**=rest[user],根据请求的方法,相当于/admins/user/**=perms[user:method] ,其中method为post,get,delete等。 + //port:比如/admins/user/**=port[8081],当请求的url的端口不是8081是跳转到schemal://serverName:8081?queryString,其中schmal是协议http或https等,serverName是你访问的host,8081是url配置里port的端口,queryString是你访问的url里的?后面的参数。 + //perms:比如/admins/user/**=perms[user:add:*],perms参数可以写多个,多个时必须加上引号,并且参数之间用逗号分割,比如/admins/user/**=perms["user:add:*,user:modify:*"],当有多个参数时必须每个参数都通过才通过,想当于isPermitedAll()方法。 + //roles:比如/admins/user/**=roles[admin],参数可以写多个,多个时必须加上引号,并且参数之间用逗号分割,当有多个参数时,比如/admins/user/**=roles["admin,guest"],每个参数通过才算通过,相当于hasAllRoles()方法。//要实现or的效果看http://zgzty.blog.163.com/blog/static/83831226201302983358670/ + //anon:比如/admins/**=anon 没有参数,表示可以匿名使用。 + //authc:比如/admins/user/**=authc表示需要认证才能使用,没有参数 + //authcBasic:比如/admins/user/**=authcBasic没有参数表示httpBasic认证 + //ssl:比如/admins/user/**=ssl没有参数,表示安全的url请求,协议为https + //user:比如/admins/user/**=user没有参数表示必须存在用户,当登入操作时不做检查 + public static Map definitionUrlOptions(){ + Map filterRuleMap = new LinkedHashMap<>(); + //TODO 此处设置URL过滤规则 默认是全部请求进行拦截,此处设置为不拦截的URL地址 + filterRuleMap.put("/api/login",ANON);//登录接口 + // swagger接口文档 + filterRuleMap.put("/v2/api-docs", "anon"); + filterRuleMap.put("/webjars/**", "anon"); + filterRuleMap.put("/swagger-resources/**", "anon"); + filterRuleMap.put("/swagger-ui.html", "anon"); + filterRuleMap.put("/doc.html", "anon"); + return filterRuleMap; + } + + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/MybatisPlusConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/MybatisPlusConfig.java new file mode 100644 index 00000000..0ca71a89 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/MybatisPlusConfig.java @@ -0,0 +1,22 @@ +package com.adc.da.main.config; + +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * Mybatis Plus 配置 + */ +@EnableTransactionManagement +@Configuration +@MapperScan("com.adc.da.**.dao") +public class MybatisPlusConfig { + + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); + } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/RestTemplateConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/RestTemplateConfig.java new file mode 100644 index 00000000..870c415d --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/RestTemplateConfig.java @@ -0,0 +1,50 @@ +package com.adc.da.main.config; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.web.client.RestTemplate; + +import java.nio.charset.Charset; +import java.util.Iterator; +import java.util.List; + +/** + * restTemplate设置 + */ +@Configuration +public class RestTemplateConfig { + + private static final Logger logger = LoggerFactory.getLogger(RestTemplateConfig.class); + + @Bean + public RestTemplate restTemplate(ClientHttpRequestFactory factory){ + RestTemplate restTemplate = new RestTemplate(factory); + // 使用 utf-8 编码集的 conver 替换默认的 conver(默认的 string conver 的编码集为"ISO-8859-1") + List> messageConverters = restTemplate.getMessageConverters(); + Iterator> iterator = messageConverters.iterator(); + while (iterator.hasNext()) { + HttpMessageConverter converter = iterator.next(); + if (converter instanceof StringHttpMessageConverter) { + iterator.remove(); + } + } + messageConverters.add(new StringHttpMessageConverter(Charset.forName("UTF-8"))); + + return restTemplate; + } + + @Bean + public ClientHttpRequestFactory simpleClientHttpRequestFactory(){ + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + factory.setReadTimeout(50000);//单位为ms + factory.setConnectTimeout(50000);//单位为ms + return factory; + } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/ShiroConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/ShiroConfig.java new file mode 100644 index 00000000..4bfc489b --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/ShiroConfig.java @@ -0,0 +1,151 @@ +package com.adc.da.main.config; + +import com.adc.da.login.security.JWTFilter; +import com.adc.da.login.security.JWTRealm; +import org.apache.shiro.cache.ehcache.EhCacheManager; +import org.apache.shiro.mgt.DefaultSecurityManager; +import org.apache.shiro.mgt.DefaultSessionStorageEvaluator; +import org.apache.shiro.mgt.DefaultSubjectDAO; +import org.apache.shiro.spring.LifecycleBeanPostProcessor; +import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; +import org.apache.shiro.spring.web.ShiroFilterFactoryBean; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; +import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; +import org.springframework.core.annotation.Order; +import org.springframework.core.io.ClassPathResource; + +import javax.servlet.Filter; +import java.util.HashMap; +import java.util.Map; + +@Configuration +@Order(value=1) +public class ShiroConfig { + + private static final String JWT_FILTER_NAME = "jwt"; + + private static final String URL_SUFFIX="/api"; + + /** + * 自定义realm,实现登录授权流程 + * @return + */ + @Bean(name="jwtRealm") + public JWTRealm jwtRealm() { + return new JWTRealm(); + } + + /** + * 配置securityManager 管理subject(默认),并把自定义realm交由manager + */ + @Bean + public DefaultSecurityManager securityManager() { + DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); + // 设置realm. + securityManager.setRealm(jwtRealm()); + //注入缓存管理器 + securityManager.setCacheManager(ehCacheManager()); + /* + * 关闭shiro自带的session,详情见文档 + * http://shiro.apache.org/session-management.html#SessionManagement-StatelessApplications%28Sessionless%29 + */ + DefaultSubjectDAO defaultSubjectDAO = new DefaultSubjectDAO(); + DefaultSessionStorageEvaluator storageEvaluator = new DefaultSessionStorageEvaluator(); + storageEvaluator.setSessionStorageEnabled(false); + defaultSubjectDAO.setSessionStorageEvaluator(storageEvaluator); + securityManager.setSubjectDAO(defaultSubjectDAO); + + return securityManager; + } + + /** + * 拦截链 + */ + @Bean + public ShiroFilterFactoryBean shiroFilterFactoryBean(DefaultSecurityManager securityManager) { + ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); + shiroFilterFactoryBean.setSecurityManager(securityManager); + shiroFilterFactoryBean.setFilters(filterMap()); + shiroFilterFactoryBean.setFilterChainDefinitionMap(definitionMap()); + + return shiroFilterFactoryBean; + } + + /** + * 自定义拦截器,处理所有请求 + */ + private Map filterMap() { + Map filterMap = new HashMap<>(); + filterMap.put(JWT_FILTER_NAME, new JWTFilter()); + return filterMap; + } + + /** + * url拦截规则 + */ + private Map definitionMap() { + // 拦截器 + //rest:比如/admins/user/**=rest[user],根据请求的方法,相当于/admins/user/**=perms[user:method] ,其中method为post,get,delete等。 + //port:比如/admins/user/**=port[8081],当请求的url的端口不是8081是跳转到schemal://serverName:8081?queryString,其中schmal是协议http或https等,serverName是你访问的host,8081是url配置里port的端口,queryString是你访问的url里的?后面的参数。 + //perms:比如/admins/user/**=perms[user:add:*],perms参数可以写多个,多个时必须加上引号,并且参数之间用逗号分割,比如/admins/user/**=perms["user:add:*,user:modify:*"],当有多个参数时必须每个参数都通过才通过,想当于isPermitedAll()方法。 + //roles:比如/admins/user/**=roles[admin],参数可以写多个,多个时必须加上引号,并且参数之间用逗号分割,当有多个参数时,比如/admins/user/**=roles["admin,guest"],每个参数通过才算通过,相当于hasAllRoles()方法。//要实现or的效果看http://zgzty.blog.163.com/blog/static/83831226201302983358670/ + //anon:比如/admins/**=anon 没有参数,表示可以匿名使用。 + //authc:比如/admins/user/**=authc表示需要认证才能使用,没有参数 + //authcBasic:比如/admins/user/**=authcBasic没有参数表示httpBasic认证 + //ssl:比如/admins/user/**=ssl没有参数,表示安全的url请求,协议为https + //user:比如/admins/user/**=user没有参数表示必须存在用户,当登入操作时不做检查 + Map definitionMap = DefinitionUrlConfig.definitionUrlOptions(); +// definitionMap.put(URL_SUFFIX+"/**", JWT_FILTER_NAME); + return definitionMap; + } + +/* *//** + * 开启注解 + *//* + @Bean + @DependsOn("lifecycleBeanPostProcessor") + public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() { + DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator(); + // 强制使用cglib代理,防止和aop冲突 + defaultAdvisorAutoProxyCreator.setProxyTargetClass(true); + return defaultAdvisorAutoProxyCreator; + } + + @Bean + public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { + return new LifecycleBeanPostProcessor(); + }*/ + + /** + * 开启shiro aop注解支持. 使用代理方式; 所以需要开启代码支持; + * + * @param securityManager 安全管理器 + * @return 授权Advisor + */ + @Bean("authorizationAttributeSourceAdvisor") + public AuthorizationAttributeSourceAdvisor advisor(DefaultSecurityManager securityManager) { + AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor(); + advisor.setSecurityManager(securityManager); + return advisor; + } + + /** + * shiro缓存管理器; + * 需要注入对应的其它的实体类中: + * 1、安全管理器:securityManager + * 可见securityManager是整个shiro的核心; + * + * @return + */ + @Bean + public EhCacheManager ehCacheManager() { + EhCacheManager cacheManager = new EhCacheManager(); + cacheManager.setCacheManagerConfigFile("classpath:cache/ehcache.xml"); + return cacheManager; + } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/ShiroConfiguration.java b/adc-da-main/src/main/java/com/adc/da/main/config/ShiroConfiguration.java new file mode 100644 index 00000000..f40d34ce --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/ShiroConfiguration.java @@ -0,0 +1,92 @@ +package com.adc.da.main.config; + +import com.adc.da.login.security.JWTRealm; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.credential.HashedCredentialsMatcher; +import org.apache.shiro.cache.ehcache.EhCacheManager; +import org.apache.shiro.mgt.DefaultSessionStorageEvaluator; +import org.apache.shiro.mgt.DefaultSubjectDAO; +import org.apache.shiro.mgt.SecurityManager; +import org.apache.shiro.spring.LifecycleBeanPostProcessor; +import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; +import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; +import org.springframework.core.io.ClassPathResource; + + +//@Configuration +public class ShiroConfiguration { + + @Bean(name = "ehCacheManagerFactoryBean") + public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() { + EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean(); + ClassPathResource classPathResource = new ClassPathResource("cache/ehcache-local.xml"); + ehCacheManagerFactoryBean.setConfigLocation(classPathResource); + return ehCacheManagerFactoryBean; + } + + @Bean(name = "shiroCacheManager") + @DependsOn({ "ehCacheManagerFactoryBean" }) + public EhCacheManager shiroCacheManager() { + EhCacheManager ehCacheManager = new EhCacheManager(); + ehCacheManager.setCacheManager(ehCacheManagerFactoryBean().getObject()); + return ehCacheManager; + } + + @Bean + @DependsOn({ "lifecycleBeanPostProcessor" }) + public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() { + DefaultAdvisorAutoProxyCreator proxyCreator = new DefaultAdvisorAutoProxyCreator(); + proxyCreator.setProxyTargetClass(true); + return proxyCreator; + } + + @Bean(name = "lifecycleBeanPostProcessor") + public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { + return new LifecycleBeanPostProcessor(); + } + + @Bean(name = "securityManager") + public SecurityManager securityManager() { + DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager(); + defaultWebSecurityManager.setRealm(jwtRealm()); + + // 关闭shiro自带的session + DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO(); + DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator(); + defaultSessionStorageEvaluator.setSessionStorageEnabled(false); + subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator); + defaultWebSecurityManager.setSubjectDAO(subjectDAO); + + // 自定义缓存管理器 + defaultWebSecurityManager.setCacheManager(shiroCacheManager()); + SecurityUtils.setSecurityManager(defaultWebSecurityManager); + return defaultWebSecurityManager; + } + + @Bean + public HashedCredentialsMatcher hashedCredentialsMatcher() { + HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher(); + hashedCredentialsMatcher.setHashAlgorithmName("md5");// 散列算法:这里使用MD5算法; + hashedCredentialsMatcher.setHashIterations(2);// 散列的次数,比如散列两次,相当于 + // md5(md5("")); + return hashedCredentialsMatcher; + } + + @Bean + public JWTRealm jwtRealm() { + JWTRealm jwtRealm = new JWTRealm(); + return jwtRealm; + } + + @Bean + public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor() { + AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor(); + advisor.setSecurityManager(securityManager()); + return advisor; + } +} \ No newline at end of file diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/SwaggerConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/SwaggerConfig.java new file mode 100644 index 00000000..acba54fe --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/SwaggerConfig.java @@ -0,0 +1,67 @@ +package com.adc.da.main.config; + + +import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + +/** + * swagger UI 配置we年 + */ +@Configuration +@EnableSwagger2 +@EnableKnife4j +@Import(BeanValidatorPluginsConfiguration.class) +public class SwaggerConfig { + + + @Bean + public Docket createRestApiByDefault() { + + ParameterBuilder tokenPar = new ParameterBuilder(); + List pars = new ArrayList<>(); + tokenPar.name("Authorization") + .description("令牌") + .modelRef(new ModelRef("string")) + .parameterType("header") + .required(true) + .build(); + pars.add(tokenPar.build()); + + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage("com.adc.da")) + .paths(PathSelectors.any()) + .build() + .globalOperationParameters(pars).groupName("默认"); + } + + + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("FOTON-SLRS-SYSTEM-REST APIs") + .description("标准法规1.0") + .termsOfServiceUrl("http://localhost:8888/") + .contact("developer@mail.com") + .version("1.0.0") + .build(); + } + +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/config/WebConfig.java b/adc-da-main/src/main/java/com/adc/da/main/config/WebConfig.java new file mode 100644 index 00000000..e1ed920f --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/config/WebConfig.java @@ -0,0 +1,105 @@ +package com.adc.da.main.config; + +import com.adc.da.filter.*; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.Order; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +/** + * Web配置,用于注入过滤器,拦截器等 + */ +@Configuration +@Order(value =3) +public class WebConfig { + + /** + * xss过滤器(高标准) + */ + @Bean + public FilterRegistrationBean xssFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); +// registration.setFilter(new XssFilter()); + registration.setFilter(new WebFilter()); + registration.addUrlPatterns("/*"); + registration.setName("xssFilter"); + registration.setOrder(10); + return registration; + } + + /** + * xss过滤器(低标准) + */ +// @Bean +// public FilterRegistrationBean xssShieldFilter() { +// FilterRegistrationBean registration = new FilterRegistrationBean(); +// registration.setFilter(new XssShieldFilter()); +// registration.addUrlPatterns("/*"); +// registration.setName("xssShieldFilter"); +// registration.setOrder(10); +// return registration; +// } + + @Bean + public FilterRegistrationBean csrfFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new CsrfFilter()); + registration.addUrlPatterns("/*"); + registration.setName("csrfFilter"); + registration.setOrder(9); + return registration; + } + + @Bean + public FilterRegistrationBean requestInfoFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new RequestInfoFilter()); + registration.addUrlPatterns("/*"); + registration.setName("RequestInfoFilter"); + registration.setOrder(8); + return registration; + } + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", buildConfig()); // 4 + return new CorsFilter(source); + } + + private CorsConfiguration buildConfig() { + CorsConfiguration corsConfiguration = new CorsConfiguration(); + corsConfiguration.addAllowedOrigin("*"); // 1允许任何域名使用 + corsConfiguration.addAllowedHeader("*"); // 2允许任何头 + corsConfiguration.addAllowedMethod("*"); // 3允许任何方法(post、get等) + return corsConfiguration; + } + + + @Bean + public FilterRegistrationBean httpCacheFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new HttpCacheFilter()); + registration.addUrlPatterns("/*"); + registration.setName("httpCacheFilter"); + registration.addInitParameter("maxAge", String.valueOf(60 * 60 * 24 * 7)); + registration.setOrder(6); + return registration; + } + + /** + * 防伪造jsessionid + */ + @Bean + public FilterRegistrationBean fakeJSessionIdFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new FakeJSessionIdFilter()); + registration.addUrlPatterns("/*"); + registration.setName("fakeJSessionIdFilter"); + registration.setOrder(5); + return registration; + } +} \ No newline at end of file diff --git a/adc-da-main/src/main/java/com/adc/da/main/filter/AuthFormAuthenticationFilter.java b/adc-da-main/src/main/java/com/adc/da/main/filter/AuthFormAuthenticationFilter.java new file mode 100644 index 00000000..76efcf6a --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/filter/AuthFormAuthenticationFilter.java @@ -0,0 +1,25 @@ +package com.adc.da.main.filter; + +import cn.hutool.json.JSONUtil; +import com.adc.da.http.ResponseMessage; +import com.adc.da.http.Result; +import org.apache.shiro.web.filter.authc.FormAuthenticationFilter; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; + +public class AuthFormAuthenticationFilter extends FormAuthenticationFilter { + + @Override + protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { + HttpServletResponse httpServletResponse = (HttpServletResponse) response; + httpServletResponse.setStatus(200); + httpServletResponse.setContentType("application/json;charset=utf-8"); + PrintWriter out = httpServletResponse.getWriter(); + ResponseMessage responseMessage = Result.error("A404", "无权访问"); + out.print(JSONUtil.toJsonStr(responseMessage)); + return false; + } +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/generate/CodeGen.java b/adc-da-main/src/main/java/com/adc/da/main/generate/CodeGen.java new file mode 100644 index 00000000..ddf9a6f0 --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/generate/CodeGen.java @@ -0,0 +1,158 @@ +package com.adc.da.main.generate; + +import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException; +import com.baomidou.mybatisplus.core.toolkit.StringPool; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.InjectionConfig; +import com.baomidou.mybatisplus.generator.config.*; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +public class CodeGen { + + private static final String PACKAGE_PATH="/adc-da-slrs/src/main"; + + private static final String AUTHOR="super_liu"; + + // x.x.x.x:3306/xxxx --MYSQL + // 192.168.10.140:1521:foton_slrs_test + private static final String DB_IP="127.0.0.1:3306/foton_slrs"; + + private static final String DB_USER="root"; + + private static final String DB_PWD="root"; + + + /** + *

+ * 读取控制台内容 + *

+ */ + public static String scanner(String tip) { + Scanner scanner = new Scanner(System.in); + StringBuilder help = new StringBuilder(); + help.append("请输入" + tip + ":"); + System.out.println(help.toString()); + if (scanner.hasNext()) { + String ipt = scanner.next(); + if (StringUtils.isNotEmpty(ipt)) { + return ipt; + } + } + throw new MybatisPlusException("请输入正确的" + tip + "!"); + } + + public static void main(String[] args) { + // 代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 全局配置 + GlobalConfig gc = new GlobalConfig(); + String projectPath = System.getProperty("user.dir"); + gc.setOutputDir(projectPath + PACKAGE_PATH+"/java"); + gc.setAuthor(AUTHOR); + gc.setOpen(false); + gc.setSwagger2(true); //实体属性 Swagger2 注解 + gc.setMapperName("%sDao"); + mpg.setGlobalConfig(gc); + + // 数据源配置 ORACLE +// DataSourceConfig dsc = new DataSourceConfig(); +// dsc.setUrl("jdbc:oracle:thin:@"+DB_IP); +// // dsc.setSchemaName("public"); +// dsc.setDriverName("oracle.jdbc.OracleDriver"); +// dsc.setUsername(DB_USER); +// dsc.setPassword(DB_PWD); +// mpg.setDataSource(dsc); + + // 数据源配置 MYSQL + DataSourceConfig dsc = new DataSourceConfig(); + dsc.setUrl("jdbc:mysql://"+DB_IP+"?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC&useSSL=false"); + //dsc.setSchemaName("public");//PostgreSQL schemaName + dsc.setDriverName("com.mysql.cj.jdbc.Driver"); + dsc.setUsername(DB_USER); + dsc.setPassword(DB_PWD); + mpg.setDataSource(dsc); + + // 包配置 + PackageConfig pc = new PackageConfig(); + pc.setModuleName(scanner("模块名")); + pc.setMapper("dao"); + pc.setParent("com.adc.da.slrs"); + mpg.setPackageInfo(pc); + + // 自定义配置 + InjectionConfig cfg = new InjectionConfig() { + @Override + public void initMap() { + // to do nothing + } + }; + + // 如果模板引擎是 freemarker + String templatePath = "/templates/mapper.xml.ftl"; + // 如果模板引擎是 velocity + // String templatePath = "/templates/mapper.xml.vm"; + + // 自定义输出配置 + List focList = new ArrayList<>(); + // 自定义配置会被优先输出 + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! + return projectPath +PACKAGE_PATH+ "/resources/mybatis/mapper/" + pc.getModuleName() + + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; + } + }); + /* + cfg.setFileCreate(new IFileCreate() { + @Override + public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) { + // 判断自定义文件夹是否需要创建 + checkDir("调用默认方法创建的目录"); + return false; + } + }); + */ + cfg.setFileOutConfigList(focList); + mpg.setCfg(cfg); + + // 配置模板 + TemplateConfig templateConfig = new TemplateConfig(); + + // 配置自定义输出模板 + //指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别 + templateConfig.setController("templates/controller.java"); + templateConfig.setMapper("templates/mapper.java"); + templateConfig.setEntity("templates/entity.java"); + templateConfig.setService("templates/service.java"); + templateConfig.setServiceImpl("templates/serviceImpl.java"); + templateConfig.setXml(null); + mpg.setTemplate(templateConfig); + + // 策略配置 + StrategyConfig strategy = new StrategyConfig(); + strategy.setNaming(NamingStrategy.underline_to_camel); + strategy.setColumnNaming(NamingStrategy.underline_to_camel); + strategy.setSuperEntityClass("com.adc.da.base.entity.BaseEntity"); + strategy.setEntityLombokModel(true); + strategy.setRestControllerStyle(true); + // 公共父类 + strategy.setSuperControllerClass("com.adc.da.base.web.BaseController"); + // 写于父类中的公共字段 + strategy.setSuperEntityColumns("id"); + strategy.setInclude(scanner("表名,多个英文逗号分割").split(",")); + strategy.setControllerMappingHyphenStyle(true); + strategy.setTablePrefix(pc.getModuleName() + "_"); + mpg.setStrategy(strategy); + mpg.setTemplateEngine(new FreemarkerTemplateEngine()); + mpg.execute(); + } +} diff --git a/adc-da-main/src/main/java/com/adc/da/main/generate/CodeUtil.java b/adc-da-main/src/main/java/com/adc/da/main/generate/CodeUtil.java new file mode 100644 index 00000000..cbd1d9cc --- /dev/null +++ b/adc-da-main/src/main/java/com/adc/da/main/generate/CodeUtil.java @@ -0,0 +1,15 @@ +package com.adc.da.main.generate; + +//import com.codemagic.DbCodeGenerateFactory; + +public class CodeUtil { + + public CodeUtil() {} + + + public static void main(String[] args) { + String entityPackage="sys"; +// DbCodeGenerateFactory.codeGenerate("ECP_CHANGE_HIS_PLAN", entityPackage); + } + +} diff --git a/adc-da-main/src/main/resources/application-dev.properties b/adc-da-main/src/main/resources/application-dev.properties new file mode 100644 index 00000000..1439004b --- /dev/null +++ b/adc-da-main/src/main/resources/application-dev.properties @@ -0,0 +1,44 @@ +# dev config +#============================================= +# 数据库配置 +#============================================= +spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver +spring.datasource.url = jdbc:mysql://101.36.227.22:33050/foton_slrs_test?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC&useSSL=false +spring.datasource.username = root +spring.datasource.password = 1q2w3e4r + +#============================================== +# 应用设置 +spring.application.name=FotonLAWSSystem +application.code=20200101 +application.center=1 +#============================================== + +#============================================== +# 邮箱配置 +#============================================== +mail.state=false +spring.mail.host=outlook.geely.com +spring.mail.protocol=smtp +spring.mail.username=e-shiwei@geely.com +spring.mail.password=YtfaaJauPjq21 +spring.mail.properties.smtp.auth=true +spring.mail.properties.smtp.starttls.enable=false +spring.mail.properties.smtp.starttls.required=false +spring.mail.properties.mail.smtp.ssl.enable=false +spring.mail.port=587 + +# ============================================== +# rabbitMQ +# ============================================== +spring.rabbitmq.host=rabbitmq-cluster-01.vs.test.geely.svc +spring.rabbitmq.port=5672 +spring.rabbitmq.virtual-host=uat_pcms +spring.rabbitmq.username=uat_pcms +spring.rabbitmq.password=VxsBLL5bJruwzXfS +# spring.rabbitmq.publisher-confirms=true + +# ============================================== +# 文档存储路径指向 +# ============================================== +file.path=/usr/laws/file/ \ No newline at end of file diff --git a/adc-da-main/src/main/resources/application-prod.properties b/adc-da-main/src/main/resources/application-prod.properties new file mode 100644 index 00000000..203e71c7 --- /dev/null +++ b/adc-da-main/src/main/resources/application-prod.properties @@ -0,0 +1,38 @@ +#prod config +#============================================= +# 数据库配置 +#============================================= +spring.datasource.driverClassName = oracle.jdbc.OracleDriver +spring.datasource.url = jdbc:oracle:thin:@//10.190.228.33:1521/geely +spring.datasource.username = scyzx_uat +spring.datasource.password = b#Lf5z0^QrF4J3Km + + +#============================================== +# 邮箱配置 +#============================================== +mail.state=false +spring.mail.host=outlook.geely.com +spring.mail.protocol=smtp +spring.mail.username=e-shiwei@geely.com +spring.mail.password=YtfaaJauPjq21 +spring.mail.properties.smtp.auth=true +spring.mail.properties.smtp.starttls.enable=false +spring.mail.properties.smtp.starttls.required=false +spring.mail.properties.mail.smtp.ssl.enable=false +spring.mail.port=587 + +# ============================================== +# rabbitMQ +# ============================================== +spring.rabbitmq.host=rabbitmq-cluster-01.vs.test.geely.svc +spring.rabbitmq.port=5672 +spring.rabbitmq.virtual-host=uat_pcms +spring.rabbitmq.username=uat_pcms +spring.rabbitmq.password=VxsBLL5bJruwzXfS +# spring.rabbitmq.publisher-confirms=true + +# ============================================== +# 文档存储路径指向 +# ============================================== +file.path=/usr/laws/file/ \ No newline at end of file diff --git a/adc-da-main/src/main/resources/application-test.properties b/adc-da-main/src/main/resources/application-test.properties new file mode 100644 index 00000000..55f14c4b --- /dev/null +++ b/adc-da-main/src/main/resources/application-test.properties @@ -0,0 +1,38 @@ +# test config +#============================================= +# 数据库配置 +#============================================= +spring.datasource.driverClassName = oracle.jdbc.OracleDriver +spring.datasource.url = jdbc:oracle:thin:@//10.190.228.33:1521/geely +spring.datasource.username = scyzx_uat +spring.datasource.password = b#Lf5z0^QrF4J3Km + + +#============================================== +# 邮箱配置 +#============================================== +mail.state=false +spring.mail.host=outlook.geely.com +spring.mail.protocol=smtp +spring.mail.username=e-shiwei@geely.com +spring.mail.password=YtfaaJauPjq21 +spring.mail.properties.smtp.auth=true +spring.mail.properties.smtp.starttls.enable=false +spring.mail.properties.smtp.starttls.required=false +spring.mail.properties.mail.smtp.ssl.enable=false +spring.mail.port=587 + +# ============================================== +# rabbitMQ +# ============================================== +spring.rabbitmq.host=rabbitmq-cluster-01.vs.test.geely.svc +spring.rabbitmq.port=5672 +spring.rabbitmq.virtual-host=uat_pcms +spring.rabbitmq.username=uat_pcms +spring.rabbitmq.password=VxsBLL5bJruwzXfS +# spring.rabbitmq.publisher-confirms=true + +# ============================================== +# 文档存储路径指向 +# ============================================== +file.path=/usr/laws/file/ \ No newline at end of file diff --git a/adc-da-main/src/main/resources/application.properties b/adc-da-main/src/main/resources/application.properties new file mode 100644 index 00000000..515259e4 --- /dev/null +++ b/adc-da-main/src/main/resources/application.properties @@ -0,0 +1,146 @@ +############################################## +# 项目启动模式 +############################################## +spring.profiles.active=dev + +############################################## +#公共配置信息 +############################################## +server.compression.enabled=true +server.compression.mime-types=application/json,application/xml,text/html,text/plain,text/css,application/x-javascript +# 端口号设置 +server.port=9999 +#主服务session超时 +server.servlet.session.timeout =600 + +# http-only +server.session.cookie.http-only=true +spring.mvc.async.request-timeout=20000 + +# file模块上传文件大小限制 +spring.http.multipart.max-request-size=100MB +spring.http.multipart.max-file-size=100MB + +#显示sql +logging.level.com.adc=DEBUG +logging.level.org.springframework=info + +# 请求前缀 +restPath=/api +#server.servlet.context-path=/api + +#是否将自己注册到Eureka Server上,默认为true +eureka.client.register-with-eureka=true +##是否从Eureka Server上获取注册信息,默认为true +eureka.client.fetch-registry=true + +#eureka.client.service-url.defaultZone=http://10.5.116.172:8672/eureka/ +#eureka.client.service-url.defaultZone=http://127.0.0.1:8671/eureka/ +#eureka.client.service-url.defaultZone=http://10.5.116.172:8672/eureka/ +eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka/ +# 请求连接的超时时间 默认的时间为 1 秒 +ribbon.ConnectTimeout=500000 +# 请求处理的超时时间 +ribbon.ReadTimeout=500000 + +# =============================== +# = DATA SOURCE +# =============================== +spring.datasource.type = com.alibaba.druid.pool.DruidDataSource +# 下面为连接池的补充设置,应用到上面所有数据源中 +# 初始化大小,最小,最大 +spring.datasource.druid.initial-size= 5 +spring.datasource.druid.min-idle= 5 +spring.datasource.druid.max-active= 50 +# 配置获取连接等待超时的时间 +spring.datasource.druid.max-wait= 60000 +# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 +spring.datasource.druid.time-between-eviction-runs-millis= 60000 +# 配置一个连接在池中最小生存的时间,单位是毫秒 +spring.datasource.druid.min-evictable-idle-time-millis= 300000 +spring.datasource.druid.validation-query= SELECT 1 FROM DUAL +# 空闲时间监测连接是否优秀奥 +spring.datasource.druid.test-while-idle= true +# 数据库连接心跳监测 +spring.datasource.druid.keep-alive= true +# 获取链接前检查链接是否有效 +spring.datasource.druid.test-on-borrow= true +# 返回连接池时检查链接是否可用 +spring.datasource.druid.test-on-return= false +# 打开PSCache,并且指定每个连接上PSCache的大小 +spring.datasource.druid.pool-prepared-statements= true +spring.datasource.druid.max-pool-prepared-statement-per-connection-size= 20 +# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 +spring.datasource.druid.filters=stat,wall +#合并多个DruidDataSource的监控数据 +spring.datasource.druid.use-global-data-source-stat=true +# druid web管理页面开启 +spring.datasource.druid.stat-view-servlet.enabled=true +# druid web管理页面白名单 +#spring.datasource.druid.stat-view-servlet.allow=127.0.0.1 +# druid web管理页面账号 +spring.datasource.druid.stat-view-servlet.login-username=druid +# druid web管理页面密码 +spring.datasource.druid.stat-view-servlet.login-password=laws1q2w3e4r +# druid web管理页面URL访问前缀地址 +spring.datasource.druid.stat-view-servlet.url-pattern=/druid/* +# =============================== + +# ======================================= +# Mybatis Plus config +# ======================================= +mybatis-plus.config-location=classpath:mybatis/mybatis-config.xml +mybatis-plus.mapper-locations=classpath*:mybatis/mapper/**/*.xml + +# ======================================== +# activiti 配置信息 +# ======================================== +#spring.activiti.database-schema=ACT +spring.activiti.database-schema-update=false +spring.activiti.check-process-definitions=false +spring.activiti.job-executor-activate=false +spring.activiti.process-definition-location-prefix=classpath:/mybatis/mapper/activiti/ + +# ============================================================================= +# 邮箱配置 +# ============================================================================= +mail.valid=false +spring.mail.host=smtp.163.com +spring.mail.protocol=smtp +spring.mail.username=xxx@163.com +spring.mail.password=xxx +spring.mail.properties.smtp.auth=true +spring.mail.properties.smtp.starttls.enable=true +spring.mail.properties.smtp.starttls.required=true +spring.mail.properties.mail.smtp.ssl.enable=true +spring.mail.port=465 +#全球标准法规管理系统 十六进制码 +mail.personName=E585A8E79083E6A087E58786E6B395E8A784E7AEA1E79086E7B3BBE7BB9F +#邮箱内容中嵌入的系统地址 +Lawss.address =http://standard.gacrnd.com:60090 + + +# ========================================= +# login value +# ========================================= +maxLoginErrorCount=3 +verifyCodeMode=1 + +# ============================================================================= +# 文件上传管控及配置 +# ============================================================================= +# file模块上传文件的服务器地址 +file.path=D:/uploadfile/bus +# 文件下载地址参数 +file.downloadUrl=http://39.98.140.126:10001/uploadPath +#上传文件白名单-以,分隔 +upload.file.white.lists = doc,docx,xls,xlsx,pdf,PDF,png,jpg + +# ============================================================================= +# elasticsearch 配置 +# ============================================================================= +elasticsearch.clustername=laws +elasticsearch.ip=localhost +elasticsearch.port=9300 +elasticsearch.poolSize=5 +elas.flag=true \ No newline at end of file diff --git a/adc-da-main/src/main/resources/banner.txt b/adc-da-main/src/main/resources/banner.txt new file mode 100644 index 00000000..a4f9a525 --- /dev/null +++ b/adc-da-main/src/main/resources/banner.txt @@ -0,0 +1,9 @@ +${AnsiColor.RED} _ _ + __ _ __| | ___ __| | __ _ + / _` |/ _` |/ __|____ / _` |/ _` | + | (_| | (_| | (_|_____| (_| | (_| | + \__,_|\__,_|\___| \__,_|\__,_| + +${AnsiColor.YELLOW}------------------------------------------------ +${AnsiColor.YELLOW} :: ${AnsiColor.YELLOW}@数据资源中心 +${AnsiColor.YELLOW}------------------------------------------------${AnsiColor.WHITE} \ No newline at end of file diff --git a/adc-da-main/src/main/resources/cache/ehcache.xml b/adc-da-main/src/main/resources/cache/ehcache.xml new file mode 100644 index 00000000..b580e227 --- /dev/null +++ b/adc-da-main/src/main/resources/cache/ehcache.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + diff --git a/adc-da-main/src/main/resources/logback-spring.xml b/adc-da-main/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..dec4b3f5 --- /dev/null +++ b/adc-da-main/src/main/resources/logback-spring.xml @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + + + + INFO + + ACCEPT + + ACCEPT + + + + + ${LOG_HOME}/${LOG_HOME_SYSTEM}/${PROJECT_NAME}.system_all.%d{yyyy-MM-dd}.%i.log + + 7 + + 100MB + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + + ERROR + ACCEPT + DENY + + + + ${LOG_HOME}/${LOG_HOME_SYSTEM}/${PROJECT_NAME}.system_error.%d{yyyy-MM-dd}.%i.log + + 30 + + 100MB + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + + INFO + ACCEPT + DENY + + + + ${LOG_HOME}/${LOG_HOME_DRUID}/${PROJECT_NAME}.druid_info.%d{yyyy-MM-dd}.%i.log + + 15 + + 50MB + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + WARN + + + + + ${LOG_HOME}/${LOG_HOME_DRUID}/${PROJECT_NAME}.druid_warn.%d{yyyy-MM-dd}.%i.log + + 30 + + 50MB + + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + INFO + ACCEPT + DENY + + + + ${LOG_HOME}/${LOG_HOME_OPERATION}/${PROJECT_NAME}.operation.%d{yyyy-MM-dd}.%i.log + + 120 + + 300MB + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] %logger{50} - %msg%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/adc-da-main/src/main/resources/logo/logo_white.png b/adc-da-main/src/main/resources/logo/logo_white.png new file mode 100644 index 00000000..e744da1b Binary files /dev/null and b/adc-da-main/src/main/resources/logo/logo_white.png differ diff --git a/adc-da-main/src/main/resources/mybatis/mybatis-config.xml b/adc-da-main/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 00000000..e041bc2e --- /dev/null +++ b/adc-da-main/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/adc-da-main/src/main/resources/temp/entity.java.ftl b/adc-da-main/src/main/resources/temp/entity.java.ftl new file mode 100644 index 00000000..c698d363 --- /dev/null +++ b/adc-da-main/src/main/resources/temp/entity.java.ftl @@ -0,0 +1,152 @@ +package ${package.Entity}; + +<#list table.importPackages as pkg> +import ${pkg}; + +<#if swagger2> +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +<#if entityLombokModel> +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + + +/** + *

+ * ${table.comment!} + *

+ * + * @author ${author} + * @since ${date} + */ +<#if entityLombokModel> +@Data + <#if superEntityClass??> +@EqualsAndHashCode(callSuper = true) + <#else> +@EqualsAndHashCode(callSuper = false) + +@Accessors(chain = true) + +<#if table.convert> +@TableName("${table.name}") + +<#if swagger2> +@ApiModel(value="${entity}对象", description="${table.comment!}") + +<#if superEntityClass??> +public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}> { +<#elseif activeRecord> +public class ${entity} extends Model<${entity}> { +<#else> +public class ${entity} implements Serializable { + + +<#if entitySerialVersionUID> + private static final long serialVersionUID = 1L; + +<#-- ---------- BEGIN 字段循环遍历 ----------> +<#list table.fields as field> + <#if field.keyFlag> + <#assign keyPropertyName="${field.propertyName}"/> + + + <#if field.comment!?length gt 0> + <#if swagger2> + @ApiModelProperty(value = "${field.comment}") + <#else> + /** + * ${field.comment} + */ + + + <#if field.keyFlag> + <#-- 主键 --> + <#if field.keyIdentityFlag> + @TableId(value = "${field.name}", type = IdType.AUTO) + <#elseif idType??> + @TableId(value = "${field.name}", type = IdType.${idType}) + <#elseif field.convert> + @TableId("${field.name}") + + <#-- 普通字段 --> + <#elseif field.fill??> + <#-- ----- 存在字段填充设置 -----> + <#if field.convert> + @TableField(value = "${field.name}", fill = FieldFill.${field.fill}) + <#else> + @TableField(fill = FieldFill.${field.fill}) + + <#elseif field.convert> + @TableField("${field.name}") + + <#-- 乐观锁注解 --> + <#if (versionFieldName!"") == field.name> + @Version + + <#-- 逻辑删除注解 --> + <#if (logicDeleteFieldName!"") == field.name> + @TableLogic + + private ${field.propertyType} ${field.propertyName}; + +<#------------ END 字段循环遍历 ----------> + +<#if !entityLombokModel> + <#list table.fields as field> + <#if field.propertyType == "boolean"> + <#assign getprefix="is"/> + <#else> + <#assign getprefix="get"/> + + public ${field.propertyType} ${getprefix}${field.capitalName}() { + return ${field.propertyName}; + } + + <#if entityBuilderModel> + public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + <#else> + public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + + this.${field.propertyName} = ${field.propertyName}; + <#if entityBuilderModel> + return this; + + } + + + +<#if entityColumnConstant> + <#list table.fields as field> + public static final String ${field.name?upper_case} = "${field.name}"; + + + +<#if activeRecord> + @Override + protected Serializable pkVal() { + <#if keyPropertyName??> + return this.${keyPropertyName}; + <#else> + return null; + + } + + +<#if !entityLombokModel> + @Override + public String toString() { + return "${entity}{" + + <#list table.fields as field> + <#if field_index==0> + "${field.propertyName}=" + ${field.propertyName} + + <#else> + ", ${field.propertyName}=" + ${field.propertyName} + + + + "}"; + } + +} diff --git a/adc-da-main/src/main/resources/temp/mapper.java.ftl b/adc-da-main/src/main/resources/temp/mapper.java.ftl new file mode 100644 index 00000000..53da4ae3 --- /dev/null +++ b/adc-da-main/src/main/resources/temp/mapper.java.ftl @@ -0,0 +1,20 @@ +package ${package.Mapper}; + +import ${package.Entity}.${entity}; +import ${superMapperClassPackage}; + +/** + *

+ * ${table.comment!} Mapper 接口 + *

+ * + * @author ${author} + * @since ${date} + */ +<#if kotlin> +interface ${table.mapperName} : ${superMapperClass}<${entity}> +<#else> +public interface ${table.mapperName} extends ${superMapperClass}<${entity}> { + +} + diff --git a/adc-da-main/src/main/resources/temp/service.java.ftl b/adc-da-main/src/main/resources/temp/service.java.ftl new file mode 100644 index 00000000..e3232f3a --- /dev/null +++ b/adc-da-main/src/main/resources/temp/service.java.ftl @@ -0,0 +1,20 @@ +package ${package.Service}; + +import ${package.Entity}.${entity}; +import ${superServiceClassPackage}; + +/** + *

+ * ${table.comment!} 服务类 + *

+ * + * @author ${author} + * @since ${date} + */ +<#if kotlin> +interface ${table.serviceName} : ${superServiceClass}<${entity}> +<#else> +public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { + +} + diff --git a/adc-da-main/src/main/resources/templates/controller.java.ftl b/adc-da-main/src/main/resources/templates/controller.java.ftl new file mode 100644 index 00000000..df485cbe --- /dev/null +++ b/adc-da-main/src/main/resources/templates/controller.java.ftl @@ -0,0 +1,41 @@ +package ${package.Controller}; + + +import org.springframework.web.bind.annotation.RequestMapping; +import ${package.Entity}.${entity}; +import io.swagger.annotations.Api; +<#if restControllerStyle> +import org.springframework.web.bind.annotation.RestController; +<#else> +import org.springframework.stereotype.Controller; + +<#if superControllerClassPackage??> +import ${superControllerClassPackage}; + + +/** +*

+ * ${table.comment!} 前端控制器 + *

+* +* @author ${author} +* @since ${date} +*/ +<#if restControllerStyle> +@RestController +<#else> +@Controller + +@Api(description = "|${entity}|") +@RequestMapping("<#if package.ModuleName?? && package.ModuleName != "">/${package.ModuleName}/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}") +<#if kotlin> +class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}() +<#else> + <#if superControllerClass??> +public class ${table.controllerName} extends ${superControllerClass}<${entity}> { + <#else> +public class ${table.controllerName} extends ${superControllerClass}<${entity}>{ + + +} + diff --git a/adc-da-main/src/main/resources/templates/entity.java.ftl b/adc-da-main/src/main/resources/templates/entity.java.ftl new file mode 100644 index 00000000..c698d363 --- /dev/null +++ b/adc-da-main/src/main/resources/templates/entity.java.ftl @@ -0,0 +1,152 @@ +package ${package.Entity}; + +<#list table.importPackages as pkg> +import ${pkg}; + +<#if swagger2> +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +<#if entityLombokModel> +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + + +/** + *

+ * ${table.comment!} + *

+ * + * @author ${author} + * @since ${date} + */ +<#if entityLombokModel> +@Data + <#if superEntityClass??> +@EqualsAndHashCode(callSuper = true) + <#else> +@EqualsAndHashCode(callSuper = false) + +@Accessors(chain = true) + +<#if table.convert> +@TableName("${table.name}") + +<#if swagger2> +@ApiModel(value="${entity}对象", description="${table.comment!}") + +<#if superEntityClass??> +public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}> { +<#elseif activeRecord> +public class ${entity} extends Model<${entity}> { +<#else> +public class ${entity} implements Serializable { + + +<#if entitySerialVersionUID> + private static final long serialVersionUID = 1L; + +<#-- ---------- BEGIN 字段循环遍历 ----------> +<#list table.fields as field> + <#if field.keyFlag> + <#assign keyPropertyName="${field.propertyName}"/> + + + <#if field.comment!?length gt 0> + <#if swagger2> + @ApiModelProperty(value = "${field.comment}") + <#else> + /** + * ${field.comment} + */ + + + <#if field.keyFlag> + <#-- 主键 --> + <#if field.keyIdentityFlag> + @TableId(value = "${field.name}", type = IdType.AUTO) + <#elseif idType??> + @TableId(value = "${field.name}", type = IdType.${idType}) + <#elseif field.convert> + @TableId("${field.name}") + + <#-- 普通字段 --> + <#elseif field.fill??> + <#-- ----- 存在字段填充设置 -----> + <#if field.convert> + @TableField(value = "${field.name}", fill = FieldFill.${field.fill}) + <#else> + @TableField(fill = FieldFill.${field.fill}) + + <#elseif field.convert> + @TableField("${field.name}") + + <#-- 乐观锁注解 --> + <#if (versionFieldName!"") == field.name> + @Version + + <#-- 逻辑删除注解 --> + <#if (logicDeleteFieldName!"") == field.name> + @TableLogic + + private ${field.propertyType} ${field.propertyName}; + +<#------------ END 字段循环遍历 ----------> + +<#if !entityLombokModel> + <#list table.fields as field> + <#if field.propertyType == "boolean"> + <#assign getprefix="is"/> + <#else> + <#assign getprefix="get"/> + + public ${field.propertyType} ${getprefix}${field.capitalName}() { + return ${field.propertyName}; + } + + <#if entityBuilderModel> + public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + <#else> + public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + + this.${field.propertyName} = ${field.propertyName}; + <#if entityBuilderModel> + return this; + + } + + + +<#if entityColumnConstant> + <#list table.fields as field> + public static final String ${field.name?upper_case} = "${field.name}"; + + + +<#if activeRecord> + @Override + protected Serializable pkVal() { + <#if keyPropertyName??> + return this.${keyPropertyName}; + <#else> + return null; + + } + + +<#if !entityLombokModel> + @Override + public String toString() { + return "${entity}{" + + <#list table.fields as field> + <#if field_index==0> + "${field.propertyName}=" + ${field.propertyName} + + <#else> + ", ${field.propertyName}=" + ${field.propertyName} + + + + "}"; + } + +} diff --git a/adc-da-main/src/main/resources/templates/mapper.java.ftl b/adc-da-main/src/main/resources/templates/mapper.java.ftl new file mode 100644 index 00000000..53da4ae3 --- /dev/null +++ b/adc-da-main/src/main/resources/templates/mapper.java.ftl @@ -0,0 +1,20 @@ +package ${package.Mapper}; + +import ${package.Entity}.${entity}; +import ${superMapperClassPackage}; + +/** + *

+ * ${table.comment!} Mapper 接口 + *

+ * + * @author ${author} + * @since ${date} + */ +<#if kotlin> +interface ${table.mapperName} : ${superMapperClass}<${entity}> +<#else> +public interface ${table.mapperName} extends ${superMapperClass}<${entity}> { + +} + diff --git a/adc-da-main/src/main/resources/templates/mapper.xml.ftl b/adc-da-main/src/main/resources/templates/mapper.xml.ftl new file mode 100644 index 00000000..d9ca71c4 --- /dev/null +++ b/adc-da-main/src/main/resources/templates/mapper.xml.ftl @@ -0,0 +1,39 @@ + + + + +<#if enableCache> + + + + +<#if baseResultMap> + + +<#list table.fields as field> +<#if field.keyFlag><#--生成主键排在第一位--> + + + +<#list table.commonFields as field><#--生成公共字段 --> + + +<#list table.fields as field> +<#if !field.keyFlag><#--生成普通字段 --> + + + + + + +<#if baseColumnList> + + +<#list table.commonFields as field> + ${field.name}, + + ${table.fieldNames} + + + + diff --git a/adc-da-main/src/main/resources/templates/service.java.ftl b/adc-da-main/src/main/resources/templates/service.java.ftl new file mode 100644 index 00000000..e3232f3a --- /dev/null +++ b/adc-da-main/src/main/resources/templates/service.java.ftl @@ -0,0 +1,20 @@ +package ${package.Service}; + +import ${package.Entity}.${entity}; +import ${superServiceClassPackage}; + +/** + *

+ * ${table.comment!} 服务类 + *

+ * + * @author ${author} + * @since ${date} + */ +<#if kotlin> +interface ${table.serviceName} : ${superServiceClass}<${entity}> +<#else> +public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { + +} + diff --git a/adc-da-main/src/main/resources/templates/serviceImpl.java.ftl b/adc-da-main/src/main/resources/templates/serviceImpl.java.ftl new file mode 100644 index 00000000..aeebd14c --- /dev/null +++ b/adc-da-main/src/main/resources/templates/serviceImpl.java.ftl @@ -0,0 +1,26 @@ +package ${package.ServiceImpl}; + +import ${package.Entity}.${entity}; +import ${package.Mapper}.${table.mapperName}; +import ${package.Service}.${table.serviceName}; +import ${superServiceImplClassPackage}; +import org.springframework.stereotype.Service; + +/** + *

+ * ${table.comment!} 服务实现类 + *

+ * + * @author ${author} + * @since ${date} + */ +@Service +<#if kotlin> +open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} { + +} +<#else> +public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} { + +} + diff --git a/adc-da-main/src/main/resources/ueditor/config.json b/adc-da-main/src/main/resources/ueditor/config.json new file mode 100644 index 00000000..77a0a70f --- /dev/null +++ b/adc-da-main/src/main/resources/ueditor/config.json @@ -0,0 +1,97 @@ +/* 前后端通信相关的配置,注释只允许使用多行方式 */ +{ + /* 上传图片配置项 */ + "imageActionName": "/api/ueditor/uploadImageData", /* 执行上传图片的action名称 */ + "imageFieldName": "upfile", /* 提交的图片表单名称 */ + "imageMaxSize": 2048000, /* 上传大小限制,单位B */ + "imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 上传图片格式显示 */ + "imageCompressEnable": true, /* 是否压缩图片,默认是true */ + "imageCompressBorder": 1600, /* 图片压缩最长边限制 */ + "imageInsertAlign": "none", /* 插入的图片浮动方式 */ + "imageUrlPrefix": "", /* 图片访问路径前缀 */ + "localSavePathPrefix":"upload/images/inform", + "imagePathFormat": "", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + /* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */ + /* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */ + /* {time} 会替换成时间戳 */ + /* {yyyy} 会替换成四位年份 */ + /* {yy} 会替换成两位年份 */ + /* {mm} 会替换成两位月份 */ + /* {dd} 会替换成两位日期 */ + /* {hh} 会替换成两位小时 */ + /* {ii} 会替换成两位分钟 */ + /* {ss} 会替换成两位秒 */ + /* 非法字符 \ : * ? " < > | */ + /* 具请体看线上文档: fex.baidu.com/ueditor/#use-format_upload_filename */ + + /* 涂鸦图片上传配置项 */ + "scrawlActionName": "uploadscrawl", /* 执行上传涂鸦的action名称 */ + "scrawlFieldName": "upfile", /* 提交的图片表单名称 */ + "scrawlPathFormat": "", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + "scrawlMaxSize": 2048000, /* 上传大小限制,单位B */ + "scrawlUrlPrefix": "", /* 图片访问路径前缀 */ + "scrawlInsertAlign": "none", + + /* 截图工具上传 */ + "snapscreenActionName": "uploadimage", /* 执行上传截图的action名称 */ + "snapscreenPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + "snapscreenUrlPrefix": "", /* 图片访问路径前缀 */ + "snapscreenInsertAlign": "none", /* 插入的图片浮动方式 */ + + /* 抓取远程图片配置 */ + "catcherLocalDomain": ["127.0.0.1", "localhost", "img.baidu.com"], + "catcherActionName": "catchimage", /* 执行抓取远程图片的action名称 */ + "catcherFieldName": "source", /* 提交的图片列表表单名称 */ + "catcherPathFormat": "/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + "catcherUrlPrefix": "", /* 图片访问路径前缀 */ + "catcherMaxSize": 2048000, /* 上传大小限制,单位B */ + "catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 抓取图片格式显示 */ + /*抓取远程图片是否开启,默认true*/ + "catchRemoteImageEnable": false, + + /* 上传视频配置 */ + "videoActionName": "uploadvideo", /* 执行上传视频的action名称 */ + "videoFieldName": "upfile", /* 提交的视频表单名称 */ + "videoPathFormat": "/ueditor/jsp/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + "videoUrlPrefix": "", /* 视频访问路径前缀 */ + "videoMaxSize": 102400000, /* 上传大小限制,单位B,默认100MB */ + "videoAllowFiles": [ + ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", + ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid"], /* 上传视频格式显示 */ + + /* 上传文件配置 */ + "fileActionName": "uploadfile", /* controller里,执行上传视频的action名称 */ + "fileFieldName": "upfile", /* 提交的文件表单名称 */ + "filePathFormat": "/ueditor/jsp/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + "fileUrlPrefix": "", /* 文件访问路径前缀 */ + "fileMaxSize": 51200000, /* 上传大小限制,单位B,默认50MB */ + "fileAllowFiles": [ + ".png", ".jpg", ".jpeg", ".gif", ".bmp", + ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", + ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid", + ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso", + ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml" + ], /* 上传文件格式显示 */ + + /* 列出指定目录下的图片 */ + "imageManagerActionName": "listimage", /* 执行图片管理的action名称 */ + "imageManagerListPath": "/ueditor/jsp/upload/image/", /* 指定要列出图片的目录 */ + "imageManagerListSize": 20, /* 每次列出文件数量 */ + "imageManagerUrlPrefix": "", /* 图片访问路径前缀 */ + "imageManagerInsertAlign": "none", /* 插入的图片浮动方式 */ + "imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 列出的文件类型 */ + + /* 列出指定目录下的文件 */ + "fileManagerActionName": "listfile", /* 执行文件管理的action名称 */ + "fileManagerListPath": "/ueditor/jsp/upload/file/", /* 指定要列出文件的目录 */ + "fileManagerUrlPrefix": "", /* 文件访问路径前缀 */ + "fileManagerListSize": 20, /* 每次列出文件数量 */ + "fileManagerAllowFiles": [ + ".png", ".jpg", ".jpeg", ".gif", ".bmp", + ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", + ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid", + ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso", + ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml" + ] /* 列出的文件类型 */ + +} \ No newline at end of file diff --git a/adc-da-main/src/main/resources/white/uploadWhite.txt b/adc-da-main/src/main/resources/white/uploadWhite.txt new file mode 100644 index 00000000..fd4a3ae3 --- /dev/null +++ b/adc-da-main/src/main/resources/white/uploadWhite.txt @@ -0,0 +1,12 @@ +pdf +doc +docx +xlsx +xls +zip +rar +jpg +jpge +png +gif +ppt \ No newline at end of file diff --git a/adc-da-main/src/main/resources/white/xssWhite.txt b/adc-da-main/src/main/resources/white/xssWhite.txt new file mode 100644 index 00000000..b724e4db --- /dev/null +++ b/adc-da-main/src/main/resources/white/xssWhite.txt @@ -0,0 +1 @@ +/upload/ \ No newline at end of file diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandUnqualified/controller/SarStandUnqualifiedController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandUnqualified/controller/SarStandUnqualifiedController.java index 5bd7e17e..87b321e4 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandUnqualified/controller/SarStandUnqualifiedController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandUnqualified/controller/SarStandUnqualifiedController.java @@ -2,6 +2,7 @@ package com.adc.da.slrs.sarStandUnqualified.controller; import com.adc.da.slrs.sarStandUnqualified.service.ISarStandUnqualifiedService; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import com.adc.da.slrs.sarStandUnqualified.entity.SarStandUnqualified; @@ -23,4 +24,6 @@ import com.adc.da.base.web.BaseController; public class SarStandUnqualifiedController extends BaseController { @Autowired private ISarStandUnqualifiedService sarStandUnqualifiedService; + + }