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