diff --git a/cloud/weigeng/.gitignore b/cloud/weigeng/.gitignore deleted file mode 100644 index a2a3040..0000000 --- a/cloud/weigeng/.gitignore +++ /dev/null @@ -1,31 +0,0 @@ -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 - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ - -### VS Code ### -.vscode/ diff --git a/cloud/weigeng/.mvn/wrapper/MavenWrapperDownloader.java b/cloud/weigeng/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100644 index 7f91a56..0000000 --- a/cloud/weigeng/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,114 +0,0 @@ -/* -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/cloud/weigeng/.mvn/wrapper/maven-wrapper.jar b/cloud/weigeng/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 01e6799..0000000 Binary files a/cloud/weigeng/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/cloud/weigeng/.mvn/wrapper/maven-wrapper.properties b/cloud/weigeng/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index cd0d451..0000000 --- a/cloud/weigeng/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -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/cloud/weigeng/libs/sqljdbc4-4.2-6.jar b/cloud/weigeng/libs/sqljdbc4-4.2-6.jar deleted file mode 100644 index d33695c..0000000 Binary files a/cloud/weigeng/libs/sqljdbc4-4.2-6.jar and /dev/null differ diff --git a/cloud/weigeng/mvnw b/cloud/weigeng/mvnw deleted file mode 100644 index 8b9da3b..0000000 --- a/cloud/weigeng/mvnw +++ /dev/null @@ -1,286 +0,0 @@ -#!/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/cloud/weigeng/mvnw.cmd b/cloud/weigeng/mvnw.cmd deleted file mode 100644 index b3f9958..0000000 --- a/cloud/weigeng/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@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/cloud/weigeng/pom.xml b/cloud/weigeng/pom.xml deleted file mode 100644 index 00e3e88..0000000 --- a/cloud/weigeng/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.1.8.RELEASE - - - com.sincere - weigeng - 0.0.1 - weigeng - Demo project for Spring Boot - - - 1.8 - Greenwich.SR2 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-server - - - - com.baidu.aip - java-sdk - 4.10.0 - - - - com.microsoft.sqlserver.jdbc - sqljdbc - system - 1 - ${project.basedir}/libs/sqljdbc4-4.2-6.jar - - - - org.mybatis.spring.boot - mybatis-spring-boot-starter - 2.0.1 - - - - com.drewnoakes - metadata-extractor - 2.4.0-beta-1 - - - - org.apache.poi - poi - 4.1.0 - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - true - - - - - - - diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/AuthService.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/AuthService.java deleted file mode 100644 index 36ae7cb..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/AuthService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.sincere.weigeng; - -import org.json.JSONObject; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.List; -import java.util.Map; - -/** - * 获取token类 - */ -public class AuthService { - //设置APPID/AK/SK - public static final String APP_ID = "15990462"; - public static final String API_KEY = "t70Rzr6SGmfU9S6MrqAkspsY"; - public static final String SECRET_KEY = "nSqpqtrf7cCjo8vOB9knL85nwWNoxwvS "; - /** - * 获取权限token - * @return 返回示例: - * { - * "access_token": "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567", - * "expires_in": 2592000 - * } - */ - public static String getAuth() { - // 官网获取的 API Key 更新为你注册的 - String clientId = "t70Rzr6SGmfU9S6MrqAkspsY"; - // 官网获取的 Secret Key 更新为你注册的 - String clientSecret = "nSqpqtrf7cCjo8vOB9knL85nwWNoxwvS"; - return getAuth(clientId, clientSecret); - } - - /** - * 获取API访问token - * 该token有一定的有效期,需要自行管理,当失效时需重新获取. - * @param ak - 百度云官网获取的 API Key - * @param sk - 百度云官网获取的 Securet Key - * @return assess_token 示例: - * "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567" - */ - public static String getAuth(String ak, String sk) { - // 获取token地址 - String authHost = "https://aip.baidubce.com/oauth/2.0/token?"; - String getAccessTokenUrl = authHost - // 1. grant_type为固定参数 - + "grant_type=client_credentials" - // 2. 官网获取的 API Key - + "&client_id=" + ak - // 3. 官网获取的 Secret Key - + "&client_secret=" + sk; - try { - URL realUrl = new URL(getAccessTokenUrl); - // 打开和URL之间的连接 - HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection(); - connection.setRequestMethod("GET"); - connection.connect(); - // 获取所有响应头字段 - Map> map = connection.getHeaderFields(); - // 遍历所有的响应头字段 - for (String key : map.keySet()) { - System.err.println(key + "--->" + map.get(key)); - } - // 定义 BufferedReader输入流来读取URL的响应 - BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String result = ""; - String line; - while ((line = in.readLine()) != null) { - result += line; - } - /** - * 返回结果示例 - */ - System.err.println("result:" + result); - JSONObject jsonObject = new JSONObject(result); - String access_token = jsonObject.getString("access_token"); - return access_token; - } catch (Exception e) { - System.err.printf("获取token失败!"); - e.printStackTrace(System.err); - } - return null; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeBean.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeBean.java deleted file mode 100644 index 3409099..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeBean.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.sincere.weigeng; - -public class HomeBean { - - private String CreatorUserId; - - private String Title; - - - public String getCreatorUserId() { - return CreatorUserId; - } - - public void setCreatorUserId(String creatorUserId) { - CreatorUserId = creatorUserId; - } - - public String getTitle() { - return Title; - } - - public void setTitle(String title) { - Title = title; - } - - @Override - public String toString() { - return "HomeBean{" + - "CreatorUserId='" + CreatorUserId + '\'' + - ", Title='" + Title + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/Homework.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/Homework.java deleted file mode 100644 index 9a34851..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/Homework.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class Homework implements Serializable { - - private String ID; - - private String CreatorUserId; - - private String PaperId; - - private String Title; - - private int SuggestionTime; - - private String Deadline; - - private int State; - - private String Intime; - - private int SubjectId; - - private int PublishAnswerType; - - private int IsPigai; - - private String StartTime; - - private int TypeId; - - private String QuestionIds; - - private int HomeworkType; - - private int PkgId; - - public String getCreatorUserId() { - return CreatorUserId; - } - - public void setCreatorUserId(String creatorUserId) { - CreatorUserId = creatorUserId; - } - - public String getPaperId() { - return PaperId; - } - - public String getID() { - return ID; - } - - public void setID(String ID) { - this.ID = ID; - } - - @Override - public String toString() { - return "Homework{" + - "ID='" + ID + '\'' + - ", CreatorUserId='" + CreatorUserId + '\'' + - ", PaperId='" + PaperId + '\'' + - ", Title='" + Title + '\'' + - ", SuggestionTime=" + SuggestionTime + - ", Deadline='" + Deadline + '\'' + - ", State=" + State + - ", Intime='" + Intime + '\'' + - ", SubjectId=" + SubjectId + - ", PublishAnswerType=" + PublishAnswerType + - ", IsPigai=" + IsPigai + - ", StartTime='" + StartTime + '\'' + - ", TypeId=" + TypeId + - ", QuestionIds='" + QuestionIds + '\'' + - ", HomeworkType=" + HomeworkType + - ", PkgId=" + PkgId + - '}'; - } - - public void setPaperId(String paperId) { - PaperId = paperId; - } - - public String getTitle() { - return Title; - } - - public void setTitle(String title) { - Title = title; - } - - public int getSuggestionTime() { - return SuggestionTime; - } - - public void setSuggestionTime(int suggestionTime) { - SuggestionTime = suggestionTime; - } - - public String getDeadline() { - return Deadline; - } - - public void setDeadline(String deadline) { - Deadline = deadline; - } - - public int getState() { - return State; - } - - public void setState(int state) { - State = state; - } - - public String getIntime() { - return Intime; - } - - public void setIntime(String intime) { - Intime = intime; - } - - public int getSubjectId() { - return SubjectId; - } - - public void setSubjectId(int subjectId) { - SubjectId = subjectId; - } - - public int getPublishAnswerType() { - return PublishAnswerType; - } - - public void setPublishAnswerType(int publishAnswerType) { - PublishAnswerType = publishAnswerType; - } - - public int getIsPigai() { - return IsPigai; - } - - public void setIsPigai(int isPigai) { - IsPigai = isPigai; - } - - public String getStartTime() { - return StartTime; - } - - public void setStartTime(String startTime) { - StartTime = startTime; - } - - public int getTypeId() { - return TypeId; - } - - public void setTypeId(int typeId) { - TypeId = typeId; - } - - public String getQuestionIds() { - return QuestionIds; - } - - public void setQuestionIds(String questionIds) { - QuestionIds = questionIds; - } - - public int getHomeworkType() { - return HomeworkType; - } - - public void setHomeworkType(int homeworkType) { - HomeworkType = homeworkType; - } - - public int getPkgId() { - return PkgId; - } - - public void setPkgId(int pkgId) { - PkgId = pkgId; - } - -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeworkReceive.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeworkReceive.java deleted file mode 100644 index 1679780..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeworkReceive.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class HomeworkReceive implements Serializable { - - private String StudentId; - - private String StudnetAnswerIds; - - public String getStudentId() { - return StudentId; - } - - public void setStudentId(String studentId) { - StudentId = studentId; - } - - public String getStudnetAnswerIds() { - return StudnetAnswerIds; - } - - public void setStudnetAnswerIds(String studnetAnswerIds) { - StudnetAnswerIds = studnetAnswerIds; - } - - @Override - public String toString() { - return "HomeworkReceive{" + - "StudentId='" + StudentId + '\'' + - ", StudnetAnswerIds='" + StudnetAnswerIds + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/ImageUtils.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/ImageUtils.java deleted file mode 100644 index b9fa1e0..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/ImageUtils.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.sincere.weigeng; - -import com.drew.imaging.ImageMetadataReader; -import com.drew.imaging.jpeg.JpegMetadataReader; -import com.drew.metadata.Directory; -import com.drew.metadata.Metadata; -import com.drew.metadata.Tag; -import com.sun.imageio.plugins.png.PNGImageReader; -import org.apache.commons.lang.StringUtils; - -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.util.Iterator; - -public class ImageUtils { - - - /* *//** - * 获取图片正确显示需要旋转的角度(顺时针) - * @return - *//* - public static int getRotateAngleForPhoto(String filePath){ - File file = new File(filePath); - int angle = 0; - Metadata metadata; - try { - metadata = JpegMetadataReader.readMetadata(file); - Directory directory = metadata.getDirectory(ExifDirectory.class); - if(directory.containsTag(ExifDirectory.TAG_ORIENTATION)){ - - // Exif信息中方向   - int orientation = directory.getInt(ExifDirectory.TAG_ORIENTATION); - // 原图片的方向信息 - if(6 == orientation ){ - //6旋转90 - angle = 90; - }else if( 3 == orientation){ - //3旋转180 - angle = 180; - }else if( 8 == orientation){ - //8旋转90 - angle = 270; - } - } - } catch (JpegProcessingException e) { - e.printStackTrace(); - } catch (MetadataException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return angle; - }*/ - - - /** - * 获得图片调整角度 - * make by dongxh 2017年11月1日下午3:40:20 - * @param imgFile - * @return - */ - public static Integer getImgRotateAngle(String imgFile){ - return 0; - /*int angel = 0; - try { - File file = new File(imgFile); - Metadata metadata = ImageMetadataReader.readMetadata(file); - for (Directory directory : metadata.getDirectories()) { - for (Tag tag : directory.getTags()) { - if (tag.getTagType() == ExifDirectoryBase.TAG_ORIENTATION) { - String description = tag.getDescription(); -// System.out.println(description); - if (description.contains("90")) { - // 顺时针旋转90度 - angel = 90; - } else if (description.contains("180")) { - // 顺时针旋转180度 - angel = 180; - } else if (description.contains("270")) { - // 顺时针旋转270度 - angel = 270; - } - } - } - } -// System.out.println(angel); - } catch (Exception e) { - e.printStackTrace(); - } - return angel;*/ - /*Integer angel = 0; - Metadata metadata = null; - try{ - if(StringUtils.isBlank(imgFile))return angel; - File _img_file_ = new File(imgFile); - if(!_img_file_.exists())return angel; - metadata = JpegMetadataReader.readMetadata(_img_file_); - Directory directory = metadata.getDirectory(ExifDirectory.class); - Iterator iterator =directory.getTagIterator(); - while (iterator.hasNext()){ - System.out.println("directory:"+iterator.next().toString()); - } - if(directory != null && directory.containsTag(ExifDirectory.TAG_ORIENTATION)){ - int orientation = directory.getInt(ExifDirectory.TAG_ORIENTATION); - // 原图片的方向信息 - if(6 == orientation ){ - //6旋转90 - angel = 90; - }else if( 3 == orientation){ - //3旋转180 - angel = 180; - }else if( 8 == orientation){ - //8旋转90 - angel = 270; - } - } - }catch(Exception e){ - e.printStackTrace(); - } - return angel;*/ - } - - /** - * 旋转照片 - * @return - */ - public static String rotatePhonePhoto(String fullPath, int angel){ - - BufferedImage src; - try { - src = ImageIO.read(new File(fullPath)); - int src_width = src.getWidth(null); - int src_height = src.getHeight(null); - - int swidth=src_width; - int sheight=src_height; - - if(angel==90||angel==270){ - swidth = src_height; - sheight= src_width; - } - - Rectangle rect_des = new Rectangle(new Dimension(swidth,sheight)); - - BufferedImage res = new BufferedImage(rect_des.width, rect_des.height,BufferedImage.TYPE_INT_RGB); - Graphics2D g2 = res.createGraphics(); - - g2.translate((rect_des.width - src_width) / 2, - (rect_des.height - src_height) / 2); - g2.rotate(Math.toRadians(angel), src_width / 2, src_height / 2); - - g2.drawImage(src, null, null); - - ImageIO.write(res, "jpg", new File(fullPath)); - - } catch (IOException e) { - - e.printStackTrace(); - } - - return fullPath; - - } - -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/JiaoCai.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/JiaoCai.java deleted file mode 100644 index fa2541a..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/JiaoCai.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class JiaoCai implements Serializable { - - - private String ID; - - private String SubjectId; - - private String JiaoCaiName; - - public String getID() { - return ID; - } - - public void setID(String ID) { - this.ID = ID; - } - - public String getSubjectId() { - return SubjectId; - } - - public void setSubjectId(String subjectId) { - SubjectId = subjectId; - } - - public String getJiaoCaiName() { - return JiaoCaiName; - } - - public void setJiaoCaiName(String jiaoCaiName) { - JiaoCaiName = jiaoCaiName; - } - - @Override - public String toString() { - return "JiaoCai{" + - "ID='" + ID + '\'' + - ", SubjectId='" + SubjectId + '\'' + - ", JiaoCaiName='" + JiaoCaiName + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/Knowledge.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/Knowledge.java deleted file mode 100644 index a500a9b..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/Knowledge.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class Knowledge implements Serializable { - - private String Name; - - private String SubjectId; - - private String Id; - - public String getId() { - return Id; - } - - public void setId(String id) { - Id = id; - } - - public String getName() { - return Name; - } - - public void setName(String name) { - Name = name; - } - - public String getSubjectId() { - return SubjectId; - } - - public void setSubjectId(String subjectId) { - SubjectId = subjectId; - } - - @Override - public String toString() { - return "Knowledge{" + - "Name='" + Name + '\'' + - ", SubjectId='" + SubjectId + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/MyTask.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/MyTask.java deleted file mode 100644 index 21a60ec..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/MyTask.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sincere.weigeng; - -import com.baidu.aip.ocr.AipOcr; -import com.baidu.aip.util.Base64Util; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.json.JSONObject; -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; - -import java.util.HashMap; - -@Component -public class MyTask implements ApplicationRunner { - - - - @Override - public void run(ApplicationArguments args) throws Exception { - - System.out.println("authon:" + AuthService.getAuth()); - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/QuestionBean.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/QuestionBean.java deleted file mode 100644 index 7430f92..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/QuestionBean.java +++ /dev/null @@ -1,277 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class QuestionBean implements Serializable { - - - private String ID; - - private String Question; - - private String Qtype; - - private String Answer; - - private String CorrectAnswer; - - private String Analysis; - - private String State; - - private String Intime; - - private String ExamineFlag; - - private String ExamineUserId; - - private String CreateUserId; - - private String SubjectId; - - private String SchoolId; - - private String DifficulteId; - - private String KnowledgeId; - - private String ChapterId; - - private String GradeId; - - private String SourceId; - - private String OrderId; - - private String SId; - - private String StemId; - - private String AutomaticCorrection; - - private String PkgId; - - private String PkgType; - - public String getQuestion() { - return Question; - } - - public void setQuestion(String question) { - Question = question; - } - - public String getQtype() { - return Qtype; - } - - public void setQtype(String qtype) { - Qtype = qtype; - } - - public String getAnswer() { - return Answer; - } - - public void setAnswer(String answer) { - Answer = answer; - } - - public String getCorrectAnswer() { - return CorrectAnswer; - } - - public void setCorrectAnswer(String correctAnswer) { - CorrectAnswer = correctAnswer; - } - - public String getAnalysis() { - return Analysis; - } - - public void setAnalysis(String analysis) { - Analysis = analysis; - } - - public String getState() { - return State; - } - - public void setState(String state) { - State = state; - } - - public String getIntime() { - return Intime; - } - - public void setIntime(String intime) { - Intime = intime; - } - - public String getExamineFlag() { - return ExamineFlag; - } - - public void setExamineFlag(String examineFlag) { - ExamineFlag = examineFlag; - } - - public String getExamineUserId() { - return ExamineUserId; - } - - public void setExamineUserId(String examineUserId) { - ExamineUserId = examineUserId; - } - - public String getCreateUserId() { - return CreateUserId; - } - - public void setCreateUserId(String createUserId) { - CreateUserId = createUserId; - } - - public String getSubjectId() { - return SubjectId; - } - - public void setSubjectId(String subjectId) { - SubjectId = subjectId; - } - - public String getSchoolId() { - return SchoolId; - } - - public void setSchoolId(String schoolId) { - SchoolId = schoolId; - } - - public String getDifficulteId() { - return DifficulteId; - } - - public void setDifficulteId(String difficulteId) { - DifficulteId = difficulteId; - } - - public String getKnowledgeId() { - return KnowledgeId; - } - - public void setKnowledgeId(String knowledgeId) { - KnowledgeId = knowledgeId; - } - - public String getChapterId() { - return ChapterId; - } - - public void setChapterId(String chapterId) { - ChapterId = chapterId; - } - - public String getGradeId() { - return GradeId; - } - - public void setGradeId(String gradeId) { - GradeId = gradeId; - } - - public String getSourceId() { - return SourceId; - } - - public void setSourceId(String sourceId) { - SourceId = sourceId; - } - - public String getOrderId() { - return OrderId; - } - - public void setOrderId(String orderId) { - OrderId = orderId; - } - - public String getSId() { - return SId; - } - - public void setSId(String SId) { - this.SId = SId; - } - - public String getStemId() { - return StemId; - } - - public void setStemId(String stemId) { - StemId = stemId; - } - - public String getAutomaticCorrection() { - return AutomaticCorrection; - } - - public void setAutomaticCorrection(String automaticCorrection) { - AutomaticCorrection = automaticCorrection; - } - - public String getPkgId() { - return PkgId; - } - - public void setPkgId(String pkgId) { - PkgId = pkgId; - } - - public String getPkgType() { - return PkgType; - } - - public void setPkgType(String pkgType) { - PkgType = pkgType; - } - - public String getID() { - return ID; - } - - public void setID(String ID) { - this.ID = ID; - } - - @Override - public String toString() { - return "QuestionBean{" + - "ID='" + ID + '\'' + - ", Question='" + Question + '\'' + - ", Qtype='" + Qtype + '\'' + - ", Answer='" + Answer + '\'' + - ", CorrectAnswer='" + CorrectAnswer + '\'' + - ", Analysis='" + Analysis + '\'' + - ", State='" + State + '\'' + - ", Intime='" + Intime + '\'' + - ", ExamineFlag='" + ExamineFlag + '\'' + - ", ExamineUserId='" + ExamineUserId + '\'' + - ", CreateUserId='" + CreateUserId + '\'' + - ", SubjectId='" + SubjectId + '\'' + - ", SchoolId='" + SchoolId + '\'' + - ", DifficulteId='" + DifficulteId + '\'' + - ", KnowledgeId='" + KnowledgeId + '\'' + - ", ChapterId='" + ChapterId + '\'' + - ", GradeId='" + GradeId + '\'' + - ", SourceId='" + SourceId + '\'' + - ", OrderId='" + OrderId + '\'' + - ", SId='" + SId + '\'' + - ", StemId='" + StemId + '\'' + - ", AutomaticCorrection='" + AutomaticCorrection + '\'' + - ", PkgId='" + PkgId + '\'' + - ", PkgType='" + PkgType + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentAnswer.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentAnswer.java deleted file mode 100644 index 050e488..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentAnswer.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class StudentAnswer implements Serializable { - - private String ID; - - private String CorrectAnswer; - - private String Answer; - - public String getID() { - return ID; - } - - public String getAnswer() { - return Answer; - } - - public void setAnswer(String answer) { - Answer = answer; - } - - public void setID(String ID) { - this.ID = ID; - } - - public String getCorrectAnswer() { - return CorrectAnswer; - } - - public void setCorrectAnswer(String correctAnswer) { - CorrectAnswer = correctAnswer; - } - - @Override - public String toString() { - return "StudentAnswer{" + - "ID='" + ID + '\'' + - ", CorrectAnswer='" + CorrectAnswer + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentBean.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentBean.java deleted file mode 100644 index a874e09..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentBean.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; -import java.util.Date; - -public class StudentBean implements Serializable { - - - private long ID; - private String UserId; - - private String CustomerId; - - private int StudentType; - - private int UserType; - - private String Name; - - private int ClassId; - - private String ClassName; - - private String OldCard; - - private String Card; - - private int SchoolId; - - private int school_id; - - private int IsNew; - - private int UpdateType; - - private Date AddTime; - - private int Sex; - - private String Face; - - private String StudentCode; - - private String student_num; - - private String student_id; - - public String getUserId() { - return UserId; - } - - public void setUserId(String userId) { - UserId = userId; - } - - public String getCustomerId() { - return CustomerId; - } - - public void setCustomerId(String customerId) { - CustomerId = customerId; - } - - public int getStudentType() { - return StudentType; - } - - public void setStudentType(int studentType) { - StudentType = studentType; - } - - public int getUserType() { - return UserType; - } - - public void setUserType(int userType) { - UserType = userType; - } - - public String getName() { - return Name; - } - - public void setName(String name) { - Name = name; - } - - public int getClassId() { - return ClassId; - } - - public void setClassId(int classId) { - ClassId = classId; - } - - public String getClassName() { - return ClassName; - } - - public void setClassName(String className) { - ClassName = className; - } - - public String getOldCard() { - return OldCard; - } - - public void setOldCard(String oldCard) { - OldCard = oldCard; - } - - public String getCard() { - return Card; - } - - public int getSchool_id() { - return school_id; - } - - public void setSchool_id(int school_id) { - this.school_id = school_id; - } - - public String getStudent_num() { - return student_num; - } - - public void setStudent_num(String student_num) { - this.student_num = student_num; - } - - public void setCard(String card) { - Card = card; - } - - public int getSchoolId() { - return SchoolId; - } - - public void setSchoolId(int schoolId) { - SchoolId = schoolId; - } - - public int getIsNew() { - return IsNew; - } - - public void setIsNew(int isNew) { - IsNew = isNew; - } - - public int getUpdateType() { - return UpdateType; - } - - public void setUpdateType(int updateType) { - UpdateType = updateType; - } - - public Date getAddTime() { - return AddTime; - } - - public void setAddTime(Date addTime) { - AddTime = addTime; - } - - public int getSex() { - return Sex; - } - - public void setSex(int sex) { - Sex = sex; - } - - public String getFace() { - return Face; - } - - public void setFace(String face) { - Face = face; - } - - public String getStudentCode() { - return StudentCode; - } - - public void setStudentCode(String studentCode) { - StudentCode = studentCode; - } - - public long getID() { - return ID; - } - - public void setID(long ID) { - this.ID = ID; - } - - public String getStudent_id() { - return student_id; - } - - public void setStudent_id(String student_id) { - this.student_id = student_id; - } - - @Override - public String toString() { - return "StudentBean{" + - "ID=" + ID + - ", UserId='" + UserId + '\'' + - ", CustomerId='" + CustomerId + '\'' + - ", StudentType=" + StudentType + - ", UserType=" + UserType + - ", Name='" + Name + '\'' + - ", ClassId=" + ClassId + - ", ClassName='" + ClassName + '\'' + - ", OldCard='" + OldCard + '\'' + - ", Card='" + Card + '\'' + - ", SchoolId=" + SchoolId + - ", school_id=" + school_id + - ", IsNew=" + IsNew + - ", UpdateType=" + UpdateType + - ", AddTime=" + AddTime + - ", Sex=" + Sex + - ", Face='" + Face + '\'' + - ", StudentCode='" + StudentCode + '\'' + - ", student_num='" + student_num + '\'' + - ", student_id='" + student_id + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentInfo.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentInfo.java deleted file mode 100644 index 726f1cc..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class StudentInfo implements Serializable { - - private String student_id; - - private String name; - - private String class_name; - - private String ParentMobile; - - private String studentcode; - - - public String getStudentcode() { - return studentcode; - } - - public void setStudentcode(String studentcode) { - this.studentcode = studentcode; - } - - public String getStudent_id() { - return student_id; - } - - public void setStudent_id(String student_id) { - this.student_id = student_id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getClass_name() { - return class_name; - } - - public void setClass_name(String class_name) { - this.class_name = class_name; - } - - public String getParentMobile() { - return ParentMobile; - } - - public void setParentMobile(String parentMobile) { - ParentMobile = parentMobile; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/TestDao.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/TestDao.java deleted file mode 100644 index 9c1ef65..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/TestDao.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.sincere.weigeng; - -import org.apache.ibatis.annotations.*; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -@Mapper -public interface TestDao { - - - @Insert("insert into TK_QuestionStem values(#{QuestionStem},#{State},#{Intime})") - int addQuestionStem(@Param("QuestionStem") String QuestionStem, @Param("State") String State, @Param("Intime") String Intime); - - @Insert("insert into TK_Question(Question,Qtype,Answer,CorrectAnswer,Analysis,State,Intime,ExamineFlag,ExamineUserId,CreateUserId,SubjectId,SchoolId,DifficulteId,KnowledgeId,ChapterId,GradeId,SourceId,OrderId,SId," + - "StemId,AutomaticCorrection,PkgId,PkgType) " + - "values(#{Question},#{Qtype},#{Answer},#{CorrectAnswer},#{Analysis},#{State},#{Intime},#{ExamineFlag},#{ExamineUserId}" + - ",#{CreateUserId},#{SubjectId},#{SchoolId},#{DifficulteId},#{KnowledgeId},#{ChapterId},#{GradeId},#{SourceId},#{OrderId},#{SId}" + - ",#{StemId},#{AutomaticCorrection},#{PkgId},#{PkgType})") - int addQuestion(@Param("Question") String Question, @Param("Qtype") String Qtype, @Param("Answer") String Answer, @Param("CorrectAnswer") String CorrectAnswer - , @Param("Analysis") String Analysis, @Param("State") String State, @Param("Intime") String Intime, @Param("ExamineFlag") String ExamineFlag, @Param("ExamineUserId") String ExamineUserId - , @Param("CreateUserId") String CreateUserId, @Param("SubjectId") String SubjectId, @Param("SchoolId") String SchoolId, @Param("DifficulteId") String DifficulteId, @Param("KnowledgeId") String KnowledgeId - , @Param("ChapterId") String ChapterId, @Param("GradeId") String GradeId, @Param("SourceId") String SourceId, @Param("OrderId") String OrderId, @Param("SId") String SId - , @Param("StemId") String StemId, @Param("AutomaticCorrection") String AutomaticCorrection, @Param("PkgId") String PkgId, @Param("PkgType") String PkgType); - - @Select("select Top(1) ID from TK_QuestionStem order by Intime desc ") - int getStemId(); - - @Select("select * from TK_Question where Question like #{Question}") - List getQuestions(@Param("Question")String Question); - - @Update("update TK_Question set CorrectAnswer = #{answer},Analysis = #{explanation} where ID = #{id}") - void updateQuestion(@Param("id") String id, @Param("answer") String answer, @Param("explanation") String explanation); - - - //学生做作业 - @Insert("insert into ZY_StudentAnswer (QuestionId,Answer,CorrectAnswer,QuestionType,IsCorrect,WorkID) values (" + - "#{QuestionId},#{Answer},#{CorrectAnswer},#{QuestionType},#{IsCorrect},#{WorkID})") - void StudentAnswer(@Param("QuestionId")String QuestionId,@Param("Answer")String Answer,@Param("CorrectAnswer")String CorrectAnswer, - @Param("QuestionType")String QuestionType,@Param("IsCorrect")String IsCorresct,@Param("WorkID")String WorkID); - - @Insert("insert into ZY_HomeworkReceive values(#{WorkId},#{ClassId},#{StudentId},#{StudnetAnswerIds},#{IsFinished}," + - "#{AnswerTime},#{FinishTime},#{Intime},#{IsPigai},#{IsPigai})") - void HomeworkReceive(@Param("WorkId")String WorkId,@Param("ClassId")String ClassId,@Param("StudentId")String StudentId,@Param("StudnetAnswerIds")String StudnetAnswerIds, - @Param("IsFinished")String IsFinished,@Param("AnswerTime")String AnswerTime,@Param("FinishTime")String FinishTime,@Param("Intime")String Intime, - @Param("IsPigai")String IsPigai,@Param("IsPigai")String UseTime); - - @Select("select * from TK_Question where ID = #{ID}") - QuestionBean getQues(@Param("ID")String ID); - - @Select("select StudentId from ZY_HomeworkReceive where WorkId = #{WorkId}") - List getStudentIds(@Param("WorkId")String WorkId); -// ) - - @Select("select ID from TK_Question where SchoolId = 885 and CorrectAnswer in('A','B','C','D') and ChapterId = #{ChapterId}") - List getQIDS(@Param("ChapterId")String ChapterId ); - - @Select("select ID from ZY_StudentAnswer where WorkID = #{WorkID}") - List getStudentAnsIds(@Param("WorkID")String WorkID); - - //添加学生答题记录 - @Insert("insert into ZY_StudentAnswer values (#{QuestionId},#{Answer},#{AnswerTime},#{CorrectAnswer},#{QuestionType},#{Pigai},#{IsCorrect},#{AppachIds},#{TeacherAppachIds},#{WorkID})") - void addStudentAnswer(@Param("QuestionId")String QuestionId,@Param("Answer")String Answer,@Param("AnswerTime")String AnswerTime,@Param("CorrectAnswer")String CorrectAnswer, - @Param("QuestionType")String QuestionType,@Param("Pigai")String Pigai,@Param("IsCorrect")String IsCorrect,@Param("AppachIds")String AppachIds, - @Param("TeacherAppachIds")String TeacherAppachIds,@Param("WorkID")String WorkID); - - - @Select("select Top(#{top}) ID from ZY_StudentAnswer where WorkID = #{WorkID} order by ID desc") - List getTopIDs(@Param("WorkID")String WorkID,@Param("top")int top); - - @Select("select ID from ZY_HomeworkReceive where WorkId = #{WorkId} and ID >= #{ID} and ID<12054 order by ID desc") - List get_HomeworkReceive(@Param("WorkId")String WorkId,@Param("ID")String ID); - - @Update("update ZY_HomeworkReceive set StudnetAnswerIds = #{StudnetAnswerIds} where ID = #{ID}") - void updateHomeWork(@Param("StudnetAnswerIds")String StudnetAnswerIds,@Param("ID")String ID); - - @Select("select * from ZY_HomeworkReceive where WorkId = #{WorkId} order by ID desc") - List get_HomeworkRec(@Param("WorkId")String WorkId); - - @Select("select Title from ZY_Homework where ID = #{ID} order by ID desc") - String getWorkName(@Param("ID") String workId); - - @Select("select * from ZY_StudentAnswer where WorkID = #{WorkId}") - List get_stuAnswer(@Param("WorkId")String WorkId); - - @Update("update ZY_StudentAnswer set Answer = #{Answer},IsCorrect = #{IsCorrect} ,CorrectAnswer = #{CorrectAnswer} where ID = #{ID}") - void updateStudentAnswer(@Param("ID") String id,@Param("CorrectAnswer")String CorrectAnswer,@Param("Answer")String Answer,@Param("IsCorrect")String IsCorrect); - - @Select("select name from SZ_V_School_Student where student_id = #{student_id}") - String getStudentName(@Param("student_id") String studentId); - - @Select("select student_id from SZ_V_School_Student where class_id = #{class_id}") - List getStudentIdsWithClassId(@Param("class_id") String class_id); - - @Select("select IsCorrect from ZY_StudentAnswer where ID = #{ID}") - int getIsCorrect(@Param("ID") String id); - - @Select("select QuestionId from ZY_StudentAnswer where WorkID = #{WorkID}") - List getStuAnsIds(@Param("WorkID") String workId); - - @Select("select CorrectAnswer from ZY_StudentAnswer where WorkID = #{WorkID}") - List correctAns(@Param("WorkID")String WorkID); - - - @Select("select * from ZY_TestPaper where CreatorUserId = #{CreateUserId} and Intime > #{Intime}") - List getTestPapers(@Param("CreateUserId") String createUserId,@Param("Intime")String Intime); - - @Insert("insert into ZY_TestPaper values (#{addCreateUserId},#{questionIds},#{status},#{publishTime},#{name},#{isRecommend},#{state},#{intime},#{schoolId})") - void addTestPaper(@Param("addCreateUserId") String addCreateUserId, @Param("questionIds") String questionIds, @Param("status") int status, - @Param("publishTime") String publishTime, @Param("name") String name, @Param("isRecommend") int isRecommend, - @Param("state") int state, @Param("intime") String intime, @Param("schoolId") String schoolId); - - @Insert("insert into ZY_Homework values(#{addCreateUserId},#{id},#{name},#{s},#{s1},#{s2},#{s3},#{i},#{i1},#{i2},#{s4},#{i3},#{questionIds},#{i4},#{i5}) ") - void addHomework(@Param("addCreateUserId") String addCreateUserId, @Param("id") int id, @Param("name") String name, - @Param("s") String s, @Param("s1") String s1, @Param("s2") String s2, @Param("s3") String s3, @Param("i") int i, - @Param("i1") int i1, @Param("i2") int i2,@Param("s4") String s4, @Param("i3") int i3, @Param("questionIds") String questionIds, @Param("i4") int i4, @Param("i5") int i5); - - - @Select("select * from ZY_Homework where CreatorUserId in (select DISTINCT user_id from SZ_UserRole where school_id = 11)") - List getCreatorUserId(); - - @Select("select * from ZY_Homework where CreatorUserId = #{CreatorUserId}") - List getHomeWork(@Param("CreatorUserId") String addCreateUserId); - - @Select("select * from SZ_V_School_Student where school_id = #{school_id}") - List getStudents(@Param("school_id") int school_id); - - @Select("select QuestionIds from ZY_Homework where ID = #{workId}") - String getQuestionIds(@Param("workId") String workId); - - @Select("select CorrectAnswer from TK_Question where ID = #{questionId}") - String getCorrectAnswer(@Param("questionId") String questionId); - - - - -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/TestPaper.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/TestPaper.java deleted file mode 100644 index 62780ac..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/TestPaper.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class TestPaper implements Serializable { - - private int ID; - - private String CreatorUserId; - - private String QuestionIds; - - private int Status; - - private String PublishTime; - - private String Name; - - private int IsRecommend; - - private int State; - - private String Intime; - - private int SchoolId; - - public String getCreatorUserId() { - return CreatorUserId; - } - - public void setCreatorUserId(String creatorUserId) { - CreatorUserId = creatorUserId; - } - - public String getQuestionIds() { - return QuestionIds; - } - - public void setQuestionIds(String questionIds) { - QuestionIds = questionIds; - } - - public int getStatus() { - return Status; - } - - public int getID() { - return ID; - } - - public void setID(int ID) { - this.ID = ID; - } - - public void setStatus(int status) { - Status = status; - } - - public String getPublishTime() { - return PublishTime; - } - - public void setPublishTime(String publishTime) { - PublishTime = publishTime; - } - - public String getName() { - return Name; - } - - public void setName(String name) { - Name = name; - } - - public int getIsRecommend() { - return IsRecommend; - } - - public void setIsRecommend(int isRecommend) { - IsRecommend = isRecommend; - } - - public int getState() { - return State; - } - - public void setState(int state) { - State = state; - } - - public String getIntime() { - return Intime; - } - - public void setIntime(String intime) { - Intime = intime; - } - - public int getSchoolId() { - return SchoolId; - } - - public void setSchoolId(int schoolId) { - SchoolId = schoolId; - } - - @Override - public String toString() { - return "TestPaper{" + - "ID=" + ID + - ", CreatorUserId='" + CreatorUserId + '\'' + - ", QuestionIds='" + QuestionIds + '\'' + - ", Status=" + Status + - ", PublishTime='" + PublishTime + '\'' + - ", Name='" + Name + '\'' + - ", IsRecommend=" + IsRecommend + - ", State=" + State + - ", Intime='" + Intime + '\'' + - ", SchoolId=" + SchoolId + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/WatchServer.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/WatchServer.java deleted file mode 100644 index 5e4dbb2..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/WatchServer.java +++ /dev/null @@ -1,530 +0,0 @@ -package com.sincere.weigeng; - - -import com.sincere.common.dto.smartCampus.UserDto; -import com.sincere.common.dto.xiaoan.CheckInDto; -import com.sincere.common.dto.xiaoan.CheckOutDto; -import com.sincere.common.dto.xiaoan.PassFailDto; -import com.sincere.common.dto.xiaoan.SendMessageDto; -import com.sincere.common.util.DateUtils; -import com.sincere.weigeng.feign.SmFeign; -import com.sincere.weigeng.feign.XaFeign; -import com.sincere.weigeng.logs.LogName; -import com.sincere.weigeng.logs.LoggerUtils; -import com.sincere.weigeng.utils.WGUtils; -import com.sincere.weigeng.utils.WatchingShortHandler; -import com.sincere.weigeng.utils.WgUdpCommShort; -import org.apache.commons.lang3.StringUtils; -import org.apache.mina.core.session.IoSession; -import org.apache.mina.transport.socket.DatagramSessionConfig; -import org.apache.mina.transport.socket.nio.NioDatagramAcceptor; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -/** - * @author chen - * @version 1.0 - * @date 2019/10/12 0012 16:57 - */ - -@Component -public class WatchServer implements ApplicationRunner { - - private static final Logger Log_orderSuccess = LoggerUtils.Logger(LogName.orderSuccess); - private static final Logger Log_orderFail = LoggerUtils.Logger(LogName.orderFail); - private static final Logger Log_kaoInfo = LoggerUtils.Logger(LogName.kaoInfo); - private static final Logger Log_heartBeat = LoggerUtils.Logger(LogName.heartBeat); - private static final Logger Log_error = LoggerUtils.Logger(LogName.error); - - private static List snoList = new ArrayList<>(); - private static List indexList = new ArrayList<>(); - private static WatchingShortHandler watchingShortHandler ; - private static Queue queue = new LinkedList<>(); - private static Map sessionMap = new ConcurrentHashMap<>(); - - @Autowired - SmFeign smFeign; - - @Autowired - XaFeign xaFeign; - - private static String ip = "172.16.3.175"; - private static int port = 1200; - - @Override - public void run(ApplicationArguments args) { - //启动服务监听 - this.WatchingServerRunning(ip,port); - } - - // 进入服务器监控状态 - public int WatchingServerRunning(String watchServerIP,int watchServerPort) { - watchingShortHandler = new WatchingShortHandler(queue,sessionMap); - // 创建UDP数据包NIO - NioDatagramAcceptor acceptor = new NioDatagramAcceptor(); - // NIO设置底层IOHandler - acceptor.setHandler(watchingShortHandler); - - // 设置是否重用地址? 也就是每个发过来的udp信息都是一个地址? - DatagramSessionConfig dcfg = acceptor.getSessionConfig(); - dcfg.setReuseAddress(false); - // 绑定端口地址 - try { - acceptor.bind(new InetSocketAddress(watchServerIP, watchServerPort)); - } catch (IOException e) { - Log_orderSuccess.info("绑定接收服务器失败...."); - e.printStackTrace(); - return 0; - } - Log_orderSuccess.info("绑定接收服务器成功...."); - long recordIndex = 0; - while(true) { - if (!queue.isEmpty()) { - byte[] recvBuff; - synchronized (queue) { - recvBuff= queue.poll(); - } - if (recvBuff[1]== 0x20) { - long sn = WgUdpCommShort.getLongByByte(recvBuff, 4, 4); - smFeign.updateLinkTime(sn+""); - Log_heartBeat.info("设备"+sn); - boolean isExist = true ; - long recordIndexGet = WgUdpCommShort.getLongByByte(recvBuff, 8, 4); - if(snoList.indexOf(sn) >= 0){ - int number = snoList.indexOf(sn); - recordIndex = indexList.get(number); - indexList.set(number,recordIndexGet); - }else { - snoList.add(sn); - recordIndex = 0 ; - indexList.add(recordIndexGet); - System.out.println("设备"+sn+"上线"); - isExist = false ; - } - if(isExist){ - if (recordIndex < recordIndexGet || (recordIndexGet - recordIndex) < -5) { - watching(recvBuff); - } - } - }else { - push(recvBuff); - } - } else { - long times = 100; - try { - Thread.sleep(times); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - } - - private void watching(byte[] recv){ - long res = 0; - //8-11 记录的索引号 - //(=0表示没有记录) 4 0x00000000 - int recordIndex = 0; - recordIndex = WGUtils.byteToInt(recv, 8, 4); - //12 记录类型********************************************** - //0=无记录 - //1=刷卡记录 - //2=门磁,按钮, 设备启动, 远程开门记录 - //3=报警记录 1 - //0xFF=表示指定索引位的记录已被覆盖掉了. 请使用索引0, 取回最早一条记录的索引值 - int recordType = recv[12]; - - //13 有效性(0 表示不通过, 1表示通过) 1 - int recordValid = recv[13]; - - //14 门号(1,2,3,4) 1 业务需要-->1出2进 - int recordDoorNO = recv[14]; - - //15 进门/出门(1表示进门, 2表示出门) 1 0x01 - //int recordInOrOut = recv[15]; - - //16-19 卡号(类型是刷卡记录时) - //或编号(其他类型记录) 4 - String cardNo = WGUtils.getCardNo(recv, 16, 4); - - //20-26 刷卡时间: - //年月日时分秒 (采用BCD码)见设置时间部分的说明 - String recordTime = "2000-01-01 00:00:00"; - recordTime = String.format("%02X%02X-%02X-%02X %02X:%02X:%02X", - recv[20], recv[21], recv[22], recv[23], recv[24], recv[25], recv[26]); - //2012.12.11 10:49:59 7 - //27 记录原因代码(可以查 “刷卡记录说明.xls”文件的ReasonNO) - //处理复杂信息才用 1 - int reason = recv[27]; - if (recordType == 0) { - Log_orderSuccess.info(String.format("索引位={0} 无记录", recordIndex)); - }else if (recordType == 0xff) { - Log_orderSuccess.info("指定索引位的记录已被覆盖掉了,请使用索引0, 取回最早一条记录的索引值"); - } else if (recordType == 1) { - long sno = 0; - sno = WgUdpCommShort.getLongByByte(recv, 4, 4);//解析设备号 - String msg = "索引位=" + recordIndex - + ",卡号=" + cardNo - +"进出=" + (recordDoorNO == 1 ? "出门" : "进门") - + ",有效=" + (recordValid == 1 ? "通过" : "禁止") - + ",时间=" + recordTime - + ",描述=" + WGUtils.getReasonDetailChinese(reason) + ""; - Log_orderSuccess.info("控制器:" + sno + msg); - if(recordValid == 1) { - //有效刷卡调考勤存储过程 - CheckInDto checkIn = new CheckInDto(); - checkIn.setDeviceId(sno+""); - checkIn.setCardNo(cardNo); - checkIn.setFunNo(8); - checkIn.setFlag(recordDoorNO == 1 ? 1 : 0); - checkIn.setCheckTime(recordTime); - CheckOutDto checkOutDto = xaFeign.checkIn(checkIn); - if(checkOutDto.getIsSuccess() == 1){ - //考勤成功 - String nowDate = DateUtils.date2String(new Date(),DateUtils.format2); - Log_kaoInfo.info("考勤成功!,设备:"+sno+"卡号:"+cardNo+"方向:"+(recordDoorNO == 1 ? "出门" : "进门")+"______刷卡时间"+ recordTime+";入库时间:"+nowDate); - }else { - //考勤失败 - Log_orderFail.error("考勤失败!,设备:"+sno+"卡号:"+cardNo + "---"+ checkOutDto.getOut()); - } - }else { - //判断是否请假 - String studentNum = smFeign.checkLeave(cardNo); - if (StringUtils.isNotBlank(studentNum)) { - int outOf = recordDoorNO == 1 ? 1 : 0; - //远程开门 - openDoor(sno,"64",recordDoorNO,cardNo); - Log_orderSuccess.info("请假开门成功"+cardNo); - } else { - //没有请假不做任何处理,则是刷卡异常,入库 - UserDto user = smFeign.selectUserByCardNum(cardNo); - PassFailDto passFail = new PassFailDto(); - passFail.setCardNum(cardNo); - passFail.setDeviceId(sno+""); - passFail.setDirection((recordDoorNO == 1 ? "出门" : "进门")); - passFail.setResultIntro(WGUtils.getReasonDetailChinese(reason)); - passFail.setInTime(DateUtils.string2Date(recordTime, DateUtils.format2)); - passFail.setCreateTime(new Date()); - passFail.setSchoolId(user.getSchoolId()); - xaFeign.insertPassFail(passFail); - } - } - } - } - - private void push(byte[] recv){ - long index = WgUdpCommShort.getXidOfCommand(recv); - long sno = WgUdpCommShort.getLongByByte(recv, 4, 4); - String functionId = WGUtils.byte2Hex(recv[1]); - SendMessageDto sendMessage = xaFeign.selectMessage(sno+"",index,functionId); - if(sendMessage != null){ - if(recv[8] == 1){ - sendMessage.setCorrect(1); - }else { - sendMessage.setCorrect(0); - } - StringBuffer result = new StringBuffer(); - for(byte b : recv){ - result.append(WGUtils.byte2Hex(b)).append("-"); - } - sendMessage.setResult(result.toString().substring(0,result.toString().length()-1)); - xaFeign.updateMessage(sendMessage.getId(),sendMessage.getResult(),sendMessage.getCorrect()); - } - } - - //远程开门 - public long openDoor(long sno , String outsideOrderId,int doorNo , String cardNo){ - WgUdpCommShort pkt = new WgUdpCommShort(); - pkt.iDevSn = sno; - try{ - int doorNO =doorNo; - pkt.Reset(); - pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); - pkt.data[0] =(byte) (doorNO & 0xff); - if(StringUtils.isNotBlank(cardNo)){ - pkt.data[20] = WGUtils.toHex(cardNo.substring(0,2)); - pkt.data[21] = WGUtils.toHex(cardNo.substring(2,4)); - pkt.data[22] = WGUtils.toHex(cardNo.substring(4,6)); - pkt.data[23] = WGUtils.toHex(cardNo.substring(6,8)); - } - byte[] bytes = pkt.toByte(); - long index = WgUdpCommShort.getXidOfCommand(bytes); - long result = insert(sno+"",outsideOrderId,cardNo,index,bytes); - pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); - return result ; - }catch (Exception e){ - Log_error.error(e.toString()); - } - return 0L; - } - - //重置控制板时间 - public long setTime(long sno , String outsideOrderId){ - WgUdpCommShort pkt = new WgUdpCommShort(); - pkt.iDevSn = sno; - try{ - pkt.Reset(); - pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); - Calendar cal = (Calendar.getInstance()); - pkt.data[0] = WGUtils.toHex(String.valueOf(cal.get(Calendar.YEAR)).substring(0,2)); - pkt.data[1] = WGUtils.toHex(String.valueOf(cal.get(Calendar.YEAR)).substring(2,4)); - pkt.data[2] = WGUtils.toHex(String.valueOf(cal.get(Calendar.MONTH)+1)); - pkt.data[3] = WGUtils.toHex(String.valueOf(cal.get(Calendar.DATE))); - pkt.data[4] =WGUtils.toHex(String.valueOf(cal.get(Calendar.HOUR_OF_DAY))); - pkt.data[5] =WGUtils.toHex(String.valueOf(cal.get(Calendar.MINUTE))); - pkt.data[6] = WGUtils.toHex(String.valueOf(cal.get(Calendar.SECOND))); - byte[] bytes = pkt.toByte(); - long index = WgUdpCommShort.getXidOfCommand(bytes); - long result = insert(sno+"",outsideOrderId,null,index,bytes); - pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); - return result ; - }catch (Exception e){ - Log_error.error(e.toString()); - } - return 0L; - } - - //设置考勤时段 - public List SetAttendanceTime(long sno ,String outsideOrderId, int shiduan , Date begin ,Date end , - int isMonDay ,int isTuesDay , int isWednesDay ,int isThursDay , int isFriday , - int isSaturDay , int isWeekend , String shiqu){ - List resultList = new ArrayList<>(); - WgUdpCommShort pkt = new WgUdpCommShort(); - pkt.iDevSn = sno; - try{ - pkt.Reset(); - pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); - String[] shiQuArray = shiqu.split(","); - int shiDuanCount = shiQuArray.length / 6 ; - for (int i = 0; i < shiDuanCount; i++){ - if (i == 0) { - pkt.data[0] = WGUtils.toHex(shiduan+""); - } else { - pkt.data[0] = WGUtils.toHex((shiduan+20*i)+""); - } - Calendar c = Calendar.getInstance(); - c.setTime(begin); - //开始时间 20 19 01 01 - pkt.data[1] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2)); - pkt.data[2] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4)); - pkt.data[3] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1)); - pkt.data[4] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE))); - //结束时间 - c.setTime(end); - pkt.data[5] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2)); - pkt.data[6] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4)); - pkt.data[7] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1)); - pkt.data[8] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE))); - //星期几 有效 - pkt.data[9] = WGUtils.toHex(String.valueOf(isMonDay)); - pkt.data[10] = WGUtils.toHex(String.valueOf(isTuesDay)); - pkt.data[11] = WGUtils.toHex(String.valueOf(isWednesDay)); - pkt.data[12] = WGUtils.toHex(String.valueOf(isThursDay)); - pkt.data[13] = WGUtils.toHex(String.valueOf(isFriday)); - pkt.data[14] = WGUtils.toHex(String.valueOf(isSaturDay)); - pkt.data[15] = WGUtils.toHex(String.valueOf(isWeekend)); - //有效时区 - pkt.data[16] = WGUtils.toHex(shiQuArray[i * 6 + 0].substring(0, 2)); - pkt.data[17] = WGUtils.toHex(shiQuArray[i * 6 + 0].substring(3, 5)); - - pkt.data[18] = WGUtils.toHex(shiQuArray[i * 6 + 1].substring(0, 2)); - pkt.data[19] = WGUtils.toHex(shiQuArray[i * 6 + 1].substring(3, 5)); - - pkt.data[20] = WGUtils.toHex(shiQuArray[i * 6 + 2].substring(0, 2)); - pkt.data[21] = WGUtils.toHex(shiQuArray[i * 6 + 2].substring(3, 5)); - - pkt.data[22] = WGUtils.toHex(shiQuArray[i * 6 + 3].substring(0, 2)); - pkt.data[23] = WGUtils.toHex(shiQuArray[i * 6 + 3].substring(3, 5)); - - pkt.data[24] = WGUtils.toHex(shiQuArray[i * 6 + 4].substring(0, 2)); - pkt.data[25] = WGUtils.toHex(shiQuArray[i * 6 + 4].substring(3, 5)); - - pkt.data[26] = WGUtils.toHex(shiQuArray[i * 6 + 5].substring(0, 2)); - pkt.data[27] = WGUtils.toHex(shiQuArray[i * 6 + 5].substring(3, 5)); - if (shiDuanCount != 1) { - //需要链接时段 - if (i != shiDuanCount - 1) { - //只要不是最后一个时段 - pkt.data[28] = WGUtils.toHex((shiduan+20*(i+1)+"")); - } else { - pkt.data[28] = 0; - } - } else { - pkt.data[28] = 0; - } - byte[] bytes = pkt.toByte(); - long index = WgUdpCommShort.getXidOfCommand(bytes); - long result = insert(sno+"",outsideOrderId,null,index,bytes); - pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); - resultList.add(result); - } - return resultList ; - }catch (Exception e){ - Log_error.error(e.toString()); - } - return resultList; - } - - //设置权限 - public long SetSignalCardInfo(long sno , String outsideOrderId, String cardNo , int shiduan , Date begin , Date end){ - WgUdpCommShort pkt = new WgUdpCommShort(); - pkt.iDevSn = sno; - try{ - pkt.Reset(); - pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); - pkt.iDevSn = sno; - //0D D7 37 00 - pkt.data[0] = WGUtils.toHex(cardNo.substring(0,2)); - pkt.data[1] = WGUtils.toHex(cardNo.substring(2,4)); - pkt.data[2] = WGUtils.toHex(cardNo.substring(4,6)); - pkt.data[3] = WGUtils.toHex(cardNo.substring(6,8)); - - //20 10 01 01 起始日期: 2010年01月01日 (必须大于2001年) - Calendar c = Calendar.getInstance(); - c.setTime(begin); - pkt.data[4] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2)); - pkt.data[5] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4)); - pkt.data[6] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1)); - pkt.data[7] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE))); - //20 29 12 31 截止日期: 2029年12月31日 - c.setTime(end); - pkt.data[8] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2)); - pkt.data[9] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4)); - pkt.data[10] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1)); - pkt.data[11] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE))); - //01 允许通过 一号门 [对单门, 双门, 四门控制器有效] - pkt.data[12] = WGUtils.toHex(shiduan+""); - //01 允许通过 二号门 [对双门, 四门控制器有效] - pkt.data[13] = WGUtils.toHex(shiduan+""); - //01 允许通过 三号门 [对四门控制器有效] - pkt.data[14] = WGUtils.toHex(shiduan+""); - //01 允许通过 四号门 [对四门控制器有效] - pkt.data[15] = WGUtils.toHex(shiduan+""); - byte[] bytes = pkt.toByte(); - long index = WgUdpCommShort.getXidOfCommand(bytes); - long result = insert(sno+"",outsideOrderId,cardNo,index,bytes); - pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); - return result ; - }catch (Exception e){ - Log_error.error(e.toString()); - } - return 0l; - } - - //删除单张卡权限 - public long clearSinglePower(long sno ,String outsideOrderId, String cardNo){ - WgUdpCommShort pkt = new WgUdpCommShort(); - pkt.iDevSn = sno; - try{ - pkt.Reset(); - pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); - pkt.iDevSn = sno; - pkt.data[0] = WGUtils.toHex(cardNo.substring(0,2)); - pkt.data[1] = WGUtils.toHex(cardNo.substring(2,4)); - pkt.data[2] = WGUtils.toHex(cardNo.substring(4,6)); - pkt.data[3] = WGUtils.toHex(cardNo.substring(6,8)); - byte[] bytes = pkt.toByte(); - long index = WgUdpCommShort.getXidOfCommand(bytes); - long result = insert(sno+"",outsideOrderId,cardNo,index,bytes); - pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); - return result ; - }catch (Exception e){ - Log_error.error(e.toString()); - } - return 0l; - } - - //删除全部权限 - public long clearAllPower(long sno ,String outsideOrderId){ - WgUdpCommShort pkt = new WgUdpCommShort(); - pkt.iDevSn = sno; - try{ - pkt.Reset(); - pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); - pkt.iDevSn = sno; - pkt.data[0] = (byte) 0x55 ; - pkt.data[1] = (byte) 0xAA ; - pkt.data[2] = (byte) 0xAA ; - pkt.data[3] = (byte) 0x55 ; - byte[] bytes = pkt.toByte(); - long index = WgUdpCommShort.getXidOfCommand(bytes); - long result = insert(sno+"",outsideOrderId,null,index,bytes); - pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); - return result ; - }catch (Exception e){ - Log_error.error(e.toString()); - } - return 0l; - } - - //查询卡权限 - public long searchPower(long sno ,String outsideOrderId, String cardNo){ - WgUdpCommShort pkt = new WgUdpCommShort(); - pkt.iDevSn = sno; - try{ - pkt.Reset(); - pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); - pkt.iDevSn = sno; - pkt.data[0] = WGUtils.toHex(cardNo.substring(0,2)); - pkt.data[1] = WGUtils.toHex(cardNo.substring(2,4)); - pkt.data[2] = WGUtils.toHex(cardNo.substring(4,6)); - pkt.data[3] = WGUtils.toHex(cardNo.substring(6,8)); - byte[] bytes = pkt.toByte(); - long index = WgUdpCommShort.getXidOfCommand(bytes); - long result = insert(sno+"",outsideOrderId,cardNo,index,bytes); - pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); - return result ; - }catch (Exception e){ - Log_error.error(e.toString()); - } - return 0l; - } - - //删除时段 - public long clearShiDuan(long sno , String outsideOrderId){ - WgUdpCommShort pkt = new WgUdpCommShort(); - pkt.iDevSn = sno; - try{ - pkt.Reset(); - pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); - pkt.iDevSn = sno; - pkt.data[0] = (byte) 0x55 ; - pkt.data[1] = (byte) 0xAA ; - pkt.data[2] = (byte) 0xAA ; - pkt.data[3] = (byte) 0x55 ; - byte[] bytes = pkt.toByte(); - long index = WgUdpCommShort.getXidOfCommand(bytes); - long result = insert(sno+"",outsideOrderId,null,index,bytes); - pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); - return result ; - }catch (Exception e){ - Log_error.error(e.toString()); - } - return 0l; - } - - private long insert(String sn ,String functionId , String cardNo , long index , byte[] recv){ - - StringBuffer send = new StringBuffer(); - for(byte b : recv){ - send.append(WGUtils.byte2Hex(b)).append("-"); - } - SendMessageDto sendMessage = new SendMessageDto(); - sendMessage.setDeviceId(sn); - sendMessage.setFunctionId(Integer.toHexString(Integer.valueOf(functionId))); - sendMessage.setIndex(index); - sendMessage.setCardNo(cardNo); - sendMessage.setCreateTime(new Date()); - sendMessage.setSend(send.toString().substring(0,send.toString().length()-1)); - xaFeign.insertMessage(sendMessage); - return sendMessage.getId(); - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/WeigengApplication.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/WeigengApplication.java deleted file mode 100644 index 8eb7742..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/WeigengApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.sincere.weigeng; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class WeigengApplication { - - public static void main(String[] args) { - SpringApplication.run(WeigengApplication.class, args); - } - -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/dao/UserDao.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/dao/UserDao.java deleted file mode 100644 index 976e636..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/dao/UserDao.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sincere.weigeng.dao; - -import com.sincere.weigeng.JiaoCai; -import com.sincere.weigeng.Knowledge; -import org.apache.ibatis.annotations.*; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -@Mapper -public interface UserDao { - -// @Insert("insert into HS_StudentUpdateCard (Card,SchoolId,StudentCode,CustomerId,StudentType,UserType,ClassId,ClassName,IsNew,UpdateType,AddTime) " + -// "values (#{Card},#{SchoolId},#{StudentCode},#{CustomerId},#{StudentType},#{UserType},#{ClassId},#{ClassName},#{IsNew,#{UpdateType),#{AddTime}") -// void addStudentUpdate(@Param("Card") String card, @Param("SchoolId") int school_id, @Param("StudentCode") String studentCode, @Param("CustomerId") String CustomerId -// , @Param("StudentType") String StudentType, @Param("UserType") String UserType, @Param("ClassId") String ClassId, @Param("ClassName") String ClassName, -// @Param("IsNew") String IsNew, @Param("UpdateType") String UpdateType, @Param("AddTime") String AddTime); - - - @Select ("select * from ZY_YYKnowledge where AddTime >2019 ") - List getKnowledge(); - - @Select("select * from ZY_YYJiaoCai where ID >= 26") - List getJiaoCai(); - - @Insert("insert into ZY_YYJiaoCaiAndKnowledg values(#{id},#{id1},#{i},#{i1})") - void addKnowAndJicaoCai(@Param("id") String id, @Param("id1") String id1, @Param("i") int i, @Param("i1") int i1); -} diff --git a/cloud/weigeng/src/main/resources/application.yaml b/cloud/weigeng/src/main/resources/application.yaml deleted file mode 100644 index eedfbe5..0000000 --- a/cloud/weigeng/src/main/resources/application.yaml +++ /dev/null @@ -1,33 +0,0 @@ -server: - port: 1200 - -spring: - application: - name: weigen-server - profiles: - active: dev - datasource: - username: szjxtuser - password: RQminVCJota3H1u8bBYH - url: jdbc:sqlserver://116.62.155.137:33419;database=SmartCampus - driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver -# datasource: -# username: szjxtuser -# password: RQminVCJota3H1u8bBYH -# url: jdbc:sqlserver://116.62.155.137:33419;database=SmartAdmin - -eureka: - instance: - hostname: localhost - lease-expiration-duration-in-seconds: 60 - lease-renewal-interval-in-seconds: 10 - client: - service-url: - # defaultZone: http://localhost:8761/eureka/ - defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/ - - -mybatis: - type-aliases-package: com.sincere.weigeng.dao - mapper-locations: classpath:mapper/*.xml - config-location: classpath:mybatis-config.xml diff --git a/cloud/weigeng/src/main/resources/mybatis-config.xml b/cloud/weigeng/src/main/resources/mybatis-config.xml deleted file mode 100644 index f3b0c3f..0000000 --- a/cloud/weigeng/src/main/resources/mybatis-config.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cloud/weigeng/src/test/java/com/sincere/weigeng/WeigengApplicationTests.java b/cloud/weigeng/src/test/java/com/sincere/weigeng/WeigengApplicationTests.java deleted file mode 100644 index d24f749..0000000 --- a/cloud/weigeng/src/test/java/com/sincere/weigeng/WeigengApplicationTests.java +++ /dev/null @@ -1,570 +0,0 @@ -package com.sincere.weigeng; - -import com.drew.imaging.jpeg.JpegMetadataReader; -import com.drew.imaging.jpeg.JpegProcessingException; -import com.drew.metadata.Directory; -import com.drew.metadata.Metadata; -import com.drew.metadata.Tag; -import com.drew.metadata.exif.ExifDirectory; -import com.sincere.weigeng.dao.UserDao; -import org.apache.poi.hssf.usermodel.HSSFCell; -import org.apache.poi.hssf.usermodel.HSSFRow; -import org.apache.poi.hssf.usermodel.HSSFSheet; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; - -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.*; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.List; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class WeigengApplicationTests { - - @Autowired - TestDao testDao; - - @Test - public void contextLoads() { - - try { - BufferedReader bufferedReader = new BufferedReader(new FileReader("C:\\Users\\taohandong\\Desktop\\json.txt")); - String content = null; - StringBuilder stringBuilder = new StringBuilder(); - while ((content = bufferedReader.readLine()) != null) { - stringBuilder.append(content); - } - - JSONObject jsonObject = new JSONObject(stringBuilder.toString()); - JSONObject data = jsonObject.optJSONObject("data"); - JSONArray questions = data.optJSONArray("questions"); - for (int i = 0; i < questions.length(); i++) { - JSONObject question = questions.optJSONObject(i); - String question_text = question.optString("question_text"); - String answer = question.optString("answer");//答案 - String explanation = question.optString("explanation");//解析 -//

image.png

- explanation = "

\"image.png\"/

"; - answer = getAnswer(answer); - System.out.println("question_text:" + question_text + "\r\nanswer:" + answer + "\r\nexplanation:" + explanation); - List questionBeans = testDao.getQuestions(question_text);//获取题目 - for (int j = 0; j < questionBeans.size(); j++) { - QuestionBean questionBean = questionBeans.get(j); - testDao.updateQuestion(questionBean.getID(), answer, explanation); - } -// System.out.println(questionBeans.toString()); - } - - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - private String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token=24.26683b650b73b63e0b08afa7ac36e880.2592000.1571310480.282335-15990462"; - - private String getAnswer(String imgUrl) { - RestTemplate restTemplate = new RestTemplate(); - - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - - MultiValueMap multiValueMap = new LinkedMultiValueMap<>(); -// multiValueMap.add("image", ImageUtils.ImageToBase64ByLocal("C:\\Users\\taohandong\\Desktop\\识别.png")); - multiValueMap.add("url", imgUrl); - HttpEntity requestEntity = new HttpEntity(multiValueMap, - - headers); - - ResponseEntity result = restTemplate.postForEntity(url, requestEntity, String.class); - - JSONObject jsonObject = new JSONObject(result.getBody()); -// System.out.println("result:"+result.getBody()); - JSONArray words_result = jsonObject.optJSONArray("words_result"); -// System.out.println("words_result:"+words_result); - StringBuilder stringBuilder = new StringBuilder(); - if (words_result != null) { - for (int i = 0; i < words_result.length(); i++) { - String words = words_result.optJSONObject(i).optString("words"); - stringBuilder.append(words + " "); - } - System.out.println("result:" + stringBuilder.toString()); - } - return stringBuilder.toString().equals("") ? "B" : stringBuilder.toString(); - } - - @Test - public void get() { - -// String url = "https://zujuan.21cnjy.com/api/question/list?xd=1&chid=3&categories=3877&knowledges=&question_channel_type=1&difficult_index=&exam_type=&kid_num=&grade_id=&sort_field=time&filterquestion=0&page=&_grade_id=&tree_type=category&version_id=&_=1568766250186"; -// RestTemplate restTemplate = new RestTemplate(); -// System.out.println(restTemplate.getForObject(url, String.class)); - /*String createrUserId = "zy273789", time = "2019-10-08"; - List testPaperList = testDao.getTestPapers(createrUserId, time); - for (int i = 0; i < testPaperList.size(); i++) { - TestPaper testPaper = testPaperList.get(i); - int schoolId = 11; - testDao.addTestPaper("zy284782", testPaper.getQuestionIds(), testPaper.getStatus(), testPaper.getPublishTime(), - testPaper.getName(), testPaper.getIsRecommend(), testPaper.getState(), testPaper.getIntime(), schoolId + ""); - - }*/ - - } - - - /** - * 创建试卷 - */ - @Test - public void createTestPaper() { - String createUserId = "zy309728"; - List testPaperList = testDao.getTestPapers(createUserId, "2019-09-18 16:00:00"); - System.out.println("testPaperList:" + testPaperList.toString()); - - String addCreateUserId = "zy411337", SchoolId = "885"; - /* for (int i = 1; i < testPaperList.size(); i++) { - TestPaper testPaper = testPaperList.get(i); - int ID = testPaper.getID(); - //添加试卷 - testDao.addTestPaper(addCreateUserId, testPaper.getQuestionIds(), testPaper.getStatus(), testPaper.getPublishTime() - , testPaper.getName(), testPaper.getIsRecommend(), testPaper.getState(), testPaper.getIntime(), SchoolId); - - //发布作业 - testDao.addHomework(addCreateUserId, testPaper.getID(), testPaper.getName(), "50", "2019-09-20 18:00", "2", "2019-09-19 19:10", 1, 0, 1, "2019-09-19 19:10", 0, testPaper.getQuestionIds(), 0, 0); - }*/ - /*String[] answers = new String[]{"A", "B", "C", "D"}; - String QuestionType = "1"; - String CorrectAnswer = ""; - List homeworkList = testDao.getHomeWork(addCreateUserId); - for (int i = 0; i < homeworkList.size(); i++) { - Homework homework = homeworkList.get(i); - String[] questionIds = homework.getQuestionIds().split(","); - for (int j = 0; j < questionIds.length; j++) { - String questionId = questionIds[j]; - QuestionBean questionBean = testDao.getQues(questionId); - CorrectAnswer = questionBean.getCorrectAnswer(); - String answer = answers[new Random().nextInt(4)]; - String IsCorresct = answer.trim().equals(CorrectAnswer.trim()) ? "1" : "3"; - testDao.StudentAnswer(questionId, answer, CorrectAnswer, QuestionType, IsCorresct, homework.getID()); - } - - }*/ -// if (ID <= 4191 && ID >= 4187) { - String classId = "36398"; - List homeworkList = testDao.getHomeWork(addCreateUserId); - for (int i = 0; i < homeworkList.size(); i++) { - String workId = homeworkList.get(i).getID(); -// List stuAnsIds = testDao.getStudentAnsIds(workId); -// String stuAnIds = stuAnsIds.toString().replace("[", ""); -// stuAnIds = stuAnIds.replace("]", ""); - - List strings = testDao.getStudentIdsWithClassId(classId); - String stuIds = strings.toString().replace("[", ""); - stuIds = stuIds.replace("]", ""); - String[] stuStrings = stuIds.split(",");//学生id - - for (int j = 0; j < stuStrings.length; j++) { - String studentId = stuStrings[j]; - - testDao.HomeworkReceive(workId, classId, studentId, "", "1", j + "", "2019-09-23 21:28:00", "2019-09-22 17:50:00", "1", j + ""); - } - - } - - } - - @Autowired - UserDao userDao; - - @Test - public void doHomeWork() { - StudentBean studentBean = new StudentBean(); - studentBean.setCard("9A1229A9"); - studentBean.setSchool_id(110); - studentBean.setStudentCode("140881200710270056"); - studentBean.setCustomerId("583912"); - -// userDao.addStudentUpdate(studentBean.getCard(),studentBean.getSchool_id(),studentBean.getStudentCode(),studentBean.getCustomerId(),"1","2" -// ,"55640","2014级(08)班","0","1","2019-09-22 16:26"); - - /* String QuestionId = "21656, 21657, 21658, 21659, 21753, 21706, 21724, 21796, 21797, 21798"; - String Answer = ""; - String CorrectAnswer = ""; - String QuestionType = "1"; - String IsCorresct = ""; - String WorkID = "4198"; - String[] questionIds = QuestionId.split(","); - for (int i = 0; i < questionIds.length; i++) { - String questionId = questionIds[i]; - QuestionBean questionBean = testDao.getQues(questionId); - CorrectAnswer = questionBean.getCorrectAnswer(); - Answer = "B"; - IsCorresct = Answer.trim().equals(CorrectAnswer.trim()) ? "1" : "3"; - testDao.StudentAnswer(questionId, Answer, CorrectAnswer, QuestionType, IsCorresct, WorkID); - }*/ - - } - - - @Test - public void HomeworkRec() { - String WorkID = "4198"; - String ClassId = ""; - //查询学生id - List list = testDao.getStudentIds("4172"); - String StudentIds = list.toString().replace("[", ""); - StudentIds = StudentIds.replace("]", ""); - System.out.println("StudentIds:" + StudentIds); - String StudnetAnswerIds = testDao.getStudentAnsIds(WorkID).toString().replace("[", ""); - StudnetAnswerIds = StudnetAnswerIds.replace("]", ""); - String[] studentIds = StudentIds.split(","); - for (int i = 0; i < studentIds.length; i++) { - String studentId = studentIds[i]; - String finishTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); - testDao.HomeworkReceive(WorkID, ClassId, studentId, StudnetAnswerIds, "1", i + "", "2019-09-19 16:50", finishTime - , "1", "" + i); - } - } - - @Test - public void getQIds() { - - List knowledges = userDao.getKnowledge(); - System.out.println("knowledges:" + knowledges.toString()); - - List jiaoCais = userDao.getJiaoCai(); - System.out.println("jiaoCais:" + jiaoCais.toString()); - - for (int i = 0; i < 1; i++) { - JiaoCai jiaoCai = jiaoCais.get(i); - String SubjectId = jiaoCai.getSubjectId(); - for (int j = 0; j < knowledges.size(); j++) { - Knowledge knowledge = knowledges.get(j); - if (SubjectId.equals(knowledge.getSubjectId())) { - userDao.addKnowAndJicaoCai(jiaoCai.getID(), knowledge.getId(), 0, 1); - } - } - - } - - } - - @Test - public void tongji() { - - String[] answers = new String[]{"A", "B", "C", "D", "A", "A"}; - String createUserId = "zy411337"; - List homeworkList = testDao.getHomeWork(createUserId);//获取布置的作业 - System.out.println("homeworkList:" + homeworkList); - for (int m = 0; m < homeworkList.size(); m++) { - String WorkId = homeworkList.get(m).getID(); - Map> mapRecIDs = new HashMap<>(); - System.out.println("workId:" + WorkId); -// List queIds = testDao.getStuAnsIds(WorkId); -// String questionIds = queIds.toString().replace("[", ""); -// questionIds = questionIds.replace("]", ""); - - //获取正确答案 -// List correct = testDao.correctAns(WorkId); -// String corrStr = correct.toString().replace("[", ""); -// corrStr = corrStr.replace("]", ""); -// String[] correctAnser = corrStr.split(","); - - String questionIds = testDao.getQuestionIds(WorkId); - - //获取答题学生数量 - List homeworkReceiveIds = testDao.get_HomeworkReceive(WorkId, "12012"); - System.out.println("homeworkReceiveIds:" + homeworkReceiveIds.size()); - for (int j = 0; j < homeworkReceiveIds.size(); j++) {//接收学生数量 - - String[] quesStirngs = questionIds.split(","); - System.out.println("quesStirngs:" + quesStirngs.length); - for (int i = 0; i < quesStirngs.length; i++) { - String questionId = quesStirngs[i]; - String CorrectAnswer = testDao.getCorrectAnswer(questionId); - int randow = new Random().nextInt(6); - String answer = null; - String isCorrsct = ""; - if (randow == 0 || randow == 1 || randow == 2 || randow == 3 || randow == 4) { - answer = CorrectAnswer.trim(); - isCorrsct = "1"; - } else { - answer = answers[randow]; - isCorrsct = "3"; - } - //插入一条新的记录 - testDao.addStudentAnswer(quesStirngs[i], answer.trim(), "", CorrectAnswer.trim(), "1", "", isCorrsct, "", "", WorkId); - } - //获取最新的十条记录 - List idLists = testDao.getTopIDs(WorkId, questionIds.split(",").length); - System.out.println("idLists:" + idLists.toString()); - mapRecIDs.put(j + "", idLists); - } -// System.out.println("mapRecIDs:" + mapRecIDs.toString() + " 0:" + mapRecIDs.get("0").toString().replace("[", "")); - - for (int i = 0; i < homeworkReceiveIds.size(); i++) { - String homeRecId = homeworkReceiveIds.get(i); - System.out.println("i:" + i); - String ansIds = mapRecIDs.get(i + "").toString().replace("[", ""); - ansIds = ansIds.replace("]", ""); - testDao.updateHomeWork(ansIds, homeRecId); - } - - List homRecIDs = testDao.get_HomeworkRec(WorkId); - - Map stuMap = new HashMap<>(); - for (int i = 0; i < homRecIDs.size(); i++) { - HomeworkReceive homeworkReceive = homRecIDs.get(i); - - String studentId = homeworkReceive.getStudentId(); - - String studentName = testDao.getStudentName(studentId); - - String studnetAnswerIds = homeworkReceive.getStudnetAnswerIds(); - - String[] stuIds = studnetAnswerIds.split(","); - - String isC = ""; - for (int j = 0; j < stuIds.length; j++) { - String id = stuIds[j]; - int idCorrect = testDao.getIsCorrect(id); - if (idCorrect == 1) { - isC += "1 "; - } else if (idCorrect == 3) { - isC += "0 "; - } - } - stuMap.put(studentName, isC); - System.out.println("" + studentName + " " + isC); - - } - - } - } - - private void writeToExcel(HSSFWorkbook workbook, String HomeworkTitle, Map correctAns, String[] names, String title) { - //第二部,在workbook中创建一个sheet对应excel中的sheet - HSSFSheet sheet = workbook.createSheet(HomeworkTitle); - //第三部,在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制 - HSSFRow row = sheet.createRow(0); - //第四步,创建单元格,设置表头 - HSSFCell cell = null; - for (int i = 0; i < correctAns.get(names[0]).length; i++) { - cell = row.createCell(i); - cell.setCellValue("第" + (i + 1) + ""); - } - - //第五步,写入数据 - for (int i = 0; i < names.length; i++) { - -// String oneData =correctAns[i];//姓名对应的正确率 - HSSFRow row1 = sheet.createRow(i + 1); - String[] corrects = correctAns.get(names[i]); - System.out.println("names:" + names[i]); - for (int j = 0; j < corrects.length; j++) { - //创建单元格设值 - row1.createCell(j).setCellValue(corrects[j]); - } - row1.createCell(corrects.length).setCellValue(names[i]); - } - - //将文件保存到指定的位置 - try { - File file = new File("C:\\Users\\taohandong\\Desktop\\文澜\\"+title+".xls"); - if (!file.exists())file.createNewFile(); - FileOutputStream fos = new FileOutputStream(file); - workbook.write(fos); - System.out.println("写入成功"); - fos.close(); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - - @Test - public void getStu() { - //第一步,创建一个workbook对应一个excel文件 - HSSFWorkbook workbook = new HSSFWorkbook(); - - String createUserId = "zy595910"; - String title="作业"; - //ZY_Homework表取出要统计的作业 - String WorkId = "4408"; - String workName = testDao.getWorkName(WorkId); - - //ZY_HomeworkReceive 表获取学生作业答题情况; - List homRecIDs = testDao.get_HomeworkRec(WorkId); - - Map stuMap = new HashMap<>(); - String[] names = new String[homRecIDs.size()]; - String[] isCorrect = null; - for (int i = 0; i < homRecIDs.size(); i++) { - HomeworkReceive homeworkReceive = homRecIDs.get(i); - - String studentId = homeworkReceive.getStudentId(); - - String studentName = testDao.getStudentName(studentId); - - String studnetAnswerIds = homeworkReceive.getStudnetAnswerIds(); -// System.out.println("studnetAnswerIds:"+studnetAnswerIds+" WorkId:"+WorkId + " StudentId:"+studentId); - if (null != studnetAnswerIds) { - names[i] = studentName; - String[] stuIds = studnetAnswerIds.split(","); - isCorrect = new String[stuIds.length]; - String isC = ""; - for (int j = 0; j < stuIds.length; j++) { - String id = stuIds[j]; - System.out.println("IsCorrectId:" + id); - //ZY_StudentAnswer表获取题目是否正确 - int idCorrect = testDao.getIsCorrect(id); - if (idCorrect == 1) { - isC += "1 "; - isCorrect[j] = "1"; - } else if (idCorrect == 3) { - isC += "0 "; - isCorrect[j] = "0"; - } - } - stuMap.put(studentName, isCorrect); - System.out.println("" + studentName + " " + isC); - } - } - if (names!=null&&stuMap.size()>0) - writeToExcel(workbook, workName, stuMap, names,title); -// System.out.println("stuMap:" + stuMap.toString()); - } - - - /** - * 旋转图片 - */ - @Test - public void trnImgs() { - - File file = new File("C:\\TaoHandong\\copy\\school479\\StudentCompressed"); - File[] files = file.listFiles(); - - List studentInfos = testDao.getStudents(479); - - List studentInfoList = new ArrayList<>(); - - for (int i = 0; i < studentInfos.size(); i++) { - StudentInfo studentInfo = studentInfos.get(i); - - boolean isHas = false; - for (int j = 0; j < files.length; j++) { - File img = files[j]; - String imgName = img.getName().split("\\.")[0]; - - if (imgName.equals(studentInfo.getStudentcode())) { - isHas = true; - break; - } - - } - - if (!isHas) { - studentInfoList.add(studentInfo); - } - - } - - System.out.println("studentInfoList:" + studentInfoList); - //第一步,创建一个workbook对应一个excel文件 - HSSFWorkbook workbook = new HSSFWorkbook(); - //第二部,在workbook中创建一个sheet对应excel中的sheet - HSSFSheet sheet = workbook.createSheet("缺少的学生人脸"); - //第三部,在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制 - HSSFRow row = sheet.createRow(0); - - String[] titles = new String[]{"姓名", "班级", "学籍号", "号码"}; - //第四步,创建单元格,设置表头 - HSSFCell cell = null; - for (int i = 0; i < titles.length; i++) { - cell = row.createCell(i); - cell.setCellValue(titles[i]); - } - - //第五步,写入数据 - for (int i = 0; i < studentInfoList.size(); i++) { - HSSFRow row1 = sheet.createRow(i + 1); - for (int j = 0; j < titles.length; j++) { - String value = studentInfoList.get(i).getClass_name(); - switch (j) { - case 0: - value = studentInfoList.get(i).getName(); - break; - case 1: - value = studentInfoList.get(i).getClass_name(); - break; - case 2: - value = studentInfoList.get(i).getStudentcode(); - break; - case 3: - value = studentInfoList.get(i).getParentMobile(); - break; - } - //创建单元格设值 - row1.createCell(j).setCellValue(value); - } - } - - //将文件保存到指定的位置 - try { - FileOutputStream fos = new FileOutputStream("C:\\Users\\taohandong\\Desktop\\result.xls"); - workbook.write(fos); - System.out.println("写入成功"); - fos.close(); - } catch (IOException e) { - e.printStackTrace(); - } - - /* File file = new File("C:\\TaoHandong\\copy\\School1030\\Student"); - - File outFile = new File("C:\\TaoHandong\\copy\\School1030\\Student1"); - - if (!outFile.exists()) outFile.mkdirs(); - - File[] files = file.listFiles(); - System.out.println("files:" + files.length); - BufferedImage bufferedImage; - for (int i = 0; i < files.length; i++) { - File img = files[i]; - int ang = ImageUtils.getImgRotateAngle(img.getAbsolutePath()); - System.out.println(img.getName() + " ang:" + ang); -// try { -// bufferedImage = ImageIO.read(img); -// moveImg(bufferedImage,img,outFile); -// } catch (IOException e) { -// e.printStackTrace(); -// } - - }*/ - - } - - private List name = new ArrayList<>(); - - -} -- libgit2 0.21.0