Переглянути джерело

考试测评

tags/正式版本
雍文秀 2 роки тому
джерело
коміт
abe709d63c
65 змінених файлів з 2946 додано та 0 видалено
  1. 8
    0
      gateway/src/main/resources/application.properties
  2. 6
    0
      pom.xml
  3. 33
    0
      sexam/.gitignore
  4. BIN
      sexam/.mvn/wrapper/maven-wrapper.jar
  5. 2
    0
      sexam/.mvn/wrapper/maven-wrapper.properties
  6. 316
    0
      sexam/mvnw
  7. 188
    0
      sexam/mvnw.cmd
  8. 116
    0
      sexam/pom.xml
  9. 17
    0
      sexam/src/main/java/com/xhkjedu/sexam/SexamApplication.java
  10. 9
    0
      sexam/src/main/java/com/xhkjedu/sexam/base/TkMapper.java
  11. 34
    0
      sexam/src/main/java/com/xhkjedu/sexam/config/CorsConfig.java
  12. 67
    0
      sexam/src/main/java/com/xhkjedu/sexam/config/ErrorAdivceController.java
  13. 62
    0
      sexam/src/main/java/com/xhkjedu/sexam/config/ThreadPoolTaskExecutorConfig.java
  14. 55
    0
      sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java
  15. 49
    0
      sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectBadstudentController.java
  16. 49
    0
      sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectInvigilateController.java
  17. 55
    0
      sexam/src/main/java/com/xhkjedu/sexam/controller/paper/ESubjectScantronController.java
  18. 21
    0
      sexam/src/main/java/com/xhkjedu/sexam/controller/status/StatusController.java
  19. 109
    0
      sexam/src/main/java/com/xhkjedu/sexam/interceptors/DecryptRequestBodyAdvice.java
  20. 35
    0
      sexam/src/main/java/com/xhkjedu/sexam/interceptors/HttpServletFilter.java
  21. 132
    0
      sexam/src/main/java/com/xhkjedu/sexam/interceptors/RequestInterceptor.java
  22. 82
    0
      sexam/src/main/java/com/xhkjedu/sexam/interceptors/RequestWrapper.java
  23. 62
    0
      sexam/src/main/java/com/xhkjedu/sexam/interceptors/WebMvcConfg.java
  24. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EBaseMapper.java
  25. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EClassMapper.java
  26. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EClassStudentMapper.java
  27. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/ESubjectBadstudentMapper.java
  28. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/ESubjectInvigilateMapper.java
  29. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/ESubjectMapper.java
  30. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/ESubjectScantronMapper.java
  31. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/ESubjectScantronQtypeMapper.java
  32. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/ESubjectScantronStudentMapper.java
  33. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/ESubjectScantronStudentQuestionMapper.java
  34. 26
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/BaseBean.java
  35. 45
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/exam/EBase.java
  36. 24
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/exam/EClass.java
  37. 24
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/exam/EClassStudent.java
  38. 45
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/exam/ESubject.java
  39. 36
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/exam/ESubjectBadstudent.java
  40. 36
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/exam/ESubjectInvigilate.java
  41. 54
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaper.java
  42. 24
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperAnalyze.java
  43. 27
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperBack.java
  44. 30
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperCorrectclass.java
  45. 33
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperCorrectquestion.java
  46. 36
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperFile.java
  47. 36
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperFjtype.java
  48. 45
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperFjtypeQuestion.java
  49. 36
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperQtype.java
  50. 30
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperQtypeQuestion.java
  51. 57
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantron.java
  52. 39
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantronQtype.java
  53. 57
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/EPaperStudent.java
  54. 75
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/EPaperStudentFjquestion.java
  55. 72
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/EPaperStudentQuestion.java
  56. 45
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/ESubjectScantronStudent.java
  57. 66
    0
      sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/ESubjectScantronStudentQuestion.java
  58. 41
    0
      sexam/src/main/java/com/xhkjedu/sexam/service/exam/EBaseService.java
  59. 41
    0
      sexam/src/main/java/com/xhkjedu/sexam/service/exam/ESubjectBadstudentService.java
  60. 41
    0
      sexam/src/main/java/com/xhkjedu/sexam/service/exam/ESubjectInvigilateService.java
  61. 41
    0
      sexam/src/main/java/com/xhkjedu/sexam/service/paper/ESubjectScantronService.java
  62. 17
    0
      sexam/src/main/java/com/xhkjedu/sexam/utils/ExamUtil.java
  63. 106
    0
      sexam/src/main/java/com/xhkjedu/sexam/utils/JedisUtil.java
  64. 71
    0
      sexam/src/main/resources/application.properties
  65. 13
    0
      sexam/src/test/java/com/xhkjedu/sexam/SexamApplicationTests.java

+ 8
- 0
gateway/src/main/resources/application.properties Переглянути файл

@@ -39,6 +39,14 @@ spring.cloud.gateway.routes[4].uri=lb://sapi
39 39
 spring.cloud.gateway.routes[4].predicates[0]=Path=/sapi/**
40 40
 spring.cloud.gateway.routes[4].filters[0]=RewritePath=/sapi/(?<segment>.*), /$\{segment}
41 41
 
42
+spring.cloud.gateway.routes[5].id=path_sexam
43
+spring.cloud.gateway.routes[5].uri=lb://sexam
44
+spring.cloud.gateway.routes[5].predicates[0]=Path=/sexam/**
45
+spring.cloud.gateway.routes[5].filters[0]=RewritePath=/sexam/(?<segment>.*), /$\{segment}
46
+spring.cloud.gateway.routes[5].filters[1].name=CircuitBreaker
47
+spring.cloud.gateway.routes[5].filters[1].args.name=fallbackcmd
48
+spring.cloud.gateway.routes[5].filters[1].args.fallbackUri=forward:/fallback
49
+
42 50
 eureka.client.service-url.defaultZone=http://localhost:8081/eureka/
43 51
 #设置eureka输出日志级别
44 52
 logging.level.com.netflix=error

+ 6
- 0
pom.xml Переглянути файл

@@ -20,6 +20,7 @@
20 20
         <module>sstudy</module>
21 21
         <module>sapi</module>
22 22
         <module>scommons</module>
23
+        <module>sexam</module>
23 24
     </modules>
24 25
 
25 26
     <dependencyManagement>
@@ -69,6 +70,11 @@
69 70
                 <artifactId>scommons</artifactId>
70 71
                 <version>0.0.1-SNAPSHOT</version>
71 72
             </dependency>
73
+            <dependency>
74
+                <groupId>com.xhkjedu</groupId>
75
+                <artifactId>sexam</artifactId>
76
+                <version>0.0.1-SNAPSHOT</version>
77
+            </dependency>
72 78
         </dependencies>
73 79
     </dependencyManagement>
74 80
 </project>

+ 33
- 0
sexam/.gitignore Переглянути файл

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

BIN
sexam/.mvn/wrapper/maven-wrapper.jar Переглянути файл


+ 2
- 0
sexam/.mvn/wrapper/maven-wrapper.properties Переглянути файл

@@ -0,0 +1,2 @@
1
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip
2
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

+ 316
- 0
sexam/mvnw Переглянути файл

@@ -0,0 +1,316 @@
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
+#    https://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 /usr/local/etc/mavenrc ] ; then
40
+    . /usr/local/etc/mavenrc
41
+  fi
42
+
43
+  if [ -f /etc/mavenrc ] ; then
44
+    . /etc/mavenrc
45
+  fi
46
+
47
+  if [ -f "$HOME/.mavenrc" ] ; then
48
+    . "$HOME/.mavenrc"
49
+  fi
50
+
51
+fi
52
+
53
+# OS specific support.  $var _must_ be set to either true or false.
54
+cygwin=false;
55
+darwin=false;
56
+mingw=false
57
+case "`uname`" in
58
+  CYGWIN*) cygwin=true ;;
59
+  MINGW*) mingw=true;;
60
+  Darwin*) darwin=true
61
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
62
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
63
+    if [ -z "$JAVA_HOME" ]; then
64
+      if [ -x "/usr/libexec/java_home" ]; then
65
+        export JAVA_HOME="`/usr/libexec/java_home`"
66
+      else
67
+        export JAVA_HOME="/Library/Java/Home"
68
+      fi
69
+    fi
70
+    ;;
71
+esac
72
+
73
+if [ -z "$JAVA_HOME" ] ; then
74
+  if [ -r /etc/gentoo-release ] ; then
75
+    JAVA_HOME=`java-config --jre-home`
76
+  fi
77
+fi
78
+
79
+if [ -z "$M2_HOME" ] ; then
80
+  ## resolve links - $0 may be a link to maven's home
81
+  PRG="$0"
82
+
83
+  # need this for relative symlinks
84
+  while [ -h "$PRG" ] ; do
85
+    ls=`ls -ld "$PRG"`
86
+    link=`expr "$ls" : '.*-> \(.*\)$'`
87
+    if expr "$link" : '/.*' > /dev/null; then
88
+      PRG="$link"
89
+    else
90
+      PRG="`dirname "$PRG"`/$link"
91
+    fi
92
+  done
93
+
94
+  saveddir=`pwd`
95
+
96
+  M2_HOME=`dirname "$PRG"`/..
97
+
98
+  # make it fully qualified
99
+  M2_HOME=`cd "$M2_HOME" && pwd`
100
+
101
+  cd "$saveddir"
102
+  # echo Using m2 at $M2_HOME
103
+fi
104
+
105
+# For Cygwin, ensure paths are in UNIX format before anything is touched
106
+if $cygwin ; then
107
+  [ -n "$M2_HOME" ] &&
108
+    M2_HOME=`cygpath --unix "$M2_HOME"`
109
+  [ -n "$JAVA_HOME" ] &&
110
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
111
+  [ -n "$CLASSPATH" ] &&
112
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
113
+fi
114
+
115
+# For Mingw, ensure paths are in UNIX format before anything is touched
116
+if $mingw ; then
117
+  [ -n "$M2_HOME" ] &&
118
+    M2_HOME="`(cd "$M2_HOME"; pwd)`"
119
+  [ -n "$JAVA_HOME" ] &&
120
+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
121
+fi
122
+
123
+if [ -z "$JAVA_HOME" ]; then
124
+  javaExecutable="`which javac`"
125
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
126
+    # readlink(1) is not available as standard on Solaris 10.
127
+    readLink=`which readlink`
128
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
129
+      if $darwin ; then
130
+        javaHome="`dirname \"$javaExecutable\"`"
131
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
132
+      else
133
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
134
+      fi
135
+      javaHome="`dirname \"$javaExecutable\"`"
136
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
137
+      JAVA_HOME="$javaHome"
138
+      export JAVA_HOME
139
+    fi
140
+  fi
141
+fi
142
+
143
+if [ -z "$JAVACMD" ] ; then
144
+  if [ -n "$JAVA_HOME"  ] ; then
145
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
146
+      # IBM's JDK on AIX uses strange locations for the executables
147
+      JAVACMD="$JAVA_HOME/jre/sh/java"
148
+    else
149
+      JAVACMD="$JAVA_HOME/bin/java"
150
+    fi
151
+  else
152
+    JAVACMD="`\\unset -f command; \\command -v java`"
153
+  fi
154
+fi
155
+
156
+if [ ! -x "$JAVACMD" ] ; then
157
+  echo "Error: JAVA_HOME is not defined correctly." >&2
158
+  echo "  We cannot execute $JAVACMD" >&2
159
+  exit 1
160
+fi
161
+
162
+if [ -z "$JAVA_HOME" ] ; then
163
+  echo "Warning: JAVA_HOME environment variable is not set."
164
+fi
165
+
166
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
167
+
168
+# traverses directory structure from process work directory to filesystem root
169
+# first directory with .mvn subdirectory is considered project base directory
170
+find_maven_basedir() {
171
+
172
+  if [ -z "$1" ]
173
+  then
174
+    echo "Path not specified to find_maven_basedir"
175
+    return 1
176
+  fi
177
+
178
+  basedir="$1"
179
+  wdir="$1"
180
+  while [ "$wdir" != '/' ] ; do
181
+    if [ -d "$wdir"/.mvn ] ; then
182
+      basedir=$wdir
183
+      break
184
+    fi
185
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
186
+    if [ -d "${wdir}" ]; then
187
+      wdir=`cd "$wdir/.."; pwd`
188
+    fi
189
+    # end of workaround
190
+  done
191
+  echo "${basedir}"
192
+}
193
+
194
+# concatenates all lines of a file
195
+concat_lines() {
196
+  if [ -f "$1" ]; then
197
+    echo "$(tr -s '\n' ' ' < "$1")"
198
+  fi
199
+}
200
+
201
+BASE_DIR=`find_maven_basedir "$(pwd)"`
202
+if [ -z "$BASE_DIR" ]; then
203
+  exit 1;
204
+fi
205
+
206
+##########################################################################################
207
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
208
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
209
+##########################################################################################
210
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
211
+    if [ "$MVNW_VERBOSE" = true ]; then
212
+      echo "Found .mvn/wrapper/maven-wrapper.jar"
213
+    fi
214
+else
215
+    if [ "$MVNW_VERBOSE" = true ]; then
216
+      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
217
+    fi
218
+    if [ -n "$MVNW_REPOURL" ]; then
219
+      jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
220
+    else
221
+      jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
222
+    fi
223
+    while IFS="=" read key value; do
224
+      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
225
+      esac
226
+    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
227
+    if [ "$MVNW_VERBOSE" = true ]; then
228
+      echo "Downloading from: $jarUrl"
229
+    fi
230
+    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
231
+    if $cygwin; then
232
+      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
233
+    fi
234
+
235
+    if command -v wget > /dev/null; then
236
+        if [ "$MVNW_VERBOSE" = true ]; then
237
+          echo "Found wget ... using wget"
238
+        fi
239
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
240
+            wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
241
+        else
242
+            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
243
+        fi
244
+    elif command -v curl > /dev/null; then
245
+        if [ "$MVNW_VERBOSE" = true ]; then
246
+          echo "Found curl ... using curl"
247
+        fi
248
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
249
+            curl -o "$wrapperJarPath" "$jarUrl" -f
250
+        else
251
+            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
252
+        fi
253
+
254
+    else
255
+        if [ "$MVNW_VERBOSE" = true ]; then
256
+          echo "Falling back to using Java to download"
257
+        fi
258
+        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
259
+        # For Cygwin, switch paths to Windows format before running javac
260
+        if $cygwin; then
261
+          javaClass=`cygpath --path --windows "$javaClass"`
262
+        fi
263
+        if [ -e "$javaClass" ]; then
264
+            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
265
+                if [ "$MVNW_VERBOSE" = true ]; then
266
+                  echo " - Compiling MavenWrapperDownloader.java ..."
267
+                fi
268
+                # Compiling the Java class
269
+                ("$JAVA_HOME/bin/javac" "$javaClass")
270
+            fi
271
+            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
272
+                # Running the downloader
273
+                if [ "$MVNW_VERBOSE" = true ]; then
274
+                  echo " - Running MavenWrapperDownloader.java ..."
275
+                fi
276
+                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
277
+            fi
278
+        fi
279
+    fi
280
+fi
281
+##########################################################################################
282
+# End of extension
283
+##########################################################################################
284
+
285
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
286
+if [ "$MVNW_VERBOSE" = true ]; then
287
+  echo $MAVEN_PROJECTBASEDIR
288
+fi
289
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
290
+
291
+# For Cygwin, switch paths to Windows format before running java
292
+if $cygwin; then
293
+  [ -n "$M2_HOME" ] &&
294
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
295
+  [ -n "$JAVA_HOME" ] &&
296
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
297
+  [ -n "$CLASSPATH" ] &&
298
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
299
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
300
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
301
+fi
302
+
303
+# Provide a "standardized" way to retrieve the CLI args that will
304
+# work with both Windows and non-Windows executions.
305
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
306
+export MAVEN_CMD_LINE_ARGS
307
+
308
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
309
+
310
+exec "$JAVACMD" \
311
+  $MAVEN_OPTS \
312
+  $MAVEN_DEBUG_OPTS \
313
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
314
+  "-Dmaven.home=${M2_HOME}" \
315
+  "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
316
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 188
- 0
sexam/mvnw.cmd Переглянути файл

@@ -0,0 +1,188 @@
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    https://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 "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
50
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\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/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
124
+
125
+FOR /F "usebackq 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%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.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% ^
162
+  %JVM_CONFIG_MAVEN_PROPS% ^
163
+  %MAVEN_OPTS% ^
164
+  %MAVEN_DEBUG_OPTS% ^
165
+  -classpath %WRAPPER_JAR% ^
166
+  "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
167
+  %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
168
+if ERRORLEVEL 1 goto error
169
+goto end
170
+
171
+:error
172
+set ERROR_CODE=1
173
+
174
+:end
175
+@endlocal & set ERROR_CODE=%ERROR_CODE%
176
+
177
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
178
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
179
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
180
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
181
+:skipRcPost
182
+
183
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
184
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
185
+
186
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
187
+
188
+cmd /C exit /B %ERROR_CODE%

+ 116
- 0
sexam/pom.xml Переглянути файл

@@ -0,0 +1,116 @@
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.6.3</version>
9
+        <relativePath/> <!-- lookup parent from repository -->
10
+    </parent>
11
+    <groupId>com.xhkjedu</groupId>
12
+    <artifactId>sexam</artifactId>
13
+    <version>0.0.1-SNAPSHOT</version>
14
+    <name>sexam</name>
15
+    <description>sexam</description>
16
+    <properties>
17
+        <java.version>1.8</java.version>
18
+        <spring-cloud.version>2021.0.0</spring-cloud.version>
19
+    </properties>
20
+    <dependencies>
21
+        <dependency>
22
+            <groupId>org.springframework.boot</groupId>
23
+            <artifactId>spring-boot-starter-web</artifactId>
24
+        </dependency>
25
+        <dependency>
26
+            <groupId>org.springframework.cloud</groupId>
27
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
28
+        </dependency>
29
+
30
+        <dependency>
31
+            <groupId>mysql</groupId>
32
+            <artifactId>mysql-connector-java</artifactId>
33
+        </dependency>
34
+        <dependency>
35
+            <groupId>org.projectlombok</groupId>
36
+            <artifactId>lombok</artifactId>
37
+            <optional>true</optional>
38
+        </dependency>
39
+
40
+        <dependency>
41
+            <groupId>org.springframework.boot</groupId>
42
+            <artifactId>spring-boot-starter-test</artifactId>
43
+            <scope>test</scope>
44
+        </dependency>
45
+        <dependency>
46
+            <groupId>com.xhkjedu</groupId>
47
+            <artifactId>scommons</artifactId>
48
+            <version>0.0.1-SNAPSHOT</version>
49
+        </dependency>
50
+        <!-- https://mvnrepository.com/artifact/tk.mybatis/mapper-spring-boot-starter -->
51
+        <dependency>
52
+            <groupId>tk.mybatis</groupId>
53
+            <artifactId>mapper-spring-boot-starter</artifactId>
54
+            <version>2.0.2</version>
55
+        </dependency>
56
+        <dependency>
57
+            <groupId>com.alibaba</groupId>
58
+            <artifactId>fastjson</artifactId>
59
+            <version>1.2.56</version>
60
+        </dependency>
61
+
62
+        <dependency>
63
+            <groupId>redis.clients</groupId>
64
+            <artifactId>jedis</artifactId>
65
+            <version>2.9.3</version>
66
+        </dependency>
67
+        <dependency>
68
+            <groupId>org.springframework.boot</groupId>
69
+            <artifactId>spring-boot-starter-data-redis</artifactId>
70
+        </dependency>
71
+
72
+        <!--amqp的起步依赖-->
73
+        <dependency>
74
+            <groupId>org.springframework.boot</groupId>
75
+            <artifactId>spring-boot-starter-amqp</artifactId>
76
+        </dependency>
77
+    </dependencies>
78
+    <dependencyManagement>
79
+        <dependencies>
80
+            <dependency>
81
+                <groupId>org.springframework.cloud</groupId>
82
+                <artifactId>spring-cloud-dependencies</artifactId>
83
+                <version>${spring-cloud.version}</version>
84
+                <type>pom</type>
85
+                <scope>import</scope>
86
+            </dependency>
87
+        </dependencies>
88
+    </dependencyManagement>
89
+
90
+    <build>
91
+        <plugins>
92
+            <plugin>
93
+                <groupId>org.springframework.boot</groupId>
94
+                <artifactId>spring-boot-maven-plugin</artifactId>
95
+                <configuration>
96
+                    <excludes>
97
+                        <exclude>
98
+                            <groupId>org.projectlombok</groupId>
99
+                            <artifactId>lombok</artifactId>
100
+                        </exclude>
101
+                    </excludes>
102
+                </configuration>
103
+            </plugin>
104
+            <plugin>
105
+                <!--编译跳过测试文件检查的生命周期-->
106
+                <groupId>org.apache.maven.plugins</groupId>
107
+                <artifactId>maven-surefire-plugin</artifactId>
108
+                <version>2.22.2</version>
109
+                <configuration>
110
+                    <skip>true</skip>
111
+                </configuration>
112
+            </plugin>
113
+        </plugins>
114
+    </build>
115
+
116
+</project>

+ 17
- 0
sexam/src/main/java/com/xhkjedu/sexam/SexamApplication.java Переглянути файл

@@ -0,0 +1,17 @@
1
+package com.xhkjedu.sexam;
2
+
3
+import org.springframework.boot.SpringApplication;
4
+import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
6
+import tk.mybatis.spring.annotation.MapperScan;
7
+
8
+@SpringBootApplication
9
+@EnableEurekaClient
10
+@MapperScan(basePackages = {"com.xhkjedu.sexam.mapper"})
11
+public class SexamApplication {
12
+
13
+    public static void main(String[] args) {
14
+        SpringApplication.run(SexamApplication.class, args);
15
+    }
16
+
17
+}

+ 9
- 0
sexam/src/main/java/com/xhkjedu/sexam/base/TkMapper.java Переглянути файл

@@ -0,0 +1,9 @@
1
+package com.xhkjedu.sexam.base;
2
+
3
+import tk.mybatis.mapper.common.IdsMapper;
4
+import tk.mybatis.mapper.common.Mapper;
5
+import tk.mybatis.mapper.common.MySqlMapper;
6
+
7
+public interface TkMapper<T> extends Mapper<T>, MySqlMapper<T>, IdsMapper<T> {
8
+
9
+}

+ 34
- 0
sexam/src/main/java/com/xhkjedu/sexam/config/CorsConfig.java Переглянути файл

@@ -0,0 +1,34 @@
1
+package com.xhkjedu.sexam.config;
2
+
3
+import org.springframework.context.annotation.Bean;
4
+import org.springframework.context.annotation.Configuration;
5
+import org.springframework.web.cors.CorsConfiguration;
6
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
7
+import org.springframework.web.filter.CorsFilter;
8
+
9
+/**
10
+ * @ClassName CorsConfig
11
+ * Description 请求跨域支持
12
+ * Author WN
13
+ * Date 2020/6/5 16:29
14
+ **/
15
+@Configuration
16
+public class CorsConfig {
17
+    private CorsConfiguration corsConfiguration() {
18
+        CorsConfiguration corsConfiguration = new CorsConfiguration();
19
+        // 1允许任何域名使用
20
+        corsConfiguration.addAllowedOrigin("*");
21
+        // 2允许任何头
22
+        corsConfiguration.addAllowedHeader("*");
23
+        // 3允许任何方法(post、get等)
24
+        corsConfiguration.addAllowedMethod("*");
25
+        return corsConfiguration;
26
+    }
27
+
28
+    @Bean
29
+    public CorsFilter corsFilter() {
30
+        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
31
+        source.registerCorsConfiguration("/**", corsConfiguration());
32
+        return new CorsFilter(source);
33
+    }
34
+}

+ 67
- 0
sexam/src/main/java/com/xhkjedu/sexam/config/ErrorAdivceController.java Переглянути файл

@@ -0,0 +1,67 @@
1
+package com.xhkjedu.sexam.config;
2
+import com.alibaba.fastjson.JSON;
3
+import com.xhkjedu.config.MissingParametersException;
4
+import com.xhkjedu.utils.N_Utils;
5
+import com.xhkjedu.vo.ResultVo;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.springframework.dao.DataIntegrityViolationException;
8
+import org.springframework.web.bind.annotation.ControllerAdvice;
9
+import org.springframework.web.bind.annotation.ExceptionHandler;
10
+import org.springframework.web.bind.annotation.ResponseBody;
11
+
12
+import javax.servlet.http.HttpServletRequest;
13
+
14
+/**
15
+ * @创建人 :zj
16
+ * @创建时间 2019/11/7
17
+ * @修改人和其它信息
18
+ * @描述 :项目异常处理类:
19
+ * 项目中所有controller层抛出的异常信息都会被拦截。
20
+ * 方便我们查看异常原因,减少开发中大量的try catch。
21
+ * 拦截异常后,打印异常信息,返回前端约定参数对象。
22
+ */
23
+@Slf4j
24
+@ResponseBody
25
+@ControllerAdvice
26
+public class ErrorAdivceController {
27
+    @ExceptionHandler(MissingParametersException.class)
28
+    public ResultVo missingParametersException(MissingParametersException ex) {
29
+        log.error("参数异常:   -------> " + ex.getMessage());
30
+        return new ResultVo(1, ex.getMessage());
31
+    }
32
+
33
+    @ExceptionHandler(DataIntegrityViolationException.class)
34
+    public ResultVo DataIntegrityViolationException(DataIntegrityViolationException ex){
35
+        log.error("数据库异常:   -------> " + ex.getMessage());
36
+        String msg = ex.getMessage();
37
+        if (N_Utils.isNotEmpty(msg) && msg.indexOf("SQLIntegrityConstraintViolationException") != -1){
38
+            return new ResultVo(1,"存在关联信息");
39
+        }
40
+        return new ResultVo(1,"数据库处理异常");
41
+    }
42
+
43
+    @ExceptionHandler(Exception.class)
44
+    public ResultVo exceptionHandler(Exception ex) {
45
+        log.error("程序运行异常:   -------> " + ex.getMessage());
46
+        String msg = ex.getMessage();
47
+        if (N_Utils.isNotEmpty(msg) && msg.indexOf("JSON parse error") != -1){
48
+            return new ResultVo(1,"json格式不对");
49
+        }
50
+        return new ResultVo(1, "程序处理异常");
51
+    }
52
+
53
+    @ExceptionHandler(NullPointerException.class)
54
+    public ResultVo nullPointerException(NullPointerException ex) {
55
+        StackTraceElement element = ex.getStackTrace()[0];
56
+        log.error("参数为空异常:   -------> " + JSON.toJSONString(element));
57
+        return new ResultVo(1, "参数为空异常");
58
+    }
59
+
60
+    @ExceptionHandler(value = IllegalArgumentException.class)
61
+    public ResultVo illegalArgumentExceptionHandler(HttpServletRequest request, IllegalArgumentException ex) {
62
+        log.error("请求参数错误 URL : {},Exception : {}", request.getRequestURL(),ex.getMessage());
63
+        return new ResultVo(1, "请求参数错误");
64
+    }
65
+
66
+
67
+}

+ 62
- 0
sexam/src/main/java/com/xhkjedu/sexam/config/ThreadPoolTaskExecutorConfig.java Переглянути файл

@@ -0,0 +1,62 @@
1
+package com.xhkjedu.sexam.config;
2
+
3
+import org.springframework.context.annotation.Bean;
4
+import org.springframework.context.annotation.Configuration;
5
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
6
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
7
+
8
+import java.util.concurrent.ThreadPoolExecutor;
9
+
10
+/**
11
+ * @描述 :配置线程池
12
+ * @创建人 :zj
13
+ * @创建时间 2019/9/30
14
+ * @修改人和其它信息
15
+ */
16
+@Configuration
17
+public class ThreadPoolTaskExecutorConfig {
18
+    /**
19
+     * 配置执行任务线程池
20
+     * 应用此池: @Async("asyncPoolTaskExecutor")
21
+     *
22
+     * @return
23
+     */
24
+    @Bean(name = "asyncPoolTaskExecutor")
25
+    public ThreadPoolTaskExecutor getAsyncThreadPoolTaskExecutor() {
26
+        ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
27
+        taskExecutor.setCorePoolSize(20);
28
+        taskExecutor.setMaxPoolSize(200);
29
+        taskExecutor.setQueueCapacity(25);
30
+        taskExecutor.setKeepAliveSeconds(200);
31
+        //定义线程池名字
32
+        taskExecutor.setThreadNamePrefix("asyncPoolTaskExecutor。");
33
+        //该方法就是这里的关键,用来设置线程池关闭的时候等待所有任务都完成再继续销毁其他的Bean,这样这些异步任务的销毁就会先于Redis线程池的销毁。
34
+        // 同时,这里还设置了setAwaitTerminationSeconds(60),该方法用来设置线程池中任务的等待时间,如果超过这个时候还没有销毁就强制销毁,
35
+        // 以确保应用最后能够被关闭,而不是阻塞住。
36
+        taskExecutor.setWaitForTasksToCompleteOnShutdown(true);
37
+        taskExecutor.setAwaitTerminationSeconds(60);
38
+        // 线程池对拒绝任务(无线程可用)的处理策略,目前只支持AbortPolicy、CallerRunsPolicy;默认为后者
39
+        taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
40
+        taskExecutor.initialize();
41
+        return taskExecutor;
42
+    }
43
+
44
+    /** 
45
+    * @Description: 配置调度任务线程池
46
+    * @Author: lgq 
47
+    * @Date: 2020-03-11 16:15:27
48
+    */ 
49
+    @Bean
50
+    public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
51
+        ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
52
+        threadPoolTaskScheduler.setPoolSize(500);
53
+        threadPoolTaskScheduler.setThreadNamePrefix("taskExecutor-");
54
+        threadPoolTaskScheduler.setWaitForTasksToCompleteOnShutdown(true);
55
+        threadPoolTaskScheduler.setRemoveOnCancelPolicy(true);
56
+        threadPoolTaskScheduler.setWaitForTasksToCompleteOnShutdown(true);
57
+        threadPoolTaskScheduler.setAwaitTerminationSeconds(60);
58
+        threadPoolTaskScheduler.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
59
+        return threadPoolTaskScheduler;
60
+    }
61
+
62
+}

+ 55
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java Переглянути файл

@@ -0,0 +1,55 @@
1
+package com.xhkjedu.sexam.controller.exam;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sexam.model.exam.EBase;
6
+import com.xhkjedu.sexam.service.exam.EBaseService;
7
+import com.xhkjedu.utils.PageUtil;
8
+import com.xhkjedu.vo.PageResult;
9
+import com.xhkjedu.vo.ResultVo;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+
15
+import javax.annotation.Resource;
16
+import java.util.List;
17
+
18
+@RestController
19
+@RequestMapping("/e_base")
20
+public class EBaseController {
21
+    @Resource
22
+    private EBaseService eBaseService;
23
+
24
+    @PostMapping("/add")
25
+    public ResultVo add(@RequestBody EBase eBase) {
26
+        eBaseService.save(eBase);
27
+        return new ResultVo(0,"保存成功");
28
+    }
29
+
30
+    @PostMapping("/delete")
31
+    public ResultVo delete(@RequestBody EBase eBase) {
32
+        eBaseService.deleteById(eBase.getId());
33
+        return new ResultVo(0,"删除成功");
34
+    }
35
+
36
+    @PostMapping("/update")
37
+    public ResultVo update(@RequestBody EBase eBase) {
38
+        eBaseService.update(eBase);
39
+        return new ResultVo(0,"修改成功");
40
+    }
41
+
42
+    @PostMapping("/detail")
43
+    public ResultVo detail(@RequestBody EBase eBase) {
44
+        EBase base = eBaseService.findById(eBase.getId());
45
+        return new ResultVo(0,"获取详情成功",base);
46
+    }
47
+
48
+    @PostMapping("/list")
49
+    public ResultVo list(@RequestBody EBase eBase) {
50
+        PageHelper.startPage(eBase.getPage(), eBase.getPageSize());
51
+        List<EBase> list = eBaseService.listAll();
52
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
53
+        return new ResultVo(0,"获取列表成功",pageResult);
54
+    }
55
+}

+ 49
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectBadstudentController.java Переглянути файл

@@ -0,0 +1,49 @@
1
+package com.xhkjedu.sexam.controller.exam;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sexam.model.exam.ESubjectBadstudent;
6
+import com.xhkjedu.sexam.service.exam.ESubjectBadstudentService;
7
+import com.xhkjedu.utils.PageUtil;
8
+import com.xhkjedu.vo.PageResult;
9
+import com.xhkjedu.vo.ResultVo;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+
15
+import javax.annotation.Resource;
16
+import java.util.List;
17
+
18
+@RestController
19
+@RequestMapping("/e_badstudent")
20
+public class ESubjectBadstudentController {
21
+    @Resource
22
+    private ESubjectBadstudentService eSubjectBadstudentService;
23
+
24
+    @PostMapping("/add")
25
+    public ResultVo add(@RequestBody ESubjectBadstudent eSubjectBadstudent) {
26
+        eSubjectBadstudentService.save(eSubjectBadstudent);
27
+        return new ResultVo(0,"保存成功");
28
+    }
29
+
30
+    @PostMapping("/delete")
31
+    public ResultVo delete(@RequestBody ESubjectBadstudent eSubjectBadstudent) {
32
+        eSubjectBadstudentService.deleteById(eSubjectBadstudent.getId());
33
+        return new ResultVo(0,"删除成功");
34
+    }
35
+
36
+    @PostMapping("/update")
37
+    public ResultVo update(@RequestBody ESubjectBadstudent eSubjectBadstudent) {
38
+        eSubjectBadstudentService.update(eSubjectBadstudent);
39
+        return new ResultVo(0,"修改成功");
40
+    }
41
+
42
+    @PostMapping("/list")
43
+    public ResultVo list(@RequestBody ESubjectBadstudent eSubjectBadstudent) {
44
+        PageHelper.startPage(eSubjectBadstudent.getPage(), eSubjectBadstudent.getPageSize());
45
+        List<ESubjectBadstudent> list = eSubjectBadstudentService.listAll();
46
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
47
+        return new ResultVo(0,"获取列表成功",pageResult);
48
+    }
49
+}

+ 49
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectInvigilateController.java Переглянути файл

@@ -0,0 +1,49 @@
1
+package com.xhkjedu.sexam.controller.exam;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
6
+import com.xhkjedu.sexam.service.exam.ESubjectInvigilateService;
7
+import com.xhkjedu.utils.PageUtil;
8
+import com.xhkjedu.vo.PageResult;
9
+import com.xhkjedu.vo.ResultVo;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+
15
+import javax.annotation.Resource;
16
+import java.util.List;
17
+
18
+@RestController
19
+@RequestMapping("/e_invigilate")
20
+public class ESubjectInvigilateController {
21
+    @Resource
22
+    private ESubjectInvigilateService eSubjectInvigilateService;
23
+
24
+    @PostMapping("/add")
25
+    public ResultVo add(@RequestBody ESubjectInvigilate eSubjectInvigilate) {
26
+        eSubjectInvigilateService.save(eSubjectInvigilate);
27
+        return new ResultVo(0,"保存成功");
28
+    }
29
+
30
+    @PostMapping("/delete")
31
+    public ResultVo delete(@RequestBody ESubjectInvigilate eSubjectInvigilate) {
32
+        eSubjectInvigilateService.deleteById(eSubjectInvigilate.getId());
33
+        return new ResultVo(0,"删除成功");
34
+    }
35
+
36
+    @PostMapping("/update")
37
+    public ResultVo update(@RequestBody ESubjectInvigilate eSubjectInvigilate) {
38
+        eSubjectInvigilateService.update(eSubjectInvigilate);
39
+        return new ResultVo(0,"修改成功");
40
+    }
41
+
42
+    @PostMapping("/list")
43
+    public ResultVo list(@RequestBody ESubjectInvigilate eSubjectInvigilate) {
44
+        PageHelper.startPage(eSubjectInvigilate.getPage(), eSubjectInvigilate.getPageSize());
45
+        List<ESubjectInvigilate> list = eSubjectInvigilateService.listAll();
46
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
47
+        return new ResultVo(0,"获取列表成功",pageResult);
48
+    }
49
+}

+ 55
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/ESubjectScantronController.java Переглянути файл

@@ -0,0 +1,55 @@
1
+package com.xhkjedu.sexam.controller.paper;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sexam.model.paper.ESubjectScantron;
6
+import com.xhkjedu.sexam.service.paper.ESubjectScantronService;
7
+import com.xhkjedu.utils.PageUtil;
8
+import com.xhkjedu.vo.PageResult;
9
+import com.xhkjedu.vo.ResultVo;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+
15
+import javax.annotation.Resource;
16
+import java.util.List;
17
+
18
+@RestController
19
+@RequestMapping("/e_scantron")
20
+public class ESubjectScantronController {
21
+    @Resource
22
+    private ESubjectScantronService eSubjectScantronService;
23
+
24
+    @PostMapping("/add")
25
+    public ResultVo add(@RequestBody ESubjectScantron eSubjectScantron) {
26
+        eSubjectScantronService.save(eSubjectScantron);
27
+        return new ResultVo(0,"保存成功");
28
+    }
29
+
30
+    @PostMapping("/delete")
31
+    public ResultVo delete(@RequestBody ESubjectScantron eSubjectScantron) {
32
+        eSubjectScantronService.deleteById(eSubjectScantron.getId());
33
+        return new ResultVo(0,"删除成功");
34
+    }
35
+
36
+    @PostMapping("/update")
37
+    public ResultVo update(@RequestBody ESubjectScantron eSubjectScantron) {
38
+        eSubjectScantronService.update(eSubjectScantron);
39
+        return new ResultVo(0,"修改成功");
40
+    }
41
+
42
+    @PostMapping("/detail")
43
+    public ResultVo detail(@RequestBody ESubjectScantron eSubjectScantron) {
44
+        ESubjectScantron es = eSubjectScantronService.findById(eSubjectScantron.getId());
45
+        return new ResultVo(0,"获取详情成功",es);
46
+    }
47
+
48
+    @PostMapping("/list")
49
+    public ResultVo list(@RequestBody ESubjectScantron eSubjectScantron) {
50
+        PageHelper.startPage(eSubjectScantron.getPage(), eSubjectScantron.getPageSize());
51
+        List<ESubjectScantron> list = eSubjectScantronService.listAll();
52
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
53
+        return new ResultVo(0,"获取列表成功",pageResult);
54
+    }
55
+}

+ 21
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/status/StatusController.java Переглянути файл

@@ -0,0 +1,21 @@
1
+package com.xhkjedu.sexam.controller.status;
2
+
3
+import com.xhkjedu.vo.ResultVo;
4
+import org.springframework.web.bind.annotation.GetMapping;
5
+import org.springframework.web.bind.annotation.RequestMapping;
6
+import org.springframework.web.bind.annotation.RestController;
7
+
8
+/**
9
+ * @Description 测试子服务接口
10
+ * @Author WN
11
+ * Date 2022/4/29 16:38
12
+ **/
13
+@RestController
14
+@RequestMapping("/status")
15
+public class StatusController {
16
+
17
+    @GetMapping("/info")
18
+    public ResultVo info() {
19
+        return new ResultVo(0, "sexam服务OK");
20
+    }
21
+}

+ 109
- 0
sexam/src/main/java/com/xhkjedu/sexam/interceptors/DecryptRequestBodyAdvice.java Переглянути файл

@@ -0,0 +1,109 @@
1
+package com.xhkjedu.sexam.interceptors;
2
+
3
+
4
+import com.xhkjedu.utils.AES;
5
+import com.xhkjedu.utils.N_Utils;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.springframework.core.MethodParameter;
8
+import org.springframework.http.HttpHeaders;
9
+import org.springframework.http.HttpInputMessage;
10
+import org.springframework.http.converter.HttpMessageConverter;
11
+import org.springframework.util.StreamUtils;
12
+import org.springframework.web.bind.annotation.ControllerAdvice;
13
+import org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice;
14
+
15
+import javax.crypto.BadPaddingException;
16
+import javax.crypto.IllegalBlockSizeException;
17
+import javax.crypto.NoSuchPaddingException;
18
+import java.io.ByteArrayInputStream;
19
+import java.io.IOException;
20
+import java.io.InputStream;
21
+import java.io.UnsupportedEncodingException;
22
+import java.lang.reflect.Type;
23
+import java.security.InvalidKeyException;
24
+import java.security.NoSuchAlgorithmException;
25
+import java.util.List;
26
+
27
+/**
28
+ * @ClassName DecryptRequestBodyAdvice
29
+ * Description TODO AES解密
30
+ * Author WN
31
+ * Date 2021/5/12 11:34
32
+ **/
33
+@Slf4j
34
+@ControllerAdvice
35
+public class DecryptRequestBodyAdvice implements RequestBodyAdvice {
36
+
37
+    private static String AES_KEY = "XINGHUOLIAOYUAN7";
38
+
39
+    /** 此处如果返回false , 则不执行当前Advice的业务 */
40
+    @Override
41
+    public boolean supports(MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
42
+//       log.info("----support----");
43
+        return true;
44
+    }
45
+
46
+    /**
47
+     * @title 读取参数前执行
48
+     * @description 在此做些编码 / 解密 / 封装参数为对象的操作
49
+     **/
50
+    @Override
51
+    public HttpInputMessage beforeBodyRead(HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) throws IOException {
52
+//        log.info("----beforeBodyRead----");
53
+
54
+        //AES解密,false不需要解密
55
+        List<String> decrypts = httpInputMessage.getHeaders().get("st");
56
+        String decrypt = N_Utils.isListNotEmpty(decrypts)?decrypts.get(0):"false";
57
+        if (!decrypt.equals("true")) {
58
+            return httpInputMessage;
59
+        }
60
+        // 读取加密的请求体
61
+        byte[] body = StreamUtils.copyToByteArray(httpInputMessage.getBody());
62
+        String str = new String(body,"utf-8");
63
+
64
+        try {
65
+            // 使用AES解密
66
+            body = AES.decryptForByte(str, AES_KEY);
67
+        } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException |
68
+                BadPaddingException | UnsupportedEncodingException e) {
69
+            e.printStackTrace();
70
+            throw new RuntimeException(e);
71
+        } catch (Exception e){
72
+            e.printStackTrace();
73
+            throw new RuntimeException(e);
74
+        }
75
+
76
+        // 使用解密后的数据,构造新的读取流
77
+        InputStream rawInputStream = new ByteArrayInputStream(body);
78
+        return new HttpInputMessage() {
79
+            @Override
80
+            public HttpHeaders getHeaders() {
81
+                return httpInputMessage.getHeaders();
82
+            }
83
+
84
+            @Override
85
+            public InputStream getBody() throws IOException {
86
+                return rawInputStream;
87
+            }
88
+        };
89
+    }
90
+
91
+    /**
92
+     * @title 读取参数后执行
93
+     * @author Xingbz
94
+     */
95
+    @Override
96
+    public Object afterBodyRead(Object o, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
97
+//        log.info("afterBodyRead:----");
98
+        return o;
99
+    }
100
+
101
+    /**
102
+     * @title 无请求时的处理
103
+     */
104
+    @Override
105
+    public Object handleEmptyBody(Object o, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
106
+//        log.info("handleEmptyBody:----");
107
+        return o;
108
+    }
109
+}

+ 35
- 0
sexam/src/main/java/com/xhkjedu/sexam/interceptors/HttpServletFilter.java Переглянути файл

@@ -0,0 +1,35 @@
1
+package com.xhkjedu.sexam.interceptors;
2
+
3
+import org.springframework.stereotype.Component;
4
+
5
+import javax.servlet.Filter;
6
+import javax.servlet.FilterChain;
7
+import javax.servlet.ServletException;
8
+import javax.servlet.ServletRequest;
9
+import javax.servlet.ServletResponse;
10
+import javax.servlet.http.HttpServletRequest;
11
+import java.io.IOException;
12
+
13
+/**
14
+ * @author ywx
15
+ * @classname HttpServletFilter
16
+ * @description 过滤器 以便http post请求body输入流可多次读取
17
+ * @date 2020/11/9 11:25
18
+ **/
19
+@Component
20
+public class HttpServletFilter implements Filter {
21
+
22
+    @Override
23
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
24
+        ServletRequest requestWrapper = null;
25
+        if (request instanceof HttpServletRequest) {
26
+            requestWrapper = new RequestWrapper((HttpServletRequest) request);
27
+        }
28
+        if (requestWrapper == null) {
29
+            chain.doFilter(request, response);
30
+        } else {
31
+            chain.doFilter(requestWrapper, response);
32
+        }
33
+    }
34
+
35
+}

+ 132
- 0
sexam/src/main/java/com/xhkjedu/sexam/interceptors/RequestInterceptor.java Переглянути файл

@@ -0,0 +1,132 @@
1
+package com.xhkjedu.sexam.interceptors;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.config.MissingParametersException;
5
+import com.xhkjedu.sexam.utils.ExamUtil;
6
+import com.xhkjedu.sexam.utils.JedisUtil;
7
+import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.vo.ResultVo;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.springframework.context.annotation.Configuration;
11
+import org.springframework.web.servlet.HandlerInterceptor;
12
+import org.springframework.web.servlet.ModelAndView;
13
+
14
+import javax.servlet.http.HttpServletRequest;
15
+import javax.servlet.http.HttpServletResponse;
16
+import java.util.Map;
17
+
18
+@Configuration
19
+@Slf4j
20
+public class RequestInterceptor extends JedisUtil implements HandlerInterceptor {
21
+    @Override
22
+    public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3)
23
+            throws Exception {
24
+        // 请求结束时间
25
+        Long endTime = System.currentTimeMillis();
26
+        // 从HttpServletRequest获取开始时间
27
+        Long startTime = (Long) arg0.getAttribute("_startTime");
28
+        double time = ((endTime - startTime) * 1.000) / 1000;
29
+        // 打印接口信息及耗时
30
+        if (time > 1) {
31
+            log.error(" {};耗时:{}s", arg0.getRequestURI(), time);
32
+        }
33
+    }
34
+
35
+    @Override
36
+    public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3)
37
+            throws Exception {
38
+
39
+    }
40
+
41
+    /**
42
+     * 在调用controller具体方法前拦截
43
+     */
44
+    @Override
45
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
46
+        //log.info("请求的uri:" + request.getRequestURI());
47
+        response.setHeader("Access-Control-Allow-Origin", "*");
48
+        //response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
49
+        response.setContentType("application/json;charset=UTF-8");
50
+
51
+        // 记录请求开始时间
52
+        request.setAttribute("_startTime", System.currentTimeMillis());
53
+        String requestURI = request.getRequestURI();
54
+        String key = request.getHeader("Token-Key");
55
+        String token = request.getHeader("Token-Value");
56
+        if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
57
+                && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
58
+            String redis_token = get(key);//系统缓存中保存的token
59
+            if (!token.equals(redis_token)) {
60
+                ResultVo result = new ResultVo();
61
+                result.setCode(2);
62
+                result.setMsg("登录失效");
63
+
64
+                response.getWriter().print(JSON.toJSONString(result));
65
+                return false;
66
+            }
67
+        }
68
+
69
+        if (interceptorApi(requestURI)) {//需要拦截的请求
70
+            String encoding = request.getCharacterEncoding();
71
+            int contentLength = request.getContentLength();
72
+            byte buffer[] = new byte[request.getContentLength()];
73
+            request.getInputStream();
74
+            for (int i = 0;i < contentLength;) {
75
+
76
+                int readLen = request.getInputStream().read(buffer, i, contentLength - i);
77
+                if (readLen == -1) {
78
+                    break;
79
+                }
80
+                i += readLen;
81
+            }
82
+            if (encoding == null) {
83
+                encoding = "UTF-8";
84
+            }
85
+            String params = new String(buffer, encoding);
86
+            Map<String, String> uriMap = ExamUtil.uriMap;
87
+            String params2 = uriMap.get(requestURI);
88
+            if (N_Utils.isNotEmpty(params2) && params2.equals(params)) {
89
+                log.error("地址:{},参数:{}",requestURI,params);
90
+                throw new MissingParametersException("提交过快,请稍后重试");
91
+            } else {
92
+                uriMap.put(requestURI, params);
93
+            }
94
+        }
95
+        return true;
96
+    }
97
+
98
+    /**
99
+     * 需要拦截的请求
100
+     * @Param [uri]
101
+     * @Author ywx
102
+     * @Date 2020/5/20 14:14
103
+     * @return java.lang.Boolean
104
+     **/
105
+    private Boolean interceptorApi(String uri) {
106
+        boolean rtn = false;
107
+        String[] url = new String[]{
108
+                "/ps/start_paper",//题库作业--开始做作业
109
+                "/ps/sstart_paper",//图片作业--开始做作业
110
+                "/ps/submit_question",//作业--提交单题
111
+                "/ps/submit_paper",//作业--提交
112
+                "/ps/ssubmit_question",//图片作业--提交单题
113
+                "/ps/ssubmit_paper",//图片作业--提交
114
+                "/ps/scorrect",//答题卡--批改
115
+                "/ps/correc",//试题库--批改
116
+                "/paper/saves",//答题卡--保存
117
+                "/paper/saveq",//试题库--保存
118
+                "/pg/save"//作业--发布
119
+        };
120
+
121
+        for (int i = 0; i < url.length; i++) {
122
+            String urlstr = "/sexam"+url[i];
123
+            if (uri.equals(urlstr)) {
124
+                rtn = true;
125
+                break;
126
+            }
127
+        }
128
+
129
+        return rtn;
130
+    }
131
+
132
+}

+ 82
- 0
sexam/src/main/java/com/xhkjedu/sexam/interceptors/RequestWrapper.java Переглянути файл

@@ -0,0 +1,82 @@
1
+package com.xhkjedu.sexam.interceptors;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+
5
+import javax.servlet.ReadListener;
6
+import javax.servlet.ServletInputStream;
7
+import javax.servlet.http.HttpServletRequest;
8
+import javax.servlet.http.HttpServletRequestWrapper;
9
+import java.io.BufferedReader;
10
+import java.io.ByteArrayInputStream;
11
+import java.io.IOException;
12
+import java.io.InputStream;
13
+import java.io.InputStreamReader;
14
+
15
+/**
16
+ * @author ywx
17
+ * @classname RequestWrapper
18
+ * @description 解决POST请求中的BODY参数不能重复读取多次的问题
19
+ * @date 2020/11/9 11:24
20
+ **/
21
+@Slf4j
22
+public class RequestWrapper extends HttpServletRequestWrapper {
23
+    private static final int BUFFER_LEN = 128;
24
+
25
+    private final String body;
26
+
27
+    public RequestWrapper(HttpServletRequest request) throws IOException {
28
+        super(request);
29
+        StringBuilder stringBuilder = new StringBuilder();
30
+        BufferedReader bufferedReader = null;
31
+        try {
32
+            InputStream inputStream = request.getInputStream();
33
+            if (inputStream != null) {
34
+                bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
35
+                char[] charBuffer = new char[BUFFER_LEN];
36
+                int bytesRead;
37
+                while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
38
+                    stringBuilder.append(charBuffer, 0, bytesRead);
39
+                }
40
+            }
41
+        } catch (IOException ex) {
42
+            throw ex;
43
+        } finally {
44
+            if (bufferedReader != null) {
45
+                try {
46
+                    bufferedReader.close();
47
+                } catch (IOException ex) {
48
+                    throw ex;
49
+                }
50
+            }
51
+        }
52
+        body = stringBuilder.toString();
53
+    }
54
+
55
+    @Override
56
+    public ServletInputStream getInputStream() throws IOException {
57
+        final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body.getBytes());
58
+        ServletInputStream servletInputStream = new ServletInputStream() {
59
+            public boolean isFinished() {
60
+                return false;
61
+            }
62
+            public boolean isReady() {
63
+                return false;
64
+            }
65
+            public void setReadListener(ReadListener readListener) {}
66
+            public int read() throws IOException {
67
+                return byteArrayInputStream.read();
68
+            }
69
+        };
70
+        return servletInputStream;
71
+
72
+    }
73
+    @Override
74
+    public BufferedReader getReader() throws IOException {
75
+        return new BufferedReader(new InputStreamReader(this.getInputStream()));
76
+    }
77
+
78
+    public String getBody() {
79
+        return this.body;
80
+    }
81
+
82
+}

+ 62
- 0
sexam/src/main/java/com/xhkjedu/sexam/interceptors/WebMvcConfg.java Переглянути файл

@@ -0,0 +1,62 @@
1
+package com.xhkjedu.sexam.interceptors;
2
+
3
+import org.springframework.beans.factory.annotation.Autowired;
4
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
5
+import org.springframework.context.annotation.Bean;
6
+import org.springframework.context.annotation.Configuration;
7
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
8
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
9
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
10
+
11
+import javax.annotation.Resource;
12
+
13
+/**
14
+ * @author WN
15
+ * @description
16
+ * @date 2019/4/3 15:50
17
+ **/
18
+@Configuration
19
+public class WebMvcConfg implements WebMvcConfigurer {
20
+
21
+    @Autowired
22
+    private RequestInterceptor requestInterceptor;
23
+    @Resource
24
+    private HttpServletFilter httpServletFilter;
25
+
26
+    /**
27
+     * 拦截器addPathPatterns用于添加拦截规则 excludePathPatterns 用于排除拦截
28
+     * @Param: registry
29
+     * @return void
30
+     * @author wn
31
+     * @date 2019/4/8
32
+     */
33
+    @Override
34
+    public void addInterceptors(InterceptorRegistry registry) {
35
+        registry.addInterceptor(requestInterceptor).addPathPatterns("/**");
36
+    }
37
+
38
+    /**
39
+     * 允许跨域
40
+     * @Param: registry
41
+     * @return void
42
+     * @author wn
43
+     * @date 2019/4/8
44
+     */
45
+    @Override
46
+    public void addCorsMappings(CorsRegistry registry){
47
+        registry.addMapping("/**")
48
+                .allowedOriginPatterns("*")
49
+                .allowCredentials(true)
50
+                .allowedMethods("GET","POST")
51
+                .maxAge(3600);
52
+    }
53
+
54
+    @Bean
55
+    public FilterRegistrationBean registerFilter() {
56
+        FilterRegistrationBean registration = new FilterRegistrationBean();
57
+        registration.setFilter(httpServletFilter);
58
+        registration.addUrlPatterns("/*");
59
+        registration.setOrder(1);
60
+        return registration;
61
+    }
62
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EBaseMapper.java Переглянути файл

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.exam;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.exam.EBase;
5
+
6
+public interface EBaseMapper extends TkMapper<EBase> {
7
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EClassMapper.java Переглянути файл

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.exam;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.exam.EClass;
5
+
6
+public interface EClassMapper extends TkMapper<EClass> {
7
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EClassStudentMapper.java Переглянути файл

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.exam;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.exam.EClassStudent;
5
+
6
+public interface EClassStudentMapper extends TkMapper<EClassStudent> {
7
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/ESubjectBadstudentMapper.java Переглянути файл

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.exam;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.exam.ESubjectBadstudent;
5
+
6
+public interface ESubjectBadstudentMapper extends TkMapper<ESubjectBadstudent> {
7
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/ESubjectInvigilateMapper.java Переглянути файл

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.exam;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
5
+
6
+public interface ESubjectInvigilateMapper extends TkMapper<ESubjectInvigilate> {
7
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/ESubjectMapper.java Переглянути файл

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.exam;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.exam.ESubject;
5
+
6
+public interface ESubjectMapper extends TkMapper<ESubject> {
7
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/ESubjectScantronMapper.java Переглянути файл

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.paper;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.paper.ESubjectScantron;
5
+
6
+public interface ESubjectScantronMapper extends TkMapper<ESubjectScantron> {
7
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/ESubjectScantronQtypeMapper.java Переглянути файл

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.paper;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.paper.ESubjectScantronQtype;
5
+
6
+public interface ESubjectScantronQtypeMapper extends TkMapper<ESubjectScantronQtype> {
7
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/ESubjectScantronStudentMapper.java Переглянути файл

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.paperstudent;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.paperstudent.ESubjectScantronStudent;
5
+
6
+public interface ESubjectScantronStudentMapper extends TkMapper<ESubjectScantronStudent> {
7
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/ESubjectScantronStudentQuestionMapper.java Переглянути файл

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.paperstudent;
2
+
3
+import com.xhkjedu.sexam.base.TkMapper;
4
+import com.xhkjedu.sexam.model.paperstudent.ESubjectScantronStudentQuestion;
5
+
6
+public interface ESubjectScantronStudentQuestionMapper extends TkMapper<ESubjectScantronStudentQuestion> {
7
+}

+ 26
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/BaseBean.java Переглянути файл

@@ -0,0 +1,26 @@
1
+package com.xhkjedu.sexam.model;
2
+
3
+import lombok.Data;
4
+
5
+import javax.persistence.Transient;
6
+
7
+/**
8
+ * @author lgq
9
+ * @date 2019/11/8 9:29
10
+ * @description: 添加时返回主键绑定id
11
+ */
12
+@Data
13
+public class BaseBean {
14
+    //添加时返回主键
15
+    @Transient
16
+    private Integer id;
17
+    //创建人姓名
18
+    @Transient
19
+    private String createname;
20
+    //分页显示页码
21
+    @Transient
22
+    private Integer page;
23
+    //分页显示条数
24
+    @Transient
25
+    private Integer pageSize;
26
+}

+ 45
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/exam/EBase.java Переглянути файл

@@ -0,0 +1,45 @@
1
+package com.xhkjedu.sexam.model.exam;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_base")
10
+@Data
11
+public class EBase extends BaseBean {
12
+    @Id
13
+    //考试基础信息表
14
+    private Integer examid;
15
+
16
+    //考试名称
17
+    private String examname;
18
+
19
+    //考试时间
20
+    private String examtime;
21
+
22
+    //年级
23
+    private Integer gradeid;
24
+
25
+    //考试类型10期末20期中30月考40周考
26
+    private Integer examtype;
27
+
28
+    //考试模式1线上2线下
29
+    private Integer exammode;
30
+
31
+    //是否启用监控0未启用1启用
32
+    private Integer monitored;
33
+
34
+    //考试状态1正常10删除
35
+    private Integer examstate;
36
+
37
+    //创建人id
38
+    private Integer createid;
39
+
40
+    //创建时间
41
+    private Integer createtime;
42
+
43
+    //学校id
44
+    private Integer schoolid;
45
+}

+ 24
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/exam/EClass.java Переглянути файл

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.sexam.model.exam;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_class")
10
+@Data
11
+public class EClass extends BaseBean {
12
+    @Id
13
+    //考试关联班级表
14
+    private Integer ecid;
15
+
16
+    //考试id
17
+    private Integer examid;
18
+
19
+    //班级id
20
+    private Integer classid;
21
+
22
+    //班级人数
23
+    private Integer classnum;
24
+}

+ 24
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/exam/EClassStudent.java Переглянути файл

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.sexam.model.exam;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_class_student")
10
+@Data
11
+public class EClassStudent extends BaseBean {
12
+    @Id
13
+    //考试关联学生表
14
+    private Integer ecsid;
15
+
16
+    //考试id
17
+    private Integer examid;
18
+
19
+    //班级id
20
+    private Integer classid;
21
+
22
+    //学生id
23
+    private Integer studentid;
24
+}

+ 45
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/exam/ESubject.java Переглянути файл

@@ -0,0 +1,45 @@
1
+package com.xhkjedu.sexam.model.exam;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_subject")
10
+@Data
11
+public class ESubject extends BaseBean {
12
+    @Id
13
+    //考试科目表
14
+    private Integer esid;
15
+
16
+    //考试表id
17
+    private Integer examid;
18
+
19
+    //科目表id
20
+    private String subjectid;
21
+
22
+    //考试日期
23
+    private String sdate;
24
+
25
+    //开始时间(10:00)
26
+    private String begintime;
27
+
28
+    //结束时间(12:00)
29
+    private String endtime;
30
+
31
+    //出卷人id
32
+    private Integer teacherid;
33
+
34
+    //设置状态0未开始1设置完成
35
+    private Integer esstate;
36
+
37
+    //试卷类型1题库2答题卡3仅答题卡
38
+    private Integer ptype;
39
+
40
+    //设置人
41
+    private Integer handleid;
42
+
43
+    //设置时间
44
+    private Integer handletime;
45
+}

+ 36
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/exam/ESubjectBadstudent.java Переглянути файл

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.sexam.model.exam;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_subject_badstudent")
10
+@Data
11
+public class ESubjectBadstudent extends BaseBean {
12
+    @Id
13
+    //考试科目违规学生表
14
+    private Integer esbsid;
15
+
16
+    //考试表id
17
+    private Integer examid;
18
+
19
+    //考试科目表id
20
+    private Integer esid;
21
+
22
+    //班级id
23
+    private Integer classid;
24
+
25
+    //学生id
26
+    private Integer studentid;
27
+
28
+    //违规类型1不在屏幕2多人3切出来
29
+    private Integer badtype;
30
+
31
+    //违规图片地址
32
+    private String picpath;
33
+
34
+    //违规时间
35
+    private Integer createtime;
36
+}

+ 36
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/exam/ESubjectInvigilate.java Переглянути файл

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.sexam.model.exam;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_subject_invigilate")
10
+@Data
11
+public class ESubjectInvigilate extends BaseBean {
12
+    @Id
13
+    //考试科目监考教师表
14
+    private Integer esiid;
15
+
16
+    //考试科目id
17
+    private Integer esid;
18
+
19
+    //科目id
20
+    private String subjectid;
21
+
22
+    //班级id
23
+    private Integer classid;
24
+
25
+    //是否是主监考0不是1是
26
+    private Integer majored;
27
+
28
+    //教师id
29
+    private Integer teacherid;
30
+
31
+    //创建人id
32
+    private Integer createid;
33
+
34
+    //创建时间
35
+    private Integer createtime;
36
+}

+ 54
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaper.java Переглянути файл

@@ -0,0 +1,54 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper")
10
+@Data
11
+public class EPaper extends BaseBean {
12
+    @Id
13
+    //考试试卷表
14
+    private Integer epid;
15
+
16
+    //考试id
17
+    private Integer examid;
18
+
19
+    //考试科目表id
20
+    private Integer esid;
21
+
22
+    //科目id
23
+    private String subjectid;
24
+
25
+    //试卷类型1题库2答题卡
26
+    private Integer ptype;
27
+
28
+    //试题数量
29
+    private Integer pnum;
30
+
31
+    //试卷总分
32
+    private Double pscore;
33
+
34
+    //批阅设置:1按班设置2按题设置
35
+    private Integer correcttype;
36
+
37
+    //听力题文件地址(附件试卷)
38
+    private String hearfile;
39
+
40
+    //状态0默认1已设置2退回
41
+    private Integer pstate;
42
+
43
+    //创建人
44
+    private Integer createid;
45
+
46
+    //创建时间
47
+    private Integer createtime;
48
+
49
+    //修改人
50
+    private Integer handleid;
51
+
52
+    //修改时间
53
+    private Integer handletime;
54
+}

+ 24
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperAnalyze.java Переглянути файл

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_analyze")
10
+@Data
11
+public class EPaperAnalyze extends BaseBean {
12
+    @Id
13
+    //考试试卷分析表
14
+    private Integer epaid;
15
+
16
+    //试卷id
17
+    private Integer epid;
18
+
19
+    //总体分析
20
+    private String alljson;
21
+
22
+    //试题量分布分析
23
+    private String qnumjson;
24
+}

+ 27
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperBack.java Переглянути файл

@@ -0,0 +1,27 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_back")
10
+@Data
11
+public class EPaperBack extends BaseBean {
12
+    @Id
13
+    //考试试卷回退记录表
14
+    private Integer epcid;
15
+
16
+    //试卷表id
17
+    private Integer epid;
18
+
19
+    //试卷退回原因
20
+    private String backtxt;
21
+
22
+    //创建人
23
+    private Integer createid;
24
+
25
+    //创建时间
26
+    private Integer createtime;
27
+}

+ 30
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperCorrectclass.java Переглянути файл

@@ -0,0 +1,30 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_correctclass")
10
+@Data
11
+public class EPaperCorrectclass extends BaseBean {
12
+    @Id
13
+    //考试试卷按班批阅表
14
+    private Integer epccid;
15
+
16
+    //试卷id
17
+    private Integer epid;
18
+
19
+    //批阅老师id
20
+    private Integer teacherid;
21
+
22
+    //班级id
23
+    private Integer classid;
24
+
25
+    //创建人id
26
+    private Integer createid;
27
+
28
+    //创建时间
29
+    private Integer createtime;
30
+}

+ 33
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperCorrectquestion.java Переглянути файл

@@ -0,0 +1,33 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_correctquestion")
10
+@Data
11
+public class EPaperCorrectquestion extends BaseBean {
12
+    @Id
13
+    //考试试卷按题批阅表
14
+    private Integer epcqid;
15
+
16
+    //试卷表
17
+    private Integer epid;
18
+
19
+    //教师id
20
+    private Integer teacherid;
21
+
22
+    //试题题号
23
+    private String qorder;
24
+
25
+    //试卷中试题表id(包含答题卡和附件)
26
+    private Integer epqid;
27
+
28
+    //创建人id
29
+    private Integer createid;
30
+
31
+    //创建时间
32
+    private Integer createtime;
33
+}

+ 36
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperFile.java Переглянути файл

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_file")
10
+@Data
11
+public class EPaperFile extends BaseBean {
12
+    @Id
13
+    //考试试卷附件表
14
+    private Integer epfid;
15
+
16
+    //考试试卷表
17
+    private Integer epid;
18
+
19
+    //文件地址
20
+    private String filepath;
21
+
22
+    //原文档保存地址
23
+    private String sourcepath;
24
+
25
+    //文件类型1题干2答案
26
+    private Integer fileclass;
27
+
28
+    //文件顺序
29
+    private Integer fileorder;
30
+
31
+    //创建人di
32
+    private Integer createid;
33
+
34
+    //创建时间
35
+    private Integer createtime;
36
+}

+ 36
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperFjtype.java Переглянути файл

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_fjtype")
10
+@Data
11
+public class EPaperFjtype extends BaseBean {
12
+    @Id
13
+    //附件试卷题型表
14
+    private Integer epfjid;
15
+
16
+    //试卷id
17
+    private Integer epid;
18
+
19
+    //题型名称
20
+    private String epfjname;
21
+
22
+    //题型下试题数量
23
+    private Integer epfjnum;
24
+
25
+    //题型排序
26
+    private Integer epfjorder;
27
+
28
+    //题型下试题分值
29
+    private Double epfjscore;
30
+
31
+    //创建人id
32
+    private Integer createid;
33
+
34
+    //创建时间
35
+    private Integer createtime;
36
+}

+ 45
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperFjtypeQuestion.java Переглянути файл

@@ -0,0 +1,45 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_fjtype_question")
10
+@Data
11
+public class EPaperFjtypeQuestion extends BaseBean {
12
+    @Id
13
+    //附件试卷题型试题表
14
+    private Integer epfjqid;
15
+
16
+    //附件题型表id
17
+    private Integer epfjid;
18
+
19
+    //试卷表id
20
+    private Integer epid;
21
+
22
+    //题型id
23
+    private String qtypeid;
24
+
25
+    //题型名称
26
+    private String qtypename;
27
+
28
+    //处理题型1单选题2多选题3主观题4判断对错5判断√×6判断TF7完形填空8阅读理解10任务型阅读
29
+    private Integer ctype;
30
+
31
+    //分值
32
+    private Double score;
33
+
34
+    //题号
35
+    private String qn;
36
+
37
+    //排序
38
+    private Integer order;
39
+
40
+    //选项数量
41
+    private Integer optionnum;
42
+
43
+    //正确答案
44
+    private String answer;
45
+}

+ 36
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperQtype.java Переглянути файл

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_qtype")
10
+@Data
11
+public class EPaperQtype extends BaseBean {
12
+    @Id
13
+    //考试试卷题型表
14
+    private Integer eptid;
15
+
16
+    //试卷id
17
+    private Integer epid;
18
+
19
+    //题型名称
20
+    private String eptname;
21
+
22
+    //题型下试题数量
23
+    private Integer eptnum;
24
+
25
+    //题型排序
26
+    private Integer eptorder;
27
+
28
+    //题型下试题总分值
29
+    private Double eptscore;
30
+
31
+    //创建人id
32
+    private Integer createid;
33
+
34
+    //创建时间
35
+    private Integer createtime;
36
+}

+ 30
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperQtypeQuestion.java Переглянути файл

@@ -0,0 +1,30 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_qtype_question")
10
+@Data
11
+public class EPaperQtypeQuestion extends BaseBean {
12
+    @Id
13
+    //考试试卷题型试题表
14
+    private Integer eptqid;
15
+
16
+    //考试试卷题型表id
17
+    private Integer eptid;
18
+
19
+    //考试试卷表id
20
+    private Integer epid;
21
+
22
+    //试题id
23
+    private String questionid;
24
+
25
+    //试题分值
26
+    private Double score;
27
+
28
+    //试题排序
29
+    private Integer order;
30
+}

+ 57
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantron.java Переглянути файл

@@ -0,0 +1,57 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_subject_scantron")
10
+@Data
11
+public class ESubjectScantron extends BaseBean {
12
+    @Id
13
+    //试卷科目答题卡表
14
+    private Integer essid;
15
+
16
+    //考试id
17
+    private Integer examid;
18
+
19
+    //考试科目id
20
+    private Integer esid;
21
+
22
+    //答题卡题型表id
23
+    private Integer esstid;
24
+
25
+    //试卷类型1题库2答题卡3仅答题卡
26
+    private Integer ptype;
27
+
28
+    //试题id
29
+    private String questionid;
30
+
31
+    //题型id
32
+    private String qtypeid;
33
+
34
+    //题型名称
35
+    private String qtypename;
36
+
37
+    //题号
38
+    private String order;
39
+
40
+    //分值
41
+    private Double score;
42
+
43
+    //选项数量
44
+    private Integer optionnum;
45
+
46
+    //正确答案
47
+    private String answer;
48
+
49
+    //试题坐标
50
+    private String coord;
51
+
52
+    //创建人id
53
+    private Integer createid;
54
+
55
+    //创建时间
56
+    private Integer createtime;
57
+}

+ 39
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantronQtype.java Переглянути файл

@@ -0,0 +1,39 @@
1
+package com.xhkjedu.sexam.model.paper;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_subject_scantron_qtype")
10
+@Data
11
+public class ESubjectScantronQtype extends BaseBean {
12
+    @Id
13
+    //试卷科目答题卡题型表
14
+    private Integer esstid;
15
+
16
+    //考试id
17
+    private Integer examid;
18
+
19
+    //考试科目表
20
+    private Integer esid;
21
+
22
+    //题型名称
23
+    private String esstname;
24
+
25
+    //题型序号
26
+    private String esstorder;
27
+
28
+    //题型下试题数量
29
+    private Integer esstnum;
30
+
31
+    //题型下试题总分值
32
+    private Double esstscore;
33
+
34
+    //创建人id
35
+    private Integer createid;
36
+
37
+    //创建时间
38
+    private Integer createtime;
39
+}

+ 57
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/EPaperStudent.java Переглянути файл

@@ -0,0 +1,57 @@
1
+package com.xhkjedu.sexam.model.paperstudent;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_student")
10
+@Data
11
+public class EPaperStudent extends BaseBean {
12
+    @Id
13
+    //考试试卷学生表
14
+    private Integer epsid;
15
+
16
+    //考试id
17
+    private Integer examid;
18
+
19
+    //试卷id
20
+    private Integer espid;
21
+
22
+    //班级id
23
+    private Integer classid;
24
+
25
+    //学生id
26
+    private Integer studentid;
27
+
28
+    //状态0未提交1已提交
29
+    private Integer sstate;
30
+
31
+    //批阅状态0未批改1批改中2已批改
32
+    private Integer checked;
33
+
34
+    //批阅人
35
+    private Integer checkid;
36
+
37
+    //试题数量
38
+    private Integer num;
39
+
40
+    //试卷总分
41
+    private Double score;
42
+
43
+    //学生得分
44
+    private Double stuscore;
45
+
46
+    //开始作答时间
47
+    private Integer starttime;
48
+
49
+    //结束作答时间
50
+    private Integer endtime;
51
+
52
+    //花费时间(单位秒)
53
+    private Integer costtime;
54
+
55
+    //创建时间
56
+    private Integer createtime;
57
+}

+ 75
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/EPaperStudentFjquestion.java Переглянути файл

@@ -0,0 +1,75 @@
1
+package com.xhkjedu.sexam.model.paperstudent;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_student_fjquestion")
10
+@Data
11
+public class EPaperStudentFjquestion extends BaseBean {
12
+    @Id
13
+    //考试试卷学生附件试题表
14
+    private Integer epsfjqid;
15
+
16
+    //班级id
17
+    private Integer classid;
18
+
19
+    //学生id
20
+    private Integer studentid;
21
+
22
+    //试卷id
23
+    private Integer epid;
24
+
25
+    //试卷学生id
26
+    private Integer epsid;
27
+
28
+    //附件试题表id
29
+    private Integer epfjqid;
30
+
31
+    //试题序号
32
+    private String qn;
33
+
34
+    //试题排序
35
+    private Integer qorder;
36
+
37
+    //是否作答0未作答1已作做答
38
+    private Integer answered;
39
+
40
+    //答案类型1选择题、图片2纯文本
41
+    private Integer ansertype;
42
+
43
+    //学生答案(纯文本)
44
+    private String stuanswertxt;
45
+
46
+    //是否转换0未转换1已转换2转换失败
47
+    private Integer converted;
48
+
49
+    //提交时间
50
+    private Integer answertime;
51
+
52
+    //单题花费时间(单位秒)
53
+    private Integer costtime;
54
+
55
+    //试题分值
56
+    private Double qscore;
57
+
58
+    //学生得分
59
+    private Double stuscore;
60
+
61
+    //是否批改0未批改1批改中2已批改
62
+    private Integer checked;
63
+
64
+    //批改人
65
+    private Integer checkid;
66
+
67
+    //批改时间
68
+    private Integer checktime;
69
+
70
+    //作答情况0默认1优秀2违规
71
+    private Integer goodbad;
72
+
73
+    //学生答案(选项、图片)
74
+    private String stuanswer;
75
+}

+ 72
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/EPaperStudentQuestion.java Переглянути файл

@@ -0,0 +1,72 @@
1
+package com.xhkjedu.sexam.model.paperstudent;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_paper_student_question")
10
+@Data
11
+public class EPaperStudentQuestion extends BaseBean {
12
+    @Id
13
+    //考试试卷学生题库试题表
14
+    private Integer epsqid;
15
+
16
+    //班级id
17
+    private Integer classid;
18
+
19
+    //学生id
20
+    private Integer studentid;
21
+
22
+    //试卷id
23
+    private Integer epid;
24
+
25
+    //试卷学生id
26
+    private Integer epsid;
27
+
28
+    //试题id
29
+    private String questionid;
30
+
31
+    //试题排序
32
+    private String qorder;
33
+
34
+    //是否作答0未作答1已作做答
35
+    private Integer answered;
36
+
37
+    //答案类型1选择题、图片2纯文本
38
+    private Integer ansertype;
39
+
40
+    //学生答案(纯文本)
41
+    private String stuanswertxt;
42
+
43
+    //是否转换0未转换1已转换2转换失败
44
+    private Integer converted;
45
+
46
+    //提交时间
47
+    private Integer answertime;
48
+
49
+    //单题花费时间(单位秒)
50
+    private Integer costtime;
51
+
52
+    //试题分值
53
+    private Double qscore;
54
+
55
+    //学生得分
56
+    private Double stuscore;
57
+
58
+    //是否批改0未批改1批改中2已批改
59
+    private Integer checked;
60
+
61
+    //批改人
62
+    private Integer checkid;
63
+
64
+    //批改时间
65
+    private Integer checktime;
66
+
67
+    //作答情况0默认1优秀2违规
68
+    private Integer goodbad;
69
+
70
+    //学生答案(选项、图片)
71
+    private String stuanswer;
72
+}

+ 45
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/ESubjectScantronStudent.java Переглянути файл

@@ -0,0 +1,45 @@
1
+package com.xhkjedu.sexam.model.paperstudent;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_subject_scantron_student")
10
+@Data
11
+public class ESubjectScantronStudent extends BaseBean {
12
+    @Id
13
+    //考试科目答题卡学生表
14
+    private Integer esssid;
15
+
16
+    //班级id
17
+    private Integer classid;
18
+
19
+    //学生id
20
+    private Integer studentid;
21
+
22
+    //考试科目id
23
+    private Integer esid;
24
+
25
+    //考试科目答题卡id
26
+    private Integer essid;
27
+
28
+    //批阅状态0未批改1批改中2已批改
29
+    private Integer checked;
30
+
31
+    //批阅人
32
+    private Integer checkid;
33
+
34
+    //试题数量
35
+    private Integer num;
36
+
37
+    //试卷分值
38
+    private Double score;
39
+
40
+    //学生得分
41
+    private Double stuscore;
42
+
43
+    //保存时间
44
+    private Integer createtime;
45
+}

+ 66
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/ESubjectScantronStudentQuestion.java Переглянути файл

@@ -0,0 +1,66 @@
1
+package com.xhkjedu.sexam.model.paperstudent;
2
+
3
+import com.xhkjedu.sexam.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "e_subject_scantron_student_question")
10
+@Data
11
+public class ESubjectScantronStudentQuestion extends BaseBean {
12
+    @Id
13
+    //考试答题卡学生作答表
14
+    private Integer esssqid;
15
+
16
+    //班级id
17
+    private Integer classid;
18
+
19
+    //学生id
20
+    private Integer studentid;
21
+
22
+    //考试科目id
23
+    private Integer esid;
24
+
25
+    //考试科目答题卡id
26
+    private Integer essid;
27
+
28
+    //学生答题卡表id
29
+    private Integer esssid;
30
+
31
+    //试题序号
32
+    private String qn;
33
+
34
+    //试题排序
35
+    private Integer qorder;
36
+
37
+    //是否作答0未作答1已作做答
38
+    private Integer answered;
39
+
40
+    //是否转换0未转换1已转换2转换失败
41
+    private Integer converted;
42
+
43
+    //试题分值
44
+    private Double qscore;
45
+
46
+    //学生得分
47
+    private Double stuscore;
48
+
49
+    //是否批改0未批改1批改中2已批改
50
+    private Integer checked;
51
+
52
+    //批改人
53
+    private Integer checkid;
54
+
55
+    //批改时间
56
+    private Integer checktime;
57
+
58
+    //作答情况0默认1优秀2违规
59
+    private Integer goodbad;
60
+
61
+    //保存时间
62
+    private Integer createtime;
63
+
64
+    //学生答案(选项、图片)
65
+    private String stuanswer;
66
+}

+ 41
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/exam/EBaseService.java Переглянути файл

@@ -0,0 +1,41 @@
1
+package com.xhkjedu.sexam.service.exam;
2
+
3
+import com.xhkjedu.sexam.mapper.exam.EBaseMapper;
4
+import com.xhkjedu.sexam.model.exam.EBase;
5
+import com.xhkjedu.utils.N_Utils;
6
+import org.springframework.stereotype.Service;
7
+
8
+import javax.annotation.Resource;
9
+import java.util.List;
10
+
11
+@Service
12
+public class EBaseService {
13
+    @Resource
14
+    private EBaseMapper eBaseMapper;
15
+
16
+    //添加
17
+    public void save(EBase model) {
18
+        model.setCreatetime(N_Utils.getSecondTimestamp());
19
+        eBaseMapper.insertSelective(model);
20
+    }
21
+
22
+    //删除
23
+    public Integer deleteById(Integer id) {
24
+        return eBaseMapper.deleteByPrimaryKey(id);
25
+    }
26
+
27
+    //修改
28
+    public Integer update(EBase model) {
29
+        return eBaseMapper.updateByPrimaryKeySelective(model);
30
+    }
31
+
32
+    //获取详情
33
+    public EBase findById(Integer id) {
34
+        return eBaseMapper.selectByPrimaryKey(id);
35
+    }
36
+
37
+    //获取列表
38
+    public List <EBase> listAll() {
39
+        return eBaseMapper.selectAll();
40
+    }
41
+}

+ 41
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/exam/ESubjectBadstudentService.java Переглянути файл

@@ -0,0 +1,41 @@
1
+package com.xhkjedu.sexam.service.exam;
2
+
3
+import com.xhkjedu.sexam.mapper.exam.ESubjectBadstudentMapper;
4
+import com.xhkjedu.sexam.model.exam.ESubjectBadstudent;
5
+import com.xhkjedu.utils.N_Utils;
6
+import org.springframework.stereotype.Service;
7
+
8
+import javax.annotation.Resource;
9
+import java.util.List;
10
+
11
+@Service
12
+public class ESubjectBadstudentService {
13
+    @Resource
14
+    private ESubjectBadstudentMapper eSubjectBadstudentMapper;
15
+
16
+    //添加
17
+    public void save(ESubjectBadstudent model) {
18
+        model.setCreatetime(N_Utils.getSecondTimestamp());
19
+        eSubjectBadstudentMapper.insertSelective(model);
20
+    }
21
+
22
+    //删除
23
+    public Integer deleteById(Integer id) {
24
+        return eSubjectBadstudentMapper.deleteByPrimaryKey(id);
25
+    }
26
+
27
+    //修改
28
+    public Integer update(ESubjectBadstudent model) {
29
+        return eSubjectBadstudentMapper.updateByPrimaryKeySelective(model);
30
+    }
31
+
32
+    //获取详情
33
+    public ESubjectBadstudent findById(Integer id) {
34
+        return eSubjectBadstudentMapper.selectByPrimaryKey(id);
35
+    }
36
+
37
+    //获取列表
38
+    public List <ESubjectBadstudent> listAll() {
39
+        return eSubjectBadstudentMapper.selectAll();
40
+    }
41
+}

+ 41
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/exam/ESubjectInvigilateService.java Переглянути файл

@@ -0,0 +1,41 @@
1
+package com.xhkjedu.sexam.service.exam;
2
+
3
+import com.xhkjedu.sexam.mapper.exam.ESubjectInvigilateMapper;
4
+import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
5
+import com.xhkjedu.utils.N_Utils;
6
+import org.springframework.stereotype.Service;
7
+
8
+import javax.annotation.Resource;
9
+import java.util.List;
10
+
11
+@Service
12
+public class ESubjectInvigilateService {
13
+    @Resource
14
+    private ESubjectInvigilateMapper eSubjectInvigilateMapper;
15
+
16
+    //添加
17
+    public void save(ESubjectInvigilate model) {
18
+        model.setCreatetime(N_Utils.getSecondTimestamp());
19
+        eSubjectInvigilateMapper.insertSelective(model);
20
+    }
21
+
22
+    //删除
23
+    public Integer deleteById(Integer id) {
24
+        return eSubjectInvigilateMapper.deleteByPrimaryKey(id);
25
+    }
26
+
27
+    //修改
28
+    public Integer update(ESubjectInvigilate model) {
29
+        return eSubjectInvigilateMapper.updateByPrimaryKeySelective(model);
30
+    }
31
+
32
+    //获取详情
33
+    public ESubjectInvigilate findById(Integer id) {
34
+        return eSubjectInvigilateMapper.selectByPrimaryKey(id);
35
+    }
36
+
37
+    //获取列表
38
+    public List <ESubjectInvigilate> listAll() {
39
+        return eSubjectInvigilateMapper.selectAll();
40
+    }
41
+}

+ 41
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/paper/ESubjectScantronService.java Переглянути файл

@@ -0,0 +1,41 @@
1
+package com.xhkjedu.sexam.service.paper;
2
+
3
+import com.xhkjedu.sexam.mapper.paper.ESubjectScantronMapper;
4
+import com.xhkjedu.sexam.model.paper.ESubjectScantron;
5
+import com.xhkjedu.utils.N_Utils;
6
+import org.springframework.stereotype.Service;
7
+
8
+import javax.annotation.Resource;
9
+import java.util.List;
10
+
11
+@Service
12
+public class ESubjectScantronService {
13
+    @Resource
14
+    private ESubjectScantronMapper eSubjectScantronMapper;
15
+
16
+    //添加
17
+    public void save(ESubjectScantron model) {
18
+        model.setCreatetime(N_Utils.getSecondTimestamp());
19
+        eSubjectScantronMapper.insertSelective(model);
20
+    }
21
+
22
+    //删除
23
+    public Integer deleteById(Integer id) {
24
+        return eSubjectScantronMapper.deleteByPrimaryKey(id);
25
+    }
26
+
27
+    //修改
28
+    public Integer update(ESubjectScantron model) {
29
+        return eSubjectScantronMapper.updateByPrimaryKeySelective(model);
30
+    }
31
+
32
+    //获取详情
33
+    public ESubjectScantron findById(Integer id) {
34
+        return eSubjectScantronMapper.selectByPrimaryKey(id);
35
+    }
36
+
37
+    //获取列表
38
+    public List <ESubjectScantron> listAll() {
39
+        return eSubjectScantronMapper.selectAll();
40
+    }
41
+}

+ 17
- 0
sexam/src/main/java/com/xhkjedu/sexam/utils/ExamUtil.java Переглянути файл

@@ -0,0 +1,17 @@
1
+package com.xhkjedu.sexam.utils;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+
5
+import java.util.Map;
6
+import java.util.concurrent.ConcurrentHashMap;
7
+
8
+/**
9
+ * @ClassName StudyUtil
10
+ * Description study模块用到的工具类
11
+ * Author WN
12
+ * Date 2022/2/21 10:01
13
+ **/
14
+@Slf4j
15
+public class ExamUtil {
16
+    public static Map<String, String> uriMap = new ConcurrentHashMap<>();
17
+}

+ 106
- 0
sexam/src/main/java/com/xhkjedu/sexam/utils/JedisUtil.java Переглянути файл

@@ -0,0 +1,106 @@
1
+package com.xhkjedu.sexam.utils;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.beans.factory.annotation.Value;
6
+import org.springframework.data.redis.core.StringRedisTemplate;
7
+import org.springframework.data.redis.core.ValueOperations;
8
+import org.springframework.stereotype.Component;
9
+
10
+import javax.annotation.PostConstruct;
11
+import java.util.concurrent.TimeUnit;
12
+
13
+/**
14
+ * @author ywx
15
+ * @classname JedisUtil
16
+ * @description Redis工具类
17
+ * @date 2019/8/2 16:48
18
+ **/
19
+@Component
20
+public class JedisUtil {
21
+	@Autowired
22
+	private StringRedisTemplate stringRedisTemplate;
23
+	private ValueOperations<String, String> valueOperations;
24
+
25
+	@PostConstruct
26
+	public void init(){
27
+		this.valueOperations = stringRedisTemplate.opsForValue();
28
+	}
29
+
30
+	/**  默认过期时长,单位:秒 */
31
+	//redis失效时间
32
+	@Value("${redisdatatime}")
33
+	private Integer redisdatatime;
34
+	/**  不设置过期时长 */
35
+	public final static long NOT_EXPIRE = -1;
36
+
37
+	public boolean set(String key, Object value, Integer expire){
38
+		boolean rtn = false;
39
+		valueOperations.set(key, toJson(value));
40
+		if(expire != NOT_EXPIRE){
41
+			rtn = stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
42
+		}
43
+		return rtn;
44
+	}
45
+
46
+	public void set(String key, Object value){
47
+		set(key, value, redisdatatime);
48
+	}
49
+
50
+	public Boolean setObject(String key, Object value, int cacheSeconds) {
51
+		String val = toJson(value);
52
+		return set(key,val,cacheSeconds);
53
+	}
54
+
55
+	public <T> T get(String key, Class<T> clazz, long expire) {
56
+		String value = valueOperations.get(key);
57
+		if(expire != NOT_EXPIRE){
58
+			stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
59
+		}
60
+		return value == null ? null : fromJson(value, clazz);
61
+	}
62
+
63
+	public <T> T get(String key, Class<T> clazz) {
64
+		return get(key, clazz, NOT_EXPIRE);
65
+	}
66
+
67
+	public String get(String key, long expire) {
68
+		String value = valueOperations.get(key);
69
+		if(expire != NOT_EXPIRE){
70
+			stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
71
+		}
72
+		return value;
73
+	}
74
+
75
+	public String get(String key) {
76
+		return get(key, NOT_EXPIRE);
77
+	}
78
+
79
+	public Object getObject(String key,Class<?> clazz) {
80
+		String value = get(key);
81
+		return fromJson(value,clazz);
82
+	}
83
+
84
+	public boolean delete(String key) {
85
+		return stringRedisTemplate.delete(key);
86
+	}
87
+
88
+	/**
89
+	 * Object转成JSON数据
90
+	 */
91
+	private String toJson(Object object){
92
+		if(object instanceof Integer || object instanceof Long || object instanceof Float ||
93
+				object instanceof Double || object instanceof Boolean || object instanceof String){
94
+			return String.valueOf(object);
95
+		}
96
+		return JSON.toJSONString(object);
97
+	}
98
+
99
+	/**
100
+	 * JSON数据,转成Object
101
+	 */
102
+	private <T> T fromJson(String json, Class<T> clazz){
103
+		return JSON.parseObject(json, clazz);
104
+	}
105
+
106
+}

+ 71
- 0
sexam/src/main/resources/application.properties Переглянути файл

@@ -0,0 +1,71 @@
1
+server.port=8088
2
+spring.application.name=sexam
3
+#注册到我们本地的eureka注册中心,端口8081
4
+eureka.client.service-url.defaultZone=http://127.0.0.1:8081/eureka/
5
+#eureka.client.register-with-eureka=false
6
+#eureka.client.fetch-registry=false
7
+#设置eureka输出日志级别
8
+logging.level.com.netflix=error
9
+
10
+spring.datasource.url=jdbc:mysql://dbtest.xhkjedu.com:3306/xhkjedu_school_test?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true&allowMultiQueries=true
11
+spring.datasource.username=root
12
+spring.datasource.password=_xhkjedu!@#07
13
+spring.mvc.hiddenmethod.filter.enabled=true
14
+#数据库连接池配置
15
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
16
+#允许的最小空闲数
17
+spring.datasource.hikari.minimum-idle=5
18
+#连接池最大连接数
19
+spring.datasource.hikari.maximum-pool-size=15
20
+spring.datasource.hikari.auto-commit=true
21
+#空闲超时是 180000 毫秒,当数据库连接的空闲时间大于180000毫秒时,这些空闲超时的连接会被关闭,直到超时的空闲连接数达到 minimum-idle的值
22
+spring.datasource.hikari.idle-timeout=180000
23
+spring.datasource.hikari.pool-name=DatebookHikariCP
24
+spring.datasource.hikari.max-lifetime=1800000
25
+#连接超时时间设置,默认是30s
26
+spring.datasource.hikari.connection-timeout=20000
27
+# 测试连接是否可用的query 语句 在oracle是 select 1 from dual  36   28.26
28
+spring.datasource.hikari.connection-test-query=SELECT 1
29
+# 所有Entity别名类所在包
30
+mybatis.type-aliases-package=com.xhkjedu.sexam.model,com.xhkjedu.sexam.vo
31
+mybatis.mapper-Locations=classpath*:mapper/**/*.xml
32
+mapper.mappers=com.xhkjedu.sexam.base.TkMapper
33
+mapper.identity=MYSQL
34
+#打印日志
35
+logging.level.com.xhkjedu.sexam.mapper=debug
36
+#分页
37
+spring.pagehelper.helper-dialect=mysql
38
+
39
+#redis配置
40
+spring.redis.host=cachetest.xhkjedu.com
41
+spring.redis.port=6379
42
+spring.redis.password=xhkjedud07
43
+#超时时间:单位ms
44
+spring.redis.timeout=5000
45
+#设置过期时间10min
46
+spring.redis.jedis.pool.max-idle=300
47
+#最大等待时间:单位ms //高版本改为maxWaitMillis
48
+spring.redis.jedis.pool.max-wait=1000000
49
+spring.redis.jedis.pool.max-active=60000
50
+#缓存访问数据有效时长60*60*24*7
51
+redisdatatime=604800
52
+
53
+spring.rabbitmq.host=116.63.199.166
54
+spring.rabbitmq.port=5672
55
+spring.rabbitmq.username=xhkjedu
56
+spring.rabbitmq.password=xhkjedud07
57
+spring.rabbitmq.connection-timeout=15000
58
+#rabbitmq自动签收
59
+spring.rabbitmq.listener.simple.acknowledge-mode=auto
60
+# 是否开启消费者重试(为false时关闭消费者重试)
61
+spring.rabbitmq.listener.simple.retry.enabled=true
62
+# 最大重试重新投递消息次数
63
+spring.rabbitmq.listener.simple.retry.max-attempts=3
64
+# 重试重新投递消息的间隔时间(单位毫秒)
65
+spring.rabbitmq.listener.simple.retry.initial-interval=30000ms
66
+#重试次数超过上面的设置之后,是否丢弃(消费者listener抛出异常,是否重回队列(默认true:重回队列,false:不重回队列(可结合死信交换机))
67
+spring.rabbitmq.listener.simple.default-requeue-rejected=false
68
+
69
+#版本号
70
+versionname=Test_v3.5.0
71
+

+ 13
- 0
sexam/src/test/java/com/xhkjedu/sexam/SexamApplicationTests.java Переглянути файл

@@ -0,0 +1,13 @@
1
+package com.xhkjedu.sexam;
2
+
3
+import org.junit.jupiter.api.Test;
4
+import org.springframework.boot.test.context.SpringBootTest;
5
+
6
+@SpringBootTest
7
+class SexamApplicationTests {
8
+
9
+    @Test
10
+    void contextLoads() {
11
+    }
12
+
13
+}

Завантаження…
Відмінити
Зберегти