diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3cea843 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +*.yml +/logs/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ + +### VS Code ### +.vscode/ diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..7f91a56 --- /dev/null +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,114 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if (mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if (mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if (!outputFile.getParentFile().exists()) { + if (!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..01e6799 Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..cd0d451 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..8b9da3b --- /dev/null +++ b/mvnw @@ -0,0 +1,286 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..fef5a8f --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,161 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..b090d6f --- /dev/null +++ b/pom.xml @@ -0,0 +1,137 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 1.5.9.RELEASE + + + com.zgczx + score_analysis + 0.0.1-SNAPSHOT + score_analysis + Demo project for Spring Boot + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.projectlombok + lombok + + + + com.google.code.gson + gson + 2.8.5 + + + + com.github.binarywang + weixin-java-mp + 2.7.0 + + + + mysql + mysql-connector-java + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.springframework.boot + spring-boot-starter-freemarker + + + + org.springframework.boot + spring-boot-starter-websocket + + + + com.alibaba + fastjson + 1.2.47 + + + + org.apache.logging.log4j + log4j-core + 2.10.0 + + + + junit + junit + 4.12 + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + com.zgczx.Application + + + + + repackage + + + + + + + maven-assembly-plugin + 2.4 + + + + true + com.zgczx.Application + + + + jar-with-dependencies + + + + + assemble-all + package + + single + + + + + + + + diff --git a/shell/jenkins.sh b/shell/jenkins.sh new file mode 100644 index 0000000..0edf1f7 --- /dev/null +++ b/shell/jenkins.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +PROJECT_NAME=score_analysis + +pid=`ps -ef |grep ${PROJECT_NAME} |grep -v "grep" |awk '{print $2}' ` + +if [${pid}]; then + + echo "${PROJECT_NAME} is running and pid=$pid" + + kill -9 ${pid} + + if [[ $? -eq 0 ]];then + + echo "success to stop ${PROJECT_NAME} " + + else + + echo "fail to stop ${PROJECT_NAME} " + + fi + +fi + +old_pid=`ps -ef |grep ${PROJECT_NAME} |grep -v "grep" |awk '{print $2}' ` + +if [$old_pid]; then + + echo "$PROJECT_NAME is running and pid=$old_pid" + +else + + echo "Ready to start ${PROJECT_NAME} ...." + + cd /var/lib/jenkins/workspace/学生发展平台 + + echo "切换到jar包路径---> 成功..." + + BUILD_ID=dontKillMe + + nohup java -jar target/sdc-0.0.1-SNAPSHOT.jar >> catalina.out 2>&1 & + +fi + +new_pid=`ps -ef |grep ${PROJECT_NAME} |grep -v "grep" |awk '{print $2}' ` + +if [${new_pid}]; then + + echo "${PROJECT_NAME} start success and pid=${new_pid}" + +else + + echo "${PROJECT_NAME} start failed " + +fi \ No newline at end of file diff --git a/src/main/java/com/zgczx/Application.java b/src/main/java/com/zgczx/Application.java new file mode 100644 index 0000000..8c052dc --- /dev/null +++ b/src/main/java/com/zgczx/Application.java @@ -0,0 +1,13 @@ +package com.zgczx; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/src/main/java/com/zgczx/VO/ResultVO.java b/src/main/java/com/zgczx/VO/ResultVO.java new file mode 100644 index 0000000..8168585 --- /dev/null +++ b/src/main/java/com/zgczx/VO/ResultVO.java @@ -0,0 +1,33 @@ +package com.zgczx.VO; + +import lombok.Data; +import org.springframework.http.HttpStatus; + +/** + * @author aml + * @date 2019/9/10 15:59 + * 最外层的显示对象; + * @param + */ +@Data +public class ResultVO { + //错误码 + private Integer code; + //提示信息 + private String msg; + //具体内容 + private T data; + + public ResultVO(){ + this.data = data; + this.code = code; + this.msg = msg; + } + + public ResultVO(T data, HttpStatus status){ + this.code = status.value(); + this.msg = status.getReasonPhrase(); + this.data = data; + } + +} diff --git a/src/main/java/com/zgczx/config/CorsOriginConfig.java b/src/main/java/com/zgczx/config/CorsOriginConfig.java new file mode 100644 index 0000000..ca847f6 --- /dev/null +++ b/src/main/java/com/zgczx/config/CorsOriginConfig.java @@ -0,0 +1,22 @@ +package com.zgczx.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +/** + * 实现跨域访问的配置任务 + * @author jason + * + */ +@Configuration +public class CorsOriginConfig extends WebMvcConfigurerAdapter{ + +// @Override +// public void addCorsMappings(CorsRegistry registry){ +// registry.addMapping("/**") +// .allowedOrigins("*") +// .allowedMethods("GET","POST") +// .allowCredentials(false).maxAge(3600); +// } +} diff --git a/src/main/java/com/zgczx/controller/score/ScoreController.java b/src/main/java/com/zgczx/controller/score/ScoreController.java new file mode 100644 index 0000000..57320b0 --- /dev/null +++ b/src/main/java/com/zgczx/controller/score/ScoreController.java @@ -0,0 +1,117 @@ +package com.zgczx.controller.score; + +import com.zgczx.VO.ResultVO; +import com.zgczx.dataobject.score.ExamCoversionTotal; +import com.zgczx.dataobject.score.ExamInfo; +import com.zgczx.dto.ExamCoversionTotalDTO; +import com.zgczx.dto.ExamCoversionTotalSectionDTO; +import com.zgczx.dto.ExamCoversionTotalSingleDTO; +import com.zgczx.dto.SixRateDTO; +import com.zgczx.service.score.ScoreService; +import com.zgczx.utils.ResultVOUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + * @author aml + * @date 2019/9/10 14:44 + * 成绩相关的路由皆由此转发 + */ +@RestController +@RequestMapping("/score") +//@CrossOrigin(origins = "*", maxAge = 3600) +public class ScoreController { + + private static final Logger logger = LoggerFactory.getLogger(ScoreController.class); + + @Autowired + ScoreService scoreService; + + /** + * 获取学生的所有成绩 + * @param userId 学号id + * @param examType 具体哪次考试 + * @return ResultVOUtil中的code、msg、data + */ + @GetMapping("/getExamCoversionTotal") + public ResultVO getExamCoversionTotal(@RequestParam(value = "userId") Integer userId, + @RequestParam(value = "examType") String examType){ + + ExamCoversionTotal examCoversionTotal = scoreService.getExamCoversionTotal(userId, examType); + + return ResultVOUtil.success(examCoversionTotal); + + } + + @GetMapping(value = "/getListExamInfols", name = "查询所有的考试名称") + public ResultVO getListExamInfols(){ + + List listExamInfols = scoreService.getListExamInfols(); + + return ResultVOUtil.success(listExamInfols); + } + + /** + * 旭日图中的中心,主要是对年级和班级的进退名次的实现 + * @param stuNumber 学生学号 + * @param examType 具体某次考试名称 + * @return VO类中的data数据返回 + */ + @GetMapping(value = "/getExamCoversionTotalInfo") + public ResultVO getExamCoversionTotalInfo(@RequestParam(value = "stuNumber") String stuNumber, + @RequestParam(value = "examType") String examType ){ + List examCoversionTotalInfo = scoreService.getExamCoversionTotalInfo(stuNumber, examType); + + return ResultVOUtil.success(examCoversionTotalInfo); + } + + /** + * 旭日图第三层,获取各单科的班排、年排、进退名次 + * @param stuNumber 学生学号 + * @param examType 具体某次考试名称 + * @return VO类中的data数据返回 + */ + @GetMapping(value = "/getExamCoversionTotalSingleInfo") + public ResultVO getExamCoversionTotalSingleInfo(@RequestParam(value = "stuNumber") String stuNumber, + @RequestParam(value = "examType") String examType, + @RequestParam(value = "subject") String subject){ + List examCoversionTotalSingleInfo = scoreService.getExamCoversionTotalSingleInfo(stuNumber, examType, subject); + + return ResultVOUtil.success(examCoversionTotalSingleInfo); + } + + /** + * 旭日图的第二层, 获取三科和综合(6选3)的分值, + * 三科班排、年排;综合班排、年排 + * @param stuNumber 学生学号 + * @param examType 某次考试 + * @return 返回DTO + */ + @GetMapping(value = "/getExamCoversionTotalSectionInfo") + public ResultVO getExamCoversionTotalSectionInfo(@RequestParam(value = "stuNumber") String stuNumber, + @RequestParam(value = "examType") String examType){ + List examCoversionTotalSectionInfo = scoreService.getExamCoversionTotalSectionInfo(stuNumber, examType); + + return ResultVOUtil.success(examCoversionTotalSectionInfo); + } + + + /** + * 获取六率信息,高分率、优秀率、良好率、及格率、低分率、超均率,当前学生所处率值 + * @param stuNumber 学生学号 + * @param examType 某次考试 + * @return 返回具体的DTO + */ + @GetMapping(value = "/getSixRateInfo") + public ResultVO getSixRateInfo(@RequestParam(value = "stuNumber") String stuNumber, + @RequestParam(value = "examType") String examType){ + List sixRateInfo = scoreService.getSixRateInfo(stuNumber, examType); + return ResultVOUtil.success(sixRateInfo); + } + +} diff --git a/src/main/java/com/zgczx/dataobject/score/ExamCoversionTotal.java b/src/main/java/com/zgczx/dataobject/score/ExamCoversionTotal.java new file mode 100644 index 0000000..591eac0 --- /dev/null +++ b/src/main/java/com/zgczx/dataobject/score/ExamCoversionTotal.java @@ -0,0 +1,293 @@ +package com.zgczx.dataobject.score; + +import lombok.Data; + +import javax.persistence.*; +import java.sql.Timestamp; +import java.util.Objects; + +/** + * @author aml + * @date 2019/9/10 15:38 + */ +@Entity +@Data +@Table(name = "exam_coversion_total", schema = "score_ananlysis_dev", catalog = "") +public class ExamCoversionTotal { + private long id; + private long examId; + private String studentMachineCard; + private String studentNumber; + private String studentName; + private String classId; + private String gradeName; + private Timestamp examDate; + private String examType; + private Double yuwenScore; + private Double shuxueScore; + private Double yingyuScore; + private Double wuliCoversion; + private Double huaxueCoversion; + private Double shengwuCoversion; + private Double lishiCoversion; + private Double diliCoversion; + private Double zhengzhiCoversion; + private Double coversionTotal; + private Double coversionAvg; + private Integer schoolIndex; + private Integer classIndex; + + @Id + @Column(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Basic + @Column(name = "exam_id") + public long getExamId() { + return examId; + } + + public void setExamId(long examId) { + this.examId = examId; + } + + @Basic + @Column(name = "student_machine_card") + public String getStudentMachineCard() { + return studentMachineCard; + } + + public void setStudentMachineCard(String studentMachineCard) { + this.studentMachineCard = studentMachineCard; + } + + @Basic + @Column(name = "student_number") + public String getStudentNumber() { + return studentNumber; + } + + public void setStudentNumber(String studentNumber) { + this.studentNumber = studentNumber; + } + + @Basic + @Column(name = "student_name") + public String getStudentName() { + return studentName; + } + + public void setStudentName(String studentName) { + this.studentName = studentName; + } + + @Basic + @Column(name = "class_id") + public String getClassId() { + return classId; + } + + public void setClassId(String classId) { + this.classId = classId; + } + + @Basic + @Column(name = "grade_name") + public String getGradeName() { + return gradeName; + } + + public void setGradeName(String gradeName) { + this.gradeName = gradeName; + } + + @Basic + @Column(name = "exam_date") + public Timestamp getExamDate() { + return examDate; + } + + public void setExamDate(Timestamp examDate) { + this.examDate = examDate; + } + + @Basic + @Column(name = "exam_type") + public String getExamType() { + return examType; + } + + public void setExamType(String examType) { + this.examType = examType; + } + + @Basic + @Column(name = "yuwen_score") + public Double getYuwenScore() { + return yuwenScore; + } + + public void setYuwenScore(Double yuwenScore) { + this.yuwenScore = yuwenScore; + } + + @Basic + @Column(name = "shuxue_score") + public Double getShuxueScore() { + return shuxueScore; + } + + public void setShuxueScore(Double shuxueScore) { + this.shuxueScore = shuxueScore; + } + + @Basic + @Column(name = "yingyu_score") + public Double getYingyuScore() { + return yingyuScore; + } + + public void setYingyuScore(Double yingyuScore) { + this.yingyuScore = yingyuScore; + } + + @Basic + @Column(name = "wuli_coversion") + public Double getWuliCoversion() { + return wuliCoversion; + } + + public void setWuliCoversion(Double wuliCoversion) { + this.wuliCoversion = wuliCoversion; + } + + @Basic + @Column(name = "huaxue_coversion") + public Double getHuaxueCoversion() { + return huaxueCoversion; + } + + public void setHuaxueCoversion(Double huaxueCoversion) { + this.huaxueCoversion = huaxueCoversion; + } + + @Basic + @Column(name = "shengwu_coversion") + public Double getShengwuCoversion() { + return shengwuCoversion; + } + + public void setShengwuCoversion(Double shengwuCoversion) { + this.shengwuCoversion = shengwuCoversion; + } + + @Basic + @Column(name = "lishi_coversion") + public Double getLishiCoversion() { + return lishiCoversion; + } + + public void setLishiCoversion(Double lishiCoversion) { + this.lishiCoversion = lishiCoversion; + } + + @Basic + @Column(name = "dili_coversion") + public Double getDiliCoversion() { + return diliCoversion; + } + + public void setDiliCoversion(Double diliCoversion) { + this.diliCoversion = diliCoversion; + } + + @Basic + @Column(name = "zhengzhi_coversion") + public Double getZhengzhiCoversion() { + return zhengzhiCoversion; + } + + public void setZhengzhiCoversion(Double zhengzhiCoversion) { + this.zhengzhiCoversion = zhengzhiCoversion; + } + + @Basic + @Column(name = "coversion_total") + public Double getCoversionTotal() { + return coversionTotal; + } + + public void setCoversionTotal(Double coversionTotal) { + this.coversionTotal = coversionTotal; + } + + @Basic + @Column(name = "coversion_avg") + public Double getCoversionAvg() { + return coversionAvg; + } + + public void setCoversionAvg(Double coversionAvg) { + this.coversionAvg = coversionAvg; + } + + @Basic + @Column(name = "school_index") + public Integer getSchoolIndex() { + return schoolIndex; + } + + public void setSchoolIndex(Integer schoolIndex) { + this.schoolIndex = schoolIndex; + } + + @Basic + @Column(name = "class_index") + public Integer getClassIndex() { + return classIndex; + } + + public void setClassIndex(Integer classIndex) { + this.classIndex = classIndex; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ExamCoversionTotal that = (ExamCoversionTotal) o; + return id == that.id && + examId == that.examId && + Objects.equals(studentMachineCard, that.studentMachineCard) && + Objects.equals(studentNumber, that.studentNumber) && + Objects.equals(studentName, that.studentName) && + Objects.equals(classId, that.classId) && + Objects.equals(gradeName, that.gradeName) && + Objects.equals(examDate, that.examDate) && + Objects.equals(examType, that.examType) && + Objects.equals(yuwenScore, that.yuwenScore) && + Objects.equals(shuxueScore, that.shuxueScore) && + Objects.equals(yingyuScore, that.yingyuScore) && + Objects.equals(wuliCoversion, that.wuliCoversion) && + Objects.equals(huaxueCoversion, that.huaxueCoversion) && + Objects.equals(shengwuCoversion, that.shengwuCoversion) && + Objects.equals(lishiCoversion, that.lishiCoversion) && + Objects.equals(diliCoversion, that.diliCoversion) && + Objects.equals(zhengzhiCoversion, that.zhengzhiCoversion) && + Objects.equals(coversionTotal, that.coversionTotal) && + Objects.equals(coversionAvg, that.coversionAvg) && + Objects.equals(schoolIndex, that.schoolIndex) && + Objects.equals(classIndex, that.classIndex); + } + + @Override + public int hashCode() { + return Objects.hash(id, examId, studentMachineCard, studentNumber, studentName, classId, gradeName, examDate, examType, yuwenScore, shuxueScore, yingyuScore, wuliCoversion, huaxueCoversion, shengwuCoversion, lishiCoversion, diliCoversion, zhengzhiCoversion, coversionTotal, coversionAvg, schoolIndex, classIndex); + } +} diff --git a/src/main/java/com/zgczx/dataobject/score/ExamFullScoreSet.java b/src/main/java/com/zgczx/dataobject/score/ExamFullScoreSet.java new file mode 100644 index 0000000..5885aa2 --- /dev/null +++ b/src/main/java/com/zgczx/dataobject/score/ExamFullScoreSet.java @@ -0,0 +1,61 @@ +package com.zgczx.dataobject.score; + +import javax.persistence.*; +import java.util.Objects; + +/** + * @author aml + * @date 2019/9/19 15:21 + */ +@Entity +@Table(name = "exam_full_score_set", schema = "score_ananlysis_dev", catalog = "") +public class ExamFullScoreSet { + private long id; + private Long examinfoId; + private Long subjectSchameId; + + @Id + @Column(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Basic + @Column(name = "examinfo_id") + public Long getExaminfoId() { + return examinfoId; + } + + public void setExaminfoId(Long examinfoId) { + this.examinfoId = examinfoId; + } + + @Basic + @Column(name = "subject_schame_id") + public Long getSubjectSchameId() { + return subjectSchameId; + } + + public void setSubjectSchameId(Long subjectSchameId) { + this.subjectSchameId = subjectSchameId; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ExamFullScoreSet that = (ExamFullScoreSet) o; + return id == that.id && + Objects.equals(examinfoId, that.examinfoId) && + Objects.equals(subjectSchameId, that.subjectSchameId); + } + + @Override + public int hashCode() { + return Objects.hash(id, examinfoId, subjectSchameId); + } +} diff --git a/src/main/java/com/zgczx/dataobject/score/ExamInfo.java b/src/main/java/com/zgczx/dataobject/score/ExamInfo.java new file mode 100644 index 0000000..0793026 --- /dev/null +++ b/src/main/java/com/zgczx/dataobject/score/ExamInfo.java @@ -0,0 +1,89 @@ +package com.zgczx.dataobject.score; + +import lombok.Data; + +import javax.persistence.*; +import java.sql.Timestamp; +import java.util.Objects; + +/** + * @author aml + * @date 2019/9/10 15:39 + */ +@Entity +@Data +@Table(name = "exam_info", schema = "score_ananlysis_dev", catalog = "") +public class ExamInfo { + private long id; + private String examName; + private String examGrade; + private Timestamp examDate; + private String paperId; + + @Id + @Column(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Basic + @Column(name = "exam_name") + public String getExamName() { + return examName; + } + + public void setExamName(String examName) { + this.examName = examName; + } + + @Basic + @Column(name = "exam_grade") + public String getExamGrade() { + return examGrade; + } + + public void setExamGrade(String examGrade) { + this.examGrade = examGrade; + } + + @Basic + @Column(name = "exam_date") + public Timestamp getExamDate() { + return examDate; + } + + public void setExamDate(Timestamp examDate) { + this.examDate = examDate; + } + + @Basic + @Column(name = "paper_id") + public String getPaperId() { + return paperId; + } + + public void setPaperId(String paperId) { + this.paperId = paperId; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ExamInfo examInfo = (ExamInfo) o; + return id == examInfo.id && + Objects.equals(examName, examInfo.examName) && + Objects.equals(examGrade, examInfo.examGrade) && + Objects.equals(examDate, examInfo.examDate) && + Objects.equals(paperId, examInfo.paperId); + } + + @Override + public int hashCode() { + return Objects.hash(id, examName, examGrade, examDate, paperId); + } +} diff --git a/src/main/java/com/zgczx/dataobject/score/SubjectFullScore.java b/src/main/java/com/zgczx/dataobject/score/SubjectFullScore.java new file mode 100644 index 0000000..b7e3624 --- /dev/null +++ b/src/main/java/com/zgczx/dataobject/score/SubjectFullScore.java @@ -0,0 +1,157 @@ +package com.zgczx.dataobject.score; + +import javax.persistence.*; +import java.util.Objects; + +/** + * @author aml + * @date 2019/9/19 15:22 + */ +@Entity +@Table(name = "subject_full_score", schema = "score_ananlysis_dev", catalog = "") +public class SubjectFullScore { + private long id; + private String schemaname; + private Long yuwen; + private Long shuxue; + private Long yingyu; + private Long wuli; + private Long huaxue; + private Long shengwu; + private Long zhengzhi; + private Long dili; + private Long lishi; + + @Id + @Column(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Basic + @Column(name = "schemaname") + public String getSchemaname() { + return schemaname; + } + + public void setSchemaname(String schemaname) { + this.schemaname = schemaname; + } + + @Basic + @Column(name = "yuwen") + public Long getYuwen() { + return yuwen; + } + + public void setYuwen(Long yuwen) { + this.yuwen = yuwen; + } + + @Basic + @Column(name = "shuxue") + public Long getShuxue() { + return shuxue; + } + + public void setShuxue(Long shuxue) { + this.shuxue = shuxue; + } + + @Basic + @Column(name = "yingyu") + public Long getYingyu() { + return yingyu; + } + + public void setYingyu(Long yingyu) { + this.yingyu = yingyu; + } + + @Basic + @Column(name = "wuli") + public Long getWuli() { + return wuli; + } + + public void setWuli(Long wuli) { + this.wuli = wuli; + } + + @Basic + @Column(name = "huaxue") + public Long getHuaxue() { + return huaxue; + } + + public void setHuaxue(Long huaxue) { + this.huaxue = huaxue; + } + + @Basic + @Column(name = "shengwu") + public Long getShengwu() { + return shengwu; + } + + public void setShengwu(Long shengwu) { + this.shengwu = shengwu; + } + + @Basic + @Column(name = "zhengzhi") + public Long getZhengzhi() { + return zhengzhi; + } + + public void setZhengzhi(Long zhengzhi) { + this.zhengzhi = zhengzhi; + } + + @Basic + @Column(name = "dili") + public Long getDili() { + return dili; + } + + public void setDili(Long dili) { + this.dili = dili; + } + + @Basic + @Column(name = "lishi") + public Long getLishi() { + return lishi; + } + + public void setLishi(Long lishi) { + this.lishi = lishi; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SubjectFullScore that = (SubjectFullScore) o; + return id == that.id && + Objects.equals(schemaname, that.schemaname) && + Objects.equals(yuwen, that.yuwen) && + Objects.equals(shuxue, that.shuxue) && + Objects.equals(yingyu, that.yingyu) && + Objects.equals(wuli, that.wuli) && + Objects.equals(huaxue, that.huaxue) && + Objects.equals(shengwu, that.shengwu) && + Objects.equals(zhengzhi, that.zhengzhi) && + Objects.equals(dili, that.dili) && + Objects.equals(lishi, that.lishi); + } + + @Override + public int hashCode() { + return Objects.hash(id, schemaname, yuwen, shuxue, yingyu, wuli, huaxue, shengwu, zhengzhi, dili, lishi); + } +} diff --git a/src/main/java/com/zgczx/dataobject/user/StudentInfo.java b/src/main/java/com/zgczx/dataobject/user/StudentInfo.java new file mode 100644 index 0000000..1c49da1 --- /dev/null +++ b/src/main/java/com/zgczx/dataobject/user/StudentInfo.java @@ -0,0 +1,269 @@ +package com.zgczx.dataobject.user; + +import lombok.Data; + +import javax.persistence.*; +import java.sql.Timestamp; +import java.util.Objects; + +/** + * @author aml + * @date 2019/9/10 15:40 + */ +@Entity +@Data +@Table(name = "student_info", schema = "score_ananlysis_dev", catalog = "") +public class StudentInfo { + private int id; + private String userId; + private String studentMachineCard; + private String studentNumber; + private String studentName; + private String schoolName; + private String schoolId; + private String gradeId; + private String gradeName; + private String classId; + private String className; + private String cardNum; + private String province; + private String address; + private String birthdate; + private String sex; + private String phone; + private String image; + private Long createUser; + private Timestamp createTime; + + @Id + @Column(name = "id") + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Basic + @Column(name = "user_id") + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + @Basic + @Column(name = "student_machine_card") + public String getStudentMachineCard() { + return studentMachineCard; + } + + public void setStudentMachineCard(String studentMachineCard) { + this.studentMachineCard = studentMachineCard; + } + + @Basic + @Column(name = "student_number") + public String getStudentNumber() { + return studentNumber; + } + + public void setStudentNumber(String studentNumber) { + this.studentNumber = studentNumber; + } + + @Basic + @Column(name = "student_name") + public String getStudentName() { + return studentName; + } + + public void setStudentName(String studentName) { + this.studentName = studentName; + } + + @Basic + @Column(name = "school_name") + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + @Basic + @Column(name = "school_id") + public String getSchoolId() { + return schoolId; + } + + public void setSchoolId(String schoolId) { + this.schoolId = schoolId; + } + + @Basic + @Column(name = "grade_id") + public String getGradeId() { + return gradeId; + } + + public void setGradeId(String gradeId) { + this.gradeId = gradeId; + } + + @Basic + @Column(name = "grade_name") + public String getGradeName() { + return gradeName; + } + + public void setGradeName(String gradeName) { + this.gradeName = gradeName; + } + + @Basic + @Column(name = "class_id") + public String getClassId() { + return classId; + } + + public void setClassId(String classId) { + this.classId = classId; + } + + @Basic + @Column(name = "class_name") + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + @Basic + @Column(name = "card_num") + public String getCardNum() { + return cardNum; + } + + public void setCardNum(String cardNum) { + this.cardNum = cardNum; + } + + @Basic + @Column(name = "province") + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + @Basic + @Column(name = "address") + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Basic + @Column(name = "birthdate") + public String getBirthdate() { + return birthdate; + } + + public void setBirthdate(String birthdate) { + this.birthdate = birthdate; + } + + @Basic + @Column(name = "sex") + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + @Basic + @Column(name = "phone") + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + @Basic + @Column(name = "image") + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + @Basic + @Column(name = "create_user") + public Long getCreateUser() { + return createUser; + } + + public void setCreateUser(Long createUser) { + this.createUser = createUser; + } + + @Basic + @Column(name = "create_time") + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + StudentInfo that = (StudentInfo) o; + return id == that.id && + Objects.equals(userId, that.userId) && + Objects.equals(studentMachineCard, that.studentMachineCard) && + Objects.equals(studentNumber, that.studentNumber) && + Objects.equals(studentName, that.studentName) && + Objects.equals(schoolName, that.schoolName) && + Objects.equals(schoolId, that.schoolId) && + Objects.equals(gradeId, that.gradeId) && + Objects.equals(gradeName, that.gradeName) && + Objects.equals(classId, that.classId) && + Objects.equals(className, that.className) && + Objects.equals(cardNum, that.cardNum) && + Objects.equals(province, that.province) && + Objects.equals(address, that.address) && + Objects.equals(birthdate, that.birthdate) && + Objects.equals(sex, that.sex) && + Objects.equals(phone, that.phone) && + Objects.equals(image, that.image) && + Objects.equals(createUser, that.createUser) && + Objects.equals(createTime, that.createTime); + } + + @Override + public int hashCode() { + return Objects.hash(id, userId, studentMachineCard, studentNumber, studentName, schoolName, schoolId, gradeId, gradeName, classId, className, cardNum, province, address, birthdate, sex, phone, image, createUser, createTime); + } +} diff --git a/src/main/java/com/zgczx/dataobject/user/SysLogin.java b/src/main/java/com/zgczx/dataobject/user/SysLogin.java new file mode 100644 index 0000000..acc3dfa --- /dev/null +++ b/src/main/java/com/zgczx/dataobject/user/SysLogin.java @@ -0,0 +1,101 @@ +package com.zgczx.dataobject.user; + +import lombok.Data; + +import javax.persistence.*; +import java.sql.Timestamp; +import java.util.Objects; + +/** + * @author aml + * @date 2019/9/10 20:02 + */ +@Entity +@Data +@Table(name = "sys_login", schema = "score_ananlysis_dev", catalog = "") +public class SysLogin { + private int id; + private String username; + private String password; + private Timestamp createTime; + private String email; + private String imageUrl; + + @Id + @Column(name = "id") + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Basic + @Column(name = "username") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + @Basic + @Column(name = "password") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Basic + @Column(name = "create_time") + public Timestamp getCreateTime() { + return createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + @Basic + @Column(name = "email") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Basic + @Column(name = "image_url") + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SysLogin sysLogin = (SysLogin) o; + return id == sysLogin.id && + Objects.equals(username, sysLogin.username) && + Objects.equals(password, sysLogin.password) && + Objects.equals(createTime, sysLogin.createTime) && + Objects.equals(email, sysLogin.email) && + Objects.equals(imageUrl, sysLogin.imageUrl); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, password, createTime, email, imageUrl); + } +} diff --git a/src/main/java/com/zgczx/dto/ExamCoversionTotalDTO.java b/src/main/java/com/zgczx/dto/ExamCoversionTotalDTO.java new file mode 100644 index 0000000..81bca3e --- /dev/null +++ b/src/main/java/com/zgczx/dto/ExamCoversionTotalDTO.java @@ -0,0 +1,21 @@ +package com.zgczx.dto; + +import com.zgczx.dataobject.score.ExamCoversionTotal; +import lombok.Data; + +/** + * @author aml + * @date 2019/9/11 21:00 + * DTO(Data Transfer Object) :数据传输对象, Service 或 Manager 向外传输的对象 + * controller中真正返回给前端的数据对象 + */ +@Data +public class ExamCoversionTotalDTO { + + private ExamCoversionTotal examCoversionTotal; + // 年级排名进退名次 + private int waveGrade; + // 班级排名进退名次 + private int waveClass; + +} diff --git a/src/main/java/com/zgczx/dto/ExamCoversionTotalSectionDTO.java b/src/main/java/com/zgczx/dto/ExamCoversionTotalSectionDTO.java new file mode 100644 index 0000000..80dca86 --- /dev/null +++ b/src/main/java/com/zgczx/dto/ExamCoversionTotalSectionDTO.java @@ -0,0 +1,35 @@ +package com.zgczx.dto; + +import com.zgczx.dataobject.score.ExamCoversionTotal; +import lombok.Data; + +import java.util.List; + +/** + * @author aml + * @date 2019/9/17 21:11 + */ +@Data +public class ExamCoversionTotalSectionDTO { + + private ExamCoversionTotal examCoversionTotal; + // 三科:语数英的总分分值 + private Float threeSubject; + //剩下的6选3的总分分值 + private Float comprehensive; + //三科班级排名 + private int classRank; + //三科年级排名 + private int gradeRank; + //综合班级排名 + private int complexClassRank; + //综合年级排名 + private int complexGradeRank; + + // 年级排名进退名次 + private int waveGrade; + // 班级排名进退名次 + private int waveClass; + //存放某学生的6选3的具体科目 + private List list; +} diff --git a/src/main/java/com/zgczx/dto/ExamCoversionTotalSingleDTO.java b/src/main/java/com/zgczx/dto/ExamCoversionTotalSingleDTO.java new file mode 100644 index 0000000..3ff0ab7 --- /dev/null +++ b/src/main/java/com/zgczx/dto/ExamCoversionTotalSingleDTO.java @@ -0,0 +1,21 @@ +package com.zgczx.dto; + +import com.zgczx.dataobject.score.ExamCoversionTotal; +import lombok.Data; + +/** + * @author aml + * @date 2019/9/16 14:08 + */ +@Data +public class ExamCoversionTotalSingleDTO { + private ExamCoversionTotal examCoversionTotal; + //班级排名 + private int classRank; + //年级排名 + private int gradeRank; + // 年级排名进退名次 + private int waveGrade; + // 班级排名进退名次 + private int waveClass; +} diff --git a/src/main/java/com/zgczx/dto/SixRateDTO.java b/src/main/java/com/zgczx/dto/SixRateDTO.java new file mode 100644 index 0000000..aea3d88 --- /dev/null +++ b/src/main/java/com/zgczx/dto/SixRateDTO.java @@ -0,0 +1,26 @@ +package com.zgczx.dto; + +import lombok.Data; + +/** + * @author aml + * @date 2019/9/19 15:30 + */ +@Data +public class SixRateDTO { + // 高分率 + private double highNumRate; + // 优秀率 + private double excellentRate; + //良好率 + private double goodRate; + // 及格率 + private double passRate; + // 低分率 + private double failRate; + // 超均率 + private double beyondRate; + // 所处率值 + private String locationRate; + +} diff --git a/src/main/java/com/zgczx/enums/ResultEnum.java b/src/main/java/com/zgczx/enums/ResultEnum.java new file mode 100644 index 0000000..9fdb969 --- /dev/null +++ b/src/main/java/com/zgczx/enums/ResultEnum.java @@ -0,0 +1,140 @@ +package com.zgczx.enums; + +import lombok.Getter; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author aml + * @date 2019/9/10 20:23 + * API 统一返回状态码 + */ +@Getter +public enum ResultEnum { + + /* 成功状态码 */ + SUCCESS(1, "成功"), + /** + * 参数异常 + */ + PARAM_EXCEPTION(500,"参数异常"), + /** + * 信息未发现异常 + */ + INFO_NOTFOUND_EXCEPTION(501,"信息未发现异常"), + /** + * 数据库操作异常 + */ + DATABASE_OP_EXCEPTION(502,"数据库操作异常"), + /** + * 预约冲突 + */ + SUB_FAIL(503,"预约冲突"), + /** + * 微信公众账号方面错误 + */ + WECHAT_MP_ERROR(504, "微信公众账号方面错误"), + /** + * 课程冲突 + */ + COURSE_CONFLICT(505,"当前课程和已有课程冲突"), + /** + * 当前用户未注册 + */ + USER_NOT_REGISTER(506,"当前用户未注册"), + + + + + /* 参数错误:10001-19999 */ + PARAM_IS_INVALID(10001, "参数无效"), + PARAM_IS_BLANK(10002, "参数为空"), + PARAM_TYPE_BIND_ERROR(10003, "参数类型错误"), + PARAM_NOT_COMPLETE(10004, "参数缺失"), + + /* 用户错误:20001-29999*/ + USER_NOT_LOGGED_IN(20001, "用户未登录"), + USER_LOGIN_ERROR(20002, "账号不存在或密码错误"), + USER_ACCOUNT_FORBIDDEN(20003, "账号已被禁用"), + USER_NOT_EXIST(20004, "用户不存在"), + USER_HAS_EXISTED(20005, "用户已存在"), + + /* 业务错误:30001-39999 */ + SPECIFIED_QUESTIONED_USER_NOT_EXIST(30001, "某业务出现问题"), + + /* 系统错误:40001-49999 */ + SYSTEM_INNER_ERROR(40001, "系统繁忙,请稍后重试"), + + /* 数据错误:50001-599999 */ + RESULE_DATA_NONE(50001, "数据未找到"), + DATA_IS_WRONG(50002, "数据有误"), + DATA_ALREADY_EXISTED(50003, "数据已存在"), + + /* 接口错误:60001-69999 */ + INTERFACE_INNER_INVOKE_ERROR(60001, "内部系统接口调用异常"), + INTERFACE_OUTTER_INVOKE_ERROR(60002, "外部系统接口调用异常"), + INTERFACE_FORBID_VISIT(60003, "该接口禁止访问"), + INTERFACE_ADDRESS_INVALID(60004, "接口地址无效"), + INTERFACE_REQUEST_TIMEOUT(60005, "接口请求超时"), + INTERFACE_EXCEED_LOAD(60006, "接口负载过高"), + + /* 权限错误:70001-79999 */ + PERMISSION_NO_ACCESS(70001, "无访问权限"); + + + + private Integer code; + + private String message; + + ResultEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer code() { + return this.code; + } + + public String message() { + return this.message; + } + + public static String getMessage(String name) { + for (ResultEnum item : ResultEnum.values()) { + if (item.name().equals(name)) { + return item.message; + } + } + return name; + } + + public static Integer getCode(String name) { + for (ResultEnum item : ResultEnum.values()) { + if (item.name().equals(name)) { + return item.code; + } + } + return null; + } + + @Override + public String toString() { + return this.name(); + } + + //校验重复的code值 + public static void main(String[] args) { + ResultEnum[] ApiResultCodes = ResultEnum.values(); + List codeList = new ArrayList(); + for (ResultEnum ApiResultCode : ApiResultCodes) { + if (codeList.contains(ApiResultCode.code)) { + System.out.println(ApiResultCode.code); + } else { + codeList.add(ApiResultCode.code()); + } + } + } + +} diff --git a/src/main/java/com/zgczx/enums/UserEnum.java b/src/main/java/com/zgczx/enums/UserEnum.java new file mode 100644 index 0000000..6c33f92 --- /dev/null +++ b/src/main/java/com/zgczx/enums/UserEnum.java @@ -0,0 +1,50 @@ +package com.zgczx.enums; + +import lombok.Getter; + +/** + * 用户状态枚举类 + * + * @author jason + */ +@Getter +public enum UserEnum { + + /** + * 数据库执行错误,请检查数据库操作 + */ + DB_ERROR(600,"数据库执行错误,请检查数据库操作"), + + /** + * 该stuOpenid没有被注册 + */ + stuOpenid_not_registered(601,"该stuOpenid没有被注册"), + + /** + * 该teaOpenid没有被注册 + */ + teaOpenid_not_registered(602,"该teaOpenid没有被注册"), + + /** + * 该stuOpenid已经被创建 + */ + stuOpenid_is_created(603,"该stuOpenid已经被创建"), + + /** + * 该teaOpenid已经被创建 + */ + teaOpenid_is_created(603,"该teaOpenid已经被创建"), + + + + ; + + private Integer code; + + private String message; + + UserEnum(Integer code, String message) { + this.code = code; + this.message = message; + } +} diff --git a/src/main/java/com/zgczx/exception/ScoreException.java b/src/main/java/com/zgczx/exception/ScoreException.java new file mode 100644 index 0000000..d4e2c41 --- /dev/null +++ b/src/main/java/com/zgczx/exception/ScoreException.java @@ -0,0 +1,46 @@ +package com.zgczx.exception; + +import com.zgczx.enums.ResultEnum; +import com.zgczx.enums.UserEnum; +import lombok.Getter; +import org.apache.catalina.User; + +/** + * @author aml + * @date 2019/9/10 20:32 + * 统一的异常调度 + */ +@Getter +public class ScoreException extends RuntimeException{ + + public Integer code; + + public String data; + + public ScoreException(Integer code, String message){ + super(message); + this.code = code; + } + + /** + * ResultEnum 定义的错误code和msg + * @param resultEnum result结果集中相关的错误code、msg + * @param data Impl中自定义的info 具体错误信息 + */ + public ScoreException(ResultEnum resultEnum, String data){ + super(resultEnum.getMessage()); + this.code = resultEnum.getCode(); + this.data = data; + } + + /** + * UserEnum 定义的错误code和msg + * @param userEnum user相关的错误code、msg + * @param data Impl中自定义的info 具体错误信息 + */ + public ScoreException(UserEnum userEnum, String data){ + super(userEnum.getMessage()); + this.code = userEnum.getCode(); + this.data = data; + } +} diff --git a/src/main/java/com/zgczx/repository/score/ExamCoversionTotalDao.java b/src/main/java/com/zgczx/repository/score/ExamCoversionTotalDao.java new file mode 100644 index 0000000..49c47bf --- /dev/null +++ b/src/main/java/com/zgczx/repository/score/ExamCoversionTotalDao.java @@ -0,0 +1,82 @@ +package com.zgczx.repository.score; + +import com.zgczx.dataobject.score.ExamCoversionTotal; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import javax.validation.Valid; +import java.math.BigInteger; +import java.util.List; + +/** + * @author aml + * @date 2019/9/10 15:52 + */ +@Repository +public interface ExamCoversionTotalDao extends JpaRepository { + + /** + * 根据学号获取此学生所有成绩 + * + * @param stuNumber 学号 + * @return ExamCoversionTotal实体对象 + */ + ExamCoversionTotal findByStudentNumberAndExamType(String stuNumber,String examType); + + /** + * 获取单科的班级排名 + * @param 单科具体科目 + * @return 学号、单科分数、单科班级排名 + */ +// @Query(value = "SELECT t.student_number, t.yuwen_score,t.rank" + +// "FROM " + +// " (select u.student_number, u.yuwen_score, @rank:= @rank + 1," + +// " @last_rank:= CASE " + +// " WHEN @last_score = u.yuwen_score\n" + +// " THEN @last_rank" + +// " WHEN @last_score:= u.yuwen_score \n" + +// " THEN @rank " + +// " END AS rank " + +// " FROM " + +// " (SELECT * FROM exam_coversion_total WHERE class_id=?1 AND exam_type=?2 ORDER BY yuwen_score DESC) u, " + +// " (SELECT @rank:= 0, @last_score:= NULL, @last_rank:= 0) r" + +// ")t ", nativeQuery = true) + @Query(value = "SELECT t.student_number, t.shuxue_score,t.rank FROM(SELECT u.student_number,u.shuxue_score,@rank \\:= @rank + 1,@last_rank \\:= CASE WHEN @last_score = u.shuxue_score THEN @last_rank WHEN @last_score \\:= u.shuxue_score THEN @rank END AS rank FROM (SELECT * FROM exam_coversion_total WHERE class_id=?1 AND exam_type=?2 ORDER BY shuxue_score DESC)u,(SELECT @rank \\:= 0,@last_score \\:= NULL,@last_rank \\:= 0)r)t", nativeQuery = true) + List getSingleClassRank(String classid, String examType); + + /** + * 获取某科目的成绩排序,降序 + * @param classid 班级id + * @param examType 哪次考试 + * @param subject 哪个科目 + * @return 实体对象 + */ + //@Query("select examCoversionTotal from ExamCoversionTotal examCoversionTotal where examCoversionTotal.classId = ?1 and examCoversionTotal.examType = ?2 order by ?3 desc ") + //@Query(value = "SELECT * FROM exam_coversion_total WHERE class_id=?1 AND exam_type=?2 ORDER BY yingyu_score=?3 DESC", nativeQuery = true) 必须得指定第三个参数是数据库中哪个列的 + List findAllByClassIdAndExamType(String classid, String examType,String subject); + + // 获取三科的班排 + @Query(value = "SELECT student_number,yuwen_score+shuxue_score+yingyu_score AS s FROM exam_coversion_total WHERE class_id=?1 AND exam_type=?2 ORDER BY s DESC", nativeQuery = true) + List findByClassIdAndExamType(String classid, String examType); + + //获取三科的年排 + @Query(value = "SELECT student_number,yuwen_score+shuxue_score+yingyu_score AS s FROM exam_coversion_total WHERE exam_type=?1 ORDER BY s DESC", nativeQuery = true) + List findByClassIdAndExamTypeGrade(String examType); + + // 获取综合的班排 + @Query(value = "SELECT student_number,wuli_coversion+huaxue_coversion+shengwu_coversion+lishi_coversion+dili_coversion+zhengzhi_coversion AS s FROM exam_coversion_total WHERE class_id=?1 AND exam_type=?2 ORDER BY s DESC", nativeQuery = true) + List findByClassIdAndExamTypeComplex(String classid, String examType); + + // 获取综合的年排 + @Query(value = "SELECT student_number,wuli_coversion+huaxue_coversion+shengwu_coversion+lishi_coversion+dili_coversion+zhengzhi_coversion AS s FROM exam_coversion_total WHERE exam_type=?1 ORDER BY s DESC", nativeQuery = true) + List findByClassIdAndExamTypeComplexGrade(String examType); + + @Query(value = "select e.coversionTotal from ExamCoversionTotal as e where e.classId = ?1 and e.examType = ?2") + List getCoversionTotalByClassIdAndExamType(String classid, String examType); + + @Query(value = "select sum(sfs.yuwen+sfs.shuxue+sfs.yingyu+sfs.wuli+sfs.huaxue+sfs.shengwu+sfs.zhengzhi+sfs.lishi+sfs.dili)as total from subject_full_score sfs,exam_full_score_set sfss where sfs.id=sfss.subject_schame_id and sfss.examinfo_id=?1 ",nativeQuery = true) + @Transactional + BigInteger findSchametotal(int examid); +} diff --git a/src/main/java/com/zgczx/repository/score/ExamFullScoreSetDao.java b/src/main/java/com/zgczx/repository/score/ExamFullScoreSetDao.java new file mode 100644 index 0000000..71ec612 --- /dev/null +++ b/src/main/java/com/zgczx/repository/score/ExamFullScoreSetDao.java @@ -0,0 +1,19 @@ +package com.zgczx.repository.score; + +import com.zgczx.dataobject.score.ExamFullScoreSet; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +import java.math.BigInteger; + +/** + * @author aml + * @date 2019/9/19 16:12 + */ +@Repository +public interface ExamFullScoreSetDao extends JpaRepository { + + @Query(value = "select e from ExamFullScoreSet as e where e.examinfoId = ?1") + ExamFullScoreSet findByExaminfoId(int examid); +} diff --git a/src/main/java/com/zgczx/repository/score/ExamInfoDao.java b/src/main/java/com/zgczx/repository/score/ExamInfoDao.java new file mode 100644 index 0000000..eefb4aa --- /dev/null +++ b/src/main/java/com/zgczx/repository/score/ExamInfoDao.java @@ -0,0 +1,22 @@ +package com.zgczx.repository.score; + +import com.zgczx.dataobject.score.ExamInfo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +/** + * @author aml + * @date 2019/9/10 15:53 + */ +@Repository +public interface ExamInfoDao extends JpaRepository { + + /** + * 根据具体的 哪次考试获取 此id + * @param examType 具体考试名称 + * @return id + */ + @Query(value = "select e.id from ExamInfo e where e.examName = ?1") + int findByExamName(String examType); +} diff --git a/src/main/java/com/zgczx/repository/score/SubjectFullScoreDao.java b/src/main/java/com/zgczx/repository/score/SubjectFullScoreDao.java new file mode 100644 index 0000000..8eeefd3 --- /dev/null +++ b/src/main/java/com/zgczx/repository/score/SubjectFullScoreDao.java @@ -0,0 +1,15 @@ +package com.zgczx.repository.score; + +import com.zgczx.dataobject.score.SubjectFullScore; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.math.BigInteger; + +/** + * @author aml + * @date 2019/9/19 16:19 + */ +@Repository +public interface SubjectFullScoreDao extends JpaRepository { +} diff --git a/src/main/java/com/zgczx/repository/user/StudentInfoDao.java b/src/main/java/com/zgczx/repository/user/StudentInfoDao.java new file mode 100644 index 0000000..979b36a --- /dev/null +++ b/src/main/java/com/zgczx/repository/user/StudentInfoDao.java @@ -0,0 +1,14 @@ +package com.zgczx.repository.user; + +import com.zgczx.dataobject.user.StudentInfo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * @author aml + * @date 2019/9/10 15:53 + */ +@Repository +public interface StudentInfoDao extends JpaRepository { + +} diff --git a/src/main/java/com/zgczx/repository/user/SysLoginDao.java b/src/main/java/com/zgczx/repository/user/SysLoginDao.java new file mode 100644 index 0000000..aa0543f --- /dev/null +++ b/src/main/java/com/zgczx/repository/user/SysLoginDao.java @@ -0,0 +1,14 @@ +package com.zgczx.repository.user; + +import com.zgczx.dataobject.user.SysLogin; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * @author aml + * @date 2019/9/10 20:03 + */ +@Repository +public interface SysLoginDao extends JpaRepository { + +} diff --git a/src/main/java/com/zgczx/service/score/ScoreService.java b/src/main/java/com/zgczx/service/score/ScoreService.java new file mode 100644 index 0000000..b9955c0 --- /dev/null +++ b/src/main/java/com/zgczx/service/score/ScoreService.java @@ -0,0 +1,39 @@ +package com.zgczx.service.score; + +import com.zgczx.dataobject.score.ExamCoversionTotal; +import com.zgczx.dataobject.score.ExamInfo; +import com.zgczx.dto.ExamCoversionTotalDTO; +import com.zgczx.dto.ExamCoversionTotalSectionDTO; +import com.zgczx.dto.ExamCoversionTotalSingleDTO; +import com.zgczx.dto.SixRateDTO; + +import java.util.List; + +/** + * @author aml + * @date 2019/9/10 17:15 + */ +public interface ScoreService { + + /** + * 获取学生的所有成绩 + * @param userId 学号id + * @param examType 具体哪次考试 + * @return ExamCoversionTotal对象 + */ + ExamCoversionTotal getExamCoversionTotal(Integer userId, String examType); + + /** + * 获取所有考试名称 + * @return 多个ExamInfo对象 + */ + List getListExamInfols(); + + List getExamCoversionTotalInfo(String stuNumber, String examType); + + List getExamCoversionTotalSingleInfo(String stuNumber, String examType, String subject); + + List getExamCoversionTotalSectionInfo(String stuNumber, String examType); + + List getSixRateInfo(String stuNumber, String examType); +} diff --git a/src/main/java/com/zgczx/service/score/impl/ScoreServiceImpl.java b/src/main/java/com/zgczx/service/score/impl/ScoreServiceImpl.java new file mode 100644 index 0000000..12d62f5 --- /dev/null +++ b/src/main/java/com/zgczx/service/score/impl/ScoreServiceImpl.java @@ -0,0 +1,750 @@ +package com.zgczx.service.score.impl; + +import com.zgczx.dataobject.score.ExamCoversionTotal; +import com.zgczx.dataobject.score.ExamFullScoreSet; +import com.zgczx.dataobject.score.ExamInfo; +import com.zgczx.dataobject.score.SubjectFullScore; +import com.zgczx.dataobject.user.SysLogin; +import com.zgczx.dto.ExamCoversionTotalDTO; +import com.zgczx.dto.ExamCoversionTotalSectionDTO; +import com.zgczx.dto.ExamCoversionTotalSingleDTO; +import com.zgczx.dto.SixRateDTO; +import com.zgczx.enums.ResultEnum; +import com.zgczx.enums.UserEnum; +import com.zgczx.exception.ScoreException; +import com.zgczx.repository.score.ExamCoversionTotalDao; +import com.zgczx.repository.score.ExamFullScoreSetDao; +import com.zgczx.repository.score.ExamInfoDao; +import com.zgczx.repository.score.SubjectFullScoreDao; +import com.zgczx.repository.user.StudentInfoDao; +import com.zgczx.repository.user.SysLoginDao; +import com.zgczx.service.score.ScoreService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Query; +import java.math.BigInteger; +import java.text.DecimalFormat; +import java.util.*; + +/** + * @author aml + * @date 2019/9/10 17:15 + */ +@Service +public class ScoreServiceImpl implements ScoreService { + + private static final Logger logger = LoggerFactory.getLogger(ScoreServiceImpl.class); + + @Autowired + private StudentInfoDao studentInfoDao; + + @Autowired + private SysLoginDao sysLoginDao; + + @Autowired + private ExamCoversionTotalDao examCoversionTotalDao; + + @Autowired + private ExamInfoDao examInfoDao; + + @Autowired + private ExamFullScoreSetDao examFullScoreSetDao; + + @Autowired + private SubjectFullScoreDao subjectFullScoreDao; + + @Autowired + EntityManagerFactory ntityManagerFactory; + + private String info; + + @Override + public ExamCoversionTotal getExamCoversionTotal(Integer userId, String examType) { + SysLogin sysLogin = sysLoginDao.findOne(userId); + if (null == sysLogin) { +// info = userId + " 此参数不存在"; 这个加上userId,就报错。。。。 + info = " 此参数不存在"; + logger.error(info); + throw new ScoreException(ResultEnum.PARAM_IS_INVALID, info); + } + String stuNumber = sysLogin.getUsername(); + if (null == stuNumber) { + info = " 没有此用户"; + logger.error(info); + throw new ScoreException(ResultEnum.PARAM_EXCEPTION, info); + } +// ExamCoversionTotal examCoversionTotal = examCoversionTotalDao.findByStudentNumberAndExamType(stuNumber,examType); +// return examCoversionTotal; + return examCoversionTotalDao.findByStudentNumberAndExamType(stuNumber, examType); + } + + @Override + public List getListExamInfols() { + List examInfoList = examInfoDao.findAll(); + if (examInfoList == null || examInfoList.size() == 0) { + info = "查无结果"; + logger.error(info); + throw new ScoreException(ResultEnum.DATABASE_OP_EXCEPTION, info); + } + return examInfoList; + } + + @Override + public List getExamCoversionTotalInfo(String stuNumber, String examType) { + ExamCoversionTotal examCoversionTotal = examCoversionTotalDao.findByStudentNumberAndExamType(stuNumber, examType); + if (null == examCoversionTotal) { + info = "查询此学生的所有信息失败"; + logger.error(info); + throw new ScoreException(ResultEnum.RESULE_DATA_NONE, info); + } + List examInfoList = examInfoDao.findAll(); + if (examInfoList == null || examInfoList.size() == 0) { + info = "查无结果"; + logger.error(info); + throw new ScoreException(ResultEnum.DATABASE_OP_EXCEPTION, info); + } + String oldExamType = null; + for (int i = 0; i < examInfoList.size(); i++) { + if (examType.equals(examInfoList.get(0).getExamName())){ + info = "本次为首次考试,暂无排名波动情况"; + // 年级波动名次,进退名次 + int waveGrade = 0; + // 班级波动名称,进退名次 + int waveClass =0; + + List examCoversionTotalDTOS = new ArrayList<>(); + + ExamCoversionTotalDTO examCoversionTotalDTO = new ExamCoversionTotalDTO(); + examCoversionTotalDTO.setExamCoversionTotal(examCoversionTotal); + /* 将年级进退名次放入到封装对象中*/ + examCoversionTotalDTO.setWaveGrade(waveGrade); + /* 将班级进退名次放入到封装对象中*/ + examCoversionTotalDTO.setWaveClass(waveClass); + examCoversionTotalDTOS.add(examCoversionTotalDTO); + return examCoversionTotalDTOS; + } else if (examType.equals(examInfoList.get(i).getExamName())) { + oldExamType = examInfoList.get(i - 1).getExamName(); + } + } + // 获取上次考试的所有成绩信息 + ExamCoversionTotal oldExamCoversionTotal = examCoversionTotalDao.findByStudentNumberAndExamType(stuNumber, oldExamType); + if (null == oldExamCoversionTotal) { + info = "查询此学生上次考试的所有信息失败"; + logger.error(info); + throw new ScoreException(ResultEnum.RESULE_DATA_NONE, info); + } + + // 年级波动名次,进退名次 + int waveGrade = examCoversionTotal.getSchoolIndex() - oldExamCoversionTotal.getSchoolIndex(); + // 班级波动名称,进退名次 + int waveClass = examCoversionTotal.getClassIndex() - oldExamCoversionTotal.getClassIndex(); + + List examCoversionTotalDTOS = new ArrayList<>(); + + ExamCoversionTotalDTO examCoversionTotalDTO = new ExamCoversionTotalDTO(); + examCoversionTotalDTO.setExamCoversionTotal(examCoversionTotal); + /* 将年级进退名次放入到封装对象中*/ + examCoversionTotalDTO.setWaveGrade(waveGrade); + /* 将班级进退名次放入到封装对象中*/ + examCoversionTotalDTO.setWaveClass(waveClass); + examCoversionTotalDTOS.add(examCoversionTotalDTO); + return examCoversionTotalDTOS; + } + + @Override + public List getExamCoversionTotalSingleInfo(String stuNumber, String examType, String subject) { + ExamCoversionTotal examCoversionTotal = examCoversionTotalDao.findByStudentNumberAndExamType(stuNumber, examType); + if (null == examCoversionTotal) { + info = "查询此学生的所有信息失败"; + logger.error(info); + throw new ScoreException(ResultEnum.RESULE_DATA_NONE, info); + } + //使用原生SQL + EntityManager em = ntityManagerFactory.createEntityManager(); + //String querysql = "SELECT * FROM exam_coversion_total WHERE class_id="+examCoversionTotal.getClassId()+ "AND exam_type="+examType+" ORDER BY "+ subject + " DESC"; 这个是错的 + //String querysql = "SELECT * FROM exam_coversion_total WHERE class_id=\""+examCoversionTotal.getClassId()+ "\" AND exam_type=\""+examType+"\" ORDER BY \""+ subject + "\" DESC"; 这个可以得用java转译字符 \" + // 本次班级排名 + String querysql = "SELECT * FROM exam_coversion_total WHERE class_id='"+examCoversionTotal.getClassId()+ "' AND exam_type='"+examType+"' ORDER BY "+ subject + " DESC"; //这个是直接拼接 + logger.info("查询本次班级排名-->" + querysql); + Query query = em.createNativeQuery(querysql, ExamCoversionTotal.class); + @SuppressWarnings("unchecked") + List examCoversionTotalSubject = query.getResultList(); + //本次年级排名 + String gradeQuerysql = "select * from exam_coversion_total where exam_type='"+examType+"' order by "+ subject + " desc"; + logger.info("查询本次年级排名-->" + gradeQuerysql); + Query gradeQuery = em.createNativeQuery(gradeQuerysql, ExamCoversionTotal.class); + @SuppressWarnings("unchecked") + List gradeExamCoversionTotal = gradeQuery.getResultList(); + + em.close(); + + // List examCoversionTotalSubject = examCoversionTotalDao.findAllByClassIdAndExamType(examCoversionTotal.getClassId(), examType,subject); + //当前试卷的班级排名map + Map mapClass = new HashMap<>(); + for(int i = 1; i < examCoversionTotalSubject.size(); i++){ + if (subject.equals("yuwen_score")){ + mapClass.put(examCoversionTotalSubject.get(0).getStudentNumber(),1); + if (examCoversionTotalSubject.get(i-1).getYuwenScore().equals(examCoversionTotalSubject.get(i).getYuwenScore())){ + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i - 1); + }else { + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("shuxue_score")){ + mapClass.put(examCoversionTotalSubject.get(0).getStudentNumber(),1); + if (examCoversionTotalSubject.get(i-1).getShuxueScore().equals(examCoversionTotalSubject.get(i).getShuxueScore())){ + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i - 1); + }else { + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("yingyu_score")){ + mapClass.put(examCoversionTotalSubject.get(0).getStudentNumber(),1); + if (examCoversionTotalSubject.get(i-1).getYingyuScore().equals(examCoversionTotalSubject.get(i).getYingyuScore())){ + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i - 1); + }else { + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("wuli_coversion")){ + mapClass.put(examCoversionTotalSubject.get(0).getStudentNumber(),1); + if (examCoversionTotalSubject.get(i-1).getWuliCoversion().equals(examCoversionTotalSubject.get(i).getWuliCoversion())){ + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i - 1); + }else { + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("huaxue_coversion")){ + mapClass.put(examCoversionTotalSubject.get(0).getStudentNumber(),1); + if (examCoversionTotalSubject.get(i-1).getHuaxueCoversion().equals(examCoversionTotalSubject.get(i).getHuaxueCoversion())){ + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i - 1); + }else { + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("shengwu_coversion")){ + mapClass.put(examCoversionTotalSubject.get(0).getStudentNumber(),1); + if (examCoversionTotalSubject.get(i-1).getShengwuCoversion().equals(examCoversionTotalSubject.get(i).getShengwuCoversion())){ + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i - 1); + }else { + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("lishi_coversion")){ + mapClass.put(examCoversionTotalSubject.get(0).getStudentNumber(),1); + if (examCoversionTotalSubject.get(i-1).getLishiCoversion().equals(examCoversionTotalSubject.get(i).getLishiCoversion())){ + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i - 1); + }else { + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("dili_coversion")){ + mapClass.put(examCoversionTotalSubject.get(0).getStudentNumber(),1); + if (examCoversionTotalSubject.get(i-1).getDiliCoversion().equals(examCoversionTotalSubject.get(i).getDiliCoversion())){ + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i - 1); + }else { + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("zhengzhi_coversion")){ + mapClass.put(examCoversionTotalSubject.get(0).getStudentNumber(),1); + if (examCoversionTotalSubject.get(i-1).getZhengzhiCoversion().equals(examCoversionTotalSubject.get(i).getZhengzhiCoversion())){ + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i - 1); + }else { + mapClass.put(examCoversionTotalSubject.get(i).getStudentNumber(), i + 1); + } + } + + } + //当前试卷的年级排名map + Map mapGrade = new HashMap<>(); + for (int i = 1; i < gradeExamCoversionTotal.size(); i++ ){ + if (subject.equals("yuwen_score")){ + mapGrade.put(gradeExamCoversionTotal.get(0).getStudentNumber(), 1); + if (gradeExamCoversionTotal.get(i-1).getYuwenScore().equals(gradeExamCoversionTotal.get(i).getYuwenScore())){ + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("shuxue_score")){ + mapGrade.put(gradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (gradeExamCoversionTotal.get(i-1).getShuxueScore().equals(gradeExamCoversionTotal.get(i).getShuxueScore())){ + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("yingyu_score")){ + mapGrade.put(gradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (gradeExamCoversionTotal.get(i-1).getYingyuScore().equals(gradeExamCoversionTotal.get(i).getYingyuScore())){ + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("wuli_coversion")){ + mapGrade.put(gradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (gradeExamCoversionTotal.get(i-1).getWuliCoversion().equals(gradeExamCoversionTotal.get(i).getWuliCoversion())){ + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("huaxue_coversion")){ + mapGrade.put(gradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (gradeExamCoversionTotal.get(i-1).getHuaxueCoversion().equals(gradeExamCoversionTotal.get(i).getHuaxueCoversion())){ + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("shengwu_coversion")){ + mapGrade.put(gradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (gradeExamCoversionTotal.get(i-1).getShengwuCoversion().equals(gradeExamCoversionTotal.get(i).getShengwuCoversion())){ + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("lishi_coversion")){ + mapGrade.put(gradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (gradeExamCoversionTotal.get(i-1).getLishiCoversion().equals(gradeExamCoversionTotal.get(i).getLishiCoversion())){ + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("dili_coversion")){ + mapGrade.put(gradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (gradeExamCoversionTotal.get(i-1).getDiliCoversion().equals(gradeExamCoversionTotal.get(i).getDiliCoversion())){ + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("zhengzhi_coversion")){ + mapGrade.put(gradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (gradeExamCoversionTotal.get(i-1).getZhengzhiCoversion().equals(gradeExamCoversionTotal.get(i).getZhengzhiCoversion())){ + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + mapGrade.put(gradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + } + } + + + + // 获取所有考试列表 + List examInfoList = examInfoDao.findAll(); + if (examInfoList == null || examInfoList.size() == 0) { + info = "查无结果"; + logger.error(info); + throw new ScoreException(ResultEnum.DATABASE_OP_EXCEPTION, info); + } + String oldExamType = null; + for (int i = 0; i < examInfoList.size(); i++) { + if (examType.equals(examInfoList.get(0).getExamName())){ + info = "本次为首次考试,暂无排名波动情况"; + // 年级波动名次,进退名次 + int waveGrade = 0; + // 班级波动名称,进退名次 + int waveClass =0; + + List examCoversionTotalSingleDTOList = new ArrayList<>(); + ExamCoversionTotalSingleDTO examCoversionTotalSingleDTO = new ExamCoversionTotalSingleDTO(); + examCoversionTotalSingleDTO.setExamCoversionTotal(examCoversionTotal); + examCoversionTotalSingleDTO.setClassRank(mapClass.get(stuNumber));//班排名 + examCoversionTotalSingleDTO.setGradeRank(mapGrade.get(stuNumber));//年排名 + examCoversionTotalSingleDTO.setWaveGrade(waveGrade);//年级进退名次 + examCoversionTotalSingleDTO.setWaveClass(waveClass);//班级进退名次 + + examCoversionTotalSingleDTOList.add(examCoversionTotalSingleDTO); + return examCoversionTotalSingleDTOList; + } else if (examType.equals(examInfoList.get(i).getExamName())) { + //获取上次试卷的名称 + oldExamType = examInfoList.get(i - 1).getExamName(); + } + } + + //再次使用原生SQL语句查询,来获取班级年级的排名 + EntityManager entityManager = ntityManagerFactory.createEntityManager(); + //上次班级排名 + String oldClassQuerysql = "SELECT * FROM exam_coversion_total WHERE class_id='"+examCoversionTotal.getClassId()+ "' AND exam_type='"+oldExamType+"' ORDER BY "+ subject + " DESC"; + Query oldClass = entityManager.createNativeQuery(oldClassQuerysql, ExamCoversionTotal.class); + @SuppressWarnings("unchecked") + List oldClassExamCoversionTotal = oldClass.getResultList(); + //上次年级排名 + String oldGradeQuerysql = "select * from exam_coversion_total where exam_type='"+oldExamType+"' order by "+ subject + " desc"; + Query oldgGradeQuery = entityManager.createNativeQuery(oldGradeQuerysql, ExamCoversionTotal.class); + @SuppressWarnings("unchecked") + List oldGradeExamCoversionTotal = oldgGradeQuery.getResultList(); + + entityManager.close(); + + //上次试卷的班级排名map + Map oldMapClass = new HashMap<>(); + for(int i = 1; i < oldClassExamCoversionTotal.size(); i++){ + if (subject.equals("yuwen_score")){ + oldMapClass.put(oldClassExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldClassExamCoversionTotal.get(i-1).getYuwenScore().equals(oldClassExamCoversionTotal.get(i).getYuwenScore())){ + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("shuxue_score")){ + oldMapClass.put(oldClassExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldClassExamCoversionTotal.get(i-1).getShuxueScore().equals(oldClassExamCoversionTotal.get(i).getShuxueScore())){ + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("yingyu_score")){ + oldMapClass.put(oldClassExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldClassExamCoversionTotal.get(i-1).getYingyuScore().equals(oldClassExamCoversionTotal.get(i).getYingyuScore())){ + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("wuli_coversion")){ + oldMapClass.put(oldClassExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldClassExamCoversionTotal.get(i-1).getWuliCoversion().equals(oldClassExamCoversionTotal.get(i).getWuliCoversion())){ + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("huaxue_coversion")){ + oldMapClass.put(oldClassExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldClassExamCoversionTotal.get(i-1).getHuaxueCoversion().equals(oldClassExamCoversionTotal.get(i).getHuaxueCoversion())){ + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("shengwu_coversion")){ + oldMapClass.put(oldClassExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldClassExamCoversionTotal.get(i-1).getShengwuCoversion().equals(oldClassExamCoversionTotal.get(i).getShengwuCoversion())){ + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("lishi_coversion")){ + oldMapClass.put(oldClassExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldClassExamCoversionTotal.get(i-1).getLishiCoversion().equals(oldClassExamCoversionTotal.get(i).getLishiCoversion())){ + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("dili_coversion")){ + oldMapClass.put(oldClassExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldClassExamCoversionTotal.get(i-1).getDiliCoversion().equals(oldClassExamCoversionTotal.get(i).getDiliCoversion())){ + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("zhengzhi_coversion")){ + oldMapClass.put(oldClassExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldClassExamCoversionTotal.get(i-1).getZhengzhiCoversion().equals(oldClassExamCoversionTotal.get(i).getZhengzhiCoversion())){ + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapClass.put(oldClassExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + } + + } + + //当前试卷的年级排名map + Map oldMapGrade = new HashMap<>(); + for (int i = 1; i < oldGradeExamCoversionTotal.size(); i++ ){ + if (subject.equals("yuwen_score")){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(0).getStudentNumber(), 1); + if (oldGradeExamCoversionTotal.get(i-1).getYuwenScore().equals(oldGradeExamCoversionTotal.get(i).getYuwenScore())){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("shuxue_score")){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldGradeExamCoversionTotal.get(i-1).getShuxueScore().equals(oldGradeExamCoversionTotal.get(i).getShuxueScore())){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("yingyu_score")){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldGradeExamCoversionTotal.get(i-1).getYingyuScore().equals(oldGradeExamCoversionTotal.get(i).getYingyuScore())){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("wuli_coversion")){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldGradeExamCoversionTotal.get(i-1).getWuliCoversion().equals(oldGradeExamCoversionTotal.get(i).getWuliCoversion())){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("huaxue_coversion")){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldGradeExamCoversionTotal.get(i-1).getHuaxueCoversion().equals(oldGradeExamCoversionTotal.get(i).getHuaxueCoversion())){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("shengwu_coversion")){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldGradeExamCoversionTotal.get(i-1).getShengwuCoversion().equals(oldGradeExamCoversionTotal.get(i).getShengwuCoversion())){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("lishi_coversion")){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldGradeExamCoversionTotal.get(i-1).getLishiCoversion().equals(oldGradeExamCoversionTotal.get(i).getLishiCoversion())){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("dili_coversion")){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldGradeExamCoversionTotal.get(i-1).getDiliCoversion().equals(oldGradeExamCoversionTotal.get(i).getDiliCoversion())){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + }else if (subject.equals("zhengzhi_coversion")){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(0).getStudentNumber(),1); + if (oldGradeExamCoversionTotal.get(i-1).getZhengzhiCoversion().equals(oldGradeExamCoversionTotal.get(i).getZhengzhiCoversion())){ + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i - 1); + }else { + oldMapGrade.put(oldGradeExamCoversionTotal.get(i).getStudentNumber(), i + 1); + } + } + } + + // 班级波动名次,进退名次 + int waveClass = mapClass.get(stuNumber) - oldMapClass.get(stuNumber); + // 年级波动名称,进退名次 + int waveGrade = mapGrade.get(stuNumber) - oldMapGrade.get(stuNumber); + + List examCoversionTotalSingleDTOList = new ArrayList<>(); + ExamCoversionTotalSingleDTO examCoversionTotalSingleDTO = new ExamCoversionTotalSingleDTO(); + examCoversionTotalSingleDTO.setExamCoversionTotal(examCoversionTotal); + examCoversionTotalSingleDTO.setClassRank(mapClass.get(stuNumber));//班排名 + examCoversionTotalSingleDTO.setGradeRank(mapGrade.get(stuNumber));//年排名 + examCoversionTotalSingleDTO.setWaveGrade(waveGrade);//年级进退名次 + examCoversionTotalSingleDTO.setWaveClass(waveClass);//班级进退名次 + examCoversionTotalSingleDTOList.add(examCoversionTotalSingleDTO); + return examCoversionTotalSingleDTOList; + + } + + + @Override + public List getExamCoversionTotalSectionInfo(String stuNumber, String examType) { + ExamCoversionTotal examCoversionTotal = examCoversionTotalDao.findByStudentNumberAndExamType(stuNumber, examType); + if (null == examCoversionTotal) { + info = "查询此学生的所有信息失败"; + logger.error(info); + throw new ScoreException(ResultEnum.RESULE_DATA_NONE, info); + } + // 语数英三科总分 + float threeSubject = 0; + //剩余6选3的总分 + float comprehensive = 0; + threeSubject = (float) (examCoversionTotal.getYuwenScore() + examCoversionTotal.getShuxueScore() + examCoversionTotal.getYingyuScore()); + comprehensive = (float) (examCoversionTotal.getWuliCoversion() + examCoversionTotal.getHuaxueCoversion() + examCoversionTotal.getShengwuCoversion() + examCoversionTotal.getLishiCoversion() + examCoversionTotal.getDiliCoversion() + examCoversionTotal.getZhengzhiCoversion()); + + //三科的班级排名 + List classRank = examCoversionTotalDao.findByClassIdAndExamType(examCoversionTotal.getClassId(), examType); + Map map = new HashMap<>(); + for(int i = 0; i < classRank.size(); i++) { + for (Object classRankObject[] : classRank) { + map.put(classRankObject[0], classRankObject[1]); + } + } + //将map中的值放到list中,进行排序 + List mapValueList = new ArrayList<>(); + for (Object vaule : map.values()){ + mapValueList.add(String.valueOf(vaule)); + } + //对mapValueList进行降序排序 + Collections.sort(mapValueList, Collections.reverseOrder()); + + +//三科 班排的第一种方法,第一种方法无需在进行排名,只需要排好序即可 + // mapValueRank存放的是 分值和排名 + Map mapValueRank = new HashMap<>(); + for (int j = 1; j < mapValueList.size(); j++){ + mapValueRank.put(mapValueList.get(0), 1); + if (mapValueList.get(j - 1 ).equals(mapValueList.get(j))){ + mapValueRank.put(mapValueList.get(j), j - 1); + }else { + mapValueRank.put(mapValueList.get(j), j + 1); + } + } + +//三科年级排名 + List threeSubjectGradeRank = examCoversionTotalDao.findByClassIdAndExamTypeGrade(examType); + Map threeSubjectGradeMap = new HashMap<>(); + for (int k = 0; k < threeSubjectGradeRank.size(); k++){ + for (Object gradeRankObject[] : threeSubjectGradeRank){ + threeSubjectGradeMap.put(gradeRankObject[0], gradeRankObject[1]); + } + } + List threeSubjectGradeList = new ArrayList<>(); + for (Object threeSubjectValue : threeSubjectGradeMap.values()){ + threeSubjectGradeList.add(String.valueOf(threeSubjectValue)); + } + Collections.sort(threeSubjectGradeList, Collections.reverseOrder()); + + //综合的班排名次 + List complexClassRank = examCoversionTotalDao.findByClassIdAndExamTypeComplex(examCoversionTotal.getClassId(), examType); + Map complexClassMap= new HashMap<>(); + for(int i = 0; i < complexClassRank.size(); i++) { + for (Object classRankObject[] : complexClassRank) { + complexClassMap.put(classRankObject[0], classRankObject[1]); + } + } + List mapValueListComplex = new ArrayList<>(); + for (Object vaule : complexClassMap.values()){ + mapValueListComplex.add(String.valueOf(vaule)); + } + Collections.sort(mapValueListComplex, Collections.reverseOrder()); + + //综合的年排名次 + List complexGradeRank = examCoversionTotalDao.findByClassIdAndExamTypeComplexGrade(examType); + Map complexGradeMap= new HashMap<>(); + for(int i = 0; i < complexGradeRank.size(); i++) { + for (Object classRankObject[] : complexGradeRank) { + complexGradeMap.put(classRankObject[0], classRankObject[1]); + } + } + List mapValueListComplexGrade = new ArrayList<>(); + for (Object vaule : complexGradeMap.values()){ + mapValueListComplexGrade.add(String.valueOf(vaule)); + } + Collections.sort(mapValueListComplexGrade, Collections.reverseOrder()); + + List list = new ArrayList<>(); + if (!examCoversionTotal.getWuliCoversion().toString().equals("0.0")){ + list.add("物理"); + } + if (!examCoversionTotal.getHuaxueCoversion().toString().equals("0.0")){ + list.add("化学"); + } + if (!examCoversionTotal.getShengwuCoversion().toString().equals("0.0")){ + list.add("生物"); + } + if (!examCoversionTotal.getLishiCoversion().toString().equals("0.0")){ + list.add("历史"); + } + if (!examCoversionTotal.getDiliCoversion().toString().equals("0.0")){ + list.add("地理"); + } + if (!examCoversionTotal.getZhengzhiCoversion().toString().equals("0.0")){ + list.add("政治"); + } + + List examCoversionTotalSectionDTOList = new ArrayList<>(); + ExamCoversionTotalSectionDTO examCoversionTotalSectionDTO = new ExamCoversionTotalSectionDTO(); + examCoversionTotalSectionDTO.setExamCoversionTotal(examCoversionTotal); + examCoversionTotalSectionDTO.setThreeSubject(threeSubject); + examCoversionTotalSectionDTO.setComprehensive(comprehensive); + // 求班排的第二中方法,即用排好序的list,取下标法,indexOf:如果元素相同取第一次出现的下标, + examCoversionTotalSectionDTO.setClassRank(mapValueList.indexOf(String.valueOf(map.get(stuNumber))) + 1); + + //第一种方法,此方法 +// String key = String.valueOf(map.get(stuNumber));//强转有问题,这样的也有问题,如果小数多(科学计数法)会出问题 +// examCoversionTotalSectionDTO.setClassRank(mapValueRank.get(key)); + + examCoversionTotalSectionDTO.setGradeRank(threeSubjectGradeList.indexOf(String.valueOf(threeSubjectGradeMap.get(stuNumber))) + 1); + + examCoversionTotalSectionDTO.setComplexClassRank(mapValueListComplex.indexOf(String.valueOf(complexClassMap.get(stuNumber))) + 1); + examCoversionTotalSectionDTO.setComplexGradeRank(mapValueListComplexGrade.indexOf(String.valueOf(complexGradeMap.get(stuNumber))) + 1); + + examCoversionTotalSectionDTO.setList(list); + examCoversionTotalSectionDTOList.add(examCoversionTotalSectionDTO); + + return examCoversionTotalSectionDTOList; + } + + @Override + public List getSixRateInfo(String stuNumber, String examType) { + ExamCoversionTotal examCoversionTotal = examCoversionTotalDao.findByStudentNumberAndExamType(stuNumber, examType); + if (null == examCoversionTotal) { + info = "查询此学生的所有信息失败"; + logger.error(info); + throw new ScoreException(ResultEnum.RESULE_DATA_NONE, info); + } + // 此班级的所有的总分数据 + List coversionTotalList= examCoversionTotalDao.getCoversionTotalByClassIdAndExamType(examCoversionTotal.getClassId(), examType); + int examTnfoId = examInfoDao.findByExamName(examType); +// ExamFullScoreSet examFullScoreSet= examFullScoreSetDao.findByExaminfoId((int) examTnfoId); +// SubjectFullScore sbujectFullScore = subjectFullScoreDao.findOne((int) examFullScoreSet.getId()); +// int totalScore = (int) (sbujectFullScore.getYingyu() + sbujectFullScore.getShuxue()+sbujectFullScore.getYingyu()+sbujectFullScore.getWuli()+sbujectFullScore.getHuaxue()+sbujectFullScore.getShengwu()+sbujectFullScore.getDili()+sbujectFullScore.getLishi()+sbujectFullScore.getZhengzhi() - 300); + BigInteger tatolscore = examCoversionTotalDao.findSchametotal(examTnfoId); + int score = Integer.parseInt(tatolscore.toString().trim()) - 300; + double a = 0, avg = 0, personsum = 0, classtotalscore = 0; + double highnumradio; + double excellentratio; + double goodratio; + double mediumratio; + double passratio; + double failratio; + double beyondradio; + int highnum = 0, //高分人数 + excellentnum = 0, //优秀人数 + goodnum = 0, //良好人数 + mediumnum = 0, //中等人数 + passnum = 0, //及格人数 + failnum = 0, //低分人数 + beyondnum = 0; //超平均人数 + personsum = coversionTotalList.size(); + for (int i = 0; i < coversionTotalList.size(); i++) { + + classtotalscore = classtotalscore + coversionTotalList.get(i); + if (coversionTotalList.get(i) >= score * 0.9) { + highnum++; + } else if (coversionTotalList.get(i) >= score * 0.85 && coversionTotalList.get(i) < score * 0.90) { + excellentnum++; + } else if (coversionTotalList.get(i) >= score * 0.75 && coversionTotalList.get(i) < score * 0.85) { + goodnum++; + } else if (coversionTotalList.get(i) >= score * 0.60 && coversionTotalList.get(i) < score * 0.75) { + passnum++; + } else { + failnum++; + } + } + // 班级平均分 + avg = classtotalscore / personsum; + for (int j = 0; j < coversionTotalList.size(); j++) { + if (coversionTotalList.get(j) > avg) { + beyondnum++; + } + } + + String location = ""; + if (examCoversionTotal.getCoversionTotal() >= score * 0.9) { + location = "高分区域"; + } else if (examCoversionTotal.getCoversionTotal() >= score * 0.85 && examCoversionTotal.getCoversionTotal() < score * 0.90) { + location = "优秀区域"; + } else if (examCoversionTotal.getCoversionTotal() >= score * 0.75 && examCoversionTotal.getCoversionTotal() < score * 0.85) { + location = "良好区域"; + } else if (examCoversionTotal.getCoversionTotal() >= score * 0.60 && examCoversionTotal.getCoversionTotal() < score * 0.75) { + location = "及格区域"; + } else { + location = "低分区域"; + } + highnumradio = highnum / personsum; + excellentratio = excellentnum / personsum; + goodratio = goodnum / personsum; + passratio = passnum / personsum; + failratio = failnum / personsum; + beyondradio = beyondnum / personsum; + + //保留两位小数 + DecimalFormat df = new DecimalFormat("#.00"); + + List sixRateDTOList = new ArrayList<>(); + SixRateDTO sixRateDTO = new SixRateDTO(); + sixRateDTO.setHighNumRate(Double.parseDouble(df.format(highnumradio))); + sixRateDTO.setExcellentRate(Double.parseDouble(df.format(excellentratio))); + sixRateDTO.setGoodRate(Double.parseDouble(df.format(goodratio))); + sixRateDTO.setPassRate(Double.parseDouble(df.format(passratio))); + sixRateDTO.setFailRate(Double.parseDouble(df.format(failratio))); + sixRateDTO.setBeyondRate(Double.parseDouble(df.format(beyondradio))); + sixRateDTO.setLocationRate(location); + sixRateDTOList.add(sixRateDTO); + + return sixRateDTOList; + } +} diff --git a/src/main/java/com/zgczx/utils/MapUtil.java b/src/main/java/com/zgczx/utils/MapUtil.java new file mode 100644 index 0000000..04c4346 --- /dev/null +++ b/src/main/java/com/zgczx/utils/MapUtil.java @@ -0,0 +1,18 @@ +package com.zgczx.utils; + +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; + +/** + * map操作的一些公共方法 + * @author aml + * @date 2019/9/18 16:04 + */ +public class MapUtil { + + + + +} diff --git a/src/main/java/com/zgczx/utils/ResultVOUtil.java b/src/main/java/com/zgczx/utils/ResultVOUtil.java new file mode 100644 index 0000000..1ee6c5f --- /dev/null +++ b/src/main/java/com/zgczx/utils/ResultVOUtil.java @@ -0,0 +1,34 @@ +package com.zgczx.utils; + +import com.zgczx.VO.ResultVO; +import lombok.Data; + +/** + * @author aml + * @date 2019/9/10 16:06 + * 成功状态码,和错误提示 + */ +@Data +public class ResultVOUtil { + + public static ResultVO success(Object object){ + ResultVO resultVO = new ResultVO(); + resultVO.setData(object); + resultVO.setCode(0); + resultVO.setMsg("成功"); + return resultVO; + } + + public static ResultVO success(){ + return success(null); + } + + public static ResultVO error(Integer code, String msg, Object object){ + ResultVO resultVO = new ResultVO(); + resultVO.setCode(code); + resultVO.setMsg(msg); + resultVO.setData(object); + return resultVO; + + } +} diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..f040b2f --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,58 @@ + + + + + + %d - %msg%n + + + + + + + ERROR + DENY + + + + UTF-8 + + %msg%n + + + + + + logs/info.%d{yyyy-MM-dd}.log + 90 + 1GB + + + + + + ERROR + + + UTF-8 + + %msg%n + + + + + + logs/error.%d{yyyy-MM-dd}.log + 90 + 1GB + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/category/index.ftl b/src/main/resources/templates/category/index.ftl new file mode 100644 index 0000000..46e3f29 --- /dev/null +++ b/src/main/resources/templates/category/index.ftl @@ -0,0 +1,34 @@ + +<#include "../common/header.ftl"> + + +
+ +<#--边栏sidebar--> +<#include "../common/nav.ftl"> + +<#--主要内容content--> +
+
+
+
+
+
+ + +
+
+ + +
+ + +
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/category/list.ftl b/src/main/resources/templates/category/list.ftl new file mode 100644 index 0000000..9ad474e --- /dev/null +++ b/src/main/resources/templates/category/list.ftl @@ -0,0 +1,47 @@ + +<#include "../common/header.ftl"> + + +
+ + <#--边栏sidebar--> + <#include "../common/nav.ftl"> + + <#--主要内容content--> +
+
+
+
+ + + + + + + + + + + + + + <#list categoryList as category> + + + + + + + + + + +
类目id名字type创建时间修改时间操作
${category.categoryId}${category.categoryName}${category.categoryType}${category.createTime}${category.updateTime}修改
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/common/error.ftl b/src/main/resources/templates/common/error.ftl new file mode 100644 index 0000000..2416ba0 --- /dev/null +++ b/src/main/resources/templates/common/error.ftl @@ -0,0 +1,28 @@ + + + + 错误提示 + + + + +
+
+
+
+ +

+ 错误! +

${msg}3s后自动跳转 +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/common/header.ftl b/src/main/resources/templates/common/header.ftl new file mode 100644 index 0000000..e9861f2 --- /dev/null +++ b/src/main/resources/templates/common/header.ftl @@ -0,0 +1,6 @@ + + + 卖家后端管理系统 + + + \ No newline at end of file diff --git a/src/main/resources/templates/common/nav.ftl b/src/main/resources/templates/common/nav.ftl new file mode 100644 index 0000000..bf3d81c --- /dev/null +++ b/src/main/resources/templates/common/nav.ftl @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/src/main/resources/templates/common/success.ftl b/src/main/resources/templates/common/success.ftl new file mode 100644 index 0000000..04867f3 --- /dev/null +++ b/src/main/resources/templates/common/success.ftl @@ -0,0 +1,28 @@ + + + + 成功提示 + + + + +
+
+
+
+ +

+ 成功! +

${msg!""}3s后自动跳转 +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/home.ftl b/src/main/resources/templates/home.ftl new file mode 100644 index 0000000..a5a746f --- /dev/null +++ b/src/main/resources/templates/home.ftl @@ -0,0 +1,35 @@ + + + +
+ + + <#--主要内容content--> +
+
+
+
+ + + + + + + + + + + + + + + +
类目id名字type创建时间修改时间操作
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/order/detail.ftl b/src/main/resources/templates/order/detail.ftl new file mode 100644 index 0000000..b073bd1 --- /dev/null +++ b/src/main/resources/templates/order/detail.ftl @@ -0,0 +1,71 @@ + +<#include "../common/header.ftl"> + + +
+ + <#--边栏sidebar--> + <#include "../common/nav.ftl"> + + + <#--主要内容content--> +
+
+
+
+ + + + + + + + + + + + + +
订单id订单总金额
${orderDTO.orderId}${orderDTO.orderAmount}
+
+ + <#--订单详情表数据--> +
+ + + + + + + + + + + + <#list orderDTO.orderDetailList as orderDetail> + + + + + + + + + +
商品id商品名称价格数量总额
${orderDetail.productId}${orderDetail.productName}${orderDetail.productPrice}${orderDetail.productQuantity}${orderDetail.productQuantity * orderDetail.productPrice}
+
+ + <#--操作--> +
+ <#if orderDTO.getOrderStatusEnum().message == "新订单"> + 完结订单 + 取消订单 + +
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/resources/templates/order/list.ftl b/src/main/resources/templates/order/list.ftl new file mode 100644 index 0000000..753dd9b --- /dev/null +++ b/src/main/resources/templates/order/list.ftl @@ -0,0 +1,146 @@ + +<#include "../common/header.ftl"> + + +
+ + <#--边栏sidebar--> + <#include "../common/nav.ftl"> + + <#--主要内容content--> +
+
+
+
+ + + + + + + + + + + + + + + + + <#list orderDTOPage.content as orderDTO> + + + + + + + + + + + + + + +
订单id姓名手机号地址金额订单状态支付状态创建时间操作
${orderDTO.orderId}${orderDTO.buyerName}${orderDTO.buyerPhone}${orderDTO.buyerAddress}${orderDTO.orderAmount}${orderDTO.getOrderStatusEnum().message}${orderDTO.getPayStatusEnum().message}${orderDTO.createTime}详情 + <#if orderDTO.getOrderStatusEnum().message == "新订单"> + 取消 + +
+
+ + <#--分页--> +
+
    + <#if currentPage lte 1> +
  • 上一页
  • + <#else> +
  • 上一页
  • + + + <#list 1..orderDTOPage.getTotalPages() as index> + <#if currentPage == index> +
  • ${index}
  • + <#else> +
  • ${index}
  • + + + + <#if currentPage gte orderDTOPage.getTotalPages()> +
  • 下一页
  • + <#else> +
  • 下一页
  • + +
+
+
+
+
+ +
+ +<#--弹窗--> + + +<#--播放音乐--> + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/pay/create.ftl b/src/main/resources/templates/pay/create.ftl new file mode 100644 index 0000000..1f5096c --- /dev/null +++ b/src/main/resources/templates/pay/create.ftl @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/src/main/resources/templates/pay/success.ftl b/src/main/resources/templates/pay/success.ftl new file mode 100644 index 0000000..f04ae96 --- /dev/null +++ b/src/main/resources/templates/pay/success.ftl @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/templates/product/index.ftl b/src/main/resources/templates/product/index.ftl new file mode 100644 index 0000000..9958133 --- /dev/null +++ b/src/main/resources/templates/product/index.ftl @@ -0,0 +1,60 @@ + +<#include "../common/header.ftl"> + + +
+ +<#--边栏sidebar--> +<#include "../common/nav.ftl"> + +<#--主要内容content--> +
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+
+ + +
+ + +
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/product/list.ftl b/src/main/resources/templates/product/list.ftl new file mode 100644 index 0000000..d75fd70 --- /dev/null +++ b/src/main/resources/templates/product/list.ftl @@ -0,0 +1,87 @@ + +<#include "../common/header.ftl"> + + +
+ + <#--边栏sidebar--> + <#include "../common/nav.ftl"> + + <#--主要内容content--> +
+
+
+
+ + + + + + + + + + + + + + + + + + <#list productInfoPage.content as productInfo> + + + + + + + + + + + + + + + +
商品id名称图片单价库存描述类目创建时间修改时间操作
${productInfo.productId}${productInfo.productName}${productInfo.productPrice}${productInfo.productStock}${productInfo.productDescription}${productInfo.categoryType}${productInfo.createTime}${productInfo.updateTime}修改 + <#if productInfo.getProductStatusEnum().message == "在架"> + 下架 + <#else> + 上架 + +
+
+ + <#--分页--> +
+
    + <#if currentPage lte 1> +
  • 上一页
  • + <#else> +
  • 上一页
  • + + + <#list 1..productInfoPage.getTotalPages() as index> + <#if currentPage == index> +
  • ${index}
  • + <#else> +
  • ${index}
  • + + + + <#if currentPage gte productInfoPage.getTotalPages()> +
  • 下一页
  • + <#else> +
  • 下一页
  • + +
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/src/test/java/com/zgczx/ScoreAnalysisApplicationTests.java b/src/test/java/com/zgczx/ScoreAnalysisApplicationTests.java new file mode 100644 index 0000000..ab2ed72 --- /dev/null +++ b/src/test/java/com/zgczx/ScoreAnalysisApplicationTests.java @@ -0,0 +1,16 @@ +package com.zgczx; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ScoreAnalysisApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..466dd85 --- /dev/null +++ b/start.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +rm target -rf +nohup mvn spring-boot:run -Drun.project=score_analysis >> logs/catalina.out 2>&1 & diff --git a/stop.sh b/stop.sh new file mode 100644 index 0000000..2cd71ca --- /dev/null +++ b/stop.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +PROJECTNAME=score_analysis + +pid=`ps -ef |grep $PROJECTNAME |grep -v "grep" |awk '{print $2}' ` + +if [[ $pid ]]; then + + echo "$PROJECTNAME is running and pid=$pid" + + kill -9 $pid + + if [[ $? -eq 0 ]];then + + echo "sucess to stop $PROJECTNAME " + + else + + echo "fail to stop $PROJECTNAME " + + fi + +fi + + +