commit
7525a8c4b5
@ -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/
|
||||
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
||||
Binary file not shown.
@ -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 "$@"
|
||||
@ -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%
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,50 @@
|
||||
package com.archive;
|
||||
|
||||
|
||||
|
||||
import com.archive.common.archiveUtil.MacUtil;
|
||||
import java.text.SimpleDateFormat;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
public class ArchiveApplication
|
||||
{
|
||||
public static String MAC = "9E-5C-B9-BA-E2-66";
|
||||
public static String ckDate = "2024-08-14";
|
||||
public static int sqsj = 90;
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
System.out.println("系统授权MAC:" + MAC);
|
||||
System.out.println("系统授权时间:" + ckDate);
|
||||
|
||||
boolean res = MacUtil.sqjy(MAC, ckDate, sqsj);
|
||||
if (res) {
|
||||
SpringApplication.run(com.archive.ArchiveApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 系统启动成功 ლ(´ڡ`ლ)゙ ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\ArchiveApplication.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,24 @@
|
||||
package com.archive;
|
||||
|
||||
import com.archive.ArchiveApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class ArchiveServletInitializer
|
||||
extends SpringBootServletInitializer
|
||||
{
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(new Class[] { ArchiveApplication.class });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\ArchiveServletInitializer.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,79 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
import org.ansj.domain.Result;
|
||||
import org.ansj.splitWord.analysis.BaseAnalysis;
|
||||
import org.ansj.splitWord.analysis.NlpAnalysis;
|
||||
import org.ansj.splitWord.analysis.ToAnalysis;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class AnsjTextUtil
|
||||
{
|
||||
public static String jbfc(String text) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
Result analysisedResult = BaseAnalysis.parse(text);
|
||||
long endTime = System.currentTimeMillis();
|
||||
long time = endTime - startTime;
|
||||
System.out.println("基本分词: " + analysisedResult + "(" + time + "ms)");
|
||||
return analysisedResult.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String jzfc(String text) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
String analysisedText = ToAnalysis.parse(text).toStringWithOutNature();
|
||||
long endTime = System.currentTimeMillis();
|
||||
long time = endTime - startTime;
|
||||
System.out.println("精准分词: " + analysisedText + "(" + time + "ms)");
|
||||
return analysisedText;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String nlpfc(String text) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
String analysisedText = NlpAnalysis.parse(text).toStringWithOutNature();
|
||||
long endTime = System.currentTimeMillis();
|
||||
long time = endTime - startTime;
|
||||
System.out.println("nlp分词: " + analysisedText + "(" + time + "ms)");
|
||||
return analysisedText;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
jzfc("昨天晚上张三睡觉忘了关窗户");
|
||||
jbfc("昨天晚上张三睡觉忘了关窗户");
|
||||
nlpfc("昨天晚上张三睡觉忘了关窗户");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\AnsjTextUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,78 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class CopyFileUtil
|
||||
{
|
||||
public static void copyFile(File fromFilePath, File toFilePath) {
|
||||
FileInputStream fis = null;
|
||||
FileOutputStream fos = null;
|
||||
|
||||
try {
|
||||
String str = toFilePath.toString();
|
||||
File filePath = new File(str.substring(0, str.indexOf(toFilePath.getName())));
|
||||
if (!filePath.exists() && !filePath.isDirectory()) {
|
||||
filePath.mkdirs();
|
||||
}
|
||||
fis = new FileInputStream(fromFilePath);
|
||||
fos = new FileOutputStream(toFilePath);
|
||||
byte[] b = new byte[1024];
|
||||
|
||||
while (fis.read(b) != -1) {
|
||||
fos.write(b);
|
||||
}
|
||||
if (fis != null) {
|
||||
fis.close();
|
||||
fis = null;
|
||||
}
|
||||
if (fos != null) {
|
||||
fos.flush();
|
||||
fos.close();
|
||||
fos = null;
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("源文件不存在");
|
||||
} catch (IOException e) {
|
||||
System.out.println("io异常");
|
||||
} finally {
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException iOException) {}
|
||||
}
|
||||
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException iOException) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
File file1 = new File("C:\\Users\\18291\\Desktop\\watermark\\0101-2001-长期-办公室-0005.pdf");
|
||||
File file2 = new File("C:\\Users\\18291\\Desktop\\watermark\\1\\2\\w3.pdf");
|
||||
copyFile(file1, file2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\CopyFileUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,11 @@
|
||||
/* */ package com.archive.common.archiveUtil;
|
||||
/* */
|
||||
/* */ import com.archive.common.archiveUtil.ExcelUtilArchive;
|
||||
/* */ import org.apache.poi.ss.usermodel.CellType;
|
||||
/* */
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\ExcelUtilArchive$1.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,516 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
public class ExcelUtilArchive {
|
||||
public static <T> void exportMultisheetExcel(String name, List<Map> mapList, HttpServletResponse response) {
|
||||
BufferedOutputStream bos = null;
|
||||
try {
|
||||
String fileName = name + ".xlsx";
|
||||
bos = getBufferedOutputStream(fileName, response);
|
||||
doExport(mapList, bos);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (bos != null) {
|
||||
bos.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<Map<String, String>> readExcel(String filePath, Integer sheetIndex) {
|
||||
List<Map<String, String>> dataList = new ArrayList<>();
|
||||
Workbook wb = createWorkBook(filePath);
|
||||
if (wb != null) {
|
||||
Sheet sheet = wb.getSheetAt(sheetIndex.intValue());
|
||||
int maxRownum = sheet.getPhysicalNumberOfRows();
|
||||
Row firstRow = sheet.getRow(0);
|
||||
int maxColnum = firstRow.getPhysicalNumberOfCells();
|
||||
String[] columns = new String[maxColnum];
|
||||
for (int i = 0; i < maxRownum; ) {
|
||||
Map<String, String> map = null;
|
||||
if (i > 0) {
|
||||
map = new LinkedHashMap<>();
|
||||
firstRow = sheet.getRow(i);
|
||||
}
|
||||
if (firstRow != null) {
|
||||
String cellData = null;
|
||||
for (int j = 0; j < maxColnum; j++) {
|
||||
cellData = getCellFormatValue(firstRow.getCell(j));
|
||||
if (i == 0) {
|
||||
columns[j] = cellData;
|
||||
} else {
|
||||
map.put(columns[j], cellData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (i > 0)
|
||||
dataList.add(map); i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
wb.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static int getSheetCount(String filePath) {
|
||||
Workbook wb = createWorkBook(filePath);
|
||||
int i = 0;
|
||||
if (wb != null) {
|
||||
Sheet whet1 = wb.getSheetAt(0);
|
||||
if (whet1 != null) {
|
||||
i++;
|
||||
}
|
||||
Sheet whet2 = wb.getSheetAt(1);
|
||||
if (whet2 != null) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
wb.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String[] readExcelFirstRow(String filePath, Integer sheetIndex) {
|
||||
String[] columns = null;
|
||||
Workbook wb = createWorkBook(filePath);
|
||||
if (wb != null) {
|
||||
Sheet sheet = wb.getSheetAt(sheetIndex.intValue());
|
||||
|
||||
Row firstRow = sheet.getRow(0);
|
||||
int maxColnum = firstRow.getPhysicalNumberOfCells();
|
||||
columns = new String[maxColnum];
|
||||
if (firstRow != null) {
|
||||
String cellData = null;
|
||||
for (int j = 0; j < maxColnum; j++) {
|
||||
cellData = getCellFormatValue(firstRow.getCell(j));
|
||||
if (!cellData.equals("") && !cellData.trim().equals("") && !cellData.equals("请选择")) {
|
||||
columns[j] = cellData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
wb.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return columns;
|
||||
}
|
||||
|
||||
|
||||
private static BufferedOutputStream getBufferedOutputStream(String fileName, HttpServletResponse response) throws Exception {
|
||||
response.setContentType("application/x-msdownload");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName
|
||||
.getBytes("gb2312"), "ISO8859-1"));
|
||||
return new BufferedOutputStream((OutputStream)response.getOutputStream());
|
||||
}
|
||||
|
||||
private static <T> void doExport(List<Map> mapList, OutputStream outputStream) {
|
||||
int maxBuff = 100;
|
||||
|
||||
SXSSFWorkbook wb = new SXSSFWorkbook(maxBuff);
|
||||
try {
|
||||
for (int i = 0; i < mapList.size(); i++) {
|
||||
Map map = mapList.get(i);
|
||||
String[] headers = (String[])map.get("headers");
|
||||
Collection<T> dataList = (Collection<T>)map.get("dataList");
|
||||
String fileName = (String)map.get("fileName");
|
||||
createSheet(wb, null, headers, dataList, fileName, maxBuff);
|
||||
}
|
||||
|
||||
if (outputStream != null) {
|
||||
wb.write(outputStream);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
wb.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static <T> void createSheet(SXSSFWorkbook wb, String[] exportFields, String[] headers, Collection<T> dataList, String fileName, int maxBuff) throws NoSuchFieldException, IllegalAccessException, IOException {
|
||||
SXSSFSheet sXSSFSheet = wb.createSheet(fileName);
|
||||
|
||||
CellStyle style = wb.createCellStyle();
|
||||
CellStyle style2 = wb.createCellStyle();
|
||||
|
||||
Font font = wb.createFont();
|
||||
font.setFontName("微软雅黑");
|
||||
font.setFontHeightInPoints((short)11);
|
||||
style.setFont(font);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
style2.setFont(font);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Row headerRow = sXSSFSheet.createRow(0);
|
||||
|
||||
int headerSize = headers.length;
|
||||
for (int cellnum = 0; cellnum < headerSize; cellnum++) {
|
||||
Cell cell = headerRow.createCell(cellnum);
|
||||
cell.setCellStyle(style);
|
||||
sXSSFSheet.setColumnWidth(cellnum, 4000);
|
||||
cell.setCellValue(headers[cellnum]);
|
||||
}
|
||||
|
||||
int rownum = 0;
|
||||
Iterator<T> iterator = dataList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
T data = iterator.next();
|
||||
Row row = sXSSFSheet.createRow(rownum + 1);
|
||||
|
||||
Field[] fields = getExportFields(data.getClass(), exportFields);
|
||||
for (int i = 0; i < headerSize; i++) {
|
||||
Cell cell = row.createCell(i);
|
||||
cell.setCellStyle(style2);
|
||||
Field field = fields[i];
|
||||
|
||||
setData(field, data, field.getName(), cell);
|
||||
}
|
||||
rownum = sXSSFSheet.getLastRowNum();
|
||||
|
||||
if (rownum % maxBuff == 0) {
|
||||
sXSSFSheet.flushRows(maxBuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static <T> void doExport(String[] headers, String[] exportFields, Collection<T> dataList, String fileName, OutputStream outputStream) {
|
||||
int maxBuff = 100;
|
||||
|
||||
SXSSFWorkbook wb = new SXSSFWorkbook(maxBuff);
|
||||
try {
|
||||
createSheet(wb, exportFields, headers, dataList, fileName, maxBuff);
|
||||
if (outputStream != null) {
|
||||
wb.write(outputStream);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static <T> Field getDataField(T object, String property) throws NoSuchFieldException, IllegalAccessException {
|
||||
if (property.contains(".")) {
|
||||
String p = property.substring(0, property.indexOf("."));
|
||||
Field field = object.getClass().getDeclaredField(p);
|
||||
return field;
|
||||
}
|
||||
Field dataField = object.getClass().getDeclaredField(property);
|
||||
|
||||
return dataField;
|
||||
}
|
||||
|
||||
private static Field[] getExportFields(Class<?> targetClass, String[] exportFieldNames) {
|
||||
Field[] fields = null;
|
||||
if (exportFieldNames == null || exportFieldNames.length < 1) {
|
||||
fields = targetClass.getDeclaredFields();
|
||||
} else {
|
||||
fields = new Field[exportFieldNames.length];
|
||||
for (int i = 0; i < exportFieldNames.length; i++) {
|
||||
try {
|
||||
fields[i] = targetClass.getDeclaredField(exportFieldNames[i]);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
fields[i] = targetClass.getSuperclass().getDeclaredField(exportFieldNames[i]);
|
||||
} catch (Exception e1) {
|
||||
throw new IllegalArgumentException("无法获取导出字段", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static <T> void setData(Field dataField, T object, String property, Cell cell) throws IllegalAccessException, NoSuchFieldException {
|
||||
dataField.setAccessible(true);
|
||||
Object val = dataField.get(object);
|
||||
Sheet sh = cell.getSheet();
|
||||
CellStyle style = cell.getCellStyle();
|
||||
int cellnum = cell.getColumnIndex();
|
||||
if (val != null) {
|
||||
if (dataField.getType().toString().endsWith("String")) {
|
||||
cell.setCellValue((String)val);
|
||||
} else if (dataField.getType().toString().endsWith("Integer") || dataField.getType().toString().endsWith("int")) {
|
||||
cell.setCellValue(((Integer)val).intValue());
|
||||
} else if (dataField.getType().toString().endsWith("Long") || dataField.getType().toString().endsWith("long")) {
|
||||
cell.setCellValue(val.toString());
|
||||
} else if (dataField.getType().toString().endsWith("Double") || dataField.getType().toString().endsWith("double")) {
|
||||
cell.setCellValue(((Double)val).doubleValue());
|
||||
} else if (dataField.getType().toString().endsWith("Date")) {
|
||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
cell.setCellValue(format.format((Date)val));
|
||||
} else if (dataField.getType().toString().endsWith("List")) {
|
||||
List list1 = (List)val;
|
||||
int size = list1.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
int start = property.indexOf(dataField.getName()) + dataField.getName().length() + 1;
|
||||
String tempProperty = property.substring(start, property.length());
|
||||
Field field = getDataField(list1.get(i), tempProperty);
|
||||
Cell tempCell = cell;
|
||||
if (i > 0) {
|
||||
int rowNum = cell.getRowIndex() + i;
|
||||
Row row = sh.getRow(rowNum);
|
||||
if (row == null) {
|
||||
row = sh.createRow(rowNum);
|
||||
|
||||
for (int j = 0; j < cell.getColumnIndex(); j++) {
|
||||
sh.addMergedRegion(new CellRangeAddress(cell.getRowIndex(), cell.getRowIndex() + size - 1, j, j));
|
||||
Cell c = row.createCell(j);
|
||||
c.setCellStyle(style);
|
||||
}
|
||||
}
|
||||
tempCell = row.createCell(cellnum);
|
||||
tempCell.setCellStyle(style);
|
||||
}
|
||||
|
||||
setData(field, list1.get(i), tempProperty, tempCell);
|
||||
}
|
||||
|
||||
} else if (property.contains(".")) {
|
||||
String p = property.substring(property.indexOf(".") + 1, property.length());
|
||||
Field field = getDataField(val, p);
|
||||
setData(field, val, p, cell);
|
||||
} else {
|
||||
cell.setCellValue(val.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Workbook createWorkBook(String filePath) {
|
||||
XSSFWorkbook xSSFWorkbook;
|
||||
Workbook wb = null;
|
||||
if (filePath == null) {
|
||||
return null;
|
||||
}
|
||||
String extString = filePath.substring(filePath.lastIndexOf("."));
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(filePath);
|
||||
if (".xls".equals(extString)) {
|
||||
HSSFWorkbook hSSFWorkbook; return (Workbook)(hSSFWorkbook = new HSSFWorkbook(is));
|
||||
} if (".xlsx".equals(extString)) {
|
||||
return (Workbook)(xSSFWorkbook = new XSSFWorkbook(is));
|
||||
}
|
||||
return (Workbook)xSSFWorkbook;
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return (Workbook)xSSFWorkbook;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String getCellFormatValue(Cell cell) {
|
||||
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String cellValue = "";
|
||||
if (cell == null) {
|
||||
return cellValue;
|
||||
}
|
||||
|
||||
CellType cellType = cell.getCellTypeEnum();
|
||||
|
||||
if (cellType == CellType.NUMERIC) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
}
|
||||
|
||||
|
||||
switch (null.$SwitchMap$org$apache$poi$ss$usermodel$CellType[cellType.ordinal()])
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case 1:
|
||||
cellValue = String.valueOf(cell.getStringCellValue());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return cellValue;case 2: cellValue = String.valueOf(cell.getStringCellValue()); return cellValue;case 3: cellValue = String.valueOf(cell.getBooleanCellValue()); return cellValue;case 4: cellValue = String.valueOf(cell.getCellFormula()); return cellValue;case 5: cellValue = cell.getStringCellValue(); return cellValue;case 6: cellValue = "非法字符"; return cellValue; } cellValue = "未知类型"; return cellValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\ExcelUtilArchive.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,32 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class FileUtils
|
||||
{
|
||||
public static String changeValueType(Long dataSize) {
|
||||
String valueType = new String();
|
||||
String[] type = { "KB", "MB", "GB", "TB", "PB" };
|
||||
int p = 0;
|
||||
if (dataSize.longValue() == 0L) {
|
||||
valueType = dataSize + type[p];
|
||||
} else {
|
||||
Double value = Double.valueOf(dataSize.longValue() * 1.0D / 1024.0D);
|
||||
while (value.doubleValue() >= 1024.0D) {
|
||||
value = Double.valueOf(value.doubleValue() / 1024.0D);
|
||||
p++;
|
||||
}
|
||||
valueType = String.format("%.2f", new Object[] { value }) + type[p];
|
||||
}
|
||||
return valueType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\FileUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,499 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Iterator;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.ImageReader;
|
||||
import javax.imageio.stream.ImageInputStream;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class ImageWaterMarkUtil
|
||||
{
|
||||
public static void markImageByWriting(String srcImgPath, String targerPath, String waterMarkContent, Color markContentColor, String scripts, String styles, int fontSize, Integer degree, float alpha, int xmove, int ymove) {
|
||||
try {
|
||||
String[] waterMarkContents = waterMarkContent.split("\\|\\|");
|
||||
|
||||
File srcImgFile = new File(srcImgPath);
|
||||
Image srcImg = ImageIO.read(srcImgFile);
|
||||
|
||||
int srcImgWidth = srcImg.getWidth(null);
|
||||
|
||||
int srcImgHeight = srcImg.getHeight(null);
|
||||
|
||||
BufferedImage bufImg = new BufferedImage(srcImgWidth, srcImgHeight, 1);
|
||||
|
||||
Graphics2D g = bufImg.createGraphics();
|
||||
g.drawImage(srcImg, 0, 0, srcImgWidth, srcImgHeight, null);
|
||||
|
||||
int sty = getStyle(styles);
|
||||
Font font = new Font(scripts, sty, fontSize);
|
||||
g.setComposite(AlphaComposite.getInstance(10, alpha));
|
||||
|
||||
g.setColor(markContentColor);
|
||||
|
||||
g.setFont(font);
|
||||
|
||||
g.rotate(Math.toRadians(degree.intValue()), bufImg.getWidth() / 2.0D, bufImg.getHeight() / 2.0D);
|
||||
|
||||
int maxLen = 0;
|
||||
int maxHigh = 0;
|
||||
for (int i = 0; i < waterMarkContents.length; i++) {
|
||||
waterMarkContent = waterMarkContents[i];
|
||||
int fontlen = g.getFontMetrics(g.getFont()).charsWidth(waterMarkContent.toCharArray(), 0, waterMarkContent.length());
|
||||
if (fontlen >= maxLen) {
|
||||
maxLen = fontlen;
|
||||
}
|
||||
maxHigh = maxHigh + (i + 1) * fontSize + 10;
|
||||
}
|
||||
|
||||
int line = srcImgWidth * 2 / maxLen;
|
||||
int co = srcImgHeight * 2 / maxHigh;
|
||||
int yz = 0;
|
||||
|
||||
for (int a = 0; a < co; a++) {
|
||||
int t = 0;
|
||||
for (int j = 0; j < waterMarkContents.length; j++) {
|
||||
waterMarkContent = waterMarkContents[j];
|
||||
int y = (j + 1) * fontSize + 10 + t;
|
||||
|
||||
int tempX = -srcImgWidth / 2;
|
||||
int tempY = -srcImgHeight / 2 + y + yz;
|
||||
|
||||
int tempCharLen = 0;
|
||||
|
||||
int tempLineLen = 0;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int k = 0; k < waterMarkContent.length(); k++) {
|
||||
char tempChar = waterMarkContent.charAt(k);
|
||||
tempCharLen = g.getFontMetrics(g.getFont()).charWidth(tempChar);
|
||||
tempLineLen += tempCharLen;
|
||||
|
||||
if (tempLineLen >= srcImgWidth) {
|
||||
|
||||
g.drawString(sb.toString(), tempX, tempY);
|
||||
t += fontSize;
|
||||
|
||||
sb.delete(0, sb.length());
|
||||
tempY += fontSize;
|
||||
tempLineLen = 0;
|
||||
}
|
||||
|
||||
sb.append(tempChar);
|
||||
}
|
||||
|
||||
for (int z = 0; z < line; z++) {
|
||||
|
||||
g.drawString(sb.toString(), tempX, tempY);
|
||||
tempX = tempX + maxLen + xmove;
|
||||
}
|
||||
}
|
||||
yz = yz + maxHigh + ymove;
|
||||
}
|
||||
g.dispose();
|
||||
|
||||
|
||||
File targetFile = new File(targerPath);
|
||||
if (!targetFile.getParentFile().exists()) {
|
||||
targetFile.getParentFile().mkdirs();
|
||||
}
|
||||
String format = getFormatName(new File(srcImgPath));
|
||||
FileOutputStream outImgStream = new FileOutputStream(targerPath);
|
||||
ImageIO.write(bufImg, format, outImgStream);
|
||||
outImgStream.flush();
|
||||
outImgStream.close();
|
||||
System.out.println("**********图片完成添加文字水印工作**********");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void markImageByWriting(String srcImgPath, String targerPath, String waterMarkContent, Color markContentColor, String scripts, String styles, int fontSize, Integer degree, float alpha, String watermarkPosition, Integer left, Integer top) {
|
||||
try {
|
||||
File srcImgFile = new File(srcImgPath);
|
||||
Image srcImg = ImageIO.read(srcImgFile);
|
||||
int srcImgWidth = srcImg.getWidth(null);
|
||||
int srcImgHeight = srcImg.getHeight(null);
|
||||
|
||||
BufferedImage bufImg = new BufferedImage(srcImgWidth, srcImgHeight, 1);
|
||||
Graphics2D g = bufImg.createGraphics();
|
||||
g.drawImage(srcImg, 0, 0, srcImgWidth, srcImgHeight, null);
|
||||
int sty = getStyle(styles);
|
||||
Font font = new Font(scripts, sty, fontSize);
|
||||
g.setComposite(AlphaComposite.getInstance(10, alpha));
|
||||
g.setColor(markContentColor);
|
||||
g.setFont(font);
|
||||
g.rotate(Math.toRadians(degree.intValue()), bufImg.getWidth() / 2.0D, bufImg.getHeight() / 2.0D);
|
||||
int markLength = g.getFontMetrics(g.getFont()).charsWidth(waterMarkContent.toCharArray(), 0, waterMarkContent.length());
|
||||
|
||||
int x = left.intValue();
|
||||
int y = top.intValue();
|
||||
if (x == 0 && y == 0) {
|
||||
switch (watermarkPosition) {
|
||||
case "topLeft":
|
||||
x = 0;
|
||||
y = 0 + fontSize;
|
||||
break;
|
||||
case "topRight":
|
||||
x = srcImgWidth - markLength;
|
||||
y = 0 + fontSize;
|
||||
break;
|
||||
case "topCenter":
|
||||
x = (srcImgWidth - markLength) / 2;
|
||||
y = 0 + fontSize;
|
||||
break;
|
||||
case "center":
|
||||
x = (srcImgWidth - markLength) / 2;
|
||||
y = (srcImgHeight - fontSize) / 2;
|
||||
break;
|
||||
case "centerLeft":
|
||||
x = 0;
|
||||
y = (srcImgHeight - fontSize) / 2;
|
||||
break;
|
||||
case "centerRight":
|
||||
x = srcImgWidth - markLength;
|
||||
y = (srcImgHeight - fontSize) / 2;
|
||||
break;
|
||||
case "bottomLeft":
|
||||
x = 0;
|
||||
y = srcImgHeight - 3;
|
||||
break;
|
||||
case "bottomCenter":
|
||||
x = (srcImgWidth - markLength) / 2;
|
||||
y = srcImgHeight - 3;
|
||||
break;
|
||||
case "bottomRight":
|
||||
x = srcImgWidth - markLength - 3;
|
||||
y = srcImgHeight - 3;
|
||||
break;
|
||||
default:
|
||||
x = srcImgWidth - markLength - 3;
|
||||
y = srcImgHeight - 3;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
g.drawString(waterMarkContent, x, y);
|
||||
g.dispose();
|
||||
|
||||
|
||||
File targetFile = new File(targerPath);
|
||||
if (!targetFile.getParentFile().exists()) {
|
||||
targetFile.getParentFile().mkdirs();
|
||||
}
|
||||
String format = getFormatName(new File(srcImgPath));
|
||||
FileOutputStream outImgStream = new FileOutputStream(targerPath);
|
||||
ImageIO.write(bufImg, format, outImgStream);
|
||||
outImgStream.flush();
|
||||
outImgStream.close();
|
||||
System.out.println("**********图片完成添加文字水印工作**********");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int getStyle(String styles) {
|
||||
switch (styles)
|
||||
{ case "普通":
|
||||
sty = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return sty;case "加粗": sty = 1; return sty;case "斜体": sty = 2; return sty;case "粗斜体": sty = 3; return sty; } int sty = 0; return sty;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void markImageByIcon(String iconPath, String srcImgPath, String targerPath, Integer degree, float alpha, Integer left, Integer top) {
|
||||
OutputStream os = null;
|
||||
try {
|
||||
Image srcImg = ImageIO.read(new File(srcImgPath));
|
||||
BufferedImage buffImg = new BufferedImage(srcImg.getWidth(null), srcImg.getHeight(null), 1);
|
||||
|
||||
|
||||
Graphics2D g = buffImg.createGraphics();
|
||||
|
||||
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||
g.drawImage(srcImg.getScaledInstance(srcImg.getWidth(null), srcImg.getHeight(null), 4), 0, 0, (ImageObserver)null);
|
||||
if (null != degree)
|
||||
{
|
||||
g.rotate(Math.toRadians(degree.intValue()), buffImg
|
||||
.getWidth() / 2.0D, buffImg
|
||||
.getHeight() / 2.0D);
|
||||
}
|
||||
|
||||
ImageIcon imgIcon = new ImageIcon(iconPath);
|
||||
|
||||
Image img = imgIcon.getImage();
|
||||
g.setComposite(AlphaComposite.getInstance(10, alpha));
|
||||
|
||||
g.drawImage(img, left.intValue(), top.intValue(), (ImageObserver)null);
|
||||
g.setComposite(AlphaComposite.getInstance(3));
|
||||
g.dispose();
|
||||
|
||||
File targetFile = new File(targerPath);
|
||||
if (!targetFile.getParentFile().exists()) {
|
||||
targetFile.getParentFile().mkdirs();
|
||||
}
|
||||
String format = getFormatName(new File(srcImgPath));
|
||||
os = new FileOutputStream(targerPath);
|
||||
|
||||
ImageIO.write(buffImg, format, os);
|
||||
System.out.println("**********图片完成添加图片水印工作**********");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (null != os)
|
||||
os.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void markImageByIcon(String iconPath, String srcImgPath, String targerPath, Integer degree, float alpha, String watermarkPosition) {
|
||||
OutputStream os = null; try {
|
||||
int x, y;
|
||||
Image srcImg = ImageIO.read(new File(srcImgPath));
|
||||
|
||||
BufferedImage buffImg = new BufferedImage(srcImg.getWidth(null), srcImg.getHeight(null), 1);
|
||||
|
||||
int srcWidth = srcImg.getWidth(null);
|
||||
int srcHeight = srcImg.getHeight(null);
|
||||
|
||||
Graphics2D g = buffImg.createGraphics();
|
||||
|
||||
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||
|
||||
g.drawImage(srcImg
|
||||
.getScaledInstance(srcImg.getWidth(null), srcImg
|
||||
.getHeight(null), 4), 0, 0, (ImageObserver)null);
|
||||
|
||||
if (null != degree) {
|
||||
g.rotate(Math.toRadians(degree.intValue()), buffImg
|
||||
.getWidth() / 2.0D, buffImg
|
||||
.getHeight() / 2.0D);
|
||||
}
|
||||
|
||||
ImageIcon imgIcon = new ImageIcon(iconPath);
|
||||
|
||||
Image img = imgIcon.getImage();
|
||||
int watermarkImageWidth = img.getWidth(null);
|
||||
int watermarkImageHeight = img.getHeight(null);
|
||||
g.setComposite(AlphaComposite.getInstance(10, alpha));
|
||||
|
||||
|
||||
|
||||
switch (watermarkPosition) {
|
||||
case "topLeft":
|
||||
x = 0;
|
||||
y = 0;
|
||||
break;
|
||||
case "topRight":
|
||||
x = srcWidth - watermarkImageWidth;
|
||||
y = 0;
|
||||
break;
|
||||
case "topCenter":
|
||||
x = (srcWidth - watermarkImageWidth) / 2;
|
||||
y = 0;
|
||||
break;
|
||||
case "center":
|
||||
x = (srcWidth - watermarkImageWidth) / 2;
|
||||
y = (srcHeight - watermarkImageHeight) / 2;
|
||||
break;
|
||||
case "centerLeft":
|
||||
x = 0;
|
||||
y = (srcHeight - watermarkImageHeight) / 2;
|
||||
break;
|
||||
case "centerRight":
|
||||
x = srcWidth - watermarkImageWidth;
|
||||
y = (srcHeight - watermarkImageHeight) / 2;
|
||||
break;
|
||||
case "bottomLeft":
|
||||
x = 0;
|
||||
y = srcHeight - watermarkImageHeight;
|
||||
break;
|
||||
case "bottomCenter":
|
||||
x = (srcWidth - watermarkImageWidth) / 2;
|
||||
y = srcHeight - watermarkImageHeight;
|
||||
break;
|
||||
case "bottomRight":
|
||||
x = srcWidth - watermarkImageWidth;
|
||||
y = srcHeight - watermarkImageHeight;
|
||||
break;
|
||||
default:
|
||||
x = srcWidth - watermarkImageWidth;
|
||||
y = srcHeight - watermarkImageHeight;
|
||||
break;
|
||||
}
|
||||
g.drawImage(img, x, y, (ImageObserver)null);
|
||||
g.setComposite(AlphaComposite.getInstance(3));
|
||||
g.dispose();
|
||||
|
||||
File targetFile = new File(targerPath);
|
||||
if (!targetFile.getParentFile().exists()) {
|
||||
targetFile.getParentFile().mkdirs();
|
||||
}
|
||||
String format = getFormatName(new File(srcImgPath));
|
||||
os = new FileOutputStream(targerPath);
|
||||
ImageIO.write(buffImg, format, os);
|
||||
System.out.println("**********图片完成添加图片水印工作**********");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (null != os)
|
||||
os.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String getFormatName(File file) {
|
||||
ImageInputStream iis = null;
|
||||
ImageReader reader = null;
|
||||
try {
|
||||
iis = ImageIO.createImageInputStream(file);
|
||||
Iterator<ImageReader> iter = ImageIO.getImageReaders(iis);
|
||||
if (!iter.hasNext()) {
|
||||
return null;
|
||||
}
|
||||
reader = iter.next();
|
||||
return reader.getFormatName();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (iis != null) {
|
||||
iis.close();
|
||||
}
|
||||
if (reader != null) {
|
||||
reader.dispose();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String iconPath = "C:\\Users\\18291\\Desktop\\watermark\\watermark2.png";
|
||||
String srcImgPath = "C:\\Users\\18291\\Desktop\\watermark\\c8.jpg";
|
||||
String targerPath = "C:\\Users\\18291\\Desktop\\watermark\\1\\2\\c1.jpg";
|
||||
String contont = "Font类是用于设置图形用户界面上的字体样式";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\ImageWaterMarkUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,28 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
import org.apache.commons.codec.digest.HmacUtils;
|
||||
|
||||
public class LicenseGenerator
|
||||
{
|
||||
public static String generateLicense(String macAddress) {
|
||||
String license = HmacUtils.hmacSha256Hex("tale", macAddress);
|
||||
return license;
|
||||
}
|
||||
private static final String LICENSE_SECRET_KEY = "tale";
|
||||
public static String licenseGetMac(String macAddress) {
|
||||
String license = HmacUtils.hmacSha256Hex("tale", macAddress);
|
||||
return license;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String macAddress = "00:1A:2B:3C:4D:5E";
|
||||
String license = generateLicense(macAddress);
|
||||
System.out.println("Generated License: " + license);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\LicenseGenerator.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,231 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
import com.archive.common.utils.DateUtils;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
|
||||
public class MacUtil
|
||||
{
|
||||
public static List<String> getMACAddressByWindows() throws Exception {
|
||||
ArrayList<String> rs = new ArrayList<>();
|
||||
String result = "";
|
||||
Process process = Runtime.getRuntime().exec("ipconfig /all");
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream(), "GBK"));
|
||||
int index = -1;
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
index = line.indexOf("物理地址");
|
||||
if (index >= 0) {
|
||||
index = line.indexOf(":");
|
||||
if (index >= 0) {
|
||||
result = line.substring(index + 1).trim();
|
||||
}
|
||||
rs.add(result.toUpperCase());
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
|
||||
|
||||
return rs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<String> getMacIds() {
|
||||
InetAddress ip = null;
|
||||
NetworkInterface ni = null;
|
||||
List<String> macList = new ArrayList<>();
|
||||
|
||||
try {
|
||||
Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||
while (netInterfaces.hasMoreElements()) {
|
||||
|
||||
ni = netInterfaces.nextElement();
|
||||
|
||||
|
||||
Enumeration<InetAddress> ips = ni.getInetAddresses();
|
||||
while (ips.hasMoreElements()) {
|
||||
ip = ips.nextElement();
|
||||
if (!ip.isLoopbackAddress() && ip
|
||||
.getHostAddress().matches("(\\d{1,3}\\.){3}\\d{1,3}"))
|
||||
{
|
||||
macList.add(getMacFromBytes(ni.getHardwareAddress()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("出现异常" + e.getMessage());
|
||||
}
|
||||
return macList;
|
||||
}
|
||||
|
||||
private static String getMacFromBytes(byte[] bytes) {
|
||||
StringBuffer mac = new StringBuffer();
|
||||
|
||||
boolean first = false;
|
||||
for (byte b : bytes) {
|
||||
if (first) {
|
||||
mac.append(":");
|
||||
}
|
||||
byte currentByte = (byte)((b & 0xF0) >> 4);
|
||||
mac.append(Integer.toHexString(currentByte));
|
||||
currentByte = (byte)(b & 0xF);
|
||||
mac.append(Integer.toHexString(currentByte));
|
||||
first = true;
|
||||
}
|
||||
System.out.println(mac.toString());
|
||||
return mac.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<String> getMacAddress() {
|
||||
ArrayList<String> macs = new ArrayList<>();
|
||||
try {
|
||||
Enumeration<NetworkInterface> allNetInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||
byte[] mac = null;
|
||||
while (allNetInterfaces.hasMoreElements()) {
|
||||
NetworkInterface netInterface = allNetInterfaces.nextElement();
|
||||
if (netInterface.isLoopback() || netInterface.isVirtual() || netInterface.isPointToPoint() || !netInterface.isUp()) {
|
||||
continue;
|
||||
}
|
||||
mac = netInterface.getHardwareAddress();
|
||||
if (mac != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < mac.length; i++) {
|
||||
sb.append(String.format("%02X%s", new Object[] { Byte.valueOf(mac[i]), (i < mac.length - 1) ? ":" : "" }));
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
macs.add(sb.toString().toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return macs;
|
||||
} catch (Exception e) {
|
||||
System.out.println("MAC地址获取失败" + e.getMessage());
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String getMAC() throws SocketException {
|
||||
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||
|
||||
while (networkInterfaces.hasMoreElements()) {
|
||||
NetworkInterface network = networkInterfaces.nextElement();
|
||||
byte[] mac = network.getHardwareAddress();
|
||||
if (mac == null) {
|
||||
System.out.println("mac为空");
|
||||
continue;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < mac.length; i++) {
|
||||
sb.append(String.format("%02X%s", new Object[] { Byte.valueOf(mac[i]), (i < mac.length - 1) ? "-" : "" }));
|
||||
}
|
||||
|
||||
|
||||
if (!"".equals(sb.toString())) {
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static boolean sqjy(String mac, String ckDate, int shqx) throws Exception {
|
||||
boolean res = false;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
System.out.println("操作系统:" + osName);
|
||||
if (osName.contains("windows")) {
|
||||
List<String> list = getMACAddressByWindows();
|
||||
if (list.contains(mac)) {
|
||||
res = true;
|
||||
}
|
||||
} else if (osName.contains("linux")) {
|
||||
List<String> list = getMacIds();
|
||||
if (list.contains(mac)) {
|
||||
res = true;
|
||||
}
|
||||
} else if (osName.contains("uos")) {
|
||||
|
||||
List<String> list = getMacAddress();
|
||||
if (list.contains(mac)) {
|
||||
res = true;
|
||||
}
|
||||
} else if (osName.contains("kylin")) {
|
||||
|
||||
String mac1 = getMAC();
|
||||
if (mac1.equals(mac)) {
|
||||
res = true;
|
||||
}
|
||||
}
|
||||
if (res == true) {
|
||||
System.out.println("mac地址校验通过");
|
||||
if (shqx == 0) {
|
||||
System.out.println("授权期限校验通过,永久授权");
|
||||
} else {
|
||||
Date dqsj = DateUtils.addDays(sdf.parse(ckDate), shqx);
|
||||
if (dqsj.after(new Date())) {
|
||||
res = true;
|
||||
System.out.println("系统授权期限为:" + shqx + "天,到期时间:" + sdf.format(dqsj));
|
||||
} else {
|
||||
System.out.println("系统授权期限为:" + shqx + "天,出库时间:" + ckDate + ",到期时间:" + sdf.format(dqsj));
|
||||
System.out.println("系统授权已过期,请联系商务进行授权!");
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
System.out.println("mac地址校验失败,请核实授权MAC是否正确");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
System.out.println(osName);
|
||||
if (osName.contains("windows")) {
|
||||
List<String> list = getMACAddressByWindows();
|
||||
for (int i = 0; i < list.size(); i++)
|
||||
System.out.println(list.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\MacUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,218 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.tika.exception.TikaException;
|
||||
import org.apache.tika.metadata.Metadata;
|
||||
import org.apache.tika.parser.AutoDetectParser;
|
||||
import org.apache.tika.parser.ParseContext;
|
||||
import org.apache.tika.sax.BodyContentHandler;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class MetadataUtil
|
||||
{
|
||||
public static List<Map<String, String>> getMetadataAllByFile(String path) {
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
File file = new File(path);
|
||||
|
||||
AutoDetectParser autoDetectParser = new AutoDetectParser();
|
||||
BodyContentHandler handler = new BodyContentHandler(Integer.parseInt(String.valueOf(file.length())));
|
||||
Metadata metadata = new Metadata();
|
||||
FileInputStream inputstream = null;
|
||||
try {
|
||||
inputstream = new FileInputStream(file);
|
||||
ParseContext context = new ParseContext();
|
||||
autoDetectParser.parse(inputstream, (ContentHandler)handler, metadata, context);
|
||||
String[] metadataNames = metadata.names();
|
||||
for (String name : metadataNames) {
|
||||
if (name.indexOf("tiff") == -1 && name.indexOf("Exif") == -1 && name
|
||||
.indexOf("X-Parsed-By") == -1 && name
|
||||
.indexOf("File Name") == -1 && name
|
||||
.indexOf("Component ") == -1 && name
|
||||
.indexOf("meta:") == -1 &&
|
||||
|
||||
!name.equals("date") && name
|
||||
.indexOf("dcterms:") == -1) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("propety", ConverChinaText(name));
|
||||
map.put("propetyValue", metadata.get(name));
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inputstream != null) {
|
||||
try {
|
||||
inputstream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException, TikaException, SAXException {
|
||||
File file = new File("C:\\Users\\Administrator\\Downloads\\20221104091635.pdf");
|
||||
|
||||
AutoDetectParser autoDetectParser = new AutoDetectParser();
|
||||
|
||||
|
||||
|
||||
BodyContentHandler handler = new BodyContentHandler();
|
||||
Metadata metadata = new Metadata();
|
||||
FileInputStream inputstream = new FileInputStream(file);
|
||||
ParseContext context = new ParseContext();
|
||||
autoDetectParser.parse(inputstream, (ContentHandler)handler, metadata, context);
|
||||
|
||||
|
||||
|
||||
|
||||
String[] metadataNames = metadata.names();
|
||||
for (String name : metadataNames) {
|
||||
if (name.indexOf("tiff") == -1 && name.indexOf("Exif") == -1 && name
|
||||
.indexOf("X-Parsed-By") == -1 && name
|
||||
.indexOf("File Name") == -1 && name
|
||||
.indexOf("Component ") == -1 && name
|
||||
.indexOf("meta:") == -1 &&
|
||||
|
||||
!name.equals("date") && name
|
||||
.indexOf("dcterms:") == -1) {
|
||||
System.out.println(ConverChinaText(name) + ": " + metadata.get(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String ConverChinaText(String name) {
|
||||
String res = name;
|
||||
if (name.contains("Y Resolution")) {
|
||||
res = "Y轴分辨率(Y Resolution)";
|
||||
} else if (name.contains("X Resolution")) {
|
||||
res = "X轴分辨率(X Resolution)";
|
||||
} else if (name.contains("Image Width")) {
|
||||
res = "宽度(Image Width)";
|
||||
} else if (name.contains("Image Height")) {
|
||||
res = "高度(Image Height)";
|
||||
} else if (name.contains("Number of Tables")) {
|
||||
res = "表格数量(Number of Tables)";
|
||||
} else if (name.contains("Compression Type")) {
|
||||
res = "压缩方式(Compression Type)";
|
||||
} else if (name.contains("Data Precision")) {
|
||||
res = "数据精度(Data Precision)";
|
||||
} else if (name.contains("Number of Components")) {
|
||||
res = "部件数量(Number of Components)";
|
||||
} else if (name.contains("File Size")) {
|
||||
res = "文件大小(File Size)";
|
||||
} else if (name.contains("Color Space")) {
|
||||
res = "色彩空间(" + name + ")";
|
||||
} else if (name.contains("Exif Version")) {
|
||||
res = "Exif版本(" + name + ")";
|
||||
} else if (name.contains("Thumbnail Offset")) {
|
||||
res = "缩略图偏移(" + name + ")";
|
||||
} else if (name.contains("Resolution Unit")) {
|
||||
res = "分辨率单位(" + name + ")";
|
||||
} else if (name.contains("BitsPerSample")) {
|
||||
res = "每个样本位数(" + name + ")";
|
||||
} else if (name.contains("Caption Digest")) {
|
||||
res = "标题摘要(" + name + ")";
|
||||
} else if (name.contains("Content-Type")) {
|
||||
res = "内容类型(" + name + ")";
|
||||
} else if (name.contains("File Modified Date")) {
|
||||
res = "文件修改日期(" + name + ")";
|
||||
} else if (name.contains("YCbCr Positioning")) {
|
||||
res = "YCbCr位置(" + name + ")";
|
||||
} else if (name.contains("Thumbnail Width Pixels")) {
|
||||
res = "缩略图宽度像素(" + name + ")";
|
||||
} else if (name.contains("Thumbnail Length")) {
|
||||
res = "缩略图长度(" + name + ")";
|
||||
} else if (name.contains("Orientation")) {
|
||||
res = "方向(" + name + ")";
|
||||
} else if (name.contains("FlashPix Version")) {
|
||||
res = "FlashPix版本(" + name + ")";
|
||||
|
||||
|
||||
}
|
||||
else if (name.contains("PDFVersion")) {
|
||||
res = "PDF版本(" + name + ")";
|
||||
} else if (name.contains("hasXFA")) {
|
||||
res = "是否有XFA(" + name + ")";
|
||||
} else if (name.contains("access_permission:modify_annotations")) {
|
||||
res = "访问权限-修改注释(" + name + ")";
|
||||
} else if (name.contains("access_permission:can_print_degraded")) {
|
||||
res = "访问权限-分级打印(" + name + ")";
|
||||
} else if (name.contains("created")) {
|
||||
res = "创建时间(" + name + ")";
|
||||
} else if (name.contains("Last-Modified")) {
|
||||
res = "最后修改时间(" + name + ")";
|
||||
} else if (name.contains("modified")) {
|
||||
res = "修改时间(" + name + ")";
|
||||
} else if (name.contains("dc:format")) {
|
||||
res = "格式(" + name + ")";
|
||||
} else if (name.contains("Last-Save-Date")) {
|
||||
res = "最后保存时间(" + name + ")";
|
||||
} else if (name.contains("access_permission:fill_in_form")) {
|
||||
res = "访问权限-填充表单(" + name + ")";
|
||||
} else if (name.contains("access_permission:fill_in_form")) {
|
||||
res = "访问权限-填充表单(" + name + ")";
|
||||
} else if (name.contains("producer")) {
|
||||
res = "制作者(" + name + ")";
|
||||
} else if (name.contains("access_permission:can_print")) {
|
||||
res = "访问权限-可打印(" + name + ")";
|
||||
} else if (name.contains("access_permission:extract_content")) {
|
||||
res = "访问权限-提取内容(" + name + ")";
|
||||
}
|
||||
else if (name.contains("access_permission:assemble_document")) {
|
||||
res = "访问权限-汇编文档(" + name + ")";
|
||||
} else if (name.contains("access_permission:extract_for_accessibility")) {
|
||||
res = "访问权限-可访问性提取(" + name + ")";
|
||||
} else if (name.contains("xmpTPg:NPages")) {
|
||||
res = "页数(" + name + ")";
|
||||
} else if (name.contains("access_permission:can_modify")) {
|
||||
res = "访问权限-可修改(" + name + ")";
|
||||
} else if (name.contains("Creation-Date")) {
|
||||
res = "创建时间(" + name + ")";
|
||||
} else if (name.contains("pdf:hasXMP")) {
|
||||
res = "是否有XMP(" + name + ")";
|
||||
} else if (name.contains("pdf:charsPerPage")) {
|
||||
res = "每页字符数(" + name + ")";
|
||||
} else if (name.contains("pdf:hasMarkedContent")) {
|
||||
res = "包含标记内容(" + name + ")";
|
||||
} else if (name.contains("pdf:encrypted")) {
|
||||
res = "是否加密(" + name + ")";
|
||||
} else if (name.contains("pdf:unmappedUnicodeCharsPerPage")) {
|
||||
res = "每页未知字符(" + name + ")";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\MetadataUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,382 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
import com.itextpdf.text.Image;
|
||||
import com.itextpdf.text.Rectangle;
|
||||
import com.itextpdf.text.pdf.BaseFont;
|
||||
import com.itextpdf.text.pdf.PdfContentByte;
|
||||
import com.itextpdf.text.pdf.PdfGState;
|
||||
import com.itextpdf.text.pdf.PdfReader;
|
||||
import com.itextpdf.text.pdf.PdfStamper;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import sun.font.FontDesignMetrics;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class PdfWaterMarkUtil
|
||||
{
|
||||
private static int interval = 20;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void waterMarkforWriting(String inputFile, String outputFile, String waterMarkName, Integer degree, float alpha, int fontSize) {
|
||||
try {
|
||||
File file = new File(outputFile);
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
PdfReader reader = new PdfReader(inputFile);
|
||||
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(outputFile));
|
||||
|
||||
BaseFont base = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", true);
|
||||
Rectangle pageRect = null;
|
||||
PdfGState gs = new PdfGState();
|
||||
gs.setFillOpacity(alpha);
|
||||
|
||||
int total = reader.getNumberOfPages() + 1;
|
||||
FontMetrics metrics = FontDesignMetrics.getMetrics(new Font("宋体", 0, fontSize));
|
||||
int textH = metrics.getHeight();
|
||||
int textW = metrics.stringWidth(waterMarkName);
|
||||
|
||||
for (int i = 1; i < total; i++) {
|
||||
pageRect = reader.getPageSizeWithRotation(i);
|
||||
PdfContentByte under = stamper.getOverContent(i);
|
||||
under.saveState();
|
||||
under.setGState(gs);
|
||||
under.beginText();
|
||||
under.setFontAndSize(base, fontSize);
|
||||
int height;
|
||||
for (height = interval + textH; height < pageRect.getHeight(); height += textH * 3) {
|
||||
int width; for (width = interval + textW; width < pageRect.getWidth() + textW; width += textW * 2) {
|
||||
under.showTextAligned(0, waterMarkName, height, width, degree.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
under.endText();
|
||||
}
|
||||
stamper.close();
|
||||
reader.close();
|
||||
System.out.println("**********PDF完成添加文字水印工作**********");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void waterMarkforWriting(String inputFile, String outputFile, String waterMarkName, Integer degree, float alpha, int fontSize, String watermarkPosition, Integer left, Integer top) {
|
||||
try {
|
||||
File file = new File(outputFile);
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
PdfReader reader = new PdfReader(inputFile);
|
||||
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(outputFile));
|
||||
|
||||
BaseFont base = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", true);
|
||||
Rectangle pageRect = null;
|
||||
PdfGState gs = new PdfGState();
|
||||
gs.setFillOpacity(alpha);
|
||||
|
||||
int total = reader.getNumberOfPages() + 1;
|
||||
|
||||
FontMetrics metrics = FontDesignMetrics.getMetrics(new Font("宋体", 0, fontSize));
|
||||
int textH = metrics.getHeight();
|
||||
int textW = metrics.stringWidth(waterMarkName);
|
||||
|
||||
for (int i = 1; i < total; i++) {
|
||||
pageRect = reader.getPageSizeWithRotation(i);
|
||||
PdfContentByte under = stamper.getOverContent(i);
|
||||
under.saveState();
|
||||
under.setGState(gs);
|
||||
under.beginText();
|
||||
under.setFontAndSize(base, fontSize);
|
||||
int pdfWidth = (int)pageRect.getWidth();
|
||||
int pdfHeight = (int)pageRect.getHeight();
|
||||
|
||||
int x = left.intValue();
|
||||
int y = top.intValue();
|
||||
if (x == 0 && y == 0) {
|
||||
switch (watermarkPosition) {
|
||||
case "bottomLeft":
|
||||
x = 0;
|
||||
y = 3;
|
||||
break;
|
||||
case "bottomRight":
|
||||
x = pdfWidth - textW;
|
||||
y = 3;
|
||||
break;
|
||||
case "bottomCenter":
|
||||
x = (pdfWidth - textW) / 2;
|
||||
y = 3;
|
||||
break;
|
||||
case "center":
|
||||
x = (pdfWidth - textW) / 2;
|
||||
y = (pdfHeight - textH) / 2;
|
||||
break;
|
||||
case "centerLeft":
|
||||
x = 0;
|
||||
y = (pdfHeight - textH) / 2;
|
||||
break;
|
||||
case "centerRight":
|
||||
x = pdfWidth - textW;
|
||||
y = (pdfHeight - textH) / 2;
|
||||
break;
|
||||
case "topLeft":
|
||||
x = 0;
|
||||
y = pdfHeight - textH;
|
||||
break;
|
||||
case "topCenter":
|
||||
x = (pdfWidth - textW) / 2;
|
||||
y = pdfHeight - textH;
|
||||
break;
|
||||
case "topRight":
|
||||
x = pdfWidth - textW;
|
||||
y = pdfHeight - textH;
|
||||
break;
|
||||
default:
|
||||
x = pdfWidth - textW;
|
||||
y = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
under.showTextAligned(0, waterMarkName, x, y, degree.intValue());
|
||||
|
||||
under.endText();
|
||||
}
|
||||
stamper.close();
|
||||
reader.close();
|
||||
System.out.println("**********PDF完成添加文字水印工作**********");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void pressImageWater(String srcPath, String targetPath, String imgPath, int x, int y) {
|
||||
PdfReader reader = null;
|
||||
PdfStamper stamp = null;
|
||||
|
||||
try {
|
||||
reader = new PdfReader(srcPath);
|
||||
|
||||
File targetFile = new File(targetPath);
|
||||
if (!targetFile.getParentFile().exists()) {
|
||||
targetFile.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
stamp = new PdfStamper(reader, new FileOutputStream(targetFile));
|
||||
Image img = Image.getInstance(imgPath);
|
||||
|
||||
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
|
||||
|
||||
PdfContentByte over = stamp.getOverContent(i);
|
||||
img.setAbsolutePosition(x, y);
|
||||
|
||||
over.addImage(img);
|
||||
}
|
||||
stamp.close();
|
||||
reader.close();
|
||||
System.out.println("**********PDF完成添加图片水印工作**********");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void pressImageWater(String srcPath, String targetPath, String imgPath, int x, int y, int r) {
|
||||
PdfReader reader = null;
|
||||
PdfStamper stamp = null;
|
||||
|
||||
try {
|
||||
reader = new PdfReader(srcPath);
|
||||
|
||||
File targetFile = new File(targetPath);
|
||||
if (!targetFile.getParentFile().exists()) {
|
||||
targetFile.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
stamp = new PdfStamper(reader, new FileOutputStream(targetFile));
|
||||
Image img = Image.getInstance(imgPath);
|
||||
|
||||
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
|
||||
|
||||
PdfContentByte over = stamp.getOverContent(i);
|
||||
img.setAbsolutePosition(x, y);
|
||||
|
||||
img.setRotationDegrees(r);
|
||||
|
||||
over.addImage(img);
|
||||
}
|
||||
stamp.close();
|
||||
reader.close();
|
||||
System.out.println("**********PDF完成添加图片水印工作**********");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void pressImageWater(String srcPath, String targetPath, String imgPath, String position, Integer left, Integer top) {
|
||||
PdfReader reader = null;
|
||||
PdfStamper stamp = null;
|
||||
|
||||
try {
|
||||
reader = new PdfReader(srcPath);
|
||||
|
||||
File targetFile = new File(targetPath);
|
||||
if (!targetFile.getParentFile().exists()) {
|
||||
targetFile.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
stamp = new PdfStamper(reader, new FileOutputStream(targetFile));
|
||||
Image img = Image.getInstance(imgPath);
|
||||
|
||||
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
|
||||
|
||||
PdfContentByte over = stamp.getOverContent(i);
|
||||
|
||||
Rectangle pageSize = reader.getPageSize(i);
|
||||
int srcWth = (int)pageSize.getWidth();
|
||||
int srcHht = (int)pageSize.getHeight();
|
||||
int imgWth = (int)img.getWidth();
|
||||
int imgHht = (int)img.getHeight();
|
||||
|
||||
int x = left.intValue();
|
||||
int y = top.intValue();
|
||||
if (x == 0 && y == 0) {
|
||||
switch (position) {
|
||||
case "topLeft":
|
||||
x = 0;
|
||||
y = srcHht - imgHht;
|
||||
break;
|
||||
case "topCenter":
|
||||
x = (srcWth - imgWth) / 2;
|
||||
y = srcHht - imgHht;
|
||||
break;
|
||||
case "topRight":
|
||||
x = srcWth - imgWth;
|
||||
y = srcHht - imgHht;
|
||||
break;
|
||||
case "center":
|
||||
x = (srcWth - imgWth) / 2;
|
||||
y = (srcHht - imgHht) / 2;
|
||||
break;
|
||||
case "centerLeft":
|
||||
x = 0;
|
||||
y = (srcHht - imgHht) / 2;
|
||||
break;
|
||||
case "centerRight":
|
||||
x = srcWth - imgWth;
|
||||
y = (srcHht - imgHht) / 2;
|
||||
break;
|
||||
case "bottomLeft":
|
||||
x = 0;
|
||||
y = 0;
|
||||
break;
|
||||
case "bottomRight":
|
||||
x = srcWth - imgWth;
|
||||
y = 0;
|
||||
break;
|
||||
case "bottomCenter":
|
||||
x = (srcWth - imgWth) / 2;
|
||||
y = 0;
|
||||
break;
|
||||
default:
|
||||
x = srcWth - imgWth;
|
||||
y = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
img.setAbsolutePosition(x, y);
|
||||
|
||||
over.addImage(img);
|
||||
}
|
||||
stamp.close();
|
||||
reader.close();
|
||||
System.out.println("**********PDF完成添加文字水印工作**********");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String iconPath = "C:\\Users\\18291\\Desktop\\watermark\\watermark2.png";
|
||||
String srcPdfPath = "C:\\Users\\18291\\Desktop\\watermark\\0101-2001-长期-办公室-0005.pdf";
|
||||
String outPdfPath = "C:\\Users\\18291\\Desktop\\watermark\\1\\2\\w3.pdf";
|
||||
String contont = "Font类是用于设置图形用户界面上的字体样式";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\PdfWaterMarkUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,192 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
import com.archive.common.archiveUtil.TableUtil;
|
||||
import com.archive.project.common.service.IExecuteSqlService;
|
||||
import com.archive.project.dasz.physicaltablecolumn.domain.PhysicalTableColumn;
|
||||
import com.archive.project.dasz.physicaltablecolumn.service.IPhysicalTableColumnService;
|
||||
import java.util.List;
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Component
|
||||
public class SqlLiteUtil
|
||||
{
|
||||
@Autowired
|
||||
private IExecuteSqlService executeSqlService;
|
||||
@Autowired
|
||||
private IPhysicalTableColumnService physicalTableColumnService;
|
||||
private static IExecuteSqlService UtilExecuteSqlService;
|
||||
private static IPhysicalTableColumnService UtilPhysicalTableColumnService;
|
||||
|
||||
@PostConstruct
|
||||
private void initialize() {
|
||||
UtilExecuteSqlService = this.executeSqlService;
|
||||
UtilPhysicalTableColumnService = this.physicalTableColumnService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static boolean updateColumnType(String tableName, String columnType, String columnName, String mrz) throws Exception {
|
||||
boolean res = true;
|
||||
|
||||
String newTableName = tableName + "_resect";
|
||||
String createSql = "CREATE TABLE " + newTableName + " ( id INTEGER PRIMARY KEY AUTOINCREMENT,";
|
||||
|
||||
String tableId = TableUtil.getTableId(tableName);
|
||||
PhysicalTableColumn ptc = new PhysicalTableColumn();
|
||||
ptc.setTableId(Long.valueOf(Long.parseLong(tableId)));
|
||||
List<PhysicalTableColumn> ptcList = UtilPhysicalTableColumnService.selectPhysicalTableColumnList(ptc);
|
||||
String columns = "id,";
|
||||
for (int i = 0; i < ptcList.size(); i++) {
|
||||
String type = "TEXT";
|
||||
if (i == ptcList.size() - 1) {
|
||||
columns = columns + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode();
|
||||
} else {
|
||||
columns = columns + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + ",";
|
||||
}
|
||||
|
||||
|
||||
if (((PhysicalTableColumn)ptcList.get(i)).getColumnType().equals("C"))
|
||||
{
|
||||
type = "INTEGER";
|
||||
}
|
||||
|
||||
if (((PhysicalTableColumn)ptcList.get(i)).getColumnCode().equals(columnName)) {
|
||||
if (i == ptcList.size() - 1) {
|
||||
|
||||
if (mrz != null && !mrz.trim().equals("")) {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + columnType + " DEFAULT " + mrz;
|
||||
} else {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + columnType;
|
||||
}
|
||||
|
||||
} else if (mrz != null && !mrz.trim().equals("")) {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + columnType + " DEFAULT " + mrz + " ,";
|
||||
} else {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + columnType + ",";
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
String otherColumnMrz = ((PhysicalTableColumn)ptcList.get(i)).getMrz();
|
||||
if (i == ptcList.size() - 1) {
|
||||
if (otherColumnMrz != null && !otherColumnMrz.trim().equals("")) {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + type + " DEFAULT " + otherColumnMrz;
|
||||
} else {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + type;
|
||||
}
|
||||
|
||||
} else if (otherColumnMrz != null && !otherColumnMrz.trim().equals("")) {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + type + " DEFAULT " + otherColumnMrz + ",";
|
||||
} else {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + type + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createSql = createSql + ") ";
|
||||
UtilExecuteSqlService.jdbcTemplateExecute(createSql);
|
||||
|
||||
String sql = "insert into " + newTableName + " select " + columns + " from " + tableName + "";
|
||||
UtilExecuteSqlService.jdbcTemplateExecute(sql);
|
||||
|
||||
String dropSql = "DROP TABLE " + tableName;
|
||||
UtilExecuteSqlService.jdbcTemplateExecute(dropSql);
|
||||
|
||||
String updateTableNameSql = "ALTER TABLE " + newTableName + " RENAME TO " + tableName + "";
|
||||
UtilExecuteSqlService.jdbcTemplateExecute(updateTableNameSql);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static boolean deleteColumn(String tableName, String columnName) throws Exception {
|
||||
boolean res = true;
|
||||
|
||||
String newTableName = tableName + "_resect";
|
||||
String createSql = "CREATE TABLE " + newTableName + " ( id INTEGER PRIMARY KEY AUTOINCREMENT,";
|
||||
|
||||
String tableId = TableUtil.getTableId(tableName);
|
||||
PhysicalTableColumn ptc = new PhysicalTableColumn();
|
||||
ptc.setTableId(Long.valueOf(Long.parseLong(tableId)));
|
||||
List<PhysicalTableColumn> ptcList = UtilPhysicalTableColumnService.selectPhysicalTableColumnList(ptc);
|
||||
String columns = "id,";
|
||||
for (int i = 0; i < ptcList.size(); i++) {
|
||||
String type = "TEXT";
|
||||
|
||||
if (((PhysicalTableColumn)ptcList.get(i)).getColumnType().equals("C"))
|
||||
{
|
||||
type = "INTEGER";
|
||||
}
|
||||
if (((PhysicalTableColumn)ptcList.get(i)).getColumnCode().equals(columnName)) {
|
||||
System.out.println("此字段删除:" + columnName);
|
||||
} else {
|
||||
String otherColumnMrz = ((PhysicalTableColumn)ptcList.get(i)).getMrz();
|
||||
if (i == ptcList.size() - 1) {
|
||||
if (otherColumnMrz != null && !otherColumnMrz.trim().equals("")) {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + type + " DEFAULT " + otherColumnMrz;
|
||||
} else {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + type;
|
||||
}
|
||||
columns = columns + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode();
|
||||
} else {
|
||||
if (otherColumnMrz != null && !otherColumnMrz.trim().equals("")) {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + type + " DEFAULT " + otherColumnMrz + ",";
|
||||
} else {
|
||||
createSql = createSql + " " + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + " " + type + ",";
|
||||
}
|
||||
columns = columns + ((PhysicalTableColumn)ptcList.get(i)).getColumnCode() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (createSql.substring(createSql.length() - 1).equals(",")) {
|
||||
createSql = createSql.substring(0, createSql.length() - 1);
|
||||
}
|
||||
createSql = createSql + ") ";
|
||||
UtilExecuteSqlService.jdbcTemplateExecute(createSql);
|
||||
|
||||
if (columns.substring(columns.length() - 1).equals(",")) {
|
||||
columns = columns.substring(0, columns.length() - 1);
|
||||
}
|
||||
String sql = "insert into " + newTableName + " select " + columns + " from " + tableName + "";
|
||||
UtilExecuteSqlService.jdbcTemplateExecute(sql);
|
||||
|
||||
String dropSql = "DROP TABLE " + tableName;
|
||||
UtilExecuteSqlService.jdbcTemplateExecute(dropSql);
|
||||
|
||||
String updateTableNameSql = "ALTER TABLE " + newTableName + " RENAME TO " + tableName + "";
|
||||
UtilExecuteSqlService.jdbcTemplateExecute(updateTableNameSql);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\SqlLiteUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,139 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
import com.archive.project.dasz.archivetype.domain.ArchiveType;
|
||||
import com.archive.project.dasz.archivetype.service.IArchiveTypeService;
|
||||
import com.archive.project.dasz.physicaltable.domain.PhysicalTable;
|
||||
import com.archive.project.dasz.physicaltable.service.IPhysicalTableService;
|
||||
import java.util.List;
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Component
|
||||
public class TableUtil
|
||||
{
|
||||
@Autowired
|
||||
private IPhysicalTableService service;
|
||||
private static IPhysicalTableService physicalTableService;
|
||||
@Autowired
|
||||
private IArchiveTypeService archiveTypeservice;
|
||||
private static IArchiveTypeService archiveTypeService1;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
physicalTableService = this.service;
|
||||
archiveTypeService1 = this.archiveTypeservice;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String getTableId(String tableName) {
|
||||
PhysicalTable physicalTable = new PhysicalTable();
|
||||
physicalTable.setTablename(tableName.toLowerCase());
|
||||
List<PhysicalTable> list = physicalTableService.selectPhysicalTableList(physicalTable);
|
||||
if (list != null && list.size() > 0) {
|
||||
return String.valueOf(((PhysicalTable)list.get(0)).getId());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String getTableName(Long tableId) {
|
||||
PhysicalTable physicalTable = physicalTableService.selectPhysicalTableById(tableId);
|
||||
if (physicalTable != null) {
|
||||
return physicalTable.getTablename();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static long getTableIdByArchiveTypeId(long archiveTypeId) {
|
||||
long tableId = 0L;
|
||||
ArchiveType ArchiveType = archiveTypeService1.selectArchiveTypeById(Long.valueOf(archiveTypeId));
|
||||
String archiveCode = ArchiveType.getArhciveCode();
|
||||
String archiveType = ArchiveType.getType();
|
||||
String tableName = "";
|
||||
if (archiveType.toLowerCase().equals("file")) {
|
||||
tableName = "t_ar_" + archiveCode + "_file";
|
||||
} else if (archiveType.toLowerCase().equals("folder")) {
|
||||
tableName = "t_ar_" + archiveCode + "_folder";
|
||||
}
|
||||
if (!tableName.equals("")) {
|
||||
PhysicalTable pt = new PhysicalTable();
|
||||
pt.setTablename(tableName.toLowerCase());
|
||||
List<PhysicalTable> pts = physicalTableService.selectPhysicalTableList(pt);
|
||||
if (pts.size() > 0 && pts.get(0) != null) {
|
||||
tableId = ((PhysicalTable)pts.get(0)).getId().longValue();
|
||||
}
|
||||
}
|
||||
return tableId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static long getArchiveTypeIdByTableId(long tableId) {
|
||||
long ArchiveTypeId = 0L;
|
||||
String tableName = getTableName(Long.valueOf(tableId));
|
||||
String archiveCode = tableName.substring(5, tableName.lastIndexOf("_"));
|
||||
ArchiveType ac = new ArchiveType();
|
||||
ac.setArhciveCode(archiveCode.toUpperCase());
|
||||
List<ArchiveType> list = archiveTypeService1.selectArchiveTypeList(ac);
|
||||
if (list != null && list.get(0) != null) {
|
||||
ArchiveTypeId = ((ArchiveType)list.get(0)).getId().longValue();
|
||||
}
|
||||
return ArchiveTypeId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<ArchiveType> getAllArchiveType() {
|
||||
ArchiveType ac = new ArchiveType();
|
||||
List<ArchiveType> list = archiveTypeService1.selectArchiveTypeList(ac);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\TableUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,124 @@
|
||||
package com.archive.common.archiveUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Enumeration;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class ZipUtil
|
||||
{
|
||||
public static void unZip(File srcFile, String destDirPath) throws RuntimeException {
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
|
||||
|
||||
if (!srcFile.exists()) {
|
||||
throw new RuntimeException(srcFile.getPath() + "所指文件不存在");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ZipFile zipFile = null;
|
||||
|
||||
|
||||
try {
|
||||
zipFile = new ZipFile(srcFile, Charset.forName("GBK"));
|
||||
|
||||
Enumeration<?> entries = zipFile.entries();
|
||||
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = (ZipEntry)entries.nextElement();
|
||||
|
||||
System.out.println("解压" + entry.getName());
|
||||
|
||||
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
String dirPath = destDirPath + "/" + entry.getName();
|
||||
|
||||
File dir = new File(dirPath);
|
||||
|
||||
dir.mkdirs();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
File targetFile = new File(destDirPath + "/" + entry.getName());
|
||||
|
||||
|
||||
|
||||
if (!targetFile.getParentFile().exists()) {
|
||||
targetFile.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
|
||||
targetFile.createNewFile();
|
||||
|
||||
|
||||
|
||||
InputStream is = zipFile.getInputStream(entry);
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(targetFile);
|
||||
|
||||
|
||||
|
||||
byte[] buf = new byte[4096];
|
||||
int len;
|
||||
while ((len = is.read(buf)) != -1) {
|
||||
fos.write(buf, 0, len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fos.close();
|
||||
|
||||
is.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
System.out.println("解压完成,耗时:" + (end - start) + " ms");
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException("unzip error from ZipUtils", e);
|
||||
} finally {
|
||||
|
||||
if (zipFile != null)
|
||||
try {
|
||||
zipFile.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\archiveUtil\ZipUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,55 @@
|
||||
package com.archive.common.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class CommonMap
|
||||
{
|
||||
public static Map<String, String> javaTypeMap = new HashMap<>();
|
||||
|
||||
|
||||
static {
|
||||
initJavaTypeMap();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void initJavaTypeMap() {
|
||||
javaTypeMap.put("tinyint", "Integer");
|
||||
javaTypeMap.put("smallint", "Integer");
|
||||
javaTypeMap.put("mediumint", "Integer");
|
||||
javaTypeMap.put("int", "Integer");
|
||||
javaTypeMap.put("number", "Integer");
|
||||
javaTypeMap.put("integer", "integer");
|
||||
javaTypeMap.put("bigint", "Long");
|
||||
javaTypeMap.put("float", "Float");
|
||||
javaTypeMap.put("double", "Double");
|
||||
javaTypeMap.put("decimal", "BigDecimal");
|
||||
javaTypeMap.put("bit", "Boolean");
|
||||
javaTypeMap.put("char", "String");
|
||||
javaTypeMap.put("varchar", "String");
|
||||
javaTypeMap.put("varchar2", "String");
|
||||
javaTypeMap.put("tinytext", "String");
|
||||
javaTypeMap.put("text", "String");
|
||||
javaTypeMap.put("mediumtext", "String");
|
||||
javaTypeMap.put("longtext", "String");
|
||||
javaTypeMap.put("time", "Date");
|
||||
javaTypeMap.put("date", "Date");
|
||||
javaTypeMap.put("datetime", "Date");
|
||||
javaTypeMap.put("timestamp", "Date");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\constant\CommonMap.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,49 @@
|
||||
package com.archive.common.constant;
|
||||
|
||||
public class Constants {
|
||||
public static final String UTF8 = "UTF-8";
|
||||
|
||||
public static final String GBK = "GBK";
|
||||
|
||||
public static final String SUCCESS = "0";
|
||||
|
||||
public static final String FAIL = "1";
|
||||
|
||||
public static final String LOGIN_SUCCESS = "Success";
|
||||
|
||||
public static final String LOGOUT = "Logout";
|
||||
|
||||
public static final String REGISTER = "Register";
|
||||
|
||||
public static final String LOGIN_FAIL = "Error";
|
||||
|
||||
public static final String PAGE_NUM = "pageNum";
|
||||
|
||||
public static final String PAGE_SIZE = "pageSize";
|
||||
|
||||
public static final String ORDER_BY_COLUMN = "orderByColumn";
|
||||
|
||||
public static final String IS_ASC = "isAsc";
|
||||
|
||||
public static final String SYS_AUTH_CACHE = "sys-authCache";
|
||||
|
||||
public static final String SYS_CONFIG_CACHE = "sys-config";
|
||||
|
||||
public static final String SYS_CONFIG_KEY = "sys_config:";
|
||||
|
||||
public static final String SYS_DICT_CACHE = "sys-dict";
|
||||
|
||||
public static final String SYS_DICT_KEY = "sys_dict:";
|
||||
|
||||
public static final String RESOURCE_PREFIX = "/profile";
|
||||
|
||||
public static final String DATABASE_TYPE_MYSQL = "mysql";
|
||||
|
||||
public static final String DATABASE_TYPE_SQLITE = "sqlite";
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\constant\Constants.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,85 @@
|
||||
/* */ package com.archive.common.constant;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class GenConstants
|
||||
/* */ {
|
||||
/* */ public static final String TPL_CRUD = "crud";
|
||||
/* */ public static final String TPL_TREE = "tree";
|
||||
/* */ public static final String TPL_SUB = "sub";
|
||||
/* */ public static final String TREE_CODE = "treeCode";
|
||||
/* */ public static final String TREE_PARENT_CODE = "treeParentCode";
|
||||
/* */ public static final String TREE_NAME = "treeName";
|
||||
/* */ public static final String PARENT_MENU_ID = "parentMenuId";
|
||||
/* */ public static final String PARENT_MENU_NAME = "parentMenuName";
|
||||
/* 35 */ public static final String[] COLUMNTYPE_STR = new String[] { "char", "varchar", "nvarchar", "varchar2" };
|
||||
/* */
|
||||
/* */
|
||||
/* 38 */ public static final String[] COLUMNTYPE_TEXT = new String[] { "tinytext", "text", "mediumtext", "longtext" };
|
||||
/* */
|
||||
/* */
|
||||
/* 41 */ public static final String[] COLUMNTYPE_TIME = new String[] { "datetime", "time", "date", "timestamp" };
|
||||
/* */
|
||||
/* */
|
||||
/* 44 */ public static final String[] COLUMNTYPE_NUMBER = new String[] { "tinyint", "smallint", "mediumint", "int", "number", "integer", "bit", "bigint", "float", "double", "decimal" };
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 48 */ public static final String[] COLUMNNAME_NOT_EDIT = new String[] { "id", "create_by", "create_time", "del_flag" };
|
||||
/* */
|
||||
/* */
|
||||
/* 51 */ public static final String[] COLUMNNAME_NOT_LIST = new String[] { "id", "create_by", "create_time", "del_flag", "update_by", "update_time" };
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 55 */ public static final String[] COLUMNNAME_NOT_QUERY = new String[] { "id", "create_by", "create_time", "del_flag", "update_by", "update_time", "remark" };
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 59 */ public static final String[] BASE_ENTITY = new String[] { "createBy", "createTime", "updateBy", "updateTime", "remark" };
|
||||
/* */
|
||||
/* */
|
||||
/* 62 */ public static final String[] TREE_ENTITY = new String[] { "parentName", "parentId", "orderNum", "ancestors" };
|
||||
/* */ public static final String HTML_INPUT = "input";
|
||||
/* */ public static final String HTML_TEXTAREA = "textarea";
|
||||
/* */ public static final String HTML_SELECT = "select";
|
||||
/* */ public static final String HTML_RADIO = "radio";
|
||||
/* */ public static final String HTML_CHECKBOX = "checkbox";
|
||||
/* */ public static final String HTML_DATETIME = "datetime";
|
||||
/* */ public static final String HTML_UPLOAD = "upload";
|
||||
/* */ public static final String HTML_SUMMERNOTE = "summernote";
|
||||
/* */ public static final String TYPE_STRING = "String";
|
||||
/* */ public static final String TYPE_INTEGER = "Integer";
|
||||
/* */ public static final String TYPE_LONG = "Long";
|
||||
/* */ public static final String TYPE_DOUBLE = "Double";
|
||||
/* */ public static final String TYPE_BIGDECIMAL = "BigDecimal";
|
||||
/* */ public static final String TYPE_DATE = "Date";
|
||||
/* */ public static final String QUERY_LIKE = "LIKE";
|
||||
/* */ public static final String REQUIRE = "1";
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\constant\GenConstants.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,21 @@
|
||||
package com.archive.common.constant;
|
||||
|
||||
public class PermissionConstants {
|
||||
public static final String ADD_PERMISSION = "add";
|
||||
|
||||
public static final String EDIT_PERMISSION = "edit";
|
||||
|
||||
public static final String REMOVE_PERMISSION = "remove";
|
||||
|
||||
public static final String EXPORT_PERMISSION = "export";
|
||||
|
||||
public static final String VIEW_PERMISSION = "view";
|
||||
|
||||
public static final String LIST_PERMISSION = "list";
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\constant\PermissionConstants.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,21 @@
|
||||
package com.archive.common.constant;
|
||||
|
||||
public class ScheduleConstants {
|
||||
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
|
||||
|
||||
public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
|
||||
|
||||
public static final String MISFIRE_DEFAULT = "0";
|
||||
|
||||
public static final String MISFIRE_IGNORE_MISFIRES = "1";
|
||||
|
||||
public static final String MISFIRE_FIRE_AND_PROCEED = "2";
|
||||
|
||||
public static final String MISFIRE_DO_NOTHING = "3";
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\constant\ScheduleConstants.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,37 @@
|
||||
package com.archive.common.constant;
|
||||
|
||||
public class ShiroConstants {
|
||||
public static final String CURRENT_USER = "currentUser";
|
||||
|
||||
public static final String CURRENT_USERNAME = "username";
|
||||
|
||||
public static final String LOCK_SCREEN = "lockscreen";
|
||||
|
||||
public static final String MESSAGE = "message";
|
||||
|
||||
public static final String ERROR = "errorMsg";
|
||||
|
||||
public static final String ENCODING = "UTF-8";
|
||||
|
||||
public static final String ONLINE_SESSION = "online_session";
|
||||
|
||||
public static final String CURRENT_CAPTCHA = "captcha";
|
||||
|
||||
public static final String CURRENT_ENABLED = "captchaEnabled";
|
||||
|
||||
public static final String CURRENT_TYPE = "captchaType";
|
||||
|
||||
public static final String CURRENT_VALIDATECODE = "validateCode";
|
||||
|
||||
public static final String CAPTCHA_ERROR = "captchaError";
|
||||
|
||||
public static final String LOGINRECORDCACHE = "loginRecordCache";
|
||||
|
||||
public static final String SYS_USERCACHE = "sys-userCache";
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\constant\ShiroConstants.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,55 @@
|
||||
package com.archive.common.constant;
|
||||
|
||||
import com.archive.common.constant.ScheduleConstants;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public enum Status
|
||||
{
|
||||
NORMAL("0"),
|
||||
|
||||
|
||||
|
||||
PAUSE("1");
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
Status(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\constant\ScheduleConstants$Status.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,85 @@
|
||||
package com.archive.common.constant;
|
||||
|
||||
public class UserConstants {
|
||||
public static final String NORMAL = "0";
|
||||
|
||||
public static final String EXCEPTION = "1";
|
||||
|
||||
public static final String USER_DISABLE = "1";
|
||||
|
||||
public static final String ROLE_DISABLE = "1";
|
||||
|
||||
public static final String DEPT_NORMAL = "0";
|
||||
|
||||
public static final String DEPT_DISABLE = "1";
|
||||
|
||||
public static final String DICT_NORMAL = "0";
|
||||
|
||||
public static final String YES = "Y";
|
||||
|
||||
public static final int USERNAME_MIN_LENGTH = 2;
|
||||
|
||||
public static final int USERNAME_MAX_LENGTH = 20;
|
||||
|
||||
public static final String USER_NAME_UNIQUE = "0";
|
||||
|
||||
public static final String USER_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
public static final String USER_PHONE_UNIQUE = "0";
|
||||
|
||||
public static final String USER_PHONE_NOT_UNIQUE = "1";
|
||||
|
||||
public static final String USER_EMAIL_UNIQUE = "0";
|
||||
|
||||
public static final String USER_EMAIL_NOT_UNIQUE = "1";
|
||||
|
||||
public static final String DEPT_NAME_UNIQUE = "0";
|
||||
|
||||
public static final String DEPT_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
public static final String ROLE_NAME_UNIQUE = "0";
|
||||
|
||||
public static final String ROLE_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
public static final String POST_NAME_UNIQUE = "0";
|
||||
|
||||
public static final String POST_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
public static final String ROLE_KEY_UNIQUE = "0";
|
||||
|
||||
public static final String ROLE_KEY_NOT_UNIQUE = "1";
|
||||
|
||||
public static final String POST_CODE_UNIQUE = "0";
|
||||
|
||||
public static final String POST_CODE_NOT_UNIQUE = "1";
|
||||
|
||||
public static final String MENU_NAME_UNIQUE = "0";
|
||||
|
||||
public static final String MENU_NAME_NOT_UNIQUE = "1";
|
||||
|
||||
public static final String DICT_TYPE_UNIQUE = "0";
|
||||
|
||||
public static final String DICT_TYPE_NOT_UNIQUE = "1";
|
||||
|
||||
public static final String CONFIG_KEY_UNIQUE = "0";
|
||||
|
||||
public static final String CONFIG_KEY_NOT_UNIQUE = "1";
|
||||
|
||||
public static final int PASSWORD_MIN_LENGTH = 5;
|
||||
|
||||
public static final int PASSWORD_MAX_LENGTH = 20;
|
||||
|
||||
public static final String SYSTEM_USER_TYPE = "00";
|
||||
|
||||
public static final String REGISTER_USER_TYPE = "01";
|
||||
|
||||
public static final String MOBILE_PHONE_NUMBER_PATTERN = "^0{0,1}(13[0-9]|15[0-9]|14[0-9]|18[0-9])[0-9]{8}$";
|
||||
|
||||
public static final String EMAIL_PATTERN = "^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?";
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\constant\UserConstants.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,149 @@
|
||||
/* */ package com.archive.common.convert;
|
||||
/* */
|
||||
/* */ import com.aspose.cells.IndividualFontConfigs;
|
||||
/* */ import com.aspose.cells.License;
|
||||
/* */ import com.aspose.cells.LoadOptions;
|
||||
/* */ import com.aspose.cells.PdfSaveOptions;
|
||||
/* */ import com.aspose.cells.SaveOptions;
|
||||
/* */ import com.aspose.cells.Workbook;
|
||||
/* */ import java.io.ByteArrayInputStream;
|
||||
/* */ import java.io.FileOutputStream;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class ExcelToPdf
|
||||
/* */ {
|
||||
/* */ public static void main(String[] args) {
|
||||
/* 20 */ excel2pdf("D:\\temp\\1.xls", "D:\\temp\\31.pdf");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean getLicense() {
|
||||
/* 27 */ boolean result = false;
|
||||
/* */ try {
|
||||
/* 29 */ String license = "<License>\r\n <Data>\r\n <Products>\r\n <Product>Aspose.Total for Java</Product>\r\n <Product>Aspose.Words for Java</Product>\r\n </Products>\r\n <EditionType>Enterprise</EditionType>\r\n <SubscriptionExpiry>20991231</SubscriptionExpiry>\r\n <LicenseExpiry>20991231</LicenseExpiry>\r\n <SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>\r\n </Data>\r\n <Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>\r\n</License>";
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 43 */ InputStream is = new ByteArrayInputStream(license.getBytes("UTF-8"));
|
||||
/* 44 */ License aposeLic = new License();
|
||||
/* 45 */ aposeLic.setLicense(is);
|
||||
/* 46 */ result = true;
|
||||
/* 47 */ } catch (Exception e) {
|
||||
/* 48 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* 50 */ return result;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void excel2pdf(String sourceFilePath, String desFilePathd) {
|
||||
/* 60 */ if (!getLicense()) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* */ try {
|
||||
/* 64 */ if (isLinux()) {
|
||||
/* 65 */ IndividualFontConfigs configs = new IndividualFontConfigs();
|
||||
/* 66 */ configs.setFontFolder("/usr/share/fonts/chinese", true);
|
||||
/* 67 */ LoadOptions loadOptions = new LoadOptions();
|
||||
/* 68 */ loadOptions.setFontConfigs(configs);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 73 */ Workbook wb = new Workbook(sourceFilePath);
|
||||
/* */
|
||||
/* 75 */ FileOutputStream fileOS = new FileOutputStream(desFilePathd);
|
||||
/* 76 */ PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
|
||||
/* 77 */ pdfSaveOptions.setOnePagePerSheet(true);
|
||||
/* 78 */ int[] autoDrawSheets = { 3 };
|
||||
/* */
|
||||
/* 80 */ autoDraw(wb, autoDrawSheets);
|
||||
/* 81 */ int[] showSheets = { 0 };
|
||||
/* */
|
||||
/* 83 */ printSheetPage(wb, showSheets);
|
||||
/* 84 */ wb.save(fileOS, (SaveOptions)pdfSaveOptions);
|
||||
/* 85 */ fileOS.flush();
|
||||
/* 86 */ fileOS.close();
|
||||
/* */ }
|
||||
/* 88 */ catch (Exception e) {
|
||||
/* 89 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void autoDraw(Workbook wb, int[] page) {
|
||||
/* 99 */ if (null != page && page.length > 0) {
|
||||
/* 100 */ for (int i = 0; i < page.length; i++) {
|
||||
/* 101 */ wb.getWorksheets().get(i).getHorizontalPageBreaks().clear();
|
||||
/* 102 */ wb.getWorksheets().get(i).getVerticalPageBreaks().clear();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void printSheetPage(Workbook wb, int[] page) {
|
||||
/* */ int i;
|
||||
/* 114 */ for (i = 1; i < wb.getWorksheets().getCount(); i++) {
|
||||
/* 115 */ wb.getWorksheets().get(i).setVisible(false);
|
||||
/* */ }
|
||||
/* 117 */ if (null == page || page.length == 0) {
|
||||
/* 118 */ wb.getWorksheets().get(0).setVisible(true);
|
||||
/* */ } else {
|
||||
/* 120 */ for (i = 0; i < page.length; i++) {
|
||||
/* 121 */ wb.getWorksheets().get(i).setVisible(true);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isLinux() {
|
||||
/* 128 */ return System.getProperty("os.name").toLowerCase().contains("linux");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static boolean isWindows() {
|
||||
/* 132 */ return System.getProperty("os.name").toLowerCase().contains("windows");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public String JudgeSystem() {
|
||||
/* 136 */ if (isLinux())
|
||||
/* 137 */ return "linux";
|
||||
/* 138 */ if (isWindows()) {
|
||||
/* 139 */ return "windows";
|
||||
/* */ }
|
||||
/* 141 */ return "other system";
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\convert\ExcelToPdf.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,56 @@
|
||||
/* */ package com.archive.common.convert;
|
||||
|
||||
/* */
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.io.FileOutputStream;
|
||||
/* */ import java.io.OutputStream;
|
||||
/* */ import org.xhtmlrenderer.pdf.ITextFontResolver;
|
||||
/* */ import org.xhtmlrenderer.pdf.ITextRenderer;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class HtmlToPdf
|
||||
/* */ {
|
||||
/* */ public static void html2pdf(String htmlFile, String pdfFile) throws Exception {
|
||||
/* 21 */ String url = (new File(htmlFile)).toURI().toURL().toString();
|
||||
/* 22 */ System.out.println(url);
|
||||
/* */
|
||||
/* 24 */ OutputStream os = new FileOutputStream(pdfFile);
|
||||
/* 25 */ ITextRenderer renderer = new ITextRenderer();
|
||||
/* 26 */ renderer.setDocument(url);
|
||||
/* */
|
||||
/* */
|
||||
/* 29 */ ITextFontResolver fontResolver = renderer.getFontResolver();
|
||||
/* 30 */ if ("linux".equals(getCurrentOperatingSystem())) {
|
||||
/* 31 */ fontResolver.addFont("/usr/share/fonts/chiness/simsun.ttc", "Identity-H", true);
|
||||
/* */ } else {
|
||||
/* 33 */ fontResolver.addFont("c:/Windows/Fonts/simsun.ttc", "Identity-H", false);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 36 */ renderer.layout();
|
||||
/* 37 */ renderer.createPDF(os);
|
||||
/* 38 */ os.close();
|
||||
/* */
|
||||
/* 40 */ System.out.println("create pdf done!!");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getCurrentOperatingSystem() {
|
||||
/* 45 */ String os = System.getProperty("os.name").toLowerCase();
|
||||
/* 46 */ System.out.println("---------当前操作系统是-----------" + os);
|
||||
/* 47 */ return os;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\convert\HtmlToPdf.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,396 @@
|
||||
/* */ package com.archive.common.convert;
|
||||
|
||||
|
||||
/* */
|
||||
/* */ import com.lowagie.text.Document;
|
||||
/* */ import com.lowagie.text.Element;
|
||||
/* */ import com.lowagie.text.Image;
|
||||
/* */ import com.lowagie.text.Rectangle;
|
||||
/* */ import com.lowagie.text.pdf.PdfWriter;
|
||||
/* */ import java.awt.AlphaComposite;
|
||||
/* */ import java.awt.Color;
|
||||
/* */ import java.awt.Font;
|
||||
/* */ import java.awt.Graphics;
|
||||
/* */ import java.awt.Graphics2D;
|
||||
/* */ import java.awt.Image;
|
||||
/* */ import java.awt.RenderingHints;
|
||||
/* */ import java.awt.image.BufferedImage;
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.io.FileOutputStream;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.text.DecimalFormat;
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.Arrays;
|
||||
/* */ import javax.imageio.ImageIO;
|
||||
/* */ import javax.swing.ImageIcon;
|
||||
/* */
|
||||
/* */ public class ImgConvert
|
||||
/* */ {
|
||||
/* */ public static void ImagesToPdf(String imageFolderPath, String pdfPath) {
|
||||
/* */ try {
|
||||
/* 29 */ long start = System.currentTimeMillis();
|
||||
/* 30 */ ArrayList<String> list = new ArrayList<>();
|
||||
/* */
|
||||
/* 32 */ String imagePath = null;
|
||||
/* 33 */ FileOutputStream fos = new FileOutputStream(pdfPath);
|
||||
/* */
|
||||
/* 35 */ Document doc = new Document(null, 20.0F, 20.0F, 20.0F, 20.0F);
|
||||
/* */
|
||||
/* 37 */ PdfWriter.getInstance(doc, fos);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 43 */ File file = new File(imageFolderPath);
|
||||
/* 44 */ File[] files = file.listFiles();
|
||||
/* */
|
||||
/* 46 */ for (File file1 : files) {
|
||||
/* 47 */ if (file1.getName().endsWith(".png") || file1.getName().endsWith(".jpg") || file1.getName().endsWith(".gif") || file1
|
||||
/* 48 */ .getName().endsWith(".jpeg") || file1.getName().endsWith(".tif")) {
|
||||
/* 49 */ imagePath = imageFolderPath + File.separator + file1.getName();
|
||||
/* 50 */ list.add(file1.getName());
|
||||
/* */
|
||||
/* 52 */ BufferedImage img = ImageIO.read(new File(imagePath));
|
||||
/* */
|
||||
/* 54 */ doc.setPageSize(new Rectangle(img.getWidth(), img.getHeight()));
|
||||
/* */
|
||||
/* 56 */ Image image = Image.getInstance(imagePath);
|
||||
/* */
|
||||
/* 58 */ doc.open();
|
||||
/* 59 */ doc.add((Element)image);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 64 */ doc.close();
|
||||
/* 65 */ long endTime = System.currentTimeMillis();
|
||||
/* 66 */ int time = (int)((endTime - start) / 1000L);
|
||||
/* 67 */ System.out.println("用时:{" + time + "}:秒!");
|
||||
/* 68 */ } catch (Exception e) {
|
||||
/* 69 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void ImgToPdf(String imagePath, String pdfPath) {
|
||||
/* */ try {
|
||||
/* 81 */ long start = System.currentTimeMillis();
|
||||
/* 82 */ ArrayList<String> list = new ArrayList<>();
|
||||
/* */
|
||||
/* */
|
||||
/* 85 */ FileOutputStream fos = new FileOutputStream(pdfPath);
|
||||
/* */
|
||||
/* 87 */ Document doc = new Document(null, 20.0F, 20.0F, 20.0F, 20.0F);
|
||||
/* */
|
||||
/* 89 */ PdfWriter.getInstance(doc, fos);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 95 */ BufferedImage img = ImageIO.read(new File(imagePath));
|
||||
/* */
|
||||
/* 97 */ doc.setPageSize(new Rectangle(img.getWidth(), img.getHeight()));
|
||||
/* */
|
||||
/* 99 */ Image image = Image.getInstance(imagePath);
|
||||
/* */
|
||||
/* 101 */ doc.open();
|
||||
/* 102 */ doc.add((Element)image);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 106 */ doc.close();
|
||||
/* 107 */ long endTime = System.currentTimeMillis();
|
||||
/* 108 */ int time = (int)((endTime - start) / 1000L);
|
||||
/* 109 */ System.out.println("用时:{" + time + "}:秒!");
|
||||
/* 110 */ } catch (Exception e) {
|
||||
/* 111 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void PngToJpg(String pngPath, String jpgPath) {
|
||||
/* */ try {
|
||||
/* 125 */ BufferedImage bufferedImage = ImageIO.read(new File(pngPath));
|
||||
/* 126 */ BufferedImage newBufferedImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), 1);
|
||||
/* 127 */ newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.white, null);
|
||||
/* 128 */ ImageIO.write(newBufferedImage, "jpg", new File(jpgPath));
|
||||
/* 129 */ } catch (Exception e) {
|
||||
/* 130 */ System.out.println("ERROR:png转jpg出现异常:" + e.getMessage());
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void JpgToPng(String jpgPath, String pngPath) {
|
||||
/* */ try {
|
||||
/* 144 */ BufferedImage bufferedImage = ImageIO.read(new File(jpgPath));
|
||||
/* 145 */ BufferedImage newBufferedImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), 1);
|
||||
/* 146 */ newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.white, null);
|
||||
/* 147 */ ImageIO.write(newBufferedImage, "png", new File(pngPath));
|
||||
/* 148 */ } catch (Exception e) {
|
||||
/* 149 */ System.out.println("ERROR:jpg转png出现异常:" + e.getMessage());
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static BufferedImage waterMarkByText(int width, int heigth, String text, Color color, Font font, Double degree, float alpha) {
|
||||
/* 167 */ BufferedImage buffImg = new BufferedImage(width, heigth, 1);
|
||||
/* */
|
||||
/* 169 */ Graphics2D g2d = buffImg.createGraphics();
|
||||
/* */
|
||||
/* */
|
||||
/* 172 */ buffImg = g2d.getDeviceConfiguration().createCompatibleImage(width, heigth, 3);
|
||||
/* 173 */ g2d.dispose();
|
||||
/* 174 */ g2d = buffImg.createGraphics();
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 178 */ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 186 */ if (null != degree)
|
||||
/* */ {
|
||||
/* */
|
||||
/* 189 */ g2d.rotate(Math.toRadians(degree.doubleValue()), buffImg.getWidth() / 2.0D, buffImg
|
||||
/* 190 */ .getHeight() / 2.0D);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 194 */ g2d.setColor(color);
|
||||
/* */
|
||||
/* */
|
||||
/* 197 */ g2d.setFont(font);
|
||||
/* */
|
||||
/* */
|
||||
/* 200 */ g2d.setComposite(AlphaComposite.getInstance(3, alpha));
|
||||
/* */
|
||||
/* 202 */ float realWidth = getRealFontWidth(text);
|
||||
/* 203 */ float fontSize = font.getSize();
|
||||
/* */
|
||||
/* */
|
||||
/* 206 */ float x = 0.5F * width - 0.5F * fontSize * realWidth;
|
||||
/* 207 */ float y = 0.5F * heigth + 0.5F * fontSize;
|
||||
/* */
|
||||
/* 209 */ g2d.drawString(text, x, y);
|
||||
/* */
|
||||
/* 211 */ g2d.dispose();
|
||||
/* */
|
||||
/* 213 */ return buffImg;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static BufferedImage waterMarkByText(int width, int heigth, String text, Color color, float alpha) {
|
||||
/* 219 */ Font font = new Font("Dialog", 0, 33);
|
||||
/* 220 */ return waterMarkByText(width, heigth, text, color, font, Double.valueOf(-30.0D), alpha);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static BufferedImage waterMarkByText(int width, int heigth, String text, float alpha) {
|
||||
/* 224 */ return waterMarkByText(width, heigth, text, Color.GRAY, alpha);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static BufferedImage waterMarkByText(int width, int heigth, String text) {
|
||||
/* 229 */ return waterMarkByText(width, heigth, text, 0.2F);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static BufferedImage waterMarkByText(String text) {
|
||||
/* 233 */ return waterMarkByText(200, 150, text);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static float getRealFontWidth(String text) {
|
||||
/* 240 */ int len = text.length();
|
||||
/* 241 */ float width = 0.0F;
|
||||
/* 242 */ for (int i = 0; i < len; i++) {
|
||||
/* 243 */ if (text.charAt(i) < 'Ā') {
|
||||
/* 244 */ width += 0.5F;
|
||||
/* */ } else {
|
||||
/* 246 */ width++;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 249 */ return width;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void changeImgColor(String path, String newPath) throws IOException {
|
||||
/* 263 */ File file = new File(path);
|
||||
/* 264 */ BufferedImage bi = ImageIO.read(file);
|
||||
/* 265 */ Image image = bi;
|
||||
/* */
|
||||
/* 267 */ ImageIcon imageIcon = new ImageIcon(image);
|
||||
/* 268 */ int width = imageIcon.getIconWidth();
|
||||
/* 269 */ int height = imageIcon.getIconHeight();
|
||||
/* */
|
||||
/* 271 */ BufferedImage bufferedImage = new BufferedImage(width, height, 6);
|
||||
/* 272 */ Graphics2D graphics2D = (Graphics2D)bufferedImage.getGraphics();
|
||||
/* 273 */ graphics2D.drawImage(imageIcon.getImage(), 0, 0, imageIcon.getImageObserver());
|
||||
/* 274 */ int alpha = 255;
|
||||
/* */
|
||||
/* 276 */ int RGB = bufferedImage.getRGB(width - 1, height - 1);
|
||||
/* 277 */ for (int i = bufferedImage.getMinX(); i < width; i++) {
|
||||
/* 278 */ for (int j = bufferedImage.getMinY(); j < height; j++) {
|
||||
/* 279 */ int rgb = bufferedImage.getRGB(i, j);
|
||||
/* 280 */ int r = (rgb & 0xFF0000) >> 16;
|
||||
/* 281 */ int g = (rgb & 0xFF00) >> 8;
|
||||
/* 282 */ int b = rgb & 0xFF;
|
||||
/* 283 */ int R = (RGB & 0xFF0000) >> 16;
|
||||
/* 284 */ int G = (RGB & 0xFF00) >> 8;
|
||||
/* 285 */ int B = RGB & 0xFF;
|
||||
/* */
|
||||
/* 287 */ int a = 45;
|
||||
/* 288 */ if (Math.abs(R - r) < a && Math.abs(G - g) < a && Math.abs(B - b) < a) {
|
||||
/* 289 */ alpha = 0;
|
||||
/* */ } else {
|
||||
/* 291 */ alpha = 255;
|
||||
/* */ }
|
||||
/* 293 */ rgb = alpha << 24 | rgb & 0xFFFFFF;
|
||||
/* 294 */ bufferedImage.setRGB(i, j, rgb);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 297 */ ImageIO.write(bufferedImage, "png", new File(newPath));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static String convertRgbStr(int color) {
|
||||
/* 301 */ int red = (color & 0xFF0000) >> 16;
|
||||
/* 302 */ int green = (color & 0xFF00) >> 8;
|
||||
/* 303 */ int blue = color & 0xFF;
|
||||
/* 304 */ return red + "," + green + "," + blue;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String thumbnailImage(String imagePath, int w, int h, String prevfix, boolean force) {
|
||||
/* 317 */ File imgFile = new File(imagePath);
|
||||
/* 318 */ String newPath = "";
|
||||
/* 319 */ if (imgFile.exists()) {
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 322 */ String types = Arrays.toString((Object[])ImageIO.getReaderFormatNames());
|
||||
/* 323 */ String suffix = null;
|
||||
/* */
|
||||
/* 325 */ if (imgFile.getName().indexOf(".") > -1) {
|
||||
/* 326 */ suffix = imgFile.getName().substring(imgFile.getName().lastIndexOf(".") + 1);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 329 */ if (suffix == null || types.toLowerCase().indexOf(suffix.toLowerCase()) < 0) {
|
||||
/* 330 */ System.out.println("Sorry, the image suffix is illegal. the standard image suffix is {}." + types);
|
||||
/* 331 */ return newPath;
|
||||
/* */ }
|
||||
/* 333 */ System.out.println("target image's size, width:{" + w + "}, height:{" + h + "}.");
|
||||
/* 334 */ Image img = ImageIO.read(imgFile);
|
||||
/* 335 */ if (!force) {
|
||||
/* */
|
||||
/* 337 */ int width = img.getWidth(null);
|
||||
/* 338 */ int height = img.getHeight(null);
|
||||
/* 339 */ if (width * 1.0D / w < height * 1.0D / h) {
|
||||
/* 340 */ if (width > w) {
|
||||
/* 341 */ h = Integer.parseInt((new DecimalFormat("0")).format((height * w) / width * 1.0D));
|
||||
/* 342 */ System.out.println("change image's height, width:{" + w + "}, height:{" + h + "}.");
|
||||
/* */ }
|
||||
/* */
|
||||
/* 345 */ } else if (height > h) {
|
||||
/* 346 */ w = Integer.parseInt((new DecimalFormat("0")).format((width * h) / height * 1.0D));
|
||||
/* 347 */ System.out.println("change image's width, width:{" + w + "}, height:{" + h + "}.");
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* 351 */ BufferedImage bi = new BufferedImage(w, h, 1);
|
||||
/* 352 */ Graphics g = bi.getGraphics();
|
||||
/* 353 */ g.drawImage(img, 0, 0, w, h, Color.LIGHT_GRAY, null);
|
||||
/* 354 */ g.dispose();
|
||||
/* 355 */ String p = imgFile.getPath();
|
||||
/* */
|
||||
/* 357 */ newPath = p.substring(0, p.lastIndexOf(File.separator)) + File.separator + prevfix + imgFile.getName();
|
||||
/* 358 */ ImageIO.write(bi, suffix, new File(newPath));
|
||||
/* 359 */ System.out.println("缩略图在原路径下生成成功");
|
||||
/* 360 */ } catch (IOException e) {
|
||||
/* 361 */ System.out.println("generate thumbnail image failed." + e);
|
||||
/* */ }
|
||||
/* */ } else {
|
||||
/* 364 */ System.out.println("the image is not exist.");
|
||||
/* */ }
|
||||
/* 366 */ return newPath;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void main(String[] args) {
|
||||
/* */ try {
|
||||
/* 383 */ changeImgColor("F:\\FFOutput\\profile.png", "F:\\FFOutput\\profile1.png");
|
||||
/* 384 */ } catch (IOException e) {
|
||||
/* 385 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\convert\ImgConvert.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,36 @@
|
||||
/* */ package com.archive.common.exception;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class BusinessException
|
||||
/* */ extends RuntimeException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */ protected final String message;
|
||||
/* */
|
||||
/* */ public BusinessException(String message) {
|
||||
/* 16 */ this.message = message;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public BusinessException(String message, Throwable e) {
|
||||
/* 21 */ super(message, e);
|
||||
/* 22 */ this.message = message;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getMessage() {
|
||||
/* 28 */ return this.message;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\BusinessException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,11 @@
|
||||
package com.archive.common.exception;
|
||||
|
||||
public class DemoModeException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\DemoModeException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,32 @@
|
||||
/* */ package com.archive.common.exception;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class UtilException
|
||||
/* */ extends RuntimeException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 8247610319171014183L;
|
||||
/* */
|
||||
/* */ public UtilException(Throwable e) {
|
||||
/* 14 */ super(e.getMessage(), e);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public UtilException(String message) {
|
||||
/* 19 */ super(message);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public UtilException(String message, Throwable throwable) {
|
||||
/* 24 */ super(message, throwable);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\UtilException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,109 @@
|
||||
/* */ package com.archive.common.exception.base;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.MessageUtils;
|
||||
/* */ import org.springframework.util.StringUtils;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class BaseException
|
||||
/* */ extends RuntimeException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */ private String module;
|
||||
/* */ private String code;
|
||||
/* */ private Object[] args;
|
||||
/* */ private String defaultMessage;
|
||||
/* */
|
||||
/* */ public BaseException(String module, String code, Object[] args, String defaultMessage) {
|
||||
/* 37 */ this.module = module;
|
||||
/* 38 */ this.code = code;
|
||||
/* 39 */ this.args = args;
|
||||
/* 40 */ this.defaultMessage = defaultMessage;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public BaseException(String module, String code, Object[] args) {
|
||||
/* 45 */ this(module, code, args, null);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public BaseException(String module, String defaultMessage) {
|
||||
/* 50 */ this(module, null, null, defaultMessage);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public BaseException(String code, Object[] args) {
|
||||
/* 55 */ this(null, code, args, null);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public BaseException(String defaultMessage) {
|
||||
/* 60 */ this(null, null, null, defaultMessage);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getMessage() {
|
||||
/* 66 */ String message = null;
|
||||
/* 67 */ if (!StringUtils.isEmpty(this.code))
|
||||
/* */ {
|
||||
/* 69 */ message = MessageUtils.message(this.code, this.args);
|
||||
/* */ }
|
||||
/* 71 */ if (message == null)
|
||||
/* */ {
|
||||
/* 73 */ message = this.defaultMessage;
|
||||
/* */ }
|
||||
/* 75 */ return message;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getModule() {
|
||||
/* 80 */ return this.module;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getCode() {
|
||||
/* 85 */ return this.code;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Object[] getArgs() {
|
||||
/* 90 */ return this.args;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getDefaultMessage() {
|
||||
/* 95 */ return this.defaultMessage;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String toString() {
|
||||
/* 101 */ return getClass() + "{module='" + this.module + '\'' + ", message='" + getMessage() + '\'' + '}';
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\base\BaseException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,24 @@
|
||||
/* */ package com.archive.common.exception.file;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.base.BaseException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class FileException
|
||||
/* */ extends BaseException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public FileException(String code, Object[] args) {
|
||||
/* 16 */ super("file", code, args, null);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\FileException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,22 @@
|
||||
/* */ package com.archive.common.exception.file;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.file.FileException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class FileNameLengthLimitExceededException
|
||||
/* */ extends FileException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public FileNameLengthLimitExceededException(int defaultFileNameLength) {
|
||||
/* 14 */ super("upload.filename.exceed.length", new Object[] { Integer.valueOf(defaultFileNameLength) });
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\FileNameLengthLimitExceededException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,22 @@
|
||||
/* */ package com.archive.common.exception.file;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.file.FileException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class FileSizeLimitExceededException
|
||||
/* */ extends FileException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public FileSizeLimitExceededException(long defaultMaxSize) {
|
||||
/* 14 */ super("upload.exceed.maxSize", new Object[] { Long.valueOf(defaultMaxSize) });
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\FileSizeLimitExceededException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,66 @@
|
||||
/* */ package com.archive.common.exception.file;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.file.InvalidExtensionException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class InvalidFlashExtensionException
|
||||
/* */ extends InvalidExtensionException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) {
|
||||
/* 58 */ super(allowedExtension, extension, filename);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\InvalidExtensionException$InvalidFlashExtensionException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,56 @@
|
||||
/* */ package com.archive.common.exception.file;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.file.InvalidExtensionException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class InvalidImageExtensionException
|
||||
/* */ extends InvalidExtensionException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) {
|
||||
/* 48 */ super(allowedExtension, extension, filename);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\InvalidExtensionException$InvalidImageExtensionException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,76 @@
|
||||
/* */ package com.archive.common.exception.file;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.file.InvalidExtensionException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class InvalidMediaExtensionException
|
||||
/* */ extends InvalidExtensionException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) {
|
||||
/* 68 */ super(allowedExtension, extension, filename);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\InvalidExtensionException$InvalidMediaExtensionException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,86 @@
|
||||
/* */ package com.archive.common.exception.file;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.file.InvalidExtensionException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class InvalidVideoExtensionException
|
||||
/* */ extends InvalidExtensionException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) {
|
||||
/* 78 */ super(allowedExtension, extension, filename);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\InvalidExtensionException$InvalidVideoExtensionException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,47 @@
|
||||
/* */ package com.archive.common.exception.file;
|
||||
/* */
|
||||
/* */ import java.util.Arrays;
|
||||
/* */ import org.apache.commons.fileupload.FileUploadException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class InvalidExtensionException
|
||||
/* */ extends FileUploadException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */ private String[] allowedExtension;
|
||||
/* */ private String extension;
|
||||
/* */ private String filename;
|
||||
/* */
|
||||
/* */ public InvalidExtensionException(String[] allowedExtension, String extension, String filename) {
|
||||
/* 21 */ super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString((Object[])allowedExtension) + "]");
|
||||
/* 22 */ this.allowedExtension = allowedExtension;
|
||||
/* 23 */ this.extension = extension;
|
||||
/* 24 */ this.filename = filename;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String[] getAllowedExtension() {
|
||||
/* 29 */ return this.allowedExtension;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getExtension() {
|
||||
/* 34 */ return this.extension;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getFilename() {
|
||||
/* 39 */ return this.filename;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\InvalidExtensionException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,39 @@
|
||||
/* */ package com.archive.common.exception.job;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.job.TaskException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public enum Code
|
||||
/* */ {
|
||||
/* 32 */ TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE;
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\job\TaskException$Code.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,35 @@
|
||||
/* */ package com.archive.common.exception.job;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class TaskException
|
||||
/* */ extends Exception
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */ private Code code;
|
||||
/* */
|
||||
/* */ public TaskException(String msg, Code code) {
|
||||
/* 16 */ this(msg, code, null);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public TaskException(String msg, Code code, Exception nestedEx) {
|
||||
/* 21 */ super(msg, nestedEx);
|
||||
/* 22 */ this.code = code;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Code getCode() {
|
||||
/* 27 */ return this.code;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\job\TaskException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,22 @@
|
||||
/* */ package com.archive.common.exception.user;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.user.UserException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class CaptchaException
|
||||
/* */ extends UserException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public CaptchaException() {
|
||||
/* 14 */ super("user.jcaptcha.error", null);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\CaptchaException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,22 @@
|
||||
/* */ package com.archive.common.exception.user;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.user.UserException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class RoleBlockedException
|
||||
/* */ extends UserException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public RoleBlockedException() {
|
||||
/* 14 */ super("role.blocked", null);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\RoleBlockedException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,22 @@
|
||||
/* */ package com.archive.common.exception.user;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.user.UserException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class UserBlockedException
|
||||
/* */ extends UserException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public UserBlockedException() {
|
||||
/* 14 */ super("user.blocked", null);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserBlockedException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,22 @@
|
||||
/* */ package com.archive.common.exception.user;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.user.UserException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class UserDeleteException
|
||||
/* */ extends UserException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public UserDeleteException() {
|
||||
/* 14 */ super("user.password.delete", null);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserDeleteException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,24 @@
|
||||
/* */ package com.archive.common.exception.user;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.base.BaseException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class UserException
|
||||
/* */ extends BaseException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public UserException(String code, Object[] args) {
|
||||
/* 16 */ super("user", code, args, null);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,22 @@
|
||||
/* */ package com.archive.common.exception.user;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.user.UserException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class UserNotExistsException
|
||||
/* */ extends UserException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public UserNotExistsException() {
|
||||
/* 14 */ super("user.not.exists", null);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserNotExistsException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,22 @@
|
||||
/* */ package com.archive.common.exception.user;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.user.UserException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class UserPasswordNotMatchException
|
||||
/* */ extends UserException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public UserPasswordNotMatchException() {
|
||||
/* 14 */ super("user.password.not.match", null);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserPasswordNotMatchException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,22 @@
|
||||
/* */ package com.archive.common.exception.user;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.user.UserException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class UserPasswordRetryLimitCountException
|
||||
/* */ extends UserException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public UserPasswordRetryLimitCountException(int retryLimitCount) {
|
||||
/* 14 */ super("user.password.retry.limit.count", new Object[] { Integer.valueOf(retryLimitCount) });
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserPasswordRetryLimitCountException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,22 @@
|
||||
/* */ package com.archive.common.exception.user;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.user.UserException;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class UserPasswordRetryLimitExceedException
|
||||
/* */ extends UserException
|
||||
/* */ {
|
||||
/* */ private static final long serialVersionUID = 1L;
|
||||
/* */
|
||||
/* */ public UserPasswordRetryLimitExceedException(int retryLimitCount) {
|
||||
/* 14 */ super("user.password.retry.limit.exceed", new Object[] { Integer.valueOf(retryLimitCount) });
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserPasswordRetryLimitExceedException.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,61 @@
|
||||
/* */ package com.archive.common.ocr;
|
||||
/* */
|
||||
/* */ import com.archive.common.convert.ImgConvert;
|
||||
/* */ import java.io.File;
|
||||
/* */ import net.sourceforge.tess4j.Tesseract;
|
||||
/* */ import net.sourceforge.tess4j.util.LoadLibs;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class ImageOcr
|
||||
/* */ {
|
||||
/* */ public static String ImageOcr(String imagPath) {
|
||||
/* 18 */ String res = "";
|
||||
/* */ try {
|
||||
/* 20 */ String pngPath = "";
|
||||
/* */
|
||||
/* 22 */ if (imagPath.contains(".jpg") || imagPath.contains(".jpeg")) {
|
||||
/* 23 */ File fil = new File(imagPath);
|
||||
/* */
|
||||
/* 25 */ pngPath = fil.getParentFile().getPath() + File.separator + fil.getName().replace(".jpg", ".png").replace(".jpeg", ".png");
|
||||
/* 26 */ ImgConvert.JpgToPng(imagPath, pngPath);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 30 */ Tesseract tesseract = new Tesseract();
|
||||
/* */
|
||||
/* 32 */ File tessDataFolder = LoadLibs.extractTessResources("tessdata");
|
||||
/* 33 */ tesseract.setDatapath(tessDataFolder.getAbsolutePath());
|
||||
/* */
|
||||
/* 35 */ tesseract.setLanguage("chi_sim");
|
||||
/* */
|
||||
/* 37 */ String result = "";
|
||||
/* 38 */ if (pngPath.equals("")) {
|
||||
/* 39 */ result = tesseract.doOCR(new File(imagPath));
|
||||
/* */ } else {
|
||||
/* 41 */ result = tesseract.doOCR(new File(pngPath));
|
||||
/* */ }
|
||||
/* */
|
||||
/* 44 */ res = result.replaceAll("\\r|\\n", "-").replaceAll(" ", "");
|
||||
/* 45 */ } catch (Exception ex) {
|
||||
/* 46 */ System.out.println("图片OCR出现异常:" + ex.getMessage());
|
||||
/* */
|
||||
/* */
|
||||
/* 49 */ if (ex.getMessage().equals("javax.imageio.IIOException: JFIF APP0 must be first marker after SOI"));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 53 */ return res;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\ocr\ImageOcr.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,96 @@
|
||||
/* */ package com.archive.common.ocr;
|
||||
/* */
|
||||
/* */ import java.awt.image.BufferedImage;
|
||||
/* */ import java.io.File;
|
||||
/* */ import javax.imageio.ImageIO;
|
||||
/* */ import net.sourceforge.tess4j.Tesseract;
|
||||
/* */ import net.sourceforge.tess4j.util.LoadLibs;
|
||||
/* */ import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
/* */ import org.apache.pdfbox.rendering.PDFRenderer;
|
||||
/* */ import org.apache.pdfbox.text.PDFTextStripper;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class PdfOcr
|
||||
/* */ {
|
||||
/* */ public static String getTextFromPdf(String pdfPath, String pdfSpiltImagePath) throws Exception {
|
||||
/* 29 */ File pdffile = new File(pdfPath);
|
||||
/* 30 */ PDDocument doc = PDDocument.load(pdffile);
|
||||
/* 31 */ String text = (new PDFTextStripper()).getText(doc);
|
||||
/* 32 */ String result = text.replace("\n", "");
|
||||
/* 33 */ result = result.replace("\r", "");
|
||||
/* 34 */ if (result.equals("")) {
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 38 */ String name = pdffile.getName().substring(0, pdffile.getName().lastIndexOf("."));
|
||||
/* */
|
||||
/* 40 */ String hz = pdffile.getName().substring(pdffile.getName().lastIndexOf(".") + 1);
|
||||
/* 41 */ String imageRootPath = pdfSpiltImagePath + File.separator + name;
|
||||
/* 42 */ File imagePathFile = new File(imageRootPath);
|
||||
/* 43 */ if (!imagePathFile.exists()) {
|
||||
/* 44 */ imagePathFile.mkdirs();
|
||||
/* */ }
|
||||
/* */
|
||||
/* 47 */ pdfToImg(pdffile, imageRootPath, name);
|
||||
/* 48 */ String res = "";
|
||||
/* 49 */ for (int i = 0; i < (imagePathFile.listFiles()).length; i++) {
|
||||
/* 50 */ Tesseract tesseract = new Tesseract();
|
||||
/* */
|
||||
/* 52 */ File tessDataFolder = LoadLibs.extractTessResources("tessdata");
|
||||
/* 53 */ tesseract.setDatapath(tessDataFolder.getAbsolutePath());
|
||||
/* */
|
||||
/* 55 */ tesseract.setLanguage("chi_sim");
|
||||
/* */
|
||||
/* 57 */ String context = tesseract.doOCR(imagePathFile.listFiles()[i]);
|
||||
/* */
|
||||
/* 59 */ context = context.replaceAll("\\r|\\n", "-").replaceAll(" ", "");
|
||||
/* 60 */ res = res + context + "\n";
|
||||
/* */ }
|
||||
/* */
|
||||
/* 63 */ imagePathFile.setWritable(true, false);
|
||||
/* 64 */ imagePathFile.delete();
|
||||
/* 65 */ text = res;
|
||||
/* */ }
|
||||
/* 67 */ return text;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void pdfToImg(File file, String imagePath, String fileName) {
|
||||
/* */ try {
|
||||
/* 76 */ PDDocument doc = PDDocument.load(file);
|
||||
/* 77 */ PDFRenderer renderer = new PDFRenderer(doc);
|
||||
/* 78 */ int pageCount = doc.getNumberOfPages();
|
||||
/* */
|
||||
/* 80 */ for (int i = 0; i < pageCount; i++) {
|
||||
/* */
|
||||
/* 82 */ BufferedImage image = renderer.renderImageWithDPI(i, 144.0F);
|
||||
/* */
|
||||
/* 84 */ ImageIO.write(image, "png", new File(imagePath + File.separator + fileName + i + ".png"));
|
||||
/* */ }
|
||||
/* 86 */ } catch (Exception e) {
|
||||
/* 87 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\ocr\PdfOcr.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,61 @@
|
||||
/* */ package com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import com.alibaba.fastjson.JSONObject;
|
||||
/* */ import com.archive.common.utils.IpUtils;
|
||||
/* */ import com.archive.common.utils.StringUtils;
|
||||
/* */ import com.archive.common.utils.http.HttpUtils;
|
||||
/* */ import com.archive.framework.config.ArchiveConfig;
|
||||
/* */ import org.slf4j.Logger;
|
||||
/* */ import org.slf4j.LoggerFactory;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class AddressUtils
|
||||
/* */ {
|
||||
/* 17 */ private static final Logger log = LoggerFactory.getLogger(com.archive.common.utils.AddressUtils.class);
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp";
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String UNKNOWN = "XX XX";
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getRealAddressByIP(String ip) {
|
||||
/* 27 */ String address = "XX XX";
|
||||
/* */
|
||||
/* 29 */ if (IpUtils.internalIp(ip))
|
||||
/* */ {
|
||||
/* 31 */ return "内网IP";
|
||||
/* */ }
|
||||
/* 33 */ if (ArchiveConfig.isAddressEnabled()) {
|
||||
/* */
|
||||
/* */ try {
|
||||
/* */
|
||||
/* 37 */ String rspStr = HttpUtils.sendGet("http://whois.pconline.com.cn/ipJson.jsp", "ip=" + ip + "&json=true", "GBK");
|
||||
/* 38 */ if (StringUtils.isEmpty(rspStr)) {
|
||||
/* */
|
||||
/* 40 */ log.error("获取地理位置异常 {}", ip);
|
||||
/* 41 */ return "XX XX";
|
||||
/* */ }
|
||||
/* 43 */ JSONObject obj = JSONObject.parseObject(rspStr);
|
||||
/* 44 */ String region = obj.getString("pro");
|
||||
/* 45 */ String city = obj.getString("city");
|
||||
/* 46 */ return String.format("%s %s", new Object[] { region, city });
|
||||
/* */ }
|
||||
/* 48 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 50 */ log.error("获取地理位置异常 {}", e);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 53 */ return address;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\AddressUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,122 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import java.math.BigDecimal;
|
||||
/* */ import java.math.RoundingMode;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class Arith
|
||||
/* */ {
|
||||
/* */ private static final int DEF_DIV_SCALE = 10;
|
||||
/* */
|
||||
/* */ public static double add(double v1, double v2) {
|
||||
/* 30 */ BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||
/* 31 */ BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||
/* 32 */ return b1.add(b2).doubleValue();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static double sub(double v1, double v2) {
|
||||
/* 43 */ BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||
/* 44 */ BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||
/* 45 */ return b1.subtract(b2).doubleValue();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static double mul(double v1, double v2) {
|
||||
/* 56 */ BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||
/* 57 */ BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||
/* 58 */ return b1.multiply(b2).doubleValue();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static double div(double v1, double v2) {
|
||||
/* 70 */ return div(v1, v2, 10);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static double div(double v1, double v2, int scale) {
|
||||
/* 83 */ if (scale < 0)
|
||||
/* */ {
|
||||
/* 85 */ throw new IllegalArgumentException("The scale must be a positive integer or zero");
|
||||
/* */ }
|
||||
/* */
|
||||
/* 88 */ BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||
/* 89 */ BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||
/* 90 */ if (b1.compareTo(BigDecimal.ZERO) == 0)
|
||||
/* */ {
|
||||
/* 92 */ return BigDecimal.ZERO.doubleValue();
|
||||
/* */ }
|
||||
/* 94 */ return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static double round(double v, int scale) {
|
||||
/* 105 */ if (scale < 0)
|
||||
/* */ {
|
||||
/* 107 */ throw new IllegalArgumentException("The scale must be a positive integer or zero");
|
||||
/* */ }
|
||||
/* */
|
||||
/* 110 */ BigDecimal b = new BigDecimal(Double.toString(v));
|
||||
/* 111 */ BigDecimal one = new BigDecimal("1");
|
||||
/* 112 */ return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue();
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\Arith.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,205 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.spring.SpringUtils;
|
||||
/* */ import java.util.Iterator;
|
||||
/* */ import java.util.Set;
|
||||
/* */ import org.apache.shiro.cache.Cache;
|
||||
/* */ import org.apache.shiro.cache.CacheManager;
|
||||
/* */ import org.apache.shiro.cache.ehcache.EhCacheManager;
|
||||
/* */ import org.slf4j.Logger;
|
||||
/* */ import org.slf4j.LoggerFactory;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class CacheUtils
|
||||
/* */ {
|
||||
/* 19 */ private static Logger logger = LoggerFactory.getLogger(com.archive.common.utils.CacheUtils.class);
|
||||
/* */
|
||||
/* 21 */ private static CacheManager cacheManager = (CacheManager)SpringUtils.getBean(CacheManager.class);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static final String SYS_CACHE = "sys-cache";
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Object get(String key) {
|
||||
/* 33 */ return get("sys-cache", key);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Object get(String key, Object defaultValue) {
|
||||
/* 45 */ Object value = get(key);
|
||||
/* 46 */ return (value != null) ? value : defaultValue;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void put(String key, Object value) {
|
||||
/* 57 */ put("sys-cache", key, value);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void remove(String key) {
|
||||
/* 68 */ remove("sys-cache", key);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Object get(String cacheName, String key) {
|
||||
/* 80 */ return getCache(cacheName).get(getKey(key));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Object get(String cacheName, String key, Object defaultValue) {
|
||||
/* 93 */ Object value = get(cacheName, getKey(key));
|
||||
/* 94 */ return (value != null) ? value : defaultValue;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void put(String cacheName, String key, Object value) {
|
||||
/* 106 */ getCache(cacheName).put(getKey(key), value);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void remove(String cacheName, String key) {
|
||||
/* 117 */ getCache(cacheName).remove(getKey(key));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void removeAll(String cacheName) {
|
||||
/* 127 */ Cache<String, Object> cache = getCache(cacheName);
|
||||
/* 128 */ Set<String> keys = cache.keys();
|
||||
/* 129 */ for (Iterator<String> it = keys.iterator(); it.hasNext();)
|
||||
/* */ {
|
||||
/* 131 */ cache.remove(it.next());
|
||||
/* */ }
|
||||
/* 133 */ logger.info("清理缓存: {} => {}", cacheName, keys);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void removeByKeys(Set<String> keys) {
|
||||
/* 143 */ removeByKeys("sys-cache", keys);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void removeByKeys(String cacheName, Set<String> keys) {
|
||||
/* 154 */ for (Iterator<String> it = keys.iterator(); it.hasNext();)
|
||||
/* */ {
|
||||
/* 156 */ remove(it.next());
|
||||
/* */ }
|
||||
/* 158 */ logger.info("清理缓存: {} => {}", cacheName, keys);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static String getKey(String key) {
|
||||
/* 169 */ return key;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Cache<String, Object> getCache(String cacheName) {
|
||||
/* 180 */ Cache<String, Object> cache = cacheManager.getCache(cacheName);
|
||||
/* 181 */ if (cache == null)
|
||||
/* */ {
|
||||
/* 183 */ throw new RuntimeException("当前系统中没有定义“" + cacheName + "”这个缓存。");
|
||||
/* */ }
|
||||
/* 185 */ return cache;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String[] getCacheNames() {
|
||||
/* 195 */ return ((EhCacheManager)cacheManager).getCacheManager().getCacheNames();
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\CacheUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,146 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
;
|
||||
/* */
|
||||
/* */ import java.io.UnsupportedEncodingException;
|
||||
/* */ import java.net.URLDecoder;
|
||||
/* */ import java.net.URLEncoder;
|
||||
/* */ import javax.servlet.http.Cookie;
|
||||
/* */ import javax.servlet.http.HttpServletRequest;
|
||||
/* */ import javax.servlet.http.HttpServletResponse;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class CookieUtils
|
||||
/* */ {
|
||||
/* */ public static void setCookie(HttpServletResponse response, String name, String value) {
|
||||
/* 25 */ setCookie(response, name, value, 86400);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void setCookie(HttpServletResponse response, String name, String value, String path) {
|
||||
/* 38 */ setCookie(response, name, value, path, 86400);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void setCookie(HttpServletResponse response, String name, String value, int maxAge) {
|
||||
/* 51 */ setCookie(response, name, value, "/", maxAge);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void setCookie(HttpServletResponse response, String name, String value, String path, int maxAge) {
|
||||
/* 64 */ Cookie cookie = new Cookie(name, null);
|
||||
/* 65 */ cookie.setPath(path);
|
||||
/* 66 */ cookie.setMaxAge(maxAge);
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 69 */ cookie.setValue(URLEncoder.encode(value, "utf-8"));
|
||||
/* */ }
|
||||
/* 71 */ catch (UnsupportedEncodingException e) {
|
||||
/* */
|
||||
/* 73 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* 75 */ response.addCookie(cookie);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getCookie(HttpServletRequest request, String name) {
|
||||
/* 86 */ return getCookie(request, null, name, false);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getCookie(HttpServletRequest request, HttpServletResponse response, String name) {
|
||||
/* 97 */ return getCookie(request, response, name, true);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getCookie(HttpServletRequest request, HttpServletResponse response, String name, boolean isRemove) {
|
||||
/* 112 */ String value = null;
|
||||
/* 113 */ Cookie[] cookies = request.getCookies();
|
||||
/* 114 */ if (cookies != null)
|
||||
/* */ {
|
||||
/* 116 */ for (Cookie cookie : cookies) {
|
||||
/* */
|
||||
/* 118 */ if (cookie.getName().equals(name)) {
|
||||
/* */
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 122 */ value = URLDecoder.decode(cookie.getValue(), "utf-8");
|
||||
/* */ }
|
||||
/* 124 */ catch (UnsupportedEncodingException e) {
|
||||
/* */
|
||||
/* 126 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* 128 */ if (isRemove) {
|
||||
/* */
|
||||
/* 130 */ cookie.setMaxAge(0);
|
||||
/* 131 */ response.addCookie(cookie);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 136 */ return value;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\CookieUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,171 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import java.lang.management.ManagementFactory;
|
||||
/* */ import java.text.ParseException;
|
||||
/* */ import java.text.SimpleDateFormat;
|
||||
/* */ import java.util.Date;
|
||||
/* */ import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
/* */ import org.apache.commons.lang3.time.DateUtils;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class DateUtils
|
||||
/* */ extends DateUtils
|
||||
/* */ {
|
||||
/* 16 */ public static String YYYY = "yyyy";
|
||||
/* */
|
||||
/* 18 */ public static String YYYY_MM = "yyyy-MM";
|
||||
/* */
|
||||
/* 20 */ public static String YYYY_MM_DD = "yyyy-MM-dd";
|
||||
/* */
|
||||
/* 22 */ public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||
/* */
|
||||
/* 24 */ public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
/* */
|
||||
/* 26 */ private static String[] parsePatterns = new String[] { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM" };
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Date getNowDate() {
|
||||
/* 38 */ return new Date();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getDate() {
|
||||
/* 48 */ return dateTimeNow(YYYY_MM_DD);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String getTime() {
|
||||
/* 53 */ return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String dateTimeNow() {
|
||||
/* 58 */ return dateTimeNow(YYYYMMDDHHMMSS);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String dateTimeNow(String format) {
|
||||
/* 63 */ return parseDateToStr(format, new Date());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String dateTime(Date date) {
|
||||
/* 68 */ return parseDateToStr(YYYY_MM_DD, date);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String parseDateToStr(String format, Date date) {
|
||||
/* 73 */ return (new SimpleDateFormat(format)).format(date);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final Date dateTime(String format, String ts) {
|
||||
/* */ try {
|
||||
/* 80 */ return (new SimpleDateFormat(format)).parse(ts);
|
||||
/* */ }
|
||||
/* 82 */ catch (ParseException e) {
|
||||
/* */
|
||||
/* 84 */ throw new RuntimeException(e);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String datePath() {
|
||||
/* 93 */ Date now = new Date();
|
||||
/* 94 */ return DateFormatUtils.format(now, "yyyy/MM/dd");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String dateTime() {
|
||||
/* 102 */ Date now = new Date();
|
||||
/* 103 */ return DateFormatUtils.format(now, "yyyyMMdd");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Date parseDate(Object str) {
|
||||
/* 111 */ if (str == null)
|
||||
/* */ {
|
||||
/* 113 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 117 */ return parseDate(str.toString(), parsePatterns);
|
||||
/* */ }
|
||||
/* 119 */ catch (ParseException e) {
|
||||
/* */
|
||||
/* 121 */ return null;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Date getServerStartDate() {
|
||||
/* 130 */ long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||
/* 131 */ return new Date(time);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static int differentDaysByMillisecond(Date date1, Date date2) {
|
||||
/* 139 */ return Math.abs((int)((date2.getTime() - date1.getTime()) / 86400000L));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getDatePoor(Date endDate, Date nowDate) {
|
||||
/* 147 */ long nd = 86400000L;
|
||||
/* 148 */ long nh = 3600000L;
|
||||
/* 149 */ long nm = 60000L;
|
||||
/* */
|
||||
/* */
|
||||
/* 152 */ long diff = endDate.getTime() - nowDate.getTime();
|
||||
/* */
|
||||
/* 154 */ long day = diff / nd;
|
||||
/* */
|
||||
/* 156 */ long hour = diff % nd / nh;
|
||||
/* */
|
||||
/* 158 */ long min = diff % nd % nh / nm;
|
||||
/* */
|
||||
/* */
|
||||
/* 161 */ return day + "天" + hour + "小时" + min + "分钟";
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\DateUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,49 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.StringUtils;
|
||||
/* */ import java.io.PrintWriter;
|
||||
/* */ import java.io.StringWriter;
|
||||
/* */ import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class ExceptionUtil
|
||||
/* */ {
|
||||
/* */ public static String getExceptionMessage(Throwable e) {
|
||||
/* 20 */ StringWriter sw = new StringWriter();
|
||||
/* 21 */ e.printStackTrace(new PrintWriter(sw, true));
|
||||
/* 22 */ String str = sw.toString();
|
||||
/* 23 */ return str;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getRootErrorMseeage(Exception e) {
|
||||
/* 28 */ Throwable root = ExceptionUtils.getRootCause(e);
|
||||
/* 29 */ root = (root == null) ? e : root;
|
||||
/* 30 */ if (root == null)
|
||||
/* */ {
|
||||
/* 32 */ return "";
|
||||
/* */ }
|
||||
/* 34 */ String msg = root.getMessage();
|
||||
/* 35 */ if (msg == null)
|
||||
/* */ {
|
||||
/* 37 */ return "null";
|
||||
/* */ }
|
||||
/* 39 */ return StringUtils.defaultString(msg);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\ExceptionUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,203 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.StringUtils;
|
||||
/* */ import java.net.InetAddress;
|
||||
/* */ import java.net.UnknownHostException;
|
||||
/* */ import javax.servlet.http.HttpServletRequest;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class IpUtils
|
||||
/* */ {
|
||||
/* */ public static String getIpAddr(HttpServletRequest request) {
|
||||
/* 16 */ if (request == null)
|
||||
/* */ {
|
||||
/* 18 */ return "unknown";
|
||||
/* */ }
|
||||
/* 20 */ String ip = request.getHeader("x-forwarded-for");
|
||||
/* 21 */ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
|
||||
/* */ {
|
||||
/* 23 */ ip = request.getHeader("Proxy-Client-IP");
|
||||
/* */ }
|
||||
/* 25 */ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
|
||||
/* */ {
|
||||
/* 27 */ ip = request.getHeader("X-Forwarded-For");
|
||||
/* */ }
|
||||
/* 29 */ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
|
||||
/* */ {
|
||||
/* 31 */ ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
/* */ }
|
||||
/* 33 */ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
|
||||
/* */ {
|
||||
/* 35 */ ip = request.getHeader("X-Real-IP");
|
||||
/* */ }
|
||||
/* */
|
||||
/* 38 */ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
|
||||
/* */ {
|
||||
/* 40 */ ip = request.getRemoteAddr();
|
||||
/* */ }
|
||||
/* */
|
||||
/* 43 */ return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean internalIp(String ip) {
|
||||
/* 48 */ byte[] addr = textToNumericFormatV4(ip);
|
||||
/* 49 */ return (internalIp(addr) || "127.0.0.1".equals(ip));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static boolean internalIp(byte[] addr) {
|
||||
/* 54 */ if (StringUtils.isNull(addr) || addr.length < 2)
|
||||
/* */ {
|
||||
/* 56 */ return true;
|
||||
/* */ }
|
||||
/* 58 */ byte b0 = addr[0];
|
||||
/* 59 */ byte b1 = addr[1];
|
||||
/* */
|
||||
/* 61 */ byte SECTION_1 = 10;
|
||||
/* */
|
||||
/* 63 */ byte SECTION_2 = -84;
|
||||
/* 64 */ byte SECTION_3 = 16;
|
||||
/* 65 */ byte SECTION_4 = 31;
|
||||
/* */
|
||||
/* 67 */ byte SECTION_5 = -64;
|
||||
/* 68 */ byte SECTION_6 = -88;
|
||||
/* 69 */ switch (b0) {
|
||||
/* */
|
||||
/* */ case 10:
|
||||
/* 72 */ return true;
|
||||
/* */ case -84:
|
||||
/* 74 */ if (b1 >= 16 && b1 <= 31)
|
||||
/* */ {
|
||||
/* 76 */ return true;
|
||||
/* */ }
|
||||
/* */ case -64:
|
||||
/* 79 */ switch (b1) {
|
||||
/* */
|
||||
/* */ case -88:
|
||||
/* 82 */ return true;
|
||||
/* */ } break;
|
||||
/* */ }
|
||||
/* 85 */ return false;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static byte[] textToNumericFormatV4(String text) {
|
||||
/* 97 */ if (text.length() == 0)
|
||||
/* */ {
|
||||
/* 99 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 102 */ byte[] bytes = new byte[4];
|
||||
/* 103 */ String[] elements = text.split("\\.", -1);
|
||||
/* */
|
||||
/* */ try {
|
||||
/* */ long l;
|
||||
/* */ int i;
|
||||
/* 108 */ switch (elements.length) {
|
||||
/* */
|
||||
/* */ case 1:
|
||||
/* 111 */ l = Long.parseLong(elements[0]);
|
||||
/* 112 */ if (l < 0L || l > 4294967295L) {
|
||||
/* 113 */ return null;
|
||||
/* */ }
|
||||
/* 115 */ bytes[0] = (byte)(int)(l >> 24L & 0xFFL);
|
||||
/* 116 */ bytes[1] = (byte)(int)((l & 0xFFFFFFL) >> 16L & 0xFFL);
|
||||
/* 117 */ bytes[2] = (byte)(int)((l & 0xFFFFL) >> 8L & 0xFFL);
|
||||
/* 118 */ bytes[3] = (byte)(int)(l & 0xFFL);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 168 */ return bytes;case 2: l = Integer.parseInt(elements[0]); if (l < 0L || l > 255L) return null; bytes[0] = (byte)(int)(l & 0xFFL); l = Integer.parseInt(elements[1]); if (l < 0L || l > 16777215L) return null; bytes[1] = (byte)(int)(l >> 16L & 0xFFL); bytes[2] = (byte)(int)((l & 0xFFFFL) >> 8L & 0xFFL); bytes[3] = (byte)(int)(l & 0xFFL); return bytes;case 3: for (i = 0; i < 2; i++) { l = Integer.parseInt(elements[i]); if (l < 0L || l > 255L) return null; bytes[i] = (byte)(int)(l & 0xFFL); } l = Integer.parseInt(elements[2]); if (l < 0L || l > 65535L) return null; bytes[2] = (byte)(int)(l >> 8L & 0xFFL); bytes[3] = (byte)(int)(l & 0xFFL); return bytes;case 4: for (i = 0; i < 4; i++) { l = Integer.parseInt(elements[i]); if (l < 0L || l > 255L) return null; bytes[i] = (byte)(int)(l & 0xFFL); } return bytes;
|
||||
/* */ }
|
||||
/* */ return null;
|
||||
/* */ } catch (NumberFormatException e) {
|
||||
/* */ return null;
|
||||
/* */ } } public static String getHostIp() {
|
||||
/* */ try {
|
||||
/* 175 */ return InetAddress.getLocalHost().getHostAddress();
|
||||
/* */ }
|
||||
/* 177 */ catch (UnknownHostException unknownHostException) {
|
||||
/* */
|
||||
/* */
|
||||
/* 180 */ return "127.0.0.1";
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getHostName() {
|
||||
/* */ try {
|
||||
/* 187 */ return InetAddress.getLocalHost().getHostName();
|
||||
/* */ }
|
||||
/* 189 */ catch (UnknownHostException unknownHostException) {
|
||||
/* */
|
||||
/* */
|
||||
/* 192 */ return "未知";
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\IpUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,142 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import com.alibaba.fastjson.JSON;
|
||||
/* */ import com.archive.common.utils.IpUtils;
|
||||
/* */ import java.io.PrintWriter;
|
||||
/* */ import java.io.StringWriter;
|
||||
/* */ import java.util.Map;
|
||||
/* */ import javax.servlet.http.HttpServletRequest;
|
||||
/* */ import org.apache.shiro.SecurityUtils;
|
||||
/* */ import org.slf4j.Logger;
|
||||
/* */ import org.slf4j.LoggerFactory;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class LogUtils
|
||||
/* */ {
|
||||
/* 19 */ public static final Logger ERROR_LOG = LoggerFactory.getLogger("sys-error");
|
||||
/* 20 */ public static final Logger ACCESS_LOG = LoggerFactory.getLogger("sys-access");
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void logAccess(HttpServletRequest request) {
|
||||
/* 29 */ String username = getUsername();
|
||||
/* 30 */ String jsessionId = request.getRequestedSessionId();
|
||||
/* 31 */ String ip = IpUtils.getIpAddr(request);
|
||||
/* 32 */ String accept = request.getHeader("accept");
|
||||
/* 33 */ String userAgent = request.getHeader("User-Agent");
|
||||
/* 34 */ String url = request.getRequestURI();
|
||||
/* 35 */ String params = getParams(request);
|
||||
/* */
|
||||
/* 37 */ StringBuilder s = new StringBuilder();
|
||||
/* 38 */ s.append(getBlock(username));
|
||||
/* 39 */ s.append(getBlock(jsessionId));
|
||||
/* 40 */ s.append(getBlock(ip));
|
||||
/* 41 */ s.append(getBlock(accept));
|
||||
/* 42 */ s.append(getBlock(userAgent));
|
||||
/* 43 */ s.append(getBlock(url));
|
||||
/* 44 */ s.append(getBlock(params));
|
||||
/* 45 */ s.append(getBlock(request.getHeader("Referer")));
|
||||
/* 46 */ getAccessLog().info(s.toString());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void logError(String message, Throwable e) {
|
||||
/* 57 */ String username = getUsername();
|
||||
/* 58 */ StringBuilder s = new StringBuilder();
|
||||
/* 59 */ s.append(getBlock("exception"));
|
||||
/* 60 */ s.append(getBlock(username));
|
||||
/* 61 */ s.append(getBlock(message));
|
||||
/* 62 */ ERROR_LOG.error(s.toString(), e);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void logPageError(HttpServletRequest request) {
|
||||
/* 72 */ String username = getUsername();
|
||||
/* */
|
||||
/* 74 */ Integer statusCode = (Integer)request.getAttribute("javax.servlet.error.status_code");
|
||||
/* 75 */ String message = (String)request.getAttribute("javax.servlet.error.message");
|
||||
/* 76 */ String uri = (String)request.getAttribute("javax.servlet.error.request_uri");
|
||||
/* 77 */ Throwable t = (Throwable)request.getAttribute("javax.servlet.error.exception");
|
||||
/* */
|
||||
/* 79 */ if (statusCode == null)
|
||||
/* */ {
|
||||
/* 81 */ statusCode = Integer.valueOf(0);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 84 */ StringBuilder s = new StringBuilder();
|
||||
/* 85 */ s.append(getBlock((t == null) ? "page" : "exception"));
|
||||
/* 86 */ s.append(getBlock(username));
|
||||
/* 87 */ s.append(getBlock(statusCode));
|
||||
/* 88 */ s.append(getBlock(message));
|
||||
/* 89 */ s.append(getBlock(IpUtils.getIpAddr(request)));
|
||||
/* */
|
||||
/* 91 */ s.append(getBlock(uri));
|
||||
/* 92 */ s.append(getBlock(request.getHeader("Referer")));
|
||||
/* 93 */ StringWriter sw = new StringWriter();
|
||||
/* */
|
||||
/* 95 */ while (t != null) {
|
||||
/* */
|
||||
/* 97 */ t.printStackTrace(new PrintWriter(sw));
|
||||
/* 98 */ t = t.getCause();
|
||||
/* */ }
|
||||
/* 100 */ s.append(getBlock(sw.toString()));
|
||||
/* 101 */ getErrorLog().error(s.toString());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getBlock(Object msg) {
|
||||
/* 107 */ if (msg == null)
|
||||
/* */ {
|
||||
/* 109 */ msg = "";
|
||||
/* */ }
|
||||
/* 111 */ return "[" + msg.toString() + "]";
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected static String getParams(HttpServletRequest request) {
|
||||
/* 116 */ Map<String, String[]> params = request.getParameterMap();
|
||||
/* 117 */ return JSON.toJSONString(params);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected static String getUsername() {
|
||||
/* 122 */ return (String)SecurityUtils.getSubject().getPrincipal();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Logger getAccessLog() {
|
||||
/* 127 */ return ACCESS_LOG;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Logger getErrorLog() {
|
||||
/* 132 */ return ERROR_LOG;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\LogUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,62 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
;
|
||||
/* */
|
||||
/* */ import java.util.HashMap;
|
||||
/* */ import java.util.Iterator;
|
||||
/* */ import java.util.Map;
|
||||
/* */ import javax.servlet.http.HttpServletRequest;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class MapDataUtil
|
||||
/* */ {
|
||||
/* */ public static Map<String, Object> convertDataMap(HttpServletRequest request) {
|
||||
/* 18 */ Map<String, String[]> properties = request.getParameterMap();
|
||||
/* 19 */ Map<String, Object> returnMap = new HashMap<>();
|
||||
/* 20 */ Iterator<?> entries = properties.entrySet().iterator();
|
||||
/* */
|
||||
/* 22 */ String name = "";
|
||||
/* 23 */ String value = "";
|
||||
/* 24 */ while (entries.hasNext()) {
|
||||
/* */
|
||||
/* 26 */ Map.Entry<?, ?> entry = (Map.Entry<?, ?>)entries.next();
|
||||
/* 27 */ name = (String)entry.getKey();
|
||||
/* 28 */ Object valueObj = entry.getValue();
|
||||
/* 29 */ if (null == valueObj) {
|
||||
/* */
|
||||
/* 31 */ value = "";
|
||||
/* */ }
|
||||
/* 33 */ else if (valueObj instanceof String[]) {
|
||||
/* */
|
||||
/* 35 */ String[] values = (String[])valueObj;
|
||||
/* 36 */ value = "";
|
||||
/* 37 */ for (int i = 0; i < values.length; i++)
|
||||
/* */ {
|
||||
/* 39 */ value = value + values[i] + ",";
|
||||
/* */ }
|
||||
/* 41 */ if (value.length() > 0)
|
||||
/* */ {
|
||||
/* 43 */ value = value.substring(0, value.length() - 1);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ else {
|
||||
/* */
|
||||
/* 48 */ value = valueObj.toString();
|
||||
/* */ }
|
||||
/* 50 */ returnMap.put(name, value);
|
||||
/* */ }
|
||||
/* 52 */ return returnMap;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\MapDataUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,74 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import java.security.MessageDigest;
|
||||
/* */ import org.slf4j.Logger;
|
||||
/* */ import org.slf4j.LoggerFactory;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class Md5Utils
|
||||
/* */ {
|
||||
/* 14 */ private static final Logger log = LoggerFactory.getLogger(com.archive.common.utils.Md5Utils.class);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static byte[] md5(String s) {
|
||||
/* */ try {
|
||||
/* 21 */ MessageDigest algorithm = MessageDigest.getInstance("MD5");
|
||||
/* 22 */ algorithm.reset();
|
||||
/* 23 */ algorithm.update(s.getBytes("UTF-8"));
|
||||
/* 24 */ byte[] messageDigest = algorithm.digest();
|
||||
/* 25 */ return messageDigest;
|
||||
/* */ }
|
||||
/* 27 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 29 */ log.error("MD5 Error...", e);
|
||||
/* */
|
||||
/* 31 */ return null;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private static final String toHex(byte[] hash) {
|
||||
/* 36 */ if (hash == null)
|
||||
/* */ {
|
||||
/* 38 */ return null;
|
||||
/* */ }
|
||||
/* 40 */ StringBuffer buf = new StringBuffer(hash.length * 2);
|
||||
/* */
|
||||
/* */
|
||||
/* 43 */ for (int i = 0; i < hash.length; i++) {
|
||||
/* */
|
||||
/* 45 */ if ((hash[i] & 0xFF) < 16)
|
||||
/* */ {
|
||||
/* 47 */ buf.append("0");
|
||||
/* */ }
|
||||
/* 49 */ buf.append(Long.toString((hash[i] & 0xFF), 16));
|
||||
/* */ }
|
||||
/* 51 */ return buf.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String hash(String s) {
|
||||
/* */ try {
|
||||
/* 58 */ return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8");
|
||||
/* */ }
|
||||
/* 60 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 62 */ log.error("not supported charset...{}", e);
|
||||
/* 63 */ return s;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\Md5Utils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,34 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.spring.SpringUtils;
|
||||
/* */ import org.springframework.context.MessageSource;
|
||||
/* */ import org.springframework.context.i18n.LocaleContextHolder;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class MessageUtils
|
||||
/* */ {
|
||||
/* */ public static String message(String code, Object... args) {
|
||||
/* 23 */ MessageSource messageSource = (MessageSource)SpringUtils.getBean(MessageSource.class);
|
||||
/* 24 */ return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\MessageUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,172 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.StringUtils;
|
||||
/* */ import com.archive.common.utils.text.Convert;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import javax.servlet.http.HttpServletRequest;
|
||||
/* */ import javax.servlet.http.HttpServletResponse;
|
||||
/* */ import javax.servlet.http.HttpSession;
|
||||
/* */ import org.springframework.web.context.request.RequestAttributes;
|
||||
/* */ import org.springframework.web.context.request.RequestContextHolder;
|
||||
/* */ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class ServletUtils
|
||||
/* */ {
|
||||
/* 22 */ private static final String[] agent = new String[] { "Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser" };
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getParameter(String name) {
|
||||
/* 29 */ return getRequest().getParameter(name);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getParameter(String name, String defaultValue) {
|
||||
/* 37 */ return Convert.toStr(getRequest().getParameter(name), defaultValue);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Integer getParameterToInt(String name) {
|
||||
/* 45 */ return Convert.toInt(getRequest().getParameter(name));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Integer getParameterToInt(String name, Integer defaultValue) {
|
||||
/* 53 */ return Convert.toInt(getRequest().getParameter(name), defaultValue);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static HttpServletRequest getRequest() {
|
||||
/* 61 */ return getRequestAttributes().getRequest();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static HttpServletResponse getResponse() {
|
||||
/* 69 */ return getRequestAttributes().getResponse();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static HttpSession getSession() {
|
||||
/* 77 */ return getRequest().getSession();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static ServletRequestAttributes getRequestAttributes() {
|
||||
/* 82 */ RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
||||
/* 83 */ return (ServletRequestAttributes)attributes;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String renderString(HttpServletResponse response, String string) {
|
||||
/* */ try {
|
||||
/* 97 */ response.setContentType("application/json");
|
||||
/* 98 */ response.setCharacterEncoding("utf-8");
|
||||
/* 99 */ response.getWriter().print(string);
|
||||
/* */ }
|
||||
/* 101 */ catch (IOException e) {
|
||||
/* */
|
||||
/* 103 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* 105 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isAjaxRequest(HttpServletRequest request) {
|
||||
/* 115 */ String accept = request.getHeader("accept");
|
||||
/* 116 */ if (accept != null && accept.indexOf("application/json") != -1)
|
||||
/* */ {
|
||||
/* 118 */ return true;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 121 */ String xRequestedWith = request.getHeader("X-Requested-With");
|
||||
/* 122 */ if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1)
|
||||
/* */ {
|
||||
/* 124 */ return true;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 127 */ String uri = request.getRequestURI();
|
||||
/* 128 */ if (StringUtils.inStringIgnoreCase(uri, new String[] { ".json", ".xml" }))
|
||||
/* */ {
|
||||
/* 130 */ return true;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 133 */ String ajax = request.getParameter("__ajax");
|
||||
/* 134 */ if (StringUtils.inStringIgnoreCase(ajax, new String[] { "json", "xml" }))
|
||||
/* */ {
|
||||
/* 136 */ return true;
|
||||
/* */ }
|
||||
/* 138 */ return false;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean checkAgentIsMobile(String ua) {
|
||||
/* 146 */ boolean flag = false;
|
||||
/* 147 */ if (!ua.contains("Windows NT") || (ua.contains("Windows NT") && ua.contains("compatible; MSIE 9.0;")))
|
||||
/* */ {
|
||||
/* */
|
||||
/* 150 */ if (!ua.contains("Windows NT") && !ua.contains("Macintosh"))
|
||||
/* */ {
|
||||
/* 152 */ for (String item : agent) {
|
||||
/* */
|
||||
/* 154 */ if (ua.contains(item)) {
|
||||
/* */
|
||||
/* 156 */ flag = true;
|
||||
/* */ break;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 162 */ return flag;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\ServletUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,416 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.text.StrFormatter;
|
||||
/* */ import java.util.Collection;
|
||||
/* */ import java.util.Map;
|
||||
/* */ import org.apache.commons.lang3.StringUtils;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class StringUtils
|
||||
/* */ extends StringUtils
|
||||
/* */ {
|
||||
/* */ private static final String NULLSTR = "";
|
||||
/* */ private static final char SEPARATOR = '_';
|
||||
/* */
|
||||
/* */ public static <T> T nvl(T value, T defaultValue) {
|
||||
/* 28 */ return (value != null) ? value : defaultValue;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isEmpty(Collection<?> coll) {
|
||||
/* 39 */ return (isNull(coll) || coll.isEmpty());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isNotEmpty(Collection<?> coll) {
|
||||
/* 50 */ return !isEmpty(coll);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isEmpty(Object[] objects) {
|
||||
/* 61 */ return (isNull(objects) || objects.length == 0);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isNotEmpty(Object[] objects) {
|
||||
/* 72 */ return !isEmpty(objects);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isEmpty(Map<?, ?> map) {
|
||||
/* 83 */ return (isNull(map) || map.isEmpty());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isNotEmpty(Map<?, ?> map) {
|
||||
/* 94 */ return !isEmpty(map);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isEmpty(String str) {
|
||||
/* 105 */ return (isNull(str) || "".equals(str.trim()));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isNotEmpty(String str) {
|
||||
/* 116 */ return !isEmpty(str);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isNull(Object object) {
|
||||
/* 127 */ return (object == null);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isNotNull(Object object) {
|
||||
/* 138 */ return !isNull(object);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isArray(Object object) {
|
||||
/* 149 */ return (isNotNull(object) && object.getClass().isArray());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String trim(String str) {
|
||||
/* 157 */ return (str == null) ? "" : str.trim();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String substring(String str, int start) {
|
||||
/* 169 */ if (str == null)
|
||||
/* */ {
|
||||
/* 171 */ return "";
|
||||
/* */ }
|
||||
/* */
|
||||
/* 174 */ if (start < 0)
|
||||
/* */ {
|
||||
/* 176 */ start = str.length() + start;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 179 */ if (start < 0)
|
||||
/* */ {
|
||||
/* 181 */ start = 0;
|
||||
/* */ }
|
||||
/* 183 */ if (start > str.length())
|
||||
/* */ {
|
||||
/* 185 */ return "";
|
||||
/* */ }
|
||||
/* */
|
||||
/* 188 */ return str.substring(start);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String substring(String str, int start, int end) {
|
||||
/* 201 */ if (str == null)
|
||||
/* */ {
|
||||
/* 203 */ return "";
|
||||
/* */ }
|
||||
/* */
|
||||
/* 206 */ if (end < 0)
|
||||
/* */ {
|
||||
/* 208 */ end = str.length() + end;
|
||||
/* */ }
|
||||
/* 210 */ if (start < 0)
|
||||
/* */ {
|
||||
/* 212 */ start = str.length() + start;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 215 */ if (end > str.length())
|
||||
/* */ {
|
||||
/* 217 */ end = str.length();
|
||||
/* */ }
|
||||
/* */
|
||||
/* 220 */ if (start > end)
|
||||
/* */ {
|
||||
/* 222 */ return "";
|
||||
/* */ }
|
||||
/* */
|
||||
/* 225 */ if (start < 0)
|
||||
/* */ {
|
||||
/* 227 */ start = 0;
|
||||
/* */ }
|
||||
/* 229 */ if (end < 0)
|
||||
/* */ {
|
||||
/* 231 */ end = 0;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 234 */ return str.substring(start, end);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String format(String template, Object... params) {
|
||||
/* 252 */ if (isEmpty(params) || isEmpty(template))
|
||||
/* */ {
|
||||
/* 254 */ return template;
|
||||
/* */ }
|
||||
/* 256 */ return StrFormatter.format(template, params);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String toUnderScoreCase(String str) {
|
||||
/* 264 */ if (str == null)
|
||||
/* */ {
|
||||
/* 266 */ return null;
|
||||
/* */ }
|
||||
/* 268 */ StringBuilder sb = new StringBuilder();
|
||||
/* */
|
||||
/* 270 */ boolean preCharIsUpperCase = true;
|
||||
/* */
|
||||
/* 272 */ boolean curreCharIsUpperCase = true;
|
||||
/* */
|
||||
/* 274 */ boolean nexteCharIsUpperCase = true;
|
||||
/* 275 */ for (int i = 0; i < str.length(); i++) {
|
||||
/* */
|
||||
/* 277 */ char c = str.charAt(i);
|
||||
/* 278 */ if (i > 0) {
|
||||
/* */
|
||||
/* 280 */ preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1));
|
||||
/* */ }
|
||||
/* */ else {
|
||||
/* */
|
||||
/* 284 */ preCharIsUpperCase = false;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 287 */ curreCharIsUpperCase = Character.isUpperCase(c);
|
||||
/* */
|
||||
/* 289 */ if (i < str.length() - 1)
|
||||
/* */ {
|
||||
/* 291 */ nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1));
|
||||
/* */ }
|
||||
/* */
|
||||
/* 294 */ if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) {
|
||||
/* */
|
||||
/* 296 */ sb.append('_');
|
||||
/* */ }
|
||||
/* 298 */ else if (i != 0 && !preCharIsUpperCase && curreCharIsUpperCase) {
|
||||
/* */
|
||||
/* 300 */ sb.append('_');
|
||||
/* */ }
|
||||
/* 302 */ sb.append(Character.toLowerCase(c));
|
||||
/* */ }
|
||||
/* 304 */ return sb.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean inStringIgnoreCase(String str, String... strs) {
|
||||
/* 316 */ if (str != null && strs != null)
|
||||
/* */ {
|
||||
/* 318 */ for (String s : strs) {
|
||||
/* */
|
||||
/* 320 */ if (str.equalsIgnoreCase(trim(s)))
|
||||
/* */ {
|
||||
/* 322 */ return true;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 326 */ return false;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String convertToCamelCase(String name) {
|
||||
/* 337 */ StringBuilder result = new StringBuilder();
|
||||
/* */
|
||||
/* 339 */ if (name == null || name.isEmpty())
|
||||
/* */ {
|
||||
/* */
|
||||
/* 342 */ return "";
|
||||
/* */ }
|
||||
/* 344 */ if (!name.contains("_"))
|
||||
/* */ {
|
||||
/* */
|
||||
/* 347 */ return name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 350 */ String[] camels = name.split("_");
|
||||
/* 351 */ for (String camel : camels) {
|
||||
/* */
|
||||
/* */
|
||||
/* 354 */ if (!camel.isEmpty()) {
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 359 */ result.append(camel.substring(0, 1).toUpperCase());
|
||||
/* 360 */ result.append(camel.substring(1).toLowerCase());
|
||||
/* */ }
|
||||
/* 362 */ } return result.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String toCamelCase(String s) {
|
||||
/* 371 */ if (s == null)
|
||||
/* */ {
|
||||
/* 373 */ return null;
|
||||
/* */ }
|
||||
/* 375 */ if (s.indexOf('_') == -1)
|
||||
/* */ {
|
||||
/* 377 */ return s;
|
||||
/* */ }
|
||||
/* 379 */ s = s.toLowerCase();
|
||||
/* 380 */ StringBuilder sb = new StringBuilder(s.length());
|
||||
/* 381 */ boolean upperCase = false;
|
||||
/* 382 */ for (int i = 0; i < s.length(); i++) {
|
||||
/* */
|
||||
/* 384 */ char c = s.charAt(i);
|
||||
/* */
|
||||
/* 386 */ if (c == '_') {
|
||||
/* */
|
||||
/* 388 */ upperCase = true;
|
||||
/* */ }
|
||||
/* 390 */ else if (upperCase) {
|
||||
/* */
|
||||
/* 392 */ sb.append(Character.toUpperCase(c));
|
||||
/* 393 */ upperCase = false;
|
||||
/* */ }
|
||||
/* */ else {
|
||||
/* */
|
||||
/* 397 */ sb.append(c);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 400 */ return sb.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static <T> T cast(Object obj) {
|
||||
/* 406 */ return (T)obj;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\StringUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,107 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import java.util.concurrent.CancellationException;
|
||||
/* */ import java.util.concurrent.ExecutionException;
|
||||
/* */ import java.util.concurrent.ExecutorService;
|
||||
/* */ import java.util.concurrent.Future;
|
||||
/* */ import java.util.concurrent.TimeUnit;
|
||||
/* */ import org.slf4j.Logger;
|
||||
/* */ import org.slf4j.LoggerFactory;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class Threads
|
||||
/* */ {
|
||||
/* 18 */ private static final Logger logger = LoggerFactory.getLogger(com.archive.common.utils.Threads.class);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void sleep(long milliseconds) {
|
||||
/* */ try {
|
||||
/* 27 */ Thread.sleep(milliseconds);
|
||||
/* */ }
|
||||
/* 29 */ catch (InterruptedException e) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void shutdownAndAwaitTermination(ExecutorService pool) {
|
||||
/* 44 */ if (pool != null && !pool.isShutdown()) {
|
||||
/* */
|
||||
/* 46 */ pool.shutdown();
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 49 */ if (!pool.awaitTermination(120L, TimeUnit.SECONDS))
|
||||
/* */ {
|
||||
/* 51 */ pool.shutdownNow();
|
||||
/* 52 */ if (!pool.awaitTermination(120L, TimeUnit.SECONDS))
|
||||
/* */ {
|
||||
/* 54 */ logger.info("Pool did not terminate");
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* 58 */ } catch (InterruptedException ie) {
|
||||
/* */
|
||||
/* 60 */ pool.shutdownNow();
|
||||
/* 61 */ Thread.currentThread().interrupt();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void printException(Runnable r, Throwable t) {
|
||||
/* 71 */ if (t == null && r instanceof Future) {
|
||||
/* */
|
||||
/* */ try {
|
||||
/* */
|
||||
/* 75 */ Future<?> future = (Future)r;
|
||||
/* 76 */ if (future.isDone())
|
||||
/* */ {
|
||||
/* 78 */ future.get();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 81 */ catch (CancellationException ce) {
|
||||
/* */
|
||||
/* 83 */ t = ce;
|
||||
/* */ }
|
||||
/* 85 */ catch (ExecutionException ee) {
|
||||
/* */
|
||||
/* 87 */ t = ee.getCause();
|
||||
/* */ }
|
||||
/* 89 */ catch (InterruptedException ie) {
|
||||
/* */
|
||||
/* 91 */ Thread.currentThread().interrupt();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 94 */ if (t != null)
|
||||
/* */ {
|
||||
/* 96 */ logger.error(t.getMessage(), t);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\Threads.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,145 @@
|
||||
/* */ package com.archive.common.utils
|
||||
|
||||
-INF.classes.com.archive.common.utils;
|
||||
/* */
|
||||
/* */ import com.archive.project.system.menu.domain.Menu;
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.Iterator;
|
||||
/* */ import java.util.List;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class TreeUtils
|
||||
/* */ {
|
||||
/* */ public static List<Menu> getChildPerms(List<Menu> list, int parentId) {
|
||||
/* 24 */ List<Menu> returnList = new ArrayList<>();
|
||||
/* 25 */ for (Iterator<Menu> iterator = list.iterator(); iterator.hasNext(); ) {
|
||||
/* */
|
||||
/* 27 */ Menu t = iterator.next();
|
||||
/* */
|
||||
/* 29 */ if (t.getParentId().longValue() == parentId) {
|
||||
/* */
|
||||
/* 31 */ recursionFn(list, t);
|
||||
/* 32 */ returnList.add(t);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 35 */ return returnList;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static void recursionFn(List<Menu> list, Menu t) {
|
||||
/* 47 */ List<Menu> childList = getChildList(list, t);
|
||||
/* 48 */ t.setChildren(childList);
|
||||
/* 49 */ for (Menu tChild : childList) {
|
||||
/* */
|
||||
/* 51 */ if (hasChild(list, tChild))
|
||||
/* */ {
|
||||
/* 53 */ recursionFn(list, tChild);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static List<Menu> getChildList(List<Menu> list, Menu t) {
|
||||
/* 64 */ List<Menu> tlist = new ArrayList<>();
|
||||
/* 65 */ Iterator<Menu> it = list.iterator();
|
||||
/* 66 */ while (it.hasNext()) {
|
||||
/* */
|
||||
/* 68 */ Menu n = it.next();
|
||||
/* 69 */ if (n.getParentId().longValue() == t.getMenuId().longValue())
|
||||
/* */ {
|
||||
/* 71 */ tlist.add(n);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 74 */ return tlist;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 77 */ List<Menu> returnList = new ArrayList<>();
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public List<Menu> getChildPerms(List<Menu> list, int typeId, String prefix) {
|
||||
/* 88 */ if (list == null)
|
||||
/* */ {
|
||||
/* 90 */ return null;
|
||||
/* */ }
|
||||
/* 92 */ for (Iterator<Menu> iterator = list.iterator(); iterator.hasNext(); ) {
|
||||
/* */
|
||||
/* 94 */ Menu node = iterator.next();
|
||||
/* */
|
||||
/* 96 */ if (node.getParentId().longValue() == typeId)
|
||||
/* */ {
|
||||
/* 98 */ recursionFn(list, node, prefix);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 105 */ return this.returnList;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private void recursionFn(List<Menu> list, Menu node, String p) {
|
||||
/* 111 */ List<Menu> childList = getChildList(list, node);
|
||||
/* 112 */ if (hasChild(list, node)) {
|
||||
/* */
|
||||
/* */
|
||||
/* 115 */ this.returnList.add(node);
|
||||
/* 116 */ Iterator<Menu> it = childList.iterator();
|
||||
/* 117 */ while (it.hasNext())
|
||||
/* */ {
|
||||
/* 119 */ Menu n = it.next();
|
||||
/* 120 */ n.setMenuName(p + n.getMenuName());
|
||||
/* 121 */ recursionFn(list, n, p + p);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ } else {
|
||||
/* */
|
||||
/* 126 */ this.returnList.add(node);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static boolean hasChild(List<Menu> list, Menu t) {
|
||||
/* 135 */ return (getChildList(list, t).size() > 0);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\TreeUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,116 @@
|
||||
/* */ package com.archive.common.utils.bean;
|
||||
/* */
|
||||
/* */ import java.lang.reflect.Method;
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.regex.Matcher;
|
||||
/* */ import java.util.regex.Pattern;
|
||||
/* */ import org.springframework.beans.BeanUtils;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class BeanUtils
|
||||
/* */ extends BeanUtils
|
||||
/* */ {
|
||||
/* */ private static final int BEAN_METHOD_PROP_INDEX = 3;
|
||||
/* 20 */ private static final Pattern GET_PATTERN = Pattern.compile("get(\\p{javaUpperCase}\\w*)");
|
||||
/* */
|
||||
/* */
|
||||
/* 23 */ private static final Pattern SET_PATTERN = Pattern.compile("set(\\p{javaUpperCase}\\w*)");
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void copyBeanProp(Object dest, Object src) {
|
||||
/* */ try {
|
||||
/* 35 */ copyProperties(src, dest);
|
||||
/* */ }
|
||||
/* 37 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 39 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static List<Method> getSetterMethods(Object obj) {
|
||||
/* 52 */ List<Method> setterMethods = new ArrayList<>();
|
||||
/* */
|
||||
/* */
|
||||
/* 55 */ Method[] methods = obj.getClass().getMethods();
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 59 */ for (Method method : methods) {
|
||||
/* */
|
||||
/* 61 */ Matcher m = SET_PATTERN.matcher(method.getName());
|
||||
/* 62 */ if (m.matches() && (method.getParameterTypes()).length == 1)
|
||||
/* */ {
|
||||
/* 64 */ setterMethods.add(method);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* 68 */ return setterMethods;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static List<Method> getGetterMethods(Object obj) {
|
||||
/* 81 */ List<Method> getterMethods = new ArrayList<>();
|
||||
/* */
|
||||
/* 83 */ Method[] methods = obj.getClass().getMethods();
|
||||
/* */
|
||||
/* 85 */ for (Method method : methods) {
|
||||
/* */
|
||||
/* 87 */ Matcher m = GET_PATTERN.matcher(method.getName());
|
||||
/* 88 */ if (m.matches() && (method.getParameterTypes()).length == 0)
|
||||
/* */ {
|
||||
/* 90 */ getterMethods.add(method);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* 94 */ return getterMethods;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isMethodPropEquals(String m1, String m2) {
|
||||
/* 108 */ return m1.substring(3).equals(m2.substring(3));
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\bean\BeanUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,82 @@
|
||||
/* */ package com.archive.common.utils.file;
|
||||
/* */
|
||||
/* */ import java.io.File;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class FileTypeUtils
|
||||
/* */ {
|
||||
/* */ public static String getFileType(File file) {
|
||||
/* 23 */ if (null == file)
|
||||
/* */ {
|
||||
/* 25 */ return "";
|
||||
/* */ }
|
||||
/* 27 */ return getFileType(file.getName());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getFileType(String fileName) {
|
||||
/* 40 */ int separatorIndex = fileName.lastIndexOf(".");
|
||||
/* 41 */ if (separatorIndex < 0)
|
||||
/* */ {
|
||||
/* 43 */ return "";
|
||||
/* */ }
|
||||
/* 45 */ return fileName.substring(separatorIndex + 1).toLowerCase();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getFileExtendName(byte[] photoByte) {
|
||||
/* 56 */ String strFileExtendName = "JPG";
|
||||
/* 57 */ if (photoByte[0] == 71 && photoByte[1] == 73 && photoByte[2] == 70 && photoByte[3] == 56 && (photoByte[4] == 55 || photoByte[4] == 57) && photoByte[5] == 97) {
|
||||
/* */
|
||||
/* */
|
||||
/* 60 */ strFileExtendName = "GIF";
|
||||
/* */ }
|
||||
/* 62 */ else if (photoByte[6] == 74 && photoByte[7] == 70 && photoByte[8] == 73 && photoByte[9] == 70) {
|
||||
/* */
|
||||
/* 64 */ strFileExtendName = "JPG";
|
||||
/* */ }
|
||||
/* 66 */ else if (photoByte[0] == 66 && photoByte[1] == 77) {
|
||||
/* */
|
||||
/* 68 */ strFileExtendName = "BMP";
|
||||
/* */ }
|
||||
/* 70 */ else if (photoByte[1] == 80 && photoByte[2] == 78 && photoByte[3] == 71) {
|
||||
/* */
|
||||
/* 72 */ strFileExtendName = "PNG";
|
||||
/* */ }
|
||||
/* 74 */ return strFileExtendName;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\file\FileTypeUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,241 @@
|
||||
/* */ package com.archive.common.utils.file;
|
||||
/* */
|
||||
/* */ import com.archive.common.exception.file.FileNameLengthLimitExceededException;
|
||||
/* */ import com.archive.common.exception.file.FileSizeLimitExceededException;
|
||||
/* */ import com.archive.common.exception.file.InvalidExtensionException;
|
||||
/* */ import com.archive.common.utils.DateUtils;
|
||||
/* */ import com.archive.common.utils.StringUtils;
|
||||
/* */ import com.archive.common.utils.file.MimeTypeUtils;
|
||||
/* */ import com.archive.common.utils.uuid.IdUtils;
|
||||
/* */ import com.archive.framework.config.ArchiveConfig;
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import org.apache.commons.io.FilenameUtils;
|
||||
/* */ import org.springframework.web.multipart.MultipartFile;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class FileUploadUtils
|
||||
/* */ {
|
||||
/* */ public static final long DEFAULT_MAX_SIZE = 52428800L;
|
||||
/* */ public static final int DEFAULT_FILE_NAME_LENGTH = 100;
|
||||
/* 36 */ private static String defaultBaseDir = ArchiveConfig.getInstance().getProfile();
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void setDefaultBaseDir(String defaultBaseDir) {
|
||||
/* 40 */ com.archive.common.utils.file.FileUploadUtils.defaultBaseDir = defaultBaseDir;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getDefaultBaseDir() {
|
||||
/* 45 */ return defaultBaseDir;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String upload(MultipartFile file) throws IOException {
|
||||
/* */ try {
|
||||
/* 59 */ return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
||||
/* */ }
|
||||
/* 61 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 63 */ throw new IOException(e.getMessage(), e);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String upload(String baseDir, MultipartFile file) throws IOException {
|
||||
/* */ try {
|
||||
/* 79 */ return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
||||
/* */ }
|
||||
/* 81 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 83 */ throw new IOException(e.getMessage(), e);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, InvalidExtensionException {
|
||||
/* 103 */ int fileNamelength = file.getOriginalFilename().length();
|
||||
/* 104 */ if (fileNamelength > 100)
|
||||
/* */ {
|
||||
/* 106 */ throw new FileNameLengthLimitExceededException(100);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 109 */ assertAllowed(file, allowedExtension);
|
||||
/* */
|
||||
/* 111 */ String fileName = extractFilename(file);
|
||||
/* */
|
||||
/* 113 */ File desc = getAbsoluteFile(baseDir, fileName);
|
||||
/* 114 */ file.transferTo(desc);
|
||||
/* 115 */ String pathFileName = getPathFileName(baseDir, fileName);
|
||||
/* 116 */ return pathFileName;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String extractFilename(MultipartFile file) {
|
||||
/* 124 */ String fileName = file.getOriginalFilename();
|
||||
/* 125 */ String extension = getExtension(file);
|
||||
/* 126 */ fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
|
||||
/* 127 */ return fileName;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
|
||||
/* 132 */ File desc = new File(uploadDir + File.separator + fileName);
|
||||
/* */
|
||||
/* 134 */ if (!desc.exists())
|
||||
/* */ {
|
||||
/* 136 */ if (!desc.getParentFile().exists())
|
||||
/* */ {
|
||||
/* 138 */ desc.getParentFile().mkdirs();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 141 */ return desc;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static final String getPathFileName(String uploadDir, String fileName) throws IOException {
|
||||
/* 148 */ String pathFileName = uploadDir + "/" + fileName;
|
||||
/* 149 */ return pathFileName;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final void assertAllowed(MultipartFile file, String[] allowedExtension) throws FileSizeLimitExceededException, InvalidExtensionException {
|
||||
/* 163 */ long size = file.getSize();
|
||||
/* 164 */ if (size > 52428800L)
|
||||
/* */ {
|
||||
/* 166 */ throw new FileSizeLimitExceededException(50L);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 169 */ String fileName = file.getOriginalFilename();
|
||||
/* 170 */ String extension = getExtension(file);
|
||||
/* 171 */ if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
|
||||
/* */
|
||||
/* 173 */ if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
|
||||
/* */ {
|
||||
/* 175 */ throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, fileName);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 178 */ if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
|
||||
/* */ {
|
||||
/* 180 */ throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, fileName);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 183 */ if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
|
||||
/* */ {
|
||||
/* 185 */ throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, fileName);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 188 */ if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION)
|
||||
/* */ {
|
||||
/* 190 */ throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, fileName);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 195 */ throw new InvalidExtensionException(allowedExtension, extension, fileName);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
|
||||
/* 210 */ for (String str : allowedExtension) {
|
||||
/* */
|
||||
/* 212 */ if (str.equalsIgnoreCase(extension))
|
||||
/* */ {
|
||||
/* 214 */ return true;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 217 */ return false;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static final String getExtension(MultipartFile file) {
|
||||
/* 228 */ String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||
/* 229 */ if (StringUtils.isEmpty(extension))
|
||||
/* */ {
|
||||
/* 231 */ extension = MimeTypeUtils.getExtension(file.getContentType());
|
||||
/* */ }
|
||||
/* 233 */ return extension;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\file\FileUploadUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,212 @@
|
||||
/* */ package com.archive.common.utils.file;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.StringUtils;
|
||||
/* */ import com.archive.common.utils.file.FileTypeUtils;
|
||||
/* */ import com.archive.common.utils.file.MimeTypeUtils;
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.io.FileInputStream;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.io.OutputStream;
|
||||
/* */ import java.io.UnsupportedEncodingException;
|
||||
/* */ import java.net.URLEncoder;
|
||||
/* */ import java.nio.charset.StandardCharsets;
|
||||
/* */ import javax.servlet.http.HttpServletRequest;
|
||||
/* */ import javax.servlet.http.HttpServletResponse;
|
||||
/* */ import org.apache.commons.io.FileUtils;
|
||||
/* */ import org.apache.commons.lang3.ArrayUtils;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class FileUtils
|
||||
/* */ extends FileUtils
|
||||
/* */ {
|
||||
/* 23 */ public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void writeBytes(String filePath, OutputStream os) throws IOException {
|
||||
/* 34 */ FileInputStream fis = null;
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 37 */ File file = new File(filePath);
|
||||
/* 38 */ if (!file.exists())
|
||||
/* */ {
|
||||
/* 40 */ if (!(new File(file.getParent())).exists()) {
|
||||
/* 41 */ (new File(file.getParent())).mkdirs();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* 45 */ fis = new FileInputStream(file);
|
||||
/* 46 */ byte[] b = new byte[1024];
|
||||
/* */ int length;
|
||||
/* 48 */ while ((length = fis.read(b)) > 0)
|
||||
/* */ {
|
||||
/* 50 */ os.write(b, 0, length);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 53 */ catch (IOException e) {
|
||||
/* */
|
||||
/* 55 */ throw e;
|
||||
/* */ }
|
||||
/* */ finally {
|
||||
/* */
|
||||
/* 59 */ if (os != null) {
|
||||
/* */
|
||||
/* */ try {
|
||||
/* */
|
||||
/* 63 */ os.close();
|
||||
/* */ }
|
||||
/* 65 */ catch (IOException e1) {
|
||||
/* */
|
||||
/* 67 */ e1.printStackTrace();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 70 */ if (fis != null) {
|
||||
/* */
|
||||
/* */ try {
|
||||
/* */
|
||||
/* 74 */ fis.close();
|
||||
/* */ }
|
||||
/* 76 */ catch (IOException e1) {
|
||||
/* */
|
||||
/* 78 */ e1.printStackTrace();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean deleteFile(String filePath) {
|
||||
/* 92 */ boolean flag = false;
|
||||
/* 93 */ File file = new File(filePath);
|
||||
/* */
|
||||
/* 95 */ if (file.isFile() && file.exists()) {
|
||||
/* */
|
||||
/* 97 */ file.delete();
|
||||
/* 98 */ flag = true;
|
||||
/* */ }
|
||||
/* 100 */ return flag;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean isValidFilename(String filename) {
|
||||
/* 111 */ return filename.matches(FILENAME_PATTERN);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean checkAllowDownload(String resource) {
|
||||
/* 123 */ if (StringUtils.contains(resource, ".."))
|
||||
/* */ {
|
||||
/* 125 */ return false;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 129 */ if (ArrayUtils.contains((Object[])MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource)))
|
||||
/* */ {
|
||||
/* 131 */ return true;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 135 */ return false;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException {
|
||||
/* 147 */ String agent = request.getHeader("USER-AGENT");
|
||||
/* 148 */ String filename = fileName;
|
||||
/* 149 */ if (agent.contains("MSIE")) {
|
||||
/* */
|
||||
/* */
|
||||
/* 152 */ filename = URLEncoder.encode(filename, "utf-8");
|
||||
/* 153 */ filename = filename.replace("+", " ");
|
||||
/* */ }
|
||||
/* 155 */ else if (agent.contains("Firefox")) {
|
||||
/* */
|
||||
/* */
|
||||
/* 158 */ filename = new String(fileName.getBytes(), "ISO8859-1");
|
||||
/* */ }
|
||||
/* 160 */ else if (agent.contains("Chrome")) {
|
||||
/* */
|
||||
/* */
|
||||
/* 163 */ filename = URLEncoder.encode(filename, "utf-8");
|
||||
/* */
|
||||
/* */ }
|
||||
/* */ else {
|
||||
/* */
|
||||
/* 168 */ filename = URLEncoder.encode(filename, "utf-8");
|
||||
/* */ }
|
||||
/* 170 */ return filename;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
|
||||
/* 182 */ String percentEncodedFileName = percentEncode(realFileName);
|
||||
/* */
|
||||
/* 184 */ StringBuilder contentDispositionValue = new StringBuilder();
|
||||
/* 185 */ contentDispositionValue.append("attachment; filename=")
|
||||
/* 186 */ .append(percentEncodedFileName)
|
||||
/* 187 */ .append(";")
|
||||
/* 188 */ .append("filename*=")
|
||||
/* 189 */ .append("utf-8''")
|
||||
/* 190 */ .append(percentEncodedFileName);
|
||||
/* */
|
||||
/* 192 */ response.setHeader("Content-disposition", contentDispositionValue.toString());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String percentEncode(String s) throws UnsupportedEncodingException {
|
||||
/* 203 */ String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
|
||||
/* 204 */ return encode.replaceAll("\\+", "%20");
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\file\FileUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,106 @@
|
||||
/* */ package com.archive.common.utils.file;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.StringUtils;
|
||||
/* */ import com.archive.framework.config.ArchiveConfig;
|
||||
/* */ import java.io.ByteArrayInputStream;
|
||||
/* */ import java.io.ByteArrayOutputStream;
|
||||
/* */ import java.io.FileInputStream;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.net.URLConnection;
|
||||
/* */ import java.util.Arrays;
|
||||
/* */ import org.apache.poi.util.IOUtils;
|
||||
/* */ import org.slf4j.Logger;
|
||||
/* */ import org.slf4j.LoggerFactory;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class ImageUtils
|
||||
/* */ {
|
||||
/* 24 */ private static final Logger log = LoggerFactory.getLogger(com.archive.common.utils.file.ImageUtils.class);
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static byte[] getImage(String imagePath) {
|
||||
/* 28 */ InputStream is = getFile(imagePath);
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 31 */ return IOUtils.toByteArray(is);
|
||||
/* */ }
|
||||
/* 33 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 35 */ log.error("图片加载异常 {}", e);
|
||||
/* 36 */ return null;
|
||||
/* */ }
|
||||
/* */ finally {
|
||||
/* */
|
||||
/* 40 */ IOUtils.closeQuietly(is);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static InputStream getFile(String imagePath) {
|
||||
/* */ try {
|
||||
/* 48 */ byte[] result = readFile(imagePath);
|
||||
/* 49 */ result = Arrays.copyOf(result, result.length);
|
||||
/* 50 */ return new ByteArrayInputStream(result);
|
||||
/* */ }
|
||||
/* 52 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 54 */ log.error("获取图片异常 {}", e);
|
||||
/* */
|
||||
/* 56 */ return null;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static byte[] readFile(String url) {
|
||||
/* 67 */ InputStream in = null;
|
||||
/* 68 */ ByteArrayOutputStream baos = null;
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 71 */ if (url.startsWith("http")) {
|
||||
/* */
|
||||
/* */
|
||||
/* 74 */ URL urlObj = new URL(url);
|
||||
/* 75 */ URLConnection urlConnection = urlObj.openConnection();
|
||||
/* 76 */ urlConnection.setConnectTimeout(30000);
|
||||
/* 77 */ urlConnection.setReadTimeout(60000);
|
||||
/* 78 */ urlConnection.setDoInput(true);
|
||||
/* 79 */ in = urlConnection.getInputStream();
|
||||
/* */
|
||||
/* */ }
|
||||
/* */ else {
|
||||
/* */
|
||||
/* 84 */ String localPath = ArchiveConfig.getInstance().getProfile();
|
||||
/* 85 */ String downloadPath = localPath + StringUtils.substringAfter(url, "/profile");
|
||||
/* 86 */ in = new FileInputStream(downloadPath);
|
||||
/* */ }
|
||||
/* 88 */ return IOUtils.toByteArray(in);
|
||||
/* */ }
|
||||
/* 90 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 92 */ log.error("获取文件路径异常 {}", e);
|
||||
/* 93 */ return null;
|
||||
/* */ }
|
||||
/* */ finally {
|
||||
/* */
|
||||
/* 97 */ IOUtils.closeQuietly(baos);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\file\ImageUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,64 @@
|
||||
/* */ package com.archive.common.utils.file;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class MimeTypeUtils
|
||||
/* */ {
|
||||
/* */ public static final String IMAGE_PNG = "image/png";
|
||||
/* */ public static final String IMAGE_JPG = "image/jpg";
|
||||
/* */ public static final String IMAGE_JPEG = "image/jpeg";
|
||||
/* */ public static final String IMAGE_BMP = "image/bmp";
|
||||
/* */ public static final String IMAGE_GIF = "image/gif";
|
||||
/* 20 */ public static final String[] IMAGE_EXTENSION = new String[] { "bmp", "gif", "jpg", "jpeg", "png" };
|
||||
/* */
|
||||
/* 22 */ public static final String[] FLASH_EXTENSION = new String[] { "swf", "flv" };
|
||||
/* */
|
||||
/* 24 */ public static final String[] MEDIA_EXTENSION = new String[] { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", "asf", "rm", "rmvb" };
|
||||
/* */
|
||||
/* */
|
||||
/* 27 */ public static final String[] VIDEO_EXTENSION = new String[] { "mp4", "avi", "rmvb" };
|
||||
/* */
|
||||
/* 29 */ public static final String[] DEFAULT_ALLOWED_EXTENSION = new String[] { "bmp", "gif", "jpg", "jpeg", "png", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", "rar", "zip", "gz", "bz2", "mp4", "avi", "rmvb", "pdf" };
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getExtension(String prefix) {
|
||||
/* 43 */ switch (prefix) {
|
||||
/* */
|
||||
/* */ case "image/png":
|
||||
/* 46 */ return "png";
|
||||
/* */ case "image/jpg":
|
||||
/* 48 */ return "jpg";
|
||||
/* */ case "image/jpeg":
|
||||
/* 50 */ return "jpeg";
|
||||
/* */ case "image/bmp":
|
||||
/* 52 */ return "bmp";
|
||||
/* */ case "image/gif":
|
||||
/* 54 */ return "gif";
|
||||
/* */ }
|
||||
/* 56 */ return "";
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\file\MimeTypeUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,161 @@
|
||||
/* */ package com.archive.common.utils.html;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.StringUtils;
|
||||
/* */ import com.archive.common.utils.html.HTMLFilter;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class EscapeUtil
|
||||
/* */ {
|
||||
/* */ public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)";
|
||||
/* 14 */ private static final char[][] TEXT = new char[64][];
|
||||
/* */
|
||||
/* */
|
||||
/* */ static {
|
||||
/* 18 */ for (int i = 0; i < 64; i++) {
|
||||
/* */
|
||||
/* 20 */ (new char[1])[0] = (char)i; TEXT[i] = new char[1];
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 24 */ TEXT[39] = "'".toCharArray();
|
||||
/* 25 */ TEXT[34] = """.toCharArray();
|
||||
/* 26 */ TEXT[38] = "&".toCharArray();
|
||||
/* 27 */ TEXT[60] = "<".toCharArray();
|
||||
/* 28 */ TEXT[62] = ">".toCharArray();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String escape(String text) {
|
||||
/* 39 */ return encode(text);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String unescape(String content) {
|
||||
/* 50 */ return decode(content);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String clean(String content) {
|
||||
/* 61 */ return (new HTMLFilter()).filter(content);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static String encode(String text) {
|
||||
/* */ int len;
|
||||
/* 73 */ if (text == null || (len = text.length()) == 0)
|
||||
/* */ {
|
||||
/* 75 */ return "";
|
||||
/* */ }
|
||||
/* 77 */ StringBuilder buffer = new StringBuilder(len + (len >> 2));
|
||||
/* */
|
||||
/* 79 */ for (int i = 0; i < len; i++) {
|
||||
/* */
|
||||
/* 81 */ char c = text.charAt(i);
|
||||
/* 82 */ if (c < '@') {
|
||||
/* */
|
||||
/* 84 */ buffer.append(TEXT[c]);
|
||||
/* */ }
|
||||
/* */ else {
|
||||
/* */
|
||||
/* 88 */ buffer.append(c);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 91 */ return buffer.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String decode(String content) {
|
||||
/* 102 */ if (StringUtils.isEmpty(content))
|
||||
/* */ {
|
||||
/* 104 */ return content;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 107 */ StringBuilder tmp = new StringBuilder(content.length());
|
||||
/* 108 */ int lastPos = 0, pos = 0;
|
||||
/* */
|
||||
/* 110 */ while (lastPos < content.length()) {
|
||||
/* */
|
||||
/* 112 */ pos = content.indexOf("%", lastPos);
|
||||
/* 113 */ if (pos == lastPos) {
|
||||
/* */
|
||||
/* 115 */ if (content.charAt(pos + 1) == 'u') {
|
||||
/* */
|
||||
/* 117 */ char c = (char)Integer.parseInt(content.substring(pos + 2, pos + 6), 16);
|
||||
/* 118 */ tmp.append(c);
|
||||
/* 119 */ lastPos = pos + 6;
|
||||
/* */
|
||||
/* */ continue;
|
||||
/* */ }
|
||||
/* 123 */ char ch = (char)Integer.parseInt(content.substring(pos + 1, pos + 3), 16);
|
||||
/* 124 */ tmp.append(ch);
|
||||
/* 125 */ lastPos = pos + 3;
|
||||
/* */
|
||||
/* */ continue;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 130 */ if (pos == -1) {
|
||||
/* */
|
||||
/* 132 */ tmp.append(content.substring(lastPos));
|
||||
/* 133 */ lastPos = content.length();
|
||||
/* */
|
||||
/* */ continue;
|
||||
/* */ }
|
||||
/* 137 */ tmp.append(content.substring(lastPos, pos));
|
||||
/* 138 */ lastPos = pos;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 142 */ return tmp.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void main(String[] args) {
|
||||
/* 147 */ String html = "<script>alert(1);</script>";
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 151 */ System.out.println(clean(html));
|
||||
/* 152 */ System.out.println(escape(html));
|
||||
/* 153 */ System.out.println(unescape(html));
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\html\EscapeUtil.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,576 @@
|
||||
/* */ package com.archive.common.utils.html;
|
||||
/* */
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.Collections;
|
||||
/* */ import java.util.HashMap;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.Map;
|
||||
/* */ import java.util.concurrent.ConcurrentHashMap;
|
||||
/* */ import java.util.concurrent.ConcurrentMap;
|
||||
/* */ import java.util.regex.Matcher;
|
||||
/* */ import java.util.regex.Pattern;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public final class HTMLFilter
|
||||
/* */ {
|
||||
/* */ private static final int REGEX_FLAGS_SI = 34;
|
||||
/* 24 */ private static final Pattern P_COMMENTS = Pattern.compile("<!--(.*?)-->", 32);
|
||||
/* 25 */ private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", 34);
|
||||
/* 26 */ private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", 32);
|
||||
/* 27 */ private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", 34);
|
||||
/* 28 */ private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", 34);
|
||||
/* 29 */ private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", 34);
|
||||
/* 30 */ private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", 34);
|
||||
/* 31 */ private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", 34);
|
||||
/* 32 */ private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?");
|
||||
/* 33 */ private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?");
|
||||
/* 34 */ private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?");
|
||||
/* 35 */ private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))");
|
||||
/* 36 */ private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", 32);
|
||||
/* 37 */ private static final Pattern P_END_ARROW = Pattern.compile("^>");
|
||||
/* 38 */ private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)");
|
||||
/* 39 */ private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)");
|
||||
/* 40 */ private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)");
|
||||
/* 41 */ private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)");
|
||||
/* 42 */ private static final Pattern P_AMP = Pattern.compile("&");
|
||||
/* 43 */ private static final Pattern P_QUOTE = Pattern.compile("\"");
|
||||
/* 44 */ private static final Pattern P_LEFT_ARROW = Pattern.compile("<");
|
||||
/* 45 */ private static final Pattern P_RIGHT_ARROW = Pattern.compile(">");
|
||||
/* 46 */ private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>");
|
||||
/* */
|
||||
/* */
|
||||
/* 49 */ private static final ConcurrentMap<String, Pattern> P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>();
|
||||
/* 50 */ private static final ConcurrentMap<String, Pattern> P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>();
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final Map<String, List<String>> vAllowed;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 59 */ private final Map<String, Integer> vTagCounts = new HashMap<>();
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final String[] vSelfClosingTags;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final String[] vNeedClosingTags;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final String[] vDisallowed;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final String[] vProtocolAtts;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final String[] vAllowedProtocols;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final String[] vRemoveBlanks;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final String[] vAllowedEntities;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final boolean stripComment;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final boolean encodeQuotes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final boolean alwaysMakeTags;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public HTMLFilter() {
|
||||
/* 105 */ this.vAllowed = new HashMap<>();
|
||||
/* */
|
||||
/* 107 */ ArrayList<String> a_atts = new ArrayList<>();
|
||||
/* 108 */ a_atts.add("href");
|
||||
/* 109 */ a_atts.add("target");
|
||||
/* 110 */ this.vAllowed.put("a", a_atts);
|
||||
/* */
|
||||
/* 112 */ ArrayList<String> img_atts = new ArrayList<>();
|
||||
/* 113 */ img_atts.add("src");
|
||||
/* 114 */ img_atts.add("width");
|
||||
/* 115 */ img_atts.add("height");
|
||||
/* 116 */ img_atts.add("alt");
|
||||
/* 117 */ this.vAllowed.put("img", img_atts);
|
||||
/* */
|
||||
/* 119 */ ArrayList<String> no_atts = new ArrayList<>();
|
||||
/* 120 */ this.vAllowed.put("b", no_atts);
|
||||
/* 121 */ this.vAllowed.put("strong", no_atts);
|
||||
/* 122 */ this.vAllowed.put("i", no_atts);
|
||||
/* 123 */ this.vAllowed.put("em", no_atts);
|
||||
/* */
|
||||
/* 125 */ this.vSelfClosingTags = new String[] { "img" };
|
||||
/* 126 */ this.vNeedClosingTags = new String[] { "a", "b", "strong", "i", "em" };
|
||||
/* 127 */ this.vDisallowed = new String[0];
|
||||
/* 128 */ this.vAllowedProtocols = new String[] { "http", "mailto", "https" };
|
||||
/* 129 */ this.vProtocolAtts = new String[] { "src", "href" };
|
||||
/* 130 */ this.vRemoveBlanks = new String[] { "a", "b", "strong", "i", "em" };
|
||||
/* 131 */ this.vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" };
|
||||
/* 132 */ this.stripComment = true;
|
||||
/* 133 */ this.encodeQuotes = true;
|
||||
/* 134 */ this.alwaysMakeTags = false;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public HTMLFilter(Map<String, Object> conf) {
|
||||
/* 146 */ assert conf.containsKey("vAllowed") : "configuration requires vAllowed";
|
||||
/* 147 */ assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags";
|
||||
/* 148 */ assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags";
|
||||
/* 149 */ assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed";
|
||||
/* 150 */ assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols";
|
||||
/* 151 */ assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts";
|
||||
/* 152 */ assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks";
|
||||
/* 153 */ assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities";
|
||||
/* */
|
||||
/* 155 */ this.vAllowed = Collections.unmodifiableMap((HashMap)conf.get("vAllowed"));
|
||||
/* 156 */ this.vSelfClosingTags = (String[])conf.get("vSelfClosingTags");
|
||||
/* 157 */ this.vNeedClosingTags = (String[])conf.get("vNeedClosingTags");
|
||||
/* 158 */ this.vDisallowed = (String[])conf.get("vDisallowed");
|
||||
/* 159 */ this.vAllowedProtocols = (String[])conf.get("vAllowedProtocols");
|
||||
/* 160 */ this.vProtocolAtts = (String[])conf.get("vProtocolAtts");
|
||||
/* 161 */ this.vRemoveBlanks = (String[])conf.get("vRemoveBlanks");
|
||||
/* 162 */ this.vAllowedEntities = (String[])conf.get("vAllowedEntities");
|
||||
/* 163 */ this.stripComment = conf.containsKey("stripComment") ? ((Boolean)conf.get("stripComment")).booleanValue() : true;
|
||||
/* 164 */ this.encodeQuotes = conf.containsKey("encodeQuotes") ? ((Boolean)conf.get("encodeQuotes")).booleanValue() : true;
|
||||
/* 165 */ this.alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? ((Boolean)conf.get("alwaysMakeTags")).booleanValue() : true;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private void reset() {
|
||||
/* 170 */ this.vTagCounts.clear();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String chr(int decimal) {
|
||||
/* 177 */ return String.valueOf((char)decimal);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String htmlSpecialChars(String s) {
|
||||
/* 182 */ String result = s;
|
||||
/* 183 */ result = regexReplace(P_AMP, "&", result);
|
||||
/* 184 */ result = regexReplace(P_QUOTE, """, result);
|
||||
/* 185 */ result = regexReplace(P_LEFT_ARROW, "<", result);
|
||||
/* 186 */ result = regexReplace(P_RIGHT_ARROW, ">", result);
|
||||
/* 187 */ return result;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String filter(String input) {
|
||||
/* 200 */ reset();
|
||||
/* 201 */ String s = input;
|
||||
/* */
|
||||
/* 203 */ s = escapeComments(s);
|
||||
/* */
|
||||
/* 205 */ s = balanceHTML(s);
|
||||
/* */
|
||||
/* 207 */ s = checkTags(s);
|
||||
/* */
|
||||
/* 209 */ s = processRemoveBlanks(s);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 213 */ return s;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public boolean isAlwaysMakeTags() {
|
||||
/* 218 */ return this.alwaysMakeTags;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public boolean isStripComments() {
|
||||
/* 223 */ return this.stripComment;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String escapeComments(String s) {
|
||||
/* 228 */ Matcher m = P_COMMENTS.matcher(s);
|
||||
/* 229 */ StringBuffer buf = new StringBuffer();
|
||||
/* 230 */ if (m.find()) {
|
||||
/* */
|
||||
/* 232 */ String match = m.group(1);
|
||||
/* 233 */ m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->"));
|
||||
/* */ }
|
||||
/* 235 */ m.appendTail(buf);
|
||||
/* */
|
||||
/* 237 */ return buf.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String balanceHTML(String s) {
|
||||
/* 242 */ if (this.alwaysMakeTags) {
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 247 */ s = regexReplace(P_END_ARROW, "", s);
|
||||
/* */
|
||||
/* 249 */ s = regexReplace(P_BODY_TO_END, "<$1>", s);
|
||||
/* 250 */ s = regexReplace(P_XML_CONTENT, "$1<$2", s);
|
||||
/* */
|
||||
/* */
|
||||
/* */ }
|
||||
/* */ else {
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 258 */ s = regexReplace(P_STRAY_LEFT_ARROW, "<$1", s);
|
||||
/* 259 */ s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2><", s);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 266 */ s = regexReplace(P_BOTH_ARROWS, "", s);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 269 */ return s;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String checkTags(String s) {
|
||||
/* 274 */ Matcher m = P_TAGS.matcher(s);
|
||||
/* */
|
||||
/* 276 */ StringBuffer buf = new StringBuffer();
|
||||
/* 277 */ while (m.find()) {
|
||||
/* */
|
||||
/* 279 */ String replaceStr = m.group(1);
|
||||
/* 280 */ replaceStr = processTag(replaceStr);
|
||||
/* 281 */ m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr));
|
||||
/* */ }
|
||||
/* 283 */ m.appendTail(buf);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 287 */ StringBuilder sBuilder = new StringBuilder(buf.toString());
|
||||
/* 288 */ for (String key : this.vTagCounts.keySet()) {
|
||||
/* */
|
||||
/* 290 */ for (int ii = 0; ii < ((Integer)this.vTagCounts.get(key)).intValue(); ii++)
|
||||
/* */ {
|
||||
/* 292 */ sBuilder.append("</").append(key).append(">");
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 295 */ s = sBuilder.toString();
|
||||
/* */
|
||||
/* 297 */ return s;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String processRemoveBlanks(String s) {
|
||||
/* 302 */ String result = s;
|
||||
/* 303 */ for (String tag : this.vRemoveBlanks) {
|
||||
/* */
|
||||
/* 305 */ if (!P_REMOVE_PAIR_BLANKS.containsKey(tag))
|
||||
/* */ {
|
||||
/* 307 */ P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?></" + tag + ">"));
|
||||
/* */ }
|
||||
/* 309 */ result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result);
|
||||
/* 310 */ if (!P_REMOVE_SELF_BLANKS.containsKey(tag))
|
||||
/* */ {
|
||||
/* 312 */ P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>"));
|
||||
/* */ }
|
||||
/* 314 */ result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 317 */ return result;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static String regexReplace(Pattern regex_pattern, String replacement, String s) {
|
||||
/* 322 */ Matcher m = regex_pattern.matcher(s);
|
||||
/* 323 */ return m.replaceAll(replacement);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String processTag(String s) {
|
||||
/* 329 */ Matcher m = P_END_TAG.matcher(s);
|
||||
/* 330 */ if (m.find()) {
|
||||
/* */
|
||||
/* 332 */ String name = m.group(1).toLowerCase();
|
||||
/* 333 */ if (allowed(name))
|
||||
/* */ {
|
||||
/* 335 */ if (false == inArray(name, this.vSelfClosingTags))
|
||||
/* */ {
|
||||
/* 337 */ if (this.vTagCounts.containsKey(name)) {
|
||||
/* */
|
||||
/* 339 */ this.vTagCounts.put(name, Integer.valueOf(((Integer)this.vTagCounts.get(name)).intValue() - 1));
|
||||
/* 340 */ return "</" + name + ">";
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 347 */ m = P_START_TAG.matcher(s);
|
||||
/* 348 */ if (m.find()) {
|
||||
/* */
|
||||
/* 350 */ String name = m.group(1).toLowerCase();
|
||||
/* 351 */ String body = m.group(2);
|
||||
/* 352 */ String ending = m.group(3);
|
||||
/* */
|
||||
/* */
|
||||
/* 355 */ if (allowed(name)) {
|
||||
/* */
|
||||
/* 357 */ StringBuilder params = new StringBuilder();
|
||||
/* */
|
||||
/* 359 */ Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body);
|
||||
/* 360 */ Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body);
|
||||
/* 361 */ List<String> paramNames = new ArrayList<>();
|
||||
/* 362 */ List<String> paramValues = new ArrayList<>();
|
||||
/* 363 */ while (m2.find()) {
|
||||
/* */
|
||||
/* 365 */ paramNames.add(m2.group(1));
|
||||
/* 366 */ paramValues.add(m2.group(3));
|
||||
/* */ }
|
||||
/* 368 */ while (m3.find()) {
|
||||
/* */
|
||||
/* 370 */ paramNames.add(m3.group(1));
|
||||
/* 371 */ paramValues.add(m3.group(3));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 375 */ for (int ii = 0; ii < paramNames.size(); ii++) {
|
||||
/* */
|
||||
/* 377 */ String paramName = ((String)paramNames.get(ii)).toLowerCase();
|
||||
/* 378 */ String paramValue = paramValues.get(ii);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 384 */ if (allowedAttribute(name, paramName)) {
|
||||
/* */
|
||||
/* 386 */ if (inArray(paramName, this.vProtocolAtts))
|
||||
/* */ {
|
||||
/* 388 */ paramValue = processParamProtocol(paramValue);
|
||||
/* */ }
|
||||
/* 390 */ params.append(' ').append(paramName).append("=\"").append(paramValue).append("\"");
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* 394 */ if (inArray(name, this.vSelfClosingTags))
|
||||
/* */ {
|
||||
/* 396 */ ending = " /";
|
||||
/* */ }
|
||||
/* */
|
||||
/* 399 */ if (inArray(name, this.vNeedClosingTags))
|
||||
/* */ {
|
||||
/* 401 */ ending = "";
|
||||
/* */ }
|
||||
/* */
|
||||
/* 404 */ if (ending == null || ending.length() < 1) {
|
||||
/* */
|
||||
/* 406 */ if (this.vTagCounts.containsKey(name))
|
||||
/* */ {
|
||||
/* 408 */ this.vTagCounts.put(name, Integer.valueOf(((Integer)this.vTagCounts.get(name)).intValue() + 1));
|
||||
/* */ }
|
||||
/* */ else
|
||||
/* */ {
|
||||
/* 412 */ this.vTagCounts.put(name, Integer.valueOf(1));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ } else {
|
||||
/* */
|
||||
/* 417 */ ending = " /";
|
||||
/* */ }
|
||||
/* 419 */ return "<" + name + params + ending + ">";
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 423 */ return "";
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 428 */ m = P_COMMENT.matcher(s);
|
||||
/* 429 */ if (!this.stripComment && m.find())
|
||||
/* */ {
|
||||
/* 431 */ return "<" + m.group() + ">";
|
||||
/* */ }
|
||||
/* */
|
||||
/* 434 */ return "";
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String processParamProtocol(String s) {
|
||||
/* 439 */ s = decodeEntities(s);
|
||||
/* 440 */ Matcher m = P_PROTOCOL.matcher(s);
|
||||
/* 441 */ if (m.find()) {
|
||||
/* */
|
||||
/* 443 */ String protocol = m.group(1);
|
||||
/* 444 */ if (!inArray(protocol, this.vAllowedProtocols)) {
|
||||
/* */
|
||||
/* */
|
||||
/* 447 */ s = "#" + s.substring(protocol.length() + 1);
|
||||
/* 448 */ if (s.startsWith("#//"))
|
||||
/* */ {
|
||||
/* 450 */ s = "#" + s.substring(3);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* 455 */ return s;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String decodeEntities(String s) {
|
||||
/* 460 */ StringBuffer buf = new StringBuffer();
|
||||
/* */
|
||||
/* 462 */ Matcher m = P_ENTITY.matcher(s);
|
||||
/* 463 */ while (m.find()) {
|
||||
/* */
|
||||
/* 465 */ String match = m.group(1);
|
||||
/* 466 */ int decimal = Integer.decode(match).intValue();
|
||||
/* 467 */ m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
|
||||
/* */ }
|
||||
/* 469 */ m.appendTail(buf);
|
||||
/* 470 */ s = buf.toString();
|
||||
/* */
|
||||
/* 472 */ buf = new StringBuffer();
|
||||
/* 473 */ m = P_ENTITY_UNICODE.matcher(s);
|
||||
/* 474 */ while (m.find()) {
|
||||
/* */
|
||||
/* 476 */ String match = m.group(1);
|
||||
/* 477 */ int decimal = Integer.valueOf(match, 16).intValue();
|
||||
/* 478 */ m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
|
||||
/* */ }
|
||||
/* 480 */ m.appendTail(buf);
|
||||
/* 481 */ s = buf.toString();
|
||||
/* */
|
||||
/* 483 */ buf = new StringBuffer();
|
||||
/* 484 */ m = P_ENCODE.matcher(s);
|
||||
/* 485 */ while (m.find()) {
|
||||
/* */
|
||||
/* 487 */ String match = m.group(1);
|
||||
/* 488 */ int decimal = Integer.valueOf(match, 16).intValue();
|
||||
/* 489 */ m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
|
||||
/* */ }
|
||||
/* 491 */ m.appendTail(buf);
|
||||
/* 492 */ s = buf.toString();
|
||||
/* */
|
||||
/* 494 */ s = validateEntities(s);
|
||||
/* 495 */ return s;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String validateEntities(String s) {
|
||||
/* 500 */ StringBuffer buf = new StringBuffer();
|
||||
/* */
|
||||
/* */
|
||||
/* 503 */ Matcher m = P_VALID_ENTITIES.matcher(s);
|
||||
/* 504 */ while (m.find()) {
|
||||
/* */
|
||||
/* 506 */ String one = m.group(1);
|
||||
/* 507 */ String two = m.group(2);
|
||||
/* 508 */ m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two)));
|
||||
/* */ }
|
||||
/* 510 */ m.appendTail(buf);
|
||||
/* */
|
||||
/* 512 */ return encodeQuotes(buf.toString());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String encodeQuotes(String s) {
|
||||
/* 517 */ if (this.encodeQuotes) {
|
||||
/* */
|
||||
/* 519 */ StringBuffer buf = new StringBuffer();
|
||||
/* 520 */ Matcher m = P_VALID_QUOTES.matcher(s);
|
||||
/* 521 */ while (m.find()) {
|
||||
/* */
|
||||
/* 523 */ String one = m.group(1);
|
||||
/* 524 */ String two = m.group(2);
|
||||
/* 525 */ String three = m.group(3);
|
||||
/* */
|
||||
/* 527 */ m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three));
|
||||
/* */ }
|
||||
/* 529 */ m.appendTail(buf);
|
||||
/* 530 */ return buf.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 534 */ return s;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String checkEntity(String preamble, String term) {
|
||||
/* 541 */ return (";".equals(term) && isValidEntity(preamble)) ? ('&' + preamble) : ("&" + preamble);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private boolean isValidEntity(String entity) {
|
||||
/* 546 */ return inArray(entity, this.vAllowedEntities);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static boolean inArray(String s, String[] array) {
|
||||
/* 551 */ for (String item : array) {
|
||||
/* */
|
||||
/* 553 */ if (item != null && item.equals(s))
|
||||
/* */ {
|
||||
/* 555 */ return true;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 558 */ return false;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private boolean allowed(String name) {
|
||||
/* 563 */ return ((this.vAllowed.isEmpty() || this.vAllowed.containsKey(name)) && !inArray(name, this.vDisallowed));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private boolean allowedAttribute(String name, String paramName) {
|
||||
/* 568 */ return (allowed(name) && (this.vAllowed.isEmpty() || ((List)this.vAllowed.get(name)).contains(paramName)));
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\html\HTMLFilter.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,7 @@
|
||||
package com.archive.common.utils.http;
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\http\HttpUtils$1.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,267 @@
|
||||
/* */ package com.archive.common.utils.http;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.http.HttpUtils;
|
||||
/* */ import javax.net.ssl.HostnameVerifier;
|
||||
/* */ import javax.net.ssl.SSLSession;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ class TrustAnyHostnameVerifier
|
||||
/* */ implements HostnameVerifier
|
||||
/* */ {
|
||||
/* */ private TrustAnyHostnameVerifier() {}
|
||||
/* */
|
||||
/* */ public boolean verify(String hostname, SSLSession session) {
|
||||
/* 259 */ return true;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\http\HttpUtils$TrustAnyHostnameVerifier.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,258 @@
|
||||
/* */ package com.archive.common.utils.http;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.http.HttpUtils;
|
||||
/* */ import java.security.cert.X509Certificate;
|
||||
/* */ import javax.net.ssl.X509TrustManager;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ class TrustAnyTrustManager
|
||||
/* */ implements X509TrustManager
|
||||
/* */ {
|
||||
/* */ private TrustAnyTrustManager() {}
|
||||
/* */
|
||||
/* */ public void checkClientTrusted(X509Certificate[] chain, String authType) {}
|
||||
/* */
|
||||
/* */ public void checkServerTrusted(X509Certificate[] chain, String authType) {}
|
||||
/* */
|
||||
/* */ public X509Certificate[] getAcceptedIssuers() {
|
||||
/* 250 */ return new X509Certificate[0];
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\http\HttpUtils$TrustAnyTrustManager.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,289 @@
|
||||
/* */ package com.archive.common.utils.http;
|
||||
/* */
|
||||
/* */ import java.io.BufferedReader;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */ import java.io.InputStreamReader;
|
||||
/* */ import java.io.PrintWriter;
|
||||
/* */ import java.net.ConnectException;
|
||||
/* */ import java.net.SocketTimeoutException;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.net.URLConnection;
|
||||
/* */ import java.security.SecureRandom;
|
||||
/* */ import javax.net.ssl.HostnameVerifier;
|
||||
/* */ import javax.net.ssl.HttpsURLConnection;
|
||||
/* */ import javax.net.ssl.SSLContext;
|
||||
/* */ import javax.net.ssl.TrustManager;
|
||||
/* */ import org.slf4j.Logger;
|
||||
/* */ import org.slf4j.LoggerFactory;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class HttpUtils
|
||||
/* */ {
|
||||
/* 30 */ private static final Logger log = LoggerFactory.getLogger(com.archive.common.utils.http.HttpUtils.class);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String sendGet(String url, String param) {
|
||||
/* 41 */ return sendGet(url, param, "UTF-8");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String sendGet(String url, String param, String contentType) {
|
||||
/* 54 */ StringBuilder result = new StringBuilder();
|
||||
/* 55 */ BufferedReader in = null;
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 58 */ String urlNameString = url + "?" + param;
|
||||
/* 59 */ log.info("sendGet - {}", urlNameString);
|
||||
/* 60 */ URL realUrl = new URL(urlNameString);
|
||||
/* 61 */ URLConnection connection = realUrl.openConnection();
|
||||
/* 62 */ connection.setRequestProperty("accept", "*/*");
|
||||
/* 63 */ connection.setRequestProperty("connection", "Keep-Alive");
|
||||
/* 64 */ connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
/* 65 */ connection.connect();
|
||||
/* 66 */ in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
|
||||
/* */ String line;
|
||||
/* 68 */ while ((line = in.readLine()) != null)
|
||||
/* */ {
|
||||
/* 70 */ result.append(line);
|
||||
/* */ }
|
||||
/* 72 */ log.info("recv - {}", result);
|
||||
/* */ }
|
||||
/* 74 */ catch (ConnectException e) {
|
||||
/* */
|
||||
/* 76 */ log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e);
|
||||
/* */ }
|
||||
/* 78 */ catch (SocketTimeoutException e) {
|
||||
/* */
|
||||
/* 80 */ log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e);
|
||||
/* */ }
|
||||
/* 82 */ catch (IOException e) {
|
||||
/* */
|
||||
/* 84 */ log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e);
|
||||
/* */ }
|
||||
/* 86 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 88 */ log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e);
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* */
|
||||
/* */ try {
|
||||
/* */
|
||||
/* 94 */ if (in != null)
|
||||
/* */ {
|
||||
/* 96 */ in.close();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 99 */ catch (Exception ex) {
|
||||
/* */
|
||||
/* 101 */ log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 104 */ return result.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String sendPost(String url, String param) {
|
||||
/* 116 */ PrintWriter out = null;
|
||||
/* 117 */ BufferedReader in = null;
|
||||
/* 118 */ StringBuilder result = new StringBuilder();
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 121 */ String urlNameString = url;
|
||||
/* 122 */ log.info("sendPost - {}", urlNameString);
|
||||
/* 123 */ URL realUrl = new URL(urlNameString);
|
||||
/* 124 */ URLConnection conn = realUrl.openConnection();
|
||||
/* 125 */ conn.setRequestProperty("accept", "*/*");
|
||||
/* 126 */ conn.setRequestProperty("connection", "Keep-Alive");
|
||||
/* 127 */ conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
/* 128 */ conn.setRequestProperty("Accept-Charset", "utf-8");
|
||||
/* 129 */ conn.setRequestProperty("contentType", "utf-8");
|
||||
/* 130 */ conn.setDoOutput(true);
|
||||
/* 131 */ conn.setDoInput(true);
|
||||
/* 132 */ out = new PrintWriter(conn.getOutputStream());
|
||||
/* 133 */ out.print(param);
|
||||
/* 134 */ out.flush();
|
||||
/* 135 */ in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
|
||||
/* */ String line;
|
||||
/* 137 */ while ((line = in.readLine()) != null)
|
||||
/* */ {
|
||||
/* 139 */ result.append(line);
|
||||
/* */ }
|
||||
/* 141 */ log.info("recv - {}", result);
|
||||
/* */ }
|
||||
/* 143 */ catch (ConnectException e) {
|
||||
/* */
|
||||
/* 145 */ log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e);
|
||||
/* */ }
|
||||
/* 147 */ catch (SocketTimeoutException e) {
|
||||
/* */
|
||||
/* 149 */ log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e);
|
||||
/* */ }
|
||||
/* 151 */ catch (IOException e) {
|
||||
/* */
|
||||
/* 153 */ log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e);
|
||||
/* */ }
|
||||
/* 155 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 157 */ log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e);
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* */
|
||||
/* */ try {
|
||||
/* */
|
||||
/* 163 */ if (out != null)
|
||||
/* */ {
|
||||
/* 165 */ out.close();
|
||||
/* */ }
|
||||
/* 167 */ if (in != null)
|
||||
/* */ {
|
||||
/* 169 */ in.close();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 172 */ catch (IOException ex) {
|
||||
/* */
|
||||
/* 174 */ log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 177 */ return result.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String sendSSLPost(String url, String param) {
|
||||
/* 182 */ StringBuilder result = new StringBuilder();
|
||||
/* 183 */ String urlNameString = url + "?" + param;
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 186 */ log.info("sendSSLPost - {}", urlNameString);
|
||||
/* 187 */ SSLContext sc = SSLContext.getInstance("SSL");
|
||||
/* 188 */ sc.init(null, new TrustManager[] { (TrustManager)new TrustAnyTrustManager(null) }, new SecureRandom());
|
||||
/* 189 */ URL console = new URL(urlNameString);
|
||||
/* 190 */ HttpsURLConnection conn = (HttpsURLConnection)console.openConnection();
|
||||
/* 191 */ conn.setRequestProperty("accept", "*/*");
|
||||
/* 192 */ conn.setRequestProperty("connection", "Keep-Alive");
|
||||
/* 193 */ conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
/* 194 */ conn.setRequestProperty("Accept-Charset", "utf-8");
|
||||
/* 195 */ conn.setRequestProperty("contentType", "utf-8");
|
||||
/* 196 */ conn.setDoOutput(true);
|
||||
/* 197 */ conn.setDoInput(true);
|
||||
/* */
|
||||
/* 199 */ conn.setSSLSocketFactory(sc.getSocketFactory());
|
||||
/* 200 */ conn.setHostnameVerifier((HostnameVerifier)new TrustAnyHostnameVerifier(null));
|
||||
/* 201 */ conn.connect();
|
||||
/* 202 */ InputStream is = conn.getInputStream();
|
||||
/* 203 */ BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
/* 204 */ String ret = "";
|
||||
/* 205 */ while ((ret = br.readLine()) != null) {
|
||||
/* */
|
||||
/* 207 */ if (ret != null && !ret.trim().equals(""))
|
||||
/* */ {
|
||||
/* 209 */ result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8"));
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 212 */ log.info("recv - {}", result);
|
||||
/* 213 */ conn.disconnect();
|
||||
/* 214 */ br.close();
|
||||
/* */ }
|
||||
/* 216 */ catch (ConnectException e) {
|
||||
/* */
|
||||
/* 218 */ log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e);
|
||||
/* */ }
|
||||
/* 220 */ catch (SocketTimeoutException e) {
|
||||
/* */
|
||||
/* 222 */ log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e);
|
||||
/* */ }
|
||||
/* 224 */ catch (IOException e) {
|
||||
/* */
|
||||
/* 226 */ log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e);
|
||||
/* */ }
|
||||
/* 228 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 230 */ log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e);
|
||||
/* */ }
|
||||
/* 232 */ return result.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static boolean urlWhetherReachable(String urlString, int timeOutMillSeconds) {
|
||||
/* 270 */ boolean flag = true;
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 273 */ URL url = new URL(urlString);
|
||||
/* 274 */ URLConnection co = url.openConnection();
|
||||
/* 275 */ co.setConnectTimeout(timeOutMillSeconds);
|
||||
/* 276 */ co.connect();
|
||||
/* 277 */ } catch (Exception e1) {
|
||||
/* 278 */ System.out.println(urlString + "连接请求超时!");
|
||||
/* 279 */ flag = false;
|
||||
/* */ }
|
||||
/* 281 */ return flag;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\http\HttpUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,416 @@
|
||||
/* */ package com.archive.common.utils.reflect;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.DateUtils;
|
||||
/* */ import com.archive.common.utils.text.Convert;
|
||||
/* */ import java.lang.reflect.Field;
|
||||
/* */ import java.lang.reflect.InvocationTargetException;
|
||||
/* */ import java.lang.reflect.Method;
|
||||
/* */ import java.lang.reflect.Modifier;
|
||||
/* */ import java.lang.reflect.ParameterizedType;
|
||||
/* */ import java.lang.reflect.Type;
|
||||
/* */ import java.util.Date;
|
||||
/* */ import org.apache.commons.lang3.StringUtils;
|
||||
/* */ import org.apache.commons.lang3.Validate;
|
||||
/* */ import org.apache.poi.ss.usermodel.DateUtil;
|
||||
/* */ import org.slf4j.Logger;
|
||||
/* */ import org.slf4j.LoggerFactory;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class ReflectUtils
|
||||
/* */ {
|
||||
/* */ private static final String SETTER_PREFIX = "set";
|
||||
/* */ private static final String GETTER_PREFIX = "get";
|
||||
/* */ private static final String CGLIB_CLASS_SEPARATOR = "$$";
|
||||
/* 32 */ private static Logger logger = LoggerFactory.getLogger(com.archive.common.utils.reflect.ReflectUtils.class);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static <E> E invokeGetter(Object obj, String propertyName) {
|
||||
/* 41 */ Object object = obj;
|
||||
/* 42 */ for (String name : StringUtils.split(propertyName, ".")) {
|
||||
/* */
|
||||
/* 44 */ String getterMethodName = "get" + StringUtils.capitalize(name);
|
||||
/* 45 */ object = invokeMethod(object, getterMethodName, new Class[0], new Object[0]);
|
||||
/* */ }
|
||||
/* 47 */ return (E)object;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static <E> void invokeSetter(Object obj, String propertyName, E value) {
|
||||
/* 56 */ Object object = obj;
|
||||
/* 57 */ String[] names = StringUtils.split(propertyName, ".");
|
||||
/* 58 */ for (int i = 0; i < names.length; i++) {
|
||||
/* */
|
||||
/* 60 */ if (i < names.length - 1) {
|
||||
/* */
|
||||
/* 62 */ String getterMethodName = "get" + StringUtils.capitalize(names[i]);
|
||||
/* 63 */ object = invokeMethod(object, getterMethodName, new Class[0], new Object[0]);
|
||||
/* */ }
|
||||
/* */ else {
|
||||
/* */
|
||||
/* 67 */ String setterMethodName = "set" + StringUtils.capitalize(names[i]);
|
||||
/* 68 */ invokeMethodByName(object, setterMethodName, new Object[] { value });
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static <E> E getFieldValue(Object obj, String fieldName) {
|
||||
/* 79 */ Field field = getAccessibleField(obj, fieldName);
|
||||
/* 80 */ if (field == null) {
|
||||
/* */
|
||||
/* 82 */ logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
|
||||
/* 83 */ return null;
|
||||
/* */ }
|
||||
/* 85 */ E result = null;
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 88 */ result = (E)field.get(obj);
|
||||
/* */ }
|
||||
/* 90 */ catch (IllegalAccessException e) {
|
||||
/* */
|
||||
/* 92 */ logger.error("不可能抛出的异常{}", e.getMessage());
|
||||
/* */ }
|
||||
/* 94 */ return result;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static <E> void setFieldValue(Object obj, String fieldName, E value) {
|
||||
/* 102 */ Field field = getAccessibleField(obj, fieldName);
|
||||
/* 103 */ if (field == null) {
|
||||
/* */
|
||||
/* */
|
||||
/* 106 */ logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
|
||||
/* */
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* */ try {
|
||||
/* 111 */ field.set(obj, value);
|
||||
/* */ }
|
||||
/* 113 */ catch (IllegalAccessException e) {
|
||||
/* */
|
||||
/* 115 */ logger.error("不可能抛出的异常: {}", e.getMessage());
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static <E> E invokeMethod(Object obj, String methodName, Class<?>[] parameterTypes, Object[] args) {
|
||||
/* 128 */ if (obj == null || methodName == null)
|
||||
/* */ {
|
||||
/* 130 */ return null;
|
||||
/* */ }
|
||||
/* 132 */ Method method = getAccessibleMethod(obj, methodName, parameterTypes);
|
||||
/* 133 */ if (method == null) {
|
||||
/* */
|
||||
/* 135 */ logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
|
||||
/* 136 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 140 */ return (E)method.invoke(obj, args);
|
||||
/* */ }
|
||||
/* 142 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 144 */ String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
|
||||
/* 145 */ throw convertReflectionExceptionToUnchecked(msg, e);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static <E> E invokeMethodByName(Object obj, String methodName, Object[] args) {
|
||||
/* 157 */ Method method = getAccessibleMethodByName(obj, methodName, args.length);
|
||||
/* 158 */ if (method == null) {
|
||||
/* */
|
||||
/* */
|
||||
/* 161 */ logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
|
||||
/* 162 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 167 */ Class<?>[] cs = method.getParameterTypes();
|
||||
/* 168 */ for (int i = 0; i < cs.length; i++) {
|
||||
/* */
|
||||
/* 170 */ if (args[i] != null && !args[i].getClass().equals(cs[i]))
|
||||
/* */ {
|
||||
/* 172 */ if (cs[i] == String.class) {
|
||||
/* */
|
||||
/* 174 */ args[i] = Convert.toStr(args[i]);
|
||||
/* 175 */ if (StringUtils.endsWith((String)args[i], ".0"))
|
||||
/* */ {
|
||||
/* 177 */ args[i] = StringUtils.substringBefore((String)args[i], ".0");
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 180 */ else if (cs[i] == Integer.class) {
|
||||
/* */
|
||||
/* 182 */ args[i] = Convert.toInt(args[i]);
|
||||
/* */ }
|
||||
/* 184 */ else if (cs[i] == Long.class) {
|
||||
/* */
|
||||
/* 186 */ args[i] = Convert.toLong(args[i]);
|
||||
/* */ }
|
||||
/* 188 */ else if (cs[i] == Double.class) {
|
||||
/* */
|
||||
/* 190 */ args[i] = Convert.toDouble(args[i]);
|
||||
/* */ }
|
||||
/* 192 */ else if (cs[i] == Float.class) {
|
||||
/* */
|
||||
/* 194 */ args[i] = Convert.toFloat(args[i]);
|
||||
/* */ }
|
||||
/* 196 */ else if (cs[i] == Date.class) {
|
||||
/* */
|
||||
/* 198 */ if (args[i] instanceof String)
|
||||
/* */ {
|
||||
/* 200 */ args[i] = DateUtils.parseDate(args[i]);
|
||||
/* */ }
|
||||
/* */ else
|
||||
/* */ {
|
||||
/* 204 */ args[i] = DateUtil.getJavaDate(((Double)args[i]).doubleValue());
|
||||
/* */ }
|
||||
/* */
|
||||
/* 207 */ } else if (cs[i] == boolean.class || cs[i] == Boolean.class) {
|
||||
/* */
|
||||
/* 209 */ args[i] = Convert.toBool(args[i]);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 213 */ return (E)method.invoke(obj, args);
|
||||
/* */ }
|
||||
/* 215 */ catch (Exception e) {
|
||||
/* */
|
||||
/* 217 */ String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
|
||||
/* 218 */ throw convertReflectionExceptionToUnchecked(msg, e);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Field getAccessibleField(Object obj, String fieldName) {
|
||||
/* 229 */ if (obj == null)
|
||||
/* */ {
|
||||
/* 231 */ return null;
|
||||
/* */ }
|
||||
/* 233 */ Validate.notBlank(fieldName, "fieldName can't be blank", new Object[0]);
|
||||
/* 234 */ for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) {
|
||||
/* */
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 238 */ Field field = superClass.getDeclaredField(fieldName);
|
||||
/* 239 */ makeAccessible(field);
|
||||
/* 240 */ return field;
|
||||
/* */ }
|
||||
/* 242 */ catch (NoSuchFieldException e) {}
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 247 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Method getAccessibleMethod(Object obj, String methodName, Class<?>... parameterTypes) {
|
||||
/* 260 */ if (obj == null)
|
||||
/* */ {
|
||||
/* 262 */ return null;
|
||||
/* */ }
|
||||
/* 264 */ Validate.notBlank(methodName, "methodName can't be blank", new Object[0]);
|
||||
/* 265 */ for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) {
|
||||
/* */
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 269 */ Method method = searchType.getDeclaredMethod(methodName, parameterTypes);
|
||||
/* 270 */ makeAccessible(method);
|
||||
/* 271 */ return method;
|
||||
/* */ }
|
||||
/* 273 */ catch (NoSuchMethodException e) {}
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 278 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Method getAccessibleMethodByName(Object obj, String methodName, int argsNum) {
|
||||
/* 290 */ if (obj == null)
|
||||
/* */ {
|
||||
/* 292 */ return null;
|
||||
/* */ }
|
||||
/* 294 */ Validate.notBlank(methodName, "methodName can't be blank", new Object[0]);
|
||||
/* 295 */ for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) {
|
||||
/* */
|
||||
/* 297 */ Method[] methods = searchType.getDeclaredMethods();
|
||||
/* 298 */ for (Method method : methods) {
|
||||
/* */
|
||||
/* 300 */ if (method.getName().equals(methodName) && (method.getParameterTypes()).length == argsNum) {
|
||||
/* */
|
||||
/* 302 */ makeAccessible(method);
|
||||
/* 303 */ return method;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 307 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void makeAccessible(Method method) {
|
||||
/* 315 */ if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers())) &&
|
||||
/* 316 */ !method.isAccessible())
|
||||
/* */ {
|
||||
/* 318 */ method.setAccessible(true);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void makeAccessible(Field field) {
|
||||
/* 327 */ if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) ||
|
||||
/* 328 */ Modifier.isFinal(field.getModifiers())) && !field.isAccessible())
|
||||
/* */ {
|
||||
/* 330 */ field.setAccessible(true);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static <T> Class<T> getClassGenricType(Class clazz) {
|
||||
/* 341 */ return getClassGenricType(clazz, 0);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Class getClassGenricType(Class clazz, int index) {
|
||||
/* 350 */ Type genType = clazz.getGenericSuperclass();
|
||||
/* */
|
||||
/* 352 */ if (!(genType instanceof ParameterizedType)) {
|
||||
/* */
|
||||
/* 354 */ logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType");
|
||||
/* 355 */ return Object.class;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 358 */ Type[] params = ((ParameterizedType)genType).getActualTypeArguments();
|
||||
/* */
|
||||
/* 360 */ if (index >= params.length || index < 0) {
|
||||
/* */
|
||||
/* 362 */ logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " + params.length);
|
||||
/* */
|
||||
/* 364 */ return Object.class;
|
||||
/* */ }
|
||||
/* 366 */ if (!(params[index] instanceof Class)) {
|
||||
/* */
|
||||
/* 368 */ logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
|
||||
/* 369 */ return Object.class;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 372 */ return (Class)params[index];
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static Class<?> getUserClass(Object instance) {
|
||||
/* 377 */ if (instance == null)
|
||||
/* */ {
|
||||
/* 379 */ throw new RuntimeException("Instance must not be null");
|
||||
/* */ }
|
||||
/* 381 */ Class<?> clazz = instance.getClass();
|
||||
/* 382 */ if (clazz != null && clazz.getName().contains("$$")) {
|
||||
/* */
|
||||
/* 384 */ Class<?> superClass = clazz.getSuperclass();
|
||||
/* 385 */ if (superClass != null && !Object.class.equals(superClass))
|
||||
/* */ {
|
||||
/* 387 */ return superClass;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 390 */ return clazz;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e) {
|
||||
/* 399 */ if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException || e instanceof NoSuchMethodException)
|
||||
/* */ {
|
||||
/* */
|
||||
/* 402 */ return new IllegalArgumentException(msg, e);
|
||||
/* */ }
|
||||
/* 404 */ if (e instanceof InvocationTargetException)
|
||||
/* */ {
|
||||
/* 406 */ return new RuntimeException(msg, ((InvocationTargetException)e).getTargetException());
|
||||
/* */ }
|
||||
/* 408 */ return new RuntimeException(msg, e);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\reflect\ReflectUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,36 @@
|
||||
/* */ package com.archive.common.utils.security;
|
||||
/* */
|
||||
/* */ import com.archive.framework.shiro.realm.UserRealm;
|
||||
/* */ import org.apache.shiro.SecurityUtils;
|
||||
/* */ import org.apache.shiro.mgt.RealmSecurityManager;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class AuthorizationUtils
|
||||
/* */ {
|
||||
/* */ public static void clearAllCachedAuthorizationInfo() {
|
||||
/* 19 */ getUserRealm().clearAllCachedAuthorizationInfo();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static UserRealm getUserRealm() {
|
||||
/* 27 */ RealmSecurityManager rsm = (RealmSecurityManager)SecurityUtils.getSecurityManager();
|
||||
/* 28 */ return rsm.getRealms().iterator().next();
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\security\AuthorizationUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -0,0 +1,83 @@
|
||||
/* */ package com.archive.common.utils.security;
|
||||
/* */
|
||||
/* */ import com.archive.common.utils.MessageUtils;
|
||||
/* */ import org.apache.commons.lang3.StringUtils;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class PermissionUtils
|
||||
/* */ {
|
||||
/* */ public static final String VIEW_PERMISSION = "no.view.permission";
|
||||
/* */ public static final String CREATE_PERMISSION = "no.create.permission";
|
||||
/* */ public static final String UPDATE_PERMISSION = "no.update.permission";
|
||||
/* */ public static final String DELETE_PERMISSION = "no.delete.permission";
|
||||
/* */ public static final String EXPORT_PERMISSION = "no.export.permission";
|
||||
/* */ public static final String PERMISSION = "no.permission";
|
||||
/* */
|
||||
/* */ public static String getMsg(String permissionsStr) {
|
||||
/* 52 */ String permission = StringUtils.substringBetween(permissionsStr, "[", "]");
|
||||
/* 53 */ String msg = MessageUtils.message("no.permission", new Object[] { permission });
|
||||
/* 54 */ if (StringUtils.endsWithIgnoreCase(permission, "add")) {
|
||||
/* */
|
||||
/* 56 */ msg = MessageUtils.message("no.create.permission", new Object[] { permission });
|
||||
/* */ }
|
||||
/* 58 */ else if (StringUtils.endsWithIgnoreCase(permission, "edit")) {
|
||||
/* */
|
||||
/* 60 */ msg = MessageUtils.message("no.update.permission", new Object[] { permission });
|
||||
/* */ }
|
||||
/* 62 */ else if (StringUtils.endsWithIgnoreCase(permission, "remove")) {
|
||||
/* */
|
||||
/* 64 */ msg = MessageUtils.message("no.delete.permission", new Object[] { permission });
|
||||
/* */ }
|
||||
/* 66 */ else if (StringUtils.endsWithIgnoreCase(permission, "export")) {
|
||||
/* */
|
||||
/* 68 */ msg = MessageUtils.message("no.export.permission", new Object[] { permission });
|
||||
/* */ }
|
||||
/* 70 */ else if (StringUtils.endsWithAny(permission, (CharSequence[])new String[] { "view", "list" })) {
|
||||
/* */
|
||||
/* */
|
||||
/* 73 */ msg = MessageUtils.message("no.view.permission", new Object[] { permission });
|
||||
/* */ }
|
||||
/* 75 */ return msg;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\security\PermissionUtils.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue