parent
e6270b3d00
commit
38f6ea2a37
@ -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,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% |
@ -0,0 +1,102 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-parent</artifactId> |
||||||
|
<version>2.4.5</version> |
||||||
|
<relativePath/> <!-- lookup parent from repository --> |
||||||
|
</parent> |
||||||
|
<groupId>com.cjy</groupId> |
||||||
|
<artifactId>fieldservice</artifactId> |
||||||
|
<version>0.0.1-SNAPSHOT</version> |
||||||
|
<packaging>jar</packaging> |
||||||
|
<name>fieldservice</name> |
||||||
|
<description>Demo project for Spring Boot</description> |
||||||
|
<properties> |
||||||
|
<java.version>1.8</java.version> |
||||||
|
</properties> |
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||||
|
<exclusions> |
||||||
|
<exclusion> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-logging</artifactId> |
||||||
|
</exclusion> |
||||||
|
</exclusions> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.microsoft.sqlserver</groupId> |
||||||
|
<artifactId>mssql-jdbc</artifactId> |
||||||
|
<version>6.2.0.jre8</version> |
||||||
|
<scope>runtime</scope> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId> |
||||||
|
<scope>provided</scope> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-test</artifactId> |
||||||
|
<scope>test</scope> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.alibaba</groupId> |
||||||
|
<artifactId>fastjson</artifactId> |
||||||
|
<version>1.2.68</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>commons-httpclient</groupId> |
||||||
|
<artifactId>commons-httpclient</artifactId> |
||||||
|
<version>3.1</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.httpcomponents</groupId> |
||||||
|
<artifactId>httpclient</artifactId> |
||||||
|
<version>4.4.1</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.httpcomponents</groupId> |
||||||
|
<artifactId>httpcore</artifactId> |
||||||
|
<version>4.4.1</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.httpcomponents</groupId> |
||||||
|
<artifactId>httpmime</artifactId> |
||||||
|
<version>4.4.1</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-log4j</artifactId> |
||||||
|
<version>1.3.8.RELEASE</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.xmlunit</groupId> |
||||||
|
<artifactId>xmlunit-core</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId> |
||||||
|
<version>1.3.2</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
</dependencies> |
||||||
|
|
||||||
|
<build> |
||||||
|
<plugins> |
||||||
|
<plugin> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||||
|
</plugin> |
||||||
|
</plugins> |
||||||
|
</build> |
||||||
|
|
||||||
|
</project> |
@ -0,0 +1,15 @@ |
|||||||
|
package com.cjy.fieldservice; |
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication; |
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling; |
||||||
|
|
||||||
|
@SpringBootApplication(scanBasePackages = "com.cjy.fieldservice") |
||||||
|
@EnableScheduling |
||||||
|
public class FieldserviceApplication { |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
SpringApplication.run(FieldserviceApplication.class, args); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.cjy.fieldservice; |
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder; |
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
||||||
|
|
||||||
|
public class ServletInitializer extends SpringBootServletInitializer { |
||||||
|
|
||||||
|
@Override |
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
||||||
|
return application.sources(FieldserviceApplication.class); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
package com.cjy.fieldservice.common.utils; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.time.format.DateTimeFormatter; |
||||||
|
import java.util.Random; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author liangjiawei |
||||||
|
* @createDate 2023/7/27 |
||||||
|
*/ |
||||||
|
public class AppointmentNumberUtil { |
||||||
|
public static String generateOrderNumber() { |
||||||
|
// 获取当前时间
|
||||||
|
LocalDateTime currentTime = LocalDateTime.now(); |
||||||
|
|
||||||
|
// 定义日期时间格式
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
||||||
|
|
||||||
|
// 格式化当前时间为字符串
|
||||||
|
String timestamp = currentTime.format(formatter); |
||||||
|
|
||||||
|
// 生成随机数
|
||||||
|
Random random = new Random(); |
||||||
|
String randomDigits = String.format("%04d", random.nextInt(10000)); |
||||||
|
|
||||||
|
// 拼接单号
|
||||||
|
String orderNumber = timestamp + randomDigits; |
||||||
|
|
||||||
|
return orderNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
System.out.println(AppointmentNumberUtil.generateOrderNumber()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,340 @@ |
|||||||
|
package com.cjy.fieldservice.common.utils; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.lang.management.ManagementFactory; |
||||||
|
import java.text.ParseException; |
||||||
|
import java.text.SimpleDateFormat; |
||||||
|
import java.time.*; |
||||||
|
import java.time.format.DateTimeFormatter; |
||||||
|
import java.time.temporal.ChronoUnit; |
||||||
|
import java.util.Calendar; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* 时间工具类 |
||||||
|
* |
||||||
|
* @author ruoyi |
||||||
|
*/ |
||||||
|
public class DateUtils { |
||||||
|
public static String YYYY = "yyyy"; |
||||||
|
|
||||||
|
public static String YYYY_MM = "yyyy-MM"; |
||||||
|
|
||||||
|
public static String YYYY_MM_DD = "yyyy-MM-dd"; |
||||||
|
|
||||||
|
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; |
||||||
|
|
||||||
|
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; |
||||||
|
|
||||||
|
private static String[] parsePatterns = { |
||||||
|
"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"}; |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取当前Date型日期 |
||||||
|
* |
||||||
|
* @return Date() 当前日期 |
||||||
|
*/ |
||||||
|
public static Date getNowDate() { |
||||||
|
return new Date(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取当前日期, 默认格式为yyyy-MM-dd |
||||||
|
* |
||||||
|
* @return String |
||||||
|
*/ |
||||||
|
public static String getDate() { |
||||||
|
return dateTimeNow(YYYY_MM_DD); |
||||||
|
} |
||||||
|
|
||||||
|
public static final String getTime() { |
||||||
|
return dateTimeNow(YYYY_MM_DD_HH_MM_SS); |
||||||
|
} |
||||||
|
|
||||||
|
public static final String dateTimeNow() { |
||||||
|
return dateTimeNow(YYYYMMDDHHMMSS); |
||||||
|
} |
||||||
|
|
||||||
|
public static final String dateTimeNow(final String format) { |
||||||
|
return parseDateToStr(format, new Date()); |
||||||
|
} |
||||||
|
|
||||||
|
public static final String dateTime(final Date date) { |
||||||
|
return parseDateToStr(YYYY_MM_DD, date); |
||||||
|
} |
||||||
|
|
||||||
|
public static final String parseDateToStr(final String format, final Date date) { |
||||||
|
return new SimpleDateFormat(format).format(date); |
||||||
|
} |
||||||
|
|
||||||
|
public static final Date dateTime(final String format, final String ts) { |
||||||
|
try { |
||||||
|
return new SimpleDateFormat(format).parse(ts); |
||||||
|
} catch (ParseException e) { |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取服务器启动时间 |
||||||
|
*/ |
||||||
|
public static Date getServerStartDate() { |
||||||
|
long time = ManagementFactory.getRuntimeMXBean().getStartTime(); |
||||||
|
return new Date(time); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算相差天数 |
||||||
|
*/ |
||||||
|
public static int differentDaysByMillisecond(Date date1, Date date2) { |
||||||
|
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算两个时间差 |
||||||
|
*/ |
||||||
|
public static String getDatePoor(Date endDate, Date nowDate) { |
||||||
|
long nd = 1000 * 24 * 60 * 60; |
||||||
|
long nh = 1000 * 60 * 60; |
||||||
|
long nm = 1000 * 60; |
||||||
|
// long ns = 1000;
|
||||||
|
// 获得两个时间的毫秒时间差异
|
||||||
|
long diff = endDate.getTime() - nowDate.getTime(); |
||||||
|
// 计算差多少天
|
||||||
|
long day = diff / nd; |
||||||
|
// 计算差多少小时
|
||||||
|
long hour = diff % nd / nh; |
||||||
|
// 计算差多少分钟
|
||||||
|
long min = diff % nd % nh / nm; |
||||||
|
// 计算差多少秒//输出结果
|
||||||
|
// long sec = diff % nd % nh % nm / ns;
|
||||||
|
return day + "天" + hour + "小时" + min + "分钟"; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 增加 LocalDateTime ==> Date |
||||||
|
*/ |
||||||
|
public static Date toDate(LocalDateTime temporalAccessor) { |
||||||
|
ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); |
||||||
|
return Date.from(zdt.toInstant()); |
||||||
|
} |
||||||
|
|
||||||
|
public static Long getDifferHour(Date startDate, Date endDate) { |
||||||
|
long hourM = 1000 * 60 * 60; |
||||||
|
long differ = endDate.getTime() - startDate.getTime(); |
||||||
|
int hour = (int) (differ / hourM); |
||||||
|
return Long.parseLong(String.valueOf(hour)); |
||||||
|
} |
||||||
|
|
||||||
|
// public static void main(String[] args) throws ParseException {
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// System.out.println(getDifferHour(sdf.parse("2023-03-9 00:00:00"),sdf.parse("2023-03-10 00:00:00")));
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** |
||||||
|
* 增加 LocalDate ==> Date |
||||||
|
*/ |
||||||
|
public static Date toDate(LocalDate temporalAccessor) { |
||||||
|
LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); |
||||||
|
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); |
||||||
|
return Date.from(zdt.toInstant()); |
||||||
|
} |
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// System.out.println(dateDiff("2023-3-21 21:00:00","2023-3-22 02:00:00","yyyy-MM-dd HH:mm:ss","hour"));
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** |
||||||
|
* 计算2个时间相差的天数、小时、分钟、秒 |
||||||
|
* |
||||||
|
* @param startTime 开始时间 |
||||||
|
* @param endTime 截止时间 |
||||||
|
* @param format 时间格式 yyyy-MM-dd HH:mm:ss |
||||||
|
* @param str 返回的数据为:day-天、hour-小时、min-分钟、second-秒 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static Long dateDiff(String startTime, String endTime, String format, String str) { |
||||||
|
// 按照传入的格式生成一个simpledateformate对象
|
||||||
|
SimpleDateFormat sd = new SimpleDateFormat(format); |
||||||
|
long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
|
||||||
|
long nh = 1000 * 60 * 60;// 一小时的毫秒数
|
||||||
|
long nm = 1000 * 60;// 一分钟的毫秒数
|
||||||
|
long ns = 1000;// 一秒钟的毫秒数
|
||||||
|
long diff; |
||||||
|
long day = 0; |
||||||
|
long hour = 0; |
||||||
|
long min = 0; |
||||||
|
long second = 0; |
||||||
|
// 获得两个时间的毫秒时间差异
|
||||||
|
try { |
||||||
|
diff = sd.parse(endTime).getTime() - sd.parse(startTime).getTime(); |
||||||
|
// 计算差多少天
|
||||||
|
day = diff / nd; |
||||||
|
// 计算差多少小时
|
||||||
|
hour = diff / nh; |
||||||
|
// 计算差多少分钟
|
||||||
|
min = diff / nm; |
||||||
|
// 计算差多少秒
|
||||||
|
second = diff / ns; |
||||||
|
// 输出结果
|
||||||
|
System.out.println("时间相差:" + day + "天" + |
||||||
|
(hour - day * 24) + "小时" |
||||||
|
+ (min - day * 24 * 60) + "分钟" + |
||||||
|
second + "秒。"); |
||||||
|
/*System.out.println("hour=" + hour + ",min=" + min);*/ |
||||||
|
} catch (ParseException e) { |
||||||
|
|
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
if (str.equalsIgnoreCase("day")) { |
||||||
|
return day; |
||||||
|
} else if (str.equalsIgnoreCase("hour")) { |
||||||
|
return hour; |
||||||
|
} else if (str.equalsIgnoreCase("min")) { |
||||||
|
return min; |
||||||
|
} else { |
||||||
|
return second; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static Long getDifferenceDays(String startDate, String endDate) { |
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
||||||
|
try { |
||||||
|
Date date1 = sdf.parse(startDate); |
||||||
|
Date date2 = sdf.parse(endDate); |
||||||
|
|
||||||
|
Calendar cal1 = Calendar.getInstance(); |
||||||
|
cal1.setTime(date1); |
||||||
|
|
||||||
|
Calendar cal2 = Calendar.getInstance(); |
||||||
|
cal2.setTime(date2); |
||||||
|
|
||||||
|
Long days = 0L; |
||||||
|
Long hours = 0L; |
||||||
|
|
||||||
|
while (cal1.before(cal2)) { |
||||||
|
cal1.add(Calendar.HOUR_OF_DAY, 1); |
||||||
|
|
||||||
|
if (cal1.get(Calendar.HOUR_OF_DAY) == 0) { |
||||||
|
days++; |
||||||
|
} |
||||||
|
hours++; |
||||||
|
} |
||||||
|
System.out.println("Days between " + startDate + " and " + endDate + ": " + days); |
||||||
|
System.out.println("Hours between " + startDate + " and " + endDate + ": " + hours); |
||||||
|
return days; |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
return 0L; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static String getMonthTimeToString(int month) { |
||||||
|
Date date = new Date(); |
||||||
|
Calendar calendar = Calendar.getInstance(); |
||||||
|
calendar.setTime(date); |
||||||
|
calendar.add(Calendar.MONTH, month); |
||||||
|
date = calendar.getTime(); |
||||||
|
String defaultStartDate = new SimpleDateFormat("yyyy-MM").format(date); |
||||||
|
return defaultStartDate; |
||||||
|
} |
||||||
|
|
||||||
|
public static String getDaysTimeToString(int day) { |
||||||
|
Date date = new Date(); |
||||||
|
Calendar calendar = Calendar.getInstance(); |
||||||
|
calendar.setTime(date); |
||||||
|
calendar.add(Calendar.DATE, day); |
||||||
|
date = calendar.getTime(); |
||||||
|
String defaultStartDate = new SimpleDateFormat("yyyy-MM-dd").format(date); |
||||||
|
return defaultStartDate; |
||||||
|
} |
||||||
|
|
||||||
|
public static Date getDaysTime(int day) { |
||||||
|
Calendar calendar = Calendar.getInstance(); |
||||||
|
calendar.add(Calendar.DATE, day); |
||||||
|
return calendar.getTime(); |
||||||
|
} |
||||||
|
|
||||||
|
// 获取当前小时的n小时前的时间
|
||||||
|
public static String getNHoursAgo(int n) { |
||||||
|
LocalDateTime now = LocalDateTime.now(); |
||||||
|
LocalDateTime nHoursAgo = now.minusHours(n).withMinute(0).withSecond(0); |
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:00"); |
||||||
|
return nHoursAgo.format(formatter); |
||||||
|
} |
||||||
|
|
||||||
|
public static Date getHourBeforeCurrentTime() { |
||||||
|
// 获取当前时间
|
||||||
|
Calendar calendar = Calendar.getInstance(); |
||||||
|
// 将时间向前调整一个小时
|
||||||
|
calendar.add(Calendar.HOUR_OF_DAY, 0); |
||||||
|
Date previousHour = calendar.getTime(); |
||||||
|
// 定义日期时间格式
|
||||||
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:00:00"); |
||||||
|
|
||||||
|
// 格式化前一个小时的时间
|
||||||
|
String formattedPreviousHour = formatter.format(previousHour); |
||||||
|
|
||||||
|
SimpleDateFormat newFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
||||||
|
Date date = new Date(); |
||||||
|
try { |
||||||
|
date = newFormatter.parse(formattedPreviousHour); |
||||||
|
System.out.println("Parsed date: " + date); |
||||||
|
} catch (ParseException e) { |
||||||
|
System.out.println("Failed to parse date: " + e.getMessage()); |
||||||
|
} |
||||||
|
return date; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public static String getPreviousYearMonthUsingCalendar() { |
||||||
|
Calendar calendar = Calendar.getInstance(); |
||||||
|
calendar.add(Calendar.MONTH, -1); |
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM"); |
||||||
|
return dateFormat.format(calendar.getTime()); |
||||||
|
} |
||||||
|
public static int getPreviousYearUsingCalendar() { |
||||||
|
Calendar calendar = Calendar.getInstance(); |
||||||
|
calendar.add(Calendar.YEAR, -1); |
||||||
|
return calendar.get(Calendar.YEAR); |
||||||
|
} |
||||||
|
public static boolean isDateEqual(String targetDateString) { |
||||||
|
LocalDateTime currentDateTime = LocalDateTime.now(); |
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
||||||
|
LocalDateTime targetDateTime = LocalDateTime.parse(targetDateString, formatter); |
||||||
|
|
||||||
|
LocalDate currentDate = currentDateTime.toLocalDate(); |
||||||
|
LocalDate targetDate = targetDateTime.toLocalDate(); |
||||||
|
|
||||||
|
return currentDate.isEqual(targetDate); |
||||||
|
} |
||||||
|
public static void main(String[] args) { |
||||||
|
|
||||||
|
System.out.println(getNMinutesAgo(5)); |
||||||
|
System.out.println(getNMinutesAgo(0)); |
||||||
|
|
||||||
|
|
||||||
|
String startTime = DateUtils.getNHoursAgo(1); |
||||||
|
String endTime = DateUtils.getNHoursAgo(0); |
||||||
|
System.out.println(startTime); |
||||||
|
System.out.println(endTime); |
||||||
|
|
||||||
|
} |
||||||
|
public static String getNMinutesAgo(int n) { |
||||||
|
LocalDateTime now = LocalDateTime.now(); |
||||||
|
LocalDateTime nMinutesAgo = now.minusMinutes(n); |
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm"); |
||||||
|
return nMinutesAgo.format(formatter); |
||||||
|
} |
||||||
|
|
||||||
|
public static String addSeconds(LocalDateTime dateTime, long seconds) { |
||||||
|
LocalDateTime futureDateTime = dateTime.plus(seconds, ChronoUnit.SECONDS); |
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
||||||
|
return futureDateTime.format(formatter); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,72 @@ |
|||||||
|
package com.cjy.fieldservice.common.utils; |
||||||
|
|
||||||
|
|
||||||
|
import java.io.BufferedReader; |
||||||
|
import java.io.InputStreamReader; |
||||||
|
import java.io.OutputStream; |
||||||
|
import java.net.HttpURLConnection; |
||||||
|
import java.net.URL; |
||||||
|
import java.nio.charset.Charset; |
||||||
|
|
||||||
|
/** |
||||||
|
* HTTP请求工具类,用于处理HTTP请求 |
||||||
|
* |
||||||
|
* @author GZF |
||||||
|
*/ |
||||||
|
public class HttpUtil { |
||||||
|
|
||||||
|
/** |
||||||
|
* 连接超时 |
||||||
|
*/ |
||||||
|
private static int TIME_OUT = 5000; |
||||||
|
|
||||||
|
/** |
||||||
|
* 读取数据超时 |
||||||
|
*/ |
||||||
|
private static int READ_OUT = 10000; |
||||||
|
|
||||||
|
/** |
||||||
|
* 请求编码 |
||||||
|
*/ |
||||||
|
private static String ENCODING = "UTF-8"; |
||||||
|
|
||||||
|
|
||||||
|
public static String sendPostJson(String url, String jsonParams) { |
||||||
|
try { |
||||||
|
URL obj = new URL(url); |
||||||
|
HttpURLConnection con = (HttpURLConnection) obj.openConnection(); |
||||||
|
con.setRequestMethod("POST"); |
||||||
|
con.setDoOutput(true); |
||||||
|
con.setRequestProperty("Content-Type", "application/json"); |
||||||
|
|
||||||
|
OutputStream os = con.getOutputStream(); |
||||||
|
|
||||||
|
os.write(jsonParams.getBytes("UTF-8")); // 设置编码为UTF-8
|
||||||
|
os.flush(); |
||||||
|
os.close(); |
||||||
|
|
||||||
|
os.flush(); |
||||||
|
os.close(); |
||||||
|
|
||||||
|
int responseCode = con.getResponseCode(); |
||||||
|
if (responseCode == HttpURLConnection.HTTP_OK) { |
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), Charset.forName("UTF-8"))); |
||||||
|
String inputLine; |
||||||
|
StringBuilder response = new StringBuilder(); |
||||||
|
while ((inputLine = in.readLine()) != null) { |
||||||
|
response.append(inputLine); |
||||||
|
} |
||||||
|
|
||||||
|
in.close(); |
||||||
|
System.out.println("response " + response.toString()); |
||||||
|
return response.toString(); |
||||||
|
} else { |
||||||
|
System.out.println("Error occurred. Response code: " + responseCode); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package com.cjy.fieldservice.sys.dao; |
||||||
|
|
||||||
|
|
||||||
|
import com.cjy.fieldservice.sys.entity.CarParkData; |
||||||
|
import com.cjy.fieldservice.sys.entity.InParkRecords; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author liangjiawei |
||||||
|
* @createDate 2023/8/17 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SynchronousDataTaskDao { |
||||||
|
List<CarParkData> getCarParkData(@Param("startTime") String startTime, @Param("endTime") String endTime); |
||||||
|
List<InParkRecords> getAdmissionData(@Param("startTime") String startTime, @Param("endTime") String endTime); |
||||||
|
} |
@ -0,0 +1,440 @@ |
|||||||
|
package com.cjy.fieldservice.sys.entity; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author liangjiawei |
||||||
|
* @createDate 2023/8/17 |
||||||
|
*/ |
||||||
|
public class CarParkData { |
||||||
|
private String id; |
||||||
|
private String inWay; |
||||||
|
private String plateNumber; |
||||||
|
private String authType; |
||||||
|
private String plateType; |
||||||
|
private String plateColor; |
||||||
|
private String inParkTime; |
||||||
|
private String inParkControlName; |
||||||
|
private String inParkControlNumber; |
||||||
|
private String inParkUserName; |
||||||
|
private String inParkControlImageName; |
||||||
|
private String chargeStandardId; |
||||||
|
private String personName; |
||||||
|
private String inParkRemark; |
||||||
|
private String inParkTime2; |
||||||
|
private String inParkControlName2; |
||||||
|
private String inParkControlNumber2; |
||||||
|
private String inParkUserName2; |
||||||
|
private String inParkControlImageName2; |
||||||
|
private String chargeStandardId2; |
||||||
|
private String outParkTime2; |
||||||
|
private String outParkControlName2; |
||||||
|
private String outParkControlNumber2; |
||||||
|
private String outParkUserName2; |
||||||
|
private String outParkControlImageName2; |
||||||
|
private String outParkTime; |
||||||
|
private String outParkControlName; |
||||||
|
private String outParkControlNumber; |
||||||
|
private String outParkUserName; |
||||||
|
private String outParkControlImageName; |
||||||
|
private String receiveMoney; |
||||||
|
private String freeMoney; |
||||||
|
private String nowPayMoney; |
||||||
|
private String prePayMoney; |
||||||
|
private String parkHourStr; |
||||||
|
private String parkHourMinutes; |
||||||
|
private String plateState; |
||||||
|
private String chargeTime; |
||||||
|
private String noLicenceUserId; |
||||||
|
private String freeRemark; |
||||||
|
private String inParkID; |
||||||
|
private String creditsMoney; |
||||||
|
private String credits_origin_desc; |
||||||
|
private String upload_yun; |
||||||
|
private String upload_third; |
||||||
|
private String cardNumber; |
||||||
|
private String balanceMoney; |
||||||
|
private String chargeType; |
||||||
|
|
||||||
|
public String getId() { |
||||||
|
return id; |
||||||
|
} |
||||||
|
|
||||||
|
public void setId(String id) { |
||||||
|
this.id = id; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInWay() { |
||||||
|
return inWay; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInWay(String inWay) { |
||||||
|
this.inWay = inWay; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlateNumber() { |
||||||
|
return plateNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPlateNumber(String plateNumber) { |
||||||
|
this.plateNumber = plateNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public String getAuthType() { |
||||||
|
return authType; |
||||||
|
} |
||||||
|
|
||||||
|
public void setAuthType(String authType) { |
||||||
|
this.authType = authType; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlateType() { |
||||||
|
return plateType; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPlateType(String plateType) { |
||||||
|
this.plateType = plateType; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlateColor() { |
||||||
|
return plateColor; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPlateColor(String plateColor) { |
||||||
|
this.plateColor = plateColor; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkTime() { |
||||||
|
return inParkTime; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkTime(String inParkTime) { |
||||||
|
this.inParkTime = inParkTime; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlName() { |
||||||
|
return inParkControlName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlName(String inParkControlName) { |
||||||
|
this.inParkControlName = inParkControlName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlNumber() { |
||||||
|
return inParkControlNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlNumber(String inParkControlNumber) { |
||||||
|
this.inParkControlNumber = inParkControlNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkUserName() { |
||||||
|
return inParkUserName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkUserName(String inParkUserName) { |
||||||
|
this.inParkUserName = inParkUserName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlImageName() { |
||||||
|
return inParkControlImageName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlImageName(String inParkControlImageName) { |
||||||
|
this.inParkControlImageName = inParkControlImageName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChargeStandardId() { |
||||||
|
return chargeStandardId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setChargeStandardId(String chargeStandardId) { |
||||||
|
this.chargeStandardId = chargeStandardId; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPersonName() { |
||||||
|
return personName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPersonName(String personName) { |
||||||
|
this.personName = personName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkRemark() { |
||||||
|
return inParkRemark; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkRemark(String inParkRemark) { |
||||||
|
this.inParkRemark = inParkRemark; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkTime2() { |
||||||
|
return inParkTime2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkTime2(String inParkTime2) { |
||||||
|
this.inParkTime2 = inParkTime2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlName2() { |
||||||
|
return inParkControlName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlName2(String inParkControlName2) { |
||||||
|
this.inParkControlName2 = inParkControlName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlNumber2() { |
||||||
|
return inParkControlNumber2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlNumber2(String inParkControlNumber2) { |
||||||
|
this.inParkControlNumber2 = inParkControlNumber2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkUserName2() { |
||||||
|
return inParkUserName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkUserName2(String inParkUserName2) { |
||||||
|
this.inParkUserName2 = inParkUserName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlImageName2() { |
||||||
|
return inParkControlImageName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlImageName2(String inParkControlImageName2) { |
||||||
|
this.inParkControlImageName2 = inParkControlImageName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChargeStandardId2() { |
||||||
|
return chargeStandardId2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setChargeStandardId2(String chargeStandardId2) { |
||||||
|
this.chargeStandardId2 = chargeStandardId2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkTime2() { |
||||||
|
return outParkTime2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkTime2(String outParkTime2) { |
||||||
|
this.outParkTime2 = outParkTime2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkControlName2() { |
||||||
|
return outParkControlName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkControlName2(String outParkControlName2) { |
||||||
|
this.outParkControlName2 = outParkControlName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkControlNumber2() { |
||||||
|
return outParkControlNumber2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkControlNumber2(String outParkControlNumber2) { |
||||||
|
this.outParkControlNumber2 = outParkControlNumber2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkUserName2() { |
||||||
|
return outParkUserName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkUserName2(String outParkUserName2) { |
||||||
|
this.outParkUserName2 = outParkUserName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkControlImageName2() { |
||||||
|
return outParkControlImageName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkControlImageName2(String outParkControlImageName2) { |
||||||
|
this.outParkControlImageName2 = outParkControlImageName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkTime() { |
||||||
|
return outParkTime; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkTime(String outParkTime) { |
||||||
|
this.outParkTime = outParkTime; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkControlName() { |
||||||
|
return outParkControlName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkControlName(String outParkControlName) { |
||||||
|
this.outParkControlName = outParkControlName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkControlNumber() { |
||||||
|
return outParkControlNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkControlNumber(String outParkControlNumber) { |
||||||
|
this.outParkControlNumber = outParkControlNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkUserName() { |
||||||
|
return outParkUserName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkUserName(String outParkUserName) { |
||||||
|
this.outParkUserName = outParkUserName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkControlImageName() { |
||||||
|
return outParkControlImageName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkControlImageName(String outParkControlImageName) { |
||||||
|
this.outParkControlImageName = outParkControlImageName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getReceiveMoney() { |
||||||
|
return receiveMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setReceiveMoney(String receiveMoney) { |
||||||
|
this.receiveMoney = receiveMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getFreeMoney() { |
||||||
|
return freeMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setFreeMoney(String freeMoney) { |
||||||
|
this.freeMoney = freeMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getNowPayMoney() { |
||||||
|
return nowPayMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setNowPayMoney(String nowPayMoney) { |
||||||
|
this.nowPayMoney = nowPayMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPrePayMoney() { |
||||||
|
return prePayMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPrePayMoney(String prePayMoney) { |
||||||
|
this.prePayMoney = prePayMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getParkHourStr() { |
||||||
|
return parkHourStr; |
||||||
|
} |
||||||
|
|
||||||
|
public void setParkHourStr(String parkHourStr) { |
||||||
|
this.parkHourStr = parkHourStr; |
||||||
|
} |
||||||
|
|
||||||
|
public String getParkHourMinutes() { |
||||||
|
return parkHourMinutes; |
||||||
|
} |
||||||
|
|
||||||
|
public void setParkHourMinutes(String parkHourMinutes) { |
||||||
|
this.parkHourMinutes = parkHourMinutes; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlateState() { |
||||||
|
return plateState; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPlateState(String plateState) { |
||||||
|
this.plateState = plateState; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChargeTime() { |
||||||
|
return chargeTime; |
||||||
|
} |
||||||
|
|
||||||
|
public void setChargeTime(String chargeTime) { |
||||||
|
this.chargeTime = chargeTime; |
||||||
|
} |
||||||
|
|
||||||
|
public String getNoLicenceUserId() { |
||||||
|
return noLicenceUserId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setNoLicenceUserId(String noLicenceUserId) { |
||||||
|
this.noLicenceUserId = noLicenceUserId; |
||||||
|
} |
||||||
|
|
||||||
|
public String getFreeRemark() { |
||||||
|
return freeRemark; |
||||||
|
} |
||||||
|
|
||||||
|
public void setFreeRemark(String freeRemark) { |
||||||
|
this.freeRemark = freeRemark; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkID() { |
||||||
|
return inParkID; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkID(String inParkID) { |
||||||
|
this.inParkID = inParkID; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCreditsMoney() { |
||||||
|
return creditsMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCreditsMoney(String creditsMoney) { |
||||||
|
this.creditsMoney = creditsMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCredits_origin_desc() { |
||||||
|
return credits_origin_desc; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCredits_origin_desc(String credits_origin_desc) { |
||||||
|
this.credits_origin_desc = credits_origin_desc; |
||||||
|
} |
||||||
|
|
||||||
|
public String getUpload_yun() { |
||||||
|
return upload_yun; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUpload_yun(String upload_yun) { |
||||||
|
this.upload_yun = upload_yun; |
||||||
|
} |
||||||
|
|
||||||
|
public String getUpload_third() { |
||||||
|
return upload_third; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUpload_third(String upload_third) { |
||||||
|
this.upload_third = upload_third; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCardNumber() { |
||||||
|
return cardNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCardNumber(String cardNumber) { |
||||||
|
this.cardNumber = cardNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public String getBalanceMoney() { |
||||||
|
return balanceMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setBalanceMoney(String balanceMoney) { |
||||||
|
this.balanceMoney = balanceMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChargeType() { |
||||||
|
return chargeType; |
||||||
|
} |
||||||
|
|
||||||
|
public void setChargeType(String chargeType) { |
||||||
|
this.chargeType = chargeType; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,377 @@ |
|||||||
|
package com.cjy.fieldservice.sys.entity; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author liangjiawei |
||||||
|
* @createDate 2023/8/18 |
||||||
|
*/ |
||||||
|
public class InParkRecords { |
||||||
|
private String id; |
||||||
|
private String inWay; |
||||||
|
private String plateNumber; |
||||||
|
private String authType; |
||||||
|
private String plateType; |
||||||
|
private String plateColor; |
||||||
|
private String inParkTime; |
||||||
|
private String inParkControlName; |
||||||
|
private String inParkControlNumber; |
||||||
|
private String inParkUserName; |
||||||
|
private String inParkControlImageName; |
||||||
|
private String chargeStandardId; |
||||||
|
private String personName; |
||||||
|
private String inParkRemark; |
||||||
|
private String inParkTime2; |
||||||
|
private String inParkControlName2; |
||||||
|
private String inParkControlNumber2; |
||||||
|
private String inParkUserName2; |
||||||
|
private String inParkControlImageName2; |
||||||
|
private String chargeStandardId2; |
||||||
|
private String outParkTime2; |
||||||
|
private String outParkControlName2; |
||||||
|
private String outParkControlNumber2; |
||||||
|
private String outParkUserName2; |
||||||
|
private String outParkControlImageName2; |
||||||
|
private String plateState; |
||||||
|
private String receiveMoney; |
||||||
|
private String prePayMoney; |
||||||
|
private String freeMoney; |
||||||
|
private String nowPayMoney; |
||||||
|
private String chargeTime; |
||||||
|
private String noLicenceUserId; |
||||||
|
private String freeRemark; |
||||||
|
private String locking; |
||||||
|
private String creditsMoney; |
||||||
|
private String creditsOriginDesc; |
||||||
|
private String uploadYun; |
||||||
|
private String SpaceTo1Time; |
||||||
|
private String SpaceTo1State; |
||||||
|
private String uploadThird; |
||||||
|
private String cardNumber; |
||||||
|
|
||||||
|
public String getId() { |
||||||
|
return id; |
||||||
|
} |
||||||
|
|
||||||
|
public void setId(String id) { |
||||||
|
this.id = id; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInWay() { |
||||||
|
return inWay; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInWay(String inWay) { |
||||||
|
this.inWay = inWay; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlateNumber() { |
||||||
|
return plateNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPlateNumber(String plateNumber) { |
||||||
|
this.plateNumber = plateNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public String getAuthType() { |
||||||
|
return authType; |
||||||
|
} |
||||||
|
|
||||||
|
public void setAuthType(String authType) { |
||||||
|
this.authType = authType; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlateType() { |
||||||
|
return plateType; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPlateType(String plateType) { |
||||||
|
this.plateType = plateType; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlateColor() { |
||||||
|
return plateColor; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPlateColor(String plateColor) { |
||||||
|
this.plateColor = plateColor; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkTime() { |
||||||
|
return inParkTime; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkTime(String inParkTime) { |
||||||
|
this.inParkTime = inParkTime; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlName() { |
||||||
|
return inParkControlName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlName(String inParkControlName) { |
||||||
|
this.inParkControlName = inParkControlName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlNumber() { |
||||||
|
return inParkControlNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlNumber(String inParkControlNumber) { |
||||||
|
this.inParkControlNumber = inParkControlNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkUserName() { |
||||||
|
return inParkUserName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkUserName(String inParkUserName) { |
||||||
|
this.inParkUserName = inParkUserName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlImageName() { |
||||||
|
return inParkControlImageName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlImageName(String inParkControlImageName) { |
||||||
|
this.inParkControlImageName = inParkControlImageName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChargeStandardId() { |
||||||
|
return chargeStandardId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setChargeStandardId(String chargeStandardId) { |
||||||
|
this.chargeStandardId = chargeStandardId; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPersonName() { |
||||||
|
return personName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPersonName(String personName) { |
||||||
|
this.personName = personName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkRemark() { |
||||||
|
return inParkRemark; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkRemark(String inParkRemark) { |
||||||
|
this.inParkRemark = inParkRemark; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkTime2() { |
||||||
|
return inParkTime2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkTime2(String inParkTime2) { |
||||||
|
this.inParkTime2 = inParkTime2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlName2() { |
||||||
|
return inParkControlName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlName2(String inParkControlName2) { |
||||||
|
this.inParkControlName2 = inParkControlName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlNumber2() { |
||||||
|
return inParkControlNumber2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlNumber2(String inParkControlNumber2) { |
||||||
|
this.inParkControlNumber2 = inParkControlNumber2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkUserName2() { |
||||||
|
return inParkUserName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkUserName2(String inParkUserName2) { |
||||||
|
this.inParkUserName2 = inParkUserName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInParkControlImageName2() { |
||||||
|
return inParkControlImageName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setInParkControlImageName2(String inParkControlImageName2) { |
||||||
|
this.inParkControlImageName2 = inParkControlImageName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChargeStandardId2() { |
||||||
|
return chargeStandardId2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setChargeStandardId2(String chargeStandardId2) { |
||||||
|
this.chargeStandardId2 = chargeStandardId2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkTime2() { |
||||||
|
return outParkTime2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkTime2(String outParkTime2) { |
||||||
|
this.outParkTime2 = outParkTime2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkControlName2() { |
||||||
|
return outParkControlName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkControlName2(String outParkControlName2) { |
||||||
|
this.outParkControlName2 = outParkControlName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkControlNumber2() { |
||||||
|
return outParkControlNumber2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkControlNumber2(String outParkControlNumber2) { |
||||||
|
this.outParkControlNumber2 = outParkControlNumber2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkUserName2() { |
||||||
|
return outParkUserName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkUserName2(String outParkUserName2) { |
||||||
|
this.outParkUserName2 = outParkUserName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOutParkControlImageName2() { |
||||||
|
return outParkControlImageName2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOutParkControlImageName2(String outParkControlImageName2) { |
||||||
|
this.outParkControlImageName2 = outParkControlImageName2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlateState() { |
||||||
|
return plateState; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPlateState(String plateState) { |
||||||
|
this.plateState = plateState; |
||||||
|
} |
||||||
|
|
||||||
|
public String getReceiveMoney() { |
||||||
|
return receiveMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setReceiveMoney(String receiveMoney) { |
||||||
|
this.receiveMoney = receiveMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPrePayMoney() { |
||||||
|
return prePayMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPrePayMoney(String prePayMoney) { |
||||||
|
this.prePayMoney = prePayMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getFreeMoney() { |
||||||
|
return freeMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setFreeMoney(String freeMoney) { |
||||||
|
this.freeMoney = freeMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getNowPayMoney() { |
||||||
|
return nowPayMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setNowPayMoney(String nowPayMoney) { |
||||||
|
this.nowPayMoney = nowPayMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getChargeTime() { |
||||||
|
return chargeTime; |
||||||
|
} |
||||||
|
|
||||||
|
public void setChargeTime(String chargeTime) { |
||||||
|
this.chargeTime = chargeTime; |
||||||
|
} |
||||||
|
|
||||||
|
public String getNoLicenceUserId() { |
||||||
|
return noLicenceUserId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setNoLicenceUserId(String noLicenceUserId) { |
||||||
|
this.noLicenceUserId = noLicenceUserId; |
||||||
|
} |
||||||
|
|
||||||
|
public String getFreeRemark() { |
||||||
|
return freeRemark; |
||||||
|
} |
||||||
|
|
||||||
|
public void setFreeRemark(String freeRemark) { |
||||||
|
this.freeRemark = freeRemark; |
||||||
|
} |
||||||
|
|
||||||
|
public String getLocking() { |
||||||
|
return locking; |
||||||
|
} |
||||||
|
|
||||||
|
public void setLocking(String locking) { |
||||||
|
this.locking = locking; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCreditsMoney() { |
||||||
|
return creditsMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCreditsMoney(String creditsMoney) { |
||||||
|
this.creditsMoney = creditsMoney; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCreditsOriginDesc() { |
||||||
|
return creditsOriginDesc; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCreditsOriginDesc(String creditsOriginDesc) { |
||||||
|
this.creditsOriginDesc = creditsOriginDesc; |
||||||
|
} |
||||||
|
|
||||||
|
public String getUploadYun() { |
||||||
|
return uploadYun; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUploadYun(String uploadYun) { |
||||||
|
this.uploadYun = uploadYun; |
||||||
|
} |
||||||
|
|
||||||
|
public String getSpaceTo1Time() { |
||||||
|
return SpaceTo1Time; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSpaceTo1Time(String spaceTo1Time) { |
||||||
|
SpaceTo1Time = spaceTo1Time; |
||||||
|
} |
||||||
|
|
||||||
|
public String getSpaceTo1State() { |
||||||
|
return SpaceTo1State; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSpaceTo1State(String spaceTo1State) { |
||||||
|
SpaceTo1State = spaceTo1State; |
||||||
|
} |
||||||
|
|
||||||
|
public String getUploadThird() { |
||||||
|
return uploadThird; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUploadThird(String uploadThird) { |
||||||
|
this.uploadThird = uploadThird; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCardNumber() { |
||||||
|
return cardNumber; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCardNumber(String cardNumber) { |
||||||
|
this.cardNumber = cardNumber; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package com.cjy.fieldservice.sys.service; |
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author liangjiawei |
||||||
|
* @createDate 2023/8/17 |
||||||
|
*/ |
||||||
|
public interface SynchronousDataTaskService { |
||||||
|
JSONObject getSynchronizeData() throws IOException; |
||||||
|
JSONObject getAdmissionData() throws IOException; |
||||||
|
} |
@ -0,0 +1,124 @@ |
|||||||
|
package com.cjy.fieldservice.sys.service.impl; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.cjy.fieldservice.common.utils.AppointmentNumberUtil; |
||||||
|
import com.cjy.fieldservice.common.utils.DateUtils; |
||||||
|
import com.cjy.fieldservice.common.utils.HttpUtil; |
||||||
|
import com.cjy.fieldservice.sys.dao.SynchronousDataTaskDao; |
||||||
|
import com.cjy.fieldservice.sys.entity.CarParkData; |
||||||
|
import com.cjy.fieldservice.sys.entity.InParkRecords; |
||||||
|
import com.cjy.fieldservice.sys.service.SynchronousDataTaskService; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.beans.factory.annotation.Value; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.io.FileWriter; |
||||||
|
import java.io.IOException; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author liangjiawei |
||||||
|
* @createDate 2023/8/17 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class SynchronousDataTaskServiceImpl implements SynchronousDataTaskService { |
||||||
|
@Autowired |
||||||
|
SynchronousDataTaskDao synchronousDataTaskDao; |
||||||
|
|
||||||
|
|
||||||
|
@Value("${synchronousDataUrl}") |
||||||
|
private String synchronousDataUrl; |
||||||
|
|
||||||
|
@Value("${parkingLotSynchronousDataUrl}") |
||||||
|
private String parkingLotSynchronousDataUrl; |
||||||
|
|
||||||
|
@Value("${file.root.win}") |
||||||
|
protected String fileRootPathWin; |
||||||
|
|
||||||
|
@Value("${file.root.linux}") |
||||||
|
protected String fileRootPathLinux; |
||||||
|
|
||||||
|
@Override |
||||||
|
public JSONObject getSynchronizeData() throws IOException { |
||||||
|
String startTime = DateUtils.getNHoursAgo(1); |
||||||
|
String endTime = DateUtils.getNHoursAgo(0); |
||||||
|
|
||||||
|
List<CarParkData> list = synchronousDataTaskDao.getCarParkData(startTime, endTime); |
||||||
|
if (!list.isEmpty()) { |
||||||
|
//在这里请求景区综合管控 插入预约记录接口
|
||||||
|
try { |
||||||
|
String responseString = HttpUtil.sendPostJson(synchronousDataUrl, JSONObject.toJSONString(list)); |
||||||
|
JSONObject responseJson = JSONObject.parseObject(responseString); |
||||||
|
if (responseJson.get("code").equals("500")) { |
||||||
|
this.generateFile(JSONObject.toJSONString(list).toString()); |
||||||
|
} |
||||||
|
return responseJson; |
||||||
|
} catch (Exception e) { |
||||||
|
//生成文件
|
||||||
|
this.generateFile(JSONObject.toJSONString(list).toString()); |
||||||
|
e.printStackTrace(); |
||||||
|
JSONObject jsonObject = new JSONObject(); |
||||||
|
jsonObject.put("data", 3600000); |
||||||
|
return jsonObject; |
||||||
|
} |
||||||
|
} else { |
||||||
|
JSONObject jsonObject = new JSONObject(); |
||||||
|
jsonObject.put("data", 3600000); |
||||||
|
return jsonObject; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public JSONObject getAdmissionData() throws IOException { |
||||||
|
String startTime = DateUtils.getNMinutesAgo(5); |
||||||
|
String endTime = DateUtils.getNMinutesAgo(0); |
||||||
|
|
||||||
|
List<InParkRecords> list = synchronousDataTaskDao.getAdmissionData(startTime, endTime); |
||||||
|
if (!list.isEmpty()) { |
||||||
|
//在这里请求景区综合管控 插入预约记录接口
|
||||||
|
try { |
||||||
|
String responseString = HttpUtil.sendPostJson(parkingLotSynchronousDataUrl, JSONObject.toJSONString(list)); |
||||||
|
JSONObject responseJson = JSONObject.parseObject(responseString); |
||||||
|
if (responseJson.get("code").equals("500")) { |
||||||
|
this.generateFile(JSONObject.toJSONString(list).toString()); |
||||||
|
} |
||||||
|
return responseJson; |
||||||
|
} catch (Exception e) { |
||||||
|
//生成文件
|
||||||
|
this.generateFile(JSONObject.toJSONString(list).toString()); |
||||||
|
e.printStackTrace(); |
||||||
|
JSONObject jsonObject = new JSONObject(); |
||||||
|
jsonObject.put("data", 300000); |
||||||
|
return jsonObject; |
||||||
|
} |
||||||
|
} else { |
||||||
|
JSONObject jsonObject = new JSONObject(); |
||||||
|
jsonObject.put("data", 300000); |
||||||
|
return jsonObject; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public void generateFile(String parameter) throws IOException { |
||||||
|
String path; |
||||||
|
String OS = System.getProperty("os.name"); |
||||||
|
if (OS.toLowerCase().startsWith("win")) { |
||||||
|
path = fileRootPathWin + "/file/"; |
||||||
|
} else { |
||||||
|
path = fileRootPathLinux + "/file/"; |
||||||
|
} |
||||||
|
File folder = new File(path); |
||||||
|
File file = new File(folder, AppointmentNumberUtil.generateOrderNumber()); |
||||||
|
// 创建文件夹(如果不存在)
|
||||||
|
if (!folder.exists()) { |
||||||
|
folder.mkdirs(); |
||||||
|
} |
||||||
|
|
||||||
|
// 创建文件并写入内容
|
||||||
|
FileWriter writer = new FileWriter(file); |
||||||
|
writer.write(parameter); |
||||||
|
writer.close(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,88 @@ |
|||||||
|
package com.cjy.fieldservice.sys.task; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
|
||||||
|
import com.cjy.fieldservice.sys.service.SynchronousDataTaskService; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.core.annotation.Order; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.annotation.PostConstruct; |
||||||
|
import java.io.IOException; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author liangjiawei |
||||||
|
* @createDate 2023/8/17 |
||||||
|
*/ |
||||||
|
@Component |
||||||
|
public class SynchronousDataTask { |
||||||
|
@Autowired |
||||||
|
SynchronousDataTaskService synchronousDataTaskService; |
||||||
|
|
||||||
|
@PostConstruct |
||||||
|
@Order(3) |
||||||
|
public void init() throws InterruptedException, IOException { |
||||||
|
|
||||||
|
Thread thread = new Thread(() -> { |
||||||
|
try { |
||||||
|
System.out.println("第一次启动获取出场数据"); |
||||||
|
// 在应用程序启动时执行的代码
|
||||||
|
this.carParkDate(); |
||||||
|
} catch (InterruptedException | IOException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
}); |
||||||
|
thread.start(); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取出场数据 |
||||||
|
* |
||||||
|
* @throws InterruptedException |
||||||
|
* @throws IOException |
||||||
|
*/ |
||||||
|
public void carParkDate() throws InterruptedException, IOException { |
||||||
|
while (true) { |
||||||
|
// 无限循环
|
||||||
|
JSONObject jsonObject = synchronousDataTaskService.getSynchronizeData(); |
||||||
|
|
||||||
|
int dateTime = Integer.parseInt(jsonObject.get("data").toString()); |
||||||
|
Thread.sleep(dateTime); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@PostConstruct |
||||||
|
@Order(1) |
||||||
|
public void initGetAdmissionData() throws IOException, InterruptedException { |
||||||
|
Thread thread = new Thread(() -> { |
||||||
|
try { |
||||||
|
// 延迟1秒
|
||||||
|
System.out.println("第一次启动获取入场调用了"); |
||||||
|
// 在应用程序启动时执行的代码
|
||||||
|
this.getAdmissionData(); |
||||||
|
} catch (InterruptedException | IOException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
}); |
||||||
|
thread.start(); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取入场数据 |
||||||
|
* |
||||||
|
* @throws InterruptedException |
||||||
|
* @throws IOException |
||||||
|
*/ |
||||||
|
public void getAdmissionData() throws InterruptedException, IOException { |
||||||
|
while (true) { |
||||||
|
// 无限循环
|
||||||
|
JSONObject jsonObject = synchronousDataTaskService.getAdmissionData(); |
||||||
|
|
||||||
|
int dateTime = Integer.parseInt(jsonObject.get("data").toString()); |
||||||
|
Thread.sleep(dateTime); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
spring: |
||||||
|
datasource: |
||||||
|
url: jdbc:sqlserver://127.0.0.1:14229;DatabaseName=Park_DB |
||||||
|
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
||||||
|
username: sa |
||||||
|
password: haosql |
||||||
|
|
||||||
|
server: |
||||||
|
port: 8181 |
||||||
|
connection-timeout: 10000ms |
||||||
|
servlet: |
||||||
|
context-path: /fieldservice |
||||||
|
session: |
||||||
|
cookie: |
||||||
|
http-only: true |
||||||
|
# 开启mybatis驼峰转换 |
||||||
|
mybatis: |
||||||
|
configuration: |
||||||
|
map-underscore-to-camel-case: true |
||||||
|
mapper-locations: classpath:mapper/**/*.xml |
||||||
|
|
||||||
|
|
||||||
|
synchronousDataUrl: http://www.lbgjtoa.com/prod-api/parking/turnoverData/parkingLotSynchronousData |
||||||
|
parkingLotSynchronousDataUrl: http://www.lbgjtoa.com/prod-api/parking/turnoverData/parkingLotSynchronousAdmissionData |
||||||
|
|
||||||
|
file: |
||||||
|
root: |
||||||
|
win: D:\\syncLog |
||||||
|
linux: /Users/liangjiawei/Downloads/upload/ |
@ -0,0 +1,25 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
|
||||||
|
<mapper namespace="com.cjy.fieldservice.sys.dao.SynchronousDataTaskDao"> |
||||||
|
|
||||||
|
|
||||||
|
<select id="getCarParkData" resultType="com.cjy.fieldservice.sys.entity.CarParkData"> |
||||||
|
SELECT * |
||||||
|
FROM Sys_Park_OutParkRecords |
||||||
|
WHERE 1 = 1 |
||||||
|
AND CONVERT(date, OutParkTime) = CONVERT(date, GETDATE()) |
||||||
|
AND CONVERT(varchar(5), OutParkTime, 108) BETWEEN #{startTime} AND #{endTime} |
||||||
|
|
||||||
|
</select> |
||||||
|
|
||||||
|
|
||||||
|
<select id="getAdmissionData" resultType="com.cjy.fieldservice.sys.entity.InParkRecords"> |
||||||
|
SELECT * |
||||||
|
FROM Sys_Park_InParkRecords |
||||||
|
WHERE 1 = 1 |
||||||
|
AND CONVERT(date, InParkTime) = CONVERT(date, GETDATE()) |
||||||
|
AND CONVERT(varchar(5), InParkTime, 108) BETWEEN #{startTime} AND #{endTime} |
||||||
|
|
||||||
|
</select> |
||||||
|
</mapper> |
@ -0,0 +1,217 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html> |
||||||
|
<head> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<title></title> |
||||||
|
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<el-container id="app"> |
||||||
|
<el-container> |
||||||
|
<el-header> |
||||||
|
|
||||||
|
<div class="block"> |
||||||
|
<span class="demonstration">开始时间</span> |
||||||
|
<el-date-picker |
||||||
|
v-model="datestart" |
||||||
|
type="datetime" |
||||||
|
value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
placeholder="选择日期时间"> |
||||||
|
</el-date-picker> |
||||||
|
<span class="demonstration">结束时间</span> |
||||||
|
<el-date-picker |
||||||
|
value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
v-model="dateend" |
||||||
|
type="datetime" |
||||||
|
placeholder="选择日期时间"> |
||||||
|
</el-date-picker> |
||||||
|
|
||||||
|
类型:<el-select v-model="type" placeholder="请选择"> |
||||||
|
<el-option |
||||||
|
v-for="item in options" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value"> |
||||||
|
</el-option> |
||||||
|
</el-select> |
||||||
|
|
||||||
|
<el-button @click="getlogDate1">查询</el-button> |
||||||
|
</div> |
||||||
|
</el-header> |
||||||
|
<el-main> |
||||||
|
<el-button @click="Retry" :disabled="type=='order'?true:false">重试</el-button> |
||||||
|
<el-table |
||||||
|
ref="multipleTable" |
||||||
|
:data="tableData" |
||||||
|
tooltip-effect="dark" |
||||||
|
style="width: 100%" |
||||||
|
@selection-change="handleSelectionChange"> |
||||||
|
<el-table-column |
||||||
|
type="selection" |
||||||
|
width="55"> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
prop="dataId" |
||||||
|
label="数据id" |
||||||
|
width="180"> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
prop="status" |
||||||
|
label="状态" |
||||||
|
width="180"> |
||||||
|
<template scope="{ row }"> |
||||||
|
<!-- viewType 为2的时候标题和摘要都显示 --> |
||||||
|
<span >{{row.status ==0?'成功':'失败'}}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
prop="msg" |
||||||
|
label="消息"> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:show-overflow-tooltip="true" |
||||||
|
prop="pushJson" |
||||||
|
label="请求数据"> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
prop="operatingType" |
||||||
|
label="操作"> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
prop="date" |
||||||
|
label="时间"> |
||||||
|
</el-table-column> |
||||||
|
|
||||||
|
<el-table-column |
||||||
|
prop="frequency" |
||||||
|
label="尝试次数"> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
|
||||||
|
|
||||||
|
</el-main> |
||||||
|
<div class="block"> |
||||||
|
<span class="demonstration">显示总数</span> |
||||||
|
<el-pagination |
||||||
|
@current-change="handleCurrentChange" |
||||||
|
:current-page.sync="current" |
||||||
|
:page-size="10" |
||||||
|
layout="total, prev, pager, next" |
||||||
|
:total="count"> |
||||||
|
</el-pagination> |
||||||
|
</div> |
||||||
|
</el-container> |
||||||
|
|
||||||
|
</el-container> |
||||||
|
|
||||||
|
</body> |
||||||
|
<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script> |
||||||
|
<!-- import Vue before Element --> |
||||||
|
<script src="https://unpkg.com/vue/dist/vue.js"></script> |
||||||
|
<!-- import JavaScript --> |
||||||
|
<script src="https://unpkg.com/element-ui/lib/index.js"></script> |
||||||
|
<script src="//cdn.bootcss.com/qs/6.5.2/qs.min.js"></script> |
||||||
|
|
||||||
|
<script> |
||||||
|
let baseURL = 'http://127.0.0.1:8080/fieldservice/' |
||||||
|
new Vue({ |
||||||
|
el: '#app', |
||||||
|
data() { |
||||||
|
return { |
||||||
|
count:0, |
||||||
|
pageSize:10, |
||||||
|
current:1, |
||||||
|
multipleSelection: [], |
||||||
|
tableData: [], |
||||||
|
datestart: '', |
||||||
|
dateend:'', |
||||||
|
options: [{ |
||||||
|
value: 'dealer', |
||||||
|
label: '经销商信息' |
||||||
|
|
||||||
|
}, { |
||||||
|
value: 'product', |
||||||
|
label: '商品信息' |
||||||
|
}, { |
||||||
|
value: 'order', |
||||||
|
label: '订单信息' |
||||||
|
}, { |
||||||
|
value: 'Sent', |
||||||
|
label: '发货单信息' |
||||||
|
}], |
||||||
|
dataId:[], |
||||||
|
type: 'dealer' |
||||||
|
} |
||||||
|
}, |
||||||
|
mounted () { |
||||||
|
this.getlogDate() |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
handleCurrentChange(val) { |
||||||
|
console.log(`当前页: ${val}`); |
||||||
|
this.current=val |
||||||
|
this.getlogDate() |
||||||
|
}, |
||||||
|
Retry(){ |
||||||
|
let requestConfig = { |
||||||
|
headers: { |
||||||
|
'Content-Type': 'application/json;charset=UTF-8', |
||||||
|
} |
||||||
|
} |
||||||
|
let params = this.multipleSelection; |
||||||
|
axios.post(baseURL + 'myservice/retrySynchronize',params,requestConfig) |
||||||
|
.then(response => { |
||||||
|
|
||||||
|
console.log(response.data) |
||||||
|
}) |
||||||
|
.catch(error => { |
||||||
|
console.log(error) |
||||||
|
this.errored = true |
||||||
|
}) |
||||||
|
.finally(() => this.loading = false) |
||||||
|
|
||||||
|
}, |
||||||
|
getlogDate(){ |
||||||
|
|
||||||
|
let requestConfig = { |
||||||
|
headers: { |
||||||
|
'Content-Type': 'application/json;charset=UTF-8', |
||||||
|
} |
||||||
|
} |
||||||
|
let params = { |
||||||
|
pageSize:this.pageSize, |
||||||
|
current:this.current, |
||||||
|
type:this.type, |
||||||
|
datestart:this.datestart, |
||||||
|
dateend:this.dateend, |
||||||
|
dateId:this.dataId |
||||||
|
} |
||||||
|
axios.post(baseURL + 'log/getlog',params,requestConfig) |
||||||
|
.then(response => { |
||||||
|
this.tableData =response.data.data |
||||||
|
this.count =response.data.count |
||||||
|
console.log(response.data) |
||||||
|
}) |
||||||
|
.catch(error => { |
||||||
|
console.log(error) |
||||||
|
this.errored = true |
||||||
|
}) |
||||||
|
.finally(() => this.loading = false) |
||||||
|
}, |
||||||
|
getlogDate1(){ |
||||||
|
this.current=1 |
||||||
|
this.getlogDate() |
||||||
|
}, |
||||||
|
handleSelectionChange(val) { |
||||||
|
this.multipleSelection = val; |
||||||
|
//TODO 选择框 |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
}) |
||||||
|
|
||||||
|
</script> |
||||||
|
<style> |
||||||
|
|
||||||
|
</style> |
||||||
|
</html> |
@ -0,0 +1,13 @@ |
|||||||
|
package com.cjy.fieldservice; |
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test; |
||||||
|
import org.springframework.boot.test.context.SpringBootTest; |
||||||
|
|
||||||
|
@SpringBootTest |
||||||
|
class FieldserviceApplicationTests { |
||||||
|
|
||||||
|
@Test |
||||||
|
void contextLoads() { |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue