初始项目
This commit is contained in:
25
mallplus-portal/.gitignore
vendored
Normal file
25
mallplus-portal/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/build/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
BIN
mallplus-portal/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
mallplus-portal/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
1
mallplus-portal/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
1
mallplus-portal/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@@ -0,0 +1 @@
|
||||
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
|
||||
1
mallplus-portal/MP_verify_8U0gHxfvQWhdo4DS.txt
Normal file
1
mallplus-portal/MP_verify_8U0gHxfvQWhdo4DS.txt
Normal file
@@ -0,0 +1 @@
|
||||
8U0gHxfvQWhdo4DS
|
||||
Binary file not shown.
225
mallplus-portal/mvnw
vendored
Normal file
225
mallplus-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
mallplus-portal/mvnw.cmd
vendored
Normal file
143
mallplus-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%
|
||||
258
mallplus-portal/pom.xml
Normal file
258
mallplus-portal/pom.xml
Normal file
@@ -0,0 +1,258 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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.zscat.mallplus</groupId>
|
||||
<artifactId>mallplus-portal</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>mallplus-portal</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.3.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>aliyun</id>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>aliyun_thirdparty</id>
|
||||
<url>http://maven.aliyun.com/nexus/content/repositories/thirdparty/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<url>http://repo.spring.io/libs-snapshot</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>aliyun</id>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<url>http://repo.spring.io/libs-snapshot</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<j2cache.version>2.7.2-release</j2cache.version>
|
||||
<ijapy.version>2.3.2</ijapy.version>
|
||||
<zxing.version>3.2.1</zxing.version>
|
||||
<weixin.version>1.3.0</weixin.version>
|
||||
<enjoy.version>3.5</enjoy.version>
|
||||
<skipTests>true</skipTests>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.jfinal</groupId>
|
||||
<artifactId>enjoy</artifactId>
|
||||
<version>${enjoy.version}</version>
|
||||
</dependency>
|
||||
<!-- 开源多维码生成工具 -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>3.2.1</version>
|
||||
</dependency>
|
||||
<!-- 开源多维码生成工具 -->
|
||||
<!-- 支付宝必须 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.60</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>3.0.52.ALL</version>
|
||||
</dependency>-->
|
||||
<!-- 支付宝必须 -->
|
||||
<dependency>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>1.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zscat.mallplus</groupId>
|
||||
<artifactId>mallplus-pay</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zscat.mallplus</groupId>
|
||||
<artifactId>mallplus-mbg</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<classifier>jdk15</classifier>
|
||||
<version>2.4</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-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--Swagger-UI API文档生产工具-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
<!--redis依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-redis</artifactId>
|
||||
<version>1.3.8.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--lombok依赖-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- 阿里云OSS -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.14.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<!--<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>-->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>lib</directory>
|
||||
<targetPath>BOOT-INF/lib/</targetPath>
|
||||
<includes>
|
||||
<include>**/*.jar</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<targetPath>BOOT-INF/classes/</targetPath>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
|
||||
</resources>
|
||||
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.zscat.mallplus;
|
||||
|
||||
import com.zscat.mallplus.pay.config.StartupRunner;
|
||||
import com.zscat.mallplus.pms.mapper.PmsProductMapper;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan({"com.zscat.mallplus.mapper", "com.zscat.mallplus.ums.mapper", "com.zscat.mallplus.sms.mapper", "com.zscat.mallplus.cms.mapper", "com.zscat.mallplus.sys.mapper", "com.zscat.mallplus.oms.mapper", "com.zscat.mallplus.pms.mapper"})
|
||||
@EnableTransactionManagement
|
||||
@EnableScheduling
|
||||
public class MallPortalApplication {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("start-------------");
|
||||
SpringApplication.run(MallPortalApplication.class, args);
|
||||
System.out.println("end-------------");
|
||||
}
|
||||
|
||||
/* @Bean
|
||||
public StartupRunner startupRunner() {
|
||||
return new StartupRunner();
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.zscat.mallplus;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代码生成器演示
|
||||
* </p>
|
||||
*/
|
||||
public class MpGenerator {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* MySQL 生成演示
|
||||
* </p>
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
// 选择 freemarker 引擎,默认 Veloctiy
|
||||
// mpg.setTemplateEngine(new FreemarkerTemplateEngine());
|
||||
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
gc.setOutputDir("E:\\shenzhuan\\temp\\logs");
|
||||
// gc.setOutputDir("F:\\home");
|
||||
gc.setFileOverride(true);
|
||||
gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false
|
||||
gc.setEnableCache(false);// XML 二级缓存
|
||||
gc.setBaseResultMap(true);// XML ResultMap
|
||||
gc.setBaseColumnList(true);// XML columList
|
||||
// .setKotlin(true) 是否生成 kotlin 代码
|
||||
gc.setAuthor("zscat");
|
||||
|
||||
// 自定义文件命名,注意 %s 会自动填充表实体属性!
|
||||
// gc.setMapperName("%sDao");
|
||||
// gc.setXmlName("%sDao");
|
||||
// gc.setServiceName("MP%sService");
|
||||
// gc.setServiceImplName("%sServiceDiy");
|
||||
// gc.setControllerName("%sAction");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setDbType(DbType.MYSQL);
|
||||
dsc.setTypeConvert(new MySqlTypeConvert() {
|
||||
// 自定义数据库表字段类型转换【可选】
|
||||
public DbColumnType processTypeConvert(String fieldType) {
|
||||
System.out.println("转换类型:" + fieldType);
|
||||
// 注意!!processTypeConvert 存在默认类型转换,如果不是你要的效果请自定义返回、非如下直接返回。
|
||||
return super.processTypeConvert(gc, fieldType);
|
||||
}
|
||||
});
|
||||
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
|
||||
dsc.setUsername("root");
|
||||
dsc.setPassword("shen@123");
|
||||
dsc.setUrl("jdbc:mysql://localhost:3306/mallplus?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&useTimezone=true&serverTimezone=UTC");
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 自定义配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
// to do nothing
|
||||
}
|
||||
};
|
||||
|
||||
// mpg.setTemplate(new TemplateConfig().setXml(null));
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
|
||||
// strategy.setCapitalMode(true);// 全局大写命名 ORACLE 注意
|
||||
// strategy.setTablePrefix(new String[] { "tlog_", "tsys_" });// 此处可以修改为您的表前缀
|
||||
/* strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
|
||||
strategy.setInclude(new String[] { "sys_user_permission","sys_area","sys_member_area","sys_permission",
|
||||
"sys_role","sys_role_permission","sys_school", "sys_user","sys_user_permission",
|
||||
"sys_user_role","sys_web_log", "sys_admin_log"}); // 需要生成的表*/
|
||||
|
||||
/*strategy.setInclude(new String[] { "cms_help","cms_help_category","cms_member_report","cms_prefrence_area",
|
||||
"cms_prefrence_area_product_relation","cms_subject","cms_subject_category", "cms_subject_comment",
|
||||
"cms_subject_product_relation",
|
||||
"cms_topic","cms_topic_category", "cms_topic_comment","cms_topic_member"});*/
|
||||
|
||||
/* strategy.setInclude(new String[] { "oms_cart_item","oms_company_address","oms_order","oms_order_item",
|
||||
"oms_order_operate_history","oms_order_return_apply","oms_order_setting", "oms_order_return_reason"}); // 需要生成的表
|
||||
*/
|
||||
|
||||
/* strategy.setInclude(new String[] { "pms_album","pms_album_pic","pms_brand","pms_comment",
|
||||
"pms_comment_replay","pms_feight_template","pms_member_price", "pms_product",
|
||||
"pms_product_attribute","pms_product_consult","pms_product_full_reduction","pms_product_ladder",
|
||||
"pms_product_attribute_category","pms_product_attribute_value", "pms_product_category",
|
||||
"pms_product_category_attribute_relation","pms_product_operate_log","pms_product_vertify_record"
|
||||
,"pms_sku_stock"}); */
|
||||
|
||||
/*strategy.setInclude(new String[] { "sms_coupon","sms_coupon_history","sms_coupon_product_category_relation","sms_coupon_product_relation",
|
||||
"sms_flash_promotion","sms_flash_promotion_log","sms_flash_promotion_product_relation", "sms_flash_promotion_session",
|
||||
"sms_group","sms_group_member","sms_home_advertise",
|
||||
"sms_home_brand","sms_home_new_product", "sms_home_recommend_product",
|
||||
"sms_home_recommend_subject","sms_red_packet","sms_user_red_packet"
|
||||
}); */
|
||||
|
||||
// strategy.setInclude(new String[] { "ums_collect","ums_member","ums_member_blance_log","ums_member_level",
|
||||
// "ums_member_member_tag_relation","ums_member_product_category_relation",
|
||||
// "ums_member_receive_address", "ums_member_rule_setting","ums_member_statistics_info","ums_member_tag",
|
||||
// "ums_member_task","ums_growth_change_history","ums_integration_change_history","ums_integration_consume_setting"}); // 需要生成的表
|
||||
strategy.setInclude(new String[]{"sms_flash_promotion_session"});
|
||||
|
||||
// strategy.setExclude(new String[]{"test"}); // 排除生成的表
|
||||
// 自定义实体父类
|
||||
// strategy.setSuperEntityClass("com.baomidou.demo.TestEntity");
|
||||
// 自定义实体,公共字段
|
||||
// strategy.setSuperEntityColumns(new String[] { "test_id", "age" });
|
||||
// 自定义 mapper 父类
|
||||
// strategy.setSuperMapperClass("com.baomidou.demo.TestMapper");
|
||||
// 自定义 service 父类
|
||||
// strategy.setSuperServiceClass("com.baomidou.demo.TestService");
|
||||
// 自定义 service 实现类父类
|
||||
// strategy.setSuperServiceImplClass("com.baomidou.demo.TestServiceImpl");
|
||||
// 自定义 controller 父类
|
||||
// strategy.setSuperControllerClass("com.baomidou.demo.TestController");
|
||||
// 【实体】是否生成字段常量(默认 false)
|
||||
// public static final String ID = "test_id";
|
||||
// strategy.setEntityColumnConstant(true);
|
||||
// 【实体】是否为构建者模型(默认 false)
|
||||
// public User setName(String name) {this.name = name; return this;}
|
||||
// strategy.setEntityBuilderModel(true);
|
||||
mpg.setStrategy(strategy);
|
||||
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
pc.setParent("com.zscat.mallplus");
|
||||
pc.setModuleName("oms");
|
||||
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
|
||||
// 关闭默认 xml 生成,调整生成 至 根目录
|
||||
TemplateConfig tc = new TemplateConfig();
|
||||
tc.setXml(null);
|
||||
mpg.setTemplate(tc);
|
||||
|
||||
// 自定义模板配置,可以 copy 源码 mybatis-plus/src/main/resources/templates 下面内容修改,
|
||||
// 放置自己项目的 src/main/resources/templates 目录下, 默认名称一下可以不配置,也可以自定义模板名称
|
||||
// TemplateConfig tc = new TemplateConfig();
|
||||
// tc.setController("...");
|
||||
// tc.setEntity("...");
|
||||
// tc.setMapper("...");
|
||||
// tc.setXml("...");
|
||||
// tc.setService("...");
|
||||
// tc.setServiceImpl("...");
|
||||
// 如上任何一个模块如果设置 空 OR Null 将不生成该模块。
|
||||
// mpg.setTemplate(tc);
|
||||
|
||||
// 执行生成
|
||||
mpg.execute();
|
||||
|
||||
// 打印注入设置【可无】
|
||||
// System.err.println(mpg.getCfg().getMap().get("abc"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.zscat.mallplus;
|
||||
|
||||
import com.zscat.mallplus.sys.mapper.SysAreaMapper;
|
||||
import com.zscat.mallplus.ums.service.RedisService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@Component//被spring容器管理
|
||||
@Order(1)//如果多个自定义ApplicationRunner,用来标明执行顺序
|
||||
public class MyApplicationRunner implements ApplicationRunner {
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private SysAreaMapper areaMapper;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments applicationArguments) throws Exception {
|
||||
System.out.println("-------------->" + "项目启动,now=" + new Date());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
65
mallplus-portal/src/main/java/com/zscat/mallplus/Person.java
Normal file
65
mallplus-portal/src/main/java/com/zscat/mallplus/Person.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.zscat.mallplus;
|
||||
|
||||
import com.zscat.mallplus.sms.vo.BeanKv;
|
||||
|
||||
/**
|
||||
* Created by qcl on 2018/3/26.
|
||||
*/
|
||||
public class Person {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private int age;
|
||||
|
||||
public Person() {
|
||||
}
|
||||
|
||||
public Person(int id, String name, int age) {
|
||||
this.id = id;
|
||||
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
BeanKv kv = new BeanKv();
|
||||
if (kv == null) {
|
||||
System.out.println("1");
|
||||
} else {
|
||||
System.out.println(2);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Person{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", age=" + age +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
43
mallplus-portal/src/main/java/com/zscat/mallplus/T.java
Normal file
43
mallplus-portal/src/main/java/com/zscat/mallplus/T.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.zscat.mallplus;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zscat.mallplus.util.DateUtil;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2019/7/3.
|
||||
*/
|
||||
public class T {
|
||||
public static void main(String[] args) {
|
||||
String card = "6217730700961582";
|
||||
String json1 = HttpUtil.get("https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo=" + card + "&cardBinCheck=true");
|
||||
// 转为 Json 对象
|
||||
JSONObject json = JSON.parseObject(json1);
|
||||
//获取到 bank 代码
|
||||
String bank = String.valueOf(json.get("bank"));
|
||||
System.out.printf(bank);
|
||||
//爬取支付宝银行合作商页面
|
||||
String listContent = HttpUtil.get("http://ab.alipay.com/i/yinhang.htm");
|
||||
System.out.println(listContent);
|
||||
//过滤得到需要的银行名称
|
||||
List<String> titles = ReUtil.findAll("<span title=\"(.*?)\" class=\"icon " + bank + "\">(.*?)</span>", listContent, 2);
|
||||
for (String title : titles) {
|
||||
//打印银行名称
|
||||
System.out.println(title);
|
||||
}
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm:ss");
|
||||
Date da = new Date();
|
||||
String format = sdf2.format(da);
|
||||
long nowT = DateUtil.strToDate(format, "HH:mm:ss").getTime();
|
||||
System.out.println(json);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zscat.mallplus.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 忽略Token验证
|
||||
*
|
||||
* @author zscat
|
||||
* @email 951449465@qq.com
|
||||
* @date 2017-03-23 15:44
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface IgnoreAuth {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 系统日志注解
|
||||
*
|
||||
* @author zscat
|
||||
* @email 951449465@qq.com
|
||||
* @date 2017年3月8日 上午10:19:56
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface SysLog {
|
||||
|
||||
String MODULE() default "操作模块";
|
||||
|
||||
String REMARK() default "操作日志";
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zscat.mallplus.appversion.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.appversion.entity.AppVersion;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Auther: dimengzhe
|
||||
* @Date: 2020/06/15/11:17
|
||||
* @Description: 版本更新
|
||||
*/
|
||||
public interface AppVersionService extends IService<AppVersion> {
|
||||
/**
|
||||
* 查询apk版本中正式版本按版本编码倒叙排序
|
||||
* @return
|
||||
*/
|
||||
AppVersion getAll();
|
||||
|
||||
AppVersion selectAppVersion();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zscat.mallplus.appversion.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.appversion.entity.AppVersion;
|
||||
import com.zscat.mallplus.appversion.mapper.AppVersionMapper;
|
||||
import com.zscat.mallplus.appversion.service.AppVersionService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Auther: dimengzhe
|
||||
* @Date: 2020/06/15/11:18
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements AppVersionService {
|
||||
|
||||
@Resource
|
||||
private AppVersionMapper appVersionMapper;
|
||||
|
||||
@Override
|
||||
public AppVersion getAll() {
|
||||
return appVersionMapper.getAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppVersion selectAppVersion() {
|
||||
return appVersionMapper.selectAppVersion();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,429 @@
|
||||
package com.zscat.mallplus.b2c;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zscat.mallplus.annotation.IgnoreAuth;
|
||||
import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.zscat.mallplus.cms.entity.*;
|
||||
import com.zscat.mallplus.cms.service.*;
|
||||
import com.zscat.mallplus.enums.ConstansValue;
|
||||
import com.zscat.mallplus.pms.entity.CmsSubjectProductRelation;
|
||||
import com.zscat.mallplus.pms.entity.PmsProduct;
|
||||
import com.zscat.mallplus.pms.mapper.CmsSubjectProductRelationMapper;
|
||||
import com.zscat.mallplus.pms.service.IPmsProductAttributeCategoryService;
|
||||
import com.zscat.mallplus.pms.service.IPmsProductCategoryService;
|
||||
import com.zscat.mallplus.pms.service.IPmsProductService;
|
||||
import com.zscat.mallplus.single.ApiBaseAction;
|
||||
import com.zscat.mallplus.sms.service.ISmsGroupService;
|
||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||
import com.zscat.mallplus.ums.entity.UmsMemberLevel;
|
||||
import com.zscat.mallplus.ums.entity.UmsRewardLog;
|
||||
import com.zscat.mallplus.ums.mapper.UmsMemberMapper;
|
||||
import com.zscat.mallplus.ums.mapper.UmsRewardLogMapper;
|
||||
import com.zscat.mallplus.ums.service.IUmsMemberLevelService;
|
||||
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
||||
import com.zscat.mallplus.ums.service.IUmsRewardLogService;
|
||||
import com.zscat.mallplus.ums.service.impl.RedisUtil;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||
import com.zscat.mallplus.vo.Rediskey;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Auther: shenzhuan
|
||||
* @Date: 2019/4/2 15:02
|
||||
* @Description:
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "CmsController", description = "内容关系管理")
|
||||
public class BCmsController extends ApiBaseAction {
|
||||
|
||||
@Resource
|
||||
private ISmsGroupService groupService;
|
||||
@Resource
|
||||
private IUmsMemberLevelService memberLevelService;
|
||||
@Resource
|
||||
private IPmsProductService pmsProductService;
|
||||
@Resource
|
||||
private IPmsProductAttributeCategoryService productAttributeCategoryService;
|
||||
@Resource
|
||||
private IPmsProductCategoryService productCategoryService;
|
||||
@Resource
|
||||
private ICmsTopicService topicService;
|
||||
|
||||
@Resource
|
||||
private ICmsSubjectCategoryService subjectCategoryService;
|
||||
@Resource
|
||||
private ICmsSubjectService subjectService;
|
||||
@Resource
|
||||
private ICmsSubjectCommentService commentService;
|
||||
@Resource
|
||||
private ICmsTopicCommentService topicCommentService;
|
||||
@Resource
|
||||
private UmsMemberMapper memberMapper;
|
||||
@Resource
|
||||
private UmsRewardLogMapper rewardLogMapper;
|
||||
@Resource
|
||||
private IUmsRewardLogService rewardLogService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Resource
|
||||
private CmsSubjectProductRelationMapper subjectProductRelationMapper;
|
||||
|
||||
@Autowired
|
||||
private IUmsMemberService memberService;
|
||||
|
||||
@IgnoreAuth
|
||||
@SysLog(MODULE = "cms", REMARK = "查询打赏列表")
|
||||
@ApiOperation(value = "查询打赏列表")
|
||||
@PostMapping(value = "/reward/list")
|
||||
public Object rewardList(UmsRewardLog subject,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
return new CommonResult().success(rewardLogService.page(new Page<UmsRewardLog>(pageNum, pageSize), new QueryWrapper<>(subject).orderByDesc("create_time")));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@SysLog(MODULE = "cms", REMARK = "查询文章列表")
|
||||
@ApiOperation(value = "查询文章列表")
|
||||
@PostMapping(value = "/articles.getArticleList")
|
||||
public Object subjectList(CmsSubject subject,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
return new CommonResult().success(subjectService.page(new Page<CmsSubject>(pageNum, pageSize), new QueryWrapper<>(subject).orderByDesc("create_time").select(ConstansValue.sampleSubjectList)));
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "查询文章分类列表")
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询文章分类列表")
|
||||
@PostMapping(value = "/subjectCategory/list")
|
||||
public Object cateList(CmsSubjectCategory subjectCategory,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
return new CommonResult().success(subjectCategoryService.page(new Page<CmsSubjectCategory>(pageNum, pageSize), new QueryWrapper<>(subjectCategory)));
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "查询文章评论列表")
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询文章评论列表")
|
||||
@PostMapping(value = "/subjectComment/list")
|
||||
public Object subjectList(CmsSubjectComment subjectComment,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
return new CommonResult().success(commentService.page(new Page<CmsSubjectComment>(pageNum, pageSize), new QueryWrapper<>(subjectComment).orderByDesc("create_time")));
|
||||
}
|
||||
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "查询专题列表")
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询专题列表")
|
||||
@PostMapping(value = "/topic/list")
|
||||
public Object subjectList(CmsTopic topic,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
return new CommonResult().success(topicService.page(new Page<CmsTopic>(pageNum, pageSize), new QueryWrapper<>(topic).orderByDesc("create_time")));
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "查询专题列表")
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询公益评论列表")
|
||||
@PostMapping(value = "/topicComment/list")
|
||||
public Object subjectList(CmsTopicComment topic,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
return new CommonResult().success(topicCommentService.page(new Page<CmsTopicComment>(pageNum, pageSize), new QueryWrapper<>(topic).orderByDesc("create_time")));
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "pms", REMARK = "查询专题详情信息")
|
||||
@IgnoreAuth
|
||||
@PostMapping(value = "/topic/detail")
|
||||
@ApiOperation(value = "查询专题详情信息")
|
||||
public Object topicDetail(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
CmsTopic productResult = topicService.getById(id);
|
||||
productResult.setReadCount(productResult.getReadCount() + 1);
|
||||
topicService.updateById(productResult);
|
||||
return new CommonResult().success(productResult);
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "pms", REMARK = "查询文章详情信息")
|
||||
@IgnoreAuth
|
||||
@PostMapping(value = "/articles.getArticleDetail")
|
||||
@ApiOperation(value = "查询文章详情信息")
|
||||
public Object subjectDetail(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
CmsSubject productResult = subjectService.getById(id);
|
||||
if (productResult == null) {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
List<CmsSubjectProductRelation> list = subjectProductRelationMapper.selectList(new QueryWrapper<CmsSubjectProductRelation>().eq("subject_id", id));
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
List<Long> ids = list.stream()
|
||||
.map(CmsSubjectProductRelation::getProductId)
|
||||
.collect(Collectors.toList());
|
||||
List<PmsProduct> products = (List<PmsProduct>) pmsProductService.list(new QueryWrapper<PmsProduct>().in("id", ids).select(ConstansValue.sampleGoodsList));
|
||||
productResult.setProducts(products);
|
||||
}
|
||||
|
||||
//记录浏览量到redis,然后定时更新到数据库
|
||||
String key = Rediskey.ARTICLE_VIEWCOUNT_CODE + id;
|
||||
//找到redis中该篇文章的点赞数,如果不存在则向redis中添加一条
|
||||
Map<Object, Object> viewCountItem = redisUtil.hGetAll(Rediskey.ARTICLE_VIEWCOUNT_KEY);
|
||||
Integer viewCount = 0;
|
||||
if (!viewCountItem.isEmpty()) {
|
||||
if (viewCountItem.containsKey(key)) {
|
||||
viewCount = Integer.parseInt(viewCountItem.get(key).toString()) + 1;
|
||||
redisUtil.hPut(Rediskey.ARTICLE_VIEWCOUNT_KEY, key, viewCount + "");
|
||||
} else {
|
||||
viewCount = 1;
|
||||
redisUtil.hPut(Rediskey.ARTICLE_VIEWCOUNT_KEY, key, 1 + "");
|
||||
}
|
||||
} else {
|
||||
viewCount = 1;
|
||||
redisUtil.hPut(Rediskey.ARTICLE_VIEWCOUNT_KEY, key, 1 + "");
|
||||
}
|
||||
productResult.setReadCount(viewCount);
|
||||
return new CommonResult().success(productResult);
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "创建文章")
|
||||
@ApiOperation(value = "创建文章")
|
||||
@PostMapping(value = "/createSubject")
|
||||
public Object createSubject(CmsSubject subject, BindingResult result) {
|
||||
CommonResult commonResult;
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member != null) {
|
||||
subject.setMemberId(member.getId());
|
||||
subject.setMemberName(member.getNickname());
|
||||
} else {
|
||||
return new CommonResult().failed("请先登录");
|
||||
}
|
||||
if (member.getMemberLevelId() > 0) {
|
||||
UmsMemberLevel memberLevel = memberLevelService.getById(member.getMemberLevelId());
|
||||
|
||||
int subjectCounts = subjectService.countByToday(member.getId());
|
||||
if (ValidatorUtils.empty(subjectCounts)) {
|
||||
subjectCounts = 0;
|
||||
}
|
||||
if (subjectCounts > memberLevel.getArticlecount()) {
|
||||
commonResult = new CommonResult().failed("你今天已经有发" + memberLevel.getArticlecount() + "篇文章");
|
||||
return commonResult;
|
||||
}
|
||||
}
|
||||
if (subject.getQsType() == 1) {
|
||||
subject.setSchoolName(member.getSchoolName());
|
||||
subject.setSchoolId(member.getSchoolId());
|
||||
} else {
|
||||
subject.setAreaName(member.getAreaName());
|
||||
subject.setAreaId(member.getAreaId());
|
||||
}
|
||||
|
||||
subject.setReadCount(0);
|
||||
subject.setForwardCount(0);
|
||||
subject.setCollectCount(0);
|
||||
subject.setCreateTime(new Date());
|
||||
|
||||
boolean count = subjectService.save(subject);
|
||||
if (count) {
|
||||
commonResult = new CommonResult().success(count);
|
||||
} else {
|
||||
commonResult = new CommonResult().failed();
|
||||
}
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "创建公益")
|
||||
@ApiOperation(value = "发布专题")
|
||||
@PostMapping(value = "/createTopic")
|
||||
public Object createTopic(CmsTopic subject, BindingResult result) {
|
||||
CommonResult commonResult;
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member != null) {
|
||||
subject.setMemberId(member.getId());
|
||||
subject.setMemberName(member.getNickname());
|
||||
} else {
|
||||
return new CommonResult().failed("请先登录");
|
||||
}
|
||||
|
||||
if (subject.getQsType() == 1) {
|
||||
subject.setSchoolName(member.getSchoolName());
|
||||
subject.setSchoolId(member.getSchoolId());
|
||||
} else {
|
||||
subject.setAreaName(member.getAreaName());
|
||||
subject.setAreaId(member.getAreaId());
|
||||
}
|
||||
|
||||
subject.setReadCount(0);
|
||||
subject.setAttendCount(0);
|
||||
subject.setAttentionCount(0);
|
||||
subject.setCreateTime(new Date());
|
||||
boolean count = topicService.save(subject);
|
||||
if (count) {
|
||||
commonResult = new CommonResult().success(count);
|
||||
} else {
|
||||
commonResult = new CommonResult().failed();
|
||||
}
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "参加公益")
|
||||
@ApiOperation(value = "参加公益 公益id")
|
||||
@PostMapping(value = "/attendTopic")
|
||||
public Object attendTopic(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
CommonResult commonResult;
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
|
||||
CmsTopic subject = topicService.getById(id);
|
||||
Date now = new Date();
|
||||
if (now.getTime() > subject.getEndTime().getTime() || now.getTime() < subject.getStartTime().getTime()) {
|
||||
return new CommonResult().failed("未开始或者已过期");
|
||||
}
|
||||
if (member != null) {
|
||||
if (ValidatorUtils.notEmpty(subject.getAtids())) {
|
||||
String[] values = subject.getAtids().split(",");
|
||||
List<String> list = Arrays.asList(values);
|
||||
if (list.contains(member.getId() + "")) {
|
||||
return new CommonResult().failed("你已参加该活动");
|
||||
} else {
|
||||
list.add(member.getId() + "");
|
||||
subject.setAtids(Arrays.toString(list.toArray()));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
return new CommonResult().failed("请先登录");
|
||||
}
|
||||
subject.setReadCount(subject.getReadCount() + 1);
|
||||
subject.setAttendCount(subject.getAttendCount() + 1);
|
||||
|
||||
boolean count = topicService.updateById(subject);
|
||||
if (count) {
|
||||
commonResult = new CommonResult().success(count);
|
||||
} else {
|
||||
commonResult = new CommonResult().failed();
|
||||
}
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "参加公益")
|
||||
@ApiOperation(value = "取消参加公益 公益id")
|
||||
@PostMapping(value = "/canceTopic")
|
||||
public Object canceTopic(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
CommonResult commonResult;
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
CmsTopic subject = topicService.getById(id);
|
||||
|
||||
if (member != null) {
|
||||
if (ValidatorUtils.notEmpty(subject.getAtids())) {
|
||||
String[] values = subject.getAtids().split(",");
|
||||
List<String> list = Arrays.asList(values);
|
||||
if (list.contains(member.getId() + "")) {
|
||||
list.remove(member.getId() + "");
|
||||
subject.setAtids(Arrays.toString(list.toArray()));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
return new CommonResult().failed("请先登录");
|
||||
}
|
||||
subject.setReadCount(subject.getReadCount() - 1);
|
||||
subject.setAttendCount(subject.getAttendCount() - 1);
|
||||
|
||||
boolean count = topicService.updateById(subject);
|
||||
if (count) {
|
||||
commonResult = new CommonResult().success(count);
|
||||
} else {
|
||||
commonResult = new CommonResult().failed();
|
||||
}
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "参加公益")
|
||||
@ApiOperation(value = "关注公益 公益id,点一次关注按钮,记录一下关注数量,不去重 不需要登录")
|
||||
@PostMapping(value = "/favoriteTopic")
|
||||
public Object favoriteTopic(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
CommonResult commonResult;
|
||||
CmsTopic subject = topicService.getById(id);
|
||||
subject.setAttentionCount(subject.getAttentionCount() + 1);
|
||||
boolean count = topicService.updateById(subject);
|
||||
if (count) {
|
||||
commonResult = new CommonResult().success(count);
|
||||
} else {
|
||||
commonResult = new CommonResult().failed();
|
||||
}
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "创建文章")
|
||||
@ApiOperation(value = "添加文章评论")
|
||||
@PostMapping(value = "/addSubjectCom")
|
||||
public Object addSubjectCom(CmsSubjectComment subject, BindingResult result) {
|
||||
CommonResult commonResult;
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member != null) {
|
||||
subject.setMemberIcon(member.getIcon());
|
||||
subject.setMemberNickName(member.getNickname());
|
||||
} else {
|
||||
return new CommonResult().failed("请先登录");
|
||||
}
|
||||
subject.setCreateTime(new Date());
|
||||
|
||||
boolean count = commentService.save(subject);
|
||||
if (count) {
|
||||
commonResult = new CommonResult().success(count);
|
||||
} else {
|
||||
commonResult = new CommonResult().failed();
|
||||
}
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "创建文章")
|
||||
@ApiOperation(value = "添加公益评论")
|
||||
@PostMapping(value = "/addTopicCom")
|
||||
public Object addTopicCom(CmsTopicComment subject, BindingResult result) {
|
||||
CommonResult commonResult;
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member != null) {
|
||||
subject.setMemberIcon(member.getIcon());
|
||||
subject.setMemberNickName(member.getNickname());
|
||||
} else {
|
||||
return new CommonResult().failed("请先登录");
|
||||
}
|
||||
subject.setCreateTime(new Date());
|
||||
|
||||
boolean count = topicCommentService.save(subject);
|
||||
if (count) {
|
||||
commonResult = new CommonResult().success(count);
|
||||
} else {
|
||||
commonResult = new CommonResult().failed();
|
||||
}
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "打赏文章")
|
||||
@PostMapping(value = "/reward")
|
||||
@SysLog(MODULE = "ums", REMARK = "打赏文章")
|
||||
public Object reward(@RequestParam(value = "articlelId", required = true) Long articlelId,
|
||||
@RequestParam(value = "coin", required = true) int coin) {
|
||||
return subjectService.reward(articlelId, coin);
|
||||
}
|
||||
|
||||
@PostMapping("/listTimeline")
|
||||
public Object listTimeline() {
|
||||
return new CommonResult().success(subjectService.listTimeLine());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,587 @@
|
||||
package com.zscat.mallplus.b2c;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zscat.mallplus.annotation.IgnoreAuth;
|
||||
import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.zscat.mallplus.cms.entity.CmsSubject;
|
||||
import com.zscat.mallplus.oms.service.IOmsOrderService;
|
||||
import com.zscat.mallplus.oms.vo.HomeContentResult;
|
||||
import com.zscat.mallplus.pms.entity.PmsProduct;
|
||||
import com.zscat.mallplus.pms.service.IPmsProductService;
|
||||
import com.zscat.mallplus.pms.service.IPmsSmallNaviconCategoryService;
|
||||
import com.zscat.mallplus.sms.entity.SmsCouponHistory;
|
||||
import com.zscat.mallplus.sms.entity.SmsHomeAdvertise;
|
||||
import com.zscat.mallplus.sms.mapper.SmsCouponHistoryMapper;
|
||||
import com.zscat.mallplus.sms.service.ISmsCouponService;
|
||||
import com.zscat.mallplus.sms.service.ISmsHomeAdvertiseService;
|
||||
import com.zscat.mallplus.sms.vo.HomeFlashPromotion;
|
||||
import com.zscat.mallplus.ums.entity.SysNotice;
|
||||
import com.zscat.mallplus.ums.entity.TbUserFromId;
|
||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||
import com.zscat.mallplus.ums.entity.UmsMemberLocation;
|
||||
import com.zscat.mallplus.ums.mapper.TbUserFromIdMapper;
|
||||
import com.zscat.mallplus.ums.service.*;
|
||||
import com.zscat.mallplus.util.JsonUtils;
|
||||
import com.zscat.mallplus.util.OssAliyunUtil;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.utils.PhoneUtil;
|
||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||
import com.zscat.mallplus.vo.Rediskey;
|
||||
import com.zscat.mallplus.vo.SmsCode;
|
||||
import com.zscat.mallplus.vo.UmsMemberInfoDetail;
|
||||
import com.zscat.mallplus.vo.home.Configs;
|
||||
import com.zscat.mallplus.vo.home.Pages;
|
||||
import com.zscat.mallplus.vo.home.ServiceMenu;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 首页内容管理Controller
|
||||
* https://github.com/shenzhuan/mallplus on 2019/1/28.
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "HomeController", description = "首页内容管理")
|
||||
public class BHomeController {
|
||||
|
||||
@Autowired
|
||||
OssAliyunUtil aliyunOSSUtil;
|
||||
@Value("${jwt.tokenHeader}")
|
||||
private String tokenHeader;
|
||||
@Value("${jwt.tokenHead}")
|
||||
private String tokenHead;
|
||||
@Autowired
|
||||
private IUmsMemberLocationService memberLocationService;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Autowired
|
||||
private IUmsMemberService memberService;
|
||||
@Autowired
|
||||
private ISmsHomeAdvertiseService advertiseService;
|
||||
@Autowired
|
||||
private IOmsOrderService orderService;
|
||||
@Resource
|
||||
private ISmsCouponService couponService;
|
||||
@Resource
|
||||
private SmsCouponHistoryMapper couponHistoryMapper;
|
||||
@Resource
|
||||
private ISysNoticeService noticeService;
|
||||
@Resource
|
||||
private ISysMessageService messageService;
|
||||
@Resource
|
||||
private TbUserFromIdMapper fromIdMapper;
|
||||
@Resource
|
||||
private IPmsProductService pmsProductService;
|
||||
@Resource
|
||||
private IPmsSmallNaviconCategoryService IPmsSmallNaviconCategoryService;
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("首页内容页信息展示")
|
||||
@SysLog(MODULE = "home", REMARK = "首页内容页信息展示")
|
||||
@RequestMapping(value = "/pc.getpageconfig", method = RequestMethod.POST)
|
||||
public Object pc_home() {
|
||||
HomeContentResult contentResult = null;
|
||||
String key = Rediskey.HOMEPAGEPC;
|
||||
try {
|
||||
String json = redisService.get(key);
|
||||
if (ValidatorUtils.empty(json)) {
|
||||
contentResult = advertiseService.contentPc();
|
||||
redisService.set(key, JsonUtils.objectToJson(contentResult));
|
||||
redisService.expire(key, 60);
|
||||
} else {
|
||||
contentResult = JsonUtils.jsonToPojo(json, HomeContentResult.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
contentResult = advertiseService.contentNew1();
|
||||
redisService.set(key, JsonUtils.objectToJson(contentResult));
|
||||
redisService.expire(key, 60);
|
||||
}
|
||||
return new CommonResult().success(contentResult);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("首页内容页信息展示")
|
||||
@SysLog(MODULE = "home", REMARK = "首页内容页信息展示")
|
||||
@RequestMapping(value = "/crmeb.getpageconfig", method = RequestMethod.POST)
|
||||
public Object contentNew1() {
|
||||
|
||||
HomeContentResult contentResult = null;
|
||||
String key = Rediskey.HOMEPAGE2;
|
||||
try {
|
||||
String json = redisService.get(key);
|
||||
if (ValidatorUtils.empty(json)) {
|
||||
contentResult = advertiseService.contentNew1();
|
||||
redisService.set(key, JsonUtils.objectToJson(contentResult));
|
||||
redisService.expire(key, 60);
|
||||
} else {
|
||||
contentResult = JsonUtils.jsonToPojo(json, HomeContentResult.class);
|
||||
// contentResult = advertiseService.contentNew1();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
contentResult = advertiseService.contentNew1();
|
||||
redisService.set(key, JsonUtils.objectToJson(contentResult));
|
||||
redisService.expire(key, 60);
|
||||
}
|
||||
return new CommonResult().success(contentResult);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("首页内容页信息展示")
|
||||
@SysLog(MODULE = "home", REMARK = "首页内容页信息展示")
|
||||
@RequestMapping(value = "/pages.getpageconfig", method = RequestMethod.POST)
|
||||
public Object contentNew() {
|
||||
String key = Rediskey.HOMEPAGE;
|
||||
String json = redisService.get(key);
|
||||
Pages contentResult = null;
|
||||
try {
|
||||
if (ValidatorUtils.empty(json)) {
|
||||
contentResult = advertiseService.contentNew();
|
||||
redisService.set(key, JsonUtils.objectToJson(contentResult));
|
||||
redisService.expire(key, 360);
|
||||
} else {
|
||||
contentResult = JsonUtils.jsonToPojo(json, Pages.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
contentResult = advertiseService.contentNew();
|
||||
redisService.set(key, JsonUtils.objectToJson(contentResult));
|
||||
redisService.expire(key, 360);
|
||||
}
|
||||
|
||||
return new CommonResult().success(contentResult);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("首页内容页信息展示")
|
||||
@SysLog(MODULE = "home", REMARK = "首页内容页信息展示")
|
||||
@RequestMapping(value = "/share", method = RequestMethod.POST)
|
||||
public Object share() {
|
||||
Map<String, String> data = new HashedMap();
|
||||
data.put("img", "http://shopsoss.oss-cn-beijing.aliyuncs.com/mall/images/20190807/QQ%E5%9B%BE%E7%89%8720190807191952.jpg");
|
||||
data.put("title", "mallplus");
|
||||
data.put("synopsis", "mallplus");
|
||||
return new CommonResult().success(data);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("首页内容页信息展示")
|
||||
@SysLog(MODULE = "home", REMARK = "首页内容页信息展示")
|
||||
@RequestMapping(value = "/api/common/jshopconf", method = RequestMethod.GET)
|
||||
public Object jshopconf() {
|
||||
|
||||
return new Configs();
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("注册")
|
||||
@PostMapping(value = "/user.reg")
|
||||
public Object register(@RequestParam String phone,
|
||||
@RequestParam String password,
|
||||
@RequestParam String confimpassword,
|
||||
@RequestParam String authCode,
|
||||
@RequestParam String invitecode) {
|
||||
if (phone == null || "".equals(phone)) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
if (password == null || "".equals(password)) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
if (confimpassword == null || "".equals(confimpassword)) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
if (authCode == null || "".equals(authCode)) {
|
||||
return new CommonResult().validateFailed("手机验证码为空");
|
||||
}
|
||||
|
||||
return memberService.register(phone, password, confimpassword, authCode, invitecode);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "登录以后返回token")
|
||||
@PostMapping(value = "/userLogin")
|
||||
public Object login(UmsMember umsMember) {
|
||||
if (umsMember == null) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
try {
|
||||
Map<String, Object> token = memberService.login(umsMember.getUsername(), umsMember.getPassword());
|
||||
if (token.get("token") == null) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
return new CommonResult().success(token);
|
||||
} catch (AuthenticationException e) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("修改密码")
|
||||
@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
|
||||
public Object updatePassword(@RequestParam String telephone,
|
||||
@RequestParam String password,
|
||||
@RequestParam String authCode) {
|
||||
return memberService.updatePassword(telephone, password, authCode);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "appLogin登录")
|
||||
@PostMapping(value = "/appLogin")
|
||||
public Object appLogin(@RequestParam String openid,
|
||||
@RequestParam Integer sex,
|
||||
@RequestParam String headimgurl,
|
||||
@RequestParam String unionid,
|
||||
@RequestParam boolean status,
|
||||
@RequestParam String nickname,
|
||||
@RequestParam String city,
|
||||
@RequestParam Integer source) {
|
||||
|
||||
if (openid == null || "".equals(openid)) {
|
||||
return new CommonResult().validateFailed("openid为空");
|
||||
}
|
||||
try {
|
||||
|
||||
Map<String, Object> token = memberService.appLogin(openid, sex, headimgurl, unionid, nickname, city, source);
|
||||
if (token.get("token") == null) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
return new CommonResult().success(token);
|
||||
} catch (AuthenticationException e) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
} catch (Exception e) {
|
||||
return new CommonResult().validateFailed(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "手机号 密码登录")
|
||||
@PostMapping(value = "/user.login")
|
||||
public Object login(@RequestParam String phone,
|
||||
@RequestParam String password) {
|
||||
if (phone == null || "".equals(phone)) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
if (password == null || "".equals(password)) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
try {
|
||||
|
||||
Map<String, Object> token = memberService.login(phone, password);
|
||||
if (token.get("token") == null) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
return new CommonResult().success(token);
|
||||
} catch (AuthenticationException e) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
} catch (Exception e) {
|
||||
return new CommonResult().validateFailed(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "手机号 密码登录")
|
||||
@PostMapping(value = "/user.logout")
|
||||
public Object logout() {
|
||||
try {
|
||||
|
||||
return new CommonResult().success();
|
||||
} catch (AuthenticationException e) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
} catch (Exception e) {
|
||||
return new CommonResult().validateFailed(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "手机和验证码登录")
|
||||
@PostMapping(value = "/user.smslogin")
|
||||
public Object loginByCode(@RequestParam String phone,
|
||||
@RequestParam String authCode) {
|
||||
if (phone == null || "".equals(phone)) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
if (authCode == null || "".equals(authCode)) {
|
||||
return new CommonResult().validateFailed("手机验证码为空");
|
||||
}
|
||||
try {
|
||||
|
||||
Map<String, Object> token = memberService.loginByCode(phone, authCode);
|
||||
if (token.get("token") == null) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
}
|
||||
return new CommonResult().success(token);
|
||||
} catch (AuthenticationException e) {
|
||||
return new CommonResult().validateFailed("用户名或密码错误");
|
||||
} catch (Exception e) {
|
||||
return new CommonResult().validateFailed(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("首页内容页信息展示")
|
||||
@SysLog(MODULE = "home", REMARK = "首页内容页信息展示")
|
||||
@RequestMapping(value = "/user.info", method = RequestMethod.POST)
|
||||
public Object userInfo() {
|
||||
UmsMemberInfoDetail detail = new UmsMemberInfoDetail();
|
||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||
if (umsMember != null && umsMember.getId() != null) {
|
||||
umsMember = memberService.getById(umsMember.getId());
|
||||
List<SmsCouponHistory> histories = couponHistoryMapper.selectList(new QueryWrapper<SmsCouponHistory>().eq("member_id", umsMember.getId()));
|
||||
detail.setHistories(histories);
|
||||
detail.setMember(umsMember);
|
||||
return new CommonResult().success(detail);
|
||||
}
|
||||
return new CommonResult().success();
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@SysLog(MODULE = "oms", REMARK = "服务菜单")
|
||||
@ApiOperation(value = "服务菜单")
|
||||
@PostMapping(value = "/menuList")
|
||||
public Object menuList() {
|
||||
List<ServiceMenu> menuList = new ArrayList<>();
|
||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||
|
||||
menuList.add(new ServiceMenu("会员中心", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc9934a7c.png", "/pages/user_vip/index", "/user/vip"));
|
||||
menuList.add(new ServiceMenu("砍价记录", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc9918091.png", "/pages/activity/user_goods_bargain_list/index", "/activity/bargain/record"));
|
||||
menuList.add(new ServiceMenu("我的推广", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc9943575.png", "/pages/user_spread_user/index", "/user/user_promotion"));
|
||||
menuList.add(new ServiceMenu("我的余额", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc992db31.png", "/pages/user_money/index", "/user/account"));
|
||||
menuList.add(new ServiceMenu("地址信息", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc99101a8.png", "/pages/user_address_list/index", "/user/add_manage"));
|
||||
menuList.add(new ServiceMenu("我的收藏", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc99269d1.png", "/pages/user_goods_collection/index", "/collection"));
|
||||
menuList.add(new ServiceMenu("优惠券", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc991f394.png", "/pages/user_coupon/index", "/user/user_coupon"));
|
||||
menuList.add(new ServiceMenu("联系客服", "http://kaifa.crmeb.net/uploads/attach/2019/07/20190730/0ded3d3f72d654fb33c8c9f30a268c97.png", "/pages/service/index", "/customer/list"));
|
||||
if (umsMember != null && umsMember.getId() != null) {
|
||||
if (ValidatorUtils.empty(umsMember.getRoomNums())) {
|
||||
menuList.add(new ServiceMenu("绑定社区", "http://kaifa.crmeb.net/uploads/attach/2019/07/20190730/0ded3d3f72d654fb33c8c9f30a268c97.png", "/pages/service/index", "/build/BindingCommunity"));
|
||||
} else {
|
||||
menuList.add(new ServiceMenu(umsMember.getRoomDesc(), "http://kaifa.crmeb.net/uploads/attach/2019/07/20190730/0ded3d3f72d654fb33c8c9f30a268c97.png", "/pages/service/index", "/build/index"));
|
||||
}
|
||||
}
|
||||
return new CommonResult().success(menuList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信验证码
|
||||
*
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@ApiOperation("获取验证码")
|
||||
@PostMapping(value = "/user.sms")
|
||||
public Object sendSmsCode(@RequestParam String phone) {
|
||||
try {
|
||||
if (!PhoneUtil.checkPhone(phone)) {
|
||||
throw new IllegalArgumentException("手机号格式不正确");
|
||||
}
|
||||
SmsCode smsCode = memberService.generateCode(phone);
|
||||
|
||||
return new CommonResult().success(smsCode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* banner
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@SysLog(MODULE = "home", REMARK = "bannerList")
|
||||
@PostMapping("/advert.getAdvertList")
|
||||
public Object bannerList(SmsHomeAdvertise advertise) {
|
||||
advertise.setStatus(1);
|
||||
return new CommonResult().success(advertiseService.list(new QueryWrapper<>(advertise)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取广告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@SysLog(MODULE = "home", REMARK = "获取广告")
|
||||
@PostMapping("/advert.getcarousellists")
|
||||
public Object advList(@RequestParam(value = "type", required = false, defaultValue = "10") Integer type) {
|
||||
List<SmsHomeAdvertise> bannerList = advertiseService.getHomeAdvertiseList(type, 0);
|
||||
return new CommonResult().success(bannerList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取广告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@SysLog(MODULE = "home", REMARK = "获取公告列表")
|
||||
@PostMapping("/notice.noticeList")
|
||||
public Object notice(SysNotice order,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "100") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
|
||||
return new CommonResult().success(noticeService.page(new Page<SysNotice>(pageNum, pageSize), new QueryWrapper<>(order).orderByDesc("ctime")));
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "pms", REMARK = "查询公告详情信息")
|
||||
@IgnoreAuth
|
||||
@PostMapping(value = "/notice.noticeInfo")
|
||||
@ApiOperation(value = "查询公益详情信息")
|
||||
public Object noticeInfo(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
SysNotice productResult = noticeService.getById(id);
|
||||
return new CommonResult().success(productResult);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@PostMapping("/api/upload")
|
||||
@ApiOperation("上传文件")
|
||||
public Object upload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
// return new CommonResult().success("https://www.baidu.com/img/bd_logo1.png");
|
||||
|
||||
return new CommonResult().success(aliyunOSSUtil.upload(file));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@PostMapping("/api/uploads")
|
||||
@ApiOperation("多文件上传文件")
|
||||
public Object uploads(@RequestPart("file") MultipartFile[] file) throws Exception {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
if (file != null && file.length > 0) {
|
||||
for (int i = 0; i < file.length; i++) {
|
||||
stringBuffer.append(aliyunOSSUtil.upload(file[i]) + ",");
|
||||
}
|
||||
}
|
||||
return new CommonResult().success(stringBuffer);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("首页秒杀活动")
|
||||
@SysLog(MODULE = "home", REMARK = "首页秒杀活动")
|
||||
@RequestMapping(value = "/seckill/index", method = RequestMethod.POST)
|
||||
public Object getHomeFlashPromotion() {
|
||||
HomeFlashPromotion contentResult = advertiseService.getHomeFlashPromotion();
|
||||
return new CommonResult().success(contentResult);
|
||||
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "pms", REMARK = "查询pms_small_navicon_category表")
|
||||
@ApiOperation("查询pms_small_navicon_category表")
|
||||
@PostMapping(value = "/home.navlist")
|
||||
public Object navlist() {
|
||||
try {
|
||||
return new CommonResult().success(IPmsSmallNaviconCategoryService.list(new QueryWrapper<>()));
|
||||
} catch (Exception e) {
|
||||
log.error("分页获取pms_small_navicon_category列表:%s", e.getMessage(), e);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("首页推荐专题")
|
||||
@SysLog(MODULE = "home", REMARK = "首页推荐专题")
|
||||
@RequestMapping(value = "/recommendsubjectList", method = RequestMethod.POST)
|
||||
public Object getSubjectList(
|
||||
@RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<CmsSubject> subjectList = advertiseService.getRecommendSubjectList(pageSize, pageNum);
|
||||
return new CommonResult().success(subjectList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交小程序推送formid
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param formId 小程序推送formId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "submitFormId")
|
||||
@ApiOperation(value = "提交小程序推送formid")
|
||||
@ResponseBody
|
||||
public Object submitFormId(HttpServletRequest request, HttpServletResponse response, String formId) {
|
||||
|
||||
TbUserFromId entity = new TbUserFromId();
|
||||
|
||||
if (ValidatorUtils.empty(formId)) {
|
||||
return new CommonResult().validateFailed("前置参数错误,formId不能为空");
|
||||
}
|
||||
if ("the formId is a mock one".equals(formId)) {
|
||||
return new CommonResult().success("添加成功");
|
||||
}
|
||||
entity.setFormId(formId);
|
||||
entity.setUserId(memberService.getNewCurrentMember().getId());
|
||||
//校验formId是否已经存在
|
||||
if (fromIdMapper.selectCount(new QueryWrapper<>(entity)) > 0) {
|
||||
return new CommonResult().validateFailed("前置参数错误,formId已经存在 formId:" + formId);
|
||||
}
|
||||
entity.setStatus(1);
|
||||
fromIdMapper.insert(entity);
|
||||
return new CommonResult().success("添加成功");
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "pms", REMARK = "查询首页推荐品牌")
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询首页推荐品牌")
|
||||
@PostMapping(value = "/recommendBrand/list")
|
||||
public Object getRecommendBrandList(
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
|
||||
return new CommonResult().success(pmsProductService.getRecommendBrandList(1, 1));
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "pms", REMARK = "查询首页新品精品、热门、首发列表")
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询首页新品")
|
||||
@PostMapping(value = "/groom/list")
|
||||
public Object getNewProductList(
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "storeId", required = false) Integer storeId,
|
||||
@RequestParam(value = "type", required = false, defaultValue = "1") Integer type) {
|
||||
List<SmsHomeAdvertise> banner = advertiseService.getHomeAdvertiseList(type, storeId);
|
||||
List<PmsProduct> list = new ArrayList<>();
|
||||
if (type == 1) {
|
||||
list = pmsProductService.getHotProductList(1, 100);
|
||||
} else if (type == 2) {
|
||||
list = advertiseService.getSaleProductList(1, 100);
|
||||
} else if (type == 1) {
|
||||
list = pmsProductService.getNewProductList(1, 100);
|
||||
}
|
||||
Map<String, Object> map = new HashedMap();
|
||||
map.put("banner", banner);
|
||||
map.put("list", list);
|
||||
return new CommonResult().success(map);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "submitLocaltion")
|
||||
@ApiOperation(value = "记录位置信息")
|
||||
@ResponseBody
|
||||
public Object submitLocaltion(HttpServletRequest request, HttpServletResponse response, UmsMemberLocation location) {
|
||||
location.setCreateTime(new Date());
|
||||
memberLocationService.save(location);
|
||||
return new CommonResult().success("添加成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,904 @@
|
||||
package com.zscat.mallplus.b2c;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zscat.mallplus.annotation.IgnoreAuth;
|
||||
import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.zscat.mallplus.bill.service.IBillAftersalesItemsService;
|
||||
import com.zscat.mallplus.bill.service.IBillAftersalesService;
|
||||
import com.zscat.mallplus.cms.entity.CmsSubject;
|
||||
import com.zscat.mallplus.enums.AllEnum;
|
||||
import com.zscat.mallplus.enums.ConstansValue;
|
||||
import com.zscat.mallplus.enums.OrderStatus;
|
||||
import com.zscat.mallplus.exception.ApiMallPlusException;
|
||||
import com.zscat.mallplus.oms.entity.*;
|
||||
import com.zscat.mallplus.oms.service.*;
|
||||
import com.zscat.mallplus.oms.vo.OrderParam;
|
||||
import com.zscat.mallplus.pms.mapper.PmsProductMapper;
|
||||
import com.zscat.mallplus.pms.service.IPmsSkuStockService;
|
||||
import com.zscat.mallplus.single.ApiBaseAction;
|
||||
import com.zscat.mallplus.sms.service.ISmsGroupService;
|
||||
import com.zscat.mallplus.sys.mapper.SysShopMapper;
|
||||
import com.zscat.mallplus.ums.entity.OmsShip;
|
||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||
import com.zscat.mallplus.ums.entity.UmsMemberReceiveAddress;
|
||||
import com.zscat.mallplus.ums.mapper.UmsMemberMapper;
|
||||
import com.zscat.mallplus.ums.mapper.UmsMemberReceiveAddressMapper;
|
||||
import com.zscat.mallplus.ums.service.IOmsShipService;
|
||||
import com.zscat.mallplus.ums.service.IUmsMemberReceiveAddressService;
|
||||
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
||||
import com.zscat.mallplus.ums.service.RedisService;
|
||||
import com.zscat.mallplus.ums.service.impl.RedisUtil;
|
||||
import com.zscat.mallplus.util.JsonUtils;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.utils.HttpUtils;
|
||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||
import com.zscat.mallplus.vo.ApplyRefundVo;
|
||||
import com.zscat.mallplus.vo.CartParam;
|
||||
import com.zscat.mallplus.vo.OrderStatusCount;
|
||||
import com.zscat.mallplus.vo.Rediskey;
|
||||
import com.zscat.mallplus.vo.home.ServiceMenu;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Auther: shenzhuan
|
||||
* @Date: 2019/4/2 15:02
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "OmsController", description = "订单管理系统")
|
||||
public class BOmsController extends ApiBaseAction {
|
||||
// 物流信息缓存间隔暂定3个小时
|
||||
private static final Long maxCacheTime = 1000 * 60 * 60 * 3L;
|
||||
@Resource
|
||||
private UmsMemberMapper memberMapper;
|
||||
@Resource
|
||||
private ISmsGroupService groupService;
|
||||
@Resource
|
||||
private IOmsOrderService orderService;
|
||||
@Resource
|
||||
private IOmsOrderItemService orderItemService;
|
||||
@Autowired
|
||||
private IOmsCartItemService cartItemService;
|
||||
@Autowired
|
||||
private IUmsMemberService memberService;
|
||||
@Autowired
|
||||
private IOmsPaymentsService paymentsService;
|
||||
@Autowired
|
||||
private IPmsSkuStockService pmsSkuStockService;
|
||||
@Autowired
|
||||
private IUmsMemberReceiveAddressService memberReceiveAddressService;
|
||||
@Resource
|
||||
private PmsProductMapper productMapper;
|
||||
@Resource
|
||||
private UmsMemberReceiveAddressMapper addressMapper;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private IOmsOrderReturnReasonService IOmsOrderReturnReasonService;
|
||||
@Resource
|
||||
private IOmsOrderReturnApplyService IOmsOrderReturnApplyService;
|
||||
@Autowired
|
||||
private IOmsShipService omsShipService;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private IBillAftersalesService billAftersalesService;
|
||||
@Resource
|
||||
private IBillAftersalesItemsService billAftersalesItemsService;
|
||||
@Resource
|
||||
private SysShopMapper sysShopMapper;
|
||||
|
||||
@ApiOperation("添加商品到购物车")
|
||||
@RequestMapping(value = "/cart.store.add")
|
||||
@ResponseBody
|
||||
public Object addStoreCart(CartParam cartParam) {
|
||||
try {
|
||||
return orderService.addCart(cartParam);
|
||||
} catch (ApiMallPlusException e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation("获取某个会员的购物车列表")
|
||||
@RequestMapping(value = "/cart.getCartlist", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object listStoreCart() {
|
||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||
if (umsMember != null && umsMember.getId() != null) {
|
||||
return new CommonResult().success(cartItemService.listStoreCart(umsMember.getId()));
|
||||
}
|
||||
return new ArrayList<OmsCartItem>();
|
||||
}
|
||||
|
||||
@ApiOperation("添加商品到购物车")
|
||||
@RequestMapping(value = "/cart.add")
|
||||
@ResponseBody
|
||||
public Object addCart(CartParam cartParam) {
|
||||
try {
|
||||
return orderService.addCart(cartParam);
|
||||
} catch (ApiMallPlusException e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/submitStorePreview")
|
||||
public Object submitStorePreview(OrderParam orderParam) {
|
||||
try {
|
||||
Object result = orderService.submitStorePreview(orderParam);
|
||||
return new CommonResult().success(result);
|
||||
} catch (ApiMallPlusException e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交订单
|
||||
*
|
||||
* @param orderParam
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("根据购物车信息生成订单")
|
||||
@RequestMapping(value = "/order.store.create")
|
||||
@ResponseBody
|
||||
public Object generateStoreOrder(OrderParam orderParam) {
|
||||
try {
|
||||
return orderService.generateStoreOrder(orderParam);
|
||||
} catch (ApiMallPlusException e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation("获取某个会员的购物车列表")
|
||||
@RequestMapping(value = "/cart.getlist", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object listCart() {
|
||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||
if (umsMember != null && umsMember.getId() != null) {
|
||||
List<OmsCartItem> cartItemList = cartItemService.list(umsMember.getId(), null);
|
||||
for (OmsCartItem item : cartItemList) {
|
||||
if (ValidatorUtils.notEmpty(item.getProductSkuId())) {
|
||||
item.setSkuStock(pmsSkuStockService.getById(item.getProductSkuId()));
|
||||
} else {
|
||||
item.setProduct(productMapper.selectById(item.getProductId()));
|
||||
}
|
||||
}
|
||||
return new CommonResult().success(cartItemList);
|
||||
}
|
||||
return new ArrayList<OmsCartItem>();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("修改购物车中某个商品的数量")
|
||||
@RequestMapping(value = "/cart.setnums", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateQuantity(@RequestParam Long id,
|
||||
@RequestParam Integer quantity) {
|
||||
int count = cartItemService.updateQuantity(id, memberService.getNewCurrentMember().getId(), quantity);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改购物车中某个商品的数量")
|
||||
@RequestMapping(value = "/cart.getnumber", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getnumber() {
|
||||
Integer count = cartItemService.countCart(memberService.getNewCurrentMember().getId());
|
||||
if (ValidatorUtils.notEmpty(count) && count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().success(0);
|
||||
}
|
||||
|
||||
@ApiOperation("修改购物车中商品的规格")
|
||||
@RequestMapping(value = "/update/attr", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateAttr(@RequestBody OmsCartItem cartItem) {
|
||||
int count = cartItemService.updateAttr(cartItem);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("删除购物车中的某个商品")
|
||||
@RequestMapping(value = "/cart.del")
|
||||
@ResponseBody
|
||||
public Object delete(String ids) {
|
||||
if (StringUtils.isEmpty(ids)) {
|
||||
return new CommonResult().failed("参数为空");
|
||||
}
|
||||
List<Long> resultList = new ArrayList<>(ids.split(",").length);
|
||||
for (String s : ids.split(",")) {
|
||||
resultList.add(Long.valueOf(s));
|
||||
}
|
||||
int count = cartItemService.delete(memberService.getNewCurrentMember().getId(), resultList);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("清空购物车")
|
||||
@RequestMapping(value = "/clear", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object clear() {
|
||||
int count = cartItemService.clear(memberService.getNewCurrentMember().getId());
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("获取配送方式")
|
||||
@RequestMapping(value = "/user.getship", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getship() {
|
||||
List<OmsShip> addressList = omsShipService.list(new QueryWrapper<OmsShip>());
|
||||
return new CommonResult().success(addressList);
|
||||
}
|
||||
|
||||
@ApiOperation("删除收货地址")
|
||||
@RequestMapping(value = "/user.removeship")
|
||||
@ResponseBody
|
||||
public Object delete(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
boolean count = memberReceiveAddressService.removeById(id);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改收货地址")
|
||||
@RequestMapping(value = "/user.vuesaveusership")
|
||||
@ResponseBody
|
||||
public Object update(UmsMemberReceiveAddress address) {
|
||||
boolean count = false;
|
||||
Long memberId = memberService.getNewCurrentMember().getId();
|
||||
if (ValidatorUtils.empty(memberId)) {
|
||||
return new CommonResult().fail(100);
|
||||
|
||||
}
|
||||
address.setMemberId(memberId);
|
||||
if (address.getDefaultStatus() == 1) {
|
||||
addressMapper.updateStatusByMember(memberId);
|
||||
}
|
||||
if (address != null && address.getId() != null) {
|
||||
count = memberReceiveAddressService.updateById(address);
|
||||
} else {
|
||||
count = memberReceiveAddressService.save(address);
|
||||
}
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("微信存储收货地址")
|
||||
@RequestMapping(value = "/user.saveusership")
|
||||
@ResponseBody
|
||||
public Object saveusership(UmsMemberReceiveAddress address) {
|
||||
boolean count = false;
|
||||
if (address.getDefaultStatus() == 1) {
|
||||
addressMapper.updateStatusByMember(memberService.getNewCurrentMember().getId());
|
||||
}
|
||||
if (address != null && address.getId() != null) {
|
||||
count = memberReceiveAddressService.updateById(address);
|
||||
} else {
|
||||
count = memberReceiveAddressService.save(address);
|
||||
}
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("显示所有收货地址")
|
||||
@RequestMapping(value = "/user.getusership", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object list() {
|
||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||
if (umsMember != null && umsMember.getId() != null) {
|
||||
List<UmsMemberReceiveAddress> addressList = memberReceiveAddressService.list(new QueryWrapper<UmsMemberReceiveAddress>().eq("member_id", umsMember.getId()));
|
||||
return new CommonResult().success(addressList);
|
||||
}
|
||||
return new ArrayList<UmsMemberReceiveAddress>();
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("收货地址详情")
|
||||
@RequestMapping(value = "/user.getshipdetail", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getItem(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
UmsMemberReceiveAddress address = memberReceiveAddressService.getById(id);
|
||||
return new CommonResult().success(address);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("显示所有支付方式")
|
||||
@RequestMapping(value = "/payments.getlist", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getPayments() {
|
||||
List<OmsPayments> paymentss = paymentsService.list(new QueryWrapper<OmsPayments>().eq("status", 1));
|
||||
return new CommonResult().success(paymentss);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("显示支付方式详情")
|
||||
@RequestMapping(value = "/payments.getinfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getPaymentsInfo(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
return new CommonResult().success(paymentsService.getById(id));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("显示默认收货地址")
|
||||
@RequestMapping(value = "/user.getuserdefaultship", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getItemDefautl() {
|
||||
UmsMemberReceiveAddress address = memberReceiveAddressService.getDefaultItem();
|
||||
return new CommonResult().success(address);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("设为默认地址")
|
||||
@RequestMapping(value = "/user.setdefship")
|
||||
@ResponseBody
|
||||
public Object setDefault(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
int count = memberReceiveAddressService.setDefault(id);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@SysLog(MODULE = "oms", REMARK = "查询订单列表")
|
||||
@ApiOperation(value = "查询订单列表")
|
||||
@PostMapping(value = "/order.getorderlist")
|
||||
public Object orderList(OmsOrder order,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "100") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
|
||||
IPage<OmsOrder> page = null;
|
||||
if (ValidatorUtils.empty(order.getStatus()) || order.getStatus() == 0) {
|
||||
page = orderService.page(new Page<OmsOrder>(pageNum, pageSize), new QueryWrapper<OmsOrder>().eq("member_id", memberService.getNewCurrentMember().getId()).isNull("pid").orderByDesc("create_time").select(ConstansValue.sampleOrderList));
|
||||
} else {
|
||||
order.setMemberId(memberService.getNewCurrentMember().getId());
|
||||
page = orderService.page(new Page<OmsOrder>(pageNum, pageSize), new QueryWrapper<>(order).isNull("pid").orderByDesc("create_time").select(ConstansValue.sampleOrderList));
|
||||
|
||||
}
|
||||
for (OmsOrder omsOrder : page.getRecords()) {
|
||||
List<OmsOrderItem> itemList = orderItemService.list(new QueryWrapper<OmsOrderItem>().eq("order_id", omsOrder.getId()).eq("type", AllEnum.OrderItemType.GOODS.code()));
|
||||
omsOrder.setOrderItemList(itemList);
|
||||
}
|
||||
return new CommonResult().success(page);
|
||||
}
|
||||
|
||||
@ApiOperation("获取订单详情:订单信息、商品信息、操作记录")
|
||||
@RequestMapping(value = "/order.details", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object detail(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
OmsOrder orderDetailResult = null;
|
||||
String key = Rediskey.orderDetail + "orderid" + id;
|
||||
String json = redisService.get(key);
|
||||
if (ValidatorUtils.notEmpty(json)) {
|
||||
orderDetailResult = JsonUtils.jsonToPojo(json, OmsOrder.class);
|
||||
return new CommonResult().success(orderDetailResult);
|
||||
}
|
||||
orderDetailResult = orderService.getById(id);
|
||||
OmsOrderItem query = new OmsOrderItem();
|
||||
query.setOrderId(id);
|
||||
List<OmsOrderItem> orderItemList = orderItemService.list(new QueryWrapper<>(query));
|
||||
orderDetailResult.setOrderItemList(orderItemList);
|
||||
UmsMember member = memberMapper.selectById(orderDetailResult.getMemberId());
|
||||
if (member != null) {
|
||||
orderDetailResult.setBlance(member.getBlance());
|
||||
}
|
||||
if (ValidatorUtils.notEmpty(orderDetailResult.getGrowth())) {
|
||||
orderDetailResult.setShop(sysShopMapper.selectById(orderDetailResult.getGrowth()));
|
||||
}
|
||||
OmsOrderReturnApply apply = IOmsOrderReturnApplyService.getOne(new QueryWrapper<OmsOrderReturnApply>().eq("order_id", id));
|
||||
if (apply != null && apply.getId() > 0) {
|
||||
orderDetailResult.setAfterbillId(apply.getId());
|
||||
}
|
||||
redisService.set(key, JsonUtils.objectToJson(orderDetailResult));
|
||||
redisService.expire(key, 60);
|
||||
return new CommonResult().success(orderDetailResult);
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "小程序订单管理", REMARK = "取消订单")
|
||||
@ApiOperation("关闭订单")
|
||||
@RequestMapping(value = "/order.cancel", method = RequestMethod.POST)
|
||||
public Object closeOrder(@ApiParam("订单id") @RequestParam Long orderId) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(orderId)) {
|
||||
return new CommonResult().paramFailed("订单id is empty");
|
||||
}
|
||||
OmsOrder newE = orderService.getById(orderId);
|
||||
if (newE.getStatus() != OrderStatus.INIT.getValue()) {
|
||||
return new CommonResult().paramFailed("订单已支付,不能关闭");
|
||||
}
|
||||
if (orderService.closeOrder(newE)) {
|
||||
String key = Rediskey.orderDetail + "orderid" + orderId;
|
||||
redisService.remove(key);
|
||||
return new CommonResult().success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "小程序订单管理", REMARK = "删除订单")
|
||||
@ApiOperation("删除订单")
|
||||
@RequestMapping(value = "/order.del", method = RequestMethod.POST)
|
||||
public Object delOrder(@ApiParam("订单id") @RequestParam Long orderId) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(orderId)) {
|
||||
return new CommonResult().paramFailed("订单id is empty");
|
||||
}
|
||||
OmsOrder newE = orderService.getById(orderId);
|
||||
if (newE.getStatus() < 6) {
|
||||
return new CommonResult().paramFailed("订单已支付,不能删除");
|
||||
}
|
||||
if (orderService.removeById(orderId)) {
|
||||
String key = Rediskey.orderDetail + "orderid" + orderId;
|
||||
redisService.remove(key);
|
||||
return new CommonResult().success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "订单管理", REMARK = "订单确认收货")
|
||||
@ApiOperation("订单确认收货")
|
||||
@RequestMapping(value = "/order.confirm", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object confimDelivery(@ApiParam("订单id") @RequestParam Long id) {
|
||||
try {
|
||||
return new CommonResult().success(orderService.confimDelivery(id));
|
||||
} catch (Exception e) {
|
||||
log.error("订单确认收货:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "订单管理", REMARK = "订单申请退款")
|
||||
@ApiOperation("申请退款")
|
||||
@RequestMapping(value = "/order.applyRefund", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object applyRefund(@ApiParam("订单id") @RequestParam Long id) {
|
||||
try {
|
||||
return new CommonResult().success(orderService.applyRefund(id));
|
||||
} catch (Exception e) {
|
||||
log.error("订单确认收货:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看物流
|
||||
*/
|
||||
@ApiOperation("查看物流")
|
||||
@ResponseBody
|
||||
@RequestMapping("/order.logisticbyapi")
|
||||
public Object getWayBillInfo(String no, String type) throws Exception {
|
||||
try {
|
||||
no = "801132164062135036";
|
||||
if (StringUtils.isEmpty(no)) {
|
||||
throw new ApiMallPlusException("请传入运单号");
|
||||
}
|
||||
// String host = "http://kdwlcxf.market.alicloudapi.com";
|
||||
// String path = "/kdwlcx";
|
||||
|
||||
// String host = "https://wdexpress.market.alicloudapi.com";
|
||||
// String path = "/gxali";
|
||||
|
||||
String host = "https://wuliu.market.alicloudapi.com";
|
||||
String path = "/kdi";
|
||||
|
||||
String method = "GET";
|
||||
|
||||
String appcode = "436e99b5b81044698cbaf100d164aa63"; // !!! 替换这里填写你自己的AppCode 请在买家中心查看
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Authorization", "APPCODE " + appcode); //格式为:Authorization:APPCODE 83359fd73fe11248385f570e3c139xxx
|
||||
Map<String, String> querys = new HashMap<String, String>();
|
||||
querys.put("no", no); // !!! 请求参数 运单号
|
||||
if (ValidatorUtils.notEmpty(type)) {
|
||||
querys.put("type", type);// !!! 请求参数 快递公司
|
||||
}
|
||||
|
||||
// 物流信息
|
||||
String returnStr = "";
|
||||
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
log.info("---------开始查询运单号为{}的物流信息", no);
|
||||
|
||||
// 只有当redis里面有缓存,且缓存时间不超过最大缓存时长,直接取缓存数据
|
||||
if (redisUtil.hExists(Rediskey.KDWL_INFO_CACHE, no)) {
|
||||
|
||||
// redis已经有缓存
|
||||
Object kdwlInfo = redisUtil.hGet(Rediskey.KDWL_INFO_CACHE, no);
|
||||
if (ValidatorUtils.notEmpty(kdwlInfo)) {
|
||||
Map<String, Object> kdwlInfoToMap = JsonUtils.readJsonToMap(kdwlInfo.toString());
|
||||
Long cacheBeginTime = (Long) kdwlInfoToMap.get("queryTime");
|
||||
// 计算已经缓存时长
|
||||
if (System.currentTimeMillis() - cacheBeginTime < maxCacheTime) {
|
||||
// 直接取缓存
|
||||
// kdwlInfoToMap.remove("queryTime");
|
||||
log.info("---------此次查询的物流信息来至于Redis缓存");
|
||||
log.info("---------查询运单号为{}的物流信息结束,物流信息:{}", no, kdwlInfo);
|
||||
return kdwlInfoToMap;
|
||||
} else {
|
||||
// TODO: 2018/8/23 这里已经存过缓存时间 如果缓存数据得到的 物流的状态是已签收,是否需要重新查询??还是直接返回
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 重新查询最新物流信息
|
||||
HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
|
||||
|
||||
// 从返回信息中拿到
|
||||
returnStr = EntityUtils.toString(response.getEntity());
|
||||
|
||||
if (StringUtils.isEmpty(returnStr)) {
|
||||
throw new ApiMallPlusException("查询物流信息失败");
|
||||
}
|
||||
|
||||
// 重新缓存 [这里包含运单号输错 也缓存 避免有人故意调我们物流接口 次数用完]
|
||||
returnMap = JsonUtils.readJsonToMap(returnStr);
|
||||
if (returnMap != null) {
|
||||
returnMap.put("queryTime", System.currentTimeMillis());
|
||||
}
|
||||
redisUtil.hPut(Rediskey.KDWL_INFO_CACHE, no, JsonUtils.objectToJson(returnMap));
|
||||
|
||||
log.info("---------此次查询的物流信息来至于重新查询");
|
||||
log.info("---------查询运单号为{}的物流信息结束,物流信息:{}", no, returnStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return returnMap;
|
||||
} catch (Exception e) {
|
||||
log.error("get waybillInfo error. error=" + e.getMessage(), e);
|
||||
return new CommonResult().failed("获取物流信息失败,请稍后重试");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "订单管理", REMARK = "取消发货")
|
||||
@ApiOperation("取消发货")
|
||||
@RequestMapping(value = "/cancleDelivery", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object cancleDelivery(@ApiParam("订单id") @RequestParam Long id,
|
||||
@ApiParam(value = "订单备注", defaultValue = "我就是想取消") @RequestParam String remark) {
|
||||
OmsOrder order = orderService.getById(id);
|
||||
if (order == null) {
|
||||
return new CommonResult().paramFailed("没有找到id为{" + id + "}的订单");
|
||||
}
|
||||
|
||||
if (order.getStatus() != OrderStatus.DELIVERED.getValue()) {
|
||||
return new CommonResult().paramFailed("已发货订单的物流信息才能取消发货");
|
||||
}
|
||||
int count = orderService.cancleDelivery(order, remark);
|
||||
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/submitPreview")
|
||||
public Object submitPreview(OrderParam orderParam) {
|
||||
try {
|
||||
Object result = orderService.submitPreview(orderParam);
|
||||
return new CommonResult().success(result);
|
||||
} catch (ApiMallPlusException e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提交订单
|
||||
*
|
||||
* @param orderParam
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("根据购物车信息生成订单")
|
||||
@RequestMapping(value = "/order.create")
|
||||
@ResponseBody
|
||||
public Object generateOrder(OrderParam orderParam) {
|
||||
try {
|
||||
return orderService.generateOrder(orderParam);
|
||||
} catch (ApiMallPlusException e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation("发起拼团")
|
||||
@RequestMapping(value = "/addGroup")
|
||||
@ResponseBody
|
||||
public Object addGroup(OrderParam orderParam) {
|
||||
try {
|
||||
return new CommonResult().success(orderService.addGroup(orderParam));
|
||||
} catch (ApiMallPlusException e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation("取消拼团")
|
||||
@RequestMapping(value = "/combination/remove")
|
||||
@ResponseBody
|
||||
public Object quitGroup(@ApiParam("订单id") @RequestParam Long id) {
|
||||
try {
|
||||
return new CommonResult().success(orderService.quitGroup(id));
|
||||
} catch (ApiMallPlusException e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation("提交拼团")
|
||||
@RequestMapping(value = "/acceptGroup")
|
||||
@ResponseBody
|
||||
public Object acceptGroup(OrderParam orderParam) {
|
||||
try {
|
||||
return orderService.acceptGroup(orderParam);
|
||||
} catch (ApiMallPlusException e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "添加订单评论")
|
||||
@ApiOperation(value = "添加订单评论")
|
||||
@PostMapping(value = "/user.orderevaluate")
|
||||
public Object addGoodsConsult(@RequestParam(value = "orderId", defaultValue = "1") Long orderId,
|
||||
@RequestParam(value = "items", defaultValue = "10") String items) throws Exception {
|
||||
|
||||
return orderService.orderComment(orderId, items);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("获取订单不同状态的数量")
|
||||
@SysLog(MODULE = "applet", REMARK = "获取订单不同状态的数量")
|
||||
@PostMapping("/order.getorderstatusnum")
|
||||
public Object getOrderStatusSum() {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
|
||||
String key = Rediskey.getorderstatusnum;
|
||||
String json = redisService.get(key);
|
||||
if (ValidatorUtils.notEmpty(json)) {
|
||||
objectMap = JsonUtils.readJsonToMap1(json);
|
||||
return new CommonResult().success(objectMap);
|
||||
}
|
||||
|
||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||
OrderStatusCount count = new OrderStatusCount();
|
||||
if (umsMember != null && umsMember.getId() != null) {
|
||||
OmsOrder param = new OmsOrder();
|
||||
param.setMemberId(umsMember.getId());
|
||||
List<OmsOrder> list = orderService.list(new QueryWrapper<>(param));
|
||||
int status0 = 0;
|
||||
int status1 = 0;
|
||||
int status2 = 0;
|
||||
int status3 = 0;
|
||||
int status4 = 0;
|
||||
int status5 = 0;
|
||||
int status14 = 0;
|
||||
|
||||
int statusAll = 0;
|
||||
BigDecimal payAmount = BigDecimal.ZERO;
|
||||
for (OmsOrder consult : list) {
|
||||
if (consult.getStatus() == OrderStatus.INIT.getValue()) {
|
||||
status0++;
|
||||
}
|
||||
if (consult.getStatus() == OrderStatus.REFUND.getValue()) {
|
||||
status14++;
|
||||
}
|
||||
if (consult.getStatus() == OrderStatus.TO_DELIVER.getValue()) {
|
||||
status1++;
|
||||
payAmount = payAmount.add(consult.getPayAmount());
|
||||
}
|
||||
if (consult.getStatus() == OrderStatus.DELIVERED.getValue()) {
|
||||
status2++;
|
||||
payAmount = payAmount.add(consult.getPayAmount());
|
||||
|
||||
}
|
||||
if (consult.getStatus() == OrderStatus.TO_COMMENT.getValue()) {
|
||||
status3++;
|
||||
payAmount = payAmount.add(consult.getPayAmount());
|
||||
|
||||
}
|
||||
if (consult.getStatus() == OrderStatus.TRADE_SUCCESS.getValue()) {
|
||||
status4++;
|
||||
payAmount = payAmount.add(consult.getPayAmount());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
statusAll = status1 + status2 + status3 + status4 + status5;
|
||||
count.setPayAmount(payAmount);
|
||||
count.setStatusAll(statusAll);
|
||||
count.setStatus0(status0);
|
||||
count.setStatus1(status1);
|
||||
count.setStatus2(status2);
|
||||
count.setStatus3(status3);
|
||||
count.setStatus4(status4);
|
||||
count.setStatus5(status5);
|
||||
count.setStatus14(status14);
|
||||
|
||||
}
|
||||
objectMap.put("user", umsMember);
|
||||
objectMap.put("count", count);
|
||||
List<ServiceMenu> menuList = new ArrayList<>();
|
||||
menuList.add(new ServiceMenu("会员中心", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc9934a7c.png", "/pages/user_vip/index", "/user/vip"));
|
||||
menuList.add(new ServiceMenu("砍价记录", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc9918091.png", "/pages/activity/user_goods_bargain_list/index", "/activity/bargain/record"));
|
||||
menuList.add(new ServiceMenu("我的推广", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc9943575.png", "/pages/user_spread_user/index", "/user/user_promotion"));
|
||||
menuList.add(new ServiceMenu("我的余额", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc992db31.png", "/pages/user_money/index", "/user/account"));
|
||||
menuList.add(new ServiceMenu("地址信息", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc99101a8.png", "/pages/user_address_list/index", "/user/add_manage"));
|
||||
menuList.add(new ServiceMenu("我的收藏", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc99269d1.png", "/pages/user_goods_collection/index", "/collection"));
|
||||
menuList.add(new ServiceMenu("优惠券", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccc991f394.png", "/pages/user_coupon/index", "/user/user_coupon"));
|
||||
menuList.add(new ServiceMenu("联系客服", "http://kaifa.crmeb.net/uploads/attach/2019/07/20190730/0ded3d3f72d654fb33c8c9f30a268c97.png", "/pages/service/index", "/customer/list"));
|
||||
objectMap.put("menuList", menuList);
|
||||
redisService.set(key, JsonUtils.objectToJson(objectMap));
|
||||
redisService.expire(key, 60);
|
||||
return new CommonResult().success(objectMap);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@SysLog(MODULE = "oms", REMARK = "售后单列表")
|
||||
@ApiOperation(value = "售后单列表")
|
||||
@GetMapping(value = "/order.aftersaleslist")
|
||||
public Object afterSalesList(OmsOrderReturnApply order,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "100") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
|
||||
IPage<OmsOrderReturnApply> page = IOmsOrderReturnApplyService.page(new Page<OmsOrderReturnApply>(pageNum, pageSize), new QueryWrapper<>(order).orderByDesc("create_time"));
|
||||
for (OmsOrderReturnApply omsOrder : page.getRecords()) {
|
||||
List<OmsOrderItem> itemList = orderItemService.list(new QueryWrapper<OmsOrderItem>().eq("order_id", omsOrder.getOrderId()).eq("type", AllEnum.OrderItemType.GOODS.code()));
|
||||
omsOrder.setOrderItemList(itemList);
|
||||
}
|
||||
return new CommonResult().success(page);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@SysLog(MODULE = "oms", REMARK = "售后单详情")
|
||||
@ApiOperation(value = "售后单详情")
|
||||
@PostMapping(value = "/order.aftersalesinfo")
|
||||
public Object afterSalesInfo(@RequestParam Long id) {
|
||||
OmsOrderReturnApply omsOrder = IOmsOrderReturnApplyService.getById(id);
|
||||
List<OmsOrderItem> itemList = orderItemService.list(new QueryWrapper<OmsOrderItem>().eq("order_id", omsOrder.getId()).eq("type", AllEnum.OrderItemType.GOODS.code()));
|
||||
omsOrder.setOrderItemList(itemList);
|
||||
omsOrder.setOrder(orderService.getById(omsOrder.getOrderId()));
|
||||
return new CommonResult().success(omsOrder);
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "订单售后状态")
|
||||
@ApiOperation(value = "订单售后状态")
|
||||
@PostMapping(value = "/order.aftersalesstatus")
|
||||
public Object afterSalesStatus(CmsSubject subject, BindingResult result) {
|
||||
CommonResult commonResult;
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@SysLog(MODULE = "oms", REMARK = "保存订单售后申请")
|
||||
@ApiOperation("保存订单售后申请")
|
||||
@PostMapping(value = "/order.addaftersales")
|
||||
public Object saveOmsOrderReturnApply(@RequestParam(value = "items") String items,
|
||||
@RequestParam(value = "type") Integer type,
|
||||
@RequestParam(value = "images", required = false) String[] images,
|
||||
@RequestParam(value = "returnAmount") BigDecimal returnAmount,
|
||||
@RequestParam(value = "desc", required = false) String desc) throws Exception {
|
||||
ApplyRefundVo vo = new ApplyRefundVo();
|
||||
try {
|
||||
vo.setDesc(desc);
|
||||
vo.setItems(items);
|
||||
vo.setReturnAmount(returnAmount);
|
||||
vo.setType(type);
|
||||
vo.setImages(images);
|
||||
return orderService.applyRe(vo);
|
||||
} catch (Exception e) {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "用户发送退货包裹")
|
||||
@ApiOperation(value = "用户发送退货包裹")
|
||||
@PostMapping(value = "/order.sendreship")
|
||||
public Object sendShip(CmsSubject subject, BindingResult result) {
|
||||
CommonResult commonResult;
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "用户发送退货包裹")
|
||||
@ApiOperation(value = "用户发送退货包裹")
|
||||
@PostMapping(value = "/order.getRefundReason")
|
||||
public Object getRefundReason() {
|
||||
return new CommonResult().success(IOmsOrderReturnReasonService.list(new QueryWrapper<>()));
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "oms", REMARK = "保存订单退货申请")
|
||||
@ApiOperation("保存订单退货申请")
|
||||
@PostMapping(value = "/create")
|
||||
public Object saveOmsOrderReturnApply(OmsOrderReturnApply entity) {
|
||||
try {
|
||||
if (IOmsOrderReturnApplyService.save(entity)) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存订单退货申请:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,395 @@
|
||||
package com.zscat.mallplus.b2c;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.zscat.mallplus.enums.AllEnum;
|
||||
import com.zscat.mallplus.enums.OrderStatus;
|
||||
import com.zscat.mallplus.exception.ApiMallPlusException;
|
||||
import com.zscat.mallplus.oms.entity.OmsOrder;
|
||||
import com.zscat.mallplus.oms.entity.OmsOrderOperateHistory;
|
||||
import com.zscat.mallplus.oms.service.IOmsOrderItemService;
|
||||
import com.zscat.mallplus.oms.service.IOmsOrderOperateHistoryService;
|
||||
import com.zscat.mallplus.oms.service.IOmsOrderService;
|
||||
import com.zscat.mallplus.oms.vo.OrderParam;
|
||||
import com.zscat.mallplus.single.ApiBaseAction;
|
||||
import com.zscat.mallplus.sms.mapper.SmsGroupMapper;
|
||||
import com.zscat.mallplus.ums.entity.SysAppletSet;
|
||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||
import com.zscat.mallplus.ums.mapper.SysAppletSetMapper;
|
||||
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
||||
import com.zscat.mallplus.util.CharUtil;
|
||||
import com.zscat.mallplus.util.DateUtils;
|
||||
import com.zscat.mallplus.util.MapUtils;
|
||||
import com.zscat.mallplus.util.XmlUtil;
|
||||
import com.zscat.mallplus.util.applet.WechatRefundApiResult;
|
||||
import com.zscat.mallplus.util.applet.WechatUtil;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.vo.BalancePayParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* 作者: @author mallplus <br>
|
||||
* 时间: 2017-08-11 08:32<br>
|
||||
* 描述: ApiIndexController <br>
|
||||
*/
|
||||
@Api(tags = "商户支付")
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class BPayController extends ApiBaseAction {
|
||||
private static Logger LOGGER = LoggerFactory.getLogger(BPayController.class);
|
||||
String tradeType = "JSAPI";
|
||||
String uniformorder = "https://api.mch.weixin.qq.com/pay/unifiedorder";
|
||||
String orderquery = "https://api.mch.weixin.qq.com/pay/orderquery";
|
||||
String refundUrl = "https://api.mch.weixin.qq.com/secapi/pay/refund";
|
||||
String refundqueryUrl = "https://api.mch.weixin.qq.com/pay/refundquery";
|
||||
@Resource
|
||||
private IOmsOrderService orderService;
|
||||
@Resource
|
||||
private IUmsMemberService memberService;
|
||||
@Resource
|
||||
private IOmsOrderItemService orderItemService;
|
||||
@Resource
|
||||
private SmsGroupMapper groupMapper;
|
||||
@Resource
|
||||
private SysAppletSetMapper appletSetMapper;
|
||||
@Autowired
|
||||
private IOmsOrderOperateHistoryService orderOperateHistoryService;
|
||||
|
||||
/**
|
||||
* 订单退款请求
|
||||
*/
|
||||
/*
|
||||
@SysLog(MODULE = "pay", REMARK = "订单退款请求")
|
||||
@ApiOperation(value = "订单退款请求")
|
||||
@PostMapping("refund")
|
||||
public Object refund(Integer orderId) {
|
||||
//
|
||||
OrderVo orderInfo = orderService.queryObject(orderId);
|
||||
|
||||
if (null == orderInfo) {
|
||||
return toResponsObject(400, "订单已取消", "");
|
||||
}
|
||||
|
||||
if (orderInfo.getOrder_status() == 401 || orderInfo.getOrder_status() == 402) {
|
||||
return toResponsObject(400, "订单已退款", "");
|
||||
}
|
||||
|
||||
WechatRefundApiResult result = WechatUtil.wxRefund(orderInfo.getId().toString(),
|
||||
10.01, 10.01);
|
||||
if (result.getResult_code().equals("SUCCESS")) {
|
||||
if (orderInfo.getOrder_status() == 201) {
|
||||
orderInfo.setOrder_status(401);
|
||||
} else if (orderInfo.getOrder_status() == 300) {
|
||||
orderInfo.setOrder_status(402);
|
||||
}
|
||||
orderService.updateAll(orderInfo);
|
||||
return toResponsObject(400, "成功退款", "");
|
||||
} else {
|
||||
return toResponsObject(400, "退款失败", "");
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
//返回微信服务
|
||||
public static String setXml(String return_code, String return_msg) {
|
||||
return "<xml><return_code><![CDATA[" + return_code + "]]></return_code><return_msg><![CDATA[" + return_msg + "]]></return_msg></xml>";
|
||||
}
|
||||
|
||||
//模拟微信回调接口
|
||||
public static String callbakcXml(String orderNum) {
|
||||
return "<xml><appid><![CDATA[wx2421b1c4370ec43b]]></appid><attach><![CDATA[支付测试]]></attach><bank_type><![CDATA[CFT]]></bank_type><fee_type><![CDATA[CNY]]></fee_type> <is_subscribe><![CDATA[Y]]></is_subscribe><mch_id><![CDATA[10000100]]></mch_id><nonce_str><![CDATA[5d2b6c2a8db53831f7eda20af46e531c]]></nonce_str><openid><![CDATA[oUpF8uMEb4qRXf22hE3X68TekukE]]></openid> <out_trade_no><![CDATA[" + orderNum + "]]></out_trade_no> <result_code><![CDATA[SUCCESS]]></result_code> <return_code><![CDATA[SUCCESS]]></return_code><sign><![CDATA[B552ED6B279343CB493C5DD0D78AB241]]></sign><sub_mch_id><![CDATA[10000100]]></sub_mch_id> <time_end><![CDATA[20140903131540]]></time_end><total_fee>1</total_fee><trade_type><![CDATA[JSAPI]]></trade_type><transaction_id><![CDATA[1004400740201409030005092168]]></transaction_id></xml>";
|
||||
}
|
||||
|
||||
/**
|
||||
* 余额支付
|
||||
*/
|
||||
@SysLog(MODULE = "pay", REMARK = "余额支付")
|
||||
@ApiOperation(value = "余额支付")
|
||||
@PostMapping("balancePay")
|
||||
public Object balancePay(BalancePayParam payParam) {
|
||||
Object order = orderService.blancePay(orderService.getById(payParam.getOrderId()));
|
||||
return new CommonResult().success(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 积分兑换
|
||||
*/
|
||||
@SysLog(MODULE = "pay", REMARK = "积分兑换")
|
||||
@ApiOperation(value = "积分兑换")
|
||||
@PostMapping("jifenPay")
|
||||
public Object jifenPay(OrderParam payParam) {
|
||||
return orderService.jifenPay(payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付的请求参数
|
||||
*/
|
||||
@SysLog(MODULE = "pay", REMARK = "获取支付的请求参数")
|
||||
@ApiOperation(value = "获取支付的请求参数")
|
||||
@PostMapping("weixinAppletPay")
|
||||
public Object payPrepay(@RequestParam(value = "orderId", required = true) Long orderId,
|
||||
@RequestParam(value = "appIdsource", required = false) Integer appIdsource) {
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member == null || member.getId() == null) {
|
||||
return new CommonResult().fail(100);
|
||||
}
|
||||
OmsOrder orderInfo = orderService.getById(orderId);
|
||||
SysAppletSet appletSet = memberService.getSysAppletSet(appIdsource);
|
||||
if (null == appletSet) {
|
||||
throw new ApiMallPlusException("没有设置支付配置");
|
||||
}
|
||||
|
||||
if (null == orderInfo) {
|
||||
return toResponsObject(400, "订单已取消", "");
|
||||
}
|
||||
|
||||
if (orderInfo.getStatus() == OrderStatus.CLOSED.getValue()) {
|
||||
return toResponsObject(400, "订单已已关闭,请不要重复操作", "");
|
||||
}
|
||||
if (orderInfo.getStatus() != OrderStatus.INIT.getValue()) {
|
||||
return toResponsObject(400, "订单不是未支付,不能重新支付", "");
|
||||
}
|
||||
|
||||
String nonceStr = CharUtil.getRandomString(32);
|
||||
|
||||
//https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3
|
||||
Map<Object, Object> resultObj = new TreeMap();
|
||||
|
||||
try {
|
||||
Map<Object, Object> parame = new TreeMap<Object, Object>();
|
||||
parame.put("appid", appletSet.getAppid());
|
||||
// 商家账号。
|
||||
parame.put("mch_id", appletSet.getMchid());
|
||||
String randomStr = CharUtil.getRandomNum(18).toUpperCase();
|
||||
// 随机字符串
|
||||
parame.put("nonce_str", randomStr);
|
||||
// 商户订单编号
|
||||
parame.put("out_trade_no", orderInfo.getOrderSn());
|
||||
|
||||
// 商品描述
|
||||
parame.put("body", "超市-支付");
|
||||
|
||||
//支付金额
|
||||
parame.put("total_fee", orderInfo.getPayAmount().multiply(new BigDecimal(100)).intValue());
|
||||
// 回调地址
|
||||
parame.put("notify_url", appletSet.getNotifyurl());
|
||||
// 交易类型APP
|
||||
parame.put("trade_type", tradeType);
|
||||
parame.put("spbill_create_ip", getClientIp());
|
||||
parame.put("openid", member.getWeixinOpenid());
|
||||
String sign = WechatUtil.arraySign(parame, appletSet.getPaySignKey());
|
||||
// 数字签证
|
||||
parame.put("sign", sign);
|
||||
|
||||
String xml = MapUtils.convertMap2Xml(parame);
|
||||
log.info("xml:" + xml);
|
||||
Map<String, Object> resultUn = XmlUtil.xmlStrToMap(WechatUtil.requestOnce(uniformorder, xml));
|
||||
// 响应报文
|
||||
String return_code = MapUtils.getString("return_code", resultUn);
|
||||
String return_msg = MapUtils.getString("return_msg", resultUn);
|
||||
//
|
||||
if (return_code.equalsIgnoreCase("FAIL")) {
|
||||
return new CommonResult().failed("支付失败," + return_msg);
|
||||
} else if (return_code.equalsIgnoreCase("SUCCESS")) {
|
||||
// 返回数据
|
||||
String result_code = MapUtils.getString("result_code", resultUn);
|
||||
String err_code_des = MapUtils.getString("err_code_des", resultUn);
|
||||
if (result_code.equalsIgnoreCase("FAIL")) {
|
||||
return new CommonResult().failed("支付失败," + err_code_des);
|
||||
} else if (result_code.equalsIgnoreCase("SUCCESS")) {
|
||||
String prepay_id = MapUtils.getString("prepay_id", resultUn);
|
||||
// 先生成paySign 参考https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=5
|
||||
resultObj.put("appId", appletSet.getAppid());
|
||||
resultObj.put("timeStamp", DateUtils.timeToStr(System.currentTimeMillis() / 1000, DateUtils.DATE_TIME_PATTERN));
|
||||
resultObj.put("nonceStr", nonceStr);
|
||||
resultObj.put("package", "prepay_id=" + prepay_id);
|
||||
resultObj.put("signType", "MD5");
|
||||
String paySign = WechatUtil.arraySign(resultObj, appletSet.getPaySignKey());
|
||||
resultObj.put("paySign", paySign);
|
||||
// 业务处理
|
||||
orderInfo.setPrepayId(prepay_id);
|
||||
// 付款中
|
||||
orderInfo.setStatus(OrderStatus.PayNotNotice.getValue());
|
||||
orderService.updateById(orderInfo);
|
||||
if (orderInfo.getPid() == null) {
|
||||
OmsOrder neworder = new OmsOrder();
|
||||
neworder.setStatus(OrderStatus.TO_DELIVER.getValue());
|
||||
neworder.setPayType(AllEnum.OrderPayType.weixinAppletPay.code());
|
||||
neworder.setPaymentTime(new Date());
|
||||
orderService.update(neworder, new QueryWrapper<OmsOrder>().eq("pid", orderInfo.getId()));
|
||||
}
|
||||
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
|
||||
history.setOrderId(orderInfo.getId());
|
||||
history.setCreateTime(new Date());
|
||||
history.setOperateMan("shop");
|
||||
history.setPreStatus(OrderStatus.INIT.getValue());
|
||||
history.setOrderStatus(OrderStatus.TO_DELIVER.getValue());
|
||||
history.setNote("小程序支付");
|
||||
orderOperateHistoryService.save(history);
|
||||
return toResponsObject(200, "微信统一订单下单成功", resultObj);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new CommonResult().failed("下单失败,error=" + e.getMessage());
|
||||
}
|
||||
return new CommonResult().failed("下单失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信查询订单状态
|
||||
*/
|
||||
@SysLog(MODULE = "pay", REMARK = "查询订单状态")
|
||||
@ApiOperation(value = "查询订单状态")
|
||||
@PostMapping("query")
|
||||
public Object orderQuery(@RequestParam(value = "id", required = false, defaultValue = "0") Long id,
|
||||
@RequestParam(value = "appIdsource", required = false) Integer appIdsource) {
|
||||
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member == null || member.getId() == null) {
|
||||
return new CommonResult().fail(100);
|
||||
}
|
||||
SysAppletSet appletSet = memberService.getSysAppletSet(appIdsource);
|
||||
if (null == appletSet) {
|
||||
throw new ApiMallPlusException("没有设置支付配置");
|
||||
}
|
||||
OmsOrder orderDetail = orderService.getById(id);
|
||||
if (id == null) {
|
||||
throw new ApiMallPlusException("订单不存在");
|
||||
}
|
||||
Map<Object, Object> parame = new TreeMap<Object, Object>();
|
||||
parame.put("appid", appletSet.getAppid());
|
||||
// 商家账号。
|
||||
parame.put("mch_id", appletSet.getMchid());
|
||||
String randomStr = CharUtil.getRandomNum(18).toUpperCase();
|
||||
// 随机字符串
|
||||
parame.put("nonce_str", randomStr);
|
||||
// 商户订单编号
|
||||
parame.put("out_trade_no", orderDetail.getOrderSn());
|
||||
|
||||
String sign = WechatUtil.arraySign(parame, appletSet.getPaySignKey());
|
||||
// 数字签证
|
||||
parame.put("sign", sign);
|
||||
|
||||
String xml = MapUtils.convertMap2Xml(parame);
|
||||
log.info("xml:" + xml);
|
||||
Map<String, Object> resultUn = null;
|
||||
try {
|
||||
resultUn = XmlUtil.xmlStrToMap(WechatUtil.requestOnce(orderquery, xml));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ApiMallPlusException("查询失败,error=" + e.getMessage());
|
||||
}
|
||||
// 响应报文
|
||||
String return_code = MapUtils.getString("return_code", resultUn);
|
||||
String return_msg = MapUtils.getString("return_msg", resultUn);
|
||||
|
||||
if (!"SUCCESS".equals(return_code)) {
|
||||
throw new ApiMallPlusException("查询失败,error=" + return_msg);
|
||||
}
|
||||
|
||||
String trade_state = MapUtils.getString("trade_state", resultUn);
|
||||
if ("SUCCESS".equals(trade_state)) {
|
||||
// 更改订单状态
|
||||
// 业务处理
|
||||
OmsOrder orderInfo = new OmsOrder();
|
||||
orderInfo.setId(id);
|
||||
orderInfo.setStatus(2);
|
||||
orderInfo.setConfirmStatus(1);
|
||||
orderInfo.setPaymentTime(new Date());
|
||||
orderService.updateById(orderInfo);
|
||||
return new CommonResult().success("支付成功");
|
||||
} else if ("USERPAYING".equals(trade_state)) {
|
||||
// 重新查询 正在支付中
|
||||
/* Integer num = (Integer) J2CacheUtils.get(J2CacheUtils.SHOP_CACHE_NAME, "queryRepeatNum" + id + "");
|
||||
if (num == null) {
|
||||
J2CacheUtils.put(J2CacheUtils.SHOP_CACHE_NAME, "queryRepeatNum" + id + "", 1);
|
||||
this.orderQuery(id);
|
||||
} else if (num <= 3) {
|
||||
J2CacheUtils.remove(J2CacheUtils.SHOP_CACHE_NAME, "queryRepeatNum" + id);
|
||||
this.orderQuery(id);
|
||||
} else {
|
||||
throw new ApiMallPlusException("查询失败,error=" + trade_state);
|
||||
}*/
|
||||
|
||||
} else {
|
||||
// 失败
|
||||
throw new ApiMallPlusException("查询失败,error=" + trade_state);
|
||||
}
|
||||
|
||||
throw new ApiMallPlusException("查询失败,未知错误");
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信订单回调接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SysLog(MODULE = "pay", REMARK = "微信订单回调接口")
|
||||
@ApiOperation(value = "微信订单回调接口")
|
||||
@RequestMapping(value = "/notify", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
|
||||
@ResponseBody
|
||||
public void notify(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html;charset=UTF-8");
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
InputStream in = request.getInputStream();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int len = 0;
|
||||
while ((len = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, len);
|
||||
}
|
||||
out.close();
|
||||
in.close();
|
||||
//xml数据
|
||||
String reponseXml = new String(out.toByteArray(), "utf-8");
|
||||
|
||||
WechatRefundApiResult result = (WechatRefundApiResult) XmlUtil.xmlStrToBean(reponseXml, WechatRefundApiResult.class);
|
||||
String result_code = result.getResult_code();
|
||||
if (result_code.equalsIgnoreCase("FAIL")) {
|
||||
//订单编号
|
||||
String out_trade_no = result.getOut_trade_no();
|
||||
log.error("订单" + out_trade_no + "支付失败");
|
||||
response.getWriter().write(setXml("SUCCESS", "OK"));
|
||||
} else if (result_code.equalsIgnoreCase("SUCCESS")) {
|
||||
//订单编号
|
||||
String out_trade_no = result.getOut_trade_no();
|
||||
log.error("订单" + out_trade_no + "支付成功");
|
||||
// 业务处理
|
||||
OmsOrder param = new OmsOrder();
|
||||
param.setOrderSn(out_trade_no);
|
||||
List<OmsOrder> list = orderService.list(new QueryWrapper<>(param));
|
||||
OmsOrder orderInfo = list.get(0);
|
||||
orderInfo.setStatus(2);
|
||||
orderInfo.setPaymentTime(new Date());
|
||||
orderService.updateById(orderInfo);
|
||||
|
||||
response.getWriter().write(setXml("SUCCESS", "OK"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,683 @@
|
||||
package com.zscat.mallplus.b2c;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zscat.mallplus.annotation.IgnoreAuth;
|
||||
import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.zscat.mallplus.enums.BargainEnum;
|
||||
import com.zscat.mallplus.enums.ConstansValue;
|
||||
import com.zscat.mallplus.pms.entity.PmsFavorite;
|
||||
import com.zscat.mallplus.pms.entity.PmsProduct;
|
||||
import com.zscat.mallplus.pms.service.IPmsFavoriteService;
|
||||
import com.zscat.mallplus.pms.service.IPmsProductService;
|
||||
import com.zscat.mallplus.pms.vo.GoodsDetailResult;
|
||||
import com.zscat.mallplus.single.ApiBaseAction;
|
||||
import com.zscat.mallplus.sms.entity.*;
|
||||
import com.zscat.mallplus.sms.mapper.SmsBargainConfigMapper;
|
||||
import com.zscat.mallplus.sms.mapper.SmsBargainMemberMapper;
|
||||
import com.zscat.mallplus.sms.mapper.SmsBargainRecordMapper;
|
||||
import com.zscat.mallplus.sms.mapper.SmsFlashPromotionSessionMapper;
|
||||
import com.zscat.mallplus.sms.service.*;
|
||||
import com.zscat.mallplus.sms.vo.SmsFlashPromotionSessionVo;
|
||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
||||
import com.zscat.mallplus.ums.service.RedisService;
|
||||
import com.zscat.mallplus.ums.service.impl.RedisUtil;
|
||||
import com.zscat.mallplus.util.DateUtil;
|
||||
import com.zscat.mallplus.util.JsonUtils;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||
import com.zscat.mallplus.vo.Rediskey;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Auther: shenzhuan
|
||||
* @Date: 2019/4/2 15:02
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "SingeMarkingController", description = "营销管理")
|
||||
public class BSmsController extends ApiBaseAction {
|
||||
|
||||
|
||||
private static Lock lock = new ReentrantLock(false);
|
||||
@Resource
|
||||
private ISmsBasicGiftsService basicGiftsService;
|
||||
@Resource
|
||||
private ISmsBasicMarkingService basicMarkingService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private ISmsGroupActivityService smsGroupActivityService;
|
||||
@Autowired
|
||||
private ISmsCouponService couponService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private IPmsFavoriteService favoriteService;
|
||||
@Resource
|
||||
private SmsFlashPromotionSessionMapper smsFlashPromotionSessionMapper;
|
||||
@Autowired
|
||||
private ISmsFlashPromotionProductRelationService smsFlashPromotionProductRelationService;
|
||||
@Resource
|
||||
private IPmsProductService pmsProductService;
|
||||
@Autowired
|
||||
private IUmsMemberService memberService;
|
||||
@Autowired
|
||||
private ISmsHomeAdvertiseService advertiseService;
|
||||
@Resource
|
||||
private SmsBargainConfigMapper bargainConfigMapper;
|
||||
@Resource
|
||||
private SmsBargainRecordMapper bargainRecordMapper;
|
||||
@Resource
|
||||
private SmsBargainMemberMapper bargainMemberMapper;
|
||||
|
||||
/**
|
||||
* 生成 [m,n] 的数字
|
||||
* int i1 = random.nextInt() * (n-m+1)+m;
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
int max = 5;
|
||||
int min = 1;
|
||||
int num = new Random().nextInt(max - min + 1) + min;
|
||||
System.out.println(num);
|
||||
Random random = new Random();
|
||||
int i1 = new Random().nextInt() * (5 - 1 + 1) + 1;
|
||||
System.out.println(i1);
|
||||
String group = "1,5";
|
||||
String[] rands = group.split(",");
|
||||
double dd = Double.valueOf(rands[1]) - Double.valueOf(rands[0]) + 1;
|
||||
System.out.println(Double.valueOf(rands[1]) - Double.valueOf(rands[0]) + 1);
|
||||
System.out.println(random.nextInt());
|
||||
System.out.println(random.nextInt() * (Double.valueOf(rands[1]) - Double.valueOf(rands[0]) + 1));
|
||||
System.out.println(Double.valueOf(rands[0]));
|
||||
double pp = random.nextInt() * dd + Double.valueOf(rands[0]);
|
||||
System.out.println(pp);
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "pms", REMARK = "查询砍价商品列表")
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询砍价商品列表")
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/bargain/list")
|
||||
public Object groupHotGoods(PmsProduct product,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
List<SmsBargainConfig> groupList = bargainConfigMapper.selectList(new QueryWrapper<>());
|
||||
List<SmsBargainConfig> result = new ArrayList<>();
|
||||
for (SmsBargainConfig group : groupList) {
|
||||
|
||||
Long nowT = System.currentTimeMillis();
|
||||
if (nowT < group.getInvalidTime().getTime()) {
|
||||
PmsProduct g = pmsProductService.getById(group.getGoodsId());
|
||||
if (g != null) {
|
||||
group.setGoods(g);
|
||||
result.add(group);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return new CommonResult().success(result);
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "pms", REMARK = "查询砍价商品列表")
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询砍价商品列表")
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/sample/bargain/list")
|
||||
public Object pintuanList(PmsProduct product,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
List<SmsBargainConfig> groupList = bargainConfigMapper.selectList(new QueryWrapper<>());
|
||||
if (groupList != null && groupList.size() > 0) {
|
||||
List<Long> ids = groupList.stream()
|
||||
.map(SmsBargainConfig::getGoodsId)
|
||||
.collect(Collectors.toList());
|
||||
product.setPublishStatus(1);
|
||||
product.setDeleteStatus(1);
|
||||
product.setVerifyStatus(1);
|
||||
product.setMemberId(null);
|
||||
IPage<PmsProduct> list = pmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<>(product).in("id", ids).select(ConstansValue.sampleGoodsList));
|
||||
return new CommonResult().success(list);
|
||||
}
|
||||
return new CommonResult().success(new ArrayList<>());
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "pms", REMARK = "砍价商品详情")
|
||||
@IgnoreAuth
|
||||
@PostMapping(value = "/bargain/detail")
|
||||
@ApiOperation(value = "砍价商品详情")
|
||||
public Object groupGoodsDetail(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
SmsBargainConfig group = bargainConfigMapper.selectById(id);
|
||||
Long goodsId = group.getGoodsId();
|
||||
|
||||
GoodsDetailResult goods = null;
|
||||
try {
|
||||
goods = JsonUtils.jsonToPojo(redisService.get(String.format(Rediskey.GOODSDETAIL, goodsId + "")), GoodsDetailResult.class);
|
||||
if (ValidatorUtils.empty(goods)) {
|
||||
log.info("redis缓存失效:" + goodsId);
|
||||
goods = pmsProductService.getGoodsRedisById(goodsId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("redis缓存失效:" + goodsId);
|
||||
goods = pmsProductService.getGoodsRedisById(goodsId);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||
|
||||
if (group != null && umsMember != null) {
|
||||
// group.setPintuan_start_status(1);
|
||||
// group.setTimeSecound(ValidatorUtils.getTimeSecound(group.getEndTime()));
|
||||
Long nowT = System.currentTimeMillis();
|
||||
|
||||
/*if (nowT > endTime.getTime()) {
|
||||
group.setPintuan_start_status(3);
|
||||
}*/
|
||||
SmsBargainRecord groupRecords = bargainRecordMapper.selectOne(new QueryWrapper<SmsBargainRecord>().eq("bargin_id", group.getId()).eq("member_id", umsMember.getId()));
|
||||
if (groupRecords != null) {
|
||||
List<SmsBargainMember> groupMembers = bargainMemberMapper.selectList(new QueryWrapper<SmsBargainMember>().eq("bargin_record_id", groupRecords.getId()));
|
||||
groupRecords.setList(groupMembers);
|
||||
} else {
|
||||
groupRecords = new SmsBargainRecord();
|
||||
groupRecords.setBarginId(group.getId());
|
||||
groupRecords.setCreateTime(new Date());
|
||||
groupRecords.setMemberId(umsMember.getId());
|
||||
groupRecords.setName(umsMember.getUsername());
|
||||
groupRecords.setStatus(BargainEnum.Status.INIT.code());
|
||||
|
||||
SmsBargainMember query = new SmsBargainMember();
|
||||
query.setMemberId(umsMember.getId());
|
||||
query.setBargainId(group.getId());
|
||||
query.setGoodsId(group.getGoodsId());
|
||||
query.setBarginRecordId(groupRecords.getId());
|
||||
query.setCreateTime(new Date());
|
||||
query.setMemberId(umsMember.getId());
|
||||
query.setName(umsMember.getUsername());
|
||||
/**
|
||||
* 生成 [m,n] 的数字
|
||||
* int i1 = random.nextInt() * (n-m+1)+m;
|
||||
* */
|
||||
String[] rands = group.getParameter().split(",");
|
||||
int max = Integer.parseInt(rands[1]);
|
||||
int min = Integer.parseInt(rands[0]);
|
||||
int pp = new Random().nextInt(max - min + 1) + min;
|
||||
query.setPrice(new BigDecimal(pp).setScale(2, RoundingMode.HALF_UP));
|
||||
|
||||
couponService.insertBarginRe(groupRecords, query);
|
||||
|
||||
}
|
||||
map.put("memberGroupList", groupRecords);
|
||||
map.put("group", group);
|
||||
}
|
||||
map.put("goods", goods);
|
||||
return new CommonResult().success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 帮助好友砍价
|
||||
*/
|
||||
@PostMapping("/bargain/help")
|
||||
@ApiOperation(value = "帮助好友砍价", notes = "帮助好友砍价")
|
||||
public Object help(@RequestParam(value = "bargainId", required = false, defaultValue = "0") Long bargainId,
|
||||
@RequestParam(value = "barginRecordId", required = false, defaultValue = "0") Long barginRecordId
|
||||
) {
|
||||
if (ObjectUtil.isNull(bargainId)) return new CommonResult().failed("参数错误");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member != null) {
|
||||
SmsBargainMember query = new SmsBargainMember();
|
||||
query.setMemberId(member.getId());
|
||||
query.setBargainId(bargainId);
|
||||
if (bargainMemberMapper.selectCount(new QueryWrapper<>(query)) > 0) {
|
||||
map.put("status", "SUCCESSFUL");
|
||||
return new CommonResult().success(map);
|
||||
}
|
||||
try {
|
||||
lock.lock();
|
||||
SmsBargainConfig group = bargainConfigMapper.selectById(bargainId);
|
||||
if (group == null) {
|
||||
return new CommonResult().failed("参数错误");
|
||||
}
|
||||
query.setCreateTime(new Date());
|
||||
query.setMemberId(member.getId());
|
||||
query.setName(member.getUsername());
|
||||
/**
|
||||
* 生成 [m,n] 的数字
|
||||
* int i1 = random.nextInt() * (n-m+1)+m;
|
||||
* */
|
||||
String[] rands = group.getParameter().split(",");
|
||||
int max = Integer.parseInt(rands[1]);
|
||||
int min = Integer.parseInt(rands[0]);
|
||||
int pp = new Random().nextInt(max - min + 1) + min;
|
||||
query.setPrice(new BigDecimal(pp).setScale(2, RoundingMode.HALF_UP));
|
||||
query.setGoodsId(group.getGoodsId());
|
||||
query.setBarginRecordId(barginRecordId);
|
||||
bargainMemberMapper.insert(query);
|
||||
|
||||
BigDecimal alreadPrice = BigDecimal.ZERO; //已经砍了的价格
|
||||
List<SmsBargainMember> groupMembers = bargainMemberMapper.selectList(new QueryWrapper<SmsBargainMember>().eq("bargin_record_id", barginRecordId));
|
||||
for (SmsBargainMember bargainMember : groupMembers) {
|
||||
alreadPrice = alreadPrice.add(bargainMember.getPrice());
|
||||
}
|
||||
if (alreadPrice.compareTo(group.getPrice()) > 0) {
|
||||
group.setPepoles(group.getPepoles() + 1);
|
||||
bargainConfigMapper.updateById(group);
|
||||
|
||||
SmsBargainRecord record = new SmsBargainRecord();
|
||||
record.setId(barginRecordId);
|
||||
record.setStatus(BargainEnum.Status.SUCESS.code());
|
||||
bargainRecordMapper.updateById(record);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
map.put("status", "SUCCESS");
|
||||
return new CommonResult().success(map);
|
||||
}
|
||||
|
||||
|
||||
return new CommonResult().fail(100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团海报
|
||||
*/
|
||||
@PostMapping("/bargain/poster")
|
||||
@ApiOperation(value = "拼团海报", notes = "拼团海报")
|
||||
public Object poster(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
|
||||
if (ObjectUtil.isNull(id)) return new CommonResult().failed("参数有误");
|
||||
|
||||
SmsBargainRecord group = bargainRecordMapper.selectById(id);
|
||||
return new CommonResult().success(group);
|
||||
/*String siteUrl = "siteUrl";
|
||||
if(StrUtil.isEmpty(siteUrl)){
|
||||
return new CommonResult().failed("未配置h5地址");
|
||||
}
|
||||
String apiUrl = "apiUrl";
|
||||
if(StrUtil.isEmpty(siteUrl)){
|
||||
return new CommonResult().failed("未配置api地址");
|
||||
}
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member!=null){
|
||||
Long uid=member.getId();
|
||||
|
||||
BigDecimal alreadPrice=BigDecimal.ZERO; //已经砍了的价格
|
||||
SmsBargainRecord groupRecords = bargainRecordMapper.selectOne(new QueryWrapper<SmsBargainRecord>().eq("bargin_id", group.getId()).eq("member_id",member.getId()));
|
||||
if (groupRecords!=null){
|
||||
List<SmsBargainMember> groupMembers = bargainMemberMapper.selectList(new QueryWrapper<SmsBargainMember>().eq("bargin_record_id", groupRecords.getId()));
|
||||
groupRecords.setList(groupMembers);
|
||||
for (SmsBargainMember bargainMember: groupMembers){
|
||||
alreadPrice=alreadPrice.add(bargainMember.getPrice());
|
||||
}
|
||||
}else {
|
||||
return new CommonResult().success("没有参加");
|
||||
}
|
||||
|
||||
//用户可以砍掉的金额 好友砍价之前获取可以砍价金额
|
||||
double coverPrice = NumberUtil.sub(group.getOriginPrice()
|
||||
,group.getPrice()).doubleValue();
|
||||
//用户剩余要砍掉的价格
|
||||
double surplusPrice = NumberUtil.sub(group.getOriginPrice(),
|
||||
alreadPrice).doubleValue();
|
||||
|
||||
|
||||
String name = id+"_"+uid + "_"+"_bargain_share_wap.jpg";
|
||||
|
||||
String fileDir = path+"qrcode"+ File.separator;
|
||||
String qrcodeUrl = "";
|
||||
if(ObjectUtil.isNull(groupRecords.getShareimg())){
|
||||
//生成二维码
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
QrCodeUtil.generate(siteUrl+"/activity/dargain_detail/"+id+"/"+uid+"?spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
|
||||
|
||||
qrcodeUrl = fileDir+name;
|
||||
}else{
|
||||
qrcodeUrl = groupRecords.getShareimg();
|
||||
}
|
||||
|
||||
String spreadPicName = id+"_"+uid + "_"+"_bargain_user_spread.jpg";
|
||||
String spreadPicPath = fileDir+spreadPicName;
|
||||
|
||||
|
||||
String spreadUrl = "";
|
||||
InputStream stream = getClass().getClassLoader().getResourceAsStream("poster.jpg");
|
||||
InputStream streamT = getClass().getClassLoader()
|
||||
.getResourceAsStream("simsunb.ttf");
|
||||
File newFile = new File("poster.jpg");
|
||||
File newFileT = new File("simsunb.ttf");
|
||||
try {
|
||||
FileUtils.copyInputStreamToFile(stream, newFile);
|
||||
FileUtils.copyInputStreamToFile(streamT, newFileT);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(ObjectUtil.isNull(groupRecords.getSpreadpic())){
|
||||
try {
|
||||
|
||||
//第一步标题
|
||||
Font font = Font.createFont(Font.TRUETYPE_FONT, newFileT);
|
||||
Font f= font.deriveFont(Font.PLAIN,40);
|
||||
//font.
|
||||
ImgUtil.pressText(//
|
||||
newFile,
|
||||
FileUtil.file(spreadPicPath),
|
||||
group.getGoodsName(),
|
||||
Color.BLACK,
|
||||
f, //字体
|
||||
0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
-480, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
||||
);
|
||||
|
||||
Font f2= font.deriveFont(Font.PLAIN,45);
|
||||
//第2步价格
|
||||
ImgUtil.pressText(//
|
||||
FileUtil.file(spreadPicPath),
|
||||
FileUtil.file(spreadPicPath),
|
||||
NumberUtil.sub(group.getPrice(),
|
||||
group.getPrice()).toString(),
|
||||
Color.RED,
|
||||
f2, //字体
|
||||
-160, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
-380, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
||||
);
|
||||
|
||||
Font f3= font.deriveFont(Font.PLAIN,30);
|
||||
//第3步几人团
|
||||
ImgUtil.pressText(//
|
||||
FileUtil.file(spreadPicPath),
|
||||
FileUtil.file(spreadPicPath),
|
||||
"已砍至",
|
||||
Color.WHITE,
|
||||
f3, //字体
|
||||
90, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
-385, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
||||
);
|
||||
|
||||
//第4步介绍
|
||||
String pro = "还差还差" + surplusPrice + "即可砍价成功";
|
||||
ImgUtil.pressText(//
|
||||
FileUtil.file(spreadPicPath),
|
||||
FileUtil.file(spreadPicPath),
|
||||
pro,
|
||||
Color.BLACK,
|
||||
f3, //字体
|
||||
-50, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
-300, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
||||
);
|
||||
|
||||
//第5步商品图片
|
||||
//下载图片
|
||||
String picImage = fileDir+id+"_bargain_image.jpg";
|
||||
HttpUtil.downloadFile(groupRecords.getSpreadpic(),
|
||||
FileUtil.file(picImage));
|
||||
|
||||
ImgUtil.scale(
|
||||
FileUtil.file(picImage),
|
||||
FileUtil.file(picImage),
|
||||
0.5f//缩放比例
|
||||
);
|
||||
|
||||
ImgUtil.pressImage(
|
||||
FileUtil.file(spreadPicPath),
|
||||
FileUtil.file(spreadPicPath),
|
||||
ImgUtil.read(FileUtil.file(picImage)), //水印图片
|
||||
0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
-80, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
0.8f
|
||||
);
|
||||
|
||||
ImgUtil.pressImage(
|
||||
FileUtil.file(spreadPicPath),
|
||||
FileUtil.file(spreadPicPath),
|
||||
ImgUtil.read(FileUtil.file(qrcodeUrl)), //水印图片
|
||||
0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
390, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
||||
0.8f
|
||||
);
|
||||
|
||||
|
||||
spreadUrl = apiUrl + "/api/file/qrcode/"+spreadPicName;
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else{
|
||||
spreadUrl = apiUrl + "/api/file/" ;
|
||||
}
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("url",spreadUrl);
|
||||
return new CommonResult().success(map);
|
||||
}
|
||||
|
||||
return new CommonResult().success();*/
|
||||
}
|
||||
|
||||
@ApiOperation("领取指定优惠券")
|
||||
@PostMapping(value = "/coupon.getcoupon")
|
||||
public Object add(@RequestParam(value = "couponId", required = true) Long couponId) {
|
||||
return couponService.add(couponId);
|
||||
}
|
||||
|
||||
@ApiOperation("批量领取指定优惠券")
|
||||
@PostMapping(value = "/batch.getcoupon")
|
||||
public Object addbatch(@RequestParam(value = "couponIds", required = true) String couponIds) {
|
||||
return couponService.addbatch(couponIds);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户优惠券列表")
|
||||
@ApiImplicitParam(name = "useStatus", value = "优惠券筛选类型:0->未使用;1->已使用;2->已过期",
|
||||
allowableValues = "0,1,2", paramType = "query", dataType = "integer")
|
||||
@RequestMapping(value = "/coupon.usercoupon", method = RequestMethod.POST)
|
||||
public Object list(@RequestParam(value = "useStatus", required = false) Integer useStatus) {
|
||||
List<SmsCouponHistory> couponHistoryList = couponService.listMemberCoupon(useStatus);
|
||||
return new CommonResult().success(couponHistoryList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取没有领取的优惠券列表")
|
||||
@RequestMapping(value = "/coupon.couponlist", method = RequestMethod.POST)
|
||||
public Object couponlist() {
|
||||
List<SmsCoupon> couponHistoryList = couponService.selectNotRecive();
|
||||
return new CommonResult().success(couponHistoryList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取单个商品得优惠详情")
|
||||
@RequestMapping(value = "/detail", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object detail(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
List<SmsBasicMarking> basicMarkingList = basicMarkingService.matchGoodsBasicMarking(id);
|
||||
List<SmsBasicGifts> basicGiftsList = basicGiftsService.matchGoodsBasicGifts(id);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("basicMarkingList", basicMarkingList);
|
||||
map.put("basicGiftsList", basicGiftsList);
|
||||
return new CommonResult().success(map);
|
||||
}
|
||||
|
||||
@ApiOperation("秒杀活动时间段")
|
||||
@RequestMapping(value = "/seckillTime", method = RequestMethod.POST)
|
||||
public Object seckillTime() {
|
||||
SmsFlashPromotionSessionVo vo = new SmsFlashPromotionSessionVo();
|
||||
int count = 0;
|
||||
int count1 = 0;
|
||||
int count2 = 0;
|
||||
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm:ss");
|
||||
Date da = new Date();
|
||||
String format = sdf2.format(da);
|
||||
boolean falg = true;
|
||||
boolean falg1 = true;
|
||||
long nowT1 = DateUtil.strToDate(sdf1.format(da), "yyyy-MM-dd").getTime();
|
||||
long nowT = DateUtil.strToDate(format, "HH:mm:ss").getTime();
|
||||
List<SmsFlashPromotionSession> smsFlashSessionInfos = smsFlashPromotionSessionMapper.selectList(new QueryWrapper<SmsFlashPromotionSession>().eq("status", 1).orderByAsc("start_time"));
|
||||
for (SmsFlashPromotionSession session : smsFlashSessionInfos) {
|
||||
|
||||
Date endtime = session.getEndTime();
|
||||
|
||||
Date starttime = session.getStartTime();
|
||||
session.setStop(endtime.getTime() + nowT1 + 8 * 3600);
|
||||
|
||||
if (nowT > endtime.getTime()) {
|
||||
session.setState("已结束");
|
||||
session.setStatus(0);
|
||||
}
|
||||
if (nowT < starttime.getTime()) {
|
||||
session.setState("即将开始");
|
||||
session.setStatus(2);
|
||||
if (falg1) {
|
||||
falg1 = false;
|
||||
count2 = count;
|
||||
|
||||
}
|
||||
}
|
||||
if (nowT < endtime.getTime() && nowT > starttime.getTime()) {
|
||||
session.setState("抢购中");
|
||||
session.setStatus(1);
|
||||
if (falg) {
|
||||
falg = false;
|
||||
count1 = count;
|
||||
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
vo.setLovely("http://kaifa.crmeb.net/uploads/wechat/image/20190905/d07218c34eda83d9a19f2d30b86a7521.jpg");
|
||||
if (count1 == 0) {
|
||||
vo.setSeckillTimeIndex(count2);
|
||||
} else {
|
||||
vo.setSeckillTimeIndex(count1);
|
||||
}
|
||||
|
||||
vo.setSeckillTime(smsFlashSessionInfos);
|
||||
return new CommonResult().success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation("秒杀活动时间段商品")
|
||||
@RequestMapping(value = "/seckillGoods", method = RequestMethod.POST)
|
||||
public Object seckillGoods(@RequestParam(value = "smsFlashSessionId", required = true) Long smsFlashSessionId,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
|
||||
|
||||
SmsFlashPromotionProductRelation querySMP = new SmsFlashPromotionProductRelation();
|
||||
|
||||
querySMP.setFlashPromotionSessionId(smsFlashSessionId);
|
||||
IPage<SmsFlashPromotionProductRelation> page = smsFlashPromotionProductRelationService.page(new Page<SmsFlashPromotionProductRelation>(pageNum, pageSize), new QueryWrapper<>(querySMP));
|
||||
|
||||
|
||||
List<SmsFlashPromotionProductRelation> productAttrs = new ArrayList<>();
|
||||
for (SmsFlashPromotionProductRelation item : page.getRecords()) {
|
||||
PmsProduct tempproduct = pmsProductService.getById(item.getProductId());
|
||||
if (tempproduct != null) {
|
||||
SmsFlashPromotionProductRelation product = new SmsFlashPromotionProductRelation();
|
||||
BeanUtils.copyProperties(item, product);
|
||||
product.setProductId(tempproduct.getId());
|
||||
product.setProductImg(tempproduct.getPic());
|
||||
product.setProductName(tempproduct.getName());
|
||||
product.setProductPrice(tempproduct.getPrice() != null ? tempproduct.getPrice() : BigDecimal.ZERO);
|
||||
product.setFlashPromotionPrice(item.getFlashPromotionPrice());
|
||||
product.setFlashPromotionCount(item.getFlashPromotionCount());
|
||||
product.setPercent((double) (item.getFlashPromotionCount() * 100 / tempproduct.getStock()));
|
||||
if (item.getFlashPromotionLimit() < 1) {
|
||||
product.setFlashPromotionLimit(1);
|
||||
} else {
|
||||
product.setFlashPromotionLimit(item.getFlashPromotionLimit());
|
||||
}
|
||||
if (product.getProductPrice().compareTo(BigDecimal.ZERO) > 0 && item.getFlashPromotionCount() > 0) {
|
||||
productAttrs.add(product);
|
||||
}
|
||||
} else {
|
||||
smsFlashPromotionProductRelationService.removeById(item.getId());
|
||||
}
|
||||
}
|
||||
return new CommonResult().success(productAttrs);
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "pms", REMARK = "查询商品详情信息")
|
||||
@IgnoreAuth
|
||||
@PostMapping(value = "/secskillDetail")
|
||||
@ApiOperation(value = "查询商品详情信息")
|
||||
public Object secskillDetail(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
//记录浏览量到redis,然后定时更新到数据库
|
||||
|
||||
SmsFlashPromotionProductRelation relation = smsFlashPromotionProductRelationService.getById(id);
|
||||
|
||||
GoodsDetailResult goods = null;
|
||||
try {
|
||||
goods = JsonUtils.jsonToPojo(redisService.get(String.format(Rediskey.GOODSDETAIL, relation.getProductId() + "")), GoodsDetailResult.class);
|
||||
if (ValidatorUtils.empty(goods)) {
|
||||
log.info("redis缓存失效:" + relation.getProductId());
|
||||
goods = pmsProductService.getGoodsRedisById(relation.getProductId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("redis缓存失效:" + relation.getProductId());
|
||||
goods = pmsProductService.getGoodsRedisById(relation.getProductId());
|
||||
e.printStackTrace();
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||
if (umsMember != null && umsMember.getId() != null) {
|
||||
PmsProduct p = goods.getGoods();
|
||||
p.setHit(recordGoodsFoot(id));
|
||||
PmsFavorite query = new PmsFavorite();
|
||||
query.setObjId(p.getId());
|
||||
query.setMemberId(umsMember.getId());
|
||||
query.setType(1);
|
||||
PmsFavorite findCollection = favoriteService.getOne(new QueryWrapper<>(query));
|
||||
if (findCollection != null) {
|
||||
map.put("favorite", true);
|
||||
} else {
|
||||
map.put("favorite", false);
|
||||
}
|
||||
}
|
||||
map.put("skillDetail", relation);
|
||||
map.put("goods", goods);
|
||||
return new CommonResult().success(map);
|
||||
}
|
||||
|
||||
private Integer recordGoodsFoot(Long id) {
|
||||
//记录浏览量到redis,然后定时更新到数据库
|
||||
String key = Rediskey.GOODS_VIEWCOUNT_CODE + id;
|
||||
//找到redis中该篇文章的点赞数,如果不存在则向redis中添加一条
|
||||
Map<Object, Object> viewCountItem = redisUtil.hGetAll(Rediskey.GOODS_VIEWCOUNT_KEY);
|
||||
Integer viewCount = 0;
|
||||
if (!viewCountItem.isEmpty()) {
|
||||
if (viewCountItem.containsKey(key)) {
|
||||
viewCount = Integer.parseInt(viewCountItem.get(key).toString()) + 1;
|
||||
redisUtil.hPut(Rediskey.GOODS_VIEWCOUNT_KEY, key, viewCount + "");
|
||||
} else {
|
||||
redisUtil.hPut(Rediskey.GOODS_VIEWCOUNT_KEY, key, 1 + "");
|
||||
}
|
||||
} else {
|
||||
viewCount = 1;
|
||||
redisUtil.hPut(Rediskey.GOODS_VIEWCOUNT_KEY, key, 1 + "");
|
||||
}
|
||||
return viewCount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
package com.zscat.mallplus.b2c;
|
||||
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zscat.mallplus.annotation.IgnoreAuth;
|
||||
import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.zscat.mallplus.cms.entity.CmsSubject;
|
||||
import com.zscat.mallplus.fenxiao.entity.FenxiaoRecords;
|
||||
import com.zscat.mallplus.fenxiao.mapper.FenxiaoRecordsMapper;
|
||||
import com.zscat.mallplus.oms.entity.OmsOrder;
|
||||
import com.zscat.mallplus.oms.service.IOmsOrderService;
|
||||
import com.zscat.mallplus.sys.entity.SysArea;
|
||||
import com.zscat.mallplus.sys.entity.SysShop;
|
||||
import com.zscat.mallplus.sys.mapper.SysAreaMapper;
|
||||
import com.zscat.mallplus.sys.mapper.SysShopMapper;
|
||||
import com.zscat.mallplus.sys.mapper.SysStoreMapper;
|
||||
import com.zscat.mallplus.ums.entity.*;
|
||||
import com.zscat.mallplus.ums.service.*;
|
||||
import com.zscat.mallplus.ums.vo.UserBankcardsVo;
|
||||
import com.zscat.mallplus.util.JsonUtils;
|
||||
import com.zscat.mallplus.utils.BankUtil;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 首页内容管理Controller
|
||||
* https://github.com/shenzhuan/mallplus on 2019/1/28.
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "HomeController", description = "首页内容管理")
|
||||
public class BUmsController {
|
||||
|
||||
@Resource
|
||||
FenxiaoRecordsMapper fenxiaoRecordsMapper;
|
||||
@Value("${jwt.tokenHeader}")
|
||||
private String tokenHeader;
|
||||
@Value("${jwt.tokenHead}")
|
||||
private String tokenHead;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Autowired
|
||||
private IUmsMemberService memberService;
|
||||
@Resource
|
||||
private IUmsMemberLevelService memberLevelService;
|
||||
@Resource
|
||||
private IUmsMemberBlanceLogService blanceLogService;
|
||||
@Resource
|
||||
private IUmsIntegrationChangeHistoryService integrationChangeHistoryService;
|
||||
@Resource
|
||||
private SysAreaMapper areaMapper;
|
||||
@Resource
|
||||
private SysStoreMapper storeMapper;
|
||||
@Resource
|
||||
private IUserBankcardsService bankcardsService;
|
||||
@Resource
|
||||
private SysShopMapper sysShopMapper;
|
||||
@Resource
|
||||
private IOmsOrderService orderService;
|
||||
|
||||
public static Object getObject(UmsMember member, IUmsMemberService memberService) {
|
||||
if (member == null) {
|
||||
return new CommonResult().paramFailed();
|
||||
}
|
||||
UmsMember member1 = memberService.getNewCurrentMember();
|
||||
if (member1 != null && member1.getId() != null) {
|
||||
member.setId(member1.getId());
|
||||
return new CommonResult().success(memberService.updateById(member));
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("更新会员信息")
|
||||
@SysLog(MODULE = "ums", REMARK = "更新会员信息")
|
||||
@PostMapping(value = "/userInfo")
|
||||
public Object userInfo() {
|
||||
return new CommonResult().success(memberService.getNewCurrentMember());
|
||||
}
|
||||
|
||||
@ApiOperation("更新会员信息")
|
||||
@SysLog(MODULE = "ums", REMARK = "更新会员信息")
|
||||
@PostMapping(value = "/user.editinfo")
|
||||
public Object updateMember(@RequestParam(value = "nickname", required = false) String nickname,
|
||||
@RequestParam(value = "icon", required = false) String icon,
|
||||
@RequestParam(value = "invitecode", required = false) String invitecode,
|
||||
@RequestParam(value = "gender", required = false) Integer gender
|
||||
) {
|
||||
UmsMember m = new UmsMember();
|
||||
m.setId(memberService.getNewCurrentMember().getId());
|
||||
if (ValidatorUtils.notEmpty(nickname)) {
|
||||
m.setNickname(nickname);
|
||||
}
|
||||
if (ValidatorUtils.notEmpty(icon)) {
|
||||
m.setIcon(icon);
|
||||
}
|
||||
if (ValidatorUtils.notEmpty(gender)) {
|
||||
m.setGender(gender);
|
||||
}
|
||||
if (ValidatorUtils.notEmpty(invitecode)) {
|
||||
if (memberService.getById(invitecode) != null) {
|
||||
m.setInvitecode(invitecode);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
return memberService.updateById(m);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询余额列表")
|
||||
@PostMapping(value = "/user.balancelist")
|
||||
@SysLog(MODULE = "ums", REMARK = "查询余额列表")
|
||||
public Object balancelist(UmsMemberBlanceLog entity,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
if (memberService.getNewCurrentMember() == null) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
entity.setMemberId(memberService.getNewCurrentMember().getId());
|
||||
if (entity == null || ValidatorUtils.empty(entity.getType())) {
|
||||
return new CommonResult().success(blanceLogService.page(new Page<UmsMemberBlanceLog>(pageNum, pageSize), new QueryWrapper<>()));
|
||||
}
|
||||
return new CommonResult().success(blanceLogService.page(new Page<UmsMemberBlanceLog>(pageNum, pageSize), new QueryWrapper<>(entity)));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询会员等级列表")
|
||||
@PostMapping(value = "/user.levellist")
|
||||
@SysLog(MODULE = "ums", REMARK = "查询会员等级列表")
|
||||
public Object levellist() {
|
||||
return new CommonResult().success(memberLevelService.list(new QueryWrapper<>()));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("获取会员等级详情信息")
|
||||
@RequestMapping(value = "/user.leveldetail", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object leveldetail(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
return new CommonResult().success(memberLevelService.getById(id));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询会员和积分消费记录列表")
|
||||
@PostMapping(value = "/user.userpointlog")
|
||||
@SysLog(MODULE = "ums", REMARK = "查询会员和积分消费记录")
|
||||
public Object userpointlog(UmsIntegrationChangeHistory entity,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
Map<String, Object> map = new HashedMap();
|
||||
map.put("member", memberService.getById(memberService.getNewCurrentMember().getId()));
|
||||
entity.setMemberId(memberService.getNewCurrentMember().getId());
|
||||
map.put("intList", integrationChangeHistoryService.page(new Page<UmsIntegrationChangeHistory>(pageNum, pageSize), new QueryWrapper<>(entity)));
|
||||
return new CommonResult().success(map);
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询区域列表")
|
||||
@PostMapping(value = "/user.getareaid")
|
||||
@SysLog(MODULE = "ums", REMARK = "查询学校列表")
|
||||
public Object getareaid(SysArea entity) {
|
||||
return new CommonResult().success(areaMapper.selectOne(new QueryWrapper<>(entity)));
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "判断是否签到")
|
||||
@ApiOperation(value = "判断是否签到")
|
||||
@PostMapping(value = "/user.issign")
|
||||
public Object issign(CmsSubject subject, BindingResult result) {
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
return new CommonResult().success();
|
||||
|
||||
}
|
||||
|
||||
@SysLog(MODULE = "cms", REMARK = "签到接口")
|
||||
@ApiOperation(value = "签到接口")
|
||||
@PostMapping(value = "/user.sign")
|
||||
public Object sign(CmsSubject subject, BindingResult result) {
|
||||
CommonResult commonResult;
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
|
||||
return new CommonResult().success();
|
||||
}
|
||||
|
||||
@ApiOperation("添加银行卡")
|
||||
@RequestMapping(value = "/user.addbankcard")
|
||||
@ResponseBody
|
||||
public Object saveusership(UserBankcards address) {
|
||||
boolean count = false;
|
||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||
if (ValidatorUtils.notEmpty(address.getIsDefault()) && address.getIsDefault() == 1) {
|
||||
UserBankcards query = new UserBankcards();
|
||||
query.setIsDefault(2);
|
||||
bankcardsService.update(query, new QueryWrapper<UserBankcards>().eq("user_id", umsMember.getId()));
|
||||
}
|
||||
address.setUserId(umsMember.getId());
|
||||
if (address.getId() != null && address.getId() > 0) {
|
||||
bankcardsService.updateById(address);
|
||||
} else {
|
||||
bankcardsService.save(address);
|
||||
}
|
||||
return new CommonResult().success();
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("获取我的银行卡列表")
|
||||
@RequestMapping(value = "/user.getbankcardlist", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getbankcardlist() {
|
||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||
if (umsMember != null && umsMember.getId() != null) {
|
||||
List<UserBankcards> addressList = bankcardsService.list(new QueryWrapper<UserBankcards>().eq("user_id", umsMember.getId()));
|
||||
return new CommonResult().success(addressList);
|
||||
}
|
||||
return new ArrayList<UmsMemberReceiveAddress>();
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("获取银行卡信息")
|
||||
@RequestMapping(value = "/user.getbankcardinfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getbankcardinfo(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
return new CommonResult().success(bankcardsService.getById(id));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("获取银行卡组织信息")
|
||||
@RequestMapping(value = "/user.getbankcardorganization", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getbankcardorganization(@RequestParam(value = "card_code", required = true) String card_code) {
|
||||
try {
|
||||
String json1 = HttpUtil.get("https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo=" + card_code + "&cardBinCheck=true");
|
||||
// 转为 Json 对象
|
||||
UserBankcardsVo vo = JsonUtils.fromJson(json1, UserBankcardsVo.class);
|
||||
// 北京农村商业银行·凤凰卡
|
||||
String cardName = BankUtil.getNameOfBank(card_code);
|
||||
vo.setName(cardName.split("·")[0]);
|
||||
vo.setTypeName(cardName.split("·")[1]);
|
||||
return new CommonResult().success(vo);
|
||||
} catch (Exception e) {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation("获取默认的银行卡")
|
||||
@RequestMapping(value = "/user.getdefaultbankcard", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getItemDefautl() {
|
||||
UserBankcards address = bankcardsService.getOne(new QueryWrapper<UserBankcards>().eq("user_id", memberService.getNewCurrentMember().getId()).eq("is_default", 1));
|
||||
if (address != null && address.getId() > 0) {
|
||||
return new CommonResult().success(address);
|
||||
}
|
||||
List<UserBankcards> addressList = bankcardsService.list(new QueryWrapper<UserBankcards>().eq("user_id", memberService.getNewCurrentMember().getId()));
|
||||
if (addressList != null && addressList.size() > 0) {
|
||||
return new CommonResult().success(addressList.get(0));
|
||||
}
|
||||
return new CommonResult().success();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("设置默认银行卡")
|
||||
@RequestMapping(value = "/user.setdefaultbankcard")
|
||||
@ResponseBody
|
||||
public Object setDefault(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
int count = bankcardsService.setDefault(id);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("申请用户提现")
|
||||
@PostMapping(value = "/user.cash")
|
||||
@ResponseBody
|
||||
public Object cash(UmsMemberBlanceLog blanceLog) {
|
||||
try {
|
||||
return new CommonResult().success(memberService.withDraw(blanceLog));
|
||||
} catch (Exception e) {
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("用户推荐列表")
|
||||
@PostMapping(value = "/user.recommend")
|
||||
@ResponseBody
|
||||
public Object inviteUser(UmsMember entity,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
return new CommonResult().success(memberService.page(new Page<UmsMember>(pageNum, pageSize), new QueryWrapper<UmsMember>().eq("invitecode", memberService.getNewCurrentMember().getId())));
|
||||
}
|
||||
|
||||
@ApiOperation("邀请码")
|
||||
@PostMapping(value = "/user.sharecode")
|
||||
@ResponseBody
|
||||
public Object shareCode(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
int count = bankcardsService.setDefault(id);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取分销商进度状态")
|
||||
@PostMapping(value = "/distribution_center-api-info")
|
||||
@ResponseBody
|
||||
public Object getDistributioninfo(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
UmsMember newMember = memberService.getById(member.getId());
|
||||
|
||||
List<FenxiaoRecords> recordss = fenxiaoRecordsMapper.selectList(new QueryWrapper<FenxiaoRecords>().eq("member_id", member.getId()));
|
||||
newMember.setBuyCount(recordss.size());
|
||||
BigDecimal totalMoney = BigDecimal.ZERO;
|
||||
BigDecimal sucessMoney = BigDecimal.ZERO; // 结算
|
||||
for (FenxiaoRecords fenxiaoRecords : recordss) {
|
||||
totalMoney = fenxiaoRecords.getMoney().add(totalMoney);
|
||||
if ("2".equals(fenxiaoRecords.getStatus())) {
|
||||
sucessMoney = fenxiaoRecords.getMoney().add(sucessMoney);
|
||||
}
|
||||
}
|
||||
newMember.setBlance(totalMoney);
|
||||
newMember.setBuyMoney(sucessMoney);
|
||||
return new CommonResult().success(newMember);
|
||||
}
|
||||
|
||||
@ApiOperation("申请分销商")
|
||||
@PostMapping(value = "/distribution_center-api-applydistribution")
|
||||
@ResponseBody
|
||||
public Object applyDistribution(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
int count = bankcardsService.setDefault(id);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("店铺设置")
|
||||
@PostMapping(value = "/distribution_center-api-setstore")
|
||||
@ResponseBody
|
||||
public Object setStore(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
int count = bankcardsService.setDefault(id);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("我的分销订单")
|
||||
@PostMapping(value = "/distribution_center-api-getstoreinfo")
|
||||
@ResponseBody
|
||||
public Object distribution_centerApiGetstoreinfo(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
int count = bankcardsService.setDefault(id);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("我的分销订单")
|
||||
@PostMapping(value = "/distribution_center-api-myorder")
|
||||
@ResponseBody
|
||||
public Object getDistributionOrder(@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
UmsMember newMember = memberService.getById(member.getId());
|
||||
Integer count = memberService.count(new QueryWrapper<UmsMember>().eq("invitecode", member.getId()));
|
||||
newMember.setBuyCount(count);
|
||||
List<FenxiaoRecords> recordss = fenxiaoRecordsMapper.selectList(new QueryWrapper<FenxiaoRecords>().eq("member_id", member.getId()));
|
||||
List<Integer> ids = recordss.stream()
|
||||
.map(FenxiaoRecords::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (ids != null && ids.size() > 0) {
|
||||
return new CommonResult().success(orderService.page(new Page<OmsOrder>(pageNum, pageSize), new QueryWrapper<>(new OmsOrder()).in("id", ids)));
|
||||
}
|
||||
return new CommonResult().success();
|
||||
}
|
||||
|
||||
@ApiOperation("判断是否是店员")
|
||||
@PostMapping(value = "/store.isclerk")
|
||||
@ResponseBody
|
||||
public Object ischeck(@RequestParam(value = "id", required = false, defaultValue = "0") Long id) {
|
||||
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("店铺详情")
|
||||
@PostMapping(value = "/storeDetail")
|
||||
@ResponseBody
|
||||
public Object storeDetail(@RequestParam(value = "id", required = false, defaultValue = "0") Integer id) {
|
||||
return new CommonResult().success(storeMapper.selectById(id));
|
||||
}
|
||||
|
||||
@IgnoreAuth
|
||||
@ApiOperation(value = "查询门店管理列表")
|
||||
@PostMapping(value = "/user.shoplist")
|
||||
@SysLog(MODULE = "ums", REMARK = "查询门店管理列表")
|
||||
public Object shoplist(@RequestParam(value = "storeId", required = true) Long storeId) {
|
||||
return new CommonResult().success(sysShopMapper.selectList(new QueryWrapper<SysShop>().eq("store_id", storeId)));
|
||||
}
|
||||
|
||||
@ApiOperation("门店详情")
|
||||
@PostMapping(value = "/shopDetail")
|
||||
@ResponseBody
|
||||
public Object shopDetail(@RequestParam(value = "storeId", required = true) Integer storeId) {
|
||||
List<SysShop> list = sysShopMapper.selectList(new QueryWrapper<SysShop>().eq("store_id", storeId));
|
||||
if (list != null && list.size() > 0) {
|
||||
return new CommonResult().success(list.get(0));
|
||||
}
|
||||
return new CommonResult().success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.bill.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.bill.entity.BillAftersalesItems;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 售后单明细表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
public interface IBillAftersalesItemsService extends IService<BillAftersalesItems> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.bill.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.bill.entity.BillAftersales;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退货单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
public interface IBillAftersalesService extends IService<BillAftersales> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.bill.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.bill.entity.BillDeliveryItems;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 发货单详情表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
public interface IBillDeliveryItemsService extends IService<BillDeliveryItems> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.bill.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.bill.entity.BillDelivery;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 发货单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
public interface IBillDeliveryService extends IService<BillDelivery> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.bill.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.bill.entity.BillLading;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 提货单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
public interface IBillLadingService extends IService<BillLading> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.bill.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.bill.entity.BillPaymentsRel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 支付单明细表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
public interface IBillPaymentsRelService extends IService<BillPaymentsRel> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.bill.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.bill.entity.BillPayments;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 支付单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
public interface IBillPaymentsService extends IService<BillPayments> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.bill.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.bill.entity.BillRefund;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退款单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
public interface IBillRefundService extends IService<BillRefund> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.bill.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.bill.entity.BillReshipItems;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退货单明细表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
public interface IBillReshipItemsService extends IService<BillReshipItems> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.bill.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.bill.entity.BillReship;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退货单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
public interface IBillReshipService extends IService<BillReship> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.bill.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.bill.entity.BillAftersalesItems;
|
||||
import com.zscat.mallplus.bill.mapper.BillAftersalesItemsMapper;
|
||||
import com.zscat.mallplus.bill.service.IBillAftersalesItemsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 售后单明细表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
@Service
|
||||
public class BillAftersalesItemsServiceImpl extends ServiceImpl<BillAftersalesItemsMapper, BillAftersalesItems> implements IBillAftersalesItemsService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.bill.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.bill.entity.BillAftersales;
|
||||
import com.zscat.mallplus.bill.mapper.BillAftersalesMapper;
|
||||
import com.zscat.mallplus.bill.service.IBillAftersalesService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退货单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
@Service
|
||||
public class BillAftersalesServiceImpl extends ServiceImpl<BillAftersalesMapper, BillAftersales> implements IBillAftersalesService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.bill.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.bill.entity.BillDeliveryItems;
|
||||
import com.zscat.mallplus.bill.mapper.BillDeliveryItemsMapper;
|
||||
import com.zscat.mallplus.bill.service.IBillDeliveryItemsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 发货单详情表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
@Service
|
||||
public class BillDeliveryItemsServiceImpl extends ServiceImpl<BillDeliveryItemsMapper, BillDeliveryItems> implements IBillDeliveryItemsService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.bill.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.bill.entity.BillDelivery;
|
||||
import com.zscat.mallplus.bill.mapper.BillDeliveryMapper;
|
||||
import com.zscat.mallplus.bill.service.IBillDeliveryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 发货单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
@Service
|
||||
public class BillDeliveryServiceImpl extends ServiceImpl<BillDeliveryMapper, BillDelivery> implements IBillDeliveryService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.bill.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.bill.entity.BillLading;
|
||||
import com.zscat.mallplus.bill.mapper.BillLadingMapper;
|
||||
import com.zscat.mallplus.bill.service.IBillLadingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 提货单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
@Service
|
||||
public class BillLadingServiceImpl extends ServiceImpl<BillLadingMapper, BillLading> implements IBillLadingService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.bill.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.bill.entity.BillPaymentsRel;
|
||||
import com.zscat.mallplus.bill.mapper.BillPaymentsRelMapper;
|
||||
import com.zscat.mallplus.bill.service.IBillPaymentsRelService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 支付单明细表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
@Service
|
||||
public class BillPaymentsRelServiceImpl extends ServiceImpl<BillPaymentsRelMapper, BillPaymentsRel> implements IBillPaymentsRelService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.bill.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.bill.entity.BillPayments;
|
||||
import com.zscat.mallplus.bill.mapper.BillPaymentsMapper;
|
||||
import com.zscat.mallplus.bill.service.IBillPaymentsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 支付单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
@Service
|
||||
public class BillPaymentsServiceImpl extends ServiceImpl<BillPaymentsMapper, BillPayments> implements IBillPaymentsService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.bill.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.bill.entity.BillRefund;
|
||||
import com.zscat.mallplus.bill.mapper.BillRefundMapper;
|
||||
import com.zscat.mallplus.bill.service.IBillRefundService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退款单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
@Service
|
||||
public class BillRefundServiceImpl extends ServiceImpl<BillRefundMapper, BillRefund> implements IBillRefundService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.bill.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.bill.entity.BillReshipItems;
|
||||
import com.zscat.mallplus.bill.mapper.BillReshipItemsMapper;
|
||||
import com.zscat.mallplus.bill.service.IBillReshipItemsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退货单明细表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
@Service
|
||||
public class BillReshipItemsServiceImpl extends ServiceImpl<BillReshipItemsMapper, BillReshipItems> implements IBillReshipItemsService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.bill.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.bill.entity.BillReship;
|
||||
import com.zscat.mallplus.bill.mapper.BillReshipMapper;
|
||||
import com.zscat.mallplus.bill.service.IBillReshipService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退货单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-09-16
|
||||
*/
|
||||
@Service
|
||||
public class BillReshipServiceImpl extends ServiceImpl<BillReshipMapper, BillReship> implements IBillReshipService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildAdv;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 首页轮播广告表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
public interface IBuildAdvService extends IService<BuildAdv> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildApplyRoom;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
public interface IBuildApplyRoomService extends IService<BuildApplyRoom> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildGroupMember;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
public interface IBuildGroupMemberService extends IService<BuildGroupMember> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildGroup;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
public interface IBuildGroupService extends IService<BuildGroup> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildNotice;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公告表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
public interface IBuildNoticeService extends IService<BuildNotice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildRepair;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
public interface IBuildRepairService extends IService<BuildRepair> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildTypePrice;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
public interface IBuildTypePriceService extends IService<BuildTypePrice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildWuyeCompany;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
public interface IBuildWuyeCompanyService extends IService<BuildWuyeCompany> {
|
||||
|
||||
boolean saveCompany(BuildWuyeCompany entity);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildWuyePrice;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
public interface IBuildWuyePriceService extends IService<BuildWuyePrice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.BuildHomeResult;
|
||||
import com.zscat.mallplus.build.entity.BuildingCommunity;
|
||||
import com.zscat.mallplus.sys.entity.SysShop;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 小区 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-11-27
|
||||
*/
|
||||
public interface IBuildingCommunityService extends IService<BuildingCommunity> {
|
||||
|
||||
/**
|
||||
* 添加社区
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
boolean saveCommunity(BuildingCommunity entity);
|
||||
|
||||
/**
|
||||
* 所有社区和房间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Object allCommunity();
|
||||
|
||||
/**
|
||||
* 绑定小区和房间
|
||||
*
|
||||
* @param selectedMore2
|
||||
* @return
|
||||
*/
|
||||
Object bindCommunity(String selectedMore2);
|
||||
|
||||
/**
|
||||
* 小区首页
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
BuildHomeResult singleContent(Long id);
|
||||
|
||||
List<BuildingCommunity> selectNearCommunity( Integer distance,
|
||||
double latitude,
|
||||
double longitude,
|
||||
Integer pageSize);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildingFloor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-11-27
|
||||
*/
|
||||
public interface IBuildingFloorService extends IService<BuildingFloor> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildingOwner;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 业主成员表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-11-27
|
||||
*/
|
||||
public interface IBuildingOwnerService extends IService<BuildingOwner> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildingRoom;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 小区 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-11-27
|
||||
*/
|
||||
public interface IBuildingRoomService extends IService<BuildingRoom> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.build.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.build.entity.BuildingUnit;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-11-27
|
||||
*/
|
||||
public interface IBuildingUnitService extends IService<BuildingUnit> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildAdv;
|
||||
import com.zscat.mallplus.build.mapper.BuildAdvMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildAdvService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 首页轮播广告表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
@Service
|
||||
public class BuildAdvServiceImpl extends ServiceImpl<BuildAdvMapper, BuildAdv> implements IBuildAdvService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildApplyRoom;
|
||||
import com.zscat.mallplus.build.mapper.BuildApplyRoomMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildApplyRoomService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
@Service
|
||||
public class BuildApplyRoomServiceImpl extends ServiceImpl<BuildApplyRoomMapper, BuildApplyRoom> implements IBuildApplyRoomService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildGroupMember;
|
||||
import com.zscat.mallplus.build.mapper.BuildGroupMemberMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildGroupMemberService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
@Service
|
||||
public class BuildGroupMemberServiceImpl extends ServiceImpl<BuildGroupMemberMapper, BuildGroupMember> implements IBuildGroupMemberService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildGroup;
|
||||
import com.zscat.mallplus.build.mapper.BuildGroupMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildGroupService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
@Service
|
||||
public class BuildGroupServiceImpl extends ServiceImpl<BuildGroupMapper, BuildGroup> implements IBuildGroupService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildNotice;
|
||||
import com.zscat.mallplus.build.mapper.BuildNoticeMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildNoticeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公告表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
@Service
|
||||
public class BuildNoticeServiceImpl extends ServiceImpl<BuildNoticeMapper, BuildNotice> implements IBuildNoticeService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildRepair;
|
||||
import com.zscat.mallplus.build.mapper.BuildRepairMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildRepairService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
@Service
|
||||
public class BuildRepairServiceImpl extends ServiceImpl<BuildRepairMapper, BuildRepair> implements IBuildRepairService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildTypePrice;
|
||||
import com.zscat.mallplus.build.mapper.BuildTypePriceMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildTypePriceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
@Service
|
||||
public class BuildTypePriceServiceImpl extends ServiceImpl<BuildTypePriceMapper, BuildTypePrice> implements IBuildTypePriceService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildWuyeCompany;
|
||||
import com.zscat.mallplus.build.mapper.BuildWuyeCompanyMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildWuyeCompanyService;
|
||||
import com.zscat.mallplus.exception.ApiMallPlusException;
|
||||
import com.zscat.mallplus.sys.entity.SysUser;
|
||||
import com.zscat.mallplus.sys.entity.SysUserRole;
|
||||
import com.zscat.mallplus.sys.mapper.SysUserMapper;
|
||||
import com.zscat.mallplus.sys.mapper.SysUserRoleMapper;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
@Service
|
||||
public class BuildWuyeCompanyServiceImpl extends ServiceImpl<BuildWuyeCompanyMapper, BuildWuyeCompany> implements IBuildWuyeCompanyService {
|
||||
|
||||
@Resource
|
||||
private BuildWuyeCompanyMapper wuyeCompanyMapper;
|
||||
@Resource
|
||||
private SysUserMapper userMapper;
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@Resource
|
||||
private SysUserRoleMapper userRoleMapper;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public boolean saveCompany(BuildWuyeCompany entity) {
|
||||
//1 创建物业公司
|
||||
entity.setCreateTime(new Date());
|
||||
wuyeCompanyMapper.insert(entity);
|
||||
// 2 创建物业公司账号
|
||||
SysUser user = new SysUser();
|
||||
user.setUsername(entity.getName());
|
||||
SysUser umsAdminList = userMapper.selectByUserName(entity.getName());
|
||||
if (umsAdminList != null) {
|
||||
throw new ApiMallPlusException("此物业公司已存在");
|
||||
}
|
||||
user.setStatus(1);
|
||||
// user.setStoreId(entity.getId());
|
||||
user.setSupplyId(0L);
|
||||
user.setPassword(passwordEncoder.encode("123456"));
|
||||
user.setCreateTime(new Date());
|
||||
user.setSupplyId(0L);
|
||||
user.setNote("物业公司账户:物业公司ID=" + entity.getName() + "," + entity.getId());
|
||||
user.setIcon(entity.getPic());
|
||||
user.setNickName(entity.getName());
|
||||
userMapper.insert(user);
|
||||
|
||||
// 3 分配物业公司角色
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setAdminId(user.getId());
|
||||
userRole.setRoleId(5L);
|
||||
userRoleMapper.insert(userRole);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildWuyePrice;
|
||||
import com.zscat.mallplus.build.mapper.BuildWuyePriceMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildWuyePriceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-12-02
|
||||
*/
|
||||
@Service
|
||||
public class BuildWuyePriceServiceImpl extends ServiceImpl<BuildWuyePriceMapper, BuildWuyePrice> implements IBuildWuyePriceService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.BuildHomeResult;
|
||||
import com.zscat.mallplus.build.CommunityTree;
|
||||
import com.zscat.mallplus.build.entity.*;
|
||||
import com.zscat.mallplus.build.mapper.*;
|
||||
import com.zscat.mallplus.build.service.IBuildingCommunityService;
|
||||
import com.zscat.mallplus.enums.ConstansValue;
|
||||
import com.zscat.mallplus.exception.ApiMallPlusException;
|
||||
import com.zscat.mallplus.oms.vo.ActivityVo;
|
||||
import com.zscat.mallplus.sys.entity.SysShop;
|
||||
import com.zscat.mallplus.sys.entity.SysUser;
|
||||
import com.zscat.mallplus.sys.entity.SysUserRole;
|
||||
import com.zscat.mallplus.sys.mapper.SysUserMapper;
|
||||
import com.zscat.mallplus.sys.mapper.SysUserRoleMapper;
|
||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 小区 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-11-27
|
||||
*/
|
||||
@Service
|
||||
public class BuildingCommunityServiceImpl extends ServiceImpl<BuildingCommunityMapper, BuildingCommunity> implements IBuildingCommunityService {
|
||||
|
||||
@Resource
|
||||
private BuildingCommunityMapper communityMapper;
|
||||
@Resource
|
||||
private BuildingFloorMapper buildingFloorMapper;
|
||||
@Resource
|
||||
private BuildingRoomMapper buildingRoomMapper;
|
||||
@Resource
|
||||
private SysUserMapper userMapper;
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@Resource
|
||||
private SysUserRoleMapper userRoleMapper;
|
||||
@Resource
|
||||
private IUmsMemberService memberService;
|
||||
@Resource
|
||||
private BuildNoticeMapper noticeMapper;
|
||||
@Resource
|
||||
private BuildAdvMapper advMapper;
|
||||
|
||||
@Override
|
||||
public boolean saveCommunity(BuildingCommunity entity) {
|
||||
//1 创建小区
|
||||
entity.setCreateTime(new Date());
|
||||
communityMapper.insert(entity);
|
||||
// 2 创建物业公司账号
|
||||
SysUser user = new SysUser();
|
||||
user.setUsername(entity.getName());
|
||||
SysUser umsAdminList = userMapper.selectByUserName(entity.getName());
|
||||
if (umsAdminList != null) {
|
||||
throw new ApiMallPlusException("此小区已存在");
|
||||
}
|
||||
user.setStatus(1);
|
||||
// user.setStoreId(entity.getId());
|
||||
user.setPassword(passwordEncoder.encode("123456"));
|
||||
user.setCreateTime(new Date());
|
||||
user.setSupplyId(0L);
|
||||
user.setNote("小区账户:小区ID=" + entity.getName() + "," + entity.getId());
|
||||
user.setNickName(entity.getName());
|
||||
userMapper.insert(user);
|
||||
|
||||
// 3 分配物业公司角色
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setAdminId(user.getId());
|
||||
userRole.setRoleId(5L);
|
||||
userRoleMapper.insert(userRole);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object allCommunity() {
|
||||
List<CommunityTree> resultList = new ArrayList<>();
|
||||
|
||||
List<BuildingCommunity> list = communityMapper.selectList(new QueryWrapper<BuildingCommunity>().select(ConstansValue.sampleCommunityList));
|
||||
for (BuildingCommunity community : list) {
|
||||
CommunityTree communityTree = new CommunityTree();
|
||||
communityTree.setCode("C" + community.getId());
|
||||
communityTree.setName(community.getName());
|
||||
communityTree.setParentCode("0");
|
||||
resultList.add(communityTree);
|
||||
}
|
||||
|
||||
List<BuildingFloor> floorList = buildingFloorMapper.selectList(new QueryWrapper<>());
|
||||
for (BuildingFloor community : floorList) {
|
||||
CommunityTree communityTree = new CommunityTree();
|
||||
communityTree.setCode("F" + community.getId());
|
||||
communityTree.setName(community.getName());
|
||||
communityTree.setParentCode("C" + community.getCommunityId());
|
||||
resultList.add(communityTree);
|
||||
}
|
||||
|
||||
List<BuildingRoom> roomList = buildingRoomMapper.selectList(new QueryWrapper<>());
|
||||
for (BuildingRoom community : roomList) {
|
||||
CommunityTree communityTree = new CommunityTree();
|
||||
communityTree.setCode("R" + community.getId());
|
||||
communityTree.setName(community.getRoomNum());
|
||||
communityTree.setParentCode("F" + community.getFloorId());
|
||||
resultList.add(communityTree);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Object bindCommunity(String selectedMore2) {
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member == null) {
|
||||
return new CommonResult().fail(100);
|
||||
}
|
||||
if (ValidatorUtils.empty(selectedMore2)) {
|
||||
return new CommonResult().failed("请选择绑定数据");
|
||||
}
|
||||
String[] split = selectedMore2.split(",");
|
||||
if (split.length == 3) {
|
||||
String rommIds = selectedMore2.replaceAll("C", "").replaceAll("F", "").replaceAll("R", "");
|
||||
BuildingRoom room = buildingRoomMapper.selectById(split[2].replaceAll("R", ""));
|
||||
if (room == null) {
|
||||
return new CommonResult().failed("房间不存在");
|
||||
}
|
||||
member.setRoomNums(rommIds);
|
||||
member.setRoomDesc(room.getRoomDesc());
|
||||
memberService.updateById(member);
|
||||
return new CommonResult().success(member);
|
||||
} else {
|
||||
return new CommonResult().failed("请选择绑定房间");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuildHomeResult singleContent(Long communityId) {
|
||||
BuildHomeResult result = new BuildHomeResult();
|
||||
List<BuildAdv> buildAdvs = new ArrayList<>();
|
||||
List<BuildNotice> buildNotices = new ArrayList<>();
|
||||
BuildingCommunity community = new BuildingCommunity();
|
||||
if (ValidatorUtils.notEmpty(communityId) && communityId > 0) {
|
||||
community = communityMapper.selectById(communityId);
|
||||
} else {
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member == null) {
|
||||
throw new ApiMallPlusException("100");
|
||||
}
|
||||
if (ValidatorUtils.notEmpty(member.getRoomNums())) {
|
||||
String[] split = member.getRoomNums().split(",");
|
||||
community = communityMapper.selectById(split[0]);
|
||||
}
|
||||
|
||||
}
|
||||
buildAdvs = advMapper.selectList(new QueryWrapper<BuildAdv>().eq("community_id", community.getId()));
|
||||
buildNotices = noticeMapper.selectList(new QueryWrapper<BuildNotice>().eq("community_id", community.getId()));
|
||||
if (Double.valueOf(community.getLatitude())>0){
|
||||
List<BuildingCommunity> communityList = this.selectNearCommunity(40,Double.valueOf(community.getLatitude()),Double.valueOf(community.getLongitude()),10);
|
||||
result.setCommunityList(communityList);
|
||||
}
|
||||
result.setCommunity(community);
|
||||
result.setActivityList(getActivityList());
|
||||
result.setSubjectList(buildNotices);
|
||||
result.setAdvertiseList(buildAdvs);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BuildingCommunity> selectNearCommunity(Integer distance, double latitude, double longitude, Integer pageSize) {
|
||||
return communityMapper.selectNearCommunity(distance,latitude,longitude,pageSize);
|
||||
}
|
||||
|
||||
public List<ActivityVo> getActivityList() {
|
||||
List<ActivityVo> activityList = new ArrayList<>();
|
||||
activityList.add(new ActivityVo("优惠多多", "/pages/activity/goods_combination/index", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccf7e9f4d0.jpg", "一起来拼团", "/activity/group"));
|
||||
activityList.add(new ActivityVo("新能源汽车火热销售", "/pages/activity/goods_seckill/index", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccf7e97660.jpg", "秒杀专区", "/activity/goods_seckill"));
|
||||
|
||||
activityList.add(new ActivityVo("呼朋唤友来砍价~~~", "/pages/activity/goods_bargain/index", "http://datong.crmeb.net/public/uploads/attach/2019/03/28/5c9ccfc86a6c1.jpg", "砍价活动", "/activity/bargain"));
|
||||
|
||||
return activityList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildingFloor;
|
||||
import com.zscat.mallplus.build.mapper.BuildingFloorMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildingFloorService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-11-27
|
||||
*/
|
||||
@Service
|
||||
public class BuildingFloorServiceImpl extends ServiceImpl<BuildingFloorMapper, BuildingFloor> implements IBuildingFloorService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildingOwner;
|
||||
import com.zscat.mallplus.build.mapper.BuildingOwnerMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildingOwnerService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 业主成员表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-11-27
|
||||
*/
|
||||
@Service
|
||||
public class BuildingOwnerServiceImpl extends ServiceImpl<BuildingOwnerMapper, BuildingOwner> implements IBuildingOwnerService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildingRoom;
|
||||
import com.zscat.mallplus.build.mapper.BuildingRoomMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildingRoomService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 小区 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-11-27
|
||||
*/
|
||||
@Service
|
||||
public class BuildingRoomServiceImpl extends ServiceImpl<BuildingRoomMapper, BuildingRoom> implements IBuildingRoomService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.build.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.build.entity.BuildingUnit;
|
||||
import com.zscat.mallplus.build.mapper.BuildingUnitMapper;
|
||||
import com.zscat.mallplus.build.service.IBuildingUnitService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-11-27
|
||||
*/
|
||||
@Service
|
||||
public class BuildingUnitServiceImpl extends ServiceImpl<BuildingUnitMapper, BuildingUnit> implements IBuildingUnitService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsFavorite;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-06-15
|
||||
*/
|
||||
public interface ICmsFavoriteService extends IService<CmsFavorite> {
|
||||
int addProduct(CmsFavorite productCollection);
|
||||
|
||||
|
||||
List<CmsFavorite> listProduct(Long memberId, int type);
|
||||
|
||||
List<CmsFavorite> listCollect(Long memberId);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsHelpCategory;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助分类表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsHelpCategoryService extends IService<CmsHelpCategory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsHelp;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsHelpService extends IService<CmsHelp> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsMemberReport;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户举报表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsMemberReportService extends IService<CmsMemberReport> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.pms.entity.CmsPrefrenceAreaProductRelation;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优选专区和产品关系表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsPrefrenceAreaProductRelationService extends IService<CmsPrefrenceAreaProductRelation> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsPrefrenceArea;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优选专区 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsPrefrenceAreaService extends IService<CmsPrefrenceArea> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsSubjectCategory;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题分类表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsSubjectCategoryService extends IService<CmsSubjectCategory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsSubjectComment;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题评论表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsSubjectCommentService extends IService<CmsSubjectComment> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.pms.entity.CmsSubjectProductRelation;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题商品关系表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsSubjectProductRelationService extends IService<CmsSubjectProductRelation> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsSubject;
|
||||
import com.zscat.mallplus.vo.timeline.Timeline;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsSubjectService extends IService<CmsSubject> {
|
||||
|
||||
List<CmsSubject> getRecommendSubjectList(int pageNum, int pageSize);
|
||||
|
||||
int countByToday(Long id);
|
||||
|
||||
Object reward(Long aid, int coin);
|
||||
|
||||
List<Timeline> listTimeLine();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsTopicCategory;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 话题分类表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsTopicCategoryService extends IService<CmsTopicCategory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsTopicComment;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题评论表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsTopicCommentService extends IService<CmsTopicComment> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsTopicMember;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsTopicMemberService extends IService<CmsTopicMember> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsTopic;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 话题表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
public interface ICmsTopicService extends IService<CmsTopic> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.cms.entity.CmsZhaoPin;
|
||||
|
||||
/**
|
||||
* @author mallplus
|
||||
* @date 2020-01-06
|
||||
*/
|
||||
|
||||
public interface ICmsZhaoPinService extends IService<CmsZhaoPin> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.sys.entity.SysArea;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-14
|
||||
*/
|
||||
public interface ISysAreaService extends IService<SysArea> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zscat.mallplus.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zscat.mallplus.sys.entity.SysSchool;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-14
|
||||
*/
|
||||
public interface ISysSchoolService extends IService<SysSchool> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.zscat.mallplus.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.cms.entity.CmsFavorite;
|
||||
import com.zscat.mallplus.cms.entity.CmsSubject;
|
||||
import com.zscat.mallplus.cms.mapper.CmsFavoriteMapper;
|
||||
import com.zscat.mallplus.cms.service.ICmsFavoriteService;
|
||||
import com.zscat.mallplus.cms.service.ICmsSubjectService;
|
||||
import com.zscat.mallplus.pms.entity.PmsProduct;
|
||||
import com.zscat.mallplus.pms.mapper.PmsProductMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-06-15
|
||||
*/
|
||||
@Service
|
||||
public class CmsFavoriteServiceImpl extends ServiceImpl<CmsFavoriteMapper, CmsFavorite> implements ICmsFavoriteService {
|
||||
|
||||
@Resource
|
||||
private CmsFavoriteMapper productCollectionRepository;
|
||||
@Resource
|
||||
private PmsProductMapper productMapper;
|
||||
@Resource
|
||||
private ICmsSubjectService subjectService;
|
||||
|
||||
@Override
|
||||
public int addProduct(CmsFavorite productCollection) {
|
||||
int count = 0;
|
||||
CmsFavorite query = new CmsFavorite();
|
||||
query.setObjId(productCollection.getObjId());
|
||||
query.setMemberId(productCollection.getMemberId());
|
||||
query.setType(productCollection.getType());
|
||||
CmsFavorite findCollection = productCollectionRepository.selectOne(new QueryWrapper<>(query));
|
||||
if (findCollection == null) {
|
||||
productCollection.setAddTime(new Date());
|
||||
productCollectionRepository.insert(productCollection);
|
||||
if (productCollection.getType() == 1) {
|
||||
PmsProduct subject = productMapper.selectById(productCollection.getObjId());
|
||||
subject.setId(productCollection.getObjId());
|
||||
subject.setGiftPoint(subject.getGiftPoint() + 1);
|
||||
//更新到数据库
|
||||
productMapper.updateById(subject);
|
||||
}
|
||||
if (productCollection.getType() == 2) {
|
||||
CmsSubject subject = subjectService.getById(productCollection.getObjId());
|
||||
subject.setId(productCollection.getObjId());
|
||||
subject.setCollectCount(subject.getCollectCount() + 1);
|
||||
//更新到数据库
|
||||
subjectService.updateById(subject);
|
||||
}
|
||||
count = 1;
|
||||
} else {
|
||||
if (productCollection.getType() == 1) {
|
||||
PmsProduct subject = productMapper.selectById(productCollection.getObjId());
|
||||
subject.setId(productCollection.getObjId());
|
||||
subject.setGiftPoint(subject.getGiftPoint() - 1);
|
||||
//更新到数据库
|
||||
productMapper.updateById(subject);
|
||||
}
|
||||
if (productCollection.getType() == 2) {
|
||||
CmsSubject subject = subjectService.getById(productCollection.getObjId());
|
||||
subject.setId(productCollection.getObjId());
|
||||
subject.setCollectCount(subject.getCollectCount() - 1);
|
||||
//更新到数据库
|
||||
subjectService.updateById(subject);
|
||||
}
|
||||
return productCollectionRepository.delete(new QueryWrapper<>(query));
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CmsFavorite> listProduct(Long memberId, int type) {
|
||||
return productCollectionRepository.selectList(new QueryWrapper<CmsFavorite>().eq("member_id", memberId).eq("type", type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CmsFavorite> listCollect(Long memberId) {
|
||||
return productCollectionRepository.selectList(new QueryWrapper<CmsFavorite>().eq("member_id", memberId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.cms.entity.CmsHelpCategory;
|
||||
import com.zscat.mallplus.cms.mapper.CmsHelpCategoryMapper;
|
||||
import com.zscat.mallplus.cms.service.ICmsHelpCategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助分类表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@Service
|
||||
public class CmsHelpCategoryServiceImpl extends ServiceImpl<CmsHelpCategoryMapper, CmsHelpCategory> implements ICmsHelpCategoryService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.cms.entity.CmsHelp;
|
||||
import com.zscat.mallplus.cms.mapper.CmsHelpMapper;
|
||||
import com.zscat.mallplus.cms.service.ICmsHelpService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@Service
|
||||
public class CmsHelpServiceImpl extends ServiceImpl<CmsHelpMapper, CmsHelp> implements ICmsHelpService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.cms.entity.CmsMemberReport;
|
||||
import com.zscat.mallplus.cms.mapper.CmsMemberReportMapper;
|
||||
import com.zscat.mallplus.cms.service.ICmsMemberReportService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户举报表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@Service
|
||||
public class CmsMemberReportServiceImpl extends ServiceImpl<CmsMemberReportMapper, CmsMemberReport> implements ICmsMemberReportService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.cms.service.ICmsPrefrenceAreaProductRelationService;
|
||||
import com.zscat.mallplus.pms.entity.CmsPrefrenceAreaProductRelation;
|
||||
import com.zscat.mallplus.pms.mapper.CmsPrefrenceAreaProductRelationMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优选专区和产品关系表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@Service
|
||||
public class CmsPrefrenceAreaProductRelationServiceImpl extends ServiceImpl<CmsPrefrenceAreaProductRelationMapper, CmsPrefrenceAreaProductRelation> implements ICmsPrefrenceAreaProductRelationService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.cms.entity.CmsPrefrenceArea;
|
||||
import com.zscat.mallplus.cms.mapper.CmsPrefrenceAreaMapper;
|
||||
import com.zscat.mallplus.cms.service.ICmsPrefrenceAreaService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优选专区 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@Service
|
||||
public class CmsPrefrenceAreaServiceImpl extends ServiceImpl<CmsPrefrenceAreaMapper, CmsPrefrenceArea> implements ICmsPrefrenceAreaService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.cms.entity.CmsSubjectCategory;
|
||||
import com.zscat.mallplus.cms.mapper.CmsSubjectCategoryMapper;
|
||||
import com.zscat.mallplus.cms.service.ICmsSubjectCategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题分类表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@Service
|
||||
public class CmsSubjectCategoryServiceImpl extends ServiceImpl<CmsSubjectCategoryMapper, CmsSubjectCategory> implements ICmsSubjectCategoryService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.cms.entity.CmsSubjectComment;
|
||||
import com.zscat.mallplus.cms.mapper.CmsSubjectCommentMapper;
|
||||
import com.zscat.mallplus.cms.service.ICmsSubjectCommentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题评论表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@Service
|
||||
public class CmsSubjectCommentServiceImpl extends ServiceImpl<CmsSubjectCommentMapper, CmsSubjectComment> implements ICmsSubjectCommentService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zscat.mallplus.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.cms.service.ICmsSubjectProductRelationService;
|
||||
import com.zscat.mallplus.pms.entity.CmsSubjectProductRelation;
|
||||
import com.zscat.mallplus.pms.mapper.CmsSubjectProductRelationMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题商品关系表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@Service
|
||||
public class CmsSubjectProductRelationServiceImpl extends ServiceImpl<CmsSubjectProductRelationMapper, CmsSubjectProductRelation> implements ICmsSubjectProductRelationService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.zscat.mallplus.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.cms.entity.CmsSubject;
|
||||
import com.zscat.mallplus.cms.mapper.CmsSubjectCategoryMapper;
|
||||
import com.zscat.mallplus.cms.mapper.CmsSubjectMapper;
|
||||
import com.zscat.mallplus.cms.service.ICmsSubjectService;
|
||||
import com.zscat.mallplus.sms.entity.SmsHomeRecommendSubject;
|
||||
import com.zscat.mallplus.sms.service.ISmsHomeRecommendSubjectService;
|
||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||
import com.zscat.mallplus.ums.entity.UmsRewardLog;
|
||||
import com.zscat.mallplus.ums.mapper.UmsMemberMapper;
|
||||
import com.zscat.mallplus.ums.mapper.UmsRewardLogMapper;
|
||||
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.vo.timeline.Timeline;
|
||||
import com.zscat.mallplus.vo.timeline.TimelineMonth;
|
||||
import com.zscat.mallplus.vo.timeline.TimelinePost;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@Service
|
||||
public class CmsSubjectServiceImpl extends ServiceImpl<CmsSubjectMapper, CmsSubject> implements ICmsSubjectService {
|
||||
|
||||
|
||||
@Resource
|
||||
private CmsSubjectMapper subjectMapper;
|
||||
@Resource
|
||||
private ISmsHomeRecommendSubjectService homeRecommendSubjectService;
|
||||
|
||||
@Resource
|
||||
private UmsMemberMapper memberMapper;
|
||||
@Resource
|
||||
private UmsRewardLogMapper rewardLogMapper;
|
||||
@Resource
|
||||
private CmsSubjectCategoryMapper subjectCategoryMapper;
|
||||
@Autowired
|
||||
private IUmsMemberService memberService;
|
||||
|
||||
|
||||
/**
|
||||
* timelineMapper
|
||||
* 获取timeLine数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Timeline> listTimeLine() {
|
||||
List<Timeline> timelineList = subjectMapper.listTimeline();
|
||||
genTimelineMonth(timelineList);
|
||||
return timelineList;
|
||||
}
|
||||
|
||||
private List<Timeline> genTimelineMonth(List<Timeline> timelineList) {
|
||||
for (Timeline timeline : timelineList) {
|
||||
List<TimelineMonth> timelineMonthList = new ArrayList<>();
|
||||
for (int i = Calendar.DECEMBER + 1; i > 0; i--) {
|
||||
List<TimelinePost> postList = subjectMapper.listTimelinePost(timeline.getYear(), i);
|
||||
if (CollectionUtils.isEmpty(postList)) {
|
||||
continue;
|
||||
}
|
||||
TimelineMonth month = new TimelineMonth();
|
||||
month.setCount(postList.size());
|
||||
month.setMonth(i);
|
||||
month.setPosts(postList);
|
||||
timelineMonthList.add(month);
|
||||
}
|
||||
timeline.setMonths(timelineMonthList);
|
||||
}
|
||||
return timelineList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CmsSubject> getRecommendSubjectList(int pageNum, int pageSize) {
|
||||
List<SmsHomeRecommendSubject> brands = homeRecommendSubjectService.list(new QueryWrapper<>());
|
||||
List<Long> ids = brands.stream()
|
||||
.map(SmsHomeRecommendSubject::getId)
|
||||
.collect(Collectors.toList());
|
||||
return (List<CmsSubject>) subjectMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countByToday(Long id) {
|
||||
return subjectMapper.countByToday(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public Object reward(Long aid, int coin) {
|
||||
try {
|
||||
UmsMember member = memberService.getNewCurrentMember();
|
||||
if (member != null && member.getBlance().compareTo(new BigDecimal(coin)) < 0) {
|
||||
return new CommonResult().failed("余额不够");
|
||||
}
|
||||
member.setBlance(member.getBlance().subtract(new BigDecimal(coin)));
|
||||
memberMapper.updateById(member);
|
||||
CmsSubject subject = subjectMapper.selectById(aid);
|
||||
UmsMember remember = memberMapper.selectById(subject.getMemberId());
|
||||
if (remember != null) {
|
||||
subject.setReward(subject.getReward() + coin);
|
||||
subjectMapper.updateById(subject);
|
||||
remember.setBlance(remember.getBlance().add(new BigDecimal(coin)));
|
||||
memberMapper.updateById(remember);
|
||||
UmsRewardLog log = new UmsRewardLog();
|
||||
log.setCoin(coin);
|
||||
log.setSendMemberId(member.getId());
|
||||
log.setMemberIcon(member.getIcon());
|
||||
log.setMemberNickName(member.getNickname());
|
||||
log.setRecMemberId(remember.getId());
|
||||
log.setCreateTime(new Date());
|
||||
log.setObjid(aid);
|
||||
rewardLogMapper.insert(log);
|
||||
}
|
||||
return new CommonResult().success("打赏文章成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new CommonResult().failed("打赏文章失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user