慧麦商城
This commit is contained in:
225
mall-portal/mvnw
vendored
Normal file
225
mall-portal/mvnw
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven2 Start Up Batch script
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# M2_HOME - location of maven2's installed home dir
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "`uname`" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||
else
|
||||
export JAVA_HOME="/Library/Java/Home"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=`java-config --jre-home`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$M2_HOME" ] ; then
|
||||
## resolve links - $0 may be a link to maven's home
|
||||
PRG="$0"
|
||||
|
||||
# need this for relative symlinks
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG="`dirname "$PRG"`/$link"
|
||||
fi
|
||||
done
|
||||
|
||||
saveddir=`pwd`
|
||||
|
||||
M2_HOME=`dirname "$PRG"`/..
|
||||
|
||||
# make it fully qualified
|
||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||
|
||||
cd "$saveddir"
|
||||
# echo Using m2 at $M2_HOME
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
# For Migwn, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||
# TODO classpath?
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="`which javac`"
|
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=`which readlink`
|
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||
else
|
||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||
fi
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="`which java`"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=`cd "$wdir/.."; pwd`
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
echo "${basedir}"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
echo "$(tr -s '\n' ' ' < "$1")"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||
echo $MAVEN_PROJECTBASEDIR
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||
fi
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||
143
mall-portal/mvnw.cmd
vendored
Normal file
143
mall-portal/mvnw.cmd
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Maven2 Start Up Batch script
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM M2_HOME - location of maven2's installed home dir
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
||||
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
||||
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
||||
|
||||
exit /B %ERROR_CODE%
|
||||
133
mall-portal/pom.xml
Normal file
133
mall-portal/pom.xml
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.buy507.mall</groupId>
|
||||
<artifactId>mall-portal</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>mall-portal</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<skipTests>true</skipTests>
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
<groupId>com.buy507.mall</groupId>
|
||||
<artifactId>mall</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.buy507.mall</groupId>
|
||||
<artifactId>mall-dao</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!--JWT(Json Web Token)登录支持-->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<!--redis依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!--集成消息队列-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
<!--lombok依赖-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.60</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
<version>4.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 微信小程序支付 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 支付宝支付 -->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.39.246.ALL</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<!--<plugin>-->
|
||||
<!--<groupId>com.spotify</groupId>-->
|
||||
<!--<artifactId>docker-maven-plugin</artifactId>-->
|
||||
<!--<version>1.1.0</version>-->
|
||||
<!--<executions>-->
|
||||
<!--<execution>-->
|
||||
<!--<id>build-image</id>-->
|
||||
<!--<phase>package</phase>-->
|
||||
<!--<goals>-->
|
||||
<!--<goal>build</goal>-->
|
||||
<!--</goals>-->
|
||||
<!--</execution>-->
|
||||
<!--</executions>-->
|
||||
<!--<configuration>-->
|
||||
<!--<imageName>mall/${project.artifactId}:${project.version}</imageName>-->
|
||||
<!--<dockerHost>http://39.98.190.128:2375</dockerHost>-->
|
||||
<!--<baseImage>java:8</baseImage>-->
|
||||
<!--<entryPoint>["java", "-jar","-Dspring.profiles.active=prod","/${project.build.finalName}.jar"]</entryPoint>-->
|
||||
<!--<resources>-->
|
||||
<!--<resource>-->
|
||||
<!--<targetPath>/</targetPath>-->
|
||||
<!--<directory>${project.build.directory}</directory>-->
|
||||
<!--<include>${project.build.finalName}.jar</include>-->
|
||||
<!--</resource>-->
|
||||
<!--</resources>-->
|
||||
<!--</configuration>-->
|
||||
<!--</plugin>-->
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.buy507.mall;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@EnableTransactionManagement
|
||||
@SpringBootApplication
|
||||
@EnableAutoConfiguration(exclude = { JacksonAutoConfiguration.class })
|
||||
public class MallPortalApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MallPortalApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.buy507.mall.portal.component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.buy507.mall.common.util.Constants;
|
||||
import com.buy507.mall.mapper.DmsDistributionDictionaryMapper;
|
||||
import com.buy507.mall.mapper.UmsAreaMapper;
|
||||
import com.buy507.mall.model.DmsDistributionDictionary;
|
||||
import com.buy507.mall.model.UmsArea;
|
||||
import com.buy507.mall.portal.domain.AreaOptions;
|
||||
import com.buy507.mall.portal.service.RedisService;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* 缓存初始化
|
||||
* @author yeyun
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class CacheInitializtion implements CommandLineRunner {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CacheInitializtion.class);
|
||||
|
||||
@Autowired
|
||||
private DmsDistributionDictionaryMapper distributionDictionaryMapper;
|
||||
|
||||
@Autowired
|
||||
private UmsAreaMapper areaMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
LOGGER.debug("Cache initialize start");
|
||||
Gson gson = new Gson();
|
||||
List<DmsDistributionDictionary> dictionariesList = distributionDictionaryMapper.selectAll();
|
||||
LOGGER.debug("distribution dictionary init {}", dictionariesList.size());
|
||||
redisService.set(Constants.DISTRIBUTION_DICTIONARY, gson.toJson(dictionariesList));
|
||||
|
||||
List<UmsArea> areaList = areaMapper.selectAll();
|
||||
List<AreaOptions> optionList = new ArrayList<>();
|
||||
for(UmsArea area : areaList) {
|
||||
//我们这里最大的根节点ID是0,所以找出所有parent id为-1的节点,然后调用我们的递归算法
|
||||
if(area.getParentId().equals(-1)){
|
||||
optionList.add(recursionArea(area, areaList));
|
||||
}
|
||||
}
|
||||
redisService.set(Constants.AREA_CODE, gson.toJson(optionList));
|
||||
|
||||
LOGGER.debug("Cache initialize end");
|
||||
}
|
||||
|
||||
private AreaOptions recursionArea(UmsArea area, List<UmsArea> list) {
|
||||
List<AreaOptions> childList = new ArrayList<>();
|
||||
// 为每一个父节点增加子树(List形式,没有则为空的list)
|
||||
AreaOptions node = new AreaOptions();
|
||||
node.setId(area.getId());
|
||||
node.setName(area.getAreaName());
|
||||
node.setLevel(area.getLevel());
|
||||
|
||||
if(area.getParentId().equals(-1)) {
|
||||
node.setPid(0);
|
||||
} else {
|
||||
node.setPid(area.getParentId());
|
||||
}
|
||||
for (UmsArea childArea : list){
|
||||
//如果子节点的pid等于父节点的ID,则说明是父子关系
|
||||
if(childArea.getParentId().equals(area.getId())){
|
||||
// 继续调用递归算法,将当前作为父节点,继续找他的子节点,反复执行。
|
||||
childList.add(recursionArea(childArea, list));
|
||||
}
|
||||
}
|
||||
|
||||
// 当遍历完成,返回调用的节点
|
||||
if(!childList.isEmpty()) {
|
||||
node.setChildren(childList);
|
||||
} else {
|
||||
node.setChildren(null);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.buy507.mall.portal.component;
|
||||
|
||||
import com.buy507.mall.portal.service.OmsPortalOrderService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 取消订单消息的处理者
|
||||
*/
|
||||
@Component
|
||||
@RabbitListener(queues = "mall.order.cancel")
|
||||
public class CancelOrderReceiver {
|
||||
|
||||
private static Logger LOGGER =LoggerFactory.getLogger(CancelOrderReceiver.class);
|
||||
|
||||
@Autowired
|
||||
private OmsPortalOrderService portalOrderService;
|
||||
|
||||
@RabbitHandler
|
||||
public void handle(Long orderId){
|
||||
portalOrderService.cancelOrder(orderId);
|
||||
LOGGER.info("process orderId:{}", orderId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.buy507.mall.portal.component;
|
||||
|
||||
import com.buy507.mall.portal.domain.QueueEnum;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.AmqpException;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.core.MessagePostProcessor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 取消订单消息的发出者
|
||||
*/
|
||||
@Component
|
||||
public class CancelOrderSender {
|
||||
|
||||
private static Logger LOGGER =LoggerFactory.getLogger(CancelOrderSender.class);
|
||||
|
||||
@Autowired
|
||||
private AmqpTemplate amqpTemplate;
|
||||
|
||||
public void sendMessage(Long orderId, final long delayTimes){
|
||||
//给延迟队列发送消息
|
||||
amqpTemplate.convertAndSend(QueueEnum.QUEUE_TTL_ORDER_CANCEL.getExchange(), QueueEnum.QUEUE_TTL_ORDER_CANCEL.getRouteKey(), orderId, new MessagePostProcessor() {
|
||||
@Override
|
||||
public Message postProcessMessage(Message message) throws AmqpException {
|
||||
//给消息设置延迟毫秒值
|
||||
message.getMessageProperties().setExpiration(String.valueOf(delayTimes));
|
||||
return message;
|
||||
}
|
||||
});
|
||||
LOGGER.info("send orderId:{}", orderId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.buy507.mall.portal.component;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 分销预结算消息的发出者
|
||||
*/
|
||||
@Component
|
||||
public class DistributeSender {
|
||||
|
||||
private static Logger LOGGER = LoggerFactory.getLogger(DistributeSender.class);
|
||||
|
||||
@Autowired
|
||||
private AmqpTemplate amqpTemplate;
|
||||
|
||||
public void sendMessage(Long orderId){
|
||||
amqpTemplate.convertAndSend("mall.distribute.compute", orderId);
|
||||
LOGGER.info("Distribute send orderId:{}", orderId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.buy507.mall.portal.component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import com.buy507.mall.portal.domain.MemberDetails;
|
||||
import com.buy507.mall.portal.util.JwtTokenUtil;
|
||||
|
||||
/**
|
||||
* JWT登录授权过滤器
|
||||
*/
|
||||
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JwtAuthenticationTokenFilter.class);
|
||||
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
@Autowired
|
||||
private JwtTokenUtil jwtTokenUtil;
|
||||
|
||||
@Value("${jwt.tokenHeader}")
|
||||
private String tokenHeader;
|
||||
|
||||
@Value("${jwt.tokenHead}")
|
||||
private String tokenHead;
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
FilterChain chain) throws ServletException, IOException {
|
||||
|
||||
String authHeader = request.getHeader(this.tokenHeader);
|
||||
if (authHeader != null && authHeader.startsWith(this.tokenHead)) {
|
||||
String authToken = authHeader.substring(this.tokenHead.length());// The part after "507mall "
|
||||
String username = jwtTokenUtil.getUserNameFromToken(authToken);
|
||||
LOGGER.info("checking username:{}", username);
|
||||
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
|
||||
MemberDetails userDetails = (MemberDetails) this.userDetailsService.loadUserByUsername(username);
|
||||
if (jwtTokenUtil.validateToken(authToken, userDetails)) {
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
|
||||
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
LOGGER.info("authenticated user:{}", username);
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//允许跨域请求
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST,GET,PUT,OPTIONS,DELETE");
|
||||
response.setHeader("Access-Control-Max-Age", "3600");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Origin,X-Requested-With,Content-Type,Accept,Authorization,token");
|
||||
chain.doFilter(request, response);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.buy507.mall.portal.component;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.portal.service.OmsPortalOrderService;
|
||||
|
||||
/**
|
||||
* 订单超时取消并解锁库存的定时器
|
||||
*/
|
||||
//@Component
|
||||
public class OrderTimeOutCancelTask {
|
||||
private Logger LOGGER =LoggerFactory.getLogger(OrderTimeOutCancelTask.class);
|
||||
@Autowired
|
||||
private OmsPortalOrderService portalOrderService;
|
||||
|
||||
/**
|
||||
* cron表达式:Seconds Minutes Hours DayofMonth Month DayofWeek [Year]
|
||||
* 每10分钟扫描一次,扫描设定超时时间之前下的订单,如果没支付则取消该订单
|
||||
*/
|
||||
@Scheduled(cron = "0 0/10 * ? * ?")
|
||||
private void cancelTimeOutOrder(){
|
||||
CommonResult result = portalOrderService.cancelTimeOutOrder();
|
||||
LOGGER.info("取消订单,并根据sku编号释放锁定库存:{}",result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.buy507.mall.portal.component;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Component
|
||||
public class RedisLock {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RedisLock.class);
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
public static final int TIMEOUT = 120 * 1000; //超时时间 120s
|
||||
|
||||
/**
|
||||
* 加锁
|
||||
* @param key 唯一标识
|
||||
* @param value 当前时间 + 超时时间 也就是时间戳
|
||||
* @return
|
||||
*/
|
||||
public boolean lock(String key, String value){
|
||||
if(stringRedisTemplate.opsForValue().setIfAbsent(key, value)){//对应setnx命令
|
||||
//可以成功设置,也就是key不存在
|
||||
return true;
|
||||
}
|
||||
|
||||
//判断锁超时 - 防止原来的操作异常,没有运行解锁操作 防止死锁
|
||||
String currentValue = stringRedisTemplate.opsForValue().get(key);
|
||||
//如果锁过期
|
||||
if(!StringUtils.isEmpty(currentValue) && Long.parseLong(currentValue) < System.currentTimeMillis()){//currentValue不为空且小于当前时间
|
||||
//获取上一个锁的时间value
|
||||
String oldValue = stringRedisTemplate.opsForValue().getAndSet(key, value);//对应getset,如果key存在
|
||||
|
||||
//假设两个线程同时进来这里,因为key被占用了,而且锁过期了。获取的值currentValue=A(get取的旧的值肯定是一样的),两个线程的value都是B,key都是K.锁时间已经过期了。
|
||||
//而这里面的getAndSet一次只会一个执行,也就是一个执行之后,上一个的value已经变成了B。只有一个线程获取的上一个值会是A,另一个线程拿到的值是B。
|
||||
if(!StringUtils.isEmpty(oldValue) && oldValue.equals(currentValue) ){
|
||||
//oldValue不为空且oldValue等于currentValue,也就是校验是不是上个对应的唯一标识的时间戳,也是防止并发
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解锁
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public void unlock(String key, String value){
|
||||
try {
|
||||
String currentValue = stringRedisTemplate.opsForValue().get(key);
|
||||
if(!StringUtils.isEmpty(currentValue) && currentValue.equals(value) ){
|
||||
stringRedisTemplate.opsForValue().getOperations().delete(key);//删除key
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("[Redis distributed lock] failed: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.buy507.mall.portal.component;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 当未登录或者token失效访问接口时,自定义的返回结果
|
||||
*/
|
||||
@Component
|
||||
public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json");
|
||||
response.getWriter().println(JSONUtil.parse(CommonResult.unauthorized(authException.getMessage())));
|
||||
response.getWriter().flush();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.buy507.mall.portal.component;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 当访问接口没有权限时,自定义的返回结果
|
||||
*/
|
||||
@Component
|
||||
public class RestfulAccessDeniedHandler implements AccessDeniedHandler{
|
||||
@Override
|
||||
public void handle(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
AccessDeniedException e) throws IOException, ServletException {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json");
|
||||
response.getWriter().println(JSONUtil.parse(CommonResult.forbidden(e.getMessage())));
|
||||
response.getWriter().flush();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.buy507.mall.portal.component;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.buy507.mall.common.util.Constants;
|
||||
import com.buy507.mall.model.UmsMember;
|
||||
import com.buy507.mall.portal.service.InitDistributionService;
|
||||
|
||||
/**
|
||||
* 作用:会员注册时递归更新上级团队成员数量
|
||||
* 会员购买商品确认收货时也需要更新上级团队成员数量,使用redis分布式锁
|
||||
* @author wuming
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class TeamMemberNumberHanderQueue implements CommandLineRunner {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TeamMemberNumberHanderQueue.class);
|
||||
|
||||
private static LinkedBlockingQueue<UmsMember> queue = new LinkedBlockingQueue<>();
|
||||
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@Autowired
|
||||
private InitDistributionService distributionService;
|
||||
|
||||
@Autowired
|
||||
private ExecutorService executorService;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
executorService.execute(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while(true) {
|
||||
UmsMember member = null;
|
||||
try {
|
||||
LOGGER.info("team member number handler queue size: {}", queue.size());
|
||||
|
||||
member = queue.take();
|
||||
LOGGER.info("team member number handler start: {}", member.getId());
|
||||
|
||||
while(true) {
|
||||
long time = System.currentTimeMillis() + RedisLock.TIMEOUT;
|
||||
if(redisLock.lock(Constants.LOCK_TEAM_MEMBER_NUM, String.valueOf(time))) {
|
||||
distributionService.updateUpTeamMemberNumberForAddInviter(member);
|
||||
redisLock.unlock(Constants.LOCK_TEAM_MEMBER_NUM, String.valueOf(time));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LOGGER.info("team member number handler end: {}", member.getId());
|
||||
LOGGER.info("team member number handler queue size: {}", queue.size());
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.error("team member number handler failed");
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
if(member != null) {
|
||||
LOGGER.error("team member number handler failed: {}", member.getId());
|
||||
} else {
|
||||
LOGGER.error("team member number handler failed");
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param order
|
||||
*/
|
||||
public static void addMemberToQueue(UmsMember member) {
|
||||
try {
|
||||
queue.put(member);
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.error("team member number handler failed: {}", member.getId());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.buy507.mall.portal.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.json.GsonHttpMessageConverter;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import springfox.documentation.spring.web.json.Json;
|
||||
|
||||
@Configuration
|
||||
public class GsonConfig {
|
||||
|
||||
@Value("${spring.gson.date-format}")
|
||||
private String GSON_DATE_FORMAT;
|
||||
|
||||
@Bean
|
||||
public GsonHttpMessageConverter gsonHttpMessageConverter() {
|
||||
GsonHttpMessageConverter converter = new GsonHttpMessageConverter();
|
||||
converter.setGson(gson());
|
||||
return converter;
|
||||
}
|
||||
|
||||
private Gson gson() {
|
||||
final GsonBuilder builder = new GsonBuilder();
|
||||
builder.registerTypeAdapter(Json.class, new SpringfoxJsonToGsonAdapter());
|
||||
builder.setDateFormat(GSON_DATE_FORMAT);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.buy507.mall.portal.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* MyBatis配置类
|
||||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@MapperScan({"com.buy507.mall.mapper","com.buy507.mall.portal.dao"})
|
||||
public class MyBatisConfig {
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.buy507.mall.portal.config;
|
||||
|
||||
import com.buy507.mall.portal.domain.QueueEnum;
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 消息队列配置
|
||||
*/
|
||||
@Configuration
|
||||
public class RabbitMqConfig {
|
||||
|
||||
/**
|
||||
* 订单消息实际消费队列所绑定的交换机
|
||||
*/
|
||||
@Bean
|
||||
DirectExchange orderDirect() {
|
||||
return (DirectExchange) ExchangeBuilder
|
||||
.directExchange(QueueEnum.QUEUE_ORDER_CANCEL.getExchange())
|
||||
.durable(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单延迟队列队列所绑定的交换机
|
||||
*/
|
||||
@Bean
|
||||
DirectExchange orderTtlDirect() {
|
||||
return (DirectExchange) ExchangeBuilder
|
||||
.directExchange(QueueEnum.QUEUE_TTL_ORDER_CANCEL.getExchange())
|
||||
.durable(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单实际消费队列
|
||||
*/
|
||||
@Bean
|
||||
public Queue orderQueue() {
|
||||
return new Queue(QueueEnum.QUEUE_ORDER_CANCEL.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单延迟队列(死信队列)
|
||||
*/
|
||||
@Bean
|
||||
public Queue orderTtlQueue() {
|
||||
return QueueBuilder
|
||||
.durable(QueueEnum.QUEUE_TTL_ORDER_CANCEL.getName())
|
||||
.withArgument("x-dead-letter-exchange", QueueEnum.QUEUE_ORDER_CANCEL.getExchange())//到期后转发的交换机
|
||||
.withArgument("x-dead-letter-routing-key", QueueEnum.QUEUE_ORDER_CANCEL.getRouteKey())//到期后转发的路由键
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将订单队列绑定到交换机
|
||||
*/
|
||||
@Bean
|
||||
Binding orderBinding(DirectExchange orderDirect,Queue orderQueue){
|
||||
return BindingBuilder
|
||||
.bind(orderQueue)
|
||||
.to(orderDirect)
|
||||
.with(QueueEnum.QUEUE_ORDER_CANCEL.getRouteKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将订单延迟队列绑定到交换机
|
||||
*/
|
||||
@Bean
|
||||
Binding orderTtlBinding(DirectExchange orderTtlDirect,Queue orderTtlQueue){
|
||||
return BindingBuilder
|
||||
.bind(orderTtlQueue)
|
||||
.to(orderTtlDirect)
|
||||
.with(QueueEnum.QUEUE_TTL_ORDER_CANCEL.getRouteKey());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.buy507.mall.portal.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
|
||||
import com.buy507.mall.model.UmsMember;
|
||||
import com.buy507.mall.portal.component.JwtAuthenticationTokenFilter;
|
||||
import com.buy507.mall.portal.component.RestAuthenticationEntryPoint;
|
||||
import com.buy507.mall.portal.component.RestfulAccessDeniedHandler;
|
||||
import com.buy507.mall.portal.domain.MemberDetails;
|
||||
import com.buy507.mall.portal.service.UmsMemberService;
|
||||
|
||||
/**
|
||||
* SpringSecurity的配置
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
@Autowired
|
||||
private UmsMemberService memberService;
|
||||
|
||||
@Autowired
|
||||
private RestfulAccessDeniedHandler restfulAccessDeniedHandler;
|
||||
@Autowired
|
||||
private RestAuthenticationEntryPoint restAuthenticationEntryPoint;
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity httpSecurity) throws Exception {
|
||||
|
||||
httpSecurity.csrf()// 由于使用的是JWT,我们这里不需要csrf
|
||||
.disable()
|
||||
.sessionManagement()// 基于token,所以不需要session
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.antMatchers(HttpMethod.GET, // 允许对于网站静态资源的无授权访问
|
||||
"/",
|
||||
"/*.html",
|
||||
"/favicon.ico",
|
||||
"/**/*.html",
|
||||
"/**/*.css",
|
||||
"/**/*.js",
|
||||
"/swagger-resources/**",
|
||||
"/v2/api-docs/**"
|
||||
)
|
||||
.permitAll()
|
||||
.antMatchers(
|
||||
"/member/register", //注册
|
||||
"/member/login", //登录
|
||||
"/member/wechatLogin", //微信登录
|
||||
"/member/getAuthCode", //获取验证码
|
||||
// "/member/order/wxPay/callback", //微信支付回调
|
||||
"/member/order/alipay/callback", //支付宝支付回调
|
||||
"/home/**"//首页接口
|
||||
)
|
||||
.permitAll()
|
||||
.antMatchers(HttpMethod.OPTIONS)//跨域请求会先进行一次options请求
|
||||
.permitAll()
|
||||
//.antMatchers("/**")//测试时全部运行访问
|
||||
//.permitAll()
|
||||
.anyRequest()// 除上面外的所有请求全部需要鉴权认证
|
||||
.authenticated();
|
||||
|
||||
// 禁用缓存
|
||||
httpSecurity.headers().cacheControl();
|
||||
// 添加JWT filter
|
||||
httpSecurity.addFilterBefore(jwtAuthenticationTokenFilter(), UsernamePasswordAuthenticationFilter.class);
|
||||
//添加自定义未授权和未登录结果返回 mcoo
|
||||
httpSecurity.exceptionHandling().accessDeniedHandler(restfulAccessDeniedHandler).authenticationEntryPoint(restAuthenticationEntryPoint);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.userDetailsService(userDetailsService())
|
||||
.passwordEncoder(passwordEncoder());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public UserDetailsService userDetailsService() {
|
||||
//获取登录用户信息
|
||||
return new UserDetailsService() {
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
UmsMember member = memberService.getByUsername(username);
|
||||
if(member!=null){
|
||||
return new MemberDetails(member);
|
||||
}
|
||||
throw new UsernameNotFoundException("用户名或密码错误");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter(){
|
||||
return new JwtAuthenticationTokenFilter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Override
|
||||
public AuthenticationManager authenticationManagerBean() throws Exception {
|
||||
return super.authenticationManagerBean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.buy507.mall.portal.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 定时任务配置
|
||||
*/
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class SpringTaskConfig {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.buy507.mall.portal.config;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
|
||||
import springfox.documentation.spring.web.json.Json;
|
||||
|
||||
public class SpringfoxJsonToGsonAdapter implements JsonSerializer<Json> {
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(Json json, Type type, JsonSerializationContext context) {
|
||||
final JsonParser parser = new JsonParser();
|
||||
return parser.parse(json.value());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.buy507.mall.portal.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* Swagger2API文档的配置
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class Swagger2Config {
|
||||
@Bean
|
||||
public Docket createRestApi(){
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.buy507.mall.portal.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("mall前台系统")
|
||||
.description("mall前台系统")
|
||||
.contact("buy507")
|
||||
.version("1.0")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.buy507.mall.portal.config;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 线程池初始化
|
||||
* @author yeyun
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class ThreadPoolConfig {
|
||||
|
||||
@Bean
|
||||
public ExecutorService getThreadPool() {
|
||||
return Executors.newCachedThreadPool();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
import com.buy507.mall.portal.domain.HomeContentResult;
|
||||
import com.buy507.mall.portal.domain.ProductCategoryOptions;
|
||||
import com.buy507.mall.portal.domain.ProductDetailResult;
|
||||
import com.buy507.mall.portal.domain.ProductSkuResult;
|
||||
import com.buy507.mall.portal.service.HomeService;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 首页内容管理Controller
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "HomeController", description = "首页内容管理")
|
||||
@RequestMapping("/home")
|
||||
public class HomeController {
|
||||
|
||||
@Autowired
|
||||
private HomeService homeService;
|
||||
|
||||
@ApiOperation("首页内容页信息展示")
|
||||
@RequestMapping(value = "/content", method = RequestMethod.GET)
|
||||
public CommonResult<HomeContentResult> content() {
|
||||
HomeContentResult contentResult = homeService.content();
|
||||
return CommonResult.success(contentResult);
|
||||
}
|
||||
|
||||
@ApiOperation("根据条件分页获取商品")
|
||||
@RequestMapping(value = "/getProductList", method = RequestMethod.GET)
|
||||
public CommonResult<List<PmsProduct>> getProductList (
|
||||
@RequestParam(required = false) Long brandId,
|
||||
@RequestParam(required = false) Long categoryId,
|
||||
@RequestParam(required = false) String sortType,
|
||||
@RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<PmsProduct> productList = homeService.getProductList(brandId, categoryId, sortType, pageSize, pageNum);
|
||||
return CommonResult.success(productList);
|
||||
}
|
||||
|
||||
/*
|
||||
@ApiOperation("分页获取推荐商品")
|
||||
@RequestMapping(value = "/recommendProductList", method = RequestMethod.GET)
|
||||
public CommonResult<List<PmsProduct>> recommendProductList(
|
||||
@RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<PmsProduct> productList = homeService.recommendProductList(pageSize, pageNum);
|
||||
return CommonResult.success(productList);
|
||||
}
|
||||
*/
|
||||
|
||||
@ApiOperation("获取首页商品分类")
|
||||
@RequestMapping(value = "/productCateList", method = RequestMethod.GET)
|
||||
public CommonResult<List<ProductCategoryOptions>> getProductCateList() {
|
||||
List<ProductCategoryOptions> productCategoryList = homeService.getProductCateList();
|
||||
return CommonResult.success(productCategoryList);
|
||||
}
|
||||
|
||||
/*
|
||||
@ApiOperation("根据分类获取专题")
|
||||
@RequestMapping(value = "/subjectList", method = RequestMethod.GET)
|
||||
public CommonResult<List<CmsSubject>> getSubjectList(@RequestParam(required = false) Long cateId,
|
||||
@RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<CmsSubject> subjectList = homeService.getSubjectList(cateId, pageSize, pageNum);
|
||||
return CommonResult.success(subjectList);
|
||||
}
|
||||
*/
|
||||
|
||||
@ApiOperation("首页商品详情")
|
||||
@RequestMapping(value = "/productInfo/{productId}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<ProductDetailResult> productInfo(@PathVariable Long productId) {
|
||||
ProductDetailResult productInfo = homeService.getProductInfo(productId);
|
||||
return CommonResult.success(productInfo);
|
||||
}
|
||||
|
||||
@ApiOperation("首页商品sku信息")
|
||||
@RequestMapping(value = "/productSku/{productId}", method = RequestMethod.GET)
|
||||
public CommonResult<ProductSkuResult> productInfo(@PathVariable Long productId, @RequestParam(required = false) String sp1,
|
||||
@RequestParam(required = false) String sp2, @RequestParam(required = false) String sp3) {
|
||||
ProductSkuResult productSku = homeService.getProductSku(productId, sp1, sp2, sp3);
|
||||
return CommonResult.success(productSku);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.portal.domain.MemberBrandAttention;
|
||||
import com.buy507.mall.portal.service.MemberAttentionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员关注品牌管理Controller
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "MemberAttentionController", description = "会员关注品牌管理")
|
||||
@RequestMapping("/member/attention")
|
||||
public class MemberAttentionController {
|
||||
@Autowired
|
||||
private MemberAttentionService memberAttentionService;
|
||||
@ApiOperation("添加品牌关注")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult add(@RequestBody MemberBrandAttention memberBrandAttention) {
|
||||
int count = memberAttentionService.add(memberBrandAttention);
|
||||
if(count>0){
|
||||
return CommonResult.success(count);
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("取消关注")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult delete(Long memberId, Long brandId) {
|
||||
int count = memberAttentionService.delete(memberId,brandId);
|
||||
if(count>0){
|
||||
return CommonResult.success(count);
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("显示关注列表")
|
||||
@RequestMapping(value = "/list/{memberId}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<List<MemberBrandAttention>> list(@PathVariable Long memberId) {
|
||||
List<MemberBrandAttention> memberBrandAttentionList = memberAttentionService.list(memberId);
|
||||
return CommonResult.success(memberBrandAttentionList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.portal.domain.MemberBankAccount;
|
||||
import com.buy507.mall.portal.service.MemberBankAccountService;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 会员银行信息管理Controller
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "MemberBankAccountController", description = "会员银行信息管理")
|
||||
@RequestMapping("/member/bankAccount")
|
||||
public class MemberBankAccountController {
|
||||
|
||||
@Autowired
|
||||
private MemberBankAccountService service;
|
||||
|
||||
@ApiOperation("添加会员银行信息")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult<String> add(@RequestBody MemberBankAccount bankAccount) {
|
||||
return service.add(bankAccount);
|
||||
}
|
||||
|
||||
@ApiOperation("删除会员银行信息")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<String> delete(@PathVariable Long id) {
|
||||
return service.delete(id);
|
||||
}
|
||||
|
||||
@ApiOperation("修改会员银行信息")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody MemberBankAccount bankAccount) {
|
||||
return service.update(bankAccount);
|
||||
}
|
||||
|
||||
@ApiOperation("显示会员的所有银行信息")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<MemberBankAccount>> list() {
|
||||
return service.list();
|
||||
}
|
||||
|
||||
@ApiOperation("获取会员默认银行信息")
|
||||
@RequestMapping(value = "/getDefaultBankAccount", method = RequestMethod.GET)
|
||||
public CommonResult<MemberBankAccount> getDefaultBankAccount() {
|
||||
return service.getDefaultBankAccount();
|
||||
}
|
||||
|
||||
@ApiOperation("获取单个会员银行信息")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<MemberBankAccount> get(@PathVariable Long id) {
|
||||
return service.get(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.model.UmsMember;
|
||||
import com.buy507.mall.portal.domain.MemberProductCollection;
|
||||
import com.buy507.mall.portal.service.MemberCollectionService;
|
||||
import com.buy507.mall.portal.service.UmsMemberService;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员收藏管理Controller
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "MemberCollectionController", description = "会员收藏管理")
|
||||
@RequestMapping("/member/collection")
|
||||
public class MemberCollectionController {
|
||||
@Autowired
|
||||
private MemberCollectionService memberCollectionService;
|
||||
|
||||
@Autowired
|
||||
private UmsMemberService memberService;
|
||||
|
||||
@ApiOperation("添加商品收藏")
|
||||
@RequestMapping(value = "/addProduct", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult addProduct(@RequestBody MemberProductCollection productCollection) {
|
||||
int count = memberCollectionService.addProduct(productCollection);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("删除收藏商品")
|
||||
@RequestMapping(value = "/deleteProduct/{productId}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult deleteProduct(@PathVariable Long productId) {
|
||||
UmsMember currentMember = memberService.getCurrentMember();
|
||||
int count = memberCollectionService.deleteProduct(currentMember.getId(), productId);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("显示关注列表")
|
||||
@RequestMapping(value = "/listProduct/{memberId}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<List<MemberProductCollection>> listProduct(@PathVariable Long memberId) {
|
||||
List<MemberProductCollection> memberProductCollectionList = memberCollectionService.listProduct(memberId);
|
||||
return CommonResult.success(memberProductCollectionList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.portal.domain.MemberReadHistory;
|
||||
import com.buy507.mall.portal.service.MemberReadHistoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员商品浏览记录管理Controller
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "MemberReadHistoryController", description = "会员商品浏览记录管理")
|
||||
@RequestMapping("/member/readHistory")
|
||||
public class MemberReadHistoryController {
|
||||
@Autowired
|
||||
private MemberReadHistoryService memberReadHistoryService;
|
||||
|
||||
@ApiOperation("创建浏览记录")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult create(@RequestBody MemberReadHistory memberReadHistory) {
|
||||
int count = memberReadHistoryService.create(memberReadHistory);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("删除浏览记录")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult delete(@RequestParam("ids") List<String> ids) {
|
||||
int count = memberReadHistoryService.delete(ids);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("展示浏览记录")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<List<MemberReadHistory>> list(Long memberId) {
|
||||
List<MemberReadHistory> memberReadHistoryList = memberReadHistoryService.list(memberId);
|
||||
return CommonResult.success(memberReadHistoryList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.model.OmsCartItem;
|
||||
import com.buy507.mall.portal.domain.CartItemParam;
|
||||
import com.buy507.mall.portal.domain.CartProduct;
|
||||
import com.buy507.mall.portal.service.OmsCartItemService;
|
||||
import com.buy507.mall.portal.service.UmsMemberService;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 购物车管理Controller
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "OmsCartItemController", description = "购物车管理")
|
||||
@RequestMapping("/cart")
|
||||
public class OmsCartItemController {
|
||||
|
||||
@Autowired
|
||||
private OmsCartItemService cartItemService;
|
||||
|
||||
@Autowired
|
||||
private UmsMemberService memberService;
|
||||
|
||||
@ApiOperation("添加商品到购物车")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult add(@RequestBody CartItemParam cartItemParam) {
|
||||
return cartItemService.add(cartItemParam);
|
||||
}
|
||||
|
||||
@ApiOperation("获取某个会员的购物车列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<OmsCartItem>> list() {
|
||||
List<OmsCartItem> cartItemList = cartItemService.list(memberService.getCurrentMember().getId());
|
||||
return CommonResult.success(cartItemList);
|
||||
}
|
||||
|
||||
/*
|
||||
@ApiOperation("获取某个会员的购物车列表,包括促销信息")
|
||||
@RequestMapping(value = "/list/promotion", method = RequestMethod.GET)
|
||||
public CommonResult<List<CartPromotionItem>> listPromotion() {
|
||||
List<CartPromotionItem> cartPromotionItemList = cartItemService.listPromotion(memberService.getCurrentMember().getId());
|
||||
return CommonResult.success(cartPromotionItemList);
|
||||
}
|
||||
*/
|
||||
|
||||
@ApiOperation("修改购物车中某个商品的数量")
|
||||
@RequestMapping(value = "/update/quantity", method = RequestMethod.GET)
|
||||
public CommonResult updateQuantity(@RequestParam Long id,
|
||||
@RequestParam Integer quantity) {
|
||||
cartItemService.updateQuantity(id, memberService.getCurrentMember().getId(), quantity);
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
@ApiOperation("获取购物车中某个商品的规格,用于重选规格")
|
||||
@RequestMapping(value = "/getProduct/{productId}", method = RequestMethod.GET)
|
||||
public CommonResult<CartProduct> getCartProduct(@PathVariable Long productId) {
|
||||
CartProduct cartProduct = cartItemService.getCartProduct(productId);
|
||||
return CommonResult.success(cartProduct);
|
||||
}
|
||||
|
||||
@ApiOperation("修改购物车中商品的规格")
|
||||
@RequestMapping(value = "/update/attr", method = RequestMethod.POST)
|
||||
public CommonResult updateAttr(@RequestBody OmsCartItem cartItem) {
|
||||
int count = cartItemService.updateAttr(cartItem);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("删除购物车中的某个商品")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
|
||||
cartItemService.delete(memberService.getCurrentMember().getId(), ids);
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
@ApiOperation("清空购物车")
|
||||
@RequestMapping(value = "/clear", method = RequestMethod.POST)
|
||||
public CommonResult clear() {
|
||||
cartItemService.clear(memberService.getCurrentMember().getId());
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.portal.domain.CartOrderParam;
|
||||
import com.buy507.mall.portal.domain.OfflinePaymentParam;
|
||||
import com.buy507.mall.portal.domain.OrderParam;
|
||||
import com.buy507.mall.portal.domain.OrderResult;
|
||||
import com.buy507.mall.portal.domain.SellerBankAccountResult;
|
||||
import com.buy507.mall.portal.service.OmsPortalOrderService;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 订单管理Controller
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "OmsPortalOrderController",description = "订单管理")
|
||||
@RequestMapping("/member/order")
|
||||
public class OmsPortalOrderController {
|
||||
|
||||
@Autowired
|
||||
private OmsPortalOrderService portalOrderService;
|
||||
|
||||
@ApiOperation("获取会员订单信息列表")
|
||||
@ApiImplicitParam(name = "orderStatus", value = "查询订单状态条件:0->待付款; 1->待发货; 2->待收货; 3->已完成; 4->已关闭; 6->全部; 7->待评价 ", paramType = "query")
|
||||
@RequestMapping(value = "/getMemberOrderList", method = RequestMethod.GET)
|
||||
public CommonResult<List<OrderResult>> getMemberOrderList(@RequestParam Integer orderStatus, @RequestParam Integer pageSize, @RequestParam Integer pageNum) {
|
||||
List<OrderResult> result = portalOrderService.getMemberOrderList(orderStatus, pageSize, pageNum);
|
||||
return CommonResult.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("获取会员订单详细信息")
|
||||
@ApiImplicitParam(name = "orderId", value = "订单ID", paramType = "query")
|
||||
@RequestMapping(value = "/getMemberOrderDetailInfo", method = RequestMethod.GET)
|
||||
public CommonResult<OrderResult> getMemberOrderDetailInfo(@RequestParam Long orderId) {
|
||||
OrderResult result = portalOrderService.getMemberOrderDetailInfo(orderId);
|
||||
return CommonResult.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据购物车信息生成订单")
|
||||
@RequestMapping(value = "/createCartOrder",method = RequestMethod.POST)
|
||||
public Object generateOrder(@RequestBody CartOrderParam orderParam) {
|
||||
try {
|
||||
return portalOrderService.createCartOrder(orderParam);
|
||||
} catch (Exception e) {
|
||||
return CommonResult.failed("createCartOrder fail");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("直接购买商品生成订单")
|
||||
@RequestMapping(value = "/createOrder", method = RequestMethod.POST)
|
||||
public CommonResult createOrder(@RequestBody OrderParam orderParam){
|
||||
try {
|
||||
return portalOrderService.createOrder(orderParam);
|
||||
} catch (Exception e) {
|
||||
return CommonResult.failed("createOrder fail");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("取消订单")
|
||||
@RequestMapping(value = "/cancelOrder",method = RequestMethod.POST)
|
||||
public CommonResult cancelOrder(@RequestParam Long orderId){
|
||||
return portalOrderService.cancelOrder(orderId);
|
||||
}
|
||||
|
||||
@ApiOperation("删除订单")
|
||||
@RequestMapping(value = "/deleteOrder",method = RequestMethod.POST)
|
||||
public CommonResult deleteOrder(@RequestParam Long orderId){
|
||||
return portalOrderService.deleteOrder(orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对已付款订单退款
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("退款订单")
|
||||
@RequestMapping(value = "/refundOrder",method = RequestMethod.POST)
|
||||
public CommonResult refundOrder(@RequestParam Long orderId){
|
||||
return portalOrderService.refundOrder(orderId);
|
||||
}
|
||||
|
||||
/*
|
||||
@ApiOperation("自动取消超时订单")
|
||||
@RequestMapping(value = "/cancelTimeOutOrder",method = RequestMethod.POST)
|
||||
public Object cancelTimeOutOrder(){
|
||||
return portalOrderService.cancelTimeOutOrder();
|
||||
}
|
||||
*/
|
||||
|
||||
@ApiOperation("获取商家银行账户信息")
|
||||
@RequestMapping(value = "/getSellerBankAccount",method = RequestMethod.GET)
|
||||
public CommonResult getSellerBankAccount(){
|
||||
SellerBankAccountResult account = portalOrderService.getSellerBankAccount();
|
||||
return CommonResult.success(account);
|
||||
}
|
||||
|
||||
@ApiOperation("线下支付")
|
||||
@RequestMapping(value = "/payment",method = RequestMethod.POST)
|
||||
public CommonResult payment(@RequestBody OfflinePaymentParam paymentParam){
|
||||
return portalOrderService.payment(paymentParam);
|
||||
}
|
||||
|
||||
@ApiOperation("获取物流信息")
|
||||
@ApiImplicitParam(name = "orderId", value = "订单ID", paramType = "query")
|
||||
@RequestMapping(value = "/getLogistics", method = RequestMethod.GET)
|
||||
public CommonResult getLogistics(@RequestParam Long orderId) {
|
||||
return portalOrderService.getLogistics(orderId);
|
||||
}
|
||||
|
||||
@ApiOperation("买家确认收货")
|
||||
@ApiImplicitParam(name = "orderId", value = "订单ID", paramType = "query")
|
||||
@RequestMapping(value = "/confirmReceiving", method = RequestMethod.POST)
|
||||
public CommonResult confirmReceiving(@RequestParam Long orderId) {
|
||||
return portalOrderService.confirmReceiving(orderId);
|
||||
}
|
||||
|
||||
@ApiOperation("积分支付")
|
||||
@ApiImplicitParam(name = "orderId", value = "订单ID", paramType = "query")
|
||||
@RequestMapping(value = "/balancePayment", method = RequestMethod.POST)
|
||||
public CommonResult balancePayment(@RequestParam Long orderId) {
|
||||
return portalOrderService.balancePayment(orderId);
|
||||
}
|
||||
|
||||
@ApiOperation("微信预支付")
|
||||
@ApiImplicitParam(name = "orderId", value = "订单ID", paramType = "query")
|
||||
@RequestMapping(value = "/wxPrePay", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, String>> wxPrePay(@RequestParam Long orderId) {
|
||||
return portalOrderService.wxPrePay(orderId);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("支付宝web跳转接口")
|
||||
@ApiImplicitParam(name = "orderId", value = "订单ID", paramType = "query")
|
||||
@RequestMapping(value = "/toAlipayWeb", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, String>> toAlipayWeb(@RequestParam Long orderId, HttpServletResponse response)
|
||||
throws IOException, AlipayApiException {
|
||||
String result = portalOrderService.toAlipayWeb(orderId);
|
||||
if(result != null){
|
||||
/*String charset = "UTF-8";
|
||||
response.setContentType("text/html;charset=" + charset);
|
||||
OutputStream out = response.getOutputStream();
|
||||
out.write(result.getBytes(charset));
|
||||
response.getOutputStream().flush();
|
||||
response.getWriter().close();*/
|
||||
//请求
|
||||
response.setContentType("text/html;charset=" + "UTF-8");
|
||||
response.getWriter().write(result);
|
||||
response.getWriter().flush();
|
||||
response.getWriter().close();
|
||||
|
||||
}
|
||||
return CommonResult.failed("调用支付宝支付失败");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 微信支付成功回调方法
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping("/wxPay/callback")
|
||||
public void wxPayCallback(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
portalOrderService.wxPayCallback(request, response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支付宝支付回调方法
|
||||
* @param request
|
||||
*/
|
||||
@ApiOperation("支付宝支付回调")
|
||||
@RequestMapping("/alipay/callback")
|
||||
public String alipayCallback(HttpServletRequest request,HttpServletResponse response) throws IOException {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
Map<String, String[]> requestParams = request.getParameterMap();
|
||||
for (String name : requestParams.keySet()) {
|
||||
params.put(name, request.getParameter(name));
|
||||
}
|
||||
portalOrderService.alipayCallback(params);
|
||||
response.sendRedirect("http://49.233.215.129/#/pages/order/order?state=6");
|
||||
return "支付宝回调";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation("加速订单")
|
||||
@RequestMapping(value = "/accelerateOrder",method = RequestMethod.POST)
|
||||
public CommonResult accelerateOrder(@RequestParam Long orderId){
|
||||
return portalOrderService.accelerateOrder(orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通单队列查询信息
|
||||
*/
|
||||
@ApiOperation("普通单排队信息")
|
||||
@RequestMapping("/orderQueue/info")
|
||||
public CommonResult orderQueueInfo() {
|
||||
return portalOrderService.orderQueueInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加速单排队信息
|
||||
*/
|
||||
@ApiOperation(" 加速单排队信息")
|
||||
@RequestMapping("/accelerateOrder/info")
|
||||
public CommonResult accelerateOrderInfo(@RequestParam Long orderId) {
|
||||
return portalOrderService.accelerateOrderInfo(orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 出局名单
|
||||
*/
|
||||
@ApiOperation(" 出局名单")
|
||||
@RequestMapping(path = "/out/list",method = RequestMethod.GET)
|
||||
public CommonResult outOrderInfo() {
|
||||
return CommonResult.success(portalOrderService.outOrderInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 加速出局邀请成功名单
|
||||
*/
|
||||
|
||||
@ApiOperation(" 加速出局邀请成功名单")
|
||||
@RequestMapping(path = "/out/inviteList",method = RequestMethod.GET)
|
||||
public CommonResult inviteList(long orderId) {
|
||||
return CommonResult.success(portalOrderService.inviteList(orderId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.portal.domain.OmsOrderReturnApplyParam;
|
||||
import com.buy507.mall.portal.domain.OrderReturnResult;
|
||||
import com.buy507.mall.portal.service.OmsPortalOrderReturnService;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 订单退货管理Controller
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "OmsPortalOrderReturnController", description = "订单退货管理")
|
||||
@RequestMapping("/member/order/return")
|
||||
public class OmsPortalOrderReturnController {
|
||||
@Autowired
|
||||
private OmsPortalOrderReturnService returnService;
|
||||
|
||||
@ApiOperation("申请退货")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
public CommonResult create(@RequestBody OmsOrderReturnApplyParam returnApply) {
|
||||
int count = returnService.create(returnApply);
|
||||
if (count > 0) {
|
||||
return CommonResult.success(count);
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取退货原因")
|
||||
@RequestMapping(value = "/getReturnReason", method = RequestMethod.GET)
|
||||
public CommonResult<List<String>> getReturnReason() {
|
||||
return CommonResult.success(returnService.getReturnReason());
|
||||
}
|
||||
|
||||
@ApiOperation("获取会员退货订单信息列表")
|
||||
@RequestMapping(value = "/getMemberOrderReturnList", method = RequestMethod.GET)
|
||||
public CommonResult<List<OrderReturnResult>> getMemberOrderReturnList(@RequestParam Integer pageSize, @RequestParam Integer pageNum) {
|
||||
return CommonResult.success(returnService.getMemberOrderReturnList(pageSize, pageNum));
|
||||
}
|
||||
|
||||
@ApiOperation("获取会员退货订单详细信息")
|
||||
@ApiModelProperty(name = "orderReturnId", value = "退货订单ID")
|
||||
@RequestMapping(value = "/getMemberOrderReturnDetailInfo", method = RequestMethod.GET)
|
||||
public CommonResult<OrderReturnResult> getMemberOrderReturnDetailInfo(@RequestParam Long orderReturnId) {
|
||||
return CommonResult.success(returnService.getMemberOrderReturnDetailInfo(orderReturnId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.portal.domain.*;
|
||||
import com.buy507.mall.portal.service.UmsMemberService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 会员管理Controller
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "UmsMemberController", description = "会员管理")
|
||||
@RequestMapping("/member")
|
||||
public class UmsMemberController {
|
||||
|
||||
@Autowired
|
||||
private UmsMemberService memberService;
|
||||
|
||||
|
||||
@ApiOperation("注册")
|
||||
@RequestMapping(value = "/register", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult register(@RequestParam String telephone,
|
||||
@RequestParam String password,
|
||||
@RequestParam String authCode,
|
||||
@RequestParam String invitationCode
|
||||
) {
|
||||
return memberService.register(telephone, password, authCode,invitationCode);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "登录以后返回token")
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult login(@RequestParam String telephone, @RequestParam String password) {
|
||||
Map<String, String> tokenMap = memberService.login(telephone, password);
|
||||
if (tokenMap == null) {
|
||||
return CommonResult.validateFailed("手机号或密码错误");
|
||||
}
|
||||
return CommonResult.success(tokenMap);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "微信登录接口,登录成功以后返回token")
|
||||
@RequestMapping(value = "/wechatLogin", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult<Map<String, String>> wechatLogin(@RequestBody WeChatLogin weChatLogin) {
|
||||
|
||||
if(StringUtils.isEmpty(weChatLogin.getCode())) {
|
||||
return CommonResult.failed("授权码code不能为空");
|
||||
}
|
||||
|
||||
Map<String, String> tokenMap = memberService.wechatLogin(weChatLogin);
|
||||
if (tokenMap == null) {
|
||||
return CommonResult.unauthorized(null);
|
||||
}
|
||||
|
||||
return CommonResult.success(tokenMap);
|
||||
}
|
||||
|
||||
@ApiOperation("获取验证码")
|
||||
@RequestMapping(value = "/getAuthCode", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult getAuthCode(@RequestParam String telephone) {
|
||||
return memberService.generateAuthCode(telephone);
|
||||
}
|
||||
|
||||
/*
|
||||
@ApiOperation("修改密码")
|
||||
@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult updatePassword(@RequestParam String telephone,
|
||||
@RequestParam String password,
|
||||
@RequestParam String authCode) {
|
||||
return memberService.updatePassword(telephone,password,authCode);
|
||||
}
|
||||
*/
|
||||
|
||||
@ApiOperation("获取会员个人信息")
|
||||
@RequestMapping(value = "/getMemberInfo", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<MemberInfoResult> getMemberInfo() {
|
||||
MemberInfoResult result = memberService.getMemberInfo();
|
||||
return CommonResult.success(result);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("修改会员昵称")
|
||||
@RequestMapping(value = "/updateMemberNickname", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult updateMemberNickname(
|
||||
@RequestParam String nickname
|
||||
) {
|
||||
return memberService.updateMemberNickname(nickname);
|
||||
}
|
||||
|
||||
/*
|
||||
@ApiOperation("修改会员性别 gender=性别:0->未知;1->男;2->女")
|
||||
@RequestMapping(value = "/updateMemberGender", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult updateMemberGender(
|
||||
@RequestParam Integer gender
|
||||
) {
|
||||
return memberService.updateMemberGender(gender);
|
||||
}
|
||||
|
||||
@ApiOperation("修改会员头像")
|
||||
@RequestMapping(value = "/updateMemberIcon", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult updateMemberIcon(
|
||||
@RequestParam String icon
|
||||
) {
|
||||
return memberService.updateMemberIcon(icon);
|
||||
}
|
||||
*/
|
||||
|
||||
@ApiOperation("修改会员手机号")
|
||||
@RequestMapping(value = "/updateMemberPhone", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult updateMemberPhone(
|
||||
@RequestParam String authCode,
|
||||
@RequestParam String newPhone
|
||||
) {
|
||||
return memberService.updateMemberPhone(newPhone, authCode);
|
||||
}
|
||||
|
||||
@ApiOperation("修改真实姓名")
|
||||
@RequestMapping(value = "/updateRealName", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult<String> updateRealName(@RequestParam String realName) {
|
||||
return memberService.updateRealName(realName);
|
||||
}
|
||||
|
||||
@ApiOperation("修改联系地址")
|
||||
@RequestMapping(value = "/updateAddress", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult<String> updateAddress(@RequestParam String address) {
|
||||
return memberService.updateAddress(address);
|
||||
}
|
||||
|
||||
@ApiOperation("修改个人来源")
|
||||
@RequestMapping(value = "/updateSourceType", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult<String> updateSourceType(@RequestParam Integer sourceType) {
|
||||
return memberService.updateSourceType(sourceType);
|
||||
}
|
||||
|
||||
@ApiOperation("分享邀请码")
|
||||
@RequestMapping(value = "/shareInvite", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<Map<String, String>> shareInvite() {
|
||||
return memberService.shareInvite();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取森态积分明细")
|
||||
@RequestMapping(value = "/getAccountDetail", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult getAccountDetail(@RequestParam Integer pageSize, @RequestParam Integer pageNum) {
|
||||
return CommonResult.success(memberService.getAccountDetail(pageSize, pageNum));
|
||||
}
|
||||
|
||||
/*
|
||||
@ApiOperation("获取冻结积分明细")
|
||||
@RequestMapping(value = "/getFreezeAccountDetail", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult getFreezeAccountDetail(@RequestParam Integer pageSize, @RequestParam Integer pageNum) {
|
||||
return CommonResult.success(memberService.getAccountDetail(AccountType.Freeze, pageSize, pageNum));
|
||||
}
|
||||
*/
|
||||
|
||||
@ApiOperation("获取团队成员列表")
|
||||
@RequestMapping(value = "/getTeamList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult getTeamList(@RequestParam Long memberId, @RequestParam Integer pageSize, @RequestParam Integer pageNum) {
|
||||
return CommonResult.success(memberService.getTeamList(memberId, pageSize, pageNum));
|
||||
}
|
||||
|
||||
@ApiOperation("获取会员提现记录")
|
||||
@RequestMapping(value = "/getWithdrawApply", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult getWithdrawApply(@RequestParam Integer pageSize, @RequestParam Integer pageNum) {
|
||||
return CommonResult.success(memberService.getWithdrawApply(pageSize, pageNum));
|
||||
}
|
||||
|
||||
@ApiOperation("会员提现申请")
|
||||
@RequestMapping(value = "/withdrawApply", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult withdrawApply(@RequestBody WithdrawApplyParam applyParam) {
|
||||
return memberService.withdrawApply(applyParam);
|
||||
}
|
||||
|
||||
@ApiOperation("会员转账")
|
||||
@RequestMapping(value = "/transfer", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult transfer(@RequestBody MemberTransferParam transferParam) {
|
||||
return memberService.transfer(transferParam);
|
||||
}
|
||||
|
||||
@ApiOperation("获取会员转账记录")
|
||||
@RequestMapping(value = "/getTransferList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult getTransferList(@RequestParam Integer pageSize, @RequestParam Integer pageNum) {
|
||||
return CommonResult.success(memberService.getTransferList(pageSize, pageNum));
|
||||
}
|
||||
|
||||
@ApiOperation("注册完善个人资料")
|
||||
@RequestMapping(value = "/firstSaveMemberInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult<String> firstSaveMemberInfo(@RequestBody FirstMemberInfoParam memberInfoParam) {
|
||||
return memberService.firstSaveMemberInfo(memberInfoParam);
|
||||
}
|
||||
|
||||
@ApiOperation("根据手机号获取用户真实姓名")
|
||||
@RequestMapping(value = "/getRealName", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<Map<String, String>> getRealName(@RequestParam String phone) {
|
||||
return memberService.getRealName(phone);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("邀请码绑定")
|
||||
@RequestMapping(value = "/invitationCodeBinding", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<Map<String, String>> invitationCodeBinding(
|
||||
@RequestParam String invitationCode, @RequestParam String targetMemberId) {
|
||||
return CommonResult.success(null, null);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("个人团队")
|
||||
@RequestMapping(value = "/personalTeam", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<Map<String, Object>> personalTeam() {
|
||||
return memberService.personalTeam();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.model.SmsCouponHistory;
|
||||
import com.buy507.mall.portal.domain.CartPromotionItem;
|
||||
import com.buy507.mall.portal.domain.SmsCouponHistoryDetail;
|
||||
import com.buy507.mall.portal.service.OmsCartItemService;
|
||||
import com.buy507.mall.portal.service.UmsMemberCouponService;
|
||||
import com.buy507.mall.portal.service.UmsMemberService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户优惠券管理Controller
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "UmsMemberCouponController", description = "用户优惠券管理")
|
||||
@RequestMapping("/member/coupon")
|
||||
public class UmsMemberCouponController {
|
||||
@Autowired
|
||||
private UmsMemberCouponService memberCouponService;
|
||||
@Autowired
|
||||
private OmsCartItemService cartItemService;
|
||||
@Autowired
|
||||
private UmsMemberService memberService;
|
||||
|
||||
@ApiOperation("领取指定优惠券")
|
||||
@RequestMapping(value = "/add/{couponId}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult add(@PathVariable Long couponId) {
|
||||
return memberCouponService.add(couponId);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户优惠券列表")
|
||||
@ApiImplicitParam(name = "useStatus", value = "优惠券筛选类型:0->未使用;1->已使用;2->已过期",
|
||||
allowableValues = "0,1,2", paramType = "query", dataType = "integer")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<List<SmsCouponHistory>> list(@RequestParam(value = "useStatus", required = false) Integer useStatus) {
|
||||
List<SmsCouponHistory> couponHistoryList = memberCouponService.list(useStatus);
|
||||
return CommonResult.success(couponHistoryList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取登录会员购物车的相关优惠券")
|
||||
@ApiImplicitParam(name = "type", value = "使用可用:0->不可用;1->可用",
|
||||
defaultValue = "1", allowableValues = "0,1", paramType = "query", dataType = "integer")
|
||||
@RequestMapping(value = "/list/cart/{type}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<List<SmsCouponHistoryDetail>> listCart(@PathVariable Integer type) {
|
||||
List<CartPromotionItem> cartPromotionItemList = cartItemService.listPromotion(memberService.getCurrentMember().getId());
|
||||
List<SmsCouponHistoryDetail> couponHistoryList = memberCouponService.listCart(cartPromotionItemList, type);
|
||||
return CommonResult.success(couponHistoryList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.model.UmsMemberReceiveAddress;
|
||||
import com.buy507.mall.portal.domain.AreaOptions;
|
||||
import com.buy507.mall.portal.service.UmsMemberReceiveAddressService;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 会员收货地址管理Controller
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "UmsMemberReceiveAddressController", description = "会员收货地址管理")
|
||||
@RequestMapping("/member/address")
|
||||
public class UmsMemberReceiveAddressController {
|
||||
|
||||
@Autowired
|
||||
private UmsMemberReceiveAddressService memberReceiveAddressService;
|
||||
|
||||
@ApiOperation("添加收货地址")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult add(@RequestBody UmsMemberReceiveAddress address) {
|
||||
return memberReceiveAddressService.add(address);
|
||||
}
|
||||
|
||||
@ApiOperation("删除收货地址")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
public CommonResult delete(@PathVariable Long id) {
|
||||
return memberReceiveAddressService.delete(id);
|
||||
}
|
||||
|
||||
@ApiOperation("修改收货地址")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
public CommonResult update(@PathVariable Long id, @RequestBody UmsMemberReceiveAddress address) {
|
||||
return memberReceiveAddressService.update(id, address);
|
||||
}
|
||||
|
||||
@ApiOperation("显示所有收货地址")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<UmsMemberReceiveAddress>> list() {
|
||||
List<UmsMemberReceiveAddress> addressList = memberReceiveAddressService.list();
|
||||
return CommonResult.success(addressList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户默认收货地址")
|
||||
@RequestMapping(value = "/getDefaultReceivingAddress", method = RequestMethod.GET)
|
||||
public CommonResult<UmsMemberReceiveAddress> getDefaultReceivingAddress() {
|
||||
UmsMemberReceiveAddress defaultReceivingAddress = memberReceiveAddressService.getDefaultReceivingAddress();
|
||||
return CommonResult.success(defaultReceivingAddress);
|
||||
}
|
||||
|
||||
@ApiOperation("获取单个收货地址")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<UmsMemberReceiveAddress> get(@PathVariable Long id) {
|
||||
UmsMemberReceiveAddress address = memberReceiveAddressService.get(id);
|
||||
return CommonResult.success(address);
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有地区信息")
|
||||
@RequestMapping(value = "/getAllArea", method = RequestMethod.GET)
|
||||
public CommonResult<List<AreaOptions>> getAllArea() {
|
||||
List<AreaOptions> areaList = memberReceiveAddressService.getAllArea();
|
||||
return CommonResult.success(areaList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.buy507.mall.portal.dao;
|
||||
|
||||
import com.buy507.mall.model.CmsSubject;
|
||||
import com.buy507.mall.model.PmsBrand;
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
import com.buy507.mall.portal.domain.FlashPromotionProduct;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 首页内容管理自定义Dao
|
||||
*/
|
||||
public interface HomeDao {
|
||||
|
||||
/**
|
||||
* 获取推荐品牌
|
||||
*/
|
||||
List<PmsBrand> getRecommendBrandList(@Param("offset") Integer offset,@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* 获取秒杀商品
|
||||
*/
|
||||
List<FlashPromotionProduct> getFlashProductList(@Param("flashPromotionId") Long flashPromotionId, @Param("sessionId") Long sessionId);
|
||||
|
||||
/**
|
||||
* 获取新品推荐
|
||||
*/
|
||||
List<PmsProduct> getNewProductList(@Param("offset") Integer offset,@Param("limit") Integer limit);
|
||||
/**
|
||||
* 获取人气推荐
|
||||
*/
|
||||
List<PmsProduct> getHotProductList(@Param("offset") Integer offset,@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* 获取推荐专题
|
||||
*/
|
||||
List<CmsSubject> getRecommendSubjectList(@Param("offset") Integer offset, @Param("limit") Integer limit);
|
||||
/*
|
||||
* 获取所有商品信息按销量排序
|
||||
*/
|
||||
List<PmsProduct> getAllPioductList();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.buy507.mall.portal.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.buy507.mall.portal.domain.MemberTransferResult;
|
||||
import com.buy507.mall.portal.domain.MemberWithdrawApplyResult;
|
||||
import com.buy507.mall.portal.domain.TeamMemberResult;
|
||||
|
||||
public interface PortalMemberDao {
|
||||
|
||||
List<TeamMemberResult> selectMemberTeamList(Long memberId);
|
||||
|
||||
List<MemberWithdrawApplyResult> selectMemberWithdrawApplyList(Long memberId);
|
||||
|
||||
List<MemberTransferResult> selectMemberTransferList(Long memberId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.buy507.mall.portal.dao;
|
||||
|
||||
import com.buy507.mall.model.OmsOrderItem;
|
||||
import com.buy507.mall.portal.domain.OmsOrderDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前台订单自定义Dao
|
||||
*/
|
||||
public interface PortalOrderDao {
|
||||
/**
|
||||
* 获取订单及下单商品详情
|
||||
*/
|
||||
OmsOrderDetail getDetail(@Param("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 修改 pms_sku_stock表的锁定库存及真实库存
|
||||
*/
|
||||
int updateSkuStock(@Param("itemList") List<OmsOrderItem> orderItemList);
|
||||
|
||||
/**
|
||||
* 获取超时订单
|
||||
* @param minute 超时时间(分)
|
||||
*/
|
||||
List<OmsOrderDetail> getTimeOutOrders(@Param("minute") Integer minute);
|
||||
|
||||
/**
|
||||
* 批量修改订单状态
|
||||
*/
|
||||
int updateOrderStatus(@Param("ids") List<Long> ids,@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* 解除取消订单的库存锁定
|
||||
*/
|
||||
int releaseSkuStockLock(@Param("itemList") List<OmsOrderItem> orderItemList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.buy507.mall.portal.dao;
|
||||
|
||||
import com.buy507.mall.model.OmsOrderItem;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单商品信息自定义Dao
|
||||
*/
|
||||
public interface PortalOrderItemDao {
|
||||
int insertList(@Param("list") List<OmsOrderItem> list);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.buy507.mall.portal.dao;
|
||||
|
||||
import com.buy507.mall.portal.domain.CartProduct;
|
||||
import com.buy507.mall.portal.domain.PromotionProduct;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前台系统自定义商品Dao
|
||||
*/
|
||||
public interface PortalProductDao {
|
||||
CartProduct getCartProduct(@Param("id") Long id);
|
||||
List<PromotionProduct> getPromotionProductList(@Param("ids") List<Long> ids);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.buy507.mall.portal.dao;
|
||||
|
||||
import com.buy507.mall.portal.domain.SmsCouponHistoryDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员优惠券领取历史自定义Dao
|
||||
*/
|
||||
public interface SmsCouponHistoryDao {
|
||||
List<SmsCouponHistoryDetail> getDetailList(@Param("memberId") Long memberId);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class AccountDetailResult {
|
||||
|
||||
@ApiModelProperty(value = "收支类型(0->收入;1->支出)")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "收支类型(0->收入;1->支出)")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "金额")
|
||||
private BigDecimal value;
|
||||
|
||||
@ApiModelProperty(value = "显示标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String note;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public void setTypeName(String typeName) {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public BigDecimal getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(BigDecimal value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @auther macrozheng
|
||||
* @description 支付宝支付请求参数
|
||||
* @date 2023/9/8
|
||||
* @github https://github.com/macrozheng
|
||||
*/
|
||||
@Data
|
||||
public class AliPayParam {
|
||||
/**
|
||||
* 商户订单号,商家自定义,保持唯一性
|
||||
*/
|
||||
private String outTradeNo;
|
||||
/**
|
||||
* 商品的标题/交易标题/订单标题/订单关键字等
|
||||
*/
|
||||
private String subject;
|
||||
/**
|
||||
* 订单总金额,单位为元,精确到小数点后两位
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlipayPayTradeDto {
|
||||
|
||||
private String subject;
|
||||
|
||||
private String outTradeNo;
|
||||
|
||||
private String totalFee;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AreaOptions {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer level;
|
||||
|
||||
private Integer pid;
|
||||
|
||||
private List<AreaOptions> children;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Integer getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(Integer pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public List<AreaOptions> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<AreaOptions> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 加入购物车传入参数
|
||||
*
|
||||
*/
|
||||
public class CartItemParam {
|
||||
|
||||
@ApiModelProperty(value = "SKU ID")
|
||||
private Long skuId;
|
||||
|
||||
@ApiModelProperty(value = "商品数量")
|
||||
private Integer quantity;
|
||||
|
||||
public Long getSkuId() {
|
||||
return skuId;
|
||||
}
|
||||
|
||||
public void setSkuId(Long skuId) {
|
||||
this.skuId = skuId;
|
||||
}
|
||||
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 生成订单时传入的参数
|
||||
*/
|
||||
@ApiModel("购物车生成订单的参数实体")
|
||||
public class CartOrderParam {
|
||||
|
||||
@ApiModelProperty(value = "提货方式:0->自提;1->物流")
|
||||
private Integer deliveryType;
|
||||
|
||||
@ApiModelProperty(value = "会员收货地址ID")
|
||||
private Long memberReceiveAddressId;
|
||||
|
||||
@ApiModelProperty(value = "抵扣积分")
|
||||
private BigDecimal integration;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String note;
|
||||
|
||||
public Integer getDeliveryType() {
|
||||
return deliveryType;
|
||||
}
|
||||
|
||||
public void setDeliveryType(Integer deliveryType) {
|
||||
this.deliveryType = deliveryType;
|
||||
}
|
||||
|
||||
public Long getMemberReceiveAddressId() {
|
||||
return memberReceiveAddressId;
|
||||
}
|
||||
|
||||
public void setMemberReceiveAddressId(Long memberReceiveAddressId) {
|
||||
this.memberReceiveAddressId = memberReceiveAddressId;
|
||||
}
|
||||
|
||||
public BigDecimal getIntegration() {
|
||||
return integration;
|
||||
}
|
||||
|
||||
public void setIntegration(BigDecimal integration) {
|
||||
this.integration = integration;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
import com.buy507.mall.model.PmsProductAttribute;
|
||||
import com.buy507.mall.model.PmsSkuStock;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 购物车中选择规格的商品信息
|
||||
*/
|
||||
public class CartProduct extends PmsProduct {
|
||||
private List<PmsProductAttribute> productAttributeList;
|
||||
private List<PmsSkuStock> skuStockList;
|
||||
|
||||
public List<PmsProductAttribute> getProductAttributeList() {
|
||||
return productAttributeList;
|
||||
}
|
||||
|
||||
public void setProductAttributeList(List<PmsProductAttribute> productAttributeList) {
|
||||
this.productAttributeList = productAttributeList;
|
||||
}
|
||||
|
||||
public List<PmsSkuStock> getSkuStockList() {
|
||||
return skuStockList;
|
||||
}
|
||||
|
||||
public void setSkuStockList(List<PmsSkuStock> skuStockList) {
|
||||
this.skuStockList = skuStockList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import com.buy507.mall.model.OmsCartItem;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 购物车中促销信息的封装
|
||||
*/
|
||||
public class CartPromotionItem extends OmsCartItem{
|
||||
//促销活动信息
|
||||
private String promotionMessage;
|
||||
//促销活动减去的金额,针对每个商品
|
||||
private BigDecimal reduceAmount;
|
||||
//商品的真实库存(剩余库存-锁定库存)
|
||||
private Integer realStock;
|
||||
//购买商品赠送积分
|
||||
private Integer integration;
|
||||
//购买商品赠送成长值
|
||||
private Integer growth;
|
||||
public String getPromotionMessage() {
|
||||
return promotionMessage;
|
||||
}
|
||||
|
||||
public void setPromotionMessage(String promotionMessage) {
|
||||
this.promotionMessage = promotionMessage;
|
||||
}
|
||||
|
||||
public BigDecimal getReduceAmount() {
|
||||
return reduceAmount;
|
||||
}
|
||||
|
||||
public void setReduceAmount(BigDecimal reduceAmount) {
|
||||
this.reduceAmount = reduceAmount;
|
||||
}
|
||||
|
||||
public Integer getRealStock() {
|
||||
return realStock;
|
||||
}
|
||||
|
||||
public void setRealStock(Integer realStock) {
|
||||
this.realStock = realStock;
|
||||
}
|
||||
|
||||
public Integer getIntegration() {
|
||||
return integration;
|
||||
}
|
||||
|
||||
public void setIntegration(Integer integration) {
|
||||
this.integration = integration;
|
||||
}
|
||||
|
||||
public Integer getGrowth() {
|
||||
return growth;
|
||||
}
|
||||
|
||||
public void setGrowth(Integer growth) {
|
||||
this.growth = growth;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import com.buy507.mall.model.UmsIntegrationConsumeSetting;
|
||||
import com.buy507.mall.model.UmsMemberReceiveAddress;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 确认单信息封装
|
||||
*/
|
||||
public class ConfirmOrderResult {
|
||||
//包含优惠信息的购物车信息
|
||||
private List<CartPromotionItem> cartPromotionItemList;
|
||||
//用户收货地址列表
|
||||
private List<UmsMemberReceiveAddress> memberReceiveAddressList;
|
||||
//用户可用优惠券列表
|
||||
private List<SmsCouponHistoryDetail> couponHistoryDetailList;
|
||||
//积分使用规则
|
||||
private UmsIntegrationConsumeSetting integrationConsumeSetting;
|
||||
//会员持有的积分
|
||||
private Integer memberIntegration;
|
||||
//计算的金额
|
||||
private CalcAmount calcAmount;
|
||||
|
||||
public List<CartPromotionItem> getCartPromotionItemList() {
|
||||
return cartPromotionItemList;
|
||||
}
|
||||
|
||||
public void setCartPromotionItemList(List<CartPromotionItem> cartPromotionItemList) {
|
||||
this.cartPromotionItemList = cartPromotionItemList;
|
||||
}
|
||||
|
||||
public List<UmsMemberReceiveAddress> getMemberReceiveAddressList() {
|
||||
return memberReceiveAddressList;
|
||||
}
|
||||
|
||||
public void setMemberReceiveAddressList(List<UmsMemberReceiveAddress> memberReceiveAddressList) {
|
||||
this.memberReceiveAddressList = memberReceiveAddressList;
|
||||
}
|
||||
|
||||
public List<SmsCouponHistoryDetail> getCouponHistoryDetailList() {
|
||||
return couponHistoryDetailList;
|
||||
}
|
||||
|
||||
public void setCouponHistoryDetailList(List<SmsCouponHistoryDetail> couponHistoryDetailList) {
|
||||
this.couponHistoryDetailList = couponHistoryDetailList;
|
||||
}
|
||||
|
||||
public UmsIntegrationConsumeSetting getIntegrationConsumeSetting() {
|
||||
return integrationConsumeSetting;
|
||||
}
|
||||
|
||||
public void setIntegrationConsumeSetting(UmsIntegrationConsumeSetting integrationConsumeSetting) {
|
||||
this.integrationConsumeSetting = integrationConsumeSetting;
|
||||
}
|
||||
|
||||
public Integer getMemberIntegration() {
|
||||
return memberIntegration;
|
||||
}
|
||||
|
||||
public void setMemberIntegration(Integer memberIntegration) {
|
||||
this.memberIntegration = memberIntegration;
|
||||
}
|
||||
|
||||
public CalcAmount getCalcAmount() {
|
||||
return calcAmount;
|
||||
}
|
||||
|
||||
public void setCalcAmount(CalcAmount calcAmount) {
|
||||
this.calcAmount = calcAmount;
|
||||
}
|
||||
|
||||
public static class CalcAmount{
|
||||
//订单商品总金额
|
||||
private BigDecimal totalAmount;
|
||||
//运费
|
||||
private BigDecimal freightAmount;
|
||||
//活动优惠
|
||||
private BigDecimal promotionAmount;
|
||||
//应付金额
|
||||
private BigDecimal payAmount;
|
||||
|
||||
public BigDecimal getTotalAmount() {
|
||||
return totalAmount;
|
||||
}
|
||||
|
||||
public void setTotalAmount(BigDecimal totalAmount) {
|
||||
this.totalAmount = totalAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getFreightAmount() {
|
||||
return freightAmount;
|
||||
}
|
||||
|
||||
public void setFreightAmount(BigDecimal freightAmount) {
|
||||
this.freightAmount = freightAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getPromotionAmount() {
|
||||
return promotionAmount;
|
||||
}
|
||||
|
||||
public void setPromotionAmount(BigDecimal promotionAmount) {
|
||||
this.promotionAmount = promotionAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getPayAmount() {
|
||||
return payAmount;
|
||||
}
|
||||
|
||||
public void setPayAmount(BigDecimal payAmount) {
|
||||
this.payAmount = payAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 进入小程序完善个人资料的传参实体
|
||||
*
|
||||
*/
|
||||
@ApiModel("完善个人资料的传参实体")
|
||||
public class FirstMemberInfoParam {
|
||||
|
||||
@ApiModelProperty(value = "电话号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "验证码")
|
||||
private String authCode;
|
||||
|
||||
@ApiModelProperty(value = "联系地址")
|
||||
private String detailAddress;
|
||||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String realName;
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getAuthCode() {
|
||||
return authCode;
|
||||
}
|
||||
|
||||
public void setAuthCode(String authCode) {
|
||||
this.authCode = authCode;
|
||||
}
|
||||
|
||||
public String getDetailAddress() {
|
||||
return detailAddress;
|
||||
}
|
||||
|
||||
public void setDetailAddress(String detailAddress) {
|
||||
this.detailAddress = detailAddress;
|
||||
}
|
||||
|
||||
public String getRealName() {
|
||||
return realName;
|
||||
}
|
||||
|
||||
public void setRealName(String realName) {
|
||||
this.realName = realName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 秒杀信息和商品对象封装
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class FlashPromotionProduct extends PmsProduct{
|
||||
private BigDecimal flashPromotionPrice;
|
||||
private Integer flashPromotionCount;
|
||||
private Integer flashPromotionLimit;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import com.buy507.mall.model.CmsSubject;
|
||||
import com.buy507.mall.model.PmsBrand;
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
import com.buy507.mall.model.SmsHomeAdvertise;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 首页内容返回信息封装
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class HomeContentResult {
|
||||
//轮播广告
|
||||
private List<SmsHomeAdvertise> advertiseList;
|
||||
//推荐品牌
|
||||
private List<PmsBrand> brandList;
|
||||
//当前秒杀场次
|
||||
private HomeFlashPromotion homeFlashPromotion;
|
||||
//新品推荐
|
||||
private List<PmsProduct> newProductList;
|
||||
//人气推荐
|
||||
private List<PmsProduct> hotProductList;
|
||||
//推荐专题
|
||||
private List<CmsSubject> subjectList;
|
||||
//查询所有商品按销量排序
|
||||
private List<PmsProduct> allProductList;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 首页当前秒杀场次信息
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class HomeFlashPromotion {
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone="GMT+8")
|
||||
private Date startTime;
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone="GMT+8")
|
||||
private Date endTime;
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone="GMT+8")
|
||||
private Date nextStartTime;
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone="GMT+8")
|
||||
private Date nextEndTime;
|
||||
private String name;
|
||||
//属于该秒杀活动的商品
|
||||
private List<FlashPromotionProduct> productList;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class LogisticsResult {
|
||||
|
||||
@ApiModelProperty(value = "物流状态: 0->在途;1->揽收;2->疑难;3->签收;4->退签;5->派件;6->退回")
|
||||
private String state;
|
||||
|
||||
@ApiModelProperty(value = "物流状态: 0->在途;1->揽收;2->疑难;3->签收;4->退签;5->派件;6->退回")
|
||||
private String stateName;
|
||||
|
||||
private Object data;
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getStateName() {
|
||||
return stateName;
|
||||
}
|
||||
|
||||
public void setStateName(String stateName) {
|
||||
this.stateName = stateName;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import com.buy507.mall.model.DefaultStatus;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("会员银行卡实体")
|
||||
public class MemberBankAccount {
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "账户名")
|
||||
private String accountName;
|
||||
|
||||
@ApiModelProperty(value = "银行名称")
|
||||
private String bankName;
|
||||
|
||||
@ApiModelProperty(value = "银行卡号")
|
||||
private String bankCardNum;
|
||||
|
||||
@ApiModelProperty(value = "开户行地址")
|
||||
private String openBankAddress;
|
||||
|
||||
@ApiModelProperty(value = "是否默认:No->否;Yes->是")
|
||||
private DefaultStatus defaultStatus;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
public String getBankName() {
|
||||
return bankName;
|
||||
}
|
||||
|
||||
public void setBankName(String bankName) {
|
||||
this.bankName = bankName;
|
||||
}
|
||||
|
||||
public String getBankCardNum() {
|
||||
return bankCardNum;
|
||||
}
|
||||
|
||||
public void setBankCardNum(String bankCardNum) {
|
||||
this.bankCardNum = bankCardNum;
|
||||
}
|
||||
|
||||
public String getOpenBankAddress() {
|
||||
return openBankAddress;
|
||||
}
|
||||
|
||||
public void setOpenBankAddress(String openBankAddress) {
|
||||
this.openBankAddress = openBankAddress;
|
||||
}
|
||||
|
||||
public DefaultStatus getDefaultStatus() {
|
||||
return defaultStatus;
|
||||
}
|
||||
|
||||
public void setDefaultStatus(DefaultStatus defaultStatus) {
|
||||
this.defaultStatus = defaultStatus;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 会员关注的品牌
|
||||
*/
|
||||
@Document
|
||||
public class MemberBrandAttention {
|
||||
@Id
|
||||
private String id;
|
||||
@Indexed
|
||||
private Long memberId;
|
||||
private String memberNickname;
|
||||
private String memberIcon;
|
||||
@Indexed
|
||||
private Long brandId;
|
||||
private String brandName;
|
||||
private String brandLogo;
|
||||
private String brandCity;
|
||||
private Integer brandAttentionCount;
|
||||
private Date createTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public String getMemberNickname() {
|
||||
return memberNickname;
|
||||
}
|
||||
|
||||
public void setMemberNickname(String memberNickname) {
|
||||
this.memberNickname = memberNickname;
|
||||
}
|
||||
|
||||
public String getMemberIcon() {
|
||||
return memberIcon;
|
||||
}
|
||||
|
||||
public void setMemberIcon(String memberIcon) {
|
||||
this.memberIcon = memberIcon;
|
||||
}
|
||||
|
||||
public Long getBrandId() {
|
||||
return brandId;
|
||||
}
|
||||
|
||||
public void setBrandId(Long brandId) {
|
||||
this.brandId = brandId;
|
||||
}
|
||||
|
||||
public String getBrandName() {
|
||||
return brandName;
|
||||
}
|
||||
|
||||
public void setBrandName(String brandName) {
|
||||
this.brandName = brandName;
|
||||
}
|
||||
|
||||
public String getBrandLogo() {
|
||||
return brandLogo;
|
||||
}
|
||||
|
||||
public void setBrandLogo(String brandLogo) {
|
||||
this.brandLogo = brandLogo;
|
||||
}
|
||||
|
||||
public String getBrandCity() {
|
||||
return brandCity;
|
||||
}
|
||||
|
||||
public void setBrandCity(String brandCity) {
|
||||
this.brandCity = brandCity;
|
||||
}
|
||||
|
||||
public Integer getBrandAttentionCount() {
|
||||
return brandAttentionCount;
|
||||
}
|
||||
|
||||
public void setBrandAttentionCount(Integer brandAttentionCount) {
|
||||
this.brandAttentionCount = brandAttentionCount;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import com.buy507.mall.model.UmsMember;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 会员详情封装
|
||||
*/
|
||||
public class MemberDetails implements UserDetails {
|
||||
private UmsMember umsMember;
|
||||
|
||||
public MemberDetails(UmsMember umsMember) {
|
||||
this.umsMember = umsMember;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
//返回当前用户的权限
|
||||
return Arrays.asList(new SimpleGrantedAuthority("TEST"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return umsMember.getPassword();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return umsMember.getUsername();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonExpired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonLocked() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCredentialsNonExpired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return umsMember.getStatus()==1;
|
||||
}
|
||||
|
||||
public UmsMember getUmsMember() {
|
||||
return umsMember;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("会员信息")
|
||||
public class MemberInfoResult {
|
||||
|
||||
@ApiModelProperty(value = "会员ID")
|
||||
private Long memberId;
|
||||
|
||||
@ApiModelProperty(value = "会员昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "会员等级")
|
||||
private Integer memberLevel;
|
||||
|
||||
@ApiModelProperty(value = "会员等级名称")
|
||||
private String memberLevelName;
|
||||
|
||||
@ApiModelProperty(value = "余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
@ApiModelProperty(value = "冻结余额")
|
||||
private BigDecimal freeze;
|
||||
|
||||
@ApiModelProperty(value = "会员消费总金额")
|
||||
private BigDecimal memberTotalConsume;
|
||||
|
||||
@ApiModelProperty(value = "团队消费总金额")
|
||||
private BigDecimal teamTotalConsume;
|
||||
|
||||
@ApiModelProperty(value = "优惠卷")
|
||||
private Integer coupon;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String headPicture;
|
||||
|
||||
@ApiModelProperty(value = "性别:0->保密;1->男;2->女")
|
||||
private Integer gender;
|
||||
|
||||
@ApiModelProperty(value = "性别中文显示:0->保密;1->男;2->女")
|
||||
private String genderName;
|
||||
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "邀请人")
|
||||
private String inviter;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "联系地址")
|
||||
private String detailAddress;
|
||||
|
||||
@ApiModelProperty(value = "总收入")
|
||||
private String totalIncome;
|
||||
|
||||
@ApiModelProperty(value = "今日收入")
|
||||
private String todayIncome;
|
||||
|
||||
@ApiModelProperty(value = "1:线上,2:线下")
|
||||
private Integer sourceType;
|
||||
|
||||
|
||||
|
||||
public Long getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
public void setNickname(String nickname) {
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
public Integer getMemberLevel() {
|
||||
return memberLevel;
|
||||
}
|
||||
|
||||
public void setMemberLevel(Integer memberLevel) {
|
||||
this.memberLevel = memberLevel;
|
||||
}
|
||||
|
||||
public String getMemberLevelName() {
|
||||
return memberLevelName;
|
||||
}
|
||||
|
||||
public void setMemberLevelName(String memberLevelName) {
|
||||
this.memberLevelName = memberLevelName;
|
||||
}
|
||||
|
||||
public BigDecimal getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(BigDecimal balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public BigDecimal getFreeze() {
|
||||
return freeze;
|
||||
}
|
||||
|
||||
public void setFreeze(BigDecimal freeze) {
|
||||
this.freeze = freeze;
|
||||
}
|
||||
|
||||
public BigDecimal getMemberTotalConsume() {
|
||||
return memberTotalConsume;
|
||||
}
|
||||
|
||||
public void setMemberTotalConsume(BigDecimal memberTotalConsume) {
|
||||
this.memberTotalConsume = memberTotalConsume;
|
||||
}
|
||||
|
||||
public BigDecimal getTeamTotalConsume() {
|
||||
return teamTotalConsume;
|
||||
}
|
||||
|
||||
public void setTeamTotalConsume(BigDecimal teamTotalConsume) {
|
||||
this.teamTotalConsume = teamTotalConsume;
|
||||
}
|
||||
|
||||
public Integer getCoupon() {
|
||||
return coupon;
|
||||
}
|
||||
|
||||
public void setCoupon(Integer coupon) {
|
||||
this.coupon = coupon;
|
||||
}
|
||||
|
||||
public String getHeadPicture() {
|
||||
return headPicture;
|
||||
}
|
||||
|
||||
public void setHeadPicture(String headPicture) {
|
||||
this.headPicture = headPicture;
|
||||
}
|
||||
|
||||
public Integer getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(Integer gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getGenderName() {
|
||||
return genderName;
|
||||
}
|
||||
|
||||
public void setGenderName(String genderName) {
|
||||
this.genderName = genderName;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getInviter() {
|
||||
return inviter;
|
||||
}
|
||||
|
||||
public void setInviter(String inviter) {
|
||||
this.inviter = inviter;
|
||||
}
|
||||
|
||||
public String getRealName() {
|
||||
return realName;
|
||||
}
|
||||
|
||||
public void setRealName(String realName) {
|
||||
this.realName = realName;
|
||||
}
|
||||
|
||||
public String getDetailAddress() {
|
||||
return detailAddress;
|
||||
}
|
||||
|
||||
public void setDetailAddress(String detailAddress) {
|
||||
this.detailAddress = detailAddress;
|
||||
}
|
||||
|
||||
public String getTotalIncome() {
|
||||
return totalIncome;
|
||||
}
|
||||
|
||||
public void setTotalIncome(String totalIncome) {
|
||||
this.totalIncome = totalIncome;
|
||||
}
|
||||
|
||||
public String getTodayIncome() {
|
||||
return todayIncome;
|
||||
}
|
||||
|
||||
public void setTodayIncome(String todayIncome) {
|
||||
this.todayIncome = todayIncome;
|
||||
}
|
||||
|
||||
public Integer getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
public void setSourceType(Integer sourceType) {
|
||||
this.sourceType = sourceType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户收藏的商品
|
||||
*/
|
||||
public class MemberProductCollection {
|
||||
@Id
|
||||
private String id;
|
||||
@Indexed
|
||||
private Long memberId;
|
||||
private String memberNickname;
|
||||
private String memberIcon;
|
||||
@Indexed
|
||||
private Long productId;
|
||||
private String productName;
|
||||
private String productPic;
|
||||
private String productSubTitle;
|
||||
private String productPrice;
|
||||
private Date createTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public String getMemberNickname() {
|
||||
return memberNickname;
|
||||
}
|
||||
|
||||
public void setMemberNickname(String memberNickname) {
|
||||
this.memberNickname = memberNickname;
|
||||
}
|
||||
|
||||
public String getMemberIcon() {
|
||||
return memberIcon;
|
||||
}
|
||||
|
||||
public void setMemberIcon(String memberIcon) {
|
||||
this.memberIcon = memberIcon;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductPic() {
|
||||
return productPic;
|
||||
}
|
||||
|
||||
public void setProductPic(String productPic) {
|
||||
this.productPic = productPic;
|
||||
}
|
||||
|
||||
public String getProductSubTitle() {
|
||||
return productSubTitle;
|
||||
}
|
||||
|
||||
public void setProductSubTitle(String productSubTitle) {
|
||||
this.productSubTitle = productSubTitle;
|
||||
}
|
||||
|
||||
public String getProductPrice() {
|
||||
return productPrice;
|
||||
}
|
||||
|
||||
public void setProductPrice(String productPrice) {
|
||||
this.productPrice = productPrice;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户商品浏览历史记录
|
||||
*/
|
||||
@Document
|
||||
public class MemberReadHistory {
|
||||
@Id
|
||||
private String id;
|
||||
@Indexed
|
||||
private Long memberId;
|
||||
private String memberNickname;
|
||||
private String memberIcon;
|
||||
@Indexed
|
||||
private Long productId;
|
||||
private String productName;
|
||||
private String productPic;
|
||||
private String productSubTitle;
|
||||
private String productPrice;
|
||||
private Date createTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public String getMemberNickname() {
|
||||
return memberNickname;
|
||||
}
|
||||
|
||||
public void setMemberNickname(String memberNickname) {
|
||||
this.memberNickname = memberNickname;
|
||||
}
|
||||
|
||||
public String getMemberIcon() {
|
||||
return memberIcon;
|
||||
}
|
||||
|
||||
public void setMemberIcon(String memberIcon) {
|
||||
this.memberIcon = memberIcon;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductPic() {
|
||||
return productPic;
|
||||
}
|
||||
|
||||
public void setProductPic(String productPic) {
|
||||
this.productPic = productPic;
|
||||
}
|
||||
|
||||
public String getProductSubTitle() {
|
||||
return productSubTitle;
|
||||
}
|
||||
|
||||
public void setProductSubTitle(String productSubTitle) {
|
||||
this.productSubTitle = productSubTitle;
|
||||
}
|
||||
|
||||
public String getProductPrice() {
|
||||
return productPrice;
|
||||
}
|
||||
|
||||
public void setProductPrice(String productPrice) {
|
||||
this.productPrice = productPrice;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("会员转账参数")
|
||||
public class MemberTransferParam {
|
||||
|
||||
@ApiModelProperty(value = "转账接收者手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "转账金额")
|
||||
Double value;
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public Double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Double value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("会员转账记录实体")
|
||||
public class MemberTransferResult {
|
||||
|
||||
@ApiModelProperty(value = "转账金额")
|
||||
private BigDecimal value;
|
||||
|
||||
@ApiModelProperty(value = "转入用户昵称")
|
||||
private String receiverNickname;
|
||||
|
||||
@ApiModelProperty(value = "转入用户手机号")
|
||||
private String receiverPhone;
|
||||
|
||||
@ApiModelProperty(value = "转账时间")
|
||||
private Date createTime;
|
||||
|
||||
public BigDecimal getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(BigDecimal value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getReceiverNickname() {
|
||||
return receiverNickname;
|
||||
}
|
||||
|
||||
public void setReceiverNickname(String receiverNickname) {
|
||||
this.receiverNickname = receiverNickname;
|
||||
}
|
||||
|
||||
public String getReceiverPhone() {
|
||||
return receiverPhone;
|
||||
}
|
||||
|
||||
public void setReceiverPhone(String receiverPhone) {
|
||||
this.receiverPhone = receiverPhone;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("会员提现申请返回实体")
|
||||
public class MemberWithdrawApplyResult {
|
||||
|
||||
@ApiModelProperty(value = "提现金额")
|
||||
private BigDecimal value; //提现金额
|
||||
|
||||
@ApiModelProperty(value = "提现手续费")
|
||||
private BigDecimal poundage;
|
||||
|
||||
@ApiModelProperty(value = "扣除手续费后的金额")
|
||||
private BigDecimal actualValue;
|
||||
|
||||
@ApiModelProperty(value = "账户名")
|
||||
private String accountName;
|
||||
|
||||
@ApiModelProperty(value = "银行名称")
|
||||
private String bankName;
|
||||
|
||||
@ApiModelProperty(value = "银行账号")
|
||||
private String bankCardNum;
|
||||
|
||||
@ApiModelProperty(value = "银行开户行地址")
|
||||
private String openBankAddress;
|
||||
|
||||
@ApiModelProperty(value = "微信账号")
|
||||
private String wechatAccount;
|
||||
|
||||
@ApiModelProperty(value = "微信昵称")
|
||||
private String wechatNickname;
|
||||
|
||||
@ApiModelProperty(value = "付款状态:0->未打款;1->已打款;2->打款失败")
|
||||
private Integer paymentStatus;
|
||||
|
||||
@ApiModelProperty(value = "提现方式(0: 支付宝; 1: 微信; 2: 银行卡)")
|
||||
private Integer withdrawType;
|
||||
|
||||
@ApiModelProperty(value = "付款状态:0->未打款;1->已打款;2->打款失败")
|
||||
private String paymentStatusName;
|
||||
|
||||
@ApiModelProperty(value = "失败原因:付款状态为2时,才有值")
|
||||
private String failedReason;
|
||||
|
||||
// 打款时间
|
||||
@ApiModelProperty(value = "打款时间")
|
||||
private Date paymentTime;
|
||||
|
||||
// 创建时间
|
||||
@ApiModelProperty(value = "申请时间")
|
||||
private Date createTime;
|
||||
|
||||
public BigDecimal getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(BigDecimal value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public BigDecimal getPoundage() {
|
||||
return poundage;
|
||||
}
|
||||
|
||||
public void setPoundage(BigDecimal poundage) {
|
||||
this.poundage = poundage;
|
||||
}
|
||||
|
||||
public BigDecimal getActualValue() {
|
||||
return actualValue;
|
||||
}
|
||||
|
||||
public void setActualValue(BigDecimal actualValue) {
|
||||
this.actualValue = actualValue;
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
public String getBankName() {
|
||||
return bankName;
|
||||
}
|
||||
|
||||
public void setBankName(String bankName) {
|
||||
this.bankName = bankName;
|
||||
}
|
||||
|
||||
public String getBankCardNum() {
|
||||
return bankCardNum;
|
||||
}
|
||||
|
||||
public void setBankCardNum(String bankCardNum) {
|
||||
this.bankCardNum = bankCardNum;
|
||||
}
|
||||
|
||||
public String getOpenBankAddress() {
|
||||
return openBankAddress;
|
||||
}
|
||||
|
||||
public void setOpenBankAddress(String openBankAddress) {
|
||||
this.openBankAddress = openBankAddress;
|
||||
}
|
||||
|
||||
public Integer getPaymentStatus() {
|
||||
return paymentStatus;
|
||||
}
|
||||
|
||||
public void setPaymentStatus(Integer paymentStatus) {
|
||||
this.paymentStatus = paymentStatus;
|
||||
}
|
||||
|
||||
public String getPaymentStatusName() {
|
||||
return paymentStatusName;
|
||||
}
|
||||
|
||||
public void setPaymentStatusName(String paymentStatusName) {
|
||||
this.paymentStatusName = paymentStatusName;
|
||||
}
|
||||
|
||||
public String getFailedReason() {
|
||||
return failedReason;
|
||||
}
|
||||
|
||||
public void setFailedReason(String failedReason) {
|
||||
this.failedReason = failedReason;
|
||||
}
|
||||
|
||||
public Date getPaymentTime() {
|
||||
return paymentTime;
|
||||
}
|
||||
|
||||
public void setPaymentTime(Date paymentTime) {
|
||||
this.paymentTime = paymentTime;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Integer getWithdrawType() {
|
||||
return withdrawType;
|
||||
}
|
||||
|
||||
public void setWithdrawType(Integer withdrawType) {
|
||||
this.withdrawType = withdrawType;
|
||||
}
|
||||
|
||||
public String getWechatAccount() {
|
||||
return wechatAccount;
|
||||
}
|
||||
|
||||
public void setWechatAccount(String wechatAccount) {
|
||||
this.wechatAccount = wechatAccount;
|
||||
}
|
||||
|
||||
public String getWechatNickname() {
|
||||
return wechatNickname;
|
||||
}
|
||||
|
||||
public void setWechatNickname(String wechatNickname) {
|
||||
this.wechatNickname = wechatNickname;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class OfflinePaymentParam {
|
||||
|
||||
@ApiModelProperty(value = "订单ID")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty(value = "支付账户名")
|
||||
private String paymentAccountName;
|
||||
|
||||
@ApiModelProperty(value = "支付银行名称")
|
||||
private String paymentBankName;
|
||||
|
||||
@ApiModelProperty(value = "支付银行卡号")
|
||||
private String paymentBankCardNum;
|
||||
|
||||
public Long getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(Long orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getPaymentAccountName() {
|
||||
return paymentAccountName;
|
||||
}
|
||||
|
||||
public void setPaymentAccountName(String paymentAccountName) {
|
||||
this.paymentAccountName = paymentAccountName;
|
||||
}
|
||||
|
||||
public String getPaymentBankName() {
|
||||
return paymentBankName;
|
||||
}
|
||||
|
||||
public void setPaymentBankName(String paymentBankName) {
|
||||
this.paymentBankName = paymentBankName;
|
||||
}
|
||||
|
||||
public String getPaymentBankCardNum() {
|
||||
return paymentBankCardNum;
|
||||
}
|
||||
|
||||
public void setPaymentBankCardNum(String paymentBankCardNum) {
|
||||
this.paymentBankCardNum = paymentBankCardNum;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class OfflinePaymentRecordResult {
|
||||
|
||||
@ApiModelProperty(value = "账户名")
|
||||
private String accountName;
|
||||
|
||||
@ApiModelProperty(value = "银行名称")
|
||||
private String bankName;
|
||||
|
||||
@ApiModelProperty(value = "银行卡号")
|
||||
private String bankCardNum;
|
||||
|
||||
@ApiModelProperty(value = "开户行地址")
|
||||
private String openBankAddress;
|
||||
|
||||
@ApiModelProperty(value = "支付金额")
|
||||
private BigDecimal payAmount;
|
||||
|
||||
@ApiModelProperty(value = "支付账户名")
|
||||
private String paymentAccountName;
|
||||
|
||||
@ApiModelProperty(value = "支付银行名称")
|
||||
private String paymentBankName;
|
||||
|
||||
@ApiModelProperty(value = "支付银行卡号")
|
||||
private String paymentBankCardNum;
|
||||
|
||||
@ApiModelProperty(value = "审核状态:0->未审核;1->已审核")
|
||||
private Integer confirmStatus;
|
||||
|
||||
@ApiModelProperty(value = "审核状态:0->未审核;1->已审核")
|
||||
private String confirmStatusName;
|
||||
|
||||
@ApiModelProperty(value = "审核时间")
|
||||
private Date confirmTime;
|
||||
|
||||
@ApiModelProperty(value = "提交时间")
|
||||
private Date createTime;
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
public String getBankName() {
|
||||
return bankName;
|
||||
}
|
||||
|
||||
public void setBankName(String bankName) {
|
||||
this.bankName = bankName;
|
||||
}
|
||||
|
||||
public String getBankCardNum() {
|
||||
return bankCardNum;
|
||||
}
|
||||
|
||||
public void setBankCardNum(String bankCardNum) {
|
||||
this.bankCardNum = bankCardNum;
|
||||
}
|
||||
|
||||
public String getOpenBankAddress() {
|
||||
return openBankAddress;
|
||||
}
|
||||
|
||||
public void setOpenBankAddress(String openBankAddress) {
|
||||
this.openBankAddress = openBankAddress;
|
||||
}
|
||||
|
||||
public BigDecimal getPayAmount() {
|
||||
return payAmount;
|
||||
}
|
||||
|
||||
public void setPayAmount(BigDecimal payAmount) {
|
||||
this.payAmount = payAmount;
|
||||
}
|
||||
|
||||
public String getPaymentAccountName() {
|
||||
return paymentAccountName;
|
||||
}
|
||||
|
||||
public void setPaymentAccountName(String paymentAccountName) {
|
||||
this.paymentAccountName = paymentAccountName;
|
||||
}
|
||||
|
||||
public String getPaymentBankName() {
|
||||
return paymentBankName;
|
||||
}
|
||||
|
||||
public void setPaymentBankName(String paymentBankName) {
|
||||
this.paymentBankName = paymentBankName;
|
||||
}
|
||||
|
||||
public String getPaymentBankCardNum() {
|
||||
return paymentBankCardNum;
|
||||
}
|
||||
|
||||
public void setPaymentBankCardNum(String paymentBankCardNum) {
|
||||
this.paymentBankCardNum = paymentBankCardNum;
|
||||
}
|
||||
|
||||
public Integer getConfirmStatus() {
|
||||
return confirmStatus;
|
||||
}
|
||||
|
||||
public void setConfirmStatus(Integer confirmStatus) {
|
||||
this.confirmStatus = confirmStatus;
|
||||
}
|
||||
|
||||
public String getConfirmStatusName() {
|
||||
return confirmStatusName;
|
||||
}
|
||||
|
||||
public void setConfirmStatusName(String confirmStatusName) {
|
||||
this.confirmStatusName = confirmStatusName;
|
||||
}
|
||||
|
||||
public Date getConfirmTime() {
|
||||
return confirmTime;
|
||||
}
|
||||
|
||||
public void setConfirmTime(Date confirmTime) {
|
||||
this.confirmTime = confirmTime;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import com.buy507.mall.model.OmsOrder;
|
||||
import com.buy507.mall.model.OmsOrderItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 包含订单商品信息的订单详情
|
||||
*/
|
||||
public class OmsOrderDetail extends OmsOrder {
|
||||
private List<OmsOrderItem> orderItemList;
|
||||
|
||||
public List<OmsOrderItem> getOrderItemList() {
|
||||
return orderItemList;
|
||||
}
|
||||
|
||||
public void setOrderItemList(List<OmsOrderItem> orderItemList) {
|
||||
this.orderItemList = orderItemList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 申请退货参数
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class OmsOrderReturnApplyParam {
|
||||
@ApiModelProperty("订单id")
|
||||
private Long orderId;
|
||||
@ApiModelProperty("退货商品id")
|
||||
private Long productId;
|
||||
@ApiModelProperty("订单编号")
|
||||
private String orderSn;
|
||||
@ApiModelProperty("会员用户名")
|
||||
private String memberUsername;
|
||||
@ApiModelProperty("退货人姓名")
|
||||
private String returnName;
|
||||
@ApiModelProperty("退货人电话")
|
||||
private String returnPhone;
|
||||
@ApiModelProperty("商品图片")
|
||||
private String productPic;
|
||||
@ApiModelProperty("商品名称")
|
||||
private String productName;
|
||||
@ApiModelProperty("商品品牌")
|
||||
private String productBrand;
|
||||
@ApiModelProperty("商品销售属性:颜色:红色;尺码:xl;")
|
||||
private String productAttr;
|
||||
@ApiModelProperty("退货数量")
|
||||
private Integer productCount;
|
||||
@ApiModelProperty("商品单价")
|
||||
private BigDecimal productPrice;
|
||||
@ApiModelProperty("商品实际支付单价")
|
||||
private BigDecimal productRealPrice;
|
||||
@ApiModelProperty("原因")
|
||||
private String reason;
|
||||
@ApiModelProperty("描述")
|
||||
private String description;
|
||||
@ApiModelProperty("凭证图片,以逗号隔开")
|
||||
private String proofPics;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class OrderItemResult {
|
||||
|
||||
@ApiModelProperty(value = "订单ID")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String orderSn;
|
||||
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private Long productId;
|
||||
|
||||
@ApiModelProperty(value = "商品图片")
|
||||
private String productPic;
|
||||
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String productName;
|
||||
|
||||
@ApiModelProperty(value = "品牌")
|
||||
private String productBrand;
|
||||
|
||||
@ApiModelProperty(value = "商品价格")
|
||||
private BigDecimal productPrice;
|
||||
|
||||
@ApiModelProperty(value = "商品数量")
|
||||
private Integer productQuantity;
|
||||
|
||||
@ApiModelProperty(value = "商品SKU属性1")
|
||||
private String sp1;
|
||||
|
||||
@ApiModelProperty(value = "商品SKU属性2")
|
||||
private String sp2;
|
||||
|
||||
@ApiModelProperty(value = "商品SKU属性3")
|
||||
private String sp3;
|
||||
|
||||
public Long getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(Long orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getOrderSn() {
|
||||
return orderSn;
|
||||
}
|
||||
|
||||
public void setOrderSn(String orderSn) {
|
||||
this.orderSn = orderSn;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductPic() {
|
||||
return productPic;
|
||||
}
|
||||
|
||||
public void setProductPic(String productPic) {
|
||||
this.productPic = productPic;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductBrand() {
|
||||
return productBrand;
|
||||
}
|
||||
|
||||
public void setProductBrand(String productBrand) {
|
||||
this.productBrand = productBrand;
|
||||
}
|
||||
|
||||
public BigDecimal getProductPrice() {
|
||||
return productPrice;
|
||||
}
|
||||
|
||||
public void setProductPrice(BigDecimal productPrice) {
|
||||
this.productPrice = productPrice;
|
||||
}
|
||||
|
||||
public Integer getProductQuantity() {
|
||||
return productQuantity;
|
||||
}
|
||||
|
||||
public void setProductQuantity(Integer productQuantity) {
|
||||
this.productQuantity = productQuantity;
|
||||
}
|
||||
|
||||
public String getSp1() {
|
||||
return sp1;
|
||||
}
|
||||
|
||||
public void setSp1(String sp1) {
|
||||
this.sp1 = sp1;
|
||||
}
|
||||
|
||||
public String getSp2() {
|
||||
return sp2;
|
||||
}
|
||||
|
||||
public void setSp2(String sp2) {
|
||||
this.sp2 = sp2;
|
||||
}
|
||||
|
||||
public String getSp3() {
|
||||
return sp3;
|
||||
}
|
||||
|
||||
public void setSp3(String sp3) {
|
||||
this.sp3 = sp3;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 生成订单时传入的参数
|
||||
*/
|
||||
@ApiModel("直接购物生成订单的参数实体")
|
||||
public class OrderParam {
|
||||
|
||||
@ApiModelProperty(value = "SKU ID")
|
||||
private Long skuId;
|
||||
|
||||
@ApiModelProperty(value = "提货方式:0->自提;1->物流")
|
||||
private Integer deliveryType;
|
||||
|
||||
@ApiModelProperty(value = "会员收货地址ID")
|
||||
private Long memberReceiveAddressId;
|
||||
|
||||
@ApiModelProperty(value = "商品数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty(value = "抵扣积分")
|
||||
private BigDecimal integration;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String note;
|
||||
|
||||
public Long getSkuId() {
|
||||
return skuId;
|
||||
}
|
||||
|
||||
public void setSkuId(Long skuId) {
|
||||
this.skuId = skuId;
|
||||
}
|
||||
|
||||
public Integer getDeliveryType() {
|
||||
return deliveryType;
|
||||
}
|
||||
|
||||
public void setDeliveryType(Integer deliveryType) {
|
||||
this.deliveryType = deliveryType;
|
||||
}
|
||||
|
||||
public Long getMemberReceiveAddressId() {
|
||||
return memberReceiveAddressId;
|
||||
}
|
||||
|
||||
public void setMemberReceiveAddressId(Long memberReceiveAddressId) {
|
||||
this.memberReceiveAddressId = memberReceiveAddressId;
|
||||
}
|
||||
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public BigDecimal getIntegration() {
|
||||
return integration;
|
||||
}
|
||||
|
||||
public void setIntegration(BigDecimal integration) {
|
||||
this.integration = integration;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,389 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class OrderResult {
|
||||
|
||||
@ApiModelProperty(value = "订单ID")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String orderSn;
|
||||
|
||||
@ApiModelProperty(value = "下单时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "实际支付金额")
|
||||
private BigDecimal payAmount;
|
||||
|
||||
@ApiModelProperty(value = "运费")
|
||||
private BigDecimal freightAmount;
|
||||
|
||||
@ApiModelProperty(value = "提货方式:0->自提;1->物流")
|
||||
private Integer deliveryType;
|
||||
|
||||
@ApiModelProperty(value = "订单状态: 0->待付款;1->待发货;2->待收货;3->已完成;4->已关闭")
|
||||
private Integer orderStatus;
|
||||
|
||||
@ApiModelProperty(value = "订单状态名称")
|
||||
private String orderStatusName;
|
||||
|
||||
@ApiModelProperty(value = "评价状态: 0->未评价; 1->已评价")
|
||||
private Integer commentStatus;
|
||||
|
||||
@ApiModelProperty(value = "商品数量")
|
||||
private Integer productsNum;
|
||||
|
||||
@ApiModelProperty(value = "支付时间")
|
||||
private Date paymentTime;
|
||||
|
||||
@ApiModelProperty(value = "支付类型: 1->支付宝;2->微信;3->线下支付;4->积分支付")
|
||||
private Integer payType;
|
||||
|
||||
@ApiModelProperty(value = "支付类型名称")
|
||||
private String payTypeName;
|
||||
|
||||
@ApiModelProperty(value = "发货时间")
|
||||
private Date deliveryTime;
|
||||
|
||||
@ApiModelProperty(value = "收货时间")
|
||||
private Date receiveTime;
|
||||
|
||||
@ApiModelProperty(value = "评论时间")
|
||||
private Date commentTime;
|
||||
|
||||
@ApiModelProperty(value = "发票类型:0->不开发票;1->电子发票;2->纸质发票")
|
||||
private Integer billType;
|
||||
|
||||
@ApiModelProperty(value = "发票类型名称")
|
||||
private String billTypeName;
|
||||
|
||||
@ApiModelProperty(value = "发票抬头")
|
||||
private String billHeader;
|
||||
|
||||
@ApiModelProperty(value = "发票内容")
|
||||
private String billContent;
|
||||
|
||||
@ApiModelProperty(value = "收货人姓名")
|
||||
private String receiverName;
|
||||
|
||||
@ApiModelProperty(value = "收货人电话")
|
||||
private String receiverPhone;
|
||||
|
||||
@ApiModelProperty(value = "收货人省份/直辖市")
|
||||
private String receiverProvince;
|
||||
|
||||
@ApiModelProperty(value = "收货人城市")
|
||||
private String receiverCity;
|
||||
|
||||
@ApiModelProperty(value = "收货人区县")
|
||||
private String receiverRegion;
|
||||
|
||||
@ApiModelProperty(value = "收货人详细地址")
|
||||
private String receiverDetailAddress;
|
||||
|
||||
@ApiModelProperty(value = "订单备注")
|
||||
private String note;
|
||||
|
||||
@ApiModelProperty(value = "物流公司(配送方式)")
|
||||
private String deliveryCompany;
|
||||
|
||||
@ApiModelProperty(value = "物流单号")
|
||||
private String deliverySn;
|
||||
|
||||
@ApiModelProperty(value = "订单商品详情")
|
||||
private List<OrderItemResult> orderItem;
|
||||
|
||||
@ApiModelProperty(value = "线下支付详情")
|
||||
private OfflinePaymentRecordResult paymentRecord;
|
||||
|
||||
@ApiModelProperty(value = "分享链接")
|
||||
private String shareUrl;
|
||||
|
||||
@ApiModelProperty(value = "订单排队状态") //1为快速
|
||||
private Integer queueStatus;
|
||||
|
||||
@ApiModelProperty(value = "当前公排还未出局订单数")
|
||||
private Long queueNum;
|
||||
|
||||
@ApiModelProperty(value = "快速排队订单还剩邀请成功的人数")
|
||||
private Integer invitedCount;
|
||||
|
||||
|
||||
public Long getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(Long orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getOrderSn() {
|
||||
return orderSn;
|
||||
}
|
||||
|
||||
public void setOrderSn(String orderSn) {
|
||||
this.orderSn = orderSn;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public BigDecimal getPayAmount() {
|
||||
return payAmount;
|
||||
}
|
||||
|
||||
public void setPayAmount(BigDecimal payAmount) {
|
||||
this.payAmount = payAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getFreightAmount() {
|
||||
return freightAmount;
|
||||
}
|
||||
|
||||
public void setFreightAmount(BigDecimal freightAmount) {
|
||||
this.freightAmount = freightAmount;
|
||||
}
|
||||
|
||||
public Integer getOrderStatus() {
|
||||
return orderStatus;
|
||||
}
|
||||
|
||||
public void setOrderStatus(Integer orderStatus) {
|
||||
this.orderStatus = orderStatus;
|
||||
}
|
||||
|
||||
public Integer getDeliveryType() {
|
||||
return deliveryType;
|
||||
}
|
||||
|
||||
public void setDeliveryType(Integer deliveryType) {
|
||||
this.deliveryType = deliveryType;
|
||||
}
|
||||
|
||||
public String getOrderStatusName() {
|
||||
return orderStatusName;
|
||||
}
|
||||
|
||||
public void setOrderStatusName(String orderStatusName) {
|
||||
this.orderStatusName = orderStatusName;
|
||||
}
|
||||
|
||||
public Integer getCommentStatus() {
|
||||
return commentStatus;
|
||||
}
|
||||
|
||||
public void setCommentStatus(Integer commentStatus) {
|
||||
this.commentStatus = commentStatus;
|
||||
}
|
||||
|
||||
public Integer getProductsNum() {
|
||||
return productsNum;
|
||||
}
|
||||
|
||||
public void setProductsNum(Integer productsNum) {
|
||||
this.productsNum = productsNum;
|
||||
}
|
||||
|
||||
public Date getPaymentTime() {
|
||||
return paymentTime;
|
||||
}
|
||||
|
||||
public void setPaymentTime(Date paymentTime) {
|
||||
this.paymentTime = paymentTime;
|
||||
}
|
||||
|
||||
public Integer getPayType() {
|
||||
return payType;
|
||||
}
|
||||
|
||||
public void setPayType(Integer payType) {
|
||||
this.payType = payType;
|
||||
}
|
||||
|
||||
public String getPayTypeName() {
|
||||
return payTypeName;
|
||||
}
|
||||
|
||||
public void setPayTypeName(String payTypeName) {
|
||||
this.payTypeName = payTypeName;
|
||||
}
|
||||
|
||||
public Date getDeliveryTime() {
|
||||
return deliveryTime;
|
||||
}
|
||||
|
||||
public void setDeliveryTime(Date deliveryTime) {
|
||||
this.deliveryTime = deliveryTime;
|
||||
}
|
||||
|
||||
public Date getReceiveTime() {
|
||||
return receiveTime;
|
||||
}
|
||||
|
||||
public void setReceiveTime(Date receiveTime) {
|
||||
this.receiveTime = receiveTime;
|
||||
}
|
||||
|
||||
public Date getCommentTime() {
|
||||
return commentTime;
|
||||
}
|
||||
|
||||
public void setCommentTime(Date commentTime) {
|
||||
this.commentTime = commentTime;
|
||||
}
|
||||
|
||||
public Integer getBillType() {
|
||||
return billType;
|
||||
}
|
||||
|
||||
public void setBillType(Integer billType) {
|
||||
this.billType = billType;
|
||||
}
|
||||
|
||||
public String getBillTypeName() {
|
||||
return billTypeName;
|
||||
}
|
||||
|
||||
public void setBillTypeName(String billTypeName) {
|
||||
this.billTypeName = billTypeName;
|
||||
}
|
||||
|
||||
public String getBillHeader() {
|
||||
return billHeader;
|
||||
}
|
||||
|
||||
public void setBillHeader(String billHeader) {
|
||||
this.billHeader = billHeader;
|
||||
}
|
||||
|
||||
public String getBillContent() {
|
||||
return billContent;
|
||||
}
|
||||
|
||||
public void setBillContent(String billContent) {
|
||||
this.billContent = billContent;
|
||||
}
|
||||
|
||||
public String getReceiverName() {
|
||||
return receiverName;
|
||||
}
|
||||
|
||||
public void setReceiverName(String receiverName) {
|
||||
this.receiverName = receiverName;
|
||||
}
|
||||
|
||||
public String getReceiverPhone() {
|
||||
return receiverPhone;
|
||||
}
|
||||
|
||||
public void setReceiverPhone(String receiverPhone) {
|
||||
this.receiverPhone = receiverPhone;
|
||||
}
|
||||
|
||||
public String getReceiverProvince() {
|
||||
return receiverProvince;
|
||||
}
|
||||
|
||||
public void setReceiverProvince(String receiverProvince) {
|
||||
this.receiverProvince = receiverProvince;
|
||||
}
|
||||
|
||||
public String getReceiverCity() {
|
||||
return receiverCity;
|
||||
}
|
||||
|
||||
public void setReceiverCity(String receiverCity) {
|
||||
this.receiverCity = receiverCity;
|
||||
}
|
||||
|
||||
public String getReceiverRegion() {
|
||||
return receiverRegion;
|
||||
}
|
||||
|
||||
public void setReceiverRegion(String receiverRegion) {
|
||||
this.receiverRegion = receiverRegion;
|
||||
}
|
||||
|
||||
public String getReceiverDetailAddress() {
|
||||
return receiverDetailAddress;
|
||||
}
|
||||
|
||||
public void setReceiverDetailAddress(String receiverDetailAddress) {
|
||||
this.receiverDetailAddress = receiverDetailAddress;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public String getDeliveryCompany() {
|
||||
return deliveryCompany;
|
||||
}
|
||||
|
||||
public void setDeliveryCompany(String deliveryCompany) {
|
||||
this.deliveryCompany = deliveryCompany;
|
||||
}
|
||||
|
||||
public String getDeliverySn() {
|
||||
return deliverySn;
|
||||
}
|
||||
public String getShareUrl(){
|
||||
return shareUrl;
|
||||
}
|
||||
public void setShareUrl(String shareUrl){
|
||||
this.shareUrl = shareUrl;
|
||||
}
|
||||
public Integer getQueueStatus() {
|
||||
return queueStatus;
|
||||
}
|
||||
public void setQueueStatus(Integer queueStatus) {
|
||||
this.queueStatus = queueStatus;
|
||||
}
|
||||
public Long getQueueNum() {
|
||||
return queueNum;
|
||||
}
|
||||
public void setQueueNum(Long queueNum) {
|
||||
this.queueNum = queueNum;
|
||||
}
|
||||
public Integer getInvitedCount() {
|
||||
return invitedCount;
|
||||
}
|
||||
public void setInvitedCount(Integer invitedCount) {
|
||||
this.invitedCount = invitedCount;
|
||||
}
|
||||
public void setDeliverySn(String deliverySn) {
|
||||
this.deliverySn = deliverySn;
|
||||
}
|
||||
|
||||
public List<OrderItemResult> getOrderItem() {
|
||||
return orderItem;
|
||||
}
|
||||
|
||||
public void setOrderItem(List<OrderItemResult> orderItem) {
|
||||
this.orderItem = orderItem;
|
||||
}
|
||||
|
||||
public OfflinePaymentRecordResult getPaymentRecord() {
|
||||
return paymentRecord;
|
||||
}
|
||||
|
||||
public void setPaymentRecord(OfflinePaymentRecordResult paymentRecord) {
|
||||
this.paymentRecord = paymentRecord;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class OrderReturnResult {
|
||||
|
||||
@ApiModelProperty(value = "退货订单ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "申请时间")
|
||||
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "退款金额")
|
||||
private BigDecimal returnAmount;
|
||||
|
||||
@ApiModelProperty(value = "退货状态:0->待处理;1->退货中;2->已完成;3->已拒绝")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "退货状态名称")
|
||||
private String statusName;
|
||||
|
||||
@ApiModelProperty(value = "商品图片")
|
||||
private String productPic;
|
||||
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String productName;
|
||||
|
||||
@ApiModelProperty(value = "品牌")
|
||||
private String productBrand;
|
||||
|
||||
@ApiModelProperty(value = "商品SKU")
|
||||
private String productAttr;
|
||||
|
||||
@ApiModelProperty(value = "商品数量")
|
||||
private Integer productCount;
|
||||
|
||||
@ApiModelProperty(value = "退货原因")
|
||||
private String reason;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public BigDecimal getReturnAmount() {
|
||||
return returnAmount;
|
||||
}
|
||||
|
||||
public void setReturnAmount(BigDecimal returnAmount) {
|
||||
this.returnAmount = returnAmount;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatusName() {
|
||||
return statusName;
|
||||
}
|
||||
|
||||
public void setStatusName(String statusName) {
|
||||
this.statusName = statusName;
|
||||
}
|
||||
|
||||
public String getProductPic() {
|
||||
return productPic;
|
||||
}
|
||||
|
||||
public void setProductPic(String productPic) {
|
||||
this.productPic = productPic;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductBrand() {
|
||||
return productBrand;
|
||||
}
|
||||
|
||||
public void setProductBrand(String productBrand) {
|
||||
this.productBrand = productBrand;
|
||||
}
|
||||
|
||||
public String getProductAttr() {
|
||||
return productAttr;
|
||||
}
|
||||
|
||||
public void setProductAttr(String productAttr) {
|
||||
this.productAttr = productAttr;
|
||||
}
|
||||
|
||||
public Integer getProductCount() {
|
||||
return productCount;
|
||||
}
|
||||
|
||||
public void setProductCount(Integer productCount) {
|
||||
this.productCount = productCount;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class OutMemberResult {
|
||||
@ApiModelProperty(value = "userName")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "queue")
|
||||
private int queue;
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public int getQueue() {
|
||||
return queue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
public class ProductAttributeResult {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long pid;
|
||||
|
||||
private String name;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(Long pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ProductCategoryOptions {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer level;
|
||||
|
||||
private String icon;
|
||||
|
||||
private Long pid;
|
||||
|
||||
private List<ProductCategoryOptions> children;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public Long getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(Long pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public List<ProductCategoryOptions> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<ProductCategoryOptions> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,614 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.buy507.mall.model.PmsComment;
|
||||
import com.buy507.mall.model.PmsCommentReplay;
|
||||
import com.buy507.mall.model.PmsProductAttribute;
|
||||
import com.buy507.mall.model.PmsProductFullReduction;
|
||||
import com.buy507.mall.model.PmsProductLadder;
|
||||
import com.buy507.mall.model.SmsCoupon;
|
||||
import com.buy507.mall.model.SmsCouponProductRelation;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class ProductDetailResult {
|
||||
private Long id;
|
||||
|
||||
private Long brandId;
|
||||
|
||||
private Long productCategoryId;
|
||||
|
||||
private Long feightTemplateId;
|
||||
|
||||
private Long productAttributeCategoryId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String pic;
|
||||
|
||||
@ApiModelProperty(value = "货号")
|
||||
private String productSn;
|
||||
|
||||
@ApiModelProperty(value = "删除状态:0->未删除;1->已删除")
|
||||
private Integer deleteStatus;
|
||||
|
||||
@ApiModelProperty(value = "上架状态:0->下架;1->上架")
|
||||
private Integer publishStatus;
|
||||
|
||||
@ApiModelProperty(value = "新品状态:0->不是新品;1->新品")
|
||||
private Integer newStatus;
|
||||
|
||||
@ApiModelProperty(value = "推荐状态;0->不推荐;1->推荐")
|
||||
private Integer recommandStatus;
|
||||
|
||||
@ApiModelProperty(value = "审核状态:0->未审核;1->审核通过")
|
||||
private Integer verifyStatus;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "销量")
|
||||
private Integer sale;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "促销价格")
|
||||
private BigDecimal promotionPrice;
|
||||
|
||||
@ApiModelProperty(value = "赠送的成长值")
|
||||
private Integer giftGrowth;
|
||||
|
||||
@ApiModelProperty(value = "赠送的积分")
|
||||
private Integer giftPoint;
|
||||
|
||||
@ApiModelProperty(value = "限制使用的积分数")
|
||||
private Integer usePointLimit;
|
||||
|
||||
@ApiModelProperty(value = "副标题")
|
||||
private String subTitle;
|
||||
|
||||
@ApiModelProperty(value = "市场价")
|
||||
private BigDecimal originalPrice;
|
||||
|
||||
@ApiModelProperty(value = "库存")
|
||||
private Integer stock;
|
||||
|
||||
@ApiModelProperty(value = "库存预警值")
|
||||
private Integer lowStock;
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty(value = "商品重量,默认为克")
|
||||
private BigDecimal weight;
|
||||
|
||||
@ApiModelProperty(value = "是否为预告商品:0->不是;1->是")
|
||||
private Integer previewStatus;
|
||||
|
||||
@ApiModelProperty(value = "以逗号分割的产品服务:1->无忧退货;2->快速退款;3->免费包邮")
|
||||
private String serviceIds;
|
||||
|
||||
private String keywords;
|
||||
|
||||
private String note;
|
||||
|
||||
@ApiModelProperty(value = "画册图片,连产品图片限制为5张,以逗号分割")
|
||||
private String albumPics;
|
||||
private List<String> ListAlbumPics;
|
||||
private String detailTitle;
|
||||
|
||||
@ApiModelProperty(value = "促销开始时间")
|
||||
private Date promotionStartTime;
|
||||
|
||||
@ApiModelProperty(value = "促销结束时间")
|
||||
private Date promotionEndTime;
|
||||
|
||||
@ApiModelProperty(value = "活动限购数量")
|
||||
private Integer promotionPerLimit;
|
||||
|
||||
@ApiModelProperty(value = "促销类型:0->没有促销使用原价;1->使用促销价;2->使用会员价;3->使用阶梯价格;4->使用满减价格;5->限时购")
|
||||
private Integer promotionType;
|
||||
|
||||
@ApiModelProperty(value = "品牌名称")
|
||||
private String brandName;
|
||||
|
||||
@ApiModelProperty(value = "商品分类名称")
|
||||
private String productCategoryName;
|
||||
|
||||
@ApiModelProperty(value = "商品描述")
|
||||
private String description;
|
||||
|
||||
private String detailDesc;
|
||||
private List<PmsProductAttribute> productAttribute;
|
||||
@ApiModelProperty(value = "产品详情网页内容")
|
||||
private String detailHtml;
|
||||
|
||||
@ApiModelProperty(value = "移动端网页详情")
|
||||
private String detailMobileHtml;
|
||||
|
||||
@ApiModelProperty(value = "商品详情数据展示")
|
||||
private PmsProductFullReduction pmsProductFullReduction;
|
||||
@ApiModelProperty(value = "商品折扣信息")
|
||||
private PmsProductLadder pmsProductLadder;
|
||||
|
||||
@ApiModelProperty(value = "优惠券")
|
||||
private SmsCouponProductRelation smsCouponProductRelation;
|
||||
private SmsCoupon smsCoupon;
|
||||
@ApiModelProperty(value = "评论信息")
|
||||
private List<PmsComment> pmsComment;
|
||||
|
||||
@ApiModelProperty(value = "评论回复,差评 ,1星大于1星好评")
|
||||
private PmsCommentReplay pmsCommentReplay;
|
||||
|
||||
@ApiModelProperty(value = "好评比例")
|
||||
private PmsComment commentBiLi;
|
||||
|
||||
@ApiModelProperty(value = "是否收藏")
|
||||
private int whetherTheCollection;
|
||||
|
||||
private int countComent;
|
||||
|
||||
private int applauseRate;
|
||||
|
||||
List<ProductAttributeResult> specList;
|
||||
|
||||
List<ProductAttributeResult> specChildList;
|
||||
|
||||
|
||||
public int getWhetherTheCollection() {
|
||||
return whetherTheCollection;
|
||||
}
|
||||
|
||||
public void setWhetherTheCollection(int whetherTheCollection) {
|
||||
this.whetherTheCollection = whetherTheCollection;
|
||||
}
|
||||
|
||||
public int getCountComent() {
|
||||
return countComent;
|
||||
}
|
||||
|
||||
public void setCountComent(int countComent) {
|
||||
this.countComent = countComent;
|
||||
}
|
||||
|
||||
public int getApplauseRate() {
|
||||
return applauseRate;
|
||||
}
|
||||
|
||||
public void setApplauseRate(int applauseRate) {
|
||||
this.applauseRate = applauseRate;
|
||||
}
|
||||
|
||||
public List<PmsProductAttribute> getProductAttribute() {
|
||||
return productAttribute;
|
||||
}
|
||||
|
||||
public void setProductAttribute(List<PmsProductAttribute> productAttribute) {
|
||||
this.productAttribute = productAttribute;
|
||||
}
|
||||
|
||||
public List<String> getListAlbumPics() {
|
||||
return ListAlbumPics;
|
||||
}
|
||||
|
||||
public void setListAlbumPics(List<String> listAlbumPics) {
|
||||
ListAlbumPics = listAlbumPics;
|
||||
}
|
||||
|
||||
public PmsProductLadder getPmsProductLadder() {
|
||||
return pmsProductLadder;
|
||||
}
|
||||
|
||||
public void setPmsProductLadder(PmsProductLadder pmsProductLadder) {
|
||||
this.pmsProductLadder = pmsProductLadder;
|
||||
}
|
||||
|
||||
public SmsCouponProductRelation getSmsCouponProductRelation() {
|
||||
return smsCouponProductRelation;
|
||||
}
|
||||
|
||||
public void setSmsCouponProductRelation(SmsCouponProductRelation smsCouponProductRelation) {
|
||||
this.smsCouponProductRelation = smsCouponProductRelation;
|
||||
}
|
||||
|
||||
public SmsCoupon getSmsCoupon() {
|
||||
return smsCoupon;
|
||||
}
|
||||
|
||||
public void setSmsCoupon(SmsCoupon smsCoupon) {
|
||||
this.smsCoupon = smsCoupon;
|
||||
}
|
||||
|
||||
|
||||
public List<PmsComment> getPmsComment() {
|
||||
return pmsComment;
|
||||
}
|
||||
|
||||
public void setPmsComment(List<PmsComment> pmsComment) {
|
||||
this.pmsComment = pmsComment;
|
||||
}
|
||||
|
||||
public PmsCommentReplay getPmsCommentReplay() {
|
||||
return pmsCommentReplay;
|
||||
}
|
||||
|
||||
public void setPmsCommentReplay(PmsCommentReplay pmsCommentReplay) {
|
||||
this.pmsCommentReplay = pmsCommentReplay;
|
||||
}
|
||||
|
||||
public PmsComment getCommentBiLi() {
|
||||
return commentBiLi;
|
||||
}
|
||||
|
||||
public void setCommentBiLi(PmsComment commentBiLi) {
|
||||
this.commentBiLi = commentBiLi;
|
||||
}
|
||||
|
||||
public PmsProductFullReduction getPmsProductFullReduction() {
|
||||
return pmsProductFullReduction;
|
||||
}
|
||||
|
||||
public void setPmsProductFullReduction(PmsProductFullReduction pmsProductFullReduction) {
|
||||
this.pmsProductFullReduction = pmsProductFullReduction;
|
||||
}
|
||||
|
||||
// @ApiModelProperty(value = "移动端网页详情")
|
||||
// private List
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getBrandId() {
|
||||
return brandId;
|
||||
}
|
||||
|
||||
public void setBrandId(Long brandId) {
|
||||
this.brandId = brandId;
|
||||
}
|
||||
|
||||
public Long getProductCategoryId() {
|
||||
return productCategoryId;
|
||||
}
|
||||
|
||||
public void setProductCategoryId(Long productCategoryId) {
|
||||
this.productCategoryId = productCategoryId;
|
||||
}
|
||||
|
||||
public Long getFeightTemplateId() {
|
||||
return feightTemplateId;
|
||||
}
|
||||
|
||||
public void setFeightTemplateId(Long feightTemplateId) {
|
||||
this.feightTemplateId = feightTemplateId;
|
||||
}
|
||||
|
||||
public Long getProductAttributeCategoryId() {
|
||||
return productAttributeCategoryId;
|
||||
}
|
||||
|
||||
public void setProductAttributeCategoryId(Long productAttributeCategoryId) {
|
||||
this.productAttributeCategoryId = productAttributeCategoryId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPic() {
|
||||
return pic;
|
||||
}
|
||||
|
||||
public void setPic(String pic) {
|
||||
this.pic = pic;
|
||||
}
|
||||
|
||||
public String getProductSn() {
|
||||
return productSn;
|
||||
}
|
||||
|
||||
public void setProductSn(String productSn) {
|
||||
this.productSn = productSn;
|
||||
}
|
||||
|
||||
public Integer getDeleteStatus() {
|
||||
return deleteStatus;
|
||||
}
|
||||
|
||||
public void setDeleteStatus(Integer deleteStatus) {
|
||||
this.deleteStatus = deleteStatus;
|
||||
}
|
||||
|
||||
public Integer getPublishStatus() {
|
||||
return publishStatus;
|
||||
}
|
||||
|
||||
public void setPublishStatus(Integer publishStatus) {
|
||||
this.publishStatus = publishStatus;
|
||||
}
|
||||
|
||||
public Integer getNewStatus() {
|
||||
return newStatus;
|
||||
}
|
||||
|
||||
public void setNewStatus(Integer newStatus) {
|
||||
this.newStatus = newStatus;
|
||||
}
|
||||
|
||||
public Integer getRecommandStatus() {
|
||||
return recommandStatus;
|
||||
}
|
||||
|
||||
public void setRecommandStatus(Integer recommandStatus) {
|
||||
this.recommandStatus = recommandStatus;
|
||||
}
|
||||
|
||||
public Integer getVerifyStatus() {
|
||||
return verifyStatus;
|
||||
}
|
||||
|
||||
public void setVerifyStatus(Integer verifyStatus) {
|
||||
this.verifyStatus = verifyStatus;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Integer getSale() {
|
||||
return sale;
|
||||
}
|
||||
|
||||
public void setSale(Integer sale) {
|
||||
this.sale = sale;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public BigDecimal getPromotionPrice() {
|
||||
return promotionPrice;
|
||||
}
|
||||
|
||||
public void setPromotionPrice(BigDecimal promotionPrice) {
|
||||
this.promotionPrice = promotionPrice;
|
||||
}
|
||||
|
||||
public Integer getGiftGrowth() {
|
||||
return giftGrowth;
|
||||
}
|
||||
|
||||
public void setGiftGrowth(Integer giftGrowth) {
|
||||
this.giftGrowth = giftGrowth;
|
||||
}
|
||||
|
||||
public Integer getGiftPoint() {
|
||||
return giftPoint;
|
||||
}
|
||||
|
||||
public void setGiftPoint(Integer giftPoint) {
|
||||
this.giftPoint = giftPoint;
|
||||
}
|
||||
|
||||
public Integer getUsePointLimit() {
|
||||
return usePointLimit;
|
||||
}
|
||||
|
||||
public void setUsePointLimit(Integer usePointLimit) {
|
||||
this.usePointLimit = usePointLimit;
|
||||
}
|
||||
|
||||
public String getSubTitle() {
|
||||
return subTitle;
|
||||
}
|
||||
|
||||
public void setSubTitle(String subTitle) {
|
||||
this.subTitle = subTitle;
|
||||
}
|
||||
|
||||
public BigDecimal getOriginalPrice() {
|
||||
return originalPrice;
|
||||
}
|
||||
|
||||
public void setOriginalPrice(BigDecimal originalPrice) {
|
||||
this.originalPrice = originalPrice;
|
||||
}
|
||||
|
||||
public Integer getStock() {
|
||||
return stock;
|
||||
}
|
||||
|
||||
public void setStock(Integer stock) {
|
||||
this.stock = stock;
|
||||
}
|
||||
|
||||
public Integer getLowStock() {
|
||||
return lowStock;
|
||||
}
|
||||
|
||||
public void setLowStock(Integer lowStock) {
|
||||
this.lowStock = lowStock;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public BigDecimal getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(BigDecimal weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public Integer getPreviewStatus() {
|
||||
return previewStatus;
|
||||
}
|
||||
|
||||
public void setPreviewStatus(Integer previewStatus) {
|
||||
this.previewStatus = previewStatus;
|
||||
}
|
||||
|
||||
public String getServiceIds() {
|
||||
return serviceIds;
|
||||
}
|
||||
|
||||
public void setServiceIds(String serviceIds) {
|
||||
this.serviceIds = serviceIds;
|
||||
}
|
||||
|
||||
public String getKeywords() {
|
||||
return keywords;
|
||||
}
|
||||
|
||||
public void setKeywords(String keywords) {
|
||||
this.keywords = keywords;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public String getAlbumPics() {
|
||||
return albumPics;
|
||||
}
|
||||
|
||||
public void setAlbumPics(String albumPics) {
|
||||
this.albumPics = albumPics;
|
||||
}
|
||||
|
||||
public String getDetailTitle() {
|
||||
return detailTitle;
|
||||
}
|
||||
|
||||
public void setDetailTitle(String detailTitle) {
|
||||
this.detailTitle = detailTitle;
|
||||
}
|
||||
|
||||
public Date getPromotionStartTime() {
|
||||
return promotionStartTime;
|
||||
}
|
||||
|
||||
public void setPromotionStartTime(Date promotionStartTime) {
|
||||
this.promotionStartTime = promotionStartTime;
|
||||
}
|
||||
|
||||
public Date getPromotionEndTime() {
|
||||
return promotionEndTime;
|
||||
}
|
||||
|
||||
public void setPromotionEndTime(Date promotionEndTime) {
|
||||
this.promotionEndTime = promotionEndTime;
|
||||
}
|
||||
|
||||
public Integer getPromotionPerLimit() {
|
||||
return promotionPerLimit;
|
||||
}
|
||||
|
||||
public void setPromotionPerLimit(Integer promotionPerLimit) {
|
||||
this.promotionPerLimit = promotionPerLimit;
|
||||
}
|
||||
|
||||
public Integer getPromotionType() {
|
||||
return promotionType;
|
||||
}
|
||||
|
||||
public void setPromotionType(Integer promotionType) {
|
||||
this.promotionType = promotionType;
|
||||
}
|
||||
|
||||
public String getBrandName() {
|
||||
return brandName;
|
||||
}
|
||||
|
||||
public void setBrandName(String brandName) {
|
||||
this.brandName = brandName;
|
||||
}
|
||||
|
||||
public String getProductCategoryName() {
|
||||
return productCategoryName;
|
||||
}
|
||||
|
||||
public void setProductCategoryName(String productCategoryName) {
|
||||
this.productCategoryName = productCategoryName;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDetailDesc() {
|
||||
return detailDesc;
|
||||
}
|
||||
|
||||
public void setDetailDesc(String detailDesc) {
|
||||
this.detailDesc = detailDesc;
|
||||
}
|
||||
|
||||
public String getDetailHtml() {
|
||||
return detailHtml;
|
||||
}
|
||||
|
||||
public void setDetailHtml(String detailHtml) {
|
||||
this.detailHtml = detailHtml;
|
||||
}
|
||||
|
||||
public String getDetailMobileHtml() {
|
||||
return detailMobileHtml;
|
||||
}
|
||||
|
||||
public void setDetailMobileHtml(String detailMobileHtml) {
|
||||
this.detailMobileHtml = detailMobileHtml;
|
||||
}
|
||||
|
||||
public List<ProductAttributeResult> getSpecList() {
|
||||
return specList;
|
||||
}
|
||||
|
||||
public void setSpecList(List<ProductAttributeResult> specList) {
|
||||
this.specList = specList;
|
||||
}
|
||||
|
||||
public List<ProductAttributeResult> getSpecChildList() {
|
||||
return specChildList;
|
||||
}
|
||||
|
||||
public void setSpecChildList(List<ProductAttributeResult> specChildList) {
|
||||
this.specChildList = specChildList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class ProductSkuResult {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private Integer stock;
|
||||
|
||||
private String pic;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Integer getStock() {
|
||||
return stock;
|
||||
}
|
||||
|
||||
public void setStock(Integer stock) {
|
||||
this.stock = stock;
|
||||
}
|
||||
|
||||
public String getPic() {
|
||||
return pic;
|
||||
}
|
||||
|
||||
public void setPic(String pic) {
|
||||
this.pic = pic;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
import com.buy507.mall.model.PmsProductFullReduction;
|
||||
import com.buy507.mall.model.PmsProductLadder;
|
||||
import com.buy507.mall.model.PmsSkuStock;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品的促销信息,包括sku、打折优惠、满减优惠
|
||||
*/
|
||||
public class PromotionProduct extends PmsProduct {
|
||||
//商品库存信息
|
||||
private List<PmsSkuStock> skuStockList;
|
||||
//商品打折信息
|
||||
private List<PmsProductLadder> productLadderList;
|
||||
//商品满减信息
|
||||
private List<PmsProductFullReduction> productFullReductionList;
|
||||
|
||||
public List<PmsSkuStock> getSkuStockList() {
|
||||
return skuStockList;
|
||||
}
|
||||
|
||||
public void setSkuStockList(List<PmsSkuStock> skuStockList) {
|
||||
this.skuStockList = skuStockList;
|
||||
}
|
||||
|
||||
public List<PmsProductLadder> getProductLadderList() {
|
||||
return productLadderList;
|
||||
}
|
||||
|
||||
public void setProductLadderList(List<PmsProductLadder> productLadderList) {
|
||||
this.productLadderList = productLadderList;
|
||||
}
|
||||
|
||||
public List<PmsProductFullReduction> getProductFullReductionList() {
|
||||
return productFullReductionList;
|
||||
}
|
||||
|
||||
public void setProductFullReductionList(List<PmsProductFullReduction> productFullReductionList) {
|
||||
this.productFullReductionList = productFullReductionList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 消息队列枚举配置
|
||||
*/
|
||||
@Getter
|
||||
public enum QueueEnum {
|
||||
/**
|
||||
* 消息通知队列
|
||||
*/
|
||||
QUEUE_ORDER_CANCEL("mall.order.direct", "mall.order.cancel", "mall.order.cancel"),
|
||||
/**
|
||||
* 消息通知ttl队列
|
||||
*/
|
||||
QUEUE_TTL_ORDER_CANCEL("mall.order.direct.ttl", "mall.order.cancel.ttl", "mall.order.cancel.ttl");
|
||||
|
||||
/**
|
||||
* 交换名称
|
||||
*/
|
||||
private String exchange;
|
||||
/**
|
||||
* 队列名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 路由键
|
||||
*/
|
||||
private String routeKey;
|
||||
|
||||
QueueEnum(String exchange, String name, String routeKey) {
|
||||
this.exchange = exchange;
|
||||
this.name = name;
|
||||
this.routeKey = routeKey;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class SellerBankAccountResult {
|
||||
|
||||
@ApiModelProperty(value = "账户名")
|
||||
private String accountName;
|
||||
|
||||
@ApiModelProperty(value = "银行名称")
|
||||
private String bankName;
|
||||
|
||||
@ApiModelProperty(value = "银行卡号")
|
||||
private String bankCardNum;
|
||||
|
||||
@ApiModelProperty(value = "开户行地址")
|
||||
private String openBankAddress;
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
public String getBankName() {
|
||||
return bankName;
|
||||
}
|
||||
|
||||
public void setBankName(String bankName) {
|
||||
this.bankName = bankName;
|
||||
}
|
||||
|
||||
public String getBankCardNum() {
|
||||
return bankCardNum;
|
||||
}
|
||||
|
||||
public void setBankCardNum(String bankCardNum) {
|
||||
this.bankCardNum = bankCardNum;
|
||||
}
|
||||
|
||||
public String getOpenBankAddress() {
|
||||
return openBankAddress;
|
||||
}
|
||||
|
||||
public void setOpenBankAddress(String openBankAddress) {
|
||||
this.openBankAddress = openBankAddress;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import com.buy507.mall.model.SmsCoupon;
|
||||
import com.buy507.mall.model.SmsCouponHistory;
|
||||
import com.buy507.mall.model.SmsCouponProductCategoryRelation;
|
||||
import com.buy507.mall.model.SmsCouponProductRelation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠券领取历史详情封装
|
||||
*/
|
||||
public class SmsCouponHistoryDetail extends SmsCouponHistory {
|
||||
//相关优惠券信息
|
||||
private SmsCoupon coupon;
|
||||
//优惠券关联商品
|
||||
private List<SmsCouponProductRelation> productRelationList;
|
||||
//优惠券关联商品分类
|
||||
private List<SmsCouponProductCategoryRelation> categoryRelationList;
|
||||
|
||||
public SmsCoupon getCoupon() {
|
||||
return coupon;
|
||||
}
|
||||
|
||||
public void setCoupon(SmsCoupon coupon) {
|
||||
this.coupon = coupon;
|
||||
}
|
||||
|
||||
public List<SmsCouponProductRelation> getProductRelationList() {
|
||||
return productRelationList;
|
||||
}
|
||||
|
||||
public void setProductRelationList(List<SmsCouponProductRelation> productRelationList) {
|
||||
this.productRelationList = productRelationList;
|
||||
}
|
||||
|
||||
public List<SmsCouponProductCategoryRelation> getCategoryRelationList() {
|
||||
return categoryRelationList;
|
||||
}
|
||||
|
||||
public void setCategoryRelationList(List<SmsCouponProductCategoryRelation> categoryRelationList) {
|
||||
this.categoryRelationList = categoryRelationList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class TeamMemberResult {
|
||||
|
||||
@ApiModelProperty(value = "会员账号")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "会员ID")
|
||||
private Long memberId;
|
||||
|
||||
@ApiModelProperty(value = "团队人数")
|
||||
private Long teamNum;
|
||||
|
||||
@ApiModelProperty(value = "团队业绩")
|
||||
private BigDecimal teamConsume;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public Long getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public Long getTeamNum() {
|
||||
return teamNum;
|
||||
}
|
||||
|
||||
public void setTeamNum(Long teamNum) {
|
||||
this.teamNum = teamNum;
|
||||
}
|
||||
|
||||
public BigDecimal getTeamConsume() {
|
||||
return teamConsume;
|
||||
}
|
||||
|
||||
public void setTeamConsume(BigDecimal teamConsume) {
|
||||
this.teamConsume = teamConsume;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
@ApiModel("微信登录参数实体")
|
||||
public class WeChatLogin {
|
||||
|
||||
private String code;
|
||||
|
||||
private String encryptedData;
|
||||
|
||||
private String iv;
|
||||
|
||||
private Long memberId;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getEncryptedData() {
|
||||
return encryptedData;
|
||||
}
|
||||
|
||||
public void setEncryptedData(String encryptedData) {
|
||||
this.encryptedData = encryptedData;
|
||||
}
|
||||
|
||||
public String getIv() {
|
||||
return iv;
|
||||
}
|
||||
|
||||
public void setIv(String iv) {
|
||||
this.iv = iv;
|
||||
}
|
||||
|
||||
public Long getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("提现申请参数")
|
||||
public class WithdrawApplyParam {
|
||||
|
||||
@ApiModelProperty(value = "提现方式(0: 支付宝; 1: 微信; 2: 银行卡)")
|
||||
private Integer withdrawType;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "支付宝账号")
|
||||
private String alipayAccount;
|
||||
|
||||
@ApiModelProperty(value = "微信账号")
|
||||
private String wechatAccount;
|
||||
|
||||
@ApiModelProperty(value = "微信昵称")
|
||||
private String wechatNickname;
|
||||
|
||||
@ApiModelProperty(value = "提现金额")
|
||||
private Double value;
|
||||
|
||||
@ApiModelProperty(value = "银行信息ID")
|
||||
private Long bankAccountId;
|
||||
|
||||
public Integer getWithdrawType() {
|
||||
return withdrawType;
|
||||
}
|
||||
|
||||
public void setWithdrawType(Integer withdrawType) {
|
||||
this.withdrawType = withdrawType;
|
||||
}
|
||||
|
||||
public String getRealName() {
|
||||
return realName;
|
||||
}
|
||||
|
||||
public void setRealName(String realName) {
|
||||
this.realName = realName;
|
||||
}
|
||||
|
||||
public String getAlipayAccount() {
|
||||
return alipayAccount;
|
||||
}
|
||||
|
||||
public void setAlipayAccount(String alipayAccount) {
|
||||
this.alipayAccount = alipayAccount;
|
||||
}
|
||||
|
||||
public String getWechatAccount() {
|
||||
return wechatAccount;
|
||||
}
|
||||
|
||||
public void setWechatAccount(String wechatAccount) {
|
||||
this.wechatAccount = wechatAccount;
|
||||
}
|
||||
|
||||
public String getWechatNickname() {
|
||||
return wechatNickname;
|
||||
}
|
||||
|
||||
public void setWechatNickname(String wechatNickname) {
|
||||
this.wechatNickname = wechatNickname;
|
||||
}
|
||||
|
||||
public Double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Double value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Long getBankAccountId() {
|
||||
return bankAccountId;
|
||||
}
|
||||
|
||||
public void setBankAccountId(Long bankAccountId) {
|
||||
this.bankAccountId = bankAccountId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.buy507.mall.portal.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WxPayTradeDto {
|
||||
|
||||
private String body;
|
||||
|
||||
private String outTradeNo;
|
||||
|
||||
private String totalFee;
|
||||
|
||||
private String openId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.buy507.mall.portal.pay.alipay;
|
||||
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.CertAlipayRequest;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.internal.util.AlipaySignature;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
@Configuration
|
||||
public class AlipayConfig {
|
||||
|
||||
@Value("${alipay.appId}")
|
||||
private String appId;
|
||||
|
||||
@Value("${alipay.appPrivateKey}")
|
||||
private String appPrivateKey;
|
||||
|
||||
@Value("${alipay.alipayPublicKey}")
|
||||
private String alipayPublicKey;
|
||||
|
||||
@Value("${alipay.serverUrl}")
|
||||
private String serverUrl;
|
||||
|
||||
@Value("${alipay.format}")
|
||||
private String format;
|
||||
|
||||
@Value("${alipay.charset}")
|
||||
private String charset;
|
||||
|
||||
@Value("${alipay.signType}")
|
||||
private String signType;
|
||||
|
||||
@Bean
|
||||
public AlipayClient alipayClient() throws AlipayApiException {
|
||||
//构造client
|
||||
CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
|
||||
//设置网关地址
|
||||
certAlipayRequest.setServerUrl(serverUrl);
|
||||
//设置应用Id
|
||||
certAlipayRequest.setAppId(appId);
|
||||
//设置应用私钥
|
||||
certAlipayRequest.setPrivateKey(appPrivateKey);
|
||||
//设置请求格式,固定值json
|
||||
certAlipayRequest.setFormat("json");
|
||||
//设置字符集
|
||||
certAlipayRequest.setCharset(charset);
|
||||
//设置签名类型
|
||||
certAlipayRequest.setSignType(signType);
|
||||
//设置应用公钥证书路径
|
||||
//String ertPath = System.getProperty("user.dir") + File.separator + "alipay_cert_sn";
|
||||
//certAlipayRequest.setCertPath("D:work/cert/appCertPublicKey_2021004185651069.crt");
|
||||
certAlipayRequest.setCertContent(getCertContentByPath("appCertPublicKey_2021004185651069.crt"));
|
||||
//设置支付宝公钥证书路径
|
||||
certAlipayRequest.setAlipayPublicCertContent(getCertContentByPath("alipayCertPublicKey_RSA2.crt"));
|
||||
//设置支付宝根证书路径
|
||||
certAlipayRequest.setRootCertContent(getCertContentByPath("alipayRootCert.crt"));
|
||||
//return new DefaultAlipayClient(serverUrl, appId, appPrivateKey, format, charset, alipayPublicKey, signType);
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest);
|
||||
return alipayClient;
|
||||
}
|
||||
|
||||
|
||||
public String getCertContentByPath(String name){
|
||||
InputStream inputStream = null;
|
||||
String content = null;
|
||||
try{
|
||||
inputStream = this.getClass().getClassLoader().getResourceAsStream(name);
|
||||
content = new String(FileCopyUtils.copyToByteArray(inputStream));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.buy507.mall.portal.pay.wxpay;
|
||||
|
||||
/**
|
||||
* 域名管理,实现主备域名自动切换
|
||||
*/
|
||||
public abstract interface IWXPayDomain {
|
||||
/**
|
||||
* 上报域名网络状况
|
||||
* @param domain 域名。 比如:api.mch.weixin.qq.com
|
||||
* @param elapsedTimeMillis 耗时
|
||||
* @param ex 网络请求中出现的异常。
|
||||
* null表示没有异常
|
||||
* ConnectTimeoutException,表示建立网络连接异常
|
||||
* UnknownHostException, 表示dns解析异常
|
||||
*/
|
||||
abstract void report(final String domain, long elapsedTimeMillis, final Exception ex);
|
||||
|
||||
/**
|
||||
* 获取域名
|
||||
* @param config 配置
|
||||
* @return 域名
|
||||
*/
|
||||
abstract DomainInfo getDomain(final WXPayConfig config);
|
||||
|
||||
static class DomainInfo{
|
||||
public String domain; //域名
|
||||
public boolean primaryDomain; //该域名是否为主域名。例如:api.mch.weixin.qq.com为主域名
|
||||
public DomainInfo(String domain, boolean primaryDomain) {
|
||||
this.domain = domain;
|
||||
this.primaryDomain = primaryDomain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DomainInfo{" +
|
||||
"domain='" + domain + '\'' +
|
||||
", primaryDomain=" + primaryDomain +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.buy507.mall.portal.pay.wxpay;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
public class MyConfig extends WXPayConfig {
|
||||
|
||||
private String appId;
|
||||
|
||||
private String mchId;
|
||||
|
||||
private String key;
|
||||
|
||||
private byte[] certData;
|
||||
|
||||
public MyConfig(String appId, String mchId, String key) throws Exception {
|
||||
InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("cert/apiclient_cert.p12");
|
||||
this.certData = IOUtils.toByteArray(certStream);
|
||||
certStream.close();
|
||||
this.appId = appId;
|
||||
this.mchId = mchId;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
// 小程序appid
|
||||
@Override
|
||||
public String getAppID() {
|
||||
return this.appId;
|
||||
}
|
||||
|
||||
// 商户号
|
||||
@Override
|
||||
public String getMchID() {
|
||||
return this.mchId;
|
||||
}
|
||||
|
||||
/** 商户平台-账户中心-API安全中的密钥 */
|
||||
@Override
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getCertStream() {
|
||||
return new ByteArrayInputStream(this.certData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHttpConnectTimeoutMs() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHttpReadTimeoutMs() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
IWXPayDomain getWXPayDomain() {
|
||||
return new IWXPayDomain() {
|
||||
|
||||
@Override
|
||||
public void report(String domain, long elapsedTimeMillis, Exception ex) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainInfo getDomain(WXPayConfig config) {
|
||||
return new IWXPayDomain.DomainInfo(WXPayConstants.DOMAIN_API, true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,689 @@
|
||||
package com.buy507.mall.portal.pay.wxpay;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.buy507.mall.portal.pay.wxpay.WXPayConstants.SignType;
|
||||
|
||||
public class WXPay {
|
||||
|
||||
private WXPayConfig config;
|
||||
private SignType signType;
|
||||
private boolean autoReport;
|
||||
private boolean useSandbox;
|
||||
private String notifyUrl;
|
||||
private WXPayRequest wxPayRequest;
|
||||
|
||||
public WXPay(final WXPayConfig config) throws Exception {
|
||||
this(config, null, true, false);
|
||||
}
|
||||
|
||||
public WXPay(final WXPayConfig config, final boolean autoReport) throws Exception {
|
||||
this(config, null, autoReport, false);
|
||||
}
|
||||
|
||||
|
||||
public WXPay(final WXPayConfig config, final boolean autoReport, final boolean useSandbox) throws Exception{
|
||||
this(config, null, autoReport, useSandbox);
|
||||
}
|
||||
|
||||
public WXPay(final WXPayConfig config, final String notifyUrl) throws Exception {
|
||||
this(config, notifyUrl, true, false);
|
||||
}
|
||||
|
||||
public WXPay(final WXPayConfig config, final String notifyUrl, final boolean autoReport) throws Exception {
|
||||
this(config, notifyUrl, autoReport, false);
|
||||
}
|
||||
|
||||
public WXPay(final WXPayConfig config, final String notifyUrl, final boolean autoReport, final boolean useSandbox) throws Exception {
|
||||
this.config = config;
|
||||
this.notifyUrl = notifyUrl;
|
||||
this.autoReport = autoReport;
|
||||
this.useSandbox = useSandbox;
|
||||
if (useSandbox) {
|
||||
this.signType = SignType.MD5; // 沙箱环境
|
||||
}
|
||||
else {
|
||||
this.signType = SignType.MD5;
|
||||
}
|
||||
this.wxPayRequest = new WXPayRequest(config);
|
||||
}
|
||||
|
||||
private void checkWXPayConfig() throws Exception {
|
||||
if (this.config == null) {
|
||||
throw new Exception("config is null");
|
||||
}
|
||||
if (this.config.getAppID() == null || this.config.getAppID().trim().length() == 0) {
|
||||
throw new Exception("appid in config is empty");
|
||||
}
|
||||
if (this.config.getMchID() == null || this.config.getMchID().trim().length() == 0) {
|
||||
throw new Exception("appid in config is empty");
|
||||
}
|
||||
if (this.config.getCertStream() == null) {
|
||||
throw new Exception("cert stream in config is empty");
|
||||
}
|
||||
if (this.config.getWXPayDomain() == null){
|
||||
throw new Exception("config.getWXPayDomain() is null");
|
||||
}
|
||||
|
||||
if (this.config.getHttpConnectTimeoutMs() < 10) {
|
||||
throw new Exception("http connect timeout is too small");
|
||||
}
|
||||
if (this.config.getHttpReadTimeoutMs() < 10) {
|
||||
throw new Exception("http read timeout is too small");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 向 Map 中添加 appid、mch_id、nonce_str、sign_type、sign <br>
|
||||
* 该函数适用于商户适用于统一下单等接口,不适用于红包、代金券接口
|
||||
*
|
||||
* @param reqData
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> fillRequestData(Map<String, String> reqData) throws Exception {
|
||||
reqData.put("appid", config.getAppID());
|
||||
reqData.put("mch_id", config.getMchID());
|
||||
reqData.put("nonce_str", WXPayUtil.generateNonceStr());
|
||||
if (SignType.MD5.equals(this.signType)) {
|
||||
reqData.put("sign_type", WXPayConstants.MD5);
|
||||
}
|
||||
else if (SignType.HMACSHA256.equals(this.signType)) {
|
||||
reqData.put("sign_type", WXPayConstants.HMACSHA256);
|
||||
}
|
||||
reqData.put("sign", WXPayUtil.generateSignature(reqData, config.getKey(), this.signType));
|
||||
return reqData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断xml数据的sign是否有效,必须包含sign字段,否则返回false。
|
||||
*
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return 签名是否有效
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean isResponseSignatureValid(Map<String, String> reqData) throws Exception {
|
||||
// 返回数据的签名方式和请求中给定的签名方式是一致的
|
||||
return WXPayUtil.isSignatureValid(reqData, this.config.getKey(), this.signType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断支付结果通知中的sign是否有效
|
||||
*
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return 签名是否有效
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean isPayResultNotifySignatureValid(Map<String, String> reqData) throws Exception {
|
||||
String signTypeInData = reqData.get(WXPayConstants.FIELD_SIGN_TYPE);
|
||||
SignType signType;
|
||||
if (signTypeInData == null) {
|
||||
signType = SignType.MD5;
|
||||
}
|
||||
else {
|
||||
signTypeInData = signTypeInData.trim();
|
||||
if (signTypeInData.length() == 0) {
|
||||
signType = SignType.MD5;
|
||||
}
|
||||
else if (WXPayConstants.MD5.equals(signTypeInData)) {
|
||||
signType = SignType.MD5;
|
||||
}
|
||||
else if (WXPayConstants.HMACSHA256.equals(signTypeInData)) {
|
||||
signType = SignType.HMACSHA256;
|
||||
}
|
||||
else {
|
||||
throw new Exception(String.format("Unsupported sign_type: %s", signTypeInData));
|
||||
}
|
||||
}
|
||||
return WXPayUtil.isSignatureValid(reqData, this.config.getKey(), signType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 不需要证书的请求
|
||||
* @param urlSuffix String
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public String requestWithoutCert(String urlSuffix, Map<String, String> reqData,
|
||||
int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String msgUUID = reqData.get("nonce_str");
|
||||
String reqBody = WXPayUtil.mapToXml(reqData);
|
||||
|
||||
String resp = this.wxPayRequest.requestWithoutCert(urlSuffix, msgUUID, reqBody, connectTimeoutMs, readTimeoutMs, autoReport);
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 需要证书的请求
|
||||
* @param urlSuffix String
|
||||
* @param reqData 向wxpay post的请求数据 Map
|
||||
* @param connectTimeoutMs 超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public String requestWithCert(String urlSuffix, Map<String, String> reqData,
|
||||
int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String msgUUID= reqData.get("nonce_str");
|
||||
String reqBody = WXPayUtil.mapToXml(reqData);
|
||||
|
||||
String resp = this.wxPayRequest.requestWithCert(urlSuffix, msgUUID, reqBody, connectTimeoutMs, readTimeoutMs, this.autoReport);
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 HTTPS API返回数据,转换成Map对象。return_code为SUCCESS时,验证签名。
|
||||
* @param xmlStr API返回的XML格式数据
|
||||
* @return Map类型数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> processResponseXml(String xmlStr) throws Exception {
|
||||
String RETURN_CODE = "return_code";
|
||||
String return_code;
|
||||
Map<String, String> respData = WXPayUtil.xmlToMap(xmlStr);
|
||||
if (respData.containsKey(RETURN_CODE)) {
|
||||
return_code = respData.get(RETURN_CODE);
|
||||
}
|
||||
else {
|
||||
throw new Exception(String.format("No `return_code` in XML: %s", xmlStr));
|
||||
}
|
||||
|
||||
if (return_code.equals(WXPayConstants.FAIL)) {
|
||||
return respData;
|
||||
}
|
||||
else if (return_code.equals(WXPayConstants.SUCCESS)) {
|
||||
if (this.isResponseSignatureValid(respData)) {
|
||||
return respData;
|
||||
}
|
||||
else {
|
||||
throw new Exception(String.format("Invalid sign value in XML: %s", xmlStr));
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Exception(String.format("return_code value %s is invalid in XML: %s", return_code, xmlStr));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 作用:提交刷卡支付<br>
|
||||
* 场景:刷卡支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> microPay(Map<String, String> reqData) throws Exception {
|
||||
return this.microPay(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:提交刷卡支付<br>
|
||||
* 场景:刷卡支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> microPay(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_MICROPAY_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.MICROPAY_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交刷卡支付,针对软POS,尽可能做成功
|
||||
* 内置重试机制,最多60s
|
||||
* @param reqData
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> microPayWithPos(Map<String, String> reqData) throws Exception {
|
||||
return this.microPayWithPos(reqData, this.config.getHttpConnectTimeoutMs());
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交刷卡支付,针对软POS,尽可能做成功
|
||||
* 内置重试机制,最多60s
|
||||
* @param reqData
|
||||
* @param connectTimeoutMs
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> microPayWithPos(Map<String, String> reqData, int connectTimeoutMs) throws Exception {
|
||||
int remainingTimeMs = 60*1000;
|
||||
long startTimestampMs = 0;
|
||||
Map<String, String> lastResult = null;
|
||||
Exception lastException = null;
|
||||
|
||||
while (true) {
|
||||
startTimestampMs = WXPayUtil.getCurrentTimestampMs();
|
||||
int readTimeoutMs = remainingTimeMs - connectTimeoutMs;
|
||||
if (readTimeoutMs > 1000) {
|
||||
try {
|
||||
lastResult = this.microPay(reqData, connectTimeoutMs, readTimeoutMs);
|
||||
String returnCode = lastResult.get("return_code");
|
||||
if (returnCode.equals("SUCCESS")) {
|
||||
String resultCode = lastResult.get("result_code");
|
||||
String errCode = lastResult.get("err_code");
|
||||
if (resultCode.equals("SUCCESS")) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// 看错误码,若支付结果未知,则重试提交刷卡支付
|
||||
if (errCode.equals("SYSTEMERROR") || errCode.equals("BANKERROR") || errCode.equals("USERPAYING")) {
|
||||
remainingTimeMs = remainingTimeMs - (int)(WXPayUtil.getCurrentTimestampMs() - startTimestampMs);
|
||||
if (remainingTimeMs <= 100) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
WXPayUtil.getLogger().info("microPayWithPos: try micropay again");
|
||||
if (remainingTimeMs > 5*1000) {
|
||||
Thread.sleep(5*1000);
|
||||
}
|
||||
else {
|
||||
Thread.sleep(1*1000);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
lastResult = null;
|
||||
lastException = ex;
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (lastResult == null) {
|
||||
throw lastException;
|
||||
}
|
||||
else {
|
||||
return lastResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 作用:统一下单<br>
|
||||
* 场景:公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> unifiedOrder(Map<String, String> reqData) throws Exception {
|
||||
return this.unifiedOrder(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:统一下单<br>
|
||||
* 场景:公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> unifiedOrder(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_UNIFIEDORDER_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.UNIFIEDORDER_URL_SUFFIX;
|
||||
}
|
||||
if(this.notifyUrl != null) {
|
||||
reqData.put("notify_url", this.notifyUrl);
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:查询订单<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> orderQuery(Map<String, String> reqData) throws Exception {
|
||||
return this.orderQuery(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:查询订单<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据 int
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> orderQuery(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_ORDERQUERY_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.ORDERQUERY_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:撤销订单<br>
|
||||
* 场景:刷卡支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> reverse(Map<String, String> reqData) throws Exception {
|
||||
return this.reverse(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:撤销订单<br>
|
||||
* 场景:刷卡支付<br>
|
||||
* 其他:需要证书
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> reverse(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_REVERSE_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.REVERSE_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:关闭订单<br>
|
||||
* 场景:公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> closeOrder(Map<String, String> reqData) throws Exception {
|
||||
return this.closeOrder(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:关闭订单<br>
|
||||
* 场景:公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> closeOrder(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_CLOSEORDER_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.CLOSEORDER_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:申请退款<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> refund(Map<String, String> reqData) throws Exception {
|
||||
return this.refund(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:申请退款<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付<br>
|
||||
* 其他:需要证书
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> refund(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_REFUND_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.REFUND_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:退款查询<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> refundQuery(Map<String, String> reqData) throws Exception {
|
||||
return this.refundQuery(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:退款查询<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> refundQuery(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_REFUNDQUERY_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.REFUNDQUERY_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:对账单下载(成功时返回对账单数据,失败时返回XML格式数据)<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> downloadBill(Map<String, String> reqData) throws Exception {
|
||||
return this.downloadBill(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:对账单下载<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付<br>
|
||||
* 其他:无论是否成功都返回Map。若成功,返回的Map中含有return_code、return_msg、data,
|
||||
* 其中return_code为`SUCCESS`,data为对账单数据。
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return 经过封装的API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> downloadBill(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_DOWNLOADBILL_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.DOWNLOADBILL_URL_SUFFIX;
|
||||
}
|
||||
String respStr = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs).trim();
|
||||
Map<String, String> ret;
|
||||
// 出现错误,返回XML数据
|
||||
if (respStr.indexOf("<") == 0) {
|
||||
ret = WXPayUtil.xmlToMap(respStr);
|
||||
}
|
||||
else {
|
||||
// 正常返回csv数据
|
||||
ret = new HashMap<String, String>();
|
||||
ret.put("return_code", WXPayConstants.SUCCESS);
|
||||
ret.put("return_msg", "ok");
|
||||
ret.put("data", respStr);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:交易保障<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> report(Map<String, String> reqData) throws Exception {
|
||||
return this.report(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:交易保障<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> report(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_REPORT_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.REPORT_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return WXPayUtil.xmlToMap(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:转换短链接<br>
|
||||
* 场景:刷卡支付、扫码支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> shortUrl(Map<String, String> reqData) throws Exception {
|
||||
return this.shortUrl(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:转换短链接<br>
|
||||
* 场景:刷卡支付、扫码支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> shortUrl(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_SHORTURL_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.SHORTURL_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:授权码查询OPENID接口<br>
|
||||
* 场景:刷卡支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> authCodeToOpenid(Map<String, String> reqData) throws Exception {
|
||||
return this.authCodeToOpenid(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:授权码查询OPENID接口<br>
|
||||
* 场景:刷卡支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> authCodeToOpenid(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_AUTHCODETOOPENID_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.AUTHCODETOOPENID_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
} // end class
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.buy507.mall.portal.pay.wxpay;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public abstract class WXPayConfig {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取 App ID
|
||||
*
|
||||
* @return App ID
|
||||
*/
|
||||
abstract String getAppID();
|
||||
|
||||
|
||||
/**
|
||||
* 获取 Mch ID
|
||||
*
|
||||
* @return Mch ID
|
||||
*/
|
||||
abstract String getMchID();
|
||||
|
||||
|
||||
/**
|
||||
* 获取 API 密钥
|
||||
*
|
||||
* @return API密钥
|
||||
*/
|
||||
abstract String getKey();
|
||||
|
||||
|
||||
/**
|
||||
* 获取商户证书内容
|
||||
*
|
||||
* @return 商户证书内容
|
||||
*/
|
||||
abstract InputStream getCertStream();
|
||||
|
||||
/**
|
||||
* HTTP(S) 连接超时时间,单位毫秒
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getHttpConnectTimeoutMs() {
|
||||
return 6*1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP(S) 读数据超时时间,单位毫秒
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getHttpReadTimeoutMs() {
|
||||
return 8*1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取WXPayDomain, 用于多域名容灾自动切换
|
||||
* @return
|
||||
*/
|
||||
abstract IWXPayDomain getWXPayDomain();
|
||||
|
||||
/**
|
||||
* 是否自动上报。
|
||||
* 若要关闭自动上报,子类中实现该函数返回 false 即可。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldAutoReport() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进行健康上报的线程的数量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getReportWorkerNum() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 健康上报缓存消息的最大数量。会有线程去独立上报
|
||||
* 粗略计算:加入一条消息200B,10000消息占用空间 2000 KB,约为2MB,可以接受
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getReportQueueMaxSize() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上报,一次最多上报多个数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getReportBatchSize() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.buy507.mall.portal.pay.wxpay;
|
||||
|
||||
import org.apache.http.client.HttpClient;
|
||||
|
||||
/**
|
||||
* 常量
|
||||
*/
|
||||
public class WXPayConstants {
|
||||
|
||||
public enum SignType {
|
||||
MD5, HMACSHA256
|
||||
}
|
||||
|
||||
public static final String DOMAIN_API = "api.mch.weixin.qq.com";
|
||||
public static final String DOMAIN_API2 = "api2.mch.weixin.qq.com";
|
||||
public static final String DOMAIN_APIHK = "apihk.mch.weixin.qq.com";
|
||||
public static final String DOMAIN_APIUS = "apius.mch.weixin.qq.com";
|
||||
|
||||
|
||||
public static final String FAIL = "FAIL";
|
||||
public static final String SUCCESS = "SUCCESS";
|
||||
public static final String HMACSHA256 = "HMAC-SHA256";
|
||||
public static final String MD5 = "MD5";
|
||||
|
||||
public static final String FIELD_SIGN = "sign";
|
||||
public static final String FIELD_SIGN_TYPE = "sign_type";
|
||||
|
||||
public static final String WXPAYSDK_VERSION = "WXPaySDK/3.0.9";
|
||||
public static final String USER_AGENT = WXPAYSDK_VERSION +
|
||||
" (" + System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version") +
|
||||
") Java/" + System.getProperty("java.version") + " HttpClient/" + HttpClient.class.getPackage().getImplementationVersion();
|
||||
|
||||
public static final String MICROPAY_URL_SUFFIX = "/pay/micropay";
|
||||
public static final String UNIFIEDORDER_URL_SUFFIX = "/pay/unifiedorder";
|
||||
public static final String ORDERQUERY_URL_SUFFIX = "/pay/orderquery";
|
||||
public static final String REVERSE_URL_SUFFIX = "/secapi/pay/reverse";
|
||||
public static final String CLOSEORDER_URL_SUFFIX = "/pay/closeorder";
|
||||
public static final String REFUND_URL_SUFFIX = "/secapi/pay/refund";
|
||||
public static final String REFUNDQUERY_URL_SUFFIX = "/pay/refundquery";
|
||||
public static final String DOWNLOADBILL_URL_SUFFIX = "/pay/downloadbill";
|
||||
public static final String REPORT_URL_SUFFIX = "/payitil/report";
|
||||
public static final String SHORTURL_URL_SUFFIX = "/tools/shorturl";
|
||||
public static final String AUTHCODETOOPENID_URL_SUFFIX = "/tools/authcodetoopenid";
|
||||
|
||||
// sandbox
|
||||
public static final String SANDBOX_MICROPAY_URL_SUFFIX = "/sandboxnew/pay/micropay";
|
||||
public static final String SANDBOX_UNIFIEDORDER_URL_SUFFIX = "/sandboxnew/pay/unifiedorder";
|
||||
public static final String SANDBOX_ORDERQUERY_URL_SUFFIX = "/sandboxnew/pay/orderquery";
|
||||
public static final String SANDBOX_REVERSE_URL_SUFFIX = "/sandboxnew/secapi/pay/reverse";
|
||||
public static final String SANDBOX_CLOSEORDER_URL_SUFFIX = "/sandboxnew/pay/closeorder";
|
||||
public static final String SANDBOX_REFUND_URL_SUFFIX = "/sandboxnew/secapi/pay/refund";
|
||||
public static final String SANDBOX_REFUNDQUERY_URL_SUFFIX = "/sandboxnew/pay/refundquery";
|
||||
public static final String SANDBOX_DOWNLOADBILL_URL_SUFFIX = "/sandboxnew/pay/downloadbill";
|
||||
public static final String SANDBOX_REPORT_URL_SUFFIX = "/sandboxnew/payitil/report";
|
||||
public static final String SANDBOX_SHORTURL_URL_SUFFIX = "/sandboxnew/tools/shorturl";
|
||||
public static final String SANDBOX_AUTHCODETOOPENID_URL_SUFFIX = "/sandboxnew/tools/authcodetoopenid";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
package com.buy507.mall.portal.pay.wxpay;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.config.RegistryBuilder;
|
||||
import org.apache.http.conn.socket.ConnectionSocketFactory;
|
||||
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* 交易保障
|
||||
*/
|
||||
public class WXPayReport {
|
||||
|
||||
public static class ReportInfo {
|
||||
|
||||
/**
|
||||
* 布尔变量使用int。0为false, 1为true。
|
||||
*/
|
||||
|
||||
// 基本信息
|
||||
private String version = "v1";
|
||||
private String sdk = WXPayConstants.WXPAYSDK_VERSION;
|
||||
private String uuid; // 交易的标识
|
||||
private long timestamp; // 上报时的时间戳,单位秒
|
||||
private long elapsedTimeMillis; // 耗时,单位 毫秒
|
||||
|
||||
// 针对主域名
|
||||
private String firstDomain; // 第1次请求的域名
|
||||
private boolean primaryDomain; //是否主域名
|
||||
private int firstConnectTimeoutMillis; // 第1次请求设置的连接超时时间,单位 毫秒
|
||||
private int firstReadTimeoutMillis; // 第1次请求设置的读写超时时间,单位 毫秒
|
||||
private int firstHasDnsError; // 第1次请求是否出现dns问题
|
||||
private int firstHasConnectTimeout; // 第1次请求是否出现连接超时
|
||||
private int firstHasReadTimeout; // 第1次请求是否出现连接超时
|
||||
|
||||
public ReportInfo(String uuid, long timestamp, long elapsedTimeMillis, String firstDomain, boolean primaryDomain, int firstConnectTimeoutMillis, int firstReadTimeoutMillis, boolean firstHasDnsError, boolean firstHasConnectTimeout, boolean firstHasReadTimeout) {
|
||||
this.uuid = uuid;
|
||||
this.timestamp = timestamp;
|
||||
this.elapsedTimeMillis = elapsedTimeMillis;
|
||||
this.firstDomain = firstDomain;
|
||||
this.primaryDomain = primaryDomain;
|
||||
this.firstConnectTimeoutMillis = firstConnectTimeoutMillis;
|
||||
this.firstReadTimeoutMillis = firstReadTimeoutMillis;
|
||||
this.firstHasDnsError = firstHasDnsError?1:0;
|
||||
this.firstHasConnectTimeout = firstHasConnectTimeout?1:0;
|
||||
this.firstHasReadTimeout = firstHasReadTimeout?1:0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ReportInfo{" +
|
||||
"version='" + version + '\'' +
|
||||
", sdk='" + sdk + '\'' +
|
||||
", uuid='" + uuid + '\'' +
|
||||
", timestamp=" + timestamp +
|
||||
", elapsedTimeMillis=" + elapsedTimeMillis +
|
||||
", firstDomain='" + firstDomain + '\'' +
|
||||
", primaryDomain=" + primaryDomain +
|
||||
", firstConnectTimeoutMillis=" + firstConnectTimeoutMillis +
|
||||
", firstReadTimeoutMillis=" + firstReadTimeoutMillis +
|
||||
", firstHasDnsError=" + firstHasDnsError +
|
||||
", firstHasConnectTimeout=" + firstHasConnectTimeout +
|
||||
", firstHasReadTimeout=" + firstHasReadTimeout +
|
||||
'}';
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换成 csv 格式
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String toLineString(String key) {
|
||||
String separator = ",";
|
||||
Object[] objects = new Object[] {
|
||||
version, sdk, uuid, timestamp, elapsedTimeMillis,
|
||||
firstDomain, primaryDomain, firstConnectTimeoutMillis, firstReadTimeoutMillis,
|
||||
firstHasDnsError, firstHasConnectTimeout, firstHasReadTimeout
|
||||
};
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for(Object obj: objects) {
|
||||
sb.append(obj).append(separator);
|
||||
}
|
||||
try {
|
||||
String sign = WXPayUtil.HMACSHA256(sb.toString(), key);
|
||||
sb.append(sign);
|
||||
return sb.toString();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final String REPORT_URL = "http://report.mch.weixin.qq.com/wxpay/report/default";
|
||||
// private static final String REPORT_URL = "http://127.0.0.1:5000/test";
|
||||
|
||||
|
||||
private static final int DEFAULT_CONNECT_TIMEOUT_MS = 6*1000;
|
||||
private static final int DEFAULT_READ_TIMEOUT_MS = 8*1000;
|
||||
|
||||
private LinkedBlockingQueue<String> reportMsgQueue = null;
|
||||
private WXPayConfig config;
|
||||
private ExecutorService executorService;
|
||||
|
||||
private volatile static WXPayReport INSTANCE;
|
||||
|
||||
private WXPayReport(final WXPayConfig config) {
|
||||
this.config = config;
|
||||
reportMsgQueue = new LinkedBlockingQueue<String>(config.getReportQueueMaxSize());
|
||||
|
||||
// 添加处理线程
|
||||
executorService = Executors.newFixedThreadPool(config.getReportWorkerNum(), new ThreadFactory() {
|
||||
public Thread newThread(Runnable r) {
|
||||
Thread t = Executors.defaultThreadFactory().newThread(r);
|
||||
t.setDaemon(true);
|
||||
return t;
|
||||
}
|
||||
});
|
||||
|
||||
if (config.shouldAutoReport()) {
|
||||
WXPayUtil.getLogger().info("report worker num: {}", config.getReportWorkerNum());
|
||||
for (int i = 0; i < config.getReportWorkerNum(); ++i) {
|
||||
executorService.execute(new Runnable() {
|
||||
public void run() {
|
||||
while (true) {
|
||||
// 先用 take 获取数据
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String firstMsg = reportMsgQueue.take();
|
||||
WXPayUtil.getLogger().info("get first report msg: {}", firstMsg);
|
||||
String msg = null;
|
||||
sb.append(firstMsg); //会阻塞至有消息
|
||||
int remainNum = config.getReportBatchSize() - 1;
|
||||
for (int j=0; j<remainNum; ++j) {
|
||||
WXPayUtil.getLogger().info("try get remain report msg");
|
||||
// msg = reportMsgQueue.poll(); // 不阻塞了
|
||||
msg = reportMsgQueue.take();
|
||||
WXPayUtil.getLogger().info("get remain report msg: {}", msg);
|
||||
if (msg == null) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
sb.append("\n");
|
||||
sb.append(msg);
|
||||
}
|
||||
}
|
||||
// 上报
|
||||
WXPayReport.httpRequest(sb.toString(), DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
WXPayUtil.getLogger().warn("report fail. reason: {}", ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 单例,双重校验,请在 JDK 1.5及更高版本中使用
|
||||
*
|
||||
* @param config
|
||||
* @return
|
||||
*/
|
||||
public static WXPayReport getInstance(WXPayConfig config) {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (WXPayReport.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new WXPayReport(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void report(String uuid, long elapsedTimeMillis,
|
||||
String firstDomain, boolean primaryDomain, int firstConnectTimeoutMillis, int firstReadTimeoutMillis,
|
||||
boolean firstHasDnsError, boolean firstHasConnectTimeout, boolean firstHasReadTimeout) {
|
||||
long currentTimestamp = WXPayUtil.getCurrentTimestamp();
|
||||
ReportInfo reportInfo = new ReportInfo(uuid, currentTimestamp, elapsedTimeMillis,
|
||||
firstDomain, primaryDomain, firstConnectTimeoutMillis, firstReadTimeoutMillis,
|
||||
firstHasDnsError, firstHasConnectTimeout, firstHasReadTimeout);
|
||||
String data = reportInfo.toLineString(config.getKey());
|
||||
WXPayUtil.getLogger().info("report {}", data);
|
||||
if (data != null) {
|
||||
reportMsgQueue.offer(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
private void reportSync(final String data) throws Exception {
|
||||
httpRequest(data, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private void reportAsync(final String data) throws Exception {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
httpRequest(data, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
WXPayUtil.getLogger().warn("report fail. reason: {}", ex.getMessage());
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* http 请求
|
||||
* @param data
|
||||
* @param connectTimeoutMs
|
||||
* @param readTimeoutMs
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private static String httpRequest(String data, int connectTimeoutMs, int readTimeoutMs) throws Exception{
|
||||
BasicHttpClientConnectionManager connManager;
|
||||
connManager = new BasicHttpClientConnectionManager(
|
||||
RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
||||
.register("https", SSLConnectionSocketFactory.getSocketFactory())
|
||||
.build(),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
HttpClient httpClient = HttpClientBuilder.create()
|
||||
.setConnectionManager(connManager)
|
||||
.build();
|
||||
|
||||
HttpPost httpPost = new HttpPost(REPORT_URL);
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(readTimeoutMs).setConnectTimeout(connectTimeoutMs).build();
|
||||
httpPost.setConfig(requestConfig);
|
||||
|
||||
StringEntity postEntity = new StringEntity(data, "UTF-8");
|
||||
httpPost.addHeader("Content-Type", "text/xml");
|
||||
httpPost.addHeader("User-Agent", WXPayConstants.USER_AGENT);
|
||||
httpPost.setEntity(postEntity);
|
||||
|
||||
HttpResponse httpResponse = httpClient.execute(httpPost);
|
||||
HttpEntity httpEntity = httpResponse.getEntity();
|
||||
return EntityUtils.toString(httpEntity, "UTF-8");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
package com.buy507.mall.portal.pay.wxpay;
|
||||
|
||||
import static com.buy507.mall.portal.pay.wxpay.WXPayConstants.USER_AGENT;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.config.RegistryBuilder;
|
||||
import org.apache.http.conn.ConnectTimeoutException;
|
||||
import org.apache.http.conn.socket.ConnectionSocketFactory;
|
||||
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
public class WXPayRequest {
|
||||
private WXPayConfig config;
|
||||
public WXPayRequest(WXPayConfig config) throws Exception{
|
||||
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求,只请求一次,不做重试
|
||||
* @param domain
|
||||
* @param urlSuffix
|
||||
* @param uuid
|
||||
* @param data
|
||||
* @param connectTimeoutMs
|
||||
* @param readTimeoutMs
|
||||
* @param useCert 是否使用证书,针对退款、撤销等操作
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private String requestOnce(final String domain, String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean useCert) throws Exception {
|
||||
BasicHttpClientConnectionManager connManager;
|
||||
if (useCert) {
|
||||
// 证书
|
||||
char[] password = config.getMchID().toCharArray();
|
||||
InputStream certStream = config.getCertStream();
|
||||
KeyStore ks = KeyStore.getInstance("PKCS12");
|
||||
ks.load(certStream, password);
|
||||
|
||||
// 实例化密钥库 & 初始化密钥工厂
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
||||
kmf.init(ks, password);
|
||||
|
||||
// 创建 SSLContext
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(kmf.getKeyManagers(), null, new SecureRandom());
|
||||
|
||||
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(
|
||||
sslContext,
|
||||
new String[]{"TLSv1"},
|
||||
null,
|
||||
new DefaultHostnameVerifier());
|
||||
|
||||
connManager = new BasicHttpClientConnectionManager(
|
||||
RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
||||
.register("https", sslConnectionSocketFactory)
|
||||
.build(),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
else {
|
||||
connManager = new BasicHttpClientConnectionManager(
|
||||
RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
||||
.register("https", SSLConnectionSocketFactory.getSocketFactory())
|
||||
.build(),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
HttpClient httpClient = HttpClientBuilder.create()
|
||||
.setConnectionManager(connManager)
|
||||
.build();
|
||||
|
||||
String url = "https://" + domain + urlSuffix;
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(readTimeoutMs).setConnectTimeout(connectTimeoutMs).build();
|
||||
httpPost.setConfig(requestConfig);
|
||||
|
||||
StringEntity postEntity = new StringEntity(data, "UTF-8");
|
||||
httpPost.addHeader("Content-Type", "text/xml");
|
||||
httpPost.addHeader("User-Agent", USER_AGENT + " " + config.getMchID());
|
||||
httpPost.setEntity(postEntity);
|
||||
|
||||
HttpResponse httpResponse = httpClient.execute(httpPost);
|
||||
HttpEntity httpEntity = httpResponse.getEntity();
|
||||
return EntityUtils.toString(httpEntity, "UTF-8");
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String request(String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean useCert, boolean autoReport) throws Exception {
|
||||
Exception exception = null;
|
||||
long elapsedTimeMillis = 0;
|
||||
long startTimestampMs = WXPayUtil.getCurrentTimestampMs();
|
||||
boolean firstHasDnsErr = false;
|
||||
boolean firstHasConnectTimeout = false;
|
||||
boolean firstHasReadTimeout = false;
|
||||
IWXPayDomain.DomainInfo domainInfo = config.getWXPayDomain().getDomain(config);
|
||||
if(domainInfo == null){
|
||||
throw new Exception("WXPayConfig.getWXPayDomain().getDomain() is empty or null");
|
||||
}
|
||||
try {
|
||||
String result = requestOnce(domainInfo.domain, urlSuffix, uuid, data, connectTimeoutMs, readTimeoutMs, useCert);
|
||||
elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
|
||||
config.getWXPayDomain().report(domainInfo.domain, elapsedTimeMillis, null);
|
||||
WXPayReport.getInstance(config).report(
|
||||
uuid,
|
||||
elapsedTimeMillis,
|
||||
domainInfo.domain,
|
||||
domainInfo.primaryDomain,
|
||||
connectTimeoutMs,
|
||||
readTimeoutMs,
|
||||
firstHasDnsErr,
|
||||
firstHasConnectTimeout,
|
||||
firstHasReadTimeout);
|
||||
return result;
|
||||
}
|
||||
catch (UnknownHostException ex) { // dns 解析错误,或域名不存在
|
||||
exception = ex;
|
||||
firstHasDnsErr = true;
|
||||
elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
|
||||
WXPayUtil.getLogger().warn("UnknownHostException for domainInfo {}", domainInfo);
|
||||
WXPayReport.getInstance(config).report(
|
||||
uuid,
|
||||
elapsedTimeMillis,
|
||||
domainInfo.domain,
|
||||
domainInfo.primaryDomain,
|
||||
connectTimeoutMs,
|
||||
readTimeoutMs,
|
||||
firstHasDnsErr,
|
||||
firstHasConnectTimeout,
|
||||
firstHasReadTimeout
|
||||
);
|
||||
}
|
||||
catch (ConnectTimeoutException ex) {
|
||||
exception = ex;
|
||||
firstHasConnectTimeout = true;
|
||||
elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
|
||||
WXPayUtil.getLogger().warn("connect timeout happened for domainInfo {}", domainInfo);
|
||||
WXPayReport.getInstance(config).report(
|
||||
uuid,
|
||||
elapsedTimeMillis,
|
||||
domainInfo.domain,
|
||||
domainInfo.primaryDomain,
|
||||
connectTimeoutMs,
|
||||
readTimeoutMs,
|
||||
firstHasDnsErr,
|
||||
firstHasConnectTimeout,
|
||||
firstHasReadTimeout
|
||||
);
|
||||
}
|
||||
catch (SocketTimeoutException ex) {
|
||||
exception = ex;
|
||||
firstHasReadTimeout = true;
|
||||
elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
|
||||
WXPayUtil.getLogger().warn("timeout happened for domainInfo {}", domainInfo);
|
||||
WXPayReport.getInstance(config).report(
|
||||
uuid,
|
||||
elapsedTimeMillis,
|
||||
domainInfo.domain,
|
||||
domainInfo.primaryDomain,
|
||||
connectTimeoutMs,
|
||||
readTimeoutMs,
|
||||
firstHasDnsErr,
|
||||
firstHasConnectTimeout,
|
||||
firstHasReadTimeout);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
exception = ex;
|
||||
elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
|
||||
WXPayReport.getInstance(config).report(
|
||||
uuid,
|
||||
elapsedTimeMillis,
|
||||
domainInfo.domain,
|
||||
domainInfo.primaryDomain,
|
||||
connectTimeoutMs,
|
||||
readTimeoutMs,
|
||||
firstHasDnsErr,
|
||||
firstHasConnectTimeout,
|
||||
firstHasReadTimeout);
|
||||
}
|
||||
config.getWXPayDomain().report(domainInfo.domain, elapsedTimeMillis, exception);
|
||||
throw exception;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 可重试的,非双向认证的请求
|
||||
* @param urlSuffix
|
||||
* @param uuid
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public String requestWithoutCert(String urlSuffix, String uuid, String data, boolean autoReport) throws Exception {
|
||||
return this.request(urlSuffix, uuid, data, config.getHttpConnectTimeoutMs(), config.getHttpReadTimeoutMs(), false, autoReport);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可重试的,非双向认证的请求
|
||||
* @param urlSuffix
|
||||
* @param uuid
|
||||
* @param data
|
||||
* @param connectTimeoutMs
|
||||
* @param readTimeoutMs
|
||||
* @return
|
||||
*/
|
||||
public String requestWithoutCert(String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean autoReport) throws Exception {
|
||||
return this.request(urlSuffix, uuid, data, connectTimeoutMs, readTimeoutMs, false, autoReport);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可重试的,双向认证的请求
|
||||
* @param urlSuffix
|
||||
* @param uuid
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public String requestWithCert(String urlSuffix, String uuid, String data, boolean autoReport) throws Exception {
|
||||
return this.request(urlSuffix, uuid, data, config.getHttpConnectTimeoutMs(), config.getHttpReadTimeoutMs(), true, autoReport);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可重试的,双向认证的请求
|
||||
* @param urlSuffix
|
||||
* @param uuid
|
||||
* @param data
|
||||
* @param connectTimeoutMs
|
||||
* @param readTimeoutMs
|
||||
* @return
|
||||
*/
|
||||
public String requestWithCert(String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean autoReport) throws Exception {
|
||||
return this.request(urlSuffix, uuid, data, connectTimeoutMs, readTimeoutMs, true, autoReport);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
package com.buy507.mall.portal.pay.wxpay;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import com.buy507.mall.portal.pay.wxpay.WXPayConstants.SignType;
|
||||
|
||||
|
||||
public class WXPayUtil {
|
||||
|
||||
private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
private static final Random RANDOM = new SecureRandom();
|
||||
|
||||
/**
|
||||
* XML格式字符串转换为Map
|
||||
*
|
||||
* @param strXML XML字符串
|
||||
* @return XML数据转换后的Map
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Map<String, String> xmlToMap(String strXML) throws Exception {
|
||||
try {
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
DocumentBuilder documentBuilder = WXPayXmlUtil.newDocumentBuilder();
|
||||
InputStream stream = new ByteArrayInputStream(strXML.getBytes("UTF-8"));
|
||||
org.w3c.dom.Document doc = documentBuilder.parse(stream);
|
||||
doc.getDocumentElement().normalize();
|
||||
NodeList nodeList = doc.getDocumentElement().getChildNodes();
|
||||
for (int idx = 0; idx < nodeList.getLength(); ++idx) {
|
||||
Node node = nodeList.item(idx);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
org.w3c.dom.Element element = (org.w3c.dom.Element) node;
|
||||
data.put(element.getNodeName(), element.getTextContent());
|
||||
}
|
||||
}
|
||||
try {
|
||||
stream.close();
|
||||
} catch (Exception ex) {
|
||||
// do nothing
|
||||
}
|
||||
return data;
|
||||
} catch (Exception ex) {
|
||||
WXPayUtil.getLogger().warn("Invalid XML, can not convert to map. Error message: {}. XML content: {}", ex.getMessage(), strXML);
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Map转换为XML格式的字符串
|
||||
*
|
||||
* @param data Map类型数据
|
||||
* @return XML格式的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String mapToXml(Map<String, String> data) throws Exception {
|
||||
org.w3c.dom.Document document = WXPayXmlUtil.newDocument();
|
||||
org.w3c.dom.Element root = document.createElement("xml");
|
||||
document.appendChild(root);
|
||||
for (String key: data.keySet()) {
|
||||
String value = data.get(key);
|
||||
if (value == null) {
|
||||
value = "";
|
||||
}
|
||||
value = value.trim();
|
||||
org.w3c.dom.Element filed = document.createElement(key);
|
||||
filed.appendChild(document.createTextNode(value));
|
||||
root.appendChild(filed);
|
||||
}
|
||||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Transformer transformer = tf.newTransformer();
|
||||
DOMSource source = new DOMSource(document);
|
||||
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
|
||||
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
StringWriter writer = new StringWriter();
|
||||
StreamResult result = new StreamResult(writer);
|
||||
transformer.transform(source, result);
|
||||
String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", "");
|
||||
try {
|
||||
writer.close();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成带有 sign 的 XML 格式字符串
|
||||
*
|
||||
* @param data Map类型数据
|
||||
* @param key API密钥
|
||||
* @return 含有sign字段的XML
|
||||
*/
|
||||
public static String generateSignedXml(final Map<String, String> data, String key) throws Exception {
|
||||
return generateSignedXml(data, key, SignType.MD5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成带有 sign 的 XML 格式字符串
|
||||
*
|
||||
* @param data Map类型数据
|
||||
* @param key API密钥
|
||||
* @param signType 签名类型
|
||||
* @return 含有sign字段的XML
|
||||
*/
|
||||
public static String generateSignedXml(final Map<String, String> data, String key, SignType signType) throws Exception {
|
||||
String sign = generateSignature(data, key, signType);
|
||||
data.put(WXPayConstants.FIELD_SIGN, sign);
|
||||
return mapToXml(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断签名是否正确
|
||||
*
|
||||
* @param xmlStr XML格式数据
|
||||
* @param key API密钥
|
||||
* @return 签名是否正确
|
||||
* @throws Exception
|
||||
*/
|
||||
public static boolean isSignatureValid(String xmlStr, String key) throws Exception {
|
||||
Map<String, String> data = xmlToMap(xmlStr);
|
||||
if (!data.containsKey(WXPayConstants.FIELD_SIGN) ) {
|
||||
return false;
|
||||
}
|
||||
String sign = data.get(WXPayConstants.FIELD_SIGN);
|
||||
return generateSignature(data, key).equals(sign);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断签名是否正确,必须包含sign字段,否则返回false。使用MD5签名。
|
||||
*
|
||||
* @param data Map类型数据
|
||||
* @param key API密钥
|
||||
* @return 签名是否正确
|
||||
* @throws Exception
|
||||
*/
|
||||
public static boolean isSignatureValid(Map<String, String> data, String key) throws Exception {
|
||||
return isSignatureValid(data, key, SignType.MD5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断签名是否正确,必须包含sign字段,否则返回false。
|
||||
*
|
||||
* @param data Map类型数据
|
||||
* @param key API密钥
|
||||
* @param signType 签名方式
|
||||
* @return 签名是否正确
|
||||
* @throws Exception
|
||||
*/
|
||||
public static boolean isSignatureValid(Map<String, String> data, String key, SignType signType) throws Exception {
|
||||
if (!data.containsKey(WXPayConstants.FIELD_SIGN) ) {
|
||||
return false;
|
||||
}
|
||||
String sign = data.get(WXPayConstants.FIELD_SIGN);
|
||||
return generateSignature(data, key, signType).equals(sign);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成签名
|
||||
*
|
||||
* @param data 待签名数据
|
||||
* @param key API密钥
|
||||
* @return 签名
|
||||
*/
|
||||
public static String generateSignature(final Map<String, String> data, String key) throws Exception {
|
||||
return generateSignature(data, key, SignType.MD5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成签名. 注意,若含有sign_type字段,必须和signType参数保持一致。
|
||||
*
|
||||
* @param data 待签名数据
|
||||
* @param key API密钥
|
||||
* @param signType 签名方式
|
||||
* @return 签名
|
||||
*/
|
||||
public static String generateSignature(final Map<String, String> data, String key, SignType signType) throws Exception {
|
||||
Set<String> keySet = data.keySet();
|
||||
String[] keyArray = keySet.toArray(new String[keySet.size()]);
|
||||
Arrays.sort(keyArray);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String k : keyArray) {
|
||||
if (k.equals(WXPayConstants.FIELD_SIGN)) {
|
||||
continue;
|
||||
}
|
||||
if (data.get(k).trim().length() > 0) // 参数值为空,则不参与签名
|
||||
sb.append(k).append("=").append(data.get(k).trim()).append("&");
|
||||
}
|
||||
sb.append("key=").append(key);
|
||||
if (SignType.MD5.equals(signType)) {
|
||||
return MD5(sb.toString()).toUpperCase();
|
||||
}
|
||||
else if (SignType.HMACSHA256.equals(signType)) {
|
||||
return HMACSHA256(sb.toString(), key);
|
||||
}
|
||||
else {
|
||||
throw new Exception(String.format("Invalid sign_type: %s", signType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取随机字符串 Nonce Str
|
||||
*
|
||||
* @return String 随机字符串
|
||||
*/
|
||||
public static String generateNonceStr() {
|
||||
char[] nonceChars = new char[32];
|
||||
for (int index = 0; index < nonceChars.length; ++index) {
|
||||
nonceChars[index] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length()));
|
||||
}
|
||||
return new String(nonceChars);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成 MD5
|
||||
*
|
||||
* @param data 待处理数据
|
||||
* @return MD5结果
|
||||
*/
|
||||
public static String MD5(String data) throws Exception {
|
||||
java.security.MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
byte[] array = md.digest(data.getBytes("UTF-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte item : array) {
|
||||
sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
|
||||
}
|
||||
return sb.toString().toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 HMACSHA256
|
||||
* @param data 待处理数据
|
||||
* @param key 密钥
|
||||
* @return 加密结果
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String HMACSHA256(String data, String key) throws Exception {
|
||||
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
|
||||
sha256_HMAC.init(secret_key);
|
||||
byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte item : array) {
|
||||
sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
|
||||
}
|
||||
return sb.toString().toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志
|
||||
* @return
|
||||
*/
|
||||
public static Logger getLogger() {
|
||||
Logger logger = LoggerFactory.getLogger("wxpay java sdk");
|
||||
return logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间戳,单位秒
|
||||
* @return
|
||||
*/
|
||||
public static long getCurrentTimestamp() {
|
||||
return System.currentTimeMillis()/1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间戳,单位毫秒
|
||||
* @return
|
||||
*/
|
||||
public static long getCurrentTimestampMs() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.buy507.mall.portal.pay.wxpay;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
/**
|
||||
* 2018/7/3
|
||||
*/
|
||||
public final class WXPayXmlUtil {
|
||||
public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
|
||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
||||
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
documentBuilderFactory.setXIncludeAware(false);
|
||||
documentBuilderFactory.setExpandEntityReferences(false);
|
||||
|
||||
return documentBuilderFactory.newDocumentBuilder();
|
||||
}
|
||||
|
||||
public static Document newDocument() throws ParserConfigurationException {
|
||||
return newDocumentBuilder().newDocument();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.buy507.mall.portal.repository;
|
||||
|
||||
import com.buy507.mall.portal.domain.MemberBrandAttention;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员关注Repository
|
||||
*/
|
||||
public interface MemberBrandAttentionRepository extends MongoRepository<MemberBrandAttention,String> {
|
||||
MemberBrandAttention findByMemberIdAndBrandId(Long memberId, Long brandId);
|
||||
int deleteByMemberIdAndBrandId(Long memberId,Long brandId);
|
||||
List<MemberBrandAttention> findByMemberId(Long memberId);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.buy507.mall.portal.repository;
|
||||
|
||||
import com.buy507.mall.portal.domain.MemberProductCollection;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品收藏Repository
|
||||
*/
|
||||
public interface MemberProductCollectionRepository extends MongoRepository<MemberProductCollection,String> {
|
||||
MemberProductCollection findByMemberIdAndProductId(Long memberId, Long productId);
|
||||
int deleteByMemberIdAndProductId(Long memberId,Long productId);
|
||||
List<MemberProductCollection> findByMemberId(Long memberId);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.buy507.mall.portal.repository;
|
||||
|
||||
import com.buy507.mall.portal.domain.MemberReadHistory;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员商品浏览历史Repository
|
||||
*/
|
||||
public interface MemberReadHistoryRepository extends MongoRepository<MemberReadHistory,String> {
|
||||
List<MemberReadHistory> findByMemberIdOrderByCreateTimeDesc(Long memberId);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.buy507.mall.portal.service;
|
||||
|
||||
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.buy507.mall.portal.domain.AlipayPayTradeDto;
|
||||
|
||||
public interface AlipayService {
|
||||
/**
|
||||
* 跳转支付宝支付
|
||||
* @param tradeDto
|
||||
* @return
|
||||
*/
|
||||
String createPayment(AlipayPayTradeDto tradeDto) throws AlipayApiException;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.buy507.mall.portal.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.buy507.mall.model.CmsSubject;
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
import com.buy507.mall.portal.domain.HomeContentResult;
|
||||
import com.buy507.mall.portal.domain.ProductCategoryOptions;
|
||||
import com.buy507.mall.portal.domain.ProductDetailResult;
|
||||
import com.buy507.mall.portal.domain.ProductSkuResult;
|
||||
|
||||
/**
|
||||
* 首页内容管理Service
|
||||
*/
|
||||
public interface HomeService {
|
||||
|
||||
/**
|
||||
* 获取首页内容
|
||||
*/
|
||||
HomeContentResult content();
|
||||
|
||||
/**
|
||||
* 首页商品推荐
|
||||
*/
|
||||
List<PmsProduct> recommendProductList(Integer pageSize, Integer pageNum);
|
||||
|
||||
/**
|
||||
* 获取商品分类信息
|
||||
*/
|
||||
List<ProductCategoryOptions> getProductCateList();
|
||||
|
||||
/**
|
||||
* 根据专题分类分页获取专题
|
||||
* @param cateId 专题分类id
|
||||
*/
|
||||
List<CmsSubject> getSubjectList(Long cateId, Integer pageSize, Integer pageNum);
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
* @param productId
|
||||
* @return
|
||||
*/
|
||||
ProductDetailResult getProductInfo(Long productId);
|
||||
|
||||
ProductSkuResult getProductSku(Long productId, String sp1, String sp2, String sp3);
|
||||
|
||||
List<PmsProduct> getProductList(Long brandId, Long categoryId, String sortType, Integer pageSize, Integer pageNum);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.buy507.mall.portal.service;
|
||||
|
||||
import com.buy507.mall.model.UmsMember;
|
||||
|
||||
public interface InitDistributionService {
|
||||
|
||||
/**
|
||||
* 计算上级团队成员数量
|
||||
* @param member
|
||||
*/
|
||||
void updateUpTeamMemberNumberForAddInviter(UmsMember member);
|
||||
|
||||
void initDistributionTable(Long memberId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.buy507.mall.portal.service;
|
||||
|
||||
import com.buy507.mall.portal.domain.MemberBrandAttention;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员关注Service
|
||||
*/
|
||||
public interface MemberAttentionService {
|
||||
/**
|
||||
* 添加关注
|
||||
*/
|
||||
int add(MemberBrandAttention memberBrandAttention);
|
||||
|
||||
/**
|
||||
* 取消关注
|
||||
*/
|
||||
int delete(Long memberId, Long brandId);
|
||||
|
||||
/**
|
||||
* 获取用户关注列表
|
||||
*/
|
||||
List<MemberBrandAttention> list(Long memberId);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user