diff --git a/food-waimai-web/.classpath b/food-waimai-web/.classpath new file mode 100644 index 0000000..a5d9509 --- /dev/null +++ b/food-waimai-web/.classpath @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/food-waimai-web/.project b/food-waimai-web/.project new file mode 100644 index 0000000..76126e4 --- /dev/null +++ b/food-waimai-web/.project @@ -0,0 +1,23 @@ + + + food-waimai-web + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/food-waimai-web/.settings/org.eclipse.core.resources.prefs b/food-waimai-web/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..839d647 --- /dev/null +++ b/food-waimai-web/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/food-waimai-web/.settings/org.eclipse.jdt.core.prefs b/food-waimai-web/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..2f5cc74 --- /dev/null +++ b/food-waimai-web/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/food-waimai-web/.settings/org.eclipse.m2e.core.prefs b/food-waimai-web/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/food-waimai-web/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/food-waimai-web/assembly.xml b/food-waimai-web/assembly.xml new file mode 100644 index 0000000..a87a265 --- /dev/null +++ b/food-waimai-web/assembly.xml @@ -0,0 +1,49 @@ + + + package + + dir + zip + + true + + + src/main/bin + bin + + + src/main/resources + conf + + application.properties + logback.xml + + + + src/main/conf + conf + + + src/main/logs + logs + + + src/main/lib + lib + + + src/main/temp + temp + + + + + ${project.build.directory}/${artifactId}-${version}.jar + lib + ${artifactId}-${version}.jar + + + \ No newline at end of file diff --git a/food-waimai-web/food-waimai-web.iml b/food-waimai-web/food-waimai-web.iml new file mode 100644 index 0000000..2291f4f --- /dev/null +++ b/food-waimai-web/food-waimai-web.iml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/food-waimai-web/pom.xml b/food-waimai-web/pom.xml new file mode 100644 index 0000000..bc22b9b --- /dev/null +++ b/food-waimai-web/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + + com.jwsaas + food-parent + 2.0.0 + + food-waimai-web + food-waimai-web + http://maven.apache.org + + + UTF-8 + 2.0.2.RELEASE + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-freemarker + + + org.apache.commons + commons-lang3 + + + org.apache.commons + commons-collections4 + + + + com.alibaba + fastjson + + + + com.jwsaas + food-api + + + com.jwsaas + common-dubbo + + + commons-logging + commons-logging + + + dubbo + com.alibaba + + + + + com.alibaba + dubbo + 2.6.5 + + + com.vdurmont + emoji-java + 4.0.0 + + + + org.springframework.boot + spring-boot-starter-amqp + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + + + repackage + + + + + + maven-assembly-plugin + + false + + assembly.xml + + + + + make-assembly + package + + single + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + application.properties + logback.xml + + + + + + + diff --git a/food-waimai-web/src/main/bin/install.bat b/food-waimai-web/src/main/bin/install.bat new file mode 100644 index 0000000..046a68c --- /dev/null +++ b/food-waimai-web/src/main/bin/install.bat @@ -0,0 +1,140 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general passthrough startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem _PASS_THROUGH tells the script to pass all parameters through to the JVM +rem as is. +rem If _WRAPPER_CONF_OVERRIDE is specified then all parameters will be passed. +rem If not set then all parameters starting with the second will be passed. +set _PASS_THROUGH=true + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -i %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -i %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause + + diff --git a/food-waimai-web/src/main/bin/middleware b/food-waimai-web/src/main/bin/middleware new file mode 100644 index 0000000..8e960e3 --- /dev/null +++ b/food-waimai-web/src/main/bin/middleware @@ -0,0 +1,2162 @@ +#! /bin/sh + +# +# Copyright (c) 1999, 2016 Tanuki Software, Ltd. +# http://www.tanukisoftware.com +# All rights reserved. +# +# This software is the proprietary information of Tanuki Software. +# You shall use it only in accordance with the terms of the +# license agreement you entered into with Tanuki Software. +# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +# +# Java Service Wrapper sh script. Suitable for starting and stopping +# wrapped Java applications on UNIX platforms. +# + +#----------------------------------------------------------------------------- +# These settings can be modified to fit the needs of your application +# Optimized for use with version 3.5.28 of the Wrapper. + +#******************************************************************** +# NOTE - This script has been modified to run the TestWrapper sample +# application and should NOT be used as a base for your own +# applications. All of the documentation assumes that you are +# working from the default source script: +# WRAPPER_HOME/src/bin/sh.script.in +#******************************************************************** + +# IMPORTANT - Please always stop and uninstall an application before making +# any changes to this file. Failure to do so could remove the +# script's ability to control the application. + +# Initialization block for the install_initd and remove_initd scripts used by +# SUSE linux, CentOS and RHEL distributions. +# Note: From CentOS 6, make sure the BEGIN INIT INFO section is before any line +# of code otherwise the service won't be displayed in the Service +# Configuration GUI. +### BEGIN INIT INFO +# Provides: wrapper +# Required-Start: $local_fs $network $syslog +# Should-Start: +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Wrapper Sample Application +# Description: Wrapper Sample Application Description +### END INIT INFO + +# Application +APP_NAME="Food2WaiMaiWeb" +APP_LONG_NAME="Food2WaiMaiWeb Application" + +# If uncommented (and set to false), APP_NAME and APP_LONG_NAME will no longer +# be passed to the wrapper. See documentation for details. +#APP_NAME_PASS_TO_WRAPPER=false + +# Wrapper +WRAPPER_CMD="./wrapper" +WRAPPER_CONF="../conf/wrapper.conf" + +# Priority at which to run the wrapper. See "man nice" for valid priorities. +# nice is only used if a priority is specified. +PRIORITY= + +# Location of the pid file. +PIDDIR="." + +# PIDFILE_CHECK_PID tells the script to double check whether the pid in the pid +# file actually exists and belongs to this application. When not set, only +# check the pid, but not what it is. This is only needed when multiple +# applications need to share the same pid file. +PIDFILE_CHECK_PID=true + +# FIXED_COMMAND tells the script to use a hard coded action rather than +# expecting the first parameter of the command line to be the command. +# By default the command will will be expected to be the first parameter. +#FIXED_COMMAND=console + +# PASS_THROUGH tells the script to pass all arguments through to the JVM +# as is. If FIXED_COMMAND is specified then all arguments will be passed. +# If not set then all arguments starting with the second will be passed. +PASS_THROUGH=true + +# If uncommented, causes the Wrapper to be shutdown using an anchor file. +# When launched with the 'start' command, it will also ignore all INT and +# TERM signals. +#IGNORE_SIGNALS=true + +# Wrapper will start the JVM asynchronously. Your application may have some +# initialization tasks and it may be desirable to wait a few seconds +# before returning. For example, to delay the invocation of following +# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will +# cause the start command to delay for the indicated period of time +# (in seconds). +# +WAIT_AFTER_STARTUP=0 + +# If set, wait for the wrapper to report that the daemon has started +WAIT_FOR_STARTED_STATUS=true +WAIT_FOR_STARTED_TIMEOUT=120 + +# If set, the status, start_msg and stop_msg commands will print out detailed +# state information on the Wrapper and Java processes. +#DETAIL_STATUS=true + +# If set, the 'pause' and 'resume' commands will be enabled. These make it +# possible to pause the JVM or Java application without completely stopping +# the Wrapper. See the wrapper.pausable and wrapper.pausable.stop_jvm +# properties for more information. +#PAUSABLE=true + +# If specified, the Wrapper will be run as the specified user. +# IMPORTANT - Make sure that the user has the required privileges to write +# the PID file and wrapper.log files. Failure to be able to write the log +# file will cause the Wrapper to exit without any way to write out an error +# message. +# NOTE - This will set the user which is used to run the Wrapper as well as +# the JVM and is not useful in situations where a privileged resource or +# port needs to be allocated prior to the user being changed. +#RUN_AS_USER= + +# Set the full path to the 'su' command (substitute user). +# NOTE - In case 'su' is not in the PATH, you can set the absolute path here, +# for example: +# SU_BIN=/bin/su +# NOTE - For Red Hat, the script will use '/sbin/runuser' if it is present and +# ignore the value of SU_BIN. +SU_BIN=su + +# Set option for 'su'. +# In case the user set in RUN_AS_USER has no bash set, the 'su' command will fail. +# The workaround for GNU/Linux system is to specify which bash to use with +# the '-s' option. +#SU_OPTS="-s /bin/bash" + +# Set the full path to the 'id' command. +# For example: +# ID_BIN=/usr/bin/id +ID_BIN=id + +# By default we show a detailed usage block. Uncomment to show brief usage. +#BRIEF_USAGE=true + +# OS service management tool: flag for using Upstart when installing (rather than init.d rc.d) +USE_UPSTART= + +# OS service management tool: flag for using systemd when installing +USE_SYSTEMD= + +# When installing on Mac OSX platforms, the following domain will be used to +# prefix the plist file name. +PLIST_DOMAIN=org.tanukisoftware.wrapper + +# When installing on Mac OSX platforms, this parameter controls whether the daemon +# is to be kept continuously running or to let demand and conditions control the +# invocation. +MACOSX_KEEP_RUNNING="false" + +# The following two lines are used by the chkconfig command. Change as is +# appropriate for your application. They should remain commented. +# chkconfig: 2345 20 80 +# description: Test Wrapper Sample Application + +# Set run level to use when installing the application to start and stop on +# system startup and shutdown. It is important that the application always +# be uninstalled before making any changes to the run levels. +# It is also possible to specify different run levels based on the individual +# platform. When doing so this script will look for defined run levels in +# the following order: +# 1) "RUN_LEVEL_S_$DIST_OS" or "RUN_LEVEL_K_$DIST_OS", where "$DIST_OS" is +# the value of DIST_OS. "RUN_LEVEL_S_solaris=20" for example. +# 2) RUN_LEVEL_S or RUN_LEVEL_K, to specify specify start or stop run levels. +# 3) RUN_LEVEL, to specify a general run level. +RUN_LEVEL=20 + +# Do not modify anything beyond this point +#----------------------------------------------------------------------------- + +# check if we are running under Cygwin terminal. +# Note: on some OS's (for example Solaris, MacOS), -o is not a valid parameter +# and it shows an error message. We redirect stderr to null so the error message +# doesn't show up. +CYGWIN=`uname -o 2>/dev/null` +if [ "$CYGWIN" = "Cygwin" ] +then + eval echo `gettext 'This script is not compatible with Cygwin. Please use the Wrapper batch files to control the Wrapper.'` + exit 1 +fi + +if [ -n "$FIXED_COMMAND" ] +then + COMMAND="$FIXED_COMMAND" +else + COMMAND="$1" +fi + +# check if there is a parameter "sysd" +SYSD= +if [ $# -gt 1 ] ; then + if [ $2 = "sysd" ] ; then + SYSD=1 + fi +fi + +# default location for the service file +SYSTEMD_SERVICE_FILE="/etc/systemd/system/$APP_NAME.service" + +# Required for HP-UX Startup +if [ `uname -s` = "HP-UX" -o `uname -s` = "HP-UX64" ] ; then + PATH=$PATH:/usr/bin +fi + +# Get the fully qualified path to the script +case $0 in + /*) + SCRIPT="$0" + ;; + *) + PWD=`pwd` + SCRIPT="$PWD/$0" + ;; +esac + +# Resolve the true real path without any sym links. +CHANGED=true +while [ "X$CHANGED" != "X" ] +do + # Change spaces to ":" so the tokens can be parsed. + SAFESCRIPT=`echo $SCRIPT | sed -e 's; ;:;g'` + # Get the real path to this script, resolving any symbolic links + TOKENS=`echo $SAFESCRIPT | sed -e 's;/; ;g'` + REALPATH= + for C in $TOKENS; do + # Change any ":" in the token back to a space. + C=`echo $C | sed -e 's;:; ;g'` + REALPATH="$REALPATH/$C" + # If REALPATH is a sym link, resolve it. Loop for nested links. + while [ -h "$REALPATH" ] ; do + LS="`ls -ld "$REALPATH"`" + LINK="`expr "$LS" : '.*-> \(.*\)$'`" + if expr "$LINK" : '/.*' > /dev/null; then + # LINK is absolute. + REALPATH="$LINK" + else + # LINK is relative. + REALPATH="`dirname "$REALPATH"`""/$LINK" + fi + done + done + + if [ "$REALPATH" = "$SCRIPT" ] + then + CHANGED="" + else + SCRIPT="$REALPATH" + fi +done + +# Get the location of the script. +REALDIR=`dirname "$REALPATH"` +# Normalize the path +REALDIR=`cd "${REALDIR}"; pwd` + +# If the PIDDIR is relative, set its value relative to the full REALPATH to avoid problems if +# the working directory is later changed. +FIRST_CHAR=`echo $PIDDIR | cut -c1,1` +if [ "$FIRST_CHAR" != "/" ] +then + PIDDIR=$REALDIR/$PIDDIR +fi +# Same test for WRAPPER_CMD +FIRST_CHAR=`echo $WRAPPER_CMD | cut -c1,1` +if [ "$FIRST_CHAR" != "/" ] +then + WRAPPER_CMD=$REALDIR/$WRAPPER_CMD +fi +# Same test for WRAPPER_CONF +FIRST_CHAR=`echo $WRAPPER_CONF | cut -c1,1` +if [ "$FIRST_CHAR" != "/" ] +then + WRAPPER_CONF=$REALDIR/$WRAPPER_CONF +fi + +# Process ID +ANCHORFILE="$PIDDIR/$APP_NAME.anchor" +COMMANDFILE="$PIDDIR/$APP_NAME.command" +STATUSFILE="$PIDDIR/$APP_NAME.status" +JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status" +PIDFILE="$PIDDIR/$APP_NAME.pid" +LOCKDIR="/var/lock/subsys" +LOCKFILE="$LOCKDIR/$APP_NAME" +pid="" + +# Resolve the location of the 'ps' command +PS_BIN="/usr/ucb/ps" + if [ ! -x "$PS_BIN" ] + then + PS_BIN="/usr/bin/ps" + if [ ! -x "$PS_BIN" ] + then + PS_BIN="/bin/ps" + if [ ! -x "$PS_BIN" ] + then + eval echo `gettext 'Unable to locate "ps".'` + eval echo `gettext 'Please report this message along with the location of the command on your system.'` + exit 1 + fi + fi + fi + +TR_BIN="/usr/bin/tr" +if [ ! -x "$TR_BIN" ] +then + TR_BIN="/bin/tr" + if [ ! -x "$TR_BIN" ] + then + eval echo `gettext 'Unable to locate "tr".'` + eval echo `gettext 'Please report this message along with the location of the command on your system.'` + exit 1 + fi +fi +# Resolve the os +DIST_OS=`uname -s | $TR_BIN "[A-Z]" "[a-z]" | $TR_BIN -d ' '` +case "$DIST_OS" in + 'sunos') + DIST_OS="solaris" + ;; + 'hp-ux' | 'hp-ux64') + # HP-UX needs the XPG4 version of ps (for -o args) + DIST_OS="hpux" + UNIX95="" + export UNIX95 + ;; + 'darwin') + DIST_OS="macosx" + ;; + 'unix_sv') + DIST_OS="unixware" + ;; + 'os/390') + DIST_OS="zos" + ;; +esac + +# Compare Versions $1<$2=0, $1==$2=1, $1>$2=2 +compareVersions () { + if [ "$1" = "$2" ] + then + return 1 + else + local i=1 + while true + do + local v1=`echo "$1" | cut -d '.' -f $i` + local v2=`echo "$2" | cut -d '.' -f $i` + if [ "X$v1" = "X" ] + then + if [ "X$v2" = "X" ] + then + return 1 + fi + v1="0" + elif [ "X$v2" = "X" ] + then + v2="0" + fi + if [ $v1 -lt $v2 ] + then + return 0 + elif [ $v1 -gt $v2 ] + then + return 2 + fi + i=`expr $i + 1` + done + fi +} + +# Resolve the architecture +if [ "$DIST_OS" = "macosx" ] +then + OS_VER=`sw_vers | grep 'ProductVersion:' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\|[0-9]*\.[0-9]*'` + DIST_ARCH="universal" + compareVersions "$OS_VER" "10.5.0" + if [[ $? < 1 ]] + then + DIST_BITS="32" + KEY_KEEP_ALIVE="OnDemand" + else + # Note: "OnDemand" has been deprecated and replaced from Mac OS X 10.5 by "KeepAlive" + KEY_KEEP_ALIVE="KeepAlive" + + if [ "X`/usr/sbin/sysctl -n hw.cpu64bit_capable`" = "X1" ] + then + DIST_BITS="64" + else + DIST_BITS="32" + fi + fi + APP_PLIST_BASE=${PLIST_DOMAIN}.${APP_NAME} + APP_PLIST=${APP_PLIST_BASE}.plist +else + if [ "$DIST_OS" = "linux" ] + then + DIST_ARCH= + else + DIST_ARCH=`uname -p 2>/dev/null | $TR_BIN "[A-Z]" "[a-z]" | $TR_BIN -d ' '` + fi + if [ "X$DIST_ARCH" = "X" ] + then + DIST_ARCH="unknown" + fi + if [ "$DIST_ARCH" = "unknown" ] + then + DIST_ARCH=`uname -m 2>/dev/null | $TR_BIN "[A-Z]" "[a-z]" | $TR_BIN -d ' '` + fi + case "$DIST_ARCH" in + 'athlon' | 'i386' | 'i486' | 'i586' | 'i686') + DIST_ARCH="x86" + if [ "${DIST_OS}" = "solaris" ] ; then + DIST_BITS=`isainfo -b` + else + DIST_BITS="32" + fi + ;; + 'amd64' | 'x86_64') + DIST_ARCH="x86" + DIST_BITS="64" + ;; + 'ia32') + DIST_ARCH="ia" + DIST_BITS="32" + ;; + 'ia64' | 'ia64n' | 'ia64w') + DIST_ARCH="ia" + DIST_BITS="64" + ;; + 'ip27') + DIST_ARCH="mips" + DIST_BITS="32" + ;; + 'power' | 'powerpc' | 'power_pc' | 'ppc64') + if [ "${DIST_ARCH}" = "ppc64" ] ; then + DIST_BITS="64" + else + DIST_BITS="32" + fi + DIST_ARCH="ppc" + if [ "${DIST_OS}" = "aix" ] ; then + if [ `getconf KERNEL_BITMODE` -eq 64 ]; then + DIST_BITS="64" + else + DIST_BITS="32" + fi + fi + ;; + 'pa_risc' | 'pa-risc') + DIST_ARCH="parisc" + if [ `getconf KERNEL_BITS` -eq 64 ]; then + DIST_BITS="64" + else + DIST_BITS="32" + fi + ;; + 'sun4u' | 'sparcv9' | 'sparc') + DIST_ARCH="sparc" + DIST_BITS=`isainfo -b` + ;; + '9000/800' | '9000/785') + DIST_ARCH="parisc" + if [ `getconf KERNEL_BITS` -eq 64 ]; then + DIST_BITS="64" + else + DIST_BITS="32" + fi + ;; + '2064' | '2066' | '2084' | '2086' | '2094' | '2096' | '2097' | '2098' | '2817') + DIST_ARCH="390" + DIST_BITS="64" + ;; + armv*) + if [ -z "`readelf -A /proc/self/exe | grep Tag_ABI_VFP_args`" ] ; then + DIST_ARCH="armel" + DIST_BITS="32" + else + DIST_ARCH="armhf" + DIST_BITS="32" + fi + ;; + esac +fi + +# OSX always places Java in the same location so we can reliably set JAVA_HOME +if [ "$DIST_OS" = "macosx" ] +then + if [ -z "$JAVA_HOME" ]; then + if [ -x /usr/libexec/java_home ]; then + JAVA_HOME=`/usr/libexec/java_home`; export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME + fi + fi +fi + +# Test Echo +ECHOTEST=`echo -n "x"` +if [ "$ECHOTEST" = "x" ] +then + ECHOOPT="-n " + ECHOOPTC="" +else + ECHOOPT="" + ECHOOPTC="\c" +fi + + +gettext() { + "$WRAPPER_CMD" --translate "$1" "$WRAPPER_CONF" 2>/dev/null + if [ $? != 0 ] ; then + echo "$1" + fi +} + +outputFile() { + if [ -f "$1" ] + then + eval echo `gettext ' $1 Found but not executable.'`; + else + echo " $1" + fi +} + +# Decide on the wrapper binary to use. +# If the bits of the OS could be detected, we will try to look for the +# binary with the correct bits value. If it doesn't exist, fall back +# and look for the 32-bit binary. If that doesn't exist either then +# look for the default. +WRAPPER_TEST_CMD="" +if [ -f "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-$DIST_BITS" ] +then + WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-$DIST_BITS" + if [ ! -x "$WRAPPER_TEST_CMD" ] + then + chmod +x "$WRAPPER_TEST_CMD" 2>/dev/null + fi + if [ -x "$WRAPPER_TEST_CMD" ] + then + WRAPPER_CMD="$WRAPPER_TEST_CMD" + else + outputFile "$WRAPPER_TEST_CMD" + WRAPPER_TEST_CMD="" + fi +fi +if [ -f "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32" -a -z "$WRAPPER_TEST_CMD" ] +then + WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32" + if [ ! -x "$WRAPPER_TEST_CMD" ] + then + chmod +x "$WRAPPER_TEST_CMD" 2>/dev/null + fi + if [ -x "$WRAPPER_TEST_CMD" ] + then + WRAPPER_CMD="$WRAPPER_TEST_CMD" + else + outputFile "$WRAPPER_TEST_CMD" + WRAPPER_TEST_CMD="" + fi +fi +if [ -f "$WRAPPER_CMD" -a -z "$WRAPPER_TEST_CMD" ] +then + WRAPPER_TEST_CMD="$WRAPPER_CMD" + if [ ! -x "$WRAPPER_TEST_CMD" ] + then + chmod +x "$WRAPPER_TEST_CMD" 2>/dev/null + fi + if [ -x "$WRAPPER_TEST_CMD" ] + then + WRAPPER_CMD="$WRAPPER_TEST_CMD" + else + outputFile "$WRAPPER_TEST_CMD" + WRAPPER_TEST_CMD="" + fi +fi +if [ -z "$WRAPPER_TEST_CMD" ] +then + eval echo `gettext 'Unable to locate any of the following binaries:'` + outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-$DIST_BITS" + if [ ! "$DIST_BITS" = "32" ] + then + outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32" + fi + outputFile "$WRAPPER_CMD" + + exit 1 +fi + + +# Build the nice clause +if [ "X$PRIORITY" = "X" ] +then + CMDNICE="" +else + CMDNICE="nice -$PRIORITY" +fi + +# Build the anchor file clause. +if [ "X$IGNORE_SIGNALS" = "X" ] +then + ANCHORPROP= + IGNOREPROP= +else + ANCHORPROP=wrapper.anchorfile=\"$ANCHORFILE\" + IGNOREPROP=wrapper.ignore_signals=TRUE +fi + +# Build the status file clause. +if [ "X$DETAIL_STATUS$WAIT_FOR_STARTED_STATUS" = "X" ] +then + STATUSPROP= +else + STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\"" +fi + +# Build the command file clause. +if [ -n "$PAUSABLE" ] +then + COMMANDPROP="wrapper.commandfile=\"$COMMANDFILE\" wrapper.pausable=TRUE" +else + COMMANDPROP= +fi + +if [ ! -n "$WAIT_FOR_STARTED_STATUS" ] +then + WAIT_FOR_STARTED_STATUS=true +fi + +if [ $WAIT_FOR_STARTED_STATUS = true ] ; then + DETAIL_STATUS=true +fi + + +# Build the lock file clause. Only create a lock file if the lock directory exists on this platform. +LOCKPROP= +if [ -d $LOCKDIR ] +then + if [ -w $LOCKDIR ] + then + LOCKPROP=wrapper.lockfile=\"$LOCKFILE\" + fi +fi + +# Build app name clause +if [ ! -n "$APP_NAME_PASS_TO_WRAPPER" ] +then + APP_NAME_PASS_TO_WRAPPER=true +fi +if [ $APP_NAME_PASS_TO_WRAPPER = false ] +then + APPNAMEPROP= +else + APPNAMEPROP="wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\"" +fi + +# Decide on run levels. +RUN_LEVEL_S_DIST_OS_TMP=`eval "echo \$\{RUN_LEVEL_S_${DIST_OS}\}"` +RUN_LEVEL_S_DIST_OS=`eval "echo ${RUN_LEVEL_S_DIST_OS_TMP}"` +if [ "X${RUN_LEVEL_S_DIST_OS}" != "X" ] ; then + APP_RUN_LEVEL_S=${RUN_LEVEL_S_DIST_OS} +elif [ "X$RUN_LEVEL_S" != "X" ] ; then + APP_RUN_LEVEL_S=$RUN_LEVEL_S +else + APP_RUN_LEVEL_S=$RUN_LEVEL +fi +APP_RUN_LEVEL_S_CHECK=`echo "$APP_RUN_LEVEL_S" | sed "s/[(0-9)*]/0/g"` +if [ "X${APP_RUN_LEVEL_S_CHECK}" != "X00" ] ; then + eval echo `gettext 'Run level \"${APP_RUN_LEVEL_S}\" must be numeric and have a length of two \(00-99\).'` + exit 1; +fi +RUN_LEVEL_K_DIST_OS_TMP=`eval "echo \$\{RUN_LEVEL_K_${DIST_OS}\}"` +RUN_LEVEL_K_DIST_OS=`eval "echo ${RUN_LEVEL_K_DIST_OS_TMP}"` +if [ "X${RUN_LEVEL_K_DIST_OS}" != "X" ] ; then + APP_RUN_LEVEL_K=${RUN_LEVEL_K_DIST_OS} +elif [ "X$RUN_LEVEL_K" != "X" ] ; then + APP_RUN_LEVEL_K=$RUN_LEVEL_K +else + APP_RUN_LEVEL_K=$RUN_LEVEL +fi +APP_RUN_LEVEL_K_CHECK=`echo "$APP_RUN_LEVEL_K" | sed "s/[(0-9)*]/0/g"` +if [ "X${APP_RUN_LEVEL_K_CHECK}" != "X00" ] ; then + eval echo `gettext 'Run level \"${APP_RUN_LEVEL_K}\" must be numeric and have a length of two \(00-99\).'` + exit 1; +fi + +prepAdditionalParams() { + ADDITIONAL_PARA="" + if [ ! -n "$PASS_THROUGH" ] + then + PASS_THROUGH=false + fi + if [ $PASS_THROUGH = true ] ; then + ADDITIONAL_PARA="--" + while [ -n "$1" ] ; do + ADDITIONAL_PARA="$ADDITIONAL_PARA \"$1\"" + shift + done + elif [ -n "$1" ] ; then + eval echo `gettext "WARNING: Extra arguments will be ignored. Please run \'$0 help\' for usage."` + fi +} + +checkUser() { + # $1 touchLock flag + # $2.. [command] args + + # Check the configured user. If necessary rerun this script as the desired user. + if [ "X$RUN_AS_USER" != "X" ] + then + # Resolve the location of the 'id' command + ID_BIN="/usr/xpg4/bin/id" + if [ ! -x "$ID_BIN" ] + then + ID_BIN="/usr/bin/id" + if [ ! -x "$ID_BIN" ] + then + eval echo `gettext 'Unable to locate "id".'` + eval echo `gettext 'Please report this message along with the location of the command on your system.'` + exit 1 + fi + fi + + if [ "`$ID_BIN -u -n`" = "$RUN_AS_USER" ] + then + # Already running as the configured user. Avoid password prompts by not calling su. + RUN_AS_USER="" + fi + fi + if [ "X$RUN_AS_USER" != "X" ] + then + if [ "`$ID_BIN -u -n "$RUN_AS_USER" 2>/dev/null`" != "$RUN_AS_USER" ] + then + eval echo `gettext 'User $RUN_AS_USER does not exist.'` + exit 1 + fi + + # If LOCKPROP and $RUN_AS_USER are defined then the new user will most likely not be + # able to create the lock file. The Wrapper will be able to update this file once it + # is created but will not be able to delete it on shutdown. If $1 is set then + # the lock file should be created for the current command + if [ "X$LOCKPROP" != "X" ] + then + if [ "X$1" != "X" ] + then + # Resolve the primary group + RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1` + if [ "X$RUN_AS_GROUP" = "X" ] + then + RUN_AS_GROUP=$RUN_AS_USER + fi + touch $LOCKFILE + chown $RUN_AS_USER:$RUN_AS_GROUP $LOCKFILE + fi + fi + + # Still want to change users, recurse. This means that the user will only be + # prompted for a password once. Variables shifted by 1 + shift + + # Wrap the parameters so they can be passed. + ADDITIONAL_PARA="" + while [ -n "$1" ] ; do + if [ "$1" = 'installstart' ] ; then + # At this point the service is already installed. When we will fork the process we only need to start the service. + ADDITIONAL_PARA="$ADDITIONAL_PARA \"start\"" + else + ADDITIONAL_PARA="$ADDITIONAL_PARA \"$1\"" + fi + shift + done + + # Use "runuser" if this exists. + # runuser should be used on RedHat in preference to su. + if test -f "/sbin/runuser" + then + /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA" + else + $SU_BIN - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA" $SU_OPTS + fi + RUN_AS_USER_EXITCODE=$? + + # we check if the previous command has failed + if [ $RUN_AS_USER_EXITCODE -ne 0 ] + then + if [ $RUN_AS_USER_EXITCODE -eq 1 ] + then + checkForkCommand + else + eval echo `gettext 'Error executing the requested command with user \"$RUN_AS_USER\" \(error code $RUN_AS_USER_EXITCODE\).'` + echo "" + fi + fi + + # Now that we are the original user again, we may need to clean up the lock file. + if [ "X$LOCKPROP" != "X" ] + then + getpid + if [ "X$pid" = "X" ] + then + # Wrapper is not running so make sure the lock file is deleted. + if [ -f "$LOCKFILE" ] + then + rm "$LOCKFILE" + fi + fi + fi + + exit $RUN_AS_USER_EXITCODE + fi +} + +# Try to fork by executing a simple command. +# With this function, we want to make sure we are able to fork. +checkForkCommand() { + + if test -f "/sbin/runuser" + then + /sbin/runuser - $RUN_AS_USER -c "ls \"$REALPATH\"" > /dev/null 2>&1 & + else + $SU_BIN - $RUN_AS_USER -c "ls \"$REALPATH\"" $SU_OPTS > /dev/null 2>&1 & + fi + CHECK_EXITCODE=$? + + if [ $CHECK_EXITCODE -ne 0 ] + then + # clearly a problem with forking + eval echo `gettext 'Error: unable to create fork process.'` + eval echo `gettext 'Advice:'` + eval echo `gettext 'One possible cause of failure is when the user \(\"$RUN_AS_USER\"\) has no shell.'` + eval echo `gettext 'In this case, two solutions are available by editing the script file:'` + eval echo `gettext '1. Use \"SU_OPTS\" to set the shell for the user.'` + eval echo `gettext '2. Use a OS service management tool (only available on some platforms).'` + echo "" + fi +} + +getpid() { + pid="" + if [ -f "$PIDFILE" ] + then + if [ -r "$PIDFILE" ] + then + pid=`cat "$PIDFILE"` + if [ "X$pid" != "X" ] + then + if [ "X$PIDFILE_CHECK_PID" != "X" ] + then + # It is possible that 'a' process with the pid exists but that it is not the + # correct process. This can happen in a number of cases, but the most + # common is during system startup after an unclean shutdown. + # The ps statement below looks for the specific wrapper command running as + # the pid. If it is not found then the pid file is considered to be stale. + case "$DIST_OS" in + 'freebsd') + pidtest=`$PS_BIN -p $pid -o args | tail -1` + if [ "X$pidtest" = "XCOMMAND" ] + then + pidtest="" + fi + ;; + 'macosx') + pidtest=`$PS_BIN -ww -p $pid -o command | grep -F "$WRAPPER_CMD" | tail -1` + ;; + 'solaris') + if [ -f "/usr/bin/pargs" ] + then + pidtest=`pargs $pid | fgrep "$WRAPPER_CMD" | tail -1` + else + case "$PS_BIN" in + '/usr/ucb/ps') + pidtest=`$PS_BIN -auxww $pid | fgrep "$WRAPPER_CMD" | tail -1` + ;; + '/usr/bin/ps') + TRUNCATED_CMD=`$PS_BIN -o comm -p $pid | tail -1` + COUNT=`echo $TRUNCATED_CMD | wc -m` + COUNT=`echo ${COUNT}` + COUNT=`expr $COUNT - 1` + TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT` + pidtest=`$PS_BIN -o comm -p $pid | fgrep "$TRUNCATED_CMD" | tail -1` + ;; + '/bin/ps') + TRUNCATED_CMD=`$PS_BIN -o comm -p $pid | tail -1` + COUNT=`echo $TRUNCATED_CMD | wc -m` + COUNT=`echo ${COUNT}` + COUNT=`expr $COUNT - 1` + TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT` + pidtest=`$PS_BIN -o comm -p $pid | fgrep "$TRUNCATED_CMD" | tail -1` + ;; + *) + echo "Unsupported ps command $PS_BIN" + exit 1 + ;; + esac + fi + ;; + 'hpux') + pidtest=`$PS_BIN -p $pid -x -o args | grep -F "$WRAPPER_CMD" | tail -1` + ;; + 'zos') + TRUNCATED_CMD=`$PS_BIN -p $pid -o args | tail -1` + COUNT=`echo $TRUNCATED_CMD | wc -m` + COUNT=`echo ${COUNT}` + COUNT=`expr $COUNT - 1` + TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT` + pidtest=`$PS_BIN -p $pid -o args | grep -F "$TRUNCATED_CMD" | tail -1` + ;; + *) + pidtest=`$PS_BIN -p $pid -o args | grep -F "$WRAPPER_CMD" | tail -1` + ;; + esac + else + # Check to see whether the pid exists as a running process, but in this mode, don't check what that pid is. + case "$DIST_OS" in + 'solaris') + case "$PS_BIN" in + '/usr/ucb/ps') + pidtest=`$PS_BIN $pid | grep "$pid" | awk '{print $1}' | tail -1` + ;; + '/usr/bin/ps') + pidtest=`$PS_BIN -p $pid -o pid | grep "$pid" | tail -1` + ;; + '/bin/ps') + pidtest=`$PS_BIN -p $pid -o pid | grep "$pid" | tail -1` + ;; + *) + echo "Unsupported ps command $PS_BIN" + exit 1 + ;; + esac + ;; + *) + pidtest=`$PS_BIN -p $pid -o pid | grep "$pid" | tail -1` + ;; + esac + fi + + if [ "X$pidtest" = "X" ] + then + # This is a stale pid file. + rm -f "$PIDFILE" + eval echo `gettext 'Removed stale pid file: $PIDFILE'` + pid="" + fi + fi + else + eval echo `gettext 'Cannot read $PIDFILE.'` + exit 1 + fi + fi +} + +getstatus() { + STATUS= + if [ -f "$STATUSFILE" ] + then + if [ -r "$STATUSFILE" ] + then + STATUS=`cat "$STATUSFILE"` + fi + fi + if [ "X$STATUS" = "X" ] + then + STATUS="Unknown" + fi + + JAVASTATUS= + if [ -f "$JAVASTATUSFILE" ] + then + if [ -r "$JAVASTATUSFILE" ] + then + JAVASTATUS=`cat "$JAVASTATUSFILE"` + fi + fi + if [ "X$JAVASTATUS" = "X" ] + then + JAVASTATUS="Unknown" + fi +} + +testpid() { + case "$DIST_OS" in + 'solaris') + case "$PS_BIN" in + '/usr/ucb/ps') + pid=`$PS_BIN $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` + ;; + '/usr/bin/ps') + pid=`$PS_BIN -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` + ;; + '/bin/ps') + pid=`$PS_BIN -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` + ;; + *) + echo "Unsupported ps command $PS_BIN" + exit 1 + ;; + esac + ;; + *) + pid=`$PS_BIN -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` 2>/dev/null + ;; + esac + if [ "X$pid" = "X" ] + then + # Process is gone so remove the pid file. + rm -f "$PIDFILE" + pid="" + fi +} + +launchdtrap() { + stopit + exit +} + +waitforwrapperstop() { + getpid + while [ "X$pid" != "X" ] ; do + sleep 1 + getpid + done +} + +launchinternal() { + getpid + trap launchdtrap TERM + if [ "X$pid" = "X" ] + then + prepAdditionalParams "$@" + + # The string passed to eval must handles spaces in paths correctly. + COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $APPNAMEPROP $ANCHORPROP $IGNOREPROP $STATUSPROP $COMMANDPROP $LOCKPROP wrapper.script.version=3.5.28 $ADDITIONAL_PARA" + eval $COMMAND_LINE + else + eval echo `gettext '$APP_LONG_NAME is already running.'` + exit 1 + fi + # launchd expects that this script stay up and running so we need to do our own monitoring of the Wrapper process. + if [ $WAIT_FOR_STARTED_STATUS = true ] + then + waitforwrapperstop + fi +} + +console() { + eval echo `gettext 'Running $APP_LONG_NAME...'` + getpid + if [ "X$pid" = "X" ] + then + trap '' 3 + + prepAdditionalParams "$@" + + # The string passed to eval must handles spaces in paths correctly. + COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" $APPNAMEPROP $ANCHORPROP $STATUSPROP $COMMANDPROP $LOCKPROP wrapper.script.version=3.5.28 $ADDITIONAL_PARA" + eval $COMMAND_LINE + else + eval echo `gettext '$APP_LONG_NAME is already running.'` + exit 1 + fi +} + +waitforjavastartup() { + getstatus + eval echo $ECHOOPT `gettext 'Waiting for $APP_LONG_NAME...$ECHOOPTC'` + + # Wait until the timeout or we have something besides Unknown. + counter=15 + while [ "$JAVASTATUS" = "Unknown" -a $counter -gt 0 -a -n "$JAVASTATUS" ] ; do + echo $ECHOOPT".$ECHOOPTC" + sleep 1 + getstatus + counter=`expr $counter - 1` + done + + if [ -n "$WAIT_FOR_STARTED_TIMEOUT" ] ; then + counter=$WAIT_FOR_STARTED_TIMEOUT + else + counter=120 + fi + while [ "$JAVASTATUS" != "STARTED" -a "$JAVASTATUS" != "Unknown" -a $counter -gt 0 -a -n "$JAVASTATUS" ] ; do + echo $ECHOOPT".$ECHOOPTC" + sleep 1 + getstatus + counter=`expr $counter - 1` + done + echo "" +} + +startwait() { + if [ $WAIT_FOR_STARTED_STATUS = true ] + then + waitforjavastartup + fi + # Sleep for a few seconds to allow for intialization if required + # then test to make sure we're still running. + # + i=0 + while [ $i -lt $WAIT_AFTER_STARTUP ] + do + sleep 1 + echo $ECHOOPT".$ECHOOPTC" + i=`expr $i + 1` + done + if [ $WAIT_AFTER_STARTUP -gt 0 -o $WAIT_FOR_STARTED_STATUS = true ] + then + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext ' WARNING: $APP_LONG_NAME may have failed to start.'` + exit 1 + else + eval echo `gettext ' running: PID:$pid'` + fi + else + echo "" + fi +} + +mustBeRootOrExit() { + if [ `id | sed 's/^uid=//;s/(.*$//'` != "0" ] ; then + eval echo `gettext 'Must be root to perform this action.'` + exit 1 + fi +} + + +macosxStart() { + # The daemon has been installed. + eval echo `gettext 'Starting $APP_LONG_NAME. Detected Mac OSX and installed launchd daemon.'` + mustBeRootOrExit + + getpid + if [ "X$pid" != "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is already running.'` + exit 1 + fi + + # If the daemon was just installed, it may not be loaded. + LOADED_PLIST=`launchctl list | grep ${APP_PLIST_BASE}` + if [ "X${LOADED_PLIST}" = "X" ] ; then + launchctl load /Library/LaunchDaemons/${APP_PLIST} + fi + # If launchd is set to run the daemon already at Load, we don't need to call start + getpid + if [ "X$pid" = "X" ] ; then + launchctl start ${APP_PLIST_BASE} + fi + + startwait +} + +macosxStop() { + # The daemon should be running. + eval echo `gettext 'Stopping $APP_LONG_NAME...'` + mustBeRootOrExit + + getpid + if [ "X$pid" = "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is not running.'` + exit 1 + else + if [ "$MACOSX_KEEP_RUNNING" = "true" ] ; then + echo "" + eval echo `gettext 'Daemon is set to be kept continuously running and it will be automatically restarted.'` + eval echo `gettext 'To stop the daemon you need to uninstall it.'` + eval echo `gettext 'If you want to use the \"stop\" argument, you need to find MACOSX_KEEP_RUNNING'` + eval echo `gettext 'at the beginning of the script file and set it to \"false\".'` + echo "" + fi + launchctl stop ${APP_PLIST_BASE} + fi +} + +macosxRestart() { + # The daemon should be running. + eval echo `gettext 'Restarting $APP_LONG_NAME...'` + mustBeRootOrExit + + getpid + if [ "X$pid" = "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is not running.'` + exit 1 + else + if [ "$MACOSX_KEEP_RUNNING" = "true" ] ; then + # by stopping it, launchd will automatically restart it + launchctl stop ${APP_PLIST_BASE} + else + launchctl unload "/Library/LaunchDaemons/${APP_PLIST}" + sleep 1 + launchctl load "/Library/LaunchDaemons/${APP_PLIST}" + fi + fi + + startwait +} + +upstartstart() { + # The daemon has been installed. + eval echo `gettext 'Starting $APP_LONG_NAME. Detected Linux and installed upstart.'` + mustBeRootOrExit + + getpid + if [ "X$pid" != "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is already running.'` + exit 1 + fi + + /sbin/start ${APP_NAME} + + startwait +} + +upstartStop() { + # The daemon has been installed. + eval echo `gettext 'Stopping $APP_LONG_NAME...'` + mustBeRootOrExit + + getpid + if [ "X$pid" = "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is not running.'` + exit 1 + fi + + /sbin/stop ${APP_NAME} +} + +upstartRestart() { + # The daemon has been installed. + eval echo `gettext 'Restarting $APP_LONG_NAME...'` + mustBeRootOrExit + + getpid + if [ "X$pid" = "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is not running.'` + exit 1 + fi + + /sbin/restart ${APP_NAME} + + startwait +} + +systemdInstall() { + eval echo `gettext ' Installing the $APP_LONG_NAME daemon using systemd...'` + if [ -f "${REALDIR}/${APP_NAME}.service" ] ; then + eval echo `gettext ' a custom service file ${APP_NAME}.service found'` + cp "${REALDIR}/${APP_NAME}.service" "${SYSTEMD_SERVICE_FILE}" + else + eval echo `gettext ' creating default service file...'` + echo "[Unit]" > "${SYSTEMD_SERVICE_FILE}" + echo "Description=${APP_LONG_NAME}" >> "${SYSTEMD_SERVICE_FILE}" + echo "After=syslog.target" >> "${SYSTEMD_SERVICE_FILE}" + echo "" >> "${SYSTEMD_SERVICE_FILE}" + echo "[Service]" >> "${SYSTEMD_SERVICE_FILE}" + echo "Type=forking" >> "${SYSTEMD_SERVICE_FILE}" + echo "ExecStart=${REALPATH} start sysd" >> "${SYSTEMD_SERVICE_FILE}" + echo "ExecStop=${REALPATH} stop sysd" >> "${SYSTEMD_SERVICE_FILE}" + if [ "X${RUN_AS_USER}" != "X" ] ; then + echo "User=${RUN_AS_USER}" >> "${SYSTEMD_SERVICE_FILE}" + fi + echo "" >> "${SYSTEMD_SERVICE_FILE}" + echo "[Install]" >> "${SYSTEMD_SERVICE_FILE}" + echo "WantedBy=multi-user.target" >> "${SYSTEMD_SERVICE_FILE}" + + systemctl daemon-reload + systemctl enable "${APP_NAME}" + fi +} + +systemdStart() { + # check if the service file is present + if [ -f "${SYSTEMD_SERVICE_FILE}" ] ; then + eval echo `gettext 'Reading file ${SYSTEMD_SERVICE_FILE}'` + else + eval echo `gettext 'No service file detected. Did you install the service?'` + exit 1 + fi + + systemctl start $APP_NAME + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to start service $APP_NAME'` + exit 1 + fi + + startwait +} + +systemdStop() { + systemctl stop $APP_NAME + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to stop service $APP_NAME'` + exit 1 + fi +} + +systemdRestart() { + systemctl restart $APP_NAME + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to restart service $APP_NAME'` + exit 1 + fi + + startwait +} + +systemdRemove() { + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon from systemd...'` + systemctl disable $APP_NAME + rm "/etc/systemd/system/${APP_NAME}.service" + systemctl daemon-reload +} + +srcInstall() { + if [ "X$RUN_AS_USER" = "X" ] ; then + USERID="0" + else + USERID=`$ID_BIN -u "$RUN_AS_USER"` + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to get user id for $RUN_AS_USER'` + exit 1 + fi + fi + /usr/bin/mkssys -s "$APP_NAME" -p "$REALPATH" -a "launchdinternal" -u "$USERID" -f 9 -n 15 -S + /usr/sbin/mkitab "$APP_NAME":2:once:"/usr/bin/startsrc -s \"${APP_NAME}\" >/dev/console 2>&1" +} + +srcStart() { + startsrc -s "${APP_NAME}" + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to start service $APP_NAME'` + exit 1 + fi + + startwait +} + +srcStop() { + stopsrc -s "${APP_NAME}" + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to stop service $APP_NAME'` + exit 1 + fi +} + +srcRestart() { + srcStop + srcStart +} + +start() { + eval echo `gettext 'Starting $APP_LONG_NAME...'` + getpid + if [ "X$pid" = "X" ] + then + prepAdditionalParams "$@" + + # The string passed to eval must handles spaces in paths correctly. + COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $APPNAMEPROP $ANCHORPROP $IGNOREPROP $STATUSPROP $COMMANDPROP $LOCKPROP wrapper.script.version=3.5.28 $ADDITIONAL_PARA" + eval $COMMAND_LINE + else + eval echo `gettext '$APP_LONG_NAME is already running.'` + exit 1 + fi + + startwait +} + +stopit() { + # $1 exit if down flag + + eval echo `gettext 'Stopping $APP_LONG_NAME...'` + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext '$APP_LONG_NAME was not running.'` + if [ "X$1" = "X1" ] + then + exit 1 + fi + else + if [ "X$IGNORE_SIGNALS" = "X" ] + then + # Running so try to stop it. + kill $pid + if [ $? -ne 0 ] + then + # An explanation for the failure should have been given + eval echo `gettext 'Unable to stop $APP_LONG_NAME.'` + exit 1 + fi + else + rm -f "$ANCHORFILE" + if [ -f "$ANCHORFILE" ] + then + # An explanation for the failure should have been given + eval echo `gettext 'Unable to stop $APP_LONG_NAME.'` + exit 1 + fi + fi + + # We can not predict how long it will take for the wrapper to + # actually stop as it depends on settings in wrapper.conf. + # Loop until it does. + savepid=$pid + CNT=0 + TOTCNT=0 + while [ "X$pid" != "X" ] + do + # Show a waiting message every 5 seconds. + if [ "$CNT" -lt "5" ] + then + CNT=`expr $CNT + 1` + else + eval echo `gettext 'Waiting for $APP_LONG_NAME to exit...'` + CNT=0 + fi + TOTCNT=`expr $TOTCNT + 1` + + sleep 1 + + testpid + done + + pid=$savepid + testpid + if [ "X$pid" != "X" ] + then + eval echo `gettext 'Failed to stop $APP_LONG_NAME.'` + exit 1 + else + eval echo `gettext 'Stopped $APP_LONG_NAME.'` + fi + fi +} + +pause() { + eval echo `gettext 'Pausing $APP_LONG_NAME.'` +} + +resume() { + eval echo `gettext 'Resuming $APP_LONG_NAME.'` +} + +status() { + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext '$APP_LONG_NAME is not running.'` + exit 1 + else + if [ "X$DETAIL_STATUS" = "X" ] + then + eval echo `gettext '$APP_LONG_NAME is running: PID:$pid'` + else + getstatus + eval echo `gettext '$APP_LONG_NAME is running: PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS'` + fi + exit 0 + fi +} + +# Make sure APP_NAME is less than 14 characters, otherwise in AIX, the command +# "lsitab" will fail +validateAppNameLength() { + if [ ${#APP_NAME} -gt 14 ] ; then + eval echo `gettext ' APP_NAME (${APP_NAME}) must be less than 14 characters long'` + exit 1 + fi +} + +installUpstart() { + eval echo `gettext ' Installing the $APP_LONG_NAME daemon using upstart..'` + if [ -f "${REALDIR}/${APP_NAME}.install" ] ; then + eval echo `gettext ' a custom upstart conf file ${APP_NAME}.install found'` + cp "${REALDIR}/${APP_NAME}.install" "/etc/init/${APP_NAME}.conf" + else + eval echo `gettext ' creating default upstart conf file..'` + echo "# ${APP_NAME} - ${APP_LONG_NAME}" > "/etc/init/${APP_NAME}.conf" + echo "description \"${APP_LONG_NAME}\"" >> "/etc/init/${APP_NAME}.conf" + echo "author \"Tanuki Software Ltd. \"" >> "/etc/init/${APP_NAME}.conf" + echo "start on runlevel [2345]" >> "/etc/init/${APP_NAME}.conf" + echo "stop on runlevel [!2345]" >> "/etc/init/${APP_NAME}.conf" + echo "env LANG=${LANG}" >> "/etc/init/${APP_NAME}.conf" + echo "exec \"${REALPATH}\" upstartinternal" >> "/etc/init/${APP_NAME}.conf" + fi +} + +installdaemon() { + mustBeRootOrExit + + APP_NAME_LOWER=`echo "$APP_NAME" | $TR_BIN "[A-Z]" "[a-z]"` + if [ "$DIST_OS" = "solaris" ] ; then + eval echo `gettext 'Detected Solaris:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + ln -s "$REALPATH" "/etc/init.d/$APP_NAME" + for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do + eval echo `gettext ' Removing unexpected file before proceeding: $i'` + rm -f $i + done + ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER" + ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER" + fi + elif [ "$DIST_OS" = "linux" ] ; then + if [ -f /etc/redhat-release -o -f /etc/redhat_version -o -f /etc/fedora-release ] ; then + eval echo `gettext 'Detected RHEL or Fedora:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" -o -f "/etc/init/${APP_NAME}.conf" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + elif [ -n "$USE_SYSTEMD" -a -d "/etc/systemd" ] ; then + systemdInstall + else + if [ -n "$USE_UPSTART" -a -d "/etc/init" ] ; then + installUpstart + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + ln -s "$REALPATH" "/etc/init.d/$APP_NAME" + /sbin/chkconfig --add "$APP_NAME" + /sbin/chkconfig "$APP_NAME" on + fi + fi + elif [ -f /etc/SuSE-release ] ; then + eval echo `gettext 'Detected SuSE or SLES:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + elif [ -n "$USE_SYSTEMD" -a -d "/etc/systemd" ] ; then + systemdInstall + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + ln -s "$REALPATH" "/etc/init.d/$APP_NAME" + insserv "/etc/init.d/$APP_NAME" + fi + elif [ -f /etc/lsb-release -o -f /etc/debian_version -o -f /etc/debian_release ] ; then + eval echo `gettext 'Detected Ubuntu or Debian:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" -o -f "/etc/init/${APP_NAME}.conf" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + if [ -n "$USE_SYSTEMD" -a -d "/etc/systemd" ] ; then + systemdInstall + elif [ -n "$USE_UPSTART" -a -d "/etc/init" ] ; then + installUpstart + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon using init.d..'` + ln -s "$REALPATH" "/etc/init.d/$APP_NAME" + update-rc.d "$APP_NAME" defaults + fi + fi + else + eval echo `gettext 'Detected Linux:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + ln -s "$REALPATH" /etc/init.d/$APP_NAME + for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc5.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" "/etc/rc5.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do + eval echo `gettext ' Removing unexpected file before proceeding: $i'` + rm -f $i + done + ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER" + ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER" + ln -s "/etc/init.d/$APP_NAME" "/etc/rc5.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER" + ln -s "/etc/init.d/$APP_NAME" "/etc/rc5.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER" + fi + fi + elif [ "$DIST_OS" = "hpux" ] ; then + eval echo `gettext 'Detected HP-UX:'` + if [ -f "/sbin/init.d/$APP_NAME" -o -L "/sbin/init.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + ln -s "$REALPATH" "/sbin/init.d/$APP_NAME" + for i in `ls "/sbin/rc3.d/K"??"$APP_NAME_LOWER" "/sbin/rc3.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do + eval echo `gettext ' Removing unexpected file before proceeding: $i'` + rm -f $i + done + ln -s "/sbin/init.d/$APP_NAME" "/sbin/rc3.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER" + ln -s "/sbin/init.d/$APP_NAME" "/sbin/rc3.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER" + fi + elif [ "$DIST_OS" = "aix" ] ; then + eval echo `gettext 'Detected AIX:'` + validateAppNameLength + if [ -f "/etc/rc.d/init.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed as rc.d script.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + elif [ -n "`/usr/sbin/lsitab $APP_NAME`" -a -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed as SRC service.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + if [ -n "`/usr/sbin/lsitab install_assist`" ] ; then + eval echo `gettext ' The task /usr/sbin/install_assist was found in the inittab, this might cause problems for all subsequent tasks to launch at this process is known to block the init task. Please make sure this task is not needed anymore and remove/deactivate it.'` + fi + for i in `ls "/etc/rc.d/rc2.d/K"??"$APP_NAME_LOWER" "/etc/rc.d/rc2.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do + eval echo `gettext ' Removing unexpected file before proceeding: $i'` + rm -f $i + done + srcInstall + fi + elif [ "$DIST_OS" = "freebsd" ] ; then + eval echo `gettext 'Detected FreeBSD:'` + if [ -f "/etc/rc.d/$APP_NAME" -o -L "/etc/rc.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + sed -i .bak "/${APP_NAME}_enable=\"YES\"/d" /etc/rc.conf + if [ -f "${REALDIR}/${APP_NAME}.install" ] ; then + ln -s "${REALDIR}/${APP_NAME}.install" "/etc/rc.d/$APP_NAME" + else + echo '#!/bin/sh' > "/etc/rc.d/$APP_NAME" + echo "#" >> "/etc/rc.d/$APP_NAME" + echo "# PROVIDE: $APP_NAME" >> "/etc/rc.d/$APP_NAME" + echo "# REQUIRE: NETWORKING" >> "/etc/rc.d/$APP_NAME" + echo "# KEYWORD: shutdown" >> "/etc/rc.d/$APP_NAME" + echo ". /etc/rc.subr" >> "/etc/rc.d/$APP_NAME" + echo "name=\"$APP_NAME\"" >> "/etc/rc.d/$APP_NAME" + echo "rcvar=\`set_rcvar\`" >> "/etc/rc.d/$APP_NAME" + echo "command=\"${REALPATH}\"" >> "/etc/rc.d/$APP_NAME" + echo 'start_cmd="${name}_start"' >> "/etc/rc.d/$APP_NAME" + echo 'load_rc_config $name' >> "/etc/rc.d/$APP_NAME" + echo 'status_cmd="${name}_status"' >> "/etc/rc.d/$APP_NAME" + echo 'stop_cmd="${name}_stop"' >> "/etc/rc.d/$APP_NAME" + echo "${APP_NAME}_status() {" >> "/etc/rc.d/$APP_NAME" + echo '${command} status' >> "/etc/rc.d/$APP_NAME" + echo '}' >> "/etc/rc.d/$APP_NAME" + echo "${APP_NAME}_stop() {" >> "/etc/rc.d/$APP_NAME" + echo '${command} stop' >> "/etc/rc.d/$APP_NAME" + echo '}' >> "/etc/rc.d/$APP_NAME" + echo "${APP_NAME}_start() {" >> "/etc/rc.d/$APP_NAME" + echo '${command} start' >> "/etc/rc.d/$APP_NAME" + echo '}' >> "/etc/rc.d/$APP_NAME" + echo 'run_rc_command "$1"' >> "/etc/rc.d/$APP_NAME" + fi + echo "${APP_NAME}_enable=\"YES\"" >> /etc/rc.conf + chmod 555 "/etc/rc.d/$APP_NAME" + fi + elif [ "$DIST_OS" = "macosx" ] ; then + eval echo `gettext 'Detected Mac OSX:'` + if [ -f "/Library/LaunchDaemons/${APP_PLIST}" -o -L "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + if [ -f "${REALDIR}/${APP_PLIST}" ] ; then + ln -s "${REALDIR}/${APP_PLIST}" "/Library/LaunchDaemons/${APP_PLIST}" + else + echo "" > "/Library/LaunchDaemons/${APP_PLIST}" + echo "> "/Library/LaunchDaemons/${APP_PLIST}" + echo "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo "" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " " >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " Label" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " ${APP_PLIST_BASE}" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " ProgramArguments" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " " >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " ${REALPATH}" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " launchdinternal" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " " >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " ${KEY_KEEP_ALIVE}" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " <${MACOSX_KEEP_RUNNING}/>" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " RunAtLoad" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " " >> "/Library/LaunchDaemons/${APP_PLIST}" + if [ "X$RUN_AS_USER" != "X" ] ; then + echo " UserName" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " ${RUN_AS_USER}" >> "/Library/LaunchDaemons/${APP_PLIST}" + fi + echo " " >> "/Library/LaunchDaemons/${APP_PLIST}" + echo "" >> "/Library/LaunchDaemons/${APP_PLIST}" + fi + chmod 555 "/Library/LaunchDaemons/${APP_PLIST}" + fi + elif [ "$DIST_OS" = "zos" ] ; then + eval echo `gettext 'Detected z/OS:'` + if [ -f /etc/rc.bak ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + cp /etc/rc /etc/rc.bak + sed "s:echo /etc/rc script executed, \`date\`::g" /etc/rc.bak > /etc/rc + echo "_BPX_JOBNAME='${APP_NAME}' \"${REALDIR}/${APP_NAME}\" start" >>/etc/rc + echo '/etc/rc script executed, `date`' >>/etc/rc + fi + else + eval echo `gettext 'Install not currently supported for $DIST_OS'` + exit 1 + fi +} + +startdaemon() { + if [ "$DIST_OS" = "macosx" ] ; then + if [ ! -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + eval echo `gettext 'The $APP_LONG_NAME daemon is not currently installed.'` + else + macosxStart + fi + elif [ "$DIST_OS" = "linux" -a -f "/etc/init/${APP_NAME}.conf" ] ; then + upstartstart + elif [ "$DIST_OS" = "linux" -a -n "$USE_SYSTEMD" -a -z "$SYSD" ] ; then + systemdStart + elif [ "$DIST_OS" = "aix" ] && [ -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + srcStart + else + if [ -n "$SYSD" ] ; then + shift + fi + + checkUser touchlock "$@" + if [ ! -n "$FIXED_COMMAND" ] ; then + shift + fi + start "$@" + fi +} + +removedaemon() { + mustBeRootOrExit + + APP_NAME_LOWER=`echo "$APP_NAME" | $TR_BIN "[A-Z]" "[a-z]"` + if [ "$DIST_OS" = "solaris" ] ; then + eval echo `gettext 'Detected Solaris:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" "/etc/init.d/$APP_NAME" 2>/dev/null` ; do + rm -f $i + done + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ "$DIST_OS" = "linux" ] ; then + if [ -f /etc/redhat-release -o -f /etc/redhat_version -o -f /etc/fedora-release ] ; then + eval echo `gettext 'Detected RHEL or Fedora:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + /sbin/chkconfig "$APP_NAME" off + /sbin/chkconfig --del "$APP_NAME" + rm -f "/etc/init.d/$APP_NAME" + elif [ -n "$USE_SYSTEMD" -a -f "${SYSTEMD_SERVICE_FILE}" ] ; then + systemdRemove + elif [ -f "/etc/init/${APP_NAME}.conf" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon from upstart...'` + rm "/etc/init/${APP_NAME}.conf" + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ -f /etc/SuSE-release ] ; then + eval echo `gettext 'Detected SuSE or SLES:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + insserv -r "/etc/init.d/$APP_NAME" + rm -f "/etc/init.d/$APP_NAME" + elif [ -n "$USE_SYSTEMD" -a -f "${SYSTEMD_SERVICE_FILE}" ] ; then + systemdRemove + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ -f /etc/lsb-release -o -f /etc/debian_version -o -f /etc/debian_release ] ; then + eval echo `gettext 'Detected Ubuntu or Debian:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon from init.d...'` + update-rc.d -f "$APP_NAME" remove + rm -f "/etc/init.d/$APP_NAME" + elif [ -n "$USE_SYSTEMD" -a -f "${SYSTEMD_SERVICE_FILE}" ] ; then + systemdRemove + elif [ -f "/etc/init/${APP_NAME}.conf" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon from upstart...'` + rm "/etc/init/${APP_NAME}.conf" + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + else + eval echo `gettext 'Detected Linux:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc5.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" "/etc/rc5.d/S"??"$APP_NAME_LOWER" "/etc/init.d/$APP_NAME" 2>/dev/null` ; do + rm -f $i + done + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + fi + elif [ "$DIST_OS" = "hpux" ] ; then + eval echo `gettext 'Detected HP-UX:'` + if [ -f "/sbin/init.d/$APP_NAME" -o -L "/sbin/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + for i in `ls "/sbin/rc3.d/K"??"$APP_NAME_LOWER" "/sbin/rc3.d/S"??"$APP_NAME_LOWER" "/sbin/init.d/$APP_NAME" 2>/dev/null` ; do + rm -f $i + done + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ "$DIST_OS" = "aix" ] ; then + eval echo `gettext 'Detected AIX:'` + validateAppNameLength + if [ -f "/etc/rc.d/init.d/$APP_NAME" -o -L "/etc/rc.d/init.d/$APP_NAME" -o -n "`/usr/sbin/lsitab $APP_NAME`" -o -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + if [ -f "/etc/rc.d/init.d/$APP_NAME" -o -L "/etc/rc.d/init.d/$APP_NAME" ] ; then + for i in `ls "/etc/rc.d/rc2.d/K"??"$APP_NAME_LOWER" "/etc/rc.d/rc2.d/S"??"$APP_NAME_LOWER" "/etc/rc.d/init.d/$APP_NAME" 2>/dev/null` ; do + rm -f $i + done + fi + if [ -n "`/usr/sbin/lsitab $APP_NAME`" -o -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + /usr/sbin/rmitab $APP_NAME + /usr/bin/rmssys -s $APP_NAME + fi + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ "$DIST_OS" = "freebsd" ] ; then + eval echo `gettext 'Detected FreeBSD:'` + if [ -f "/etc/rc.d/$APP_NAME" -o -L "/etc/rc.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + for i in "/etc/rc.d/$APP_NAME" + do + rm -f $i + done + sed -i .bak "/${APP_NAME}_enable=\"YES\"/d" /etc/rc.conf + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ "$DIST_OS" = "macosx" ] ; then + eval echo `gettext 'Detected Mac OSX:'` + if [ -f "/Library/LaunchDaemons/${APP_PLIST}" -o -L "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + # Make sure the plist is installed + LOADED_PLIST=`launchctl list | grep ${APP_PLIST_BASE}` + if [ "X${LOADED_PLIST}" != "X" ] ; then + launchctl unload "/Library/LaunchDaemons/${APP_PLIST}" + fi + rm -f "/Library/LaunchDaemons/${APP_PLIST}" + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ "$DIST_OS" = "zos" ] ; then + eval echo `gettext 'Detected z/OS:'` + if [ -f /etc/rc.bak ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + cp /etc/rc /etc/rc.bak + sed "s/_BPX_JOBNAME=\'APP_NAME\'.*//g" /etc/rc.bak > /etc/rc + rm /etc/rc.bak + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + else + eval echo `gettext 'Remove not currently supported for $DIST_OS'` + exit 1 + fi +} + +dump() { + eval echo `gettext 'Dumping $APP_LONG_NAME...'` + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext '$APP_LONG_NAME was not running.'` + else + kill -3 $pid + + if [ $? -ne 0 ] + then + eval echo `gettext 'Failed to dump $APP_LONG_NAME.'` + exit 1 + else + eval echo `gettext 'Dumped $APP_LONG_NAME.'` + fi + fi +} + +# Used by HP-UX init scripts. +startmsg() { + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext 'Starting $APP_LONG_NAME... Wrapper:Stopped'` + else + if [ "X$DETAIL_STATUS" = "X" ] + then + eval echo `gettext 'Starting $APP_LONG_NAME... Wrapper:Running'` + else + getstatus + eval echo `gettext 'Starting $APP_LONG_NAME... Wrapper:$STATUS, Java:$JAVASTATUS'` + fi + fi +} + +# Used by HP-UX init scripts. +stopmsg() { + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext 'Stopping $APP_LONG_NAME... Wrapper:Stopped'` + else + if [ "X$DETAIL_STATUS" = "X" ] + then + eval echo `gettext 'Stopping $APP_LONG_NAME... Wrapper:Running'` + else + getstatus + eval echo `gettext 'Stopping $APP_LONG_NAME... Wrapper:$STATUS, Java:$JAVASTATUS'` + fi + fi +} + +showUsage() { + # $1 bad command + + if [ -n "$1" ] + then + eval echo `gettext 'Unexpected command: $1'` + echo ""; + fi + + eval MSG=`gettext 'Usage: '` + if [ -n "$FIXED_COMMAND" ] ; then + if [ -n "$PASS_THROUGH" ] ; then + echo "${MSG} $0 {JavaAppArgs}" + else + echo "${MSG} $0" + fi + else + if [ -n "$PAUSABLE" ] ; then + if [ -n "$PASS_THROUGH" ] ; then + echo "${MSG} $0 [ console {JavaAppArgs} | start {JavaAppArgs} | stop | restart {JavaAppArgs} | condrestart {JavaAppArgs} | pause | resume | status | install | installstart | remove | dump ]" + else + echo "${MSG} $0 [ console | start | stop | restart | condrestart | pause | resume | status | install | installstart | remove | dump ]" + fi + else + if [ -n "$PASS_THROUGH" ] ; then + echo "${MSG} $0 [ console {JavaAppArgs} | start {JavaAppArgs} | stop | restart {JavaAppArgs} | condrestart {JavaAppArgs} | status | install | installstart | remove | dump ]" + else + echo "${MSG} $0 [ console | start | stop | restart | condrestart | status | install | installstart | remove | dump ]" + fi + fi + fi + + if [ ! -n "$BRIEF_USAGE" ] + then + echo ""; + if [ ! -n "$FIXED_COMMAND" ] ; then + echo "`gettext 'Commands:'`" + echo "`gettext ' console Launch in the current console.'`" + echo "`gettext ' start Start in the background as a daemon process.'`" + echo "`gettext ' stop Stop if running as a daemon or in another console.'`" + echo "`gettext ' restart Stop if running and then start.'`" + echo "`gettext ' condrestart Restart only if already running.'`" + if [ -n "$PAUSABLE" ] ; then + echo "`gettext ' pause Pause if running.'`" + echo "`gettext ' resume Resume if paused.'`" + fi + echo "`gettext ' status Query the current status.'`" + echo "`gettext ' install Install to start automatically when system boots.'`" + echo "`gettext ' installstart Install and start running as a daemon process.'`" + echo "`gettext ' remove Uninstall.'`" + echo "`gettext ' dump Request a Java thread dump if running.'`" + echo ""; + fi + if [ -n "$PASS_THROUGH" ] ; then + echo "`gettext 'JavaAppArgs: Zero or more arguments which will be passed to the Java application.'`" + echo ""; + fi + fi + + exit 1 +} + +docommand() { + case "$COMMAND" in + 'console') + checkUser touchlock "$@" + if [ ! -n "$FIXED_COMMAND" ] ; then + shift + fi + console "$@" + ;; + + 'start') + startdaemon "$@" + ;; + + 'stop') + if [ "$DIST_OS" = "macosx" -a -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + macosxStop + elif [ "$DIST_OS" = "linux" -a -f "/etc/init/${APP_NAME}.conf" ] ; then + upstartStop + elif [ "$DIST_OS" = "linux" -a -n "$USE_SYSTEMD" -a -z "$SYSD" ] ; then + systemdStop + elif [ "$DIST_OS" = "aix" ] && [ "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + srcStop + else + checkUser "" "$COMMAND" + stopit "0" + fi + ;; + + 'restart') + if [ "$DIST_OS" = "macosx" ] ; then + if [ ! -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + eval echo `gettext '$APP_NAME was not installed.'` + else + macosxRestart + fi + elif [ "$DIST_OS" = "linux" -a -f "/etc/init/${APP_NAME}.conf" ] ; then + upstartRestart + elif [ "$DIST_OS" = "linux" -a -n "$USE_SYSTEMD" -a -z "$SYSD" ] ; then + systemdRestart + elif [ "$DIST_OS" = "aix" ] && [ "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + srcRestart + else + if [ -n "$SMF" ] ; then + shift + fi + checkUser touchlock "$COMMAND" + if [ ! -n "$FIXED_COMMAND" ] ; then + shift + fi + stopit "0" + start "$@" + fi + ;; + + 'condrestart') + checkUser touchlock "$COMMAND" + if [ ! -n "$FIXED_COMMAND" ] ; then + shift + fi + stopit "1" + start "$@" + ;; + + 'pause') + if [ -n "$PAUSABLE" ] + then + pause + else + showUsage "$COMMAND" + fi + ;; + + 'resume') + if [ -n "$PAUSABLE" ] + then + resume + else + showUsage "$COMMAND" + fi + ;; + + 'status') + status + ;; + + 'install') + installdaemon "$@" + ;; + + 'installstart') + installdaemon "$@" + startdaemon "$@" + ;; + + 'remove') + removedaemon + ;; + + 'dump') + checkUser "" "$COMMAND" + dump + ;; + + 'start_msg') + # Internal command called by launchd on HP-UX. + checkUser "" "$COMMAND" + startmsg + ;; + + 'stop_msg') + # Internal command called by launchd on HP-UX. + checkUser "" "$COMMAND" + stopmsg + ;; + + 'launchdinternal' | 'upstartinternal') + if [ ! "$DIST_OS" = "macosx" -o ! -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + checkUser touchlock "$@" + fi + # Internal command called by launchd on Max OSX. + # We do not want to call checkUser here as it is handled in the launchd plist file. Doing it here would confuse launchd. + if [ ! -n "$FIXED_COMMAND" ] ; then + shift + fi + launchinternal "$@" + ;; + + *) + showUsage "$COMMAND" + ;; + esac +} + +docommand "$@" + +exit 0 diff --git a/food-waimai-web/src/main/bin/pause.bat b/food-waimai-web/src/main/bin/pause.bat new file mode 100644 index 0000000..65a2166 --- /dev/null +++ b/food-waimai-web/src/main/bin/pause.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -a %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -a %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/src/main/bin/query.bat b/food-waimai-web/src/main/bin/query.bat new file mode 100644 index 0000000..5638a44 --- /dev/null +++ b/food-waimai-web/src/main/bin/query.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -q %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -q %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/src/main/bin/resume.bat b/food-waimai-web/src/main/bin/resume.bat new file mode 100644 index 0000000..8b4d6ea --- /dev/null +++ b/food-waimai-web/src/main/bin/resume.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -e %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -e %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/src/main/bin/run.bat b/food-waimai-web/src/main/bin/run.bat new file mode 100644 index 0000000..8672708 --- /dev/null +++ b/food-waimai-web/src/main/bin/run.bat @@ -0,0 +1,156 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general passthrough startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. +rem +rem ******************************************************************** +rem NOTE - This script has been modified to run the TestWrapper sample +rem application and should NOT be used as a base for your own +rem applications. All of the documentation assumes that you are +rem working from the default source script: +rem WRAPPER_HOME/src/bin/App.bat.in +rem ******************************************************************** +rem +rem ******************************************************************** +rem NOTE - This script has been modified to run the TestWrapper sample +rem application and should NOT be used as a base for your own +rem applications. All of the documentation assumes that you are +rem working from the default source script: +rem WRAPPER_HOME/src/bin/App.bat.in +rem ******************************************************************** + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem _PASS_THROUGH tells the script to pass all parameters through to the JVM +rem as is. +rem If _WRAPPER_CONF_OVERRIDE is specified then all parameters will be passed. +rem If not set then all parameters starting with the second will be passed. +set _PASS_THROUGH=true + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -c %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -c %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause + + diff --git a/food-waimai-web/src/main/bin/start.bat b/food-waimai-web/src/main/bin/start.bat new file mode 100644 index 0000000..d7d5e85 --- /dev/null +++ b/food-waimai-web/src/main/bin/start.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -t %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -t %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/src/main/bin/stop.bat b/food-waimai-web/src/main/bin/stop.bat new file mode 100644 index 0000000..49d717c --- /dev/null +++ b/food-waimai-web/src/main/bin/stop.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -p %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -p %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/src/main/bin/uninstall.bat b/food-waimai-web/src/main/bin/uninstall.bat new file mode 100644 index 0000000..6ee6d07 --- /dev/null +++ b/food-waimai-web/src/main/bin/uninstall.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -r %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -r %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/src/main/bin/wrapper-linux-x86-32 b/food-waimai-web/src/main/bin/wrapper-linux-x86-32 new file mode 100644 index 0000000..ff3509f Binary files /dev/null and b/food-waimai-web/src/main/bin/wrapper-linux-x86-32 differ diff --git a/food-waimai-web/src/main/bin/wrapper-linux-x86-64 b/food-waimai-web/src/main/bin/wrapper-linux-x86-64 new file mode 100644 index 0000000..e72b0e0 Binary files /dev/null and b/food-waimai-web/src/main/bin/wrapper-linux-x86-64 differ diff --git a/food-waimai-web/src/main/bin/wrapper-macosx-universal-32 b/food-waimai-web/src/main/bin/wrapper-macosx-universal-32 new file mode 100644 index 0000000..9a36a5c Binary files /dev/null and b/food-waimai-web/src/main/bin/wrapper-macosx-universal-32 differ diff --git a/food-waimai-web/src/main/bin/wrapper-macosx-universal-64 b/food-waimai-web/src/main/bin/wrapper-macosx-universal-64 new file mode 100644 index 0000000..6587d2c Binary files /dev/null and b/food-waimai-web/src/main/bin/wrapper-macosx-universal-64 differ diff --git a/food-waimai-web/src/main/bin/wrapper-windows-x86-32.exe b/food-waimai-web/src/main/bin/wrapper-windows-x86-32.exe new file mode 100644 index 0000000..9762dbf Binary files /dev/null and b/food-waimai-web/src/main/bin/wrapper-windows-x86-32.exe differ diff --git a/food-waimai-web/src/main/bin/wrapper-windows-x86-64.exe b/food-waimai-web/src/main/bin/wrapper-windows-x86-64.exe new file mode 100644 index 0000000..122ec17 Binary files /dev/null and b/food-waimai-web/src/main/bin/wrapper-windows-x86-64.exe differ diff --git a/food-waimai-web/src/main/conf/wrapper.conf b/food-waimai-web/src/main/conf/wrapper.conf new file mode 100644 index 0000000..6f01ce9 --- /dev/null +++ b/food-waimai-web/src/main/conf/wrapper.conf @@ -0,0 +1,60 @@ +encoding=UTF-8 +wrapper.lang=zh_CN +#using the system default JDK environment variable +wrapper.java.command=java +#set.JAVA_HOME=/home/jdk1.8.0_65 +#wrapper.java.command=%JAVA_HOME%/bin/java +wrapper.java.command.loglevel=INFO + +wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp +wrapper.java.classpath.1=./ +wrapper.java.classpath.2=../conf/ +wrapper.java.classpath.3=../lib/*.jar + +wrapper.java.library.path.1=../lib + +wrapper.java.additional.auto_bits=TRUE +#set the default parameters +wrapper.java.additional.1=-Xms256m +wrapper.java.additional.2=-Xmx512m +wrapper.java.additional.3=-XX:PermSize=128m +wrapper.java.additional.4=-XX:MaxPermSize=256m +wrapper.java.additional.5=-Djava.net.preferIPv4Stack=true +wrapper.java.additional.6=-Dsun.lang.ClassLoader.allowArraySyntax=true + +# Initial Java Heap Size (in MB) +wrapper.java.initmemory=128 +# Maximum Java Heap Size (in MB) +wrapper.java.maxmemory=512 + +# Application parameters. Add parameters as needed starting from 1 +wrapper.app.parameter.1=org.springframework.boot.loader.JarLauncher +wrapper.app.parameter.2=--spring.config.location=../conf/application.properties +wrapper.app.parameter.3=--logging.config=../conf/logback.xml +wrapper.app.parameter.4=--logging.path=../logs + +wrapper.filter.trigger.1=java.lang.OutOfMemoryError +wrapper.filter.action.1=RESTART + +wrapper.console.format=PM +wrapper.console.loglevel=INFO + +wrapper.logfile=../logs/server_YYYYMMDD.log +wrapper.logfile.rollmode=DATE +wrapper.logfile.format=LPTM +wrapper.logfile.loglevel=INFO +wrapper.logfile.maxsize=0 +wrapper.logfile.maxfiles=0 +wrapper.syslog.loglevel=NONE + +wrapper.ignore_sequence_gaps=TRUE +wrapper.pidfile.strict=TRUE + +wrapper.console.title=Food2WaiMaiWeb Application + +wrapper.name=food2WaiMaiWeb +wrapper.displayname=Food2WaiMaiWeb Application +wrapper.description=Food2WaiMaiWeb Application +wrapper.ntservice.dependency.1= +wrapper.ntservice.starttype=AUTO_START +wrapper.ntservice.interactive=false diff --git a/food-waimai-web/src/main/java/com/jwsaas/Application.java b/food-waimai-web/src/main/java/com/jwsaas/Application.java new file mode 100644 index 0000000..253d0e4 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/Application.java @@ -0,0 +1,17 @@ +package com.jwsaas; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ImportResource; + +@ComponentScan(basePackages = "com.jwsaas") +@ImportResource(locations = { "classpath*:META-INF/spring/spring-*.xml" }) +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/Global.java b/food-waimai-web/src/main/java/com/jwsaas/Global.java new file mode 100644 index 0000000..a7ea8ad --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/Global.java @@ -0,0 +1,13 @@ +package com.jwsaas; + +public class Global { + + public static final String APP_SIGN = "foodWaiMai"; + + // 树路径(path)分隔符 + public static final String PATH_SEPARATOR = ","; + + //是否启用MQ上传 + public static final boolean USEMQ = true; + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/config/MQMessageSender.java b/food-waimai-web/src/main/java/com/jwsaas/config/MQMessageSender.java new file mode 100644 index 0000000..15e7843 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/config/MQMessageSender.java @@ -0,0 +1,67 @@ +package com.jwsaas.config; + +import java.util.Map; + +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.amqp.rabbit.support.CorrelationData; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.jwsaas.utils.JSONUtil; + +@Component +public class MQMessageSender { + + @Autowired + private RabbitTemplate rabbitTemplate; + + public void send4elemecreate(String tenantId, Map message, CorrelationData correlationData) throws Exception { + message.put("tenantId", tenantId); + this.rabbitTemplate.convertAndSend(RabbitConstant.EXCHANGE_NAME, RabbitConstant.ROUTING_KEY_ELEME_CREATE, JSONUtil.toJSONString(message), correlationData); + } + + public void send4elemeupdate(String tenantId, Map message, CorrelationData correlationData) throws Exception { + message.put("tenantId", tenantId); + this.rabbitTemplate.convertAndSend(RabbitConstant.EXCHANGE_NAME, RabbitConstant.ROUTING_KEY_ELEME_UPDATE, JSONUtil.toJSONString(message), correlationData); + } + + public void send4meituancreate(String tenantId, Map message, CorrelationData correlationData) throws Exception { + message.put("tenantId", tenantId); + this.rabbitTemplate.convertAndSend(RabbitConstant.EXCHANGE_NAME, RabbitConstant.ROUTING_KEY_MEITUAN_CREATE, JSONUtil.toJSONString(message), correlationData); + } + + public void send4meituanupdate(String tenantId, Map message, CorrelationData correlationData) throws Exception { + message.put("tenantId", tenantId); + this.rabbitTemplate.convertAndSend(RabbitConstant.EXCHANGE_NAME, RabbitConstant.ROUTING_KEY_MEITUAN_UPDATE, JSONUtil.toJSONString(message), correlationData); + } + + public void send4qimaicreate(String tenantId, Map message, CorrelationData correlationData) throws Exception { + message.put("tenantId", tenantId); + this.rabbitTemplate.convertAndSend(RabbitConstant.EXCHANGE_NAME, RabbitConstant.ROUTING_KEY_QIMAI_CREATE, JSONUtil.toJSONString(message), correlationData); + } + + public void send4qimaiupdate(String tenantId, Map message, CorrelationData correlationData) throws Exception { + message.put("tenantId", tenantId); + this.rabbitTemplate.convertAndSend(RabbitConstant.EXCHANGE_NAME, RabbitConstant.ROUTING_KEY_QIMAI_UPDATE, JSONUtil.toJSONString(message), correlationData); + } + + public void send4tidiancreate(String tenantId, Map message, CorrelationData correlationData) throws Exception { + message.put("tenantId", tenantId); + this.rabbitTemplate.convertAndSend(RabbitConstant.EXCHANGE_NAME, RabbitConstant.ROUTING_KEY_TIDIAN_CREATE, JSONUtil.toJSONString(message), correlationData); + } + + public void send4tidianupdate(String tenantId, Map message, CorrelationData correlationData) throws Exception { + message.put("tenantId", tenantId); + this.rabbitTemplate.convertAndSend(RabbitConstant.EXCHANGE_NAME, RabbitConstant.ROUTING_KEY_TIDIAN_UPDATE, JSONUtil.toJSONString(message), correlationData); + } + + public void send4shopmeituancreate(String tenantId, Map message, CorrelationData correlationData) throws Exception { + message.put("tenantId", tenantId); + this.rabbitTemplate.convertAndSend(RabbitConstant.EXCHANGE_NAME, RabbitConstant.ROUTING_KEY_SHOPMEITUAN_CREATE, JSONUtil.toJSONString(message), correlationData); + } + + public void send4shopmeituanupdate(String tenantId, Map message, CorrelationData correlationData) throws Exception { + message.put("tenantId", tenantId); + this.rabbitTemplate.convertAndSend(RabbitConstant.EXCHANGE_NAME, RabbitConstant.ROUTING_KEY_SHOPMEITUAN_UPDATE, JSONUtil.toJSONString(message), correlationData); + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/config/RabbitConstant.java b/food-waimai-web/src/main/java/com/jwsaas/config/RabbitConstant.java new file mode 100644 index 0000000..e4b1fe1 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/config/RabbitConstant.java @@ -0,0 +1,70 @@ +package com.jwsaas.config; + +public class RabbitConstant { + + public final static String EXCHANGE_NAME = "exchange";// 交换器 + + /** + * 饿了么相关 + */ + public final static String QUEUE_NAME_ELEME_CREATE = "queue4elemecreate";// 饿了么新订单 + + public final static String ROUTING_KEY_ELEME_CREATE = "routing4elemecreate";// 饿了么新订单 + + + public final static String QUEUE_NAME_ELEME_UPDATE = "queue4elemeupdate";// 饿了么更新订单 + + public final static String ROUTING_KEY_ELEME_UPDATE = "routing4elemeupdate";// 饿了么更新订单 + + /** + * 美团相关 + */ + public final static String QUEUE_NAME_MEITUAN_CREATE = "queue4meituancreate";// 美团新订单 + + public final static String ROUTING_KEY_MEITUAN_CREATE = "routing4meituancreate";// 美团新订单 + + + public final static String QUEUE_NAME_MEITUAN_UPDATE = "queue4meituanupdate";// 美团更新订单 + + public final static String ROUTING_KEY_MEITUAN_UPDATE = "routing4meituanupdate";// 美团更新订单 + + + /** + * 企迈相关 + */ + public final static String QUEUE_NAME_QIMAI_CREATE = "queue4qimaicreate";// 企迈新订单 + + public final static String ROUTING_KEY_QIMAI_CREATE = "routing4qimaicreate";// 企迈新订单 + + + public final static String QUEUE_NAME_QIMAI_UPDATE = "queue4qimaiupdate";// 企迈更新订单 + + public final static String ROUTING_KEY_QIMAI_UPDATE = "routing4qimaiupdate";// 企迈更新订单 + + + /** + * 提点相关 + */ + public final static String QUEUE_NAME_TIDIAN_CREATE = "queue4tidiancreate";// 提点新订单 + + public final static String ROUTING_KEY_TIDIAN_CREATE = "routing4tidiancreate";// 提点新订单 + + + public final static String QUEUE_NAME_TIDIAN_UPDATE = "queue4tidianupdate";// 提点更新订单 + + public final static String ROUTING_KEY_TIDIAN_UPDATE = "routing4tidianupdate";// 提点更新订单 + + + /** + * 商家美团相关 + */ + public final static String QUEUE_NAME_SHOPMEITUAN_CREATE = "queue4shopmeituancreate";// 商家美团新订单 + + public final static String ROUTING_KEY_SHOPMEITUAN_CREATE = "routing4shopmeituancreate";// 商家美团新订单 + + public final static String QUEUE_NAME_SHOPMEITUAN_UPDATE = "queue4shopmeituanupdate";// 商家美团更新订单 + + public final static String ROUTING_KEY_SHOPMEITUAN_UPDATE = "routing4shopmeituanupdate";// 商家美团更新订单 + + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/config/RabbitMQConfig.java b/food-waimai-web/src/main/java/com/jwsaas/config/RabbitMQConfig.java new file mode 100644 index 0000000..fb29102 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/config/RabbitMQConfig.java @@ -0,0 +1,187 @@ +package com.jwsaas.config; + +import org.springframework.amqp.core.Binding; +import org.springframework.amqp.core.BindingBuilder; +import org.springframework.amqp.core.DirectExchange; +import org.springframework.amqp.core.Queue; +import org.springframework.amqp.core.QueueBuilder; +import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; +import org.springframework.amqp.rabbit.connection.ConnectionFactory; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Scope; + +@Configuration +public class RabbitMQConfig { + + @Value("${spring.rabbitmq.host}") + private String host; + + @Value("${spring.rabbitmq.port}") + private String port; + + @Value("${spring.rabbitmq.username}") + private String username; + + @Value("${spring.rabbitmq.password}") + private String password; + + @Value("${spring.rabbitmq.publisher-confirms}") + private Boolean publisherConfirms; + + @Value("${spring.rabbitmq.virtual-host}") + private String virtualHost; + + // 创建工厂连接 + @Bean + public ConnectionFactory connectionFactory() { + CachingConnectionFactory connectionFactory = new CachingConnectionFactory(); + connectionFactory.setAddresses(this.host); + connectionFactory.setUsername(this.username); + connectionFactory.setPassword(this.password); + connectionFactory.setVirtualHost(this.virtualHost); + /** 如果要进行消息回调,则这里必须要设置为true */ + connectionFactory.setPublisherConfirms(this.publisherConfirms); // 必须要设置 + connectionFactory.setChannelCacheSize(100); + return connectionFactory; + } + + // rabbitmq的模板配置 + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) // 必须是prototype类型(因为要设置回调类,所以应是prototype类型,如果是singleton类型,则回调类为最后一次设置) + public RabbitTemplate rabbitTemplate() { + RabbitTemplate template = new RabbitTemplate(this.connectionFactory()); + // template.setConfirmCallback(); 设置消息确认 + // template.setReturnCallback(); + return template; + } + + // 直连交换机 + @Bean + public DirectExchange defaultExchange() { + return new DirectExchange(RabbitConstant.EXCHANGE_NAME); + } + + // 队列-饿了么新增订单 + @Bean(name = "queue4elemecreate") + public Queue queue4elemecreate() { + return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_ELEME_CREATE).build(); + } + + // 绑定-饿了么新增订单 + @Bean(name = "binding4elemecreate") + public Binding binding4elemecreate() { + return BindingBuilder.bind(this.queue4elemecreate()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_ELEME_CREATE); + } + + // 队列-饿了么更新订单 + @Bean(name = "queue4elemeupdate") + public Queue queue4elemeupdate() { + return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_ELEME_UPDATE).build(); + } + + // 绑定-饿了么更新订单 + @Bean(name = "binding4elemeupdate") + public Binding binding4elemeupdate() { + return BindingBuilder.bind(this.queue4elemeupdate()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_ELEME_UPDATE); + } + + // 队列-美团新增订单 + @Bean(name = "queue4meituancreate") + public Queue queue4meituancreate() { + return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_MEITUAN_CREATE).build(); + } + + // 绑定-美团新增订单 + @Bean(name = "binding4meituancreate") + public Binding binding4meituancreate() { + return BindingBuilder.bind(this.queue4meituancreate()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_MEITUAN_CREATE); + } + + // 队列-美团更新订单 + @Bean(name = "queue4meituanupdate") + public Queue queue4meituanupdate() { + return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_MEITUAN_UPDATE).build(); + } + + // 绑定-美团更新订单 + @Bean(name = "binding4meituanupdate") + public Binding binding4meituanupdate() { + return BindingBuilder.bind(this.queue4meituanupdate()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_MEITUAN_UPDATE); + } + + // 队列-企迈新增订单 + @Bean(name = "queue4qimaicreate") + public Queue queue4qimaicreate() { + return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_QIMAI_CREATE).build(); + } + + // 绑定-企迈新增订单 + @Bean(name = "binding4qimaicreate") + public Binding binding4qimaicreate() { + return BindingBuilder.bind(this.queue4qimaicreate()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_QIMAI_CREATE); + } + + // 队列-企迈更新订单 + @Bean(name = "queue4qimaiupdate") + public Queue queue4qimaiupdate() { + return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_QIMAI_UPDATE).build(); + } + + // 绑定-企迈更新订单 + @Bean(name = "binding4qimaiupdate") + public Binding binding4qimaiupdate() { + return BindingBuilder.bind(this.queue4qimaiupdate()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_QIMAI_UPDATE); + } + + // 队列-提点新增订单 + @Bean(name = "queue4tidiancreate") + public Queue queue4tidiancreate() { + return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_TIDIAN_CREATE).build(); + } + + // 绑定-提点新增订单 + @Bean(name = "binding4tidiancreate") + public Binding binding4tidiancreate() { + return BindingBuilder.bind(this.queue4tidiancreate()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_TIDIAN_CREATE); + } + + // 队列-提点更新订单 + @Bean(name = "queue4tidianupdate") + public Queue queue4tidianupdate() { + return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_TIDIAN_UPDATE).build(); + } + + // 绑定-提点更新订单 + @Bean(name = "binding4tidianupdate") + public Binding binding4tidianupdate() { + return BindingBuilder.bind(this.queue4tidianupdate()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_TIDIAN_UPDATE); + } + + // 队列-美团新增订单 + @Bean(name = "queue4shopmeituancreate") + public Queue queue4shopmeituancreate() { + return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_SHOPMEITUAN_CREATE).build(); + } + + // 绑定-美团新增订单 + @Bean(name = "binding4shopmeituancreate") + public Binding binding4shopmeituancreate() { + return BindingBuilder.bind(this.queue4shopmeituancreate()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_SHOPMEITUAN_CREATE); + } + + // 队列-美团更新订单 + @Bean(name = "queue4shopmeituanupdate") + public Queue queue4shopmeituanupdate() { + return QueueBuilder.durable(RabbitConstant.QUEUE_NAME_SHOPMEITUAN_UPDATE).build(); + } + + // 绑定-美团更新订单 + @Bean(name = "binding4shopmeituanupdate") + public Binding binding4shopmeituanupdate() { + return BindingBuilder.bind(this.queue4shopmeituanupdate()).to(this.defaultExchange()).with(RabbitConstant.ROUTING_KEY_SHOPMEITUAN_UPDATE); + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/BaseController.java b/food-waimai-web/src/main/java/com/jwsaas/controller/BaseController.java new file mode 100644 index 0000000..20dd890 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/BaseController.java @@ -0,0 +1,51 @@ +package com.jwsaas.controller; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class BaseController { + + protected Logger logger = LoggerFactory.getLogger(getClass()); + + // 获取Parameter + public String getParameter(HttpServletRequest request, String name) { + return request.getParameter(name); + } + + // 获取Parameter数组 + public String[] getParameterValues(HttpServletRequest request, String name) { + return request.getParameterValues(name); + } + + public String getIpAddress(HttpServletRequest request) { + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + return ip; + } + + public static String filter(String str) { + if (str.trim().isEmpty()) { + return str; + } + String pattern = "[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]"; + String reStr = ""; + Pattern emoji = Pattern.compile(pattern); + Matcher emojiMatcher = emoji.matcher(str); + str = emojiMatcher.replaceAll(reStr); + return str; + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/IndexController.java b/food-waimai-web/src/main/java/com/jwsaas/controller/IndexController.java new file mode 100644 index 0000000..36787c3 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/IndexController.java @@ -0,0 +1,15 @@ +package com.jwsaas.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class IndexController extends BaseController { + + @RequestMapping(value = { "", "index" }) + public String index(Model model) { + return "index"; + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/BaiduOrderEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/BaiduOrderEntity.java new file mode 100644 index 0000000..f01df51 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/BaiduOrderEntity.java @@ -0,0 +1,512 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +public class BaiduOrderEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + private String body;// 订单内容 + + private String source;// 百度应用编号 + + private String shopId;// 商户ID + + private String baiduShopId;// 百度商户ID + + private String baiduShopName;// 百度商户名称 + + private String orderId;// 订单ID + + private Integer sendImmediately;// 是否立即送餐 + + private String orderIndex;// 订单当日流水号 + + private Integer status;// 订单状态 + + private Integer expectTimeMode;// 送达时间类型 + + private String sendTime;// 期望送达时间 + + private String pickupTime;// 取餐时间 + + private String atshopTime;// 到店时间 + + private String deliveryTime;// 送餐时间 + + private String deliveryPhone;// 骑士手机号 + + private String finishedTime;// 完成时间 + + private String confirmTime;// 确认时间 + + private String cancelTime;// 取消时间 + + private Integer sendFee;// 配送费 + + private Integer packageFee;// 餐盒费 + + private Integer discountFee;// 优惠总金额 + + private Integer shopFee;// 商户应收金额 + + private Integer totalFee;// 订单总金额 + + private Integer userFee;// 用户实付金额 + + private Integer payType;// 付款类型 + + private Integer needInvoice;// 是否需要发票 + + private String invoiceTitle;// 发票抬头 + + private String remark;// 订单备注 + + private Integer deliveryParty;// 物流类型 + + private String createTime;// 创建时间 + + private String mealNum;// 餐具数量 + + private String responsibleParty;// 取消订单责任承担方 + + private Integer commission;// 佣金 + + private String user;// 订单客户信息 + + private String shop;// 商户信息 + + private String products;// 订单商品信息数组 + + private String discount;// 优惠信息 + + private String partRefundInfo;// 部分退款 + + private List productList;// 商品信息列表 + + public BaiduOrderEntity(JSONObject jsonObject) { + body = jsonObject.toJSONString(); + if (jsonObject.containsKey("body")) { + JSONObject boday = jsonObject.getJSONObject("body"); + if (boday.containsKey("errno")) { + Integer errno = boday.getInteger("errno"); + } + if (boday.containsKey("error")) { + String error = boday.getString("error"); + } + if (boday.containsKey("data")) { + JSONObject data = boday.getJSONObject("data"); + if (data.containsKey("source")) { + source = boday.getString("source"); + } + if (data.containsKey("shop")) { + shop = jsonObject.getString("shop"); + JSONObject shopJSON = data.getJSONObject("shop"); + if (shopJSON.containsKey("id")) + shopId = shopJSON.getString("id"); + if (shopJSON.containsKey("baidu_shop_id")) + baiduShopId = shopJSON.getString("baidu_shop_id"); + if (shopJSON.containsKey("name")) + baiduShopName = shopJSON.getString("name"); + } + if (data.containsKey("order")) { + JSONObject order = data.getJSONObject("order"); + if (order.containsKey("order_id")) + orderId = order.getString("order_id"); + if (order.containsKey("send_immediately")) + sendImmediately = order.getInteger("send_immediately"); + if (order.containsKey("order_index")) + orderIndex = order.getString("order_index"); + if (order.containsKey("status")) + status = order.getInteger("status"); + if (order.containsKey("expect_time_mode")) + expectTimeMode = order.getInteger("expect_time_mode"); + if (order.containsKey("send_time")) + sendTime = order.getString("send_time"); + if (order.containsKey("pickup_time")) + pickupTime = order.getString("pickup_time"); + if (order.containsKey("atshop_time")) + atshopTime = order.getString("atshop_time"); + if (order.containsKey("delivery_time")) + deliveryTime = order.getString("delivery_time"); + if (order.containsKey("delivery_phone")) + deliveryPhone = order.getString("delivery_phone"); + if (order.containsKey("finished_time")) + finishedTime = order.getString("finished_time"); + if (order.containsKey("confirm_time")) + confirmTime = order.getString("confirm_time"); + if (order.containsKey("cancel_time")) + cancelTime = order.getString("cancel_time"); + if (order.containsKey("send_fee")) + sendFee = order.getInteger("send_fee"); + if (order.containsKey("package_fee")) + packageFee = order.getInteger("package_fee"); + if (order.containsKey("discount_fee")) + discountFee = order.getInteger("discount_fee"); + if (order.containsKey("shop_fee")) + shopFee = order.getInteger("shop_fee"); + if (order.containsKey("total_fee")) + totalFee = order.getInteger("total_fee"); + if (order.containsKey("user_fee")) + userFee = order.getInteger("user_fee"); + if (order.containsKey("pay_type")) + payType = order.getInteger("pay_type"); + if (order.containsKey("need_invoice")) + needInvoice = order.getInteger("need_invoice"); + if (order.containsKey("invoice_title")) + invoiceTitle = order.getString("invoice_title"); + if (order.containsKey("remark")) + remark = order.getString("remark"); + if (order.containsKey("delivery_party")) + deliveryParty = order.getInteger("delivery_party"); + if (order.containsKey("create_time")) + createTime = order.getString("create_time"); + if (order.containsKey("meal_num")) + mealNum = order.getString("meal_num"); + if (order.containsKey("responsible_party")) + responsibleParty = order.getString("responsible_party"); + if (order.containsKey("commission")) + commission = order.getInteger("commission"); + } + if (data.containsKey("user")) { + user = data.getJSONObject("user").toJSONString(); + } + if (data.containsKey("products")) { + products = data.getJSONArray("products").toJSONString(); + JSONArray products = data.getJSONArray("products"); + productList = new ArrayList<>(); + for (int i = 0; i < products.size(); i++) { + JSONArray product = products.getJSONArray(i); + for (int j = 0; j < product.size(); j++) { + BaiduOrderProductEntity baiduOrderProductEntity = new BaiduOrderProductEntity(product.getJSONObject(j)); + productList.add(baiduOrderProductEntity); + } + } + } + if (data.containsKey("discount")) { + discount = data.getJSONArray("discount").toJSONString(); + } + if (data.containsKey("part_refund_info")) { + partRefundInfo = data.getJSONArray("part_refund_info").toJSONString(); + } + } + } + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getShopId() { + return shopId; + } + + public void setShopId(String shopId) { + this.shopId = shopId; + } + + public String getBaiduShopId() { + return baiduShopId; + } + + public void setBaiduShopId(String baiduShopId) { + this.baiduShopId = baiduShopId; + } + + public String getBaiduShopName() { + return baiduShopName; + } + + public void setBaiduShopName(String baiduShopName) { + this.baiduShopName = baiduShopName; + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public Integer getSendImmediately() { + return sendImmediately; + } + + public void setSendImmediately(Integer sendImmediately) { + this.sendImmediately = sendImmediately; + } + + public String getOrderIndex() { + return orderIndex; + } + + public void setOrderIndex(String orderIndex) { + this.orderIndex = orderIndex; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Integer getExpectTimeMode() { + return expectTimeMode; + } + + public void setExpectTimeMode(Integer expectTimeMode) { + this.expectTimeMode = expectTimeMode; + } + + public String getSendTime() { + return sendTime; + } + + public void setSendTime(String sendTime) { + this.sendTime = sendTime; + } + + public String getPickupTime() { + return pickupTime; + } + + public void setPickupTime(String pickupTime) { + this.pickupTime = pickupTime; + } + + public String getAtshopTime() { + return atshopTime; + } + + public void setAtshopTime(String atshopTime) { + this.atshopTime = atshopTime; + } + + public String getDeliveryTime() { + return deliveryTime; + } + + public void setDeliveryTime(String deliveryTime) { + this.deliveryTime = deliveryTime; + } + + public String getDeliveryPhone() { + return deliveryPhone; + } + + public void setDeliveryPhone(String deliveryPhone) { + this.deliveryPhone = deliveryPhone; + } + + public String getFinishedTime() { + return finishedTime; + } + + public void setFinishedTime(String finishedTime) { + this.finishedTime = finishedTime; + } + + public String getConfirmTime() { + return confirmTime; + } + + public void setConfirmTime(String confirmTime) { + this.confirmTime = confirmTime; + } + + public String getCancelTime() { + return cancelTime; + } + + public void setCancelTime(String cancelTime) { + this.cancelTime = cancelTime; + } + + public Integer getSendFee() { + return sendFee; + } + + public void setSendFee(Integer sendFee) { + this.sendFee = sendFee; + } + + public Integer getPackageFee() { + return packageFee; + } + + public void setPackageFee(Integer packageFee) { + this.packageFee = packageFee; + } + + public Integer getDiscountFee() { + return discountFee; + } + + public void setDiscountFee(Integer discountFee) { + this.discountFee = discountFee; + } + + public Integer getShopFee() { + return shopFee; + } + + public void setShopFee(Integer shopFee) { + this.shopFee = shopFee; + } + + public Integer getTotalFee() { + return totalFee; + } + + public void setTotalFee(Integer totalFee) { + this.totalFee = totalFee; + } + + public Integer getUserFee() { + return userFee; + } + + public void setUserFee(Integer userFee) { + this.userFee = userFee; + } + + public Integer getPayType() { + return payType; + } + + public void setPayType(Integer payType) { + this.payType = payType; + } + + public Integer getNeedInvoice() { + return needInvoice; + } + + public void setNeedInvoice(Integer needInvoice) { + this.needInvoice = needInvoice; + } + + public String getInvoiceTitle() { + return invoiceTitle; + } + + public void setInvoiceTitle(String invoiceTitle) { + this.invoiceTitle = invoiceTitle; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public Integer getDeliveryParty() { + return deliveryParty; + } + + public void setDeliveryParty(Integer deliveryParty) { + this.deliveryParty = deliveryParty; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getMealNum() { + return mealNum; + } + + public void setMealNum(String mealNum) { + this.mealNum = mealNum; + } + + public String getResponsibleParty() { + return responsibleParty; + } + + public void setResponsibleParty(String responsibleParty) { + this.responsibleParty = responsibleParty; + } + + public Integer getCommission() { + return commission; + } + + public void setCommission(Integer commission) { + this.commission = commission; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getShop() { + return shop; + } + + public void setShop(String shop) { + this.shop = shop; + } + + public String getProducts() { + return products; + } + + public void setProducts(String products) { + this.products = products; + } + + public String getDiscount() { + return discount; + } + + public void setDiscount(String discount) { + this.discount = discount; + } + + public String getPartRefundInfo() { + return partRefundInfo; + } + + public void setPartRefundInfo(String partRefundInfo) { + this.partRefundInfo = partRefundInfo; + } + + public List getProductList() { + return productList; + } + + public void setProductList(List productList) { + this.productList = productList; + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/BaiduOrderProductEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/BaiduOrderProductEntity.java new file mode 100644 index 0000000..a02168c --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/BaiduOrderProductEntity.java @@ -0,0 +1,283 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +public class BaiduOrderProductEntity implements Serializable { + private static final long serialVersionUID = 1379568009771599898L; + + private String orderId;// 订单ID + + private String baiduProductId;// 百度商品ID + + private String otherDishId;// 第三方菜品ID + + private String productId;// 第三方套餐ID + + private String upc;// 商品UPC + + private Integer productType;// 菜品类型 + + private String productName;// 商品名称 + + private Integer productAmount;// 商品份数 + + private Integer productPrice;// 价格 + + private String productAttr;// 商品规格 + + private String baiduAttrId;// 百度规格ID + + private String attrId;// 第三方规格ID + + private String option;// 规格名称 + + private String productFeatures;// 商品属性 + + private Integer productFee;// 商品总价 + + private Integer packageFee;// 餐盒总价 + + private Integer packagePrice;// 餐盒单价 + + private Integer packageAmount;// 餐盒数量 + + private Integer totalFee;// 总价 + + private String productCustomIndex;// 商品唯一串 + + private Integer isFixedPrice;// 是否固定价格 + + private String group;// 套餐内组合 + + public BaiduOrderProductEntity(JSONObject jsonObject) { + if (jsonObject.containsKey("baidu_product_id")) + baiduProductId = jsonObject.getString("baidu_product_id"); + if (jsonObject.containsKey("other_dish_id")) + otherDishId = jsonObject.getString("other_dish_id"); + if (jsonObject.containsKey("product_id")) + productId = jsonObject.getString("product_id"); + if (jsonObject.containsKey("upc")) + upc = jsonObject.getString("upc"); + if (jsonObject.containsKey("product_type")) + productType = jsonObject.getInteger("product_type"); + if (jsonObject.containsKey("product_name")) + productName = jsonObject.getString("product_name"); + if (jsonObject.containsKey("product_amount")) + productAmount = jsonObject.getInteger("product_amount"); + if (jsonObject.containsKey("product_price")) + productPrice = jsonObject.getInteger("product_price"); + if (jsonObject.containsKey("product_attr")) { + productAttr = jsonObject.getString("product_attr"); + JSONArray product_attr = jsonObject.getJSONArray("product_attr"); + // 规格解析 + for (int i = 0; i < product_attr.size(); i++) { + JSONObject attr = product_attr.getJSONObject(i); + if (attr.containsKey("baidu_attr_id")) + baiduAttrId = attr.getString("baidu_attr_id"); + if (attr.containsKey("attr_id")) + attrId = attr.getString("attr_id"); + if (attr.containsKey("option")) + option = attr.getString("option"); + } + } + if (jsonObject.containsKey("product_features")) + productFeatures = jsonObject.getString("product_features"); + if (jsonObject.containsKey("product_fee")) + productFee = jsonObject.getInteger("product_fee"); + if (jsonObject.containsKey("package_fee")) + packageFee = jsonObject.getInteger("package_fee"); + if (jsonObject.containsKey("package_price")) + packagePrice = jsonObject.getInteger("package_price"); + if (jsonObject.containsKey("package_amount")) + packageAmount = jsonObject.getInteger("package_amount"); + if (jsonObject.containsKey("total_fee")) + totalFee = jsonObject.getInteger("total_fee"); + if (jsonObject.containsKey("product_custom_index")) + productCustomIndex = jsonObject.getString("product_custom_index"); + if (jsonObject.containsKey("is_fixed_price")) + isFixedPrice = jsonObject.getInteger("is_fixed_price"); + if (jsonObject.containsKey("group")) + group = jsonObject.getString("group"); + + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getBaiduProductId() { + return baiduProductId; + } + + public void setBaiduProductId(String baiduProductId) { + this.baiduProductId = baiduProductId; + } + + public String getOtherDishId() { + return otherDishId; + } + + public void setOtherDishId(String otherDishId) { + this.otherDishId = otherDishId; + } + + public String getProductId() { + return productId; + } + + public void setProductId(String productId) { + this.productId = productId; + } + + public String getUpc() { + return upc; + } + + public void setUpc(String upc) { + this.upc = upc; + } + + public Integer getProductType() { + return productType; + } + + public void setProductType(Integer productType) { + this.productType = productType; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Integer getProductAmount() { + return productAmount; + } + + public void setProductAmount(Integer productAmount) { + this.productAmount = productAmount; + } + + public Integer getProductPrice() { + return productPrice; + } + + public void setProductPrice(Integer productPrice) { + this.productPrice = productPrice; + } + + public String getProductAttr() { + return productAttr; + } + + public void setProductAttr(String productAttr) { + this.productAttr = productAttr; + } + + public String getBaiduAttrId() { + return baiduAttrId; + } + + public void setBaiduAttrId(String baiduAttrId) { + this.baiduAttrId = baiduAttrId; + } + + public String getAttrId() { + return attrId; + } + + public void setAttrId(String attrId) { + this.attrId = attrId; + } + + public String getOption() { + return option; + } + + public void setOption(String option) { + this.option = option; + } + + public String getProductFeatures() { + return productFeatures; + } + + public void setProductFeatures(String productFeatures) { + this.productFeatures = productFeatures; + } + + public Integer getProductFee() { + return productFee; + } + + public void setProductFee(Integer productFee) { + this.productFee = productFee; + } + + public Integer getPackageFee() { + return packageFee; + } + + public void setPackageFee(Integer packageFee) { + this.packageFee = packageFee; + } + + public Integer getPackagePrice() { + return packagePrice; + } + + public void setPackagePrice(Integer packagePrice) { + this.packagePrice = packagePrice; + } + + public Integer getPackageAmount() { + return packageAmount; + } + + public void setPackageAmount(Integer packageAmount) { + this.packageAmount = packageAmount; + } + + public Integer getTotalFee() { + return totalFee; + } + + public void setTotalFee(Integer totalFee) { + this.totalFee = totalFee; + } + + public String getProductCustomIndex() { + return productCustomIndex; + } + + public void setProductCustomIndex(String productCustomIndex) { + this.productCustomIndex = productCustomIndex; + } + + public Integer getIsFixedPrice() { + return isFixedPrice; + } + + public void setIsFixedPrice(Integer isFixedPrice) { + this.isFixedPrice = isFixedPrice; + } + + public String getGroup() { + return group; + } + + public void setGroup(String group) { + this.group = group; + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/BaiduWaimaiOrderController.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/BaiduWaimaiOrderController.java new file mode 100644 index 0000000..3ac9d40 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/BaiduWaimaiOrderController.java @@ -0,0 +1,148 @@ +package com.jwsaas.controller.waimai; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.alibaba.fastjson.JSONObject; +import com.jwsaas.Global; +import com.jwsaas.controller.BaseController; +import com.jwsaas.entity.food.BaiduOrder; +import com.jwsaas.entity.food.BaiduOrderProduct; +import com.jwsaas.service.food.BaiduOrderProductService; +import com.jwsaas.service.food.BaiduOrderService; +import com.vdurmont.emoji.EmojiParser; + +@Controller(Global.APP_SIGN + "BaiduWaimaiOrderController") +@RequestMapping("/waimai/baidu") +public class BaiduWaimaiOrderController extends BaseController { + + @Resource + private BaiduOrderService baiduOrderService; + + @Resource + private BaiduOrderProductService baiduOrderProductService; + + @RequestMapping(value = "/order", method = { RequestMethod.POST }) + @ResponseBody + public Object order(HttpServletRequest request, HttpServletResponse response) { + String info = "百度外卖订单推送"; + Map result = new HashMap<>(); + try { + String type = getParameter(request, "type");// 1新增;2修改 + String tenantId = getParameter(request, "tenantId");// 企业编号 + String body = getParameter(request, "body"); + body = EmojiParser.removeAllEmojis(body); + logger.error(tenantId); + logger.error(body); + Date createDate = new Date(); + String createUser = "push-user"; + BaiduOrderEntity baiduOrderEntity = new BaiduOrderEntity(JSONObject.parseObject(EmojiParser.removeAllEmojis(body))); + BaiduOrder baiduOrder = new BaiduOrder(); + baiduOrder.setBody(baiduOrderEntity.getBody()); + baiduOrder.setAtshopTime(baiduOrderEntity.getAtshopTime()); + baiduOrder.setBaiduShopId(baiduOrderEntity.getBaiduShopId()); + baiduOrder.setBaiduShopName(baiduOrderEntity.getBaiduShopName()); + baiduOrder.setCancelTime(baiduOrderEntity.getCancelTime()); + baiduOrder.setCommission(baiduOrderEntity.getCommission()); + baiduOrder.setConfirmTime(baiduOrderEntity.getConfirmTime()); + baiduOrder.setCreateDate(createDate); + baiduOrder.setCreateTime(baiduOrderEntity.getCreateTime()); + baiduOrder.setCreateUser(createUser); + baiduOrder.setDeliveryParty(baiduOrderEntity.getDeliveryParty()); + baiduOrder.setDeliveryPhone(baiduOrderEntity.getDeliveryPhone()); + baiduOrder.setDeliveryTime(baiduOrderEntity.getDeliveryTime()); + baiduOrder.setDiscount(baiduOrderEntity.getDiscount()); + baiduOrder.setDiscountFee(baiduOrderEntity.getDiscountFee()); + baiduOrder.setExpectTimeMode(baiduOrderEntity.getExpectTimeMode()); + baiduOrder.setFinishedTime(baiduOrderEntity.getFinishedTime()); + baiduOrder.setInvoiceTitle(baiduOrderEntity.getInvoiceTitle()); + baiduOrder.setMealNum(baiduOrderEntity.getMealNum()); + baiduOrder.setNeedInvoice(baiduOrderEntity.getNeedInvoice()); + baiduOrder.setOrderId(baiduOrderEntity.getOrderId()); + baiduOrder.setOrderIndex(baiduOrderEntity.getOrderIndex()); + baiduOrder.setPackageFee(baiduOrderEntity.getPackageFee()); + baiduOrder.setPartRefundInfo(baiduOrderEntity.getPartRefundInfo()); + baiduOrder.setPayType(baiduOrderEntity.getPayType()); + baiduOrder.setPickupTime(baiduOrderEntity.getPickupTime()); + baiduOrder.setProducts(baiduOrderEntity.getProducts()); + baiduOrder.setRemark(baiduOrderEntity.getRemark()); + baiduOrder.setResponsibleParty(baiduOrderEntity.getResponsibleParty()); + baiduOrder.setSendFee(baiduOrderEntity.getSendFee()); + baiduOrder.setSendImmediately(baiduOrderEntity.getSendImmediately()); + baiduOrder.setSendTime(baiduOrderEntity.getSendTime()); + baiduOrder.setShop(baiduOrderEntity.getShop()); + baiduOrder.setShopFee(baiduOrderEntity.getSendFee()); + baiduOrder.setShopId(baiduOrderEntity.getShopId()); + baiduOrder.setSource(baiduOrderEntity.getSource()); + baiduOrder.setStatus(baiduOrderEntity.getStatus()); + baiduOrder.setTenantId(tenantId); + baiduOrder.setTotalFee(baiduOrderEntity.getTotalFee()); + baiduOrder.setUser(baiduOrderEntity.getUser()); + baiduOrder.setUserFee(baiduOrderEntity.getUserFee()); + List list = baiduOrderEntity.getProductList(); + List productList = new ArrayList<>(); + for (BaiduOrderProductEntity baiduOrderProductEntity : list) { + BaiduOrderProduct order = new BaiduOrderProduct(); + order.setAttrId(baiduOrderProductEntity.getAttrId()); + order.setBaiduAttrId(baiduOrderProductEntity.getBaiduAttrId()); + order.setBaiduProductId(baiduOrderProductEntity.getBaiduProductId()); + order.setCreateDate(createDate); + order.setCreateUser(createUser); + order.setGroup(baiduOrderProductEntity.getGroup()); + order.setIsFixedPrice(baiduOrderProductEntity.getIsFixedPrice()); + order.setOption(baiduOrderProductEntity.getOption()); + order.setOrderId(baiduOrder.getOrderId()); + order.setOtherDishId(baiduOrderProductEntity.getOtherDishId()); + order.setPackageAmount(baiduOrderProductEntity.getPackageAmount()); + order.setPackageFee(baiduOrderProductEntity.getPackageFee()); + order.setPackagePrice(baiduOrderProductEntity.getPackagePrice()); + order.setProductAmount(baiduOrderProductEntity.getPackageAmount()); + order.setProductAttr(baiduOrderProductEntity.getProductAttr()); + order.setProductCustomIndex(baiduOrderProductEntity.getProductCustomIndex()); + order.setProductFeatures(baiduOrderProductEntity.getProductFeatures()); + order.setProductFee(baiduOrderProductEntity.getProductFee()); + order.setProductId(baiduOrderProductEntity.getProductId()); + order.setProductName(baiduOrderProductEntity.getProductName()); + order.setProductPrice(baiduOrderProductEntity.getProductPrice()); + order.setProductType(baiduOrderProductEntity.getProductType()); + order.setTenantId(tenantId); + order.setTotalFee(baiduOrderProductEntity.getTotalFee()); + order.setUpc(baiduOrderProductEntity.getUpc()); + productList.add(order); + } + List orderList = baiduOrderService.findList(tenantId, "orderId", baiduOrder.getOrderId()); + if ("1".equals(type)) { + logger.error("百度外卖订单推送,订单新增====>>:", orderList.size()); + if (orderList == null || orderList.size() <= 0) { + baiduOrderService.saveOrder(tenantId, baiduOrder, productList); + } + } else if ("2".equals(type)) { + logger.error("百度外卖订单推送,订单数量====>>:", orderList.size()); + if (orderList != null && orderList.size() > 0) { + BaiduOrder oldBaiduOrder = orderList.get(0); + baiduOrder.setId(oldBaiduOrder.getId()); + baiduOrderService.update(tenantId, baiduOrder); + } + } + result.put("orderId", baiduOrder.getOrderId()); + result.put("storeId", baiduOrder.getShopId()); + result.put("status", "success"); + } catch (Exception e) { + logger.error("百度外卖订单推送:", e); + result.put("status", "error"); + } + return result; + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ElemeOrderDetailEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ElemeOrderDetailEntity.java new file mode 100644 index 0000000..f4e0de3 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ElemeOrderDetailEntity.java @@ -0,0 +1,493 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.jwsaas.utils.DateUtils; + +public class ElemeOrderDetailEntity implements Serializable { + + private static final long serialVersionUID = -3105563592467144321L; + + private String storeId;// 系统门店ID + + private String orderId;// 饿了么订单id + + private String address;// 顾客送餐地址 + + private String createdAt;// 下单时间 + + private String activeAt;// 订单生效时间 + + private Double deliverFee;// 配送费 + + private String deliverTime;// 送餐时间 + + private String description;// 订单备注 + + private String invoice;// 发票抬头 + + private Integer isBook;// 是否预订单 + + private Integer isOnlinePaid;// 是否在线支付 + + private String phoneList;// 顾客联系电话 + + private String shopId;// 店铺Id + + private String shopName;// 店铺名称 + + private Integer daySn;// 店铺当日订单流水号 + + private String status;// 订单状态 + + private String refundStatus;// 退单状态 + + private String userId;// 用户id + + private Double totalPrice;// 订单总价 + + private Double originalPrice;// 原始价格 + + private String consignee;// 订单收货人 + + private String deliveryGeo;// 订单收货地址经纬度 + + private String deliveryPoiAddress;// 顾客送餐详情地址 + + private Integer invoiced;// 是否需要发票 + + private Double income;// 店铺实收 + + private Double serviceRate;// 饿了么服务费率 + + private Double serviceFee;// 饿了么服务费 + + private Double hongbao;// 订单中红包金额 + + private Double packageFee;// 餐盒费 + + private Double activityTotal;// 订单活动总额 + + private Double shopPart;// 店铺承担活动费用 + + private Double elemePart;// 饿了么承担活动费用 + + private Integer downgraded;// 降级标识 + + private List list; + + public static String jsonGetDate(JSONObject jsonObject, String key) { + String value = null; + try { + value = DateUtils.format(jsonObject.getDate(key), DateUtils.SHOW_DATETIME_FORMAT); + } catch (Exception e) { + value = null; + } + return value; + } + + public ElemeOrderDetailEntity() { + + } + + public ElemeOrderDetailEntity(JSONObject jsonObject) { + if (jsonObject.containsKey("address")) { + address = jsonObject.getString("address"); + } + if (jsonObject.containsKey("createdAt")) { + createdAt = jsonGetDate(jsonObject, "createdAt"); + } + if (jsonObject.containsKey("activeAt")) { + activeAt = jsonGetDate(jsonObject, "activeAt"); + } + if (jsonObject.containsKey("deliverFee")) { + deliverFee = jsonObject.getDouble("deliverFee"); + } + if (jsonObject.containsKey("deliverTime")) { + deliverTime = jsonGetDate(jsonObject, "deliverTime"); + } + if (jsonObject.containsKey("description")) { + description = jsonObject.getString("description"); + } + if (jsonObject.containsKey("invoice")) { + invoice = jsonObject.getString("invoice"); + } + if (jsonObject.containsKey("book")) { + isBook = jsonObject.getBoolean("book") ? 1 : 0; + } + if (jsonObject.containsKey("onlinePaid")) { + isOnlinePaid = jsonObject.getBoolean("onlinePaid") ? 1 : 0; + } + if (jsonObject.containsKey("id")) { + orderId = jsonObject.getString("id"); + } + if (jsonObject.containsKey("phoneList")) { + phoneList = jsonObject.getJSONArray("phoneList").toString(); + } + if (jsonObject.containsKey("shopId")) { + shopId = String.valueOf(jsonObject.getLong("shopId")); + } + if (jsonObject.containsKey("shopName")) { + shopName = jsonObject.getString("shopName"); + } + if (jsonObject.containsKey("daySn")) { + daySn = jsonObject.getInteger("daySn"); + } + if (jsonObject.containsKey("status")) { + status = jsonObject.getString("status"); + } + if (jsonObject.containsKey("refundStatus")) { + refundStatus = jsonObject.getString("refundStatus"); + } + if (jsonObject.containsKey("userId")) { + userId = String.valueOf(jsonObject.getLong("userId")); + } + if (jsonObject.containsKey("totalPrice")) { + totalPrice = jsonObject.getDouble("totalPrice"); + } + if (jsonObject.containsKey("originalPrice")) { + originalPrice = jsonObject.getDouble("originalPrice"); + } + if (jsonObject.containsKey("consignee")) { + consignee = jsonObject.getString("consignee"); + } + if (jsonObject.containsKey("deliveryGeo")) { + deliveryGeo = jsonObject.getString("deliveryGeo"); + } + if (jsonObject.containsKey("deliveryPoiAddress")) { + deliveryPoiAddress = jsonObject.getString("deliveryPoiAddress"); + } + if (jsonObject.containsKey("invoiced")) { + invoiced = jsonObject.getBoolean("invoiced") ? 1 : 0; + } + if (jsonObject.containsKey("income")) { + income = jsonObject.getDouble("income"); + } + if (jsonObject.containsKey("serviceRate")) { + serviceRate = jsonObject.getDouble("serviceRate"); + } + if (jsonObject.containsKey("serviceFee")) { + serviceFee = jsonObject.getDouble("serviceFee"); + } + if (jsonObject.containsKey("hongbao")) { + hongbao = jsonObject.getDouble("hongbao"); + } + if (jsonObject.containsKey("packageFee")) { + packageFee = jsonObject.getDouble("packageFee"); + } + if (jsonObject.containsKey("activityTotal")) { + activityTotal = jsonObject.getDouble("activityTotal"); + } + if (jsonObject.containsKey("shopPart")) { + shopPart = jsonObject.getDouble("shopPart"); + } + if (jsonObject.containsKey("elemePart")) { + elemePart = jsonObject.getDouble("elemePart"); + } + if (jsonObject.containsKey("downgraded")) { + downgraded = jsonObject.getBoolean("downgraded") ? 1 : 0; + } + if (jsonObject.containsKey("groups")) { + list = new ArrayList(); + JSONArray groups = jsonObject.getJSONArray("groups"); + for (int i = 0; i < groups.size(); i++) { + JSONObject groupObject = groups.getJSONObject(i); + String groupName = ""; + if (groupObject.containsKey("name")) { + groupName = groupObject.getString("name"); + } + String groupType = ""; + if (groupObject.containsKey("type")) { + groupType = groupObject.getString("type"); + } + if (groupObject.containsKey("items")) { + JSONArray items = groupObject.getJSONArray("items"); + for (int j = 0; j < items.size(); j++) { + ElemeOrderDetailGroupEntity entity = new ElemeOrderDetailGroupEntity(items.getJSONObject(j)); + entity.setGroupName(groupName); + entity.setGroupType(groupType); + entity.setOrderId(orderId); + list.add(entity); + } + } + } + } + } + + public String getStoreId() { + return storeId; + } + + public void setStoreId(String storeId) { + this.storeId = storeId; + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Double getDeliverFee() { + return deliverFee; + } + + public void setDeliverFee(Double deliverFee) { + this.deliverFee = deliverFee; + } + + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public String getActiveAt() { + return activeAt; + } + + public void setActiveAt(String activeAt) { + this.activeAt = activeAt; + } + + public String getDeliverTime() { + return deliverTime; + } + + public void setDeliverTime(String deliverTime) { + this.deliverTime = deliverTime; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getInvoice() { + return invoice; + } + + public void setInvoice(String invoice) { + this.invoice = invoice; + } + + public Integer getIsBook() { + return isBook; + } + + public void setIsBook(Integer isBook) { + this.isBook = isBook; + } + + public Integer getIsOnlinePaid() { + return isOnlinePaid; + } + + public void setIsOnlinePaid(Integer isOnlinePaid) { + this.isOnlinePaid = isOnlinePaid; + } + + public String getPhoneList() { + return phoneList; + } + + public void setPhoneList(String phoneList) { + this.phoneList = phoneList; + } + + public String getShopId() { + return shopId; + } + + public void setShopId(String shopId) { + this.shopId = shopId; + } + + public String getShopName() { + return shopName; + } + + public void setShopName(String shopName) { + this.shopName = shopName; + } + + public Integer getDaySn() { + return daySn; + } + + public void setDaySn(Integer daySn) { + this.daySn = daySn; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getRefundStatus() { + return refundStatus; + } + + public void setRefundStatus(String refundStatus) { + this.refundStatus = refundStatus; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public Double getTotalPrice() { + return totalPrice; + } + + public void setTotalPrice(Double totalPrice) { + this.totalPrice = totalPrice; + } + + public Double getOriginalPrice() { + return originalPrice; + } + + public void setOriginalPrice(Double originalPrice) { + this.originalPrice = originalPrice; + } + + public String getConsignee() { + return consignee; + } + + public void setConsignee(String consignee) { + this.consignee = consignee; + } + + public String getDeliveryGeo() { + return deliveryGeo; + } + + public void setDeliveryGeo(String deliveryGeo) { + this.deliveryGeo = deliveryGeo; + } + + public String getDeliveryPoiAddress() { + return deliveryPoiAddress; + } + + public void setDeliveryPoiAddress(String deliveryPoiAddress) { + this.deliveryPoiAddress = deliveryPoiAddress; + } + + public Integer getInvoiced() { + return invoiced; + } + + public void setInvoiced(Integer invoiced) { + this.invoiced = invoiced; + } + + public Double getIncome() { + return income; + } + + public void setIncome(Double income) { + this.income = income; + } + + public Double getServiceRate() { + return serviceRate; + } + + public void setServiceRate(Double serviceRate) { + this.serviceRate = serviceRate; + } + + public Double getServiceFee() { + return serviceFee; + } + + public void setServiceFee(Double serviceFee) { + this.serviceFee = serviceFee; + } + + public Double getHongbao() { + return hongbao; + } + + public void setHongbao(Double hongbao) { + this.hongbao = hongbao; + } + + public Double getPackageFee() { + return packageFee; + } + + public void setPackageFee(Double packageFee) { + this.packageFee = packageFee; + } + + public Double getActivityTotal() { + return activityTotal; + } + + public void setActivityTotal(Double activityTotal) { + this.activityTotal = activityTotal; + } + + public Double getShopPart() { + return shopPart; + } + + public void setShopPart(Double shopPart) { + this.shopPart = shopPart; + } + + public Double getElemePart() { + return elemePart; + } + + public void setElemePart(Double elemePart) { + this.elemePart = elemePart; + } + + public Integer getDowngraded() { + return downgraded; + } + + public void setDowngraded(Integer downgraded) { + this.downgraded = downgraded; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ElemeOrderDetailGroupEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ElemeOrderDetailGroupEntity.java new file mode 100644 index 0000000..cd2685e --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ElemeOrderDetailGroupEntity.java @@ -0,0 +1,141 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; + +import com.alibaba.fastjson.JSONObject; + +public class ElemeOrderDetailGroupEntity implements Serializable { + + private static final long serialVersionUID = -6256364576519596920L; + + private String orderId;// 订单ID + + private String groupName;// 分组名称 + + private String groupType;// 分组类型 + + private String specId;// 规格商品Id + + private String skuId;// skuId + + private String categoryId;// 商品分类Id + + private String name;// 售品名称 + + private Double price;// 售品价格 + + private Integer quantity;// 售品数量 + + private Double total;// 总价 + + public ElemeOrderDetailGroupEntity() { + + } + + public ElemeOrderDetailGroupEntity(JSONObject jsonObject) { + if (jsonObject.containsKey("id")) { + specId = String.valueOf(jsonObject.getLong("id")); + } + if (jsonObject.containsKey("skuId")) { + skuId = String.valueOf(jsonObject.getLong("skuId")); + } + if (jsonObject.containsKey("categoryId")) { + categoryId = String.valueOf(jsonObject.getLong("categoryId")); + } + if (jsonObject.containsKey("name")) { + name = jsonObject.getString("name"); + if(name.length() > 64){ + name = name.substring(0,63); + } + } + if (jsonObject.containsKey("price")) { + price = jsonObject.getDouble("price"); + } + if (jsonObject.containsKey("total")) { + total = jsonObject.getDouble("total"); + } + if (jsonObject.containsKey("quantity")) { + quantity = jsonObject.getInteger("quantity"); + } + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public String getGroupType() { + return groupType; + } + + public void setGroupType(String groupType) { + this.groupType = groupType; + } + + public String getSpecId() { + return specId; + } + + public void setSpecId(String specId) { + this.specId = specId; + } + + public String getSkuId() { + return skuId; + } + + public void setSkuId(String skuId) { + this.skuId = skuId; + } + + public String getCategoryId() { + return categoryId; + } + + public void setCategoryId(String categoryId) { + this.categoryId = categoryId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Double getTotal() { + return total; + } + + public void setTotal(Double total) { + this.total = total; + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ElemeWaimaiOrderController.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ElemeWaimaiOrderController.java new file mode 100644 index 0000000..b808580 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ElemeWaimaiOrderController.java @@ -0,0 +1,223 @@ +package com.jwsaas.controller.waimai; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.amqp.rabbit.support.CorrelationData; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.alibaba.fastjson.JSONObject; +import com.jwsaas.Global; +import com.jwsaas.condition.Criteria; +import com.jwsaas.condition.Restrictions; +import com.jwsaas.config.MQMessageSender; +import com.jwsaas.controller.BaseController; +import com.jwsaas.entity.food.ElemeOrderDetail; +import com.jwsaas.entity.food.ElemeOrderDetailGroup; +import com.jwsaas.service.food.ElemeOrderDetailGroupService; +import com.jwsaas.service.food.ElemeOrderDetailService; +import com.vdurmont.emoji.EmojiParser; + +@Controller(Global.APP_SIGN + "ElemeWaimaiOrderController") +@RequestMapping("/waimai/eleme") +public class ElemeWaimaiOrderController extends BaseController { + + @Resource + private ElemeOrderDetailService elemeOrderDetailService; + + @Resource + private ElemeOrderDetailGroupService elemeOrderDetailGroupService; + + @Resource + private MQMessageSender mqMessageSender; + + @RequestMapping(value = "/order", method = { RequestMethod.POST }) + @ResponseBody + public Object order(HttpServletRequest request, HttpServletResponse response) { + String info = "饿了么订单推送"; + Map result = new HashMap<>(); + try { + String tenantId = getParameter(request, "tenantId");// 企业编号 + String storeId = getParameter(request, "storeId");// 门店ID + String type = getParameter(request, "type");// 1新增;2修改 + String message = getParameter(request, "message");// 消息体 + message = EmojiParser.removeAllEmojis(message); + message = filter(message); + logger.error(tenantId); + logger.error(storeId); + logger.error(message); + ElemeOrderDetailEntity entity = new ElemeOrderDetailEntity(JSONObject.parseObject(EmojiParser.removeAllEmojis(message))); + entity.setStoreId(storeId); + // 订单入库 + Criteria criteria = new Criteria(); + criteria.add(Restrictions.eq("orderId", entity.getOrderId())); + List orderList = elemeOrderDetailService.getList(tenantId, criteria); + if (!CollectionUtils.isEmpty(orderList)) { + ElemeOrderDetail newEntity = orderList.get(0); + newEntity.setStoreId(storeId); + newEntity.setMessage(message); + newEntity.setActiveAt(entity.getActiveAt()); + newEntity.setActivityTotal(entity.getActivityTotal()); + newEntity.setAddress(entity.getAddress()); + newEntity.setConsignee(entity.getConsignee()); + newEntity.setCreatedAt(entity.getCreatedAt()); + newEntity.setModifyDate(new Date()); + newEntity.setModifyUser("open-api"); + newEntity.setDaySn(entity.getDaySn()); + newEntity.setDeliverFee(entity.getDeliverFee()); + newEntity.setDeliverTime(entity.getDeliverTime()); + newEntity.setDeliveryGeo(entity.getDeliveryGeo()); + newEntity.setDeliveryPoiAddress(entity.getDeliveryPoiAddress()); + newEntity.setDescription(entity.getDescription()); + newEntity.setDowngraded(entity.getDowngraded()); + newEntity.setElemePart(entity.getElemePart()); + newEntity.setHongbao(entity.getHongbao()); + newEntity.setIncome(entity.getIncome()); + newEntity.setInvoice(entity.getInvoice()); + newEntity.setInvoiced(entity.getInvoiced()); + newEntity.setIsBook(entity.getIsBook()); + newEntity.setIsOnlinePaid(entity.getIsOnlinePaid()); + newEntity.setOrderId(entity.getOrderId()); + newEntity.setOriginalPrice(entity.getOriginalPrice()); + newEntity.setPackageFee(entity.getPackageFee()); + newEntity.setPhoneList(entity.getPhoneList()); + newEntity.setRefundStatus(entity.getRefundStatus()); + newEntity.setServiceFee(entity.getServiceFee()); + newEntity.setServiceRate(entity.getServiceRate()); + newEntity.setShopId(entity.getShopId()); + newEntity.setShopName(entity.getShopName()); + newEntity.setShopPart(entity.getShopPart()); + newEntity.setStatus(entity.getStatus()); + newEntity.setStoreId(entity.getStoreId()); + newEntity.setTenantId(tenantId); + newEntity.setTotalPrice(entity.getTotalPrice()); + newEntity.setUserId(entity.getUserId()); + List groupList = new ArrayList(); + if (!CollectionUtils.isEmpty(entity.getList())) { + for (ElemeOrderDetailGroupEntity elemeOrderDetailGroupEntity : entity.getList()) { + ElemeOrderDetailGroup groupNew = new ElemeOrderDetailGroup(); + groupNew.setCategoryId(elemeOrderDetailGroupEntity.getCategoryId()); + groupNew.setCreateDate(new Date()); + groupNew.setCreateUser("open-api"); + groupNew.setGroupName(elemeOrderDetailGroupEntity.getGroupName()); + groupNew.setGroupType(elemeOrderDetailGroupEntity.getGroupType()); + groupNew.setName(elemeOrderDetailGroupEntity.getName()); + groupNew.setOrderId(elemeOrderDetailGroupEntity.getOrderId()); + groupNew.setPrice(elemeOrderDetailGroupEntity.getPrice()); + groupNew.setQuantity(elemeOrderDetailGroupEntity.getQuantity()); + groupNew.setSpecId(elemeOrderDetailGroupEntity.getSpecId()); + groupNew.setSkuId(elemeOrderDetailGroupEntity.getSkuId()); + groupNew.setTenantId(tenantId); + groupNew.setTotal(elemeOrderDetailGroupEntity.getTotal()); + groupList.add(groupNew); + } + } + if(Global.USEMQ){ + // 放入消息队列 + Map waimai_message = new HashMap<>(); + waimai_message.put("type", "elemeupdate"); + waimai_message.put("newEntity", newEntity); + waimai_message.put("groupList", groupList); + CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); + this.mqMessageSender.send4elemeupdate(tenantId, waimai_message, correlationData); + logger.error("饿了么新订单发布(MQ)成功"); + }else{ + this.elemeOrderDetailService.updateDetail(tenantId, newEntity, groupList); + } + } else { + ElemeOrderDetail newEntity = new ElemeOrderDetail(); + newEntity.setStoreId(storeId); + newEntity.setMessage(message); + newEntity.setActiveAt(entity.getActiveAt()); + newEntity.setActivityTotal(entity.getActivityTotal()); + newEntity.setAddress(entity.getAddress()); + newEntity.setConsignee(entity.getConsignee()); + newEntity.setCreatedAt(entity.getCreatedAt()); + newEntity.setCreateDate(new Date()); + newEntity.setCreateUser("open-api"); + newEntity.setDaySn(entity.getDaySn()); + newEntity.setDeliverFee(entity.getDeliverFee()); + newEntity.setDeliverTime(entity.getDeliverTime()); + newEntity.setDeliveryGeo(entity.getDeliveryGeo()); + newEntity.setDeliveryPoiAddress(entity.getDeliveryPoiAddress()); + newEntity.setDescription(entity.getDescription()); + newEntity.setDowngraded(entity.getDowngraded()); + newEntity.setElemePart(entity.getElemePart()); + newEntity.setHongbao(entity.getHongbao()); + newEntity.setIncome(entity.getIncome()); + newEntity.setInvoice(entity.getInvoice()); + newEntity.setInvoiced(entity.getInvoiced()); + newEntity.setIsBook(entity.getIsBook()); + newEntity.setIsOnlinePaid(entity.getIsOnlinePaid()); + newEntity.setOrderId(entity.getOrderId()); + newEntity.setOriginalPrice(entity.getOriginalPrice()); + newEntity.setPackageFee(entity.getPackageFee()); + newEntity.setPhoneList(entity.getPhoneList()); + newEntity.setRefundStatus(entity.getRefundStatus()); + newEntity.setServiceFee(entity.getServiceFee()); + newEntity.setServiceRate(entity.getServiceRate()); + newEntity.setShopId(entity.getShopId()); + newEntity.setShopName(entity.getShopName()); + newEntity.setShopPart(entity.getShopPart()); + newEntity.setStatus(entity.getStatus()); + newEntity.setStoreId(entity.getStoreId()); + newEntity.setTenantId(tenantId); + newEntity.setTotalPrice(entity.getTotalPrice()); + newEntity.setUserId(entity.getUserId()); + List groupList = new ArrayList(); + if (!CollectionUtils.isEmpty(entity.getList())) { + for (ElemeOrderDetailGroupEntity elemeOrderDetailGroupEntity : entity.getList()) { + ElemeOrderDetailGroup groupNew = new ElemeOrderDetailGroup(); + groupNew.setCategoryId(elemeOrderDetailGroupEntity.getCategoryId()); + groupNew.setCreateDate(new Date()); + groupNew.setCreateUser("open-api"); + groupNew.setGroupName(elemeOrderDetailGroupEntity.getGroupName()); + groupNew.setGroupType(elemeOrderDetailGroupEntity.getGroupType()); + groupNew.setName(elemeOrderDetailGroupEntity.getName()); + groupNew.setOrderId(elemeOrderDetailGroupEntity.getOrderId()); + groupNew.setPrice(elemeOrderDetailGroupEntity.getPrice()); + groupNew.setQuantity(elemeOrderDetailGroupEntity.getQuantity()); + groupNew.setSpecId(elemeOrderDetailGroupEntity.getSpecId()); + groupNew.setSkuId(elemeOrderDetailGroupEntity.getSkuId()); + groupNew.setTenantId(tenantId); + groupNew.setTotal(elemeOrderDetailGroupEntity.getTotal()); + groupList.add(groupNew); + } + } + if(Global.USEMQ){ + // 放入消息队列 + Map waimai_message = new HashMap<>(); + waimai_message.put("type", "elemecreate"); + waimai_message.put("newEntity", newEntity); + waimai_message.put("groupList", groupList); + CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); + this.mqMessageSender.send4elemecreate(tenantId, waimai_message, correlationData); + logger.error("饿了么新订单更新发布(MQ)成功"); + }else{ + this.elemeOrderDetailService.saveDetail(tenantId, newEntity, groupList); + } + } + logger.error("饿了么订单推送:", message); + result.put("status", "success"); + } catch (Exception e) { + logger.error("饿了么订单推送:", e); + result.put("status", "error"); + } + return result; + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeiTuanOrderController.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeiTuanOrderController.java new file mode 100644 index 0000000..10dfe30 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeiTuanOrderController.java @@ -0,0 +1,349 @@ +package com.jwsaas.controller.waimai; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.amqp.rabbit.support.CorrelationData; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.alibaba.fastjson.JSONObject; +import com.jwsaas.Global; +import com.jwsaas.condition.Criteria; +import com.jwsaas.condition.Restrictions; +import com.jwsaas.config.MQMessageSender; +import com.jwsaas.controller.BaseController; +import com.jwsaas.entity.food.MeituanOrder; +import com.jwsaas.entity.food.MeituanOrderExtra; +import com.jwsaas.entity.food.MeituanOrderItem; +import com.jwsaas.service.food.MeituanOrderExtraService; +import com.jwsaas.service.food.MeituanOrderItemService; +import com.jwsaas.service.food.MeituanOrderService; +import com.jwsaas.utils.DateUtils; +import com.vdurmont.emoji.EmojiParser; + +@Controller(Global.APP_SIGN + "MeiTuanOrderController") +@RequestMapping("/waimai/meituan") +public class MeiTuanOrderController extends BaseController { + + @Resource + protected MeituanOrderService meituanOrderService; + + @Resource + protected MeituanOrderItemService meituanOrderItemService; + + @Resource + protected MeituanOrderExtraService meituanOrderExtraService; + + @Resource + private MQMessageSender mqMessageSender; + + @RequestMapping(value = "/order", method = { RequestMethod.POST }) + @ResponseBody + public Object order(HttpServletRequest request, HttpServletResponse response) { + String info = "美团订单推送"; + Map result = new HashMap<>(); + String tenantId = getParameter(request, "tenantId");// 企业编号 + String storeId = getParameter(request, "storeId");// 门店ID + String message = getParameter(request, "message");// 消息体 + message = EmojiParser.removeAllEmojis(message); + message = filter(message); + String reasonCode = getParameter(request, "reasonCode");// 订单取消CODE + String reason = getParameter(request, "reason");// 取消原因 + String refundReasonCode = getParameter(request, "refundReasonCode");// 退单CODE + String refundReason = getParameter(request, "refundReason");// 退单原因 + String shipTime = getParameter(request, "shipTime");// 配送时间 + String shippingStatus = getParameter(request, "shippingStatus");// 配送状态 + String dispatcherMobile = getParameter(request, "dispatcherMobile");// 骑手电话 + String dispatcherName = getParameter(request, "dispatcherName");// 骑手名称 + String pickType = getParameter(request, "pickType");// 取餐类型 + String status = null; + logger.error(tenantId); + logger.error(storeId); + logger.error(message); + try { + MeituanOrderEntity entity = new MeituanOrderEntity(JSONObject.parseObject(message)); + entity.setStoreId(storeId); + entity.setMessage(message); + // 订单入库 + Criteria criteria = new Criteria(); + criteria.add(Restrictions.eq("orderId", entity.getOrderId())); + List orderList = meituanOrderService.getList(tenantId, criteria); + if (!CollectionUtils.isEmpty(orderList)) { + MeituanOrder newEntity = orderList.get(0); + if (reason != null && !"".equals(reason)) { + newEntity.setCancelReason(reason); + } + if (reasonCode != null && !"".equals(reasonCode)) { + newEntity.setCancelReasonCode(reasonCode); + } + newEntity.setCaution(entity.getCaution()); + newEntity.setCityId(entity.getCityId()); + newEntity.setCreateDate(new Date()); + newEntity.setCreateUser("open-api"); + newEntity.setCTime(entity.getcTime()); + newEntity.setDaySeq(entity.getDaySeq()); + newEntity.setDeliveryTime(entity.getDeliveryTime()); + newEntity.setDetail(entity.getDetail()); + newEntity.setDinnersNumber(entity.getDinnersNumber()); + newEntity.setExtras(entity.getExtras()); + newEntity.setHasInvoiced(entity.getHasInvoiced()); + newEntity.setInvoiceTitle(entity.getInvoiceTitle()); + newEntity.setIsPre(entity.getIsPre()); + newEntity.setIsThirdShipping(entity.getIsThirdShipping()); + newEntity.setLatitude(entity.getLatitude()); + if (dispatcherMobile != null && !"".equals(dispatcherMobile)) { + newEntity.setLogisticsDispatcherMobile(dispatcherMobile); + } + if (dispatcherName != null && !"".equals(dispatcherName)) { + newEntity.setLogisticsDispatcherName(dispatcherName); + } + if (shippingStatus != null && !"".equals(shippingStatus)) { + String shipDateTime = DateUtils.format(new Date(Long.parseLong(shipTime) * 1000), DateUtils.SHOW_DATETIME_FORMAT); + switch (shippingStatus) { + case "0": + // 配送单发往配送 + // 配送单下单时间 + newEntity.setLogisticsSendTime(shipDateTime); + break; + case "10": + // 配送单已确认 + newEntity.setLogisticsConfirmTime(shipDateTime); + break; + case "20": + // 骑手已取餐 + newEntity.setLogisticsFetchTime(shipDateTime); + break; + case "40": + // 骑手已送达 + newEntity.setLogisticsCompletedTime(shipDateTime); + break; + case "100": + // 配送单已取消 + break; + default: + break; + } + } + newEntity.setLogisticsCode(entity.getLogisticsCode()); + newEntity.setLogisticsId(entity.getLogisticsId()); + newEntity.setLogisticsName(entity.getLogisticsName()); + if (shippingStatus != null && !"".equals(shippingStatus)) { + newEntity.setLogisticsStatus(shippingStatus); + } + newEntity.setLongitude(entity.getLongitude()); + newEntity.setMessage(message); + newEntity.setOrderCancelTime(entity.getOrderCancelTime()); + newEntity.setOrderCompletedTime(entity.getOrderCompletedTime()); + newEntity.setOrderConfirmTime(entity.getOrderConfirmTime()); + newEntity.setOrderId(entity.getOrderId()); + newEntity.setOrderIdView(entity.getOrderIdView()); + newEntity.setOrderSendTime(entity.getOrderSendTime()); + newEntity.setOriginalPrice(entity.getOriginalPrice()); + newEntity.setPayType(entity.getPayType()); + newEntity.setPoiAddress(entity.getPoiAddress()); + newEntity.setPoiId(entity.getPoiId()); + newEntity.setPoiName(entity.getPoiName()); + newEntity.setPoiPhone(entity.getPoiPhone()); + newEntity.setPoiReceiveDetail(entity.getPoiReceiveDetail()); + newEntity.setRecipientAddress(entity.getRecipientAddress()); + newEntity.setRecipientName(entity.getRecipientName()); + newEntity.setRecipientPhone(entity.getRecipientPhone()); + if (refundReason != null && !"".equals(refundReason)) { + newEntity.setRefundReason(refundReason); + } + if (refundReasonCode != null && !"".equals(refundReasonCode)) { + newEntity.setRefundReasonCode(refundReasonCode); + } + if (dispatcherMobile != null && !"".equals(dispatcherMobile)) { + newEntity.setShipperPhone(dispatcherMobile); + } + newEntity.setStatus(entity.getStatus()); + newEntity.setStoreId(storeId); + newEntity.setTenantId(tenantId); + newEntity.setTotal(entity.getTotal()); + newEntity.setUTime(entity.getuTime()); + newEntity.setFoodShareFeeChargeByPoi(entity.getFoodShareFeeChargeByPoi()); + newEntity.setWmPoiReceiveCent(entity.getWmPoiReceiveCent()); + status = String.valueOf(newEntity.getStatus()); + if (Global.USEMQ) { + // 放入消息队列 + Map waimai_message = new HashMap<>(); + waimai_message.put("type", "meituanupdate"); + waimai_message.put("newEntity", newEntity); + CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); + this.mqMessageSender.send4meituanupdate(tenantId, waimai_message, correlationData); + } else { + this.meituanOrderService.update(tenantId, newEntity); + } + } else { + MeituanOrder newEntity = new MeituanOrder(); + if (reason != null && !"".equals(reason)) { + newEntity.setCancelReason(reason); + } + if (reasonCode != null && !"".equals(reasonCode)) { + newEntity.setCancelReasonCode(reasonCode); + } + newEntity.setCaution(entity.getCaution()); + newEntity.setCityId(entity.getCityId()); + newEntity.setCreateDate(new Date()); + newEntity.setCreateUser("open-api"); + newEntity.setCTime(entity.getcTime()); + newEntity.setDaySeq(entity.getDaySeq()); + newEntity.setDeliveryTime(entity.getDeliveryTime()); + newEntity.setDetail(entity.getDetail()); + newEntity.setDinnersNumber(entity.getDinnersNumber()); + newEntity.setExtras(entity.getExtras()); + newEntity.setHasInvoiced(entity.getHasInvoiced()); + newEntity.setInvoiceTitle(entity.getInvoiceTitle()); + newEntity.setIsPre(entity.getIsPre()); + newEntity.setIsThirdShipping(entity.getIsThirdShipping()); + newEntity.setLatitude(entity.getLatitude()); + if (dispatcherMobile != null && !"".equals(dispatcherMobile)) { + newEntity.setLogisticsDispatcherMobile(dispatcherMobile); + } + if (dispatcherName != null && !"".equals(dispatcherName)) { + newEntity.setLogisticsDispatcherName(dispatcherName); + } + if (shippingStatus != null && !"".equals(shippingStatus)) { + String shipDateTime = DateUtils.format(new Date(Long.parseLong(shipTime) * 1000), DateUtils.SHOW_DATETIME_FORMAT); + switch (shippingStatus) { + case "0": + // 配送单发往配送 + // 配送单下单时间 + newEntity.setLogisticsSendTime(shipDateTime); + break; + case "10": + // 配送单已确认 + newEntity.setLogisticsConfirmTime(shipDateTime); + break; + case "20": + // 骑手已取餐 + newEntity.setLogisticsFetchTime(shipDateTime); + break; + case "40": + // 骑手已送达 + newEntity.setLogisticsCompletedTime(shipDateTime); + break; + case "100": + // 配送单已取消 + break; + default: + break; + } + } + newEntity.setLogisticsCode(entity.getLogisticsCode()); + newEntity.setLogisticsId(entity.getLogisticsId()); + newEntity.setLogisticsName(entity.getLogisticsName()); + if (shippingStatus != null && !"".equals(shippingStatus)) { + newEntity.setLogisticsStatus(shippingStatus); + } + newEntity.setLongitude(entity.getLongitude()); + newEntity.setMessage(message); + newEntity.setOrderCancelTime(entity.getOrderCancelTime()); + newEntity.setOrderCompletedTime(entity.getOrderCompletedTime()); + newEntity.setOrderConfirmTime(entity.getOrderConfirmTime()); + newEntity.setOrderId(entity.getOrderId()); + newEntity.setOrderIdView(entity.getOrderIdView()); + newEntity.setOrderSendTime(entity.getOrderSendTime()); + newEntity.setOriginalPrice(entity.getOriginalPrice()); + newEntity.setPayType(entity.getPayType()); + newEntity.setPoiAddress(entity.getPoiAddress()); + newEntity.setPoiId(entity.getPoiId()); + newEntity.setPoiName(entity.getPoiName()); + newEntity.setPoiPhone(entity.getPoiPhone()); + newEntity.setPoiReceiveDetail(entity.getPoiReceiveDetail()); + newEntity.setRecipientAddress(entity.getRecipientAddress()); + newEntity.setRecipientName(entity.getRecipientName()); + newEntity.setRecipientPhone(entity.getRecipientPhone()); + newEntity.setShippingFee(entity.getShippingFee()); + if (refundReason != null && !"".equals(refundReason)) { + newEntity.setRefundReason(refundReason); + } + if (refundReasonCode != null && !"".equals(refundReasonCode)) { + newEntity.setRefundReasonCode(refundReasonCode); + } + if (dispatcherMobile != null && !"".equals(dispatcherMobile)) { + newEntity.setShipperPhone(dispatcherMobile); + } + newEntity.setStatus(entity.getStatus()); + newEntity.setStoreId(storeId); + newEntity.setTenantId(tenantId); + newEntity.setTotal(entity.getTotal()); + newEntity.setUTime(entity.getuTime()); + newEntity.setFoodShareFeeChargeByPoi(entity.getFoodShareFeeChargeByPoi()); + newEntity.setWmPoiReceiveCent(entity.getWmPoiReceiveCent()); + List itemList = new ArrayList<>(); + for (MeituanOrderItemEntity meituanOrderItemEntity : entity.getOrderItemList()) { + MeituanOrderItem item = new MeituanOrderItem(); + item.setBoxNum(meituanOrderItemEntity.getBoxNum()); + item.setBoxPrice(meituanOrderItemEntity.getBoxPrice()); + item.setCreateDate(new Date()); + item.setCreateUser("open-api"); + item.setDiscount(meituanOrderItemEntity.getDiscount()); + item.setDishName(meituanOrderItemEntity.getDishName()); + item.setEDishCode(meituanOrderItemEntity.geteDishCode()); + item.setOrderId(entity.getOrderId()); + item.setPrice(meituanOrderItemEntity.getPrice()); + item.setProperty(meituanOrderItemEntity.getProperty()); + item.setQuantity(meituanOrderItemEntity.getQuantity()); + item.setSkuId(meituanOrderItemEntity.getSkuId()); + item.setSpec(meituanOrderItemEntity.getSpec()); + item.setTenantId(tenantId); + item.setUnit(meituanOrderItemEntity.getUnit()); + itemList.add(item); + } + List extraList = new ArrayList<>(); + for (MeituanOrderExtraEntity meituanOrderExtraEntity : entity.getOrderExtraList()) { + MeituanOrderExtra extra = new MeituanOrderExtra(); + extra.setActDetailId(meituanOrderExtraEntity.getActDetailId()); + extra.setAvgSendTime(meituanOrderExtraEntity.getAvgSendTime()); + extra.setCreateDate(new Date()); + extra.setCreateUser("open-api"); + extra.setMtCharge(meituanOrderExtraEntity.getMtCharge()); + extra.setOrderId(entity.getOrderId()); + extra.setPoiCharge(meituanOrderExtraEntity.getPoiCharge()); + extra.setReduceFee(meituanOrderExtraEntity.getReduceFee()); + extra.setRemark(meituanOrderExtraEntity.getRemark()); + extra.setTenantId(tenantId); + extra.setType(meituanOrderExtraEntity.getType()); + extraList.add(extra); + } + if (pickType != null) { + newEntity.setPickType(Integer.parseInt(pickType)); + } + status = String.valueOf(newEntity.getStatus()); + if (Global.USEMQ) { + // 放入消息队列 + Map waimai_message = new HashMap<>(); + waimai_message.put("type", "meituancreate"); + waimai_message.put("newEntity", newEntity); + waimai_message.put("itemList", itemList); + waimai_message.put("extraList", extraList); + CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); + this.mqMessageSender.send4meituancreate(tenantId, waimai_message, correlationData); + } else { + this.meituanOrderService.saveOrder(tenantId, newEntity, itemList, extraList); + } + } + result.put("info", "success"); + result.put("status", status); + result.put("refundReasonCode", refundReasonCode); + } catch (Exception e) { + logger.error(info, e); + result.put("status", "error"); + } + return result; + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeituanOrderEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeituanOrderEntity.java new file mode 100644 index 0000000..65a97da --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeituanOrderEntity.java @@ -0,0 +1,752 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.jwsaas.utils.DateUtils; + +public class MeituanOrderEntity implements Serializable { + + private static final long serialVersionUID = -975253547225858225L; + + private String message;// 消息 + + private String storeId;// erp方门店id + + private String orderId;// 订单ID + + private String cTime;// 订单创建时间 + + private String caution;// 订单备注 + + private String deliveryTime;// 用户预计送达时间 + + private String detail;// 订单菜品详情 + + private String cityId;// 城市Id + + private String extras;// 订单扩展信息 + + private Integer hasInvoiced;// 是否需要发票 + + private String invoiceTitle;// 发票抬头 + + private Integer isPre;// 是否是预定单 + + private Integer isThirdShipping;// 是否第三方配送 + + private Double latitude;// 实际送餐地址纬度 + + private Double longitude;// 实际送餐地址经度 + + private String poiReceiveDetail;// 商家对账信息 + + private String logisticsCode;// 配送类型码 + + private String logisticsCompletedTime;// 配送完成时间 + + private String logisticsConfirmTime;// 配送单确认时间 + + private String logisticsDispatcherMobile;// 骑手电话 + + private String logisticsDispatcherName;// 骑手姓名 + + private String logisticsFetchTime;// 骑手取单时间 + + private String logisticsId;// 配送方ID + + private String logisticsName;// 配送方名称 + + private String logisticsSendTime;// 配送单下单时间 + + private String logisticsStatus;// 配送订单状态code + + private String orderCompletedTime;// 订单完成时间 + + private String orderConfirmTime;// 商户确认时间 + + private String orderCancelTime;// 订单取消时间 + + private String orderIdView;// 订单展示Id + + private String orderSendTime;// 用户下单时间 + + private Double originalPrice;// 订单原价 + + private Integer payType;// 订单支付类型 + + private String poiAddress;// 门店地址 + + private String poiId;// 门店Id + + private String poiName;// 门店名称 + + private String poiPhone;// 门店服务电话 + + private String recipientAddress;// 收货人地址 + + private String recipientName;// 收货人名称 + + private String recipientPhone;// 收货人电话 + + private String backupRecipientPhone;//备份隐私号 + + private String shipperPhone;// 配送骑手电话 + + private Double shippingFee;// 配送费用 + + private Integer status;// 订单状态 + + private Double total;// 总价 + + private String uTime;// 订单更新时间 + + private Integer daySeq;// 门店当天的订单流水号 + + private Integer dinnersNumber;// 就餐人数 + + private String cancelReason;// 订单取消原因 + + private String cancelReasonCode;// 订单取消code + + private String refundReason;// 订单退款原因 + + private String refundReasonCode;// 订单退款code + + private Double foodShareFeeChargeByPoi;// 菜品分成(分) + + private Double wmPoiReceiveCent;// 商家应收款(分) + + List orderItemList; + + List orderExtraList; + + public MeituanOrderEntity() { + + } + + public MeituanOrderEntity(JSONObject jsonObject) { + if (jsonObject.containsKey("cTime")) { + cTime = DateUtils.format(new Date(jsonObject.getLong("cTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("caution")) { + caution = jsonObject.getString("caution"); + } + if (jsonObject.containsKey("deliveryTime")) { + deliveryTime = jsonObject.getLong("deliveryTime") == null ? null : DateUtils.format(new Date(jsonObject.getLong("deliveryTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("cityId")) { + cityId = String.valueOf(jsonObject.getLong("cityId")); + } + if (jsonObject.containsKey("hasInvoiced")) { + hasInvoiced = jsonObject.getInteger("hasInvoiced"); + } + if (jsonObject.containsKey("invoiceTitle")) { + invoiceTitle = jsonObject.getString("invoiceTitle"); + } + if (jsonObject.containsKey("isPre")) { + isPre = jsonObject.getInteger("isPre"); + } + if (jsonObject.containsKey("isThirdShipping")) { + isThirdShipping = jsonObject.getInteger("isThirdShipping"); + } + if (jsonObject.containsKey("latitude")) { + latitude = jsonObject.getDouble("latitude"); + } + if (jsonObject.containsKey("longitude")) { + longitude = jsonObject.getDouble("longitude"); + } + if (jsonObject.containsKey("logisticsCode")) { + logisticsCode = jsonObject.getString("logisticsCode"); + } + if (jsonObject.containsKey("logisticsCompletedTime")) { + logisticsCompletedTime = jsonObject.getLong("logisticsCompletedTime") == null ? null + : DateUtils.format(new Date(jsonObject.getLong("logisticsCompletedTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("logisticsConfirmTime")) { + logisticsConfirmTime = jsonObject.getLong("logisticsConfirmTime") == null ? null + : DateUtils.format(new Date(jsonObject.getLong("logisticsConfirmTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("logisticsDispatcherMobile")) { + logisticsDispatcherMobile = jsonObject.getString("logisticsDispatcherMobile"); + } + if (jsonObject.containsKey("logisticsDispatcherName")) { + logisticsDispatcherName = jsonObject.getString("logisticsDispatcherName"); + } + if (jsonObject.containsKey("logisticsFetchTime")) { + logisticsFetchTime = jsonObject.getLong("logisticsFetchTime") == null ? null : DateUtils.format(new Date(jsonObject.getLong("logisticsFetchTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("logisticsId")) { + logisticsId = jsonObject.getString("logisticsId"); + } + if (jsonObject.containsKey("logisticsName")) { + logisticsName = jsonObject.getString("logisticsName"); + } + if (jsonObject.containsKey("logisticsSendTime")) { + logisticsSendTime = jsonObject.getLong("logisticsSendTime") == null ? null : DateUtils.format(new Date(jsonObject.getLong("logisticsSendTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("logisticsStatus")) { + logisticsStatus = jsonObject.getString("logisticsStatus"); + } + if (jsonObject.containsKey("orderCompletedTime")) { + orderCompletedTime = jsonObject.getLong("orderCompletedTime") == null ? null : DateUtils.format(new Date(jsonObject.getLong("orderCompletedTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("orderConfirmTime")) { + orderConfirmTime = jsonObject.getLong("orderConfirmTime") == null ? null : DateUtils.format(new Date(jsonObject.getLong("orderConfirmTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("orderCancelTime")) { + orderCancelTime = jsonObject.getLong("orderCancelTime") == null ? null : DateUtils.format(new Date(jsonObject.getLong("orderCancelTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("orderId")) { + orderId = String.valueOf(jsonObject.getLong("orderId")); + } + if (jsonObject.containsKey("orderIdView")) { + orderIdView = String.valueOf(jsonObject.getLong("orderIdView")); + } + if (jsonObject.containsKey("orderSendTime")) { + orderSendTime = jsonObject.getLong("orderSendTime") == null ? null : DateUtils.format(new Date(jsonObject.getLong("orderSendTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("originalPrice")) { + originalPrice = jsonObject.getDouble("originalPrice"); + } + if (jsonObject.containsKey("payType")) { + payType = jsonObject.getInteger("payType"); + } + if (jsonObject.containsKey("poiAddress")) { + poiAddress = jsonObject.getString("poiAddress"); + } + if (jsonObject.containsKey("poiId")) { + poiId = String.valueOf(jsonObject.getLong("poiId")); + } + if (jsonObject.containsKey("poiName")) { + poiName = jsonObject.getString("poiName"); + } + if (jsonObject.containsKey("poiPhone")) { + poiPhone = jsonObject.getString("poiPhone"); + } + if (jsonObject.containsKey("recipientAddress")) { + recipientAddress = jsonObject.getString("recipientAddress"); + } + if (jsonObject.containsKey("recipientName")) { + recipientName = jsonObject.getString("recipientName"); + } + if (jsonObject.containsKey("recipientPhone")) { + recipientPhone = jsonObject.getString("recipientPhone"); + } + if (jsonObject.containsKey("backupRecipientPhone")) { + backupRecipientPhone = jsonObject.getString("backupRecipientPhone"); + } + if (jsonObject.containsKey("shipperPhone")) { + shipperPhone = jsonObject.getString("shipperPhone"); + } + if (jsonObject.containsKey("shippingFee")) { + shippingFee = jsonObject.getDouble("shippingFee"); + } + if (jsonObject.containsKey("status")) { + status = jsonObject.getInteger("status"); + } + if (jsonObject.containsKey("total")) { + total = jsonObject.getDouble("total"); + } + if (jsonObject.containsKey("uTime")) { + uTime = jsonObject.getLong("uTime") == null ? null : DateUtils.format(new Date(jsonObject.getLong("uTime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("daySeq")) { + daySeq = jsonObject.getInteger("daySeq"); + } + if (jsonObject.containsKey("dinnersNumber")) { + dinnersNumber = jsonObject.getInteger("dinnersNumber"); + } + if (jsonObject.containsKey("poiReceiveDetail")) { + poiReceiveDetail = jsonObject.getString("poiReceiveDetail"); + JSONObject poiReceiveObject = JSONArray.parseObject(poiReceiveDetail); + if (poiReceiveObject.containsKey("foodShareFeeChargeByPoi")) { + foodShareFeeChargeByPoi = poiReceiveObject.getDouble("foodShareFeeChargeByPoi"); + } + if (poiReceiveObject.containsKey("wmPoiReceiveCent")) { + wmPoiReceiveCent = poiReceiveObject.getDouble("wmPoiReceiveCent"); + } + } + if (jsonObject.containsKey("detail")) { + orderItemList = new ArrayList<>(); + detail = jsonObject.getString("detail"); + JSONArray detailArray = JSONArray.parseArray(detail); + for (int i = 0; i < detailArray.size(); i++) { + JSONObject detailObject = detailArray.getJSONObject(i); + MeituanOrderItemEntity orderItem = new MeituanOrderItemEntity(detailObject); + orderItem.setOrderId(orderId); + orderItemList.add(orderItem); + } + } + if (jsonObject.containsKey("extras")) { + orderExtraList = new ArrayList<>(); + extras = jsonObject.getString("extras"); + JSONArray extrasArray = JSONArray.parseArray(extras); + for (int i = 0; i < extrasArray.size(); i++) { + JSONObject extrasObject = extrasArray.getJSONObject(i); + MeituanOrderExtraEntity orderExtra = new MeituanOrderExtraEntity(extrasObject); + orderExtra.setOrderId(orderId); + orderExtraList.add(orderExtra); + } + } + + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getStoreId() { + return storeId; + } + + public void setStoreId(String storeId) { + this.storeId = storeId; + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getcTime() { + return cTime; + } + + public void setcTime(String cTime) { + this.cTime = cTime; + } + + public String getCaution() { + return caution; + } + + public void setCaution(String caution) { + this.caution = caution; + } + + public String getDeliveryTime() { + return deliveryTime; + } + + public void setDeliveryTime(String deliveryTime) { + this.deliveryTime = deliveryTime; + } + + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public String getCityId() { + return cityId; + } + + public void setCityId(String cityId) { + this.cityId = cityId; + } + + public String getExtras() { + return extras; + } + + public void setExtras(String extras) { + this.extras = extras; + } + + public Integer getHasInvoiced() { + return hasInvoiced; + } + + public void setHasInvoiced(Integer hasInvoiced) { + this.hasInvoiced = hasInvoiced; + } + + public String getInvoiceTitle() { + return invoiceTitle; + } + + public void setInvoiceTitle(String invoiceTitle) { + this.invoiceTitle = invoiceTitle; + } + + public Integer getIsPre() { + return isPre; + } + + public void setIsPre(Integer isPre) { + this.isPre = isPre; + } + + public Integer getIsThirdShipping() { + return isThirdShipping; + } + + public void setIsThirdShipping(Integer isThirdShipping) { + this.isThirdShipping = isThirdShipping; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public String getPoiReceiveDetail() { + return poiReceiveDetail; + } + + public void setPoiReceiveDetail(String poiReceiveDetail) { + this.poiReceiveDetail = poiReceiveDetail; + } + + public String getLogisticsCode() { + return logisticsCode; + } + + public void setLogisticsCode(String logisticsCode) { + this.logisticsCode = logisticsCode; + } + + public String getLogisticsCompletedTime() { + return logisticsCompletedTime; + } + + public void setLogisticsCompletedTime(String logisticsCompletedTime) { + this.logisticsCompletedTime = logisticsCompletedTime; + } + + public String getLogisticsConfirmTime() { + return logisticsConfirmTime; + } + + public void setLogisticsConfirmTime(String logisticsConfirmTime) { + this.logisticsConfirmTime = logisticsConfirmTime; + } + + public String getLogisticsDispatcherMobile() { + return logisticsDispatcherMobile; + } + + public void setLogisticsDispatcherMobile(String logisticsDispatcherMobile) { + this.logisticsDispatcherMobile = logisticsDispatcherMobile; + } + + public String getLogisticsDispatcherName() { + return logisticsDispatcherName; + } + + public void setLogisticsDispatcherName(String logisticsDispatcherName) { + this.logisticsDispatcherName = logisticsDispatcherName; + } + + public String getLogisticsFetchTime() { + return logisticsFetchTime; + } + + public void setLogisticsFetchTime(String logisticsFetchTime) { + this.logisticsFetchTime = logisticsFetchTime; + } + + public String getLogisticsId() { + return logisticsId; + } + + public void setLogisticsId(String logisticsId) { + this.logisticsId = logisticsId; + } + + public String getLogisticsName() { + return logisticsName; + } + + public void setLogisticsName(String logisticsName) { + this.logisticsName = logisticsName; + } + + public String getLogisticsSendTime() { + return logisticsSendTime; + } + + public void setLogisticsSendTime(String logisticsSendTime) { + this.logisticsSendTime = logisticsSendTime; + } + + public String getLogisticsStatus() { + return logisticsStatus; + } + + public void setLogisticsStatus(String logisticsStatus) { + this.logisticsStatus = logisticsStatus; + } + + public String getOrderCompletedTime() { + return orderCompletedTime; + } + + public void setOrderCompletedTime(String orderCompletedTime) { + this.orderCompletedTime = orderCompletedTime; + } + + public String getOrderConfirmTime() { + return orderConfirmTime; + } + + public void setOrderConfirmTime(String orderConfirmTime) { + this.orderConfirmTime = orderConfirmTime; + } + + public String getOrderCancelTime() { + return orderCancelTime; + } + + public void setOrderCancelTime(String orderCancelTime) { + this.orderCancelTime = orderCancelTime; + } + + public String getOrderIdView() { + return orderIdView; + } + + public void setOrderIdView(String orderIdView) { + this.orderIdView = orderIdView; + } + + public String getOrderSendTime() { + return orderSendTime; + } + + public void setOrderSendTime(String orderSendTime) { + this.orderSendTime = orderSendTime; + } + + public Double getOriginalPrice() { + return originalPrice; + } + + public void setOriginalPrice(Double originalPrice) { + this.originalPrice = originalPrice; + } + + public Integer getPayType() { + return payType; + } + + public void setPayType(Integer payType) { + this.payType = payType; + } + + public String getPoiAddress() { + return poiAddress; + } + + public void setPoiAddress(String poiAddress) { + this.poiAddress = poiAddress; + } + + public String getPoiId() { + return poiId; + } + + public void setPoiId(String poiId) { + this.poiId = poiId; + } + + public String getPoiName() { + return poiName; + } + + public void setPoiName(String poiName) { + this.poiName = poiName; + } + + public String getPoiPhone() { + return poiPhone; + } + + public void setPoiPhone(String poiPhone) { + this.poiPhone = poiPhone; + } + + public String getRecipientAddress() { + return recipientAddress; + } + + public void setRecipientAddress(String recipientAddress) { + this.recipientAddress = recipientAddress; + } + + public String getRecipientName() { + return recipientName; + } + + public void setRecipientName(String recipientName) { + this.recipientName = recipientName; + } + + public String getRecipientPhone() { + return recipientPhone; + } + + public void setRecipientPhone(String recipientPhone) { + this.recipientPhone = recipientPhone; + } + + public String getBackupRecipientPhone() { + return backupRecipientPhone; + } + + public void setBackupRecipientPhone(String backupRecipientPhone) { + this.backupRecipientPhone = backupRecipientPhone; + } + + public String getShipperPhone() { + return shipperPhone; + } + + public void setShipperPhone(String shipperPhone) { + this.shipperPhone = shipperPhone; + } + + public Double getShippingFee() { + return shippingFee; + } + + public void setShippingFee(Double shippingFee) { + this.shippingFee = shippingFee; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Double getTotal() { + return total; + } + + public void setTotal(Double total) { + this.total = total; + } + + public String getuTime() { + return uTime; + } + + public void setuTime(String uTime) { + this.uTime = uTime; + } + + public Integer getDaySeq() { + return daySeq; + } + + public void setDaySeq(Integer daySeq) { + this.daySeq = daySeq; + } + + public Integer getDinnersNumber() { + return dinnersNumber; + } + + public void setDinnersNumber(Integer dinnersNumber) { + this.dinnersNumber = dinnersNumber; + } + + public String getCancelReason() { + return cancelReason; + } + + public void setCancelReason(String cancelReason) { + this.cancelReason = cancelReason; + } + + public String getCancelReasonCode() { + return cancelReasonCode; + } + + public void setCancelReasonCode(String cancelReasonCode) { + this.cancelReasonCode = cancelReasonCode; + } + + public String getRefundReason() { + return refundReason; + } + + public void setRefundReason(String refundReason) { + this.refundReason = refundReason; + } + + public String getRefundReasonCode() { + return refundReasonCode; + } + + public void setRefundReasonCode(String refundReasonCode) { + this.refundReasonCode = refundReasonCode; + } + + public Double getFoodShareFeeChargeByPoi() { + return foodShareFeeChargeByPoi; + } + + public void setFoodShareFeeChargeByPoi(Double foodShareFeeChargeByPoi) { + this.foodShareFeeChargeByPoi = foodShareFeeChargeByPoi; + } + + public Double getWmPoiReceiveCent() { + return wmPoiReceiveCent; + } + + public void setWmPoiReceiveCent(Double wmPoiReceiveCent) { + this.wmPoiReceiveCent = wmPoiReceiveCent; + } + + public List getOrderItemList() { + return orderItemList; + } + + public void setOrderItemList(List orderItemList) { + this.orderItemList = orderItemList; + } + + public List getOrderExtraList() { + return orderExtraList; + } + + public void setOrderExtraList(List orderExtraList) { + this.orderExtraList = orderExtraList; + } + + public static void main(String[] args) { + JSONObject jsonObject = JSONObject.parseObject("{\"actOrderChargeByMt\":[{\"comment\":\"活动款\",\"feeTypeDesc\":\"活动款\",\"feeTypeId\":10019,\"moneyCent\":0}],\"actOrderChargeByPoi\":[],\"foodShareFeeChargeByPoi\":308,\"logisticsFee\":300,\"onlinePayment\":2350,\"wmPoiReceiveCent\":1742}"); + System.out.println("========>"+jsonObject.getDouble("foodShareFeeChargeByPoi")); + System.out.println("========>"+jsonObject.getDouble("wmPoiReceiveCent")); + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeituanOrderExtraEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeituanOrderExtraEntity.java new file mode 100644 index 0000000..be80ff2 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeituanOrderExtraEntity.java @@ -0,0 +1,113 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; + +import com.alibaba.fastjson.JSONObject; + +public class MeituanOrderExtraEntity implements Serializable { + + private static final long serialVersionUID = -5656137756648724626L; + + private String orderId;// 订单ID + + private Double mtCharge;// 优惠金额中美团承担的部分 + + private Double poiCharge;// 优惠金额中商家承担的部分 + + private Double reduceFee;// 活动优惠总金额 + + private String remark;// 优惠说明 + + private Integer type;// 活动类型 + + private String actDetailId;// 活动ID + + private Double avgSendTime;// 餐厅平均送餐时间 + + public MeituanOrderExtraEntity() { + + } + + public MeituanOrderExtraEntity(JSONObject jsonObject) { + if (jsonObject.containsKey("mt_charge")) { + mtCharge = jsonObject.getDouble("mt_charge"); + } + if (jsonObject.containsKey("poi_charge")) { + poiCharge = jsonObject.getDouble("poi_charge"); + } + if (jsonObject.containsKey("reduce_fee")) { + reduceFee = jsonObject.getDouble("reduce_fee"); + } + if (jsonObject.containsKey("remark")) { + remark = jsonObject.getString("remark"); + } + if (jsonObject.containsKey("type")) { + type = jsonObject.getInteger("type"); + } + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public Double getMtCharge() { + return mtCharge; + } + + public void setMtCharge(Double mtCharge) { + this.mtCharge = mtCharge; + } + + public Double getPoiCharge() { + return poiCharge; + } + + public void setPoiCharge(Double poiCharge) { + this.poiCharge = poiCharge; + } + + public Double getReduceFee() { + return reduceFee; + } + + public void setReduceFee(Double reduceFee) { + this.reduceFee = reduceFee; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getActDetailId() { + return actDetailId; + } + + public void setActDetailId(String actDetailId) { + this.actDetailId = actDetailId; + } + + public Double getAvgSendTime() { + return avgSendTime; + } + + public void setAvgSendTime(Double avgSendTime) { + this.avgSendTime = avgSendTime; + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeituanOrderItemEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeituanOrderItemEntity.java new file mode 100644 index 0000000..bd66055 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/MeituanOrderItemEntity.java @@ -0,0 +1,171 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; + +import com.alibaba.fastjson.JSONObject; + +public class MeituanOrderItemEntity implements Serializable { + + private static final long serialVersionUID = 2256815358403798672L; + + private String orderId;// 订单ID + + private String eDishCode;// erp方菜品id + + private Integer boxNum;// 餐盒数量 + + private Double boxPrice;// 餐盒单价 + + private String dishName;// 菜品名 + + private Double price;// 价格 + + private String skuId;// erp方菜品sku + + private String quantity;// 菜品份数 + + private String unit;// 单位 + + private Double discount;// 菜品折扣 + + private String spec;// 菜品规格 + + private String property;// 菜品属性 + + public MeituanOrderItemEntity() { + + } + + public MeituanOrderItemEntity(JSONObject jsonObject) { + if (jsonObject.containsKey("app_food_code")) { + eDishCode = jsonObject.getString("app_food_code"); + } + if (jsonObject.containsKey("box_num")) { + boxNum = jsonObject.getInteger("box_num"); + } + if (jsonObject.containsKey("box_price")) { + boxPrice = jsonObject.getDouble("box_price"); + } + if (jsonObject.containsKey("food_name")) { + dishName = jsonObject.getString("food_name"); + } + if (jsonObject.containsKey("price")) { + price = jsonObject.getDouble("price"); + } + if (jsonObject.containsKey("sku_id")) { + skuId = jsonObject.getString("sku_id"); + } + if (jsonObject.containsKey("quantity")) { + quantity = String.valueOf(jsonObject.getInteger("quantity")); + } + if (jsonObject.containsKey("unit")) { + unit = jsonObject.getString("unit"); + } + if (jsonObject.containsKey("food_discount")) { + discount = jsonObject.getDouble("food_discount"); + } + if (jsonObject.containsKey("spec")) { + spec = jsonObject.getString("spec"); + } + if (jsonObject.containsKey("food_property")) { + property = jsonObject.getString("food_property"); + } + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String geteDishCode() { + return eDishCode; + } + + public void seteDishCode(String eDishCode) { + this.eDishCode = eDishCode; + } + + public Integer getBoxNum() { + return boxNum; + } + + public void setBoxNum(Integer boxNum) { + this.boxNum = boxNum; + } + + public Double getBoxPrice() { + return boxPrice; + } + + public void setBoxPrice(Double boxPrice) { + this.boxPrice = boxPrice; + } + + public String getDishName() { + return dishName; + } + + public void setDishName(String dishName) { + this.dishName = dishName; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public String getSkuId() { + return skuId; + } + + public void setSkuId(String skuId) { + this.skuId = skuId; + } + + public String getQuantity() { + return quantity; + } + + public void setQuantity(String quantity) { + this.quantity = quantity; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public Double getDiscount() { + return discount; + } + + public void setDiscount(Double discount) { + this.discount = discount; + } + + public String getSpec() { + return spec; + } + + public void setSpec(String spec) { + this.spec = spec; + } + + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderController.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderController.java new file mode 100644 index 0000000..2b10bc4 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderController.java @@ -0,0 +1,293 @@ +package com.jwsaas.controller.waimai; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.amqp.rabbit.support.CorrelationData; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.alibaba.fastjson.JSONObject; +import com.jwsaas.Global; +import com.jwsaas.condition.Criteria; +import com.jwsaas.condition.Restrictions; +import com.jwsaas.config.MQMessageSender; +import com.jwsaas.controller.BaseController; +import com.jwsaas.entity.food.QimaiOrder; +import com.jwsaas.entity.food.QimaiOrderItem; +import com.jwsaas.entity.food.QimaiOrderPay; +import com.jwsaas.service.food.QimaiOrderItemService; +import com.jwsaas.service.food.QimaiOrderPayService; +import com.jwsaas.service.food.QimaiOrderService; + +@Controller(Global.APP_SIGN + "QiMaiOrderController") +@RequestMapping("/waimai/qimai") +public class QiMaiOrderController extends BaseController { + + @Resource + protected QimaiOrderService qimaiOrderService; + + @Resource + protected QimaiOrderItemService qimaiOrderItemService; + + @Resource + protected QimaiOrderPayService qimaiOrderPayService; + + @Resource + private MQMessageSender mqMessageSender; + + @RequestMapping(value = "/order", method = { RequestMethod.POST }) + @ResponseBody + public Object order(HttpServletRequest request, HttpServletResponse response) { + String info = "企迈订单推送"; + Map result = new HashMap<>(); + String tenantId = getParameter(request, "tenantId");// 企业编号 + String storeId = getParameter(request, "storeId");// 门店ID + String message = getParameter(request, "message");// 消息体 + message = filter(message); + logger.error(tenantId); + logger.error(storeId); + //logger.error(message); + try { + QiMaiOrderEntity entity = new QiMaiOrderEntity(JSONObject.parseObject(message).getJSONObject("data")); + entity.setStoreId(storeId); + entity.setMessage(message); + Date operateDate = new Date(); + String operateUser = "open-api"; + // 订单入库 + Criteria criteria = new Criteria(); + criteria.add(Restrictions.eq("orderId", entity.getOrderId())); + List orderList = qimaiOrderService.getList(tenantId, criteria); + if (!CollectionUtils.isEmpty(orderList)) { + QimaiOrder newEntity = orderList.get(0); + newEntity.setStoreId(storeId); + newEntity.setMessage(message); + newEntity.setAcceptMobile(entity.getAcceptMobile()); + newEntity.setAcceptName(entity.getAcceptName()); + newEntity.setAddress(entity.getAddress()); + newEntity.setAmount(entity.getAmount()); + newEntity.setCompletedAt(entity.getCompletedAt()); + newEntity.setCouponType(entity.getCouponType()); + newEntity.setCreateDate(new Date()); + newEntity.setCreatedTime(entity.getCreatedTime()); + newEntity.setExpress(entity.getExpress()); + newEntity.setFinalStatus(entity.getFinalStatus()); + newEntity.setFreight(entity.getFreight()); + newEntity.setGoods(entity.getGoods()); + newEntity.setGoodsName(entity.getGoodsName()); + newEntity.setLat(entity.getLat()); + newEntity.setLng(entity.getLng()); + newEntity.setMealTime(entity.getMealTime()); + newEntity.setMinusAmount(entity.getMinusAmount()); + newEntity.setMoblie(entity.getMoblie()); + newEntity.setModifyDate(operateDate); + newEntity.setModifyUser(operateUser); + newEntity.setMultiStoreId(entity.getMultiStoreId()); + newEntity.setMultiStoreMark(entity.getMultiStoreMark()); + newEntity.setMultiStoreName(entity.getMultiStoreName()); + newEntity.setMutilUser(entity.getMutilUser()); + newEntity.setOrderId(entity.getOrderId()); + newEntity.setOrderNo(entity.getOrderNo()); + newEntity.setPayModel(entity.getPayModel()); + newEntity.setPayTime(entity.getPayTime()); + newEntity.setPayUserName(entity.getPayUserName()); + newEntity.setPeopleNumber(entity.getPeopleNumber()); + newEntity.setPostscript(entity.getPostscript()); + newEntity.setReceivableAmount(entity.getReceivableAmount()); + newEntity.setRefundOrderId(entity.getRefundOrderId()); + newEntity.setRefundOrderStatus(entity.getRefundOrderStatus()); + newEntity.setRefundOrderStatusText(entity.getRefundOrderStatusText()); + newEntity.setReserveTakeoutTime(entity.getReserveTakeoutTime()); + newEntity.setSortNum(entity.getSortNum()); + newEntity.setSource(entity.getSource()); + newEntity.setSourceTxt(entity.getSourceTxt()); + newEntity.setStatus(entity.getStatus()); + newEntity.setStatusText(entity.getSourceTxt()); + newEntity.setTableNumber(entity.getTableNumber()); + newEntity.setTablewarePrice(entity.getTablewarePrice()); + newEntity.setTenantId(tenantId); + newEntity.setThirdDelivery(entity.getThirdDelivery()); + newEntity.setTotalAmount(entity.getTotalAmount()); + newEntity.setTypeCateText(entity.getTypeCateText()); + newEntity.setUseCoupon(entity.getUseCoupon()); + newEntity.setUserName(entity.getUserName()); + newEntity.setUserNameAll(entity.getUserNameAll()); + newEntity.setWalletAmount(entity.getWalletAmount()); + List items = entity.getOrderItems(); + List pays = entity.getOrderPays(); + List itemList = new ArrayList<>(); + if (items != null && items.size() > 0) { + for (QiMaiOrderItemEntity itemEntity : items) { + QimaiOrderItem it = new QimaiOrderItem(); + it.setCostPrice(itemEntity.getCostPrice()); + it.setCreateDate(operateDate); + it.setCreateUser(operateUser); + it.setDishId(itemEntity.getDishId()); + it.setImage(itemEntity.getImage()); + it.setIncomeRate(itemEntity.getIncomeRate()); + it.setIncomeRate2(itemEntity.getIncomeRate2()); + it.setIsGive(itemEntity.getIsGive()); + it.setIsSend(itemEntity.getIsSend()); + it.setMinus(itemEntity.getMinus()); + it.setName(itemEntity.getName()); + it.setNum(itemEntity.getNum()); + it.setOrderId(entity.getOrderId()); + it.setPrice(itemEntity.getPrice()); + it.setSentAt(itemEntity.getSentAt()); + it.setTenantId(tenantId); + it.setTradeMark(itemEntity.getTradeMark()); + itemList.add(it); + } + } + List payList = new ArrayList<>(); + if (pays != null && pays.size() > 0) { + for (QiMaiOrderPayEntity payEntity : pays) { + QimaiOrderPay py = new QimaiOrderPay(); + py.setName(payEntity.getName()); + py.setOrderId(entity.getOrderId()); + py.setTenantId(tenantId); + py.setType(payEntity.getType()); + py.setCreateDate(operateDate); + py.setCreateUser(operateUser); + payList.add(py); + } + } + if (Global.USEMQ) { + // 放入消息队列 + Map waimai_message = new HashMap<>(); + waimai_message.put("type", "qimaiupdate"); + waimai_message.put("newEntity", newEntity); + waimai_message.put("itemList", itemList); + waimai_message.put("payList", payList); + CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); + this.mqMessageSender.send4qimaiupdate(tenantId, waimai_message, correlationData); + } else { + this.qimaiOrderService.updateOrder(tenantId, newEntity, itemList, payList); + } + } else { + QimaiOrder newEntity = new QimaiOrder(); + newEntity.setStoreId(storeId); + newEntity.setMessage(message); + newEntity.setAcceptMobile(entity.getAcceptMobile()); + newEntity.setAcceptName(entity.getAcceptName()); + newEntity.setAddress(entity.getAddress()); + newEntity.setAmount(entity.getAmount()); + newEntity.setCompletedAt(entity.getCompletedAt()); + newEntity.setCouponType(entity.getCouponType()); + newEntity.setCreateDate(operateDate); + newEntity.setCreatedTime(entity.getCreatedTime()); + newEntity.setCreateUser(operateUser); + newEntity.setExpress(entity.getExpress()); + newEntity.setFinalStatus(entity.getFinalStatus()); + newEntity.setFreight(entity.getFreight()); + newEntity.setGoods(entity.getGoods()); + newEntity.setGoodsName(entity.getGoodsName()); + newEntity.setLat(entity.getLat()); + newEntity.setLng(entity.getLng()); + newEntity.setMealTime(entity.getMealTime()); + newEntity.setMinusAmount(entity.getMinusAmount()); + newEntity.setMoblie(entity.getMoblie()); + newEntity.setMultiStoreId(entity.getMultiStoreId()); + newEntity.setMultiStoreMark(entity.getMultiStoreMark()); + newEntity.setMultiStoreName(entity.getMultiStoreName()); + newEntity.setMutilUser(entity.getMutilUser()); + newEntity.setOrderId(entity.getOrderId()); + newEntity.setOrderNo(entity.getOrderNo()); + newEntity.setPayModel(entity.getPayModel()); + newEntity.setPayTime(entity.getPayTime()); + newEntity.setPayUserName(entity.getPayUserName()); + newEntity.setPeopleNumber(entity.getPeopleNumber()); + newEntity.setPostscript(entity.getPostscript()); + newEntity.setReceivableAmount(entity.getReceivableAmount()); + newEntity.setRefundOrderId(entity.getRefundOrderId()); + newEntity.setRefundOrderStatus(entity.getRefundOrderStatus()); + newEntity.setRefundOrderStatusText(entity.getRefundOrderStatusText()); + newEntity.setReserveTakeoutTime(entity.getReserveTakeoutTime()); + newEntity.setSortNum(entity.getSortNum()); + newEntity.setSource(entity.getSource()); + newEntity.setSourceTxt(entity.getSourceTxt()); + newEntity.setStatus(entity.getStatus()); + newEntity.setStatusText(entity.getSourceTxt()); + newEntity.setTableNumber(entity.getTableNumber()); + newEntity.setTablewarePrice(entity.getTablewarePrice()); + newEntity.setTenantId(tenantId); + newEntity.setThirdDelivery(entity.getThirdDelivery()); + newEntity.setTotalAmount(entity.getTotalAmount()); + newEntity.setTypeCateText(entity.getTypeCateText()); + newEntity.setUseCoupon(entity.getUseCoupon()); + newEntity.setUserName(entity.getUserName()); + newEntity.setUserNameAll(entity.getUserNameAll()); + newEntity.setWalletAmount(entity.getWalletAmount()); + List items = entity.getOrderItems(); + List pays = entity.getOrderPays(); + List itemList = new ArrayList<>(); + if (items != null && items.size() > 0) { + for (QiMaiOrderItemEntity itemEntity : items) { + QimaiOrderItem it = new QimaiOrderItem(); + it.setCostPrice(itemEntity.getCostPrice()); + it.setCreateDate(operateDate); + it.setCreateUser(operateUser); + it.setDishId(itemEntity.getDishId()); + it.setImage(itemEntity.getImage()); + it.setIncomeRate(itemEntity.getIncomeRate()); + it.setIncomeRate2(itemEntity.getIncomeRate2()); + it.setIsGive(itemEntity.getIsGive()); + it.setIsSend(itemEntity.getIsSend()); + it.setMinus(itemEntity.getMinus()); + it.setName(itemEntity.getName()); + it.setNum(itemEntity.getNum()); + it.setOrderId(entity.getOrderId()); + it.setPrice(itemEntity.getPrice()); + it.setSentAt(itemEntity.getSentAt()); + it.setTenantId(tenantId); + it.setTradeMark(itemEntity.getTradeMark()); + itemList.add(it); + } + } + List payList = new ArrayList<>(); + if (pays != null && pays.size() > 0) { + for (QiMaiOrderPayEntity payEntity : pays) { + QimaiOrderPay py = new QimaiOrderPay(); + py.setName(payEntity.getName()); + py.setOrderId(entity.getOrderId()); + py.setTenantId(tenantId); + py.setType(payEntity.getType()); + py.setCreateDate(operateDate); + py.setCreateUser(operateUser); + payList.add(py); + } + } + if (Global.USEMQ) { + // 放入消息队列 + Map waimai_message = new HashMap<>(); + waimai_message.put("type", "qimaicreate"); + waimai_message.put("newEntity", newEntity); + waimai_message.put("itemList", itemList); + waimai_message.put("payList", payList); + CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); + this.mqMessageSender.send4qimaicreate(tenantId, waimai_message, correlationData); + }else{ + this.qimaiOrderService.saveOrder(tenantId, newEntity, itemList, payList); + } + } + result.put("info", "success"); + result.put("final_status", entity.getFinalStatus()); + result.put("refund_order_status", entity.getRefundOrderStatus()); + } catch (Exception e) { + logger.error(info, e); + result.put("status", "error"); + } + return result; + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderEntity.java new file mode 100644 index 0000000..2e26541 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderEntity.java @@ -0,0 +1,695 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +public class QiMaiOrderEntity implements Serializable { + + private static final long serialVersionUID = -975253547225858225L; + + private String message;// 消息 + + private String storeId;// 巨为门店id + + private String orderId;// 订单ID + + private String multiStoreName;// 门店名称 + + private String multiStoreId;// 门店ID + + private String orderNo;// 订单号 + + private String createdTime;// 创建时间 + + private String payTime;// 支付时间 + + private Integer status;// 订单状态 + + private String sortNum;// 取单号 + + private Double amount;// 应付价格 + + private Double totalAmount;// 总价格 + + private Double minusAmount;// 优惠价格 + + private Integer useCoupon;// 是否使用优惠券 + + private Integer couponType;// 使用的优惠券类型 + + private String postscript;// 备注 + + private String typeCateText;// 订单类型文字 + + private String userName;// 用户名称 + + private String payUserName;// 支付用户名称 + + private Integer source;// 订单来源 + + private String sourceTxt;// 来源文字 + + private String moblie;// 用户手机号 + + private String userNameAll;// 用户全称 + + private String goodsName;// 商品名称集合 + + private String refundOrderId;// 退款订单id + + private Integer refundOrderStatus;// 退款订单状态 + + private String refundOrderStatusText;// 退款订单状态文字 + + private String goods;// 商品详情 + + private List orderItems;// 商品详情 + + private Integer mutilUser;// 是否多人点餐 + + private String tableNumber;// 桌号 + + private Double freight;// 配送费 + + private Double tablewarePrice;// 餐具费 + + private Integer finalStatus;// 状态 + + private String statusText;// 状态文字 + + private Integer peopleNumber;// 就餐人数 + + private String multiStoreMark;// 门店编码 + + private String completedAt;// 订单完成时间 + + private String reserveTakeoutTime;// 预计送达时间 + + private String mealTime;// 预点餐订单的就餐时间 + + private Integer express;// 配送快递 + + private String lat;// 纬度 + + private String lng;// 经度 + + private String thirdDelivery;// 配送信息 + + private String acceptName;// 收件人名称 + + private String acceptMobile;// 收件人联系方式 + + private String address;// 收件人地址 + + private String payModel;// 支付详情 + + private List orderPays;// 支付详情 + + private Double walletAmount;// 余额支付金额 + + private Double receivableAmount;// 实际支付金额 + + public QiMaiOrderEntity() { + + } + + public QiMaiOrderEntity(JSONObject jsonObject) { + + if (jsonObject.containsKey("id")) { + orderId = jsonObject.getString("id"); + } + if (jsonObject.containsKey("multi_store_name")) { + multiStoreName = jsonObject.getString("multi_store_name"); + } + if (jsonObject.containsKey("multi_store_id")) { + multiStoreId = jsonObject.getString("multi_store_id"); + } + if (jsonObject.containsKey("order_no")) { + orderNo = jsonObject.getString("order_no"); + } + if (jsonObject.containsKey("created_time")) { + createdTime = jsonObject.getString("created_time"); + } + if (jsonObject.containsKey("pay_time")) { + payTime = jsonObject.getString("pay_time"); + } + if (jsonObject.containsKey("status")) { + status = jsonObject.getInteger("status"); + } + if (jsonObject.containsKey("sort_num")) { + sortNum = jsonObject.getString("sort_num"); + } + if (jsonObject.containsKey("amount")) { + amount = jsonObject.getDouble("amount"); + } + if (jsonObject.containsKey("total_amount")) { + totalAmount = jsonObject.getDouble("total_amount"); + } + if (jsonObject.containsKey("minus_amount")) { + minusAmount = jsonObject.getDouble("minus_amount"); + } + if (jsonObject.containsKey("use_coupon")) { + useCoupon = jsonObject.getInteger("use_coupon"); + } + if (jsonObject.containsKey("coupon_type")) { + couponType = jsonObject.getInteger("coupon_type"); + } + if (jsonObject.containsKey("postscript")) { + postscript = jsonObject.getString("postscript"); + } + if (jsonObject.containsKey("typeCateText")) { + typeCateText = jsonObject.getString("typeCateText"); + } + if (jsonObject.containsKey("user_name")) { + userName = jsonObject.getString("user_name"); + } + if (jsonObject.containsKey("pay_user_name")) { + payUserName = jsonObject.getString("pay_user_name"); + } + if (jsonObject.containsKey("source")) { + source = jsonObject.getInteger("source"); + } + if (jsonObject.containsKey("source_txt")) { + sourceTxt = jsonObject.getString("source_txt"); + } + if (jsonObject.containsKey("source_txt")) { + sourceTxt = jsonObject.getString("source_txt"); + } + if (jsonObject.containsKey("moblie")) { + moblie = jsonObject.getString("moblie"); + } + if (jsonObject.containsKey("user_name_all")) { + userNameAll = jsonObject.getString("user_name_all"); + } + if (jsonObject.containsKey("goods_name")) { + goodsName = jsonObject.getString("goods_name"); + } + if (jsonObject.containsKey("refund_order_id")) { + refundOrderId = jsonObject.getString("refund_order_id"); + } + if (jsonObject.containsKey("refund_order_status")) { + refundOrderStatus = jsonObject.getInteger("refund_order_status"); + } + if (jsonObject.containsKey("refund_order_status_text")) { + refundOrderStatusText = jsonObject.getString("refund_order_status_text"); + } + if (jsonObject.containsKey("goods")) { + goods = jsonObject.getString("goods"); + orderItems = new ArrayList<>(); + JSONObject goodJson = JSONObject.parseObject(goods); + if (goodJson.containsKey("goods")) { + JSONArray goodsArrayJson = goodJson.getJSONArray("goods"); + for (int i = 0; i < goodsArrayJson.size(); i++) { + JSONObject detailObject = goodsArrayJson.getJSONObject(i); + QiMaiOrderItemEntity orderItem = new QiMaiOrderItemEntity(detailObject); + orderItem.setOrderId(orderId); + orderItems.add(orderItem); + } + } + } + if (jsonObject.containsKey("mutil_user")) { + mutilUser = jsonObject.getInteger("mutil_user"); + } + if (jsonObject.containsKey("table_number")) { + tableNumber = jsonObject.getString("table_number"); + } + if (jsonObject.containsKey("freight")) { + freight = jsonObject.getDouble("freight"); + } + if (jsonObject.containsKey("tableware_price")) { + tablewarePrice = jsonObject.getDouble("tableware_price"); + } + if (jsonObject.containsKey("final_status")) { + finalStatus = jsonObject.getInteger("final_status"); + } + if (jsonObject.containsKey("status_text")) { + statusText = jsonObject.getString("status_text"); + } + if (jsonObject.containsKey("people_number")) { + peopleNumber = jsonObject.getInteger("people_number"); + } + if (jsonObject.containsKey("multi_store_mark")) { + multiStoreMark = jsonObject.getString("multi_store_mark"); + } + if (jsonObject.containsKey("completed_at")) { + completedAt = jsonObject.getString("completed_at"); + } + if (jsonObject.containsKey("reserve_takeout_time")) { + reserveTakeoutTime = jsonObject.getString("reserve_takeout_time"); + } + if (jsonObject.containsKey("meal_time")) { + mealTime = jsonObject.getString("meal_time"); + } + if (jsonObject.containsKey("express")) { + express = jsonObject.getInteger("express"); + } + if (jsonObject.containsKey("lat")) { + lat = jsonObject.getString("lat"); + } + if (jsonObject.containsKey("lng")) { + lng = jsonObject.getString("lng"); + } + if (jsonObject.containsKey("third_delivery")) { + thirdDelivery = jsonObject.getString("third_delivery"); + } + if (jsonObject.containsKey("third_delivery")) { + thirdDelivery = jsonObject.getString("third_delivery"); + } + if (jsonObject.containsKey("accept_name")) { + acceptName = jsonObject.getString("accept_name"); + } + if (jsonObject.containsKey("accept_mobile")) { + acceptMobile = jsonObject.getString("accept_mobile"); + } + if (jsonObject.containsKey("address")) { + address = jsonObject.getString("address"); + } + if (jsonObject.containsKey("pay_model")) { + payModel = jsonObject.getString("pay_model"); + orderPays = new ArrayList<>(); + JSONObject paysArrayJson = JSONObject.parseObject(payModel); + QiMaiOrderPayEntity orderPay = new QiMaiOrderPayEntity(paysArrayJson); + orderPay.setOrderId(orderId); + orderPays.add(orderPay); + } + if (jsonObject.containsKey("wallet_amount")) { + walletAmount = jsonObject.getDouble("wallet_amount"); + } + if (jsonObject.containsKey("receivable_amount")) { + receivableAmount = jsonObject.getDouble("receivable_amount"); + } + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getStoreId() { + return storeId; + } + + public void setStoreId(String storeId) { + this.storeId = storeId; + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getMultiStoreName() { + return multiStoreName; + } + + public void setMultiStoreName(String multiStoreName) { + this.multiStoreName = multiStoreName; + } + + public String getMultiStoreId() { + return multiStoreId; + } + + public void setMultiStoreId(String multiStoreId) { + this.multiStoreId = multiStoreId; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(String createdTime) { + this.createdTime = createdTime; + } + + public String getPayTime() { + return payTime; + } + + public void setPayTime(String payTime) { + this.payTime = payTime; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getSortNum() { + return sortNum; + } + + public void setSortNum(String sortNum) { + this.sortNum = sortNum; + } + + public Double getAmount() { + return amount; + } + + public void setAmount(Double amount) { + this.amount = amount; + } + + public Double getTotalAmount() { + return totalAmount; + } + + public void setTotalAmount(Double totalAmount) { + this.totalAmount = totalAmount; + } + + public Double getMinusAmount() { + return minusAmount; + } + + public void setMinusAmount(Double minusAmount) { + this.minusAmount = minusAmount; + } + + public Integer getUseCoupon() { + return useCoupon; + } + + public void setUseCoupon(Integer useCoupon) { + this.useCoupon = useCoupon; + } + + public Integer getCouponType() { + return couponType; + } + + public void setCouponType(Integer couponType) { + this.couponType = couponType; + } + + public String getPostscript() { + return postscript; + } + + public void setPostscript(String postscript) { + this.postscript = postscript; + } + + public String getTypeCateText() { + return typeCateText; + } + + public void setTypeCateText(String typeCateText) { + this.typeCateText = typeCateText; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPayUserName() { + return payUserName; + } + + public void setPayUserName(String payUserName) { + this.payUserName = payUserName; + } + + public Integer getSource() { + return source; + } + + public void setSource(Integer source) { + this.source = source; + } + + public String getSourceTxt() { + return sourceTxt; + } + + public void setSourceTxt(String sourceTxt) { + this.sourceTxt = sourceTxt; + } + + public String getMoblie() { + return moblie; + } + + public void setMoblie(String moblie) { + this.moblie = moblie; + } + + public String getUserNameAll() { + return userNameAll; + } + + public void setUserNameAll(String userNameAll) { + this.userNameAll = userNameAll; + } + + public String getGoodsName() { + return goodsName; + } + + public void setGoodsName(String goodsName) { + this.goodsName = goodsName; + } + + public String getRefundOrderId() { + return refundOrderId; + } + + public void setRefundOrderId(String refundOrderId) { + this.refundOrderId = refundOrderId; + } + + public Integer getRefundOrderStatus() { + return refundOrderStatus; + } + + public void setRefundOrderStatus(Integer refundOrderStatus) { + this.refundOrderStatus = refundOrderStatus; + } + + public String getRefundOrderStatusText() { + return refundOrderStatusText; + } + + public void setRefundOrderStatusText(String refundOrderStatusText) { + this.refundOrderStatusText = refundOrderStatusText; + } + + public String getGoods() { + return goods; + } + + public void setGoods(String goods) { + this.goods = goods; + } + + public List getOrderItems() { + return orderItems; + } + + public void setOrderItems(List orderItems) { + this.orderItems = orderItems; + } + + public Integer getMutilUser() { + return mutilUser; + } + + public void setMutilUser(Integer mutilUser) { + this.mutilUser = mutilUser; + } + + public String getTableNumber() { + return tableNumber; + } + + public void setTableNumber(String tableNumber) { + this.tableNumber = tableNumber; + } + + public Double getFreight() { + return freight; + } + + public void setFreight(Double freight) { + this.freight = freight; + } + + public Double getTablewarePrice() { + return tablewarePrice; + } + + public void setTablewarePrice(Double tablewarePrice) { + this.tablewarePrice = tablewarePrice; + } + + public Integer getFinalStatus() { + return finalStatus; + } + + public void setFinalStatus(Integer finalStatus) { + this.finalStatus = finalStatus; + } + + public String getStatusText() { + return statusText; + } + + public void setStatusText(String statusText) { + this.statusText = statusText; + } + + public Integer getPeopleNumber() { + return peopleNumber; + } + + public void setPeopleNumber(Integer peopleNumber) { + this.peopleNumber = peopleNumber; + } + + public String getMultiStoreMark() { + return multiStoreMark; + } + + public void setMultiStoreMark(String multiStoreMark) { + this.multiStoreMark = multiStoreMark; + } + + public String getCompletedAt() { + return completedAt; + } + + public void setCompletedAt(String completedAt) { + this.completedAt = completedAt; + } + + public String getReserveTakeoutTime() { + return reserveTakeoutTime; + } + + public void setReserveTakeoutTime(String reserveTakeoutTime) { + this.reserveTakeoutTime = reserveTakeoutTime; + } + + public String getMealTime() { + return mealTime; + } + + public void setMealTime(String mealTime) { + this.mealTime = mealTime; + } + + public Integer getExpress() { + return express; + } + + public void setExpress(Integer express) { + this.express = express; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getThirdDelivery() { + return thirdDelivery; + } + + public void setThirdDelivery(String thirdDelivery) { + this.thirdDelivery = thirdDelivery; + } + + public String getAcceptName() { + return acceptName; + } + + public void setAcceptName(String acceptName) { + this.acceptName = acceptName; + } + + public String getAcceptMobile() { + return acceptMobile; + } + + public void setAcceptMobile(String acceptMobile) { + this.acceptMobile = acceptMobile; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getPayModel() { + return payModel; + } + + public void setPayModel(String payModel) { + this.payModel = payModel; + } + + public List getOrderPays() { + return orderPays; + } + + public void setOrderPays(List orderPays) { + this.orderPays = orderPays; + } + + public Double getWalletAmount() { + return walletAmount; + } + + public void setWalletAmount(Double walletAmount) { + this.walletAmount = walletAmount; + } + + public Double getReceivableAmount() { + return receivableAmount; + } + + public void setReceivableAmount(Double receivableAmount) { + this.receivableAmount = receivableAmount; + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderItemEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderItemEntity.java new file mode 100644 index 0000000..08f50e9 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderItemEntity.java @@ -0,0 +1,197 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; + +import com.alibaba.fastjson.JSONObject; + +public class QiMaiOrderItemEntity implements Serializable { + + private static final long serialVersionUID = 7930172251524778092L; + + private String orderId;// 订单ID + + private String dishId;// 菜品id + + private String name;// 商品名称 + + private String image;// 图片 + + private Double price;// 价格 + + private Double minus;// 优惠金额 + + private Double costPrice;// 成本价格 + + private Integer num;// 数量 + + private Integer isSend;// 是否发货 + + private String sentAt;// 发货时间 + + private Integer isGive;// 是否赠品 + + private Double incomeRate;// 推广员佣金 + + private String tradeMark;// 商品标识 + + private Double incomeRate2;// 邀请人佣金 + + public QiMaiOrderItemEntity() { + + } + + public QiMaiOrderItemEntity(JSONObject jsonObject) { + if (jsonObject.containsKey("id")) { + dishId = jsonObject.getString("id"); + } + if (jsonObject.containsKey("name")) { + name = jsonObject.getString("name"); + } + if (jsonObject.containsKey("image")) { + image = jsonObject.getString("image"); + } + if (jsonObject.containsKey("price")) { + price = jsonObject.getDouble("price"); + } + if (jsonObject.containsKey("minus")) { + minus = jsonObject.getDouble("minus"); + } + if (jsonObject.containsKey("cost_price")) { + costPrice = jsonObject.getDouble("cost_price"); + } + if (jsonObject.containsKey("num")) { + num = jsonObject.getInteger("num"); + } + if (jsonObject.containsKey("is_send")) { + isSend = jsonObject.getInteger("is_send"); + } + if (jsonObject.containsKey("sent_at")) { + sentAt = jsonObject.getString("sent_at"); + } + if (jsonObject.containsKey("is_give")) { + isGive = jsonObject.getInteger("is_give"); + } + if (jsonObject.containsKey("income_rate")) { + incomeRate = jsonObject.getDouble("income_rate"); + } + if (jsonObject.containsKey("trade_mark")) { + tradeMark = jsonObject.getString("trade_mark"); + } + if (jsonObject.containsKey("income_rate2")) { + incomeRate2 = jsonObject.getDouble("income_rate2"); + } + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getDishId() { + return dishId; + } + + public void setDishId(String dishId) { + this.dishId = dishId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public Double getMinus() { + return minus; + } + + public void setMinus(Double minus) { + this.minus = minus; + } + + public Double getCostPrice() { + return costPrice; + } + + public void setCostPrice(Double costPrice) { + this.costPrice = costPrice; + } + + public Integer getNum() { + return num; + } + + public void setNum(Integer num) { + this.num = num; + } + + public Integer getIsSend() { + return isSend; + } + + public void setIsSend(Integer isSend) { + this.isSend = isSend; + } + + public String getSentAt() { + return sentAt; + } + + public void setSentAt(String sentAt) { + this.sentAt = sentAt; + } + + public Integer getIsGive() { + return isGive; + } + + public void setIsGive(Integer isGive) { + this.isGive = isGive; + } + + public Double getIncomeRate() { + return incomeRate; + } + + public void setIncomeRate(Double incomeRate) { + this.incomeRate = incomeRate; + } + + public String getTradeMark() { + return tradeMark; + } + + public void setTradeMark(String tradeMark) { + this.tradeMark = tradeMark; + } + + public Double getIncomeRate2() { + return incomeRate2; + } + + public void setIncomeRate2(Double incomeRate2) { + this.incomeRate2 = incomeRate2; + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderPayEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderPayEntity.java new file mode 100644 index 0000000..49fb42d --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/QiMaiOrderPayEntity.java @@ -0,0 +1,53 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; + +import com.alibaba.fastjson.JSONObject; + +public class QiMaiOrderPayEntity implements Serializable { + + private static final long serialVersionUID = 5938158311962070095L; + + private String orderId;//订单ID + + private String name;//支付方式名称 + + private Integer type;//支付方式id + + public QiMaiOrderPayEntity() { + + } + + public QiMaiOrderPayEntity(JSONObject jsonObject) { + if (jsonObject.containsKey("name")) { + name = jsonObject.getString("name"); + } + if (jsonObject.containsKey("type")) { + type = jsonObject.getInteger("type"); + } + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeiTuanOrderController.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeiTuanOrderController.java new file mode 100644 index 0000000..46896eb --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeiTuanOrderController.java @@ -0,0 +1,337 @@ +package com.jwsaas.controller.waimai; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.jwsaas.entity.ops.AppShopmeituanSetStore; +import com.jwsaas.service.ops.AppShopmeituanSetStoreService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.amqp.rabbit.support.CorrelationData; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.alibaba.fastjson.JSONObject; +import com.jwsaas.Global; +import com.jwsaas.condition.Criteria; +import com.jwsaas.condition.Restrictions; +import com.jwsaas.config.MQMessageSender; +import com.jwsaas.controller.BaseController; +import com.jwsaas.entity.food.ShopMeituanOrder; +import com.jwsaas.entity.food.ShopMeituanOrderExtra; +import com.jwsaas.entity.food.ShopMeituanOrderItem; +import com.jwsaas.service.food.ShopMeituanOrderExtraService; +import com.jwsaas.service.food.ShopMeituanOrderItemService; +import com.jwsaas.service.food.ShopMeituanOrderService; +import com.vdurmont.emoji.EmojiParser; + +@Controller(Global.APP_SIGN + "ShopMeiTuanOrderController") +@RequestMapping("/waimai/shopmeituan") +public class ShopMeiTuanOrderController extends BaseController { + + @Resource + protected ShopMeituanOrderService shopMeituanOrderService; + + @Resource + protected ShopMeituanOrderItemService shopMeituanOrderItemService; + + @Resource + protected ShopMeituanOrderExtraService shopMeituanOrderExtraService; + + @Resource + private AppShopmeituanSetStoreService appShopmeituanSetStoreService; + + @Resource + private MQMessageSender mqMessageSender; + + @RequestMapping(value = "/order", method = { RequestMethod.POST }) + @ResponseBody + public Object order(HttpServletRequest request, HttpServletResponse response) { + String info = "美团订单推送"; + Map result = new HashMap<>(); + String tenantId = getParameter(request, "tenantId");// 企业编号 + String storeId = getParameter(request, "storeId");// 门店ID + String message = getParameter(request, "message");// 消息体 + message = EmojiParser.removeAllEmojis(message); + message = filter(message); + String reasonCode = getParameter(request, "reasonCode");// 订单取消CODE + String reason = getParameter(request, "reason");// 取消原因 + String refundReasonCode = getParameter(request, "refundReasonCode");// 退单CODE + String refundReason = getParameter(request, "refundReason");// 退单原因 + String pickType = getParameter(request, "pickType");// 取餐类型 + String status = null; + logger.error(tenantId); + logger.error(storeId); + //logger.error(message); + try { + + if("571022".equals(tenantId) || "210008".equals(tenantId)){ + Criteria criteria = new Criteria(); + criteria.add(Restrictions.eq("storeId",storeId)); + List storeList = appShopmeituanSetStoreService.getList("10001",criteria); + if(CollectionUtils.isNotEmpty(storeList)){ + tenantId = storeList.get(0).getTenantCode(); + } + } + + Date operateDate = new Date(); + ShopMeituanOrderEntity entity = new ShopMeituanOrderEntity(JSONObject.parseObject(message)); + entity.setStoreId(storeId); + entity.setMessage(message); + // 订单入库 + Criteria criteria = new Criteria(); + criteria.add(Restrictions.eq("orderId", entity.getOrderId())); + List orderList = shopMeituanOrderService.getList(tenantId, criteria); + if (!CollectionUtils.isEmpty(orderList)) { + ShopMeituanOrder newEntity = orderList.get(0); + newEntity.setStoreId(storeId); + newEntity.setModifyUser("open-api"); + newEntity.setModifyDate(operateDate); + if (reason != null && !"".equals(reason)) { + newEntity.setCancelReason(reason); + } + if (reasonCode != null && !"".equals(reasonCode)) { + newEntity.setCancelReasonCode(reasonCode); + } + if (refundReason != null && !"".equals(refundReason)) { + newEntity.setRefundReason(refundReason); + } + if (refundReasonCode != null && !"".equals(refundReasonCode)) { + newEntity.setRefundReasonCode(refundReasonCode); + } + newEntity.setTenantId(tenantId); + newEntity.setMessage(message); + newEntity.setOrderId(entity.getOrderId()); + newEntity.setOrderIdView(entity.getOrderIdView()); + newEntity.setWmPoiName(entity.getWmPoiName()); + newEntity.setWmPoiAddress(entity.getWmPoiAddress()); + newEntity.setWmPoiPhone(entity.getWmPoiPhone()); + newEntity.setRecipientAddress(entity.getRecipientAddress()); + newEntity.setRecipientPhone(entity.getRecipientPhone()); + newEntity.setBackupRecipientPhone(entity.getBackupRecipientPhone()); + newEntity.setRecipientName(entity.getRecipientName()); + newEntity.setShippingFee(entity.getShippingFee()); + newEntity.setTotal(entity.getTotal()); + newEntity.setOriginalPrice(entity.getOriginalPrice()); + newEntity.setCaution(entity.getCaution()); + newEntity.setShipperPhone(entity.getShipperPhone()); + newEntity.setStatus(entity.getStatus()); + newEntity.setCityId(entity.getCityId()); + newEntity.setHasInvoiced(entity.getHasInvoiced()); + newEntity.setInvoiceTitle(entity.getInvoiceTitle()); + newEntity.setTaxpayerId(entity.getTaxpayerId()); + newEntity.setCTime(entity.getCTime()); + newEntity.setDeliveryTime(entity.getDeliveryTime()); + newEntity.setIsThirdShipping(entity.getIsThirdShipping()); + newEntity.setPayType(entity.getPayType()); + newEntity.setLatitude(entity.getLatitude()); + newEntity.setLongitude(entity.getLongitude()); + newEntity.setDaySeq(entity.getDaySeq()); + newEntity.setIsFavorites(entity.getIsFavorites()); + newEntity.setIsPoiFirstOrder(entity.getIsPoiFirstOrder()); + newEntity.setDinnersNumber(entity.getDinnersNumber()); + newEntity.setLogisticsCode(entity.getLogisticsCode()); + + List itemList = new ArrayList<>(); + for (ShopMeituanOrderItemEntity meituanOrderItemEntity : entity.getOrderItemList()) { + ShopMeituanOrderItem item = new ShopMeituanOrderItem(); + item.setTenantId(tenantId); + item.setCreateDate(operateDate); + item.setCreateUser("open-api"); + item.setOrderId(entity.getOrderId()); + item.setAppFoodCode(meituanOrderItemEntity.getAppFoodCode()); + item.setFoodName(meituanOrderItemEntity.getFoodName()); + item.setQuantity(meituanOrderItemEntity.getQuantity()); + item.setPrice(meituanOrderItemEntity.getPrice()); + item.setStoreId(storeId); + item.setSkuId(meituanOrderItemEntity.getSkuId()); + item.setBoxNum(meituanOrderItemEntity.getBoxNum()); + item.setBoxPrice(meituanOrderItemEntity.getBoxPrice()); + item.setUnit(meituanOrderItemEntity.getUnit()); + item.setFoodDiscount(meituanOrderItemEntity.getFoodDiscount()); + item.setFoodProperty(meituanOrderItemEntity.getFoodProperty()); + item.setCartId(meituanOrderItemEntity.getCartId()); + itemList.add(item); + } + List extraList = new ArrayList<>(); + for (ShopMeituanOrderExtraEntity meituanOrderExtraEntity : entity.getOrderExtraList()) { + ShopMeituanOrderExtra extra = new ShopMeituanOrderExtra(); + extra.setTenantId(tenantId); + extra.setCreateDate(operateDate); + extra.setCreateUser("open-api"); + extra.setOrderId(entity.getOrderId()); + extra.setReduceFee(meituanOrderExtraEntity.getReduceFee()); + extra.setPoiCharge(meituanOrderExtraEntity.getPoiCharge()); + extra.setMtCharge(meituanOrderExtraEntity.getMtCharge()); + extra.setRemark(meituanOrderExtraEntity.getRemark()); + extra.setType(meituanOrderExtraEntity.getType()); + extra.setActDetailId(meituanOrderExtraEntity.getActDetailId()); + extraList.add(extra); + } + if (pickType != null) { + newEntity.setPickType(Integer.parseInt(pickType)); + } + newEntity.setAvgSendTime(entity.getAvgSendTime()); + newEntity.setOrderSendTime(entity.getOrderSendTime()); + newEntity.setOrderReceiveTime(entity.getOrderReceiveTime()); + newEntity.setOrderConfirmTime(entity.getOrderConfirmTime()); + newEntity.setOrderCancelTime(entity.getOrderCancelTime()); + newEntity.setOrderCompletedTime(entity.getOrderCompletedTime()); + newEntity.setLogisticsStatus(entity.getLogisticsStatus()); + newEntity.setLogisticsId(entity.getLogisticsId()); + newEntity.setLogisticsName(entity.getLogisticsName()); + newEntity.setLogisticsSendTime(entity.getLogisticsSendTime()); + newEntity.setLogisticsConfirmTime(entity.getLogisticsConfirmTime()); + newEntity.setLogisticsCancelTime(entity.getLogisticsCancelTime()); + newEntity.setLogisticsFetchTime(entity.getLogisticsFetchTime()); + newEntity.setLogisticsCompletedTime(entity.getLogisticsCompletedTime()); + newEntity.setLogisticsDispatcherName(entity.getLogisticsDispatcherName()); + newEntity.setLogisticsDispatcherMobile(entity.getLogisticsDispatcherMobile()); + newEntity.setChannel(entity.getChannel()); + newEntity.setFoodShareFeeChargeByPoi(entity.getFoodShareFeeChargeByPoi()); + newEntity.setWmPoiReceiveCent(entity.getWmPoiReceiveCent()); + status = String.valueOf(newEntity.getStatus()); + // 放入消息队列 + Map waimai_message = new HashMap<>(); + waimai_message.put("type", "shopmeituanupdate"); + waimai_message.put("newEntity", newEntity); + CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); + this.mqMessageSender.send4shopmeituanupdate(tenantId, waimai_message, correlationData); + } else { + ShopMeituanOrder newEntity = new ShopMeituanOrder(); + if (reason != null && !"".equals(reason)) { + newEntity.setCancelReason(reason); + } + if (reasonCode != null && !"".equals(reasonCode)) { + newEntity.setCancelReasonCode(reasonCode); + } + if (refundReason != null && !"".equals(refundReason)) { + newEntity.setRefundReason(refundReason); + } + if (refundReasonCode != null && !"".equals(refundReasonCode)) { + newEntity.setRefundReasonCode(refundReasonCode); + } + newEntity.setStoreId(storeId); + newEntity.setCreateDate(operateDate); + newEntity.setCreateUser("open-api"); + newEntity.setTenantId(tenantId); + newEntity.setMessage(message); + newEntity.setOrderId(entity.getOrderId()); + newEntity.setOrderIdView(entity.getOrderIdView()); + newEntity.setWmPoiName(entity.getWmPoiName()); + newEntity.setWmPoiAddress(entity.getWmPoiAddress()); + newEntity.setWmPoiPhone(entity.getWmPoiPhone()); + newEntity.setRecipientAddress(entity.getRecipientAddress()); + newEntity.setRecipientPhone(entity.getRecipientPhone()); + newEntity.setBackupRecipientPhone(entity.getBackupRecipientPhone()); + newEntity.setRecipientName(entity.getRecipientName()); + newEntity.setShippingFee(entity.getShippingFee()); + newEntity.setTotal(entity.getTotal()); + newEntity.setOriginalPrice(entity.getOriginalPrice()); + newEntity.setCaution(entity.getCaution()); + newEntity.setShipperPhone(entity.getShipperPhone()); + newEntity.setStatus(entity.getStatus()); + newEntity.setCityId(entity.getCityId()); + newEntity.setHasInvoiced(entity.getHasInvoiced()); + newEntity.setInvoiceTitle(entity.getInvoiceTitle()); + newEntity.setTaxpayerId(entity.getTaxpayerId()); + newEntity.setCTime(entity.getCTime()); + newEntity.setDeliveryTime(entity.getDeliveryTime()); + newEntity.setIsThirdShipping(entity.getIsThirdShipping()); + newEntity.setPayType(entity.getPayType()); + newEntity.setLatitude(entity.getLatitude()); + newEntity.setLongitude(entity.getLongitude()); + newEntity.setDaySeq(entity.getDaySeq()); + newEntity.setIsFavorites(entity.getIsFavorites()); + newEntity.setIsPoiFirstOrder(entity.getIsPoiFirstOrder()); + newEntity.setDinnersNumber(entity.getDinnersNumber()); + newEntity.setLogisticsCode(entity.getLogisticsCode()); + + List itemList = new ArrayList<>(); + for (ShopMeituanOrderItemEntity meituanOrderItemEntity : entity.getOrderItemList()) { + ShopMeituanOrderItem item = new ShopMeituanOrderItem(); + item.setTenantId(tenantId); + item.setCreateDate(operateDate); + item.setCreateUser("open-api"); + item.setOrderId(entity.getOrderId()); + item.setAppFoodCode(meituanOrderItemEntity.getAppFoodCode()); + item.setFoodName(meituanOrderItemEntity.getFoodName()); + item.setQuantity(meituanOrderItemEntity.getQuantity()); + item.setPrice(meituanOrderItemEntity.getPrice()); + item.setStoreId(storeId); + item.setSkuId(meituanOrderItemEntity.getSkuId()); + item.setBoxNum(meituanOrderItemEntity.getBoxNum()); + item.setBoxPrice(meituanOrderItemEntity.getBoxPrice()); + item.setUnit(meituanOrderItemEntity.getUnit()); + item.setFoodDiscount(meituanOrderItemEntity.getFoodDiscount()); + item.setFoodProperty(meituanOrderItemEntity.getFoodProperty()); + item.setCartId(meituanOrderItemEntity.getCartId()); + itemList.add(item); + } + List extraList = new ArrayList<>(); + for (ShopMeituanOrderExtraEntity meituanOrderExtraEntity : entity.getOrderExtraList()) { + ShopMeituanOrderExtra extra = new ShopMeituanOrderExtra(); + extra.setTenantId(tenantId); + extra.setCreateDate(operateDate); + extra.setCreateUser("open-api"); + extra.setOrderId(entity.getOrderId()); + extra.setReduceFee(meituanOrderExtraEntity.getReduceFee()); + extra.setPoiCharge(meituanOrderExtraEntity.getPoiCharge()); + extra.setMtCharge(meituanOrderExtraEntity.getMtCharge()); + extra.setRemark(meituanOrderExtraEntity.getRemark()); + extra.setType(meituanOrderExtraEntity.getType()); + extra.setActDetailId(meituanOrderExtraEntity.getActDetailId()); + extraList.add(extra); + } + if (pickType != null) { + newEntity.setPickType(Integer.parseInt(pickType)); + } + newEntity.setAvgSendTime(entity.getAvgSendTime()); + newEntity.setOrderSendTime(entity.getOrderSendTime()); + newEntity.setOrderReceiveTime(entity.getOrderReceiveTime()); + newEntity.setOrderConfirmTime(entity.getOrderConfirmTime()); + newEntity.setOrderCancelTime(entity.getOrderCancelTime()); + newEntity.setOrderCompletedTime(entity.getOrderCompletedTime()); + newEntity.setLogisticsStatus(entity.getLogisticsStatus()); + newEntity.setLogisticsId(entity.getLogisticsId()); + newEntity.setLogisticsName(entity.getLogisticsName()); + newEntity.setLogisticsSendTime(entity.getLogisticsSendTime()); + newEntity.setLogisticsConfirmTime(entity.getLogisticsConfirmTime()); + newEntity.setLogisticsCancelTime(entity.getLogisticsCancelTime()); + newEntity.setLogisticsFetchTime(entity.getLogisticsFetchTime()); + newEntity.setLogisticsCompletedTime(entity.getLogisticsCompletedTime()); + newEntity.setLogisticsDispatcherName(entity.getLogisticsDispatcherName()); + newEntity.setLogisticsDispatcherMobile(entity.getLogisticsDispatcherMobile()); + newEntity.setChannel(entity.getChannel()); + newEntity.setFoodShareFeeChargeByPoi(entity.getFoodShareFeeChargeByPoi()); + newEntity.setWmPoiReceiveCent(entity.getWmPoiReceiveCent()); + + status = String.valueOf(newEntity.getStatus()); + // 放入消息队列 + Map waimai_message = new HashMap<>(); + waimai_message.put("type", "shopmeituancreate"); + waimai_message.put("newEntity", newEntity); + waimai_message.put("itemList", itemList); + waimai_message.put("extraList", extraList); + CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); + this.mqMessageSender.send4shopmeituancreate(tenantId, waimai_message, correlationData); + } + result.put("info", "success"); + result.put("status", status); + result.put("refundReasonCode", refundReasonCode); + } catch (Exception e) { + logger.error(info, e); + result.put("status", "error"); + } + return result; + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeituanOrderEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeituanOrderEntity.java new file mode 100644 index 0000000..155f7aa --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeituanOrderEntity.java @@ -0,0 +1,1366 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.jwsaas.utils.DateUtils; + +public class ShopMeituanOrderEntity implements Serializable { + + private static final long serialVersionUID = 1487307405772636828L; + + /** + * 消息 + */ + private String message; + + /** + * 订单ID + */ + private String orderId; + + /** + * 订单展示Id + */ + private String orderIdView; + + /** + * 美团商家名称 + */ + private String wmPoiName; + + /** + * 美团商家地址 + */ + private String wmPoiAddress; + + /** + * 美团商家电话 + */ + private String wmPoiPhone; + + /** + * erp方门店id + */ + private String storeId; + + /** + * 收货人地址 + */ + private String recipientAddress; + + /** + * 收货人电话 + */ + private String recipientPhone; + + /** + * 备用隐私号 + */ + private String backupRecipientPhone; + + /** + * 收货人名称 + */ + private String recipientName; + + /** + * 配送费用 + */ + private Double shippingFee; + + /** + * 总价 + */ + private Double total; + + /** + * 订单原价 + */ + private Double originalPrice; + + /** + * 订单备注 + */ + private String caution; + + /** + * 配送骑手电话 + */ + private String shipperPhone; + + /** + * 订单状态 + */ + private Integer status; + + /** + * 城市Id + */ + private String cityId; + + /** + * 是否需要发票 + */ + private Integer hasInvoiced; + + /** + * 发票抬头 + */ + private String invoiceTitle; + + /** + * 纳税人识别号 + */ + private String taxpayerId; + + /** + * 订单创建时间 + */ + private String cTime; + + /** + * 订单更新时间 + */ + private String uTime; + + /** + * 用户预计送达时间 + */ + private String deliveryTime; + + /** + * 是否第三方配送 + */ + private Integer isThirdShipping; + + /** + * 订单支付类型 + */ + private Integer payType; + + /** + * 订单取餐类型 + */ + private Integer pickType; + + /** + * 实际送餐地址纬度 + */ + private Double latitude; + + /** + * 实际送餐地址经度 + */ + private Double longitude; + + /** + * 门店当天的订单流水号 + */ + private Integer daySeq; + + /** + * 用户是否收藏此门店 + */ + private Integer isFavorites; + + /** + * 用户是否第一次在此门店点餐 + */ + private Integer isPoiFirstOrder; + + /** + * 就餐人数 + */ + private Integer dinnersNumber; + + /** + * 配送类型码 + */ + private String logisticsCode; + + /** + * 餐厅平均送餐时间 + */ + private Integer avgSendTime; + + /** + * 用户下单时间 + */ + private String orderSendTime; + + /** + * 商户收到时间 + */ + private String orderReceiveTime; + + /** + * 商户确认时间 + */ + private String orderConfirmTime; + + /** + * 订单取消时间 + */ + private String orderCancelTime; + + /** + * 订单完成时间 + */ + private String orderCompletedTime; + + /** + * 配送订单状态code + */ + private String logisticsStatus; + + /** + * 配送方ID + */ + private String logisticsId; + + /** + * 配送方名称 + */ + private String logisticsName; + + /** + * 配送单下单时间 + */ + private String logisticsSendTime; + + /** + * 配送单确认时间 + */ + private String logisticsConfirmTime; + + /** + * 配送单取消时间 + */ + private String logisticsCancelTime; + + /** + * 骑手取单时间 + */ + private String logisticsFetchTime; + + /** + * 配送完成时间 + */ + private String logisticsCompletedTime; + + /** + * 骑手姓名 + */ + private String logisticsDispatcherName; + + /** + * 骑手电话 + */ + private String logisticsDispatcherMobile; + + /** + * 订单来源属性标识 + */ + private String channel; + + private String detail;// 订单菜品详情 + + private String extras;// 订单扩展信息 + + /** + * 订单菜品详情 + */ + private List orderItemList; + + /** + * 订单扩展信息 + */ + private List orderExtraList; + + /** + * 商家对账信息 + */ + private String poiReceiveDetail; + + /** + * 订单取消原因 + */ + private String cancelReason; + + /** + * 订单取消code + */ + private String cancelReasonCode; + + /** + * 订单退款原因 + */ + private String refundReason; + + /** + * 菜品分成(分) + */ + private Double foodShareFeeChargeByPoi; + + /** + * 商家应收款(分) + */ + private Double wmPoiReceiveCent; + + /** + * 订单退款code + */ + private String refundReasonCode; + + private Integer counts;// 单数; + + public ShopMeituanOrderEntity() { + + } + + public ShopMeituanOrderEntity(JSONObject jsonObject) { + + if (jsonObject.containsKey("order_id")) { + orderId = jsonObject.getString("order_id"); + } + if (jsonObject.containsKey("wm_order_id_view")) { + orderIdView = jsonObject.getString("wm_order_id_view"); + } + if (jsonObject.containsKey("app_poi_code")) { + storeId = jsonObject.getString("app_poi_code"); + } + if (jsonObject.containsKey("wm_poi_name")) { + wmPoiName = jsonObject.getString("wm_poi_name"); + } + if (jsonObject.containsKey("wm_poi_address")) { + wmPoiAddress = jsonObject.getString("wm_poi_address"); + } + if (jsonObject.containsKey("wm_poi_phone")) { + wmPoiPhone = jsonObject.getString("wm_poi_phone"); + } + if (jsonObject.containsKey("recipient_address")) { + recipientAddress = jsonObject.getString("recipient_address"); + } + if (jsonObject.containsKey("recipient_phone")) { + recipientPhone = jsonObject.getString("recipient_phone"); + } + if (jsonObject.containsKey("backup_recipient_phone")) { + backupRecipientPhone = jsonObject.getString("backup_recipient_phone"); + } + if (jsonObject.containsKey("recipient_name")) { + recipientName = jsonObject.getString("recipient_name"); + } + if (jsonObject.containsKey("shipping_fee")) { + shippingFee = jsonObject.getDouble("shipping_fee"); + } + if (jsonObject.containsKey("total")) { + total = jsonObject.getDouble("total"); + } + if (jsonObject.containsKey("original_price")) { + originalPrice = jsonObject.getDouble("original_price"); + } + if (jsonObject.containsKey("caution")) { + caution = jsonObject.getString("caution"); + } + if (jsonObject.containsKey("shipper_phone")) { + shipperPhone = jsonObject.getString("shipper_phone"); + } + if (jsonObject.containsKey("status")) { + status = jsonObject.getInteger("status"); + } + if (jsonObject.containsKey("city_id")) { + cityId = String.valueOf(jsonObject.getLong("city_id")); + } + if (jsonObject.containsKey("has_invoiced")) { + hasInvoiced = jsonObject.getInteger("has_invoiced"); + } + if (jsonObject.containsKey("invoice_title")) { + invoiceTitle = jsonObject.getString("invoice_title"); + } + if (jsonObject.containsKey("taxpayer_id")) { + taxpayerId = jsonObject.getString("taxpayer_id"); + } + if (jsonObject.containsKey("ctime")) { + cTime = DateUtils.format(new Date(jsonObject.getLong("ctime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("utime")) { + uTime = jsonObject.getLong("utime") == null ? null : DateUtils.format(new Date(jsonObject.getLong("utime") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("delivery_time")) { + deliveryTime = jsonObject.getLong("delivery_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("delivery_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("is_third_shipping")) { + isThirdShipping = jsonObject.getInteger("is_third_shipping"); + } + if (jsonObject.containsKey("pay_type")) { + payType = jsonObject.getInteger("pay_type"); + } + if (jsonObject.containsKey("pick_type")) { + pickType = jsonObject.getInteger("pick_type"); + } + if (jsonObject.containsKey("latitude")) { + latitude = jsonObject.getDouble("latitude"); + } + if (jsonObject.containsKey("longitude")) { + longitude = jsonObject.getDouble("longitude"); + } + if (jsonObject.containsKey("day_seq")) { + daySeq = jsonObject.getInteger("day_seq"); + } + if (jsonObject.containsKey("is_favorites")) { + isFavorites = jsonObject.getBoolean("is_favorites") ? 1 : 0; + } + if (jsonObject.containsKey("is_poi_first_order")) { + isPoiFirstOrder = jsonObject.getBoolean("is_poi_first_order") ? 1 : 0; + } + if (jsonObject.containsKey("dinners_number")) { + dinnersNumber = jsonObject.getInteger("dinners_number"); + } + if (jsonObject.containsKey("logistics_code")) { + logisticsCode = jsonObject.getString("logistics_code"); + } + if (jsonObject.containsKey("poi_receive_detail")) { + poiReceiveDetail = jsonObject.getString("poi_receive_detail"); + JSONObject poiReceiveObject = JSONObject.parseObject(poiReceiveDetail); + if (poiReceiveObject.containsKey("foodShareFeeChargeByPoi")) { + foodShareFeeChargeByPoi = poiReceiveObject.getDouble("foodShareFeeChargeByPoi"); + } + if (poiReceiveObject.containsKey("wmPoiReceiveCent")) { + wmPoiReceiveCent = poiReceiveObject.getDouble("wmPoiReceiveCent"); + } + } + if (jsonObject.containsKey("detail")) { + orderItemList = new ArrayList<>(); + detail = jsonObject.getString("detail"); + JSONArray detailArray = JSONArray.parseArray(detail); + for (int i = 0; i < detailArray.size(); i++) { + JSONObject detailObject = detailArray.getJSONObject(i); + ShopMeituanOrderItemEntity orderItem = new ShopMeituanOrderItemEntity(detailObject); + orderItem.setOrderId(orderId); + orderItemList.add(orderItem); + } + } + if (jsonObject.containsKey("extras")) { + orderExtraList = new ArrayList<>(); + extras = jsonObject.getString("extras"); + JSONArray extrasArray = JSONArray.parseArray(extras); + for (int i = 0; i < extrasArray.size(); i++) { + JSONObject extrasObject = extrasArray.getJSONObject(i); + ShopMeituanOrderExtraEntity orderExtra = new ShopMeituanOrderExtraEntity(extrasObject); + orderExtra.setOrderId(orderId); + orderExtraList.add(orderExtra); + } + } + if (jsonObject.containsKey("avg_send_time")) { + avgSendTime = jsonObject.getInteger("avg_send_time"); + } + if (jsonObject.containsKey("order_send_time")) { + orderSendTime = jsonObject.getLong("order_send_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("order_send_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("order_receive_time")) { + orderReceiveTime = jsonObject.getLong("order_receive_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("order_receive_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("order_confirm_time")) { + orderConfirmTime = jsonObject.getLong("order_confirm_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("order_confirm_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("order_cancel_time")) { + orderCancelTime = jsonObject.getLong("order_cancel_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("order_cancel_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("order_completed_time")) { + orderCompletedTime = jsonObject.getLong("order_completed_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("order_completed_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("logistics_status")) { + logisticsStatus = String.valueOf(jsonObject.getInteger("logistics_status")); + } + if (jsonObject.containsKey("logistics_id")) { + logisticsId = String.valueOf(jsonObject.getInteger("logistics_id")); + } + if (jsonObject.containsKey("logistics_name")) { + logisticsName = jsonObject.getString("logistics_name"); + } + if (jsonObject.containsKey("logistics_send_time")) { + logisticsSendTime = jsonObject.getLong("logistics_send_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("logistics_send_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("logistics_confirm_time")) { + logisticsConfirmTime = jsonObject.getLong("logistics_confirm_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("logistics_confirm_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("logistics_cancel_time")) { + logisticsCancelTime = jsonObject.getLong("logistics_cancel_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("logistics_cancel_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("logistics_fetch_time")) { + logisticsFetchTime = jsonObject.getLong("logistics_fetch_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("logistics_fetch_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("logistics_completed_time")) { + logisticsCompletedTime = jsonObject.getLong("logistics_completed_time") == null ? null : DateUtils.format(new Date(jsonObject.getLong("logistics_completed_time") * 1000), DateUtils.SHOW_DATETIME_FORMAT); + } + if (jsonObject.containsKey("logistics_dispatcher_name")) { + logisticsDispatcherName = jsonObject.getString("logistics_dispatcher_name"); + } + if (jsonObject.containsKey("logistics_dispatcher_mobile")) { + logisticsDispatcherMobile = jsonObject.getString("logistics_dispatcher_mobile"); + } + if (jsonObject.containsKey("channel")) { + channel = jsonObject.getString("channel"); + } + } + + public Integer getCounts() { + return counts; + } + + public void setCounts(Integer counts) { + this.counts = counts; + } + + /** + * 字段名称 :消息 数据类型 :longtext 是否必填 :false + */ + public String getMessage() { + return this.message; + } + + /** + * 字段名称 :消息 数据类型 :longtext 是否必填 :false + */ + public void setMessage(String message) { + this.message = message; + } + + /** + * 字段名称 :订单ID 数据类型 :varchar(32) 是否必填 :false + */ + public String getOrderId() { + return this.orderId; + } + + /** + * 字段名称 :订单ID 数据类型 :varchar(32) 是否必填 :false + */ + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + /** + * 字段名称 :订单展示Id 数据类型 :varchar(32) 是否必填 :false + */ + public String getOrderIdView() { + return this.orderIdView; + } + + /** + * 字段名称 :订单展示Id 数据类型 :varchar(32) 是否必填 :false + */ + public void setOrderIdView(String orderIdView) { + this.orderIdView = orderIdView; + } + + /** + * 字段名称 :美团商家名称 数据类型 :varchar(500) 是否必填 :false + */ + public String getWmPoiName() { + return this.wmPoiName; + } + + /** + * 字段名称 :美团商家名称 数据类型 :varchar(500) 是否必填 :false + */ + public void setWmPoiName(String wmPoiName) { + this.wmPoiName = wmPoiName; + } + + /** + * 字段名称 :美团商家地址 数据类型 :text 是否必填 :false + */ + public String getWmPoiAddress() { + return this.wmPoiAddress; + } + + /** + * 字段名称 :美团商家地址 数据类型 :text 是否必填 :false + */ + public void setWmPoiAddress(String wmPoiAddress) { + this.wmPoiAddress = wmPoiAddress; + } + + /** + * 字段名称 :美团商家电话 数据类型 :varchar(64) 是否必填 :false + */ + public String getWmPoiPhone() { + return this.wmPoiPhone; + } + + /** + * 字段名称 :美团商家电话 数据类型 :varchar(64) 是否必填 :false + */ + public void setWmPoiPhone(String wmPoiPhone) { + this.wmPoiPhone = wmPoiPhone; + } + + /** + * 字段名称 :erp方门店id 数据类型 :varchar(32) 是否必填 :false + */ + public String getStoreId() { + return this.storeId; + } + + /** + * 字段名称 :erp方门店id 数据类型 :varchar(32) 是否必填 :false + */ + public void setStoreId(String storeId) { + this.storeId = storeId; + } + + /** + * 字段名称 :收货人地址 数据类型 :text 是否必填 :false + */ + public String getRecipientAddress() { + return this.recipientAddress; + } + + /** + * 字段名称 :收货人地址 数据类型 :text 是否必填 :false + */ + public void setRecipientAddress(String recipientAddress) { + this.recipientAddress = recipientAddress; + } + + /** + * 字段名称 :收货人电话 数据类型 :varchar(64) 是否必填 :false + */ + public String getRecipientPhone() { + return this.recipientPhone; + } + + /** + * 字段名称 :收货人电话 数据类型 :varchar(64) 是否必填 :false + */ + public void setRecipientPhone(String recipientPhone) { + this.recipientPhone = recipientPhone; + } + + /** + * 字段名称 :备用隐私号 数据类型 :text 是否必填 :false + */ + public String getBackupRecipientPhone() { + return this.backupRecipientPhone; + } + + /** + * 字段名称 :备用隐私号 数据类型 :text 是否必填 :false + */ + public void setBackupRecipientPhone(String backupRecipientPhone) { + this.backupRecipientPhone = backupRecipientPhone; + } + + /** + * 字段名称 :收货人名称 数据类型 :varchar(500) 是否必填 :false + */ + public String getRecipientName() { + return this.recipientName; + } + + /** + * 字段名称 :收货人名称 数据类型 :varchar(500) 是否必填 :false + */ + public void setRecipientName(String recipientName) { + this.recipientName = recipientName; + } + + /** + * 字段名称 :配送费用 数据类型 :decimal(24,4) 是否必填 :false + */ + public Double getShippingFee() { + return this.shippingFee; + } + + /** + * 字段名称 :配送费用 数据类型 :decimal(24,4) 是否必填 :false + */ + public void setShippingFee(Double shippingFee) { + this.shippingFee = shippingFee; + } + + /** + * 字段名称 :总价 数据类型 :decimal(24,4) 是否必填 :false + */ + public Double getTotal() { + return this.total; + } + + /** + * 字段名称 :总价 数据类型 :decimal(24,4) 是否必填 :false + */ + public void setTotal(Double total) { + this.total = total; + } + + /** + * 字段名称 :订单原价 数据类型 :decimal(24,4) 是否必填 :false + */ + public Double getOriginalPrice() { + return this.originalPrice; + } + + /** + * 字段名称 :订单原价 数据类型 :decimal(24,4) 是否必填 :false + */ + public void setOriginalPrice(Double originalPrice) { + this.originalPrice = originalPrice; + } + + /** + * 字段名称 :订单备注 数据类型 :text 是否必填 :false + */ + public String getCaution() { + return this.caution; + } + + /** + * 字段名称 :订单备注 数据类型 :text 是否必填 :false + */ + public void setCaution(String caution) { + this.caution = caution; + } + + /** + * 字段名称 :配送骑手电话 数据类型 :varchar(64) 是否必填 :false + */ + public String getShipperPhone() { + return this.shipperPhone; + } + + /** + * 字段名称 :配送骑手电话 数据类型 :varchar(64) 是否必填 :false + */ + public void setShipperPhone(String shipperPhone) { + this.shipperPhone = shipperPhone; + } + + /** + * 字段名称 :订单状态 数据类型 :int 是否必填 :false + */ + public Integer getStatus() { + return this.status; + } + + /** + * 字段名称 :订单状态 数据类型 :int 是否必填 :false + */ + public void setStatus(Integer status) { + this.status = status; + } + + /** + * 字段名称 :城市Id 数据类型 :varchar(32) 是否必填 :false + */ + public String getCityId() { + return this.cityId; + } + + /** + * 字段名称 :城市Id 数据类型 :varchar(32) 是否必填 :false + */ + public void setCityId(String cityId) { + this.cityId = cityId; + } + + /** + * 字段名称 :是否需要发票 数据类型 :int 是否必填 :false + */ + public Integer getHasInvoiced() { + return this.hasInvoiced; + } + + /** + * 字段名称 :是否需要发票 数据类型 :int 是否必填 :false + */ + public void setHasInvoiced(Integer hasInvoiced) { + this.hasInvoiced = hasInvoiced; + } + + /** + * 字段名称 :发票抬头 数据类型 :varchar(128) 是否必填 :false + */ + public String getInvoiceTitle() { + return this.invoiceTitle; + } + + /** + * 字段名称 :发票抬头 数据类型 :varchar(128) 是否必填 :false + */ + public void setInvoiceTitle(String invoiceTitle) { + this.invoiceTitle = invoiceTitle; + } + + /** + * 字段名称 :纳税人识别号 数据类型 :varchar(64) 是否必填 :false + */ + public String getTaxpayerId() { + return this.taxpayerId; + } + + /** + * 字段名称 :纳税人识别号 数据类型 :varchar(64) 是否必填 :false + */ + public void setTaxpayerId(String taxpayerId) { + this.taxpayerId = taxpayerId; + } + + /** + * 字段名称 :订单创建时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getCTime() { + return this.cTime; + } + + /** + * 字段名称 :订单创建时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setCTime(String cTime) { + this.cTime = cTime; + } + + /** + * 字段名称 :订单更新时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getUTime() { + return this.uTime; + } + + /** + * 字段名称 :订单更新时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setUTime(String uTime) { + this.uTime = uTime; + } + + /** + * 字段名称 :用户预计送达时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getDeliveryTime() { + return this.deliveryTime; + } + + /** + * 字段名称 :用户预计送达时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setDeliveryTime(String deliveryTime) { + this.deliveryTime = deliveryTime; + } + + /** + * 字段名称 :是否第三方配送 数据类型 :int 是否必填 :false + */ + public Integer getIsThirdShipping() { + return this.isThirdShipping; + } + + /** + * 字段名称 :是否第三方配送 数据类型 :int 是否必填 :false + */ + public void setIsThirdShipping(Integer isThirdShipping) { + this.isThirdShipping = isThirdShipping; + } + + /** + * 字段名称 :订单支付类型 数据类型 :int 是否必填 :false + */ + public Integer getPayType() { + return this.payType; + } + + /** + * 字段名称 :订单支付类型 数据类型 :int 是否必填 :false + */ + public void setPayType(Integer payType) { + this.payType = payType; + } + + /** + * 字段名称 :订单取餐类型 数据类型 :int 是否必填 :false + */ + public Integer getPickType() { + return this.pickType; + } + + /** + * 字段名称 :订单取餐类型 数据类型 :int 是否必填 :false + */ + public void setPickType(Integer pickType) { + this.pickType = pickType; + } + + /** + * 字段名称 :实际送餐地址纬度 数据类型 :decimal(24,8) 是否必填 :false + */ + public Double getLatitude() { + return this.latitude; + } + + /** + * 字段名称 :实际送餐地址纬度 数据类型 :decimal(24,8) 是否必填 :false + */ + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + /** + * 字段名称 :实际送餐地址经度 数据类型 :decimal(24,8) 是否必填 :false + */ + public Double getLongitude() { + return this.longitude; + } + + /** + * 字段名称 :实际送餐地址经度 数据类型 :decimal(24,8) 是否必填 :false + */ + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + /** + * 字段名称 :门店当天的订单流水号 数据类型 :int 是否必填 :false + */ + public Integer getDaySeq() { + return this.daySeq; + } + + /** + * 字段名称 :门店当天的订单流水号 数据类型 :int 是否必填 :false + */ + public void setDaySeq(Integer daySeq) { + this.daySeq = daySeq; + } + + /** + * 字段名称 :用户是否收藏此门店 数据类型 :int 是否必填 :false + */ + public Integer getIsFavorites() { + return this.isFavorites; + } + + /** + * 字段名称 :用户是否收藏此门店 数据类型 :int 是否必填 :false + */ + public void setIsFavorites(Integer isFavorites) { + this.isFavorites = isFavorites; + } + + /** + * 字段名称 :用户是否第一次在此门店点餐 数据类型 :int 是否必填 :false + */ + public Integer getIsPoiFirstOrder() { + return this.isPoiFirstOrder; + } + + /** + * 字段名称 :用户是否第一次在此门店点餐 数据类型 :int 是否必填 :false + */ + public void setIsPoiFirstOrder(Integer isPoiFirstOrder) { + this.isPoiFirstOrder = isPoiFirstOrder; + } + + /** + * 字段名称 :就餐人数 数据类型 :int 是否必填 :false + */ + public Integer getDinnersNumber() { + return this.dinnersNumber; + } + + /** + * 字段名称 :就餐人数 数据类型 :int 是否必填 :false + */ + public void setDinnersNumber(Integer dinnersNumber) { + this.dinnersNumber = dinnersNumber; + } + + /** + * 字段名称 :配送类型码 数据类型 :varchar(16) 是否必填 :false + */ + public String getLogisticsCode() { + return this.logisticsCode; + } + + /** + * 字段名称 :配送类型码 数据类型 :varchar(16) 是否必填 :false + */ + public void setLogisticsCode(String logisticsCode) { + this.logisticsCode = logisticsCode; + } + + /** + * 字段名称 :餐厅平均送餐时间 数据类型 :int 是否必填 :false + */ + public Integer getAvgSendTime() { + return this.avgSendTime; + } + + /** + * 字段名称 :餐厅平均送餐时间 数据类型 :int 是否必填 :false + */ + public void setAvgSendTime(Integer avgSendTime) { + this.avgSendTime = avgSendTime; + } + + /** + * 字段名称 :用户下单时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getOrderSendTime() { + return this.orderSendTime; + } + + /** + * 字段名称 :用户下单时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setOrderSendTime(String orderSendTime) { + this.orderSendTime = orderSendTime; + } + + /** + * 字段名称 :商户收到时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getOrderReceiveTime() { + return this.orderReceiveTime; + } + + /** + * 字段名称 :商户收到时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setOrderReceiveTime(String orderReceiveTime) { + this.orderReceiveTime = orderReceiveTime; + } + + /** + * 字段名称 :商户确认时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getOrderConfirmTime() { + return this.orderConfirmTime; + } + + /** + * 字段名称 :商户确认时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setOrderConfirmTime(String orderConfirmTime) { + this.orderConfirmTime = orderConfirmTime; + } + + /** + * 字段名称 :订单取消时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getOrderCancelTime() { + return this.orderCancelTime; + } + + /** + * 字段名称 :订单取消时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setOrderCancelTime(String orderCancelTime) { + this.orderCancelTime = orderCancelTime; + } + + /** + * 字段名称 :订单完成时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getOrderCompletedTime() { + return this.orderCompletedTime; + } + + /** + * 字段名称 :订单完成时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setOrderCompletedTime(String orderCompletedTime) { + this.orderCompletedTime = orderCompletedTime; + } + + /** + * 字段名称 :配送订单状态code 数据类型 :varchar(16) 是否必填 :false + */ + public String getLogisticsStatus() { + return this.logisticsStatus; + } + + /** + * 字段名称 :配送订单状态code 数据类型 :varchar(16) 是否必填 :false + */ + public void setLogisticsStatus(String logisticsStatus) { + this.logisticsStatus = logisticsStatus; + } + + /** + * 字段名称 :配送方ID 数据类型 :varchar(32) 是否必填 :false + */ + public String getLogisticsId() { + return this.logisticsId; + } + + /** + * 字段名称 :配送方ID 数据类型 :varchar(32) 是否必填 :false + */ + public void setLogisticsId(String logisticsId) { + this.logisticsId = logisticsId; + } + + /** + * 字段名称 :配送方名称 数据类型 :varchar(64) 是否必填 :false + */ + public String getLogisticsName() { + return this.logisticsName; + } + + /** + * 字段名称 :配送方名称 数据类型 :varchar(64) 是否必填 :false + */ + public void setLogisticsName(String logisticsName) { + this.logisticsName = logisticsName; + } + + /** + * 字段名称 :配送单下单时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getLogisticsSendTime() { + return this.logisticsSendTime; + } + + /** + * 字段名称 :配送单下单时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setLogisticsSendTime(String logisticsSendTime) { + this.logisticsSendTime = logisticsSendTime; + } + + /** + * 字段名称 :配送单确认时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getLogisticsConfirmTime() { + return this.logisticsConfirmTime; + } + + /** + * 字段名称 :配送单确认时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setLogisticsConfirmTime(String logisticsConfirmTime) { + this.logisticsConfirmTime = logisticsConfirmTime; + } + + /** + * 字段名称 :配送单取消时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getLogisticsCancelTime() { + return this.logisticsCancelTime; + } + + /** + * 字段名称 :配送单取消时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setLogisticsCancelTime(String logisticsCancelTime) { + this.logisticsCancelTime = logisticsCancelTime; + } + + /** + * 字段名称 :骑手取单时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getLogisticsFetchTime() { + return this.logisticsFetchTime; + } + + /** + * 字段名称 :骑手取单时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setLogisticsFetchTime(String logisticsFetchTime) { + this.logisticsFetchTime = logisticsFetchTime; + } + + /** + * 字段名称 :配送完成时间 数据类型 :varchar(32) 是否必填 :false + */ + public String getLogisticsCompletedTime() { + return this.logisticsCompletedTime; + } + + /** + * 字段名称 :配送完成时间 数据类型 :varchar(32) 是否必填 :false + */ + public void setLogisticsCompletedTime(String logisticsCompletedTime) { + this.logisticsCompletedTime = logisticsCompletedTime; + } + + /** + * 字段名称 :骑手姓名 数据类型 :varchar(64) 是否必填 :false + */ + public String getLogisticsDispatcherName() { + return this.logisticsDispatcherName; + } + + /** + * 字段名称 :骑手姓名 数据类型 :varchar(64) 是否必填 :false + */ + public void setLogisticsDispatcherName(String logisticsDispatcherName) { + this.logisticsDispatcherName = logisticsDispatcherName; + } + + /** + * 字段名称 :骑手电话 数据类型 :varchar(16) 是否必填 :false + */ + public String getLogisticsDispatcherMobile() { + return this.logisticsDispatcherMobile; + } + + /** + * 字段名称 :骑手电话 数据类型 :varchar(16) 是否必填 :false + */ + public void setLogisticsDispatcherMobile(String logisticsDispatcherMobile) { + this.logisticsDispatcherMobile = logisticsDispatcherMobile; + } + + /** + * 字段名称 :订单来源属性标识 数据类型 :varchar(64) 是否必填 :false + */ + public String getChannel() { + return this.channel; + } + + /** + * 字段名称 :订单来源属性标识 数据类型 :varchar(64) 是否必填 :false + */ + public void setChannel(String channel) { + this.channel = channel; + } + + + + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public String getExtras() { + return extras; + } + + public void setExtras(String extras) { + this.extras = extras; + } + + public List getOrderItemList() { + return orderItemList; + } + + public void setOrderItemList(List orderItemList) { + this.orderItemList = orderItemList; + } + + public List getOrderExtraList() { + return orderExtraList; + } + + public void setOrderExtraList(List orderExtraList) { + this.orderExtraList = orderExtraList; + } + + /** + * 字段名称 :商家对账信息 数据类型 :text 是否必填 :false + */ + public String getPoiReceiveDetail() { + return this.poiReceiveDetail; + } + + /** + * 字段名称 :商家对账信息 数据类型 :text 是否必填 :false + */ + public void setPoiReceiveDetail(String poiReceiveDetail) { + this.poiReceiveDetail = poiReceiveDetail; + } + + /** + * 字段名称 :订单取消原因 数据类型 :text 是否必填 :false + */ + public String getCancelReason() { + return this.cancelReason; + } + + /** + * 字段名称 :订单取消原因 数据类型 :text 是否必填 :false + */ + public void setCancelReason(String cancelReason) { + this.cancelReason = cancelReason; + } + + /** + * 字段名称 :订单取消code 数据类型 :varchar(32) 是否必填 :false + */ + public String getCancelReasonCode() { + return this.cancelReasonCode; + } + + /** + * 字段名称 :订单取消code 数据类型 :varchar(32) 是否必填 :false + */ + public void setCancelReasonCode(String cancelReasonCode) { + this.cancelReasonCode = cancelReasonCode; + } + + /** + * 字段名称 :订单退款原因 数据类型 :text 是否必填 :false + */ + public String getRefundReason() { + return this.refundReason; + } + + /** + * 字段名称 :订单退款原因 数据类型 :text 是否必填 :false + */ + public void setRefundReason(String refundReason) { + this.refundReason = refundReason; + } + + /** + * 字段名称 :菜品分成(分) 数据类型 :decimal(24,2) 是否必填 :false + */ + public Double getFoodShareFeeChargeByPoi() { + return this.foodShareFeeChargeByPoi; + } + + /** + * 字段名称 :菜品分成(分) 数据类型 :decimal(24,2) 是否必填 :false + */ + public void setFoodShareFeeChargeByPoi(Double foodShareFeeChargeByPoi) { + this.foodShareFeeChargeByPoi = foodShareFeeChargeByPoi; + } + + /** + * 字段名称 :商家应收款(分) 数据类型 :decimal(24,2) 是否必填 :false + */ + public Double getWmPoiReceiveCent() { + return this.wmPoiReceiveCent; + } + + /** + * 字段名称 :商家应收款(分) 数据类型 :decimal(24,2) 是否必填 :false + */ + public void setWmPoiReceiveCent(Double wmPoiReceiveCent) { + this.wmPoiReceiveCent = wmPoiReceiveCent; + } + + /** + * 字段名称 :订单退款code 数据类型 :varchar(32) 是否必填 :false + */ + public String getRefundReasonCode() { + return this.refundReasonCode; + } + + /** + * 字段名称 :订单退款code 数据类型 :varchar(32) 是否必填 :false + */ + public void setRefundReasonCode(String refundReasonCode) { + this.refundReasonCode = refundReasonCode; + } + +} \ No newline at end of file diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeituanOrderExtraEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeituanOrderExtraEntity.java new file mode 100644 index 0000000..c88cfa0 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeituanOrderExtraEntity.java @@ -0,0 +1,199 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; + +import com.alibaba.fastjson.JSONObject; + +public class ShopMeituanOrderExtraEntity implements Serializable { + + private static final long serialVersionUID = 1037261515303605701L; + + /** + *订单ID + */ + private String orderId; + + /** + *活动优惠总金额 + */ + private Double reduceFee; + + /** + *优惠金额中商家承担的部分 + */ + private Double poiCharge; + + /** + *优惠金额中美团承担的部分 + */ + private Double mtCharge; + + /** + *优惠说明 + */ + private String remark; + + /** + *活动类型 + */ + private Integer type; + + /** + *活动ID + */ + private String actDetailId; + + public ShopMeituanOrderExtraEntity() { + + } + + public ShopMeituanOrderExtraEntity(JSONObject jsonObject) { + + if (jsonObject.containsKey("act_detail_id")) { + actDetailId = String.valueOf(jsonObject.getInteger("act_detail_id")); + } + if (jsonObject.containsKey("reduce_fee")) { + reduceFee = jsonObject.getDouble("reduce_fee"); + } + if (jsonObject.containsKey("mt_charge")) { + mtCharge = jsonObject.getDouble("mt_charge"); + } + if (jsonObject.containsKey("poi_charge")) { + poiCharge = jsonObject.getDouble("poi_charge"); + } + if (jsonObject.containsKey("remark")) { + remark = jsonObject.getString("remark"); + } + if (jsonObject.containsKey("type")) { + type = jsonObject.getInteger("type"); + } + } + + + /** + * 字段名称 :订单ID + * 数据类型 :varchar(32) + * 是否必填 :false + */ + public String getOrderId() { + return this.orderId; + } + + /** + * 字段名称 :订单ID + * 数据类型 :varchar(32) + * 是否必填 :false + */ + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + /** + * 字段名称 :活动优惠总金额 + * 数据类型 :decimal(24,4) + * 是否必填 :false + */ + public Double getReduceFee() { + return this.reduceFee; + } + + /** + * 字段名称 :活动优惠总金额 + * 数据类型 :decimal(24,4) + * 是否必填 :false + */ + public void setReduceFee(Double reduceFee) { + this.reduceFee = reduceFee; + } + + /** + * 字段名称 :优惠金额中商家承担的部分 + * 数据类型 :decimal(24,4) + * 是否必填 :false + */ + public Double getPoiCharge() { + return this.poiCharge; + } + + /** + * 字段名称 :优惠金额中商家承担的部分 + * 数据类型 :decimal(24,4) + * 是否必填 :false + */ + public void setPoiCharge(Double poiCharge) { + this.poiCharge = poiCharge; + } + + /** + * 字段名称 :优惠金额中美团承担的部分 + * 数据类型 :decimal(24,4) + * 是否必填 :false + */ + public Double getMtCharge() { + return this.mtCharge; + } + + /** + * 字段名称 :优惠金额中美团承担的部分 + * 数据类型 :decimal(24,4) + * 是否必填 :false + */ + public void setMtCharge(Double mtCharge) { + this.mtCharge = mtCharge; + } + + /** + * 字段名称 :优惠说明 + * 数据类型 :text + * 是否必填 :false + */ + public String getRemark() { + return this.remark; + } + + /** + * 字段名称 :优惠说明 + * 数据类型 :text + * 是否必填 :false + */ + public void setRemark(String remark) { + this.remark = remark; + } + + /** + * 字段名称 :活动类型 + * 数据类型 :int + * 是否必填 :false + */ + public Integer getType() { + return this.type; + } + + /** + * 字段名称 :活动类型 + * 数据类型 :int + * 是否必填 :false + */ + public void setType(Integer type) { + this.type = type; + } + + /** + * 字段名称 :活动ID + * 数据类型 :varchar(32) + * 是否必填 :false + */ + public String getActDetailId() { + return this.actDetailId; + } + + /** + * 字段名称 :活动ID + * 数据类型 :varchar(32) + * 是否必填 :false + */ + public void setActDetailId(String actDetailId) { + this.actDetailId = actDetailId; + } + +} \ No newline at end of file diff --git a/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeituanOrderItemEntity.java b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeituanOrderItemEntity.java new file mode 100644 index 0000000..9e6d401 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/controller/waimai/ShopMeituanOrderItemEntity.java @@ -0,0 +1,299 @@ +package com.jwsaas.controller.waimai; + +import java.io.Serializable; + +import com.alibaba.fastjson.JSONObject; + +public class ShopMeituanOrderItemEntity implements Serializable { + + private static final long serialVersionUID = 1446333132378327741L; + + /** + * 订单ID + */ + private String orderId; + + /** + * APP方菜品ID + */ + private String appFoodCode; + + /** + * 菜品名 + */ + private String foodName; + + /** + * 菜品份数 + */ + private String quantity; + + /** + * 价格 + */ + private Double price; + + /** + * erp方门店ID + */ + private String storeId; + + /** + * erp方菜品sku + */ + private String skuId; + + /** + * 餐盒数量 + */ + private Integer boxNum; + + /** + * 餐盒单价 + */ + private Double boxPrice; + + /** + * 单位 + */ + private String unit; + + /** + * 菜品折扣 + */ + private Double foodDiscount; + + /** + * 菜品属性 + */ + private String foodProperty; + + /** + * 商品所在的口袋 + */ + private Integer cartId; + + public ShopMeituanOrderItemEntity() { + + } + + public ShopMeituanOrderItemEntity(JSONObject jsonObject) { + + if (jsonObject.containsKey("app_food_code")) { + appFoodCode = jsonObject.getString("app_food_code"); + } + if (jsonObject.containsKey("food_name")) { + foodName = jsonObject.getString("food_name"); + } + if (jsonObject.containsKey("sku_id")) { + skuId = jsonObject.getString("sku_id"); + } + if (jsonObject.containsKey("quantity")) { + quantity = String.valueOf(jsonObject.getDouble("quantity")); + } + if (jsonObject.containsKey("price")) { + price = jsonObject.getDouble("price"); + } + if (jsonObject.containsKey("box_num")) { + boxNum = jsonObject.getDouble("box_num").intValue(); + } + if (jsonObject.containsKey("box_price")) { + boxPrice = jsonObject.getDouble("box_price"); + } + if (jsonObject.containsKey("unit")) { + unit = jsonObject.getString("unit"); + } + if (jsonObject.containsKey("food_discount")) { + foodDiscount = jsonObject.getDouble("food_discount"); + } + if (jsonObject.containsKey("food_property")) { + foodProperty = jsonObject.getString("food_property"); + } + if (jsonObject.containsKey("cart_id")) { + cartId = jsonObject.getInteger("cart_id"); + } + } + + /** + * 字段名称 :订单ID 数据类型 :varchar(32) 是否必填 :false + */ + public String getOrderId() { + return this.orderId; + } + + /** + * 字段名称 :订单ID 数据类型 :varchar(32) 是否必填 :false + */ + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + /** + * 字段名称 :APP方菜品ID 数据类型 :varchar(32) 是否必填 :false + */ + public String getAppFoodCode() { + return this.appFoodCode; + } + + /** + * 字段名称 :APP方菜品ID 数据类型 :varchar(32) 是否必填 :false + */ + public void setAppFoodCode(String appFoodCode) { + this.appFoodCode = appFoodCode; + } + + /** + * 字段名称 :菜品名 数据类型 :varchar(64) 是否必填 :false + */ + public String getFoodName() { + return this.foodName; + } + + /** + * 字段名称 :菜品名 数据类型 :varchar(64) 是否必填 :false + */ + public void setFoodName(String foodName) { + this.foodName = foodName; + } + + /** + * 字段名称 :菜品份数 数据类型 :varchar(32) 是否必填 :false + */ + public String getQuantity() { + return this.quantity; + } + + /** + * 字段名称 :菜品份数 数据类型 :varchar(32) 是否必填 :false + */ + public void setQuantity(String quantity) { + this.quantity = quantity; + } + + /** + * 字段名称 :价格 数据类型 :decimal(24,4) 是否必填 :false + */ + public Double getPrice() { + return this.price; + } + + /** + * 字段名称 :价格 数据类型 :decimal(24,4) 是否必填 :false + */ + public void setPrice(Double price) { + this.price = price; + } + + /** + * 字段名称 :erp方门店ID 数据类型 :varchar(32) 是否必填 :false + */ + public String getStoreId() { + return this.storeId; + } + + /** + * 字段名称 :erp方门店ID 数据类型 :varchar(32) 是否必填 :false + */ + public void setStoreId(String storeId) { + this.storeId = storeId; + } + + /** + * 字段名称 :erp方菜品sku 数据类型 :varchar(32) 是否必填 :false + */ + public String getSkuId() { + return this.skuId; + } + + /** + * 字段名称 :erp方菜品sku 数据类型 :varchar(32) 是否必填 :false + */ + public void setSkuId(String skuId) { + this.skuId = skuId; + } + + /** + * 字段名称 :餐盒数量 数据类型 :int 是否必填 :false + */ + public Integer getBoxNum() { + return this.boxNum; + } + + /** + * 字段名称 :餐盒数量 数据类型 :int 是否必填 :false + */ + public void setBoxNum(Integer boxNum) { + this.boxNum = boxNum; + } + + /** + * 字段名称 :餐盒单价 数据类型 :decimal(24,4) 是否必填 :false + */ + public Double getBoxPrice() { + return this.boxPrice; + } + + /** + * 字段名称 :餐盒单价 数据类型 :decimal(24,4) 是否必填 :false + */ + public void setBoxPrice(Double boxPrice) { + this.boxPrice = boxPrice; + } + + /** + * 字段名称 :单位 数据类型 :varchar(32) 是否必填 :false + */ + public String getUnit() { + return this.unit; + } + + /** + * 字段名称 :单位 数据类型 :varchar(32) 是否必填 :false + */ + public void setUnit(String unit) { + this.unit = unit; + } + + /** + * 字段名称 :菜品折扣 数据类型 :decimal(24,4) 是否必填 :false + */ + public Double getFoodDiscount() { + return this.foodDiscount; + } + + /** + * 字段名称 :菜品折扣 数据类型 :decimal(24,4) 是否必填 :false + */ + public void setFoodDiscount(Double foodDiscount) { + this.foodDiscount = foodDiscount; + } + + /** + * 字段名称 :菜品属性 数据类型 :varchar(128) 是否必填 :false + */ + public String getFoodProperty() { + return this.foodProperty; + } + + /** + * 字段名称 :菜品属性 数据类型 :varchar(128) 是否必填 :false + */ + public void setFoodProperty(String foodProperty) { + this.foodProperty = foodProperty; + } + + /** + * 字段名称 :商品所在的口袋 数据类型 :int 是否必填 :false + */ + public Integer getCartId() { + return this.cartId; + } + + /** + * 字段名称 :商品所在的口袋 数据类型 :int 是否必填 :false + */ + public void setCartId(Integer cartId) { + this.cartId = cartId; + } + +} \ No newline at end of file diff --git a/food-waimai-web/src/main/java/com/jwsaas/freemarker/DefaultTemplateExceptionHandler.java b/food-waimai-web/src/main/java/com/jwsaas/freemarker/DefaultTemplateExceptionHandler.java new file mode 100644 index 0000000..58a8c7c --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/freemarker/DefaultTemplateExceptionHandler.java @@ -0,0 +1,27 @@ +package com.jwsaas.freemarker; + +import java.io.IOException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import freemarker.core.Environment; +import freemarker.template.TemplateException; +import freemarker.template.TemplateExceptionHandler; + +public class DefaultTemplateExceptionHandler implements TemplateExceptionHandler { + + private static final Logger logger = LoggerFactory.getLogger(DefaultTemplateExceptionHandler.class); + + public void handleTemplateException(TemplateException te, Environment env, java.io.Writer out) + throws TemplateException { + try { + logger.info("handleTemplateException"); + + out.write("[ERROR: " + te.getMessage() + "]"); + } catch (IOException e) { + throw new TemplateException("Failed to print error message. Cause: " + e, env); + } + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/utils/Assert.java b/food-waimai-web/src/main/java/com/jwsaas/utils/Assert.java new file mode 100644 index 0000000..8063a85 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/utils/Assert.java @@ -0,0 +1,125 @@ +package com.jwsaas.utils; + +/** + * org.springframework.util.Assert + */ +public abstract class Assert { + + /** + * Assert a boolean expression, throwing an {@code IllegalStateException} if + * the expression evaluates to {@code false}. + *

+ * Call {@link #isTrue} if you wish to throw an + * {@code IllegalArgumentException} on an assertion failure. + * + *

+	 * Assert.state(id == null, "The id property must not already be initialized");
+	 * 
+ * + * @param expression + * a boolean expression + * @param message + * the exception message to use if the assertion fails + * @throws IllegalStateException + * if {@code expression} is {@code false} + */ + public static void state(boolean expression, String message) { + if (!expression) { + throw new IllegalStateException(message); + } + } + + /** + * @deprecated as of 4.3.7, in favor of {@link #state(boolean, String)} + */ + @Deprecated + public static void state(boolean expression) { + state(expression, "[Assertion failed] - this state invariant must be true"); + } + + /** + * Assert a boolean expression, throwing an {@code IllegalArgumentException} + * if the expression evaluates to {@code false}. + * + *
+	 * Assert.isTrue(i > 0, "The value must be greater than zero");
+	 * 
+ * + * @param expression + * a boolean expression + * @param message + * the exception message to use if the assertion fails + * @throws IllegalArgumentException + * if {@code expression} is {@code false} + */ + public static void isTrue(boolean expression, String message) { + if (!expression) { + throw new IllegalArgumentException(message); + } + } + + /** + * @deprecated as of 4.3.7, in favor of {@link #isTrue(boolean, String)} + */ + @Deprecated + public static void isTrue(boolean expression) { + isTrue(expression, "[Assertion failed] - this expression must be true"); + } + + /** + * Assert that an object is {@code null}. + * + *
+	 * Assert.isNull(value, "The value must be null");
+	 * 
+ * + * @param object + * the object to check + * @param message + * the exception message to use if the assertion fails + * @throws IllegalArgumentException + * if the object is not {@code null} + */ + public static void isNull(Object object, String message) { + if (object != null) { + throw new IllegalArgumentException(message); + } + } + + /** + * @deprecated as of 4.3.7, in favor of {@link #isNull(Object, String)} + */ + @Deprecated + public static void isNull(Object object) { + isNull(object, "[Assertion failed] - the object argument must be null"); + } + + /** + * Assert that an object is not {@code null}. + * + *
+	 * Assert.notNull(clazz, "The class must not be null");
+	 * 
+ * + * @param object + * the object to check + * @param message + * the exception message to use if the assertion fails + * @throws IllegalArgumentException + * if the object is {@code null} + */ + public static void notNull(Object object, String message) { + if (object == null) { + throw new IllegalArgumentException(message); + } + } + + /** + * @deprecated as of 4.3.7, in favor of {@link #notNull(Object, String)} + */ + @Deprecated + public static void notNull(Object object) { + notNull(object, "[Assertion failed] - this argument is required; it must not be null"); + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/utils/DateUtils.java b/food-waimai-web/src/main/java/com/jwsaas/utils/DateUtils.java new file mode 100644 index 0000000..7306838 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/utils/DateUtils.java @@ -0,0 +1,492 @@ +package com.jwsaas.utils; + +import org.apache.commons.lang3.StringUtils; + +import java.text.DateFormat; +import java.text.MessageFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +/** + * 时间日期的工具类 + * + * @author : 张莹 + */ +public class DateUtils { + + public static final String DATETIME_FORMAT = "yyyyMMddHHmmss"; + public static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat(DATETIME_FORMAT); + public static final String DATE_FORMAT = "yyyyMMdd"; + public static final String TIME_FORMAT = "HH:mm:ss"; + public static final String SHOW_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; + public static final String SHOW_DATE_FORMAT = "yyyy-MM-dd"; + + /** + * 得到以yyyy-MM-dd格式表示的当前日期字符串 + */ + public static String getCurrentDate() { + return new SimpleDateFormat(SHOW_DATE_FORMAT).format(new Date()); + } + + /** + * 得到以HH:mm:ss表示的当前时间字符串 + */ + public static String getCurrentTime() { + return new SimpleDateFormat(TIME_FORMAT).format(new Date()); + } + + /** + * 获取当前时间串,格式为:yyyyMMddHHmmss + * + * @return + */ + public static final String getCurrDatetime() { + return format(new Date(), DATETIME_FORMAT); + } + + /** + * 获取当前日期串,格式为yyyyMMdd + * + * @return + */ + public static final String getCurrDate() { + return format(new Date(), DATE_FORMAT); + } + + /** + * 得到以yyyy-MM-dd HH:mm:ss表示的当前时间字符串 + */ + public static String getCurrentDateTime() { + return format(new Date(), SHOW_DATETIME_FORMAT); + } + + public static String getCurrentDateTime(String format) { + return format(new Date(), format); + } + + /** + * @param date + * 时间 + * @param format + * 格式化串 + * @return + */ + public static String format(Date date, String format) { + SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.format(date); + } + + /** + * 对{@code date}字符串,采用0右补齐到{@code length}的长度 + * + * @param date + * @param length + * @return + */ + public static String pad0(String date, int length) { + return padChar(date, length, '0'); + } + + /** + * 对{@code date}字符串,采用9右补齐到{@code length}的长度 + * + * @param date + * @param length + * @return + */ + public static String pad9(String date, int length) { + return padChar(date, length, '9'); + } + + private static String padChar(String date, int length, char theChar) { + if (StringUtils.isEmpty(date)) { + date = ""; + } + return StringUtils.rightPad(date, length, theChar); + } + + /** + * {@code time1}是否小于{@code time2},即类似于 + * + *
+	 * time1 < time2
+	 * 
+ * + * 。 如果{@code time2}为null, 则视为最小。 + * + * @param time1 + * 时间字符串,格式为 yyyyMMddHHmmss,不足14位后补0 + * @param time2 + * 时间字符串,格式为 yyyyMMddHHmmss,不足14位后补0 + * @return + */ + public static boolean lessThan(String time1, String time2) { + if (StringUtils.isEmpty(time1)) { + if (StringUtils.isEmpty(time2)) { + return false; + } else { + return true; + } + } else { + return time1.compareTo(time2) < 0; + } + } + + /** + * {@code time1}是否大于{@code time2},即类似于 + * + *
+	 * time1 > time2
+	 * 
+ * + * 。如果{@code time2}为null, 则视为最大。 + * + * @param time1 + * 时间字符串,格式为 yyyyMMddHHmmss,不足14位后补9 + * @param time2 + * 时间字符串,格式为 yyyyMMddHHmmss,不足14位后补9 + * @return + */ + public static boolean greaterThan(String time1, String time2) { + if (StringUtils.isEmpty(time1)) { + if (StringUtils.isEmpty(time2)) { + return false; + } else { + return true; + } + } else { + return time1.compareTo(time2) > 0; + } + } + + /** + * 将datetime字符串时间转换为毫秒数 + * + * @param datetime + * 长度必须大于等于8而小于等于14,格式为 yyyyMMddHHmmss,不足14位后补0 + * @return + */ + public static long toMilliseconds(String datetime) { + return parseDate(datetime).getTime(); + } + + /** + * 将格式为{@link #DATETIME_FORMAT}的时间格式解析为Date对象,{@code datetime}的长度必须大于8小于14. + * + * @param datetime + * @return + */ + public static Date parseDate(String datetime) { + Assert.notNull(datetime, "datetime不能为空"); + Assert.isTrue(datetime.length() >= 4 && datetime.length() <= 14, "长度必须大于等于8而小于等于14"); + DateFormat dateFormat = SIMPLE_DATE_FORMAT; + try { + if (datetime.length() < 14) { + dateFormat = new SimpleDateFormat(DATETIME_FORMAT.substring(0, datetime.length())); + } + return dateFormat.parse(datetime); + } catch (ParseException e) { + throw new IllegalArgumentException("入参datetime:" + datetime + "解析异常,请检查格式必须为:" + DATETIME_FORMAT); + } + } + + /** + * 将字符串时间解析为对象 + * + * @param datetime + * @param format + * @return + */ + public static Date parseDate(String datetime, String format) { + Assert.notNull(datetime, "datetime不能为空"); + Assert.notNull(format, "datetime不能为空"); + Assert.isTrue(datetime.length() == format.length(), "值和格式串的长度不一致"); + DateFormat dateFormat = new SimpleDateFormat(format); + try { + return dateFormat.parse(datetime); + } catch (ParseException e) { + throw new IllegalArgumentException( + MessageFormat.format("入参datetime:{1}解析异常,请检查格式必须为:{2}", datetime, format)); + } + } + + public static int getDayOfWeek() { + Calendar cal = Calendar.getInstance(); + return cal.get(Calendar.DAY_OF_WEEK); + } + + public static int getDayOfWeek(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + return cal.get(Calendar.DAY_OF_WEEK); + } + + public static int getDayOfMonth() { + Calendar cal = Calendar.getInstance(); + return cal.get(Calendar.DAY_OF_MONTH); + } + + public static int getDayOfMonth(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + return cal.get(Calendar.DAY_OF_MONTH); + } + + // 获取某一个月的天数 + public static int getMaxDayOfMonth(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + return cal.getActualMaximum(Calendar.DATE); + } + + // 获取某月的第一天 + public static String getFirstDayOfMonth(String date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(parseDate(date, SHOW_DATE_FORMAT)); + cal.set(Calendar.DAY_OF_MONTH, 1); + return new SimpleDateFormat(SHOW_DATE_FORMAT).format(cal.getTime()); + } + + public static int getDayOfYear() { + Calendar cal = Calendar.getInstance(); + return cal.get(Calendar.DAY_OF_YEAR); + } + + public static int getDayOfYear(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + return cal.get(Calendar.DAY_OF_YEAR); + } + + public static int getDayOfWeek(String date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(parseDate(date, SHOW_DATE_FORMAT)); + return cal.get(Calendar.DAY_OF_WEEK); + } + + public static int getDayOfMonth(String date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(parseDate(date, SHOW_DATE_FORMAT)); + return cal.get(Calendar.DAY_OF_MONTH); + } + + public static int getDayOfYear(String date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(parseDate(date, SHOW_DATE_FORMAT)); + return cal.get(Calendar.DAY_OF_YEAR); + } + + public static int compare(String date1, String date2) { + return compare(date1, date2, SHOW_DATE_FORMAT); + } + + public static int compareTime(String time1, String time2) { + return compareTime(time1, time2, TIME_FORMAT); + } + + public static int compare(String date1, String date2, String format) { + Date d1 = parseDate(date1, format); + Date d2 = parseDate(date2, format); + return d1.compareTo(d2); + } + + public static int compareTime(String time1, String time2, String format) { + String[] arr1 = time1.split(":"); + String[] arr2 = time2.split(":"); + if (arr1.length < 2) { + throw new RuntimeException("错误的时间值:" + time1); + } + if (arr2.length < 2) { + throw new RuntimeException("错误的时间值:" + time2); + } + int h1 = Integer.parseInt(arr1[0]); + int m1 = Integer.parseInt(arr1[1]); + int h2 = Integer.parseInt(arr2[0]); + int m2 = Integer.parseInt(arr2[1]); + int s1 = 0, s2 = 0; + if (arr1.length == 3) { + s1 = Integer.parseInt(arr1[2]); + } + if (arr2.length == 3) { + s2 = Integer.parseInt(arr2[2]); + } + if (h1 < 0 || h1 > 23 || m1 < 0 || m1 > 59 || s1 < 0 || s1 > 59) { + throw new RuntimeException("错误的时间值:" + time1); + } + if (h2 < 0 || h2 > 23 || m2 < 0 || m2 > 59 || s2 < 0 || s2 > 59) { + throw new RuntimeException("错误的时间值:" + time2); + } + if (h1 != h2) { + return h1 > h2 ? 1 : -1; + } else { + if (m1 == m2) { + if (s1 == s2) { + return 0; + } else { + return s1 > s2 ? 1 : -1; + } + } else { + return m1 > m2 ? 1 : -1; + } + } + } + + public static boolean isTime(String time) { + String[] arr = time.split(":"); + if (arr.length < 2) { + return false; + } + try { + int h = Integer.parseInt(arr[0]); + int m = Integer.parseInt(arr[1]); + int s = 0; + if (arr.length == 3) { + s = Integer.parseInt(arr[2]); + } + if (h < 0 || h > 23 || m < 0 || m > 59 || s < 0 || s > 59) { + return false; + } + } catch (Exception e) { + return false; + } + return true; + } + + public static boolean isDate(String date) { + String[] arr = date.split("-"); + if (arr.length < 3) { + return false; + } + try { + int y = Integer.parseInt(arr[0]); + int m = Integer.parseInt(arr[1]); + int d = Integer.parseInt(arr[2]); + if (y < 0 || m > 12 || m < 0 || d < 0 || d > 31) { + return false; + } + } catch (Exception e) { + return false; + } + return true; + } + + public static boolean isWeekend(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + int t = cal.get(Calendar.DAY_OF_WEEK); + if (t == Calendar.SATURDAY || t == Calendar.SUNDAY) { + return true; + } + return false; + } + + public static boolean isWeekend(String str) { + return isWeekend(parseDate(str)); + } + + /** + * 日期date上加count分钟,count为负表示减 + */ + public static Date addMinute(Date date, int count) { + return new Date(date.getTime() + 60000L * count); + } + + /** + * 日期date上加count小时,count为负表示减 + */ + public static Date addHour(Date date, int count) { + return new Date(date.getTime() + 3600000L * count); + } + + /** + * 日期date上加count天,count为负表示减 + */ + public static Date addDay(Date date, int count) { + return new Date(date.getTime() + 86400000L * count); + } + + /** + * 日期date上加count星期,count为负表示减 + */ + public static Date addWeek(Date date, int count) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + c.add(Calendar.WEEK_OF_YEAR, count); + return c.getTime(); + } + + /** + * 日期date上加count月,count为负表示减 + */ + public static Date addMonth(Date date, int count) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + c.add(Calendar.MONTH, count); + return c.getTime(); + } + + /** + * 日期date上加count年,count为负表示减 + */ + public static Date addYear(Date date, int count) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + c.add(Calendar.YEAR, count); + return c.getTime(); + } + + public static String toDisplayDateTime(String date) { + if (StringUtils.isEmpty(date)) + return null; + try { + if (isDate(date)) { + return toDisplayDateTime(parseDate(date, SHOW_DATE_FORMAT)); + } + SimpleDateFormat t = new SimpleDateFormat(SHOW_DATETIME_FORMAT); + Date d = t.parse(date); + return toDisplayDateTime(d); + } catch (ParseException e) { + e.printStackTrace(); + } + return "不是标准格式时间!"; + } + + public static String toDisplayDateTime(Date date) { + long minite = (System.currentTimeMillis() - date.getTime()) / 60000L; + if (minite < 60L) { + return toString(date, "MM-dd") + " " + minite + "分钟前"; + } + if (minite < 1440L) { + return toString(date, "MM-dd") + " " + (minite / 60L) + "小时前"; + } + return toString(date, "MM-dd") + " " + (minite / 1440L) + "天前"; + } + + /** + * 按指定的format输出日期字符串 + */ + public static String toString(Date date, String format) { + SimpleDateFormat t = new SimpleDateFormat(format); + return t.format(date); + } + + // 获得本周第一天 + public static String getFirstDayOfNowWeek() { + Calendar cal = Calendar.getInstance(); + SimpleDateFormat df = new SimpleDateFormat(SHOW_DATE_FORMAT); + cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); // 获取本周一的日期 + return df.format(cal.getTime()); + } + + // 获取本月第一天 + public static String getFirstDayOfNowMonth() { + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.MONTH, 0); + cal.set(Calendar.DAY_OF_MONTH, 1);// 设置为1号,当前日期既为本月第一天 + SimpleDateFormat df = new SimpleDateFormat(SHOW_DATE_FORMAT); + return df.format(cal.getTime()); + } + +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/utils/EmojiFilter.java b/food-waimai-web/src/main/java/com/jwsaas/utils/EmojiFilter.java new file mode 100644 index 0000000..0173441 --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/utils/EmojiFilter.java @@ -0,0 +1,302 @@ +package com.jwsaas.utils; + +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.alibaba.fastjson.JSONObject; +import com.jwsaas.controller.waimai.MeituanOrderEntity; +import com.jwsaas.controller.waimai.MeituanOrderItemEntity; +import com.vdurmont.emoji.EmojiParser; + +public class EmojiFilter { + + public final static String unicodeReg = "[" + "\u4E00-\u9FBF" + // :CJK + // 统一表意符号 + // (CJK + // Unified + // Ideographs) + "\u4DC0-\u4DFF" + // :易经六十四卦符号 (Yijing Hexagrams Symbols) + "\u0000-\u007F" + // :C0控制符及基本拉丁文 (C0 Control and Basic Latin) + "\u0080-\u00FF" + // :C1控制符及拉丁:补充-1 (C1 Control and Latin 1 + // Supplement) + "\u0100-\u017F" + // :拉丁文扩展-A (Latin Extended-A) + "\u0180-\u024F" + // :拉丁文扩展-B (Latin Extended-B) + "\u0250-\u02AF" + // :国际音标扩展 (IPA Extensions) + "\u02B0-\u02FF" + // :空白修饰字母 (Spacing Modifiers) + "\u0300-\u036F" + // :结合用读音符号 (Combining Diacritics Marks) + "\u0370-\u03FF" + // :希腊文及科普特文 (Greek and Coptic) + "\u0400-\u04FF" + // :西里尔字母 (Cyrillic) + "\u0500-\u052F" + // :西里尔字母补充 (Cyrillic Supplement) + "\u0530-\u058F" + // :亚美尼亚语 (Armenian) + "\u0590-\u05FF" + // :希伯来文 (Hebrew) + "\u0600-\u06FF" + // :阿拉伯文 (Arabic) + "\u0700-\u074F" + // :叙利亚文 (Syriac) + "\u0750-\u077F" + // :阿拉伯文补充 (Arabic Supplement) + "\u0780-\u07BF" + // :马尔代夫语 (Thaana) + // "\u07C0-\u077F"+//:西非书面语言 (N'Ko) + "\u0800-\u085F" + // :阿维斯塔语及巴列维语 (Avestan and Pahlavi) + "\u0860-\u087F" + // :Mandaic + "\u0880-\u08AF" + // :撒马利亚语 (Samaritan) + "\u0900-\u097F" + // :天城文书 (Devanagari) + "\u0980-\u09FF" + // :孟加拉语 (Bengali) + "\u0A00-\u0A7F" + // :锡克教文 (Gurmukhi) + "\u0A80-\u0AFF" + // :古吉拉特文 (Gujarati) + "\u0B00-\u0B7F" + // :奥里亚文 (Oriya) + "\u0B80-\u0BFF" + // :泰米尔文 (Tamil) + "\u0C00-\u0C7F" + // :泰卢固文 (Telugu) + "\u0C80-\u0CFF" + // :卡纳达文 (Kannada) + "\u0D00-\u0D7F" + // :德拉维族语 (Malayalam) + "\u0D80-\u0DFF" + // :僧伽罗语 (Sinhala) + "\u0E00-\u0E7F" + // :泰文 (Thai) + "\u0E80-\u0EFF" + // :老挝文 (Lao) + "\u0F00-\u0FFF" + // :藏文 (Tibetan) + "\u1000-\u109F" + // :缅甸语 (Myanmar) + "\u10A0-\u10FF" + // :格鲁吉亚语 (Georgian) + "\u1100-\u11FF" + // :朝鲜文 (Hangul Jamo) + "\u1200-\u137F" + // :埃塞俄比亚语 (Ethiopic) + "\u1380-\u139F" + // :埃塞俄比亚语补充 (Ethiopic Supplement) + "\u13A0-\u13FF" + // :切罗基语 (Cherokee) + "\u1400-\u167F" + // :统一加拿大土著语音节 (Unified Canadian Aboriginal + // Syllabics) + "\u1680-\u169F" + // :欧甘字母 (Ogham) + "\u16A0-\u16FF" + // :如尼文 (Runic) + "\u1700-\u171F" + // :塔加拉语 (Tagalog) + "\u1720-\u173F" + // :Hanunóo + "\u1740-\u175F" + // :Buhid + "\u1760-\u177F" + // :Tagbanwa + "\u1780-\u17FF" + // :高棉语 (Khmer) + "\u1800-\u18AF" + // :蒙古文 (Mongolian) + "\u18B0-\u18FF" + // :Cham + "\u1900-\u194F" + // :Limbu + "\u1950-\u197F" + // :德宏泰语 (Tai Le) + "\u1980-\u19DF" + // :新傣仂语 (New Tai Lue) + "\u19E0-\u19FF" + // :高棉语记号 (Kmer Symbols) + "\u1A00-\u1A1F" + // :Buginese + "\u1A20-\u1A5F" + // :Batak + "\u1A80-\u1AEF" + // :Lanna + "\u1B00-\u1B7F" + // :巴厘语 (Balinese) + "\u1B80-\u1BB0" + // :巽他语 (Sundanese) + "\u1BC0-\u1BFF" + // :Pahawh Hmong + "\u1C00-\u1C4F" + // :雷布查语(Lepcha) + "\u1C50-\u1C7F" + // :Ol Chiki + "\u1C80-\u1CDF" + // :曼尼普尔语 (Meithei/Manipuri) + "\u1D00-\u1D7F" + // :语音学扩展 (Phone tic Extensions) + "\u1D80-\u1DBF" + // :语音学扩展补充 (Phonetic Extensions Supplement) + "\u1DC0-\u1DFF" + // 结合用读音符号补充 (Combining Diacritics Marks + // Supplement) + "\u1E00-\u1EFF" + // :拉丁文扩充附加 (Latin Extended Additional) + "\u1F00-\u1FFF" + // :希腊语扩充 (Greek Extended) + "\u2000-\u206F" + // :常用标点 (General Punctuation) + "\u2070-\u209F" + // :上标及下标 (Superscripts and Subscripts) + "\u20A0-\u20CF" + // :货币符号 (Currency Symbols) + "\u20D0-\u20FF" + // :组合用记号 (Combining Diacritics Marks for Symbols) + "\u2100-\u214F" + // :字母式符号 (Letterlike Symbols) + "\u2150-\u218F" + // :数字形式 (Number Form) + "\u2190-\u21FF" + // :箭头 (Arrows) + "\u2200-\u22FF" + // :数学运算符 (Mathematical Operator) + "\u2300-\u23FF" + // :杂项工业符号 (Miscellaneous Technical) + "\u2400-\u243F" + // :控制图片 (Control Pictures) + "\u2440-\u245F" + // :光学识别符 (Optical Character Recognition) + "\u2460-\u24FF" + // :封闭式字母数字 (Enclosed Alphanumerics) + "\u2500-\u257F" + // :制表符 (Box Drawing) + "\u2580-\u259F" + // :方块元素 (Block Element) + "\u25A0-\u25FF" + // :几何图形 (Geometric Shapes) + "\u2600-\u26FF" + // :杂项符号 (Miscellaneous Symbols) + "\u2700-\u27BF" + // :印刷符号 (Dingbats) + "\u27C0-\u27EF" + // :杂项数学符号-A (Miscellaneous Mathematical + // Symbols-A) + "\u27F0-\u27FF" + // :追加箭头-A (Supplemental Arrows-A) + "\u2800-\u28FF" + // :盲文点字模型 (Braille Patterns) + "\u2900-\u297F" + // :追加箭头-B (Supplemental Arrows-B) + "\u2980-\u29FF" + // :杂项数学符号-B (Miscellaneous Mathematical + // Symbols-B) + "\u2A00-\u2AFF" + // :追加数学运算符 (Supplemental Mathematical Operator) + "\u2B00-\u2BFF" + // :杂项符号和箭头 (Miscellaneous Symbols and Arrows) + "\u2C00-\u2C5F" + // :格拉哥里字母 (Glagolitic) + "\u2C60-\u2C7F" + // :拉丁文扩展-C (Latin Extended-C) + "\u2C80-\u2CFF" + // :古埃及语 (Coptic) + "\u2D00-\u2D2F" + // :格鲁吉亚语补充 (Georgian Supplement) + "\u2D30-\u2D7F" + // :提非纳文 (Tifinagh) + "\u2D80-\u2DDF" + // :埃塞俄比亚语扩展 (Ethiopic Extended) + "\u2E00-\u2E7F" + // :追加标点 (Supplemental Punctuation) + "\u2E80-\u2EFF" + // :CJK 部首补充 (CJK Radicals Supplement) + "\u2F00-\u2FDF" + // :康熙字典部首 (Kangxi Radicals) + "\u2FF0-\u2FFF" + // :表意文字描述符 (Ideographic Description Characters) + "\u3000-\u303F" + // :CJK 符号和标点 (CJK Symbols and Punctuation) + "\u3040-\u309F" + // :日文平假名 (Hiragana) + "\u30A0-\u30FF" + // :日文片假名 (Katakana) + "\u3100-\u312F" + // :注音字母 (Bopomofo) + "\u3130-\u318F" + // :朝鲜文兼容字母 (Hangul Compatibility Jamo) + "\u3190-\u319F" + // :象形字注释标志 (Kanbun) + "\u31A0-\u31BF" + // :注音字母扩展 (Bopomofo Extended) + "\u31C0-\u31EF" + // :CJK 笔画 (CJK Strokes) + "\u31F0-\u31FF" + // :日文片假名语音扩展 (Katakana Phonetic Extensions) + "\u3200-\u32FF" + // :封闭式 CJK 文字和月份 (Enclosed CJK Letters and + // Months) + "\u3300-\u33FF" + // :CJK 兼容 (CJK Compatibility) + "\u3400-\u4DBF" + // :CJK 统一表意符号扩展 A (CJK Unified Ideographs + // Extension A) + "\u4DC0-\u4DFF" + // :易经六十四卦符号 (Yijing Hexagrams Symbols) + "\u4E00-\u9FBF" + // :CJK 统一表意符号 (CJK Unified Ideographs) + "\uA000-\uA48F" + // :彝文音节 (Yi Syllables) + "\uA490-\uA4CF" + // :彝文字根 (Yi Radicals) + "\uA500-\uA61F" + // :Vai + "\uA660-\uA6FF" + // :统一加拿大土著语音节补充 (Unified Canadian Aboriginal + // Syllabics Supplement) + "\uA700-\uA71F" + // :声调修饰字母 (Modifier Tone Letters) + "\uA720-\uA7FF" + // :拉丁文扩展-D (Latin Extended-D) + "\uA800-\uA82F" + // :Syloti Nagri + "\uA840-\uA87F" + // :八思巴字 (Phags-pa) + "\uA880-\uA8DF" + // :Saurashtra + "\uA900-\uA97F" + // :爪哇语 (Javanese) + "\uA980-\uA9DF" + // :Chakma + "\uAA00-\uAA3F" + // :Varang Kshiti + "\uAA40-\uAA6F" + // :Sorang Sompeng + "\uAA80-\uAADF" + // :Newari + "\uAB00-\uAB5F" + // :越南傣语 (Vi?t Thái) + "\uAB80-\uABA0" + // :Kayah Li + "\uAC00-\uD7AF" + // :朝鲜文音节 (Hangul Syllables) + // "\uD800-\uDBFF"+//:High-half zone of UTF-16 + // "\uDC00-\uDFFF"+//:Low-half zone of UTF-16 + "\uE000-\uF8FF" + // :自行使用区域 (Private Use Zone) + "\uF900-\uFAFF" + // :CJK 兼容象形文字 (CJK Compatibility Ideographs) + "\uFB00-\uFB4F" + // :字母表达形式 (Alphabetic Presentation Form) + "\uFB50-\uFDFF" + // :阿拉伯表达形式A (Arabic Presentation Form-A) + "\uFE00-\uFE0F" + // :变量选择符 (Variation Selector) + "\uFE10-\uFE1F" + // :竖排形式 (Vertical Forms) + "\uFE20-\uFE2F" + // :组合用半符号 (Combining Half Marks) + "\uFE30-\uFE4F" + // :CJK 兼容形式 (CJK Compatibility Forms) + "\uFE50-\uFE6F" + // :小型变体形式 (Small Form Variants) + "\uFE70-\uFEFF" + // :阿拉伯表达形式B (Arabic Presentation Form-B) + "\uFF00-\uFFEF" + // :半型及全型形式 (Halfwidth and Fullwidth Form) + "\uFFF0-\uFFFF]";// :特殊 (Specials); + + /** + * 将字符串转成unicode + * + * @param str + * 待转字符串 + * @return unicode字符串 + */ + public static String convert(String str) { + str = (str == null ? "" : str); + String tmp; + StringBuffer sb = new StringBuffer(1000); + char c; + int i, j; + sb.setLength(0); + for (i = 0; i < str.length(); i++) { + c = str.charAt(i); + sb.append("\\u"); + j = (c >>> 8); // 取出高8位 + tmp = Integer.toHexString(j); + if (tmp.length() == 1) { + sb.append("0"); + } + sb.append(tmp); + j = (c & 0xFF); // 取出低8位 + tmp = Integer.toHexString(j); + if (tmp.length() == 1) { + sb.append("0"); + } + sb.append(tmp); + + } + return (new String(sb).toUpperCase()); + } + + /** + * 2)unicode转成字符串,与上述过程反向操作即可 将unicode 字符串 + * + * @param str + * 待转字符串 + * @return 普通字符串 + */ + public static String revert(String str) { + str = (str == null ? "" : str); + if (str.indexOf("\\u") == -1)// 如果不是unicode码则原样返回 + return str; + + StringBuffer sb = new StringBuffer(1000); + + for (int i = 0; i < str.length() - 6;) { + String strTemp = str.substring(i, i + 6); + String value = strTemp.substring(2); + int c = 0; + for (int j = 0; j < value.length(); j++) { + char tempChar = value.charAt(j); + int t = 0; + switch (tempChar) { + case 'a': + t = 10; + break; + case 'b': + t = 11; + break; + case 'c': + t = 12; + break; + case 'd': + t = 13; + break; + case 'e': + t = 14; + break; + case 'f': + t = 15; + break; + default: + t = tempChar - 48; + break; + } + + c += t * ((int) Math.pow(16, (value.length() - j - 1))); + } + sb.append((char) c); + i = i + 6; + } + return sb.toString(); + } + + /** + * + * @author: Simon + * @Description:传入需要过滤的字符 + * @date: 2017年9月22日 上午11:11:33 + * @param string + * @return + */ + public static String filterEmoji(String string) { + try { + Pattern pattern = Pattern.compile(unicodeReg); + StringBuffer sbBuffer = new StringBuffer(); + for (int i = 0; i < string.length(); i++) { + char c = string.charAt(i); + String temp = String.valueOf(c); + Matcher matcher = pattern.matcher(temp); + if (matcher.find()) { + sbBuffer.append(temp); + } else { + sbBuffer.append(""); + } + } + return sbBuffer.toString(); + } catch (Exception e) { + e.printStackTrace(); + } + return ""; + } + + public static void main(String[] args) { +// String message = "{\"cTime\":1532760316,\"caution\":\"水果种类多点,我会给五星好评 收餐人隐私号 15656547948_5348,手机号 131****7557\",\"deliveryTime\":0,\"detail\":[{\"app_food_code\":\"原味鸡蛋仔\",\"box_num\":1,\"box_price\":0,\"cart_id\":0,\"food_discount\":1,\"food_name\":\"原味鸡蛋仔\",\"food_property\":\"\",\"price\":10,\"quantity\":1,\"sku_id\":\"\",\"spec\":\"\",\"unit\":\"份\"},{\"app_food_code\":\"椰果\",\"box_num\":1,\"box_price\":0,\"cart_id\":0,\"food_discount\":1,\"food_name\":\"椰果\",\"food_property\":\"\",\"price\":2,\"quantity\":1,\"sku_id\":\"\",\"spec\":\"\",\"unit\":\"份\"},{\"app_food_code\":\"大果粒水果茶\uD83C\uDF49\",\"box_num\":1,\"box_price\":0,\"cart_id\":0,\"food_discount\":1,\"food_name\":\"大果粒水果茶\uD83C\uDF49\",\"food_property\":\"少冰,半糖\",\"price\":18,\"quantity\":1,\"sku_id\":\"\",\"spec\":\"\",\"unit\":\"份\"}],\"cityId\":340100,\"ePoiId\":\"571022_756373515946561536\",\"extras\":[{\"act_detail_id\":1333158319,\"mt_charge\":0,\"poi_charge\":6,\"reduce_fee\":6,\"remark\":\"满28.0元减6.0元\",\"type\":2},{\"act_detail_id\":1980953437,\"mt_charge\":0,\"poi_charge\":1,\"reduce_fee\":1,\"remark\":\"减配送费1.0元\",\"type\":25},{}],\"hasInvoiced\":0,\"invoiceTitle\":\"\",\"isPre\":0,\"isThirdShipping\":0,\"latitude\":31.855104,\"longitude\":117.174992,\"poiReceiveDetail\":{\"actOrderChargeByMt\":[{\"comment\":\"活动款\",\"feeTypeDesc\":\"活动款\",\"feeTypeId\":10019,\"moneyCent\":0}],\"actOrderChargeByPoi\":[{\"comment\":\"满28.0元减6.0元\",\"feeTypeDesc\":\"活动款\",\"feeTypeId\":10019,\"moneyCent\":600},{\"comment\":\"减配送费1.0元\",\"feeTypeDesc\":\"活动款\",\"feeTypeId\":10019,\"moneyCent\":100}],\"foodShareFeeChargeByPoi\":414,\"logisticsFee\":350,\"onlinePayment\":2650,\"wmPoiReceiveCent\":1886},\"logisticsCode\":\"1001\",\"logisticsCompletedTime\":1532761925,\"logisticsConfirmTime\":1532760363,\"logisticsDispatcherMobile\":15215694098,\"logisticsDispatcherName\":\"潘步群\",\"logisticsFetchTime\":1532760997,\"logisticsId\":5,\"logisticsName\":\"加盟\",\"logisticsSendTime\":1532760337,\"logisticsStatus\":40,\"orderCompletedTime\":1532761925,\"orderConfirmTime\":1532760997,\"orderCancelTime\":\"\",\"orderId\":42360153909115061,\"orderIdView\":42360153909115061,\"orderSendTime\":1532760335,\"originalPrice\":33.5,\"payType\":2,\"pickType\":0,\"poiAddress\":\"长江西路与振兴路交口东北角加侨悦山城(振兴路地铁站A1出口城市便捷酒店旁)\",\"poiId\":4236015,\"poiName\":\"HEY JUICE茶桔便(加侨悦山店)\",\"poiPhone\":\"15156879980\",\"recipientAddress\":\"西城山水居 (西城山水居北门11栋1单元2401)@#安徽省合肥市蜀山区井岗路井岗路西城山水居\",\"recipientName\":\"张虹(女士)\",\"recipientPhone\":\"15656547948_5348\",\"shipperPhone\":\"15215694098\",\"shippingFee\":3.5,\"status\":8,\"total\":26.5,\"uTime\":1532761925,\"daySeq\":17,\"dinnersNumber\":0}"; + String message = "大果粒水果茶\uD83C\uDF49"; + message = EmojiParser.removeAllEmojis(message); +// MeituanOrderEntity entity = new MeituanOrderEntity(JSONObject.parseObject(message)); +// List list = entity.getOrderItemList(); +// for (MeituanOrderItemEntity groupEntity : list) { +// System.out.println(groupEntity.getDishName()); +// } + System.out.println(message); + } +} diff --git a/food-waimai-web/src/main/java/com/jwsaas/utils/JSONException.java b/food-waimai-web/src/main/java/com/jwsaas/utils/JSONException.java new file mode 100644 index 0000000..3148f3e --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/utils/JSONException.java @@ -0,0 +1,18 @@ +package com.jwsaas.utils; + +@SuppressWarnings("serial") +public class JSONException extends RuntimeException { + + public JSONException(){ + super(); + } + + public JSONException(String message){ + super(message); + } + + public JSONException(String message, Throwable cause){ + super(message, cause); + } + +} \ No newline at end of file diff --git a/food-waimai-web/src/main/java/com/jwsaas/utils/JSONUtil.java b/food-waimai-web/src/main/java/com/jwsaas/utils/JSONUtil.java new file mode 100644 index 0000000..0f7b73a --- /dev/null +++ b/food-waimai-web/src/main/java/com/jwsaas/utils/JSONUtil.java @@ -0,0 +1,167 @@ +package com.jwsaas.utils; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.core.JsonEncoding; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationConfig; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.node.ObjectNode; + +public class JSONUtil { + + protected static Logger logger = LoggerFactory.getLogger(JSONUtil.class); + + private static ObjectMapper objectMapper = new ObjectMapper(); + private static final String charsetName = "UTF-8"; + + static { + objectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + SerializationConfig serializationConfig = objectMapper.getSerializationConfig(); + serializationConfig = serializationConfig.without(SerializationFeature.WRAP_ROOT_VALUE) + .with(SerializationFeature.INDENT_OUTPUT); + SerializerProvider serializerProvider = objectMapper.getSerializerProvider(); + serializerProvider.setNullValueSerializer(new JsonSerializer() { + + @Override + public void serialize(Object value, JsonGenerator jgen, SerializerProvider serializers) + throws IOException, JsonProcessingException { + jgen.writeString(""); + } + + }); + } + +// public static ObjectMapper getObjectMapper() { +// return CollectionUtils.deepCopy(objectMapper); +// } + + public static String toJSONString(Object object) { + ByteArrayOutputStream bos = new ByteArrayOutputStream(1024); + try { + JsonGenerator jsonGenerator = objectMapper.getFactory().createGenerator(bos, JsonEncoding.UTF8); + objectMapper.writeValue(jsonGenerator, object); + return bos.toString(charsetName); + } catch (Exception e) { + throw new JSONException(e.getMessage(), e); + } finally { + try { + bos.close(); + } catch (Exception ex) { + logger.error("toJSONString(bos.close) Exception ", ex); + } + } + } + + public static JsonNode parseJsonNode(String text) { + try { + return objectMapper.readTree(text); + } catch (Exception e) { + throw new JSONException(e.getMessage(), e); + } + } + + public static T parseObject(String text, Class clazz) { + try { + return objectMapper.readValue(text, clazz); + } catch (Exception e) { + throw new JSONException(e.getMessage(), e); + } + } + + public static T parseObject(String text, Class clazz, String charsetName) { + try { + return objectMapper.readValue(text.getBytes(charsetName), clazz); + } catch (Exception e) { + throw new JSONException(e.getMessage(), e); + } + } + + public static T parseObject(String text, TypeReference valueTypeRef) { + try { + return objectMapper.readValue(objectMapper.getFactory().createParser(text), valueTypeRef); + } catch (Exception e) { + throw new JSONException(e.getMessage(), e); + } + } + + public static ObjectNode createObjectNode() { + try { + return objectMapper.createObjectNode(); + } catch (Exception e) { + throw new JSONException(e.getMessage(), e); + } + } + + /** + * 从json中读取tagPath处的值 tagPath用 :分隔 + * + * @param json + * @param tagPath + * @return + * @throws Exception + */ + public static List readValueFromJson(String json, String tagPath) throws Exception { + // 返回值 + List value = new ArrayList(); + if (StringUtils.isBlank(json) || StringUtils.isBlank(tagPath)) { + return value; + } + String[] path = tagPath.split(":"); + JsonNode node = objectMapper.readTree(json); + getJsonValue(node, path, value, 1); + return value; + } + + public static void getJsonValue(JsonNode node, String[] path, List values, int nextIndex) { + if (node == null) { + return; + } + // 是路径的最后就直接取值 + if (nextIndex == path.length) { + if (node.isArray()) { + for (int i = 0; i < node.size(); i++) { + JsonNode child = node.get(i).get(path[nextIndex - 1]); + if (child == null) { + continue; + } + values.add(child.toString()); + } + } else { + JsonNode child = node.get(path[nextIndex - 1]); + if (child != null) { + values.add(child.toString()); + } + } + return; + } + // 判断是Node下是集合还是一个节点 + node = node.get(path[nextIndex - 1]); + if (node.isArray()) { + for (int i = 0; i < node.size(); i++) { + getJsonValue(node.get(i), path, values, nextIndex + 1); + } + } else { + getJsonValue(node, path, values, nextIndex + 1); + } + } + +} diff --git a/food-waimai-web/src/main/lib/libwrapper-macosx-universal-32.jnilib b/food-waimai-web/src/main/lib/libwrapper-macosx-universal-32.jnilib new file mode 100644 index 0000000..ae75d31 Binary files /dev/null and b/food-waimai-web/src/main/lib/libwrapper-macosx-universal-32.jnilib differ diff --git a/food-waimai-web/src/main/lib/libwrapper-macosx-universal-64.jnilib b/food-waimai-web/src/main/lib/libwrapper-macosx-universal-64.jnilib new file mode 100644 index 0000000..e7d4102 Binary files /dev/null and b/food-waimai-web/src/main/lib/libwrapper-macosx-universal-64.jnilib differ diff --git a/food-waimai-web/src/main/lib/wrapper-windows-x86-32.dll b/food-waimai-web/src/main/lib/wrapper-windows-x86-32.dll new file mode 100644 index 0000000..6aaa9c1 Binary files /dev/null and b/food-waimai-web/src/main/lib/wrapper-windows-x86-32.dll differ diff --git a/food-waimai-web/src/main/lib/wrapper-windows-x86-64.dll b/food-waimai-web/src/main/lib/wrapper-windows-x86-64.dll new file mode 100644 index 0000000..81f11ce Binary files /dev/null and b/food-waimai-web/src/main/lib/wrapper-windows-x86-64.dll differ diff --git a/food-waimai-web/src/main/lib/wrapper.jar b/food-waimai-web/src/main/lib/wrapper.jar new file mode 100644 index 0000000..70dc5ab Binary files /dev/null and b/food-waimai-web/src/main/lib/wrapper.jar differ diff --git a/food-waimai-web/src/main/resources/META-INF/spring/spring-dubbo-food-waimai.xml b/food-waimai-web/src/main/resources/META-INF/spring/spring-dubbo-food-waimai.xml new file mode 100644 index 0000000..02fd19e --- /dev/null +++ b/food-waimai-web/src/main/resources/META-INF/spring/spring-dubbo-food-waimai.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/food-waimai-web/src/main/resources/META-INF/spring/spring-dubbo.xml b/food-waimai-web/src/main/resources/META-INF/spring/spring-dubbo.xml new file mode 100644 index 0000000..94f953e --- /dev/null +++ b/food-waimai-web/src/main/resources/META-INF/spring/spring-dubbo.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/food-waimai-web/src/main/resources/application.properties b/food-waimai-web/src/main/resources/application.properties new file mode 100644 index 0000000..63ec4fb --- /dev/null +++ b/food-waimai-web/src/main/resources/application.properties @@ -0,0 +1,48 @@ +#Global +global.encoding=UTF-8 +global.locale=zh_CN + +#application.sign,application.index\u90FD\u4E0D\u80FD\u91CD\u590D +application.name=foodWaiMai +application.owner= +application.sign=1 +application.description=${application.name} +application.index=0 + +#\u6CE8\u518C\u4E2D\u5FC3 +zk.connect=127.0.0.1:2181 +# curator or zkclient +zk.client=curator + +#dubbo\u670D\u52A1 +reference.version=2.0.0 +reference.group=default +reference.timeout=600000 +reference.retries=1 + +#dubbo cache address +dubbo.cache.address=/home/project/food/dubbo/food-waimai-web.cache + +# EMBEDDED SERVER CONFIGURATION (ServerProperties) +server.port=8200 +server.servlet.context-path=/foodWaiMai +server.compression.enabled=true +server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml +server.compression.min-response-size=2048 + +# FREEMARKER (FreeMarkerProperties) +spring.freemarker.cache=false +spring.freemarker.charset=${global.encoding} +spring.freemarker.settings.template_exception_handler=com.jwsaas.freemarker.DefaultTemplateExceptionHandler +spring.freemarker.settings.auto_import=spring.ftl as spring + +# INTERNATIONALIZATION (MessageSourceProperties) +spring.messages.basename=i18n/messages + +#RabbitMQ +spring.rabbitmq.host=192.168.0.110 +spring.rabbitmq.port=5672 +spring.rabbitmq.virtual-host=/dev_test +spring.rabbitmq.publisher-confirms=true +spring.rabbitmq.username=dev +spring.rabbitmq.password=dev \ No newline at end of file diff --git a/food-waimai-web/src/main/resources/i18n/messages.properties b/food-waimai-web/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000..2d3636f --- /dev/null +++ b/food-waimai-web/src/main/resources/i18n/messages.properties @@ -0,0 +1,5 @@ +project.name=\u9910\u996eV2\u5916\u5356\u63a5\u5355 +project.boduo.name=\u9910\u996eV2\u5916\u5356\u63a5\u5355 +project.description=\u9910\u996eV2\u5916\u5356\u63a5\u5355 +project.version=2.0 +project.softwareName=\u9910\u996eV2\u5916\u5356\u63a5\u5355 diff --git a/food-waimai-web/src/main/resources/logback.xml b/food-waimai-web/src/main/resources/logback.xml new file mode 100644 index 0000000..027d001 --- /dev/null +++ b/food-waimai-web/src/main/resources/logback.xml @@ -0,0 +1,32 @@ + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%-5level] %logger{120} - %msg %n + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/food-waimai-web/src/main/resources/templates/error/404.ftl b/food-waimai-web/src/main/resources/templates/error/404.ftl new file mode 100644 index 0000000..0254b6e --- /dev/null +++ b/food-waimai-web/src/main/resources/templates/error/404.ftl @@ -0,0 +1,20 @@ + + + + + + +<@spring.message "project.name"/> + + +"> + + + + + +404 +点我返回首页 + + diff --git a/food-waimai-web/src/main/resources/templates/error/4xx.ftl b/food-waimai-web/src/main/resources/templates/error/4xx.ftl new file mode 100644 index 0000000..cfc7fd8 --- /dev/null +++ b/food-waimai-web/src/main/resources/templates/error/4xx.ftl @@ -0,0 +1,20 @@ + + + + + + +<@spring.message "project.name"/> + + +"> + + + + + +Something went wrong (4XX): ${status} ${error}
+点我返回首页 + + diff --git a/food-waimai-web/src/main/resources/templates/error/5xx.ftl b/food-waimai-web/src/main/resources/templates/error/5xx.ftl new file mode 100644 index 0000000..51c54fc --- /dev/null +++ b/food-waimai-web/src/main/resources/templates/error/5xx.ftl @@ -0,0 +1,21 @@ + + + + + + +<@spring.message "project.name"/> + + +"> + + + + + +Something went wrong: ${status} ${error}
+request=${springMacroRequestContext}
+点我返回首页 + + diff --git a/food-waimai-web/src/main/resources/templates/index.ftl b/food-waimai-web/src/main/resources/templates/index.ftl new file mode 100644 index 0000000..88fadcb --- /dev/null +++ b/food-waimai-web/src/main/resources/templates/index.ftl @@ -0,0 +1,20 @@ + + + + + + +<@spring.message "project.name"/> + + +"> + + + + + +<@spring.message "project.name"/>Web服务 + + diff --git a/food-waimai-web/src/main/resources/templates/spring.ftl b/food-waimai-web/src/main/resources/templates/spring.ftl new file mode 100644 index 0000000..1e4e745 --- /dev/null +++ b/food-waimai-web/src/main/resources/templates/spring.ftl @@ -0,0 +1,372 @@ +<#ftl strip_whitespace=true> +<#-- + * spring.ftl + * + * This file consists of a collection of FreeMarker macros aimed at easing + * some of the common requirements of web applications - in particular + * handling of forms. + * + * Spring's FreeMarker support will automatically make this file and therefore + * all macros within it available to any application using Spring's + * FreeMarkerConfigurer. + * + * To take advantage of these macros, the "exposeSpringMacroHelpers" property + * of the FreeMarker class needs to be set to "true". This will expose a + * RequestContext under the name "springMacroRequestContext", as needed by + * the macros in this library. + * + * @author Darren Davison + * @author Juergen Hoeller + * @since 1.1 + --> + <#-- + * 张莹 + * 获取contextPath + * 添加 ${base} 方式应用 + --> +<#macro basePath><#if springMacroRequestContext.getContextPath()=="/"><#else>${springMacroRequestContext.getContextPath()} +<#global base><@basePath/> +<#-- + * message + * + * Macro to translate a message code into a message. + --> +<#macro message code>${springMacroRequestContext.getMessage(code)} + +<#-- + * messageText + * + * Macro to translate a message code into a message, + * using the given default text if no message found. + --> +<#macro messageText code, text>${springMacroRequestContext.getMessage(code, text)} + +<#-- + * messageArgs + * + * Macro to translate a message code with arguments into a message. + --> +<#macro messageArgs code, args>${springMacroRequestContext.getMessage(code, args)} + +<#-- + * messageArgsText + * + * Macro to translate a message code with arguments into a message, + * using the given default text if no message found. + --> +<#macro messageArgsText code, args, text>${springMacroRequestContext.getMessage(code, args, text)} + +<#-- + * theme + * + * Macro to translate a theme message code into a message. + --> +<#macro theme code>${springMacroRequestContext.getThemeMessage(code)} + +<#-- + * themeText + * + * Macro to translate a theme message code into a message, + * using the given default text if no message found. + --> +<#macro themeText code, text>${springMacroRequestContext.getThemeMessage(code, text)} + +<#-- + * themeArgs + * + * Macro to translate a theme message code with arguments into a message. + --> +<#macro themeArgs code, args>${springMacroRequestContext.getThemeMessage(code, args)} + +<#-- + * themeArgsText + * + * Macro to translate a theme message code with arguments into a message, + * using the given default text if no message found. + --> +<#macro themeArgsText code, args, text>${springMacroRequestContext.getThemeMessage(code, args, text)} + +<#-- + * url + * + * Takes a relative URL and makes it absolute from the server root by + * adding the context root for the web application. + --> +<#macro url relativeUrl>${springMacroRequestContext.getContextPath()}${relativeUrl} + +<#-- + * bind + * + * Exposes a BindStatus object for the given bind path, which can be + * a bean (e.g. "person") to get global errors, or a bean property + * (e.g. "person.name") to get field errors. Can be called multiple times + * within a form to bind to multiple command objects and/or field names. + * + * This macro will participate in the default HTML escape setting for the given + * RequestContext. This can be customized by calling "setDefaultHtmlEscape" + * on the "springMacroRequestContext" context variable, or via the + * "defaultHtmlEscape" context-param in web.xml (same as for the JSP bind tag). + * Also regards a "htmlEscape" variable in the namespace of this library. + * + * Producing no output, the following context variable will be available + * each time this macro is referenced (assuming you import this library in + * your templates with the namespace 'spring'): + * + * spring.status : a BindStatus instance holding the command object name, + * expression, value, and error messages and codes for the path supplied + * + * @param path : the path (string value) of the value required to bind to. + * Spring defaults to a command name of "command" but this can be overridden + * by user config. + --> +<#macro bind path> + <#if htmlEscape?exists> + <#assign status = springMacroRequestContext.getBindStatus(path, htmlEscape)> + <#else> + <#assign status = springMacroRequestContext.getBindStatus(path)> + + <#-- assign a temporary value, forcing a string representation for any + kind of variable. This temp value is only used in this macro lib --> + <#if status.value?exists && status.value?is_boolean> + <#assign stringStatusValue=status.value?string> + <#else> + <#assign stringStatusValue=status.value?default("")> + + + +<#-- + * bindEscaped + * + * Similar to spring:bind, but takes an explicit HTML escape flag rather + * than relying on the default HTML escape setting. + --> +<#macro bindEscaped path, htmlEscape> + <#assign status = springMacroRequestContext.getBindStatus(path, htmlEscape)> + <#-- assign a temporary value, forcing a string representation for any + kind of variable. This temp value is only used in this macro lib --> + <#if status.value?exists && status.value?is_boolean> + <#assign stringStatusValue=status.value?string> + <#else> + <#assign stringStatusValue=status.value?default("")> + + + +<#-- + * formInput + * + * Display a form input field of type 'text' and bind it to an attribute + * of a command or bean. + * + * @param path the name of the field to bind to + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size + --> +<#macro formInput path attributes="" fieldType="text"> + <@bind path/> + ${stringStatusValue}" ${attributes}<@closeTag/> + + +<#-- + * formPasswordInput + * + * Display a form input field of type 'password' and bind it to an attribute + * of a command or bean. No value will ever be displayed. This functionality + * can also be obtained by calling the formInput macro with a 'type' parameter + * of 'password'. + * + * @param path the name of the field to bind to + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size + --> +<#macro formPasswordInput path attributes=""> + <@formInput path, attributes, "password"/> + + +<#-- + * formHiddenInput + * + * Generate a form input field of type 'hidden' and bind it to an attribute + * of a command or bean. This functionality can also be obtained by calling + * the formInput macro with a 'type' parameter of 'hidden'. + * + * @param path the name of the field to bind to + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size + --> +<#macro formHiddenInput path attributes=""> + <@formInput path, attributes, "hidden"/> + + +<#-- + * formTextarea + * + * Display a text area and bind it to an attribute of a command or bean. + * + * @param path the name of the field to bind to + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size + --> +<#macro formTextarea path attributes=""> + <@bind path/> + + + +<#-- + * formSingleSelect + * + * Show a selectbox (dropdown) input element allowing a single value to be chosen + * from a list of options. + * + * @param path the name of the field to bind to + * @param options a map (value=label) of all the available options + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size +--> +<#macro formSingleSelect path options attributes=""> + <@bind path/> + + + +<#-- + * formMultiSelect + * + * Show a listbox of options allowing the user to make 0 or more choices from + * the list of options. + * + * @param path the name of the field to bind to + * @param options a map (value=label) of all the available options + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size +--> +<#macro formMultiSelect path options attributes=""> + <@bind path/> + + + +<#-- + * formRadioButtons + * + * Show radio buttons. + * + * @param path the name of the field to bind to + * @param options a map (value=label) of all the available options + * @param separator the html tag or other character list that should be used to + * separate each option. Typically ' ' or '
' + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size +--> +<#macro formRadioButtons path options separator attributes=""> + <@bind path/> + <#list options?keys as value> + <#assign id="${status.expression}${value_index}"> + checked="checked" ${attributes}<@closeTag/> + ${separator} + + + +<#-- + * formCheckboxes + * + * Show checkboxes. + * + * @param path the name of the field to bind to + * @param options a map (value=label) of all the available options + * @param separator the html tag or other character list that should be used to + * separate each option. Typically ' ' or '
' + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size +--> +<#macro formCheckboxes path options separator attributes=""> + <@bind path/> + <#list options?keys as value> + <#assign id="${status.expression}${value_index}"> + <#assign isSelected = contains(status.value?default([""]), value)> + checked="checked" ${attributes}<@closeTag/> + ${separator} + + + + +<#-- + * showErrors + * + * Show validation errors for the currently bound field, with + * optional style attributes. + * + * @param separator the html tag or other character list that should be used to + * separate each option. Typically '
'. + * @param classOrStyle either the name of a CSS class element (which is defined in + * the template or an external CSS file) or an inline style. If the value passed in here + * contains a colon (:) then a 'style=' attribute will be used, else a 'class=' attribute + * will be used. +--> +<#macro showErrors separator classOrStyle=""> + <#list status.errorMessages as error> + <#if classOrStyle == ""> + ${error} + <#else> + <#if classOrStyle?index_of(":") == -1><#assign attr="class"><#else><#assign attr="style"> + ${error} + + <#if error_has_next>${separator} + + + +<#-- + * checkSelected + * + * Check a value in a list to see if it is the currently selected value. + * If so, add the 'selected="selected"' text to the output. + * Handles values of numeric and string types. + * This function is used internally but can be accessed by user code if required. + * + * @param value the current value in a list iteration +--> +<#macro checkSelected value> + <#if stringStatusValue?is_number && stringStatusValue == value?number>selected="selected" + <#if stringStatusValue?is_string && stringStatusValue == value>selected="selected" + + +<#-- + * contains + * + * Macro to return true if the list contains the scalar, false if not. + * Surprisingly not a FreeMarker builtin. + * This function is used internally but can be accessed by user code if required. + * + * @param list the list to search for the item + * @param item the item to search for in the list + * @return true if item is found in the list, false otherwise +--> +<#function contains list item> + <#list list as nextInList> + <#if nextInList == item><#return true> + + <#return false> + + +<#-- + * closeTag + * + * Simple macro to close an HTML tag that has no body with '>' or '/>', + * depending on the value of a 'xhtmlCompliant' variable in the namespace + * of this library. +--> +<#macro closeTag> + <#if xhtmlCompliant?exists && xhtmlCompliant>/><#else>> + diff --git a/food-waimai-web/target/classes/META-INF/spring/spring-dubbo-food-waimai.xml b/food-waimai-web/target/classes/META-INF/spring/spring-dubbo-food-waimai.xml new file mode 100644 index 0000000..02fd19e --- /dev/null +++ b/food-waimai-web/target/classes/META-INF/spring/spring-dubbo-food-waimai.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/food-waimai-web/target/classes/META-INF/spring/spring-dubbo.xml b/food-waimai-web/target/classes/META-INF/spring/spring-dubbo.xml new file mode 100644 index 0000000..94f953e --- /dev/null +++ b/food-waimai-web/target/classes/META-INF/spring/spring-dubbo.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/food-waimai-web/target/classes/application.properties b/food-waimai-web/target/classes/application.properties new file mode 100644 index 0000000..63ec4fb --- /dev/null +++ b/food-waimai-web/target/classes/application.properties @@ -0,0 +1,48 @@ +#Global +global.encoding=UTF-8 +global.locale=zh_CN + +#application.sign,application.index\u90FD\u4E0D\u80FD\u91CD\u590D +application.name=foodWaiMai +application.owner= +application.sign=1 +application.description=${application.name} +application.index=0 + +#\u6CE8\u518C\u4E2D\u5FC3 +zk.connect=127.0.0.1:2181 +# curator or zkclient +zk.client=curator + +#dubbo\u670D\u52A1 +reference.version=2.0.0 +reference.group=default +reference.timeout=600000 +reference.retries=1 + +#dubbo cache address +dubbo.cache.address=/home/project/food/dubbo/food-waimai-web.cache + +# EMBEDDED SERVER CONFIGURATION (ServerProperties) +server.port=8200 +server.servlet.context-path=/foodWaiMai +server.compression.enabled=true +server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml +server.compression.min-response-size=2048 + +# FREEMARKER (FreeMarkerProperties) +spring.freemarker.cache=false +spring.freemarker.charset=${global.encoding} +spring.freemarker.settings.template_exception_handler=com.jwsaas.freemarker.DefaultTemplateExceptionHandler +spring.freemarker.settings.auto_import=spring.ftl as spring + +# INTERNATIONALIZATION (MessageSourceProperties) +spring.messages.basename=i18n/messages + +#RabbitMQ +spring.rabbitmq.host=192.168.0.110 +spring.rabbitmq.port=5672 +spring.rabbitmq.virtual-host=/dev_test +spring.rabbitmq.publisher-confirms=true +spring.rabbitmq.username=dev +spring.rabbitmq.password=dev \ No newline at end of file diff --git a/food-waimai-web/target/classes/com/jwsaas/Application.class b/food-waimai-web/target/classes/com/jwsaas/Application.class new file mode 100644 index 0000000..6202b66 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/Application.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/Global.class b/food-waimai-web/target/classes/com/jwsaas/Global.class new file mode 100644 index 0000000..d4a1d8c Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/Global.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/config/MQMessageSender.class b/food-waimai-web/target/classes/com/jwsaas/config/MQMessageSender.class new file mode 100644 index 0000000..32ccf93 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/config/MQMessageSender.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/config/RabbitConstant.class b/food-waimai-web/target/classes/com/jwsaas/config/RabbitConstant.class new file mode 100644 index 0000000..c3384ea Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/config/RabbitConstant.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/config/RabbitMQConfig.class b/food-waimai-web/target/classes/com/jwsaas/config/RabbitMQConfig.class new file mode 100644 index 0000000..7dd99cf Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/config/RabbitMQConfig.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/BaseController.class b/food-waimai-web/target/classes/com/jwsaas/controller/BaseController.class new file mode 100644 index 0000000..fd07b05 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/BaseController.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/IndexController.class b/food-waimai-web/target/classes/com/jwsaas/controller/IndexController.class new file mode 100644 index 0000000..8691f86 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/IndexController.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/BaiduOrderEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/BaiduOrderEntity.class new file mode 100644 index 0000000..6c40b31 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/BaiduOrderEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/BaiduOrderProductEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/BaiduOrderProductEntity.class new file mode 100644 index 0000000..19f37d5 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/BaiduOrderProductEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/BaiduWaimaiOrderController.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/BaiduWaimaiOrderController.class new file mode 100644 index 0000000..ac548d6 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/BaiduWaimaiOrderController.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ElemeOrderDetailEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ElemeOrderDetailEntity.class new file mode 100644 index 0000000..4e2a175 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ElemeOrderDetailEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ElemeOrderDetailGroupEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ElemeOrderDetailGroupEntity.class new file mode 100644 index 0000000..1d3999d Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ElemeOrderDetailGroupEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ElemeWaimaiOrderController.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ElemeWaimaiOrderController.class new file mode 100644 index 0000000..f4a6069 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ElemeWaimaiOrderController.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeiTuanOrderController.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeiTuanOrderController.class new file mode 100644 index 0000000..81606e4 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeiTuanOrderController.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeituanOrderEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeituanOrderEntity.class new file mode 100644 index 0000000..7e4197c Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeituanOrderEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeituanOrderExtraEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeituanOrderExtraEntity.class new file mode 100644 index 0000000..bb943a9 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeituanOrderExtraEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeituanOrderItemEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeituanOrderItemEntity.class new file mode 100644 index 0000000..a8c89d8 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/MeituanOrderItemEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderController.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderController.class new file mode 100644 index 0000000..2e50519 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderController.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderEntity.class new file mode 100644 index 0000000..9b1fc34 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderItemEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderItemEntity.class new file mode 100644 index 0000000..e4966ad Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderItemEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderPayEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderPayEntity.class new file mode 100644 index 0000000..18a01d4 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/QiMaiOrderPayEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeiTuanOrderController.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeiTuanOrderController.class new file mode 100644 index 0000000..b104127 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeiTuanOrderController.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeituanOrderEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeituanOrderEntity.class new file mode 100644 index 0000000..6e97578 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeituanOrderEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeituanOrderExtraEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeituanOrderExtraEntity.class new file mode 100644 index 0000000..cf96b32 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeituanOrderExtraEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeituanOrderItemEntity.class b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeituanOrderItemEntity.class new file mode 100644 index 0000000..2aefdd7 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/controller/waimai/ShopMeituanOrderItemEntity.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/freemarker/DefaultTemplateExceptionHandler.class b/food-waimai-web/target/classes/com/jwsaas/freemarker/DefaultTemplateExceptionHandler.class new file mode 100644 index 0000000..bc36231 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/freemarker/DefaultTemplateExceptionHandler.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/utils/Assert.class b/food-waimai-web/target/classes/com/jwsaas/utils/Assert.class new file mode 100644 index 0000000..5854fc0 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/utils/Assert.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/utils/DateUtils.class b/food-waimai-web/target/classes/com/jwsaas/utils/DateUtils.class new file mode 100644 index 0000000..1e5a7ca Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/utils/DateUtils.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/utils/EmojiFilter.class b/food-waimai-web/target/classes/com/jwsaas/utils/EmojiFilter.class new file mode 100644 index 0000000..b8d5bcf Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/utils/EmojiFilter.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/utils/JSONException.class b/food-waimai-web/target/classes/com/jwsaas/utils/JSONException.class new file mode 100644 index 0000000..7d4fbe5 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/utils/JSONException.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/utils/JSONUtil$1.class b/food-waimai-web/target/classes/com/jwsaas/utils/JSONUtil$1.class new file mode 100644 index 0000000..60fdcd2 Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/utils/JSONUtil$1.class differ diff --git a/food-waimai-web/target/classes/com/jwsaas/utils/JSONUtil.class b/food-waimai-web/target/classes/com/jwsaas/utils/JSONUtil.class new file mode 100644 index 0000000..44ef6ad Binary files /dev/null and b/food-waimai-web/target/classes/com/jwsaas/utils/JSONUtil.class differ diff --git a/food-waimai-web/target/classes/i18n/messages.properties b/food-waimai-web/target/classes/i18n/messages.properties new file mode 100644 index 0000000..2d3636f --- /dev/null +++ b/food-waimai-web/target/classes/i18n/messages.properties @@ -0,0 +1,5 @@ +project.name=\u9910\u996eV2\u5916\u5356\u63a5\u5355 +project.boduo.name=\u9910\u996eV2\u5916\u5356\u63a5\u5355 +project.description=\u9910\u996eV2\u5916\u5356\u63a5\u5355 +project.version=2.0 +project.softwareName=\u9910\u996eV2\u5916\u5356\u63a5\u5355 diff --git a/food-waimai-web/target/classes/logback.xml b/food-waimai-web/target/classes/logback.xml new file mode 100644 index 0000000..027d001 --- /dev/null +++ b/food-waimai-web/target/classes/logback.xml @@ -0,0 +1,32 @@ + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%-5level] %logger{120} - %msg %n + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/food-waimai-web/target/classes/templates/error/404.ftl b/food-waimai-web/target/classes/templates/error/404.ftl new file mode 100644 index 0000000..0254b6e --- /dev/null +++ b/food-waimai-web/target/classes/templates/error/404.ftl @@ -0,0 +1,20 @@ + + + + + + +<@spring.message "project.name"/> + + +"> + + + + + +404 +点我返回首页 + + diff --git a/food-waimai-web/target/classes/templates/error/4xx.ftl b/food-waimai-web/target/classes/templates/error/4xx.ftl new file mode 100644 index 0000000..cfc7fd8 --- /dev/null +++ b/food-waimai-web/target/classes/templates/error/4xx.ftl @@ -0,0 +1,20 @@ + + + + + + +<@spring.message "project.name"/> + + +"> + + + + + +Something went wrong (4XX): ${status} ${error}
+点我返回首页 + + diff --git a/food-waimai-web/target/classes/templates/error/5xx.ftl b/food-waimai-web/target/classes/templates/error/5xx.ftl new file mode 100644 index 0000000..51c54fc --- /dev/null +++ b/food-waimai-web/target/classes/templates/error/5xx.ftl @@ -0,0 +1,21 @@ + + + + + + +<@spring.message "project.name"/> + + +"> + + + + + +Something went wrong: ${status} ${error}
+request=${springMacroRequestContext}
+点我返回首页 + + diff --git a/food-waimai-web/target/classes/templates/index.ftl b/food-waimai-web/target/classes/templates/index.ftl new file mode 100644 index 0000000..88fadcb --- /dev/null +++ b/food-waimai-web/target/classes/templates/index.ftl @@ -0,0 +1,20 @@ + + + + + + +<@spring.message "project.name"/> + + +"> + + + + + +<@spring.message "project.name"/>Web服务 + + diff --git a/food-waimai-web/target/classes/templates/spring.ftl b/food-waimai-web/target/classes/templates/spring.ftl new file mode 100644 index 0000000..1e4e745 --- /dev/null +++ b/food-waimai-web/target/classes/templates/spring.ftl @@ -0,0 +1,372 @@ +<#ftl strip_whitespace=true> +<#-- + * spring.ftl + * + * This file consists of a collection of FreeMarker macros aimed at easing + * some of the common requirements of web applications - in particular + * handling of forms. + * + * Spring's FreeMarker support will automatically make this file and therefore + * all macros within it available to any application using Spring's + * FreeMarkerConfigurer. + * + * To take advantage of these macros, the "exposeSpringMacroHelpers" property + * of the FreeMarker class needs to be set to "true". This will expose a + * RequestContext under the name "springMacroRequestContext", as needed by + * the macros in this library. + * + * @author Darren Davison + * @author Juergen Hoeller + * @since 1.1 + --> + <#-- + * 张莹 + * 获取contextPath + * 添加 ${base} 方式应用 + --> +<#macro basePath><#if springMacroRequestContext.getContextPath()=="/"><#else>${springMacroRequestContext.getContextPath()} +<#global base><@basePath/> +<#-- + * message + * + * Macro to translate a message code into a message. + --> +<#macro message code>${springMacroRequestContext.getMessage(code)} + +<#-- + * messageText + * + * Macro to translate a message code into a message, + * using the given default text if no message found. + --> +<#macro messageText code, text>${springMacroRequestContext.getMessage(code, text)} + +<#-- + * messageArgs + * + * Macro to translate a message code with arguments into a message. + --> +<#macro messageArgs code, args>${springMacroRequestContext.getMessage(code, args)} + +<#-- + * messageArgsText + * + * Macro to translate a message code with arguments into a message, + * using the given default text if no message found. + --> +<#macro messageArgsText code, args, text>${springMacroRequestContext.getMessage(code, args, text)} + +<#-- + * theme + * + * Macro to translate a theme message code into a message. + --> +<#macro theme code>${springMacroRequestContext.getThemeMessage(code)} + +<#-- + * themeText + * + * Macro to translate a theme message code into a message, + * using the given default text if no message found. + --> +<#macro themeText code, text>${springMacroRequestContext.getThemeMessage(code, text)} + +<#-- + * themeArgs + * + * Macro to translate a theme message code with arguments into a message. + --> +<#macro themeArgs code, args>${springMacroRequestContext.getThemeMessage(code, args)} + +<#-- + * themeArgsText + * + * Macro to translate a theme message code with arguments into a message, + * using the given default text if no message found. + --> +<#macro themeArgsText code, args, text>${springMacroRequestContext.getThemeMessage(code, args, text)} + +<#-- + * url + * + * Takes a relative URL and makes it absolute from the server root by + * adding the context root for the web application. + --> +<#macro url relativeUrl>${springMacroRequestContext.getContextPath()}${relativeUrl} + +<#-- + * bind + * + * Exposes a BindStatus object for the given bind path, which can be + * a bean (e.g. "person") to get global errors, or a bean property + * (e.g. "person.name") to get field errors. Can be called multiple times + * within a form to bind to multiple command objects and/or field names. + * + * This macro will participate in the default HTML escape setting for the given + * RequestContext. This can be customized by calling "setDefaultHtmlEscape" + * on the "springMacroRequestContext" context variable, or via the + * "defaultHtmlEscape" context-param in web.xml (same as for the JSP bind tag). + * Also regards a "htmlEscape" variable in the namespace of this library. + * + * Producing no output, the following context variable will be available + * each time this macro is referenced (assuming you import this library in + * your templates with the namespace 'spring'): + * + * spring.status : a BindStatus instance holding the command object name, + * expression, value, and error messages and codes for the path supplied + * + * @param path : the path (string value) of the value required to bind to. + * Spring defaults to a command name of "command" but this can be overridden + * by user config. + --> +<#macro bind path> + <#if htmlEscape?exists> + <#assign status = springMacroRequestContext.getBindStatus(path, htmlEscape)> + <#else> + <#assign status = springMacroRequestContext.getBindStatus(path)> + + <#-- assign a temporary value, forcing a string representation for any + kind of variable. This temp value is only used in this macro lib --> + <#if status.value?exists && status.value?is_boolean> + <#assign stringStatusValue=status.value?string> + <#else> + <#assign stringStatusValue=status.value?default("")> + + + +<#-- + * bindEscaped + * + * Similar to spring:bind, but takes an explicit HTML escape flag rather + * than relying on the default HTML escape setting. + --> +<#macro bindEscaped path, htmlEscape> + <#assign status = springMacroRequestContext.getBindStatus(path, htmlEscape)> + <#-- assign a temporary value, forcing a string representation for any + kind of variable. This temp value is only used in this macro lib --> + <#if status.value?exists && status.value?is_boolean> + <#assign stringStatusValue=status.value?string> + <#else> + <#assign stringStatusValue=status.value?default("")> + + + +<#-- + * formInput + * + * Display a form input field of type 'text' and bind it to an attribute + * of a command or bean. + * + * @param path the name of the field to bind to + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size + --> +<#macro formInput path attributes="" fieldType="text"> + <@bind path/> + ${stringStatusValue}" ${attributes}<@closeTag/> + + +<#-- + * formPasswordInput + * + * Display a form input field of type 'password' and bind it to an attribute + * of a command or bean. No value will ever be displayed. This functionality + * can also be obtained by calling the formInput macro with a 'type' parameter + * of 'password'. + * + * @param path the name of the field to bind to + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size + --> +<#macro formPasswordInput path attributes=""> + <@formInput path, attributes, "password"/> + + +<#-- + * formHiddenInput + * + * Generate a form input field of type 'hidden' and bind it to an attribute + * of a command or bean. This functionality can also be obtained by calling + * the formInput macro with a 'type' parameter of 'hidden'. + * + * @param path the name of the field to bind to + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size + --> +<#macro formHiddenInput path attributes=""> + <@formInput path, attributes, "hidden"/> + + +<#-- + * formTextarea + * + * Display a text area and bind it to an attribute of a command or bean. + * + * @param path the name of the field to bind to + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size + --> +<#macro formTextarea path attributes=""> + <@bind path/> + + + +<#-- + * formSingleSelect + * + * Show a selectbox (dropdown) input element allowing a single value to be chosen + * from a list of options. + * + * @param path the name of the field to bind to + * @param options a map (value=label) of all the available options + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size +--> +<#macro formSingleSelect path options attributes=""> + <@bind path/> + + + +<#-- + * formMultiSelect + * + * Show a listbox of options allowing the user to make 0 or more choices from + * the list of options. + * + * @param path the name of the field to bind to + * @param options a map (value=label) of all the available options + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size +--> +<#macro formMultiSelect path options attributes=""> + <@bind path/> + + + +<#-- + * formRadioButtons + * + * Show radio buttons. + * + * @param path the name of the field to bind to + * @param options a map (value=label) of all the available options + * @param separator the html tag or other character list that should be used to + * separate each option. Typically ' ' or '
' + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size +--> +<#macro formRadioButtons path options separator attributes=""> + <@bind path/> + <#list options?keys as value> + <#assign id="${status.expression}${value_index}"> + checked="checked" ${attributes}<@closeTag/> + ${separator} + + + +<#-- + * formCheckboxes + * + * Show checkboxes. + * + * @param path the name of the field to bind to + * @param options a map (value=label) of all the available options + * @param separator the html tag or other character list that should be used to + * separate each option. Typically ' ' or '
' + * @param attributes any additional attributes for the element (such as class + * or CSS styles or size +--> +<#macro formCheckboxes path options separator attributes=""> + <@bind path/> + <#list options?keys as value> + <#assign id="${status.expression}${value_index}"> + <#assign isSelected = contains(status.value?default([""]), value)> + checked="checked" ${attributes}<@closeTag/> + ${separator} + + + + +<#-- + * showErrors + * + * Show validation errors for the currently bound field, with + * optional style attributes. + * + * @param separator the html tag or other character list that should be used to + * separate each option. Typically '
'. + * @param classOrStyle either the name of a CSS class element (which is defined in + * the template or an external CSS file) or an inline style. If the value passed in here + * contains a colon (:) then a 'style=' attribute will be used, else a 'class=' attribute + * will be used. +--> +<#macro showErrors separator classOrStyle=""> + <#list status.errorMessages as error> + <#if classOrStyle == ""> + ${error} + <#else> + <#if classOrStyle?index_of(":") == -1><#assign attr="class"><#else><#assign attr="style"> + ${error} + + <#if error_has_next>${separator} + + + +<#-- + * checkSelected + * + * Check a value in a list to see if it is the currently selected value. + * If so, add the 'selected="selected"' text to the output. + * Handles values of numeric and string types. + * This function is used internally but can be accessed by user code if required. + * + * @param value the current value in a list iteration +--> +<#macro checkSelected value> + <#if stringStatusValue?is_number && stringStatusValue == value?number>selected="selected" + <#if stringStatusValue?is_string && stringStatusValue == value>selected="selected" + + +<#-- + * contains + * + * Macro to return true if the list contains the scalar, false if not. + * Surprisingly not a FreeMarker builtin. + * This function is used internally but can be accessed by user code if required. + * + * @param list the list to search for the item + * @param item the item to search for in the list + * @return true if item is found in the list, false otherwise +--> +<#function contains list item> + <#list list as nextInList> + <#if nextInList == item><#return true> + + <#return false> + + +<#-- + * closeTag + * + * Simple macro to close an HTML tag that has no body with '>' or '/>', + * depending on the value of a 'xhtmlCompliant' variable in the namespace + * of this library. +--> +<#macro closeTag> + <#if xhtmlCompliant?exists && xhtmlCompliant>/><#else>> + diff --git a/food-waimai-web/target/food-waimai-web-2.0.0.jar b/food-waimai-web/target/food-waimai-web-2.0.0.jar new file mode 100644 index 0000000..006917d Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0.jar differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0.jar.original b/food-waimai-web/target/food-waimai-web-2.0.0.jar.original new file mode 100644 index 0000000..82d916e Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0.jar.original differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0.zip b/food-waimai-web/target/food-waimai-web-2.0.0.zip new file mode 100644 index 0000000..5088c95 Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0.zip differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/install.bat b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/install.bat new file mode 100644 index 0000000..046a68c --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/install.bat @@ -0,0 +1,140 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general passthrough startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem _PASS_THROUGH tells the script to pass all parameters through to the JVM +rem as is. +rem If _WRAPPER_CONF_OVERRIDE is specified then all parameters will be passed. +rem If not set then all parameters starting with the second will be passed. +set _PASS_THROUGH=true + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -i %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -i %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause + + diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/middleware b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/middleware new file mode 100644 index 0000000..8e960e3 --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/middleware @@ -0,0 +1,2162 @@ +#! /bin/sh + +# +# Copyright (c) 1999, 2016 Tanuki Software, Ltd. +# http://www.tanukisoftware.com +# All rights reserved. +# +# This software is the proprietary information of Tanuki Software. +# You shall use it only in accordance with the terms of the +# license agreement you entered into with Tanuki Software. +# http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +# +# Java Service Wrapper sh script. Suitable for starting and stopping +# wrapped Java applications on UNIX platforms. +# + +#----------------------------------------------------------------------------- +# These settings can be modified to fit the needs of your application +# Optimized for use with version 3.5.28 of the Wrapper. + +#******************************************************************** +# NOTE - This script has been modified to run the TestWrapper sample +# application and should NOT be used as a base for your own +# applications. All of the documentation assumes that you are +# working from the default source script: +# WRAPPER_HOME/src/bin/sh.script.in +#******************************************************************** + +# IMPORTANT - Please always stop and uninstall an application before making +# any changes to this file. Failure to do so could remove the +# script's ability to control the application. + +# Initialization block for the install_initd and remove_initd scripts used by +# SUSE linux, CentOS and RHEL distributions. +# Note: From CentOS 6, make sure the BEGIN INIT INFO section is before any line +# of code otherwise the service won't be displayed in the Service +# Configuration GUI. +### BEGIN INIT INFO +# Provides: wrapper +# Required-Start: $local_fs $network $syslog +# Should-Start: +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Wrapper Sample Application +# Description: Wrapper Sample Application Description +### END INIT INFO + +# Application +APP_NAME="Food2WaiMaiWeb" +APP_LONG_NAME="Food2WaiMaiWeb Application" + +# If uncommented (and set to false), APP_NAME and APP_LONG_NAME will no longer +# be passed to the wrapper. See documentation for details. +#APP_NAME_PASS_TO_WRAPPER=false + +# Wrapper +WRAPPER_CMD="./wrapper" +WRAPPER_CONF="../conf/wrapper.conf" + +# Priority at which to run the wrapper. See "man nice" for valid priorities. +# nice is only used if a priority is specified. +PRIORITY= + +# Location of the pid file. +PIDDIR="." + +# PIDFILE_CHECK_PID tells the script to double check whether the pid in the pid +# file actually exists and belongs to this application. When not set, only +# check the pid, but not what it is. This is only needed when multiple +# applications need to share the same pid file. +PIDFILE_CHECK_PID=true + +# FIXED_COMMAND tells the script to use a hard coded action rather than +# expecting the first parameter of the command line to be the command. +# By default the command will will be expected to be the first parameter. +#FIXED_COMMAND=console + +# PASS_THROUGH tells the script to pass all arguments through to the JVM +# as is. If FIXED_COMMAND is specified then all arguments will be passed. +# If not set then all arguments starting with the second will be passed. +PASS_THROUGH=true + +# If uncommented, causes the Wrapper to be shutdown using an anchor file. +# When launched with the 'start' command, it will also ignore all INT and +# TERM signals. +#IGNORE_SIGNALS=true + +# Wrapper will start the JVM asynchronously. Your application may have some +# initialization tasks and it may be desirable to wait a few seconds +# before returning. For example, to delay the invocation of following +# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will +# cause the start command to delay for the indicated period of time +# (in seconds). +# +WAIT_AFTER_STARTUP=0 + +# If set, wait for the wrapper to report that the daemon has started +WAIT_FOR_STARTED_STATUS=true +WAIT_FOR_STARTED_TIMEOUT=120 + +# If set, the status, start_msg and stop_msg commands will print out detailed +# state information on the Wrapper and Java processes. +#DETAIL_STATUS=true + +# If set, the 'pause' and 'resume' commands will be enabled. These make it +# possible to pause the JVM or Java application without completely stopping +# the Wrapper. See the wrapper.pausable and wrapper.pausable.stop_jvm +# properties for more information. +#PAUSABLE=true + +# If specified, the Wrapper will be run as the specified user. +# IMPORTANT - Make sure that the user has the required privileges to write +# the PID file and wrapper.log files. Failure to be able to write the log +# file will cause the Wrapper to exit without any way to write out an error +# message. +# NOTE - This will set the user which is used to run the Wrapper as well as +# the JVM and is not useful in situations where a privileged resource or +# port needs to be allocated prior to the user being changed. +#RUN_AS_USER= + +# Set the full path to the 'su' command (substitute user). +# NOTE - In case 'su' is not in the PATH, you can set the absolute path here, +# for example: +# SU_BIN=/bin/su +# NOTE - For Red Hat, the script will use '/sbin/runuser' if it is present and +# ignore the value of SU_BIN. +SU_BIN=su + +# Set option for 'su'. +# In case the user set in RUN_AS_USER has no bash set, the 'su' command will fail. +# The workaround for GNU/Linux system is to specify which bash to use with +# the '-s' option. +#SU_OPTS="-s /bin/bash" + +# Set the full path to the 'id' command. +# For example: +# ID_BIN=/usr/bin/id +ID_BIN=id + +# By default we show a detailed usage block. Uncomment to show brief usage. +#BRIEF_USAGE=true + +# OS service management tool: flag for using Upstart when installing (rather than init.d rc.d) +USE_UPSTART= + +# OS service management tool: flag for using systemd when installing +USE_SYSTEMD= + +# When installing on Mac OSX platforms, the following domain will be used to +# prefix the plist file name. +PLIST_DOMAIN=org.tanukisoftware.wrapper + +# When installing on Mac OSX platforms, this parameter controls whether the daemon +# is to be kept continuously running or to let demand and conditions control the +# invocation. +MACOSX_KEEP_RUNNING="false" + +# The following two lines are used by the chkconfig command. Change as is +# appropriate for your application. They should remain commented. +# chkconfig: 2345 20 80 +# description: Test Wrapper Sample Application + +# Set run level to use when installing the application to start and stop on +# system startup and shutdown. It is important that the application always +# be uninstalled before making any changes to the run levels. +# It is also possible to specify different run levels based on the individual +# platform. When doing so this script will look for defined run levels in +# the following order: +# 1) "RUN_LEVEL_S_$DIST_OS" or "RUN_LEVEL_K_$DIST_OS", where "$DIST_OS" is +# the value of DIST_OS. "RUN_LEVEL_S_solaris=20" for example. +# 2) RUN_LEVEL_S or RUN_LEVEL_K, to specify specify start or stop run levels. +# 3) RUN_LEVEL, to specify a general run level. +RUN_LEVEL=20 + +# Do not modify anything beyond this point +#----------------------------------------------------------------------------- + +# check if we are running under Cygwin terminal. +# Note: on some OS's (for example Solaris, MacOS), -o is not a valid parameter +# and it shows an error message. We redirect stderr to null so the error message +# doesn't show up. +CYGWIN=`uname -o 2>/dev/null` +if [ "$CYGWIN" = "Cygwin" ] +then + eval echo `gettext 'This script is not compatible with Cygwin. Please use the Wrapper batch files to control the Wrapper.'` + exit 1 +fi + +if [ -n "$FIXED_COMMAND" ] +then + COMMAND="$FIXED_COMMAND" +else + COMMAND="$1" +fi + +# check if there is a parameter "sysd" +SYSD= +if [ $# -gt 1 ] ; then + if [ $2 = "sysd" ] ; then + SYSD=1 + fi +fi + +# default location for the service file +SYSTEMD_SERVICE_FILE="/etc/systemd/system/$APP_NAME.service" + +# Required for HP-UX Startup +if [ `uname -s` = "HP-UX" -o `uname -s` = "HP-UX64" ] ; then + PATH=$PATH:/usr/bin +fi + +# Get the fully qualified path to the script +case $0 in + /*) + SCRIPT="$0" + ;; + *) + PWD=`pwd` + SCRIPT="$PWD/$0" + ;; +esac + +# Resolve the true real path without any sym links. +CHANGED=true +while [ "X$CHANGED" != "X" ] +do + # Change spaces to ":" so the tokens can be parsed. + SAFESCRIPT=`echo $SCRIPT | sed -e 's; ;:;g'` + # Get the real path to this script, resolving any symbolic links + TOKENS=`echo $SAFESCRIPT | sed -e 's;/; ;g'` + REALPATH= + for C in $TOKENS; do + # Change any ":" in the token back to a space. + C=`echo $C | sed -e 's;:; ;g'` + REALPATH="$REALPATH/$C" + # If REALPATH is a sym link, resolve it. Loop for nested links. + while [ -h "$REALPATH" ] ; do + LS="`ls -ld "$REALPATH"`" + LINK="`expr "$LS" : '.*-> \(.*\)$'`" + if expr "$LINK" : '/.*' > /dev/null; then + # LINK is absolute. + REALPATH="$LINK" + else + # LINK is relative. + REALPATH="`dirname "$REALPATH"`""/$LINK" + fi + done + done + + if [ "$REALPATH" = "$SCRIPT" ] + then + CHANGED="" + else + SCRIPT="$REALPATH" + fi +done + +# Get the location of the script. +REALDIR=`dirname "$REALPATH"` +# Normalize the path +REALDIR=`cd "${REALDIR}"; pwd` + +# If the PIDDIR is relative, set its value relative to the full REALPATH to avoid problems if +# the working directory is later changed. +FIRST_CHAR=`echo $PIDDIR | cut -c1,1` +if [ "$FIRST_CHAR" != "/" ] +then + PIDDIR=$REALDIR/$PIDDIR +fi +# Same test for WRAPPER_CMD +FIRST_CHAR=`echo $WRAPPER_CMD | cut -c1,1` +if [ "$FIRST_CHAR" != "/" ] +then + WRAPPER_CMD=$REALDIR/$WRAPPER_CMD +fi +# Same test for WRAPPER_CONF +FIRST_CHAR=`echo $WRAPPER_CONF | cut -c1,1` +if [ "$FIRST_CHAR" != "/" ] +then + WRAPPER_CONF=$REALDIR/$WRAPPER_CONF +fi + +# Process ID +ANCHORFILE="$PIDDIR/$APP_NAME.anchor" +COMMANDFILE="$PIDDIR/$APP_NAME.command" +STATUSFILE="$PIDDIR/$APP_NAME.status" +JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status" +PIDFILE="$PIDDIR/$APP_NAME.pid" +LOCKDIR="/var/lock/subsys" +LOCKFILE="$LOCKDIR/$APP_NAME" +pid="" + +# Resolve the location of the 'ps' command +PS_BIN="/usr/ucb/ps" + if [ ! -x "$PS_BIN" ] + then + PS_BIN="/usr/bin/ps" + if [ ! -x "$PS_BIN" ] + then + PS_BIN="/bin/ps" + if [ ! -x "$PS_BIN" ] + then + eval echo `gettext 'Unable to locate "ps".'` + eval echo `gettext 'Please report this message along with the location of the command on your system.'` + exit 1 + fi + fi + fi + +TR_BIN="/usr/bin/tr" +if [ ! -x "$TR_BIN" ] +then + TR_BIN="/bin/tr" + if [ ! -x "$TR_BIN" ] + then + eval echo `gettext 'Unable to locate "tr".'` + eval echo `gettext 'Please report this message along with the location of the command on your system.'` + exit 1 + fi +fi +# Resolve the os +DIST_OS=`uname -s | $TR_BIN "[A-Z]" "[a-z]" | $TR_BIN -d ' '` +case "$DIST_OS" in + 'sunos') + DIST_OS="solaris" + ;; + 'hp-ux' | 'hp-ux64') + # HP-UX needs the XPG4 version of ps (for -o args) + DIST_OS="hpux" + UNIX95="" + export UNIX95 + ;; + 'darwin') + DIST_OS="macosx" + ;; + 'unix_sv') + DIST_OS="unixware" + ;; + 'os/390') + DIST_OS="zos" + ;; +esac + +# Compare Versions $1<$2=0, $1==$2=1, $1>$2=2 +compareVersions () { + if [ "$1" = "$2" ] + then + return 1 + else + local i=1 + while true + do + local v1=`echo "$1" | cut -d '.' -f $i` + local v2=`echo "$2" | cut -d '.' -f $i` + if [ "X$v1" = "X" ] + then + if [ "X$v2" = "X" ] + then + return 1 + fi + v1="0" + elif [ "X$v2" = "X" ] + then + v2="0" + fi + if [ $v1 -lt $v2 ] + then + return 0 + elif [ $v1 -gt $v2 ] + then + return 2 + fi + i=`expr $i + 1` + done + fi +} + +# Resolve the architecture +if [ "$DIST_OS" = "macosx" ] +then + OS_VER=`sw_vers | grep 'ProductVersion:' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\|[0-9]*\.[0-9]*'` + DIST_ARCH="universal" + compareVersions "$OS_VER" "10.5.0" + if [[ $? < 1 ]] + then + DIST_BITS="32" + KEY_KEEP_ALIVE="OnDemand" + else + # Note: "OnDemand" has been deprecated and replaced from Mac OS X 10.5 by "KeepAlive" + KEY_KEEP_ALIVE="KeepAlive" + + if [ "X`/usr/sbin/sysctl -n hw.cpu64bit_capable`" = "X1" ] + then + DIST_BITS="64" + else + DIST_BITS="32" + fi + fi + APP_PLIST_BASE=${PLIST_DOMAIN}.${APP_NAME} + APP_PLIST=${APP_PLIST_BASE}.plist +else + if [ "$DIST_OS" = "linux" ] + then + DIST_ARCH= + else + DIST_ARCH=`uname -p 2>/dev/null | $TR_BIN "[A-Z]" "[a-z]" | $TR_BIN -d ' '` + fi + if [ "X$DIST_ARCH" = "X" ] + then + DIST_ARCH="unknown" + fi + if [ "$DIST_ARCH" = "unknown" ] + then + DIST_ARCH=`uname -m 2>/dev/null | $TR_BIN "[A-Z]" "[a-z]" | $TR_BIN -d ' '` + fi + case "$DIST_ARCH" in + 'athlon' | 'i386' | 'i486' | 'i586' | 'i686') + DIST_ARCH="x86" + if [ "${DIST_OS}" = "solaris" ] ; then + DIST_BITS=`isainfo -b` + else + DIST_BITS="32" + fi + ;; + 'amd64' | 'x86_64') + DIST_ARCH="x86" + DIST_BITS="64" + ;; + 'ia32') + DIST_ARCH="ia" + DIST_BITS="32" + ;; + 'ia64' | 'ia64n' | 'ia64w') + DIST_ARCH="ia" + DIST_BITS="64" + ;; + 'ip27') + DIST_ARCH="mips" + DIST_BITS="32" + ;; + 'power' | 'powerpc' | 'power_pc' | 'ppc64') + if [ "${DIST_ARCH}" = "ppc64" ] ; then + DIST_BITS="64" + else + DIST_BITS="32" + fi + DIST_ARCH="ppc" + if [ "${DIST_OS}" = "aix" ] ; then + if [ `getconf KERNEL_BITMODE` -eq 64 ]; then + DIST_BITS="64" + else + DIST_BITS="32" + fi + fi + ;; + 'pa_risc' | 'pa-risc') + DIST_ARCH="parisc" + if [ `getconf KERNEL_BITS` -eq 64 ]; then + DIST_BITS="64" + else + DIST_BITS="32" + fi + ;; + 'sun4u' | 'sparcv9' | 'sparc') + DIST_ARCH="sparc" + DIST_BITS=`isainfo -b` + ;; + '9000/800' | '9000/785') + DIST_ARCH="parisc" + if [ `getconf KERNEL_BITS` -eq 64 ]; then + DIST_BITS="64" + else + DIST_BITS="32" + fi + ;; + '2064' | '2066' | '2084' | '2086' | '2094' | '2096' | '2097' | '2098' | '2817') + DIST_ARCH="390" + DIST_BITS="64" + ;; + armv*) + if [ -z "`readelf -A /proc/self/exe | grep Tag_ABI_VFP_args`" ] ; then + DIST_ARCH="armel" + DIST_BITS="32" + else + DIST_ARCH="armhf" + DIST_BITS="32" + fi + ;; + esac +fi + +# OSX always places Java in the same location so we can reliably set JAVA_HOME +if [ "$DIST_OS" = "macosx" ] +then + if [ -z "$JAVA_HOME" ]; then + if [ -x /usr/libexec/java_home ]; then + JAVA_HOME=`/usr/libexec/java_home`; export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME + fi + fi +fi + +# Test Echo +ECHOTEST=`echo -n "x"` +if [ "$ECHOTEST" = "x" ] +then + ECHOOPT="-n " + ECHOOPTC="" +else + ECHOOPT="" + ECHOOPTC="\c" +fi + + +gettext() { + "$WRAPPER_CMD" --translate "$1" "$WRAPPER_CONF" 2>/dev/null + if [ $? != 0 ] ; then + echo "$1" + fi +} + +outputFile() { + if [ -f "$1" ] + then + eval echo `gettext ' $1 Found but not executable.'`; + else + echo " $1" + fi +} + +# Decide on the wrapper binary to use. +# If the bits of the OS could be detected, we will try to look for the +# binary with the correct bits value. If it doesn't exist, fall back +# and look for the 32-bit binary. If that doesn't exist either then +# look for the default. +WRAPPER_TEST_CMD="" +if [ -f "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-$DIST_BITS" ] +then + WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-$DIST_BITS" + if [ ! -x "$WRAPPER_TEST_CMD" ] + then + chmod +x "$WRAPPER_TEST_CMD" 2>/dev/null + fi + if [ -x "$WRAPPER_TEST_CMD" ] + then + WRAPPER_CMD="$WRAPPER_TEST_CMD" + else + outputFile "$WRAPPER_TEST_CMD" + WRAPPER_TEST_CMD="" + fi +fi +if [ -f "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32" -a -z "$WRAPPER_TEST_CMD" ] +then + WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32" + if [ ! -x "$WRAPPER_TEST_CMD" ] + then + chmod +x "$WRAPPER_TEST_CMD" 2>/dev/null + fi + if [ -x "$WRAPPER_TEST_CMD" ] + then + WRAPPER_CMD="$WRAPPER_TEST_CMD" + else + outputFile "$WRAPPER_TEST_CMD" + WRAPPER_TEST_CMD="" + fi +fi +if [ -f "$WRAPPER_CMD" -a -z "$WRAPPER_TEST_CMD" ] +then + WRAPPER_TEST_CMD="$WRAPPER_CMD" + if [ ! -x "$WRAPPER_TEST_CMD" ] + then + chmod +x "$WRAPPER_TEST_CMD" 2>/dev/null + fi + if [ -x "$WRAPPER_TEST_CMD" ] + then + WRAPPER_CMD="$WRAPPER_TEST_CMD" + else + outputFile "$WRAPPER_TEST_CMD" + WRAPPER_TEST_CMD="" + fi +fi +if [ -z "$WRAPPER_TEST_CMD" ] +then + eval echo `gettext 'Unable to locate any of the following binaries:'` + outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-$DIST_BITS" + if [ ! "$DIST_BITS" = "32" ] + then + outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32" + fi + outputFile "$WRAPPER_CMD" + + exit 1 +fi + + +# Build the nice clause +if [ "X$PRIORITY" = "X" ] +then + CMDNICE="" +else + CMDNICE="nice -$PRIORITY" +fi + +# Build the anchor file clause. +if [ "X$IGNORE_SIGNALS" = "X" ] +then + ANCHORPROP= + IGNOREPROP= +else + ANCHORPROP=wrapper.anchorfile=\"$ANCHORFILE\" + IGNOREPROP=wrapper.ignore_signals=TRUE +fi + +# Build the status file clause. +if [ "X$DETAIL_STATUS$WAIT_FOR_STARTED_STATUS" = "X" ] +then + STATUSPROP= +else + STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\"" +fi + +# Build the command file clause. +if [ -n "$PAUSABLE" ] +then + COMMANDPROP="wrapper.commandfile=\"$COMMANDFILE\" wrapper.pausable=TRUE" +else + COMMANDPROP= +fi + +if [ ! -n "$WAIT_FOR_STARTED_STATUS" ] +then + WAIT_FOR_STARTED_STATUS=true +fi + +if [ $WAIT_FOR_STARTED_STATUS = true ] ; then + DETAIL_STATUS=true +fi + + +# Build the lock file clause. Only create a lock file if the lock directory exists on this platform. +LOCKPROP= +if [ -d $LOCKDIR ] +then + if [ -w $LOCKDIR ] + then + LOCKPROP=wrapper.lockfile=\"$LOCKFILE\" + fi +fi + +# Build app name clause +if [ ! -n "$APP_NAME_PASS_TO_WRAPPER" ] +then + APP_NAME_PASS_TO_WRAPPER=true +fi +if [ $APP_NAME_PASS_TO_WRAPPER = false ] +then + APPNAMEPROP= +else + APPNAMEPROP="wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\"" +fi + +# Decide on run levels. +RUN_LEVEL_S_DIST_OS_TMP=`eval "echo \$\{RUN_LEVEL_S_${DIST_OS}\}"` +RUN_LEVEL_S_DIST_OS=`eval "echo ${RUN_LEVEL_S_DIST_OS_TMP}"` +if [ "X${RUN_LEVEL_S_DIST_OS}" != "X" ] ; then + APP_RUN_LEVEL_S=${RUN_LEVEL_S_DIST_OS} +elif [ "X$RUN_LEVEL_S" != "X" ] ; then + APP_RUN_LEVEL_S=$RUN_LEVEL_S +else + APP_RUN_LEVEL_S=$RUN_LEVEL +fi +APP_RUN_LEVEL_S_CHECK=`echo "$APP_RUN_LEVEL_S" | sed "s/[(0-9)*]/0/g"` +if [ "X${APP_RUN_LEVEL_S_CHECK}" != "X00" ] ; then + eval echo `gettext 'Run level \"${APP_RUN_LEVEL_S}\" must be numeric and have a length of two \(00-99\).'` + exit 1; +fi +RUN_LEVEL_K_DIST_OS_TMP=`eval "echo \$\{RUN_LEVEL_K_${DIST_OS}\}"` +RUN_LEVEL_K_DIST_OS=`eval "echo ${RUN_LEVEL_K_DIST_OS_TMP}"` +if [ "X${RUN_LEVEL_K_DIST_OS}" != "X" ] ; then + APP_RUN_LEVEL_K=${RUN_LEVEL_K_DIST_OS} +elif [ "X$RUN_LEVEL_K" != "X" ] ; then + APP_RUN_LEVEL_K=$RUN_LEVEL_K +else + APP_RUN_LEVEL_K=$RUN_LEVEL +fi +APP_RUN_LEVEL_K_CHECK=`echo "$APP_RUN_LEVEL_K" | sed "s/[(0-9)*]/0/g"` +if [ "X${APP_RUN_LEVEL_K_CHECK}" != "X00" ] ; then + eval echo `gettext 'Run level \"${APP_RUN_LEVEL_K}\" must be numeric and have a length of two \(00-99\).'` + exit 1; +fi + +prepAdditionalParams() { + ADDITIONAL_PARA="" + if [ ! -n "$PASS_THROUGH" ] + then + PASS_THROUGH=false + fi + if [ $PASS_THROUGH = true ] ; then + ADDITIONAL_PARA="--" + while [ -n "$1" ] ; do + ADDITIONAL_PARA="$ADDITIONAL_PARA \"$1\"" + shift + done + elif [ -n "$1" ] ; then + eval echo `gettext "WARNING: Extra arguments will be ignored. Please run \'$0 help\' for usage."` + fi +} + +checkUser() { + # $1 touchLock flag + # $2.. [command] args + + # Check the configured user. If necessary rerun this script as the desired user. + if [ "X$RUN_AS_USER" != "X" ] + then + # Resolve the location of the 'id' command + ID_BIN="/usr/xpg4/bin/id" + if [ ! -x "$ID_BIN" ] + then + ID_BIN="/usr/bin/id" + if [ ! -x "$ID_BIN" ] + then + eval echo `gettext 'Unable to locate "id".'` + eval echo `gettext 'Please report this message along with the location of the command on your system.'` + exit 1 + fi + fi + + if [ "`$ID_BIN -u -n`" = "$RUN_AS_USER" ] + then + # Already running as the configured user. Avoid password prompts by not calling su. + RUN_AS_USER="" + fi + fi + if [ "X$RUN_AS_USER" != "X" ] + then + if [ "`$ID_BIN -u -n "$RUN_AS_USER" 2>/dev/null`" != "$RUN_AS_USER" ] + then + eval echo `gettext 'User $RUN_AS_USER does not exist.'` + exit 1 + fi + + # If LOCKPROP and $RUN_AS_USER are defined then the new user will most likely not be + # able to create the lock file. The Wrapper will be able to update this file once it + # is created but will not be able to delete it on shutdown. If $1 is set then + # the lock file should be created for the current command + if [ "X$LOCKPROP" != "X" ] + then + if [ "X$1" != "X" ] + then + # Resolve the primary group + RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1` + if [ "X$RUN_AS_GROUP" = "X" ] + then + RUN_AS_GROUP=$RUN_AS_USER + fi + touch $LOCKFILE + chown $RUN_AS_USER:$RUN_AS_GROUP $LOCKFILE + fi + fi + + # Still want to change users, recurse. This means that the user will only be + # prompted for a password once. Variables shifted by 1 + shift + + # Wrap the parameters so they can be passed. + ADDITIONAL_PARA="" + while [ -n "$1" ] ; do + if [ "$1" = 'installstart' ] ; then + # At this point the service is already installed. When we will fork the process we only need to start the service. + ADDITIONAL_PARA="$ADDITIONAL_PARA \"start\"" + else + ADDITIONAL_PARA="$ADDITIONAL_PARA \"$1\"" + fi + shift + done + + # Use "runuser" if this exists. + # runuser should be used on RedHat in preference to su. + if test -f "/sbin/runuser" + then + /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA" + else + $SU_BIN - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA" $SU_OPTS + fi + RUN_AS_USER_EXITCODE=$? + + # we check if the previous command has failed + if [ $RUN_AS_USER_EXITCODE -ne 0 ] + then + if [ $RUN_AS_USER_EXITCODE -eq 1 ] + then + checkForkCommand + else + eval echo `gettext 'Error executing the requested command with user \"$RUN_AS_USER\" \(error code $RUN_AS_USER_EXITCODE\).'` + echo "" + fi + fi + + # Now that we are the original user again, we may need to clean up the lock file. + if [ "X$LOCKPROP" != "X" ] + then + getpid + if [ "X$pid" = "X" ] + then + # Wrapper is not running so make sure the lock file is deleted. + if [ -f "$LOCKFILE" ] + then + rm "$LOCKFILE" + fi + fi + fi + + exit $RUN_AS_USER_EXITCODE + fi +} + +# Try to fork by executing a simple command. +# With this function, we want to make sure we are able to fork. +checkForkCommand() { + + if test -f "/sbin/runuser" + then + /sbin/runuser - $RUN_AS_USER -c "ls \"$REALPATH\"" > /dev/null 2>&1 & + else + $SU_BIN - $RUN_AS_USER -c "ls \"$REALPATH\"" $SU_OPTS > /dev/null 2>&1 & + fi + CHECK_EXITCODE=$? + + if [ $CHECK_EXITCODE -ne 0 ] + then + # clearly a problem with forking + eval echo `gettext 'Error: unable to create fork process.'` + eval echo `gettext 'Advice:'` + eval echo `gettext 'One possible cause of failure is when the user \(\"$RUN_AS_USER\"\) has no shell.'` + eval echo `gettext 'In this case, two solutions are available by editing the script file:'` + eval echo `gettext '1. Use \"SU_OPTS\" to set the shell for the user.'` + eval echo `gettext '2. Use a OS service management tool (only available on some platforms).'` + echo "" + fi +} + +getpid() { + pid="" + if [ -f "$PIDFILE" ] + then + if [ -r "$PIDFILE" ] + then + pid=`cat "$PIDFILE"` + if [ "X$pid" != "X" ] + then + if [ "X$PIDFILE_CHECK_PID" != "X" ] + then + # It is possible that 'a' process with the pid exists but that it is not the + # correct process. This can happen in a number of cases, but the most + # common is during system startup after an unclean shutdown. + # The ps statement below looks for the specific wrapper command running as + # the pid. If it is not found then the pid file is considered to be stale. + case "$DIST_OS" in + 'freebsd') + pidtest=`$PS_BIN -p $pid -o args | tail -1` + if [ "X$pidtest" = "XCOMMAND" ] + then + pidtest="" + fi + ;; + 'macosx') + pidtest=`$PS_BIN -ww -p $pid -o command | grep -F "$WRAPPER_CMD" | tail -1` + ;; + 'solaris') + if [ -f "/usr/bin/pargs" ] + then + pidtest=`pargs $pid | fgrep "$WRAPPER_CMD" | tail -1` + else + case "$PS_BIN" in + '/usr/ucb/ps') + pidtest=`$PS_BIN -auxww $pid | fgrep "$WRAPPER_CMD" | tail -1` + ;; + '/usr/bin/ps') + TRUNCATED_CMD=`$PS_BIN -o comm -p $pid | tail -1` + COUNT=`echo $TRUNCATED_CMD | wc -m` + COUNT=`echo ${COUNT}` + COUNT=`expr $COUNT - 1` + TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT` + pidtest=`$PS_BIN -o comm -p $pid | fgrep "$TRUNCATED_CMD" | tail -1` + ;; + '/bin/ps') + TRUNCATED_CMD=`$PS_BIN -o comm -p $pid | tail -1` + COUNT=`echo $TRUNCATED_CMD | wc -m` + COUNT=`echo ${COUNT}` + COUNT=`expr $COUNT - 1` + TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT` + pidtest=`$PS_BIN -o comm -p $pid | fgrep "$TRUNCATED_CMD" | tail -1` + ;; + *) + echo "Unsupported ps command $PS_BIN" + exit 1 + ;; + esac + fi + ;; + 'hpux') + pidtest=`$PS_BIN -p $pid -x -o args | grep -F "$WRAPPER_CMD" | tail -1` + ;; + 'zos') + TRUNCATED_CMD=`$PS_BIN -p $pid -o args | tail -1` + COUNT=`echo $TRUNCATED_CMD | wc -m` + COUNT=`echo ${COUNT}` + COUNT=`expr $COUNT - 1` + TRUNCATED_CMD=`echo $WRAPPER_CMD | cut -c1-$COUNT` + pidtest=`$PS_BIN -p $pid -o args | grep -F "$TRUNCATED_CMD" | tail -1` + ;; + *) + pidtest=`$PS_BIN -p $pid -o args | grep -F "$WRAPPER_CMD" | tail -1` + ;; + esac + else + # Check to see whether the pid exists as a running process, but in this mode, don't check what that pid is. + case "$DIST_OS" in + 'solaris') + case "$PS_BIN" in + '/usr/ucb/ps') + pidtest=`$PS_BIN $pid | grep "$pid" | awk '{print $1}' | tail -1` + ;; + '/usr/bin/ps') + pidtest=`$PS_BIN -p $pid -o pid | grep "$pid" | tail -1` + ;; + '/bin/ps') + pidtest=`$PS_BIN -p $pid -o pid | grep "$pid" | tail -1` + ;; + *) + echo "Unsupported ps command $PS_BIN" + exit 1 + ;; + esac + ;; + *) + pidtest=`$PS_BIN -p $pid -o pid | grep "$pid" | tail -1` + ;; + esac + fi + + if [ "X$pidtest" = "X" ] + then + # This is a stale pid file. + rm -f "$PIDFILE" + eval echo `gettext 'Removed stale pid file: $PIDFILE'` + pid="" + fi + fi + else + eval echo `gettext 'Cannot read $PIDFILE.'` + exit 1 + fi + fi +} + +getstatus() { + STATUS= + if [ -f "$STATUSFILE" ] + then + if [ -r "$STATUSFILE" ] + then + STATUS=`cat "$STATUSFILE"` + fi + fi + if [ "X$STATUS" = "X" ] + then + STATUS="Unknown" + fi + + JAVASTATUS= + if [ -f "$JAVASTATUSFILE" ] + then + if [ -r "$JAVASTATUSFILE" ] + then + JAVASTATUS=`cat "$JAVASTATUSFILE"` + fi + fi + if [ "X$JAVASTATUS" = "X" ] + then + JAVASTATUS="Unknown" + fi +} + +testpid() { + case "$DIST_OS" in + 'solaris') + case "$PS_BIN" in + '/usr/ucb/ps') + pid=`$PS_BIN $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` + ;; + '/usr/bin/ps') + pid=`$PS_BIN -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` + ;; + '/bin/ps') + pid=`$PS_BIN -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` + ;; + *) + echo "Unsupported ps command $PS_BIN" + exit 1 + ;; + esac + ;; + *) + pid=`$PS_BIN -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` 2>/dev/null + ;; + esac + if [ "X$pid" = "X" ] + then + # Process is gone so remove the pid file. + rm -f "$PIDFILE" + pid="" + fi +} + +launchdtrap() { + stopit + exit +} + +waitforwrapperstop() { + getpid + while [ "X$pid" != "X" ] ; do + sleep 1 + getpid + done +} + +launchinternal() { + getpid + trap launchdtrap TERM + if [ "X$pid" = "X" ] + then + prepAdditionalParams "$@" + + # The string passed to eval must handles spaces in paths correctly. + COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $APPNAMEPROP $ANCHORPROP $IGNOREPROP $STATUSPROP $COMMANDPROP $LOCKPROP wrapper.script.version=3.5.28 $ADDITIONAL_PARA" + eval $COMMAND_LINE + else + eval echo `gettext '$APP_LONG_NAME is already running.'` + exit 1 + fi + # launchd expects that this script stay up and running so we need to do our own monitoring of the Wrapper process. + if [ $WAIT_FOR_STARTED_STATUS = true ] + then + waitforwrapperstop + fi +} + +console() { + eval echo `gettext 'Running $APP_LONG_NAME...'` + getpid + if [ "X$pid" = "X" ] + then + trap '' 3 + + prepAdditionalParams "$@" + + # The string passed to eval must handles spaces in paths correctly. + COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" $APPNAMEPROP $ANCHORPROP $STATUSPROP $COMMANDPROP $LOCKPROP wrapper.script.version=3.5.28 $ADDITIONAL_PARA" + eval $COMMAND_LINE + else + eval echo `gettext '$APP_LONG_NAME is already running.'` + exit 1 + fi +} + +waitforjavastartup() { + getstatus + eval echo $ECHOOPT `gettext 'Waiting for $APP_LONG_NAME...$ECHOOPTC'` + + # Wait until the timeout or we have something besides Unknown. + counter=15 + while [ "$JAVASTATUS" = "Unknown" -a $counter -gt 0 -a -n "$JAVASTATUS" ] ; do + echo $ECHOOPT".$ECHOOPTC" + sleep 1 + getstatus + counter=`expr $counter - 1` + done + + if [ -n "$WAIT_FOR_STARTED_TIMEOUT" ] ; then + counter=$WAIT_FOR_STARTED_TIMEOUT + else + counter=120 + fi + while [ "$JAVASTATUS" != "STARTED" -a "$JAVASTATUS" != "Unknown" -a $counter -gt 0 -a -n "$JAVASTATUS" ] ; do + echo $ECHOOPT".$ECHOOPTC" + sleep 1 + getstatus + counter=`expr $counter - 1` + done + echo "" +} + +startwait() { + if [ $WAIT_FOR_STARTED_STATUS = true ] + then + waitforjavastartup + fi + # Sleep for a few seconds to allow for intialization if required + # then test to make sure we're still running. + # + i=0 + while [ $i -lt $WAIT_AFTER_STARTUP ] + do + sleep 1 + echo $ECHOOPT".$ECHOOPTC" + i=`expr $i + 1` + done + if [ $WAIT_AFTER_STARTUP -gt 0 -o $WAIT_FOR_STARTED_STATUS = true ] + then + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext ' WARNING: $APP_LONG_NAME may have failed to start.'` + exit 1 + else + eval echo `gettext ' running: PID:$pid'` + fi + else + echo "" + fi +} + +mustBeRootOrExit() { + if [ `id | sed 's/^uid=//;s/(.*$//'` != "0" ] ; then + eval echo `gettext 'Must be root to perform this action.'` + exit 1 + fi +} + + +macosxStart() { + # The daemon has been installed. + eval echo `gettext 'Starting $APP_LONG_NAME. Detected Mac OSX and installed launchd daemon.'` + mustBeRootOrExit + + getpid + if [ "X$pid" != "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is already running.'` + exit 1 + fi + + # If the daemon was just installed, it may not be loaded. + LOADED_PLIST=`launchctl list | grep ${APP_PLIST_BASE}` + if [ "X${LOADED_PLIST}" = "X" ] ; then + launchctl load /Library/LaunchDaemons/${APP_PLIST} + fi + # If launchd is set to run the daemon already at Load, we don't need to call start + getpid + if [ "X$pid" = "X" ] ; then + launchctl start ${APP_PLIST_BASE} + fi + + startwait +} + +macosxStop() { + # The daemon should be running. + eval echo `gettext 'Stopping $APP_LONG_NAME...'` + mustBeRootOrExit + + getpid + if [ "X$pid" = "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is not running.'` + exit 1 + else + if [ "$MACOSX_KEEP_RUNNING" = "true" ] ; then + echo "" + eval echo `gettext 'Daemon is set to be kept continuously running and it will be automatically restarted.'` + eval echo `gettext 'To stop the daemon you need to uninstall it.'` + eval echo `gettext 'If you want to use the \"stop\" argument, you need to find MACOSX_KEEP_RUNNING'` + eval echo `gettext 'at the beginning of the script file and set it to \"false\".'` + echo "" + fi + launchctl stop ${APP_PLIST_BASE} + fi +} + +macosxRestart() { + # The daemon should be running. + eval echo `gettext 'Restarting $APP_LONG_NAME...'` + mustBeRootOrExit + + getpid + if [ "X$pid" = "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is not running.'` + exit 1 + else + if [ "$MACOSX_KEEP_RUNNING" = "true" ] ; then + # by stopping it, launchd will automatically restart it + launchctl stop ${APP_PLIST_BASE} + else + launchctl unload "/Library/LaunchDaemons/${APP_PLIST}" + sleep 1 + launchctl load "/Library/LaunchDaemons/${APP_PLIST}" + fi + fi + + startwait +} + +upstartstart() { + # The daemon has been installed. + eval echo `gettext 'Starting $APP_LONG_NAME. Detected Linux and installed upstart.'` + mustBeRootOrExit + + getpid + if [ "X$pid" != "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is already running.'` + exit 1 + fi + + /sbin/start ${APP_NAME} + + startwait +} + +upstartStop() { + # The daemon has been installed. + eval echo `gettext 'Stopping $APP_LONG_NAME...'` + mustBeRootOrExit + + getpid + if [ "X$pid" = "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is not running.'` + exit 1 + fi + + /sbin/stop ${APP_NAME} +} + +upstartRestart() { + # The daemon has been installed. + eval echo `gettext 'Restarting $APP_LONG_NAME...'` + mustBeRootOrExit + + getpid + if [ "X$pid" = "X" ] ; then + eval echo `gettext '$APP_LONG_NAME is not running.'` + exit 1 + fi + + /sbin/restart ${APP_NAME} + + startwait +} + +systemdInstall() { + eval echo `gettext ' Installing the $APP_LONG_NAME daemon using systemd...'` + if [ -f "${REALDIR}/${APP_NAME}.service" ] ; then + eval echo `gettext ' a custom service file ${APP_NAME}.service found'` + cp "${REALDIR}/${APP_NAME}.service" "${SYSTEMD_SERVICE_FILE}" + else + eval echo `gettext ' creating default service file...'` + echo "[Unit]" > "${SYSTEMD_SERVICE_FILE}" + echo "Description=${APP_LONG_NAME}" >> "${SYSTEMD_SERVICE_FILE}" + echo "After=syslog.target" >> "${SYSTEMD_SERVICE_FILE}" + echo "" >> "${SYSTEMD_SERVICE_FILE}" + echo "[Service]" >> "${SYSTEMD_SERVICE_FILE}" + echo "Type=forking" >> "${SYSTEMD_SERVICE_FILE}" + echo "ExecStart=${REALPATH} start sysd" >> "${SYSTEMD_SERVICE_FILE}" + echo "ExecStop=${REALPATH} stop sysd" >> "${SYSTEMD_SERVICE_FILE}" + if [ "X${RUN_AS_USER}" != "X" ] ; then + echo "User=${RUN_AS_USER}" >> "${SYSTEMD_SERVICE_FILE}" + fi + echo "" >> "${SYSTEMD_SERVICE_FILE}" + echo "[Install]" >> "${SYSTEMD_SERVICE_FILE}" + echo "WantedBy=multi-user.target" >> "${SYSTEMD_SERVICE_FILE}" + + systemctl daemon-reload + systemctl enable "${APP_NAME}" + fi +} + +systemdStart() { + # check if the service file is present + if [ -f "${SYSTEMD_SERVICE_FILE}" ] ; then + eval echo `gettext 'Reading file ${SYSTEMD_SERVICE_FILE}'` + else + eval echo `gettext 'No service file detected. Did you install the service?'` + exit 1 + fi + + systemctl start $APP_NAME + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to start service $APP_NAME'` + exit 1 + fi + + startwait +} + +systemdStop() { + systemctl stop $APP_NAME + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to stop service $APP_NAME'` + exit 1 + fi +} + +systemdRestart() { + systemctl restart $APP_NAME + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to restart service $APP_NAME'` + exit 1 + fi + + startwait +} + +systemdRemove() { + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon from systemd...'` + systemctl disable $APP_NAME + rm "/etc/systemd/system/${APP_NAME}.service" + systemctl daemon-reload +} + +srcInstall() { + if [ "X$RUN_AS_USER" = "X" ] ; then + USERID="0" + else + USERID=`$ID_BIN -u "$RUN_AS_USER"` + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to get user id for $RUN_AS_USER'` + exit 1 + fi + fi + /usr/bin/mkssys -s "$APP_NAME" -p "$REALPATH" -a "launchdinternal" -u "$USERID" -f 9 -n 15 -S + /usr/sbin/mkitab "$APP_NAME":2:once:"/usr/bin/startsrc -s \"${APP_NAME}\" >/dev/console 2>&1" +} + +srcStart() { + startsrc -s "${APP_NAME}" + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to start service $APP_NAME'` + exit 1 + fi + + startwait +} + +srcStop() { + stopsrc -s "${APP_NAME}" + if [ $? -ne 0 ] ; then + eval echo `gettext 'Failed to stop service $APP_NAME'` + exit 1 + fi +} + +srcRestart() { + srcStop + srcStart +} + +start() { + eval echo `gettext 'Starting $APP_LONG_NAME...'` + getpid + if [ "X$pid" = "X" ] + then + prepAdditionalParams "$@" + + # The string passed to eval must handles spaces in paths correctly. + COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $APPNAMEPROP $ANCHORPROP $IGNOREPROP $STATUSPROP $COMMANDPROP $LOCKPROP wrapper.script.version=3.5.28 $ADDITIONAL_PARA" + eval $COMMAND_LINE + else + eval echo `gettext '$APP_LONG_NAME is already running.'` + exit 1 + fi + + startwait +} + +stopit() { + # $1 exit if down flag + + eval echo `gettext 'Stopping $APP_LONG_NAME...'` + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext '$APP_LONG_NAME was not running.'` + if [ "X$1" = "X1" ] + then + exit 1 + fi + else + if [ "X$IGNORE_SIGNALS" = "X" ] + then + # Running so try to stop it. + kill $pid + if [ $? -ne 0 ] + then + # An explanation for the failure should have been given + eval echo `gettext 'Unable to stop $APP_LONG_NAME.'` + exit 1 + fi + else + rm -f "$ANCHORFILE" + if [ -f "$ANCHORFILE" ] + then + # An explanation for the failure should have been given + eval echo `gettext 'Unable to stop $APP_LONG_NAME.'` + exit 1 + fi + fi + + # We can not predict how long it will take for the wrapper to + # actually stop as it depends on settings in wrapper.conf. + # Loop until it does. + savepid=$pid + CNT=0 + TOTCNT=0 + while [ "X$pid" != "X" ] + do + # Show a waiting message every 5 seconds. + if [ "$CNT" -lt "5" ] + then + CNT=`expr $CNT + 1` + else + eval echo `gettext 'Waiting for $APP_LONG_NAME to exit...'` + CNT=0 + fi + TOTCNT=`expr $TOTCNT + 1` + + sleep 1 + + testpid + done + + pid=$savepid + testpid + if [ "X$pid" != "X" ] + then + eval echo `gettext 'Failed to stop $APP_LONG_NAME.'` + exit 1 + else + eval echo `gettext 'Stopped $APP_LONG_NAME.'` + fi + fi +} + +pause() { + eval echo `gettext 'Pausing $APP_LONG_NAME.'` +} + +resume() { + eval echo `gettext 'Resuming $APP_LONG_NAME.'` +} + +status() { + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext '$APP_LONG_NAME is not running.'` + exit 1 + else + if [ "X$DETAIL_STATUS" = "X" ] + then + eval echo `gettext '$APP_LONG_NAME is running: PID:$pid'` + else + getstatus + eval echo `gettext '$APP_LONG_NAME is running: PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS'` + fi + exit 0 + fi +} + +# Make sure APP_NAME is less than 14 characters, otherwise in AIX, the command +# "lsitab" will fail +validateAppNameLength() { + if [ ${#APP_NAME} -gt 14 ] ; then + eval echo `gettext ' APP_NAME (${APP_NAME}) must be less than 14 characters long'` + exit 1 + fi +} + +installUpstart() { + eval echo `gettext ' Installing the $APP_LONG_NAME daemon using upstart..'` + if [ -f "${REALDIR}/${APP_NAME}.install" ] ; then + eval echo `gettext ' a custom upstart conf file ${APP_NAME}.install found'` + cp "${REALDIR}/${APP_NAME}.install" "/etc/init/${APP_NAME}.conf" + else + eval echo `gettext ' creating default upstart conf file..'` + echo "# ${APP_NAME} - ${APP_LONG_NAME}" > "/etc/init/${APP_NAME}.conf" + echo "description \"${APP_LONG_NAME}\"" >> "/etc/init/${APP_NAME}.conf" + echo "author \"Tanuki Software Ltd. \"" >> "/etc/init/${APP_NAME}.conf" + echo "start on runlevel [2345]" >> "/etc/init/${APP_NAME}.conf" + echo "stop on runlevel [!2345]" >> "/etc/init/${APP_NAME}.conf" + echo "env LANG=${LANG}" >> "/etc/init/${APP_NAME}.conf" + echo "exec \"${REALPATH}\" upstartinternal" >> "/etc/init/${APP_NAME}.conf" + fi +} + +installdaemon() { + mustBeRootOrExit + + APP_NAME_LOWER=`echo "$APP_NAME" | $TR_BIN "[A-Z]" "[a-z]"` + if [ "$DIST_OS" = "solaris" ] ; then + eval echo `gettext 'Detected Solaris:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + ln -s "$REALPATH" "/etc/init.d/$APP_NAME" + for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do + eval echo `gettext ' Removing unexpected file before proceeding: $i'` + rm -f $i + done + ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER" + ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER" + fi + elif [ "$DIST_OS" = "linux" ] ; then + if [ -f /etc/redhat-release -o -f /etc/redhat_version -o -f /etc/fedora-release ] ; then + eval echo `gettext 'Detected RHEL or Fedora:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" -o -f "/etc/init/${APP_NAME}.conf" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + elif [ -n "$USE_SYSTEMD" -a -d "/etc/systemd" ] ; then + systemdInstall + else + if [ -n "$USE_UPSTART" -a -d "/etc/init" ] ; then + installUpstart + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + ln -s "$REALPATH" "/etc/init.d/$APP_NAME" + /sbin/chkconfig --add "$APP_NAME" + /sbin/chkconfig "$APP_NAME" on + fi + fi + elif [ -f /etc/SuSE-release ] ; then + eval echo `gettext 'Detected SuSE or SLES:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + elif [ -n "$USE_SYSTEMD" -a -d "/etc/systemd" ] ; then + systemdInstall + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + ln -s "$REALPATH" "/etc/init.d/$APP_NAME" + insserv "/etc/init.d/$APP_NAME" + fi + elif [ -f /etc/lsb-release -o -f /etc/debian_version -o -f /etc/debian_release ] ; then + eval echo `gettext 'Detected Ubuntu or Debian:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" -o -f "/etc/init/${APP_NAME}.conf" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + if [ -n "$USE_SYSTEMD" -a -d "/etc/systemd" ] ; then + systemdInstall + elif [ -n "$USE_UPSTART" -a -d "/etc/init" ] ; then + installUpstart + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon using init.d..'` + ln -s "$REALPATH" "/etc/init.d/$APP_NAME" + update-rc.d "$APP_NAME" defaults + fi + fi + else + eval echo `gettext 'Detected Linux:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + ln -s "$REALPATH" /etc/init.d/$APP_NAME + for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc5.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" "/etc/rc5.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do + eval echo `gettext ' Removing unexpected file before proceeding: $i'` + rm -f $i + done + ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER" + ln -s "/etc/init.d/$APP_NAME" "/etc/rc3.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER" + ln -s "/etc/init.d/$APP_NAME" "/etc/rc5.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER" + ln -s "/etc/init.d/$APP_NAME" "/etc/rc5.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER" + fi + fi + elif [ "$DIST_OS" = "hpux" ] ; then + eval echo `gettext 'Detected HP-UX:'` + if [ -f "/sbin/init.d/$APP_NAME" -o -L "/sbin/init.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + ln -s "$REALPATH" "/sbin/init.d/$APP_NAME" + for i in `ls "/sbin/rc3.d/K"??"$APP_NAME_LOWER" "/sbin/rc3.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do + eval echo `gettext ' Removing unexpected file before proceeding: $i'` + rm -f $i + done + ln -s "/sbin/init.d/$APP_NAME" "/sbin/rc3.d/K${APP_RUN_LEVEL_K}$APP_NAME_LOWER" + ln -s "/sbin/init.d/$APP_NAME" "/sbin/rc3.d/S${APP_RUN_LEVEL_S}$APP_NAME_LOWER" + fi + elif [ "$DIST_OS" = "aix" ] ; then + eval echo `gettext 'Detected AIX:'` + validateAppNameLength + if [ -f "/etc/rc.d/init.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed as rc.d script.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + elif [ -n "`/usr/sbin/lsitab $APP_NAME`" -a -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed as SRC service.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + if [ -n "`/usr/sbin/lsitab install_assist`" ] ; then + eval echo `gettext ' The task /usr/sbin/install_assist was found in the inittab, this might cause problems for all subsequent tasks to launch at this process is known to block the init task. Please make sure this task is not needed anymore and remove/deactivate it.'` + fi + for i in `ls "/etc/rc.d/rc2.d/K"??"$APP_NAME_LOWER" "/etc/rc.d/rc2.d/S"??"$APP_NAME_LOWER" 2>/dev/null` ; do + eval echo `gettext ' Removing unexpected file before proceeding: $i'` + rm -f $i + done + srcInstall + fi + elif [ "$DIST_OS" = "freebsd" ] ; then + eval echo `gettext 'Detected FreeBSD:'` + if [ -f "/etc/rc.d/$APP_NAME" -o -L "/etc/rc.d/$APP_NAME" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + sed -i .bak "/${APP_NAME}_enable=\"YES\"/d" /etc/rc.conf + if [ -f "${REALDIR}/${APP_NAME}.install" ] ; then + ln -s "${REALDIR}/${APP_NAME}.install" "/etc/rc.d/$APP_NAME" + else + echo '#!/bin/sh' > "/etc/rc.d/$APP_NAME" + echo "#" >> "/etc/rc.d/$APP_NAME" + echo "# PROVIDE: $APP_NAME" >> "/etc/rc.d/$APP_NAME" + echo "# REQUIRE: NETWORKING" >> "/etc/rc.d/$APP_NAME" + echo "# KEYWORD: shutdown" >> "/etc/rc.d/$APP_NAME" + echo ". /etc/rc.subr" >> "/etc/rc.d/$APP_NAME" + echo "name=\"$APP_NAME\"" >> "/etc/rc.d/$APP_NAME" + echo "rcvar=\`set_rcvar\`" >> "/etc/rc.d/$APP_NAME" + echo "command=\"${REALPATH}\"" >> "/etc/rc.d/$APP_NAME" + echo 'start_cmd="${name}_start"' >> "/etc/rc.d/$APP_NAME" + echo 'load_rc_config $name' >> "/etc/rc.d/$APP_NAME" + echo 'status_cmd="${name}_status"' >> "/etc/rc.d/$APP_NAME" + echo 'stop_cmd="${name}_stop"' >> "/etc/rc.d/$APP_NAME" + echo "${APP_NAME}_status() {" >> "/etc/rc.d/$APP_NAME" + echo '${command} status' >> "/etc/rc.d/$APP_NAME" + echo '}' >> "/etc/rc.d/$APP_NAME" + echo "${APP_NAME}_stop() {" >> "/etc/rc.d/$APP_NAME" + echo '${command} stop' >> "/etc/rc.d/$APP_NAME" + echo '}' >> "/etc/rc.d/$APP_NAME" + echo "${APP_NAME}_start() {" >> "/etc/rc.d/$APP_NAME" + echo '${command} start' >> "/etc/rc.d/$APP_NAME" + echo '}' >> "/etc/rc.d/$APP_NAME" + echo 'run_rc_command "$1"' >> "/etc/rc.d/$APP_NAME" + fi + echo "${APP_NAME}_enable=\"YES\"" >> /etc/rc.conf + chmod 555 "/etc/rc.d/$APP_NAME" + fi + elif [ "$DIST_OS" = "macosx" ] ; then + eval echo `gettext 'Detected Mac OSX:'` + if [ -f "/Library/LaunchDaemons/${APP_PLIST}" -o -L "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + if [ -f "${REALDIR}/${APP_PLIST}" ] ; then + ln -s "${REALDIR}/${APP_PLIST}" "/Library/LaunchDaemons/${APP_PLIST}" + else + echo "" > "/Library/LaunchDaemons/${APP_PLIST}" + echo "> "/Library/LaunchDaemons/${APP_PLIST}" + echo "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo "" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " " >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " Label" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " ${APP_PLIST_BASE}" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " ProgramArguments" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " " >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " ${REALPATH}" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " launchdinternal" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " " >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " ${KEY_KEEP_ALIVE}" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " <${MACOSX_KEEP_RUNNING}/>" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " RunAtLoad" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " " >> "/Library/LaunchDaemons/${APP_PLIST}" + if [ "X$RUN_AS_USER" != "X" ] ; then + echo " UserName" >> "/Library/LaunchDaemons/${APP_PLIST}" + echo " ${RUN_AS_USER}" >> "/Library/LaunchDaemons/${APP_PLIST}" + fi + echo " " >> "/Library/LaunchDaemons/${APP_PLIST}" + echo "" >> "/Library/LaunchDaemons/${APP_PLIST}" + fi + chmod 555 "/Library/LaunchDaemons/${APP_PLIST}" + fi + elif [ "$DIST_OS" = "zos" ] ; then + eval echo `gettext 'Detected z/OS:'` + if [ -f /etc/rc.bak ] ; then + eval echo `gettext ' The $APP_LONG_NAME daemon is already installed.'` + if [ "$COMMAND" != 'installstart' ] ; then + exit 1 + fi + else + eval echo `gettext ' Installing the $APP_LONG_NAME daemon..'` + cp /etc/rc /etc/rc.bak + sed "s:echo /etc/rc script executed, \`date\`::g" /etc/rc.bak > /etc/rc + echo "_BPX_JOBNAME='${APP_NAME}' \"${REALDIR}/${APP_NAME}\" start" >>/etc/rc + echo '/etc/rc script executed, `date`' >>/etc/rc + fi + else + eval echo `gettext 'Install not currently supported for $DIST_OS'` + exit 1 + fi +} + +startdaemon() { + if [ "$DIST_OS" = "macosx" ] ; then + if [ ! -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + eval echo `gettext 'The $APP_LONG_NAME daemon is not currently installed.'` + else + macosxStart + fi + elif [ "$DIST_OS" = "linux" -a -f "/etc/init/${APP_NAME}.conf" ] ; then + upstartstart + elif [ "$DIST_OS" = "linux" -a -n "$USE_SYSTEMD" -a -z "$SYSD" ] ; then + systemdStart + elif [ "$DIST_OS" = "aix" ] && [ -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + srcStart + else + if [ -n "$SYSD" ] ; then + shift + fi + + checkUser touchlock "$@" + if [ ! -n "$FIXED_COMMAND" ] ; then + shift + fi + start "$@" + fi +} + +removedaemon() { + mustBeRootOrExit + + APP_NAME_LOWER=`echo "$APP_NAME" | $TR_BIN "[A-Z]" "[a-z]"` + if [ "$DIST_OS" = "solaris" ] ; then + eval echo `gettext 'Detected Solaris:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" "/etc/init.d/$APP_NAME" 2>/dev/null` ; do + rm -f $i + done + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ "$DIST_OS" = "linux" ] ; then + if [ -f /etc/redhat-release -o -f /etc/redhat_version -o -f /etc/fedora-release ] ; then + eval echo `gettext 'Detected RHEL or Fedora:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + /sbin/chkconfig "$APP_NAME" off + /sbin/chkconfig --del "$APP_NAME" + rm -f "/etc/init.d/$APP_NAME" + elif [ -n "$USE_SYSTEMD" -a -f "${SYSTEMD_SERVICE_FILE}" ] ; then + systemdRemove + elif [ -f "/etc/init/${APP_NAME}.conf" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon from upstart...'` + rm "/etc/init/${APP_NAME}.conf" + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ -f /etc/SuSE-release ] ; then + eval echo `gettext 'Detected SuSE or SLES:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + insserv -r "/etc/init.d/$APP_NAME" + rm -f "/etc/init.d/$APP_NAME" + elif [ -n "$USE_SYSTEMD" -a -f "${SYSTEMD_SERVICE_FILE}" ] ; then + systemdRemove + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ -f /etc/lsb-release -o -f /etc/debian_version -o -f /etc/debian_release ] ; then + eval echo `gettext 'Detected Ubuntu or Debian:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon from init.d...'` + update-rc.d -f "$APP_NAME" remove + rm -f "/etc/init.d/$APP_NAME" + elif [ -n "$USE_SYSTEMD" -a -f "${SYSTEMD_SERVICE_FILE}" ] ; then + systemdRemove + elif [ -f "/etc/init/${APP_NAME}.conf" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon from upstart...'` + rm "/etc/init/${APP_NAME}.conf" + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + else + eval echo `gettext 'Detected Linux:'` + if [ -f "/etc/init.d/$APP_NAME" -o -L "/etc/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + for i in `ls "/etc/rc3.d/K"??"$APP_NAME_LOWER" "/etc/rc5.d/K"??"$APP_NAME_LOWER" "/etc/rc3.d/S"??"$APP_NAME_LOWER" "/etc/rc5.d/S"??"$APP_NAME_LOWER" "/etc/init.d/$APP_NAME" 2>/dev/null` ; do + rm -f $i + done + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + fi + elif [ "$DIST_OS" = "hpux" ] ; then + eval echo `gettext 'Detected HP-UX:'` + if [ -f "/sbin/init.d/$APP_NAME" -o -L "/sbin/init.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + for i in `ls "/sbin/rc3.d/K"??"$APP_NAME_LOWER" "/sbin/rc3.d/S"??"$APP_NAME_LOWER" "/sbin/init.d/$APP_NAME" 2>/dev/null` ; do + rm -f $i + done + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ "$DIST_OS" = "aix" ] ; then + eval echo `gettext 'Detected AIX:'` + validateAppNameLength + if [ -f "/etc/rc.d/init.d/$APP_NAME" -o -L "/etc/rc.d/init.d/$APP_NAME" -o -n "`/usr/sbin/lsitab $APP_NAME`" -o -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + if [ -f "/etc/rc.d/init.d/$APP_NAME" -o -L "/etc/rc.d/init.d/$APP_NAME" ] ; then + for i in `ls "/etc/rc.d/rc2.d/K"??"$APP_NAME_LOWER" "/etc/rc.d/rc2.d/S"??"$APP_NAME_LOWER" "/etc/rc.d/init.d/$APP_NAME" 2>/dev/null` ; do + rm -f $i + done + fi + if [ -n "`/usr/sbin/lsitab $APP_NAME`" -o -n "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + /usr/sbin/rmitab $APP_NAME + /usr/bin/rmssys -s $APP_NAME + fi + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ "$DIST_OS" = "freebsd" ] ; then + eval echo `gettext 'Detected FreeBSD:'` + if [ -f "/etc/rc.d/$APP_NAME" -o -L "/etc/rc.d/$APP_NAME" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + for i in "/etc/rc.d/$APP_NAME" + do + rm -f $i + done + sed -i .bak "/${APP_NAME}_enable=\"YES\"/d" /etc/rc.conf + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ "$DIST_OS" = "macosx" ] ; then + eval echo `gettext 'Detected Mac OSX:'` + if [ -f "/Library/LaunchDaemons/${APP_PLIST}" -o -L "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + # Make sure the plist is installed + LOADED_PLIST=`launchctl list | grep ${APP_PLIST_BASE}` + if [ "X${LOADED_PLIST}" != "X" ] ; then + launchctl unload "/Library/LaunchDaemons/${APP_PLIST}" + fi + rm -f "/Library/LaunchDaemons/${APP_PLIST}" + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + elif [ "$DIST_OS" = "zos" ] ; then + eval echo `gettext 'Detected z/OS:'` + if [ -f /etc/rc.bak ] ; then + stopit "0" + eval echo `gettext ' Removing $APP_LONG_NAME daemon...'` + cp /etc/rc /etc/rc.bak + sed "s/_BPX_JOBNAME=\'APP_NAME\'.*//g" /etc/rc.bak > /etc/rc + rm /etc/rc.bak + else + eval echo `gettext ' The $APP_LONG_NAME daemon is not currently installed.'` + exit 1 + fi + else + eval echo `gettext 'Remove not currently supported for $DIST_OS'` + exit 1 + fi +} + +dump() { + eval echo `gettext 'Dumping $APP_LONG_NAME...'` + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext '$APP_LONG_NAME was not running.'` + else + kill -3 $pid + + if [ $? -ne 0 ] + then + eval echo `gettext 'Failed to dump $APP_LONG_NAME.'` + exit 1 + else + eval echo `gettext 'Dumped $APP_LONG_NAME.'` + fi + fi +} + +# Used by HP-UX init scripts. +startmsg() { + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext 'Starting $APP_LONG_NAME... Wrapper:Stopped'` + else + if [ "X$DETAIL_STATUS" = "X" ] + then + eval echo `gettext 'Starting $APP_LONG_NAME... Wrapper:Running'` + else + getstatus + eval echo `gettext 'Starting $APP_LONG_NAME... Wrapper:$STATUS, Java:$JAVASTATUS'` + fi + fi +} + +# Used by HP-UX init scripts. +stopmsg() { + getpid + if [ "X$pid" = "X" ] + then + eval echo `gettext 'Stopping $APP_LONG_NAME... Wrapper:Stopped'` + else + if [ "X$DETAIL_STATUS" = "X" ] + then + eval echo `gettext 'Stopping $APP_LONG_NAME... Wrapper:Running'` + else + getstatus + eval echo `gettext 'Stopping $APP_LONG_NAME... Wrapper:$STATUS, Java:$JAVASTATUS'` + fi + fi +} + +showUsage() { + # $1 bad command + + if [ -n "$1" ] + then + eval echo `gettext 'Unexpected command: $1'` + echo ""; + fi + + eval MSG=`gettext 'Usage: '` + if [ -n "$FIXED_COMMAND" ] ; then + if [ -n "$PASS_THROUGH" ] ; then + echo "${MSG} $0 {JavaAppArgs}" + else + echo "${MSG} $0" + fi + else + if [ -n "$PAUSABLE" ] ; then + if [ -n "$PASS_THROUGH" ] ; then + echo "${MSG} $0 [ console {JavaAppArgs} | start {JavaAppArgs} | stop | restart {JavaAppArgs} | condrestart {JavaAppArgs} | pause | resume | status | install | installstart | remove | dump ]" + else + echo "${MSG} $0 [ console | start | stop | restart | condrestart | pause | resume | status | install | installstart | remove | dump ]" + fi + else + if [ -n "$PASS_THROUGH" ] ; then + echo "${MSG} $0 [ console {JavaAppArgs} | start {JavaAppArgs} | stop | restart {JavaAppArgs} | condrestart {JavaAppArgs} | status | install | installstart | remove | dump ]" + else + echo "${MSG} $0 [ console | start | stop | restart | condrestart | status | install | installstart | remove | dump ]" + fi + fi + fi + + if [ ! -n "$BRIEF_USAGE" ] + then + echo ""; + if [ ! -n "$FIXED_COMMAND" ] ; then + echo "`gettext 'Commands:'`" + echo "`gettext ' console Launch in the current console.'`" + echo "`gettext ' start Start in the background as a daemon process.'`" + echo "`gettext ' stop Stop if running as a daemon or in another console.'`" + echo "`gettext ' restart Stop if running and then start.'`" + echo "`gettext ' condrestart Restart only if already running.'`" + if [ -n "$PAUSABLE" ] ; then + echo "`gettext ' pause Pause if running.'`" + echo "`gettext ' resume Resume if paused.'`" + fi + echo "`gettext ' status Query the current status.'`" + echo "`gettext ' install Install to start automatically when system boots.'`" + echo "`gettext ' installstart Install and start running as a daemon process.'`" + echo "`gettext ' remove Uninstall.'`" + echo "`gettext ' dump Request a Java thread dump if running.'`" + echo ""; + fi + if [ -n "$PASS_THROUGH" ] ; then + echo "`gettext 'JavaAppArgs: Zero or more arguments which will be passed to the Java application.'`" + echo ""; + fi + fi + + exit 1 +} + +docommand() { + case "$COMMAND" in + 'console') + checkUser touchlock "$@" + if [ ! -n "$FIXED_COMMAND" ] ; then + shift + fi + console "$@" + ;; + + 'start') + startdaemon "$@" + ;; + + 'stop') + if [ "$DIST_OS" = "macosx" -a -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + macosxStop + elif [ "$DIST_OS" = "linux" -a -f "/etc/init/${APP_NAME}.conf" ] ; then + upstartStop + elif [ "$DIST_OS" = "linux" -a -n "$USE_SYSTEMD" -a -z "$SYSD" ] ; then + systemdStop + elif [ "$DIST_OS" = "aix" ] && [ "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + srcStop + else + checkUser "" "$COMMAND" + stopit "0" + fi + ;; + + 'restart') + if [ "$DIST_OS" = "macosx" ] ; then + if [ ! -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + eval echo `gettext '$APP_NAME was not installed.'` + else + macosxRestart + fi + elif [ "$DIST_OS" = "linux" -a -f "/etc/init/${APP_NAME}.conf" ] ; then + upstartRestart + elif [ "$DIST_OS" = "linux" -a -n "$USE_SYSTEMD" -a -z "$SYSD" ] ; then + systemdRestart + elif [ "$DIST_OS" = "aix" ] && [ "`/usr/bin/lssrc -S -s $APP_NAME`" ] ; then + srcRestart + else + if [ -n "$SMF" ] ; then + shift + fi + checkUser touchlock "$COMMAND" + if [ ! -n "$FIXED_COMMAND" ] ; then + shift + fi + stopit "0" + start "$@" + fi + ;; + + 'condrestart') + checkUser touchlock "$COMMAND" + if [ ! -n "$FIXED_COMMAND" ] ; then + shift + fi + stopit "1" + start "$@" + ;; + + 'pause') + if [ -n "$PAUSABLE" ] + then + pause + else + showUsage "$COMMAND" + fi + ;; + + 'resume') + if [ -n "$PAUSABLE" ] + then + resume + else + showUsage "$COMMAND" + fi + ;; + + 'status') + status + ;; + + 'install') + installdaemon "$@" + ;; + + 'installstart') + installdaemon "$@" + startdaemon "$@" + ;; + + 'remove') + removedaemon + ;; + + 'dump') + checkUser "" "$COMMAND" + dump + ;; + + 'start_msg') + # Internal command called by launchd on HP-UX. + checkUser "" "$COMMAND" + startmsg + ;; + + 'stop_msg') + # Internal command called by launchd on HP-UX. + checkUser "" "$COMMAND" + stopmsg + ;; + + 'launchdinternal' | 'upstartinternal') + if [ ! "$DIST_OS" = "macosx" -o ! -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then + checkUser touchlock "$@" + fi + # Internal command called by launchd on Max OSX. + # We do not want to call checkUser here as it is handled in the launchd plist file. Doing it here would confuse launchd. + if [ ! -n "$FIXED_COMMAND" ] ; then + shift + fi + launchinternal "$@" + ;; + + *) + showUsage "$COMMAND" + ;; + esac +} + +docommand "$@" + +exit 0 diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/pause.bat b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/pause.bat new file mode 100644 index 0000000..65a2166 --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/pause.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -a %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -a %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/query.bat b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/query.bat new file mode 100644 index 0000000..5638a44 --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/query.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -q %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -q %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/resume.bat b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/resume.bat new file mode 100644 index 0000000..8b4d6ea --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/resume.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -e %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -e %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/run.bat b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/run.bat new file mode 100644 index 0000000..8672708 --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/run.bat @@ -0,0 +1,156 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general passthrough startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. +rem +rem ******************************************************************** +rem NOTE - This script has been modified to run the TestWrapper sample +rem application and should NOT be used as a base for your own +rem applications. All of the documentation assumes that you are +rem working from the default source script: +rem WRAPPER_HOME/src/bin/App.bat.in +rem ******************************************************************** +rem +rem ******************************************************************** +rem NOTE - This script has been modified to run the TestWrapper sample +rem application and should NOT be used as a base for your own +rem applications. All of the documentation assumes that you are +rem working from the default source script: +rem WRAPPER_HOME/src/bin/App.bat.in +rem ******************************************************************** + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem _PASS_THROUGH tells the script to pass all parameters through to the JVM +rem as is. +rem If _WRAPPER_CONF_OVERRIDE is specified then all parameters will be passed. +rem If not set then all parameters starting with the second will be passed. +set _PASS_THROUGH=true + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -c %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -c %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause + + diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/start.bat b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/start.bat new file mode 100644 index 0000000..d7d5e85 --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/start.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -t %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -t %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/stop.bat b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/stop.bat new file mode 100644 index 0000000..49d717c --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/stop.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -p %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -p %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/uninstall.bat b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/uninstall.bat new file mode 100644 index 0000000..6ee6d07 --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/uninstall.bat @@ -0,0 +1,135 @@ +@echo off +setlocal + +rem +rem Copyright (c) 1999, 2016 Tanuki Software, Ltd. +rem http://www.tanukisoftware.com +rem All rights reserved. +rem +rem This software is the proprietary information of Tanuki Software. +rem You shall use it only in accordance with the terms of the +rem license agreement you entered into with Tanuki Software. +rem http://wrapper.tanukisoftware.com/doc/english/licenseOverview.html +rem +rem Java Service Wrapper general startup script. +rem + +rem ----------------------------------------------------------------------------- +rem These settings can be modified to fit the needs of your application +rem Optimized for use with version 3.5.28 of the Wrapper. + +rem The base name for the Wrapper binary. +set _WRAPPER_BASE=wrapper + +rem The directory where the Wrapper binary (.exe) file is located. It can be +rem either an absolute or a relative path. If the path contains any special +rem characters, please make sure to quote the variable. +set _WRAPPER_DIR= + +rem The name and location of the Wrapper configuration file. This will be used +rem if the user does not specify a configuration file as the first parameter to +rem this script. +set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf" + +rem Makes it possible to override the Wrapper configuration file by specifying it +rem as the first parameter. +rem set _WRAPPER_CONF_OVERRIDE=true + +rem Note that it is only possible to pass parameters through to the JVM when +rem installing the service, or when running in a console. + +rem Do not modify anything beyond this point +rem ----------------------------------------------------------------------------- + +rem +rem Resolve the real path of the wrapper.exe +rem For non NT systems, the _REALPATH and _WRAPPER_CONF values +rem can be hard-coded below and the following test removed. +rem +if "%OS%"=="Windows_NT" goto nt +echo This script only works with NT-based versions of Windows. +goto :eof + +:nt +rem Find the application home. +rem if no path path specified do the default action +IF not DEFINED _WRAPPER_DIR goto dir_undefined +set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR:"=%" +if not "%_WRAPPER_DIR:~-2,1%" == "\" set _WRAPPER_DIR_QUOTED="%_WRAPPER_DIR_QUOTED:"=%\" +rem check if absolute path +if "%_WRAPPER_DIR_QUOTED:~2,1%" == ":" goto absolute_path +if "%_WRAPPER_DIR_QUOTED:~1,1%" == "\" goto absolute_path +rem everythig else means relative path +set _REALPATH="%~dp0%_WRAPPER_DIR_QUOTED:"=%" +goto pathfound + +:dir_undefined +rem Use a relative path to the wrapper %~dp0 is location of current script under NT +set _REALPATH="%~dp0" +goto pathfound +:absolute_path +rem Use an absolute path to the wrapper +set _REALPATH="%_WRAPPER_DIR_QUOTED:"=%" + +:pathfound +rem +rem Decide on the specific Wrapper binary to use (See delta-pack) +rem +if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64 +if "%PROCESSOR_ARCHITECTURE%"=="IA64" goto ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-32.exe" +goto search +:amd64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-x86-64.exe" +goto search +:ia64 +set _WRAPPER_L_EXE="%_REALPATH:"=%%_WRAPPER_BASE%-windows-ia-64.exe" +goto search +:search +set _WRAPPER_EXE="%_WRAPPER_L_EXE:"=%" +if exist %_WRAPPER_EXE% goto conf +set _WRAPPER_EXE="%_REALPATH:"=%%_WRAPPER_BASE%.exe" +if exist %_WRAPPER_EXE% goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_L_EXE% +echo %_WRAPPER_EXE% +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +if [%_WRAPPER_CONF_OVERRIDE%]==[true] ( + set _WRAPPER_CONF="%~f1" + if not [%_WRAPPER_CONF%]==[""] ( + shift + goto :startup + ) +) +set _WRAPPER_CONF="%_WRAPPER_CONF_DEFAULT:"=%" + +rem +rem Start the Wrapper +rem +:startup +if not [%_PASS_THROUGH%]==[true] ( + if not [%1]==[] ( + echo WARNING: Extra arguments will be ignored. Please check usage in the batch file. + ) +) + +rem Collect the application parameters +:parameters +set _PARAMETERS=%_PARAMETERS% %1 +shift +if not [%1]==[] goto :parameters + +if not [%_PASS_THROUGH%]==[true] ( + %_WRAPPER_EXE% -r %_WRAPPER_CONF% +) else ( + %_WRAPPER_EXE% -r %_WRAPPER_CONF% -- %_PARAMETERS% +) +if not errorlevel 1 goto :eof +pause diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-linux-x86-32 b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-linux-x86-32 new file mode 100644 index 0000000..ff3509f Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-linux-x86-32 differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-linux-x86-64 b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-linux-x86-64 new file mode 100644 index 0000000..e72b0e0 Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-linux-x86-64 differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-macosx-universal-32 b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-macosx-universal-32 new file mode 100644 index 0000000..9a36a5c Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-macosx-universal-32 differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-macosx-universal-64 b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-macosx-universal-64 new file mode 100644 index 0000000..6587d2c Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-macosx-universal-64 differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-windows-x86-32.exe b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-windows-x86-32.exe new file mode 100644 index 0000000..9762dbf Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-windows-x86-32.exe differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-windows-x86-64.exe b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-windows-x86-64.exe new file mode 100644 index 0000000..122ec17 Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/bin/wrapper-windows-x86-64.exe differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/conf/application.properties b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/conf/application.properties new file mode 100644 index 0000000..63ec4fb --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/conf/application.properties @@ -0,0 +1,48 @@ +#Global +global.encoding=UTF-8 +global.locale=zh_CN + +#application.sign,application.index\u90FD\u4E0D\u80FD\u91CD\u590D +application.name=foodWaiMai +application.owner= +application.sign=1 +application.description=${application.name} +application.index=0 + +#\u6CE8\u518C\u4E2D\u5FC3 +zk.connect=127.0.0.1:2181 +# curator or zkclient +zk.client=curator + +#dubbo\u670D\u52A1 +reference.version=2.0.0 +reference.group=default +reference.timeout=600000 +reference.retries=1 + +#dubbo cache address +dubbo.cache.address=/home/project/food/dubbo/food-waimai-web.cache + +# EMBEDDED SERVER CONFIGURATION (ServerProperties) +server.port=8200 +server.servlet.context-path=/foodWaiMai +server.compression.enabled=true +server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml +server.compression.min-response-size=2048 + +# FREEMARKER (FreeMarkerProperties) +spring.freemarker.cache=false +spring.freemarker.charset=${global.encoding} +spring.freemarker.settings.template_exception_handler=com.jwsaas.freemarker.DefaultTemplateExceptionHandler +spring.freemarker.settings.auto_import=spring.ftl as spring + +# INTERNATIONALIZATION (MessageSourceProperties) +spring.messages.basename=i18n/messages + +#RabbitMQ +spring.rabbitmq.host=192.168.0.110 +spring.rabbitmq.port=5672 +spring.rabbitmq.virtual-host=/dev_test +spring.rabbitmq.publisher-confirms=true +spring.rabbitmq.username=dev +spring.rabbitmq.password=dev \ No newline at end of file diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/conf/logback.xml b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/conf/logback.xml new file mode 100644 index 0000000..027d001 --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/conf/logback.xml @@ -0,0 +1,32 @@ + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%-5level] %logger{120} - %msg %n + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/conf/wrapper.conf b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/conf/wrapper.conf new file mode 100644 index 0000000..6f01ce9 --- /dev/null +++ b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/conf/wrapper.conf @@ -0,0 +1,60 @@ +encoding=UTF-8 +wrapper.lang=zh_CN +#using the system default JDK environment variable +wrapper.java.command=java +#set.JAVA_HOME=/home/jdk1.8.0_65 +#wrapper.java.command=%JAVA_HOME%/bin/java +wrapper.java.command.loglevel=INFO + +wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp +wrapper.java.classpath.1=./ +wrapper.java.classpath.2=../conf/ +wrapper.java.classpath.3=../lib/*.jar + +wrapper.java.library.path.1=../lib + +wrapper.java.additional.auto_bits=TRUE +#set the default parameters +wrapper.java.additional.1=-Xms256m +wrapper.java.additional.2=-Xmx512m +wrapper.java.additional.3=-XX:PermSize=128m +wrapper.java.additional.4=-XX:MaxPermSize=256m +wrapper.java.additional.5=-Djava.net.preferIPv4Stack=true +wrapper.java.additional.6=-Dsun.lang.ClassLoader.allowArraySyntax=true + +# Initial Java Heap Size (in MB) +wrapper.java.initmemory=128 +# Maximum Java Heap Size (in MB) +wrapper.java.maxmemory=512 + +# Application parameters. Add parameters as needed starting from 1 +wrapper.app.parameter.1=org.springframework.boot.loader.JarLauncher +wrapper.app.parameter.2=--spring.config.location=../conf/application.properties +wrapper.app.parameter.3=--logging.config=../conf/logback.xml +wrapper.app.parameter.4=--logging.path=../logs + +wrapper.filter.trigger.1=java.lang.OutOfMemoryError +wrapper.filter.action.1=RESTART + +wrapper.console.format=PM +wrapper.console.loglevel=INFO + +wrapper.logfile=../logs/server_YYYYMMDD.log +wrapper.logfile.rollmode=DATE +wrapper.logfile.format=LPTM +wrapper.logfile.loglevel=INFO +wrapper.logfile.maxsize=0 +wrapper.logfile.maxfiles=0 +wrapper.syslog.loglevel=NONE + +wrapper.ignore_sequence_gaps=TRUE +wrapper.pidfile.strict=TRUE + +wrapper.console.title=Food2WaiMaiWeb Application + +wrapper.name=food2WaiMaiWeb +wrapper.displayname=Food2WaiMaiWeb Application +wrapper.description=Food2WaiMaiWeb Application +wrapper.ntservice.dependency.1= +wrapper.ntservice.starttype=AUTO_START +wrapper.ntservice.interactive=false diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/food-waimai-web-2.0.0.jar b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/food-waimai-web-2.0.0.jar new file mode 100644 index 0000000..006917d Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/food-waimai-web-2.0.0.jar differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/libwrapper-macosx-universal-32.jnilib b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/libwrapper-macosx-universal-32.jnilib new file mode 100644 index 0000000..ae75d31 Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/libwrapper-macosx-universal-32.jnilib differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/libwrapper-macosx-universal-64.jnilib b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/libwrapper-macosx-universal-64.jnilib new file mode 100644 index 0000000..e7d4102 Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/libwrapper-macosx-universal-64.jnilib differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/wrapper-windows-x86-32.dll b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/wrapper-windows-x86-32.dll new file mode 100644 index 0000000..6aaa9c1 Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/wrapper-windows-x86-32.dll differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/wrapper-windows-x86-64.dll b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/wrapper-windows-x86-64.dll new file mode 100644 index 0000000..81f11ce Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/wrapper-windows-x86-64.dll differ diff --git a/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/wrapper.jar b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/wrapper.jar new file mode 100644 index 0000000..70dc5ab Binary files /dev/null and b/food-waimai-web/target/food-waimai-web-2.0.0/food-waimai-web-2.0.0/lib/wrapper.jar differ diff --git a/food-waimai-web/target/maven-archiver/pom.properties b/food-waimai-web/target/maven-archiver/pom.properties new file mode 100644 index 0000000..b690d9f --- /dev/null +++ b/food-waimai-web/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Tue Dec 26 12:40:22 CST 2023 +version=2.0.0 +groupId=com.jwsaas +artifactId=food-waimai-web diff --git a/food-waimai-web/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/food-waimai-web/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..af92b9c --- /dev/null +++ b/food-waimai-web/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,32 @@ +com\jwsaas\config\MQMessageSender.class +com\jwsaas\Global.class +com\jwsaas\controller\waimai\BaiduOrderEntity.class +com\jwsaas\controller\waimai\ShopMeituanOrderExtraEntity.class +com\jwsaas\controller\waimai\ElemeWaimaiOrderController.class +com\jwsaas\utils\JSONUtil$1.class +com\jwsaas\controller\waimai\MeituanOrderExtraEntity.class +com\jwsaas\utils\Assert.class +com\jwsaas\controller\waimai\ShopMeituanOrderEntity.class +com\jwsaas\controller\waimai\ShopMeiTuanOrderController.class +com\jwsaas\controller\IndexController.class +com\jwsaas\utils\EmojiFilter.class +com\jwsaas\controller\waimai\QiMaiOrderPayEntity.class +com\jwsaas\controller\waimai\BaiduWaimaiOrderController.class +com\jwsaas\utils\JSONUtil.class +com\jwsaas\utils\JSONException.class +com\jwsaas\controller\waimai\BaiduOrderProductEntity.class +com\jwsaas\freemarker\DefaultTemplateExceptionHandler.class +com\jwsaas\controller\waimai\ShopMeituanOrderItemEntity.class +com\jwsaas\controller\waimai\MeiTuanOrderController.class +com\jwsaas\utils\DateUtils.class +com\jwsaas\controller\waimai\QiMaiOrderItemEntity.class +com\jwsaas\controller\waimai\MeituanOrderItemEntity.class +com\jwsaas\controller\waimai\ElemeOrderDetailGroupEntity.class +com\jwsaas\Application.class +com\jwsaas\controller\waimai\QiMaiOrderController.class +com\jwsaas\controller\waimai\MeituanOrderEntity.class +com\jwsaas\controller\BaseController.class +com\jwsaas\config\RabbitMQConfig.class +com\jwsaas\controller\waimai\QiMaiOrderEntity.class +com\jwsaas\controller\waimai\ElemeOrderDetailEntity.class +com\jwsaas\config\RabbitConstant.class diff --git a/food-waimai-web/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/food-waimai-web/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..9c3b845 --- /dev/null +++ b/food-waimai-web/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,31 @@ +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\ElemeOrderDetailGroupEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\QiMaiOrderEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\utils\Assert.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\config\MQMessageSender.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\IndexController.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\ElemeWaimaiOrderController.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\BaiduOrderProductEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\ShopMeituanOrderItemEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\config\RabbitConstant.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\ShopMeituanOrderExtraEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\ShopMeiTuanOrderController.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\BaiduWaimaiOrderController.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\MeituanOrderItemEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\Global.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\freemarker\DefaultTemplateExceptionHandler.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\BaiduOrderEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\Application.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\MeituanOrderEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\utils\EmojiFilter.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\config\RabbitMQConfig.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\ElemeOrderDetailEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\QiMaiOrderController.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\MeiTuanOrderController.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\MeituanOrderExtraEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\ShopMeituanOrderEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\QiMaiOrderPayEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\BaseController.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\utils\DateUtils.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\utils\JSONException.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\controller\waimai\QiMaiOrderItemEntity.java +E:\food\food\food-waimai-web\src\main\java\com\jwsaas\utils\JSONUtil.java diff --git a/food-waimai-web/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/food-waimai-web/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29