Browse Source

first commit

张延森 3 years ago
commit
76b0611b97
100 changed files with 5231 additions and 0 deletions
  1. 43
    0
      .gitignore
  2. 310
    0
      mvnw
  3. 182
    0
      mvnw.cmd
  4. 236
    0
      pom.xml
  5. 16
    0
      src/main/java/com/yunzhi/training/SpringApplication.java
  6. 56
    0
      src/main/java/com/yunzhi/training/common/BaseController.java
  7. 9
    0
      src/main/java/com/yunzhi/training/common/Constants.java
  8. 37
    0
      src/main/java/com/yunzhi/training/common/DateUtils.java
  9. 17
    0
      src/main/java/com/yunzhi/training/common/EncryptUtils.java
  10. 27
    0
      src/main/java/com/yunzhi/training/common/ExcelUtils.java
  11. 104
    0
      src/main/java/com/yunzhi/training/common/JWTUtils.java
  12. 11
    0
      src/main/java/com/yunzhi/training/common/MathUtils.java
  13. 166
    0
      src/main/java/com/yunzhi/training/common/OSSUtils.java
  14. 76
    0
      src/main/java/com/yunzhi/training/common/ResponseBean.java
  15. 145
    0
      src/main/java/com/yunzhi/training/common/SMSCaptcha.java
  16. 71
    0
      src/main/java/com/yunzhi/training/common/SMSUtils.java
  17. 203
    0
      src/main/java/com/yunzhi/training/common/StringUtils.java
  18. 53
    0
      src/main/java/com/yunzhi/training/common/excelConverter/LocalDateTimeConverter.java
  19. 53
    0
      src/main/java/com/yunzhi/training/common/excelConverter/LocalDayConverter.java
  20. 55
    0
      src/main/java/com/yunzhi/training/common/excelConverter/MoneyConverter.java
  21. 40
    0
      src/main/java/com/yunzhi/training/config/AliyunConfig.java
  22. 35
    0
      src/main/java/com/yunzhi/training/config/BaseConfig.java
  23. 28
    0
      src/main/java/com/yunzhi/training/config/CorsConfig.java
  24. 32
    0
      src/main/java/com/yunzhi/training/config/InterceptorConfig.java
  25. 21
    0
      src/main/java/com/yunzhi/training/config/LoggingFilterConfig.java
  26. 14
    0
      src/main/java/com/yunzhi/training/config/MybatisPlusConfig.java
  27. 24
    0
      src/main/java/com/yunzhi/training/config/SwagggerConfig.java
  28. 102
    0
      src/main/java/com/yunzhi/training/controller/CommController.java
  29. 151
    0
      src/main/java/com/yunzhi/training/controller/LoginController.java
  30. 119
    0
      src/main/java/com/yunzhi/training/controller/SysUserController.java
  31. 119
    0
      src/main/java/com/yunzhi/training/controller/TaActivityController.java
  32. 119
    0
      src/main/java/com/yunzhi/training/controller/TaActivitySignController.java
  33. 119
    0
      src/main/java/com/yunzhi/training/controller/TaAnswerController.java
  34. 119
    0
      src/main/java/com/yunzhi/training/controller/TaAttachmentController.java
  35. 119
    0
      src/main/java/com/yunzhi/training/controller/TaPersonController.java
  36. 119
    0
      src/main/java/com/yunzhi/training/controller/TaQuePersonController.java
  37. 119
    0
      src/main/java/com/yunzhi/training/controller/TaQuestionController.java
  38. 119
    0
      src/main/java/com/yunzhi/training/controller/TaQuestionPersonController.java
  39. 119
    0
      src/main/java/com/yunzhi/training/controller/TaQuestionnaireController.java
  40. 201
    0
      src/main/java/com/yunzhi/training/controller/WxMpController.java
  41. 52
    0
      src/main/java/com/yunzhi/training/entity/SysUser.java
  42. 55
    0
      src/main/java/com/yunzhi/training/entity/TaActivity.java
  43. 43
    0
      src/main/java/com/yunzhi/training/entity/TaActivitySign.java
  44. 52
    0
      src/main/java/com/yunzhi/training/entity/TaAnswer.java
  45. 52
    0
      src/main/java/com/yunzhi/training/entity/TaAttachment.java
  46. 55
    0
      src/main/java/com/yunzhi/training/entity/TaPerson.java
  47. 49
    0
      src/main/java/com/yunzhi/training/entity/TaQuePerson.java
  48. 49
    0
      src/main/java/com/yunzhi/training/entity/TaQuestion.java
  49. 52
    0
      src/main/java/com/yunzhi/training/entity/TaQuestionPerson.java
  50. 43
    0
      src/main/java/com/yunzhi/training/entity/TaQuestionnaire.java
  51. 19
    0
      src/main/java/com/yunzhi/training/exception/GlobalExceptionHandler.java
  52. 47
    0
      src/main/java/com/yunzhi/training/interceptor/PermissionInterceptor.java
  53. 79
    0
      src/main/java/com/yunzhi/training/log/MysqlAppender.java
  54. 18
    0
      src/main/java/com/yunzhi/training/mapper/SysUserMapper.java
  55. 18
    0
      src/main/java/com/yunzhi/training/mapper/TaActivityMapper.java
  56. 18
    0
      src/main/java/com/yunzhi/training/mapper/TaActivitySignMapper.java
  57. 18
    0
      src/main/java/com/yunzhi/training/mapper/TaAnswerMapper.java
  58. 18
    0
      src/main/java/com/yunzhi/training/mapper/TaAttachmentMapper.java
  59. 18
    0
      src/main/java/com/yunzhi/training/mapper/TaPersonMapper.java
  60. 18
    0
      src/main/java/com/yunzhi/training/mapper/TaQuePersonMapper.java
  61. 18
    0
      src/main/java/com/yunzhi/training/mapper/TaQuestionMapper.java
  62. 18
    0
      src/main/java/com/yunzhi/training/mapper/TaQuestionPersonMapper.java
  63. 18
    0
      src/main/java/com/yunzhi/training/mapper/TaQuestionnaireMapper.java
  64. 14
    0
      src/main/java/com/yunzhi/training/service/IBaseService.java
  65. 17
    0
      src/main/java/com/yunzhi/training/service/ISysUserService.java
  66. 16
    0
      src/main/java/com/yunzhi/training/service/ITaActivityService.java
  67. 16
    0
      src/main/java/com/yunzhi/training/service/ITaActivitySignService.java
  68. 16
    0
      src/main/java/com/yunzhi/training/service/ITaAnswerService.java
  69. 16
    0
      src/main/java/com/yunzhi/training/service/ITaAttachmentService.java
  70. 16
    0
      src/main/java/com/yunzhi/training/service/ITaPersonService.java
  71. 16
    0
      src/main/java/com/yunzhi/training/service/ITaQuePersonService.java
  72. 16
    0
      src/main/java/com/yunzhi/training/service/ITaQuestionPersonService.java
  73. 16
    0
      src/main/java/com/yunzhi/training/service/ITaQuestionService.java
  74. 16
    0
      src/main/java/com/yunzhi/training/service/ITaQuestionnaireService.java
  75. 23
    0
      src/main/java/com/yunzhi/training/service/impl/BaseServiceImpl.java
  76. 30
    0
      src/main/java/com/yunzhi/training/service/impl/SysUserServiceImpl.java
  77. 20
    0
      src/main/java/com/yunzhi/training/service/impl/TaActivityServiceImpl.java
  78. 20
    0
      src/main/java/com/yunzhi/training/service/impl/TaActivitySignServiceImpl.java
  79. 20
    0
      src/main/java/com/yunzhi/training/service/impl/TaAnswerServiceImpl.java
  80. 20
    0
      src/main/java/com/yunzhi/training/service/impl/TaAttachmentServiceImpl.java
  81. 20
    0
      src/main/java/com/yunzhi/training/service/impl/TaPersonServiceImpl.java
  82. 20
    0
      src/main/java/com/yunzhi/training/service/impl/TaQuePersonServiceImpl.java
  83. 20
    0
      src/main/java/com/yunzhi/training/service/impl/TaQuestionPersonServiceImpl.java
  84. 20
    0
      src/main/java/com/yunzhi/training/service/impl/TaQuestionServiceImpl.java
  85. 20
    0
      src/main/java/com/yunzhi/training/service/impl/TaQuestionnaireServiceImpl.java
  86. 16
    0
      src/main/java/com/yunzhi/training/vo/AdminLoginParam.java
  87. 16
    0
      src/main/java/com/yunzhi/training/vo/ChangePassword.java
  88. 25
    0
      src/main/java/com/yunzhi/training/vo/CharacterInstWithWords.java
  89. 20
    0
      src/main/java/com/yunzhi/training/vo/LoginParam.java
  90. 17
    0
      src/main/java/com/yunzhi/training/vo/QuestionVO.java
  91. 56
    0
      src/main/java/com/yunzhi/training/vo/TokenParam.java
  92. 16
    0
      src/main/resources/application-dev.yml
  93. 21
    0
      src/main/resources/application-prod.yml
  94. 50
    0
      src/main/resources/application.yml
  95. 31
    0
      src/main/resources/logback.xml.bak
  96. 5
    0
      src/main/resources/mapper/SysUserMapper.xml
  97. 5
    0
      src/main/resources/mapper/TaActivityMapper.xml
  98. 5
    0
      src/main/resources/mapper/TaActivitySignMapper.xml
  99. 5
    0
      src/main/resources/mapper/TaAnswerMapper.xml
  100. 0
    0
      src/main/resources/mapper/TaAttachmentMapper.xml

+ 43
- 0
.gitignore View File

1
+HELP.md
2
+target/
3
+out/
4
+!.mvn/wrapper/maven-wrapper.jar
5
+!**/src/main/**/target/
6
+!**/src/test/**/target/
7
+
8
+### STS ###
9
+.apt_generated
10
+.classpath
11
+.factorypath
12
+.project
13
+.settings
14
+.springBeans
15
+.sts4-cache
16
+
17
+### IntelliJ IDEA ###
18
+.idea
19
+*.iws
20
+*.iml
21
+*.ipr
22
+
23
+### NetBeans ###
24
+/nbproject/private/
25
+/nbbuild/
26
+/dist/
27
+/nbdist/
28
+/.nb-gradle/
29
+build/
30
+!**/src/main/**/build/
31
+!**/src/test/**/build/
32
+
33
+### VS Code ###
34
+.vscode/
35
+
36
+
37
+### serverless ###
38
+/deploy/*.jar
39
+/deploy/*.zip
40
+/deploy/.fun/
41
+/deploy/.env
42
+
43
+cert/

+ 310
- 0
mvnw View File

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
+# Maven 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 Mingw, 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
+fi
118
+
119
+if [ -z "$JAVA_HOME" ]; then
120
+  javaExecutable="`which javac`"
121
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
122
+    # readlink(1) is not available as standard on Solaris 10.
123
+    readLink=`which readlink`
124
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
125
+      if $darwin ; then
126
+        javaHome="`dirname \"$javaExecutable\"`"
127
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
128
+      else
129
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
130
+      fi
131
+      javaHome="`dirname \"$javaExecutable\"`"
132
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
133
+      JAVA_HOME="$javaHome"
134
+      export JAVA_HOME
135
+    fi
136
+  fi
137
+fi
138
+
139
+if [ -z "$JAVACMD" ] ; then
140
+  if [ -n "$JAVA_HOME"  ] ; then
141
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
142
+      # IBM's JDK on AIX uses strange locations for the executables
143
+      JAVACMD="$JAVA_HOME/jre/sh/java"
144
+    else
145
+      JAVACMD="$JAVA_HOME/bin/java"
146
+    fi
147
+  else
148
+    JAVACMD="`which java`"
149
+  fi
150
+fi
151
+
152
+if [ ! -x "$JAVACMD" ] ; then
153
+  echo "Error: JAVA_HOME is not defined correctly." >&2
154
+  echo "  We cannot execute $JAVACMD" >&2
155
+  exit 1
156
+fi
157
+
158
+if [ -z "$JAVA_HOME" ] ; then
159
+  echo "Warning: JAVA_HOME environment variable is not set."
160
+fi
161
+
162
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
163
+
164
+# traverses directory structure from process work directory to filesystem root
165
+# first directory with .mvn subdirectory is considered project base directory
166
+find_maven_basedir() {
167
+
168
+  if [ -z "$1" ]
169
+  then
170
+    echo "Path not specified to find_maven_basedir"
171
+    return 1
172
+  fi
173
+
174
+  basedir="$1"
175
+  wdir="$1"
176
+  while [ "$wdir" != '/' ] ; do
177
+    if [ -d "$wdir"/.mvn ] ; then
178
+      basedir=$wdir
179
+      break
180
+    fi
181
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
182
+    if [ -d "${wdir}" ]; then
183
+      wdir=`cd "$wdir/.."; pwd`
184
+    fi
185
+    # end of workaround
186
+  done
187
+  echo "${basedir}"
188
+}
189
+
190
+# concatenates all lines of a file
191
+concat_lines() {
192
+  if [ -f "$1" ]; then
193
+    echo "$(tr -s '\n' ' ' < "$1")"
194
+  fi
195
+}
196
+
197
+BASE_DIR=`find_maven_basedir "$(pwd)"`
198
+if [ -z "$BASE_DIR" ]; then
199
+  exit 1;
200
+fi
201
+
202
+##########################################################################################
203
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
204
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
205
+##########################################################################################
206
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
207
+    if [ "$MVNW_VERBOSE" = true ]; then
208
+      echo "Found .mvn/wrapper/maven-wrapper.jar"
209
+    fi
210
+else
211
+    if [ "$MVNW_VERBOSE" = true ]; then
212
+      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
213
+    fi
214
+    if [ -n "$MVNW_REPOURL" ]; then
215
+      jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
216
+    else
217
+      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
218
+    fi
219
+    while IFS="=" read key value; do
220
+      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
221
+      esac
222
+    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
223
+    if [ "$MVNW_VERBOSE" = true ]; then
224
+      echo "Downloading from: $jarUrl"
225
+    fi
226
+    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
227
+    if $cygwin; then
228
+      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
229
+    fi
230
+
231
+    if command -v wget > /dev/null; then
232
+        if [ "$MVNW_VERBOSE" = true ]; then
233
+          echo "Found wget ... using wget"
234
+        fi
235
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
236
+            wget "$jarUrl" -O "$wrapperJarPath"
237
+        else
238
+            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
239
+        fi
240
+    elif command -v curl > /dev/null; then
241
+        if [ "$MVNW_VERBOSE" = true ]; then
242
+          echo "Found curl ... using curl"
243
+        fi
244
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
245
+            curl -o "$wrapperJarPath" "$jarUrl" -f
246
+        else
247
+            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
248
+        fi
249
+
250
+    else
251
+        if [ "$MVNW_VERBOSE" = true ]; then
252
+          echo "Falling back to using Java to download"
253
+        fi
254
+        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
255
+        # For Cygwin, switch paths to Windows format before running javac
256
+        if $cygwin; then
257
+          javaClass=`cygpath --path --windows "$javaClass"`
258
+        fi
259
+        if [ -e "$javaClass" ]; then
260
+            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
261
+                if [ "$MVNW_VERBOSE" = true ]; then
262
+                  echo " - Compiling MavenWrapperDownloader.java ..."
263
+                fi
264
+                # Compiling the Java class
265
+                ("$JAVA_HOME/bin/javac" "$javaClass")
266
+            fi
267
+            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
268
+                # Running the downloader
269
+                if [ "$MVNW_VERBOSE" = true ]; then
270
+                  echo " - Running MavenWrapperDownloader.java ..."
271
+                fi
272
+                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
273
+            fi
274
+        fi
275
+    fi
276
+fi
277
+##########################################################################################
278
+# End of extension
279
+##########################################################################################
280
+
281
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
282
+if [ "$MVNW_VERBOSE" = true ]; then
283
+  echo $MAVEN_PROJECTBASEDIR
284
+fi
285
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
286
+
287
+# For Cygwin, switch paths to Windows format before running java
288
+if $cygwin; then
289
+  [ -n "$M2_HOME" ] &&
290
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
291
+  [ -n "$JAVA_HOME" ] &&
292
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
293
+  [ -n "$CLASSPATH" ] &&
294
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
295
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
296
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
297
+fi
298
+
299
+# Provide a "standardized" way to retrieve the CLI args that will
300
+# work with both Windows and non-Windows executions.
301
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
302
+export MAVEN_CMD_LINE_ARGS
303
+
304
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
305
+
306
+exec "$JAVACMD" \
307
+  $MAVEN_OPTS \
308
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
309
+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
310
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 182
- 0
mvnw.cmd View File

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 Maven 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 keystroke 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 set title of command window
39
+title %0
40
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
41
+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
42
+
43
+@REM set %HOME% to equivalent of $HOME
44
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
45
+
46
+@REM Execute a user defined script before this one
47
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
48
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
49
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
50
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
51
+:skipRcPre
52
+
53
+@setlocal
54
+
55
+set ERROR_CODE=0
56
+
57
+@REM To isolate internal variables from possible post scripts, we use another setlocal
58
+@setlocal
59
+
60
+@REM ==== START VALIDATION ====
61
+if not "%JAVA_HOME%" == "" goto OkJHome
62
+
63
+echo.
64
+echo Error: JAVA_HOME not found in your environment. >&2
65
+echo Please set the JAVA_HOME variable in your environment to match the >&2
66
+echo location of your Java installation. >&2
67
+echo.
68
+goto error
69
+
70
+:OkJHome
71
+if exist "%JAVA_HOME%\bin\java.exe" goto init
72
+
73
+echo.
74
+echo Error: JAVA_HOME is set to an invalid directory. >&2
75
+echo JAVA_HOME = "%JAVA_HOME%" >&2
76
+echo Please set the JAVA_HOME variable in your environment to match the >&2
77
+echo location of your Java installation. >&2
78
+echo.
79
+goto error
80
+
81
+@REM ==== END VALIDATION ====
82
+
83
+:init
84
+
85
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86
+@REM Fallback to current working directory if not found.
87
+
88
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
89
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
90
+
91
+set EXEC_DIR=%CD%
92
+set WDIR=%EXEC_DIR%
93
+:findBaseDir
94
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
95
+cd ..
96
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
97
+set WDIR=%CD%
98
+goto findBaseDir
99
+
100
+:baseDirFound
101
+set MAVEN_PROJECTBASEDIR=%WDIR%
102
+cd "%EXEC_DIR%"
103
+goto endDetectBaseDir
104
+
105
+:baseDirNotFound
106
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
107
+cd "%EXEC_DIR%"
108
+
109
+:endDetectBaseDir
110
+
111
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
112
+
113
+@setlocal EnableExtensions EnableDelayedExpansion
114
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
115
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
116
+
117
+:endReadAdditionalConfig
118
+
119
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122
+
123
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
124
+
125
+FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126
+    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127
+)
128
+
129
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131
+if exist %WRAPPER_JAR% (
132
+    if "%MVNW_VERBOSE%" == "true" (
133
+        echo Found %WRAPPER_JAR%
134
+    )
135
+) else (
136
+    if not "%MVNW_REPOURL%" == "" (
137
+        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
138
+    )
139
+    if "%MVNW_VERBOSE%" == "true" (
140
+        echo Couldn't find %WRAPPER_JAR%, downloading it ...
141
+        echo Downloading from: %DOWNLOAD_URL%
142
+    )
143
+
144
+    powershell -Command "&{"^
145
+		"$webclient = new-object System.Net.WebClient;"^
146
+		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147
+		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148
+		"}"^
149
+		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150
+		"}"
151
+    if "%MVNW_VERBOSE%" == "true" (
152
+        echo Finished downloading %WRAPPER_JAR%
153
+    )
154
+)
155
+@REM End of extension
156
+
157
+@REM Provide a "standardized" way to retrieve the CLI args that will
158
+@REM work with both Windows and non-Windows executions.
159
+set MAVEN_CMD_LINE_ARGS=%*
160
+
161
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
162
+if ERRORLEVEL 1 goto error
163
+goto end
164
+
165
+:error
166
+set ERROR_CODE=1
167
+
168
+:end
169
+@endlocal & set ERROR_CODE=%ERROR_CODE%
170
+
171
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
172
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
173
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
174
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
175
+:skipRcPost
176
+
177
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
178
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
179
+
180
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
181
+
182
+exit /B %ERROR_CODE%

+ 236
- 0
pom.xml View File

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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+	<modelVersion>4.0.0</modelVersion>
5
+	<parent>
6
+		<groupId>org.springframework.boot</groupId>
7
+		<artifactId>spring-boot-starter-parent</artifactId>
8
+		<version>2.3.2.RELEASE</version>
9
+		<relativePath/> <!-- lookup parent from repository -->
10
+	</parent>
11
+	<groupId>com.yunzhi</groupId>
12
+	<artifactId>traning</artifactId>
13
+	<version>1.0.0</version>
14
+	<name>traning-service</name>
15
+	<description>电网教培</description>
16
+
17
+	<properties>
18
+		<log4j2.version>2.17.1</log4j2.version>
19
+		<java.version>1.8</java.version>
20
+	</properties>
21
+
22
+	<dependencies>
23
+		<dependency>
24
+			<groupId>org.springframework.boot</groupId>
25
+			<artifactId>spring-boot-starter-web</artifactId>
26
+		</dependency>
27
+
28
+		<dependency>
29
+			<groupId>org.springframework.boot</groupId>
30
+			<artifactId>spring-boot-configuration-processor</artifactId>
31
+			<optional>true</optional>
32
+		</dependency>
33
+
34
+		<dependency>
35
+			<groupId>org.springframework.boot</groupId>
36
+			<artifactId>spring-boot-starter-test</artifactId>
37
+			<scope>test</scope>
38
+			<exclusions>
39
+				<exclusion>
40
+					<groupId>org.junit.vintage</groupId>
41
+					<artifactId>junit-vintage-engine</artifactId>
42
+				</exclusion>
43
+			</exclusions>
44
+		</dependency>
45
+
46
+		<!--mysql start-->
47
+		<dependency>
48
+			<groupId>mysql</groupId>
49
+			<artifactId>mysql-connector-java</artifactId>
50
+			<scope>runtime</scope>
51
+		</dependency>
52
+		<!--mysql end-->
53
+
54
+		<!--mybatis-plus start-->
55
+		<dependency>
56
+			<groupId>com.baomidou</groupId>
57
+			<artifactId>mybatis-plus-boot-starter</artifactId>
58
+			<version>3.1.1</version>
59
+		</dependency>
60
+		<!--mybatis-plus end-->
61
+
62
+		<!--oss start-->
63
+		<dependency>
64
+			<groupId>com.aliyun.oss</groupId>
65
+			<artifactId>aliyun-sdk-oss</artifactId>
66
+			<version>2.8.3</version>
67
+		</dependency>
68
+		<!--oss end-->
69
+
70
+		<dependency>
71
+			<groupId>com.aliyun</groupId>
72
+			<artifactId>aliyun-java-sdk-core</artifactId>
73
+			<version>[4.4.9,5.0.0)</version>
74
+		</dependency>
75
+
76
+		<!--excel start-->
77
+		<dependency>
78
+			<groupId>com.alibaba</groupId>
79
+			<artifactId>easyexcel</artifactId>
80
+			<version>2.0.4</version>
81
+		</dependency>
82
+		<!--excel end-->
83
+
84
+		<dependency>
85
+			<groupId>cn.hutool</groupId>
86
+			<artifactId>hutool-json</artifactId>
87
+			<version>5.7.21</version>
88
+		</dependency>
89
+		<dependency>
90
+			<groupId>cn.hutool</groupId>
91
+			<artifactId>hutool-jwt</artifactId>
92
+			<version>5.7.21</version>
93
+		</dependency>
94
+
95
+		<!--lombok start-->
96
+		<dependency>
97
+			<groupId>org.projectlombok</groupId>
98
+			<artifactId>lombok</artifactId>
99
+			<optional>true</optional>
100
+		</dependency>
101
+		<!--lombok end-->
102
+
103
+		<!--swagger start-->
104
+		<dependency>
105
+			<groupId>io.springfox</groupId>
106
+			<artifactId>springfox-boot-starter</artifactId>
107
+			<version>3.0.0</version>
108
+		</dependency>
109
+		<!--swagger end-->
110
+	</dependencies>
111
+
112
+	<profiles>
113
+		<profile>
114
+			<id>dev</id>
115
+			<properties>
116
+				<profileActive>dev</profileActive>
117
+			</properties>
118
+			<activation>
119
+				<activeByDefault>true</activeByDefault>
120
+			</activation>
121
+
122
+			<build>
123
+				<plugins>
124
+					<plugin>
125
+						<groupId>org.springframework.boot</groupId>
126
+						<artifactId>spring-boot-maven-plugin</artifactId>
127
+						<configuration>
128
+							<excludes>
129
+								<exclude>
130
+									<groupId>org.springframework.boot</groupId>
131
+									<artifactId>spring-boot-configuration-processor</artifactId>
132
+								</exclude>
133
+							</excludes>
134
+						</configuration>
135
+					</plugin>
136
+
137
+					<!-- 跳过测试 -->
138
+					<plugin>
139
+						<groupId>org.apache.maven.plugins</groupId>
140
+						<artifactId>maven-surefire-plugin</artifactId>
141
+						<configuration>
142
+							<skipTests>true</skipTests>
143
+							<testFailureIgnore>true</testFailureIgnore>
144
+						</configuration>
145
+					</plugin>
146
+					<plugin>
147
+						<groupId>org.apache.maven.plugins</groupId>
148
+						<artifactId>maven-resources-plugin</artifactId>
149
+						<configuration>
150
+							<encoding>UTF-8</encoding>
151
+							<nonFilteredFileExtensions>
152
+								<nonFilteredFileExtension>pem</nonFilteredFileExtension>
153
+								<nonFilteredFileExtension>pfx</nonFilteredFileExtension>
154
+								<nonFilteredFileExtension>p12</nonFilteredFileExtension>
155
+							</nonFilteredFileExtensions>
156
+						</configuration>
157
+					</plugin>
158
+				</plugins>
159
+				<resources>
160
+					<resource>
161
+						<directory>src/main/resources</directory>
162
+						<filtering>true</filtering>
163
+						<includes>
164
+							<include>**/*.xml</include>
165
+							<include>**/*.p12</include>
166
+							<include>application.yml</include>
167
+							<include>application-${profileActive}.yml</include>
168
+						</includes>
169
+					</resource>
170
+				</resources>
171
+			</build>
172
+		</profile>
173
+
174
+		<profile>
175
+			<id>prod</id>
176
+			<properties>
177
+				<profileActive>prod</profileActive>
178
+			</properties>
179
+			<activation>
180
+				<activeByDefault>false</activeByDefault>
181
+			</activation>
182
+
183
+			<build>
184
+				<plugins>
185
+					<plugin>
186
+						<groupId>org.springframework.boot</groupId>
187
+						<artifactId>spring-boot-maven-plugin</artifactId>
188
+						<configuration>
189
+							<excludes>
190
+								<exclude>
191
+									<groupId>org.springframework.boot</groupId>
192
+									<artifactId>spring-boot-configuration-processor</artifactId>
193
+								</exclude>
194
+							</excludes>
195
+						</configuration>
196
+					</plugin>
197
+
198
+					<!-- 跳过测试 -->
199
+					<plugin>
200
+						<groupId>org.apache.maven.plugins</groupId>
201
+						<artifactId>maven-surefire-plugin</artifactId>
202
+						<configuration>
203
+							<skipTests>true</skipTests>
204
+							<testFailureIgnore>true</testFailureIgnore>
205
+						</configuration>
206
+					</plugin>
207
+					<plugin>
208
+						<groupId>org.apache.maven.plugins</groupId>
209
+						<artifactId>maven-resources-plugin</artifactId>
210
+						<configuration>
211
+							<encoding>UTF-8</encoding>
212
+							<nonFilteredFileExtensions>
213
+								<nonFilteredFileExtension>pem</nonFilteredFileExtension>
214
+								<nonFilteredFileExtension>pfx</nonFilteredFileExtension>
215
+								<nonFilteredFileExtension>p12</nonFilteredFileExtension>
216
+							</nonFilteredFileExtensions>
217
+						</configuration>
218
+					</plugin>
219
+				</plugins>
220
+				<resources>
221
+					<resource>
222
+						<directory>src/main/resources</directory>
223
+						<filtering>true</filtering>
224
+						<includes>
225
+							<include>**/*.xml</include>
226
+							<include>**/*.p12</include>
227
+							<include>application.yml</include>
228
+							<include>application-${profileActive}.yml</include>
229
+						</includes>
230
+					</resource>
231
+				</resources>
232
+			</build>
233
+		</profile>
234
+	</profiles>
235
+
236
+</project>

+ 16
- 0
src/main/java/com/yunzhi/training/SpringApplication.java View File

1
+package com.yunzhi.training;
2
+
3
+import org.springframework.boot.autoconfigure.SpringBootApplication;
4
+import org.springframework.scheduling.annotation.EnableAsync;
5
+import org.springframework.transaction.annotation.EnableTransactionManagement;
6
+
7
+@EnableAsync
8
+@EnableTransactionManagement
9
+@SpringBootApplication
10
+public class SpringApplication {
11
+
12
+	public static void main(String[] args) {
13
+		org.springframework.boot.SpringApplication.run(SpringApplication.class, args);
14
+	}
15
+
16
+}

+ 56
- 0
src/main/java/com/yunzhi/training/common/BaseController.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import com.yunzhi.training.entity.SysUser;
4
+import com.yunzhi.training.entity.TaPerson;
5
+import com.yunzhi.training.service.ISysUserService;
6
+import com.yunzhi.training.service.ITaPersonService;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Component;
9
+
10
+import javax.servlet.http.HttpServletRequest;
11
+
12
+@Component
13
+public class BaseController {
14
+
15
+    @Autowired
16
+    ISysUserService iSysUserService;
17
+
18
+    @Autowired
19
+    ITaPersonService iTaPersonService;
20
+
21
+    /**
22
+     * 获取当前管理端人员
23
+     * @return
24
+     */
25
+    public SysUser getCurrentUser(HttpServletRequest request) throws Exception {
26
+        String userId = request.getHeader("x-userid");
27
+        if (StringUtils.isEmpty(userId)) {
28
+            throw new Exception("获取当前人员信息失败");
29
+        }
30
+
31
+        SysUser sysUser = iSysUserService.getById(userId);
32
+        if (null == sysUser || Constants.STATUS_DELETED == sysUser.getState()) {
33
+            throw new Exception("校验人员息失败, 请重试");
34
+        }
35
+
36
+        return sysUser;
37
+    }
38
+
39
+    /**
40
+     * 获取当前小程序端人员
41
+     * @return
42
+     */
43
+    public TaPerson getCurrentPerson(HttpServletRequest request) throws Exception {
44
+        String personId = request.getHeader("x-person");
45
+        if (StringUtils.isEmpty(personId)) {
46
+            throw new Exception("获取当前人员信息失败");
47
+        }
48
+
49
+        TaPerson taPerson = iTaPersonService.getById(personId);
50
+        if (null == taPerson || Constants.STATUS_DELETED == taPerson.getState()) {
51
+            throw new Exception("获取当前人员信息失败");
52
+        }
53
+
54
+        return taPerson;
55
+    }
56
+}

+ 9
- 0
src/main/java/com/yunzhi/training/common/Constants.java View File

1
+package com.yunzhi.training.common;
2
+
3
+public class Constants {
4
+    // 基本状态
5
+    public final static int STATUS_DELETED = -1;
6
+    public final static int STATUS_READY = 0;
7
+    public final static int STATUS_NORMAL = 1;
8
+
9
+}

+ 37
- 0
src/main/java/com/yunzhi/training/common/DateUtils.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import java.time.*;
4
+import java.time.format.DateTimeFormatter;
5
+
6
+public class DateUtils {
7
+    public static LocalDateTime from(String str, String formater) {
8
+        DateTimeFormatter fmt = DateTimeFormatter.ofPattern(formater);
9
+        return LocalDateTime.parse(str, fmt);
10
+    }
11
+
12
+    public static long daysBetween(LocalDateTime dt1, LocalDateTime dt2) {
13
+        Duration duration = Duration.between(dt1, dt2);
14
+        return duration.toDays();
15
+    }
16
+
17
+    public static String toString(LocalDateTime dt, String formater) {
18
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(formater);
19
+        return dt.format(formatter);
20
+    }
21
+
22
+    public static String weekDay(LocalDateTime dt) {
23
+        String[] week = new String[]{"一", "二", "三", "四", "五", "六", "日"};
24
+        DayOfWeek dayOfWeek = dt.getDayOfWeek();
25
+        int inx = dayOfWeek.getValue() - 1;
26
+        return String.format("星期%s", week[inx]);
27
+    }
28
+
29
+    /**
30
+     * 毫秒转 UTC 时间
31
+     * @param milliseconds
32
+     * @return
33
+     */
34
+    public static LocalDateTime getDateTime(long milliseconds) {
35
+        return LocalDateTime.ofInstant(Instant.ofEpochMilli(milliseconds), ZoneOffset.UTC);
36
+    }
37
+}

+ 17
- 0
src/main/java/com/yunzhi/training/common/EncryptUtils.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import org.springframework.util.DigestUtils;
4
+
5
+public class EncryptUtils {
6
+
7
+    public static String md5(String str, String ...slats) {
8
+        String slat = "";
9
+        if (null != slats && slats.length > 0) {
10
+            slat = slats[0];
11
+        }
12
+
13
+        String base = str + slat;
14
+        String md5 = DigestUtils.md5DigestAsHex(base.getBytes());
15
+        return md5;
16
+    }
17
+}

+ 27
- 0
src/main/java/com/yunzhi/training/common/ExcelUtils.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import com.alibaba.excel.EasyExcel;
4
+
5
+import javax.servlet.http.HttpServletResponse;
6
+import java.io.IOException;
7
+import java.util.List;
8
+
9
+public class ExcelUtils {
10
+
11
+    /**
12
+     * 发送 excel 到客户端
13
+     * 暂时只支持单 sheet 页
14
+     * @param response
15
+     * @param data
16
+     * @param fileName
17
+     * @throws IOException
18
+     */
19
+    public static void flush(HttpServletResponse response, Class dataClass, List data, String fileName) throws IOException {
20
+        response.setContentType("application/vnd.ms-excel");
21
+        response.setCharacterEncoding("utf-8");
22
+        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
23
+        response.setHeader("Content-Disposition", "attachment;filename="+StringUtils.urlEncode(fileName)+".xlsx");
24
+
25
+        EasyExcel.write(response.getOutputStream(), dataClass).sheet("sheet1").doWrite(data);
26
+    }
27
+}

+ 104
- 0
src/main/java/com/yunzhi/training/common/JWTUtils.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import cn.hutool.json.JSONObject;
4
+import cn.hutool.jwt.JWT;
5
+import cn.hutool.jwt.JWTUtil;
6
+import cn.hutool.jwt.JWTValidator;
7
+import cn.hutool.jwt.signers.JWTSigner;
8
+import cn.hutool.jwt.signers.JWTSignerUtil;
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+
12
+import javax.servlet.http.HttpServletRequest;
13
+import javax.servlet.http.HttpServletResponse;
14
+import java.time.LocalDateTime;
15
+import java.time.ZoneId;
16
+import java.util.Date;
17
+import java.util.Map;
18
+
19
+/**
20
+ * JWTUtils
21
+ * jwt 辅助类
22
+ * https://github.com/jwtk/jjwt
23
+ */
24
+public class JWTUtils {
25
+    private static final Logger log = LoggerFactory.getLogger(JWTUtils.class);
26
+
27
+    // 过期时间 30 分钟
28
+    public static final long EXPIRE_TIME = 30 * 60 * 24;
29
+
30
+    // 私钥
31
+    static final JWTSigner signer = JWTSignerUtil.hs512("Yansen is so handsome. He is a good man. Everyone like him !!!".getBytes());
32
+
33
+    // 请求头
34
+    public static final String AUTH_HEADER = "X-Authorization-JWT";
35
+
36
+    /**
37
+     * 生成 token, claims 里必须要有 userId
38
+     * @param claims
39
+     * @return
40
+     */
41
+    public static String encode(Map<String, Object> claims) {
42
+        Date[] datePair = getDatePair();
43
+        Date iat = datePair[0];
44
+        Date exp = datePair[1];
45
+
46
+        return JWT.create()
47
+                .setIssuedAt(iat)
48
+                .setExpiresAt(exp)
49
+                .addPayloads(claims)
50
+                .sign(signer);
51
+    }
52
+
53
+    public static JSONObject decode(String token) throws Exception {
54
+        return JWTUtil.parseToken(token).getPayloads();
55
+    }
56
+
57
+    public static String refresh(String token) {
58
+        try {
59
+            JWT jwt = JWTUtil.parseToken(token);
60
+
61
+            Object obj = jwt.getPayload("iat");
62
+            if (null != obj) {
63
+                Date dt = (Date) obj;
64
+                long currentTime = System.currentTimeMillis() / 1000;
65
+                int oneMinute = 60;
66
+                if (currentTime - dt.getTime() < oneMinute) {
67
+                    return token;
68
+                }
69
+            }
70
+
71
+            Date[] datePair = getDatePair();
72
+            Date iat = datePair[0];
73
+            Date exp = datePair[1];
74
+            jwt.setIssuedAt(iat).setExpiresAt(exp);
75
+
76
+            return jwt.sign(signer);
77
+        } catch (Exception e) {
78
+            log.error("解析 JWT Token 失败: {}", e.getMessage());
79
+        }
80
+        return null;
81
+    }
82
+
83
+    public static void refresh(String jws, HttpServletResponse response) {
84
+        if (!StringUtils.isEmpty(jws)) {
85
+            String token =  refresh(jws);
86
+            response.addHeader(AUTH_HEADER, token);
87
+        }
88
+    }
89
+
90
+    public static String getToken(HttpServletRequest request) {
91
+        return request.getHeader(AUTH_HEADER);
92
+    }
93
+
94
+    public static void verify(String token) throws Exception {
95
+        JWTValidator.of(token).validateAlgorithm(signer);
96
+    }
97
+
98
+    private static Date[] getDatePair() {
99
+        LocalDateTime now = LocalDateTime.now();
100
+        Date iat = Date.from(now.atZone(ZoneId.systemDefault()).toInstant());
101
+        Date exp = Date.from(now.plusSeconds(EXPIRE_TIME).atZone(ZoneId.systemDefault()).toInstant());
102
+        return new Date[]{iat, exp};
103
+    }
104
+}

+ 11
- 0
src/main/java/com/yunzhi/training/common/MathUtils.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import java.util.Random;
4
+
5
+public class MathUtils {
6
+
7
+    public static Integer getRand(int min, int max) {
8
+        Random random = new Random();
9
+        return random.nextInt(max) % (max - min + 1) + min;
10
+    }
11
+}

+ 166
- 0
src/main/java/com/yunzhi/training/common/OSSUtils.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import com.aliyun.oss.OSSClient;
4
+import com.aliyuncs.DefaultAcsClient;
5
+import com.aliyuncs.auth.sts.AssumeRoleRequest;
6
+import com.aliyuncs.auth.sts.AssumeRoleResponse;
7
+import com.aliyuncs.exceptions.ClientException;
8
+import com.aliyuncs.http.MethodType;
9
+import com.aliyuncs.profile.DefaultProfile;
10
+import com.aliyuncs.profile.IClientProfile;
11
+import com.yunzhi.training.config.AliyunConfig;
12
+import lombok.extern.slf4j.Slf4j;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.stereotype.Component;
15
+import org.springframework.web.multipart.MultipartFile;
16
+
17
+import java.io.*;
18
+import java.time.LocalDateTime;
19
+import java.time.format.DateTimeFormatter;
20
+import java.util.Base64;
21
+import java.util.HashMap;
22
+import java.util.Map;
23
+
24
+@Slf4j
25
+@Component
26
+public class OSSUtils {
27
+
28
+    private final static String STS_ENDPOINT = "sts.aliyuncs.com";
29
+
30
+    @Autowired
31
+    AliyunConfig aliyunConfig;
32
+
33
+    private String getMonth() {
34
+        return DateTimeFormatter.ofPattern("yyyyMM").format(LocalDateTime.now());
35
+    }
36
+
37
+    private String getUploadPath(String[] toDirs) {
38
+        String path = toDirs.length > 0 ? toDirs[0] : "/";
39
+        if (!path.endsWith("/")) {
40
+            path += "/";
41
+        }
42
+
43
+        return path + getMonth() + "/";
44
+    }
45
+
46
+    /**
47
+     * 上传 base64
48
+     * @param base64Str
49
+     * @param toDirs
50
+     * @return
51
+     * @throws IOException
52
+     */
53
+    public String putObject(String base64Str, String ...toDirs) throws IOException {
54
+        int index = base64Str.indexOf("base64,");
55
+
56
+        if (index > -1) {
57
+            index += 7;
58
+        } else {
59
+            index = 0;
60
+        }
61
+
62
+        String dataStr = base64Str.substring(index);
63
+        byte[] data = Base64.getDecoder().decode(dataStr);
64
+        ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
65
+        String toDir = getUploadPath(toDirs);
66
+        String nwFName = toDir + System.currentTimeMillis() + ".png";
67
+        nwFName = StringUtils.trim(nwFName,"/");
68
+        return putFile(nwFName, inputStream);
69
+    }
70
+
71
+    /**
72
+     * 上传文件
73
+     * @param mf 上传的文件
74
+     * @param toDirs 上传到的目录
75
+     * @return
76
+     */
77
+    public String putObject(MultipartFile mf, String ... toDirs) throws IOException {
78
+        String fName = formatFileName(mf.getOriginalFilename());
79
+        String preFix = String.valueOf(System.currentTimeMillis());
80
+        String toDir = getUploadPath(toDirs);
81
+        String nwFName = toDir + preFix + "-" + fName;
82
+        nwFName = StringUtils.trim(nwFName,"/");
83
+
84
+        return putFile(nwFName, new ByteArrayInputStream(mf.getBytes()));
85
+    }
86
+
87
+    public String putObject(File f, String ... toDirs) throws FileNotFoundException {
88
+        String fName = formatFileName(f.getName());
89
+        String preFix = String.valueOf(System.currentTimeMillis());
90
+        String toDir = getUploadPath(toDirs);
91
+        String nwFName = toDir + preFix + "-" + fName;
92
+        nwFName = StringUtils.trim(nwFName,"/");
93
+
94
+        InputStream inputStream = new FileInputStream(f);
95
+        return putFile(nwFName, inputStream);
96
+    }
97
+
98
+    public String putObject(InputStream inputStream, String fName, String ... toDirs) {
99
+        String toDir = getUploadPath(toDirs);
100
+        String nwFName = toDir + fName;
101
+        nwFName = StringUtils.trim(nwFName,"/");
102
+        return putFile(nwFName, inputStream);
103
+    }
104
+
105
+    private String formatFileName(String fName) {
106
+        return StringUtils.ifNull(fName, StringUtils.random(16) + ".png");
107
+    }
108
+
109
+    private String putFile(String fname, InputStream input) {
110
+        OSSClient ossClient = new OSSClient(aliyunConfig.getOss().getEndpoint(), aliyunConfig.getAccessKeyId(), aliyunConfig.getAccessKeySecret());
111
+        ossClient.putObject(aliyunConfig.getOss().getBucketName(), fname, input);
112
+        ossClient.shutdown();
113
+
114
+        // String url = ossClient.generatePresignedUrl(AliOSSUtils.oss.getBucketName(), fname, expiration).toString();
115
+
116
+        String preURL = aliyunConfig.getOss().getBucketURL();
117
+        if (!preURL.endsWith("/")) {
118
+            preURL += "/";
119
+        }
120
+
121
+        return preURL + fname.replaceAll("\\ ", "%20").replaceAll("\\'", "%27");
122
+    }
123
+
124
+    /**
125
+     * 获取上传凭证
126
+     * @return
127
+     * @throws Exception
128
+     */
129
+    public Map<String, Object> getSTSAKToken() throws Exception {
130
+        AliyunConfig.Oss oss = aliyunConfig.getOss();
131
+
132
+        try {
133
+            // 添加endpoint(直接使用STS endpoint,无需添加region ID)
134
+            DefaultProfile.addEndpoint("", "Sts", STS_ENDPOINT);
135
+            // 构造default profile(参数留空,无需添加region ID)
136
+            IClientProfile profile = DefaultProfile.getProfile("", oss.getAccessKeyId(), oss.getAccessKeySecret());
137
+
138
+            // 用profile构造client
139
+            DefaultAcsClient client = new DefaultAcsClient(profile);
140
+            final AssumeRoleRequest request = new AssumeRoleRequest();
141
+            request.setSysMethod(MethodType.POST);
142
+            request.setRoleArn(oss.getArn());
143
+            request.setRoleSessionName(oss.getRoleSessionName());
144
+            request.setPolicy(null); // 若policy为空,则用户将获得该角色下所有权限
145
+            request.setDurationSeconds(30 * 60L); // 设置凭证有效时间 1800 秒 = 30 分钟
146
+            final AssumeRoleResponse response = client.getAcsResponse(request);
147
+
148
+            AssumeRoleResponse.Credentials credentials = response.getCredentials();
149
+
150
+            Map<String, Object> res = new HashMap<>();
151
+            res.put("stsToken", credentials.getSecurityToken());
152
+            res.put("accessKeySecret", credentials.getAccessKeySecret());
153
+            res.put("accessKeyId", credentials.getAccessKeyId());
154
+            res.put("expiration", credentials.getExpiration());
155
+
156
+            return res;
157
+        } catch (ClientException e) {
158
+            e.printStackTrace();
159
+            log.error("Error code: " + e.getErrCode());
160
+            log.error("Error message: " + e.getErrMsg());
161
+            log.error("RequestId: " + e.getRequestId());
162
+            throw new Exception(e.getMessage());
163
+        }
164
+    }
165
+
166
+}

+ 76
- 0
src/main/java/com/yunzhi/training/common/ResponseBean.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import java.io.Serializable;
4
+import java.util.Map;
5
+
6
+/**
7
+ * 接口统一状态返回BEAN.
8
+ */
9
+public class ResponseBean<T> implements Serializable {
10
+
11
+    private static final long serialVersionUID = 3593827217136880822L;
12
+
13
+    public static final int CODE_SUCCESS = 1000;
14
+    public static final int ERROR_AUTH_FAIL = 1001;
15
+    public static final int ERROR_AUTH_EXPIRED = 1002;
16
+    public static final int ERROR_MISSING_PARAMS = 1003;
17
+    public static final int ERROR_ILLEGAL_PARAMS = 1004;
18
+    public static final int ERROR_UNAVAILABLE = 1005;
19
+
20
+    private int code;
21
+    private String message;
22
+    private T data;
23
+    private String token;
24
+
25
+    /**
26
+     * 禁止外部 new
27
+     */
28
+    private ResponseBean() {
29
+        code = ResponseBean.CODE_SUCCESS;
30
+    }
31
+
32
+    public static <T> ResponseBean success(T data, String ...msgs) {
33
+        ResponseBean responseBean = new ResponseBean();
34
+        responseBean.code = ResponseBean.CODE_SUCCESS;
35
+        responseBean.data = data;
36
+
37
+        if (null != msgs && msgs.length > 0) {
38
+            responseBean.message = msgs[0];
39
+        }
40
+
41
+        return responseBean;
42
+    }
43
+
44
+    public static <T> ResponseBean error(String msg, int code, T ...datas) {
45
+        ResponseBean responseBean = new ResponseBean();
46
+        responseBean.code = code;
47
+        responseBean.message = msg;
48
+
49
+        if (null != datas && datas.length > 0) {
50
+            responseBean.data = datas[0];
51
+        }
52
+
53
+        return responseBean;
54
+    }
55
+
56
+    public int getCode() {
57
+        return code;
58
+    }
59
+
60
+    public String getMessage() {
61
+        return message;
62
+    }
63
+
64
+    public T getData() {
65
+        return data;
66
+    }
67
+
68
+    public String getToken() {
69
+        return token;
70
+    }
71
+    
72
+    @Override
73
+    public String toString() {
74
+        return  "{ code: "+code+", message: "+message+", data: <T> }";
75
+    }
76
+}

+ 145
- 0
src/main/java/com/yunzhi/training/common/SMSCaptcha.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import com.yunzhi.training.config.AliyunConfig;
4
+import lombok.Data;
5
+import lombok.experimental.Accessors;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.scheduling.annotation.EnableScheduling;
9
+import org.springframework.scheduling.annotation.Scheduled;
10
+import org.springframework.stereotype.Component;
11
+
12
+import java.time.LocalDateTime;
13
+import java.util.Hashtable;
14
+import java.util.Random;
15
+
16
+@Slf4j
17
+@Component
18
+@EnableScheduling
19
+public class SMSCaptcha {
20
+    @Autowired
21
+    AliyunConfig aliyunConfig;
22
+
23
+    @Autowired
24
+    SMSUtils smsUtils;
25
+
26
+    // 默认超时时间, 单位秒
27
+    Integer expireSec = 5 * 60;
28
+
29
+    // 缓存电话列表
30
+    Hashtable<String, Phone> allPhones = new Hashtable<>();
31
+
32
+    /**
33
+     * 发送验证码
34
+     * @param tel
35
+     * @param captcha
36
+     * @throws Exception
37
+     */
38
+    public void send(String tel, String captcha) throws Exception {
39
+        if (null == captcha) {
40
+            throw new Exception("没有有效的验证码");
41
+        }
42
+
43
+        Phone phone = new Phone()
44
+                .setNumber(tel)
45
+                .setCaptcha(captcha)
46
+                .setExpire(expireTime());
47
+
48
+
49
+        SMSUtils.Message message = new SMSUtils.Message()
50
+                .setCode(aliyunConfig.getSms().getCaptcha().getCode())
51
+                .setSign(aliyunConfig.getSms().getCaptcha().getSign())
52
+                .setTel(tel)
53
+                .setContent("{ \"code\": \"" + captcha + "\" }");
54
+
55
+        try {
56
+            smsUtils.sendMessage(message);
57
+        } catch (Exception e) {
58
+            // 修改友好点的错误
59
+            throw new Exception("发送验证码失败");
60
+        }
61
+
62
+        log.info(String.format("发送验证码 %s 到手机 %s", captcha, tel));
63
+
64
+        // 发送成功, 写入缓存
65
+        toCache(phone);
66
+    }
67
+
68
+    /**
69
+     * 校验验证码
70
+     * @param tel
71
+     * @param captcha
72
+     * @return
73
+     */
74
+    public boolean validate(String tel, String captcha) {
75
+        Phone phone = fromCache(tel);
76
+        if (null == phone) {
77
+            return false;
78
+        }
79
+
80
+        if (null == captcha || !captcha.equals(phone.getCaptcha())) {
81
+            return false;
82
+        }
83
+
84
+        // 过期则清除缓存
85
+        boolean res = checkExpire(phone);
86
+        if (res) {
87
+            clearCache(phone);
88
+        }
89
+
90
+        return !res;
91
+    }
92
+
93
+    /**
94
+     * 辅助方法: 随机生成验证码
95
+     * @param length
96
+     * @return
97
+     */
98
+    public String randCaptcha(int length) {
99
+        Random random = new Random();
100
+        String res = "";
101
+        for (int i = 0; i < length; i ++) {
102
+            int num = random.nextInt(10);
103
+            res += String.valueOf(num);
104
+        }
105
+        return res;
106
+    }
107
+
108
+    /**
109
+     * 定时任务 每半小时 清除一次不用的手机号
110
+     */
111
+    @Scheduled(fixedRate = 1000 * 60 * 30)
112
+    public void clearUnused() {
113
+        for (Phone phone: allPhones.values()) {
114
+            if (checkExpire(phone)) {
115
+                clearCache(phone);
116
+            }
117
+        }
118
+    }
119
+
120
+    private Phone fromCache(String phone) {
121
+        return allPhones.get(phone);
122
+    }
123
+    private void toCache(Phone phone) {
124
+        allPhones.put(phone.getNumber(), phone);
125
+    }
126
+    private void clearCache(Phone phone) { allPhones.remove(phone); }
127
+
128
+    private LocalDateTime expireTime() {
129
+        return LocalDateTime.now().plusSeconds(expireSec);
130
+    }
131
+
132
+    // 过期返回 true
133
+    private boolean checkExpire(Phone phone) {
134
+        return LocalDateTime.now().isAfter(phone.getExpire());
135
+    }
136
+
137
+    @Data
138
+    @Accessors(chain = true)
139
+    public static class Phone {
140
+        String number;
141
+        String captcha;
142
+        LocalDateTime expire;
143
+    }
144
+
145
+}

+ 71
- 0
src/main/java/com/yunzhi/training/common/SMSUtils.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import com.aliyuncs.CommonRequest;
4
+import com.aliyuncs.CommonResponse;
5
+import com.aliyuncs.DefaultAcsClient;
6
+import com.aliyuncs.IAcsClient;
7
+import com.aliyuncs.http.MethodType;
8
+import com.aliyuncs.profile.DefaultProfile;
9
+import com.yunzhi.training.config.AliyunConfig;
10
+import lombok.Data;
11
+import lombok.experimental.Accessors;
12
+import lombok.extern.slf4j.Slf4j;
13
+import org.springframework.beans.factory.InitializingBean;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.stereotype.Component;
16
+
17
+@Slf4j
18
+@Component
19
+public class SMSUtils implements InitializingBean {
20
+
21
+    IAcsClient acsClient;
22
+
23
+    //产品名称:云通信短信API产品,开发者无需替换
24
+    static final String product = "Dysmsapi";
25
+    //产品域名,开发者无需替换
26
+    static final String domain = "dysmsapi.aliyuncs.com";
27
+    //API 的名称,开发者无需替换
28
+    static final String action = "SendSms";
29
+    //API RegionId,开发者无需替换
30
+    static final String regionId = "cn-hangzhou";
31
+    //API 版本,开发者无需替换
32
+    static final String verison = "2017-05-25";
33
+
34
+    @Autowired
35
+    AliyunConfig aliyunConfig;
36
+
37
+    public void sendMessage(Message message) throws Exception {
38
+        request(message);
39
+    }
40
+
41
+    private CommonResponse request(Message message) throws Exception {
42
+        CommonRequest request = new CommonRequest();
43
+        request.setSysMethod(MethodType.POST);
44
+        request.setSysDomain(domain);
45
+        request.setSysVersion(verison);
46
+        request.setSysAction(action);
47
+        request.putQueryParameter("RegionId", regionId);
48
+        request.putQueryParameter("PhoneNumbers", message.getTel());
49
+        request.putQueryParameter("SignName", message.getSign());
50
+        request.putQueryParameter("TemplateCode", message.getCode());
51
+        request.putQueryParameter("TemplateParam", message.getContent());
52
+
53
+        return acsClient.getCommonResponse(request);
54
+    }
55
+
56
+    @Override
57
+    public void afterPropertiesSet() throws Exception {
58
+        AliyunConfig.Sms sms = aliyunConfig.getSms();
59
+        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", aliyunConfig.getAccessKeyId(), aliyunConfig.getAccessKeySecret());
60
+        acsClient = new DefaultAcsClient(profile);
61
+    }
62
+
63
+    @Data
64
+    @Accessors(chain = true)
65
+    public static class Message {
66
+        String code;
67
+        String tel;
68
+        String sign;
69
+        String content;
70
+    }
71
+}

+ 203
- 0
src/main/java/com/yunzhi/training/common/StringUtils.java View File

1
+package com.yunzhi.training.common;
2
+
3
+import java.io.UnsupportedEncodingException;
4
+import java.net.URLDecoder;
5
+import java.net.URLEncoder;
6
+import java.util.*;
7
+import java.util.regex.Matcher;
8
+import java.util.regex.Pattern;
9
+
10
+public class StringUtils {
11
+    private static Pattern humpPattern = Pattern.compile("[A-Z]");
12
+
13
+    public static boolean isEmpty(String str) {
14
+        return null == str || "".equals(str.trim()) || "null".equals(str) || "undefined".equals(str);
15
+    }
16
+
17
+    public static String trim(String src, String...st) {
18
+        if (null == src) return src;
19
+        if (null == st || st.length == 0) return src.trim();
20
+
21
+        String start = st[0];
22
+        if (!src.startsWith(start)) {
23
+            return src;
24
+        }
25
+
26
+        return src.substring(start.length());
27
+    }
28
+
29
+    public static String trimEnd(String src, String str) {
30
+        if (null == src || null == str) {
31
+            return src;
32
+        }
33
+
34
+        if (src.endsWith(str)) {
35
+            return src.substring(0, src.length() - str.length());
36
+        }
37
+
38
+        return src;
39
+    }
40
+
41
+    public static String ifNull(String src, String defaultVal) {
42
+        return isEmpty(src) ? defaultVal : src;
43
+    }
44
+
45
+    public static String random(int length) {
46
+        String str="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
47
+        Random random = new Random();
48
+        StringBuffer sb = new StringBuffer();
49
+        for(int i=0;i<length;i++){
50
+            int number=random.nextInt(62);
51
+            sb.append(str.charAt(number));
52
+        }
53
+        return sb.toString();
54
+    }
55
+
56
+    public static String urlEncode(String str) {
57
+        if (isEmpty(str)) return str;
58
+
59
+        try {
60
+            return URLEncoder.encode(str, "UTF-8");
61
+        } catch (UnsupportedEncodingException e) {
62
+            e.printStackTrace();
63
+            return str;
64
+        }
65
+    }
66
+
67
+    public static String urlDecode(String str) {
68
+        if (isEmpty(str)) return str;
69
+
70
+        try {
71
+            return URLDecoder.decode(str, "UTF-8");
72
+        } catch (UnsupportedEncodingException e) {
73
+            e.printStackTrace();
74
+            return str;
75
+        }
76
+    }
77
+
78
+    public static String encodeURIComponent(String str) {
79
+        String result = urlEncode(str);
80
+
81
+        return result.replaceAll("\\+", "%20")
82
+                .replaceAll("\\%21", "!")
83
+                .replaceAll("\\%27", "'")
84
+                .replaceAll("\\%28", "(")
85
+                .replaceAll("\\%29", ")")
86
+                .replaceAll("\\%7E", "~");
87
+    }
88
+
89
+    public static String humpToLine(String str) {
90
+        if (null == str || "".equals(str)) return "";
91
+
92
+        Matcher matcher = humpPattern.matcher(str);
93
+        StringBuffer sb = new StringBuffer();
94
+        while (matcher.find()) {
95
+            matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
96
+        }
97
+        matcher.appendTail(sb);
98
+        return sb.toString();
99
+    }
100
+
101
+    public static String strToUnicode(String str) {
102
+        char[] chars = str.toCharArray();
103
+        String returnStr = "";
104
+        for (int i = 0; i < chars.length; i++) {
105
+            returnStr += "\\u" + Integer.toString(chars[i], 16);
106
+        }
107
+        return returnStr;
108
+    }
109
+
110
+    public static String repeat(String src, int len) {
111
+        if (null == src) {
112
+            return null;
113
+        }
114
+
115
+        if (len <= 0) {
116
+            return src;
117
+        }
118
+
119
+        String res = "";
120
+        for (int i = 0; i < len; i ++) {
121
+            res += src;
122
+        }
123
+
124
+        return res;
125
+    }
126
+
127
+    public static String lpad(String src, String padStr, int len) {
128
+        if (null == src) {
129
+            return null;
130
+        }
131
+
132
+        if (len <= 0 || src.length() >= len) {
133
+            return src;
134
+        }
135
+
136
+        if (null == padStr) {
137
+            padStr = "";
138
+        }
139
+
140
+        int padLen = len - src.length();
141
+        String prefix = repeat(padStr, padLen);
142
+        prefix = prefix.substring(0, padLen);
143
+        return prefix + src;
144
+    }
145
+
146
+    /**
147
+     * 解析 QueryString
148
+     * @param queryStr
149
+     * @return
150
+     */
151
+    public static Map<String, String> parseQueryString(String queryStr) {
152
+        if (isEmpty(queryStr)) {
153
+            return null;
154
+        }
155
+        Map<String, String> result = new HashMap<String, String>();
156
+
157
+        String[] fields = queryStr.split("&");
158
+        for (String field : fields) {
159
+            String[] pairs = field.split("=");
160
+            if (2 != pairs.length) {
161
+                continue;
162
+            }
163
+
164
+            try {
165
+                String key = URLDecoder.decode(pairs[0].trim(), "UTF-8");
166
+                String val = URLDecoder.decode(pairs[1].trim(), "UTF-8");
167
+
168
+                result.put(key, val);
169
+            } catch (UnsupportedEncodingException e) {
170
+                e.printStackTrace();
171
+            }
172
+        }
173
+
174
+        return result;
175
+    }
176
+
177
+    /**
178
+     * Map 转 QueryString
179
+     * @param params
180
+     * @return
181
+     */
182
+    public static String buildQueryString(Map<String, Object> params) {
183
+        if (null == params) {
184
+            return null;
185
+        }
186
+
187
+        List<String> lst = new ArrayList<>();
188
+        for (Map.Entry<String, Object> entry : params.entrySet()) {
189
+            String key = StringUtils.urlEncode(entry.getKey());
190
+            Object o = entry.getValue();
191
+            if (null == o) {
192
+                continue;
193
+            }
194
+            String val = o.toString();
195
+            if (StringUtils.isEmpty(val)) {
196
+                continue;
197
+            }
198
+            String queryStr = key + "=" + StringUtils.urlEncode(val);
199
+            lst.add(queryStr);
200
+        }
201
+        return String.join("&", lst);
202
+    }
203
+}

+ 53
- 0
src/main/java/com/yunzhi/training/common/excelConverter/LocalDateTimeConverter.java View File

1
+package com.yunzhi.training.common.excelConverter;
2
+
3
+import com.alibaba.excel.converters.Converter;
4
+import com.alibaba.excel.enums.CellDataTypeEnum;
5
+import com.alibaba.excel.metadata.CellData;
6
+import com.alibaba.excel.metadata.GlobalConfiguration;
7
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
8
+import com.yunzhi.training.common.DateUtils;
9
+
10
+import java.time.LocalDateTime;
11
+
12
+public class LocalDateTimeConverter implements Converter<LocalDateTime> {
13
+    @Override
14
+    public Class supportJavaTypeKey() {
15
+        return LocalDateTime.class;
16
+    }
17
+
18
+    @Override
19
+    public CellDataTypeEnum supportExcelTypeKey() {
20
+        return CellDataTypeEnum.STRING;
21
+    }
22
+
23
+    /**
24
+     * 读 Excel
25
+     * @param cellData
26
+     * @param contentProperty
27
+     * @param globalConfiguration
28
+     * @return
29
+     * @throws Exception
30
+     */
31
+    @Override
32
+    public LocalDateTime convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
33
+        // 暂时没这个业务
34
+        return null;
35
+    }
36
+
37
+    /**
38
+     * 写 Excel
39
+     * @param value
40
+     * @param contentProperty
41
+     * @param globalConfiguration
42
+     * @return
43
+     * @throws Exception
44
+     */
45
+    @Override
46
+    public CellData convertToExcelData(LocalDateTime value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
47
+        if (null == value) return null;
48
+
49
+        String val = DateUtils.toString(value, "yyyy-MM-dd HH:mm:ss");
50
+
51
+        return new CellData(val);
52
+    }
53
+}

+ 53
- 0
src/main/java/com/yunzhi/training/common/excelConverter/LocalDayConverter.java View File

1
+package com.yunzhi.training.common.excelConverter;
2
+
3
+import com.alibaba.excel.converters.Converter;
4
+import com.alibaba.excel.enums.CellDataTypeEnum;
5
+import com.alibaba.excel.metadata.CellData;
6
+import com.alibaba.excel.metadata.GlobalConfiguration;
7
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
8
+import com.yunzhi.training.common.DateUtils;
9
+
10
+import java.time.LocalDateTime;
11
+
12
+public class LocalDayConverter implements Converter<LocalDateTime> {
13
+    @Override
14
+    public Class supportJavaTypeKey() {
15
+        return LocalDateTime.class;
16
+    }
17
+
18
+    @Override
19
+    public CellDataTypeEnum supportExcelTypeKey() {
20
+        return CellDataTypeEnum.STRING;
21
+    }
22
+
23
+    /**
24
+     * 读 Excel
25
+     * @param cellData
26
+     * @param contentProperty
27
+     * @param globalConfiguration
28
+     * @return
29
+     * @throws Exception
30
+     */
31
+    @Override
32
+    public LocalDateTime convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
33
+        // 暂时没这个业务
34
+        return null;
35
+    }
36
+
37
+    /**
38
+     * 写 Excel
39
+     * @param value
40
+     * @param contentProperty
41
+     * @param globalConfiguration
42
+     * @return
43
+     * @throws Exception
44
+     */
45
+    @Override
46
+    public CellData convertToExcelData(LocalDateTime value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
47
+        if (null == value) return null;
48
+
49
+        String val = DateUtils.toString(value, "yyyy-MM-dd");
50
+
51
+        return new CellData(val);
52
+    }
53
+}

+ 55
- 0
src/main/java/com/yunzhi/training/common/excelConverter/MoneyConverter.java View File

1
+package com.yunzhi.training.common.excelConverter;
2
+
3
+import com.alibaba.excel.converters.Converter;
4
+import com.alibaba.excel.enums.CellDataTypeEnum;
5
+import com.alibaba.excel.metadata.CellData;
6
+import com.alibaba.excel.metadata.GlobalConfiguration;
7
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
8
+
9
+import java.math.BigDecimal;
10
+import java.math.RoundingMode;
11
+
12
+public class MoneyConverter implements Converter<Integer> {
13
+    @Override
14
+    public Class supportJavaTypeKey() {
15
+        return Integer.class;
16
+    }
17
+
18
+    @Override
19
+    public CellDataTypeEnum supportExcelTypeKey() {
20
+        return CellDataTypeEnum.NUMBER;
21
+    }
22
+
23
+    /**
24
+     * 读转换
25
+     * @param cellData
26
+     * @param contentProperty
27
+     * @param globalConfiguration
28
+     * @return
29
+     * @throws Exception
30
+     */
31
+    @Override
32
+    public Integer convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
33
+        // 暂时没这业务
34
+        return cellData.getNumberValue().intValue();
35
+    }
36
+
37
+    /**
38
+     * 写转换. 由分写成元
39
+     * @param value
40
+     * @param contentProperty
41
+     * @param globalConfiguration
42
+     * @return
43
+     * @throws Exception
44
+     */
45
+    @Override
46
+    public CellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
47
+        if (null == value) return null;
48
+
49
+        float money = Float.valueOf(value) / 100;
50
+        BigDecimal val = new BigDecimal(money);
51
+        val = val.setScale(2, RoundingMode.HALF_UP);    // 保留2位小数
52
+
53
+        return new CellData(val);
54
+    }
55
+}

+ 40
- 0
src/main/java/com/yunzhi/training/config/AliyunConfig.java View File

1
+package com.yunzhi.training.config;
2
+
3
+import lombok.Data;
4
+import org.springframework.boot.context.properties.ConfigurationProperties;
5
+import org.springframework.stereotype.Component;
6
+
7
+@Data
8
+@Component
9
+@ConfigurationProperties(prefix = "aliyun")
10
+public class AliyunConfig {
11
+    private String accessKeyId;
12
+    private String accessKeySecret;
13
+
14
+    private Oss oss;
15
+
16
+    private Sms sms;
17
+
18
+    @Data
19
+    public  static class Oss {
20
+        private String roleSessionName;
21
+        private String accessKeyId;
22
+        private String accessKeySecret;
23
+        private String arn;
24
+        private String region;
25
+        private String endpoint;
26
+        private String bucketName;
27
+        private String bucketURL;
28
+    }
29
+
30
+    @Data
31
+    public static class Sms {
32
+        private Captcha captcha;
33
+    }
34
+
35
+    @Data
36
+    public static class Captcha {
37
+        private String code;
38
+        private String sign;
39
+    }
40
+}

+ 35
- 0
src/main/java/com/yunzhi/training/config/BaseConfig.java View File

1
+package com.yunzhi.training.config;
2
+
3
+import com.yunzhi.training.interceptor.PermissionInterceptor;
4
+import lombok.Data;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.context.annotation.Configuration;
7
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
8
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
9
+
10
+import javax.annotation.PostConstruct;
11
+
12
+@Data
13
+@Configuration
14
+public class BaseConfig implements WebMvcConfigurer {
15
+
16
+    @Autowired
17
+    private PermissionInterceptor permissionInterceptor;
18
+
19
+    @Autowired
20
+    private InterceptorConfig interceptorConfig;
21
+
22
+    @PostConstruct
23
+    public void init() {
24
+    }
25
+
26
+    @Override
27
+    public void addInterceptors(InterceptorRegistry registry) {
28
+        // 自定义拦截器,添加拦截路径和排除拦截路径
29
+        if (interceptorConfig.getPermission().isEnable()) {
30
+            registry.addInterceptor(permissionInterceptor)
31
+                    .addPathPatterns(interceptorConfig.getPermission().getIncludePaths())
32
+                    .excludePathPatterns(interceptorConfig.getPermission().getExcludePaths());
33
+        }
34
+    }
35
+}

+ 28
- 0
src/main/java/com/yunzhi/training/config/CorsConfig.java View File

1
+package com.yunzhi.training.config;
2
+
3
+import org.springframework.boot.SpringBootConfiguration;
4
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
5
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
6
+
7
+@SpringBootConfiguration
8
+public class CorsConfig implements WebMvcConfigurer {
9
+    @Override
10
+    public void addCorsMappings(CorsRegistry registry) {
11
+        //添加映射路径
12
+        registry.addMapping("/**")
13
+                //是否发送Cookie
14
+                .allowCredentials(true)
15
+                //设置放行哪些原始域
16
+                .allowedOrigins("*")
17
+                //放行哪些请求方式
18
+                .allowedMethods("GET", "POST", "PUT", "DELETE")
19
+                //.allowedMethods("*") //或者放行全部
20
+                //放行哪些原始请求头部信息
21
+                .allowedHeaders("*")
22
+                //暴露哪些原始请求头部信息
23
+                .exposedHeaders("X-Authorization-JWT");
24
+    }
25
+}
26
+
27
+
28
+//public class CorsConfig {}

+ 32
- 0
src/main/java/com/yunzhi/training/config/InterceptorConfig.java View File

1
+package com.yunzhi.training.config;
2
+
3
+import lombok.Data;
4
+import org.springframework.boot.context.properties.ConfigurationProperties;
5
+import org.springframework.stereotype.Component;
6
+
7
+@Data
8
+@Component
9
+@ConfigurationProperties(prefix = "interceptor")
10
+public class InterceptorConfig {
11
+
12
+    private Config permission;
13
+
14
+    @Data
15
+    public static class Config {
16
+
17
+        /**
18
+         * 是否启用
19
+         */
20
+        private boolean enable;
21
+
22
+        /**
23
+         * 包含的路径
24
+         */
25
+        private String[] includePaths = new String[]{};
26
+
27
+        /**
28
+         * 排除路径
29
+         */
30
+        private String[] excludePaths = new String[]{};
31
+    }
32
+}

+ 21
- 0
src/main/java/com/yunzhi/training/config/LoggingFilterConfig.java View File

1
+package com.yunzhi.training.config;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+import org.springframework.context.annotation.Configuration;
5
+
6
+import javax.servlet.*;
7
+import javax.servlet.http.HttpServletRequest;
8
+import java.io.IOException;
9
+
10
+@Slf4j
11
+@Configuration
12
+public class LoggingFilterConfig implements Filter {
13
+    @Override
14
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
15
+        HttpServletRequest req = (HttpServletRequest) request;
16
+        log.info("Request URI: [{}] {}", req.getMethod() , req.getRequestURI());
17
+
18
+        // 继续执行
19
+        chain.doFilter(request, response);
20
+    }
21
+}

+ 14
- 0
src/main/java/com/yunzhi/training/config/MybatisPlusConfig.java View File

1
+package com.yunzhi.training.config;
2
+
3
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
4
+import org.springframework.context.annotation.Bean;
5
+import org.springframework.context.annotation.Configuration;
6
+
7
+@Configuration
8
+public class MybatisPlusConfig {
9
+
10
+    @Bean
11
+    public PaginationInterceptor paginationInterceptor() {
12
+        return new PaginationInterceptor();
13
+    }
14
+}

+ 24
- 0
src/main/java/com/yunzhi/training/config/SwagggerConfig.java View File

1
+package com.yunzhi.training.config;
2
+
3
+import io.swagger.annotations.Api;
4
+import org.springframework.context.annotation.Bean;
5
+import org.springframework.context.annotation.Configuration;
6
+import springfox.documentation.builders.PathSelectors;
7
+import springfox.documentation.builders.RequestHandlerSelectors;
8
+import springfox.documentation.spi.DocumentationType;
9
+import springfox.documentation.spring.web.plugins.Docket;
10
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
11
+
12
+@Configuration
13
+@EnableSwagger2
14
+public class SwagggerConfig {
15
+    @Bean
16
+    public Docket docket() {
17
+        return new Docket(DocumentationType.SWAGGER_2)
18
+                .select()
19
+                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
20
+                .paths(PathSelectors.any())
21
+                .build();
22
+
23
+    }
24
+}

+ 102
- 0
src/main/java/com/yunzhi/training/controller/CommController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.yunzhi.training.common.BaseController;
4
+import com.yunzhi.training.common.OSSUtils;
5
+import com.yunzhi.training.common.ResponseBean;
6
+import com.yunzhi.training.common.SMSCaptcha;
7
+import com.yunzhi.training.config.AliyunConfig;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.web.bind.annotation.*;
13
+import org.springframework.web.multipart.MultipartFile;
14
+
15
+import java.io.IOException;
16
+import java.time.LocalDateTime;
17
+import java.time.format.DateTimeFormatter;
18
+import java.util.Map;
19
+
20
+@Api(tags = "通用")
21
+@RestController
22
+@RequestMapping("/")
23
+public class CommController extends BaseController {
24
+
25
+    @Autowired
26
+    OSSUtils ossUtils;
27
+
28
+    @Autowired
29
+    AliyunConfig aliyunConfig;
30
+
31
+    @Autowired
32
+    SMSCaptcha smsCaptcha;
33
+
34
+
35
+    /**
36
+     * 图片
37
+     * @param multipartFile
38
+     * @return
39
+     */
40
+    @ApiOperation(value = "图片上传", notes = "图片上传")
41
+    @PostMapping("/{plat}/image")
42
+    public ResponseBean uploadImage(@RequestParam("file") MultipartFile multipartFile) {
43
+        try {
44
+            String img = ossUtils.putObject(multipartFile);
45
+            return ResponseBean.success(img);
46
+        } catch (IOException e) {
47
+            return ResponseBean.error("上传图片失败: " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
48
+        }
49
+    }
50
+
51
+    /**
52
+     * base64 图片上传
53
+     * @param data
54
+     * @return
55
+     */
56
+    @ApiOperation(value = "base64 图片上传", notes = "base64 图片上传")
57
+    @PostMapping("/{plat}/image/base64")
58
+    public ResponseBean uploadBase64Image(@RequestBody Map<String, String> data) {
59
+        try {
60
+            String base64Str = data.get("base64");
61
+            String img = ossUtils.putObject(base64Str);
62
+            return ResponseBean.success(img);
63
+        } catch (IOException e) {
64
+            return ResponseBean.error("上传图片失败: " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
65
+        }
66
+    }
67
+
68
+    /**
69
+     * 获取文件上传凭证
70
+     * @return
71
+     */
72
+    @ApiOperation(value = "获取文件上传凭证", notes = "获取文件上传凭证")
73
+    @GetMapping("/{plat}/oss-sts")
74
+    public ResponseBean getOSSSTS() {
75
+        AliyunConfig.Oss oss = aliyunConfig.getOss();
76
+
77
+        try {
78
+            Map<String, Object> res = ossUtils.getSTSAKToken();
79
+            res.put("endpoint", oss.getEndpoint());
80
+            res.put("bucket", oss.getBucketName());
81
+            res.put("bucketURL", oss.getBucketURL());
82
+            res.put("region", oss.getRegion());
83
+            res.put("path", getMonth());
84
+
85
+            return ResponseBean.success(res);
86
+        } catch (Exception e) {
87
+            return ResponseBean.error("获取上传凭证失败! ", ResponseBean.ERROR_UNAVAILABLE);
88
+        }
89
+    }
90
+
91
+    @ApiOperation("获取验证码")
92
+    @GetMapping("/{plat}/captcha")
93
+    public ResponseBean getCaptcha(@ApiParam("手机号") @RequestParam String phone) throws Exception {
94
+        smsCaptcha.send(phone, smsCaptcha.randCaptcha(4));
95
+        return ResponseBean.success("success");
96
+    }
97
+
98
+    private String getMonth() {
99
+        return DateTimeFormatter.ofPattern("yyyy-MM").format(LocalDateTime.now());
100
+    }
101
+
102
+}

+ 151
- 0
src/main/java/com/yunzhi/training/controller/LoginController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.yunzhi.training.common.*;
4
+import com.yunzhi.training.entity.SysUser;
5
+import com.yunzhi.training.service.ISysUserService;
6
+import com.yunzhi.training.service.ITaPersonService;
7
+import com.yunzhi.training.vo.ChangePassword;
8
+import com.yunzhi.training.vo.AdminLoginParam;
9
+import com.yunzhi.training.vo.LoginParam;
10
+import com.yunzhi.training.vo.TokenParam;
11
+import io.swagger.annotations.Api;
12
+import io.swagger.annotations.ApiOperation;
13
+import io.swagger.annotations.ApiParam;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.*;
16
+
17
+import javax.servlet.http.HttpServletRequest;
18
+import java.util.HashMap;
19
+import java.util.Map;
20
+
21
+@Api(tags = "登入/登出")
22
+@RestController
23
+public class LoginController extends BaseController {
24
+
25
+    @Autowired
26
+    SMSCaptcha smsCaptcha;
27
+
28
+    @Autowired
29
+    ISysUserService iSysUserService;
30
+
31
+    @Autowired
32
+    ITaPersonService iTaPersonService;
33
+
34
+    @PostMapping("/admin/login")
35
+    @ApiOperation(value="登录", notes = "登录", httpMethod = "POST", response = ResponseBean.class)
36
+    public ResponseBean login(@ApiParam("登录参数") @RequestBody AdminLoginParam loginParam) throws Exception {
37
+        if (null == loginParam) {
38
+            return ResponseBean.error("账户或密码不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
39
+        }
40
+
41
+        String userName = loginParam.getUserName();
42
+        String password = loginParam.getPassword();
43
+
44
+        if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)) {
45
+            return ResponseBean.error("账户或密码不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
46
+        }
47
+
48
+        SysUser sysUser = iSysUserService.getByLoginName(userName);
49
+        if (null == sysUser) {
50
+            return ResponseBean.error("账户或密码不正确", ResponseBean.ERROR_ILLEGAL_PARAMS);
51
+        }
52
+
53
+        if (!checkPassword(password, sysUser.getPassword(), sysUser.getUserId())) {
54
+            return ResponseBean.error("账户或密码不正确", ResponseBean.ERROR_ILLEGAL_PARAMS);
55
+        }
56
+
57
+        if (Constants.STATUS_NORMAL != sysUser.getState()) {
58
+            return ResponseBean.error("用户状态不正确, 请联系管理人员", ResponseBean.ERROR_UNAVAILABLE);
59
+        }
60
+
61
+        // 生成 token
62
+        TokenParam tokenParam = new TokenParam()
63
+                .setUserId(sysUser.getUserId())
64
+                .setOrgId("0");
65
+
66
+        Map<String, Object> tokenMap = tokenParam.toMap();
67
+        String token = JWTUtils.encode(tokenMap);
68
+//        CurrentContext.setTokenParam(tokenMap);
69
+
70
+        Map<String, Object> res = new HashMap<String, Object>() {{
71
+            put("user", sysUser);
72
+            put("token", token);
73
+        }};
74
+        return ResponseBean.success(res);
75
+    }
76
+
77
+
78
+    @PutMapping("/admin/change-password")
79
+    @ApiOperation(value="修改密码", notes = "修改密码", httpMethod = "PUT", response = ResponseBean.class)
80
+    public ResponseBean changePassword(@ApiParam("修改密码参数") @RequestBody ChangePassword param,
81
+                                       HttpServletRequest request) throws Exception {
82
+        if (StringUtils.isEmpty(param.getOriginPassword()) || StringUtils.isEmpty(param.getNewPassword())) {
83
+            return ResponseBean.error("原始密码或新密码不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
84
+        }
85
+
86
+        SysUser currentUser = getCurrentUser(request);
87
+
88
+        if (!checkPassword(param.getOriginPassword(), currentUser.getPassword(), currentUser.getUserId())) {
89
+            return ResponseBean.error("原始密码不正确", ResponseBean.ERROR_ILLEGAL_PARAMS);
90
+        }
91
+
92
+        currentUser.setPassword(EncryptUtils.md5(param.getNewPassword(), currentUser.getUserId()));
93
+        iSysUserService.updateById(currentUser);
94
+
95
+        return ResponseBean.success("密码修改成功");
96
+    }
97
+
98
+
99
+//    @ApiParam("客户端登录")
100
+//    @PostMapping("/{appid}/login")
101
+//    public ResponseBean clientLogin(@ApiParam("APPID") @PathVariable String appid,
102
+//                                    @ApiParam("登录参数") @RequestBody LoginParam loginParam) throws Exception {
103
+//        if (null == loginParam) {
104
+//            return ResponseBean.error("登录参数不存在", ResponseBean.ERROR_ILLEGAL_PARAMS);
105
+//        }
106
+//
107
+//        if (StringUtils.isEmpty(loginParam.getName())
108
+//            || StringUtils.isEmpty(loginParam.getPhone())
109
+//            || StringUtils.isEmpty(loginParam.getCaptcha())) {
110
+//            return ResponseBean.error("登录参数不合法", ResponseBean.ERROR_ILLEGAL_PARAMS);
111
+//        }
112
+//
113
+//        boolean isCapatchRight = smsCaptcha.validate(loginParam.getPhone(), loginParam.getCaptcha());
114
+//        if (!isCapatchRight) {
115
+//            return ResponseBean.error("验证码不正确", ResponseBean.ERROR_ILLEGAL_PARAMS);
116
+//        }
117
+//
118
+//        TaPerson taPerson = iTaPersonService.getByPhone(loginParam.getPhone());
119
+//        if (null != taPerson) {
120
+//           return ResponseBean.success(taPerson);
121
+//        }
122
+//
123
+//        taPerson = new TaPerson();
124
+//        taPerson.setNickName(loginParam.getName());
125
+//        taPerson.setPhone(loginParam.getPhone());
126
+//        if (iTaPersonService.save(taPerson)) {
127
+//            Map<String, Object> result = new HashMap<>();
128
+//            result.put("person", taPerson);
129
+//
130
+//            return ResponseBean.success(taPerson);
131
+//        } else {
132
+//            return ResponseBean.error("登录失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
133
+//        }
134
+//    }
135
+
136
+//    @PutMapping("/admin/reset-password/{userId}")
137
+//    @ApiOperation(value="重置密码", notes = "重置密码", httpMethod = "PUT", response = ResponseBean.class)
138
+//    public ResponseBean resetPassword(@ApiParam("用户ID") @PathVariable String userId) throws Exception {
139
+//        SysLogin sysLogin = iSysLoginService.getByUser(userId);
140
+//
141
+//        String newPassword = EncryptUtils.md5(EncryptUtils.md5(Constants.DEFAULT_PASSWORD), userId);
142
+//        sysLogin.setPassword(newPassword);
143
+//        iSysLoginService.updateById(sysLogin);
144
+//
145
+//        return ResponseBean.success("重置密码成功");
146
+//    }
147
+
148
+    private boolean checkPassword(String src, String targ, String salt) {
149
+        return EncryptUtils.md5(src, salt).equals(targ);
150
+    }
151
+}

+ 119
- 0
src/main/java/com/yunzhi/training/controller/SysUserController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.training.common.BaseController;
7
+import com.yunzhi.training.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
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 com.yunzhi.training.service.ISysUserService;
20
+import com.yunzhi.training.entity.SysUser;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 用户表 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-02-18
30
+ */
31
+
32
+@Api(tags = "用户表")
33
+@RestController
34
+@RequestMapping("/")
35
+public class SysUserController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(SysUserController.class);
38
+
39
+    @Autowired
40
+    public ISysUserService iSysUserService;
41
+
42
+
43
+    /**
44
+     * 分页查询列表
45
+     * @param pageNum
46
+     * @param pageSize
47
+     * @return
48
+     */
49
+    @RequestMapping(value="/sysUser",method= RequestMethod.GET)
50
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+    public ResponseBean sysUserList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+
54
+		    IPage<SysUser> pg = new Page<>(pageNum, pageSize);
55
+            QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.orderByDesc("create_date");
57
+
58
+            IPage<SysUser> result = iSysUserService.page(pg, queryWrapper);
59
+            return ResponseBean.success(result);
60
+    }
61
+
62
+    /**
63
+     * 保存对象
64
+     * @param sysUser 实体对象
65
+     * @return
66
+     */
67
+    @RequestMapping(value="/sysUser",method= RequestMethod.POST)
68
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+    public ResponseBean sysUserAdd(@ApiParam("保存内容") @RequestBody SysUser sysUser) throws Exception{
70
+
71
+        if (iSysUserService.save(sysUser)){
72
+            return ResponseBean.success(sysUser);
73
+        }else {
74
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * 根据id删除对象
80
+     * @param id  实体ID
81
+     */
82
+    @RequestMapping(value="/sysUser/{id}", method= RequestMethod.DELETE)
83
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+    public ResponseBean sysUserDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+        if(iSysUserService.removeById(id)){
86
+            return ResponseBean.success("success");
87
+        }else {
88
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 修改对象
94
+     * @param id  实体ID
95
+     * @param sysUser 实体对象
96
+     * @return
97
+     */
98
+    @RequestMapping(value="/sysUser/{id}",method= RequestMethod.PUT)
99
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+    public ResponseBean sysUserUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+                                        @ApiParam("更新内容") @RequestBody SysUser sysUser) throws Exception{
102
+
103
+        if (iSysUserService.updateById(sysUser)){
104
+            return ResponseBean.success(iSysUserService.getById(id));
105
+        }else {
106
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+        }
108
+    }
109
+
110
+    /**
111
+     * 根据id查询对象
112
+     * @param id  实体ID
113
+     */
114
+    @RequestMapping(value="/sysUser/{id}",method= RequestMethod.GET)
115
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+    public ResponseBean sysUserGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+        return ResponseBean.success(iSysUserService.getById(id));
118
+    }
119
+}

+ 119
- 0
src/main/java/com/yunzhi/training/controller/TaActivityController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.training.common.BaseController;
7
+import com.yunzhi.training.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
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 com.yunzhi.training.service.ITaActivityService;
20
+import com.yunzhi.training.entity.TaActivity;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 活动表 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-02-18
30
+ */
31
+
32
+@Api(tags = "活动表")
33
+@RestController
34
+@RequestMapping("/")
35
+public class TaActivityController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(TaActivityController.class);
38
+
39
+    @Autowired
40
+    public ITaActivityService iTaActivityService;
41
+
42
+
43
+    /**
44
+     * 分页查询列表
45
+     * @param pageNum
46
+     * @param pageSize
47
+     * @return
48
+     */
49
+    @RequestMapping(value="/taActivity",method= RequestMethod.GET)
50
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+    public ResponseBean taActivityList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+
54
+		    IPage<TaActivity> pg = new Page<>(pageNum, pageSize);
55
+            QueryWrapper<TaActivity> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.orderByDesc("create_date");
57
+
58
+            IPage<TaActivity> result = iTaActivityService.page(pg, queryWrapper);
59
+            return ResponseBean.success(result);
60
+    }
61
+
62
+    /**
63
+     * 保存对象
64
+     * @param taActivity 实体对象
65
+     * @return
66
+     */
67
+    @RequestMapping(value="/taActivity",method= RequestMethod.POST)
68
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+    public ResponseBean taActivityAdd(@ApiParam("保存内容") @RequestBody TaActivity taActivity) throws Exception{
70
+
71
+        if (iTaActivityService.save(taActivity)){
72
+            return ResponseBean.success(taActivity);
73
+        }else {
74
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * 根据id删除对象
80
+     * @param id  实体ID
81
+     */
82
+    @RequestMapping(value="/taActivity/{id}", method= RequestMethod.DELETE)
83
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+    public ResponseBean taActivityDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+        if(iTaActivityService.removeById(id)){
86
+            return ResponseBean.success("success");
87
+        }else {
88
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 修改对象
94
+     * @param id  实体ID
95
+     * @param taActivity 实体对象
96
+     * @return
97
+     */
98
+    @RequestMapping(value="/taActivity/{id}",method= RequestMethod.PUT)
99
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+    public ResponseBean taActivityUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+                                        @ApiParam("更新内容") @RequestBody TaActivity taActivity) throws Exception{
102
+
103
+        if (iTaActivityService.updateById(taActivity)){
104
+            return ResponseBean.success(iTaActivityService.getById(id));
105
+        }else {
106
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+        }
108
+    }
109
+
110
+    /**
111
+     * 根据id查询对象
112
+     * @param id  实体ID
113
+     */
114
+    @RequestMapping(value="/taActivity/{id}",method= RequestMethod.GET)
115
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+    public ResponseBean taActivityGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+        return ResponseBean.success(iTaActivityService.getById(id));
118
+    }
119
+}

+ 119
- 0
src/main/java/com/yunzhi/training/controller/TaActivitySignController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.training.common.BaseController;
7
+import com.yunzhi.training.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
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 com.yunzhi.training.service.ITaActivitySignService;
20
+import com.yunzhi.training.entity.TaActivitySign;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 签到表 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-02-18
30
+ */
31
+
32
+@Api(tags = "签到表")
33
+@RestController
34
+@RequestMapping("/")
35
+public class TaActivitySignController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(TaActivitySignController.class);
38
+
39
+    @Autowired
40
+    public ITaActivitySignService iTaActivitySignService;
41
+
42
+
43
+    /**
44
+     * 分页查询列表
45
+     * @param pageNum
46
+     * @param pageSize
47
+     * @return
48
+     */
49
+    @RequestMapping(value="/taActivitySign",method= RequestMethod.GET)
50
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+    public ResponseBean taActivitySignList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+
54
+		    IPage<TaActivitySign> pg = new Page<>(pageNum, pageSize);
55
+            QueryWrapper<TaActivitySign> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.orderByDesc("create_date");
57
+
58
+            IPage<TaActivitySign> result = iTaActivitySignService.page(pg, queryWrapper);
59
+            return ResponseBean.success(result);
60
+    }
61
+
62
+    /**
63
+     * 保存对象
64
+     * @param taActivitySign 实体对象
65
+     * @return
66
+     */
67
+    @RequestMapping(value="/taActivitySign",method= RequestMethod.POST)
68
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+    public ResponseBean taActivitySignAdd(@ApiParam("保存内容") @RequestBody TaActivitySign taActivitySign) throws Exception{
70
+
71
+        if (iTaActivitySignService.save(taActivitySign)){
72
+            return ResponseBean.success(taActivitySign);
73
+        }else {
74
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * 根据id删除对象
80
+     * @param id  实体ID
81
+     */
82
+    @RequestMapping(value="/taActivitySign/{id}", method= RequestMethod.DELETE)
83
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+    public ResponseBean taActivitySignDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+        if(iTaActivitySignService.removeById(id)){
86
+            return ResponseBean.success("success");
87
+        }else {
88
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 修改对象
94
+     * @param id  实体ID
95
+     * @param taActivitySign 实体对象
96
+     * @return
97
+     */
98
+    @RequestMapping(value="/taActivitySign/{id}",method= RequestMethod.PUT)
99
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+    public ResponseBean taActivitySignUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+                                        @ApiParam("更新内容") @RequestBody TaActivitySign taActivitySign) throws Exception{
102
+
103
+        if (iTaActivitySignService.updateById(taActivitySign)){
104
+            return ResponseBean.success(iTaActivitySignService.getById(id));
105
+        }else {
106
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+        }
108
+    }
109
+
110
+    /**
111
+     * 根据id查询对象
112
+     * @param id  实体ID
113
+     */
114
+    @RequestMapping(value="/taActivitySign/{id}",method= RequestMethod.GET)
115
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+    public ResponseBean taActivitySignGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+        return ResponseBean.success(iTaActivitySignService.getById(id));
118
+    }
119
+}

+ 119
- 0
src/main/java/com/yunzhi/training/controller/TaAnswerController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.training.common.BaseController;
7
+import com.yunzhi.training.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
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 com.yunzhi.training.service.ITaAnswerService;
20
+import com.yunzhi.training.entity.TaAnswer;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 问题答案 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-02-18
30
+ */
31
+
32
+@Api(tags = "问题答案")
33
+@RestController
34
+@RequestMapping("/")
35
+public class TaAnswerController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(TaAnswerController.class);
38
+
39
+    @Autowired
40
+    public ITaAnswerService iTaAnswerService;
41
+
42
+
43
+    /**
44
+     * 分页查询列表
45
+     * @param pageNum
46
+     * @param pageSize
47
+     * @return
48
+     */
49
+    @RequestMapping(value="/taAnswer",method= RequestMethod.GET)
50
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+    public ResponseBean taAnswerList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+
54
+		    IPage<TaAnswer> pg = new Page<>(pageNum, pageSize);
55
+            QueryWrapper<TaAnswer> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.orderByDesc("create_date");
57
+
58
+            IPage<TaAnswer> result = iTaAnswerService.page(pg, queryWrapper);
59
+            return ResponseBean.success(result);
60
+    }
61
+
62
+    /**
63
+     * 保存对象
64
+     * @param taAnswer 实体对象
65
+     * @return
66
+     */
67
+    @RequestMapping(value="/taAnswer",method= RequestMethod.POST)
68
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+    public ResponseBean taAnswerAdd(@ApiParam("保存内容") @RequestBody TaAnswer taAnswer) throws Exception{
70
+
71
+        if (iTaAnswerService.save(taAnswer)){
72
+            return ResponseBean.success(taAnswer);
73
+        }else {
74
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * 根据id删除对象
80
+     * @param id  实体ID
81
+     */
82
+    @RequestMapping(value="/taAnswer/{id}", method= RequestMethod.DELETE)
83
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+    public ResponseBean taAnswerDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+        if(iTaAnswerService.removeById(id)){
86
+            return ResponseBean.success("success");
87
+        }else {
88
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 修改对象
94
+     * @param id  实体ID
95
+     * @param taAnswer 实体对象
96
+     * @return
97
+     */
98
+    @RequestMapping(value="/taAnswer/{id}",method= RequestMethod.PUT)
99
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+    public ResponseBean taAnswerUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+                                        @ApiParam("更新内容") @RequestBody TaAnswer taAnswer) throws Exception{
102
+
103
+        if (iTaAnswerService.updateById(taAnswer)){
104
+            return ResponseBean.success(iTaAnswerService.getById(id));
105
+        }else {
106
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+        }
108
+    }
109
+
110
+    /**
111
+     * 根据id查询对象
112
+     * @param id  实体ID
113
+     */
114
+    @RequestMapping(value="/taAnswer/{id}",method= RequestMethod.GET)
115
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+    public ResponseBean taAnswerGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+        return ResponseBean.success(iTaAnswerService.getById(id));
118
+    }
119
+}

+ 119
- 0
src/main/java/com/yunzhi/training/controller/TaAttachmentController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.training.common.BaseController;
7
+import com.yunzhi.training.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
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 com.yunzhi.training.service.ITaAttachmentService;
20
+import com.yunzhi.training.entity.TaAttachment;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 附件表 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-02-18
30
+ */
31
+
32
+@Api(tags = "附件表")
33
+@RestController
34
+@RequestMapping("/")
35
+public class TaAttachmentController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(TaAttachmentController.class);
38
+
39
+    @Autowired
40
+    public ITaAttachmentService iTaAttachmentService;
41
+
42
+
43
+    /**
44
+     * 分页查询列表
45
+     * @param pageNum
46
+     * @param pageSize
47
+     * @return
48
+     */
49
+    @RequestMapping(value="/taAttachment",method= RequestMethod.GET)
50
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+    public ResponseBean taAttachmentList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+
54
+		    IPage<TaAttachment> pg = new Page<>(pageNum, pageSize);
55
+            QueryWrapper<TaAttachment> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.orderByDesc("create_date");
57
+
58
+            IPage<TaAttachment> result = iTaAttachmentService.page(pg, queryWrapper);
59
+            return ResponseBean.success(result);
60
+    }
61
+
62
+    /**
63
+     * 保存对象
64
+     * @param taAttachment 实体对象
65
+     * @return
66
+     */
67
+    @RequestMapping(value="/taAttachment",method= RequestMethod.POST)
68
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+    public ResponseBean taAttachmentAdd(@ApiParam("保存内容") @RequestBody TaAttachment taAttachment) throws Exception{
70
+
71
+        if (iTaAttachmentService.save(taAttachment)){
72
+            return ResponseBean.success(taAttachment);
73
+        }else {
74
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * 根据id删除对象
80
+     * @param id  实体ID
81
+     */
82
+    @RequestMapping(value="/taAttachment/{id}", method= RequestMethod.DELETE)
83
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+    public ResponseBean taAttachmentDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+        if(iTaAttachmentService.removeById(id)){
86
+            return ResponseBean.success("success");
87
+        }else {
88
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 修改对象
94
+     * @param id  实体ID
95
+     * @param taAttachment 实体对象
96
+     * @return
97
+     */
98
+    @RequestMapping(value="/taAttachment/{id}",method= RequestMethod.PUT)
99
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+    public ResponseBean taAttachmentUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+                                        @ApiParam("更新内容") @RequestBody TaAttachment taAttachment) throws Exception{
102
+
103
+        if (iTaAttachmentService.updateById(taAttachment)){
104
+            return ResponseBean.success(iTaAttachmentService.getById(id));
105
+        }else {
106
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+        }
108
+    }
109
+
110
+    /**
111
+     * 根据id查询对象
112
+     * @param id  实体ID
113
+     */
114
+    @RequestMapping(value="/taAttachment/{id}",method= RequestMethod.GET)
115
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+    public ResponseBean taAttachmentGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+        return ResponseBean.success(iTaAttachmentService.getById(id));
118
+    }
119
+}

+ 119
- 0
src/main/java/com/yunzhi/training/controller/TaPersonController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.training.common.BaseController;
7
+import com.yunzhi.training.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
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 com.yunzhi.training.service.ITaPersonService;
20
+import com.yunzhi.training.entity.TaPerson;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 人员表 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-02-18
30
+ */
31
+
32
+@Api(tags = "人员表")
33
+@RestController
34
+@RequestMapping("/")
35
+public class TaPersonController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(TaPersonController.class);
38
+
39
+    @Autowired
40
+    public ITaPersonService iTaPersonService;
41
+
42
+
43
+    /**
44
+     * 分页查询列表
45
+     * @param pageNum
46
+     * @param pageSize
47
+     * @return
48
+     */
49
+    @RequestMapping(value="/taPerson",method= RequestMethod.GET)
50
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+    public ResponseBean taPersonList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+
54
+		    IPage<TaPerson> pg = new Page<>(pageNum, pageSize);
55
+            QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.orderByDesc("create_date");
57
+
58
+            IPage<TaPerson> result = iTaPersonService.page(pg, queryWrapper);
59
+            return ResponseBean.success(result);
60
+    }
61
+
62
+    /**
63
+     * 保存对象
64
+     * @param taPerson 实体对象
65
+     * @return
66
+     */
67
+    @RequestMapping(value="/taPerson",method= RequestMethod.POST)
68
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+    public ResponseBean taPersonAdd(@ApiParam("保存内容") @RequestBody TaPerson taPerson) throws Exception{
70
+
71
+        if (iTaPersonService.save(taPerson)){
72
+            return ResponseBean.success(taPerson);
73
+        }else {
74
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * 根据id删除对象
80
+     * @param id  实体ID
81
+     */
82
+    @RequestMapping(value="/taPerson/{id}", method= RequestMethod.DELETE)
83
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+    public ResponseBean taPersonDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+        if(iTaPersonService.removeById(id)){
86
+            return ResponseBean.success("success");
87
+        }else {
88
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 修改对象
94
+     * @param id  实体ID
95
+     * @param taPerson 实体对象
96
+     * @return
97
+     */
98
+    @RequestMapping(value="/taPerson/{id}",method= RequestMethod.PUT)
99
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+    public ResponseBean taPersonUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+                                        @ApiParam("更新内容") @RequestBody TaPerson taPerson) throws Exception{
102
+
103
+        if (iTaPersonService.updateById(taPerson)){
104
+            return ResponseBean.success(iTaPersonService.getById(id));
105
+        }else {
106
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+        }
108
+    }
109
+
110
+    /**
111
+     * 根据id查询对象
112
+     * @param id  实体ID
113
+     */
114
+    @RequestMapping(value="/taPerson/{id}",method= RequestMethod.GET)
115
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+    public ResponseBean taPersonGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+        return ResponseBean.success(iTaPersonService.getById(id));
118
+    }
119
+}

+ 119
- 0
src/main/java/com/yunzhi/training/controller/TaQuePersonController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.training.common.BaseController;
7
+import com.yunzhi.training.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
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 com.yunzhi.training.service.ITaQuePersonService;
20
+import com.yunzhi.training.entity.TaQuePerson;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 问卷参与人 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-02-18
30
+ */
31
+
32
+@Api(tags = "问卷参与人")
33
+@RestController
34
+@RequestMapping("/")
35
+public class TaQuePersonController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(TaQuePersonController.class);
38
+
39
+    @Autowired
40
+    public ITaQuePersonService iTaQuePersonService;
41
+
42
+
43
+    /**
44
+     * 分页查询列表
45
+     * @param pageNum
46
+     * @param pageSize
47
+     * @return
48
+     */
49
+    @RequestMapping(value="/taQuePerson",method= RequestMethod.GET)
50
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+    public ResponseBean taQuePersonList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+
54
+		    IPage<TaQuePerson> pg = new Page<>(pageNum, pageSize);
55
+            QueryWrapper<TaQuePerson> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.orderByDesc("create_date");
57
+
58
+            IPage<TaQuePerson> result = iTaQuePersonService.page(pg, queryWrapper);
59
+            return ResponseBean.success(result);
60
+    }
61
+
62
+    /**
63
+     * 保存对象
64
+     * @param taQuePerson 实体对象
65
+     * @return
66
+     */
67
+    @RequestMapping(value="/taQuePerson",method= RequestMethod.POST)
68
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+    public ResponseBean taQuePersonAdd(@ApiParam("保存内容") @RequestBody TaQuePerson taQuePerson) throws Exception{
70
+
71
+        if (iTaQuePersonService.save(taQuePerson)){
72
+            return ResponseBean.success(taQuePerson);
73
+        }else {
74
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * 根据id删除对象
80
+     * @param id  实体ID
81
+     */
82
+    @RequestMapping(value="/taQuePerson/{id}", method= RequestMethod.DELETE)
83
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+    public ResponseBean taQuePersonDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+        if(iTaQuePersonService.removeById(id)){
86
+            return ResponseBean.success("success");
87
+        }else {
88
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 修改对象
94
+     * @param id  实体ID
95
+     * @param taQuePerson 实体对象
96
+     * @return
97
+     */
98
+    @RequestMapping(value="/taQuePerson/{id}",method= RequestMethod.PUT)
99
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+    public ResponseBean taQuePersonUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+                                        @ApiParam("更新内容") @RequestBody TaQuePerson taQuePerson) throws Exception{
102
+
103
+        if (iTaQuePersonService.updateById(taQuePerson)){
104
+            return ResponseBean.success(iTaQuePersonService.getById(id));
105
+        }else {
106
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+        }
108
+    }
109
+
110
+    /**
111
+     * 根据id查询对象
112
+     * @param id  实体ID
113
+     */
114
+    @RequestMapping(value="/taQuePerson/{id}",method= RequestMethod.GET)
115
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+    public ResponseBean taQuePersonGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+        return ResponseBean.success(iTaQuePersonService.getById(id));
118
+    }
119
+}

+ 119
- 0
src/main/java/com/yunzhi/training/controller/TaQuestionController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.training.common.BaseController;
7
+import com.yunzhi.training.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
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 com.yunzhi.training.service.ITaQuestionService;
20
+import com.yunzhi.training.entity.TaQuestion;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 问卷问题 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-02-18
30
+ */
31
+
32
+@Api(tags = "问卷问题")
33
+@RestController
34
+@RequestMapping("/")
35
+public class TaQuestionController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(TaQuestionController.class);
38
+
39
+    @Autowired
40
+    public ITaQuestionService iTaQuestionService;
41
+
42
+
43
+    /**
44
+     * 分页查询列表
45
+     * @param pageNum
46
+     * @param pageSize
47
+     * @return
48
+     */
49
+    @RequestMapping(value="/taQuestion",method= RequestMethod.GET)
50
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+    public ResponseBean taQuestionList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+
54
+		    IPage<TaQuestion> pg = new Page<>(pageNum, pageSize);
55
+            QueryWrapper<TaQuestion> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.orderByDesc("create_date");
57
+
58
+            IPage<TaQuestion> result = iTaQuestionService.page(pg, queryWrapper);
59
+            return ResponseBean.success(result);
60
+    }
61
+
62
+    /**
63
+     * 保存对象
64
+     * @param taQuestion 实体对象
65
+     * @return
66
+     */
67
+    @RequestMapping(value="/taQuestion",method= RequestMethod.POST)
68
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+    public ResponseBean taQuestionAdd(@ApiParam("保存内容") @RequestBody TaQuestion taQuestion) throws Exception{
70
+
71
+        if (iTaQuestionService.save(taQuestion)){
72
+            return ResponseBean.success(taQuestion);
73
+        }else {
74
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * 根据id删除对象
80
+     * @param id  实体ID
81
+     */
82
+    @RequestMapping(value="/taQuestion/{id}", method= RequestMethod.DELETE)
83
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+    public ResponseBean taQuestionDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+        if(iTaQuestionService.removeById(id)){
86
+            return ResponseBean.success("success");
87
+        }else {
88
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 修改对象
94
+     * @param id  实体ID
95
+     * @param taQuestion 实体对象
96
+     * @return
97
+     */
98
+    @RequestMapping(value="/taQuestion/{id}",method= RequestMethod.PUT)
99
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+    public ResponseBean taQuestionUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+                                        @ApiParam("更新内容") @RequestBody TaQuestion taQuestion) throws Exception{
102
+
103
+        if (iTaQuestionService.updateById(taQuestion)){
104
+            return ResponseBean.success(iTaQuestionService.getById(id));
105
+        }else {
106
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+        }
108
+    }
109
+
110
+    /**
111
+     * 根据id查询对象
112
+     * @param id  实体ID
113
+     */
114
+    @RequestMapping(value="/taQuestion/{id}",method= RequestMethod.GET)
115
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+    public ResponseBean taQuestionGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+        return ResponseBean.success(iTaQuestionService.getById(id));
118
+    }
119
+}

+ 119
- 0
src/main/java/com/yunzhi/training/controller/TaQuestionPersonController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.training.common.BaseController;
7
+import com.yunzhi.training.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
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 com.yunzhi.training.service.ITaQuestionPersonService;
20
+import com.yunzhi.training.entity.TaQuestionPerson;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 答卷明细 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-02-18
30
+ */
31
+
32
+@Api(tags = "答卷明细")
33
+@RestController
34
+@RequestMapping("/")
35
+public class TaQuestionPersonController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(TaQuestionPersonController.class);
38
+
39
+    @Autowired
40
+    public ITaQuestionPersonService iTaQuestionPersonService;
41
+
42
+
43
+    /**
44
+     * 分页查询列表
45
+     * @param pageNum
46
+     * @param pageSize
47
+     * @return
48
+     */
49
+    @RequestMapping(value="/taQuestionPerson",method= RequestMethod.GET)
50
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+    public ResponseBean taQuestionPersonList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+
54
+		    IPage<TaQuestionPerson> pg = new Page<>(pageNum, pageSize);
55
+            QueryWrapper<TaQuestionPerson> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.orderByDesc("create_date");
57
+
58
+            IPage<TaQuestionPerson> result = iTaQuestionPersonService.page(pg, queryWrapper);
59
+            return ResponseBean.success(result);
60
+    }
61
+
62
+    /**
63
+     * 保存对象
64
+     * @param taQuestionPerson 实体对象
65
+     * @return
66
+     */
67
+    @RequestMapping(value="/taQuestionPerson",method= RequestMethod.POST)
68
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+    public ResponseBean taQuestionPersonAdd(@ApiParam("保存内容") @RequestBody TaQuestionPerson taQuestionPerson) throws Exception{
70
+
71
+        if (iTaQuestionPersonService.save(taQuestionPerson)){
72
+            return ResponseBean.success(taQuestionPerson);
73
+        }else {
74
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * 根据id删除对象
80
+     * @param id  实体ID
81
+     */
82
+    @RequestMapping(value="/taQuestionPerson/{id}", method= RequestMethod.DELETE)
83
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+    public ResponseBean taQuestionPersonDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+        if(iTaQuestionPersonService.removeById(id)){
86
+            return ResponseBean.success("success");
87
+        }else {
88
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 修改对象
94
+     * @param id  实体ID
95
+     * @param taQuestionPerson 实体对象
96
+     * @return
97
+     */
98
+    @RequestMapping(value="/taQuestionPerson/{id}",method= RequestMethod.PUT)
99
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+    public ResponseBean taQuestionPersonUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+                                        @ApiParam("更新内容") @RequestBody TaQuestionPerson taQuestionPerson) throws Exception{
102
+
103
+        if (iTaQuestionPersonService.updateById(taQuestionPerson)){
104
+            return ResponseBean.success(iTaQuestionPersonService.getById(id));
105
+        }else {
106
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+        }
108
+    }
109
+
110
+    /**
111
+     * 根据id查询对象
112
+     * @param id  实体ID
113
+     */
114
+    @RequestMapping(value="/taQuestionPerson/{id}",method= RequestMethod.GET)
115
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+    public ResponseBean taQuestionPersonGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+        return ResponseBean.success(iTaQuestionPersonService.getById(id));
118
+    }
119
+}

+ 119
- 0
src/main/java/com/yunzhi/training/controller/TaQuestionnaireController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.training.common.BaseController;
7
+import com.yunzhi.training.common.ResponseBean;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestBody;
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 com.yunzhi.training.service.ITaQuestionnaireService;
20
+import com.yunzhi.training.entity.TaQuestionnaire;
21
+import org.springframework.web.bind.annotation.RestController;
22
+
23
+/**
24
+ * <p>
25
+    * 问卷调查 前端控制器
26
+    * </p>
27
+ *
28
+ * @author yansen
29
+ * @since 2022-02-18
30
+ */
31
+
32
+@Api(tags = "问卷调查")
33
+@RestController
34
+@RequestMapping("/")
35
+public class TaQuestionnaireController extends BaseController {
36
+
37
+    private final Logger logger = LoggerFactory.getLogger(TaQuestionnaireController.class);
38
+
39
+    @Autowired
40
+    public ITaQuestionnaireService iTaQuestionnaireService;
41
+
42
+
43
+    /**
44
+     * 分页查询列表
45
+     * @param pageNum
46
+     * @param pageSize
47
+     * @return
48
+     */
49
+    @RequestMapping(value="/taQuestionnaire",method= RequestMethod.GET)
50
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
+    public ResponseBean taQuestionnaireList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
+
54
+		    IPage<TaQuestionnaire> pg = new Page<>(pageNum, pageSize);
55
+            QueryWrapper<TaQuestionnaire> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.orderByDesc("create_date");
57
+
58
+            IPage<TaQuestionnaire> result = iTaQuestionnaireService.page(pg, queryWrapper);
59
+            return ResponseBean.success(result);
60
+    }
61
+
62
+    /**
63
+     * 保存对象
64
+     * @param taQuestionnaire 实体对象
65
+     * @return
66
+     */
67
+    @RequestMapping(value="/taQuestionnaire",method= RequestMethod.POST)
68
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
+    public ResponseBean taQuestionnaireAdd(@ApiParam("保存内容") @RequestBody TaQuestionnaire taQuestionnaire) throws Exception{
70
+
71
+        if (iTaQuestionnaireService.save(taQuestionnaire)){
72
+            return ResponseBean.success(taQuestionnaire);
73
+        }else {
74
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * 根据id删除对象
80
+     * @param id  实体ID
81
+     */
82
+    @RequestMapping(value="/taQuestionnaire/{id}", method= RequestMethod.DELETE)
83
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
+    public ResponseBean taQuestionnaireDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
+        if(iTaQuestionnaireService.removeById(id)){
86
+            return ResponseBean.success("success");
87
+        }else {
88
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * 修改对象
94
+     * @param id  实体ID
95
+     * @param taQuestionnaire 实体对象
96
+     * @return
97
+     */
98
+    @RequestMapping(value="/taQuestionnaire/{id}",method= RequestMethod.PUT)
99
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
+    public ResponseBean taQuestionnaireUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
+                                        @ApiParam("更新内容") @RequestBody TaQuestionnaire taQuestionnaire) throws Exception{
102
+
103
+        if (iTaQuestionnaireService.updateById(taQuestionnaire)){
104
+            return ResponseBean.success(iTaQuestionnaireService.getById(id));
105
+        }else {
106
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
+        }
108
+    }
109
+
110
+    /**
111
+     * 根据id查询对象
112
+     * @param id  实体ID
113
+     */
114
+    @RequestMapping(value="/taQuestionnaire/{id}",method= RequestMethod.GET)
115
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
+    public ResponseBean taQuestionnaireGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
+        return ResponseBean.success(iTaQuestionnaireService.getById(id));
118
+    }
119
+}

+ 201
- 0
src/main/java/com/yunzhi/training/controller/WxMpController.java View File

1
+package com.yunzhi.training.controller;
2
+
3
+import com.yunzhi.training.common.*;
4
+import lombok.extern.slf4j.Slf4j;
5
+import org.springframework.web.bind.annotation.*;
6
+
7
+@Slf4j
8
+@RestController
9
+public class WxMpController extends BaseController {
10
+//
11
+//    @Autowired
12
+//    private ITaMpSettingService iTaMpSettingService;
13
+//
14
+//    @Autowired
15
+//    WxUtils wxUtils;
16
+//
17
+//    @Autowired
18
+//    OSSUtils ossUtils;
19
+//
20
+//    @Value("${sysBiz.miniapp.title}")
21
+//    String miniAppTtitle;
22
+//
23
+//    @Value("${sysBiz.miniapp.indexPage}")
24
+//    String miniAppIndex;
25
+//
26
+//    /**
27
+//     * 微信公众号接入
28
+//     * @param appid
29
+//     * @param signature
30
+//     * @param timestamp
31
+//     * @param nonce
32
+//     * @param echostr
33
+//     * @return
34
+//     */
35
+//    @GetMapping(path = "/mp/portal/{appid}", produces = "text/plain;charset=utf-8")
36
+//    public String authGet(@PathVariable String appid,
37
+//                          @RequestParam(name = "signature", required = false) String signature,
38
+//                          @RequestParam(name = "timestamp", required = false) String timestamp,
39
+//                          @RequestParam(name = "nonce", required = false) String nonce,
40
+//                          @RequestParam(name = "echostr", required = false) String echostr) {
41
+//        return echostr;
42
+//    }
43
+//
44
+//    @PostMapping(path = "/mp/portal/{appid}", produces = "application/xml; charset=UTF-8")
45
+//    public String post(@PathVariable String appid,
46
+//                       @RequestBody String requestBody,
47
+//                       @RequestParam("signature") String signature,
48
+//                       @RequestParam("timestamp") String timestamp,
49
+//                       @RequestParam("nonce") String nonce,
50
+//                       @RequestParam("openid") String openid,
51
+//                       @RequestParam(name = "encrypt_type", required = false) String encType,
52
+//                       @RequestParam(name = "msg_signature", required = false) String msgSignature) {
53
+//
54
+//        log.info("\n接收微信请求:[openid=[{}], [signature=[{}], encType=[{}], msgSignature=[{}],"
55
+//                        + " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ",
56
+//                openid, signature, encType, msgSignature, timestamp, nonce, requestBody);
57
+//
58
+//        WxMpService mpService = wxUtils.getMpService();
59
+//        if (null == mpService) {
60
+//            throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
61
+//        }
62
+//
63
+//        if (!mpService.checkSignature(timestamp, nonce, signature)) {
64
+//            throw new IllegalArgumentException("非法请求,可能属于伪造的请求!");
65
+//        }
66
+//
67
+//        WxMpXmlMessage inMessage = null;
68
+//        if (encType == null) {
69
+//            // 明文传输的消息
70
+//            inMessage = WxMpXmlMessage.fromXml(requestBody);
71
+//        } else if ("aes".equalsIgnoreCase(encType)) {
72
+//            // aes加密的消息
73
+//            inMessage = WxMpXmlMessage.fromEncryptedXml(requestBody, mpService.getWxMpConfigStorage(),
74
+//                    timestamp, nonce, msgSignature);
75
+//            log.debug("\n消息解密后内容为:\n{} ", inMessage.toString());
76
+//        }
77
+//
78
+//        // 关注公众号
79
+//        if (inMessage.getMsgType().equals(WxConsts.XmlMsgType.EVENT) && inMessage.getEvent().equals(WxConsts.EventType.SUBSCRIBE)) {
80
+//            // 发送客服消息
81
+//            sendMiniAppKefuMessage(mpService, openid);
82
+//        }
83
+//
84
+//        return "";
85
+//    }
86
+//
87
+//    private void sendMiniAppKefuMessage(WxMpService mpService, String openid) {
88
+//        // 客服消息封面
89
+//        TaMpSetting taMpSetting = iTaMpSettingService.getKFPoster(wxUtils.getMpConf().getAppid());
90
+//        if (null == taMpSetting) {
91
+//            log.error("发送客服消息失败, 暂无小程序封面信息");
92
+//            return;
93
+//        }
94
+//
95
+//        String[] parts = taMpSetting.getSettingValue().split("\\|");
96
+//        if (parts.length != 2) {
97
+//            log.error("发送客服消息失败, 小程序封面信息错误");
98
+//            return;
99
+//        }
100
+//
101
+//        String mediaId = parts[0];
102
+//
103
+//        String miniAppId = wxUtils.getMiniappConf().getAppid();
104
+//        WxMpKefuMessage kefuMessage = WxMpKefuMessage.MINIPROGRAMPAGE().appId(miniAppId)
105
+//                .toUser(openid)
106
+//                .title(miniAppTtitle + "欢迎您!")
107
+//                .pagePath(miniAppIndex + "?mpOpenId=" + openid )
108
+//                .thumbMediaId(mediaId)
109
+//                .build();
110
+//
111
+//        try {
112
+//            mpService.getKefuService().sendKefuMessage(kefuMessage);
113
+//        } catch (WxErrorException e) {
114
+//            e.printStackTrace();
115
+//        }
116
+//    }
117
+//
118
+//    /**
119
+//     * 暂时仅支持 jpg
120
+//     * @param multipartFile
121
+//     * @param request
122
+//     * @return
123
+//     */
124
+//    @PostMapping("/admin/mp/material/miniapp")
125
+//    public ResponseBean postMpMiniappMedia(@RequestParam("file") MultipartFile multipartFile,
126
+//                                           HttpServletRequest request) {
127
+//        if (multipartFile.isEmpty()) {
128
+//            return ResponseBean.error("请选择文件上传", ResponseBean.ERROR_MISSING_PARAMS);
129
+//        }
130
+//
131
+//        try {
132
+//            File tempFile = multipartFileToFile(multipartFile);
133
+//
134
+//            WxMpMaterial wxMaterial = new WxMpMaterial();
135
+//            wxMaterial.setFile(tempFile);
136
+//            wxMaterial.setName("kf-message-poster.jpg");
137
+//
138
+//            WxMpMaterialUploadResult res = wxUtils.getMpService().getMaterialService().materialFileUpload(WxConsts.MaterialType.IMAGE, wxMaterial);
139
+//            String mediaId = res.getMediaId();
140
+//
141
+//            if (StringUtils.isEmpty(mediaId)) {
142
+//                log.error("上传图片到微信失败 [{}]: {}", res.getErrCode(), res.getErrMsg());
143
+//                return ResponseBean.error("上传图片到微信失败: " + res.getErrMsg(), ResponseBean.ERROR_UNAVAILABLE);
144
+//            }
145
+//
146
+//            String imageUrl = ossUtils.putObject(tempFile);
147
+//            String settingValue = String.format("%s|%s", mediaId, imageUrl);
148
+//
149
+//            String mpAppid = wxUtils.getMpConf().getAppid();
150
+//            TaMpSetting taMpSetting = iTaMpSettingService.getKFPoster(mpAppid);
151
+//            if (null == taMpSetting) {
152
+//                taMpSetting = new TaMpSetting();
153
+//                taMpSetting.setAppid(mpAppid);
154
+//                taMpSetting.setSettingCode(Constants.MP_SETTING_MINIAPP_POSTER);
155
+//                taMpSetting.setSettingValue(settingValue);
156
+//                iTaMpSettingService.save(taMpSetting);
157
+//            } else {
158
+//                taMpSetting.setSettingValue(settingValue);
159
+//                iTaMpSettingService.updateById(taMpSetting);
160
+//            }
161
+//
162
+//            // 删除临时文件
163
+//            tempFile.delete();
164
+//
165
+//            return ResponseBean.success(taMpSetting);
166
+//
167
+//        } catch (IOException e) {
168
+//            e.printStackTrace();
169
+//            return ResponseBean.error("接收图片失败: " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
170
+//        } catch (WxErrorException e) {
171
+//            e.printStackTrace();
172
+//            return ResponseBean.error("上传图片到微信失败: " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
173
+//        }
174
+//    }
175
+//
176
+//    private File multipartFileToFile(MultipartFile multiFile) throws IOException {
177
+//        // 获取文件名
178
+//        String fileName = multiFile.getOriginalFilename();
179
+//        // sep
180
+//        int pos = fileName.lastIndexOf(".");
181
+//        //
182
+//        String prefix = fileName.substring(0, pos);
183
+//        String suffix = fileName.substring(pos);
184
+//
185
+//        File tempFile = File.createTempFile(prefix, suffix);
186
+//        multiFile.transferTo(tempFile);
187
+//        return tempFile;
188
+//    }
189
+//
190
+//
191
+//    /**
192
+//     * 获取消息封面
193
+//     * @return
194
+//     */
195
+//    @GetMapping("/admin/mp/material/miniapp")
196
+//    public ResponseBean postMpMiniappMedia() {
197
+//        String mpAppid = wxUtils.getMpConf().getAppid();
198
+//        TaMpSetting taMpSetting = iTaMpSettingService.getKFPoster(mpAppid);
199
+//        return ResponseBean.success(taMpSetting);
200
+//    }
201
+}

+ 52
- 0
src/main/java/com/yunzhi/training/entity/SysUser.java View File

1
+package com.yunzhi.training.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 用户表
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-02-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="SysUser对象", description="用户表")
25
+public class SysUser implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "用户ID")
30
+    @TableId(value = "user_id", type = IdType.INPUT)
31
+    private String userId;
32
+
33
+    @ApiModelProperty(value = "用户名")
34
+    private String name;
35
+
36
+    @ApiModelProperty(value = "登录名")
37
+    private String loginName;
38
+
39
+    @ApiModelProperty(value = "密码")
40
+    private String password;
41
+
42
+    @ApiModelProperty(value = "手机号")
43
+    private String phone;
44
+
45
+    @ApiModelProperty(value = "状态")
46
+    private Integer state;
47
+
48
+    @ApiModelProperty(value = "创建时间")
49
+    private LocalDateTime createDate;
50
+
51
+
52
+}

+ 55
- 0
src/main/java/com/yunzhi/training/entity/TaActivity.java View File

1
+package com.yunzhi.training.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 活动表
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-02-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaActivity对象", description="活动表")
25
+public class TaActivity implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "课程ID")
30
+    @TableId(value = "activity_id", type = IdType.INPUT)
31
+    private String activityId;
32
+
33
+    @ApiModelProperty(value = "名称")
34
+    private String name;
35
+
36
+    @ApiModelProperty(value = "计划人数")
37
+    private Integer studentNum;
38
+
39
+    @ApiModelProperty(value = "参与人数")
40
+    private Integer joinedNum;
41
+
42
+    @ApiModelProperty(value = "开始时间")
43
+    private LocalDateTime startTime;
44
+
45
+    @ApiModelProperty(value = "结束时间")
46
+    private LocalDateTime endTime;
47
+
48
+    @ApiModelProperty(value = "状态")
49
+    private Integer state;
50
+
51
+    @ApiModelProperty(value = "创建时间")
52
+    private LocalDateTime createDate;
53
+
54
+
55
+}

+ 43
- 0
src/main/java/com/yunzhi/training/entity/TaActivitySign.java View File

1
+package com.yunzhi.training.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.time.LocalDateTime;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 签到表
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-02-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaActivitySign对象", description="签到表")
25
+public class TaActivitySign implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "签到ID")
30
+    @TableId(value = "sign_id", type = IdType.AUTO)
31
+    private Integer signId;
32
+
33
+    @ApiModelProperty(value = "人员ID")
34
+    private String personId;
35
+
36
+    @ApiModelProperty(value = "活动ID")
37
+    private String activityId;
38
+
39
+    @ApiModelProperty(value = "创建时间")
40
+    private LocalDateTime createDate;
41
+
42
+
43
+}

+ 52
- 0
src/main/java/com/yunzhi/training/entity/TaAnswer.java View File

1
+package com.yunzhi.training.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 问题答案
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-02-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaAnswer对象", description="问题答案")
25
+public class TaAnswer implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "答案ID")
30
+    @TableId(value = "answer_id", type = IdType.INPUT)
31
+    private String answerId;
32
+
33
+    @ApiModelProperty(value = "选项")
34
+    private String optCode;
35
+
36
+    @ApiModelProperty(value = "内容")
37
+    private String content;
38
+
39
+    @ApiModelProperty(value = "得分")
40
+    private Integer score;
41
+
42
+    @ApiModelProperty(value = "问题ID")
43
+    private String questionId;
44
+
45
+    @ApiModelProperty(value = "状态")
46
+    private Integer state;
47
+
48
+    @ApiModelProperty(value = "创建时间")
49
+    private LocalDateTime createDate;
50
+
51
+
52
+}

+ 52
- 0
src/main/java/com/yunzhi/training/entity/TaAttachment.java View File

1
+package com.yunzhi.training.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 附件表
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-02-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaAttachment对象", description="附件表")
25
+public class TaAttachment implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "附件ID")
30
+    @TableId(value = "attch_id", type = IdType.INPUT)
31
+    private String attchId;
32
+
33
+    @ApiModelProperty(value = "附件类型")
34
+    private String attchType;
35
+
36
+    @ApiModelProperty(value = "附件地址")
37
+    private String url;
38
+
39
+    @ApiModelProperty(value = "所属包组")
40
+    private String packId;
41
+
42
+    @ApiModelProperty(value = "包组名称")
43
+    private String packName;
44
+
45
+    @ApiModelProperty(value = "状态")
46
+    private Integer state;
47
+
48
+    @ApiModelProperty(value = "创建时间")
49
+    private LocalDateTime createDate;
50
+
51
+
52
+}

+ 55
- 0
src/main/java/com/yunzhi/training/entity/TaPerson.java View File

1
+package com.yunzhi.training.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 人员表
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-02-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaPerson对象", description="人员表")
25
+public class TaPerson implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "人员ID")
30
+    @TableId(value = "person_id", type = IdType.INPUT)
31
+    private String personId;
32
+
33
+    @ApiModelProperty(value = "openid")
34
+    private String openid;
35
+
36
+    @ApiModelProperty(value = "名称")
37
+    private String name;
38
+
39
+    @ApiModelProperty(value = "性别")
40
+    private Integer sex;
41
+
42
+    @ApiModelProperty(value = "手机号")
43
+    private String phone;
44
+
45
+    @ApiModelProperty(value = "身份")
46
+    private String personType;
47
+
48
+    @ApiModelProperty(value = "状态")
49
+    private Integer state;
50
+
51
+    @ApiModelProperty(value = "创建时间")
52
+    private LocalDateTime createDate;
53
+
54
+
55
+}

+ 49
- 0
src/main/java/com/yunzhi/training/entity/TaQuePerson.java View File

1
+package com.yunzhi.training.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.time.LocalDateTime;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 问卷参与人
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-02-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaQuePerson对象", description="问卷参与人")
25
+public class TaQuePerson implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "序号")
30
+    @TableId(value = "serial_no", type = IdType.AUTO)
31
+    private Integer serialNo;
32
+
33
+    @ApiModelProperty(value = "人员ID")
34
+    private String personId;
35
+
36
+    @ApiModelProperty(value = "得分")
37
+    private Integer score;
38
+
39
+    @ApiModelProperty(value = "问卷ID")
40
+    private String queId;
41
+
42
+    @ApiModelProperty(value = "状态")
43
+    private Integer state;
44
+
45
+    @ApiModelProperty(value = "创建时间")
46
+    private LocalDateTime createDate;
47
+
48
+
49
+}

+ 49
- 0
src/main/java/com/yunzhi/training/entity/TaQuestion.java View File

1
+package com.yunzhi.training.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 问卷问题
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-02-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaQuestion对象", description="问卷问题")
25
+public class TaQuestion implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "问题ID")
30
+    @TableId(value = "question_id", type = IdType.INPUT)
31
+    private String questionId;
32
+
33
+    @ApiModelProperty(value = "问题内容")
34
+    private String content;
35
+
36
+    @ApiModelProperty(value = "排序")
37
+    private Integer sortNo;
38
+
39
+    @ApiModelProperty(value = "问卷ID")
40
+    private String queId;
41
+
42
+    @ApiModelProperty(value = "状态")
43
+    private Integer state;
44
+
45
+    @ApiModelProperty(value = "创建时间")
46
+    private LocalDateTime createDate;
47
+
48
+
49
+}

+ 52
- 0
src/main/java/com/yunzhi/training/entity/TaQuestionPerson.java View File

1
+package com.yunzhi.training.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.time.LocalDateTime;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 答卷明细
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-02-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaQuestionPerson对象", description="答卷明细")
25
+public class TaQuestionPerson implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "序号")
30
+    @TableId(value = "serial_no", type = IdType.AUTO)
31
+    private Integer serialNo;
32
+
33
+    @ApiModelProperty(value = "人员ID")
34
+    private String personId;
35
+
36
+    @ApiModelProperty(value = "问题ID")
37
+    private String questionId;
38
+
39
+    @ApiModelProperty(value = "答案")
40
+    private String answerOpt;
41
+
42
+    @ApiModelProperty(value = "得分")
43
+    private Integer score;
44
+
45
+    @ApiModelProperty(value = "状态")
46
+    private Integer state;
47
+
48
+    @ApiModelProperty(value = "创建时间")
49
+    private LocalDateTime createDate;
50
+
51
+
52
+}

+ 43
- 0
src/main/java/com/yunzhi/training/entity/TaQuestionnaire.java View File

1
+package com.yunzhi.training.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 问卷调查
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-02-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaQuestionnaire对象", description="问卷调查")
25
+public class TaQuestionnaire implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "调查ID")
30
+    @TableId(value = "que_id", type = IdType.INPUT)
31
+    private String queId;
32
+
33
+    @ApiModelProperty(value = "调查名称")
34
+    private String name;
35
+
36
+    @ApiModelProperty(value = "状态")
37
+    private Integer state;
38
+
39
+    @ApiModelProperty(value = "创建时间")
40
+    private LocalDateTime createDate;
41
+
42
+
43
+}

+ 19
- 0
src/main/java/com/yunzhi/training/exception/GlobalExceptionHandler.java View File

1
+package com.yunzhi.training.exception;
2
+
3
+import com.yunzhi.training.common.ResponseBean;
4
+import lombok.extern.slf4j.Slf4j;
5
+import org.springframework.web.bind.annotation.ExceptionHandler;
6
+import org.springframework.web.bind.annotation.ResponseBody;
7
+import org.springframework.web.bind.annotation.RestControllerAdvice;
8
+
9
+@Slf4j
10
+@RestControllerAdvice
11
+public class GlobalExceptionHandler {
12
+
13
+    @ResponseBody
14
+    @ExceptionHandler(Exception.class)
15
+    public ResponseBean handleException(Exception e){
16
+        log.error(e.getMessage(),e);
17
+        return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
18
+    }
19
+}

+ 47
- 0
src/main/java/com/yunzhi/training/interceptor/PermissionInterceptor.java View File

1
+package com.yunzhi.training.interceptor;
2
+
3
+import cn.hutool.json.JSONUtil;
4
+import com.yunzhi.training.common.*;
5
+import lombok.extern.slf4j.Slf4j;
6
+import org.springframework.stereotype.Component;
7
+import org.springframework.web.servlet.HandlerInterceptor;
8
+import org.springframework.web.servlet.ModelAndView;
9
+
10
+import javax.servlet.http.HttpServletRequest;
11
+import javax.servlet.http.HttpServletResponse;
12
+import java.io.IOException;
13
+import java.nio.charset.StandardCharsets;
14
+
15
+@Slf4j
16
+@Component
17
+public class PermissionInterceptor implements HandlerInterceptor {
18
+
19
+    @Override
20
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws Exception {
21
+        String token = JWTUtils.getToken(request);
22
+
23
+        try {
24
+            JWTUtils.verify(token);
25
+        } catch (Exception e) {
26
+            log.error("鉴权失败: {}", e.getMessage());
27
+            responseTokenError(response, "鉴权失败, 请重新登录");
28
+            return false;
29
+        }
30
+
31
+        return true;
32
+    }
33
+
34
+    @Override
35
+    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
36
+        // 刷新 TOKEN
37
+        String jws = JWTUtils.getToken(request);
38
+        JWTUtils.refresh(jws, response);
39
+    }
40
+
41
+    private void responseTokenError(HttpServletResponse response, String error) throws IOException {
42
+        response.addHeader("Content-type", "application/json");
43
+        byte[] data = JSONUtil.toJsonStr(ResponseBean.error(error, ResponseBean.ERROR_AUTH_FAIL)).getBytes(StandardCharsets.UTF_8);
44
+        response.getOutputStream().write(data);
45
+
46
+    }
47
+}

+ 79
- 0
src/main/java/com/yunzhi/training/log/MysqlAppender.java View File

1
+package com.yunzhi.training.log;
2
+
3
+import static ch.qos.logback.core.db.DBHelper.closeStatement;
4
+import ch.qos.logback.core.UnsynchronizedAppenderBase;
5
+import ch.qos.logback.core.db.ConnectionSource;
6
+import ch.qos.logback.core.encoder.Encoder;
7
+
8
+import java.sql.Connection;
9
+import java.sql.PreparedStatement;
10
+import java.util.Arrays;
11
+
12
+public class MysqlAppender<E> extends UnsynchronizedAppenderBase<E> {
13
+    protected ConnectionSource connectionSource;
14
+    protected Encoder<E> encoder;
15
+    protected String app = "shigongli";
16
+
17
+    @Override
18
+    public void start() {
19
+        if (connectionSource == null) {
20
+            throw new IllegalStateException("MysqlAppender cannot function without a connection source");
21
+        }
22
+
23
+        super.start();
24
+    }
25
+
26
+    public ConnectionSource getConnectionSource() {
27
+        return connectionSource;
28
+    }
29
+
30
+    public void setConnectionSource(ConnectionSource connectionSource) {
31
+        this.connectionSource = connectionSource;
32
+    }
33
+
34
+    @Override
35
+    protected void append(E event) {
36
+        Connection connection = null;
37
+        PreparedStatement insertStatement = null;
38
+
39
+        try {
40
+            connection = connectionSource.getConnection();
41
+            connection.setAutoCommit(false);
42
+            insertStatement = connection.prepareStatement(getInsertSQL());
43
+
44
+            synchronized (this) {
45
+                byte[] logContent = this.encoder.encode(event);
46
+                insertStatement.setBytes(1, logContent);
47
+                insertStatement.execute();
48
+                closeStatement(insertStatement);
49
+            }
50
+
51
+            connection.commit();
52
+        } catch (Throwable sqle) {
53
+            addError("problem appending event", sqle);
54
+        }
55
+
56
+    }
57
+
58
+    public Encoder<E> getEncoder() {
59
+        return encoder;
60
+    }
61
+
62
+    public void setEncoder(Encoder<E> encoder) {
63
+        this.encoder = encoder;
64
+    }
65
+
66
+    @Override
67
+    public void stop() {
68
+        super.stop();
69
+    }
70
+
71
+    private String getInsertSQL() {
72
+        String tableName = "ta_"+app;
73
+        String[] columns = {"log"};
74
+        String[] signs = Arrays.stream(columns).map(x -> "?").toArray(String[]::new);
75
+        String sql = String.format("INSERT INTO %s (%s) values (%s)", tableName, String.join(",", columns), String.join(",", signs));
76
+//        System.out.println(sql);
77
+        return sql;
78
+    }
79
+}

+ 18
- 0
src/main/java/com/yunzhi/training/mapper/SysUserMapper.java View File

1
+package com.yunzhi.training.mapper;
2
+
3
+import com.yunzhi.training.entity.SysUser;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 用户表 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-02-18
14
+ */
15
+@Mapper
16
+public interface SysUserMapper extends BaseMapper<SysUser> {
17
+
18
+}

+ 18
- 0
src/main/java/com/yunzhi/training/mapper/TaActivityMapper.java View File

1
+package com.yunzhi.training.mapper;
2
+
3
+import com.yunzhi.training.entity.TaActivity;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 活动表 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-02-18
14
+ */
15
+@Mapper
16
+public interface TaActivityMapper extends BaseMapper<TaActivity> {
17
+
18
+}

+ 18
- 0
src/main/java/com/yunzhi/training/mapper/TaActivitySignMapper.java View File

1
+package com.yunzhi.training.mapper;
2
+
3
+import com.yunzhi.training.entity.TaActivitySign;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 签到表 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-02-18
14
+ */
15
+@Mapper
16
+public interface TaActivitySignMapper extends BaseMapper<TaActivitySign> {
17
+
18
+}

+ 18
- 0
src/main/java/com/yunzhi/training/mapper/TaAnswerMapper.java View File

1
+package com.yunzhi.training.mapper;
2
+
3
+import com.yunzhi.training.entity.TaAnswer;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 问题答案 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-02-18
14
+ */
15
+@Mapper
16
+public interface TaAnswerMapper extends BaseMapper<TaAnswer> {
17
+
18
+}

+ 18
- 0
src/main/java/com/yunzhi/training/mapper/TaAttachmentMapper.java View File

1
+package com.yunzhi.training.mapper;
2
+
3
+import com.yunzhi.training.entity.TaAttachment;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 附件表 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-02-18
14
+ */
15
+@Mapper
16
+public interface TaAttachmentMapper extends BaseMapper<TaAttachment> {
17
+
18
+}

+ 18
- 0
src/main/java/com/yunzhi/training/mapper/TaPersonMapper.java View File

1
+package com.yunzhi.training.mapper;
2
+
3
+import com.yunzhi.training.entity.TaPerson;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 人员表 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-02-18
14
+ */
15
+@Mapper
16
+public interface TaPersonMapper extends BaseMapper<TaPerson> {
17
+
18
+}

+ 18
- 0
src/main/java/com/yunzhi/training/mapper/TaQuePersonMapper.java View File

1
+package com.yunzhi.training.mapper;
2
+
3
+import com.yunzhi.training.entity.TaQuePerson;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 问卷参与人 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-02-18
14
+ */
15
+@Mapper
16
+public interface TaQuePersonMapper extends BaseMapper<TaQuePerson> {
17
+
18
+}

+ 18
- 0
src/main/java/com/yunzhi/training/mapper/TaQuestionMapper.java View File

1
+package com.yunzhi.training.mapper;
2
+
3
+import com.yunzhi.training.entity.TaQuestion;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 问卷问题 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-02-18
14
+ */
15
+@Mapper
16
+public interface TaQuestionMapper extends BaseMapper<TaQuestion> {
17
+
18
+}

+ 18
- 0
src/main/java/com/yunzhi/training/mapper/TaQuestionPersonMapper.java View File

1
+package com.yunzhi.training.mapper;
2
+
3
+import com.yunzhi.training.entity.TaQuestionPerson;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 答卷明细 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-02-18
14
+ */
15
+@Mapper
16
+public interface TaQuestionPersonMapper extends BaseMapper<TaQuestionPerson> {
17
+
18
+}

+ 18
- 0
src/main/java/com/yunzhi/training/mapper/TaQuestionnaireMapper.java View File

1
+package com.yunzhi.training.mapper;
2
+
3
+import com.yunzhi.training.entity.TaQuestionnaire;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 问卷调查 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-02-18
14
+ */
15
+@Mapper
16
+public interface TaQuestionnaireMapper extends BaseMapper<TaQuestionnaire> {
17
+
18
+}

+ 14
- 0
src/main/java/com/yunzhi/training/service/IBaseService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+
5
+import java.io.Serializable;
6
+
7
+public interface IBaseService <T> extends IService<T> {
8
+    /**
9
+     * 逻辑删除
10
+     * @param id
11
+     * @return
12
+     */
13
+    boolean removeLogicById(Serializable id);
14
+}

+ 17
- 0
src/main/java/com/yunzhi/training/service/ISysUserService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.yunzhi.training.entity.SysUser;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 用户表 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-02-18
13
+ */
14
+public interface ISysUserService extends IService<SysUser> {
15
+
16
+    SysUser getByLoginName(String userName);
17
+}

+ 16
- 0
src/main/java/com/yunzhi/training/service/ITaActivityService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.yunzhi.training.entity.TaActivity;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 活动表 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-02-18
13
+ */
14
+public interface ITaActivityService extends IService<TaActivity> {
15
+
16
+}

+ 16
- 0
src/main/java/com/yunzhi/training/service/ITaActivitySignService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.yunzhi.training.entity.TaActivitySign;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 签到表 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-02-18
13
+ */
14
+public interface ITaActivitySignService extends IService<TaActivitySign> {
15
+
16
+}

+ 16
- 0
src/main/java/com/yunzhi/training/service/ITaAnswerService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.yunzhi.training.entity.TaAnswer;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 问题答案 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-02-18
13
+ */
14
+public interface ITaAnswerService extends IService<TaAnswer> {
15
+
16
+}

+ 16
- 0
src/main/java/com/yunzhi/training/service/ITaAttachmentService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.yunzhi.training.entity.TaAttachment;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 附件表 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-02-18
13
+ */
14
+public interface ITaAttachmentService extends IService<TaAttachment> {
15
+
16
+}

+ 16
- 0
src/main/java/com/yunzhi/training/service/ITaPersonService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.yunzhi.training.entity.TaPerson;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 人员表 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-02-18
13
+ */
14
+public interface ITaPersonService extends IService<TaPerson> {
15
+
16
+}

+ 16
- 0
src/main/java/com/yunzhi/training/service/ITaQuePersonService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.yunzhi.training.entity.TaQuePerson;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 问卷参与人 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-02-18
13
+ */
14
+public interface ITaQuePersonService extends IService<TaQuePerson> {
15
+
16
+}

+ 16
- 0
src/main/java/com/yunzhi/training/service/ITaQuestionPersonService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.yunzhi.training.entity.TaQuestionPerson;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 答卷明细 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-02-18
13
+ */
14
+public interface ITaQuestionPersonService extends IService<TaQuestionPerson> {
15
+
16
+}

+ 16
- 0
src/main/java/com/yunzhi/training/service/ITaQuestionService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.yunzhi.training.entity.TaQuestion;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 问卷问题 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-02-18
13
+ */
14
+public interface ITaQuestionService extends IService<TaQuestion> {
15
+
16
+}

+ 16
- 0
src/main/java/com/yunzhi/training/service/ITaQuestionnaireService.java View File

1
+package com.yunzhi.training.service;
2
+
3
+import com.yunzhi.training.entity.TaQuestionnaire;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 问卷调查 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-02-18
13
+ */
14
+public interface ITaQuestionnaireService extends IService<TaQuestionnaire> {
15
+
16
+}

+ 23
- 0
src/main/java/com/yunzhi/training/service/impl/BaseServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import com.baomidou.mybatisplus.core.metadata.TableInfo;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
8
+import com.yunzhi.training.service.IBaseService;
9
+
10
+import java.io.Serializable;
11
+
12
+public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> implements IBaseService<T> {
13
+    @Override
14
+    public boolean removeLogicById(Serializable id) {
15
+
16
+        TableInfo tableInfo = SqlHelper.table(currentModelClass());
17
+        UpdateWrapper<T> updateWrapper = new UpdateWrapper<>();
18
+        updateWrapper.set("status", -1)
19
+                .eq(tableInfo.getKeyColumn(), id);
20
+
21
+        return update(updateWrapper);
22
+    }
23
+}

+ 30
- 0
src/main/java/com/yunzhi/training/service/impl/SysUserServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.yunzhi.training.common.Constants;
5
+import com.yunzhi.training.entity.SysUser;
6
+import com.yunzhi.training.mapper.SysUserMapper;
7
+import com.yunzhi.training.service.ISysUserService;
8
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9
+import org.springframework.stereotype.Service;
10
+
11
+/**
12
+ * <p>
13
+ * 用户表 服务实现类
14
+ * </p>
15
+ *
16
+ * @author yansen
17
+ * @since 2022-02-18
18
+ */
19
+@Service
20
+public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
21
+
22
+    @Override
23
+    public SysUser getByLoginName(String userName) {
24
+        QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
25
+        queryWrapper.eq("login_name", userName);
26
+        queryWrapper.gt("state", Constants.STATUS_DELETED);
27
+
28
+        return getOne(queryWrapper);
29
+    }
30
+}

+ 20
- 0
src/main/java/com/yunzhi/training/service/impl/TaActivityServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.yunzhi.training.entity.TaActivity;
4
+import com.yunzhi.training.mapper.TaActivityMapper;
5
+import com.yunzhi.training.service.ITaActivityService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 活动表 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-02-18
16
+ */
17
+@Service
18
+public class TaActivityServiceImpl extends ServiceImpl<TaActivityMapper, TaActivity> implements ITaActivityService {
19
+
20
+}

+ 20
- 0
src/main/java/com/yunzhi/training/service/impl/TaActivitySignServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.yunzhi.training.entity.TaActivitySign;
4
+import com.yunzhi.training.mapper.TaActivitySignMapper;
5
+import com.yunzhi.training.service.ITaActivitySignService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 签到表 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-02-18
16
+ */
17
+@Service
18
+public class TaActivitySignServiceImpl extends ServiceImpl<TaActivitySignMapper, TaActivitySign> implements ITaActivitySignService {
19
+
20
+}

+ 20
- 0
src/main/java/com/yunzhi/training/service/impl/TaAnswerServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.yunzhi.training.entity.TaAnswer;
4
+import com.yunzhi.training.mapper.TaAnswerMapper;
5
+import com.yunzhi.training.service.ITaAnswerService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 问题答案 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-02-18
16
+ */
17
+@Service
18
+public class TaAnswerServiceImpl extends ServiceImpl<TaAnswerMapper, TaAnswer> implements ITaAnswerService {
19
+
20
+}

+ 20
- 0
src/main/java/com/yunzhi/training/service/impl/TaAttachmentServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.yunzhi.training.entity.TaAttachment;
4
+import com.yunzhi.training.mapper.TaAttachmentMapper;
5
+import com.yunzhi.training.service.ITaAttachmentService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 附件表 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-02-18
16
+ */
17
+@Service
18
+public class TaAttachmentServiceImpl extends ServiceImpl<TaAttachmentMapper, TaAttachment> implements ITaAttachmentService {
19
+
20
+}

+ 20
- 0
src/main/java/com/yunzhi/training/service/impl/TaPersonServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.yunzhi.training.entity.TaPerson;
4
+import com.yunzhi.training.mapper.TaPersonMapper;
5
+import com.yunzhi.training.service.ITaPersonService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 人员表 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-02-18
16
+ */
17
+@Service
18
+public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> implements ITaPersonService {
19
+
20
+}

+ 20
- 0
src/main/java/com/yunzhi/training/service/impl/TaQuePersonServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.yunzhi.training.entity.TaQuePerson;
4
+import com.yunzhi.training.mapper.TaQuePersonMapper;
5
+import com.yunzhi.training.service.ITaQuePersonService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 问卷参与人 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-02-18
16
+ */
17
+@Service
18
+public class TaQuePersonServiceImpl extends ServiceImpl<TaQuePersonMapper, TaQuePerson> implements ITaQuePersonService {
19
+
20
+}

+ 20
- 0
src/main/java/com/yunzhi/training/service/impl/TaQuestionPersonServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.yunzhi.training.entity.TaQuestionPerson;
4
+import com.yunzhi.training.mapper.TaQuestionPersonMapper;
5
+import com.yunzhi.training.service.ITaQuestionPersonService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 答卷明细 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-02-18
16
+ */
17
+@Service
18
+public class TaQuestionPersonServiceImpl extends ServiceImpl<TaQuestionPersonMapper, TaQuestionPerson> implements ITaQuestionPersonService {
19
+
20
+}

+ 20
- 0
src/main/java/com/yunzhi/training/service/impl/TaQuestionServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.yunzhi.training.entity.TaQuestion;
4
+import com.yunzhi.training.mapper.TaQuestionMapper;
5
+import com.yunzhi.training.service.ITaQuestionService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 问卷问题 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-02-18
16
+ */
17
+@Service
18
+public class TaQuestionServiceImpl extends ServiceImpl<TaQuestionMapper, TaQuestion> implements ITaQuestionService {
19
+
20
+}

+ 20
- 0
src/main/java/com/yunzhi/training/service/impl/TaQuestionnaireServiceImpl.java View File

1
+package com.yunzhi.training.service.impl;
2
+
3
+import com.yunzhi.training.entity.TaQuestionnaire;
4
+import com.yunzhi.training.mapper.TaQuestionnaireMapper;
5
+import com.yunzhi.training.service.ITaQuestionnaireService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 问卷调查 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-02-18
16
+ */
17
+@Service
18
+public class TaQuestionnaireServiceImpl extends ServiceImpl<TaQuestionnaireMapper, TaQuestionnaire> implements ITaQuestionnaireService {
19
+
20
+}

+ 16
- 0
src/main/java/com/yunzhi/training/vo/AdminLoginParam.java View File

1
+package com.yunzhi.training.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+@ApiModel(description = "登录参数")
8
+@Data
9
+public class AdminLoginParam {
10
+
11
+    @ApiModelProperty("用户名")
12
+    String userName;
13
+
14
+    @ApiModelProperty("密码, MD5 加密后数据")
15
+    String password;
16
+}

+ 16
- 0
src/main/java/com/yunzhi/training/vo/ChangePassword.java View File

1
+package com.yunzhi.training.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+@ApiModel(description = "修改密码参数")
8
+@Data
9
+public class ChangePassword {
10
+
11
+    @ApiModelProperty("原始密码, MD5 加密后数据")
12
+    String originPassword;
13
+
14
+    @ApiModelProperty("新密码, MD5 加密后数据")
15
+    String newPassword;
16
+}

+ 25
- 0
src/main/java/com/yunzhi/training/vo/CharacterInstWithWords.java View File

1
+package com.yunzhi.training.vo;
2
+
3
+
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+import java.util.List;
9
+
10
+@ApiModel(description = "特征实例及特征词")
11
+@Data
12
+public class CharacterInstWithWords {
13
+
14
+    @ApiModelProperty("特征实例")
15
+    String resultId;
16
+
17
+    @ApiModelProperty("特征词ID")
18
+    String wordIdStr;
19
+
20
+    @ApiModelProperty("特征词ID集合")
21
+    List<String> wordIdList;
22
+
23
+    @ApiModelProperty("匹配得分")
24
+    Float score;
25
+}

+ 20
- 0
src/main/java/com/yunzhi/training/vo/LoginParam.java View File

1
+package com.yunzhi.training.vo;
2
+
3
+
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+@ApiModel(description = "登录参数")
9
+@Data
10
+public class LoginParam {
11
+
12
+    @ApiModelProperty("用户名")
13
+    private String name;
14
+
15
+    @ApiModelProperty("手机号")
16
+    private String phone;
17
+
18
+    @ApiModelProperty("验证码")
19
+    private String captcha;
20
+}

+ 17
- 0
src/main/java/com/yunzhi/training/vo/QuestionVO.java View File

1
+package com.yunzhi.training.vo;
2
+
3
+import com.yunzhi.training.entity.TaAnswer;
4
+import com.yunzhi.training.entity.TaQuestion;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+
9
+import java.util.List;
10
+
11
+@Data
12
+@ApiModel(description = "题目")
13
+public class QuestionVO extends TaQuestion {
14
+
15
+    @ApiModelProperty(value = "选项列表")
16
+    private List<TaAnswer> answerList;
17
+}

+ 56
- 0
src/main/java/com/yunzhi/training/vo/TokenParam.java View File

1
+package com.yunzhi.training.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+import lombok.experimental.Accessors;
7
+
8
+import java.lang.reflect.Field;
9
+import java.util.Date;
10
+import java.util.HashMap;
11
+import java.util.Map;
12
+
13
+@ApiModel(description = "Token参数")
14
+@Data
15
+@Accessors(chain = true)
16
+public class TokenParam {
17
+    @ApiModelProperty("用户ID")
18
+    String userId;
19
+
20
+    @ApiModelProperty("机构ID")
21
+    String orgId;
22
+
23
+    @ApiModelProperty("原始值")
24
+    String raw;
25
+
26
+    @ApiModelProperty("有效期")
27
+    Date exp;
28
+
29
+    public static TokenParam fromMap(Map<String, Object> mapParams) {
30
+        TokenParam tokenParam = new TokenParam();
31
+
32
+        // 没有使用反射, 懒
33
+        Object u = mapParams.get("userId");
34
+        Object o = mapParams.get("orgId");
35
+        Object r = mapParams.get("raw");
36
+        Object e = mapParams.get("exp");
37
+        tokenParam.setUserId(null == u ? null : u.toString());
38
+        tokenParam.setOrgId(null == o ? null : o.toString());
39
+        tokenParam.setRaw(null == r ? null : r.toString());
40
+        tokenParam.setExp(null == r ? null : (Date) r);
41
+
42
+        return tokenParam;
43
+    }
44
+
45
+    public Map<String, Object> toMap() throws IllegalAccessException {
46
+        Map<String, Object> rtn = new HashMap<>();
47
+
48
+        Class<?> cls = getClass();
49
+        for (Field field: cls.getDeclaredFields()) {
50
+            field.setAccessible(true);
51
+            rtn.put(field.getName(), field.get(this));
52
+        }
53
+
54
+        return rtn;
55
+    }
56
+}

+ 16
- 0
src/main/resources/application-dev.yml View File

1
+###
2
+spring:
3
+  servlet:
4
+    multipart:
5
+      max-file-size: 10MB
6
+      max-request-size: 50MB
7
+  datasource:
8
+    url: jdbc:mysql://110.40.183.156:3306/stategrid_traning?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
9
+    username: stategrid_training
10
+    password: stategrid_training@ABC123
11
+
12
+###
13
+logging:
14
+  level:
15
+    root: info
16
+    springfox: info

+ 21
- 0
src/main/resources/application-prod.yml View File

1
+server:
2
+  port: 8822
3
+###
4
+spring:
5
+  servlet:
6
+    multipart:
7
+      max-file-size: 10MB
8
+      max-request-size: 50MB
9
+  datasource:
10
+    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/shigongli-v2?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
11
+    username: shigongli
12
+    password: shigongli@123
13
+
14
+
15
+weixin:
16
+  miniapp:
17
+    appid:
18
+    secret:
19
+    token:
20
+    aesKey:
21
+    msgDataFormat: JSON

+ 50
- 0
src/main/resources/application.yml View File

1
+###
2
+server:
3
+  port: 8080
4
+  servlet:
5
+    context-path: /api
6
+
7
+###
8
+interceptor:
9
+  permission:
10
+    enable: true
11
+    include-paths: /**
12
+    exclude-paths:
13
+      - /**/login
14
+      - /m/captcha
15
+      - /swagger-ui/**
16
+      - /swagger-resources/**
17
+      - /v2/**
18
+      - /test-weather
19
+
20
+###
21
+mybatis-plus:
22
+  configuration:
23
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
24
+    call-setters-on-nulls: true
25
+  mapper-locations: classpath:mapper/**/*.xml
26
+
27
+###
28
+aliyun:
29
+  accessKeyId: LTAI5tGjnZY6k799BHxhmqcm
30
+  accessKeySecret: eU1DmULbgHe2dnIg3P93634PO2vEh5
31
+  oss:
32
+    roleSessionName: shigongli
33
+    accessKeyId: LTAI4G9zCefU1m7sKmmBnzTc
34
+    accessKeySecret: Vaax5O7wTL0KZdSgd8L9cGBf8AgUqJ
35
+    arn: acs:ram::1636896505560465:role/ramosssts
36
+    region: oss-cn-shanghai
37
+    endpoint: oss-accelerate.aliyuncs.com
38
+    bucketName: yz-shigongli
39
+    bucketURL: https://yz-shigongli.oss-accelerate.aliyuncs.com
40
+  sms:
41
+    captcha:
42
+      code: SMS_195585471
43
+      sign: 云致
44
+
45
+###
46
+spring:
47
+  application:
48
+    name: questions
49
+  profiles:
50
+    active: @profileActive@

+ 31
- 0
src/main/resources/logback.xml.bak View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<configuration>
3
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
4
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
5
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
6
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
7
+        </encoder>
8
+    </appender>
9
+    <appender name="LOGDB" class="com.yunzhi.training.log.MysqlAppender">
10
+        <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
11
+            <driverClass>com.mysql.cj.jdbc.Driver</driverClass>
12
+            <url>jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/yz_questions</url>
13
+            <user>yz_questions</user>
14
+            <password>questions@1234</password>
15
+        </connectionSource>
16
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
17
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
18
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
19
+        </encoder>
20
+    </appender>
21
+
22
+    <logger name="com.apache.ibatis" level="TRACE"/>
23
+    <logger name="java.sql.Connection" level="DEBUG"/>
24
+    <logger name="java.sql.Statement" level="DEBUG"/>
25
+    <logger name="java.sql.PreparedStatement" level="DEBUG"/>
26
+
27
+    <root level="INFO">
28
+        <appender-ref ref="STDOUT" />
29
+        <appender-ref ref="LOGDB" />
30
+    </root>
31
+</configuration>

+ 5
- 0
src/main/resources/mapper/SysUserMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.training.mapper.SysUserMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaActivityMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.training.mapper.TaActivityMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaActivitySignMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.training.mapper.TaActivitySignMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaAnswerMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.training.mapper.TaAnswerMapper">
4
+
5
+</mapper>

+ 0
- 0
src/main/resources/mapper/TaAttachmentMapper.xml View File


Some files were not shown because too many files changed in this diff