bce2c347 by ja

初始化项目

0 parents
Showing 90 changed files with 4091 additions and 0 deletions
/*
Navicat MySQL Data Transfer
Source Server : 127
Source Server Version : 50632
Source Host : localhost
Source Database : csair_dp
Target Server Version : 50632
File Encoding : utf-8
Date: 12/29/2017 17:28:10 PM
*/
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `t_hpai_member_info`
-- ----------------------------
DROP TABLE IF EXISTS `t_hpai_member_info`;
CREATE TABLE `t_hpai_member_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`source` bigint(20) NOT NULL,
`timestamp` bigint(20) NOT NULL,
`barcode` varchar(128) NOT NULL,
`channel_id` bigint(20) NOT NULL,
`manager_id` bigint(20) NOT NULL,
`name` varchar(255) NOT NULL,
`gender` char(32) NOT NULL,
`birthday_str` varchar(128) NOT NULL,
`mobile_number` varchar(255) NOT NULL,
`sampling_date` varchar(255) NOT NULL,
`recipients` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`family_disease` varchar(255) NOT NULL,
`existing_disease` varchar(255) NOT NULL,
`weight` float NOT NULL,
`height` bigint(20) NOT NULL,
`remarks` varchar(255) DEFAULT NULL,
`create_at` datetime NOT NULL,
`status` tinyint(4) NOT NULL,
`member_number` varchar(255) NOT NULL,
`is_genereport` tinyint(4) DEFAULT '0',
`genereport_at` datetime DEFAULT NULL,
`pack_name` varchar(255) DEFAULT NULL,
`pdf_name` varchar(255) DEFAULT NULL,
`url` text,
`genereport_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
SET FOREIGN_KEY_CHECKS = 1;
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
No preview for this file type
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>demo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="cloudfoundry.standalone.app" version="1.0"/>
</faceted-project>
No preview for this file type
[ WARN ] [2017-03-09 18:40:10] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:44:02] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:48:57] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:52:40] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:53:00] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:53:46] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:54:53] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:55:03] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:57:12] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:57:29] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:57:53] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ ERROR] [2017-03-09 18:57:54] org.apache.axis.client.Call [2418] - No returnType was specified to the Call object! You must call setReturnType() if you have called addParameter().
[ WARN ] [2017-03-09 18:58:08] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[ WARN ] [2017-03-09 18:59:20] org.apache.axis.utils.JavaUtils [1308] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
#!/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
#
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
# for the new JDKs provided by Oracle.
#
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
#
# Apple JDKs
#
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
fi
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
#
# Apple JDKs
#
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
fi
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
#
# Oracle JDKs
#
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
fi
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
#
# Apple JDKs
#
export JAVA_HOME=`/usr/libexec/java_home`
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
# 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"`
fi
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
local basedir=$(pwd)
local wdir=$(pwd)
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
wdir=$(cd "$wdir/.."; pwd)
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} "$@"
@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
set MAVEN_CMD_LINE_ARGS=%*
@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="".\.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_CMD_LINE_ARGS%
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%
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>csair_dp_HDP</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>csair_dp_HDP</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<!-- https://mvnrepository.com/artifact/wsdl4j/wsdl4j -->
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.5.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
</dependency>
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>4.0.3</version>
</dependency>
<!--通用Mapper插件-->
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>3.3.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.wink</groupId>
<artifactId>wink-client</artifactId>
<version>1.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.2.3</version>
<classifier>jdk15</classifier>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.csairholiday</groupId>-->
<!--<artifactId>csairholiday</artifactId>-->
<!--<scope>system</scope>-->
<!--<version>1.5</version>-->
<!--<systemPath>${project.basedir}/libs/shdupp-jdk1.5.jar</systemPath>-->
<!--</dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Manifest-Version: 1.0
Class-Path: spring-tx-4.2.5.RELEASE.jar websocket-api-9.2.15.v20160210
.jar spring-boot-starter-1.3.3.RELEASE.jar urlrewritefilter-4.0.3.jar
mybatis-spring-boot-starter-1.0.0.jar spring-boot-starter-jdbc-1.3.3
.RELEASE.jar tomcat-jdbc-8.0.32.jar javax.websocket-api-1.0.jar valid
ation-api-1.1.0.Final.jar aopalliance-1.0.jar xml-apis-1.0.b2.jar asm
-commons-5.0.1.jar jaxb-impl-2.2.1.1.jar jetty-servlet-9.2.15.v201602
10.jar spring-data-mongodb-1.8.4.RELEASE.jar websocket-client-9.2.15.
v20160210.jar jetty-server-9.2.15.v20160210.jar jetty-xml-9.2.15.v201
60210.jar javax-websocket-server-impl-9.2.15.v20160210.jar jackson-an
notations-2.6.5.jar commons-codec-1.9.jar mysql-connector-java-5.1.38
.jar dom4j-1.6.1.jar jetty-util-9.2.15.v20160210.jar commons-pool2-2.
4.2.jar mongo-java-driver-2.13.3.jar jboss-logging-3.3.0.Final.jar co
mmons-logging-1.0.4.jar h2-1.4.191.jar mybatis-spring-1.2.3.jar jaxb-
api-2.2.jar jetty-jndi-9.2.15.v20160210.jar wink-client-1.3.0.jar hib
ernate-validator-5.2.4.Final.jar websocket-server-9.2.15.v20160210.ja
r log4j-over-slf4j-1.7.16.jar mapper-3.3.4.jar json-20140107.jar tomc
at-embed-core-8.0.32.jar asm-tree-5.0.1.jar spring-context-4.2.5.RELE
ASE.jar jsr311-api-1.1.1.jar spring-aop-4.2.5.RELEASE.jar snakeyaml-1
.16.jar javax.annotation-api-1.2.jar wink-common-1.3.0.jar commons-io
-2.1.jar jetty-security-9.2.15.v20160210.jar asm-5.0.1.jar logback-cl
assic-1.1.5.jar tomcat-juli-8.0.32.jar classmate-1.1.0.jar jstl-1.2.j
ar spring-boot-starter-data-mongodb-1.3.3.RELEASE.jar spring-beans-4.
2.5.RELEASE.jar spring-boot-autoconfigure-1.3.3.RELEASE.jar logback-c
ore-1.1.5.jar spring-jdbc-4.2.5.RELEASE.jar slf4j-api-1.7.16.jar comm
ons-lang3-3.3.2.jar jetty-http-9.2.15.v20160210.jar geronimo-annotati
on_1.1_spec-1.0.jar jedis-2.7.3.jar spring-core-4.2.5.RELEASE.jar jet
ty-io-9.2.15.v20160210.jar stax-api-1.0-2.jar spring-boot-starter-web
-1.3.3.RELEASE.jar spring-boot-starter-tomcat-1.3.3.RELEASE.jar jacks
on-databind-2.6.5.jar mybatis-3.3.0.jar commons-httpclient-3.1.jar je
tty-servlets-9.2.15.v20160210.jar jul-to-slf4j-1.7.16.jar javax.servl
et-api-3.1.0.jar jetty-annotations-9.2.15.v20160210.jar jcl-over-slf4
j-1.7.16.jar activation-1.1.jar jetty-webapp-9.2.15.v20160210.jar spr
ing-boot-starter-validation-1.3.3.RELEASE.jar spring-boot-1.3.3.RELEA
SE.jar jackson-core-2.6.5.jar tomcat-embed-websocket-8.0.32.jar sprin
g-boot-starter-jetty-1.3.3.RELEASE.jar spring-context-support-4.2.5.R
ELEASE.jar spring-webmvc-4.2.5.RELEASE.jar spring-boot-starter-loggin
g-1.3.3.RELEASE.jar tomcat-embed-el-8.0.32.jar commons-fileupload-1.2
.2.jar jetty-continuation-9.2.15.v20160210.jar spring-webmvc-portlet-
4.2.5.RELEASE.jar spring-web-4.2.5.RELEASE.jar javax-websocket-client
-impl-9.2.15.v20160210.jar spring-boot-starter-redis-1.3.3.RELEASE.ja
r websocket-servlet-9.2.15.v20160210.jar persistence-api-1.0.jar tomc
at-embed-logging-juli-8.0.32.jar jetty-plus-9.2.15.v20160210.jar spri
ng-data-commons-1.11.4.RELEASE.jar spring-data-redis-1.5.0.RELEASE.ja
r spring-expression-4.2.5.RELEASE.jar websocket-common-9.2.15.v201602
10.jar mybatis-spring-boot-autoconfigure-1.0.0.jar
Main-Class: com.example.DemoApplication
package com.example;
import com.example.filter.CORSFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@MapperScan(basePackages = {"com.example.mapper.*"})
@SpringBootApplication
@RestController
@RequestMapping("/test")
public class DemoApplication extends WebMvcConfigurerAdapter{
Logger logger = LoggerFactory.getLogger(getClass());
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new CORSFilter()).addPathPatterns("/**");
}
}
package com.example.controller.api;
import com.example.service.api.HapiService;
import com.example.support.model.MessageEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by long on 2017/11/13.
*/
@RestController
@RequestMapping("/marketing/hapi")
public class HapiController {
@Autowired
private HapiService hapiService;
@RequestMapping("/register")
public MessageEntity register(@RequestParam("barcode") String barcode,
@RequestParam("name") String name,@RequestParam("gender") String gender,@RequestParam("birthdayStr") String birthdayStr,
@RequestParam("mobileNumber") String mobileNumber,@RequestParam("samplingDate") String samplingDate,
@RequestParam("recipients") String recipients,@RequestParam("address") String address,@RequestParam("familyDisease") String familyDisease,
@RequestParam("existingDisease") String existingDisease,@RequestParam("weight") Float weight,
@RequestParam("height") Integer height,@RequestParam(value = "remarks",required = false)String remarks){
return this.hapiService.register(barcode, name, gender, birthdayStr, mobileNumber, samplingDate, recipients, address, familyDisease, existingDisease, weight, height, remarks);
}
@RequestMapping("/genereport")
public MessageEntity genereport(@RequestParam("barcode") String barcode,
@RequestParam("mobileNumber") String mobileNumber){
return this.hapiService.genereport(barcode, mobileNumber);
}
@RequestMapping("/getbymobile")
public MessageEntity getbymobile(
@RequestParam("mobileNumber") String mobileNumber){
return this.hapiService.getByMobileNumber(mobileNumber);
}
@RequestMapping("/memberlist")
public MessageEntity memberlist(
@RequestParam(value = "keyWord",required = false) String keyWord,
@RequestParam(value = "status",defaultValue = "0") Integer status,
@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "size",defaultValue = "10") int size){
return this.hapiService.memberList(keyWord, status, page, size);
}
@RequestMapping("/reportbyday")
public MessageEntity reportbyday(
@RequestParam("beginTime") String beginTime,@RequestParam("endTime") String endTime){
return this.hapiService.reportByDay(beginTime, endTime);
}
@RequestMapping("/reportbymonth")
public MessageEntity reportbymonth(
@RequestParam("beginTime") String beginTime,@RequestParam("endTime") String endTime){
return this.hapiService.reportByMonth(beginTime, endTime);
}
}
package com.example.filter;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by caobug on 15/7/29.
*/
public class CORSFilter extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, HEAD");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "Content-Type,X-Requested-With,accept," +
"Origin,Access-Control-Request-Method,Access-Control-Request-Headers,hdp-application-id," +
"hdp-rest-api-key,hdp_wx_user_info_json,wxu_session");
return super.preHandle(request, response, handler);
}
}
\ No newline at end of file
package com.example.mapper.api;
import com.example.models.api.MemberInfo;
import com.example.utils.mybatis.pageable.Pageable;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Created by JA on 17/12/26.
*/
public interface MemberInfoMapper {
boolean create(MemberInfo memberInfo);
MemberInfo getByMobileNumber(@Param("mobileNumber") String mobileNumber);
boolean genereport(@Param("isGenereport") Integer isGenereport,
@Param("genereportAt") Date genereportAt,
@Param("packName") String packName,
@Param("pdfName") String pdfName,
@Param("url") String url,
@Param("genereportName") String genereportName,
@Param("mobileNumber") String mobileNumber);
List<MemberInfo> list(@Param("keyWord") String keyWord,@Param("status") Integer status,@Param("pageable") Pageable pageable);
int count(@Param("keyWord") String keyWord,@Param("status") Integer status);
List<Map<String, Object>> registerByDay(@Param("startTime") String startTime,@Param("endTime") String endTime);
List<Map<String, Object>> genereportByDay(@Param("startTime") String startTime,@Param("endTime") String endTime);
List<Map<String, Object>> registerByMonth(@Param("startTime") String startTime,@Param("endTime") String endTime);
List<Map<String, Object>> genereportByMonth(@Param("startTime") String startTime,@Param("endTime") String endTime);
}
\ No newline at end of file
package com.example.mapper.log;
import com.example.models.log.HttpLog;
import org.apache.ibatis.annotations.Param;
/**
* Created by JA on 17/3/15.
*/
public interface HttpLogMapper {
boolean create(HttpLog httpLog);
boolean update(@Param("id") Long id,@Param("restful") String restful);
}
package com.example.models.api;
import java.util.Date;
/**
* Created by long on 2017/11/13.
*/
public class AppStore {
private Long id;
private String app_id;
private String store_key;
private String store_value;
private Date create_at;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getApp_id() {
return app_id;
}
public void setApp_id(String app_id) {
this.app_id = app_id;
}
public String getStore_key() {
return store_key;
}
public void setStore_key(String store_key) {
this.store_key = store_key;
}
public String getStore_value() {
return store_value;
}
public void setStore_value(String store_value) {
this.store_value = store_value;
}
public Date getCreate_at() {
return create_at;
}
public void setCreate_at(Date create_at) {
this.create_at = create_at;
}
}
package com.example.models.api;
import java.util.Date;
/**
* Created by JA on 17/12/26.
*/
public class MemberInfo {
Long id;
Integer source;
Long timestamp;
String barcode;
Integer channelId;
Integer managerId;
String name;
String gender;
String birthdayStr;
String mobileNumber;
String samplingDate;
String recipients;
String address;
String familyDisease;
String existingDisease;
float weight;
Integer height;
String remarks;
String memberNumber;
Date createAt;
Integer status;
Integer isGenereport;
Date genereportAt;
String packName;
String pdfName;
String url;
String genereportName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode;
}
public Integer getChannelId() {
return channelId;
}
public void setChannelId(Integer channelId) {
this.channelId = channelId;
}
public Integer getManagerId() {
return managerId;
}
public void setManagerId(Integer managerId) {
this.managerId = managerId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getBirthdayStr() {
return birthdayStr;
}
public void setBirthdayStr(String birthdayStr) {
this.birthdayStr = birthdayStr;
}
public String getMobileNumber() {
return mobileNumber;
}
public void setMobileNumber(String mobileNumber) {
this.mobileNumber = mobileNumber;
}
public String getSamplingDate() {
return samplingDate;
}
public void setSamplingDate(String samplingDate) {
this.samplingDate = samplingDate;
}
public String getRecipients() {
return recipients;
}
public void setRecipients(String recipients) {
this.recipients = recipients;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getFamilyDisease() {
return familyDisease;
}
public void setFamilyDisease(String familyDisease) {
this.familyDisease = familyDisease;
}
public String getExistingDisease() {
return existingDisease;
}
public void setExistingDisease(String existingDisease) {
this.existingDisease = existingDisease;
}
public float getWeight() {
return weight;
}
public void setWeight(float weight) {
this.weight = weight;
}
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public Date getCreateAt() {
return createAt;
}
public void setCreateAt(Date createAt) {
this.createAt = createAt;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getMemberNumber() {
return memberNumber;
}
public void setMemberNumber(String memberNumber) {
this.memberNumber = memberNumber;
}
public Integer getIsGenereport() {
return isGenereport;
}
public void setIsGenereport(Integer isGenereport) {
this.isGenereport = isGenereport;
}
public Date getGenereportAt() {
return genereportAt;
}
public void setGenereportAt(Date genereportAt) {
this.genereportAt = genereportAt;
}
public String getPackName() {
return packName;
}
public void setPackName(String packName) {
this.packName = packName;
}
public String getPdfName() {
return pdfName;
}
public void setPdfName(String pdfName) {
this.pdfName = pdfName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getGenereportName() {
return genereportName;
}
public void setGenereportName(String genereportName) {
this.genereportName = genereportName;
}
}
package com.example.models.log;
import java.util.Date;
/**
* Created by Administrator on 2017/4/1.
*/
public class ExternalRequestLog {
private Long id;
private String app_id;
private String request_url;
private String request_params;
private String response_data;
private Date create_time;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getApp_id() {
return app_id;
}
public void setApp_id(String app_id) {
this.app_id = app_id;
}
public String getRequest_url() {
return request_url;
}
public void setRequest_url(String request_url) {
this.request_url = request_url;
}
public String getRequest_params() {
return request_params;
}
public void setRequest_params(String request_params) {
this.request_params = request_params;
}
public String getResponse_data() {
return response_data;
}
public void setResponse_data(String response_data) {
this.response_data = response_data;
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
}
package com.example.models.log;
import java.util.Date;
/**
* Created by JA on 17/3/15.
*/
public class HttpLog {
private Long id;
private String app_id;
private String url;
private String param;
private String restful;
private Date create_at;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
public String getRestful() {
return restful;
}
public void setRestful(String restful) {
this.restful = restful;
}
public Date getCreate_at() {
return create_at;
}
public void setCreate_at(Date create_at) {
this.create_at = create_at;
}
public String getApp_id() {
return app_id;
}
public void setApp_id(String app_id) {
this.app_id = app_id;
}
}
package com.example.service.api;
import com.example.models.api.MemberInfo;
import com.example.support.model.MessageEntity;
import java.util.List;
/**
* Created by long on 2017/11/13.
*/
public interface HapiService {
MessageEntity register(String barcode,String name,String gender,String birthdayStr,String mobileNumber,String samplingDate,
String recipients,String address,String familyDisease,String existingDisease,Float weight,Integer height,String remarks);
MessageEntity getByMobileNumber(String mobileNumber);
MessageEntity genereport(String barcode,String mobileNumber);
MessageEntity reportByDay(String beginTime,String endTime);
MessageEntity reportByMonth(String beginTime,String endTime);
MessageEntity memberList(String keyWord,Integer status,int page,int size);
}
package com.example.service.http;
import org.apache.wink.client.ClientConfig;
/**
* Created by caobug on 15/5/12.
*/
public interface ClientConfigService {
ClientConfig getClientConfig();
}
\ No newline at end of file
package com.example.service.http;
import org.apache.wink.client.ClientConfig;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
/**
* Created by caobug on 15/5/12.
*/
public class ClientConfigServiceImpl implements ClientConfigService {
public ClientConfig getClientConfig() {
ClientConfig myConfig = new ClientConfig();
SSLContext sc;
try {
sc = SSLContext.getInstance("SSL");
sc.init(null, getTrustManager(), new java.security.SecureRandom());
} catch (NoSuchAlgorithmException | KeyManagementException e) {
return null;
}
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
myConfig.setBypassHostnameVerification(true);
myConfig.connectTimeout(100000);
myConfig.readTimeout(100000);
myConfig.followRedirects(false);
return myConfig;
}
private TrustManager[] getTrustManager() {
return new TrustManager[]{new X509TrustManager() {
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
@Override
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
}};
}
}
\ No newline at end of file
package com.example.service.http;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* Created by Administrator on 2015/10/10-16:56.
*
* 派加积分HTTP POST接口
*/
public interface HttpPostService {
void httpPostAsync(String url,String app_id, Map<String, Object> postData);
Map<String, Object> httpPost(String url,String app_id, Map<String, Object> postData) throws JsonProcessingException, IOException;
Map<String, Object> httpPostList(String url,String app_id, List<Map<String, Object>> postData) throws JsonProcessingException, IOException;
String httpPostString(String url,String app_id, Map<String, Object> postData);
Map<String, Object> httpGet(String url,String app_id);
Map<String, Object> httpPostForm(String url,String app_id, Map<String, Object> postData);
Map<String, Object> httpForm(String url, Map<String, String> params);
Map<String, Object> httpPost(String url, Map<String, Object> postData);
}
package com.example.support.model;
import org.apache.commons.lang3.RandomStringUtils;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
/**
* 响应的消息实体,使用例子如下:
*
* @FormToken(produce = true)
* @ResponseBody
* @RequestMapping(value = "/create/test", method = RequestMethod.GET)
* public Object test(HttpServletRequest request) throws JsonProcessingException {
* Object map = new HashMap<>();
* map.put("redirect", "http://www.baidu.com/");
* return new MessageEntity.Builder(request).code(MessageCodeEnum.ALREADY_EXISTS).
* msg("账户已存在").content(map).success(false).create();
* }
* <p/>
* 构造对此对象时,消息不传时会默认初始化一些值。以下键值对左边表示属性,右边表示默认值:requestId=null, msg=null, seccuess=false
* , code=0, content=null,而resubmitToken已内置在构造器中,无需担忧默认为空。通常该值是从 SESSION 中取,为了防止TOKEN 重复提交功能生效,
* 请勿自定义resubmitToken值。正确的做法是传入request
*/
public class MessageEntity implements Serializable {
private static final long serialVersionUID = 5165069341805388402L;
private final String msg; // 消息
private final boolean success; // 操作成功与否
private final String resubmitToken; // post token
private final String code; // 状态码
private final Object content; // 内容主体
/**
* 请选构造 MessageEntity.Builder 对象
*
* @param builder
*/
public MessageEntity(Builder builder) {
this.msg = builder.msg;
this.success = builder.success;
this.resubmitToken = builder.resubmitToken;
this.code = builder.code;
this.content = builder.content;
}
public String getMsg() {
return msg;
}
public boolean isSuccess() {
return success;
}
public String getResubmitToken() {
return resubmitToken;
}
public String getCode() {
return code;
}
public Object getContent() {
return content;
}
@Override
public String toString() {
return "MessageEntity{" +
", msg='" + msg + '\'' +
", success=" + success +
", resubmitToken='" + resubmitToken + '\'' +
", code=" + code +
", content=" + content +
'}';
}
public static class Builder {
private final String resubmitToken; // post token
private String msg; // 消息
private boolean success; // 操作成功与否
private String code; // 状态码
private Object content; // 内容主体
/**
* 新 token
*
* @param request
*/
public Builder(HttpServletRequest request) {
if (null != request) {
this.resubmitToken = getToken();
// request.getSession().setAttribute(FormTokenInterceptor.TOKEN_NAME, this.resubmitToken);
} else {
this.resubmitToken = null;
}
}
/**
* 新 token
*
*/
public Builder() {
this.resubmitToken = null;
}
/**
* 消息,需要解决国际化问题
*
* @param msg
* @return
*/
public Builder msg(String msg) {
this.msg = msg;
return this;
}
/**
* 是否成功
*
* @param success
* @return
*/
public Builder success(boolean success) {
this.success = success;
return this;
}
public Builder code(String code) {
this.code = code;
return this;
}
/**
* 消息主体,根据前端需求构造
*
* @param content
* @return
*/
public Builder content(Object content) {
this.content = content;
return this;
}
public MessageEntity create() {
return new MessageEntity(this);
}
public String getToken() {
return RandomStringUtils.random(32, 'a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
}
}
}
\ No newline at end of file
package com.example.support.model;
/**
*/
public class UriEntity {
private String uri;
public UriEntity(String uri) {
this.uri = uri;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
}
\ No newline at end of file
package com.example.utils;
import org.apache.commons.lang3.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* Created by long on 2017/8/28.
*/
public class DateFormatUtils {
//时间格式:yyyy-MM-dd HH:mm:ss
private static String DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss";
/**
* 将时间转换为对应格式
* @param date : 时间
* @param format : 格式
* @return
*/
public static String getStrByFormat(Date date, String format){
if(StringUtils.isBlank(format)){
format = DEFAULT_FORMAT;
}
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(date);
}
/**
* 通过时间字符串和格式获取时间戳
* @param str : 时间字符串
* @param format : 格式
* @return
*/
public static Long getTimeByFormat(String str, String format){
try {
if(StringUtils.isBlank(format)){
format = DEFAULT_FORMAT;
}
SimpleDateFormat sdf = new SimpleDateFormat(format);
Date parse = sdf.parse(str);
return parse.getTime();
} catch (ParseException e) {
// e.printStackTrace();
}
return null;
}
/**
* 通过时间字符串和格式获取时间对象
* @param str : 时间字符串
* @param format : 格式
* @return
*/
public static Date getDateByFormat(String str, String format){
try {
if(StringUtils.isBlank(format)){
format = DEFAULT_FORMAT;
}
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.parse(str);
} catch (ParseException e) {
// e.printStackTrace();
}
return null;
}
/**
* 获取N天内的时间
* @param now
* @param n 正数表示在条件时间n天之后,负数表示在条件时间n天之前
* @return
*/
public static Date getBelongDay(Date now, int n){
Calendar calendar = Calendar.getInstance(); //得到日历
calendar.setTime(now);//把当前时间赋给日历
calendar.add(Calendar.DAY_OF_MONTH, n);
return calendar.getTime();
}
/**
* 获取N月内的时间
* @param now
* @param n 正数表示在条件时间n月之后,负数表示在条件时间n月之前
* @return
*/
public static Date getBelongMonth(Date now, int n){
Calendar calendar = Calendar.getInstance(); //得到日历
calendar.setTime(now);//把当前时间赋给日历
calendar.add(Calendar.MONTH, n);
return calendar.getTime();
}
/**
* 根据开始时间和结束时间返回时间段内的时间集合
*
* @param beginDate
* @param endDate
* @return List
*/
public static List<Date> getDatesBetweenTwoDate(Date beginDate, Date endDate) {
List<Date> lDate = new ArrayList<Date>();
lDate.add(beginDate);// 把开始时间加入集合
Calendar cal = Calendar.getInstance();
// 使用给定的 Date 设置此 Calendar 的时间
cal.setTime(beginDate);
boolean bContinue = true;
while (bContinue) {
// 根据日历的规则,为给定的日历字段添加或减去指定的时间量
cal.add(Calendar.DAY_OF_MONTH, 1);
// 测试此日期是否在指定日期之后
if (endDate.after(cal.getTime())) {
lDate.add(cal.getTime());
} else {
break;
}
}
lDate.add(endDate);// 把结束时间加入集合
return lDate;
}
//正式变负数
public static int unAbs(int a) {
return (a > 0) ? -a : a;
}
}
package com.example.utils;
import java.util.UUID;
/**
* Created by Administrator on 2017/4/20.
*/
public class RandomStringUtils extends org.apache.commons.lang3.RandomStringUtils {
public static final String ARTICLE_KEY_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
public static String getString() {
return UUID.randomUUID().toString().replace("-", "");
}
/**
* 根据字母表生成指定位数随机字符串
*
* @param length 随机长度
* @return 随机字符串
*/
public static String getString(int length) {
return random(length, ARTICLE_KEY_ALPHABET);
}
}
package com.example.utils;
import sun.misc.BASE64Encoder;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Random;
/**
* Created by JA on 17/4/19.
*/
public class ValidateCode {
// 图片的宽度。
private int width = 160;
// 图片的高度。
private int height = 40;
// 验证码字符个数
private int codeCount = 5;
// 验证码干扰线数
private int lineCount = 150;
// 验证码
private String code = null;
// 验证码图片Buffer
private BufferedImage buffImg = null;
// 验证码范围,去掉0(数字)和O(拼音)容易混淆的(小写的1和L也可以去掉,大写不用了)
private char[] codeSequence = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
/**
* 默认构造函数,设置默认参数
*/
public ValidateCode() {
this.createCode();
}
/**
* @param width 图片宽
* @param height 图片高
*/
public ValidateCode(int width, int height) {
this.width = width;
this.height = height;
this.createCode();
}
/**
* @param width 图片宽
* @param height 图片高
* @param codeCount 字符个数
* @param lineCount 干扰线条数
*/
public ValidateCode(int width, int height, int codeCount, int lineCount) {
this.width = width;
this.height = height;
this.codeCount = codeCount;
this.lineCount = lineCount;
this.createCode();
}
public void createCode() {
int x = 0, fontHeight = 0, codeY = 0;
int red = 0, green = 0, blue = 0;
x = width / (codeCount + 2);//每个字符的宽度(左右各空出一个字符)
fontHeight = height - 2;//字体的高度
codeY = height - 4;
// 图像buffer
buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = buffImg.createGraphics();
// 生成随机数
Random random = new Random();
// 将图像填充为白色
g.setColor(Color.WHITE);
g.fillRect(0, 0, width, height);
// 创建字体,可以修改为其它的
Font font = new Font("Fixedsys", Font.PLAIN, fontHeight);
// Font font = new Font("Times New Roman", Font.ROMAN_BASELINE, fontHeight);
g.setFont(font);
for (int i = 0; i < lineCount; i++) {
// 设置随机开始和结束坐标
int xs = random.nextInt(width);//x坐标开始
int ys = random.nextInt(height);//y坐标开始
int xe = xs + random.nextInt(width / 8);//x坐标结束
int ye = ys + random.nextInt(height / 8);//y坐标结束
// 产生随机的颜色值,让输出的每个干扰线的颜色值都将不同。
red = random.nextInt(255);
green = random.nextInt(255);
blue = random.nextInt(255);
g.setColor(new Color(red, green, blue));
g.drawLine(xs, ys, xe, ye);
}
// randomCode记录随机产生的验证码
StringBuffer randomCode = new StringBuffer();
// 随机产生codeCount个字符的验证码。
for (int i = 0; i < codeCount; i++) {
String strRand = String.valueOf(codeSequence[random.nextInt(codeSequence.length)]);
// 产生随机的颜色值,让输出的每个字符的颜色值都将不同。
red = random.nextInt(255);
green = random.nextInt(255);
blue = random.nextInt(255);
g.setColor(new Color(red, green, blue));
g.drawString(strRand, (i + 1) * x, codeY);
// 将产生的四个随机数组合在一起。
randomCode.append(strRand);
}
// 将四位数字的验证码保存到Session中。
code = randomCode.toString();
}
// public void write(String path) throws IOException {
// OutputStream sos = new FileOutputStream(path);
// this.write(sos);
// }
public String getBASE64() throws IOException {
// ImageIO.write(buffImg, "png", sos);
// sos.close();
String imageString = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
ImageIO.write(buffImg, "png", bos);
byte[] imageBytes = bos.toByteArray();
BASE64Encoder encoder = new BASE64Encoder();
imageString = encoder.encode(imageBytes);
bos.close();
} catch (IOException e) {
e.printStackTrace();
}
return imageString;
}
public BufferedImage getBuffImg() {
return buffImg;
}
public String getCode() {
return code;
}
}
package com.example.utils.check;
import javax.servlet.http.HttpServletRequest;
/**
* Created by Administrator on 2017/4/1.
*/
public class CheckRefererUtils {
public static boolean checkReferer(HttpServletRequest request){
return true;
// String referer = request.getHeader("REFERER");
// String host = "lucky.csair.com";
//
// System.out.println("开始校验 referer:"+referer);
// if(referer == null || referer.indexOf(host) < 0){
// System.out.println("referer错误 referer:"+referer);
// return false;
// }
// return true;
}
}
package com.example.utils.dun;
import java.util.HashMap;
import java.util.Map;
import com.example.utils.dun.CheckResult;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.example.utils.dun.utils.HttpClient4Utils;
import com.example.utils.dun.utils.SignatureUtils;
public abstract class AbstProtectionChecker {
private String apiUrl;
private String secretId;
private String secretKey;
private String businessId;
protected String getApiUrl() {
return apiUrl;
}
protected String getSecretId() {
return secretId;
}
protected String getSecretKey() {
return secretKey;
}
protected String getBusinessId() {
return businessId;
}
protected AbstProtectionChecker(String apiUrl, String secretId, String secretKey, String businessId) {
this.apiUrl = apiUrl;
this.secretId = secretId;
this.secretKey = secretKey;
this.businessId = businessId;
}
private CheckResult check(Map<String, String> params) {
try {
String response = HttpClient4Utils.sendPost(this.apiUrl, params);
System.out.println(response);
// 解析响应
JsonObject jObject = new JsonParser().parse(response).getAsJsonObject();
int code = jObject.get("code").getAsInt();
String msg = jObject.get("msg").getAsString();
if (code == 200) {
// code==200说明接口正常
JsonObject dataObject = jObject.getAsJsonObject("result");
int action = dataObject.get("action").getAsInt();
if (action == 0) {
return CheckResult.NORMAL;
} else if (action == 10) {
return CheckResult.SUSPECT;
} else if (action == 20) {
return CheckResult.FATAL;
}
} else {
// 接口调用出现错误
// 请根据错误码 和 错误消息判断原因
System.err.println(String.format("ERROR: code=%d, msg=%s", code, msg));
}
} catch (Exception e) {
// log
System.out.println("接口调用异常(超时 等),当作[正常]处理");
}
return CheckResult.NORMAL;
}
/**
* 通过token查询结果
*
* @param token 前端提交的查询token
* @param businessParams 业务数据
* @return
* @throws Exception
*/
public CheckResult check(String token, Map<String, String> businessParams) throws Exception {
Map<String, String> params = new HashMap<String, String>();
params.put("version", "v1");
params.put("secretId", getSecretId());
params.put("businessId", getBusinessId());
params.put("timestamp", System.currentTimeMillis() / 1000 + "");
params.put("nonce", Math.random() + "");
params.put("token", token);
if (businessParams != null) {
params.putAll(businessParams);
}
// 生成签名,参见签名过程的示例代码
params.put("signature", SignatureUtils.genSignature(getSecretKey(), params));
return check(params);
}
}
package com.example.utils.dun;
public class ActivityProtectionChecker extends AbstProtectionChecker {
/**
* 活动反作弊检测接口地址
*/
private static final String API_URL = "https://ac.dun.163yun.com/v1/activity/check";
/**
*
* @param secretId 产品密钥ID
* @param secretKey 产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露
* @param businessId 业务ID,易盾根据产品业务特点分配
*/
public ActivityProtectionChecker(String secretId, String secretKey, String businessId) {
super(API_URL, secretId, secretKey, businessId);
}
}
package com.example.utils.dun;
public enum CheckResult {
/**
* 正常
*/
NORMAL,
/**
* 嫌疑
*/
SUSPECT,
/**
* 致命
*/
FATAL
}
package com.example.utils.dun.utils;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
public class HttpClient4Utils {
private static HttpClient defaultClient = createHttpClient(20, 20, 5000, 5000, 3000);
/**
* 实例化HttpClient
*
* @param maxTotal
* @param maxPerRoute
* @param socketTimeout
* @param connectTimeout
* @param connectionRequestTimeout
* @return
*/
public static HttpClient createHttpClient(int maxTotal, int maxPerRoute, int socketTimeout, int connectTimeout,
int connectionRequestTimeout) {
RequestConfig defaultRequestConfig = RequestConfig.custom().setSocketTimeout(socketTimeout)
.setConnectTimeout(connectTimeout).setConnectionRequestTimeout(connectionRequestTimeout).build();
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
cm.setMaxTotal(maxTotal);
cm.setDefaultMaxPerRoute(maxPerRoute);
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm)
.setDefaultRequestConfig(defaultRequestConfig).build();
return httpClient;
}
/**
* 发送post请求
*
* @param httpClient
* @param url 请求地址
* @param params 请求参数
* @param encoding 编码
* @return
*/
public static String sendPost(HttpClient httpClient, String url, Map<String, String> params, Charset encoding) {
String resp = "";
HttpPost httpPost = new HttpPost(url);
if (params != null && params.size() > 0) {
List<NameValuePair> formParams = new ArrayList<NameValuePair>();
Iterator<Map.Entry<String, String>> itr = params.entrySet().iterator();
while (itr.hasNext()) {
Map.Entry<String, String> entry = itr.next();
formParams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
UrlEncodedFormEntity postEntity = new UrlEncodedFormEntity(formParams, encoding);
httpPost.setEntity(postEntity);
}
CloseableHttpResponse response = null;
try {
response = (CloseableHttpResponse) httpClient.execute(httpPost);
resp = EntityUtils.toString(response.getEntity(), encoding);
} catch (Exception e) {
// log
e.printStackTrace();
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
// log
e.printStackTrace();
}
}
}
return resp;
}
/**
* 发送post请求
* @param url 请求地址
* @param params 请求参数
* @return
*/
public static String sendPost(String url, Map<String, String> params) {
Charset encoding = Charset.forName("utf8");
return sendPost(defaultClient, url, params, encoding);
}
}
\ No newline at end of file
package com.example.utils.dun.utils;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.Map;
import org.apache.commons.codec.digest.DigestUtils;
public class SignatureUtils {
/**
* 生成签名信息
* @param secretKey 产品私钥
* @param params 接口请求参数名和参数值map,不包括signature参数名
* @return
* @throws UnsupportedEncodingException
*/
public static String genSignature(String secretKey, Map<String, String> params) throws UnsupportedEncodingException {
// 1. 参数名按照ASCII码表升序排序
String[] keys = params.keySet().toArray(new String[0]);
Arrays.sort(keys);
// 2. 按照排序拼接参数名与参数值
StringBuffer paramBuffer = new StringBuffer();
for (String key : keys) {
paramBuffer.append(key).append(params.get(key) == null ? "" : params.get(key));
}
// 3. 将secretKey拼接到最后
paramBuffer.append(secretKey);
// 4. MD5是128位长度的摘要算法,用16进制表示,一个十六进制的字符能表示4个位,所以签名后的字符串长度固定为32个十六进制字符。
return DigestUtils.md5Hex(paramBuffer.toString().getBytes("UTF-8"));
}
}
package com.example.utils.email;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
/**
* Created by JA on 17/4/6.
*/
public class Authentication extends Authenticator {
String username=null;
String password=null;
public Authentication(){
}
public Authentication(String username, String password) {
this.username = username;
this.password = password;
}
protected PasswordAuthentication getPasswordAuthentication(){
PasswordAuthentication pa = new PasswordAuthentication(username, password);
return pa;
}
}
\ No newline at end of file
package com.example.utils.email;
import org.apache.commons.lang3.StringUtils;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.*;
import javax.mail.internet.*;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.Properties;
/**
* 邮件发送工具类
*/
public class SendMailUtil {
/**
* 邮件发送的方法
*
* @param to 收件人
* @param subject 主题
* @param content 内容
* @param smtp 协议
* @param host 发送服务器服务器
* @param sendName 邮件发送人
* @param sendPort 邮件发送人端口
* @param userName 邮件发送人名
* @param userPwd 邮件发送人密码
* @return 成功或失败
*/
public static boolean send(String to, String subject, String content,String nickname, String smtp, String host,
String sendName, String sendPort, String userName, String userPwd) {
// 第一步:创建Session
Properties props = new Properties();
// 指定邮件的传输协议,smtp(Simple Mail Transfer Protocol 简单的邮件传输协议)
props.put("mail.transport.protocol", smtp);
// 指定邮件发送服务器服务器 "smtp.qq.com"
props.put("mail.host", host);
// 指定邮件的发送人(您用来发送邮件的服务器,比如您的163\sina等邮箱)
props.put("mail.from", sendName);
if (true) {
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.socketFactory.port", sendPort);
}
props.put("mail.smtp.auth", "true");
Authentication authentication = new Authentication(userName, userPwd);
Session session = Session.getDefaultInstance(props, authentication);
// 开启调试模式
session.setDebug(true);
try {
// 第二步:获取邮件发送对象
Transport transport = session.getTransport();
// 连接邮件服务器,链接您的163、sina邮箱,用户名(不带@163.com,登录邮箱的邮箱账号,不是邮箱地址)、密码
transport.connect(userName, userPwd);
Address toAddress = new InternetAddress(to);
// 第三步:创建邮件消息体
MimeMessage message = new MimeMessage(session);
MimeMultipart multipart = new MimeMultipart("related");
//设置自定义发件人昵称
String nick="";
try {
nick=javax.mail.internet.MimeUtility.encodeText(nickname);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// message.setFrom(new InternetAddress(nick+" <"+sendName+">"));
//设置发信人
message.setFrom(new InternetAddress(sendName));
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(content, "text/html;charset=utf-8");
// 邮件的主题
message.setSubject(subject);
//收件人
message.addRecipient(Message.RecipientType.TO, toAddress);
/*//抄送人
Address ccAddress = new InternetAddress("first.lady@whitehouse.gov");
message.addRecipient(Message.RecipientType.CC, ccAddress);*/
multipart.addBodyPart(messageBodyPart);
// 邮件的内容
message.setContent(multipart);
// 邮件发送时间
message.setSentDate(new Date());
// 第四步:发送邮件
// 第一个参数:邮件的消息体
// 第二个参数:邮件的接收人,多个接收人用逗号隔开(test1@163.com,test2@sina.com)
transport.sendMessage(message, InternetAddress.parse(to));
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/**
* 邮件发送的方法,带附件
*
* @param to 收件人, 多个Email以英文逗号分隔
* @param cc 抄送, 多个Email以英文逗号分隔
* @param subject 主题
* @param content 内容
* @param smtp 协议
* @param host 发送服务器服务器
* @param sendName 邮件发送人
* @param sendPort 邮件发送人端口
* @param userName 邮件发送人名
* @param userPwd 邮件发送人密码
* @param files 附件 (路径+文件名)
* @return 成功或失败
*/
public static boolean sendMail(String to, String cc, String subject, String content,String nickname, String smtp,
String host, String sendName, String sendPort, String userName,
String userPwd, String[] files) {
System.out.println("cc:" + cc);
// 第一步:创建Session
Properties props = new Properties();
// 指定邮件的传输协议,smtp(Simple Mail Transfer Protocol 简单的邮件传输协议)
props.put("mail.transport.protocol", smtp);
// 指定邮件发送服务器服务器 "smtp.qq.com"
props.put("mail.host", host);
// 指定邮件的发送人(您用来发送邮件的服务器,比如您的163\sina等邮箱)
props.put("mail.from", sendName);
if (true) {
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.socketFactory.port", sendPort);
}
props.put("mail.smtp.auth", "true");
Authentication authentication = new Authentication(userName, userPwd);
Session session = Session.getDefaultInstance(props, authentication);
// 开启调试模式
session.setDebug(true);
try {
// 第二步:获取邮件发送对象
Transport transport = session.getTransport();
// 连接邮件服务器,链接您的163、sina邮箱,用户名(不带@163.com,登录邮箱的邮箱账号,不是邮箱地址)、密码
transport.connect(userName, userPwd);
// Address toAddress = new InternetAddress(to);
// 第三步:创建邮件消息体
MimeMessage message = new MimeMessage(session);
MimeMultipart multipart = new MimeMultipart("related");
//设置自定义发件人昵称
String nick="";
try {
nick=javax.mail.internet.MimeUtility.encodeText(nickname);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
message.setFrom(new InternetAddress(nick+" <"+sendName+">"));
//设置发信人
// message.setFrom(new InternetAddress(sendName));
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(content, "text/html;charset=utf-8");
// 邮件的主题
message.setSubject(subject);
//收件人
message.addRecipients(Message.RecipientType.TO, InternetAddress.parse(to));
//抄送人
if(StringUtils.isNotBlank(cc)){
// Address ccAddress = new InternetAddress(cc);
message.addRecipients(Message.RecipientType.CC, InternetAddress.parse(cc));
}
multipart.addBodyPart(messageBodyPart);
// 邮件的内容
message.setContent(multipart);
// 邮件发送时间
message.setSentDate(new Date());
/*添加附件*/
if(files != null){
for (String file : files) {
MimeBodyPart bp = new MimeBodyPart();
FileDataSource fileds = new FileDataSource(file);
bp.setDataHandler(new DataHandler(fileds));
bp.setFileName(MimeUtility.encodeText(fileds.getName(), "UTF-8", "B"));
multipart.addBodyPart(bp);
}
}
// 第四步:发送邮件
// 第一个参数:邮件的消息体
// 第二个参数:邮件的接收人,多个接收人用逗号隔开(test1@163.com,test2@sina.com)
transport.sendMessage(message, InternetAddress.parse(to));
// transport.sendMessage(message, InternetAddress.parse(cc));
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}
package com.example.utils.file;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
/**
* Created by JA on 17/7/3.
*/
public class DefaultFileUpload {
/**
* 快速上传,等同于调用另外一个uplaod方法
*
* @param file MultipartFile 对象,不能为空
* @return FileUploadInfo
*/
public static FileUploadInfo directUpload(String home, MultipartFile file) {
return new DefaultFileUpload().upload(home,file);
}
public FileUploadInfo upload(String home,MultipartFile file) {
try {
InputStream inputStream = file.getInputStream();
String savePath = home;
String originFileName = file.getOriginalFilename();
String suffix = FileType.getSuffixByFilename(originFileName);
String url = savePath + "/" + getRandomString() + suffix;
File filePath = new File(url);
File parentFile = filePath.getParentFile();
if (!parentFile.exists()) {
parentFile.mkdirs(); // create dirs
}
// filePath.createNewFile();
inputstreamtofile(inputStream,filePath);
// file.transferTo(filePath);
return new FileUploadInfo(true, originFileName, file.getSize(), url.replace(home, ""), suffix);
} catch (IOException e) {
e.printStackTrace();
// logger.error("file upload fail!", e);
FileUploadInfo fileUploadInfo = new FileUploadInfo(false, null, 0, null, null);
fileUploadInfo.setStateMsg(e.getMessage());
return fileUploadInfo;
}
}
public FileUploadInfo uploadBase64(String home,String base64) {
try {
BASE64Decoder decoder = new BASE64Decoder();
String savePath = home;
String suffix = base64.substring(base64.indexOf('/') + 1, base64.indexOf(';'));
String str1 = base64.split(",")[1];
base64 = str1;
String url = savePath + "/" + getRandomString()+"." + suffix;
// File filePath = new File(url);
// filePath.createNewFile();
//对字节数组字符串进行Base64解码并生成图片
if (base64 == null){
FileUploadInfo fileUploadInfo = new FileUploadInfo(false, null, 0, null, null);
fileUploadInfo.setStateMsg("");
return fileUploadInfo;
}
//Base64解码
byte[] bytes = decoder.decodeBuffer(base64);
OutputStream out = new FileOutputStream(url);
out.write(bytes);
out.flush();
out.close();
// file.transferTo(filePath);
return new FileUploadInfo(true, "", 0, url.replace(home, ""), suffix);
} catch (Exception e) {
e.printStackTrace();
// logger.error("file upload fail!", e);
FileUploadInfo fileUploadInfo = new FileUploadInfo(false, null, 0, null, null);
fileUploadInfo.setStateMsg(e.getMessage());
return fileUploadInfo;
}
}
public static void inputstreamtofile(InputStream ins,File file) {
try {
OutputStream os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
ins.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private String getDateTime(String format) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
return simpleDateFormat.format(new Date());
}
private String getRandomString() {
return UUID.randomUUID().toString().replace("-", "");
}
}
\ No newline at end of file
package com.example.utils.file;
import java.util.HashMap;
import java.util.Map;
/**
* Created by caobug on 15/5/22.
*/
public class FileType {
public static final String JPG = "JPG";
private static final Map<String, String> types = new HashMap<String, String>() {{
put(FileType.JPG, ".jpg");
}};
public static String getSuffix(String key) {
return FileType.types.get(key);
}
/**
* 根据给定的文件名,获取其后缀信息
*
* @param filename
* @return
*/
public static String getSuffixByFilename(String filename) {
return filename.substring(filename.lastIndexOf(".")).toLowerCase();
}
/**
* 根据给定的文件名,获取文件类型
*
* @param filename
* @return
*/
public static String getFileType(String filename) {
return filename.substring(filename.lastIndexOf(".") + 1).toLowerCase();
}
}
package com.example.utils.file;
/**
* Created by JA on 17/7/3.
*/
/**
* 文件上传信息
* <p/>
* Created by caobug on 15/5/22.
*/
public class FileUploadInfo {
private boolean state; // 上传状态
private String stateMsg;// 状态消息
private String originalName; // 原始文件名
private long size; // 文件大小
private String url; // 文件保存路径
private String suffix; // 后缀
public FileUploadInfo(boolean state, String originalName, long size, String url, String suffix) {
this.state = state;
this.originalName = originalName;
this.size = size;
this.url = url;
this.suffix = suffix;
}
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
public String getOriginalName() {
return originalName;
}
public void setOriginalName(String originalName) {
this.originalName = originalName;
}
public long getSize() {
return size;
}
public void setSize(long size) {
this.size = size;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getSuffix() {
return suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
public String getStateMsg() {
return stateMsg;
}
public void setStateMsg(String stateMsg) {
this.stateMsg = stateMsg;
}
}
package com.example.utils.md5;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
/**
* Created by caobug on 14/11/20.
*/
public class MD5Utils {
public static String hash(String str) {
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
byte[] array = md.digest(str.getBytes());
StringBuilder sb = new StringBuilder();
for (byte anArray : array) {
sb.append(Integer.toHexString((anArray & 0xFF) | 0x100).substring(1, 3));
}
return sb.toString();
} catch (java.security.NoSuchAlgorithmException ignored) {
}
return "";
}
private static String byteArrayToHexString(byte b[]) {
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < b.length; i++)
resultSb.append(byteToHexString(b[i]));
return resultSb.toString();
}
private static String byteToHexString(byte b) {
int n = b;
if (n < 0)
n += 256;
int d1 = n / 16;
int d2 = n % 16;
return hexDigits[d1] + hexDigits[d2];
}
public static String MD5Encode(String origin, String charsetname) {
String resultString = null;
try {
resultString = new String(origin);
MessageDigest md = MessageDigest.getInstance("MD5");
if (charsetname == null || "".equals(charsetname))
resultString = byteArrayToHexString(md.digest(resultString
.getBytes()));
else
resultString = byteArrayToHexString(md.digest(resultString
.getBytes(charsetname)));
} catch (Exception exception) {
}
return resultString;
}
public static String getMd5ByFile(File file) throws FileNotFoundException {
String value = null;
FileInputStream in = new FileInputStream(file);
try {
MappedByteBuffer byteBuffer = in.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, file.length());
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(byteBuffer);
BigInteger bi = new BigInteger(1, md5.digest());
value = bi.toString(16);
} catch (Exception e) {
e.printStackTrace();
} finally {
if(null != in) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return value;
}
private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
}
\ No newline at end of file
package com.example.utils.mybatis;
import com.example.utils.mybatis.pageable.MybatisPageableInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.TransactionManagementConfigurer;
import javax.sql.DataSource;
@Configuration
@EnableTransactionManagement
public class MyBatisConfig implements TransactionManagementConfigurer {
@Autowired
DataSource dataSource;
@Value("${mybatis.mapperLocations}")
private String mybatismapperLocations;
@Autowired
MybatisPageableInterceptor mybatisPageableInterceptor;
@Bean(name = "sqlSessionFactory")
public SqlSessionFactory sqlSessionFactoryBean() {
System.out.println("sqlSessionFactory=============");
System.out.println("sqlSessionFactory=============");
System.out.println("sqlSessionFactory=============");
System.out.println("sqlSessionFactory=============");
System.out.println("sqlSessionFactory=============");
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
//添加分页插件
bean.setPlugins(new Interceptor[]{mybatisPageableInterceptor});
//添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
try {
// SqlSessionFactory sqlSessionFactory = bean.getObject();
// org.apache.ibatis.session.Configuration configuration = sqlSessionFactory.getConfiguration();
// //支持驼峰
// configuration.setMapUnderscoreToCamelCase(true);
bean.setMapperLocations(resolver.getResources(mybatismapperLocations));
SqlSessionFactory sqlSessionFactory = bean.getObject();
sqlSessionFactory.getConfiguration().setMapUnderscoreToCamelCase(true);// 开启驼峰映射
return sqlSessionFactory;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
@Bean
public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
@Bean
@Override
public PlatformTransactionManager annotationDrivenTransactionManager() {
return new DataSourceTransactionManager(dataSource);
}
}
\ No newline at end of file
package com.example.utils.mybatis.pageable;
public class Dialect {
public boolean supportsLimit() {
return false;
}
public boolean supportsLimitOffset() {
return supportsLimit();
}
/**
* 将sql变成分页sql语句,直接使用offset,limit的值作为占位符.</br> 源代码为:
* getLimitString(sql,offset
* ,String.valueOf(offset),limit,String.valueOf(limit))
*/
public String getLimitString(String sql, int offset, int limit) {
return getLimitString(sql, offset, Integer.toString(offset), limit,
Integer.toString(limit));
}
/**
* 将sql变成分页sql语句,提供将offset及limit使用占位符(placeholder)替换.
* <p/>
* <pre>
* 如mysql
* dialect.getLimitString("select * from user", 12, ":offset",0,":limit") 将返回
* select * from user limit :offset,:limit
* </pre>
*
* @return 包含占位符的分页sql
*/
public String getLimitString(String sql, int offset,
String offsetPlaceholder, int limit, String limitPlaceholder) {
throw new UnsupportedOperationException("paged queries not supported");
}
/**
* 将sql转换为总记录数SQL
*
* @param sql SQL语句
* @return 总记录数的sql
*/
public String getCountString(String sql) {
return "select count(1) from (" + sql + ") tmp_count";
}
/**
* 将sql转换为带排序的SQL
*
* @param sql
* SQL语句
* @return 总记录数的sql
*/
// public String getSortString(String sql, List<Order> orders) {
// if (orders == null || orders.isEmpty()) {
// return sql;
// }
//
// StringBuffer buffer = new StringBuffer("select * from (").append(sql)
// .append(") temp_order order by ");
// for (Order order : orders) {
// if (order != null) {
// buffer.append(order.toString()).append(", ");
// }
//
// }
// buffer.delete(buffer.length() - 2, buffer.length());
// return buffer.toString();
// }
}
package com.example.utils.mybatis.pageable;
public class MySQLDialect extends Dialect {
public boolean supportsLimitOffset() {
return true;
}
public boolean supportsLimit() {
return true;
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder) {
if (offset > 0) {
return sql + " limit " + offsetPlaceholder + "," + limitPlaceholder;
} else {
return sql + " limit " + limitPlaceholder;
}
}
}
\ No newline at end of file
package com.example.utils.mybatis.pageable;
public class OracleDialect extends Dialect {
public boolean supportsLimit() {
return true;
}
public boolean supportsLimitOffset() {
return true;
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder) {
sql = sql.trim();
boolean isForUpdate = false;
if (sql.toLowerCase().endsWith(" for update")) {
sql = sql.substring(0, sql.length() - 11);
isForUpdate = true;
}
StringBuffer pagingSelect = new StringBuffer(sql.length() + 100);
if (offset > 0) {
pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");
} else {
pagingSelect.append("select * from ( ");
}
pagingSelect.append(sql);
if (offset > 0) {
// int end = offset+limit;
String endString = offsetPlaceholder + "+" + limitPlaceholder;
pagingSelect.append(" ) row_ ) where rownum_ <= " + endString + " and rownum_ > " + offsetPlaceholder);
} else {
pagingSelect.append(" ) where rownum <= " + limitPlaceholder);
}
if (isForUpdate) {
pagingSelect.append(" for update");
}
return pagingSelect.toString();
}
}
package com.example.utils.mybatis.pageable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/**
* 分页对象, 存放单页数据
*/
public class Page<T> {
private static final long serialVersionUID = 867755909294344406L;
private final List<T> content = new ArrayList<T>();
private final Pageable pageable;
private final long total;
public Page(List<T> content, Pageable pageable, long total) {
if (null == content) {
throw new IllegalArgumentException("Content must not be null!");
}
this.content.addAll(content);
this.total = total;
this.pageable = pageable;
}
public Page(List<T> content) {
this(content, null, null == content ? 0 : content.size());
}
/**
* 请求页面
*
* @return
*/
public int getNumber() {
return pageable == null ? 0 : pageable.getPageNumber();
}
/**
* page size
*
* @return
*/
public int getSize() {
return pageable == null ? 0 : pageable.getPageSize();
}
/**
* 总页数
*
* @return
*/
public int getTotalPages() {
return getSize() == 0 ? 1 : (int) Math.ceil((double) total / (double) getSize());
}
/**
* 当前页记录条数
*
* @return
*/
public int getNumberOfElements() {
return content.size();
}
/**
* 总记录条数
*
* @return
*/
public long getTotalElements() {
return total;
}
/**
* 是否有上一页
*
* @return
*/
public boolean hasPreviousPage() {
return getNumber() > 0;
}
/**
* 是否首页
*
* @return
*/
public boolean isFirstPage() {
return !hasPreviousPage();
}
/**
* 是否有下一页
*
* @return
*/
public boolean hasNextPage() {
return getNumber() + 1 < getTotalPages();
}
/**
* 是否末页
*
* @return
*/
public boolean isLastPage() {
return !hasNextPage();
}
/**
* 下一页请求对象
*
* @return
*/
public Pageable nextPageable() {
return hasNextPage() ? pageable.next() : null;
}
/**
* 上一页请求对象
*
* @return
*/
public Pageable previousPageable() {
if (hasPreviousPage()) {
return pageable.previousOrFirst();
}
return null;
}
/**
* 迭代器
*
* @return
*/
public Iterator<T> iterator() {
return content.iterator();
}
/**
* 当前页元素列表
*
* @return
*/
public List<T> getContent() {
return Collections.unmodifiableList(content);
}
/**
* 当前页是否有元素
*
* @return
*/
public boolean hasContent() {
return !content.isEmpty();
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
String contentType = "UNKNOWN";
if (content.size() > 0) {
contentType = content.get(0).getClass().getName();
}
return String.format("Page %s of %d containing %s instances", getNumber(), getTotalPages(), contentType);
}
}
package com.example.utils.mybatis.pageable;
/**
* 分页请求对象
*/
public class Pageable {
private static final long serialVersionUID = 7280485938848398236L;
private final int page;
private final int size;
/**
* 是否查询总记录数
*/
private final boolean countable;
/**
* @param page the page no you want to request, start from 0
* @param size page size
*/
public Pageable(int page, int size) {
this(page, size, true);
}
/**
* @param page the page no you want to request, start from 0
* @param size page size
* @param countable whether count total numbers
*/
public Pageable(int page, int size, boolean countable) {
if (page < 0) {
throw new IllegalArgumentException("Page index must not be less than zero!");
}
if (size < 0) {
throw new IllegalArgumentException("Page size must not be less than zero!");
}
this.page = page;
this.size = size;
this.countable = countable;
}
public boolean getCountable() {
return countable;
}
public int getPageSize() {
return size;
}
public int getPageNumber() {
return page;
}
public int getOffset() {
return page * size - size;
}
public boolean hasPrevious() {
return page > 0;
}
public Pageable next() {
return new Pageable(page + 1, size);
}
public Pageable previousOrFirst() {
return hasPrevious() ? new Pageable(page - 1, size) : this;
}
public Pageable first() {
return new Pageable(0, size);
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return String.format("Page request [number: %d, size %d, sort: %s]", page, size);
}
}
#data source
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/csair_dp?useUnicode=true&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5
spring.datasource.validation-query=SELECT 1
spring.datasource.test-on-borrow=false
spring.datasource.test-while-idle=true
spring.datasource.time-between-eviction-runs-millis=18800
spring.datasource.jdbc-interceptors=ConnectionState;SlowQueryReport(threshold=0)
#mybatis
mybatis.mapperLocations=classpath*:mappers/*.xml
mybatis.configLocation=classpath:/mybatis-config.xml
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
<configuration scan="true" scanPeriod="10 seconds">
<!-- Simple file output -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>
[ %-5level] [%date{yyyy-MM-dd HH:mm:ss}] %logger{96} [%line] - %msg%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily 配置日志所生成的目录以及生成文件名的规则 -->
<fileNamePattern>logs/catalina-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<!-- Safely log to the same file from multiple JVMs. Degrades performance! -->
<prudent>true</prudent>
</appender>
<!-- Console output -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>
[ %-5level] [%date{yyyy-MM-dd HH:mm:ss}] %logger{96} [%line] - %msg%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- Only log level WARN and above -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
<!-- Enable FILE and STDOUT appenders for all log messages.
By default, only log at level INFO and above. -->
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
<!-- For loggers in the these namespaces, log at all levels. -->
<logger name="pedestal" level="ALL" />
<logger name="hammock-cafe" level="ALL" />
<logger name="user" level="ALL" />
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.example.mapper.log.HttpLogMapper">
<insert id="create" parameterType="com.example.models.log.HttpLog" useGeneratedKeys="true" keyProperty="id">
INSERT INTO t_http_log (
url,
param,
app_id,
create_at,
restful
)
VALUES (
#{url},
#{param},
#{app_id},
#{create_at},
#{restful}
)
</insert>
<update id="update">
update t_http_log set restful = #{restful} where id = #{id}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.example.mapper.api.MemberInfoMapper">
<insert id="create" parameterType="com.example.models.api.MemberInfo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO t_hpai_member_info (
source,
`timestamp`,
barcode,
channel_id,
manager_id,
`name`,
gender,
birthday_str,
mobile_number,
sampling_date,
recipients,
address,
family_disease,
existing_disease,
weight,
height,
remarks,
member_number,
create_at,
status
)
VALUES (
#{source},
#{timestamp},
#{barcode},
#{channelId},
#{managerId},
#{name},
#{gender},
#{birthdayStr},
#{mobileNumber},
#{samplingDate},
#{recipients},
#{address},
#{familyDisease},
#{existingDisease},
#{weight},
#{height},
#{remarks},
#{memberNumber},
#{createAt},
#{status}
);
</insert>
<select id="getByMobileNumber" resultType="com.example.models.api.MemberInfo">
select * from t_hpai_member_info where mobile_number = #{mobileNumber} limit 1;
</select>
<update id="genereport">
update t_hpai_member_info set
is_genereport = #{isGenereport},
genereport_at = #{genereportAt},
pack_name = #{packName},
pdf_name = #{pdfName},
url = #{url},
genereport_name = #{genereportName} where mobile_number = #{mobileNumber};
</update>
<select id="list" resultType="com.example.models.api.MemberInfo">
select * from t_hpai_member_info where 1 = 1
<if test="keyWord != null and keyWord != ''">
and `name` LIKE CONCAT('%', #{keyWord}, '%')
</if>
<if test="status != -1">
and is_genereport = #{status}
</if>
</select>
<select id="count" resultType="int">
select count(*) c from t_hpai_member_info where 1 = 1
<if test="keyWord != null and keyWord != ''">
and `name` LIKE CONCAT('%', #{keyWord}, '%')
</if>
<if test="status != -1">
and is_genereport = #{status}
</if>
</select>
<select id="registerByDay" resultType="map">
select count(*) c,DATE_FORMAT(create_at,'%Y-%m-%d') d from t_hpai_member_info
where create_at BETWEEN #{startTime} and #{endTime}
group by DATE_FORMAT(create_at,'%Y-%m-%d')
</select>
<select id="genereportByDay" resultType="map">
select count(*) c,DATE_FORMAT(genereport_at,'%Y-%m-%d') d from t_hpai_member_info
where is_genereport = 1 and create_at BETWEEN #{startTime} and #{endTime} group by DATE_FORMAT(genereport_at,'%Y-%m-%d')
</select>
<select id="registerByMonth" resultType="map">
select count(*) c,DATE_FORMAT(create_at,'%Y-%m') d from t_hpai_member_info
where create_at BETWEEN #{startTime} and #{endTime}
group by DATE_FORMAT(create_at,'%Y-%m')
</select>
<select id="genereportByMonth" resultType="map">
select count(*) c,DATE_FORMAT(genereport_at,'%Y-%m') d from t_hpai_member_info
where is_genereport = 1 and create_at BETWEEN #{startTime} and #{endTime} group by DATE_FORMAT(genereport_at,'%Y-%m')
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!--该配置影响的所有映射器中配置的二级缓存的全局开关。-->
<setting name="cacheEnabled" value="false"/>
<!--延迟加载的全局开关。当开启时,所有关联对象都会延迟加载。特定关联关系中可通过设置fetchType属性来覆盖该项的开关状态。-->
<setting name="lazyLoadingEnabled" value="true"/>
<!--是否允许单一语句返回多结果集(需要兼容驱动)。-->
<setting name="multipleResultSetsEnabled" value="true"/>
<!--使用列标签代替列名。不同的驱动在这方面会有不同的表现,具体可参考相关驱动文档或通过测试这两种不同的模式来观察所用驱动的结果。-->
<setting name="useColumnLabel" value="true"/>
<!--允许 JDBC 支持自动生成主键,需要驱动兼容。如果设置为 true 则这个设置强制使用自动生成主键,尽管一些驱动不能兼容但仍可正常工作(比如 Derby)。-->
<setting name="useGeneratedKeys" value="false"/>
<!--指定 MyBatis 是否以及如何自动映射指定的列到字段或属性。NONE 表示取消自动映射;PARTIAL 只会自动映射没有定义嵌套结果集映射的结果集。FULL 会自动映射任意复杂的结果集(包括嵌套和其他情况)。-->
<setting name="autoMappingBehavior" value="PARTIAL"/>
<!--配置默认的执行器。SIMPLE 就是普通的执行器;REUSE 执行器会重用预处理语句(prepared statements);BATCH 执行器将重用语句并执行批量更新。-->
<setting name="defaultExecutorType" value="SIMPLE"/>
<!--设置超时时间,它决定驱动等待数据库响应的秒数。-->
<setting name="defaultStatementTimeout" value="25"/>
<!--允许在嵌套语句中使用行分界(RowBounds)。-->
<setting name="safeRowBoundsEnabled" value="false"/>
<!--是否开启自动驼峰命名规则(camel case)映射,即从经典数据库列名 A_COLUMN 到经典 Java 属性名 aColumn 的类似映射。-->
<setting name="mapUnderscoreToCamelCase" value="true"/>
<!--MyBatis 利用本地缓存机制(Local Cache)防止循环引用(circular references)和加速重复嵌套查询。默认值为 SESSION,这种情况下会缓存一个会话中执行的所有查询。若设置值为 STATEMENT,本地会话仅用在语句执行上,对相同 SqlSession 的不同调用将不会共享数据。-->
<setting name="localCacheScope" value="SESSION"/>
<!--当没有为参数提供特定的 JDBC 类型时,为空值指定 JDBC 类型。某些驱动需要指定列的 JDBC 类型,多数情况直接用一般类型即可,比如 NULL、VARCHAR 或 OTHER。-->
<setting name="jdbcTypeForNull" value="OTHER"/>
<!--指定哪个对象的方法触发一次延迟加载。-->
<setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
</settings>
<plugins>
<!-- 分页 -->
<plugin interceptor="com.example.utils.pageable.MybatisPageableInterceptor">
<property name="dialectClass" value="com.example.utils.pageable.MySQLDialect"/>
</plugin>
<!-- / 分页 -->
</plugins>
</configuration>
\ No newline at end of file
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `cms_article`;
CREATE TABLE `cms_article` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`model` char(32) DEFAULT NULL,
`seo_keywords` varchar(512) DEFAULT NULL,
`seo_describe` varchar(1024) DEFAULT NULL,
`keywords` varchar(512) DEFAULT NULL,
`column_id` char(32) DEFAULT NULL,
`source` varchar(512) DEFAULT NULL,
`is_promulgate` tinyint(1) DEFAULT NULL,
`is_top` tinyint(1) DEFAULT NULL,
`summary` varchar(512) DEFAULT NULL,
`page_url` varchar(255) DEFAULT NULL,
`status` tinyint(4) DEFAULT NULL,
`creater_id` varchar(64) DEFAULT NULL,
`create_time` bigint(20) DEFAULT NULL,
`promulgate_time` bigint(20) DEFAULT NULL,
`sequence` bigint(20) DEFAULT NULL,
`media_url` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `cms_article_content`;
CREATE TABLE `cms_article_content` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`content` mediumtext,
`article_id` char(32) NOT NULL,
`creater_id` varchar(64) DEFAULT NULL,
`create_time` bigint(20) NOT NULL,
`page` int(11) NOT NULL,
`type` char(16) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat MySQL Data Transfer
Source Server : 127
Source Server Version : 50623
Source Host : localhost
Source Database : demo_st
Target Server Version : 50623
File Encoding : utf-8
Date: 04/14/2016 11:31:53 AM
*/
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `cms_column`
-- ----------------------------
DROP TABLE IF EXISTS `cms_column`;
CREATE TABLE `cms_column` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`column_code` varchar(32) NOT NULL,
`name` varchar(128) NOT NULL,
`sequence` int(11) DEFAULT NULL,
`is_navigation` tinyint(1) DEFAULT NULL,
`target_url` varchar(255) DEFAULT NULL,
`is_publish` tinyint(1) DEFAULT NULL,
`home_model_id` char(32) DEFAULT NULL,
`list_model_id` char(32) DEFAULT NULL,
`parent_id` char(32) DEFAULT NULL,
`status` tinyint(4) DEFAULT NULL,
`creater_id` varchar(64) DEFAULT NULL,
`create_time` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10007 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of `cms_column`
-- ----------------------------
BEGIN;
INSERT INTO `cms_column` VALUES
('10004', 'jiangren', '匠人', '0', '1', null, '1', '0', '0', '0', '1', '', '1460532655677'),
('10005', 'xianchangzhaopian', '现场照片', '0', '1', null, '1', '0', '0', '0', '1', '', '1460600453575'),
('10006', 'meitibaodao', '媒体报道', '0', '1', null, '1', '0', '0', '0', '1', '', '1460600471869');
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `cms_mould`;
CREATE TABLE `cms_mould` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` char(30) DEFAULT NULL COMMENT '模板的名称',
`path` char(255) DEFAULT NULL COMMENT '模板的路径',
`type` int(11) DEFAULT NULL COMMENT '模板的类型',
`default_template` tinyint(1) DEFAULT NULL COMMENT '是否是默认模板',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- insert into `cms_mould`(`id`,`name`,`path`,`type`,`default_template`) values
-- ('077340ef44c040b385641128cc2674e4','联系我们模板','temps/contactus','4','0'),
-- ('11a67ad89d584bf4acea0d5a17fcfd6b','关于我们模板','temps/aboutus','4','0'),
-- ('13fafc32beb048878edf964f7702c1ef','文章页模板','temps/pub','2','0'),
-- ('650383dfa6f741f5afc355eac4ba8d64','公司动态模板','temps/news','4','0'),
-- ('6b9741afbf9c41d98433391867152409','动态列表页模板','temps/newslist','3','0'),
-- ('c3a0b1fc1ffe4df99a3321974a2d0f33','网站首页(服务介绍)模板','/index','4','0'),
-- ('d1cd3eb36584439d8e90c64f7b762808','案例展示页模板','/temps/case','4','0');
-- SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat MySQL Data Transfer
Source Server : sdk test
Source Server Version : 50616
Source Host : rm-m5eg27hoe205fc0x2.mysql.rds.aliyuncs.com:3306
Source Database : csair_dp
Target Server Type : MYSQL
Target Server Version : 50616
File Encoding : 65001
Date: 2017-03-23 17:43:12
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `t_prize_info`
-- ----------------------------
DROP TABLE IF EXISTS `t_prize_info`;
CREATE TABLE `t_prize_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`prize_pool_id` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '应用ID',
`name` varchar(45) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '奖品的名称',
`number` int(11) NOT NULL DEFAULT '0' COMMENT '奖品总量',
`draw_number` int(11) NOT NULL DEFAULT '0' COMMENT '已经抽取的数量',
`prize_type` int(11) NOT NULL DEFAULT '1' COMMENT '奖品类型:1、实物;2、积分;',
`prize_image` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '图片地址',
`ext_information` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '扩展信息,存储相应奖品的个性信息。',
`probability` double NOT NULL COMMENT '中奖概率',
`lottery_draw_amount` int(11) DEFAULT NULL COMMENT '每周发放上限',
`positions` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '位置信息,针对大转盘设置。多个位置用“,”分割。',
`deleted` tinyint(4) NOT NULL DEFAULT '0',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_PRIZE_POOL_ID` (`prize_pool_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Records of t_prize_info
-- ----------------------------
-- ----------------------------
-- Table structure for `t_prize_lottery_record`
-- ----------------------------
DROP TABLE IF EXISTS `t_prize_lottery_record`;
CREATE TABLE `t_prize_lottery_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`prize_pool_id` varchar(32) COLLATE utf8mb4_bin NOT NULL,
`phone_number` varchar(128) COLLATE utf8mb4_bin NOT NULL,
`lottery_platform` varchar(128) COLLATE utf8mb4_bin DEFAULT NULL,
`lottery_day` varchar(128) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '抽奖日期',
`deleted` tinyint(4) NOT NULL DEFAULT '0',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_LO_PR_PH` (`lottery_platform`,`prize_pool_id`,`phone_number`),
KEY `IDX_LO_LO_PR_PH` (`lottery_platform`,`lottery_day`,`prize_pool_id`,`phone_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Records of t_prize_lottery_record
-- ----------------------------
-- ----------------------------
-- Table structure for `t_prize_pool`
-- ----------------------------
DROP TABLE IF EXISTS `t_prize_pool`;
CREATE TABLE `t_prize_pool` (
`id` varchar(32) COLLATE utf8mb4_bin NOT NULL,
`name` varchar(45) COLLATE utf8mb4_bin NOT NULL COMMENT '活动名称',
`desscription` text CHARACTER SET utf8mb4 COMMENT '活动描述',
`winning_rate` int(11) NOT NULL DEFAULT '1' COMMENT '1 表示 万分之一 中奖率,非负, 0<= r <= 10000,在这个范围之外取其极限。',
`deleted` tinyint(4) NOT NULL DEFAULT '1' COMMENT '互动的状态,1、进行中;0、已结束。',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`is_lottery_platform` tinyint(4) DEFAULT '2' COMMENT '1 全平台,2 pc/手机端平台',
`lottery_frequency` tinyint(4) NOT NULL COMMENT '参与间隔:1、整个活动;2、每天',
`lottery_times` int(11) NOT NULL COMMENT '抽奖次数',
`draw_times` int(11) DEFAULT NULL COMMENT '总中奖次数',
`draw_frequency` int(11) DEFAULT NULL COMMENT '中奖间隔:1、整个活动;2、每天;3、每周',
`draw_frequency_times` int(11) DEFAULT NULL COMMENT '中奖间隔内的中奖次数',
`is_white_rand` tinyint(4) DEFAULT '1' COMMENT '适用用户: 1 通用,2 白名单用户',
PRIMARY KEY (`id`),
KEY `IDX_IS_WHITE_RAND` (`is_white_rand`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Records of t_prize_pool
-- ----------------------------
-- ----------------------------
-- Table structure for `t_prize_white_info`
-- ----------------------------
DROP TABLE IF EXISTS `t_prize_white_info`;
CREATE TABLE `t_prize_white_info` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`prize_pool_id` varchar(32) DEFAULT NULL,
`phone_number` varchar(255) DEFAULT NULL,
`online_time` timestamp NULL DEFAULT NULL COMMENT '上线时间',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deleted` tinyint(4) DEFAULT '0',
PRIMARY KEY (`id`),
KEY `IDX_PHONE_NUMBER_ONLINE_TIME` (`phone_number`,`online_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_prize_white_info
-- ----------------------------
-- ----------------------------
-- Table structure for `t_prize_winning_record`
-- ----------------------------
DROP TABLE IF EXISTS `t_prize_winning_record`;
CREATE TABLE `t_prize_winning_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`prize_pool_id` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL,
`phone_number` varchar(128) COLLATE utf8mb4_bin NOT NULL,
`lottery_platform` varchar(128) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '抽奖平台',
`prize_id` int(11) NOT NULL,
`prize_name` varchar(45) COLLATE utf8mb4_bin NOT NULL COMMENT '奖品的名称',
`prize_type` int(11) NOT NULL DEFAULT '1' COMMENT '奖品类型:1、实物;2、积分;',
`prize_extends` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '扩展信息,存储相应奖品的个性信息。',
`prize_image` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`prize_no` varchar(45) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '奖品的编号,20位数字',
`winning_day` varchar(128) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '中奖日期',
`deleted` tinyint(4) NOT NULL DEFAULT '0',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_PR_PR_WI` (`prize_id`,`prize_pool_id`,`winning_day`),
KEY `IDX_PH_PR_WI` (`phone_number`,`prize_pool_id`,`winning_day`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Records of t_prize_winning_record
-- ----------------------------
/*
Navicat MySQL Data Transfer
Source Server : 127
Source Server Version : 50623
Source Host : localhost
Source Database : demo_st
Target Server Version : 50623
File Encoding : utf-8
Date: 04/12/2016 16:05:41 PM
*/
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `product_user_collect`
-- ----------------------------
DROP TABLE IF EXISTS `product_user_collect`;
CREATE TABLE `product_user_collect` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` bigint(20) NOT NULL,
`status` tinyint(4) NOT NULL,
`user_name` varchar(255) NOT NULL,
`user_phone` varchar(255) NOT NULL,
`user_address` varchar(255) NOT NULL,
`user_buy_product` varchar(255) DEFAULT NULL,
`user_buy_time` varchar(255) DEFAULT NULL,
`img_url` varchar(255) DEFAULT NULL,
`user_describe` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8mb4;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat MySQL Data Transfer
Source Server : 127
Source Server Version : 50623
Source Host : localhost
Source Database : demo_st
Target Server Version : 50623
File Encoding : utf-8
Date: 04/12/2016 16:05:37 PM
*/
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `product_apply`
-- ----------------------------
DROP TABLE IF EXISTS `product_apply`;
CREATE TABLE `product_apply` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`city` varchar(255) DEFAULT NULL,
`activity_time` varchar(255) DEFAULT NULL,
`activity_address` varchar(255) DEFAULT NULL,
`phone` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`count` bigint(20) DEFAULT NULL,
`product` varchar(255) DEFAULT NULL,
`reason` varchar(255) DEFAULT NULL,
`create_time` bigint(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat MySQL Data Transfer
Source Server : 127
Source Server Version : 50623
Source Host : localhost
Source Database : demo_st
Target Server Version : 50623
File Encoding : utf-8
Date: 04/13/2016 17:23:29 PM
*/
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `pv_info`
-- ----------------------------
DROP TABLE IF EXISTS `pv_info`;
CREATE TABLE `pv_info` (
`pv_count` bigint(20) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `pv_info`
-- ----------------------------
BEGIN;
INSERT INTO `pv_info` VALUES ('1');
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat MySQL Data Transfer
Source Server : sdk test
Source Server Version : 50616
Source Host : rm-m5eg27hoe205fc0x2.mysql.rds.aliyuncs.com:3306
Source Database : csair_dp
Target Server Type : MYSQL
Target Server Version : 50616
File Encoding : 65001
Date: 2017-04-20 15:35:44
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `t_rand_application`
-- ----------------------------
DROP TABLE IF EXISTS `t_rand_application`;
CREATE TABLE `t_rand_application` (
`id` char(32) NOT NULL,
`deleted` tinyint(4) DEFAULT '1',
`offline_date` datetime DEFAULT NULL COMMENT '下线时间',
`app_name` varchar(255) DEFAULT NULL,
`description` text,
`app_dir` varchar(255) DEFAULT NULL,
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`update_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for `t_rand_prize_pool`
-- ----------------------------
DROP TABLE IF EXISTS `t_rand_prize_pool`;
CREATE TABLE `t_rand_prize_pool` (
`id` char(32) NOT NULL,
`app_id` char(32) DEFAULT NULL,
`name` varchar(45) NOT NULL COMMENT '活动名称',
`description` text COMMENT '活动描述',
`winning_rate` int(11) NOT NULL DEFAULT '1' COMMENT '1 表示 万分之一 中奖率,非负, 0<= r <= 10000,在这个范围之外取其极限。',
`deleted` tinyint(4) NOT NULL DEFAULT '1' COMMENT '互动的状态,1、进行中;0、已结束。',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`is_lottery_platform` tinyint(4) DEFAULT '2' COMMENT '1 全平台,2 pc/手机端平台',
`lottery_frequency` tinyint(4) NOT NULL COMMENT '参与间隔:1、整个活动;2、每天',
`lottery_times` int(11) NOT NULL COMMENT '抽奖次数',
`draw_times` int(11) DEFAULT NULL COMMENT '总中奖次数',
`draw_frequency` int(11) DEFAULT NULL COMMENT '中奖间隔:1、整个活动;2、每天;3、每周',
`draw_frequency_times` int(11) DEFAULT NULL COMMENT '中奖间隔内的中奖次数',
`is_white_rand` tinyint(4) DEFAULT '1' COMMENT '适用用户: 1 通用,2 白名单用户',
PRIMARY KEY (`id`),
KEY `IDX_APP_ID_IS_WHITE_RAND` (`app_id`, `is_white_rand`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for `t_rand_prize_info`
-- ----------------------------
DROP TABLE IF EXISTS `t_rand_prize_info`;
CREATE TABLE `t_rand_prize_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`app_id` char(32) DEFAULT NULL,
`prize_pool_id` char(32) DEFAULT NULL COMMENT '应用ID',
`name` varchar(45) DEFAULT NULL COMMENT '奖品的名称',
`number` int(11) NOT NULL DEFAULT '0' COMMENT '奖品总量',
`draw_number` int(11) NOT NULL DEFAULT '0' COMMENT '已经抽取的数量',
`prize_type` int(11) NOT NULL DEFAULT '1' COMMENT '奖品类型:1、实物;2、优惠券;',
`prize_image` varchar(255) DEFAULT NULL COMMENT '图片地址',
`ext_information` varchar(255) NOT NULL COMMENT '扩展信息,存储相应奖品的个性信息。',
`probability` double NOT NULL COMMENT '中奖概率',
`user_lottery_draw_amount` int(11) DEFAULT NULL COMMENT '用户每天中奖次数',
`lottery_draw_amount` int(11) DEFAULT NULL COMMENT '奖品每周发放上限',
`positions` varchar(255) DEFAULT NULL COMMENT '位置信息,针对大转盘设置。多个位置用“,”分割。',
`deleted` tinyint(4) NOT NULL DEFAULT '0',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `IDX_APP_ID_PRIZE_POOL_ID` (`app_id`, `prize_pool_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
<?xml version="1.0" encoding="UTF-8"?>
<urlrewrite>
<rule>
<note>默认加载 /index.html</note>
<from>^/([a-zA-Z0-9]+)/$</from>
<to>/Users/joe/Documents/self/src/jia51/case_new_by_luo/$1/html/$1.html</to>
</rule>
</urlrewrite>
\ No newline at end of file
package com.example;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = DemoApplication.class)
@WebAppConfiguration
public class DemoApplicationTests {
@Test
public void contextLoads() {
}
}