浏览代码

香颂蔚澜初始化

andrew 4 年前
父节点
当前提交
6e5f640a56
共有 100 个文件被更改,包括 9263 次插入0 次删除
  1. 26
    0
      .gitignore
  2. 25
    0
      app-api/.gitignore
  3. 二进制
      app-api/.mvn/wrapper/maven-wrapper.jar
  4. 1
    0
      app-api/.mvn/wrapper/maven-wrapper.properties
  5. 二进制
      app-api/lib/Digests.jar
  6. 二进制
      app-api/lib/HttpClientSSLUtils.jar
  7. 225
    0
      app-api/mvnw
  8. 143
    0
      app-api/mvnw.cmd
  9. 281
    0
      app-api/pom.xml
  10. 30
    0
      app-api/src/main/assembly/assembly.xml
  11. 86
    0
      app-api/src/main/assembly/bin/start.sh
  12. 54
    0
      app-api/src/main/java/com/community/huiju/AppApplication.java
  13. 40
    0
      app-api/src/main/java/com/community/huiju/Swagger2.java
  14. 91
    0
      app-api/src/main/java/com/community/huiju/aop/LogAOP.java
  15. 246
    0
      app-api/src/main/java/com/community/huiju/common/PicUtils.java
  16. 54
    0
      app-api/src/main/java/com/community/huiju/common/code/ICode.java
  17. 46
    0
      app-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java
  18. 23
    0
      app-api/src/main/java/com/community/huiju/common/code/entity/CodeEntity.java
  19. 12
    0
      app-api/src/main/java/com/community/huiju/common/code/impl/ImgCodeImpl.java
  20. 74
    0
      app-api/src/main/java/com/community/huiju/common/code/impl/PhoneCodeImpl.java
  21. 268
    0
      app-api/src/main/java/com/community/huiju/common/fushi/Base64.java
  22. 166
    0
      app-api/src/main/java/com/community/huiju/common/fushi/FSApi.java
  23. 35
    0
      app-api/src/main/java/com/community/huiju/common/messagePush.java
  24. 26
    0
      app-api/src/main/java/com/community/huiju/common/perproties/DaSuProperties.java
  25. 44
    0
      app-api/src/main/java/com/community/huiju/common/perproties/FuShiProperties.java
  26. 37
    0
      app-api/src/main/java/com/community/huiju/common/perproties/LoginCodePerproties.java
  27. 47
    0
      app-api/src/main/java/com/community/huiju/common/perproties/PayNotifyPerproties.java
  28. 23
    0
      app-api/src/main/java/com/community/huiju/common/perproties/WeiXinPerproties.java
  29. 24
    0
      app-api/src/main/java/com/community/huiju/common/perproties/YinShiProperties.java
  30. 83
    0
      app-api/src/main/java/com/community/huiju/common/sign/DaSuSign.java
  31. 236
    0
      app-api/src/main/java/com/community/huiju/common/welcome/OkHttpRequestUtils.java
  32. 26
    0
      app-api/src/main/java/com/community/huiju/common/welcome/WelcomeProperties.java
  33. 15
    0
      app-api/src/main/java/com/community/huiju/common/wxmp/WxMPConst.java
  34. 21
    0
      app-api/src/main/java/com/community/huiju/common/wxmp/WxMPUtil.java
  35. 72
    0
      app-api/src/main/java/com/community/huiju/common/wxpay/HfWxConfig.java
  36. 42
    0
      app-api/src/main/java/com/community/huiju/common/wxpay/IWXPayDomain.java
  37. 72
    0
      app-api/src/main/java/com/community/huiju/common/wxpay/QaddWxConfig.java
  38. 689
    0
      app-api/src/main/java/com/community/huiju/common/wxpay/WXPay.java
  39. 103
    0
      app-api/src/main/java/com/community/huiju/common/wxpay/WXPayConfig.java
  40. 59
    0
      app-api/src/main/java/com/community/huiju/common/wxpay/WXPayConstants.java
  41. 265
    0
      app-api/src/main/java/com/community/huiju/common/wxpay/WXPayReport.java
  42. 258
    0
      app-api/src/main/java/com/community/huiju/common/wxpay/WXPayRequest.java
  43. 299
    0
      app-api/src/main/java/com/community/huiju/common/wxpay/WXPayUtil.java
  44. 30
    0
      app-api/src/main/java/com/community/huiju/common/wxpay/WXPayXmlUtil.java
  45. 66
    0
      app-api/src/main/java/com/community/huiju/config/BillQuartz.java
  46. 29
    0
      app-api/src/main/java/com/community/huiju/config/FeignUploadConfig.java
  47. 40
    0
      app-api/src/main/java/com/community/huiju/config/FuShiConfig.java
  48. 22
    0
      app-api/src/main/java/com/community/huiju/config/HttpSessionConfig.java
  49. 46
    0
      app-api/src/main/java/com/community/huiju/controller/AgreementController.java
  50. 179
    0
      app-api/src/main/java/com/community/huiju/controller/AliMPUserController.java
  51. 132
    0
      app-api/src/main/java/com/community/huiju/controller/AliPayController.java
  52. 96
    0
      app-api/src/main/java/com/community/huiju/controller/AssembleController.java
  53. 71
    0
      app-api/src/main/java/com/community/huiju/controller/BannerController.java
  54. 77
    0
      app-api/src/main/java/com/community/huiju/controller/BaseController.java
  55. 99
    0
      app-api/src/main/java/com/community/huiju/controller/BillController.java
  56. 65
    0
      app-api/src/main/java/com/community/huiju/controller/CodeController.java
  57. 41
    0
      app-api/src/main/java/com/community/huiju/controller/CommunityController.java
  58. 117
    0
      app-api/src/main/java/com/community/huiju/controller/FSController.java
  59. 83
    0
      app-api/src/main/java/com/community/huiju/controller/FaceController.java
  60. 125
    0
      app-api/src/main/java/com/community/huiju/controller/HkController.java
  61. 80
    0
      app-api/src/main/java/com/community/huiju/controller/IBuildingOwnerInfoController.java
  62. 47
    0
      app-api/src/main/java/com/community/huiju/controller/ImageController.java
  63. 38
    0
      app-api/src/main/java/com/community/huiju/controller/LoginCodeController.java
  64. 51
    0
      app-api/src/main/java/com/community/huiju/controller/MenuController.java
  65. 142
    0
      app-api/src/main/java/com/community/huiju/controller/MessageController.java
  66. 105
    0
      app-api/src/main/java/com/community/huiju/controller/MonitoringController.java
  67. 515
    0
      app-api/src/main/java/com/community/huiju/controller/SocialController.java
  68. 46
    0
      app-api/src/main/java/com/community/huiju/controller/TaVersionController.java
  69. 229
    0
      app-api/src/main/java/com/community/huiju/controller/TicketController.java
  70. 61
    0
      app-api/src/main/java/com/community/huiju/controller/TpHotelController.java
  71. 79
    0
      app-api/src/main/java/com/community/huiju/controller/TpRentalHouseController.java
  72. 109
    0
      app-api/src/main/java/com/community/huiju/controller/TpShopController.java
  73. 193
    0
      app-api/src/main/java/com/community/huiju/controller/TpTicketAndTransactionController.java
  74. 417
    0
      app-api/src/main/java/com/community/huiju/controller/UserController.java
  75. 98
    0
      app-api/src/main/java/com/community/huiju/controller/UserLicenseController.java
  76. 119
    0
      app-api/src/main/java/com/community/huiju/controller/UserVerifyController.java
  77. 87
    0
      app-api/src/main/java/com/community/huiju/controller/VistorController.java
  78. 108
    0
      app-api/src/main/java/com/community/huiju/controller/WxLoginController.java
  79. 199
    0
      app-api/src/main/java/com/community/huiju/controller/WxMPUserController.java
  80. 210
    0
      app-api/src/main/java/com/community/huiju/controller/WxPayController.java
  81. 19
    0
      app-api/src/main/java/com/community/huiju/dao/SysNationMapper.java
  82. 19
    0
      app-api/src/main/java/com/community/huiju/dao/SysReportReasonMapper.java
  83. 24
    0
      app-api/src/main/java/com/community/huiju/dao/TaAgreementMapper.java
  84. 16
    0
      app-api/src/main/java/com/community/huiju/dao/TaBriskUserMapper.java
  85. 39
    0
      app-api/src/main/java/com/community/huiju/dao/TaFaceMapper.java
  86. 30
    0
      app-api/src/main/java/com/community/huiju/dao/TaFeedbackImgMapper.java
  87. 39
    0
      app-api/src/main/java/com/community/huiju/dao/TaFeedbackMapper.java
  88. 19
    0
      app-api/src/main/java/com/community/huiju/dao/TaPublicMonitorMapper.java
  89. 19
    0
      app-api/src/main/java/com/community/huiju/dao/TaRemotelyDoorMapper.java
  90. 19
    0
      app-api/src/main/java/com/community/huiju/dao/TaRemotelyMonitorMapper.java
  91. 24
    0
      app-api/src/main/java/com/community/huiju/dao/TaSysMenuImgMapper.java
  92. 29
    0
      app-api/src/main/java/com/community/huiju/dao/TaSysMenuMapper.java
  93. 36
    0
      app-api/src/main/java/com/community/huiju/dao/TaSysRoleMapper.java
  94. 41
    0
      app-api/src/main/java/com/community/huiju/dao/TaSysUserRoleMapper.java
  95. 22
    0
      app-api/src/main/java/com/community/huiju/dao/TaTemporaryLicenseOrderMapper.java
  96. 33
    0
      app-api/src/main/java/com/community/huiju/dao/TaUserHkMapper.java
  97. 52
    0
      app-api/src/main/java/com/community/huiju/dao/TaUserLicenseMapper.java
  98. 50
    0
      app-api/src/main/java/com/community/huiju/dao/TaUserLicenseOrderMapper.java
  99. 115
    0
      app-api/src/main/java/com/community/huiju/dao/TaUserMapper.java
  100. 0
    0
      app-api/src/main/java/com/community/huiju/dao/TaUserVerifyMapper.java

+ 26
- 0
.gitignore 查看文件

@@ -0,0 +1,26 @@
1
+/target/
2
+!.mvn/wrapper/maven-wrapper.jar
3
+
4
+### STS ###
5
+.apt_generated
6
+.classpath
7
+.factorypath
8
+.project
9
+.settings
10
+.springBeans
11
+.sts4-cache
12
+
13
+### IntelliJ IDEA ###
14
+.idea
15
+*.iws
16
+*.iml
17
+*.ipr
18
+/target/
19
+
20
+### NetBeans ###
21
+/nbproject/private/
22
+/build/
23
+/nbbuild/
24
+/dist/
25
+/nbdist/
26
+/.nb-gradle/

+ 25
- 0
app-api/.gitignore 查看文件

@@ -0,0 +1,25 @@
1
+/target/
2
+!.mvn/wrapper/maven-wrapper.jar
3
+
4
+### STS ###
5
+.apt_generated
6
+.classpath
7
+.factorypath
8
+.project
9
+.settings
10
+.springBeans
11
+.sts4-cache
12
+
13
+### IntelliJ IDEA ###
14
+.idea
15
+*.iws
16
+*.iml
17
+*.ipr
18
+
19
+### NetBeans ###
20
+/nbproject/private/
21
+/build/
22
+/nbbuild/
23
+/dist/
24
+/nbdist/
25
+/.nb-gradle/

二进制
app-api/.mvn/wrapper/maven-wrapper.jar 查看文件


+ 1
- 0
app-api/.mvn/wrapper/maven-wrapper.properties 查看文件

@@ -0,0 +1 @@
1
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip

二进制
app-api/lib/Digests.jar 查看文件


二进制
app-api/lib/HttpClientSSLUtils.jar 查看文件


+ 225
- 0
app-api/mvnw 查看文件

@@ -0,0 +1,225 @@
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
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59
+    if [ -z "$JAVA_HOME" ]; then
60
+      if [ -x "/usr/libexec/java_home" ]; then
61
+        export JAVA_HOME="`/usr/libexec/java_home`"
62
+      else
63
+        export JAVA_HOME="/Library/Java/Home"
64
+      fi
65
+    fi
66
+    ;;
67
+esac
68
+
69
+if [ -z "$JAVA_HOME" ] ; then
70
+  if [ -r /etc/gentoo-release ] ; then
71
+    JAVA_HOME=`java-config --jre-home`
72
+  fi
73
+fi
74
+
75
+if [ -z "$M2_HOME" ] ; then
76
+  ## resolve links - $0 may be a link to maven's home
77
+  PRG="$0"
78
+
79
+  # need this for relative symlinks
80
+  while [ -h "$PRG" ] ; do
81
+    ls=`ls -ld "$PRG"`
82
+    link=`expr "$ls" : '.*-> \(.*\)$'`
83
+    if expr "$link" : '/.*' > /dev/null; then
84
+      PRG="$link"
85
+    else
86
+      PRG="`dirname "$PRG"`/$link"
87
+    fi
88
+  done
89
+
90
+  saveddir=`pwd`
91
+
92
+  M2_HOME=`dirname "$PRG"`/..
93
+
94
+  # make it fully qualified
95
+  M2_HOME=`cd "$M2_HOME" && pwd`
96
+
97
+  cd "$saveddir"
98
+  # echo Using m2 at $M2_HOME
99
+fi
100
+
101
+# For Cygwin, ensure paths are in UNIX format before anything is touched
102
+if $cygwin ; then
103
+  [ -n "$M2_HOME" ] &&
104
+    M2_HOME=`cygpath --unix "$M2_HOME"`
105
+  [ -n "$JAVA_HOME" ] &&
106
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
107
+  [ -n "$CLASSPATH" ] &&
108
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
109
+fi
110
+
111
+# For Migwn, ensure paths are in UNIX format before anything is touched
112
+if $mingw ; then
113
+  [ -n "$M2_HOME" ] &&
114
+    M2_HOME="`(cd "$M2_HOME"; pwd)`"
115
+  [ -n "$JAVA_HOME" ] &&
116
+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117
+  # TODO classpath?
118
+fi
119
+
120
+if [ -z "$JAVA_HOME" ]; then
121
+  javaExecutable="`which javac`"
122
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
123
+    # readlink(1) is not available as standard on Solaris 10.
124
+    readLink=`which readlink`
125
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
126
+      if $darwin ; then
127
+        javaHome="`dirname \"$javaExecutable\"`"
128
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
129
+      else
130
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
131
+      fi
132
+      javaHome="`dirname \"$javaExecutable\"`"
133
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
134
+      JAVA_HOME="$javaHome"
135
+      export JAVA_HOME
136
+    fi
137
+  fi
138
+fi
139
+
140
+if [ -z "$JAVACMD" ] ; then
141
+  if [ -n "$JAVA_HOME"  ] ; then
142
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
143
+      # IBM's JDK on AIX uses strange locations for the executables
144
+      JAVACMD="$JAVA_HOME/jre/sh/java"
145
+    else
146
+      JAVACMD="$JAVA_HOME/bin/java"
147
+    fi
148
+  else
149
+    JAVACMD="`which java`"
150
+  fi
151
+fi
152
+
153
+if [ ! -x "$JAVACMD" ] ; then
154
+  echo "Error: JAVA_HOME is not defined correctly." >&2
155
+  echo "  We cannot execute $JAVACMD" >&2
156
+  exit 1
157
+fi
158
+
159
+if [ -z "$JAVA_HOME" ] ; then
160
+  echo "Warning: JAVA_HOME environment variable is not set."
161
+fi
162
+
163
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
164
+
165
+# traverses directory structure from process work directory to filesystem root
166
+# first directory with .mvn subdirectory is considered project base directory
167
+find_maven_basedir() {
168
+
169
+  if [ -z "$1" ]
170
+  then
171
+    echo "Path not specified to find_maven_basedir"
172
+    return 1
173
+  fi
174
+
175
+  basedir="$1"
176
+  wdir="$1"
177
+  while [ "$wdir" != '/' ] ; do
178
+    if [ -d "$wdir"/.mvn ] ; then
179
+      basedir=$wdir
180
+      break
181
+    fi
182
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
183
+    if [ -d "${wdir}" ]; then
184
+      wdir=`cd "$wdir/.."; pwd`
185
+    fi
186
+    # end of workaround
187
+  done
188
+  echo "${basedir}"
189
+}
190
+
191
+# concatenates all lines of a file
192
+concat_lines() {
193
+  if [ -f "$1" ]; then
194
+    echo "$(tr -s '\n' ' ' < "$1")"
195
+  fi
196
+}
197
+
198
+BASE_DIR=`find_maven_basedir "$(pwd)"`
199
+if [ -z "$BASE_DIR" ]; then
200
+  exit 1;
201
+fi
202
+
203
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
204
+echo $MAVEN_PROJECTBASEDIR
205
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
206
+
207
+# For Cygwin, switch paths to Windows format before running java
208
+if $cygwin; then
209
+  [ -n "$M2_HOME" ] &&
210
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
211
+  [ -n "$JAVA_HOME" ] &&
212
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
213
+  [ -n "$CLASSPATH" ] &&
214
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
215
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
216
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
217
+fi
218
+
219
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
220
+
221
+exec "$JAVACMD" \
222
+  $MAVEN_OPTS \
223
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
224
+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
225
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 143
- 0
app-api/mvnw.cmd 查看文件

@@ -0,0 +1,143 @@
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
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
84
+@REM Fallback to current working directory if not found.
85
+
86
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
87
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
88
+
89
+set EXEC_DIR=%CD%
90
+set WDIR=%EXEC_DIR%
91
+:findBaseDir
92
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
93
+cd ..
94
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
95
+set WDIR=%CD%
96
+goto findBaseDir
97
+
98
+:baseDirFound
99
+set MAVEN_PROJECTBASEDIR=%WDIR%
100
+cd "%EXEC_DIR%"
101
+goto endDetectBaseDir
102
+
103
+:baseDirNotFound
104
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
105
+cd "%EXEC_DIR%"
106
+
107
+:endDetectBaseDir
108
+
109
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
110
+
111
+@setlocal EnableExtensions EnableDelayedExpansion
112
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
113
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
114
+
115
+:endReadAdditionalConfig
116
+
117
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
118
+
119
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
120
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
121
+
122
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
123
+if ERRORLEVEL 1 goto error
124
+goto end
125
+
126
+:error
127
+set ERROR_CODE=1
128
+
129
+:end
130
+@endlocal & set ERROR_CODE=%ERROR_CODE%
131
+
132
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
133
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
134
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
135
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
136
+:skipRcPost
137
+
138
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
139
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
140
+
141
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
142
+
143
+exit /B %ERROR_CODE%

+ 281
- 0
app-api/pom.xml 查看文件

@@ -0,0 +1,281 @@
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.community</groupId>
7
+	<artifactId>app-api</artifactId>
8
+	<version>0.0.1</version>
9
+	<packaging>jar</packaging>
10
+
11
+	<name>app-api</name>
12
+	<description>app-api</description>
13
+
14
+	<parent>
15
+		<groupId>com.community</groupId>
16
+		<artifactId>smart-community</artifactId>
17
+		<version>0.0.1</version>
18
+	</parent>
19
+
20
+	<properties>
21
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
22
+		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
23
+		<java.version>1.8</java.version>
24
+		<spring-cloud.version>Finchley.SR1</spring-cloud.version>
25
+		<spring-session-jdbc.version>2.0.5.RELEASE</spring-session-jdbc.version>
26
+		<logback.version>1.1.6</logback.version>
27
+		<logback.access.version>1.1.2</logback.access.version>
28
+		<commons.logging.version>1.2</commons.logging.version>
29
+	</properties>
30
+
31
+	<dependencies>
32
+		<dependency>
33
+			<groupId>org.springframework.boot</groupId>
34
+			<artifactId>spring-boot-starter-web</artifactId>
35
+		</dependency>
36
+		<dependency>
37
+			<groupId>org.springframework.cloud</groupId>
38
+			<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
39
+		</dependency>
40
+
41
+		<dependency>
42
+			<groupId>org.springframework.cloud</groupId>
43
+			<artifactId>spring-cloud-starter-openfeign</artifactId>
44
+		</dependency>
45
+
46
+		<dependency>
47
+			<groupId>io.springfox</groupId>
48
+			<artifactId>springfox-swagger2</artifactId>
49
+			<version>2.7.0</version>
50
+		</dependency>
51
+
52
+		<dependency>
53
+			<groupId>io.springfox</groupId>
54
+			<artifactId>springfox-swagger-ui</artifactId>
55
+			<version>2.7.0</version>
56
+		</dependency>
57
+
58
+		<dependency>
59
+			<groupId>org.springframework.cloud</groupId>
60
+			<artifactId>spring-cloud-starter-config</artifactId>
61
+		</dependency>
62
+
63
+		<dependency>
64
+			<groupId>org.springframework.boot</groupId>
65
+			<artifactId>spring-boot-starter-actuator</artifactId>
66
+		</dependency>
67
+
68
+		<dependency>
69
+			<groupId>org.mybatis.spring.boot</groupId>
70
+			<artifactId>mybatis-spring-boot-starter</artifactId>
71
+			<version>1.3.2</version>
72
+		</dependency>
73
+
74
+		<dependency>
75
+			<groupId>com.github.pagehelper</groupId>
76
+			<artifactId>pagehelper-spring-boot-starter</artifactId>
77
+			<version>1.2.3</version>
78
+		</dependency>
79
+
80
+		<dependency>
81
+			<groupId>mysql</groupId>
82
+			<artifactId>mysql-connector-java</artifactId>
83
+			<scope>runtime</scope>
84
+		</dependency>
85
+
86
+		<dependency>
87
+			<groupId>com.community</groupId>
88
+			<artifactId>community-common</artifactId>
89
+			<version>0.0.1</version>
90
+		</dependency>
91
+
92
+		<dependency>
93
+			<groupId>org.springframework.boot</groupId>
94
+			<artifactId>spring-boot-starter-test</artifactId>
95
+			<scope>test</scope>
96
+		</dependency>
97
+
98
+		<dependency>
99
+			<groupId>org.springframework.boot</groupId>
100
+			<artifactId>spring-boot-starter-jdbc</artifactId>
101
+		</dependency>
102
+
103
+		<dependency>
104
+			<groupId>org.springframework.session</groupId>
105
+			<artifactId>spring-session-jdbc</artifactId>
106
+			<version>${spring-session-jdbc.version}</version>
107
+		</dependency>
108
+
109
+		<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
110
+		<dependency>
111
+			<groupId>org.projectlombok</groupId>
112
+			<artifactId>lombok</artifactId>
113
+			<version>1.18.2</version>
114
+			<scope>provided</scope>
115
+		</dependency>
116
+
117
+		<!-- https://mvnrepository.com/artifact/com.alipay.sdk/alipay-sdk-java -->
118
+		<dependency>
119
+			<groupId>com.alipay.sdk</groupId>
120
+			<artifactId>alipay-sdk-java</artifactId>
121
+			<version>3.3.49.ALL</version>
122
+		</dependency>
123
+
124
+		<dependency>
125
+			<groupId>com.github.sd4324530</groupId>
126
+			<artifactId>fastweixin</artifactId>
127
+			<version>1.3.6</version>
128
+		</dependency>
129
+
130
+		<!-- log4j -->
131
+
132
+		<!--<dependency>-->
133
+			<!--<groupId>org.springframework.boot</groupId>-->
134
+			<!--<artifactId>spring-boot-starter-log4j</artifactId>-->
135
+		<!--</dependency>-->
136
+
137
+		<dependency>
138
+			<groupId>org.springframework.boot</groupId>
139
+			<artifactId>spring-boot-starter</artifactId>
140
+		</dependency>
141
+
142
+
143
+		<dependency>
144
+			<groupId>commons-logging</groupId>
145
+			<artifactId>commons-logging</artifactId>
146
+			<version>${commons.logging.version}</version>
147
+		</dependency>
148
+
149
+		<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
150
+		<dependency>
151
+			<groupId>com.google.guava</groupId>
152
+			<artifactId>guava</artifactId>
153
+			<version>26.0-jre</version>
154
+		</dependency>
155
+
156
+		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
157
+		<dependency>
158
+			<groupId>org.apache.commons</groupId>
159
+			<artifactId>commons-lang3</artifactId>
160
+			<version>3.8.1</version>
161
+		</dependency>
162
+
163
+		<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
164
+		<dependency>
165
+			<groupId>commons-lang</groupId>
166
+			<artifactId>commons-lang</artifactId>
167
+			<version>2.6</version>
168
+		</dependency>
169
+
170
+		<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
171
+		<dependency>
172
+			<groupId>com.squareup.okhttp3</groupId>
173
+			<artifactId>okhttp</artifactId>
174
+			<version>3.11.0</version>
175
+		</dependency>
176
+
177
+		<dependency>
178
+			<groupId>commons-httpclient</groupId>
179
+			<artifactId>commons-httpclient</artifactId>
180
+			<version>3.1</version>
181
+		</dependency>
182
+
183
+		<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
184
+		<dependency>
185
+			<groupId>commons-io</groupId>
186
+			<artifactId>commons-io</artifactId>
187
+			<version>1.4</version>
188
+		</dependency>
189
+
190
+		<dependency>
191
+			<groupId>net.coobird</groupId>
192
+			<artifactId>thumbnailator</artifactId>
193
+			<version>0.4.2</version>
194
+		</dependency>
195
+        <dependency>
196
+            <groupId>mysql</groupId>
197
+            <artifactId>mysql-connector-java</artifactId>
198
+        </dependency>
199
+
200
+		<dependency>
201
+			<groupId>io.github.openfeign.form</groupId>
202
+			<artifactId>feign-form</artifactId>
203
+			<version>3.0.3</version>
204
+		</dependency>
205
+		<dependency>
206
+			<groupId>io.github.openfeign.form</groupId>
207
+			<artifactId>feign-form-spring</artifactId>
208
+			<version>3.0.3</version>
209
+		</dependency>
210
+		<dependency>
211
+			<groupId>commons-fileupload</groupId>
212
+			<artifactId>commons-fileupload</artifactId>
213
+			<version>1.3.3</version>
214
+		</dependency>
215
+
216
+    </dependencies>
217
+
218
+	<dependencyManagement>
219
+		<dependencies>
220
+			<dependency>
221
+				<groupId>org.springframework.cloud</groupId>
222
+				<artifactId>spring-cloud-dependencies</artifactId>
223
+				<version>${spring-cloud.version}</version>
224
+				<type>pom</type>
225
+				<scope>import</scope>
226
+			</dependency>
227
+		</dependencies>
228
+	</dependencyManagement>
229
+
230
+	<build>
231
+		<plugins>
232
+			<plugin>
233
+				<groupId>org.springframework.boot</groupId>
234
+				<artifactId>spring-boot-maven-plugin</artifactId>
235
+			</plugin>
236
+			<plugin>
237
+				<groupId>org.apache.maven.plugins</groupId>
238
+				<artifactId>maven-compiler-plugin</artifactId>
239
+				<version>3.7.0</version>
240
+				<configuration>
241
+					<source>1.8</source>
242
+					<target>1.8</target>
243
+					<encoding>UTF-8</encoding>
244
+					<compilerArguments>
245
+						<extdirs>${project.basedir}/lib</extdirs>
246
+					</compilerArguments>
247
+				</configuration>
248
+			</plugin>
249
+			<!--服务化打包工具-->
250
+			<plugin>
251
+				<groupId>org.apache.maven.plugins</groupId>
252
+				<artifactId>maven-assembly-plugin</artifactId>
253
+				<configuration>
254
+					<descriptors>
255
+						<descriptor>src/main/assembly/assembly.xml</descriptor>
256
+					</descriptors>
257
+				</configuration>
258
+				<executions>
259
+					<execution>
260
+						<id>make-assembly</id>
261
+						<phase>package</phase>
262
+						<goals>
263
+							<goal>single</goal>
264
+						</goals>
265
+					</execution>
266
+				</executions>
267
+			</plugin>
268
+
269
+			<plugin>
270
+				<groupId>org.apache.maven.plugins</groupId>
271
+				<artifactId>maven-surefire-plugin</artifactId>
272
+				<version>2.4.2</version>
273
+				<configuration>
274
+					<skipTests>true</skipTests>
275
+				</configuration>
276
+			</plugin>
277
+		</plugins>
278
+	</build>
279
+
280
+
281
+</project>

+ 30
- 0
app-api/src/main/assembly/assembly.xml 查看文件

@@ -0,0 +1,30 @@
1
+<assembly>
2
+    <id>assembly</id>
3
+    <formats>
4
+        <format>tar.gz</format>
5
+    </formats>
6
+    <includeBaseDirectory>true</includeBaseDirectory>
7
+    <fileSets>
8
+        <fileSet>
9
+            <directory>src/main/assembly/bin</directory>
10
+            <outputDirectory>bin</outputDirectory>
11
+            <fileMode>0755</fileMode>
12
+        </fileSet>
13
+        <fileSet>
14
+            <directory>target/classes</directory>
15
+            <outputDirectory>conf</outputDirectory>
16
+            <includes>
17
+                <include>META-INF/**</include>
18
+                <include>*.yml</include>
19
+                <include>conf/**</include>
20
+            </includes>
21
+            <fileMode>0755</fileMode>
22
+        </fileSet>
23
+    </fileSets>
24
+    <dependencySets>
25
+        <dependencySet>
26
+            <useProjectArtifact>true</useProjectArtifact>
27
+            <outputDirectory>lib</outputDirectory>
28
+        </dependencySet>
29
+    </dependencySets>
30
+</assembly>

+ 86
- 0
app-api/src/main/assembly/bin/start.sh 查看文件

@@ -0,0 +1,86 @@
1
+#!/bin/bash
2
+
3
+SERVER_NAME='app-api'
4
+# jar名称
5
+JAR_NAME='app-api-0.0.1.jar'
6
+cd `dirname $0`
7
+BIN_DIR=`pwd`
8
+cd ..
9
+DEPLOY_DIR=`pwd`
10
+CONF_DIR=$DEPLOY_DIR/conf
11
+# 获取应用的端口号
12
+SERVER_PORT=`sed -nr '/port: [0-9]+/ s/.*port: +([0-9]+).*/\1/p' conf/bootstrap.yml`
13
+
14
+PIDS=`ps -f | grep java | grep "$CONF_DIR" |awk '{print $2}'`
15
+if [ "$1" = "status" ]; then
16
+    if [ -n "$PIDS" ]; then
17
+        echo "The $SERVER_NAME is running...!"
18
+        echo "PID: $PIDS"
19
+        exit 0
20
+    else
21
+        echo "The $SERVER_NAME is stopped"
22
+        exit 0
23
+    fi
24
+fi
25
+
26
+if [ -n "$PIDS" ]; then
27
+    echo "ERROR: The $SERVER_NAME already started!"
28
+    echo "PID: $PIDS"
29
+    exit 1
30
+fi
31
+
32
+if [ -n "$SERVER_PORT" ]; then
33
+    SERVER_PORT_COUNT=`netstat -tln | grep $SERVER_PORT | wc -l`
34
+    if [ $SERVER_PORT_COUNT -gt 0 ]; then
35
+        echo "ERROR: The $SERVER_NAME port $SERVER_PORT already used!"
36
+        exit 1
37
+    fi
38
+fi
39
+
40
+LOGS_DIR=$DEPLOY_DIR/logs
41
+if [ ! -d $LOGS_DIR ]; then
42
+    mkdir $LOGS_DIR
43
+fi
44
+STDOUT_FILE=$LOGS_DIR/stdout.log
45
+
46
+JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true "
47
+JAVA_DEBUG_OPTS=""
48
+if [ "$1" = "debug" ]; then
49
+    JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
50
+fi
51
+
52
+JAVA_JMX_OPTS=""
53
+if [ "$1" = "jmx" ]; then
54
+    JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
55
+fi
56
+
57
+JAVA_MEM_OPTS=""
58
+BITS=`java -version 2>&1 | grep -i 64-bit`
59
+if [ -n "$BITS" ]; then
60
+    JAVA_MEM_OPTS=" -server -Xmx512m -Xms512m -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
61
+else
62
+    JAVA_MEM_OPTS=" -server -Xms512m -Xmx512m -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
63
+fi
64
+
65
+CONFIG_FILES=" -Dspring.config.location=$CONF_DIR/ "
66
+echo -e "Starting the $SERVER_NAME ..."
67
+nohup java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS $CONFIG_FILES -jar $DEPLOY_DIR/lib/$JAR_NAME > $STDOUT_FILE 2>&1 &
68
+
69
+COUNT=0
70
+while [ $COUNT -lt 1 ]; do
71
+    echo -e ".\c"
72
+    sleep 1
73
+    if [ -n "$SERVER_PORT" ]; then
74
+        COUNT=`netstat -an | grep $SERVER_PORT | wc -l`
75
+    else
76
+        COUNT=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}' | wc -l`
77
+    fi
78
+    if [ $COUNT -gt 0 ]; then
79
+        break
80
+    fi
81
+done
82
+
83
+echo "OK!"
84
+PIDS=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}'`
85
+echo "PID: $PIDS"
86
+echo "STDOUT: $STDOUT_FILE"

+ 54
- 0
app-api/src/main/java/com/community/huiju/AppApplication.java 查看文件

@@ -0,0 +1,54 @@
1
+package com.community.huiju;
2
+
3
+import com.alibaba.fastjson.serializer.SerializerFeature;
4
+import com.alibaba.fastjson.support.config.FastJsonConfig;
5
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
6
+import org.springframework.boot.SpringApplication;
7
+import org.springframework.boot.autoconfigure.SpringBootApplication;
8
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
9
+import org.springframework.boot.web.servlet.MultipartConfigFactory;
10
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
11
+import org.springframework.cloud.openfeign.EnableFeignClients;
12
+import org.springframework.context.annotation.Bean;
13
+import org.springframework.transaction.annotation.EnableTransactionManagement;
14
+import org.springframework.web.client.RestTemplate;
15
+
16
+import javax.servlet.MultipartConfigElement;
17
+
18
+@EnableDiscoveryClient
19
+@SpringBootApplication
20
+@EnableFeignClients
21
+@EnableTransactionManagement
22
+public class AppApplication {
23
+
24
+	public static void main(String[] args) {
25
+		SpringApplication.run(AppApplication.class, args);
26
+	}
27
+
28
+	@Bean
29
+	public RestTemplate restTemplate(){
30
+		return new RestTemplate();
31
+	}
32
+
33
+	@Bean
34
+	public HttpMessageConverters fastJsonConfigure(){
35
+		FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
36
+		FastJsonConfig fastJsonConfig = new FastJsonConfig();
37
+		fastJsonConfig.setSerializerFeatures(SerializerFeature.BrowserCompatible,SerializerFeature.PrettyFormat,SerializerFeature.DisableCircularReferenceDetect,SerializerFeature.WriteMapNullValue);
38
+		//日期格式化
39
+		//fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
40
+		converter.setFastJsonConfig(fastJsonConfig);
41
+		return new HttpMessageConverters(converter);
42
+	}
43
+
44
+	/**
45
+	 * 文件上传临时路径
46
+	 */
47
+//	@Bean
48
+//	public MultipartConfigElement multipartConfigElement() {
49
+//		MultipartConfigFactory factory = new MultipartConfigFactory();
50
+//		factory.setLocation("/tmp/smart-community");
51
+//		return factory.createMultipartConfig();
52
+//	}
53
+
54
+}

+ 40
- 0
app-api/src/main/java/com/community/huiju/Swagger2.java 查看文件

@@ -0,0 +1,40 @@
1
+package com.community.huiju;
2
+
3
+import org.springframework.context.annotation.Bean;
4
+import org.springframework.context.annotation.Configuration;
5
+import springfox.documentation.builders.ApiInfoBuilder;
6
+import springfox.documentation.builders.PathSelectors;
7
+import springfox.documentation.builders.RequestHandlerSelectors;
8
+import springfox.documentation.service.ApiInfo;
9
+import springfox.documentation.service.Contact;
10
+import springfox.documentation.spi.DocumentationType;
11
+import springfox.documentation.spring.web.plugins.Docket;
12
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
13
+
14
+/**
15
+ * @author FXF
16
+ * @date 2018-09-27
17
+ */
18
+@Configuration
19
+@EnableSwagger2
20
+public class Swagger2 {
21
+    @Bean
22
+    public Docket docket(){
23
+        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
24
+                .apis(RequestHandlerSelectors.basePackage("com.community.huiju.controller"))
25
+                .paths(PathSelectors.any()).build();
26
+    }
27
+    //构建api文档的详细信息函数
28
+    private ApiInfo apiInfo(){
29
+        return new ApiInfoBuilder()
30
+                //页面标题
31
+                .title("app端的 RESTful API")
32
+                //创建人
33
+                .contact(new Contact("fuxingfan","","fuxingfan@dingtalk.com"))
34
+                //版本号
35
+                .version("1.0")
36
+                //描述
37
+                .description("API 描述")
38
+                .build();
39
+    }
40
+}

+ 91
- 0
app-api/src/main/java/com/community/huiju/aop/LogAOP.java 查看文件

@@ -0,0 +1,91 @@
1
+package com.community.huiju.aop;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.fushi.error.FuShiException;
5
+import com.community.huiju.log.LogAnnotation;
6
+import com.community.huiju.log.LogEnums;
7
+import com.community.huiju.log.LogFactory;
8
+import com.community.huiju.log.LogFileManager;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.aspectj.lang.JoinPoint;
11
+import org.aspectj.lang.ProceedingJoinPoint;
12
+import org.aspectj.lang.Signature;
13
+import org.aspectj.lang.annotation.AfterThrowing;
14
+import org.aspectj.lang.annotation.Around;
15
+import org.aspectj.lang.annotation.Aspect;
16
+import org.aspectj.lang.annotation.Pointcut;
17
+import org.aspectj.lang.reflect.MethodSignature;
18
+import org.springframework.stereotype.Component;
19
+
20
+import java.lang.reflect.Method;
21
+
22
+@Aspect
23
+@Component
24
+@Slf4j
25
+public class LogAOP {
26
+
27
+    @Pointcut("@annotation(com.community.huiju.log.LogAnnotation)")
28
+    public void pointLog() {
29
+
30
+    }
31
+
32
+    @Around("pointLog()")
33
+    public Object logAround(ProceedingJoinPoint point) throws Throwable {
34
+
35
+        // 获取切面的点的实例
36
+        Object target = point.getTarget();
37
+        // 获取反射对象
38
+        Class<?> zClass = target.getClass();
39
+        // 获取切面点
40
+        Signature signature = point.getSignature();
41
+
42
+        // 判断日志注解是否用在方法上
43
+        if (!(signature instanceof MethodSignature)) {
44
+            throw new RuntimeException("该注解只允许在方法上使用!");
45
+        }
46
+
47
+        // 方法名称
48
+        String methodName = signature.getName();
49
+        // 获取方法参数类型
50
+        Class<?>[] parameterTypes = ((MethodSignature) signature).getMethod().getParameterTypes();
51
+
52
+        // 通过方法名称和方法参数类型
53
+        // 获取当前正在执行切面的方法
54
+        Method method = zClass.getMethod(methodName, parameterTypes);
55
+
56
+        // 所有方法输入参数
57
+        Object[] args = point.getArgs();
58
+        // 执行方法的返回值
59
+        Object result = null;
60
+        if (null != method && method.isAnnotationPresent(LogAnnotation.class)) {
61
+
62
+            // 获取这个注解
63
+            LogAnnotation logAnnotation = method.getAnnotation(LogAnnotation.class);
64
+            // 大苏操作
65
+            if (logAnnotation.record() && logAnnotation.value() == LogEnums.DA_SU) {
66
+                String alias = "".equals(logAnnotation.alias()) ? "未设置别名" : logAnnotation.alias();
67
+                    log.info("AOP拦截----大苏操作----执行方法:{},方法别名:{}, 请求参数:{}", methodName, alias,args);
68
+                    // 方法返回值
69
+                    result = point.proceed();
70
+                    log.info("AOP拦截----大苏操作----执行方法:{},方法别名:{},请求参数:{},返回结果:{}", methodName, alias,args, result);
71
+
72
+                    String strPararmeter = String.format( "AOP拦截----大苏操作----执行方法:%s,方法别名:%s,请求参数:%s", methodName, alias,JSONObject.toJSONString(args));
73
+                    String strReturn = String.format("AOP拦截----大苏操作----执行方法:%s,方法别名:%s, 请求参数:%s,返回结果:%s", methodName, alias ,JSONObject.toJSONString(args), JSONObject.toJSONString(result));
74
+
75
+                    LogFileManager.getInstance().executeLog(LogFactory.parametersAndReturn(strPararmeter, strReturn));
76
+
77
+            }
78
+
79
+        }
80
+
81
+        return result;
82
+    }
83
+
84
+    @AfterThrowing(value = "pointLog()", throwing = "cause")
85
+    public void doException(JoinPoint joinPoint, Throwable cause) {
86
+        if (null != cause) {
87
+            throw new FuShiException(cause.getMessage());
88
+        }
89
+    }
90
+
91
+}

+ 246
- 0
app-api/src/main/java/com/community/huiju/common/PicUtils.java 查看文件

@@ -0,0 +1,246 @@
1
+package com.community.huiju.common;
2
+
3
+import com.community.commom.utils.FileUtils;
4
+import net.coobird.thumbnailator.Thumbnails;
5
+import org.apache.commons.fileupload.FileItem;
6
+import org.apache.commons.fileupload.disk.DiskFileItem;
7
+import org.apache.commons.io.IOUtils;
8
+import org.slf4j.Logger;
9
+import org.slf4j.LoggerFactory;
10
+import org.springframework.util.StringUtils;
11
+import org.springframework.web.multipart.MultipartFile;
12
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
13
+import sun.misc.BASE64Encoder;
14
+
15
+import javax.imageio.ImageIO;
16
+import java.awt.image.BufferedImage;
17
+import java.io.*;
18
+import java.math.BigDecimal;
19
+import java.net.HttpURLConnection;
20
+import java.net.URL;
21
+import java.nio.file.Files;
22
+
23
+/**
24
+ * 图片压缩Utils
25
+ *
26
+ * @author worstEzreal
27
+ * @version V1.1.0
28
+ * @date 2018/3/12
29
+ */
30
+public class PicUtils {
31
+
32
+    private static Logger logger = LoggerFactory.getLogger(PicUtils.class);
33
+
34
+    /**
35
+     * 根据指定大小压缩图片
36
+     *
37
+     * @param imageBytes  源图片字节数组
38
+     * @param desFileSize 指定图片大小,单位kb
39
+     * @param imageId     影像编号
40
+     * @return 压缩质量后的图片字节数组
41
+     */
42
+    public static byte[] compressPicForScale(byte[] imageBytes, long desFileSize, String imageId) {
43
+        if (imageBytes == null || imageBytes.length <= 0 || imageBytes.length < desFileSize * 1024) {
44
+            return imageBytes;
45
+        }
46
+        long srcSize = imageBytes.length;
47
+        double accuracy = getAccuracy(srcSize / 1024);
48
+        try {
49
+            while (imageBytes.length > desFileSize * 1024) {
50
+                ByteArrayInputStream inputStream = new ByteArrayInputStream(imageBytes);
51
+                ByteArrayOutputStream outputStream = new ByteArrayOutputStream(imageBytes.length);
52
+                Thumbnails.of(inputStream)
53
+                        .scale(accuracy)
54
+                        .outputQuality(accuracy)
55
+                        .toOutputStream(outputStream);
56
+                imageBytes = outputStream.toByteArray();
57
+            }
58
+            logger.info("【图片压缩】imageId={} | 图片原大小={}kb | 压缩后大小={}kb",
59
+                    imageId, srcSize / 1024, imageBytes.length / 1024);
60
+        } catch (Exception e) {
61
+            logger.error("【图片压缩】msg=图片压缩失败!", e);
62
+        }
63
+        return imageBytes;
64
+    }
65
+
66
+    /**
67
+     * 自动调节精度(经验数值)
68
+     *
69
+     * @param size 源图片大小
70
+     * @return 图片压缩质量比
71
+     */
72
+    private static double getAccuracy(long size) {
73
+        double accuracy;
74
+        if (size < 900) {
75
+            accuracy = 0.85;
76
+        } else if (size < 2047) {
77
+            accuracy = 0.6;
78
+        } else if (size < 3275) {
79
+            accuracy = 0.44;
80
+        } else {
81
+            accuracy = 0.4;
82
+        }
83
+        return accuracy;
84
+    }
85
+    
86
+    /**
87
+     * 图片进行Base64位编码
88
+     * @param fileBytes
89
+     * @return
90
+     */
91
+      public static String getImgStr(byte [] fileBytes) {
92
+        return new String(org.apache.commons.codec.binary.Base64.encodeBase64(fileBytes));
93
+    }
94
+
95
+    /**
96
+     * 图片进行Base64位编码
97
+     * @param imgFile
98
+     * @return
99
+     */
100
+   /* public static String getImgStr(MultipartFile imgFile){
101
+        byte[] data = null;
102
+        try
103
+        {
104
+            data = imgFile.getBytes();
105
+        }
106
+        catch (IOException e)
107
+        {
108
+            e.printStackTrace();
109
+        }
110
+        return new String(org.apache.commons.codec.binary.Base64.encodeBase64(data));
111
+    }*/
112
+
113
+    /**
114
+     * 把URL 图片转换为 Base64
115
+     * @param url
116
+     * @return
117
+     * @throws Exception
118
+     */
119
+    public static String encodeImageToBase64(URL url) {
120
+        //将图片文件转化为字节数组字符串,并对其进行Base64编码处理
121
+        System.out.println("图片的路径为:" + url.toString());
122
+        try {
123
+            byte[] data = encodeImageToOutputStream(url);
124
+            //对字节数组Base64编码
125
+            BASE64Encoder encoder = new BASE64Encoder();
126
+            String base64 = encoder.encode(data);
127
+            System.out.println("网络文件[{}]编码成base64字符串:[{}]"+url.toString()+base64);
128
+            return base64;//返回Base64编码过的字节数组字符串
129
+        } catch (Exception e) {
130
+            e.printStackTrace();
131
+        }
132
+
133
+        return null;
134
+    }
135
+
136
+    /**
137
+     * 把 URL 图片转换为 byte[]
138
+     * @param url
139
+     * @return
140
+     * @throws Exception
141
+     */
142
+    public static byte[] encodeImageToOutputStream(URL url) throws Exception {
143
+        byte[] data = null;
144
+        //将图片文件转化为字节数组字符串,并对其进行Base64编码处理
145
+        System.out.println("图片的路径为:" + url.toString());
146
+        //打开链接
147
+        HttpURLConnection conn = null;
148
+        try {
149
+            conn = (HttpURLConnection) url.openConnection();
150
+            //设置请求方式为"GET"
151
+            conn.setRequestMethod("GET");
152
+            //超时响应时间为5秒
153
+            conn.setConnectTimeout(5 * 1000);
154
+            //通过输入流获取图片数据
155
+            InputStream inStream = conn.getInputStream();
156
+            //得到图片的二进制数据,以二进制封装得到数据,具有通用性
157
+            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
158
+            //创建一个Buffer字符串
159
+            byte[] buffer = new byte[1024];
160
+            //每次读取的字符串长度,如果为-1,代表全部读取完毕
161
+            int len = 0;
162
+            //使用一个输入流从buffer里把数据读取出来
163
+            while ((len = inStream.read(buffer)) != -1) {
164
+                //用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度
165
+                outStream.write(buffer, 0, len);
166
+            }
167
+            //关闭输入流
168
+            inStream.close();
169
+            data = outStream.toByteArray();
170
+            outStream.close();
171
+        } catch (IOException e) {
172
+            e.printStackTrace();
173
+            throw new Exception("图片上传失败,请联系客服!");
174
+        }
175
+
176
+       return data;
177
+    }
178
+
179
+
180
+    /**
181
+     * byte 转换为 MultipartFile
182
+     * @param bytes
183
+     * @return
184
+     */
185
+    public static MultipartFile encodeToMultipartFile(byte [] bytes) {
186
+        MultipartFile multipartFile = null;
187
+        InputStream input = null;
188
+        OutputStream outputStream = null;
189
+        File tempFile = null;
190
+        try {
191
+            String path = "";
192
+            String os = System.getProperty("os.name");
193
+            if(os.toLowerCase().startsWith("win")){
194
+                path = "E:" + File.separator + "file" + File.separator + "app-file" + File.separator;
195
+            } else {
196
+                path = "/home/fxf/smart-community" + File.separator + "file" + File.separator + "app-file" + File.separator;
197
+            }
198
+
199
+            File file = new File(path);
200
+            file.mkdirs();
201
+            path = path + System.currentTimeMillis() + ".png";
202
+            tempFile = new File(path);
203
+            tempFile.createNewFile();
204
+
205
+            // 把 byte 转换为 File 文件
206
+            FileUtils.getFileByBytes(bytes, path);
207
+
208
+            // 第一个参数 fieldName 就是文件上传的 name, 这里我写的是 uploadFile
209
+            FileItem fileItem = new DiskFileItem("uploadFile", Files.probeContentType(tempFile.toPath()), false, tempFile.getName(), (int) tempFile.length(), tempFile.getParentFile());
210
+            input = new FileInputStream(tempFile);
211
+            outputStream = fileItem.getOutputStream();
212
+            IOUtils.copy(input, outputStream);
213
+
214
+            multipartFile = new CommonsMultipartFile(fileItem);
215
+
216
+
217
+        } catch (Exception e) {
218
+            e.printStackTrace();
219
+        } finally {
220
+            try {
221
+                input.close();
222
+                outputStream.close();
223
+            } catch (Exception e) {
224
+                e.printStackTrace();
225
+            }
226
+
227
+        }
228
+
229
+        // 删除这个 File
230
+        if (tempFile.exists()) {
231
+            tempFile.delete();
232
+        }
233
+
234
+        return multipartFile;
235
+    }
236
+
237
+
238
+}
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+

+ 54
- 0
app-api/src/main/java/com/community/huiju/common/code/ICode.java 查看文件

@@ -0,0 +1,54 @@
1
+package com.community.huiju.common.code;
2
+
3
+
4
+import com.community.commom.utils.AccountValidatorUtil;
5
+import com.community.huiju.common.code.cache.AppkeyCache;
6
+import com.community.huiju.exception.WisdomException;
7
+import lombok.extern.slf4j.Slf4j;
8
+import org.apache.commons.lang.StringUtils;
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+
12
+/**
13
+ * 验证码接口
14
+ * @author weiximei
15
+ */
16
+public interface ICode {
17
+
18
+    Logger log = LoggerFactory.getLogger(ICode.class);
19
+
20
+    /**
21
+     * 验证码
22
+     */
23
+    boolean sendCode(String phone,String code);
24
+
25
+    /**
26
+     * 校验手机号和验证码
27
+     * @param phone
28
+     * @param code
29
+     */
30
+    default void checkPhoneAndCode(String phone,String code) {
31
+        checkPhone(phone);
32
+        String phoneCode = (String) AppkeyCache.getCache(phone);
33
+        if (StringUtils.isBlank(code)) {
34
+            throw new WisdomException("请输入验证码!");
35
+        } else if (!code.equals(phoneCode)) {
36
+            throw new WisdomException("验证码错误!");
37
+        }
38
+        // 设置验证码为null字符
39
+        // AppkeyCache.setCache(phone,"null");
40
+
41
+    }
42
+
43
+    /**
44
+     * 检验手机号
45
+     * @param phone
46
+     */
47
+    default void checkPhone(String phone) {
48
+        log.info("{} 手机号校验结果: {}",phone, AccountValidatorUtil.isPhone(phone));
49
+        if (!AccountValidatorUtil.isPhone(phone)){
50
+            throw new WisdomException("请输入正确的手机号!");
51
+        }
52
+    }
53
+
54
+}

+ 46
- 0
app-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java 查看文件

@@ -0,0 +1,46 @@
1
+package com.community.huiju.common.code.cache;
2
+import com.community.commom.constant.Constant;
3
+import com.google.common.cache.CacheBuilder;
4
+import com.google.common.cache.CacheLoader;
5
+import com.google.common.cache.LoadingCache;
6
+import lombok.extern.slf4j.Slf4j;
7
+import java.util.concurrent.TimeUnit;
8
+
9
+/**
10
+ * 缓存
11
+ * @author weiximei
12
+ */
13
+@Slf4j
14
+public class AppkeyCache {
15
+
16
+    // .refreshAfterWrite(3, TimeUnit.HOURS)// 给定时间内没有被读/写访问,则回收。
17
+    static LoadingCache<String, Object> cache = CacheBuilder.newBuilder()
18
+            .expireAfterAccess(Constant.CACHE_EXPIRE, TimeUnit.HOURS)// 缓存过期时间和redis缓存时长一样
19
+            .maximumSize(Constant.CACHE_SIZE).// 设置缓存个数
20
+            build(new CacheLoader<String, Object>() {
21
+            @Override
22
+            /** 当本地缓存命没有中时,调用load方法获取结果并将结果缓存 **/
23
+            public String load(String appKey) throws Exception {
24
+                return null;
25
+            }
26
+
27
+    });
28
+
29
+    public static Object getCache(String appKey) {
30
+        Object value = null;
31
+        try {
32
+            value = cache.get(appKey);
33
+        } catch (Exception e) {
34
+            //e.printStackTrace();
35
+            value = null;
36
+        }
37
+        return value;
38
+    }
39
+
40
+    public static void setCache(String appKey,Object appValue){
41
+        log.info("缓存的key-value: {}-{}", appKey,appValue);
42
+        cache.put(appKey,appValue);
43
+    }
44
+
45
+
46
+}

+ 23
- 0
app-api/src/main/java/com/community/huiju/common/code/entity/CodeEntity.java 查看文件

@@ -0,0 +1,23 @@
1
+package com.community.huiju.common.code.entity;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+
7
+@Data
8
+@AllArgsConstructor
9
+@NoArgsConstructor
10
+public class CodeEntity {
11
+
12
+   private String code;
13
+
14
+   private String tel;
15
+
16
+    /**
17
+     * 参数 格式 String params = "["xxx"]"
18
+     */
19
+   private String params;
20
+
21
+
22
+
23
+}

+ 12
- 0
app-api/src/main/java/com/community/huiju/common/code/impl/ImgCodeImpl.java 查看文件

@@ -0,0 +1,12 @@
1
+package com.community.huiju.common.code.impl;
2
+
3
+
4
+/**
5
+ * 图片验证码
6
+ * @author weiximei
7
+ */
8
+public class ImgCodeImpl {
9
+
10
+
11
+
12
+}

+ 74
- 0
app-api/src/main/java/com/community/huiju/common/code/impl/PhoneCodeImpl.java 查看文件

@@ -0,0 +1,74 @@
1
+package com.community.huiju.common.code.impl;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.utils.AccountValidatorUtil;
5
+import com.community.huiju.common.code.ICode;
6
+import com.community.huiju.common.code.cache.AppkeyCache;
7
+import lombok.extern.slf4j.Slf4j;
8
+import okhttp3.*;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.stereotype.Service;
11
+import org.springframework.web.client.RestTemplate;
12
+
13
+import java.io.IOException;
14
+import java.util.concurrent.TimeUnit;
15
+
16
+/**
17
+ * 手机验证码
18
+ * @author weiximei
19
+ */
20
+@Service("phoneCodeImpl")
21
+@Slf4j
22
+public class PhoneCodeImpl implements ICode {
23
+
24
+    public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
25
+
26
+    @Autowired
27
+    private RestTemplate restTemplate;
28
+
29
+    public OkHttpClient getClient() {
30
+        OkHttpClient client  = new OkHttpClient.Builder()
31
+                .connectTimeout(10, TimeUnit.SECONDS)
32
+                .writeTimeout(10,TimeUnit.SECONDS)
33
+                .readTimeout(20, TimeUnit.SECONDS)
34
+                .build();
35
+        return client;
36
+    }
37
+
38
+    @Override
39
+    public boolean sendCode(String phone, String code) {
40
+        boolean bool = false;
41
+
42
+        try {
43
+            String result = null;
44
+            OkHttpClient client = getClient();
45
+            RequestBody body = RequestBody.create(JSON, "{\"code\":\""+Constant.CODE+"\"," + "\"tel\":\""+phone+"\"," + "\"params\":[\""+code+"\",\"银城慧家\"]}");
46
+            Request request = new Request.Builder()
47
+                    .url(Constant.REQUEST_URL)
48
+                    .post(body)
49
+                    .build();
50
+            Response response = client.newCall(request).execute();
51
+            if (response.isSuccessful()) {
52
+                result = response.body().string();
53
+            } else {
54
+                throw new IOException("Unexpected code " + response);
55
+            }
56
+
57
+
58
+
59
+            if ("发送成功".equals(result)) {
60
+                bool = true;
61
+                log.info("手机号 {} 验证码 {} 发送成功!",phone,code);
62
+            }else {
63
+                bool = false;
64
+                log.error("短信发送验证码失败!{}", result);
65
+            }
66
+        } catch (Exception e){
67
+            e.printStackTrace();
68
+            log.error("短信发送错误!",e);
69
+            bool = false;
70
+        }
71
+
72
+        return bool;
73
+    }
74
+}

+ 268
- 0
app-api/src/main/java/com/community/huiju/common/fushi/Base64.java 查看文件

@@ -0,0 +1,268 @@
1
+package com.community.huiju.common.fushi;
2
+
3
+public final class Base64 {
4
+
5
+	private static final int BASELENGTH = 128;
6
+	private static final int LOOKUPLENGTH = 64;
7
+	private static final int TWENTYFOURBITGROUP = 24;
8
+	private static final int EIGHTBIT = 8;
9
+	private static final int SIXTEENBIT = 16;
10
+	private static final int FOURBYTE = 4;
11
+	private static final int SIGN = -128;
12
+	private static char PAD = '=';
13
+	private static byte[] base64Alphabet = new byte[BASELENGTH];
14
+	private static char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH];
15
+
16
+	static {
17
+		for (int i = 0; i < BASELENGTH; ++i) {
18
+			base64Alphabet[i] = -1;
19
+		}
20
+		for (int i = 'Z'; i >= 'A'; i--) {
21
+			base64Alphabet[i] = (byte) (i - 'A');
22
+		}
23
+		for (int i = 'z'; i >= 'a'; i--) {
24
+			base64Alphabet[i] = (byte) (i - 'a' + 26);
25
+		}
26
+
27
+		for (int i = '9'; i >= '0'; i--) {
28
+			base64Alphabet[i] = (byte) (i - '0' + 52);
29
+		}
30
+
31
+		base64Alphabet['+'] = 62;
32
+		base64Alphabet['/'] = 63;
33
+
34
+		for (int i = 0; i <= 25; i++) {
35
+			lookUpBase64Alphabet[i] = (char) ('A' + i);
36
+		}
37
+
38
+		for (int i = 26, j = 0; i <= 51; i++, j++) {
39
+			lookUpBase64Alphabet[i] = (char) ('a' + j);
40
+		}
41
+
42
+		for (int i = 52, j = 0; i <= 61; i++, j++) {
43
+			lookUpBase64Alphabet[i] = (char) ('0' + j);
44
+		}
45
+		lookUpBase64Alphabet[62] = (char) '+';
46
+		lookUpBase64Alphabet[63] = (char) '/';
47
+
48
+	}
49
+
50
+	private static boolean isWhiteSpace(char octect) {
51
+		return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9);
52
+	}
53
+
54
+	private static boolean isPad(char octect) {
55
+		return (octect == PAD);
56
+	}
57
+
58
+	private static boolean isData(char octect) {
59
+		return (octect < BASELENGTH && base64Alphabet[octect] != -1);
60
+	}
61
+
62
+	/**
63
+	 * Encodes hex octects into Base64
64
+	 * 
65
+	 * @param binaryData
66
+	 *            Array containing binaryData
67
+	 * @return Encoded Base64 array
68
+	 */
69
+	public static String encode(byte[] binaryData) {
70
+
71
+		if (binaryData == null) {
72
+			return null;
73
+		}
74
+
75
+		int lengthDataBits = binaryData.length * EIGHTBIT;
76
+		if (lengthDataBits == 0) {
77
+			return "";
78
+		}
79
+
80
+		int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
81
+		int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
82
+		int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1
83
+				: numberTriplets;
84
+		char encodedData[] = null;
85
+
86
+		encodedData = new char[numberQuartet * 4];
87
+
88
+		byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
89
+
90
+		int encodedIndex = 0;
91
+		int dataIndex = 0;
92
+
93
+		for (int i = 0; i < numberTriplets; i++) {
94
+			b1 = binaryData[dataIndex++];
95
+			b2 = binaryData[dataIndex++];
96
+			b3 = binaryData[dataIndex++];
97
+
98
+			l = (byte) (b2 & 0x0f);
99
+			k = (byte) (b1 & 0x03);
100
+
101
+			byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2)
102
+					: (byte) ((b1) >> 2 ^ 0xc0);
103
+			byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4)
104
+					: (byte) ((b2) >> 4 ^ 0xf0);
105
+			byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6)
106
+					: (byte) ((b3) >> 6 ^ 0xfc);
107
+
108
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
109
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
110
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3];
111
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f];
112
+		}
113
+
114
+		// form integral number of 6-bit groups
115
+		if (fewerThan24bits == EIGHTBIT) {
116
+			b1 = binaryData[dataIndex];
117
+			k = (byte) (b1 & 0x03);
118
+			
119
+			byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2)
120
+					: (byte) ((b1) >> 2 ^ 0xc0);
121
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
122
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4];
123
+			encodedData[encodedIndex++] = PAD;
124
+			encodedData[encodedIndex++] = PAD;
125
+		} else if (fewerThan24bits == SIXTEENBIT) {
126
+			b1 = binaryData[dataIndex];
127
+			b2 = binaryData[dataIndex + 1];
128
+			l = (byte) (b2 & 0x0f);
129
+			k = (byte) (b1 & 0x03);
130
+
131
+			byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2)
132
+					: (byte) ((b1) >> 2 ^ 0xc0);
133
+			byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4)
134
+					: (byte) ((b2) >> 4 ^ 0xf0);
135
+
136
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
137
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
138
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2];
139
+			encodedData[encodedIndex++] = PAD;
140
+		}
141
+
142
+		return new String(encodedData);
143
+	}
144
+
145
+	/**
146
+	 * Decodes Base64 data into octects
147
+	 * 
148
+	 * @param encoded
149
+	 *            string containing Base64 data
150
+	 * @return Array containind decoded data.
151
+	 */
152
+	public static byte[] decode(String encoded) {
153
+
154
+		if (encoded == null) {
155
+			return null;
156
+		}
157
+
158
+		char[] base64Data = encoded.toCharArray();
159
+		// remove white spaces
160
+		int len = removeWhiteSpace(base64Data);
161
+
162
+		if (len % FOURBYTE != 0) {
163
+			return null;// should be divisible by four
164
+		}
165
+
166
+		int numberQuadruple = (len / FOURBYTE);
167
+
168
+		if (numberQuadruple == 0) {
169
+			return new byte[0];
170
+		}
171
+
172
+		byte decodedData[] = null;
173
+		byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
174
+		char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
175
+
176
+		int i = 0;
177
+		int encodedIndex = 0;
178
+		int dataIndex = 0;
179
+		decodedData = new byte[(numberQuadruple) * 3];
180
+
181
+		for (; i < numberQuadruple - 1; i++) {
182
+
183
+			if (!isData((d1 = base64Data[dataIndex++]))
184
+					|| !isData((d2 = base64Data[dataIndex++]))
185
+					|| !isData((d3 = base64Data[dataIndex++]))
186
+					|| !isData((d4 = base64Data[dataIndex++]))) {
187
+				return null;
188
+			}// if found "no data" just return null
189
+
190
+			b1 = base64Alphabet[d1];
191
+			b2 = base64Alphabet[d2];
192
+			b3 = base64Alphabet[d3];
193
+			b4 = base64Alphabet[d4];
194
+
195
+			decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
196
+			decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
197
+			decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
198
+		}
199
+
200
+		if (!isData((d1 = base64Data[dataIndex++]))
201
+				|| !isData((d2 = base64Data[dataIndex++]))) {
202
+			return null;// if found "no data" just return null
203
+		}
204
+
205
+		b1 = base64Alphabet[d1];
206
+		b2 = base64Alphabet[d2];
207
+
208
+		d3 = base64Data[dataIndex++];
209
+		d4 = base64Data[dataIndex++];
210
+		if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters
211
+			if (isPad(d3) && isPad(d4)) {
212
+				if ((b2 & 0xf) != 0)// last 4 bits should be zero
213
+				{
214
+					return null;
215
+				}
216
+				byte[] tmp = new byte[i * 3 + 1];
217
+				System.arraycopy(decodedData, 0, tmp, 0, i * 3);
218
+				tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
219
+				return tmp;
220
+			} else if (!isPad(d3) && isPad(d4)) {
221
+				b3 = base64Alphabet[d3];
222
+				if ((b3 & 0x3) != 0)// last 2 bits should be zero
223
+				{
224
+					return null;
225
+				}
226
+				byte[] tmp = new byte[i * 3 + 2];
227
+				System.arraycopy(decodedData, 0, tmp, 0, i * 3);
228
+				tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
229
+				tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
230
+				return tmp;
231
+			} else {
232
+				return null;
233
+			}
234
+		} else { // No PAD e.g 3cQl
235
+			b3 = base64Alphabet[d3];
236
+			b4 = base64Alphabet[d4];
237
+			decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
238
+			decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
239
+			decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
240
+
241
+		}
242
+
243
+		return decodedData;
244
+	}
245
+
246
+	/**
247
+	 * remove WhiteSpace from MIME containing encoded Base64 data.
248
+	 * 
249
+	 * @param data
250
+	 *            the byte array of base64 data (with WS)
251
+	 * @return the new length
252
+	 */
253
+	private static int removeWhiteSpace(char[] data) {
254
+		if (data == null) {
255
+			return 0;
256
+		}
257
+
258
+		// count characters that's not whitespace
259
+		int newSize = 0;
260
+		int len = data.length;
261
+		for (int i = 0; i < len; i++) {
262
+			if (!isWhiteSpace(data[i])) {
263
+				data[newSize++] = data[i];
264
+			}
265
+		}
266
+		return newSize;
267
+	}
268
+}

+ 166
- 0
app-api/src/main/java/com/community/huiju/common/fushi/FSApi.java 查看文件

@@ -0,0 +1,166 @@
1
+package com.community.huiju.common.fushi;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+
5
+import java.io.BufferedReader;
6
+import java.io.IOException;
7
+import java.io.InputStreamReader;
8
+import java.io.OutputStream;
9
+import java.net.HttpURLConnection;
10
+import java.net.URL;
11
+import java.security.KeyFactory;
12
+import java.security.PrivateKey;
13
+import java.security.spec.PKCS8EncodedKeySpec;
14
+import java.util.Map;
15
+import java.util.SortedMap;
16
+import java.util.TreeMap;
17
+
18
+public class FSApi {
19
+
20
+    //	private static String url = "http://mops-test.fujica.com.cn:8021/Api/Park/GetParkInfoByCarNo";
21
+    private static String url = "http://api.mops.fujica.com.cn/v2/Api/Park/GetParkInfoByCarNo";
22
+    private static String appid = "fujica_89aa0f62d7ec77fc";
23
+    private static String appSecret = "cef36935e0954f40afc519a43a0c857c";
24
+    private static String privateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALATu5WNNx+XcrAS\n" +
25
+            "NJieGRsY7VryQjcs+pABXGh4BOCqAW3FgAAc21aIG0uxvYHdQUw1I7J80RiQJ506\n" +
26
+            "aIktGTmZKJTjez7JNF7GO4ieGmLMI3ds8iXyJrfUMp/1U3Cq6vja8vuRIKYVQCxZ\n" +
27
+            "e8un98Nr03F7oMlKpBydJQKVdlAHAgMBAAECgYBPcqfqhAyCWbCrF5vZ3URQwL+g\n" +
28
+            "kL0l7kqknaiXjsgMo0j/weTOqDaj5cgDMJDkvvPOsg+IYt9qKOlm/Urb0piVb9v9\n" +
29
+            "iAnp6gIppcyHrPUesgYRSbqR/HhdGtnzn/4f45YpkXA6URMfc04xBrIUCw5Dmnqo\n" +
30
+            "nJZJkjd6jjXiL65rYQJBAN8eg99yFH45D2cdlPBTN0LVWXgqy3N22byYh0j6kgo2\n" +
31
+            "5WOPMcuIZPM/XdSoTfhYeHixvEwrmCAkCmSkf524prECQQDKBnzZRj3eCij1z2SZ\n" +
32
+            "JCRZhRQUhFmK0AYYTXw9R0DfEaZNrEAe8PEypS94lYROvNV3TnSnK2FHKeH8YhHX\n" +
33
+            "EoA3AkBRHzMrRrsUuYJUJ3lDd74b2p5RBp46OPgpjfuCGTiH5jW44RNlwQ2TM3LW\n" +
34
+            "IutWZDRJDbY8q40AApqUxQpxOfXBAkA8bB5RGZoNW7qOcj3jM5UPlSbBUCg7xSXd\n" +
35
+            "hOdAqJv1W6ECoB75YhSxkggVp5pPtlid+0AWc3n/v74QLwCo86aXAkEAlxY3hoxQ\n" +
36
+            "jJiCjD2PbL0GLkMKNBqJgLcDWqeoHcal+iY2Fpr3U/iCJZNoBuovC2Qvc5J1y61P\n" +
37
+            "ojrvFNyFMEkWTQ==";
38
+    private static String sign = "";
39
+    private static String time;
40
+
41
+    public static void main(String[] args) {
42
+        time = getTimestamp();
43
+        String jsonString = "{'ParkingCode':'19000100250504','CarNo':'苏A8M6B2'}";
44
+
45
+        TreeMap<String, String> map = new TreeMap();
46
+        map.put("param", jsonString);
47
+        map.put("secret", appSecret);
48
+        map.put("timestamp", time);
49
+        sign = signWithoutMD5(map);
50
+        sign = sign(sign, privateKey);
51
+
52
+        doJsonPost(url, jsonString);
53
+    }
54
+
55
+    public static String doJsonPost(String urlPath, String Json) {
56
+        String result = "";
57
+        BufferedReader reader = null;
58
+        try {
59
+            URL url = new URL(urlPath);
60
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
61
+            conn.setRequestMethod("POST");
62
+            conn.setDoOutput(true);
63
+            conn.setDoInput(true);
64
+            conn.setUseCaches(false);
65
+            conn.setRequestProperty("Connection", "Keep-Alive");
66
+            conn.setRequestProperty("Charset", "UTF-8");
67
+            conn.setRequestProperty("appid", appid);
68
+            conn.setRequestProperty("appSecret", appSecret);
69
+            conn.setRequestProperty("sign", sign);
70
+            conn.setRequestProperty("timestamp", time);
71
+            // 设置文件类型:
72
+            conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
73
+            // 设置接收类型否则返回415错误
74
+            conn.setRequestProperty("accept", "*/*");// 此处为暴力方法设置接受所有类型,以此来防范返回415;
75
+            conn.setRequestProperty("accept", "application/json");
76
+            // 往服务器里面发送数据
77
+            if (Json != null && !("").equals(Json)) {
78
+                byte[] writebytes = Json.getBytes();
79
+                // 设置文件长度
80
+                conn.setRequestProperty("Content-Length", String.valueOf(writebytes.length));
81
+                OutputStream outwritestream = (OutputStream) conn.getOutputStream();
82
+                outwritestream.write(Json.getBytes());
83
+                outwritestream.flush();
84
+                outwritestream.close();
85
+
86
+            }
87
+            if (conn.getResponseCode() == 200) {
88
+                reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
89
+                result = reader.readLine();
90
+                System.out.println(result);
91
+            }
92
+        } catch (Exception e) {
93
+            e.printStackTrace();
94
+        } finally {
95
+            if (reader != null) {
96
+                try {
97
+                    reader.close();
98
+                } catch (IOException e) {
99
+                    e.printStackTrace();
100
+                }
101
+            }
102
+        }
103
+        return result;
104
+    }
105
+
106
+    public static String getTimestamp() {
107
+        String time = "";
108
+        long timestamp = System.currentTimeMillis();
109
+        time = String.valueOf(timestamp);
110
+        time = time.substring(0, 10);
111
+        return time;
112
+    }
113
+
114
+    public static String signWithoutMD5(SortedMap<String, String> params) {
115
+        String restul = "";
116
+        if (params == null) {
117
+            return restul;
118
+        }
119
+
120
+        StringBuilder sb = new StringBuilder();
121
+        for (Map.Entry<String, String> me : params.entrySet()) {
122
+
123
+            sb.append(me.getKey());
124
+            sb.append('=');
125
+            sb.append(me.getValue());
126
+            sb.append('&');
127
+
128
+        }
129
+        int lastIndexOf = sb.lastIndexOf("&");
130
+        if (lastIndexOf != -1) {
131
+            sb.deleteCharAt(lastIndexOf);
132
+        }
133
+        restul = new String(sb);
134
+
135
+        return restul;
136
+    }
137
+
138
+    private static final String ALGORITHM = "RSA";
139
+    private static final String SIGN_ALGORITHMS = "SHA1WithRSA";
140
+
141
+    private static final String DEFAULT_CHARSET = "UTF-8";
142
+
143
+    public static String sign(String content, String privateKey) {
144
+        try {
145
+            PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64.decode(privateKey));
146
+            KeyFactory keyf = KeyFactory.getInstance(ALGORITHM);
147
+
148
+            PrivateKey priKey = keyf.generatePrivate(priPKCS8);
149
+
150
+            java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS);
151
+
152
+            signature.initSign(priKey);
153
+            signature.update(content.getBytes(DEFAULT_CHARSET));
154
+
155
+            byte[] signed = signature.sign();
156
+
157
+            return Base64.encode(signed);
158
+        } catch (Exception e) {
159
+            e.printStackTrace();
160
+        }
161
+
162
+        return null;
163
+    }
164
+
165
+
166
+}

+ 35
- 0
app-api/src/main/java/com/community/huiju/common/messagePush.java 查看文件

@@ -0,0 +1,35 @@
1
+package com.community.huiju.common;
2
+
3
+import java.text.SimpleDateFormat;
4
+import java.util.ArrayList;
5
+import java.util.Calendar;
6
+import java.util.Date;
7
+import java.util.List;
8
+
9
+/**
10
+ * version V1.0
11
+ * class_name: $METHOD_NAME$
12
+ * param: $METHOD_PARAM$
13
+ * describe: TODO
14
+ * creat_user:fannaixi
15
+ * creat_time: 2019/4/18
16
+ **/
17
+public class messagePush {
18
+    public String[]  messagePushAll() {
19
+        String[] messageArr= new String[13];
20
+        messageArr[0] = "账号已审核通过,看看下面的消息了解下APP如何使用吧!";
21
+        messageArr[1] = "点击顶部小区名称,切换到其他房产或小区,或关联更多房产";
22
+        messageArr[2] = "点击上方 人脸录入,为自己或家人录入人脸信息,家人未注册可先替TA注册";
23
+        messageArr[3] = "点击上方 访客邀请,将生成的二维码发送给访客,访客即可使用二维码开门";
24
+        messageArr[4] = "点击上方 公区监控,查看小区公共区域视频直播,看看大家都在干什么";
25
+        messageArr[5] = "点击上方 智能家居,安装APP玩转室内智能家居设备";
26
+        messageArr[6] = "想知道物业公告和社区活动?点击底部 论坛 查看";
27
+        messageArr[7] = "参与社区议事,发布二手/求购/租赁等热门话题,点击底部 论坛 话题";
28
+        messageArr[8] = "点击底部开锁图标,获取开门二维码,即可扫码开门";
29
+        messageArr[9] = "楼道灯不亮,电梯坏了,通下水道,找保洁?点击底部 服务 报修";
30
+        messageArr[10] = "想投诉施工扰民、乱搭乱建、乱停车?点击底部 服务 投诉";
31
+        messageArr[11] = "有很急的事需要马上联系物业?点击底部 服务 物业 电话联系物业";
32
+        messageArr[12] = "家人想刷脸进门不会操作?点击底部 个人 房屋成员管理 邀请新成员为TA录入人脸";
33
+        return  messageArr;
34
+    }
35
+}

+ 26
- 0
app-api/src/main/java/com/community/huiju/common/perproties/DaSuProperties.java 查看文件

@@ -0,0 +1,26 @@
1
+package com.community.huiju.common.perproties;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+import org.springframework.boot.context.properties.ConfigurationProperties;
7
+import org.springframework.stereotype.Component;
8
+
9
+/**
10
+ * 提供给 大苏 的 appid 和 appsecret
11
+ * @author weiximei
12
+ */
13
+@Component
14
+@ConfigurationProperties(prefix = "da-su")
15
+@Data
16
+@AllArgsConstructor
17
+@NoArgsConstructor
18
+public class DaSuProperties {
19
+
20
+    private String appid;
21
+
22
+    private String appSecret;
23
+
24
+    private String communityId;
25
+
26
+}

+ 44
- 0
app-api/src/main/java/com/community/huiju/common/perproties/FuShiProperties.java 查看文件

@@ -0,0 +1,44 @@
1
+package com.community.huiju.common.perproties;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+import org.springframework.boot.context.properties.ConfigurationProperties;
7
+import org.springframework.stereotype.Component;
8
+
9
+/**
10
+ * 富士配置类
11
+ * @author weiximei
12
+ */
13
+@AllArgsConstructor
14
+@NoArgsConstructor
15
+@Data
16
+@Component
17
+@ConfigurationProperties(prefix = "fu-shi")
18
+public class FuShiProperties {
19
+
20
+    /**
21
+     * 富士云 请求地址
22
+     */
23
+    private String url;
24
+
25
+    /**
26
+     * 富士云 appid
27
+     */
28
+    private String appid;
29
+
30
+    /**
31
+     * 富士云 appSecret
32
+     */
33
+    private String appSecret;
34
+
35
+    /**
36
+     * 富士云 私钥 privateKey
37
+     */
38
+    private String privateKey;
39
+
40
+    /**
41
+     * 停车场编码
42
+     */
43
+    private String parkingCode;
44
+}

+ 37
- 0
app-api/src/main/java/com/community/huiju/common/perproties/LoginCodePerproties.java 查看文件

@@ -0,0 +1,37 @@
1
+package com.community.huiju.common.perproties;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+import org.springframework.boot.context.properties.ConfigurationProperties;
7
+import org.springframework.stereotype.Component;
8
+
9
+import java.util.Map;
10
+
11
+/**
12
+ * 登陆的状态跳转url配置
13
+ * @author weiximei
14
+ */
15
+@ConfigurationProperties(prefix = "login-code-perproties")
16
+@Component
17
+@Data
18
+@AllArgsConstructor
19
+@NoArgsConstructor
20
+public class LoginCodePerproties {
21
+
22
+    /**
23
+     * 状态url集合
24
+     */
25
+    private Map<String, String> loginCode;
26
+
27
+    /**
28
+     * app 请求地址
29
+     */
30
+    private String appUrl;
31
+
32
+    /**
33
+     * 默认的演示账号
34
+     */
35
+    private String phone;
36
+
37
+}

+ 47
- 0
app-api/src/main/java/com/community/huiju/common/perproties/PayNotifyPerproties.java 查看文件

@@ -0,0 +1,47 @@
1
+package com.community.huiju.common.perproties;
2
+
3
+import lombok.Data;
4
+import org.springframework.boot.context.properties.ConfigurationProperties;
5
+import org.springframework.stereotype.Component;
6
+
7
+import java.math.BigDecimal;
8
+
9
+/**
10
+ * 支付回调地址配置
11
+ * @author weiximei
12
+ */
13
+@Component
14
+@ConfigurationProperties(prefix = "pay-notify")
15
+@Data
16
+public class PayNotifyPerproties {
17
+
18
+    /**
19
+     * 微信回调 物业缴费
20
+     */
21
+    private String wxBillNotify;
22
+
23
+    /**
24
+     * 支付宝回调 物业缴费
25
+     */
26
+    private String aliBillNotify;
27
+
28
+    /**
29
+     * 微信回调 车缴费
30
+     */
31
+    private String wxCarNotify;
32
+
33
+    /**
34
+     * 支付宝回调 车缴费
35
+     */
36
+    private String aliCarNotify;
37
+    
38
+    /**
39
+     * 微信临时车回调
40
+     */
41
+    private String wxTmpNotify;
42
+    
43
+    /**
44
+     * 支付宝临时车回调
45
+     */
46
+    private String aliTmpNotify;
47
+}

+ 23
- 0
app-api/src/main/java/com/community/huiju/common/perproties/WeiXinPerproties.java 查看文件

@@ -0,0 +1,23 @@
1
+package com.community.huiju.common.perproties;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+import org.springframework.boot.context.properties.ConfigurationProperties;
7
+import org.springframework.stereotype.Component;
8
+
9
+/**
10
+ * 微信信息
11
+ */
12
+@Component
13
+@ConfigurationProperties(prefix = "weixin")
14
+@Data
15
+@AllArgsConstructor
16
+@NoArgsConstructor
17
+public class WeiXinPerproties {
18
+
19
+    private String appid;
20
+
21
+    private String secret;
22
+
23
+}

+ 24
- 0
app-api/src/main/java/com/community/huiju/common/perproties/YinShiProperties.java 查看文件

@@ -0,0 +1,24 @@
1
+package com.community.huiju.common.perproties;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+import org.springframework.boot.context.properties.ConfigurationProperties;
7
+import org.springframework.stereotype.Component;
8
+
9
+/**
10
+ * 萤石 开放平台
11
+ */
12
+@Data
13
+@AllArgsConstructor
14
+@NoArgsConstructor
15
+@ConfigurationProperties(prefix = "ying-shi")
16
+@Component
17
+public class YinShiProperties {
18
+
19
+    /**
20
+     * 获取视频流 token 地址
21
+     */
22
+    public String videoTokenUrl;
23
+
24
+}

+ 83
- 0
app-api/src/main/java/com/community/huiju/common/sign/DaSuSign.java 查看文件

@@ -0,0 +1,83 @@
1
+package com.community.huiju.common.sign;
2
+
3
+import com.google.common.collect.Maps;
4
+import lombok.extern.slf4j.Slf4j;
5
+import org.apache.commons.codec.digest.DigestUtils;
6
+import org.apache.commons.lang3.StringUtils;
7
+
8
+import java.io.UnsupportedEncodingException;
9
+import java.util.Map;
10
+import java.util.Set;
11
+import java.util.TreeMap;
12
+
13
+/**
14
+ * 大苏签名校验
15
+ */
16
+@Slf4j
17
+public class DaSuSign {
18
+
19
+    /**
20
+     * 校验签名是否相等
21
+     * @param val_1
22
+     * @param val_2
23
+     * @return true 相等  false 不相等
24
+     */
25
+    public static boolean isMD5Sign(String val_1, String val_2) {
26
+        return StringUtils.equals(val_1, val_2);
27
+    }
28
+
29
+    /**
30
+     *
31
+     * 创建签名
32
+     *
33
+     * @param appid
34
+     * @param appSecret
35
+     * @param datetime 时间戳
36
+     * @param encrypt 加密方式(目前就 MD5)
37
+     * @param communityId 小区id
38
+     * @return
39
+     */
40
+    public static String createSign(String appid, String appSecret, String datetime, String encrypt, String communityId, String phone){
41
+        TreeMap<String ,Object> treeMap = Maps.newTreeMap();
42
+        treeMap.put("appid", appid);
43
+        treeMap.put("datetime", datetime);
44
+        treeMap.put("encrypt", encrypt);
45
+        treeMap.put("communityid", communityId);
46
+        treeMap.put("phone", phone);
47
+
48
+        String sign = "";
49
+
50
+        StringBuilder sb = new StringBuilder();
51
+        Set<Map.Entry<String, Object>> entries = treeMap.entrySet();
52
+        entries.forEach(e-> {
53
+            sb.append(e.getKey());
54
+            sb.append("=");
55
+            sb.append(e.getValue());
56
+            sb.append("&");
57
+        });
58
+
59
+        sign = sb.toString();
60
+        sign = sign.substring(0, sign.lastIndexOf("&"));
61
+
62
+        log.info("签名之前参数: {}" , sign);
63
+
64
+        try {
65
+            String str = new String(sign.getBytes("UTF-8"), "UTF-8");
66
+            sign = DigestUtils.md5Hex( str + appSecret);
67
+        } catch (UnsupportedEncodingException e) {
68
+            e.printStackTrace();
69
+        }
70
+
71
+        log.info("签名: {}" , sign);
72
+
73
+        return sign;
74
+    }
75
+
76
+    public static void main(String[] args) {
77
+
78
+        Long timeMillis = System.currentTimeMillis();
79
+        System.out.println(timeMillis);
80
+        String sign = createSign("dssdw2576sd997", "fgexhd855sf4", timeMillis + "", "md5", "101", "15850791953");
81
+    }
82
+
83
+}

+ 236
- 0
app-api/src/main/java/com/community/huiju/common/welcome/OkHttpRequestUtils.java 查看文件

@@ -0,0 +1,236 @@
1
+package com.community.huiju.common.welcome;
2
+
3
+import com.beust.jcommander.internal.Maps;
4
+import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream;
5
+import okhttp3.*;
6
+
7
+import java.io.*;
8
+import java.util.Iterator;
9
+import java.util.Map;
10
+
11
+/**
12
+ * 封装请求
13
+ * @author weiximei
14
+ */
15
+public class OkHttpRequestUtils {
16
+
17
+    // 定义请求客户端
18
+    private static OkHttpClient client = new OkHttpClient();
19
+
20
+    /**
21
+     * get 请求
22
+     * @param url 请求URL
23
+     * @return
24
+     * @throws Exception
25
+     */
26
+    public static String doGet(String url) throws Exception {
27
+       return doGet(url, Maps.newHashMap());
28
+    }
29
+
30
+
31
+    /**
32
+     * get 请求
33
+     * @param url 请求URL
34
+     * @param query 携带参数参数
35
+     * @return
36
+     * @throws Exception
37
+     */
38
+    public static String doGet(String url, Map<String, Object> query) throws Exception {
39
+
40
+        return doGet(url, Maps.newHashMap(), query);
41
+    }
42
+
43
+    /**
44
+     * get 请求
45
+     * @param url url
46
+     * @param header 请求头参数
47
+     * @param query 参数
48
+     * @return
49
+     */
50
+    public static String doGet(String url, Map<String, Object> header, Map<String, Object> query) throws Exception {
51
+
52
+        // 创建一个请求 Builder
53
+        Request.Builder builder = new Request.Builder();
54
+        // 创建一个 request
55
+        Request request = builder.url(url).build();
56
+
57
+        // 创建一个 HttpUrl.Builder
58
+        HttpUrl.Builder urlBuilder = request.url().newBuilder();
59
+        // 创建一个 Headers.Builder
60
+        Headers.Builder headerBuilder = request.headers().newBuilder();
61
+
62
+        // 装载请求头参数
63
+        Iterator<Map.Entry<String, Object>> headerIterator = header.entrySet().iterator();
64
+        headerIterator.forEachRemaining(e -> {
65
+            headerBuilder.add(e.getKey(), (String) e.getValue());
66
+        });
67
+
68
+        // 装载请求的参数
69
+        Iterator<Map.Entry<String, Object>> queryIterator = query.entrySet().iterator();
70
+        queryIterator.forEachRemaining(e -> {
71
+            urlBuilder.addQueryParameter(e.getKey(), (String) e.getValue());
72
+        });
73
+
74
+        // 设置自定义的 builder
75
+        builder.url(urlBuilder.build()).headers(headerBuilder.build());
76
+
77
+        try (Response execute = client.newCall(builder.build()).execute()) {
78
+            return execute.body().string();
79
+        }
80
+    }
81
+
82
+    /**
83
+     * post 请求, 请求参数 并且 携带文件上传
84
+     * @param url
85
+     * @param header
86
+     * @param parameter
87
+     * @param file
88
+     * @return
89
+     * @throws Exception
90
+     */
91
+    public static String doPost(String url, Map<String, Object> header, Map<String, Object> parameter, File file) throws Exception {
92
+
93
+        // 创建一个请求 Builder
94
+        Request.Builder builder = new Request.Builder();
95
+        // 创建一个 request
96
+        Request request = builder.url(url).build();
97
+
98
+        // 创建一个 Headers.Builder
99
+        Headers.Builder headerBuilder = request.headers().newBuilder();
100
+
101
+        // 装载请求头参数
102
+        Iterator<Map.Entry<String, Object>> headerIterator = header.entrySet().iterator();
103
+        headerIterator.forEachRemaining(e -> {
104
+            headerBuilder.add(e.getKey(), (String) e.getValue());
105
+        });
106
+
107
+        MultipartBody.Builder requestBuilder = new MultipartBody.Builder();
108
+
109
+        // 状态请求参数
110
+        Iterator<Map.Entry<String, Object>> queryIterator = parameter.entrySet().iterator();
111
+        queryIterator.forEachRemaining(e -> {
112
+            requestBuilder.addFormDataPart(e.getKey(), (String) e.getValue());
113
+        });
114
+
115
+        if (null != file) {
116
+            // application/octet-stream
117
+            requestBuilder.addFormDataPart("uploadFiles", file.getName(), RequestBody.create(MediaType.parse("application/octet-stream"), file));
118
+        }
119
+
120
+        // 设置自定义的 builder
121
+        builder.headers(headerBuilder.build()).post(requestBuilder.build());
122
+
123
+        // 然后再 build 一下
124
+        try (Response execute = client.newCall(builder.build()).execute()) {
125
+            return execute.body().string();
126
+        }
127
+    }
128
+
129
+    /**
130
+     * post 请求, 请求参数 并且 携带文件上传二进制流
131
+     * @param url
132
+     * @param header
133
+     * @param parameter
134
+     * @param fileName 文件名
135
+     * @param fileByte 文件的二进制流
136
+     * @return
137
+     * @throws Exception
138
+     */
139
+    public static String doPost(String url, Map<String, Object> header, Map<String, Object> parameter, String fileName, byte [] fileByte) throws Exception {
140
+// 创建一个请求 Builder
141
+        Request.Builder builder = new Request.Builder();
142
+        // 创建一个 request
143
+        Request request = builder.url(url).build();
144
+
145
+        // 创建一个 Headers.Builder
146
+        Headers.Builder headerBuilder = request.headers().newBuilder();
147
+
148
+        // 装载请求头参数
149
+        Iterator<Map.Entry<String, Object>> headerIterator = header.entrySet().iterator();
150
+        headerIterator.forEachRemaining(e -> {
151
+            headerBuilder.add(e.getKey(), (String) e.getValue());
152
+        });
153
+
154
+        MultipartBody.Builder requestBuilder = new MultipartBody.Builder();
155
+
156
+        // 状态请求参数
157
+        Iterator<Map.Entry<String, Object>> queryIterator = parameter.entrySet().iterator();
158
+        queryIterator.forEachRemaining(e -> {
159
+            requestBuilder.addFormDataPart(e.getKey(), (String) e.getValue());
160
+        });
161
+
162
+        if (fileByte.length > 0) {
163
+            // application/octet-stream
164
+            requestBuilder.addFormDataPart("uploadFiles", fileName, RequestBody.create(MediaType.parse("application/octet-stream"), fileByte));
165
+        }
166
+
167
+        // 设置自定义的 builder
168
+        builder.headers(headerBuilder.build()).post(requestBuilder.build());
169
+
170
+        try (Response execute = client.newCall(builder.build()).execute()) {
171
+            return execute.body().string();
172
+        }
173
+    }
174
+
175
+
176
+    /**
177
+     * post 请求  携带文件上传
178
+     * @param url
179
+     * @param file
180
+     * @return
181
+     * @throws Exception
182
+     */
183
+    public static String doPost(String url, File file) throws Exception {
184
+        return doPost(url, Maps.newHashMap(), Maps.newHashMap(), file);
185
+    }
186
+
187
+    /**
188
+     * post 请求
189
+     * @param url
190
+     * @param header 请求头
191
+     * @param parameter 参数
192
+     * @return
193
+     * @throws Exception
194
+     */
195
+    public static String doPost(String url, Map<String, Object> header, Map<String, Object> parameter) throws Exception {
196
+        return doPost(url, header, parameter, null);
197
+    }
198
+
199
+    /**
200
+     * post 请求
201
+     * @param url
202
+     * @param parameter 参数
203
+     * @return
204
+     * @throws Exception
205
+     */
206
+    public static String doPost(String url, Map<String, Object> parameter) throws Exception {
207
+        return doPost(url, Maps.newHashMap(), parameter, null);
208
+    }
209
+
210
+    public static void main(String[] args) throws Exception {
211
+
212
+        byte [] fileByte = null;
213
+
214
+        File file = new File("C:\\Users\\szc\\Pictures\\file-read-4182.jpg");
215
+        FileInputStream fileInputStream = new FileInputStream(file);
216
+
217
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
218
+        byte[] b = new byte[1024];
219
+        int n;
220
+        while ((n = fileInputStream.read(b)) != -1)
221
+        {
222
+            bos.write(b, 0, n);
223
+        }
224
+        fileInputStream.close();
225
+        bos.close();
226
+        fileByte = bos.toByteArray();
227
+
228
+
229
+        Map<String, Object> queryMap = Maps.newHashMap();
230
+        queryMap.put("pageNum","2");
231
+        queryMap.put("pageSize","50");
232
+        System.out.println(OkHttpRequestUtils.doPost("http://localhost:8566/uploadImage" , Maps.newHashMap(), Maps.newHashMap(),file.getName(), fileByte));
233
+
234
+    }
235
+
236
+}

+ 26
- 0
app-api/src/main/java/com/community/huiju/common/welcome/WelcomeProperties.java 查看文件

@@ -0,0 +1,26 @@
1
+package com.community.huiju.common.welcome;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+import org.springframework.boot.context.properties.ConfigurationProperties;
7
+import org.springframework.stereotype.Component;
8
+
9
+/**
10
+ * 迎宾系统配置
11
+ * @author weiximei
12
+ */
13
+@ConfigurationProperties(prefix = "welcome")
14
+@Component
15
+@Data
16
+@AllArgsConstructor
17
+@NoArgsConstructor
18
+public class WelcomeProperties {
19
+
20
+    /** 小区 **/
21
+    private Integer communityId;
22
+
23
+    /** 请求url **/
24
+    private String url;
25
+
26
+}

+ 15
- 0
app-api/src/main/java/com/community/huiju/common/wxmp/WxMPConst.java 查看文件

@@ -0,0 +1,15 @@
1
+package com.community.huiju.common.wxmp;
2
+
3
+/**
4
+ * @author FXF
5
+ * @date 2019-07-08
6
+ */
7
+public class WxMPConst {
8
+	
9
+	/**
10
+	 * 用code换取oauth2的access token.
11
+	 */
12
+	static String OAUTH2_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code";
13
+	
14
+	static String WX_USERINFO_URL = "http://47.101.36.130:9000/wx/userinfo?appid=%s&code=%s";
15
+}

+ 21
- 0
app-api/src/main/java/com/community/huiju/common/wxmp/WxMPUtil.java 查看文件

@@ -0,0 +1,21 @@
1
+package com.community.huiju.common.wxmp;
2
+
3
+import org.springframework.web.client.RestTemplate;
4
+
5
+/**
6
+ * @author FXF
7
+ * @date 2019-07-08
8
+ */
9
+public class WxMPUtil {
10
+	/**
11
+	 * 通过CODE拿取用户openid
12
+	 * @param code
13
+	 * @param appId
14
+	 * @return
15
+	 */
16
+	public static String getWxMPUserInfo(String code, String appId, String secret) {
17
+		String url = String.format(WxMPConst.OAUTH2_ACCESS_TOKEN_URL, appId, secret,code);
18
+		RestTemplate restTemplate = new RestTemplate();
19
+		return restTemplate.getForObject(url,String.class);
20
+	}
21
+}

+ 72
- 0
app-api/src/main/java/com/community/huiju/common/wxpay/HfWxConfig.java 查看文件

@@ -0,0 +1,72 @@
1
+package com.community.huiju.common.wxpay;
2
+
3
+import java.io.InputStream;
4
+
5
+/**
6
+ * 监控 控制器
7
+ * @author fxf
8
+ */
9
+public class HfWxConfig extends WXPayConfig {
10
+	
11
+	/**
12
+	 * 获取 App ID
13
+	 *
14
+	 * @return App ID
15
+	 */
16
+	@Override
17
+	public String getAppID() {
18
+		//银城慧家
19
+		return "wx6070fd3e8ef854e4";
20
+	}
21
+	
22
+	/**
23
+	 * 获取 Mch ID
24
+	 *
25
+	 * @return Mch ID
26
+	 */
27
+	@Override
28
+	public String getMchID() {
29
+		return "1525909671";
30
+	}
31
+	
32
+	/**
33
+	 * 获取 API 密钥
34
+	 *
35
+	 * @return API密钥
36
+	 */
37
+	@Override
38
+	public String getKey() {
39
+		return "HUIJU999999999999999999999999999";
40
+	}
41
+	
42
+	/**
43
+	 * 获取商户证书内容
44
+	 *
45
+	 * @return 商户证书内容
46
+	 */
47
+	@Override
48
+	public InputStream getCertStream() {
49
+		return null;
50
+	}
51
+	
52
+	/**
53
+	 * 获取WXPayDomain, 用于多域名容灾自动切换
54
+	 *
55
+	 * @return
56
+	 */
57
+	@Override
58
+	IWXPayDomain getWXPayDomain() {
59
+		IWXPayDomain iwxPayDomain = new IWXPayDomain() {
60
+			@Override
61
+			public void report(String domain, long elapsedTimeMillis, Exception ex) {
62
+			
63
+			}
64
+			@Override
65
+			public DomainInfo getDomain(WXPayConfig config) {
66
+				return new IWXPayDomain.DomainInfo(WXPayConstants.DOMAIN_API, true);
67
+			}
68
+		};
69
+		return iwxPayDomain;
70
+	}
71
+}
72
+

+ 42
- 0
app-api/src/main/java/com/community/huiju/common/wxpay/IWXPayDomain.java 查看文件

@@ -0,0 +1,42 @@
1
+package com.community.huiju.common.wxpay;
2
+
3
+/**
4
+ * 域名管理,实现主备域名自动切换
5
+ */
6
+public abstract interface IWXPayDomain {
7
+    /**
8
+     * 上报域名网络状况
9
+     * @param domain 域名。 比如:api.mch.weixin.qq.com
10
+     * @param elapsedTimeMillis 耗时
11
+     * @param ex 网络请求中出现的异常。
12
+     *           null表示没有异常
13
+     *           ConnectTimeoutException,表示建立网络连接异常
14
+     *           UnknownHostException, 表示dns解析异常
15
+     */
16
+    abstract void report(final String domain, long elapsedTimeMillis, final Exception ex);
17
+
18
+    /**
19
+     * 获取域名
20
+     * @param config 配置
21
+     * @return 域名
22
+     */
23
+    abstract DomainInfo getDomain(final WXPayConfig config);
24
+
25
+    static class DomainInfo{
26
+        public String domain;       //域名
27
+        public boolean primaryDomain;     //该域名是否为主域名。例如:api.mch.weixin.qq.com为主域名
28
+        public DomainInfo(String domain, boolean primaryDomain) {
29
+            this.domain = domain;
30
+            this.primaryDomain = primaryDomain;
31
+        }
32
+
33
+        @Override
34
+        public String toString() {
35
+            return "DomainInfo{" +
36
+                    "domain='" + domain + '\'' +
37
+                    ", primaryDomain=" + primaryDomain +
38
+                    '}';
39
+        }
40
+    }
41
+
42
+}

+ 72
- 0
app-api/src/main/java/com/community/huiju/common/wxpay/QaddWxConfig.java 查看文件

@@ -0,0 +1,72 @@
1
+package com.community.huiju.common.wxpay;
2
+
3
+import java.io.InputStream;
4
+
5
+/**
6
+ * 监控 控制器
7
+ * @author fxf
8
+ */
9
+public class QaddWxConfig extends WXPayConfig {
10
+	
11
+	/**
12
+	 * 获取 App ID
13
+	 *
14
+	 * @return App ID
15
+	 */
16
+	@Override
17
+	public String getAppID() {
18
+		//公众号
19
+		return "wx00a5778cb013ded9";
20
+	}
21
+	
22
+	/**
23
+	 * 获取 Mch ID
24
+	 *
25
+	 * @return Mch ID
26
+	 */
27
+	@Override
28
+	public String getMchID() {
29
+		return "1525909671";
30
+	}
31
+	
32
+	/**
33
+	 * 获取 API 密钥
34
+	 *
35
+	 * @return API密钥
36
+	 */
37
+	@Override
38
+	public String getKey() {
39
+		return "HUIJU999999999999999999999999999";
40
+	}
41
+	
42
+	/**
43
+	 * 获取商户证书内容
44
+	 *
45
+	 * @return 商户证书内容
46
+	 */
47
+	@Override
48
+	public InputStream getCertStream() {
49
+		return null;
50
+	}
51
+	
52
+	/**
53
+	 * 获取WXPayDomain, 用于多域名容灾自动切换
54
+	 *
55
+	 * @return
56
+	 */
57
+	@Override
58
+	IWXPayDomain getWXPayDomain() {
59
+		IWXPayDomain iwxPayDomain = new IWXPayDomain() {
60
+			@Override
61
+			public void report(String domain, long elapsedTimeMillis, Exception ex) {
62
+			
63
+			}
64
+			@Override
65
+			public DomainInfo getDomain(WXPayConfig config) {
66
+				return new DomainInfo(WXPayConstants.DOMAIN_API, true);
67
+			}
68
+		};
69
+		return iwxPayDomain;
70
+	}
71
+}
72
+

+ 689
- 0
app-api/src/main/java/com/community/huiju/common/wxpay/WXPay.java 查看文件

@@ -0,0 +1,689 @@
1
+package com.community.huiju.common.wxpay;
2
+
3
+import com.community.huiju.common.wxpay.WXPayConstants.SignType;
4
+
5
+import java.util.HashMap;
6
+import java.util.Map;
7
+
8
+public class WXPay {
9
+
10
+    private WXPayConfig config;
11
+    private SignType signType;
12
+    private boolean autoReport;
13
+    private boolean useSandbox;
14
+    private String notifyUrl;
15
+    private WXPayRequest wxPayRequest;
16
+
17
+    public WXPay(final WXPayConfig config) throws Exception {
18
+        this(config, null, true, false);
19
+    }
20
+
21
+    public WXPay(final WXPayConfig config, final boolean autoReport) throws Exception {
22
+        this(config, null, autoReport, false);
23
+    }
24
+
25
+
26
+    public WXPay(final WXPayConfig config, final boolean autoReport, final boolean useSandbox) throws Exception{
27
+        this(config, null, autoReport, useSandbox);
28
+    }
29
+
30
+    public WXPay(final WXPayConfig config, final String notifyUrl) throws Exception {
31
+        this(config, notifyUrl, true, false);
32
+    }
33
+
34
+    public WXPay(final WXPayConfig config, final String notifyUrl, final boolean autoReport) throws Exception {
35
+        this(config, notifyUrl, autoReport, false);
36
+    }
37
+
38
+    public WXPay(final WXPayConfig config, final String notifyUrl, final boolean autoReport, final boolean useSandbox) throws Exception {
39
+        this.config = config;
40
+        this.notifyUrl = notifyUrl;
41
+        this.autoReport = autoReport;
42
+        this.useSandbox = useSandbox;
43
+        //if (useSandbox) {
44
+            this.signType = SignType.MD5;
45
+        //}
46
+        //else {
47
+        //    this.signType = SignType.HMACSHA256;
48
+        //}
49
+        this.wxPayRequest = new WXPayRequest(config);
50
+    }
51
+
52
+    private void checkWXPayConfig() throws Exception {
53
+        if (this.config == null) {
54
+            throw new Exception("config is null");
55
+        }
56
+        if (this.config.getAppID() == null || this.config.getAppID().trim().length() == 0) {
57
+            throw new Exception("appid in config is empty");
58
+        }
59
+        if (this.config.getMchID() == null || this.config.getMchID().trim().length() == 0) {
60
+            throw new Exception("appid in config is empty");
61
+        }
62
+        if (this.config.getCertStream() == null) {
63
+            throw new Exception("cert stream in config is empty");
64
+        }
65
+        if (this.config.getWXPayDomain() == null){
66
+            throw new Exception("config.getWXPayDomain() is null");
67
+        }
68
+
69
+        if (this.config.getHttpConnectTimeoutMs() < 10) {
70
+            throw new Exception("http connect timeout is too small");
71
+        }
72
+        if (this.config.getHttpReadTimeoutMs() < 10) {
73
+            throw new Exception("http read timeout is too small");
74
+        }
75
+
76
+    }
77
+
78
+    /**
79
+     * 向 Map 中添加 appid、mch_id、nonce_str、sign_type、sign <br>
80
+     * 该函数适用于商户适用于统一下单等接口,不适用于红包、代金券接口
81
+     *
82
+     * @param reqData
83
+     * @return
84
+     * @throws Exception
85
+     */
86
+    public Map<String, String> fillRequestData(Map<String, String> reqData) throws Exception {
87
+        reqData.put("appid", config.getAppID());
88
+        reqData.put("mch_id", config.getMchID());
89
+        reqData.put("nonce_str", WXPayUtil.generateNonceStr());
90
+        if (SignType.MD5.equals(this.signType)) {
91
+            reqData.put("sign_type", WXPayConstants.MD5);
92
+        }
93
+        else if (SignType.HMACSHA256.equals(this.signType)) {
94
+            reqData.put("sign_type", WXPayConstants.HMACSHA256);
95
+        }
96
+        reqData.put("sign", WXPayUtil.generateSignature(reqData, config.getKey(), this.signType));
97
+        return reqData;
98
+    }
99
+
100
+    /**
101
+     * 判断xml数据的sign是否有效,必须包含sign字段,否则返回false。
102
+     *
103
+     * @param reqData 向wxpay post的请求数据
104
+     * @return 签名是否有效
105
+     * @throws Exception
106
+     */
107
+    public boolean isResponseSignatureValid(Map<String, String> reqData) throws Exception {
108
+        // 返回数据的签名方式和请求中给定的签名方式是一致的
109
+        return WXPayUtil.isSignatureValid(reqData, this.config.getKey(), this.signType);
110
+    }
111
+
112
+    /**
113
+     * 判断支付结果通知中的sign是否有效
114
+     *
115
+     * @param reqData 向wxpay post的请求数据
116
+     * @return 签名是否有效
117
+     * @throws Exception
118
+     */
119
+    public boolean isPayResultNotifySignatureValid(Map<String, String> reqData) throws Exception {
120
+        String signTypeInData = reqData.get(WXPayConstants.FIELD_SIGN_TYPE);
121
+        SignType signType;
122
+        if (signTypeInData == null) {
123
+            signType = SignType.MD5;
124
+        }
125
+        else {
126
+            signTypeInData = signTypeInData.trim();
127
+            if (signTypeInData.length() == 0) {
128
+                signType = SignType.MD5;
129
+            }
130
+            else if (WXPayConstants.MD5.equals(signTypeInData)) {
131
+                signType = SignType.MD5;
132
+            }
133
+            else if (WXPayConstants.HMACSHA256.equals(signTypeInData)) {
134
+                signType = SignType.HMACSHA256;
135
+            }
136
+            else {
137
+                throw new Exception(String.format("Unsupported sign_type: %s", signTypeInData));
138
+            }
139
+        }
140
+        return WXPayUtil.isSignatureValid(reqData, this.config.getKey(), signType);
141
+    }
142
+
143
+
144
+    /**
145
+     * 不需要证书的请求
146
+     * @param urlSuffix String
147
+     * @param reqData 向wxpay post的请求数据
148
+     * @param connectTimeoutMs 超时时间,单位是毫秒
149
+     * @param readTimeoutMs 超时时间,单位是毫秒
150
+     * @return API返回数据
151
+     * @throws Exception
152
+     */
153
+    public String requestWithoutCert(String urlSuffix, Map<String, String> reqData,
154
+                                     int connectTimeoutMs, int readTimeoutMs) throws Exception {
155
+        String msgUUID = reqData.get("nonce_str");
156
+        String reqBody = WXPayUtil.mapToXml(reqData);
157
+
158
+        String resp = this.wxPayRequest.requestWithoutCert(urlSuffix, msgUUID, reqBody, connectTimeoutMs, readTimeoutMs, autoReport);
159
+        return resp;
160
+    }
161
+
162
+
163
+    /**
164
+     * 需要证书的请求
165
+     * @param urlSuffix String
166
+     * @param reqData 向wxpay post的请求数据  Map
167
+     * @param connectTimeoutMs 超时时间,单位是毫秒
168
+     * @param readTimeoutMs 超时时间,单位是毫秒
169
+     * @return API返回数据
170
+     * @throws Exception
171
+     */
172
+    public String requestWithCert(String urlSuffix, Map<String, String> reqData,
173
+                                  int connectTimeoutMs, int readTimeoutMs) throws Exception {
174
+        String msgUUID= reqData.get("nonce_str");
175
+        String reqBody = WXPayUtil.mapToXml(reqData);
176
+
177
+        String resp = this.wxPayRequest.requestWithCert(urlSuffix, msgUUID, reqBody, connectTimeoutMs, readTimeoutMs, this.autoReport);
178
+        return resp;
179
+    }
180
+
181
+    /**
182
+     * 处理 HTTPS API返回数据,转换成Map对象。return_code为SUCCESS时,验证签名。
183
+     * @param xmlStr API返回的XML格式数据
184
+     * @return Map类型数据
185
+     * @throws Exception
186
+     */
187
+    public Map<String, String> processResponseXml(String xmlStr) throws Exception {
188
+        String RETURN_CODE = "return_code";
189
+        String return_code;
190
+        Map<String, String> respData = WXPayUtil.xmlToMap(xmlStr);
191
+        if (respData.containsKey(RETURN_CODE)) {
192
+            return_code = respData.get(RETURN_CODE);
193
+        }
194
+        else {
195
+            throw new Exception(String.format("No `return_code` in XML: %s", xmlStr));
196
+        }
197
+
198
+        if (return_code.equals(WXPayConstants.FAIL)) {
199
+            return respData;
200
+        }
201
+        else if (return_code.equals(WXPayConstants.SUCCESS)) {
202
+           if (this.isResponseSignatureValid(respData)) {
203
+               return respData;
204
+           }
205
+           else {
206
+               throw new Exception(String.format("Invalid sign value in XML: %s", xmlStr));
207
+           }
208
+        }
209
+        else {
210
+            throw new Exception(String.format("return_code value %s is invalid in XML: %s", return_code, xmlStr));
211
+        }
212
+    }
213
+
214
+    /**
215
+     * 作用:提交刷卡支付<br>
216
+     * 场景:刷卡支付
217
+     * @param reqData 向wxpay post的请求数据
218
+     * @return API返回数据
219
+     * @throws Exception
220
+     */
221
+    public Map<String, String> microPay(Map<String, String> reqData) throws Exception {
222
+        return this.microPay(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
223
+    }
224
+
225
+
226
+    /**
227
+     * 作用:提交刷卡支付<br>
228
+     * 场景:刷卡支付
229
+     * @param reqData 向wxpay post的请求数据
230
+     * @param connectTimeoutMs 连接超时时间,单位是毫秒
231
+     * @param readTimeoutMs 读超时时间,单位是毫秒
232
+     * @return API返回数据
233
+     * @throws Exception
234
+     */
235
+    public Map<String, String> microPay(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
236
+        String url;
237
+        if (this.useSandbox) {
238
+            url = WXPayConstants.SANDBOX_MICROPAY_URL_SUFFIX;
239
+        }
240
+        else {
241
+            url = WXPayConstants.MICROPAY_URL_SUFFIX;
242
+        }
243
+        String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
244
+        return this.processResponseXml(respXml);
245
+    }
246
+
247
+    /**
248
+     * 提交刷卡支付,针对软POS,尽可能做成功
249
+     * 内置重试机制,最多60s
250
+     * @param reqData
251
+     * @return
252
+     * @throws Exception
253
+     */
254
+    public Map<String, String> microPayWithPos(Map<String, String> reqData) throws Exception {
255
+        return this.microPayWithPos(reqData, this.config.getHttpConnectTimeoutMs());
256
+    }
257
+
258
+    /**
259
+     * 提交刷卡支付,针对软POS,尽可能做成功
260
+     * 内置重试机制,最多60s
261
+     * @param reqData
262
+     * @param connectTimeoutMs
263
+     * @return
264
+     * @throws Exception
265
+     */
266
+    public Map<String, String> microPayWithPos(Map<String, String> reqData, int connectTimeoutMs) throws Exception {
267
+        int remainingTimeMs = 60*1000;
268
+        long startTimestampMs = 0;
269
+        Map<String, String> lastResult = null;
270
+        Exception lastException = null;
271
+
272
+        while (true) {
273
+            startTimestampMs = WXPayUtil.getCurrentTimestampMs();
274
+            int readTimeoutMs = remainingTimeMs - connectTimeoutMs;
275
+            if (readTimeoutMs > 1000) {
276
+                try {
277
+                    lastResult = this.microPay(reqData, connectTimeoutMs, readTimeoutMs);
278
+                    String returnCode = lastResult.get("return_code");
279
+                    if (returnCode.equals("SUCCESS")) {
280
+                        String resultCode = lastResult.get("result_code");
281
+                        String errCode = lastResult.get("err_code");
282
+                        if (resultCode.equals("SUCCESS")) {
283
+                            break;
284
+                        }
285
+                        else {
286
+                            // 看错误码,若支付结果未知,则重试提交刷卡支付
287
+                            if (errCode.equals("SYSTEMERROR") || errCode.equals("BANKERROR") || errCode.equals("USERPAYING")) {
288
+                                remainingTimeMs = remainingTimeMs - (int)(WXPayUtil.getCurrentTimestampMs() - startTimestampMs);
289
+                                if (remainingTimeMs <= 100) {
290
+                                    break;
291
+                                }
292
+                                else {
293
+                                    WXPayUtil.getLogger().info("microPayWithPos: try micropay again");
294
+                                    if (remainingTimeMs > 5*1000) {
295
+                                        Thread.sleep(5*1000);
296
+                                    }
297
+                                    else {
298
+                                        Thread.sleep(1*1000);
299
+                                    }
300
+                                    continue;
301
+                                }
302
+                            }
303
+                            else {
304
+                                break;
305
+                            }
306
+                        }
307
+                    }
308
+                    else {
309
+                        break;
310
+                    }
311
+                }
312
+                catch (Exception ex) {
313
+                    lastResult = null;
314
+                    lastException = ex;
315
+                }
316
+            }
317
+            else {
318
+                break;
319
+            }
320
+        }
321
+
322
+        if (lastResult == null) {
323
+            throw lastException;
324
+        }
325
+        else {
326
+            return lastResult;
327
+        }
328
+    }
329
+
330
+
331
+
332
+    /**
333
+     * 作用:统一下单<br>
334
+     * 场景:公共号支付、扫码支付、APP支付
335
+     * @param reqData 向wxpay post的请求数据
336
+     * @return API返回数据
337
+     * @throws Exception
338
+     */
339
+    public Map<String, String> unifiedOrder(Map<String, String> reqData) throws Exception {
340
+        return this.unifiedOrder(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
341
+    }
342
+
343
+
344
+    /**
345
+     * 作用:统一下单<br>
346
+     * 场景:公共号支付、扫码支付、APP支付
347
+     * @param reqData 向wxpay post的请求数据
348
+     * @param connectTimeoutMs 连接超时时间,单位是毫秒
349
+     * @param readTimeoutMs 读超时时间,单位是毫秒
350
+     * @return API返回数据
351
+     * @throws Exception
352
+     */
353
+    public Map<String, String> unifiedOrder(Map<String, String> reqData,  int connectTimeoutMs, int readTimeoutMs) throws Exception {
354
+        String url;
355
+        if (this.useSandbox) {
356
+            url = WXPayConstants.SANDBOX_UNIFIEDORDER_URL_SUFFIX;
357
+        }
358
+        else {
359
+            url = WXPayConstants.UNIFIEDORDER_URL_SUFFIX;
360
+        }
361
+        if(this.notifyUrl != null) {
362
+            reqData.put("notify_url", this.notifyUrl);
363
+        }
364
+        String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
365
+        return this.processResponseXml(respXml);
366
+    }
367
+
368
+
369
+    /**
370
+     * 作用:查询订单<br>
371
+     * 场景:刷卡支付、公共号支付、扫码支付、APP支付
372
+     * @param reqData 向wxpay post的请求数据
373
+     * @return API返回数据
374
+     * @throws Exception
375
+     */
376
+    public Map<String, String> orderQuery(Map<String, String> reqData) throws Exception {
377
+        return this.orderQuery(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
378
+    }
379
+
380
+
381
+    /**
382
+     * 作用:查询订单<br>
383
+     * 场景:刷卡支付、公共号支付、扫码支付、APP支付
384
+     * @param reqData 向wxpay post的请求数据 int
385
+     * @param connectTimeoutMs 连接超时时间,单位是毫秒
386
+     * @param readTimeoutMs 读超时时间,单位是毫秒
387
+     * @return API返回数据
388
+     * @throws Exception
389
+     */
390
+    public Map<String, String> orderQuery(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
391
+        String url;
392
+        if (this.useSandbox) {
393
+            url = WXPayConstants.SANDBOX_ORDERQUERY_URL_SUFFIX;
394
+        }
395
+        else {
396
+            url = WXPayConstants.ORDERQUERY_URL_SUFFIX;
397
+        }
398
+        String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
399
+        return this.processResponseXml(respXml);
400
+    }
401
+
402
+
403
+    /**
404
+     * 作用:撤销订单<br>
405
+     * 场景:刷卡支付
406
+     * @param reqData 向wxpay post的请求数据
407
+     * @return API返回数据
408
+     * @throws Exception
409
+     */
410
+    public Map<String, String> reverse(Map<String, String> reqData) throws Exception {
411
+        return this.reverse(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
412
+    }
413
+
414
+
415
+    /**
416
+     * 作用:撤销订单<br>
417
+     * 场景:刷卡支付<br>
418
+     * 其他:需要证书
419
+     * @param reqData 向wxpay post的请求数据
420
+     * @param connectTimeoutMs 连接超时时间,单位是毫秒
421
+     * @param readTimeoutMs 读超时时间,单位是毫秒
422
+     * @return API返回数据
423
+     * @throws Exception
424
+     */
425
+    public Map<String, String> reverse(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
426
+        String url;
427
+        if (this.useSandbox) {
428
+            url = WXPayConstants.SANDBOX_REVERSE_URL_SUFFIX;
429
+        }
430
+        else {
431
+            url = WXPayConstants.REVERSE_URL_SUFFIX;
432
+        }
433
+        String respXml = this.requestWithCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
434
+        return this.processResponseXml(respXml);
435
+    }
436
+
437
+
438
+    /**
439
+     * 作用:关闭订单<br>
440
+     * 场景:公共号支付、扫码支付、APP支付
441
+     * @param reqData 向wxpay post的请求数据
442
+     * @return API返回数据
443
+     * @throws Exception
444
+     */
445
+    public Map<String, String> closeOrder(Map<String, String> reqData) throws Exception {
446
+        return this.closeOrder(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
447
+    }
448
+
449
+
450
+    /**
451
+     * 作用:关闭订单<br>
452
+     * 场景:公共号支付、扫码支付、APP支付
453
+     * @param reqData 向wxpay post的请求数据
454
+     * @param connectTimeoutMs 连接超时时间,单位是毫秒
455
+     * @param readTimeoutMs 读超时时间,单位是毫秒
456
+     * @return API返回数据
457
+     * @throws Exception
458
+     */
459
+    public Map<String, String> closeOrder(Map<String, String> reqData,  int connectTimeoutMs, int readTimeoutMs) throws Exception {
460
+        String url;
461
+        if (this.useSandbox) {
462
+            url = WXPayConstants.SANDBOX_CLOSEORDER_URL_SUFFIX;
463
+        }
464
+        else {
465
+            url = WXPayConstants.CLOSEORDER_URL_SUFFIX;
466
+        }
467
+        String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
468
+        return this.processResponseXml(respXml);
469
+    }
470
+
471
+
472
+    /**
473
+     * 作用:申请退款<br>
474
+     * 场景:刷卡支付、公共号支付、扫码支付、APP支付
475
+     * @param reqData 向wxpay post的请求数据
476
+     * @return API返回数据
477
+     * @throws Exception
478
+     */
479
+    public Map<String, String> refund(Map<String, String> reqData) throws Exception {
480
+        return this.refund(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
481
+    }
482
+
483
+
484
+    /**
485
+     * 作用:申请退款<br>
486
+     * 场景:刷卡支付、公共号支付、扫码支付、APP支付<br>
487
+     * 其他:需要证书
488
+     * @param reqData 向wxpay post的请求数据
489
+     * @param connectTimeoutMs 连接超时时间,单位是毫秒
490
+     * @param readTimeoutMs 读超时时间,单位是毫秒
491
+     * @return API返回数据
492
+     * @throws Exception
493
+     */
494
+    public Map<String, String> refund(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
495
+        String url;
496
+        if (this.useSandbox) {
497
+            url = WXPayConstants.SANDBOX_REFUND_URL_SUFFIX;
498
+        }
499
+        else {
500
+            url = WXPayConstants.REFUND_URL_SUFFIX;
501
+        }
502
+        String respXml = this.requestWithCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
503
+        return this.processResponseXml(respXml);
504
+    }
505
+
506
+
507
+    /**
508
+     * 作用:退款查询<br>
509
+     * 场景:刷卡支付、公共号支付、扫码支付、APP支付
510
+     * @param reqData 向wxpay post的请求数据
511
+     * @return API返回数据
512
+     * @throws Exception
513
+     */
514
+    public Map<String, String> refundQuery(Map<String, String> reqData) throws Exception {
515
+        return this.refundQuery(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
516
+    }
517
+
518
+
519
+    /**
520
+     * 作用:退款查询<br>
521
+     * 场景:刷卡支付、公共号支付、扫码支付、APP支付
522
+     * @param reqData 向wxpay post的请求数据
523
+     * @param connectTimeoutMs 连接超时时间,单位是毫秒
524
+     * @param readTimeoutMs 读超时时间,单位是毫秒
525
+     * @return API返回数据
526
+     * @throws Exception
527
+     */
528
+    public Map<String, String> refundQuery(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
529
+        String url;
530
+        if (this.useSandbox) {
531
+            url = WXPayConstants.SANDBOX_REFUNDQUERY_URL_SUFFIX;
532
+        }
533
+        else {
534
+            url = WXPayConstants.REFUNDQUERY_URL_SUFFIX;
535
+        }
536
+        String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
537
+        return this.processResponseXml(respXml);
538
+    }
539
+
540
+
541
+    /**
542
+     * 作用:对账单下载(成功时返回对账单数据,失败时返回XML格式数据)<br>
543
+     * 场景:刷卡支付、公共号支付、扫码支付、APP支付
544
+     * @param reqData 向wxpay post的请求数据
545
+     * @return API返回数据
546
+     * @throws Exception
547
+     */
548
+    public Map<String, String> downloadBill(Map<String, String> reqData) throws Exception {
549
+        return this.downloadBill(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
550
+    }
551
+
552
+
553
+    /**
554
+     * 作用:对账单下载<br>
555
+     * 场景:刷卡支付、公共号支付、扫码支付、APP支付<br>
556
+     * 其他:无论是否成功都返回Map。若成功,返回的Map中含有return_code、return_msg、data,
557
+     *      其中return_code为`SUCCESS`,data为对账单数据。
558
+     * @param reqData 向wxpay post的请求数据
559
+     * @param connectTimeoutMs 连接超时时间,单位是毫秒
560
+     * @param readTimeoutMs 读超时时间,单位是毫秒
561
+     * @return 经过封装的API返回数据
562
+     * @throws Exception
563
+     */
564
+    public Map<String, String> downloadBill(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
565
+        String url;
566
+        if (this.useSandbox) {
567
+            url = WXPayConstants.SANDBOX_DOWNLOADBILL_URL_SUFFIX;
568
+        }
569
+        else {
570
+            url = WXPayConstants.DOWNLOADBILL_URL_SUFFIX;
571
+        }
572
+        String respStr = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs).trim();
573
+        Map<String, String> ret;
574
+        // 出现错误,返回XML数据
575
+        if (respStr.indexOf("<") == 0) {
576
+            ret = WXPayUtil.xmlToMap(respStr);
577
+        }
578
+        else {
579
+            // 正常返回csv数据
580
+            ret = new HashMap<String, String>();
581
+            ret.put("return_code", WXPayConstants.SUCCESS);
582
+            ret.put("return_msg", "ok");
583
+            ret.put("data", respStr);
584
+        }
585
+        return ret;
586
+    }
587
+
588
+
589
+    /**
590
+     * 作用:交易保障<br>
591
+     * 场景:刷卡支付、公共号支付、扫码支付、APP支付
592
+     * @param reqData 向wxpay post的请求数据
593
+     * @return API返回数据
594
+     * @throws Exception
595
+     */
596
+    public Map<String, String> report(Map<String, String> reqData) throws Exception {
597
+        return this.report(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
598
+    }
599
+
600
+
601
+    /**
602
+     * 作用:交易保障<br>
603
+     * 场景:刷卡支付、公共号支付、扫码支付、APP支付
604
+     * @param reqData 向wxpay post的请求数据
605
+     * @param connectTimeoutMs 连接超时时间,单位是毫秒
606
+     * @param readTimeoutMs 读超时时间,单位是毫秒
607
+     * @return API返回数据
608
+     * @throws Exception
609
+     */
610
+    public Map<String, String> report(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
611
+        String url;
612
+        if (this.useSandbox) {
613
+            url = WXPayConstants.SANDBOX_REPORT_URL_SUFFIX;
614
+        }
615
+        else {
616
+            url = WXPayConstants.REPORT_URL_SUFFIX;
617
+        }
618
+        String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
619
+        return WXPayUtil.xmlToMap(respXml);
620
+    }
621
+
622
+
623
+    /**
624
+     * 作用:转换短链接<br>
625
+     * 场景:刷卡支付、扫码支付
626
+     * @param reqData 向wxpay post的请求数据
627
+     * @return API返回数据
628
+     * @throws Exception
629
+     */
630
+    public Map<String, String> shortUrl(Map<String, String> reqData) throws Exception {
631
+        return this.shortUrl(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
632
+    }
633
+
634
+
635
+    /**
636
+     * 作用:转换短链接<br>
637
+     * 场景:刷卡支付、扫码支付
638
+     * @param reqData 向wxpay post的请求数据
639
+     * @return API返回数据
640
+     * @throws Exception
641
+     */
642
+    public Map<String, String> shortUrl(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
643
+        String url;
644
+        if (this.useSandbox) {
645
+            url = WXPayConstants.SANDBOX_SHORTURL_URL_SUFFIX;
646
+        }
647
+        else {
648
+            url = WXPayConstants.SHORTURL_URL_SUFFIX;
649
+        }
650
+        String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
651
+        return this.processResponseXml(respXml);
652
+    }
653
+
654
+
655
+    /**
656
+     * 作用:授权码查询OPENID接口<br>
657
+     * 场景:刷卡支付
658
+     * @param reqData 向wxpay post的请求数据
659
+     * @return API返回数据
660
+     * @throws Exception
661
+     */
662
+    public Map<String, String> authCodeToOpenid(Map<String, String> reqData) throws Exception {
663
+        return this.authCodeToOpenid(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
664
+    }
665
+
666
+
667
+    /**
668
+     * 作用:授权码查询OPENID接口<br>
669
+     * 场景:刷卡支付
670
+     * @param reqData 向wxpay post的请求数据
671
+     * @param connectTimeoutMs 连接超时时间,单位是毫秒
672
+     * @param readTimeoutMs 读超时时间,单位是毫秒
673
+     * @return API返回数据
674
+     * @throws Exception
675
+     */
676
+    public Map<String, String> authCodeToOpenid(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
677
+        String url;
678
+        if (this.useSandbox) {
679
+            url = WXPayConstants.SANDBOX_AUTHCODETOOPENID_URL_SUFFIX;
680
+        }
681
+        else {
682
+            url = WXPayConstants.AUTHCODETOOPENID_URL_SUFFIX;
683
+        }
684
+        String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
685
+        return this.processResponseXml(respXml);
686
+    }
687
+
688
+
689
+} // end class

+ 103
- 0
app-api/src/main/java/com/community/huiju/common/wxpay/WXPayConfig.java 查看文件

@@ -0,0 +1,103 @@
1
+package com.community.huiju.common.wxpay;
2
+
3
+import java.io.InputStream;
4
+
5
+public abstract class WXPayConfig {
6
+
7
+
8
+
9
+    /**
10
+     * 获取 App ID
11
+     *
12
+     * @return App ID
13
+     */
14
+    abstract String getAppID();
15
+
16
+
17
+    /**
18
+     * 获取 Mch ID
19
+     *
20
+     * @return Mch ID
21
+     */
22
+    abstract String getMchID();
23
+
24
+
25
+    /**
26
+     * 获取 API 密钥
27
+     *
28
+     * @return API密钥
29
+     */
30
+    abstract String getKey();
31
+
32
+
33
+    /**
34
+     * 获取商户证书内容
35
+     *
36
+     * @return 商户证书内容
37
+     */
38
+    abstract InputStream getCertStream();
39
+
40
+    /**
41
+     * HTTP(S) 连接超时时间,单位毫秒
42
+     *
43
+     * @return
44
+     */
45
+    public int getHttpConnectTimeoutMs() {
46
+        return 6*1000;
47
+    }
48
+
49
+    /**
50
+     * HTTP(S) 读数据超时时间,单位毫秒
51
+     *
52
+     * @return
53
+     */
54
+    public int getHttpReadTimeoutMs() {
55
+        return 8*1000;
56
+    }
57
+
58
+    /**
59
+     * 获取WXPayDomain, 用于多域名容灾自动切换
60
+     * @return
61
+     */
62
+    abstract IWXPayDomain getWXPayDomain();
63
+
64
+    /**
65
+     * 是否自动上报。
66
+     * 若要关闭自动上报,子类中实现该函数返回 false 即可。
67
+     *
68
+     * @return
69
+     */
70
+    public boolean shouldAutoReport() {
71
+        return true;
72
+    }
73
+
74
+    /**
75
+     * 进行健康上报的线程的数量
76
+     *
77
+     * @return
78
+     */
79
+    public int getReportWorkerNum() {
80
+        return 6;
81
+    }
82
+
83
+
84
+    /**
85
+     * 健康上报缓存消息的最大数量。会有线程去独立上报
86
+     * 粗略计算:加入一条消息200B,10000消息占用空间 2000 KB,约为2MB,可以接受
87
+     *
88
+     * @return
89
+     */
90
+    public int getReportQueueMaxSize() {
91
+        return 10000;
92
+    }
93
+
94
+    /**
95
+     * 批量上报,一次最多上报多个数据
96
+     *
97
+     * @return
98
+     */
99
+    public int getReportBatchSize() {
100
+        return 10;
101
+    }
102
+
103
+}

+ 59
- 0
app-api/src/main/java/com/community/huiju/common/wxpay/WXPayConstants.java 查看文件

@@ -0,0 +1,59 @@
1
+package com.community.huiju.common.wxpay;
2
+
3
+import org.apache.http.client.HttpClient;
4
+
5
+/**
6
+ * 常量
7
+ */
8
+public class WXPayConstants {
9
+
10
+    public enum SignType {
11
+        MD5, HMACSHA256
12
+    }
13
+
14
+    public static final String DOMAIN_API = "api.mch.weixin.qq.com";
15
+    public static final String DOMAIN_API2 = "api2.mch.weixin.qq.com";
16
+    public static final String DOMAIN_APIHK = "apihk.mch.weixin.qq.com";
17
+    public static final String DOMAIN_APIUS = "apius.mch.weixin.qq.com";
18
+
19
+
20
+    public static final String FAIL     = "FAIL";
21
+    public static final String SUCCESS  = "SUCCESS";
22
+    public static final String HMACSHA256 = "HMAC-SHA256";
23
+    public static final String MD5 = "MD5";
24
+
25
+    public static final String FIELD_SIGN = "sign";
26
+    public static final String FIELD_SIGN_TYPE = "sign_type";
27
+
28
+    public static final String WXPAYSDK_VERSION = "WXPaySDK/3.0.9";
29
+    public static final String USER_AGENT = WXPAYSDK_VERSION +
30
+            " (" + System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version") +
31
+            ") Java/" + System.getProperty("java.version") + " HttpClient/" + HttpClient.class.getPackage().getImplementationVersion();
32
+
33
+    public static final String MICROPAY_URL_SUFFIX     = "/pay/micropay";
34
+    public static final String UNIFIEDORDER_URL_SUFFIX = "/pay/unifiedorder";
35
+    public static final String ORDERQUERY_URL_SUFFIX   = "/pay/orderquery";
36
+    public static final String REVERSE_URL_SUFFIX      = "/secapi/pay/reverse";
37
+    public static final String CLOSEORDER_URL_SUFFIX   = "/pay/closeorder";
38
+    public static final String REFUND_URL_SUFFIX       = "/secapi/pay/refund";
39
+    public static final String REFUNDQUERY_URL_SUFFIX  = "/pay/refundquery";
40
+    public static final String DOWNLOADBILL_URL_SUFFIX = "/pay/downloadbill";
41
+    public static final String REPORT_URL_SUFFIX       = "/payitil/report";
42
+    public static final String SHORTURL_URL_SUFFIX     = "/tools/shorturl";
43
+    public static final String AUTHCODETOOPENID_URL_SUFFIX = "/tools/authcodetoopenid";
44
+
45
+    // sandbox
46
+    public static final String SANDBOX_MICROPAY_URL_SUFFIX     = "/sandboxnew/pay/micropay";
47
+    public static final String SANDBOX_UNIFIEDORDER_URL_SUFFIX = "/sandboxnew/pay/unifiedorder";
48
+    public static final String SANDBOX_ORDERQUERY_URL_SUFFIX   = "/sandboxnew/pay/orderquery";
49
+    public static final String SANDBOX_REVERSE_URL_SUFFIX      = "/sandboxnew/secapi/pay/reverse";
50
+    public static final String SANDBOX_CLOSEORDER_URL_SUFFIX   = "/sandboxnew/pay/closeorder";
51
+    public static final String SANDBOX_REFUND_URL_SUFFIX       = "/sandboxnew/secapi/pay/refund";
52
+    public static final String SANDBOX_REFUNDQUERY_URL_SUFFIX  = "/sandboxnew/pay/refundquery";
53
+    public static final String SANDBOX_DOWNLOADBILL_URL_SUFFIX = "/sandboxnew/pay/downloadbill";
54
+    public static final String SANDBOX_REPORT_URL_SUFFIX       = "/sandboxnew/payitil/report";
55
+    public static final String SANDBOX_SHORTURL_URL_SUFFIX     = "/sandboxnew/tools/shorturl";
56
+    public static final String SANDBOX_AUTHCODETOOPENID_URL_SUFFIX = "/sandboxnew/tools/authcodetoopenid";
57
+
58
+}
59
+

+ 265
- 0
app-api/src/main/java/com/community/huiju/common/wxpay/WXPayReport.java 查看文件

@@ -0,0 +1,265 @@
1
+package com.community.huiju.common.wxpay;
2
+
3
+import org.apache.http.HttpEntity;
4
+import org.apache.http.HttpResponse;
5
+import org.apache.http.client.HttpClient;
6
+import org.apache.http.client.config.RequestConfig;
7
+import org.apache.http.client.methods.HttpPost;
8
+import org.apache.http.config.RegistryBuilder;
9
+import org.apache.http.conn.socket.ConnectionSocketFactory;
10
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
11
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
12
+import org.apache.http.entity.StringEntity;
13
+import org.apache.http.impl.client.HttpClientBuilder;
14
+import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
15
+import org.apache.http.util.EntityUtils;
16
+
17
+import java.util.concurrent.ExecutorService;
18
+import java.util.concurrent.Executors;
19
+import java.util.concurrent.LinkedBlockingQueue;
20
+import java.util.concurrent.ThreadFactory;
21
+
22
+/**
23
+ * 交易保障
24
+ */
25
+public class WXPayReport {
26
+
27
+    public static class ReportInfo {
28
+
29
+        /**
30
+         * 布尔变量使用int。0为false, 1为true。
31
+         */
32
+
33
+        // 基本信息
34
+        private String version = "v1";
35
+        private String sdk = WXPayConstants.WXPAYSDK_VERSION;
36
+        private String uuid;  // 交易的标识
37
+        private long timestamp;   // 上报时的时间戳,单位秒
38
+        private long elapsedTimeMillis; // 耗时,单位 毫秒
39
+
40
+        // 针对主域名
41
+        private String firstDomain;  // 第1次请求的域名
42
+        private boolean primaryDomain; //是否主域名
43
+        private int firstConnectTimeoutMillis;  // 第1次请求设置的连接超时时间,单位 毫秒
44
+        private int firstReadTimeoutMillis;  // 第1次请求设置的读写超时时间,单位 毫秒
45
+        private int firstHasDnsError;  // 第1次请求是否出现dns问题
46
+        private int firstHasConnectTimeout; // 第1次请求是否出现连接超时
47
+        private int firstHasReadTimeout; // 第1次请求是否出现连接超时
48
+
49
+        public ReportInfo(String uuid, long timestamp, long elapsedTimeMillis, String firstDomain, boolean primaryDomain, int firstConnectTimeoutMillis, int firstReadTimeoutMillis, boolean firstHasDnsError, boolean firstHasConnectTimeout, boolean firstHasReadTimeout) {
50
+            this.uuid = uuid;
51
+            this.timestamp = timestamp;
52
+            this.elapsedTimeMillis = elapsedTimeMillis;
53
+            this.firstDomain = firstDomain;
54
+            this.primaryDomain = primaryDomain;
55
+            this.firstConnectTimeoutMillis = firstConnectTimeoutMillis;
56
+            this.firstReadTimeoutMillis = firstReadTimeoutMillis;
57
+            this.firstHasDnsError = firstHasDnsError?1:0;
58
+            this.firstHasConnectTimeout = firstHasConnectTimeout?1:0;
59
+            this.firstHasReadTimeout = firstHasReadTimeout?1:0;
60
+         }
61
+
62
+        @Override
63
+        public String toString() {
64
+            return "ReportInfo{" +
65
+                    "version='" + version + '\'' +
66
+                    ", sdk='" + sdk + '\'' +
67
+                    ", uuid='" + uuid + '\'' +
68
+                    ", timestamp=" + timestamp +
69
+                    ", elapsedTimeMillis=" + elapsedTimeMillis +
70
+                    ", firstDomain='" + firstDomain + '\'' +
71
+                    ", primaryDomain=" + primaryDomain +
72
+                    ", firstConnectTimeoutMillis=" + firstConnectTimeoutMillis +
73
+                    ", firstReadTimeoutMillis=" + firstReadTimeoutMillis +
74
+                    ", firstHasDnsError=" + firstHasDnsError +
75
+                    ", firstHasConnectTimeout=" + firstHasConnectTimeout +
76
+                    ", firstHasReadTimeout=" + firstHasReadTimeout +
77
+                    '}';
78
+        }
79
+
80
+        /**
81
+         * 转换成 csv 格式
82
+         *
83
+         * @return
84
+         */
85
+        public String toLineString(String key) {
86
+            String separator = ",";
87
+            Object[] objects = new Object[] {
88
+                version, sdk, uuid, timestamp, elapsedTimeMillis,
89
+                    firstDomain, primaryDomain, firstConnectTimeoutMillis, firstReadTimeoutMillis,
90
+                    firstHasDnsError, firstHasConnectTimeout, firstHasReadTimeout
91
+            };
92
+            StringBuffer sb = new StringBuffer();
93
+            for(Object obj: objects) {
94
+                sb.append(obj).append(separator);
95
+            }
96
+            try {
97
+                String sign = WXPayUtil.HMACSHA256(sb.toString(), key);
98
+                sb.append(sign);
99
+                return sb.toString();
100
+            }
101
+            catch (Exception ex) {
102
+                return null;
103
+            }
104
+
105
+        }
106
+
107
+    }
108
+
109
+    private static final String REPORT_URL = "http://report.mch.weixin.qq.com/wxpay/report/default";
110
+    // private static final String REPORT_URL = "http://127.0.0.1:5000/test";
111
+
112
+
113
+    private static final int DEFAULT_CONNECT_TIMEOUT_MS = 6*1000;
114
+    private static final int DEFAULT_READ_TIMEOUT_MS = 8*1000;
115
+
116
+    private LinkedBlockingQueue<String> reportMsgQueue = null;
117
+    private WXPayConfig config;
118
+    private ExecutorService executorService;
119
+
120
+    private volatile static WXPayReport INSTANCE;
121
+
122
+    private WXPayReport(final WXPayConfig config) {
123
+        this.config = config;
124
+        reportMsgQueue = new LinkedBlockingQueue<String>(config.getReportQueueMaxSize());
125
+
126
+        // 添加处理线程
127
+        executorService = Executors.newFixedThreadPool(config.getReportWorkerNum(), new ThreadFactory() {
128
+            public Thread newThread(Runnable r) {
129
+                Thread t = Executors.defaultThreadFactory().newThread(r);
130
+                t.setDaemon(true);
131
+                return t;
132
+            }
133
+        });
134
+
135
+        if (config.shouldAutoReport()) {
136
+            WXPayUtil.getLogger().info("report worker num: {}", config.getReportWorkerNum());
137
+            for (int i = 0; i < config.getReportWorkerNum(); ++i) {
138
+                executorService.execute(new Runnable() {
139
+                    public void run() {
140
+                        while (true) {
141
+                            // 先用 take 获取数据
142
+                            try {
143
+                                StringBuffer sb = new StringBuffer();
144
+                                String firstMsg = reportMsgQueue.take();
145
+                                WXPayUtil.getLogger().info("get first report msg: {}", firstMsg);
146
+                                String msg = null;
147
+                                sb.append(firstMsg); //会阻塞至有消息
148
+                                int remainNum = config.getReportBatchSize() - 1;
149
+                                for (int j=0; j<remainNum; ++j) {
150
+                                    WXPayUtil.getLogger().info("try get remain report msg");
151
+                                    // msg = reportMsgQueue.poll();  // 不阻塞了
152
+                                    msg = reportMsgQueue.take();
153
+                                    WXPayUtil.getLogger().info("get remain report msg: {}", msg);
154
+                                    if (msg == null) {
155
+                                        break;
156
+                                    }
157
+                                    else {
158
+                                        sb.append("\n");
159
+                                        sb.append(msg);
160
+                                    }
161
+                                }
162
+                                // 上报
163
+                                WXPayReport.httpRequest(sb.toString(), DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS);
164
+                            }
165
+                            catch (Exception ex) {
166
+                                WXPayUtil.getLogger().warn("report fail. reason: {}", ex.getMessage());
167
+                            }
168
+                        }
169
+                    }
170
+                });
171
+            }
172
+        }
173
+
174
+    }
175
+
176
+    /**
177
+     * 单例,双重校验,请在 JDK 1.5及更高版本中使用
178
+     *
179
+     * @param config
180
+     * @return
181
+     */
182
+    public static WXPayReport getInstance(WXPayConfig config) {
183
+        if (INSTANCE == null) {
184
+            synchronized (WXPayReport.class) {
185
+                if (INSTANCE == null) {
186
+                    INSTANCE = new WXPayReport(config);
187
+                }
188
+            }
189
+        }
190
+        return INSTANCE;
191
+    }
192
+
193
+    public void report(String uuid, long elapsedTimeMillis,
194
+                       String firstDomain, boolean primaryDomain, int firstConnectTimeoutMillis, int firstReadTimeoutMillis,
195
+                       boolean firstHasDnsError, boolean firstHasConnectTimeout, boolean firstHasReadTimeout) {
196
+        long currentTimestamp = WXPayUtil.getCurrentTimestamp();
197
+        ReportInfo reportInfo = new ReportInfo(uuid, currentTimestamp, elapsedTimeMillis,
198
+                firstDomain, primaryDomain, firstConnectTimeoutMillis, firstReadTimeoutMillis,
199
+                firstHasDnsError, firstHasConnectTimeout, firstHasReadTimeout);
200
+        String data = reportInfo.toLineString(config.getKey());
201
+        WXPayUtil.getLogger().info("report {}", data);
202
+        if (data != null) {
203
+            reportMsgQueue.offer(data);
204
+        }
205
+    }
206
+
207
+
208
+    @Deprecated
209
+    private void reportSync(final String data) throws Exception {
210
+        httpRequest(data, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS);
211
+    }
212
+
213
+    @Deprecated
214
+    private void reportAsync(final String data) throws Exception {
215
+        new Thread(new Runnable() {
216
+            public void run() {
217
+                try {
218
+                    httpRequest(data, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS);
219
+                }
220
+                catch (Exception ex) {
221
+                    WXPayUtil.getLogger().warn("report fail. reason: {}", ex.getMessage());
222
+                }
223
+            }
224
+        }).start();
225
+    }
226
+
227
+    /**
228
+     * http 请求
229
+     * @param data
230
+     * @param connectTimeoutMs
231
+     * @param readTimeoutMs
232
+     * @return
233
+     * @throws Exception
234
+     */
235
+    private static String httpRequest(String data, int connectTimeoutMs, int readTimeoutMs) throws Exception{
236
+        BasicHttpClientConnectionManager connManager;
237
+        connManager = new BasicHttpClientConnectionManager(
238
+                RegistryBuilder.<ConnectionSocketFactory>create()
239
+                        .register("http", PlainConnectionSocketFactory.getSocketFactory())
240
+                        .register("https", SSLConnectionSocketFactory.getSocketFactory())
241
+                        .build(),
242
+                null,
243
+                null,
244
+                null
245
+        );
246
+        HttpClient httpClient = HttpClientBuilder.create()
247
+                .setConnectionManager(connManager)
248
+                .build();
249
+
250
+        HttpPost httpPost = new HttpPost(REPORT_URL);
251
+
252
+        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(readTimeoutMs).setConnectTimeout(connectTimeoutMs).build();
253
+        httpPost.setConfig(requestConfig);
254
+
255
+        StringEntity postEntity = new StringEntity(data, "UTF-8");
256
+        httpPost.addHeader("Content-Type", "text/xml");
257
+        httpPost.addHeader("User-Agent", WXPayConstants.USER_AGENT);
258
+        httpPost.setEntity(postEntity);
259
+
260
+        HttpResponse httpResponse = httpClient.execute(httpPost);
261
+        HttpEntity httpEntity = httpResponse.getEntity();
262
+        return EntityUtils.toString(httpEntity, "UTF-8");
263
+    }
264
+
265
+}

+ 258
- 0
app-api/src/main/java/com/community/huiju/common/wxpay/WXPayRequest.java 查看文件

@@ -0,0 +1,258 @@
1
+package com.community.huiju.common.wxpay;
2
+
3
+import org.apache.http.HttpEntity;
4
+import org.apache.http.HttpResponse;
5
+import org.apache.http.client.HttpClient;
6
+import org.apache.http.client.config.RequestConfig;
7
+import org.apache.http.client.methods.HttpPost;
8
+import org.apache.http.config.RegistryBuilder;
9
+import org.apache.http.conn.ConnectTimeoutException;
10
+import org.apache.http.conn.socket.ConnectionSocketFactory;
11
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
12
+import org.apache.http.conn.ssl.DefaultHostnameVerifier;
13
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
14
+import org.apache.http.entity.StringEntity;
15
+import org.apache.http.impl.client.HttpClientBuilder;
16
+import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
17
+import org.apache.http.util.EntityUtils;
18
+
19
+import javax.net.ssl.KeyManagerFactory;
20
+import javax.net.ssl.SSLContext;
21
+import java.io.InputStream;
22
+import java.net.SocketTimeoutException;
23
+import java.net.UnknownHostException;
24
+import java.security.KeyStore;
25
+import java.security.SecureRandom;
26
+
27
+import static com.community.huiju.common.wxpay.WXPayConstants.USER_AGENT;
28
+
29
+public class WXPayRequest {
30
+    private WXPayConfig config;
31
+    public WXPayRequest(WXPayConfig config) throws Exception{
32
+
33
+        this.config = config;
34
+    }
35
+
36
+    /**
37
+     * 请求,只请求一次,不做重试
38
+     * @param domain
39
+     * @param urlSuffix
40
+     * @param uuid
41
+     * @param data
42
+     * @param connectTimeoutMs
43
+     * @param readTimeoutMs
44
+     * @param useCert 是否使用证书,针对退款、撤销等操作
45
+     * @return
46
+     * @throws Exception
47
+     */
48
+    private String requestOnce(final String domain, String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean useCert) throws Exception {
49
+        BasicHttpClientConnectionManager connManager;
50
+        if (useCert) {
51
+            // 证书
52
+            char[] password = config.getMchID().toCharArray();
53
+            InputStream certStream = config.getCertStream();
54
+            KeyStore ks = KeyStore.getInstance("PKCS12");
55
+            ks.load(certStream, password);
56
+
57
+            // 实例化密钥库 & 初始化密钥工厂
58
+            KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
59
+            kmf.init(ks, password);
60
+
61
+            // 创建 SSLContext
62
+            SSLContext sslContext = SSLContext.getInstance("TLS");
63
+            sslContext.init(kmf.getKeyManagers(), null, new SecureRandom());
64
+
65
+            SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(
66
+                    sslContext,
67
+                    new String[]{"TLSv1"},
68
+                    null,
69
+                    new DefaultHostnameVerifier());
70
+
71
+            connManager = new BasicHttpClientConnectionManager(
72
+                    RegistryBuilder.<ConnectionSocketFactory>create()
73
+                            .register("http", PlainConnectionSocketFactory.getSocketFactory())
74
+                            .register("https", sslConnectionSocketFactory)
75
+                            .build(),
76
+                    null,
77
+                    null,
78
+                    null
79
+            );
80
+        }
81
+        else {
82
+            connManager = new BasicHttpClientConnectionManager(
83
+                    RegistryBuilder.<ConnectionSocketFactory>create()
84
+                            .register("http", PlainConnectionSocketFactory.getSocketFactory())
85
+                            .register("https", SSLConnectionSocketFactory.getSocketFactory())
86
+                            .build(),
87
+                    null,
88
+                    null,
89
+                    null
90
+            );
91
+        }
92
+
93
+        HttpClient httpClient = HttpClientBuilder.create()
94
+                .setConnectionManager(connManager)
95
+                .build();
96
+
97
+        String url = "https://" + domain + urlSuffix;
98
+        HttpPost httpPost = new HttpPost(url);
99
+
100
+        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(readTimeoutMs).setConnectTimeout(connectTimeoutMs).build();
101
+        httpPost.setConfig(requestConfig);
102
+
103
+        StringEntity postEntity = new StringEntity(data, "UTF-8");
104
+        httpPost.addHeader("Content-Type", "text/xml");
105
+        httpPost.addHeader("User-Agent", USER_AGENT + " " + config.getMchID());
106
+        httpPost.setEntity(postEntity);
107
+
108
+        HttpResponse httpResponse = httpClient.execute(httpPost);
109
+        HttpEntity httpEntity = httpResponse.getEntity();
110
+        return EntityUtils.toString(httpEntity, "UTF-8");
111
+
112
+    }
113
+
114
+
115
+    private String request(String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean useCert, boolean autoReport) throws Exception {
116
+        Exception exception = null;
117
+        long elapsedTimeMillis = 0;
118
+        long startTimestampMs = WXPayUtil.getCurrentTimestampMs();
119
+        boolean firstHasDnsErr = false;
120
+        boolean firstHasConnectTimeout = false;
121
+        boolean firstHasReadTimeout = false;
122
+        IWXPayDomain.DomainInfo domainInfo = config.getWXPayDomain().getDomain(config);
123
+        if(domainInfo == null){
124
+            throw new Exception("WXPayConfig.getWXPayDomain().getDomain() is empty or null");
125
+        }
126
+        try {
127
+            String result = requestOnce(domainInfo.domain, urlSuffix, uuid, data, connectTimeoutMs, readTimeoutMs, useCert);
128
+            elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
129
+            config.getWXPayDomain().report(domainInfo.domain, elapsedTimeMillis, null);
130
+            WXPayReport.getInstance(config).report(
131
+                    uuid,
132
+                    elapsedTimeMillis,
133
+                    domainInfo.domain,
134
+                    domainInfo.primaryDomain,
135
+                    connectTimeoutMs,
136
+                    readTimeoutMs,
137
+                    firstHasDnsErr,
138
+                    firstHasConnectTimeout,
139
+                    firstHasReadTimeout);
140
+            return result;
141
+        }
142
+        catch (UnknownHostException ex) {  // dns 解析错误,或域名不存在
143
+            exception = ex;
144
+            firstHasDnsErr = true;
145
+            elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
146
+            WXPayUtil.getLogger().warn("UnknownHostException for domainInfo {}", domainInfo);
147
+            WXPayReport.getInstance(config).report(
148
+                    uuid,
149
+                    elapsedTimeMillis,
150
+                    domainInfo.domain,
151
+                    domainInfo.primaryDomain,
152
+                    connectTimeoutMs,
153
+                    readTimeoutMs,
154
+                    firstHasDnsErr,
155
+                    firstHasConnectTimeout,
156
+                    firstHasReadTimeout
157
+            );
158
+        }
159
+        catch (ConnectTimeoutException ex) {
160
+            exception = ex;
161
+            firstHasConnectTimeout = true;
162
+            elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
163
+            WXPayUtil.getLogger().warn("connect timeout happened for domainInfo {}", domainInfo);
164
+            WXPayReport.getInstance(config).report(
165
+                    uuid,
166
+                    elapsedTimeMillis,
167
+                    domainInfo.domain,
168
+                    domainInfo.primaryDomain,
169
+                    connectTimeoutMs,
170
+                    readTimeoutMs,
171
+                    firstHasDnsErr,
172
+                    firstHasConnectTimeout,
173
+                    firstHasReadTimeout
174
+            );
175
+        }
176
+        catch (SocketTimeoutException ex) {
177
+            exception = ex;
178
+            firstHasReadTimeout = true;
179
+            elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
180
+            WXPayUtil.getLogger().warn("timeout happened for domainInfo {}", domainInfo);
181
+            WXPayReport.getInstance(config).report(
182
+                    uuid,
183
+                    elapsedTimeMillis,
184
+                    domainInfo.domain,
185
+                    domainInfo.primaryDomain,
186
+                    connectTimeoutMs,
187
+                    readTimeoutMs,
188
+                    firstHasDnsErr,
189
+                    firstHasConnectTimeout,
190
+                    firstHasReadTimeout);
191
+        }
192
+        catch (Exception ex) {
193
+            exception = ex;
194
+            elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
195
+            WXPayReport.getInstance(config).report(
196
+                    uuid,
197
+                    elapsedTimeMillis,
198
+                    domainInfo.domain,
199
+                    domainInfo.primaryDomain,
200
+                    connectTimeoutMs,
201
+                    readTimeoutMs,
202
+                    firstHasDnsErr,
203
+                    firstHasConnectTimeout,
204
+                    firstHasReadTimeout);
205
+        }
206
+        config.getWXPayDomain().report(domainInfo.domain, elapsedTimeMillis, exception);
207
+        throw exception;
208
+    }
209
+
210
+
211
+    /**
212
+     * 可重试的,非双向认证的请求
213
+     * @param urlSuffix
214
+     * @param uuid
215
+     * @param data
216
+     * @return
217
+     */
218
+    public String requestWithoutCert(String urlSuffix, String uuid, String data, boolean autoReport) throws Exception {
219
+        return this.request(urlSuffix, uuid, data, config.getHttpConnectTimeoutMs(), config.getHttpReadTimeoutMs(), false, autoReport);
220
+    }
221
+
222
+    /**
223
+     * 可重试的,非双向认证的请求
224
+     * @param urlSuffix
225
+     * @param uuid
226
+     * @param data
227
+     * @param connectTimeoutMs
228
+     * @param readTimeoutMs
229
+     * @return
230
+     */
231
+    public String requestWithoutCert(String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs,  boolean autoReport) throws Exception {
232
+        return this.request(urlSuffix, uuid, data, connectTimeoutMs, readTimeoutMs, false, autoReport);
233
+    }
234
+
235
+    /**
236
+     * 可重试的,双向认证的请求
237
+     * @param urlSuffix
238
+     * @param uuid
239
+     * @param data
240
+     * @return
241
+     */
242
+    public String requestWithCert(String urlSuffix, String uuid, String data, boolean autoReport) throws Exception {
243
+        return this.request(urlSuffix, uuid, data, config.getHttpConnectTimeoutMs(), config.getHttpReadTimeoutMs(), true, autoReport);
244
+    }
245
+
246
+    /**
247
+     * 可重试的,双向认证的请求
248
+     * @param urlSuffix
249
+     * @param uuid
250
+     * @param data
251
+     * @param connectTimeoutMs
252
+     * @param readTimeoutMs
253
+     * @return
254
+     */
255
+    public String requestWithCert(String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean autoReport) throws Exception {
256
+        return this.request(urlSuffix, uuid, data, connectTimeoutMs, readTimeoutMs, true, autoReport);
257
+    }
258
+}

+ 299
- 0
app-api/src/main/java/com/community/huiju/common/wxpay/WXPayUtil.java 查看文件

@@ -0,0 +1,299 @@
1
+package com.community.huiju.common.wxpay;
2
+
3
+import com.community.huiju.common.wxpay.WXPayConstants.SignType;
4
+import org.slf4j.Logger;
5
+import org.slf4j.LoggerFactory;
6
+import org.w3c.dom.Node;
7
+import org.w3c.dom.NodeList;
8
+
9
+import javax.crypto.Mac;
10
+import javax.crypto.spec.SecretKeySpec;
11
+import javax.xml.parsers.DocumentBuilder;
12
+import javax.xml.transform.OutputKeys;
13
+import javax.xml.transform.Transformer;
14
+import javax.xml.transform.TransformerFactory;
15
+import javax.xml.transform.dom.DOMSource;
16
+import javax.xml.transform.stream.StreamResult;
17
+import java.io.ByteArrayInputStream;
18
+import java.io.InputStream;
19
+import java.io.StringWriter;
20
+import java.security.MessageDigest;
21
+import java.security.SecureRandom;
22
+import java.util.Arrays;
23
+import java.util.HashMap;
24
+import java.util.Map;
25
+import java.util.Random;
26
+import java.util.Set;
27
+
28
+
29
+public class WXPayUtil {
30
+
31
+    private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
32
+
33
+    private static final Random RANDOM = new SecureRandom();
34
+
35
+    /**
36
+     * XML格式字符串转换为Map
37
+     *
38
+     * @param strXML XML字符串
39
+     * @return XML数据转换后的Map
40
+     * @throws Exception
41
+     */
42
+    public static Map<String, String> xmlToMap(String strXML) throws Exception {
43
+        try {
44
+            Map<String, String> data = new HashMap<String, String>();
45
+            DocumentBuilder documentBuilder = WXPayXmlUtil.newDocumentBuilder();
46
+            InputStream stream = new ByteArrayInputStream(strXML.getBytes("UTF-8"));
47
+            org.w3c.dom.Document doc = documentBuilder.parse(stream);
48
+            doc.getDocumentElement().normalize();
49
+            NodeList nodeList = doc.getDocumentElement().getChildNodes();
50
+            for (int idx = 0; idx < nodeList.getLength(); ++idx) {
51
+                Node node = nodeList.item(idx);
52
+                if (node.getNodeType() == Node.ELEMENT_NODE) {
53
+                    org.w3c.dom.Element element = (org.w3c.dom.Element) node;
54
+                    data.put(element.getNodeName(), element.getTextContent());
55
+                }
56
+            }
57
+            try {
58
+                stream.close();
59
+            } catch (Exception ex) {
60
+                // do nothing
61
+            }
62
+            return data;
63
+        } catch (Exception ex) {
64
+            WXPayUtil.getLogger().warn("Invalid XML, can not convert to map. Error message: {}. XML content: {}", ex.getMessage(), strXML);
65
+            throw ex;
66
+        }
67
+
68
+    }
69
+
70
+    /**
71
+     * 将Map转换为XML格式的字符串
72
+     *
73
+     * @param data Map类型数据
74
+     * @return XML格式的字符串
75
+     * @throws Exception
76
+     */
77
+    public static String mapToXml(Map<String, String> data) throws Exception {
78
+        org.w3c.dom.Document document = WXPayXmlUtil.newDocument();
79
+        org.w3c.dom.Element root = document.createElement("xml");
80
+        document.appendChild(root);
81
+        for (String key: data.keySet()) {
82
+            String value = data.get(key);
83
+            if (value == null) {
84
+                value = "";
85
+            }
86
+            value = value.trim();
87
+            org.w3c.dom.Element filed = document.createElement(key);
88
+            filed.appendChild(document.createTextNode(value));
89
+            root.appendChild(filed);
90
+        }
91
+        TransformerFactory tf = TransformerFactory.newInstance();
92
+        Transformer transformer = tf.newTransformer();
93
+        DOMSource source = new DOMSource(document);
94
+        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
95
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
96
+        StringWriter writer = new StringWriter();
97
+        StreamResult result = new StreamResult(writer);
98
+        transformer.transform(source, result);
99
+        String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", "");
100
+        try {
101
+            writer.close();
102
+        }
103
+        catch (Exception ex) {
104
+        }
105
+        return output;
106
+    }
107
+
108
+
109
+    /**
110
+     * 生成带有 sign 的 XML 格式字符串
111
+     *
112
+     * @param data Map类型数据
113
+     * @param key API密钥
114
+     * @return 含有sign字段的XML
115
+     */
116
+    public static String generateSignedXml(final Map<String, String> data, String key) throws Exception {
117
+        return generateSignedXml(data, key, SignType.MD5);
118
+    }
119
+
120
+    /**
121
+     * 生成带有 sign 的 XML 格式字符串
122
+     *
123
+     * @param data Map类型数据
124
+     * @param key API密钥
125
+     * @param signType 签名类型
126
+     * @return 含有sign字段的XML
127
+     */
128
+    public static String generateSignedXml(final Map<String, String> data, String key, SignType signType) throws Exception {
129
+        String sign = generateSignature(data, key, signType);
130
+        data.put(WXPayConstants.FIELD_SIGN, sign);
131
+        return mapToXml(data);
132
+    }
133
+
134
+
135
+    /**
136
+     * 判断签名是否正确
137
+     *
138
+     * @param xmlStr XML格式数据
139
+     * @param key API密钥
140
+     * @return 签名是否正确
141
+     * @throws Exception
142
+     */
143
+    public static boolean isSignatureValid(String xmlStr, String key) throws Exception {
144
+        Map<String, String> data = xmlToMap(xmlStr);
145
+        if (!data.containsKey(WXPayConstants.FIELD_SIGN) ) {
146
+            return false;
147
+        }
148
+        String sign = data.get(WXPayConstants.FIELD_SIGN);
149
+        return generateSignature(data, key).equals(sign);
150
+    }
151
+
152
+    /**
153
+     * 判断签名是否正确,必须包含sign字段,否则返回false。使用MD5签名。
154
+     *
155
+     * @param data Map类型数据
156
+     * @param key API密钥
157
+     * @return 签名是否正确
158
+     * @throws Exception
159
+     */
160
+    public static boolean isSignatureValid(Map<String, String> data, String key) throws Exception {
161
+        return isSignatureValid(data, key, SignType.MD5);
162
+    }
163
+
164
+    /**
165
+     * 判断签名是否正确,必须包含sign字段,否则返回false。
166
+     *
167
+     * @param data Map类型数据
168
+     * @param key API密钥
169
+     * @param signType 签名方式
170
+     * @return 签名是否正确
171
+     * @throws Exception
172
+     */
173
+    public static boolean isSignatureValid(Map<String, String> data, String key, SignType signType) throws Exception {
174
+        if (!data.containsKey(WXPayConstants.FIELD_SIGN) ) {
175
+            return false;
176
+        }
177
+        String sign = data.get(WXPayConstants.FIELD_SIGN);
178
+        return generateSignature(data, key, signType).equals(sign);
179
+    }
180
+
181
+    /**
182
+     * 生成签名
183
+     *
184
+     * @param data 待签名数据
185
+     * @param key API密钥
186
+     * @return 签名
187
+     */
188
+    public static String generateSignature(final Map<String, String> data, String key) throws Exception {
189
+        return generateSignature(data, key, SignType.MD5);
190
+    }
191
+
192
+    /**
193
+     * 生成签名. 注意,若含有sign_type字段,必须和signType参数保持一致。
194
+     *
195
+     * @param data 待签名数据
196
+     * @param key API密钥
197
+     * @param signType 签名方式
198
+     * @return 签名
199
+     */
200
+    public static String generateSignature(final Map<String, String> data, String key, SignType signType) throws Exception {
201
+        Set<String> keySet = data.keySet();
202
+        String[] keyArray = keySet.toArray(new String[keySet.size()]);
203
+        Arrays.sort(keyArray);
204
+        StringBuilder sb = new StringBuilder();
205
+        for (String k : keyArray) {
206
+            if (k.equals(WXPayConstants.FIELD_SIGN)) {
207
+                continue;
208
+            }
209
+            if (data.get(k).trim().length() > 0) // 参数值为空,则不参与签名
210
+                sb.append(k).append("=").append(data.get(k).trim()).append("&");
211
+        }
212
+        sb.append("key=").append(key);
213
+        if (SignType.MD5.equals(signType)) {
214
+            return MD5(sb.toString()).toUpperCase();
215
+        }
216
+        else if (SignType.HMACSHA256.equals(signType)) {
217
+            return HMACSHA256(sb.toString(), key);
218
+        }
219
+        else {
220
+            throw new Exception(String.format("Invalid sign_type: %s", signType));
221
+        }
222
+    }
223
+
224
+
225
+    /**
226
+     * 获取随机字符串 Nonce Str
227
+     *
228
+     * @return String 随机字符串
229
+     */
230
+    public static String generateNonceStr() {
231
+        char[] nonceChars = new char[32];
232
+        for (int index = 0; index < nonceChars.length; ++index) {
233
+            nonceChars[index] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length()));
234
+        }
235
+        return new String(nonceChars);
236
+    }
237
+
238
+
239
+    /**
240
+     * 生成 MD5
241
+     *
242
+     * @param data 待处理数据
243
+     * @return MD5结果
244
+     */
245
+    public static String MD5(String data) throws Exception {
246
+        MessageDigest md = MessageDigest.getInstance("MD5");
247
+        byte[] array = md.digest(data.getBytes("UTF-8"));
248
+        StringBuilder sb = new StringBuilder();
249
+        for (byte item : array) {
250
+            sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
251
+        }
252
+        return sb.toString().toUpperCase();
253
+    }
254
+
255
+    /**
256
+     * 生成 HMACSHA256
257
+     * @param data 待处理数据
258
+     * @param key 密钥
259
+     * @return 加密结果
260
+     * @throws Exception
261
+     */
262
+    public static String HMACSHA256(String data, String key) throws Exception {
263
+        Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
264
+        SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
265
+        sha256_HMAC.init(secret_key);
266
+        byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8"));
267
+        StringBuilder sb = new StringBuilder();
268
+        for (byte item : array) {
269
+            sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
270
+        }
271
+        return sb.toString().toUpperCase();
272
+    }
273
+
274
+    /**
275
+     * 日志
276
+     * @return
277
+     */
278
+    public static Logger getLogger() {
279
+        Logger logger = LoggerFactory.getLogger("wxpay java sdk");
280
+        return logger;
281
+    }
282
+
283
+    /**
284
+     * 获取当前时间戳,单位秒
285
+     * @return
286
+     */
287
+    public static long getCurrentTimestamp() {
288
+        return System.currentTimeMillis()/1000;
289
+    }
290
+
291
+    /**
292
+     * 获取当前时间戳,单位毫秒
293
+     * @return
294
+     */
295
+    public static long getCurrentTimestampMs() {
296
+        return System.currentTimeMillis();
297
+    }
298
+
299
+}

+ 30
- 0
app-api/src/main/java/com/community/huiju/common/wxpay/WXPayXmlUtil.java 查看文件

@@ -0,0 +1,30 @@
1
+package com.community.huiju.common.wxpay;
2
+
3
+import org.w3c.dom.Document;
4
+
5
+import javax.xml.XMLConstants;
6
+import javax.xml.parsers.DocumentBuilder;
7
+import javax.xml.parsers.DocumentBuilderFactory;
8
+import javax.xml.parsers.ParserConfigurationException;
9
+
10
+/**
11
+ * 2018/7/3
12
+ */
13
+public final class WXPayXmlUtil {
14
+    public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
15
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
16
+        documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
17
+        documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
18
+        documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
19
+        documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
20
+        documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
21
+        documentBuilderFactory.setXIncludeAware(false);
22
+        documentBuilderFactory.setExpandEntityReferences(false);
23
+
24
+        return documentBuilderFactory.newDocumentBuilder();
25
+    }
26
+
27
+    public static Document newDocument() throws ParserConfigurationException {
28
+        return newDocumentBuilder().newDocument();
29
+    }
30
+}

+ 66
- 0
app-api/src/main/java/com/community/huiju/config/BillQuartz.java 查看文件

@@ -0,0 +1,66 @@
1
+package com.community.huiju.config;
2
+
3
+import com.community.huiju.dao.TaUserLicenseOrderMapper;
4
+import com.community.huiju.dao.TpBillInvoiceMapper;
5
+import com.community.huiju.dao.TpBillOrderMapper;
6
+import com.community.huiju.model.TaUserLicenseOrder;
7
+import com.community.huiju.model.TpBillInvoice;
8
+import com.community.huiju.model.TpBillOrder;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.scheduling.annotation.Scheduled;
12
+import org.springframework.stereotype.Component;
13
+
14
+import java.util.List;
15
+
16
+/**
17
+ * 定时器
18
+ * @author weiximei
19
+ */
20
+//@Component
21
+@Slf4j
22
+public class BillQuartz {
23
+
24
+    @Autowired
25
+    private TpBillOrderMapper tpBillOrderMapper;
26
+
27
+    @Autowired
28
+    private TpBillInvoiceMapper tpBillInvoiceMapper;
29
+
30
+    @Autowired
31
+    private TaUserLicenseOrderMapper taUserLicenseOrderMapper;
32
+
33
+    //@Scheduled(cron = "0 0/10 * * * ?")
34
+    public void billInvoice() {
35
+        log.info("定时任务,扫描订单,超过 10 分未付款则,关闭订单!");
36
+        // 物业缴费
37
+        List<TpBillOrder> billOrderList = tpBillOrderMapper.selectCloseOrder();
38
+        if (!billOrderList.isEmpty()) {
39
+            // 把缴费单变为未交费
40
+            billOrderList.forEach(e->{
41
+                TpBillInvoice tpBillInvoice = tpBillInvoiceMapper.selectByPrimaryKey(e.getTpBillInvoiceId());
42
+                tpBillInvoice.setBillStatus("0");
43
+                tpBillInvoiceMapper.updateByPrimaryKeySelective(tpBillInvoice);
44
+            });
45
+
46
+            // 关闭订单
47
+            billOrderList.forEach(e -> {
48
+                e.setOrderStatus("3");
49
+                tpBillOrderMapper.updateByPrimaryKeySelective(e);
50
+            });
51
+
52
+        }
53
+
54
+        // 车缴费订单
55
+        List<TaUserLicenseOrder> userLicenseOrders = taUserLicenseOrderMapper.selectCloseOrder();
56
+        if (!userLicenseOrders.isEmpty()) {
57
+            userLicenseOrders.forEach(e-> {
58
+                e.setOrderStatus("3");
59
+                taUserLicenseOrderMapper.updateByPrimaryKeySelective(e);
60
+            });
61
+        }
62
+
63
+
64
+    }
65
+
66
+}

+ 29
- 0
app-api/src/main/java/com/community/huiju/config/FeignUploadConfig.java 查看文件

@@ -0,0 +1,29 @@
1
+package com.community.huiju.config;
2
+
3
+import feign.Logger;
4
+import feign.codec.Encoder;
5
+import feign.form.spring.SpringFormEncoder;
6
+import org.springframework.beans.factory.ObjectFactory;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
9
+import org.springframework.cloud.openfeign.support.SpringEncoder;
10
+import org.springframework.context.annotation.Bean;
11
+import org.springframework.context.annotation.Configuration;
12
+
13
+@Configuration
14
+public class FeignUploadConfig {
15
+
16
+    @Autowired
17
+    private ObjectFactory<HttpMessageConverters> messageConverters;
18
+    @Bean
19
+    public Encoder feignEncoder() {
20
+        return new SpringFormEncoder(new SpringEncoder(messageConverters));
21
+    }
22
+
23
+    @Bean
24
+    public Logger.Level feignLoggerLevel() {
25
+        //这里记录所有,根据实际情况选择合适的日志level
26
+        return Logger.Level.FULL;
27
+    }
28
+
29
+}

+ 40
- 0
app-api/src/main/java/com/community/huiju/config/FuShiConfig.java 查看文件

@@ -0,0 +1,40 @@
1
+package com.community.huiju.config;
2
+
3
+import com.community.commom.fushi.FuShiHttpClient;
4
+import com.community.commom.fushi.FuShiRequestAPI;
5
+import com.community.huiju.common.perproties.FuShiProperties;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.context.annotation.Bean;
8
+import org.springframework.context.annotation.Configuration;
9
+
10
+/**
11
+ * 富士配置类
12
+ * @author weiximei
13
+ */
14
+@Configuration
15
+public class FuShiConfig {
16
+
17
+    @Autowired
18
+    private FuShiProperties fuShiProperties;
19
+
20
+
21
+    /**
22
+     * 初始化富士HTTP客户端
23
+     * @return FuShiHttpClient
24
+     */
25
+    @Bean
26
+    public FuShiHttpClient fuShiHttpClient() {
27
+        return new FuShiHttpClient(fuShiProperties.getUrl(), fuShiProperties.getAppid(), fuShiProperties.getAppSecret(), fuShiProperties.getPrivateKey());
28
+    }
29
+
30
+    /**
31
+     * 初始化富士请求 API
32
+     * @param fuShiHttpClient
33
+     * @return
34
+     */
35
+    @Bean
36
+    public FuShiRequestAPI fuShiRequestAPI(FuShiHttpClient fuShiHttpClient) {
37
+        return new FuShiRequestAPI(fuShiHttpClient);
38
+    }
39
+
40
+}

+ 22
- 0
app-api/src/main/java/com/community/huiju/config/HttpSessionConfig.java 查看文件

@@ -0,0 +1,22 @@
1
+package com.community.huiju.config;
2
+
3
+import org.springframework.context.annotation.Bean;
4
+import org.springframework.context.annotation.Configuration;
5
+import org.springframework.session.MapSession;
6
+import org.springframework.session.jdbc.config.annotation.web.http.EnableJdbcHttpSession;
7
+import org.springframework.session.web.http.HeaderHttpSessionIdResolver;
8
+import org.springframework.session.web.http.HttpSessionIdResolver;
9
+
10
+/**
11
+ * @author weiximei
12
+ */
13
+@Configuration
14
+@EnableJdbcHttpSession(maxInactiveIntervalInSeconds = MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS*48*7)
15
+public class HttpSessionConfig {
16
+
17
+    @Bean
18
+    public HttpSessionIdResolver httpSessionIdResolver() {
19
+        return HeaderHttpSessionIdResolver.xAuthToken();
20
+    }
21
+
22
+}

+ 46
- 0
app-api/src/main/java/com/community/huiju/controller/AgreementController.java 查看文件

@@ -0,0 +1,46 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.model.TaAgreement;
5
+import com.community.huiju.service.AgreementServicel;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.cloud.context.config.annotation.RefreshScope;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import java.util.List;
17
+
18
+/**
19
+ * version V1.0
20
+ * class_name: $METHOD_NAME$
21
+ * param: $METHOD_PARAM$
22
+ * describe: TODO
23
+ * creat_user:fannaixi
24
+ * creat_time: 2018/10/22
25
+ **/
26
+
27
+@RestController
28
+@RefreshScope
29
+@RequestMapping("/")
30
+@Api(value = "协议相关的API", description = "协议相关的API")
31
+public class AgreementController {
32
+
33
+    @Autowired
34
+    private AgreementServicel agreementService;
35
+
36
+    @ApiOperation(value = "获取所有协议", notes = "获取所有协议")
37
+    @RequestMapping(value = "/agreement",method = RequestMethod.GET)
38
+    public ResponseBean getAgreement(){
39
+        ResponseBean responseBean = new ResponseBean();
40
+        TaAgreement agreement = agreementService.getAgreement();
41
+        responseBean.addSuccess(agreement);
42
+        return responseBean;
43
+    }
44
+
45
+
46
+}

+ 179
- 0
app-api/src/main/java/com/community/huiju/controller/AliMPUserController.java 查看文件

@@ -0,0 +1,179 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.alipay.api.AlipayApiException;
5
+import com.alipay.api.internal.util.AlipaySignature;
6
+import com.community.commom.constant.Constant;
7
+import com.community.commom.mode.ResponseBean;
8
+import com.community.huiju.common.wxpay.WXPayConstants;
9
+import com.community.huiju.common.wxpay.WXPayUtil;
10
+import com.community.huiju.feign.IFuShiServer;
11
+import com.community.huiju.service.AliMPUserServiceI;
12
+import com.community.huiju.service.WxMPUserServiceI;
13
+import com.google.common.collect.Maps;
14
+import io.swagger.annotations.Api;
15
+import io.swagger.annotations.ApiImplicitParam;
16
+import io.swagger.annotations.ApiImplicitParams;
17
+import io.swagger.annotations.ApiOperation;
18
+import org.slf4j.Logger;
19
+import org.slf4j.LoggerFactory;
20
+import org.springframework.beans.factory.annotation.Autowired;
21
+import org.springframework.beans.factory.annotation.Value;
22
+import org.springframework.cloud.context.config.annotation.RefreshScope;
23
+import org.springframework.web.bind.annotation.PathVariable;
24
+import org.springframework.web.bind.annotation.RequestMapping;
25
+import org.springframework.web.bind.annotation.RequestMethod;
26
+import org.springframework.web.bind.annotation.RequestParam;
27
+import org.springframework.web.bind.annotation.RestController;
28
+
29
+import javax.servlet.http.HttpServletRequest;
30
+import javax.servlet.http.HttpServletResponse;
31
+import java.io.ByteArrayOutputStream;
32
+import java.io.InputStream;
33
+import java.math.BigDecimal;
34
+import java.util.HashMap;
35
+import java.util.Iterator;
36
+import java.util.Map;
37
+
38
+import static com.alipay.api.AlipayConstants.CHARSET_UTF8;
39
+
40
+/**
41
+ * @author FXF
42
+ * @date 2019-07-08
43
+ */
44
+@RestController
45
+@RefreshScope
46
+@RequestMapping("/")
47
+@Api(value = "支付宝生活号API", description = "支付宝生活号API")
48
+public class AliMPUserController {
49
+	
50
+	private Logger log = LoggerFactory.getLogger(AliMPUserController.class);
51
+	
52
+	@Value("${ali.mp.configs.appId}")
53
+	private String appId;
54
+	
55
+	@Value("${ali.mp.configs.secret}")
56
+	private String secret;
57
+	
58
+	@Value("${alipay.ALIPAY_PUBLIC_KEY}")
59
+	private String ALIPAY_PUBLIC_KEY;
60
+	
61
+	@Autowired
62
+	private AliMPUserServiceI aliMPUserService;
63
+	
64
+	@Autowired
65
+	private IFuShiServer fuShiServer;
66
+
67
+	@RequestMapping(value = "/alimp/info", method = RequestMethod.GET)
68
+	@ApiOperation(value = "获取支付宝生活号相关信息", notes = "获取支付宝生活号相关信息")
69
+	@ApiImplicitParams({})
70
+	public ResponseBean getAliMPinfo(){
71
+		ResponseBean responseBean = new ResponseBean();
72
+		Map<String,Object> map = Maps.newHashMap();
73
+		map.put("appId",appId);
74
+		responseBean.addSuccess(map);
75
+		return responseBean;
76
+	}
77
+	
78
+	@RequestMapping(value = "/{communityId}/alimp", method = RequestMethod.GET)
79
+	@ApiOperation(value = "根据CODE获取OPENID并判断是否第一次来,并返回数据", notes = "根据CODE获取OPENID并判断是否第一次来,并返回数据")
80
+	@ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
81
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "支付宝code")})
82
+	public ResponseBean getUseridByCode(@PathVariable Integer communityId, @RequestParam String code){
83
+		ResponseBean responseBean = aliMPUserService.getTemporaryData(code,appId,secret,communityId);
84
+		return responseBean;
85
+	}
86
+	
87
+	
88
+	@RequestMapping(value = "/{communityId}/alimp/records", method = RequestMethod.GET)
89
+	@ApiOperation(value = "根据openid获取缴费记录", notes = "根据openid获取缴费记录")
90
+	@ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
91
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "opneid", value = "支付宝opneid")})
92
+	public ResponseBean getRecordsByOpenid(@PathVariable Integer communityId, @RequestParam String opneid){
93
+		ResponseBean responseBean = aliMPUserService.getRecordsByOpenid(opneid,communityId);
94
+		return responseBean;
95
+	}
96
+	
97
+	@RequestMapping(value = "/{communityId}/alimp/car", method = RequestMethod.GET)
98
+	@ApiOperation(value = "根据车牌获取数据", notes = "根据车牌获取数据")
99
+	@ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
100
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "carNo", value = "车牌号")})
101
+	public ResponseBean getParkInfoByCarNo(@PathVariable Integer communityId, @RequestParam String carNo){
102
+		ResponseBean responseBean = new ResponseBean();
103
+		String parkInfoByCarNo = fuShiServer.getParkInfoByCarNo(carNo);
104
+		JSONObject carNoJson = JSONObject.parseObject(parkInfoByCarNo);
105
+		//车辆不在停车场
106
+		if (carNoJson.getInteger("code") == 1){
107
+			responseBean.addError(carNoJson.getString("message"));
108
+			return responseBean;
109
+		}
110
+		
111
+		if (carNoJson.getInteger("code") == 0 ){
112
+			if (carNoJson.getJSONObject("data").getInteger("DataType") != 3){
113
+				responseBean.addSuccess("储值车不支持在线缴费,月卡车请使用银城慧家APP延期续费");
114
+				return responseBean;
115
+			}
116
+			//返回查询的金额
117
+			JSONObject jsonParam = carNoJson.getJSONObject("data").getJSONObject("JsonParam");
118
+			Map<String,Object> resultMap = Maps.newHashMap();
119
+			resultMap.put("ActualAmount",jsonParam.get("ActualAmount"));
120
+			responseBean.addSuccess(resultMap);
121
+		}
122
+		return responseBean;
123
+	}
124
+	
125
+	@ApiOperation(value = "临时车统一下单", notes = "临时车统一下单")
126
+	@ApiImplicitParams({
127
+			@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
128
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "carNo", value = "车牌号"),
129
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "openid", value = "支付宝openid")
130
+	})
131
+	@RequestMapping(value = "/{communityId}/alimp/order",method = RequestMethod.GET)
132
+	public ResponseBean aliTmpOrder(@PathVariable Integer communityId,
133
+	                               @RequestParam("carNo") String carNo,
134
+	                               @RequestParam("openid") String openid){
135
+		ResponseBean responseBean = new ResponseBean();
136
+		
137
+		//String parkInfoByCarNo = fuShiServer.getParkInfoByCarNo(carNo);
138
+		//JSONObject carNoJson = JSONObject.parseObject(parkInfoByCarNo);
139
+		//String actualAmount = String.valueOf(Double.valueOf(((BigDecimal) carNoJson.getJSONObject("JsonParam").get("ActualAmount")).toString()) * 100);
140
+		//actualAmount = actualAmount.substring(0, actualAmount.lastIndexOf("."));
141
+		//String resp = wxMPUserService.wxTmpOrder(carNo,actualAmount,communityId,openid,(BigDecimal) carNoJson.getJSONObject("JsonParam").get("ActualAmount"));
142
+		String resp = aliMPUserService.aliTmpOrder(carNo,"1",communityId,openid,new BigDecimal("0.1"));
143
+		
144
+		responseBean.addSuccess(resp);
145
+		return responseBean;
146
+	}
147
+	
148
+	@ApiOperation(value = "手机订单支付完成后回调临时车缴费", notes = "手机订单支付完成后回调临时车缴费")
149
+	@RequestMapping(value = "/aliTmpNotify",method = RequestMethod.POST)
150
+	public void wxBillNotify(HttpServletRequest request, HttpServletResponse response){
151
+		log.info("支付宝 alipay result  start =======");
152
+		Map<String,String> params = new HashMap<String,String>();
153
+		Map requestParams = request.getParameterMap();
154
+		for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) {
155
+			String name = (String) iter.next();
156
+			String[] values = (String[]) requestParams.get(name);
157
+			String valueStr = "";
158
+			for (int i = 0; i < values.length; i++) {
159
+				valueStr = (i == values.length - 1) ? valueStr + values[i]
160
+						: valueStr + values[i] + ",";
161
+			}
162
+			//乱码解决,这段代码在出现乱码时使用。
163
+			//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
164
+			params.put(name, valueStr);
165
+		}
166
+		//切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。
167
+		try {
168
+			boolean flag = AlipaySignature.rsaCheckV1(params, ALIPAY_PUBLIC_KEY, CHARSET_UTF8,"RSA2");
169
+			if (flag){
170
+				aliMPUserService.updateTmpOrder(params.get("out_trade_no"));
171
+			}
172
+		} catch (AlipayApiException e) {
173
+			e.printStackTrace();
174
+		} catch (Exception e) {
175
+			e.printStackTrace();
176
+		}
177
+		
178
+	}
179
+}

+ 132
- 0
app-api/src/main/java/com/community/huiju/controller/AliPayController.java 查看文件

@@ -0,0 +1,132 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alipay.api.AlipayApiException;
4
+import com.alipay.api.internal.util.AlipaySignature;
5
+import com.community.commom.constant.Constant;
6
+import com.community.commom.mode.ResponseBean;
7
+import com.community.commom.session.UserElement;
8
+import com.community.huiju.common.wxpay.WXPayConstants;
9
+import com.community.huiju.common.wxpay.WXPayUtil;
10
+import com.community.huiju.service.AliPayServiceI;
11
+import com.community.huiju.service.WxPayServiceI;
12
+import com.google.common.collect.Maps;
13
+import io.swagger.annotations.Api;
14
+import io.swagger.annotations.ApiImplicitParam;
15
+import io.swagger.annotations.ApiImplicitParams;
16
+import io.swagger.annotations.ApiOperation;
17
+import lombok.extern.slf4j.Slf4j;
18
+import org.slf4j.Logger;
19
+import org.slf4j.LoggerFactory;
20
+import org.springframework.beans.factory.annotation.Autowired;
21
+import org.springframework.beans.factory.annotation.Value;
22
+import org.springframework.cloud.context.config.annotation.RefreshScope;
23
+import org.springframework.web.bind.annotation.*;
24
+
25
+import javax.servlet.http.HttpServletRequest;
26
+import javax.servlet.http.HttpServletResponse;
27
+import javax.servlet.http.HttpSession;
28
+import java.io.ByteArrayOutputStream;
29
+import java.io.InputStream;
30
+import java.util.HashMap;
31
+import java.util.Iterator;
32
+import java.util.Map;
33
+
34
+import static com.alipay.api.AlipayConstants.CHARSET_UTF8;
35
+
36
+/**
37
+ * @author FXF
38
+ * @date 2019-03-12
39
+ */
40
+@RestController
41
+@RefreshScope
42
+@RequestMapping("/")
43
+@Api(value = "支付宝支付 API", description = "支付宝支付 API")
44
+public class AliPayController {
45
+	
46
+	private Logger log = LoggerFactory.getLogger(AliPayController.class);
47
+	
48
+	@Autowired
49
+	private AliPayServiceI aliPayService;
50
+	
51
+	@Autowired
52
+	private WxPayServiceI wxPayService;
53
+	
54
+	@Value("${alipay.ALIPAY_PUBLIC_KEY}")
55
+	private String ALIPAY_PUBLIC_KEY;
56
+	
57
+	@ApiOperation(value = "统一下单", notes = "统一下单")
58
+	@ApiImplicitParams({
59
+			@ApiImplicitParam(paramType = "path", dataType = "String", name = "outTradeNo", value = "订单号"),
60
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "订单类型:type: 类型(car 车缴费, bill 物业缴费)"),
61
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token") })
62
+	@RequestMapping(value = "/aliPayOrder/{outTradeNo}",method = RequestMethod.GET)
63
+	public ResponseBean wxUnifiedOrder(@PathVariable("outTradeNo") String outTradeNo, @RequestParam("type") String type, HttpSession session){
64
+		ResponseBean responseBean = new ResponseBean();
65
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
66
+		String resp = "";
67
+		try {
68
+			resp = aliPayService.AliPayOrder(outTradeNo, type,userElement);
69
+		} catch (Exception e) {
70
+			e.printStackTrace();
71
+			responseBean.addError(e.getMessage());
72
+			return responseBean;
73
+		}
74
+		responseBean.addSuccess(resp);
75
+		return responseBean;
76
+	}
77
+	
78
+	@ApiOperation(value = "支付宝手机订单支付完成后回调 物业缴费", notes = "支付宝手机订单支付完成后回调")
79
+	@RequestMapping(value = "/aliPayBillNotify",method = RequestMethod.POST)
80
+	public void aliPayBillNotify(HttpServletRequest request, HttpServletResponse response){
81
+		log.info("支付宝手机订单支付完成后回调 物业缴费");
82
+		wxNotify(request, Constant.PAY_TYPE_BILL);
83
+	}
84
+
85
+	@ApiOperation(value = "支付宝手机订单支付完成后回调 车缴费", notes = "支付宝手机订单支付完成后回调 车缴费")
86
+	@RequestMapping(value = "/aliPayCarNotify",method = RequestMethod.POST)
87
+	public void aliPayCarNotify(HttpServletRequest request, HttpServletResponse response){
88
+		log.info("支付宝手机订单支付完成后回调 车缴费");
89
+		wxNotify(request, Constant.PAY_TYPE_CAR);
90
+	}
91
+
92
+	/**
93
+	 * 支付回调
94
+	 * @param request
95
+	 * @param type
96
+	 */
97
+	private void wxNotify(HttpServletRequest request, String type) {
98
+		log.info("支付宝 alipay result  start =======");
99
+		Map<String,String> params = new HashMap<String,String>();
100
+		Map requestParams = request.getParameterMap();
101
+		for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) {
102
+			String name = (String) iter.next();
103
+			String[] values = (String[]) requestParams.get(name);
104
+			String valueStr = "";
105
+			for (int i = 0; i < values.length; i++) {
106
+				valueStr = (i == values.length - 1) ? valueStr + values[i]
107
+						: valueStr + values[i] + ",";
108
+			}
109
+			//乱码解决,这段代码在出现乱码时使用。
110
+			//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
111
+			params.put(name, valueStr);
112
+		}
113
+		//切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。
114
+		try {
115
+			boolean flag = AlipaySignature.rsaCheckV1(params, ALIPAY_PUBLIC_KEY, CHARSET_UTF8,"RSA2");
116
+			if (flag){
117
+				params.put("pay_type","2");
118
+				if (Constant.PAY_TYPE_BILL.equals(type)) {
119
+					wxPayService.wxBillNotify(params);
120
+				} else if (Constant.PAY_TYPE_CAR.equals(type)){
121
+					wxPayService.wxCarNotify(params);
122
+				}
123
+
124
+			}
125
+		} catch (AlipayApiException e) {
126
+			e.printStackTrace();
127
+		} catch (Exception e) {
128
+			e.printStackTrace();
129
+		}
130
+	}
131
+
132
+}

+ 96
- 0
app-api/src/main/java/com/community/huiju/controller/AssembleController.java 查看文件

@@ -0,0 +1,96 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.model.TaSysMenu;
7
+import com.community.huiju.model.ToBanner;
8
+import com.community.huiju.service.AssembleServiceI;
9
+import com.community.huiju.service.BannerServiceI;
10
+import com.community.huiju.service.MenuServiceI;
11
+import com.community.huiju.service.MessageServiceI;
12
+import com.community.huiju.service.TpHotelServicel;
13
+import com.community.huiju.service.TpShopServicel;
14
+import io.swagger.annotations.Api;
15
+import io.swagger.annotations.ApiImplicitParam;
16
+import io.swagger.annotations.ApiImplicitParams;
17
+import io.swagger.annotations.ApiOperation;
18
+import org.springframework.beans.factory.annotation.Autowired;
19
+import org.springframework.cloud.context.config.annotation.RefreshScope;
20
+import org.springframework.web.bind.annotation.PathVariable;
21
+import org.springframework.web.bind.annotation.RequestMapping;
22
+import org.springframework.web.bind.annotation.RequestMethod;
23
+import org.springframework.web.bind.annotation.RestController;
24
+
25
+import javax.servlet.http.HttpSession;
26
+import java.util.HashMap;
27
+import java.util.List;
28
+import java.util.Map;
29
+
30
+/**
31
+ * @author FXF
32
+ * @date 2018-11-05
33
+ */
34
+@RestController
35
+@RefreshScope
36
+@RequestMapping("/")
37
+@Api(value = "首页聚合API", description = "首页聚合API")
38
+public class AssembleController extends BaseController {
39
+	
40
+	@Autowired
41
+	private MenuServiceI menuService;
42
+	
43
+	@Autowired
44
+	private BannerServiceI bannerService;
45
+	
46
+	@Autowired
47
+	private MessageServiceI messageService;
48
+	
49
+	@Autowired
50
+	private TpHotelServicel tpHotelServicel;
51
+	
52
+	@Autowired
53
+	private TpShopServicel tpShopServicel;
54
+	
55
+	@Autowired
56
+	private AssembleServiceI assembleService;
57
+	
58
+	@ApiOperation(value = "首页数据获取接口", notes = "首页数据获取接口")
59
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
60
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token") })
61
+	@RequestMapping(value = "/index/{communityId}",method = RequestMethod.GET)
62
+	public ResponseBean getIndexData(@PathVariable("communityId") Integer communityId, HttpSession session){
63
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
64
+		ResponseBean responseBean = new ResponseBean();
65
+
66
+		if (!check(communityId)) {
67
+			responseBean.addError("小区不存在");
68
+			return responseBean;
69
+		}
70
+
71
+		Map<String,Object> indexMap = new HashMap<>();
72
+		//获取菜单数据
73
+		List<TaSysMenu> menuList = menuService.getMenuList(communityId);
74
+		//获取首页banner数据
75
+		List<ToBanner> toBannerList = bannerService.viewAllBannerImgAndCommunityId(1,communityId);
76
+		//获取消息总数接口
77
+		Map<String,Object> totalMap = messageService.getMessageTotal(communityId, userElement.getUserVerifyId());
78
+		//获取当前小区的酒店信息
79
+		ResponseBean hotelRes = tpHotelServicel.getHotelCommunity(userElement);
80
+		//获取当前小区的商铺信息
81
+		ResponseBean shopRes = tpShopServicel.getShopCommunity(userElement);
82
+		
83
+		//组装数据
84
+		indexMap.put("menuList",menuList);
85
+		indexMap.put("bannerList",toBannerList);
86
+		indexMap.put("messageTotal",totalMap.get("messageTotal"));
87
+		indexMap.put("tpHotel",hotelRes.getData());
88
+		indexMap.put("tpShopType",((Map<Object, Object>)shopRes.getData()).get("tpShopType"));
89
+		indexMap.put("tpShopList",((Map<Object, Object>)shopRes.getData()).get("tpShopList"));
90
+		indexMap.put("toDoTotal",totalMap.get("toDoTotal"));
91
+		responseBean.addSuccess(indexMap);
92
+		//获取成功的情况下记录
93
+		assembleService.saveBriskUser(userElement.getUserVerifyId(),userElement.getCommunityId());
94
+		return responseBean;
95
+	}
96
+}

+ 71
- 0
app-api/src/main/java/com/community/huiju/controller/BannerController.java 查看文件

@@ -0,0 +1,71 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.aliyun.oss.OSSClient;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.huiju.model.ToBanner;
6
+import com.community.huiju.service.BannerServiceI;
7
+import io.swagger.annotations.Api;
8
+import io.swagger.annotations.ApiImplicitParam;
9
+import io.swagger.annotations.ApiImplicitParams;
10
+import io.swagger.annotations.ApiOperation;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.cloud.context.config.annotation.RefreshScope;
13
+import org.springframework.util.CollectionUtils;
14
+import org.springframework.web.bind.annotation.*;
15
+import org.springframework.web.multipart.MultipartFile;
16
+
17
+import java.io.ByteArrayInputStream;
18
+import java.util.Date;
19
+import java.util.List;
20
+
21
+/**
22
+ * @author weichaochao
23
+ * @Title: BannerController
24
+ * @Description: 首页运营banner入口类
25
+ * @date 2018/10/22
26
+ */
27
+@RestController
28
+@RefreshScope
29
+@RequestMapping("/")
30
+@Api(value = "首页运营banner的API", description = "首页运营banner的API")
31
+public class BannerController {
32
+
33
+    @Autowired
34
+    private BannerServiceI bannerService;
35
+
36
+    @ApiOperation(value = "获取首页运营banner接口详情", notes = "获取首页运营banner详情")
37
+    @RequestMapping(value = "/banner/{bannerId}", method = RequestMethod.GET)
38
+    @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "integer", name = "bannerId", value = "运营banner图Id") })
39
+    public ResponseBean selectToBannerImg(@PathVariable("bannerId")Integer bannerId){
40
+        ResponseBean responseBean = new ResponseBean();
41
+        ToBanner toBannerList = bannerService.viewBannerImg(bannerId);
42
+        responseBean.addSuccess(toBannerList);
43
+        return responseBean;
44
+    }
45
+
46
+    @ApiOperation(value = "获取首页运营所有banner接口", notes = "获取首页所有运营banner")
47
+    @ApiImplicitParams({
48
+            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "bannerPosition", value = "banner位: 1首页banner 2服务端"),
49
+    })
50
+    @RequestMapping(value = "/banners", method = RequestMethod.GET)
51
+    public ResponseBean selectAllToBannerImg(@RequestParam("bannerPosition") Integer bannerPosition){
52
+        ResponseBean responseBean = new ResponseBean();
53
+        List<ToBanner> toBannerList = bannerService.viewAllBannerImg(bannerPosition);
54
+        responseBean.addSuccess(toBannerList);
55
+        return responseBean;
56
+    }
57
+
58
+    @ApiOperation(value = "获取广告banner接口", notes = "获取广告运营banner")
59
+    @ApiImplicitParams({
60
+            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "bannerPosition", value = " 3 广告banner"),
61
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "communityId", value = "小区编号")
62
+    })
63
+    @RequestMapping(value = "/banners/advertising", method = RequestMethod.GET)
64
+    public ResponseBean selectAllToBannerImg(@RequestParam("bannerPosition") Integer bannerPosition, @RequestParam(value = "communityId", required = false) Integer communityId){
65
+        ResponseBean responseBean = new ResponseBean();
66
+        List<ToBanner> toBannerList = bannerService.viewAllBannerImgAndCommunityId(bannerPosition, communityId);
67
+        responseBean.addSuccess(toBannerList);
68
+        return responseBean;
69
+    }
70
+
71
+}

+ 77
- 0
app-api/src/main/java/com/community/huiju/controller/BaseController.java 查看文件

@@ -0,0 +1,77 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.session.UserElement;
5
+import com.community.huiju.exception.WisdomException;
6
+import com.community.huiju.model.ToCommunities;
7
+import com.community.huiju.service.CommunityServiceI;
8
+import com.community.huiju.vo.TaUserVO;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.springframework.beans.BeanUtils;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+
13
+import javax.servlet.http.HttpSession;
14
+
15
+/**
16
+ * 公共 controller
17
+ */
18
+@Slf4j
19
+public class BaseController {
20
+
21
+    @Autowired
22
+    private CommunityServiceI community;
23
+
24
+    /**
25
+     * 校验小区是否存在
26
+     * @return
27
+     */
28
+    protected boolean check(Integer communityId){
29
+        ToCommunities toCommunities = community.getByCommunityId(communityId);
30
+        if (null != toCommunities) {
31
+            return true;
32
+        }
33
+        return false;
34
+    }
35
+
36
+    /**
37
+     * 设置用户 session
38
+     * @param userVO
39
+     * @param session
40
+     */
41
+    protected void setUserElement(TaUserVO userVO, HttpSession session) {
42
+        if (null == userVO) {
43
+            throw new WisdomException("用户信息不能为空!");
44
+        }
45
+
46
+        log.info("用户当前sessionId:{}, 设置的用户信息: {}", session.getId(), userVO);
47
+        UserElement userElement = new UserElement();
48
+        BeanUtils.copyProperties(userVO,userElement);
49
+        userElement.setLoginType(Constant.APP_LOGIN_TYPE);
50
+        session.setAttribute(Constant.APP_USER_SESSION,userElement);
51
+        userVO.setToken(session.getId());
52
+    }
53
+
54
+    /**
55
+     * 获取用户 session
56
+     * @param session
57
+     * @return
58
+     */
59
+    protected UserElement getUserElement(HttpSession session) {
60
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
61
+        log.info("用户当前sessionId:{}, 设置的用户信息: {}", session.getId(), userElement);
62
+        if (null == userElement) {
63
+            throw new WisdomException("用户 session 不存在!");
64
+        }
65
+        return userElement;
66
+    }
67
+
68
+    /**
69
+     * 删除 用户 session
70
+     * @param session
71
+     */
72
+    protected void removeUserElement(HttpSession session) {
73
+        log.info("用户当前sessionId:{}", session.getId());
74
+        session.removeAttribute(Constant.APP_USER_SESSION);
75
+    }
76
+
77
+}

+ 99
- 0
app-api/src/main/java/com/community/huiju/controller/BillController.java 查看文件

@@ -0,0 +1,99 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.service.BillServiceI;
7
+import com.sun.org.apache.regexp.internal.RE;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiImplicitParam;
10
+import io.swagger.annotations.ApiImplicitParams;
11
+import io.swagger.annotations.ApiOperation;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.cloud.context.config.annotation.RefreshScope;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestMapping;
16
+import org.springframework.web.bind.annotation.RequestMethod;
17
+import org.springframework.web.bind.annotation.RequestParam;
18
+import org.springframework.web.bind.annotation.RestController;
19
+
20
+import javax.servlet.http.HttpSession;
21
+import java.util.List;
22
+import java.util.Map;
23
+
24
+/**
25
+ * @author FXF
26
+ * @date 2018-10-25
27
+ */
28
+@RestController
29
+@RefreshScope
30
+@RequestMapping("/")
31
+@Api(value = "缴费相关的API", description = "缴费相关的API")
32
+public class BillController extends BaseController {
33
+	
34
+	@Autowired
35
+	private BillServiceI billServiceI;
36
+	
37
+	@ApiOperation(value = "获取本人的收费账单信息(已缴费或未缴费)", notes = "获取本人的收费账单信息(已缴费或未缴费)")
38
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "payType", value = "0是未缴费1是已缴费"),
39
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
40
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
41
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
42
+	})
43
+	@RequestMapping(value = "/bills/current_user/{payType}",method = RequestMethod.GET)
44
+	public ResponseBean getBillInvoice(@PathVariable Integer payType,
45
+									   @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
46
+									   @RequestParam(value ="pageSize",defaultValue = "5") Integer pageSize, HttpSession session){
47
+		UserElement userElement = getUserElement(session);
48
+		ResponseBean responseBean = new ResponseBean();
49
+
50
+		if (!check(userElement.getCommunityId())) {
51
+			responseBean.addError("小区不存在");
52
+			return responseBean;
53
+		}
54
+
55
+		Map<String, Object> map = billServiceI.getBillsList(userElement, payType, pageNum, pageSize);
56
+		responseBean.addSuccess(map);
57
+		return responseBean;
58
+	}
59
+	
60
+	@ApiOperation(value = "获取账单的详细信息", notes = "获取账单的详细信息")
61
+	@ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
62
+						@ApiImplicitParam(paramType = "path", dataType = "Integer", name = "billInvoiceId", value = "账单id")})
63
+	@RequestMapping(value = "/bill/{communityId}/{billInvoiceId}",method = RequestMethod.GET)
64
+	public ResponseBean getBillInvoiceDetail(@PathVariable Integer communityId,@PathVariable Integer billInvoiceId){
65
+		ResponseBean responseBean = new ResponseBean();
66
+
67
+		if (!check(communityId)) {
68
+			responseBean.addError("小区不存在");
69
+			return responseBean;
70
+		}
71
+
72
+		Map<String,Object> billInvoiceMap = billServiceI.getBillInvoiceDetail(communityId,billInvoiceId);
73
+		responseBean.addSuccess(billInvoiceMap);
74
+		return responseBean;
75
+	}
76
+
77
+	@ApiOperation(value = "获取历史缴费", notes = "获取历史缴费")
78
+	@ApiImplicitParams({
79
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
80
+	})
81
+	@RequestMapping(value = "/bill/pay/history", method = RequestMethod.GET)
82
+	public ResponseBean payHistory(HttpSession session) {
83
+		ResponseBean responseBean = new ResponseBean();
84
+		UserElement userElement = getUserElement(session);
85
+		responseBean = billServiceI.payHistory(userElement);
86
+		return responseBean;
87
+	}
88
+
89
+	@ApiOperation(value = "获取订单详情", notes = "获取订单详情")
90
+	@ApiImplicitParams({
91
+			@ApiImplicitParam(paramType = "path", dataTypeClass = String.class, name = "orderNumber", value = "订单号")
92
+	})
93
+	@RequestMapping(value = "/bill/order/info/{orderNumber}", method = RequestMethod.GET)
94
+	public ResponseBean getOrderInfo(HttpSession session, @PathVariable("orderNumber") String orderNumber) {
95
+		ResponseBean responseBean = new ResponseBean();
96
+		responseBean = billServiceI.getOrderInfo(orderNumber);
97
+		return responseBean;
98
+	}
99
+}

+ 65
- 0
app-api/src/main/java/com/community/huiju/controller/CodeController.java 查看文件

@@ -0,0 +1,65 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.utils.AccountValidatorUtil;
6
+import com.community.huiju.common.code.ICode;
7
+import com.community.huiju.common.code.cache.AppkeyCache;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiImplicitParam;
10
+import io.swagger.annotations.ApiImplicitParams;
11
+import io.swagger.annotations.ApiOperation;
12
+import lombok.extern.slf4j.Slf4j;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.beans.factory.annotation.Qualifier;
15
+import org.springframework.cloud.context.config.annotation.RefreshScope;
16
+import org.springframework.web.bind.annotation.RequestMapping;
17
+import org.springframework.web.bind.annotation.RequestMethod;
18
+import org.springframework.web.bind.annotation.RequestParam;
19
+import org.springframework.web.bind.annotation.RestController;
20
+import sun.rmi.runtime.Log;
21
+
22
+import javax.servlet.http.HttpSession;
23
+
24
+/**
25
+ * @author weiximei
26
+ */
27
+@RestController
28
+@RequestMapping("/")
29
+@RefreshScope
30
+@Api(value = "获取验证码的API", description = "获取验证码的API")
31
+@Slf4j
32
+public class CodeController {
33
+
34
+    @Autowired
35
+    @Qualifier("phoneCodeImpl")
36
+    private ICode iCode;
37
+
38
+    @ApiOperation(value = "获取手机验证码", notes = "根据手机号发送验证码")
39
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "query",dataType = "String",name = "phone",value = "手机号")})
40
+    @RequestMapping(value = "/code/sendCode",method = {RequestMethod.POST, RequestMethod.GET})
41
+    public ResponseBean sendCode(@RequestParam String phone, HttpSession session) {
42
+        ResponseBean response = new ResponseBean();
43
+
44
+        log.info("{} 手机号校验结果: {}",phone, AccountValidatorUtil.isPhone(phone));
45
+        if (!AccountValidatorUtil.isPhone(phone)){
46
+            response.addError("请输入正确的手机号!");
47
+            return response;
48
+        }
49
+
50
+        int code = (int) ((Math.random()*9+1)*1000);
51
+        boolean result = iCode.sendCode(phone,String.valueOf(code));
52
+        // boolean result = true;
53
+        if (result) {
54
+            log.info("{} 验证码: {}",phone,code);
55
+            // 设置缓存
56
+            AppkeyCache.setCache(phone,String.valueOf(code));
57
+            //session.setAttribute(Constant.SESSION_PHONE_CODE,String.valueOf(code));
58
+            response.addSuccess("发送成功!"+code);
59
+        } else {
60
+            response.addError("发送失败!");
61
+        }
62
+        return response;
63
+    }
64
+
65
+}

+ 41
- 0
app-api/src/main/java/com/community/huiju/controller/CommunityController.java 查看文件

@@ -0,0 +1,41 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.model.ToCommunities;
5
+import com.community.huiju.service.CommunityServiceI;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.cloud.context.config.annotation.RefreshScope;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.RequestParam;
15
+import org.springframework.web.bind.annotation.RestController;
16
+
17
+import java.util.List;
18
+
19
+/**
20
+ * @author FXF
21
+ * @date 2018-10-22
22
+ */
23
+@RestController
24
+@RefreshScope
25
+@RequestMapping("/")
26
+@Api(value = "小区相关的API",description = "小区相关的API")
27
+public class CommunityController {
28
+	
29
+	@Autowired
30
+	private CommunityServiceI communityService;
31
+	
32
+	@ApiOperation(value = "根据小区名获取小区列表", notes = "根据小区名获取小区列表")
33
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "String", name = "communityName", value = "小区名字") })
34
+	@RequestMapping(value = "/communitys",method = RequestMethod.GET)
35
+	public ResponseBean getCommunitys(@RequestParam(required = false) String communityName){
36
+		ResponseBean responseBean = new ResponseBean();
37
+		List<ToCommunities> communitiesList = communityService.getCommunitys(communityName);
38
+		responseBean.addSuccess(communitiesList);
39
+		return responseBean;
40
+	}
41
+}

+ 117
- 0
app-api/src/main/java/com/community/huiju/controller/FSController.java 查看文件

@@ -0,0 +1,117 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.huiju.service.IFuShiService;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.cloud.context.config.annotation.RefreshScope;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+@RestController
15
+@RefreshScope
16
+@RequestMapping("/")
17
+@Api(value = "车辆操作API", description = "车辆操作API")
18
+public class FSController extends BaseController {
19
+
20
+    @Autowired
21
+    private IFuShiService iFuShiService;
22
+
23
+    @RequestMapping(value = "/car/getParkInfoByCarNo/{carNo}", method = RequestMethod.GET)
24
+    @ApiOperation(value = "获取停车信息(通过车牌号)", notes = "获取停车信息(通过车牌号)")
25
+    @ApiImplicitParams({
26
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "path", name = "carNo", value = "车牌号")
27
+    })
28
+    public ResponseBean getParkInfoByCarNo(@PathVariable("carNo") String carNo) {
29
+        ResponseBean responseBean = new ResponseBean();
30
+        responseBean = iFuShiService.getParkInfoByCarNo(carNo);
31
+        return responseBean;
32
+    }
33
+
34
+    @RequestMapping(value = "/car/parkGetMonthCardInfoByCarNo/{carNo}", method = RequestMethod.GET)
35
+    @ApiOperation(value = "获取月租车信息(通过车牌号)", notes = "获取月租车信息(通过车牌号)")
36
+    @ApiImplicitParams({
37
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "path", name = "carNo", value = "车牌号")
38
+    })
39
+    public ResponseBean parkGetMonthCardInfoByCarNo(@PathVariable("carNo") String carNo) {
40
+        ResponseBean responseBean = new ResponseBean();
41
+        responseBean = iFuShiService.parkGetMonthCardInfoByCarNo(carNo);
42
+        return responseBean;
43
+    }
44
+
45
+    @RequestMapping(value = "/car/parkGetTempCarPaymentInfoByCarNo/{carNo}", method = RequestMethod.GET)
46
+    @ApiOperation(value = "获取临时车信息(通过车牌号)", notes = "获取临时车信息(通过车牌号)")
47
+    @ApiImplicitParams({
48
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "path", name = "carNo", value = "车牌号")
49
+    })
50
+    public ResponseBean parkGetTempCarPaymentInfoByCarNo(@PathVariable("carNo") String carNo) {
51
+        ResponseBean responseBean = new ResponseBean();
52
+        responseBean = iFuShiService.parkGetTempCarPaymentInfoByCarNo(carNo);
53
+        return responseBean;
54
+    }
55
+
56
+    @RequestMapping(value = "/car/apiThirdPartyMonthCardPay", method = RequestMethod.POST)
57
+    @ApiOperation(value = "月卡续费", notes = "月卡续费")
58
+    @ApiImplicitParams({
59
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "body", name = "parameter", value = "Phone手机号;RenewDayType续费日期类型( 3:年 2:月 1:日, 选入对应的数字);" +
60
+                    "RenewDay续费日期数目;" +
61
+                    "PayStyle交易方式(中文描述),例如:微信、 支付宝、 银联;" +
62
+                    "CarNo车牌号;" +
63
+                    "CardNo停车卡号;" +
64
+                    "RechargeAmt充值续费金额;")
65
+    })
66
+    public ResponseBean apiThirdPartyMonthCardPay(@RequestBody String parameter) {
67
+        ResponseBean responseBean = new ResponseBean();
68
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
69
+        responseBean = iFuShiService.apiThirdPartyMonthCardPay(jsonObject.getString("Phone"),
70
+                jsonObject.getString("RenewDayType"),
71
+                jsonObject.getString("RenewDay"),
72
+                jsonObject.getString("PayStyle"),
73
+                jsonObject.getString("CarNo"),
74
+                jsonObject.getString("CardNo"),
75
+                jsonObject.getString("RechargeAmt"));
76
+        return responseBean;
77
+    }
78
+
79
+    @RequestMapping(value = "/car/apiThirdPartyTemporaryCardPay", method = RequestMethod.POST)
80
+    @ApiOperation(value = "第三方临时卡上发缴费", notes = "第三方临时卡上发缴费")
81
+    @ApiImplicitParams({
82
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "body", name = "parameter", value = "Amount应缴金额(单位元);" +
83
+                    "ActualAmount实缴金额(单位元);" +
84
+                    "DeductionAmount抵扣金额(单位元);" +
85
+                    "Reason抵扣原因;" +
86
+                    "PayStyle交易方式(汉字描述),例如:微信、支付宝、银联;" +
87
+                    "CarNo车牌号;" +
88
+                    "CardNo停车卡号;" +
89
+                    "CouponList使用的优惠券列表")
90
+    })
91
+    public ResponseBean apiThirdPartyTemporaryCardPay(@RequestBody String parameter) {
92
+        ResponseBean responseBean = new ResponseBean();
93
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
94
+        responseBean = iFuShiService.apiThirdPartyTemporaryCardPay(jsonObject.getString("Amount"),
95
+                jsonObject.getString("ActualAmount"),
96
+                jsonObject.getString("DeductionAmount"),
97
+                jsonObject.getString("Reason"),
98
+                jsonObject.getString("PayStyle"),
99
+                jsonObject.getString("CarNo"),
100
+                jsonObject.getString("CardNo"),
101
+                jsonObject.getString("CouponList"));
102
+        return responseBean;
103
+    }
104
+
105
+
106
+    @RequestMapping(value = "/car/apiGetOfflineFee/{carNoOrCardNo}", method = RequestMethod.GET)
107
+    @ApiOperation(value = "获取线下算费结果", notes = "获取线下算费结果")
108
+    @ApiImplicitParams({
109
+        @ApiImplicitParam(paramType = "path", dataTypeClass = String.class, name = "carNoOrCardNo" , value = "车牌号码或卡号")
110
+    })
111
+    public ResponseBean apiGetOfflineFee(@PathVariable("carNoOrCardNo") String carNoOrCardNo) {
112
+        ResponseBean responseBean = new ResponseBean();
113
+        responseBean = iFuShiService.apiGetOfflineFee(carNoOrCardNo);
114
+        return responseBean;
115
+    }
116
+
117
+}

+ 83
- 0
app-api/src/main/java/com/community/huiju/controller/FaceController.java 查看文件

@@ -0,0 +1,83 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.service.FaceServiceI;
7
+import io.swagger.annotations.*;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.cloud.context.config.annotation.RefreshScope;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RequestMethod;
12
+import org.springframework.web.bind.annotation.RequestParam;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import org.springframework.web.multipart.MultipartFile;
15
+
16
+import javax.servlet.http.HttpSession;
17
+
18
+@RestController
19
+@RefreshScope
20
+@RequestMapping("/")
21
+@Api(value = "人脸相关API", description = "人脸相关API")
22
+public class FaceController extends BaseController {
23
+    @Autowired
24
+    private FaceServiceI faceServicel;
25
+
26
+    @ApiOperation(value = "添加人脸图片", notes = "添加人脸图片")
27
+    @ApiImplicitParams({
28
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
29
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "otherUserId",value = "家属或租户ID,不填为本人")
30
+    })
31
+
32
+    @RequestMapping(value = "/addFace",method = RequestMethod.POST)
33
+    public Object getTaFace(HttpSession session,
34
+                            @ApiParam(value = "file" ,required = true) MultipartFile uploadFile,
35
+                            @RequestParam(required = false) Integer otherUserId){
36
+        ResponseBean responseBean = new ResponseBean();
37
+        UserElement userElement = getUserElement(session);
38
+        responseBean = faceServicel.addFace(userElement ,uploadFile,otherUserId);
39
+        return responseBean;
40
+    }
41
+
42
+    @ApiOperation(value = "修改人脸图片", notes = "修改人脸图片")
43
+    @ApiImplicitParams({
44
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
45
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "otherUserId",value = "家属或租户ID,不填为本人"),
46
+    })
47
+    @RequestMapping(value = "/upDateFace",method = RequestMethod.POST)
48
+    public Object upDateTaFace(HttpSession session,
49
+                               @ApiParam(value = "file" ,required = true) MultipartFile uploadFile,
50
+                               @RequestParam(required = false) Integer otherUserId
51
+                               ){
52
+        ResponseBean responseBean = new ResponseBean();
53
+        UserElement userElement = getUserElement(session);
54
+         responseBean = faceServicel.upDateFace(userElement,uploadFile,otherUserId);
55
+        return responseBean;
56
+    }
57
+
58
+    @ApiOperation(value = "获取当前已录入人脸信息", notes = "获取当前已录入人脸信息")
59
+    @ApiImplicitParams({
60
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
61
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "otherUserId",value = "家属或租户ID,不填为本人"),
62
+    })
63
+    @RequestMapping(value = "/getUserIdFace",method = RequestMethod.GET)
64
+    public Object getTaFaceByUserId(HttpSession session, @RequestParam(required = false) Integer otherUserId){
65
+        UserElement userElement = getUserElement(session);
66
+        ResponseBean responseBean = faceServicel.getTaFaceByUserId(userElement,otherUserId);
67
+        return responseBean;
68
+    }
69
+    @ApiOperation(value = "删除当前人脸信息", notes = "删除当前人脸信息")
70
+    @ApiImplicitParams({
71
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
72
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "otherUserId",value = "家属或租户ID,不填为本人"),
73
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "verifyId",value = "审核ID"),
74
+    })
75
+    @RequestMapping(value = "/deleteFace",method = RequestMethod.GET)
76
+    public Object deleteFace(HttpSession session, @RequestParam(required = false) Integer otherUserId,
77
+                            @RequestParam(required = false) Integer verifyId){
78
+        UserElement userElement = getUserElement(session);
79
+        ResponseBean responseBean = faceServicel.deleteFace(userElement,otherUserId,verifyId);
80
+        return responseBean;
81
+    }
82
+
83
+}

+ 125
- 0
app-api/src/main/java/com/community/huiju/controller/HkController.java 查看文件

@@ -0,0 +1,125 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.HkResponseBean;
5
+import com.community.commom.mode.ResponseBean;
6
+import com.community.commom.session.UserElement;
7
+import com.community.huiju.model.HkVisitorBill;
8
+import com.community.huiju.service.FaceServiceI;
9
+import com.community.huiju.service.IEquipmentService;
10
+import com.community.huiju.service.IHKService;
11
+import com.community.huiju.service.ISenCartId;
12
+import io.swagger.annotations.*;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.cloud.context.config.annotation.RefreshScope;
15
+import org.springframework.web.bind.annotation.*;
16
+import org.springframework.web.multipart.MultipartFile;
17
+
18
+import javax.servlet.http.HttpServletRequest;
19
+import javax.servlet.http.HttpSession;
20
+
21
+/**
22
+ * @author FXF
23
+ * @date 2019-01-23
24
+ */
25
+@RestController
26
+@RefreshScope
27
+@RequestMapping("/")
28
+@Api(value = "海康相关的API",description = "海康相关的API")
29
+public class HkController extends BaseController {
30
+
31
+	@Autowired
32
+	private IHKService ihkService;
33
+
34
+	@Autowired
35
+	private ISenCartId iSenCartId;
36
+
37
+	@Autowired
38
+	private FaceServiceI faceServiceI;
39
+
40
+	@Autowired
41
+	private IEquipmentService iEquipmentService;
42
+
43
+
44
+
45
+	@ApiOperation(value = "发送访客账单", notes = "发送访客账单")
46
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "body", name = "hkVisitorBill", dataType = "String",value = "billNum: 账单号,reservationNum:预约单号,plateNum:出场车牌号,leaveTime:出场时间,billFee:账单金额")})
47
+	@RequestMapping(value = "/sendVisitorBill",method = RequestMethod.POST)
48
+	public HkResponseBean allMessageRead(@RequestBody HkVisitorBill hkVisitorBill){
49
+		HkResponseBean hkResponseBean = new HkResponseBean();
50
+		System.out.println("测试:"+hkVisitorBill.getBillFee());
51
+		System.out.println("测试:"+hkVisitorBill.getBillNum());
52
+		System.out.println("测试:"+hkVisitorBill.getPlateNum());
53
+		System.out.println("测试:"+hkVisitorBill.getReservationNum());
54
+		System.out.println("测试:"+hkVisitorBill.getLeaveTime());
55
+		hkResponseBean.addSuccess("账单发送成功","");
56
+		return hkResponseBean;
57
+	}
58
+
59
+	@ApiOperation("推送海康人员")
60
+	@RequestMapping(value = "/pushHKPerson/{appUserId}", method = RequestMethod.POST)
61
+	public ResponseBean pushHKPerson(@PathVariable("appUserId") String appUserId, @RequestParam("userVerifyId") Integer userVerifyId) {
62
+		ResponseBean responseBean = new ResponseBean();
63
+		responseBean = ihkService.pushPerson(appUserId, userVerifyId);
64
+		return responseBean;
65
+	}
66
+
67
+	@Deprecated
68
+	@RequestMapping(value = "/downloadAuthorityByDeviceUuids", method = RequestMethod.POST)
69
+	public ResponseBean pushHKPerson() {
70
+		ResponseBean responseBean = new ResponseBean();
71
+		responseBean = ihkService.downloadAuthorityByDeviceUuids();
72
+		return responseBean;
73
+	}
74
+
75
+	@ApiOperation(value = "门口机(可视对讲)/考勤机 开门", notes = "门口机(可是对讲)/考勤机 开门")
76
+	@ApiImplicitParams({
77
+			@ApiImplicitParam(dataTypeClass = Integer.class, paramType = "header", name = "X-Auth-Token", value = "Token"),
78
+			@ApiImplicitParam(dataTypeClass = Integer.class, paramType = "path", name = "id", value = "设备id"),
79
+	})
80
+	@RequestMapping(value = "/visual/syncControl/{id}", method = RequestMethod.POST)
81
+	public ResponseBean syncControl(HttpServletRequest request, HttpSession session, @PathVariable("id") Integer equipmentId){
82
+		ResponseBean responseBean = new ResponseBean();
83
+		UserElement userElement = getUserElement(session);
84
+		responseBean = ihkService.syncControl(userElement, equipmentId);
85
+		return responseBean;
86
+	}
87
+
88
+	@ApiOperation(value = "添加人员并卡卡")
89
+	@RequestMapping(value = "/addUserAndOpenCart", method = RequestMethod.POST)
90
+	public ResponseBean addUser(@RequestParam("communityId") Integer communityId) {
91
+		ResponseBean responseBean = new ResponseBean();
92
+		responseBean = iSenCartId.addUserAndAddCartId(communityId);
93
+		return responseBean;
94
+	}
95
+
96
+	@RequestMapping(value = "/addUserOne", method = RequestMethod.POST)
97
+	@ApiOperation(value = "根据人员为主下发,测试用的")
98
+	public ResponseBean addUserOne(@ApiParam(value = "file" ,required = true) MultipartFile uploadFile,
99
+								   @RequestParam(required = false) Integer communityId) {
100
+
101
+		ResponseBean responseBean = new ResponseBean();
102
+		responseBean = iSenCartId.addUserOne(communityId, uploadFile);
103
+		return responseBean;
104
+
105
+	}
106
+
107
+	@RequestMapping(value = "/updateFaceInVerify/{userVerifyId}", method = RequestMethod.POST)
108
+	@ApiOperation(value = "审核用户后, 下发人脸")
109
+	public ResponseBean addUserOne(@PathVariable("userVerifyId") Integer userVerifyId) {
110
+
111
+		ResponseBean responseBean = new ResponseBean();
112
+		responseBean = faceServiceI.updateFaceInVerify(userVerifyId);
113
+		return responseBean;
114
+	}
115
+
116
+	@RequestMapping(value = "/deletePerson/{userVerifyId}", method = RequestMethod.POST)
117
+	@ApiOperation(value = "删除海康人员")
118
+	public ResponseBean deletePerson(@PathVariable("userVerifyId") Integer userVerifyId) {
119
+
120
+		ResponseBean responseBean = new ResponseBean();
121
+		responseBean = ihkService.deletePerson(userVerifyId);
122
+		return responseBean;
123
+	}
124
+
125
+}

+ 80
- 0
app-api/src/main/java/com/community/huiju/controller/IBuildingOwnerInfoController.java 查看文件

@@ -0,0 +1,80 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.session.UserElement;
5
+import com.community.huiju.service.IBuildingOwnerInfo;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.apache.ibatis.annotations.Param;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.cloud.context.config.annotation.RefreshScope;
13
+import org.springframework.web.bind.annotation.*;
14
+
15
+import javax.servlet.http.HttpSession;
16
+
17
+/**
18
+ * version V1.0
19
+ * class_name: $METHOD_NAME$
20
+ * param: $METHOD_PARAM$
21
+ * describe: TODO
22
+ * creat_user:fannaixi
23
+ * creat_time: 2019/3/28
24
+ **/
25
+@RestController
26
+@RefreshScope
27
+@RequestMapping("/")
28
+@Api(value = "楼栋资料库API",description = "楼栋资料库API")
29
+public class IBuildingOwnerInfoController extends BaseController {
30
+
31
+    @Autowired
32
+    private IBuildingOwnerInfo iBuildingOwnerInfo;
33
+
34
+    @RequestMapping(value = "/building/select/address", method = RequestMethod.GET)
35
+    @ApiOperation(value = "根据 小区/期/楼栋/单元/楼层/户号 (申请注册绑定)", notes = "根据 小区/期/楼栋/单元/楼层/户号")
36
+    @ApiImplicitParams({
37
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "communityId", value = "小区"),
38
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "phaseId", value = "期"),
39
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "buildingId", value = "楼栋"),
40
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "unitId", value = "单元"),
41
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "levelId", value = "楼层")
42
+    })
43
+    public ResponseBean selectByAddress(@RequestParam("communityId") Integer communityId,
44
+                                        @RequestParam(value = "phaseId", required = false) Integer phaseId,
45
+                                        @RequestParam(value = "buildingId",required = false) Integer buildingId,
46
+                                        @RequestParam(value = "unitId", required = false) Integer unitId,
47
+                                        @RequestParam(value = "levelId", required = false) Integer levelId) {
48
+
49
+        ResponseBean responseBean = new ResponseBean();
50
+        responseBean = iBuildingOwnerInfo.selectBuildList(communityId, phaseId, buildingId, unitId, levelId);
51
+        return responseBean;
52
+
53
+    }
54
+
55
+    @RequestMapping(value = "/building/has", method = RequestMethod.GET)
56
+    @ApiOperation(value = "根据 小区、期、楼栋、单元、楼层、户号 (并校验这个用户,是否绑定了这个房产)", notes = "根据 小区、期、楼栋、单元、楼层、户号")
57
+    @ApiImplicitParams({
58
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "communityId", value = "小区"),
59
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "phaseId", value = "期"),
60
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "buildingId", value = "楼栋"),
61
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "unitId", value = "单元"),
62
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "levelId", value = "楼层"),
63
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "roomNoId", value = "户号"),
64
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
65
+    })
66
+    public ResponseBean hasBuilding(@RequestParam(value = "communityId", required = false) Integer communityId,
67
+                                    @RequestParam(value = "phaseId", required = false) Integer phaseId,
68
+                                   @RequestParam(value = "buildingId",required = false) Integer buildingId,
69
+                                   @RequestParam(value = "unitId", required = false) Integer unitId,
70
+                                   @RequestParam(value = "levelId", required = false) Integer levelId,
71
+                                   @RequestParam(value = "roomNoId", required = false) Integer roomNoId,
72
+                                   HttpSession session){
73
+
74
+        ResponseBean responseBean = new ResponseBean();
75
+        UserElement userElement = getUserElement(session);
76
+        responseBean = iBuildingOwnerInfo.hasBuild(userElement, communityId ,phaseId, buildingId, unitId, levelId, roomNoId);
77
+        return responseBean;
78
+    }
79
+
80
+}

+ 47
- 0
app-api/src/main/java/com/community/huiju/controller/ImageController.java 查看文件

@@ -0,0 +1,47 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.service.ImageServiceI;
5
+import com.google.common.collect.Maps;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiOperation;
8
+import io.swagger.annotations.ApiParam;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.cloud.context.config.annotation.RefreshScope;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import org.springframework.web.multipart.MultipartFile;
15
+
16
+import java.util.ArrayList;
17
+import java.util.List;
18
+import java.util.Map;
19
+
20
+/**
21
+ * @author weichaochao
22
+ * @Title: ImageController
23
+ * @Description: 图片上传以及获取url
24
+ * @date 2018/10/31
25
+ */
26
+@RestController
27
+@RefreshScope
28
+@RequestMapping("/")
29
+@Api(value = "图片操作API", description = "图片操作API")
30
+public class ImageController {
31
+
32
+    @Autowired
33
+    private ImageServiceI imageService;
34
+
35
+    @ApiOperation(value = "图片上传以及获取url", notes = "图片上传以及获取url")
36
+    @PostMapping(value = "/uploadimage", consumes = "multipart/*", headers = "content-type=multipart/form-data")
37
+    public ResponseBean uploadImgAndGetUrl(@ApiParam(value = "uploadFiles" ,required = true) MultipartFile[] uploadFiles) throws Exception {
38
+        ResponseBean responseBean = new ResponseBean();
39
+        List<String> urls = new ArrayList<String>();
40
+        for (MultipartFile uploadFile : uploadFiles){
41
+            String url = imageService.getImageUrl(uploadFile);
42
+            urls.add(url);
43
+        }
44
+        responseBean.addSuccess(urls);
45
+        return responseBean;
46
+    }
47
+}

+ 38
- 0
app-api/src/main/java/com/community/huiju/controller/LoginCodeController.java 查看文件

@@ -0,0 +1,38 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.common.perproties.LoginCodePerproties;
5
+import com.google.common.collect.Maps;
6
+import io.swagger.annotations.Api;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.cloud.context.config.annotation.RefreshScope;
9
+import org.springframework.web.bind.annotation.RequestMapping;
10
+import org.springframework.web.bind.annotation.RequestMethod;
11
+import org.springframework.web.bind.annotation.RequestParam;
12
+import org.springframework.web.bind.annotation.RestController;
13
+
14
+import java.util.Map;
15
+
16
+/**
17
+ * @author weiximei
18
+ */
19
+@RestController
20
+@RefreshScope
21
+@RequestMapping("/")
22
+@Api(value = "根据code获取url API", description = "根据code获取url API")
23
+public class LoginCodeController {
24
+
25
+    @Autowired
26
+    private LoginCodePerproties loginCodePerproties;
27
+
28
+    @RequestMapping(value = "/url", method = RequestMethod.GET)
29
+    public ResponseBean getUrl(@RequestParam String code) {
30
+        ResponseBean responseBean = new ResponseBean();
31
+        String url = loginCodePerproties.getLoginCode().get(code);
32
+        Map<String, String> map = Maps.newHashMap();
33
+        map.put("url", url);
34
+        responseBean.addSuccess(map);
35
+        return responseBean;
36
+    }
37
+
38
+}

+ 51
- 0
app-api/src/main/java/com/community/huiju/controller/MenuController.java 查看文件

@@ -0,0 +1,51 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.model.TaSysMenu;
7
+import com.community.huiju.service.MenuServiceI;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiImplicitParam;
10
+import io.swagger.annotations.ApiImplicitParams;
11
+import io.swagger.annotations.ApiOperation;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.cloud.context.config.annotation.RefreshScope;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestMapping;
16
+import org.springframework.web.bind.annotation.RequestMethod;
17
+import org.springframework.web.bind.annotation.RestController;
18
+
19
+import javax.servlet.http.HttpSession;
20
+import java.util.List;
21
+import java.util.Map;
22
+
23
+/**
24
+ * @author FXF
25
+ * @date 2018-11-05
26
+ */
27
+@RestController
28
+@RefreshScope
29
+@RequestMapping("/")
30
+@Api(value = "菜单API", description = "菜单API")
31
+public class MenuController extends BaseController {
32
+	
33
+	@Autowired
34
+	private MenuServiceI menuService;
35
+	
36
+	@ApiOperation(value = "按小区获取菜单列表", notes = "按小区获取菜单列表")
37
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id")})
38
+	@RequestMapping(value = "/menus/{communityId}",method = RequestMethod.GET)
39
+	public ResponseBean getMenuList(@PathVariable Integer communityId, HttpSession session){
40
+		ResponseBean responseBean = new ResponseBean();
41
+
42
+		if (!check(communityId)) {
43
+			responseBean.addError("小区不存在");
44
+			return responseBean;
45
+		}
46
+
47
+		List<TaSysMenu> list = menuService.getMenuList(communityId);
48
+		responseBean.addSuccess(list);
49
+		return responseBean;
50
+	}
51
+}

+ 142
- 0
app-api/src/main/java/com/community/huiju/controller/MessageController.java 查看文件

@@ -0,0 +1,142 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.service.MessageServiceI;
7
+import io.swagger.annotations.Api;
8
+import io.swagger.annotations.ApiImplicitParam;
9
+import io.swagger.annotations.ApiImplicitParams;
10
+import io.swagger.annotations.ApiOperation;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.cloud.context.config.annotation.RefreshScope;
13
+import org.springframework.web.bind.annotation.*;
14
+
15
+import javax.servlet.http.HttpSession;
16
+import java.util.Map;
17
+
18
+/**
19
+ * @author FXF
20
+ * @date 2018-10-22
21
+ */
22
+@RestController
23
+@RefreshScope
24
+@RequestMapping("/")
25
+@Api(value = "消息相关的API",description = "消息相关的API")
26
+public class MessageController extends BaseController {
27
+	
28
+	@Autowired
29
+	private MessageServiceI messageService;
30
+	
31
+	@ApiOperation(value = "按小区获取消息总数", notes = "按小区获取个人消息总数")
32
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
33
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token") })
34
+	@RequestMapping(value = "/message/{communityId}/total",method = RequestMethod.GET)
35
+	public ResponseBean getMessageTotal(@PathVariable Integer communityId, HttpSession session){
36
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
37
+		ResponseBean responseBean = new ResponseBean();
38
+
39
+		if (!check(communityId)) {
40
+			responseBean.addError("小区不存在");
41
+			return responseBean;
42
+		}
43
+
44
+		Map<String,Object> totalMap = messageService.getMessageTotal(communityId, userElement.getUserVerifyId());
45
+		responseBean.addSuccess(totalMap);
46
+		return responseBean;
47
+	}
48
+	
49
+	@ApiOperation(value = "按小区获取分页消息", notes = "按小区获取分页消息")
50
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
51
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
52
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
53
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
54
+	@RequestMapping(value = "/message/{communityId}/news",method = RequestMethod.GET)
55
+	public ResponseBean getNews(@PathVariable Integer communityId,
56
+	                            @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
57
+	                            @RequestParam(value ="pageSize",defaultValue = "5") Integer pageSize, HttpSession session){
58
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
59
+		ResponseBean responseBean = new ResponseBean();
60
+		if (!check(communityId)) {
61
+			responseBean.addError("小区不存在");
62
+			return responseBean;
63
+		}
64
+		Map<String,Object> map = messageService.getMessages(communityId,pageNum,pageSize, Constant.MODEL_TYPE_NEWS, userElement.getUserVerifyId());
65
+		responseBean.addSuccess(map);
66
+		return responseBean;
67
+	}
68
+	
69
+	@ApiOperation(value = "按小区获取分页待办", notes = "按小区获取分页待办")
70
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
71
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
72
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
73
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
74
+	@RequestMapping(value = "/message/{communityId}/upcoming",method = RequestMethod.GET)
75
+	public ResponseBean getUpcoming(@PathVariable Integer communityId,
76
+	                                @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
77
+	                                @RequestParam(value ="pageSize",defaultValue = "5") Integer pageSize, HttpSession session){
78
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
79
+		Integer userId = userElement.getId();
80
+		ResponseBean responseBean = new ResponseBean();
81
+		
82
+		if (!check(communityId)) {
83
+			responseBean.addError("小区不存在");
84
+			return responseBean;
85
+		}
86
+		Map<String,Object> map = messageService.getMessages(communityId,pageNum,pageSize,Constant.MODEL_TYPE_UPCOMING, userId);
87
+		responseBean.addSuccess(map);
88
+		return responseBean;
89
+	}
90
+
91
+	@ApiOperation(value = "消息已读接口", notes = "消息已读接口")
92
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
93
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
94
+	@RequestMapping(value = "/readStatus/{communityId}",method = RequestMethod.POST)
95
+	public ResponseBean allMessageRead(@PathVariable("communityId") Integer communityId, HttpSession session){
96
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
97
+		Integer userId = userElement.getUserVerifyId();
98
+		ResponseBean responseBean = new ResponseBean();
99
+
100
+		if (!check(communityId)) {
101
+			responseBean.addError("小区不存在");
102
+			return responseBean;
103
+		}
104
+
105
+		messageService.updateMessageReadStatus(communityId, userId);
106
+		return responseBean;
107
+	}
108
+
109
+
110
+	@ApiOperation(value = "根据消息id进行已读", notes = "根据消息id进行已读")
111
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "messageId", value = "消息id"),
112
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
113
+	@RequestMapping(value = "/messageIdreadStatus/{messageId}",method = RequestMethod.PUT)
114
+	public ResponseBean updateMessageByIdReadStatus(HttpSession session, @PathVariable("messageId") Integer messageId) {
115
+		ResponseBean responseBean = new ResponseBean();
116
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
117
+		responseBean = messageService.updateMessageByIdReadStatus(userElement, messageId);
118
+		return responseBean;
119
+	}
120
+	
121
+	@ApiOperation(value = "根据消息id获取详细数据", notes = "根据消息id获取详细数据")
122
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "messageId", value = "消息id"),
123
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
124
+	@RequestMapping(value = "/message/get/{messageId}",method = RequestMethod.GET)
125
+	public ResponseBean getMessageById(HttpSession session, @PathVariable("messageId") Integer messageId) {
126
+		ResponseBean responseBean = new ResponseBean();
127
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
128
+		responseBean = messageService.getMessageById(userElement.getCommunityId(), messageId);
129
+		return responseBean;
130
+	}
131
+
132
+	@ApiOperation(value = "app已读接口", notes = "app已读接口")
133
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "messageId", value = "消息id"),
134
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
135
+	@RequestMapping(value = "/message/{messageId}",method = RequestMethod.GET)
136
+	public ResponseBean messageReadStatus(HttpSession session, @PathVariable("messageId") Integer messageId) {
137
+		ResponseBean responseBean = new ResponseBean();
138
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
139
+		responseBean = messageService.messageReadStatus(userElement,messageId);
140
+		return responseBean;
141
+	}
142
+}

+ 105
- 0
app-api/src/main/java/com/community/huiju/controller/MonitoringController.java 查看文件

@@ -0,0 +1,105 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.session.UserElement;
5
+import com.community.huiju.service.IMonitoringService;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.cloud.context.config.annotation.RefreshScope;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import javax.servlet.http.HttpSession;
15
+
16
+/**
17
+ * 监控 控制器
18
+ * @author weiximei
19
+ */
20
+@RestController
21
+@RefreshScope
22
+@RequestMapping("/")
23
+@Api(value = "监控 控制器", description = "监控相关的数据")
24
+public class MonitoringController extends BaseController {
25
+
26
+    @Autowired
27
+    private IMonitoringService iMonitoringService;
28
+
29
+    @ApiOperation(value = "获取监控列表数据",notes = "根据小区ID获取")
30
+    @ApiImplicitParams({
31
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId",value = "小区ID"),
32
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNo",value = "第几页"),
33
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少行"),
34
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
35
+    })
36
+    @RequestMapping(value = "/monitoring/{communityId}",method = RequestMethod.GET)
37
+    public ResponseBean getList(@PathVariable("communityId") Integer communityId,
38
+                                @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
39
+                                @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
40
+                                HttpSession session){
41
+        ResponseBean response = new ResponseBean();
42
+        if (!check(communityId)) {
43
+            response.addError("小区不存在");
44
+            return response;
45
+        }
46
+
47
+        UserElement userElement = getUserElement(session);
48
+        response = iMonitoringService.getByCommunityId(userElement,communityId,pageNo,pageSize);
49
+        return response;
50
+    }
51
+
52
+
53
+    @ApiOperation(value = "获取监控列表token",notes = "根据小区ID获取")
54
+    @ApiImplicitParams({
55
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId",value = "小区ID"),
56
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNo",value = "第几页"),
57
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少行")
58
+    })
59
+    @RequestMapping(value = "/monitoring/token/{communityId}",method = RequestMethod.GET)
60
+    public ResponseBean getMonitoringToken(@PathVariable("communityId") Integer communityId,
61
+                                @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
62
+                                @RequestParam(value = "pageSize",defaultValue = "100") Integer pageSize){
63
+        ResponseBean response = new ResponseBean();
64
+        if (!check(communityId)) {
65
+            response.addError("小区不存在");
66
+            return response;
67
+        }
68
+
69
+        response = iMonitoringService.getMonitoringToken(communityId,pageNo,pageSize);
70
+        return response;
71
+    }
72
+
73
+    @ApiOperation(value = "获取监控列表数据 HLS",notes = "根据小区ID获取")
74
+    @ApiImplicitParams({
75
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId",value = "小区ID"),
76
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNo",value = "第几页"),
77
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少行"),
78
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
79
+    })
80
+    @RequestMapping(value = "/monitoring/hls/{communityId}",method = RequestMethod.GET)
81
+    public ResponseBean getListHLS(@PathVariable("communityId") Integer communityId,
82
+                                   @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
83
+                                   @RequestParam(value = "pageSize",defaultValue = "100") Integer pageSize,
84
+                                   HttpSession session) {
85
+
86
+        ResponseBean responseBean = new ResponseBean();
87
+        UserElement userElement = getUserElement(session);
88
+        responseBean = iMonitoringService.getHlsByCommunityId(userElement,communityId, pageNo, 100);
89
+        return responseBean;
90
+    }
91
+
92
+
93
+    @ApiOperation(value = "获取门口机视频地址",notes = "获取门口机视频地址")
94
+    @ApiImplicitParams({
95
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
96
+    })
97
+    @RequestMapping(value = "/monitoring/intercom",method = RequestMethod.GET)
98
+    public ResponseBean getIntercomHLS(HttpSession session) {
99
+        ResponseBean responseBean = new ResponseBean();
100
+        UserElement userElement = getUserElement(session);
101
+        responseBean = iMonitoringService.getIntercomHLS(userElement);
102
+        return responseBean;
103
+    }
104
+
105
+}

+ 515
- 0
app-api/src/main/java/com/community/huiju/controller/SocialController.java 查看文件

@@ -0,0 +1,515 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.constant.Constant;
5
+import com.community.commom.mode.ResponseBean;
6
+import com.community.commom.session.UserElement;
7
+import com.community.huiju.model.TpActivity;
8
+import com.community.huiju.model.TpAnnouncement;
9
+import com.community.huiju.model.TpTicket;
10
+import com.community.huiju.model.TpTransaction;
11
+import com.community.huiju.service.SocialServiceI;
12
+import io.swagger.annotations.*;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.cloud.context.config.annotation.RefreshScope;
15
+import org.springframework.web.bind.annotation.*;
16
+import org.springframework.web.multipart.MultipartFile;
17
+
18
+import javax.servlet.http.HttpSession;
19
+import java.io.IOException;
20
+import java.util.List;
21
+import java.util.Map;
22
+
23
+/**
24
+ * @author weichaochao
25
+ * @Title: SocialController
26
+ * @date 2018/10/23
27
+ */
28
+@RestController
29
+@RefreshScope
30
+@RequestMapping("/")
31
+@Api(value = "app端论坛相关的API", description = "app端论坛相关的API")
32
+public class SocialController extends BaseController {
33
+
34
+    @Autowired
35
+    private SocialServiceI socialServiceI;
36
+
37
+    @RequestMapping(value = "/announcement/{communityId}", method = RequestMethod.GET)
38
+    @ApiOperation(value = "论坛公告帖子详情", notes = "获取论坛公告帖子详情")
39
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
40
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "id", value = "公告帖子id"),
41
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
42
+    public ResponseBean findAnnouncementDetail(@PathVariable(value = "communityId") Integer communityId, @RequestParam("id") Integer id, HttpSession session) {
43
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
44
+        Integer userId = userElement.getId();
45
+        ResponseBean responseBean = new ResponseBean();
46
+
47
+        if (!check(communityId)) {
48
+            responseBean.addError("小区不存在");
49
+            return responseBean;
50
+        }
51
+
52
+        TpAnnouncement tpAnnouncement = socialServiceI.findAnnouncementDetail(id, communityId, userId);
53
+        responseBean.addSuccess(tpAnnouncement);
54
+        return responseBean;
55
+    }
56
+
57
+    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.POST)
58
+    @ApiOperation(value = "活动报名接口", notes = "活动报名接口")
59
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
60
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
61
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "remark", value = "活动备注"),
62
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
63
+    public ResponseBean SignActivity(@PathVariable(value = "communityId") Integer communityId,
64
+                                     @RequestParam(value = "remark", required = false) String remark,
65
+                                     @RequestParam("activityId") Integer activityId,
66
+                                     HttpSession session) {
67
+        UserElement userElement = getUserElement(session);
68
+        ResponseBean responseBean = new ResponseBean();
69
+
70
+        if (!check(communityId)) {
71
+            responseBean.addError("小区不存在");
72
+            return responseBean;
73
+        }
74
+
75
+        responseBean = socialServiceI.findTaUserInfo(userElement, activityId, communityId ,remark);
76
+        return responseBean;
77
+    }
78
+    
79
+    @RequestMapping(value = "/sign/cancel/{communityId}", method = RequestMethod.POST)
80
+    @ApiOperation(value = "取消活动报名接口", notes = "取消活动报名接口")
81
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
82
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
83
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
84
+    public ResponseBean cancelSignActivity(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
85
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
86
+        Integer userId = userElement.getUserVerifyId();
87
+        
88
+        ResponseBean responseBean = new ResponseBean();
89
+        
90
+        if (!check(communityId)) {
91
+            responseBean.addError("小区不存在");
92
+            return responseBean;
93
+        }
94
+        //取消报名
95
+        responseBean = socialServiceI.cancelSignActivity(activityId, communityId, userId);
96
+        return responseBean;
97
+    }
98
+
99
+
100
+    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.PUT)
101
+    @ApiOperation(value = "修改活动报名接口", notes = "修改活动报名接口")
102
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
103
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
104
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "remark", value = "活动备注"),
105
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
106
+    public ResponseBean updateSignActivity(@PathVariable(value = "communityId") Integer communityId,
107
+                                     @RequestParam(value = "remark", required = false) String remark,
108
+                                     @RequestParam("activityId") Integer activityId,
109
+                                     HttpSession session) {
110
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
111
+        Integer userId = userElement.getUserVerifyId();
112
+
113
+        ResponseBean responseBean = new ResponseBean();
114
+        if (!check(communityId)) {
115
+            responseBean.addError("小区不存在");
116
+            return responseBean;
117
+        }
118
+
119
+        responseBean = socialServiceI.updateActivtiySignUp(activityId, communityId, userId,remark);
120
+        return responseBean;
121
+    }
122
+
123
+    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.GET)
124
+    @ApiOperation(value = "查看 活动报名情况", notes = "查看 活动报名情")
125
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
126
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
127
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
128
+    public ResponseBean getSignActivityUp(@PathVariable(value = "communityId") Integer communityId,
129
+                                           @RequestParam("activityId") Integer activityId,
130
+                                           HttpSession session) {
131
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
132
+        Integer userId = userElement.getUserVerifyId();
133
+
134
+        ResponseBean responseBean = new ResponseBean();
135
+        if (!check(communityId)) {
136
+            responseBean.addError("小区不存在");
137
+            return responseBean;
138
+        }
139
+
140
+        responseBean = socialServiceI.getActivtiySignUp(activityId, communityId, userId);
141
+        return responseBean;
142
+    }
143
+
144
+
145
+
146
+
147
+
148
+    @ApiOperation(value = "按小区获取分页公告列表", notes = "按小区获取分页公告列表,公告标题模糊查询")
149
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
150
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "title", value = "公告标题"),
151
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
152
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
153
+    @RequestMapping(value = "/announcements/{communityId}", method = RequestMethod.GET)
154
+    public ResponseBean getAnnouncements(@PathVariable Integer communityId,
155
+                                         @RequestParam(required = false) String title,
156
+                                         @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
157
+                                         @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
158
+        ResponseBean responseBean = new ResponseBean();
159
+
160
+        if (!check(communityId)) {
161
+            responseBean.addError("小区不存在");
162
+            return responseBean;
163
+        }
164
+
165
+        ResponseBean announcementList = socialServiceI.getAnnouncements(communityId, title, pageNum, pageSize);
166
+        return announcementList;
167
+    }
168
+
169
+    @ApiOperation(value = "获取公告轮播图", notes = "获取公告轮播图")
170
+    @ApiImplicitParams({
171
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区id")
172
+    })
173
+    @RequestMapping(value = "/announcement/Img/{communityId}", method = RequestMethod.GET)
174
+    public ResponseBean getAnnouncement(@PathVariable(value = "communityId") Integer communityId) {
175
+        ResponseBean responseBean = new ResponseBean();
176
+
177
+        if (!check(communityId)) {
178
+            responseBean.addError("小区不存在");
179
+            return responseBean;
180
+        }
181
+
182
+        List<TpAnnouncement> agreement = socialServiceI.getAnnouncement(communityId);
183
+        responseBean.addSuccess(agreement);
184
+        return responseBean;
185
+    }
186
+
187
+    @ApiOperation(value = "获取活动轮播图", notes = "获取活动轮播图")
188
+    @ApiImplicitParams({
189
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区id")
190
+    })
191
+    @RequestMapping(value = "/activity/Img/{communityId}", method = RequestMethod.GET)
192
+    public ResponseBean getActivity(@PathVariable(value = "communityId") Integer communityId) {
193
+        ResponseBean responseBean = new ResponseBean();
194
+
195
+        if (!check(communityId)) {
196
+            responseBean.addError("小区不存在");
197
+            return responseBean;
198
+        }
199
+
200
+        List<TpActivity> agreement = socialServiceI.getActivity(communityId);
201
+        responseBean.addSuccess(agreement);
202
+        return responseBean;
203
+    }
204
+
205
+
206
+    @ApiOperation(value = "按小区获取分页活动列表", notes = "按小区获取分页活动列表,公告标题模糊查询")
207
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
208
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "title", value = "活动标题"),
209
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
210
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
211
+    @RequestMapping(value = "/activitys/{communityId}", method = RequestMethod.GET)
212
+    public ResponseBean getActivitys(@PathVariable Integer communityId,
213
+                                     @RequestParam(required = false) String title,
214
+                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
215
+                                     @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
216
+        ResponseBean responseBean = new ResponseBean();
217
+
218
+        if (!check(communityId)) {
219
+            responseBean.addError("小区不存在");
220
+            return responseBean;
221
+        }
222
+
223
+        ResponseBean activityList = socialServiceI.getActivitys(communityId, title, pageNum, pageSize);
224
+        return activityList;
225
+    }
226
+
227
+    @ApiOperation(value = "论坛活动帖子详情", notes = "获取论坛活动帖子详情")
228
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
229
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动帖子id"),
230
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
231
+    @RequestMapping(value = "/activity/{communityId}", method = RequestMethod.GET)
232
+    public ResponseBean findActivityDetail(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
233
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
234
+        ResponseBean responseBean = new ResponseBean();
235
+
236
+        if (!check(communityId)) {
237
+            responseBean.addError("小区不存在");
238
+            return responseBean;
239
+        }
240
+
241
+        TpActivity activity = socialServiceI.findActivityDetail(activityId, communityId, userElement);
242
+        responseBean.addSuccess(activity);
243
+        return responseBean;
244
+    }
245
+
246
+    @ApiOperation(value = "二手租赁详情", notes = "二手租赁详情")
247
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
248
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "帖子id"),
249
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
250
+    @RequestMapping(value = "/getTransaction/{communityId}", method = RequestMethod.GET)
251
+    public ResponseBean findUsedDetails(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
252
+        ResponseBean responseBean = new ResponseBean();
253
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
254
+        Integer userId = userElement.getUserVerifyId();
255
+
256
+        if (!check(communityId)) {
257
+            responseBean.addError("小区不存在");
258
+            return responseBean;
259
+        }
260
+
261
+        TpTransaction activity = socialServiceI.findUsedDetails(activityId, communityId, userId);
262
+        if (null != activity ){
263
+            responseBean.addSuccess(activity);
264
+        }else {
265
+            responseBean.addError("此用户已被删除");
266
+        }
267
+        return responseBean;
268
+    }
269
+
270
+
271
+    @ApiOperation(value = "查询二手租赁回复", notes = "查询二手租赁回复")
272
+    @ApiImplicitParams({
273
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "transactionId", value = "帖子id"),
274
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "type", value = "0:和我相关,1:楼主,2:物业"),
275
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
276
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "pageNum", value = "第几页"),
277
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "pageSize", value = "一页多少行"),
278
+            @ApiImplicitParam(paramType = "query", dataTypeClass = String.class, name = "order", value = "asc 正序(默认), desc倒序")
279
+    })
280
+    @RequestMapping(value = "/getTransactionReply", method = RequestMethod.GET)
281
+    public ResponseBean findUsedDetailsReply(@RequestParam("transactionId") Integer transactionId,
282
+                                             @RequestParam(value = "order", defaultValue = "asc") String order,
283
+                                             @RequestParam(value = "type",required = false) Integer type,
284
+                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
285
+                                             @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
286
+                                             HttpSession session) {
287
+        ResponseBean responseBean = new ResponseBean();
288
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
289
+
290
+        if (!check(userElement.getCommunityId())) {
291
+            responseBean.addError("小区不存在");
292
+            return responseBean;
293
+        }
294
+
295
+        responseBean = socialServiceI.findUsedDetailsReply(transactionId, userElement, order, pageNum, pageSize,type);
296
+        return responseBean;
297
+    }
298
+
299
+
300
+
301
+    @ApiOperation(value = "获取所有的二手租赁帖子", notes = "获取所有的二手租赁帖子")
302
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
303
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "帖子类型0 代表 议事大厅 1 是邻里互助 2 是二手/租赁 3 是其他话题"),
304
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "transactionTitle", value = "帖子标题"),
305
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
306
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")}
307
+    )
308
+    @RequestMapping(value = "/getTransactions/{communityId}", method = RequestMethod.GET)
309
+    public ResponseBean getAllPosts(@PathVariable("communityId") Integer communityId,
310
+                                    @RequestParam(value = "type", required = false) String type,
311
+                                    @RequestParam(value = "transactionTitle",required = false) String transactionTitle,
312
+                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
313
+                                    @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
314
+        ResponseBean responseBean = new ResponseBean();
315
+        if (!check(communityId)) {
316
+            responseBean.addError("小区不存在");
317
+            return responseBean;
318
+        }
319
+
320
+        ResponseBean tpTransactions = socialServiceI.findAllTransaction(communityId, transactionTitle,type, pageNum, pageSize);
321
+        return tpTransactions;
322
+    }
323
+
324
+    @ApiOperation(value = "添加二手租赁帖子", notes = "添加二手租赁帖子")
325
+    @ApiImplicitParams({
326
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="title:小区标题, imageUrl:图片URL地址, content:小区内容, type:0议事大厅,1是邻里互助 ,2是二手/租赁,3其它话题"),
327
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
328
+    })
329
+    @RequestMapping(value = "/addTransaction", method = RequestMethod.POST)
330
+    @ResponseBody
331
+    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session)throws IOException{
332
+
333
+        ResponseBean responseBean = new ResponseBean();
334
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
335
+        ResponseBean response = socialServiceI.addAllTransaction(userElement, paramets);
336
+        return response;
337
+    }
338
+    
339
+    @ApiOperation(value = "举报二手交易帖子", notes = "举报二手交易帖子")
340
+    @ApiImplicitParams({
341
+            @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
342
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="transactionId:二手交易帖子id, reportReasonId:举报原因id"),
343
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
344
+    })
345
+    @RequestMapping(value = "/transaction/report/{communityId}", method = RequestMethod.POST)
346
+    @ResponseBody
347
+    public ResponseBean reportTransaction(@PathVariable("communityId") Integer communityId,@RequestBody String paramets, HttpSession session)throws IOException{
348
+        
349
+        ResponseBean responseBean = new ResponseBean();
350
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
351
+        Integer userVerifyId = userElement.getUserVerifyId();
352
+        ResponseBean response = socialServiceI.reportTransaction(userVerifyId, communityId,paramets);
353
+        return response;
354
+    }
355
+
356
+    @ApiOperation(value = "获取我发布所有二手租赁帖子", notes = "获取我发布所有二手租赁帖子")
357
+    @ApiImplicitParams({
358
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "帖子类型"),
359
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
360
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
361
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
362
+    })
363
+    @RequestMapping(value = "/selectAllTransaction", method = RequestMethod.GET)
364
+    public ResponseBean selectAllTransaction(HttpSession session,
365
+                                             @RequestParam(value = "type",required = false) Integer type,
366
+                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
367
+                                             @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
368
+        ResponseBean responseBean = new ResponseBean();
369
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
370
+        ResponseBean response = socialServiceI.selectAllTransaction(userElement, pageNum, pageSize,type);
371
+        return response;
372
+    }
373
+
374
+    @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
375
+    @ApiImplicitParams({
376
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
377
+                    "imageUrl:图片url,transactionTitle:小区标题,transactionContent:小区内容"),
378
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "id", value = "id:帖子id"),
379
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
380
+    })
381
+    @RequestMapping(value = "/updateTransaction/{id}", method = RequestMethod.PUT)
382
+    public ResponseBean ubdateTransaction(HttpSession session,@PathVariable("id") String id, @RequestBody String paramets) {
383
+        ResponseBean responseBean = new ResponseBean();
384
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
385
+        ResponseBean response = socialServiceI.updateTransaction(paramets,userElement,Integer.valueOf(id));
386
+        return response;
387
+    }
388
+
389
+    @ApiOperation(value = "删除二手租赁帖子", notes = "删除二手租赁帖子")
390
+    @ApiImplicitParams({
391
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "id", value = "id:帖子id"),
392
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
393
+    })
394
+    @RequestMapping(value = "/deleteTransaction/{id}", method = RequestMethod.DELETE)
395
+    public ResponseBean deleteTransaction(HttpSession session, @PathVariable("id") String id) {
396
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
397
+        Integer userId = userElement.getId();
398
+        ResponseBean response = socialServiceI.deleteransaction(Integer.valueOf(id),userElement);
399
+        return response;
400
+    }
401
+
402
+
403
+    @ApiOperation(value = "评价工单内容以及评分", notes = "评价工单内容以及评分")
404
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
405
+            @ApiImplicitParam(name = "parameter", value = "score 评分, comment 评语 ", required = true, dataType = "String"),
406
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "ticketId", value = "工单Id"),
407
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
408
+    @RequestMapping(value = "/accessTicket/{communityId}", method = RequestMethod.POST)
409
+    public ResponseBean accessTicket(@PathVariable("communityId") Integer communityId, @RequestBody String parameter, @RequestParam("ticketId") String ticketId, HttpSession session) {
410
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
411
+        Integer userId = userElement.getUserVerifyId();
412
+        ResponseBean responseBean = new ResponseBean();
413
+
414
+        if (!check(communityId)) {
415
+            responseBean.addError("小区不存在");
416
+            return responseBean;
417
+        }
418
+
419
+        TpTicket tpTicket = JSONObject.parseObject(parameter,TpTicket.class);
420
+        socialServiceI.accessTicket(communityId, tpTicket, ticketId, userId);
421
+        return responseBean;
422
+    }
423
+    
424
+    @ApiOperation(value = "获取举报原因列表", notes = "获取举报原因列表")
425
+    @RequestMapping(value = "/reports", method = RequestMethod.GET)
426
+    public ResponseBean getReportReasons() {
427
+        ResponseBean responseBean = new ResponseBean();
428
+        List<Map<String,Object>> reportList = socialServiceI.getReportReasons();
429
+        responseBean.addSuccess(reportList);
430
+        return responseBean;
431
+    }
432
+
433
+    @ApiOperation(value = "二手帖子对话", notes = "二手帖子对话")
434
+    @ApiImplicitParams({
435
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
436
+                    "transactionId:当前帖子ID,replyContent:回复内容,replyId:被回复的评论ID,imgArr:可多张[],state:1,此参数用于判断是否是物业"),
437
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
438
+    })
439
+    @RequestMapping(value = "/addTransactionReply", method = RequestMethod.POST)
440
+    public ResponseBean addTransactionReply(HttpSession session, @RequestBody String paramets) {
441
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
442
+        ResponseBean response = socialServiceI.addTransactionReply(paramets,userElement);
443
+        return response;
444
+    }
445
+
446
+    @ApiOperation(value = "添加点赞", notes = "添加点赞")
447
+    @ApiImplicitParams({
448
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
449
+                    "transactionId:当前帖子ID,likeStatus:1是喜欢 2是不喜欢"),
450
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
451
+    })
452
+    @RequestMapping(value = "/addTransactionLike", method = RequestMethod.POST)
453
+    public ResponseBean  addTransactionLike(HttpSession session, @RequestBody String paramets) {
454
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
455
+        ResponseBean response = socialServiceI.addTransactionLike(paramets,userElement);
456
+        return response;
457
+    }
458
+
459
+    @ApiOperation(value = "我参加的所有活动", notes = "我参加的所有活动")
460
+    @ApiImplicitParams({
461
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
462
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
463
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
464
+    })
465
+    @RequestMapping(value = "/user/activitlist", method = RequestMethod.GET)
466
+    public ResponseBean  userActivityList(HttpSession session,
467
+                                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
468
+                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
469
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
470
+        ResponseBean response = socialServiceI.userActivityList(userElement,pageNum,pageSize);
471
+        return response;
472
+    }
473
+
474
+    @ApiOperation(value = "我参加的话题", notes = "我参加的话题")
475
+    @ApiImplicitParams({
476
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
477
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
478
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
479
+    })
480
+    @RequestMapping(value = "/user/transactionList", method = RequestMethod.GET)
481
+    public ResponseBean  userTransactionList(HttpSession session,
482
+                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
483
+                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
484
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
485
+        ResponseBean response = socialServiceI.userTransactionList(userElement,pageNum,pageSize);
486
+        return response;
487
+    }
488
+
489
+    @ApiOperation(value = "签到扫码", notes = "签到扫码")
490
+    @ApiImplicitParams({
491
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
492
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value = "activityId:活动id"),
493
+    })
494
+
495
+    @RequestMapping(value = "/tpactivitysignin/add", method = RequestMethod.POST)
496
+    public ResponseBean  tpActivitySignInAdd(HttpSession session,@RequestBody String paramets) {
497
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
498
+        ResponseBean response = socialServiceI.tpActivitySignInAdd(paramets,userElement);
499
+        return response;
500
+    }
501
+
502
+    @ApiOperation(value = "回复对话", notes = "回复对话")
503
+    @ApiImplicitParams({
504
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
505
+                    "transactionId:帖子ID,replyContent:回复内容,replyUserId:被回复的用户ID,imgArr:可多张[]"),
506
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
507
+    })
508
+    @RequestMapping(value = "/replyAdd", method = RequestMethod.POST)
509
+    public ResponseBean replyAdd(HttpSession session, @RequestBody String paramets) {
510
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
511
+        ResponseBean replyAdd = socialServiceI.replyAdd(paramets,userElement);
512
+        return replyAdd;
513
+    }
514
+
515
+}

+ 46
- 0
app-api/src/main/java/com/community/huiju/controller/TaVersionController.java 查看文件

@@ -0,0 +1,46 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.service.TaVersionServicel;
5
+import io.swagger.annotations.Api;
6
+import io.swagger.annotations.ApiImplicitParam;
7
+import io.swagger.annotations.ApiImplicitParams;
8
+import io.swagger.annotations.ApiOperation;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.cloud.context.config.annotation.RefreshScope;
11
+import org.springframework.web.bind.annotation.PathVariable;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import javax.servlet.http.HttpSession;
17
+
18
+/**
19
+ * version V1.0
20
+ * class_name: $METHOD_NAME$
21
+ * param: $METHOD_PARAM$
22
+ * describe: TODO
23
+ * creat_user:fuxingfan
24
+ * creat_time: 2019/5/9
25
+ **/
26
+@RestController
27
+@RefreshScope
28
+@RequestMapping("/")
29
+@Api(value = "版本相关的API", description = "版本相关的API")
30
+public class TaVersionController extends BaseController {
31
+
32
+
33
+    @Autowired
34
+    private TaVersionServicel taVersionService;
35
+
36
+
37
+    @ApiOperation(value = "获取APP版本号并对比", notes = "获取APP版本号并对比")
38
+    @ApiImplicitParams({
39
+            @ApiImplicitParam(paramType = "path",dataType = "String",name = "type",value = "ios/android"),
40
+    })
41
+    @RequestMapping(value = "/version/{type}",method = RequestMethod.GET)
42
+    public ResponseBean getVersion(@PathVariable String type, HttpSession session){
43
+        ResponseBean responseBean = taVersionService.getVersion(type);
44
+        return responseBean;
45
+    }
46
+}

+ 229
- 0
app-api/src/main/java/com/community/huiju/controller/TicketController.java 查看文件

@@ -0,0 +1,229 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.model.TaUser;
7
+import com.community.huiju.model.TpTicket;
8
+import com.community.huiju.model.TpTransaction;
9
+import com.community.huiju.model.TpTicketRecordComment;
10
+import com.community.huiju.service.AgreementServicel;
11
+import com.community.huiju.service.ITicketService;
12
+import io.swagger.annotations.Api;
13
+import io.swagger.annotations.ApiImplicitParam;
14
+import io.swagger.annotations.ApiImplicitParams;
15
+import io.swagger.annotations.ApiOperation;
16
+import io.swagger.annotations.Example;
17
+import io.swagger.annotations.ExampleProperty;
18
+import lombok.val;
19
+import org.springframework.beans.factory.annotation.Autowired;
20
+import org.springframework.cloud.context.config.annotation.RefreshScope;
21
+import org.springframework.web.bind.annotation.*;
22
+
23
+import javax.servlet.http.HttpSession;
24
+import java.io.IOException;
25
+import java.util.List;
26
+
27
+@RestController
28
+@RefreshScope
29
+@RequestMapping("/")
30
+@Api(value = "工单相关的API",description = "工单相关的API")
31
+public class TicketController extends BaseController {
32
+
33
+    @Autowired
34
+    private ITicketService iTicketService;
35
+
36
+    @Autowired
37
+    private AgreementServicel agreementServicel;
38
+
39
+    @RequestMapping(value = "/tickets/{communityId}", method = RequestMethod.GET)
40
+    @ApiOperation(value = "获取 报修/投诉/联系单 各3条数据", notes = "根据 小区编号,第几页,一页多少行")
41
+    @ApiImplicitParams({
42
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId",value = "小区编号"),
43
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum",value = "第几页"),
44
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少数据"),
45
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
46
+    })
47
+    @Deprecated
48
+    public ResponseBean getService(@PathVariable(value = "communityId") Integer communityId,
49
+                                   @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
50
+                                   @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize,
51
+                                   HttpSession session) {
52
+        ResponseBean response = new ResponseBean();
53
+
54
+        if (!check(communityId)) {
55
+            response.addError("小区不存在");
56
+            return response;
57
+        }
58
+
59
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
60
+
61
+        TpTicket tpTicket = new TpTicket();
62
+        tpTicket.setCommunityId(Integer.valueOf(communityId));
63
+        tpTicket.setTaUserId(userElement.getId());
64
+
65
+        response = iTicketService.getList(tpTicket, pageNum, pageSize);
66
+        return response;
67
+    }
68
+
69
+    @ApiOperation(value = "获取报修/投诉/联系单进度详情数据", notes = "获取报修/投诉/联系单进度详情数据")
70
+    @ApiImplicitParams({
71
+            @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "communityId", value = "小区编号"),
72
+            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "ticketId", value = "报修id")
73
+    })
74
+    @RequestMapping(value = "/ticket/schedule/{communityId}", method = RequestMethod.GET)
75
+    public ResponseBean getTicketSchedule(@PathVariable(value = "communityId") Integer communityId, @RequestParam Integer ticketId) {
76
+        ResponseBean responseBean = new ResponseBean();
77
+
78
+        if (!check(communityId)) {
79
+            responseBean.addError("小区不存在");
80
+            return responseBean;
81
+        }
82
+
83
+        TpTicket ticket = iTicketService.getTicketSchedule(String.valueOf(communityId), ticketId);
84
+        if (null != ticket) {
85
+            responseBean.addSuccess(ticket);
86
+        }else {
87
+            responseBean.addError("没有该工单!");
88
+        }
89
+
90
+        return responseBean;
91
+    }
92
+
93
+    @RequestMapping(value = "/tickets/list/{communityId}", method = RequestMethod.GET)
94
+    @ApiOperation(value = "获取 报修/投诉/联系单 数据列表", notes = "根据 小区编号,工单类型,第几页,一页多少行")
95
+    @ApiImplicitParams({
96
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId", value = "小区编号"),
97
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum", value = "第几页"),
98
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize", value = "一页多少数据"),
99
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "type", value = "工单类型 (1:投诉   2:报修 3:联系物业)"),
100
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
101
+
102
+    })
103
+    public ResponseBean getServiceList(@PathVariable(value = "communityId") Integer communityId,
104
+                                       @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
105
+                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
106
+                                       @RequestParam(value = "type") String type,
107
+                                       HttpSession session) {
108
+        ResponseBean responseBean = new ResponseBean();
109
+
110
+        if (!check(communityId)) {
111
+            responseBean.addError("小区不存在");
112
+            return responseBean;
113
+        }
114
+
115
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
116
+
117
+        TpTicket tpTicket = new TpTicket();
118
+        tpTicket.setCommunityId(Integer.valueOf(communityId));
119
+        tpTicket.setTaUserId(userElement.getUserVerifyId());
120
+        tpTicket.setType(type);
121
+
122
+        responseBean = iTicketService.getByTypeList(tpTicket, pageNum, pageSize);
123
+
124
+        return responseBean;
125
+
126
+    }
127
+
128
+    @ApiOperation(value = "回复 报修/投诉/联系单 追问接口", notes = "回复 报修/投诉/联系单 追问接口")
129
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
130
+            @ApiImplicitParam(name = "tpTicketRecordComment", value = "回复记录参数(ticketId:工单id,content:回复时间,ticketRecordCommentId:需要回复的id)", paramType = "body"),
131
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
132
+    @RequestMapping(value = "/ticket/reply/{communityId}", method = RequestMethod.POST)
133
+    public ResponseBean updateTicketsReply(@PathVariable(value = "communityId") Integer communityId, @RequestBody TpTicketRecordComment tpTicketRecordComment,HttpSession session){
134
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
135
+        Integer userId = userElement.getId();
136
+        ResponseBean responseBean = new ResponseBean();
137
+
138
+        if (!check(communityId)) {
139
+            responseBean.addError("小区不存在");
140
+            return responseBean;
141
+        }
142
+
143
+        tpTicketRecordComment.setCommunityId(communityId);
144
+        Integer size = iTicketService.updateTicketsReply(tpTicketRecordComment, userId);
145
+        if (size > 0){
146
+            responseBean.addSuccess(size);
147
+        } else {
148
+            responseBean.addError("更新失败");
149
+        }
150
+        return responseBean;
151
+    }
152
+
153
+    @ApiOperation(value = "添加 报修/投诉/联系单", notes = "添加 报修/投诉/联系单")
154
+    @ApiImplicitParams({
155
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
156
+                    "ticketTitle:工单标题,ticketContent:工单内容,type: 1:投诉   2:报修 3:联系物业 , repairType:0:公共区域  1: 房屋质量  2:户内设施, imageUrl:图片地址 "),
157
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
158
+    })
159
+    @RequestMapping(value = "/addtpTicket", method = RequestMethod.POST)
160
+    @ResponseBody
161
+    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session) throws IOException {
162
+        ResponseBean responseBean = new ResponseBean();
163
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
164
+        ResponseBean response = iTicketService.addAiTicketService(userElement, paramets);
165
+        return response;
166
+    }
167
+
168
+    @ApiOperation(value = "物业,门卫,领导电话", notes = "物业,门卫,领导电话")
169
+    @RequestMapping(value = "/allTpAnnouncementTel", method = RequestMethod.GET)
170
+    @ApiImplicitParams({
171
+            @ApiImplicitParam(paramType = "query",dataTypeClass = Integer.class,name = "communityId", value = "小区编号"),
172
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
173
+    })
174
+    public ResponseBean getTpAnnouncementTel(HttpSession session,
175
+                                             @RequestParam(value = "communityId",required = false) Integer communityId) {
176
+        UserElement userElement = getUserElement(session);
177
+        userElement.setCommunityId(userElement.getCommunityId() == null?communityId:userElement.getCommunityId());
178
+        ResponseBean agreement = agreementServicel.getTpAnnouncementTel(userElement);
179
+        return agreement;
180
+    }
181
+
182
+    @ApiOperation(value = "修改 报修/投诉/联系单", notes = "修改 报修/投诉/联系单")
183
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "ticketId", value = "工单Id"),
184
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "parameter", value =
185
+                    "ticketTitle:工单标题,ticketContent:工单内容,type: 1:投诉   2:报修 3:联系物业 , imageUrl:图片地址 "),
186
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
187
+    })
188
+    @RequestMapping(value = "/updateTicket/{ticketId}", method = RequestMethod.POST)
189
+    public ResponseBean updateTicketContent(@PathVariable("ticketId") Integer ticketId,
190
+                                            @RequestBody String parameter,
191
+                                            HttpSession session) {
192
+        ResponseBean responseBean = new ResponseBean();
193
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
194
+        responseBean = iTicketService.updateTicketContent(ticketId, parameter,userElement);
195
+        return responseBean;
196
+    }
197
+
198
+    @ApiOperation(value = "报修进度终止", notes = "报修进度终止")
199
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
200
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "ticketId", value = "帖子Id"),
201
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
202
+    @RequestMapping(value = "/stopTicket/{communityId}", method = RequestMethod.GET)
203
+    public ResponseBean stopTicket(@PathVariable("communityId") Integer communityId, @RequestParam("ticketId") Integer ticketId, HttpSession session) {
204
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
205
+
206
+        ResponseBean responseBean = new ResponseBean();
207
+        if (!check(communityId)) {
208
+            responseBean.addError("小区不存在");
209
+            return responseBean;
210
+        }
211
+
212
+        responseBean = iTicketService.stopTpTicketRecord(communityId, ticketId, userElement);
213
+        return responseBean;
214
+    }
215
+
216
+    @ApiOperation(value = "添加工单对话", notes = "添加工单对话")
217
+    @ApiImplicitParams({
218
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "content:对话内容,imageUrl:[]图片,ticketId:工单id," )
219
+    })
220
+    @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
221
+    @RequestMapping(value = "/addRecordComment", method = RequestMethod.POST)
222
+    public ResponseBean addRecordComment(@RequestBody String parameter, HttpSession session){
223
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
224
+        ResponseBean  responseBean = iTicketService.addRecordComment(parameter,userElement.getUserVerifyId(),userElement.getCommunityId(),userElement.getUserName());
225
+        return responseBean;
226
+    }
227
+}
228
+
229
+

+ 61
- 0
app-api/src/main/java/com/community/huiju/controller/TpHotelController.java 查看文件

@@ -0,0 +1,61 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.session.UserElement;
5
+import com.community.huiju.service.TpHotelServicel;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.cloud.context.config.annotation.RefreshScope;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.RequestParam;
15
+import org.springframework.web.bind.annotation.RestController;
16
+
17
+import javax.servlet.http.HttpSession;
18
+
19
+/**
20
+ * version V1.0
21
+ * class_name: $METHOD_NAME$
22
+ * param: $METHOD_PARAM$
23
+ * describe: TODO
24
+ * creat_user:fannaixi
25
+ * creat_time: 2019/5/9
26
+ **/
27
+@RestController
28
+@RefreshScope
29
+@RequestMapping("/")
30
+@Api(value = "酒店相关的API", description = "酒店相关的API")
31
+public class TpHotelController extends BaseController {
32
+
33
+
34
+    @Autowired
35
+    private TpHotelServicel tpHotelServicel;
36
+
37
+
38
+    @ApiOperation(value = "获取本小区酒店", notes = "获取本小区酒店")
39
+    @ApiImplicitParams({
40
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
41
+    })
42
+    @RequestMapping(value = "/hotel",method = RequestMethod.GET)
43
+    public Object getHotel(HttpSession session){
44
+        UserElement userElement = getUserElement(session);
45
+        ResponseBean responseBean = tpHotelServicel.getHotel(userElement);
46
+        return responseBean;
47
+    }
48
+
49
+    @ApiOperation(value = "当前小区酒店是否需要展示", notes = "当前小区酒店是否需要展示")
50
+    @ApiImplicitParams({
51
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
52
+    })
53
+    @RequestMapping(value = "/CommunityHotel",method = RequestMethod.GET)
54
+    public Object getHotelCommunity(HttpSession session){
55
+        UserElement userElement = getUserElement(session);
56
+        ResponseBean responseBean = tpHotelServicel.getHotelCommunity(userElement);
57
+        return responseBean;
58
+    }
59
+
60
+
61
+}

+ 79
- 0
app-api/src/main/java/com/community/huiju/controller/TpRentalHouseController.java 查看文件

@@ -0,0 +1,79 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.session.UserElement;
5
+import com.community.huiju.service.TpRentalHouseServicel;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.cloud.context.config.annotation.RefreshScope;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import javax.servlet.http.HttpSession;
15
+
16
+/**
17
+ * version V1.0
18
+ * class_name: $METHOD_NAME$
19
+ * param: $METHOD_PARAM$
20
+ * describe: TODO
21
+ * creat_user:fannaixi
22
+ * creat_time: 2019/5/9
23
+ **/
24
+@RestController
25
+@RefreshScope
26
+@RequestMapping("/")
27
+@Api(value = "长租公寓相关的API", description = "长租公寓相关的API")
28
+public class TpRentalHouseController extends BaseController{
29
+
30
+    @Autowired
31
+    private TpRentalHouseServicel tpRentalHouseServicel;
32
+
33
+    @ApiOperation(value = "长租公寓接口", notes = "长租公寓接口")
34
+    @ApiImplicitParams({
35
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
36
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "houseName",value = "商圈或者小区"),
37
+            @ApiImplicitParam(paramType = "query",dataTypeClass = Integer.class,name = "rentalTypeValue",value = "1:是整租 2:是合租 3:不限"),
38
+            @ApiImplicitParam(paramType = "query",dataTypeClass = Integer.class,name = "houseTypeValue",value = "1:一室居 2:二室居 3:三室局 4:四室居及以上 5:不限"),
39
+            @ApiImplicitParam(paramType = "query",dataTypeClass = Integer.class,name = "rentalPriceValue",value = "1:1000以内 2:1000-1500 3:1500-2000 4:2000-3000 5:3000-4000 6:4000以上 7:不限"),
40
+            @ApiImplicitParam(paramType = "query",dataTypeClass = Integer.class,name = "priceFluctuateValue",value = "1:价格由低到高 2:价格由高到低  3:默认排序" ),
41
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "communityId",value = "小区编号"),
42
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum",value = "第几页"),
43
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少数据")
44
+    })
45
+    @RequestMapping(value = "/rentalhouse",method = RequestMethod.GET)
46
+    public Object getRentalHouse(HttpSession session,
47
+                                    @RequestParam(value = "houseName",required = false ) String houseName,
48
+                                    @RequestParam(value = "rentalTypeValue",required = false) Integer rentalTypeValue,
49
+                                    @RequestParam(value = "houseTypeValue",required = false) Integer houseTypeValue,
50
+                                    @RequestParam(value = "rentalPriceValue",required = false) Integer rentalPriceValue,
51
+                                    @RequestParam(value = "priceFluctuateValue",required = false) Integer priceFluctuateValue,
52
+                                 @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
53
+                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
54
+        UserElement userElement = getUserElement(session);
55
+        ResponseBean responseBean = tpRentalHouseServicel.getRentalHouse(userElement,houseName,rentalTypeValue,houseTypeValue,rentalPriceValue,priceFluctuateValue,pageNum,pageSize);
56
+        return responseBean;
57
+    }
58
+
59
+    @ApiOperation(value = "长租公寓详情", notes = "长租公寓详情")
60
+    @ApiImplicitParams({
61
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
62
+            @ApiImplicitParam(paramType = "path",dataTypeClass = Integer.class,name = "id",value = "出租房ID"),
63
+    })
64
+    @RequestMapping(value = "/rentalhouse/details/{id}",method = RequestMethod.GET)
65
+    public Object getRentalHouseDetails(HttpSession session,
66
+                                        @PathVariable("id") String id){
67
+        UserElement userElement = getUserElement(session);
68
+        ResponseBean responseBean = tpRentalHouseServicel.getRentalHouseDetails(userElement,id);
69
+        return responseBean;
70
+    }
71
+
72
+    @ApiOperation(value = "长租公寓数据字典", notes = "长租公寓数据字典")
73
+    @RequestMapping(value = "/rentalhouse/dictionaries",method = RequestMethod.GET)
74
+    public Object getRentalHousedictionaries(){
75
+        ResponseBean responseBean = tpRentalHouseServicel.getRentalHouseDictionaries();
76
+        return responseBean;
77
+    }
78
+
79
+}

+ 109
- 0
app-api/src/main/java/com/community/huiju/controller/TpShopController.java 查看文件

@@ -0,0 +1,109 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.session.UserElement;
5
+import com.community.huiju.model.TpShop;
6
+import com.community.huiju.service.TpShopServicel;
7
+import io.swagger.annotations.Api;
8
+import io.swagger.annotations.ApiImplicitParam;
9
+import io.swagger.annotations.ApiImplicitParams;
10
+import io.swagger.annotations.ApiOperation;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.cloud.context.config.annotation.RefreshScope;
13
+import org.springframework.web.bind.annotation.*;
14
+
15
+import javax.servlet.http.HttpSession;
16
+
17
+/**
18
+ * version V1.0
19
+ * class_name: $METHOD_NAME$
20
+ * param: $METHOD_PARAM$
21
+ * describe: TODO
22
+ * creat_user:fannaixi
23
+ * creat_time: 2019/5/10
24
+ **/
25
+@RestController
26
+@RefreshScope
27
+@RequestMapping("/")
28
+@Api(value = "线下商铺的API", description = "线下商铺的API")
29
+public class TpShopController extends BaseController{
30
+    @Autowired
31
+    private TpShopServicel tpShopServicel;
32
+
33
+    @ApiOperation(value = "获取所有线下商铺", notes = "获取所有线下商铺")
34
+    @ApiImplicitParams({
35
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
36
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "shopName",value = "搜所名称"),
37
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "tpShopTypeId",value = "商铺类型"),
38
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
39
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
40
+    })
41
+    @RequestMapping(value = "/shop",method = RequestMethod.GET)
42
+    public Object getShop(HttpSession session,
43
+                          @RequestParam(value = "shopName",required = false ) String houseName,
44
+                          @RequestParam(value = "tpShopTypeId",required = false ) Integer tpShopTypeId,
45
+                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
46
+                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
47
+        UserElement userElement = getUserElement(session);
48
+        ResponseBean responseBean = tpShopServicel.getShop(userElement,houseName,tpShopTypeId,pageNum,pageSize);
49
+        return responseBean;
50
+    }
51
+
52
+    @ApiOperation(value = "获取线下商铺详情", notes = "获取线下商铺详情")
53
+    @ApiImplicitParams({
54
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
55
+            @ApiImplicitParam(paramType = "path",dataType = "integer",name = "id",value = "商铺ID"),
56
+    })
57
+    @RequestMapping(value = "/shop/details/{id}",method = RequestMethod.GET)
58
+    public Object getShopDetails(HttpSession session,
59
+                                 @PathVariable("id") String id){
60
+        UserElement userElement = getUserElement(session);
61
+        ResponseBean responseBean = tpShopServicel.getShopDetails(userElement,Integer.valueOf(id));
62
+        return responseBean;
63
+    }
64
+
65
+    @ApiOperation(value = "首页商铺信息", notes = "首页商铺信息")
66
+    @ApiImplicitParams({
67
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
68
+    })
69
+    @RequestMapping(value = "/getShopCommunity",method = RequestMethod.GET)
70
+    public Object getShopCommunity(HttpSession session){
71
+        UserElement userElement = getUserElement(session);
72
+        ResponseBean responseBean = tpShopServicel.getShopCommunity(userElement);
73
+        return responseBean;
74
+    }
75
+
76
+    @ApiOperation(value = "线下商铺评论列表", notes = "线下商铺评论列表")
77
+    @ApiImplicitParams({
78
+            @ApiImplicitParam(paramType = "path", dataType = "integer", name = "shopID", value ="shopID:商铺ID"),
79
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
80
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
81
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
82
+    })
83
+    @RequestMapping(value = "/shopEvaluate/{shopID}", method = RequestMethod.GET)
84
+    @ResponseBody
85
+    public ResponseBean shopEvaluate(HttpSession session,
86
+                                     @PathVariable("shopID") Integer shopID,
87
+                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
88
+                                     @RequestParam(value = "pageSize", defaultValue = "9999") Integer pageSize){
89
+        UserElement userElement = getUserElement(session);
90
+        ResponseBean responseBean = new ResponseBean();
91
+        ResponseBean response = tpShopServicel.shopEvaluate(shopID,userElement,pageNum,pageSize);
92
+        return response;
93
+    }
94
+
95
+    @ApiOperation(value = "线下商铺评论", notes = "线下商铺评论")
96
+    @ApiImplicitParams({
97
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="shopID:商铺ID,score:评分0-5,content:评价内容"),
98
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
99
+    })
100
+    @RequestMapping(value = "/shopEvaluateAdd", method = RequestMethod.POST)
101
+    @ResponseBody
102
+    public ResponseBean shopEvaluateAdd(@RequestBody String paramets,HttpSession session){
103
+        UserElement userElement = getUserElement(session);
104
+        ResponseBean response = tpShopServicel.shopEvaluateAdd(paramets,userElement);
105
+        return response;
106
+    }
107
+
108
+
109
+}

+ 193
- 0
app-api/src/main/java/com/community/huiju/controller/TpTicketAndTransactionController.java 查看文件

@@ -0,0 +1,193 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.dao.TpTransactionMapper;
7
+import com.community.huiju.dao.TpUserMapper;
8
+import com.community.huiju.model.TpTransaction;
9
+import com.community.huiju.model.TpUser;
10
+import com.community.huiju.service.SocialServiceI;
11
+import io.swagger.annotations.Api;
12
+import io.swagger.annotations.ApiImplicitParam;
13
+import io.swagger.annotations.ApiImplicitParams;
14
+import io.swagger.annotations.ApiOperation;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.cloud.context.config.annotation.RefreshScope;
17
+import org.springframework.web.bind.annotation.*;
18
+
19
+import javax.servlet.http.HttpSession;
20
+
21
+@RestController
22
+@RefreshScope
23
+@RequestMapping("/")
24
+@Api(value = "物业端的帖子和工单", description = "物业端的帖子和工单")
25
+public class TpTicketAndTransactionController {
26
+    @Autowired
27
+    private SocialServiceI socialServiceI;
28
+
29
+    @Autowired
30
+    private TpUserMapper tpUserMapper;
31
+
32
+    @ApiOperation(value = "app端话题管理", notes = "app端话题管理")
33
+    @ApiImplicitParams({
34
+            @ApiImplicitParam(paramType = "path",dataType = "String",name = "loginName",value = "电话号码"),
35
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "status",value = "1:被举报话题,2:未读话题,3:已读话题"),
36
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "transactionTitle",value = "话题搜索"),
37
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "communityId",value = "小区"),
38
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum",value = "第几页"),
39
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少数据"),
40
+    })
41
+    @RequestMapping(value = "/transactionsManageList/{loginName}",method = RequestMethod.GET)
42
+    public ResponseBean tpTransactionManageList(@PathVariable(value = "loginName") String loginName,
43
+                                   @RequestParam(value = "status") Integer status,
44
+                                   @RequestParam(value = "transactionTitle", required = false) String transactionTitle,
45
+                                   @RequestParam(value = "communityId", required = false) Integer communityId,
46
+                                   @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
47
+                                   @RequestParam(value = "pageSize", defaultValue = "9999") Integer pageSize) {
48
+       ResponseBean tpTransactionManageList= socialServiceI.tpTransactionManageList(loginName,status,pageNum,pageSize,transactionTitle,communityId);
49
+       return tpTransactionManageList;
50
+    }
51
+
52
+    @ApiOperation(value = "app端话题管理批量作废话题",nickname ="app端话题管理批量作废话题")
53
+    @ApiImplicitParams({
54
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="id:帖子id(多个),loginName:电话号码,communityId:小区")})
55
+    @RequestMapping(value="/transactions/delete",method = RequestMethod.POST)
56
+    public ResponseBean transactionsDelete(@RequestBody String paramets){
57
+        ResponseBean  transactionsUpdata= socialServiceI.transactionsDelete(paramets);
58
+        return transactionsUpdata;
59
+    }
60
+
61
+    @ApiOperation(value = "app端话题管理清除不实举报",nickname ="app端话题管理清除不实举报")
62
+    @ApiImplicitParams({
63
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="id:帖子id(多个),loginName:电话号码,communityId:小区")})
64
+    @RequestMapping(value="/tpTransactionReport/delete",method = RequestMethod.POST)
65
+    public ResponseBean tpTransactionReportDelete(@RequestBody String paramets){
66
+        ResponseBean  transactionsUpdata= socialServiceI.tpTransactionReportDelete(paramets);
67
+        return transactionsUpdata;
68
+    }
69
+
70
+    @ApiOperation(value = "app端话题管理添加话题",nickname ="app端话题管理添加话题")
71
+    @ApiImplicitParams({
72
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="loginName:电话,communityId:小区ID,transactionTitle:话题标题," +
73
+                    "type:0 代表 二手(卖二手物品)  1 是代表 求购 (买二手物品) 2 是代表 租赁(租二手物品)3其他话题,contentImg:图片,sort:权重值,status:'0 是已作废 1 是已发布  2 是草稿 ")})
74
+    @RequestMapping(value="/transactions/add",method = RequestMethod.POST)
75
+    public ResponseBean transactionsAdd(@RequestBody String paramets){
76
+        ResponseBean  addAnnouncement= socialServiceI.transactionsAdd(paramets);
77
+        return addAnnouncement;
78
+    }
79
+
80
+    @ApiOperation(value = "app端话题管理批量已读话题",nickname ="app端话题管理批量已读话题")
81
+    @ApiImplicitParams({
82
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="id:帖子id(多个),loginName:电话号码,communityId:小区")})
83
+    @RequestMapping(value="/transactions/read",method = RequestMethod.POST)
84
+    public ResponseBean transactionsRead(@RequestBody String paramets){
85
+        ResponseBean  transactionsUpdata= socialServiceI.transactionsRead(paramets);
86
+        return transactionsUpdata;
87
+    }
88
+
89
+    @ApiOperation(value = "app端工单管理列表", notes = "app端工单管理列表")
90
+    @ApiImplicitParams({
91
+            @ApiImplicitParam(paramType = "path",dataType = "String",name = "loginName",value = "电话号码"),
92
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "status",value = "0:待分配,3正在处理,9:其他状态"),
93
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "communityId",value = "小区"),
94
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum",value = "第几页"),
95
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少数据"),
96
+    })
97
+    @RequestMapping(value = "/tpTicketManageList/{loginName}",method = RequestMethod.GET)
98
+    public ResponseBean tpTicketManageList(@PathVariable(value = "loginName") String loginName,
99
+                                                @RequestParam(value = "status") Integer status,
100
+                                                @RequestParam(value = "communityId") Integer communityId,
101
+                                                @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
102
+                                                @RequestParam(value = "pageSize", defaultValue = "9999") Integer pageSize) {
103
+        ResponseBean tpTicketManageList= socialServiceI.tpTicketManageList(loginName,status,pageNum,pageSize,communityId);
104
+        return tpTicketManageList;
105
+    }
106
+
107
+    @ApiOperation(value = "app端工单管理详情", notes = "app端工单管理列表详情")
108
+    @ApiImplicitParams({
109
+            @ApiImplicitParam(paramType = "path",dataType = "String",name = "tickedID",value = "工单ID"),
110
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "loginName",value = "电话号码"),
111
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "communityId",value = "小区")
112
+    })
113
+    @RequestMapping(value = "/tpTicketManage/{tickedID}",method = RequestMethod.GET)
114
+    public ResponseBean tpTicketManageDetails(@PathVariable(value = "tickedID") Integer tickedID,
115
+                                              @RequestParam(value = "communityId") Integer communityId,
116
+                                              @RequestParam(value = "loginName") String loginName) {
117
+        ResponseBean tpTicketManageDetails= socialServiceI.tpTicketManageDetails(tickedID,communityId,loginName);
118
+        return tpTicketManageDetails;
119
+    }
120
+
121
+    @ApiOperation(value = "app端工单管理回复业主", notes = "app端工单管理回复业主")
122
+    @ApiImplicitParams({
123
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName:手机号,communityId:小区,content:对话内容,imageUrl:[]图片,ticketId:工单id," +
124
+                    "status:工单状态(0:待分配  1:拒绝受理 2:待处理 3:正在处理 4:待评价 5:已评价 6:已终止)")
125
+    })
126
+    @RequestMapping(value = "/tpTicketManage/reply",method = RequestMethod.POST)
127
+    public ResponseBean tpTicketManageReply(@RequestBody String parameter) {
128
+        ResponseBean tpTicketManageReply= socialServiceI.tpTicketManageReply(parameter);
129
+        return tpTicketManageReply;
130
+    }
131
+
132
+    @ApiOperation(value = "app端工单管理受理分配", notes = "app端工单管理受理分配")
133
+    @ApiImplicitParams({
134
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName:手机号,communityId:小区,ticketId:工单id," +
135
+                    "id:当前处理人id")
136
+    })
137
+    @RequestMapping(value = "/ticketManage/addRecord", method = RequestMethod.POST)
138
+    public ResponseBean ticketManageRecord(@RequestBody String parameter){
139
+        ResponseBean  responseBean = socialServiceI.ticketManageRecord(parameter);
140
+        return responseBean;
141
+    }
142
+
143
+    @ApiOperation(value = "app端工单管理拒绝处理", notes = "app端工单管理拒绝处理")
144
+    @ApiImplicitParams({
145
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName:手机号,communityId:小区,ticketId:工单id,textContent:拒绝的内容" )
146
+    })
147
+    @RequestMapping(value = "/updateTicketStatus", method = RequestMethod.POST)
148
+    public ResponseBean updateTicketStatus(@RequestBody String parameter, HttpSession session){
149
+        ResponseBean  responseBean = socialServiceI.updateTicketStatus(parameter);
150
+        return responseBean;
151
+    }
152
+
153
+    @ApiOperation(value = "app端工单管理处理完成", notes = "app端工单管理处理完成")
154
+    @ApiImplicitParams({
155
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName:手机号,communityId:小区,content:对话内容,imageUrl:[]图片,ticketId:工单id" )
156
+    })
157
+    @RequestMapping(value = "/updateTicket", method = RequestMethod.POST)
158
+    public ResponseBean updateTicket(@RequestBody String parameter){
159
+        ResponseBean  responseBean = socialServiceI.updateTicket(parameter);
160
+        return responseBean;
161
+    }
162
+
163
+    @ApiOperation(value = "app端话题管理话题详情", notes = "app端话题管理话题详情")
164
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
165
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "帖子id"),
166
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "loginName", value = "手机号"),
167
+    })
168
+    @RequestMapping(value = "/getTransactionManage/{communityId}", method = RequestMethod.GET)
169
+    public ResponseBean findUsedDetails(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId,@RequestParam("loginName") String loginName) {
170
+        ResponseBean responseBean = new ResponseBean();
171
+        TpUser tpUser= tpUserMapper.selectLoginName(loginName,communityId);
172
+        TpTransaction activity = socialServiceI.findUsedDetails(activityId, communityId, tpUser.getId());
173
+        responseBean.addSuccess(activity);
174
+        return responseBean;
175
+    }
176
+
177
+    @ApiOperation(value = "app端个人中心话题管和工单管理是否展示", notes = "app端个人中心话题管和工单管理是否展示")
178
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
179
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "loginName", value = "手机号"),
180
+    })
181
+    @RequestMapping(value = "/accessAuthority/{communityId}", method = RequestMethod.GET)
182
+    public ResponseBean findUsedDetails(@PathVariable(value = "communityId") Integer communityId,@RequestParam("loginName") String loginName) {
183
+        ResponseBean responseBean = new ResponseBean();
184
+        TpUser tpUser= tpUserMapper.selectLoginName(loginName,communityId);
185
+         if (null == tpUser){
186
+             responseBean.addError("此号码无权限");
187
+             return responseBean;
188
+         }
189
+             responseBean.addSuccess("成功");
190
+        return responseBean;
191
+    }
192
+
193
+}

+ 417
- 0
app-api/src/main/java/com/community/huiju/controller/UserController.java 查看文件

@@ -0,0 +1,417 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.constant.Constant;
5
+import com.community.commom.mode.ResponseBean;
6
+import com.community.commom.session.UserElement;
7
+import com.community.huiju.common.code.cache.AppkeyCache;
8
+import com.community.huiju.model.TaUser;
9
+import com.community.huiju.model.TpTicket;
10
+import com.community.huiju.service.ITaUserService;
11
+import com.community.huiju.vo.TaUserVO;
12
+import com.google.common.collect.Maps;
13
+import io.swagger.annotations.Api;
14
+import io.swagger.annotations.ApiImplicitParam;
15
+import io.swagger.annotations.ApiImplicitParams;
16
+import io.swagger.annotations.ApiOperation;
17
+import org.apache.catalina.User;
18
+import org.apache.ibatis.annotations.Param;
19
+import org.springframework.beans.BeanUtils;
20
+import org.springframework.beans.factory.annotation.Autowired;
21
+import org.springframework.beans.factory.annotation.Value;
22
+import org.springframework.cloud.context.config.annotation.RefreshScope;
23
+import org.springframework.web.bind.annotation.*;
24
+import org.springframework.web.multipart.MultipartFile;
25
+
26
+import javax.servlet.http.HttpSession;
27
+import javax.xml.crypto.dsig.keyinfo.PGPData;
28
+import java.util.List;
29
+import java.util.Map;
30
+
31
+/**
32
+ * 用户控制器
33
+ * @author weiximei
34
+ */
35
+@RestController
36
+@RefreshScope
37
+@RequestMapping("/")
38
+@Api(value = "用户相关操作的API",description = "用户相关操作的API")
39
+public class UserController extends BaseController {
40
+
41
+    @Autowired
42
+    private ITaUserService iTaUserService;
43
+
44
+    @ApiOperation(value = "登录", notes = "根据登录名和验证码")
45
+    @ApiImplicitParams({
46
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName(登陆名(手机号)) code(验证码)")
47
+    })
48
+    @RequestMapping(value = "/user/login",method = RequestMethod.POST)
49
+    public ResponseBean login(@RequestBody String parameter,
50
+                              HttpSession session){
51
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
52
+        ResponseBean responseBean = iTaUserService.login(jsonObject.getString("loginName"),jsonObject.getString("code"), session);
53
+        TaUserVO userVO = (TaUserVO) responseBean.getData();
54
+        if (null != userVO) {
55
+            setUserElement(userVO, session);
56
+        }
57
+        return responseBean;
58
+
59
+    }
60
+
61
+    @ApiOperation(value = "注册", notes = "注册")
62
+    @ApiImplicitParams({
63
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "userName用户姓名;idCard身份证;gender性别(1:男  2:女);loginName手机号;code验证码")
64
+    })
65
+    @RequestMapping(value = "/user/register",method = RequestMethod.POST)
66
+    public ResponseBean register(@RequestBody String parameter) {
67
+        ResponseBean responseBean = new ResponseBean();
68
+        responseBean = iTaUserService.register(parameter, true);
69
+        return responseBean;
70
+    }
71
+
72
+    @ApiOperation(value = "登录 绑定 房产", notes = "绑定选中的当前房产,进行登录 (在APP登录后,选择房产的时候),还可以用于切换房产登录")
73
+    @ApiImplicitParams({
74
+            @ApiImplicitParam(paramType = "path",dataTypeClass = String.class, name = "userVerifyId",value = "审核 id"),
75
+            @ApiImplicitParam(paramType = "header",dataTypeClass = String.class, name = "X-Auth-Token",value = "Token")
76
+    })
77
+    @RequestMapping(value = "/user/binding/login/{userVerifyId}",method = RequestMethod.POST)
78
+    public ResponseBean login(@PathVariable("userVerifyId") Integer userVerifyId,
79
+                              HttpSession session){
80
+        UserElement userElement = getUserElement(session);
81
+        ResponseBean responseBean = iTaUserService.bindingLoginAndHouse(userElement, userVerifyId);
82
+        TaUserVO userVO = (TaUserVO) responseBean.getData();
83
+        if (null != userVO) {
84
+            setUserElement(userVO, session);
85
+        }
86
+        return responseBean;
87
+
88
+    }
89
+
90
+    @ApiOperation(value = "修改手机号", notes = "修改手机号")
91
+    @ApiImplicitParams({
92
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "paramets",value = "phone:登陆(手机号),code:(手机验证码)"),
93
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
94
+    })
95
+            @RequestMapping(value = "/user/phone",method = RequestMethod.PUT)
96
+    public ResponseBean update(@RequestBody String paramets, HttpSession session){
97
+        ResponseBean responseBean = new ResponseBean();
98
+        UserElement userElement = getUserElement(session);
99
+        ResponseBean response=iTaUserService.updateLoginName(userElement, paramets);
100
+        return response;
101
+    }
102
+
103
+    @ApiOperation(value = "查看房屋成员列表", notes = "查看房屋成员列表")
104
+    @ApiImplicitParams({
105
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
106
+    })
107
+    @RequestMapping(value = "/roomUserList", method = RequestMethod.GET)
108
+    public ResponseBean accessTicket(HttpSession session){
109
+        ResponseBean responseBean = new ResponseBean();
110
+        UserElement userElement = getUserElement(session);
111
+        responseBean = iTaUserService.getAllRoomUserList(userElement);
112
+        return responseBean;
113
+    }
114
+
115
+    @ApiOperation(value = "修改用户名和性别和身份证", notes = "修改用户名和性别和身份证")
116
+    @ApiImplicitParams({
117
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "userName用户民和gender性别和idCard身份证"),
118
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
119
+    })
120
+    @RequestMapping(value = "/user/update/info",method = RequestMethod.PUT)
121
+    public ResponseBean updateUserNameAndGender(@RequestBody String parameter,
122
+                                                HttpSession session){
123
+        ResponseBean response = new ResponseBean();
124
+        UserElement userElement = getUserElement(session);
125
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
126
+        Map<String, Object> map = Maps.newHashMap();
127
+        map.put("userName", jsonObject.getString("userName"));
128
+        map.put("gender", jsonObject.getString("gender"));
129
+        map.put("idCard", jsonObject.getString("idCard"));
130
+        response = iTaUserService.modifyUser(userElement, JSONObject.toJSONString(map));
131
+        return response;
132
+
133
+    }
134
+
135
+    @ApiOperation(value = "租客或家属 启用或者停用", notes = "租客或家属 启用或者停用")
136
+    @ApiImplicitParams({
137
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "userId(租客或者家属) type(1启用 0停用)"),
138
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
139
+    })
140
+    @RequestMapping(value = "/user/dependentsOrTenants",method = RequestMethod.PUT)
141
+    @Deprecated
142
+    public ResponseBean updateDependentsOrTenants(@RequestBody String parameter,
143
+                                                HttpSession session){
144
+        ResponseBean response = new ResponseBean();
145
+
146
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
147
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
148
+        response = iTaUserService.startOrEndUsingUser(userElement.getId(),jsonObject.getInteger("userId"),jsonObject.getInteger("type"));
149
+
150
+        return response;
151
+
152
+    }
153
+
154
+
155
+    @ApiOperation(value = "业主添加 租客或家属", notes = "业主添加 租客或家属")
156
+    @ApiImplicitParams({
157
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "userName(租客或者家属 姓名) " +
158
+                    "loginName(租客或者家属 手机号) " +
159
+                    "gender(租客或者家属 性别 1男 2女) " +
160
+                    "roleName(TENANT 租客 RELATION 家属)" +
161
+                    "idCard(身份证号)" +
162
+                    "code(验证码)"),
163
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
164
+    })
165
+    @RequestMapping(value = "/user/addTenantsOrDependents",method = RequestMethod.POST)
166
+    public ResponseBean addTenantsOrDependents(@RequestBody String parameter,
167
+                                               HttpSession session){
168
+        ResponseBean response = new ResponseBean();
169
+
170
+        UserElement userElement = getUserElement(session);
171
+        response = iTaUserService.addTenantsOrDependents(userElement, parameter);
172
+        return response;
173
+
174
+    }
175
+
176
+
177
+    @ApiOperation(value = "业主修改 租客或家属", notes = "业主修改 租客或家属")
178
+    @ApiImplicitParams({
179
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "id(租客或者家属 ID) userName(租客或者家属 姓名) " +
180
+                    "phone(租客或者家属 手机号) " +
181
+                    "gender(租客或者家属 性别 1男 2女) " +
182
+                    "type(2租客 3家属)" +
183
+                    "idCard(身份证号)"),
184
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
185
+    })
186
+    @RequestMapping(value = "/user/updateTenantsOrDependents",method = RequestMethod.POST)
187
+    @Deprecated
188
+    public ResponseBean updateTenantsOrDependents(@RequestBody String parameter,
189
+                                               HttpSession session){
190
+        ResponseBean response = new ResponseBean();
191
+
192
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
193
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
194
+        response = iTaUserService.updateTenantsOrDependents(jsonObject.getString("userName"),
195
+                jsonObject.getString("phone"),jsonObject.getString("gender"),
196
+                userElement.getId(),
197
+                jsonObject.getInteger("type"),
198
+                jsonObject.getInteger("id"),
199
+                jsonObject.getString("idCard"));
200
+
201
+        return response;
202
+
203
+    }
204
+
205
+
206
+
207
+    @ApiOperation(value = "修改用户头像", notes = "修改用户头像")
208
+    @ApiImplicitParams({
209
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "headPortrait(用户头像)"),
210
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
211
+    })
212
+    @RequestMapping(value = "/user/modifyUserHeadPortrait",method = RequestMethod.PUT)
213
+    public ResponseBean modifyUserHeadPortrait(@RequestBody String parameter,
214
+                                               HttpSession session){
215
+
216
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
217
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
218
+        ResponseBean response = iTaUserService.modifyUserHeadPortrait(userElement.getId(),jsonObject.getString("headPortrait"));
219
+
220
+        return response;
221
+
222
+    }
223
+
224
+    @ApiOperation(value = "获取用户信息", notes = "获取用户信息, 携带userId表示查询租客或者家属")
225
+    @ApiImplicitParams({
226
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
227
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "userId",value = "租客或者家属的ID(可选值)"),
228
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "userVerifyId",value = "审核id,只有在 userId 参数生效才有效")
229
+    })
230
+    @RequestMapping(value = "/user/info",method = RequestMethod.GET)
231
+    public ResponseBean getUserInfo(@RequestParam(value = "userId",required = false) Integer userId, @RequestParam(value = "userVerifyId", required = false) Integer userVerifyId,
232
+                                    HttpSession session){
233
+        ResponseBean response = new ResponseBean();
234
+        UserElement userElement = getUserElement(session);
235
+        response = iTaUserService.getUserInfo(userElement,userId, userVerifyId, session);
236
+        Object data = response.getData();
237
+        if ("1".equals(response.getCode()) && null == data) {
238
+            // 清空 session
239
+            removeUserElement(session);
240
+            return response;
241
+        }
242
+        if (null == userId && null != data && data instanceof TaUserVO) {
243
+            setUserElement((TaUserVO) data, session);
244
+        }
245
+        TaUserVO userVO = (TaUserVO) data;
246
+        userVO.setToken(session.getId());
247
+
248
+        return response;
249
+
250
+    }
251
+
252
+
253
+    @ApiOperation(value = "游客登录", notes = "游客登录")
254
+    @RequestMapping(value = "/user/temporary/{communityId}", method = RequestMethod.POST)
255
+    public ResponseBean temporaryLogin(HttpSession session) {
256
+        ResponseBean responseBean = new ResponseBean();
257
+        responseBean = iTaUserService.temporaryLogin(session);
258
+        TaUserVO userVO = (TaUserVO) responseBean.getData();
259
+        if (null != userVO) {
260
+            setUserElement(userVO, session);
261
+        }
262
+        return responseBean;
263
+    }
264
+
265
+    @ApiOperation(value = "迎宾系统添加人员", notes = "迎宾系统添加人员")
266
+    @ApiImplicitParams({
267
+            @ApiImplicitParam(paramType = "form", dataTypeClass = String.class, value = "userName人员名称"),
268
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
269
+    })
270
+    @RequestMapping(value = "/user/welcome/add", method = RequestMethod.POST)
271
+    public ResponseBean welcomeAddUser(@RequestParam("userName") String userName, HttpSession session) {
272
+        ResponseBean responseBean = new ResponseBean();
273
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
274
+        TaUser user = new TaUser();
275
+        user.setUserName(userName);
276
+        responseBean = iTaUserService.addWelcomeUser(userElement, user);
277
+        return responseBean;
278
+    }
279
+
280
+    @RequestMapping(value = "/user/has/phone", method = RequestMethod.GET)
281
+    @ApiOperation(value = "校验 手机号是否注册", notes = "校验 手机号是否注册")
282
+    @ApiImplicitParams({
283
+            @ApiImplicitParam(paramType = "query", dataTypeClass = String.class, name = "phone", value = "手机号"),
284
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
285
+    })
286
+    public ResponseBean hasUserPhone(HttpSession session, @RequestParam("phone") String phone) {
287
+        ResponseBean responseBean = new ResponseBean();
288
+        UserElement userElement = getUserElement(session);
289
+        responseBean = iTaUserService.hasUserPhoneVerify(phone, userElement);
290
+        return responseBean;
291
+    }
292
+
293
+    @RequestMapping(value = "/user/tenantAndRelation/delete/{userVerifyId}", method = RequestMethod.DELETE)
294
+    @ApiOperation(value = "业主删除 家属或者租客", notes = "业主删除 家属或者租客")
295
+    @ApiImplicitParams({
296
+            @ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "userVerifyId", value = "审核 id"),
297
+            @ApiImplicitParam(paramType = "header",dataTypeClass = String.class,name = "X-Auth-Token",value = "Token")
298
+    })
299
+    public ResponseBean deleteTenantAndRelation(HttpSession session, @PathVariable("userVerifyId") Integer userVerifyId) {
300
+        ResponseBean responseBean = new ResponseBean();
301
+        UserElement userElement = getUserElement(session);
302
+        responseBean = iTaUserService.deleteTenantAndRelation(userElement, userVerifyId);
303
+        return responseBean;
304
+    }
305
+
306
+    @ApiOperation(value = "获取令牌", notes = "获取令牌")
307
+    @ApiImplicitParams({
308
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "appid", value = "提供的appid"),
309
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "datetime", value = "时间戳"),
310
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "encrypt", value = "encrypt加密方式(目前值为md5)"),
311
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "phone", value = "手机号"),
312
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "communityId", value = "提供的小区编号"),
313
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "sign", value = "生成的签名"),
314
+    })
315
+    @RequestMapping(value = "/user/token", method = RequestMethod.GET)
316
+    public ResponseBean daSuToken(@RequestParam("appid") String appid,
317
+                                  @RequestParam("datetime") String datetime,
318
+                                  @RequestParam("encrypt") String encrypt,
319
+                                  @RequestParam("phone") String phone,
320
+                                  @RequestParam("communityId") String communityId,
321
+                                  @RequestParam("sign") String sign,
322
+                                  HttpSession session){
323
+        ResponseBean responseBean = new ResponseBean();
324
+        responseBean = iTaUserService.daSuToken(appid, datetime, encrypt, communityId, phone, sign, session);
325
+        Object object = responseBean.getData();
326
+        if (null != object) {
327
+            TaUserVO userVO = (TaUserVO) responseBean.getData();
328
+            if (userVO != null) {
329
+                setUserElement(userVO, session);
330
+            }
331
+        }
332
+        return responseBean;
333
+    }
334
+
335
+    @ApiOperation(value = "app问题反馈", notes = "app问题反馈")
336
+    @ApiImplicitParams({
337
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "content:问题描述,imageUrl:反馈的图片,taUserTel:反馈人电话"),
338
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
339
+    })
340
+    @RequestMapping(value = "/user/addfeedback",method = RequestMethod.POST)
341
+    public ResponseBean addFeedback(@RequestBody String parameter, HttpSession session){
342
+        ResponseBean response = new ResponseBean();
343
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
344
+        response = iTaUserService.addFeedback(userElement,parameter);
345
+        return response;
346
+
347
+    }
348
+
349
+    @ApiOperation(value = "运营联系电话", notes = "运营联系电话")
350
+    @RequestMapping(value = "/user/operatetel",method = RequestMethod.GET)
351
+    public ResponseBean operatetel(){
352
+        ResponseBean response = new ResponseBean();
353
+        response = iTaUserService.operatetel();
354
+        return response;
355
+
356
+    }
357
+
358
+    @ApiOperation(value = "app问题反馈无关联房产", notes = "app问题反馈无关联房产")
359
+    @ApiImplicitParams({
360
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "content:问题描述,imageUrl:反馈的图片,taUserTel:反馈人电话"),
361
+    })
362
+    @RequestMapping(value = "/user/addfeedback/noproperty",method = RequestMethod.POST)
363
+    public ResponseBean noProperty(@RequestBody String parameter, HttpSession session){
364
+        ResponseBean response = new ResponseBean();
365
+        response = iTaUserService.noProperty(parameter);
366
+        return response;
367
+
368
+    }
369
+
370
+    @ApiOperation(value = "app问题反馈历史", notes = "app问题反馈历史")
371
+    @ApiImplicitParams({
372
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "taUserTel",value = "taUserTel:反馈人电话"),
373
+    })
374
+    @RequestMapping(value = "/user/noPropertyHistory",method = RequestMethod.GET)
375
+    public ResponseBean propertyHistory(@RequestParam("taUserTel") String taUserTel){
376
+        ResponseBean response = new ResponseBean();
377
+        response = iTaUserService.propertyHistory(taUserTel);
378
+        return response;
379
+
380
+    }
381
+    @ApiOperation(value = "app问题反馈历史详情", notes = "app问题反馈历史详情")
382
+    @ApiImplicitParams({
383
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "id",value = "反馈id"),
384
+    })
385
+    @RequestMapping(value = "/user/noPropertyHistory/details/{id}",method = RequestMethod.GET)
386
+    public ResponseBean propertyHistoryDdetails(@PathVariable("id") Integer id){
387
+        ResponseBean response = new ResponseBean();
388
+        response = iTaUserService.propertyHistoryDdetails(id);
389
+        return response;
390
+
391
+    }
392
+
393
+    @ApiOperation(value = "获取所有家属", notes = "获取所有家属")
394
+    @ApiImplicitParams({
395
+            @ApiImplicitParam(paramType = "header", dataType = "String", name = "X-Auth-Token", value = "Token")
396
+    })
397
+    @RequestMapping(value = "/user/relation/all", method = RequestMethod.GET)
398
+    public ResponseBean getRelationAll(HttpSession session) {
399
+        ResponseBean responseBean = new ResponseBean();
400
+        UserElement userElement = getUserElement(session);
401
+        responseBean = iTaUserService.getRelationAll(userElement);
402
+        return responseBean;
403
+    }
404
+
405
+    @ApiOperation(value = "切换户主", notes = "切换户主")
406
+    @ApiImplicitParams({
407
+            @ApiImplicitParam(paramType = "header", dataType = "String", name = "X-Auth-Token", value = "Token"),
408
+            @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "relationUserVerifyId", value = "被切换的家属房产审核id")
409
+    })
410
+    @RequestMapping(value = "/user/switchoverOwner/{relationUserVerifyId}", method = RequestMethod.PUT)
411
+    public ResponseBean switchoverOwner(HttpSession session, @PathVariable("relationUserVerifyId") Integer relationUserVerifyId) {
412
+        UserElement userElement = getUserElement(session);
413
+        ResponseBean responseBean = iTaUserService.switchoverOwner(userElement, relationUserVerifyId);
414
+        return responseBean;
415
+    }
416
+
417
+}

+ 98
- 0
app-api/src/main/java/com/community/huiju/controller/UserLicenseController.java 查看文件

@@ -0,0 +1,98 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.session.UserElement;
5
+import com.community.huiju.service.ITaUserLicenseOrderService;
6
+import com.community.huiju.service.ITaUserLicenseService;
7
+import io.swagger.annotations.Api;
8
+import io.swagger.annotations.ApiImplicitParam;
9
+import io.swagger.annotations.ApiImplicitParams;
10
+import io.swagger.annotations.ApiOperation;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.cloud.context.config.annotation.RefreshScope;
13
+import org.springframework.web.bind.annotation.PathVariable;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RequestMethod;
16
+import org.springframework.web.bind.annotation.RestController;
17
+
18
+import javax.servlet.http.HttpSession;
19
+
20
+@RestController
21
+@RefreshScope
22
+@RequestMapping("/")
23
+@Api(value = "用户车牌操作的API",description = "用户车牌操作的API")
24
+public class UserLicenseController extends BaseController {
25
+
26
+    @Autowired
27
+    private ITaUserLicenseService iTaUserLicenseService;
28
+
29
+    @Autowired
30
+    private ITaUserLicenseOrderService iTaUserLicenseOrderService;
31
+
32
+    @ApiOperation(value = "关联车牌", notes = "关联车牌")
33
+    @ApiImplicitParams({
34
+            @ApiImplicitParam(paramType = "path", dataTypeClass = String.class, name = "carNo", value = "车牌号"),
35
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
36
+    })
37
+    @RequestMapping(value = "/license/associated/{carNo}", method = RequestMethod.POST)
38
+    public ResponseBean associatedLicense(@PathVariable("carNo") String carNo, HttpSession session) {
39
+        ResponseBean responseBean = new ResponseBean();
40
+        UserElement userElement = getUserElement(session);
41
+        responseBean = iTaUserLicenseService.associatedLicense(userElement, carNo);
42
+        return responseBean;
43
+    }
44
+
45
+    @ApiOperation(value = "用户所有车牌", notes = "用户所有车牌")
46
+    @ApiImplicitParams({
47
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
48
+    })
49
+    @RequestMapping(value = "/license/user/all", method = RequestMethod.GET)
50
+    public ResponseBean getAllUserLicense(HttpSession session) {
51
+        ResponseBean responseBean = new ResponseBean();
52
+        UserElement userElement = getUserElement(session);
53
+        responseBean = iTaUserLicenseService.getAllUserLicense(userElement);
54
+
55
+        return responseBean;
56
+    }
57
+
58
+    @ApiOperation(value = "用户删除车牌", notes = "用户删除车牌")
59
+    @ApiImplicitParams({
60
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token"),
61
+            @ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "id", value = "车牌id")
62
+    })
63
+    @RequestMapping(value = "/license/user/{id}", method = RequestMethod.DELETE)
64
+    public ResponseBean deleteUserLicense(@PathVariable("id") Integer id,HttpSession session) {
65
+        ResponseBean responseBean = new ResponseBean();
66
+        UserElement userElement = getUserElement(session);
67
+        responseBean = iTaUserLicenseService.deleteUserLicense(userElement, id);
68
+
69
+        return responseBean;
70
+    }
71
+
72
+    @ApiOperation(value = "用户车辆缴费列表", notes = "用户车辆缴费列表")
73
+    @ApiImplicitParams({
74
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token"),
75
+    })
76
+    @RequestMapping(value = "/license/user/order", method = RequestMethod.GET)
77
+    public ResponseBean userLicenseOrder(HttpSession session) {
78
+        ResponseBean responseBean = new ResponseBean();
79
+        UserElement userElement = getUserElement(session);
80
+        responseBean = iTaUserLicenseOrderService.selectRecords(userElement);
81
+        return responseBean;
82
+    }
83
+
84
+    @ApiOperation(value = "获取用户车牌信息", notes = "获取用户车牌信息")
85
+    @ApiImplicitParams({
86
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token"),
87
+            @ApiImplicitParam(paramType = "path", dataTypeClass = String.class, name = "licenseId", value = "车牌id"),
88
+    })
89
+    @RequestMapping(value = "/license/user/{licenseId}", method = RequestMethod.GET)
90
+    public ResponseBean getUserLicenseAndUserId(HttpSession session, @PathVariable("licenseId") Integer licenseId) {
91
+        ResponseBean responseBean = new ResponseBean();
92
+        UserElement userElement = getUserElement(session);
93
+        responseBean = iTaUserLicenseService.getUserLicenseAndUserId(userElement, licenseId);
94
+        return responseBean;
95
+    }
96
+
97
+
98
+}

+ 119
- 0
app-api/src/main/java/com/community/huiju/controller/UserVerifyController.java 查看文件

@@ -0,0 +1,119 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.service.ITaUserService;
7
+import com.community.huiju.service.TaUserVerifyServicel;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiImplicitParam;
10
+import io.swagger.annotations.ApiImplicitParams;
11
+import io.swagger.annotations.ApiOperation;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.web.bind.annotation.*;
14
+
15
+import javax.servlet.http.HttpSession;
16
+
17
+/**
18
+ * app端用户审核
19
+ *
20
+ * @author weiximei
21
+ */
22
+@RestController
23
+@RequestMapping("/")
24
+@Api(value = "app端用户审核表", description = "app端用户审核表")
25
+public class UserVerifyController extends BaseController {
26
+
27
+    @Autowired
28
+    private TaUserVerifyServicel taUserVerifyServicel;
29
+
30
+    @RequestMapping(value = "/user/verify/{userVerifyId}", method = RequestMethod.GET)
31
+    @ApiOperation(value = "获取 一个房产信息", notes = "获取 一个房产信息")
32
+    @ApiImplicitParams({
33
+            @ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "userVerifyId", value = "审核房产 id"),
34
+    })
35
+    public ResponseBean getUserVerify(HttpSession session, @PathVariable("userVerifyId") Integer userVerifyId) {
36
+        ResponseBean responseBean = taUserVerifyServicel.getToAuditNotApproved(userVerifyId);
37
+        return responseBean;
38
+    }
39
+
40
+    @RequestMapping(value = "/user/verify/add", method = RequestMethod.POST)
41
+    @ApiOperation(value = "添加一个审核的房产", notes = "添加一个审核的房产")
42
+    @ApiImplicitParams({
43
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token"),
44
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "communityId小区编号;roleName角色名称;phaseId期;buildingId楼栋;unitId单元;levelId楼层;roomNoId户号")
45
+    })
46
+    public ResponseBean addUserVerify(@RequestBody String parameter, HttpSession session) {
47
+        ResponseBean responseBean = new ResponseBean();
48
+        UserElement userElement = getUserElement(session);
49
+        responseBean = taUserVerifyServicel.addUserVerify(userElement, parameter);
50
+        return responseBean;
51
+    }
52
+
53
+    @RequestMapping(value = "/user/verify/delete/{userVerifyId}", method = RequestMethod.DELETE)
54
+    @ApiOperation(value = "删除一个审核的房产", notes = "删除一个审核的房产")
55
+    @ApiImplicitParams({
56
+            @ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "userVerifyId", value = "审核房产 id")
57
+    })
58
+    public ResponseBean deleteUserVerify(@PathVariable("userVerifyId") Integer userVerifyId, HttpSession session) {
59
+        ResponseBean responseBean = new ResponseBean();
60
+        responseBean = taUserVerifyServicel.deleteUserVerify(userVerifyId);
61
+        return responseBean;
62
+    }
63
+
64
+    @RequestMapping(value = "/current_user/verify/delete/{userVerifyId}", method = RequestMethod.DELETE)
65
+    @ApiOperation(value = "删除当前用户 关联的房产", notes = "删除当前用户 关联的房产")
66
+    @ApiImplicitParams({
67
+            @ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "userVerifyId", value = "审核房产 id"),
68
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
69
+    })
70
+    public ResponseBean deleteCurrentUserVerify(@PathVariable("userVerifyId") Integer userVerifyId, HttpSession session) {
71
+        ResponseBean responseBean = new ResponseBean();
72
+        UserElement userElement = getUserElement(session);
73
+        responseBean = taUserVerifyServicel.deleteCurrentUserVerify(userElement, userVerifyId);
74
+        return responseBean;
75
+    }
76
+
77
+    @RequestMapping(value = "/user/verify/list", method = RequestMethod.GET)
78
+    @ApiOperation(value = "获取 当前用户关联的房产列表", notes = "获取 当前用户关联的房产列表")
79
+    @ApiImplicitParams({
80
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
81
+    })
82
+    public ResponseBean getByCurrentUser(HttpSession session) {
83
+        ResponseBean responseBean = new ResponseBean();
84
+        UserElement userElement = getUserElement(session);
85
+        responseBean = taUserVerifyServicel.getByCurrentUser(userElement);
86
+        return responseBean;
87
+    }
88
+
89
+
90
+    @RequestMapping(value = "/user/verify/{userVerifyId}", method = RequestMethod.PUT)
91
+    @ApiOperation(value = "业主审核用户", notes = "业主审核用户")
92
+    @ApiImplicitParams({
93
+            @ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "userVerifyId", value = "审核房产 id"),
94
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token"),
95
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "userVerifyStatus审核 1是审核通过   2是审核不通过;remark备注"),
96
+    })
97
+    public ResponseBean verifyUser(HttpSession session,
98
+                                   @PathVariable("userVerifyId") Integer userVerifyId,
99
+                                   @RequestBody String parameter) {
100
+        ResponseBean responseBean = new ResponseBean();
101
+        UserElement userElement = getUserElement(session);
102
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
103
+        responseBean = taUserVerifyServicel.verifyUser(userElement, userVerifyId, jsonObject.getString("userVerifyStatus"), jsonObject.getString("remark"));
104
+        return responseBean;
105
+    }
106
+
107
+
108
+    @RequestMapping(value = "/user_verify/add", method = RequestMethod.POST)
109
+    @ApiOperation(value = "添加一个审核的房产 大苏", notes = "添加一个审核的房产 大苏")
110
+    @ApiImplicitParams({
111
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "userId用户编号;communityId小区编号;roleName角色名称;phaseId期;buildingId楼栋;unitId单元;levelId楼层;roomNoId户号")
112
+    })
113
+    public ResponseBean addDaSuUserVerify(@RequestBody String parameter, HttpSession session) {
114
+        ResponseBean responseBean = new ResponseBean();
115
+        responseBean = taUserVerifyServicel.addDaSuUserVerify(parameter);
116
+        return responseBean;
117
+    }
118
+
119
+}

+ 87
- 0
app-api/src/main/java/com/community/huiju/controller/VistorController.java 查看文件

@@ -0,0 +1,87 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.constant.Constant;
5
+import com.community.commom.mode.ResponseBean;
6
+import com.community.commom.session.UserElement;
7
+import com.community.huiju.model.TaVisitor;
8
+import com.community.huiju.service.TaVistorServiceI;
9
+import io.swagger.annotations.Api;
10
+import io.swagger.annotations.ApiImplicitParam;
11
+import io.swagger.annotations.ApiImplicitParams;
12
+import io.swagger.annotations.ApiOperation;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.cloud.context.config.annotation.RefreshScope;
15
+import org.springframework.web.bind.annotation.*;
16
+
17
+import javax.servlet.http.HttpSession;
18
+import java.util.List;
19
+
20
+/**
21
+ * @author weichaochao
22
+ * @Title: VistorController
23
+ * @Description: 访客相关API
24
+ * @date 2018/11/1
25
+ */
26
+@RestController
27
+@RefreshScope
28
+@RequestMapping("/")
29
+@Api(value = "访客相关的API", description = "访客相关的API")
30
+public class VistorController extends BaseController {
31
+
32
+    @Autowired
33
+    private TaVistorServiceI vistorServiceI;
34
+
35
+    @RequestMapping(value = "/vistorDetail/{communityId}", method = RequestMethod.POST)
36
+    @ApiOperation(value = "创建访客", notes = "创建访客")
37
+    @ApiImplicitParams({
38
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
39
+            @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
40
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "parameter", value = "carLicense:车牌(数组),drivingStatus:0 是不开车 1是开车," +
41
+                    "visitorName:访问人姓名,visitorNum:访问人数,visitorTel:访问人电话,visitorStartTime:访问人开始时间,visitorEndTime:访问人结束时间,payEntity:支付方式(owmer是由我承担  visitor是访客承担)")})
42
+    public ResponseBean findVistorDetail(@PathVariable("communityId")Integer communityId, @RequestBody String parameter, HttpSession session) {
43
+        ResponseBean responseBean = new ResponseBean();
44
+
45
+        if (!check(communityId)) {
46
+            responseBean.addError("小区不存在");
47
+            return responseBean;
48
+        }
49
+
50
+        UserElement userElement = getUserElement(session);
51
+        TaVisitor taVisitor = JSONObject.parseObject(parameter,TaVisitor.class);
52
+        responseBean = vistorServiceI.insertTaVistor(taVisitor, userElement);
53
+        return  responseBean;
54
+    }
55
+
56
+    @RequestMapping(value = "/invateVistorHis/{communityId}", method = RequestMethod.GET)
57
+    @ApiOperation(value = "邀请历史", notes = "邀请历史")
58
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
59
+            @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id")})
60
+    public ResponseBean invateHis(@PathVariable("communityId")Integer communityId, HttpSession session) {
61
+        ResponseBean responseBean = new ResponseBean();
62
+
63
+        if (!check(communityId)) {
64
+            responseBean.addError("小区不存在");
65
+            return responseBean;
66
+        }
67
+
68
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
69
+        responseBean = vistorServiceI.invateHis(userElement);
70
+        return  responseBean;
71
+    }
72
+
73
+    @ApiOperation(value = "查询是否开启了访客邀请的车辆", notes = "查询是否开启了访客邀请的车辆")
74
+    @ApiImplicitParams({
75
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
76
+    })
77
+    @RequestMapping(value = "/invate_license/bool", method = RequestMethod.GET)
78
+    public ResponseBean invateBool(HttpSession session) {
79
+        ResponseBean responseBean = new ResponseBean();
80
+        UserElement userElement = getUserElement(session);
81
+        responseBean = vistorServiceI.invateBool(userElement);
82
+        return responseBean;
83
+    }
84
+
85
+
86
+
87
+}

+ 108
- 0
app-api/src/main/java/com/community/huiju/controller/WxLoginController.java 查看文件

@@ -0,0 +1,108 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.session.UserElement;
5
+import com.community.huiju.service.WxLoginServiceI;
6
+import com.community.huiju.vo.TaUserVO;
7
+import io.swagger.annotations.Api;
8
+import io.swagger.annotations.ApiImplicitParam;
9
+import io.swagger.annotations.ApiImplicitParams;
10
+import io.swagger.annotations.ApiOperation;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.cloud.context.config.annotation.RefreshScope;
13
+import org.springframework.util.StringUtils;
14
+import org.springframework.web.bind.annotation.*;
15
+
16
+import javax.servlet.http.HttpServletRequest;
17
+import javax.servlet.http.HttpSession;
18
+
19
+/**
20
+ * @author FXF
21
+ * @date 2019-03-29
22
+ */
23
+@RestController
24
+@RefreshScope
25
+@RequestMapping("/")
26
+@Api(value = "微信登录 API", description = "微信登录 API")
27
+public class WxLoginController extends BaseController {
28
+	
29
+	@Autowired
30
+	private WxLoginServiceI wxLoginService;
31
+	
32
+	/**
33
+	 * 微信登录
34
+	 */
35
+	@RequestMapping(value = "/wxLogin/{wxcode}", method = RequestMethod.POST)
36
+	public ResponseBean autoLogin(@PathVariable String wxcode, HttpServletRequest request) {
37
+		ResponseBean responseBean = new ResponseBean();
38
+		if (StringUtils.isEmpty(wxcode)){
39
+			responseBean.addError("fail");
40
+			return responseBean;
41
+		}
42
+		//根据wxcode获取openid
43
+		responseBean = wxLoginService.getOpenidByWxcode(wxcode, request.getSession());
44
+		Object data = responseBean.getData();
45
+		if (null != data && data instanceof TaUserVO) {
46
+			setUserElement((TaUserVO) data, request.getSession());
47
+		}
48
+		return responseBean;
49
+	}
50
+
51
+	/**
52
+	 * 关联微信账号
53
+	 * @return
54
+	 */
55
+	@RequestMapping(value = "/wx/associated", method = RequestMethod.POST)
56
+	@ApiOperation(value = "手机号和验证码 关联微信账号", notes = "手机号和验证码 关联微信账号")
57
+	@ApiImplicitParams({
58
+			@ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "loginName手机号;code验证码;openid微信标识;nickname微信用户名称;headimgurl微信头像")
59
+	})
60
+	public ResponseBean associatedWX(@RequestBody String parameter, HttpSession session) {
61
+		ResponseBean responseBean = new ResponseBean();
62
+		responseBean = wxLoginService.associatedWX(parameter);
63
+		TaUserVO userVO = (TaUserVO) responseBean.getData();
64
+		if (null != userVO) {
65
+			setUserElement(userVO, session);
66
+		}
67
+		return responseBean;
68
+	}
69
+
70
+	@ApiOperation(value = "注册", notes = "注册")
71
+	@ApiImplicitParams({
72
+			@ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "userName用户姓名;idCard身份证;gender性别(1:男  2:女);loginName手机号;code验证码;openid微信标识;nickname微信用户名称;headimgurl微信头像")
73
+	})
74
+	@RequestMapping(value = "/wx/register",method = RequestMethod.POST)
75
+	public ResponseBean register(@RequestBody String parameter, HttpServletRequest request ,HttpSession session) {
76
+		ResponseBean responseBean = new ResponseBean();
77
+		responseBean = wxLoginService.register(parameter, request);
78
+		TaUserVO userVO = (TaUserVO) responseBean.getData();
79
+		if (null != userVO) {
80
+			setUserElement(userVO, session);
81
+		}
82
+		return responseBean;
83
+	}
84
+
85
+	@RequestMapping(value = "/unbundlingWX", method = RequestMethod.PUT)
86
+	@ApiOperation(value = "解绑微信", notes = "解绑微信")
87
+	@ApiImplicitParams({
88
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
89
+	})
90
+	public ResponseBean unbundlingWX(HttpSession session) {
91
+		ResponseBean responseBean = new ResponseBean();
92
+		UserElement userElement = getUserElement(session);
93
+		responseBean = wxLoginService.unbundlingWX(userElement);
94
+		return responseBean;
95
+	}
96
+
97
+	@RequestMapping(value = "/bundlingWX/{wxcode}", method = RequestMethod.POST)
98
+	@ApiOperation(value = "绑定微信", notes = "绑定微信")
99
+	@ApiImplicitParams({
100
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
101
+	})
102
+	public ResponseBean bundlingWX(HttpSession session, @PathVariable("wxcode") String wxcode) {
103
+		ResponseBean responseBean = new ResponseBean();
104
+		UserElement userElement = getUserElement(session);
105
+		responseBean = wxLoginService.bundlingWX(userElement, wxcode);
106
+		return responseBean;
107
+	}
108
+}

+ 199
- 0
app-api/src/main/java/com/community/huiju/controller/WxMPUserController.java 查看文件

@@ -0,0 +1,199 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.community.commom.constant.Constant;
6
+import com.community.commom.mode.ResponseBean;
7
+import com.community.commom.session.UserElement;
8
+import com.community.huiju.common.wxmp.WxMPUtil;
9
+import com.community.huiju.common.wxpay.WXPayConstants;
10
+import com.community.huiju.common.wxpay.WXPayUtil;
11
+import com.community.huiju.feign.IFuShiServer;
12
+import com.community.huiju.feign.entity.ApiThirdPartyMonthCardPay;
13
+import com.community.huiju.service.WxMPUserServiceI;
14
+import com.google.common.collect.Maps;
15
+import io.swagger.annotations.Api;
16
+import io.swagger.annotations.ApiImplicitParam;
17
+import io.swagger.annotations.ApiImplicitParams;
18
+import io.swagger.annotations.ApiOperation;
19
+import org.slf4j.Logger;
20
+import org.slf4j.LoggerFactory;
21
+import org.springframework.beans.factory.annotation.Autowired;
22
+import org.springframework.beans.factory.annotation.Value;
23
+import org.springframework.cloud.context.config.annotation.RefreshScope;
24
+import org.springframework.web.bind.annotation.PathVariable;
25
+import org.springframework.web.bind.annotation.RequestMapping;
26
+import org.springframework.web.bind.annotation.RequestMethod;
27
+import org.springframework.web.bind.annotation.RequestParam;
28
+import org.springframework.web.bind.annotation.RestController;
29
+
30
+import javax.servlet.http.HttpServletRequest;
31
+import javax.servlet.http.HttpServletResponse;
32
+import javax.servlet.http.HttpSession;
33
+import java.io.ByteArrayOutputStream;
34
+import java.io.InputStream;
35
+import java.math.BigDecimal;
36
+import java.util.Map;
37
+
38
+/**
39
+ * @author FXF
40
+ * @date 2019-07-08
41
+ */
42
+@RestController
43
+@RefreshScope
44
+@RequestMapping("/")
45
+@Api(value = "微信公众号API", description = "微信公众号API")
46
+public class WxMPUserController {
47
+	
48
+	private Logger log = LoggerFactory.getLogger(WxMPUserController.class);
49
+	
50
+	@Value("${wx.mp.configs.appId}")
51
+	private String appId;
52
+	
53
+	@Value("${wx.mp.configs.secret}")
54
+	private String secret;
55
+	
56
+	@Autowired
57
+	private WxMPUserServiceI wxMPUserService;
58
+	
59
+	@Autowired
60
+	private IFuShiServer fuShiServer;
61
+
62
+	@RequestMapping(value = "/wxmp/info", method = RequestMethod.GET)
63
+	@ApiOperation(value = "获取微信公众号相关信息", notes = "获取微信公众号相关信息")
64
+	@ApiImplicitParams({})
65
+	public ResponseBean getWxMPinfo(){
66
+		ResponseBean responseBean = new ResponseBean();
67
+		Map<String,Object> map = Maps.newHashMap();
68
+		map.put("appId",appId);
69
+		responseBean.addSuccess(map);
70
+		return responseBean;
71
+	}
72
+	
73
+	@RequestMapping(value = "/{communityId}/wxmp", method = RequestMethod.GET)
74
+	@ApiOperation(value = "根据CODE获取OPENID并判断是否第一次来,并返回数据", notes = "根据CODE获取OPENID并判断是否第一次来,并返回数据")
75
+	@ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
76
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "微信code")})
77
+	public ResponseBean getOpenidByCode(@PathVariable Integer communityId, @RequestParam String code){
78
+		ResponseBean responseBean = wxMPUserService.getTemporaryData(code,appId,secret,communityId);
79
+		return responseBean;
80
+	}
81
+	
82
+	
83
+	@RequestMapping(value = "/{communityId}/wxmp/records", method = RequestMethod.GET)
84
+	@ApiOperation(value = "根据openid获取缴费记录", notes = "根据openid获取缴费记录")
85
+	@ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
86
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "openid", value = "微信openid")})
87
+	public ResponseBean getRecordsByOpenid(@PathVariable Integer communityId, @RequestParam String openid){
88
+		ResponseBean responseBean = wxMPUserService.getRecordsByOpenid(openid,communityId);
89
+		return responseBean;
90
+	}
91
+	
92
+	@RequestMapping(value = "/{communityId}/wxmp/car", method = RequestMethod.GET)
93
+	@ApiOperation(value = "根据车牌获取数据", notes = "根据车牌获取数据")
94
+	@ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
95
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "carNo", value = "车牌号")})
96
+	public ResponseBean getParkInfoByCarNo(@PathVariable Integer communityId, @RequestParam String carNo){
97
+		ResponseBean responseBean = new ResponseBean();
98
+		String parkInfoByCarNo = fuShiServer.getParkInfoByCarNo(carNo);
99
+		JSONObject carNoJson = JSONObject.parseObject(parkInfoByCarNo);
100
+		//车辆不在停车场
101
+		if (carNoJson.getInteger("code") == 1){
102
+			responseBean.addError(carNoJson.getString("message"));
103
+			return responseBean;
104
+		}
105
+		
106
+		if (carNoJson.getInteger("code") == 0 ){
107
+			if (carNoJson.getJSONObject("data").getInteger("DataType") != 3){
108
+				responseBean.addSuccess("储值车不支持在线缴费,月卡车请使用银城慧家APP延期续费");
109
+				return responseBean;
110
+			}
111
+			//返回查询的金额
112
+			JSONObject jsonParam = carNoJson.getJSONObject("data").getJSONObject("JsonParam");
113
+			Map<String,Object> resultMap = Maps.newHashMap();
114
+			resultMap.put("ActualAmount",jsonParam.get("ActualAmount"));
115
+			responseBean.addSuccess(resultMap);
116
+		}
117
+		return responseBean;
118
+	}
119
+	
120
+	@ApiOperation(value = "临时车统一下单", notes = "临时车统一下单")
121
+	@ApiImplicitParams({
122
+			@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
123
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "carNo", value = "车牌号"),
124
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "openid", value = "微信openid")
125
+	})
126
+	@RequestMapping(value = "/{communityId}/wxmp/order",method = RequestMethod.GET)
127
+	public ResponseBean wxTmpOrder(@PathVariable Integer communityId,
128
+	                               @RequestParam("carNo") String carNo,
129
+	                               @RequestParam("openid") String openid){
130
+		ResponseBean responseBean = new ResponseBean();
131
+		Map<String, String> resp = Maps.newHashMap();
132
+		try {
133
+			//String parkInfoByCarNo = fuShiServer.getParkInfoByCarNo(carNo);
134
+			//JSONObject carNoJson = JSONObject.parseObject(parkInfoByCarNo);
135
+			//String actualAmount = String.valueOf(Double.valueOf(((BigDecimal) carNoJson.getJSONObject("JsonParam").get("ActualAmount")).toString()) * 100);
136
+			//actualAmount = actualAmount.substring(0, actualAmount.lastIndexOf("."));
137
+			//resp = wxMPUserService.wxTmpOrder(carNo,actualAmount,communityId,openid,(BigDecimal) carNoJson.getJSONObject("JsonParam").get("ActualAmount"));
138
+			resp = wxMPUserService.wxTmpOrder(carNo,"1",communityId,openid,new BigDecimal("0.1"));
139
+		} catch (Exception e) {
140
+			e.printStackTrace();
141
+			responseBean.addError(e.getMessage());
142
+			return responseBean;
143
+		}
144
+		responseBean.addSuccess(resp);
145
+		return responseBean;
146
+	}
147
+	
148
+	@ApiOperation(value = "手机订单支付完成后回调临时车缴费", notes = "手机订单支付完成后回调临时车缴费")
149
+	@RequestMapping(value = "/wxTmpNotify",method = RequestMethod.POST)
150
+	public String wxBillNotify(HttpServletRequest request, HttpServletResponse response){
151
+		String failResult = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>" + "<return_msg><![CDATA[失败]]></return_msg>" + "</xml> ";
152
+		String successResult = "<xml>" + "<return_code><![CDATA[SUCCESS]]></return_code>" + "<return_msg><![CDATA[OK]]></return_msg>" + "</xml> ";
153
+		InputStream inStream;
154
+		try {
155
+			
156
+			inStream = request.getInputStream();
157
+			ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
158
+			byte[] buffer = new byte[1024];
159
+			int len = 0;
160
+			while ((len = inStream.read(buffer)) != -1) {
161
+				outSteam.write(buffer, 0, len);
162
+			}
163
+			
164
+			// 获取微信调用我们notify_url的返回信息
165
+			String result = new String(outSteam.toByteArray(), "utf-8");
166
+			WXPayUtil.getLogger().info("wxnotify:微信支付----result----=" + result);
167
+			
168
+			// 关闭流
169
+			outSteam.close();
170
+			inStream.close();
171
+			
172
+			// xml转换为map
173
+			Map<String, String> resultMap = WXPayUtil.xmlToMap(result);
174
+			if (WXPayConstants.SUCCESS.equalsIgnoreCase(resultMap.get("result_code"))) {
175
+				//推送富士系统
176
+				//Map<String,Object> temInfo = wxMPUserService.selectByOrderNumber(resultMap.get("out_trade_no"));
177
+				//temInfo.put("DeductionAmount","0");
178
+				//temInfo.put("Reason","");
179
+				//temInfo.put("PayStyle","微信");
180
+				//fuShiServer.apiThirdPartyTemporaryCardPay(JSON.toJSONString(temInfo));
181
+				//处理业务逻辑 修改订单状态等
182
+				String state = wxMPUserService.updateTmpOrder(resultMap.get("out_trade_no"));
183
+				if (state.equals("success")){
184
+					log.info("微信支付成功。。");
185
+					return successResult;
186
+				}
187
+			}else{
188
+				return failResult;
189
+			}
190
+			
191
+		} catch (Exception e) {
192
+			log.error("手机支付回调通知失败",e);
193
+			return failResult;
194
+			
195
+		}
196
+		
197
+		return failResult;
198
+	}
199
+}

+ 210
- 0
app-api/src/main/java/com/community/huiju/controller/WxPayController.java 查看文件

@@ -0,0 +1,210 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.constant.Constant;
5
+import com.community.commom.mode.ResponseBean;
6
+import com.community.commom.redis.RedisTemplate;
7
+import com.community.commom.session.UserElement;
8
+import com.community.huiju.common.wxpay.HfWxConfig;
9
+import com.community.huiju.common.wxpay.WXPay;
10
+import com.community.huiju.common.wxpay.WXPayConstants;
11
+import com.community.huiju.common.wxpay.WXPayUtil;
12
+import com.community.huiju.service.TaVistorServiceI;
13
+import com.community.huiju.service.WxPayServiceI;
14
+import com.google.common.collect.Maps;
15
+import io.swagger.annotations.Api;
16
+import io.swagger.annotations.ApiImplicitParam;
17
+import io.swagger.annotations.ApiImplicitParams;
18
+import io.swagger.annotations.ApiOperation;
19
+import org.slf4j.Logger;
20
+import org.slf4j.LoggerFactory;
21
+import org.springframework.beans.factory.annotation.Autowired;
22
+import org.springframework.cloud.context.config.annotation.RefreshScope;
23
+import org.springframework.web.bind.annotation.*;
24
+
25
+import javax.servlet.http.HttpServletRequest;
26
+import javax.servlet.http.HttpServletResponse;
27
+import javax.servlet.http.HttpSession;
28
+import java.io.ByteArrayOutputStream;
29
+import java.io.InputStream;
30
+import java.lang.reflect.Type;
31
+import java.util.*;
32
+
33
+/**
34
+ * @author FXF
35
+ * @date 2019-02-19
36
+ */
37
+@RestController
38
+@RefreshScope
39
+@RequestMapping("/")
40
+@Api(value = "微信支付 API", description = "微信支付 API")
41
+public class WxPayController {
42
+	private Logger log = LoggerFactory.getLogger(WxPayController.class);
43
+	
44
+	@Autowired
45
+	private WxPayServiceI wxPayService;
46
+	
47
+	@ApiOperation(value = "统一下单", notes = "统一下单")
48
+	@ApiImplicitParams({
49
+			@ApiImplicitParam(paramType = "path", dataType = "Integer", name = "outTradeNo", value = "订单号"),
50
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "订单类型: bill 表示订单,car 车缴费"),
51
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
52
+	})
53
+	@RequestMapping(value = "/wxUnifiedOrder/{outTradeNo}",method = RequestMethod.GET)
54
+	public ResponseBean wxUnifiedOrder(@PathVariable("outTradeNo") String outTradeNo,
55
+									   @RequestParam("type") String type,
56
+									   HttpSession session){
57
+		ResponseBean responseBean = new ResponseBean();
58
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
59
+		
60
+		Map<String, String> resp = Maps.newHashMap();
61
+		try {
62
+			resp = wxPayService.wxUnifiedOrder(outTradeNo, type,userElement);
63
+		} catch (Exception e) {
64
+			e.printStackTrace();
65
+			responseBean.addError(e.getMessage());
66
+			return responseBean;
67
+		}
68
+		log.info("调用微信支付参数: {}",resp);
69
+		responseBean.addSuccess(resp);
70
+		return responseBean;
71
+	}
72
+	
73
+	@ApiOperation(value = "手机订单支付完成后回调 物业缴费", notes = "手机订单支付完成后回调 物业缴费")
74
+	@RequestMapping(value = "/wxBillNotify",method = RequestMethod.POST)
75
+	public String wxBillNotify(HttpServletRequest request, HttpServletResponse response){
76
+		return wxNotify(request, Constant.PAY_TYPE_BILL);
77
+	}
78
+
79
+
80
+	@ApiOperation(value = "手机订单支付完成后回调 车缴费", notes = "手机订单支付完成后回调 车缴费")
81
+	@RequestMapping(value = "/wxCarNotify",method = RequestMethod.POST)
82
+	public String wxCarNotify(HttpServletRequest request, HttpServletResponse response){
83
+
84
+		return wxNotify(request, Constant.PAY_TYPE_CAR);
85
+	}
86
+
87
+	/**
88
+	 * 微信支付回调
89
+	 * @param request
90
+	 * @param type
91
+	 * @return
92
+	 */
93
+	private String wxNotify(HttpServletRequest request, String type) {
94
+		String failResult = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>" + "<return_msg><![CDATA[失败]]></return_msg>" + "</xml> ";
95
+		String successResult = "<xml>" + "<return_code><![CDATA[SUCCESS]]></return_code>" + "<return_msg><![CDATA[OK]]></return_msg>" + "</xml> ";
96
+		InputStream inStream;
97
+		try {
98
+
99
+			inStream = request.getInputStream();
100
+			ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
101
+			byte[] buffer = new byte[1024];
102
+			int len = 0;
103
+			while ((len = inStream.read(buffer)) != -1) {
104
+				outSteam.write(buffer, 0, len);
105
+			}
106
+
107
+			// 获取微信调用我们notify_url的返回信息
108
+			String result = new String(outSteam.toByteArray(), "utf-8");
109
+			WXPayUtil.getLogger().info("wxnotify:微信支付----result----=" + result);
110
+
111
+			// 关闭流
112
+			outSteam.close();
113
+			inStream.close();
114
+
115
+			// xml转换为map
116
+			Map<String, String> resultMap = WXPayUtil.xmlToMap(result);
117
+			if (WXPayConstants.SUCCESS.equalsIgnoreCase(resultMap.get("result_code"))) {
118
+				//处理业务逻辑 修改订单状态等
119
+				resultMap.put("pay_type","0");
120
+				String state = "";
121
+				if (Constant.PAY_TYPE_CAR.equals(type)) {
122
+					state = wxPayService.wxCarNotify(resultMap);
123
+				} else if (Constant.PAY_TYPE_BILL.equals(type)) {
124
+					state = wxPayService.wxBillNotify(resultMap);
125
+				}
126
+
127
+				if (state.equals("success")){
128
+					log.info("微信支付成功。。");
129
+					return successResult;
130
+				}
131
+			}else{
132
+				return failResult;
133
+			}
134
+
135
+		} catch (Exception e) {
136
+			log.error("手机支付回调通知失败",e);
137
+			return failResult;
138
+
139
+		}
140
+
141
+		return failResult;
142
+	}
143
+
144
+	
145
+	@ApiOperation(value = "订单查询", notes = "订单查询")
146
+	@ApiImplicitParams({
147
+			@ApiImplicitParam(paramType = "path", dataType = "Integer", name = "outTradeNo", value = "订单号")
148
+	})
149
+	@RequestMapping(value = "/wxOrderQuery/{outTradeNo}",method = RequestMethod.GET)
150
+	public ResponseBean wxOrderQuery(@PathVariable("outTradeNo") String outTradeNo){
151
+		ResponseBean responseBean = new ResponseBean();
152
+		Map<String, String> resp = Maps.newHashMap();
153
+		try {
154
+			resp = wxPayService.wxOrderQuery(outTradeNo);
155
+		} catch (Exception e) {
156
+			e.printStackTrace();
157
+			responseBean.addError("查询失败");
158
+			return responseBean;
159
+		}
160
+		responseBean.addSuccess(resp);
161
+		return responseBean;
162
+	}
163
+	
164
+	@ApiOperation(value = "准备开始支付", notes = "准备开始支付")
165
+	@ApiImplicitParams({
166
+			@ApiImplicitParam(paramType = "body", dataType = "String", name = "parameter", value = "idArray:账单Id集合, type: 类型(car 车缴费, bill 物业缴费), extensionMonth: 延期月份,也就是延期几个月!只有在 车缴费的时候才有效"),
167
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
168
+	})
169
+	@RequestMapping(value = "/wxStartPay",method = RequestMethod.POST)
170
+	public ResponseBean wxStartPay(@RequestBody String parameter, HttpSession session){
171
+		ResponseBean responseBean = new ResponseBean();
172
+		try {
173
+			UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
174
+			JSONObject jsonObject = JSONObject.parseObject(parameter);
175
+			Integer[] integers = jsonObject.getJSONArray("idArray").toArray(new Integer[]{});
176
+			String type = jsonObject.getString("type");
177
+			Integer extensionMonth = jsonObject.getInteger("extensionMonth");
178
+
179
+			String outTradeNo = wxPayService.wxStartPay(Arrays.asList(integers), type, extensionMonth,userElement);
180
+			Map<String,Object> resultMap = Maps.newHashMap();
181
+			resultMap.put("outTradeNo", outTradeNo);
182
+			responseBean.addSuccess(resultMap);
183
+		} catch (Exception e) {
184
+			e.printStackTrace();
185
+			responseBean.addError(e.getMessage());
186
+			return responseBean;
187
+		}
188
+		return responseBean;
189
+	}
190
+	
191
+	@ApiOperation(value = "取消支付", notes = "取消支付")
192
+	@ApiImplicitParams({
193
+			@ApiImplicitParam(paramType = "path", dataType = "String", name = "outTradeNo", value = "订单号"),
194
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "type: 类型(car 车缴费, bill 物业缴费)"),
195
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
196
+	})
197
+	@RequestMapping(value = "/wxCancelPay/{outTradeNo}",method = RequestMethod.GET)
198
+	public ResponseBean wxCancelPay(@PathVariable("outTradeNo") String outTradeNo, @RequestParam("type") String type,HttpSession session){
199
+		ResponseBean responseBean = new ResponseBean();
200
+		try {
201
+			UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
202
+			wxPayService.wxCancelPay(outTradeNo, type,userElement);
203
+		} catch (Exception e) {
204
+			e.printStackTrace();
205
+			responseBean.addError(e.getMessage());
206
+			return responseBean;
207
+		}
208
+		return responseBean;
209
+	}
210
+}

+ 19
- 0
app-api/src/main/java/com/community/huiju/dao/SysNationMapper.java 查看文件

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.SysNation;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface SysNationMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(SysNation record);
11
+
12
+    int insertSelective(SysNation record);
13
+
14
+    SysNation selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(SysNation record);
17
+
18
+    int updateByPrimaryKey(SysNation record);
19
+}

+ 19
- 0
app-api/src/main/java/com/community/huiju/dao/SysReportReasonMapper.java 查看文件

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.SysReportReason;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface SysReportReasonMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(SysReportReason record);
11
+
12
+    int insertSelective(SysReportReason record);
13
+
14
+    SysReportReason selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(SysReportReason record);
17
+
18
+    int updateByPrimaryKey(SysReportReason record);
19
+}

+ 24
- 0
app-api/src/main/java/com/community/huiju/dao/TaAgreementMapper.java 查看文件

@@ -0,0 +1,24 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaAgreement;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+import java.util.List;
7
+
8
+@Mapper
9
+public interface TaAgreementMapper {
10
+    int deleteByPrimaryKey(Integer id);
11
+
12
+    int insert(TaAgreement record);
13
+
14
+    int insertSelective(TaAgreement record);
15
+
16
+    TaAgreement selectByPrimaryKey(Integer id);
17
+
18
+    int updateByPrimaryKeySelective(TaAgreement record);
19
+
20
+    int updateByPrimaryKey(TaAgreement record);
21
+
22
+    TaAgreement getAgreement();
23
+
24
+}

+ 16
- 0
app-api/src/main/java/com/community/huiju/dao/TaBriskUserMapper.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaBriskUser;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.Date;
8
+import java.util.List;
9
+
10
+@Mapper
11
+public interface TaBriskUserMapper {
12
+	
13
+	List<TaBriskUser> selectByParams(@Param("userVerifyId") Integer userVerifyId, @Param("communityId") Integer communityId,@Param("nowDate") Date nowDate);
14
+	
15
+	int saveBriskUser(TaBriskUser taBriskUser);
16
+}

+ 39
- 0
app-api/src/main/java/com/community/huiju/dao/TaFaceMapper.java 查看文件

@@ -0,0 +1,39 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaFace;
4
+import com.community.huiju.model.TpTicket;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+@Mapper
9
+public interface TaFaceMapper{
10
+    int deleteByPrimaryKey(Integer id);
11
+
12
+    int insert(TaFace record);
13
+
14
+    int insertSelective(TaFace record);
15
+
16
+    int selectByPrimaryKey(Integer id);
17
+
18
+    void updateByPrimaryKeySelective(TaFace record);
19
+
20
+    /**
21
+     * 查看当前用户信息
22
+     * @param userVerifyId
23
+     * @return
24
+     */
25
+    TaFace getByUserVerifyId(@Param("userVerifyId") Integer userVerifyId);
26
+
27
+    /**
28
+     * 查看当前信息
29
+     * @param id
30
+     * @return
31
+     */
32
+    TaFace getById(@Param("id")Integer id);
33
+
34
+    /**
35
+     * 根据审核ID删除人脸信息
36
+     * @param verifyId
37
+     */
38
+    void deleteFace(@Param("verifyId") Integer verifyId);
39
+}

+ 30
- 0
app-api/src/main/java/com/community/huiju/dao/TaFeedbackImgMapper.java 查看文件

@@ -0,0 +1,30 @@
1
+package com.community.huiju.dao;
2
+
3
+
4
+import com.community.huiju.model.TaFeedbackImg;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+@Mapper
11
+public interface TaFeedbackImgMapper {
12
+    int deleteByPrimaryKey(Integer id);
13
+
14
+    int insert(TaFeedbackImg record);
15
+
16
+    int insertSelective(TaFeedbackImg record);
17
+
18
+    TaFeedbackImg selectByPrimaryKey(Integer id);
19
+
20
+    int updateByPrimaryKeySelective(TaFeedbackImg record);
21
+
22
+    int updateByPrimaryKey(TaFeedbackImg record);
23
+
24
+    /**
25
+     * 获取反馈当前图片
26
+     * @param id
27
+     * @return
28
+     */
29
+    List<String> selectImg(@Param("id") Integer id);
30
+}

+ 39
- 0
app-api/src/main/java/com/community/huiju/dao/TaFeedbackMapper.java 查看文件

@@ -0,0 +1,39 @@
1
+package com.community.huiju.dao;
2
+
3
+
4
+import com.community.huiju.model.TaFeedback;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+@Mapper
11
+public interface TaFeedbackMapper {
12
+    int deleteByPrimaryKey(Integer id);
13
+
14
+    int insert(TaFeedback record);
15
+
16
+    int insertSelective(TaFeedback record);
17
+
18
+    TaFeedback selectByPrimaryKey(Integer id);
19
+
20
+    int updateByPrimaryKeySelective(TaFeedback record);
21
+
22
+    int updateByPrimaryKey(TaFeedback record);
23
+
24
+    List<TaFeedback> getFeedback(@Param("content") String content, @Param("tel") String tel, @Param("handleStatus") String handleStatus);
25
+
26
+    /**
27
+     * 根据手机号码查询历史反馈
28
+     * @param loginName
29
+     * @return
30
+     */
31
+    List<TaFeedback> noPropertyHistory(@Param("loginName") String loginName);
32
+
33
+    /**
34
+     * 查询反馈详情
35
+     * @param id
36
+     * @return
37
+     */
38
+    TaFeedback propertyHistoryDdetails(@Param("id") Integer id);
39
+}

+ 19
- 0
app-api/src/main/java/com/community/huiju/dao/TaPublicMonitorMapper.java 查看文件

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaPublicMonitor;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface TaPublicMonitorMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(TaPublicMonitor record);
11
+
12
+    int insertSelective(TaPublicMonitor record);
13
+
14
+    TaPublicMonitor selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(TaPublicMonitor record);
17
+
18
+    int updateByPrimaryKey(TaPublicMonitor record);
19
+}

+ 19
- 0
app-api/src/main/java/com/community/huiju/dao/TaRemotelyDoorMapper.java 查看文件

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaRemotelyDoor;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface TaRemotelyDoorMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(TaRemotelyDoor record);
11
+
12
+    int insertSelective(TaRemotelyDoor record);
13
+
14
+    TaRemotelyDoor selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(TaRemotelyDoor record);
17
+
18
+    int updateByPrimaryKey(TaRemotelyDoor record);
19
+}

+ 19
- 0
app-api/src/main/java/com/community/huiju/dao/TaRemotelyMonitorMapper.java 查看文件

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaRemotelyMonitor;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface TaRemotelyMonitorMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(TaRemotelyMonitor record);
11
+
12
+    int insertSelective(TaRemotelyMonitor record);
13
+
14
+    TaRemotelyMonitor selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(TaRemotelyMonitor record);
17
+
18
+    int updateByPrimaryKey(TaRemotelyMonitor record);
19
+}

+ 24
- 0
app-api/src/main/java/com/community/huiju/dao/TaSysMenuImgMapper.java 查看文件

@@ -0,0 +1,24 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaSysMenuImg;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+@Mapper
10
+public interface TaSysMenuImgMapper {
11
+    int deleteByPrimaryKey(Integer id);
12
+
13
+    int insert(TaSysMenuImg record);
14
+
15
+    int insertSelective(TaSysMenuImg record);
16
+
17
+    TaSysMenuImg selectByPrimaryKey(Integer id);
18
+
19
+    int updateByPrimaryKeySelective(TaSysMenuImg record);
20
+
21
+    int updateByPrimaryKey(TaSysMenuImg record);
22
+    
23
+    List<TaSysMenuImg> selectByMenuId(@Param("id") Integer id);
24
+}

+ 29
- 0
app-api/src/main/java/com/community/huiju/dao/TaSysMenuMapper.java 查看文件

@@ -0,0 +1,29 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaSysMenu;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+@Mapper
10
+public interface TaSysMenuMapper {
11
+    int deleteByPrimaryKey(Integer id);
12
+
13
+    int insert(TaSysMenu record);
14
+
15
+    int insertSelective(TaSysMenu record);
16
+
17
+    TaSysMenu selectByPrimaryKey(Integer id);
18
+
19
+    int updateByPrimaryKeySelective(TaSysMenu record);
20
+
21
+    int updateByPrimaryKey(TaSysMenu record);
22
+    
23
+    /**
24
+     * 获取菜单列表
25
+     * @param communityId
26
+     * @return
27
+     */
28
+    List<TaSysMenu> selectByCommunity(@Param("communityId") Integer communityId);
29
+}

+ 36
- 0
app-api/src/main/java/com/community/huiju/dao/TaSysRoleMapper.java 查看文件

@@ -0,0 +1,36 @@
1
+package com.community.huiju.dao;
2
+
3
+
4
+import com.community.huiju.model.TaSysRole;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.ResultMap;
7
+import org.apache.ibatis.annotations.Select;
8
+
9
+import java.util.List;
10
+
11
+@Mapper
12
+public interface TaSysRoleMapper {
13
+    int deleteByPrimaryKey(Integer id);
14
+
15
+    int insert(TaSysRole record);
16
+
17
+    int insertSelective(TaSysRole record);
18
+
19
+    TaSysRole selectByPrimaryKey(Integer id);
20
+
21
+    int updateByPrimaryKeySelective(TaSysRole record);
22
+
23
+    int updateByPrimaryKey(TaSysRole record);
24
+
25
+    TaSysRole findRoleByUserId(Integer userId);
26
+
27
+    /**
28
+     * 根据 角色名称 查询
29
+     * @param roleName
30
+     * @return
31
+     */
32
+    @ResultMap("BaseResultMap")
33
+    @Select("select * from ta_sys_role where role_name=#{roleName}")
34
+    TaSysRole selectByRoleName(String roleName);
35
+
36
+}

+ 41
- 0
app-api/src/main/java/com/community/huiju/dao/TaSysUserRoleMapper.java 查看文件

@@ -0,0 +1,41 @@
1
+package com.community.huiju.dao;
2
+
3
+
4
+import com.community.huiju.model.TaSysUserRole;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.Map;
9
+
10
+@Mapper
11
+public interface TaSysUserRoleMapper {
12
+    int deleteByPrimaryKey(Integer id);
13
+
14
+    int insert(TaSysUserRole record);
15
+
16
+    int insertSelective(TaSysUserRole record);
17
+
18
+    TaSysUserRole selectByPrimaryKey(Integer id);
19
+
20
+    int updateByPrimaryKeySelective(TaSysUserRole record);
21
+
22
+    int updateByPrimaryKey(TaSysUserRole record);
23
+
24
+    Integer findSysUserRoleByUserIdAndRoleId(Integer userId);
25
+
26
+    /**
27
+     *    communityId 小区ID
28
+     *    userId 用户ID
29
+     *
30
+     * @param map
31
+     * @return
32
+     */
33
+    TaSysUserRole selectByCommunityIdAndUserId(Map<String,Object> map);
34
+
35
+    /**
36
+     *查询角色
37
+     * @param userId
38
+     * @return
39
+     */
40
+    TaSysUserRole selectRole(@Param("communityId") Integer communityId,@Param("userId") Integer userId);
41
+}

+ 22
- 0
app-api/src/main/java/com/community/huiju/dao/TaTemporaryLicenseOrderMapper.java 查看文件

@@ -0,0 +1,22 @@
1
+package com.community.huiju.dao;
2
+
3
+import org.apache.ibatis.annotations.Mapper;
4
+import org.apache.ibatis.annotations.Param;
5
+
6
+import java.math.BigDecimal;
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+@Mapper
11
+public interface TaTemporaryLicenseOrderMapper {
12
+	
13
+	List<Map<String, Object>> getLicensePlateByOpenid(@Param("openid") String openid,@Param("communityId") Integer communityId,@Param("paymentType") String paymentType);
14
+	
15
+	List<Map<String, Object>> getLicensePlateRecordsByOpenid(@Param("openid") String openid,@Param("communityId") Integer communityId,@Param("paymentType") String paymentType);
16
+	
17
+	int saveTmpOrder(@Param("communityId") Integer communityId, @Param("orderNo") String orderNo, @Param("actualAmount") String actualAmount, @Param("openid") String openid, @Param("carNo") String carNo,@Param("price") BigDecimal price,@Param("paymentType") String paymentType);
18
+	
19
+	int updateTmpOrder(@Param("outTradeNo") String outTradeNo, @Param("paymentType") String paymentType);
20
+	
21
+	Map<String, Object> selectByOrderNumber(@Param("outTradeNo") String outTradeNo, @Param("paymentType") String paymentType);
22
+}

+ 33
- 0
app-api/src/main/java/com/community/huiju/dao/TaUserHkMapper.java 查看文件

@@ -0,0 +1,33 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaUserHk;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.apache.ibatis.annotations.ResultMap;
7
+import org.apache.ibatis.annotations.Select;
8
+
9
+import java.util.List;
10
+
11
+@Mapper
12
+public interface TaUserHkMapper {
13
+    int deleteByPrimaryKey(Integer id);
14
+
15
+    int insert(TaUserHk record);
16
+
17
+    int insertSelective(TaUserHk record);
18
+
19
+    TaUserHk selectByPrimaryKey(Integer id);
20
+
21
+    int updateByPrimaryKeySelective(TaUserHk record);
22
+
23
+    int updateByPrimaryKey(TaUserHk record);
24
+
25
+    @ResultMap("BaseResultMap")
26
+    @Select("select * from ta_user_hk where ta_user_id = #{userVerifyId} and community_id = #{communityId}")
27
+    TaUserHk selectByUserVerifyIdAndCommunityId(@Param("userVerifyId") Integer userVerifyId, @Param("communityId") Integer communityId);
28
+
29
+    @ResultMap("BaseResultMap")
30
+    @Select("select * from ta_user_hk where community_id = #{communityId}")
31
+    List<TaUserHk> selectByCommunityId(@Param("communityId") Integer communityId);
32
+
33
+}

+ 52
- 0
app-api/src/main/java/com/community/huiju/dao/TaUserLicenseMapper.java 查看文件

@@ -0,0 +1,52 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaUserLicense;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.apache.ibatis.annotations.ResultMap;
7
+import org.apache.ibatis.annotations.Select;
8
+
9
+import java.util.List;
10
+
11
+@Mapper
12
+public interface TaUserLicenseMapper {
13
+    int deleteByPrimaryKey(Integer id);
14
+
15
+    int insert(TaUserLicense record);
16
+
17
+    int insertSelective(TaUserLicense record);
18
+
19
+    TaUserLicense selectByPrimaryKey(Integer id);
20
+
21
+    int updateByPrimaryKeySelective(TaUserLicense record);
22
+
23
+    int updateByPrimaryKey(TaUserLicense record);
24
+
25
+    /**
26
+     * 根据用户id 和 小区id 和 车牌号 进行查询
27
+     * @return
28
+     */
29
+    @ResultMap("BaseResultMap")
30
+    @Select("select * from ta_user_license where community_id=#{communityId} and ta_user_id = #{userId} and license_plate = #{licensePlate}")
31
+    TaUserLicense selectByUserIdAndCommunityIdAndLicensePlate(@Param("communityId") Integer communityId, @Param("userId") Integer userId, @Param("licensePlate") String licensePlate);
32
+
33
+    /**
34
+     * 根据用户id  和 小区 进行查询
35
+     * @param communityId
36
+     * @param userId
37
+     * @return
38
+     */
39
+    @ResultMap("BaseResultMap")
40
+    @Select("select * from ta_user_license where community_id=#{communityId} and ta_user_id = #{userId}")
41
+    List<TaUserLicense> selectAllByCommunityIdAndUserId(@Param("communityId") Integer communityId, @Param("userId") Integer userId);
42
+
43
+
44
+    /**
45
+     * 根据用户id 和 小区id 和 车牌id 进行查询
46
+     * @return
47
+     */
48
+    @ResultMap("BaseResultMap")
49
+    @Select("select * from ta_user_license where community_id=#{communityId} and ta_user_id = #{userId} and id = #{id}")
50
+    TaUserLicense selectByUserIdAndCommunityIdAndLicenseId(@Param("communityId") Integer communityId, @Param("userId") Integer userId, @Param("id") Integer id);
51
+
52
+}

+ 50
- 0
app-api/src/main/java/com/community/huiju/dao/TaUserLicenseOrderMapper.java 查看文件

@@ -0,0 +1,50 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaUserLicenseOrder;
4
+import com.community.huiju.model.TpBillOrder;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.apache.ibatis.annotations.ResultMap;
8
+import org.apache.ibatis.annotations.Select;
9
+
10
+import java.util.List;
11
+
12
+@Mapper
13
+public interface TaUserLicenseOrderMapper {
14
+    int deleteByPrimaryKey(Integer id);
15
+
16
+    int insert(TaUserLicenseOrder record);
17
+
18
+    int insertSelective(TaUserLicenseOrder record);
19
+
20
+    TaUserLicenseOrder selectByPrimaryKey(Integer id);
21
+
22
+    int updateByPrimaryKeySelective(TaUserLicenseOrder record);
23
+
24
+    int updateByPrimaryKey(TaUserLicenseOrder record);
25
+
26
+    /**
27
+     * 缴费记录
28
+     * @return
29
+     */
30
+    @ResultMap("BaseResultMap")
31
+    @Select("select * from ta_user_license_order where community_id = #{communityId} and ta_user_id = #{userId} and order_status = 1 order by update_date DESC")
32
+    List<TaUserLicenseOrder> selectRecords(@Param("communityId") Integer communityId, @Param("userId") Integer userId);
33
+
34
+    /**
35
+     * 根据订单号查询
36
+     * @param orderNo
37
+     * @return
38
+     */
39
+    @ResultMap("BaseResultMap")
40
+    @Select("select * from ta_user_license_order where order_number=#{orderNo}")
41
+    List<TaUserLicenseOrder> selectByOrderNumber(String orderNo);
42
+
43
+    /**
44
+     * 可关闭的订单
45
+     * @return
46
+     */
47
+    @ResultMap("BaseResultMap")
48
+    @Select("SELECT t.* from ta_user_license_order t where TIMESTAMPDIFF(MINUTE,create_date,now()) >= 10 and t.order_status in (0,2)")
49
+    List<TaUserLicenseOrder> selectCloseOrder();
50
+}

+ 115
- 0
app-api/src/main/java/com/community/huiju/dao/TaUserMapper.java 查看文件

@@ -0,0 +1,115 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaUser;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.apache.ibatis.annotations.ResultMap;
7
+import org.apache.ibatis.annotations.Select;
8
+
9
+import java.util.List;
10
+import java.util.Map;
11
+
12
+@Mapper
13
+public interface TaUserMapper {
14
+    int deleteByPrimaryKey(Integer id);
15
+
16
+    int insert(TaUser record);
17
+
18
+    int insertSelective(TaUser record);
19
+
20
+    TaUser selectByPrimaryKey(Integer id);
21
+
22
+    int updateByPrimaryKeySelective(TaUser record);
23
+
24
+    int updateByPrimaryKey(TaUser record);
25
+
26
+    /**
27
+     * 根据loginName和loginPassword 查询用户
28
+     * @param map
29
+     * @return 用户
30
+     */
31
+    TaUser selectByLoginNameAndByLoginPassword(Map<String, Object> map);
32
+
33
+    /**
34
+     * 根据loginName 查询用户
35
+     * @param map
36
+     * @return 用户
37
+     */
38
+    TaUser selectByLoginName(@Param("map") Map<String, Object> map);
39
+
40
+    /**
41
+     * 更新当前用户电话
42
+     * @param record
43
+     * @return
44
+     */
45
+    TaUser updateLongName(TaUser record);
46
+
47
+    /**
48
+     * 查询房屋成员列表
49
+     * @param communityId
50
+     * @param phaseId
51
+     * @param buildingId
52
+     * @param unitId
53
+     * @param levelId
54
+     * @param roomNoId
55
+     * @return
56
+     */
57
+    List<TaUser> selectHouseUserList(@Param("communityId") Integer communityId, @Param("phaseId") Integer phaseId, @Param("buildingId") Integer buildingId, @Param("unitId") Integer unitId, @Param("levelId") Integer levelId, @Param("roomNoId") Integer roomNoId, @Param("userId") Integer userId);
58
+
59
+    /**
60
+     * 判断当前用户的关联关系
61
+     * @param userId
62
+     * @param otherUserId
63
+     * @return
64
+     */
65
+    TaUser selectTaFaceParentId(@Param("id") Integer userId, @Param("otherUserId")Integer otherUserId);
66
+
67
+    /**
68
+     * 查询此电话在小区是否存在
69
+     * @param communityId
70
+     * @param phone
71
+     * @return
72
+     */
73
+    TaUser getByLoginName(@Param("communityId")Integer communityId, @Param("phone")String phone);
74
+
75
+    /**
76
+     * 根据手机号码查询多套房产
77
+     * @param loginName
78
+     * @return
79
+     */
80
+    List<TaUser> getByLoginNameList(@Param("loginName") String loginName);
81
+	
82
+	TaUser getByOpenId(@Param("openid") String openid);
83
+
84
+    /**
85
+     * 查询已审核通过的,但是没有 海康id 的用户
86
+     * @param communityId
87
+     * @return
88
+     */
89
+    @ResultMap("BaseResultMap")
90
+    @Select("SELECT " +
91
+            "tuv.id as userVerifyId, " +
92
+            "tuv.unit_id as unitId, " +
93
+            " tau.* " +
94
+            "FROM " +
95
+            " ta_user_verify tuv " +
96
+            " LEFT JOIN ta_user tau ON tuv.user_id = tau.id " +
97
+            " LEFT JOIN ta_user_hk tuh on tuv.user_id = tuh.ta_user_id " +
98
+            "WHERE " +
99
+            " tuv.verify_status = 1 " +
100
+            " AND tuv.community_id = #{communityId} " +
101
+            " and tuh.hk_user_id is NULL")
102
+    List<TaUser> selectNotHKuserId(@Param("communityId") Integer communityId);
103
+
104
+    /**
105
+     * 获取所有家属
106
+     * @param communityId
107
+     * @param phaseId
108
+     * @param buildingId
109
+     * @param unitId
110
+     * @param levelId
111
+     * @param roomNoId
112
+     * @return
113
+     */
114
+    List<TaUser> selectHouseRelationUserList(@Param("communityId") Integer communityId, @Param("phaseId") Integer phaseId, @Param("buildingId") Integer buildingId, @Param("unitId") Integer unitId, @Param("levelId") Integer levelId, @Param("roomNoId") Integer roomNoId);
115
+}

+ 0
- 0
app-api/src/main/java/com/community/huiju/dao/TaUserVerifyMapper.java 查看文件


部分文件因为文件数量过多而无法显示