Commit 7fb36d2f by 涂亚平

start..

0 parents
Showing with 4754 additions and 0 deletions
No preview for this file type
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
**/target/
### 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/
assets/
logs/
\ No newline at end of file
/*
* Copyright 2007-present the original author or authors.
*
* Licensed 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.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* 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/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
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();
}
}
No preview for this file type
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
#!/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.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven 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)`"
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
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
fi
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 $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
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
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
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 "$@"
@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 Maven 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 keystroke 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 by 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.5.6/maven-wrapper-0.5.6.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% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%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%
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.7.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.zhongzhi</groupId>
<artifactId>zhongzhi</artifactId>
<version>1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<java.version>1.8</java.version>
<mybatis-plus.version>3.3.0</mybatis-plus.version>
<generator.version>3.3.2</generator.version>
<swagger2.version>2.9.2</swagger2.version>
<fastjson.version>1.2.58</fastjson.version>
<jhash.version>2.0.0</jhash.version>
<poi-ooxml.version>3.13</poi-ooxml.version>
<dysmsapi.version>1.1.0</dysmsapi.version>
<sdk-core.version>4.0.1</sdk-core.version>
<lang3.version>3.9</lang3.version>
<druid.version>1.1.22</druid.version>
<itext-asian.version>5.2.0</itext-asian.version>
<itextpdf.version>5.4.1</itextpdf.version>
<java-jwt.version>3.10.3</java-jwt.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>${generator.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>com.amdelamar</groupId>
<artifactId>jhash</artifactId>
<version>${jhash.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi-ooxml.version}</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>${dysmsapi.version}</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>${sdk-core.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${lang3.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext-asian</artifactId>
<version>${itext-asian.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>${itextpdf.version}</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>${java-jwt.version}</version>
</dependency>
<!-- 阿里云 对象存储oss -->
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.15.0</version>
</dependency>
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java</artifactId>
<version>3.1.64</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>fluent-hc</artifactId>
<version>4.5.13</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<build>
<finalName>zhongzhi</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
package com.zhongzhi;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RestController;
@RestController
@MapperScan(basePackages = {"com.zhongzhi.dao"})
@SpringBootApplication
public class ZhongzhiApplication {
public static void main(String[] args) {
SpringApplication.run(ZhongzhiApplication.class, args);
}
}
\ No newline at end of file
package com.zhongzhi.common.configure;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "sms")
public class AliyunSmsProperties {
private String product;
private String domain;
private String accessKeyId;
private String accessKeySecret;
private String cpcode;
private String excode;
private String key;
private String rcsapi;
}
package com.zhongzhi.common.configure;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.zhongzhi.common.handler.MetaHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
/**
* 分页
*
* @return
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor page = new PaginationInterceptor();
page.setDialectType(DbType.MYSQL.getDb());
return page;
}
/**
* 自动填充功能
*
* @return
*/
@Bean
public GlobalConfig globalConfig() {
GlobalConfig globalConfig = new GlobalConfig();
globalConfig.setMetaObjectHandler(new MetaHandler());
return globalConfig;
}
}
\ No newline at end of file
package com.zhongzhi.common.configure;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* 读取状态码
* </p>
*
* @author DengMin
* @date Created in 2020/08/24
*/
@Component
@ConfigurationProperties(prefix = "c")
@PropertySource(value = "classpath:code.properties", encoding = "UTF-8")
public class RemoteProperties {
private static Map<Integer, String> codeMessage = new HashMap<>();
public static String getMessage(Integer code) {
return codeMessage.get(code);
}
public Map<Integer, String> getCodeMessage() {
return codeMessage;
}
public void setCodeMessage(Map<Integer, String> codeMessage) {
RemoteProperties.codeMessage = codeMessage;
}
}
\ No newline at end of file
package com.zhongzhi.common.configure;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* <p>
* swagger2
* </p>
*
* @author DengMin
* @since 2020/12/8
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.pathMapping("/")
.select()
.apis(RequestHandlerSelectors.basePackage("com.zhongzhi.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(new ApiInfoBuilder()
.title("中职双创系统")
.description("接口文档")
.version("1.0")
.build());
}
}
package com.zhongzhi.common.configure;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @author: tuyp
* @create: 2020-06-01 16:46
*/
@Component
@Data
@ConfigurationProperties(prefix = "vod")
public class VODConfig {
private String appId;
private String secretId;
private String secretKey;
private String api;
private String region;
private Integer classId;
}
package com.zhongzhi.common.configure;
import com.zhongzhi.common.interceptor.AuthenticationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.*;
/**
* @author DengMin
* @date 2020/07/06
**/
@Configuration
public class WebConfig extends WebMvcConfigurationSupport {
@Autowired
private AuthenticationInterceptor authenticationInterceptor;
/**
* 跨域支持
*
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowCredentials(true)
.allowedOrigins("*")
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
.maxAge(3600);
}
@Bean
public CorsFilter corsFilter() {
CorsConfiguration config = new CorsConfiguration();
config.setMaxAge(3600L);
config.addAllowedOrigin("*");
config.addAllowedMethod("*");
config.addAllowedHeader("*");
UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
configSource.registerCorsConfiguration("/**", config);
return new CorsFilter(configSource);
}
/**
* Swagger
*
* @param registry
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
.addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
/**
* 鉴权
*
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authenticationInterceptor)
.excludePathPatterns("/static/*")
.addPathPatterns("/**");
}
}
\ No newline at end of file
package com.zhongzhi.common.constant;
import lombok.Getter;
@Getter
public enum Code {
USERNAMENOTFOUND(1001, "用户不存在"),
BADCREDENTIALS(1002, "账户或者密码错误"),
ACCOUNTEXPIRED(1003, "账户过期"),
LOCKEDEXCEPTION(1004, "账户已锁定"),
DISABLEDEXCEPTION(1005, "账户已禁用"),
ACCESSDENIED(1006, "无权限访问"),
AUTHENTICATION(1007, "身份验证异常"),
NOHANDLERFOUND(1008, "找不到相应的视图处理器"),
PARAM_INVALID(1009, "参数不合法"),
TOKEN_EXCEPTION(1010, "无效的令牌"),
TOKEN_EXPIRED(1011, "令牌已过期"),
TOKEN_VERIFICATION_FAILED(1012, "令牌验证失败"),
OSS_ERROR(1013, "OSS文件上传异常"),
Network_ERROR(9000, "网络请求失败"),
SERVER_INTERNAL_ERROR(99999, "服务器内部错误"),
;
private final Integer code;
private final String message;
Code(Integer code, String message) {
this.code = code;
this.message = message;
}
}
package com.zhongzhi.common.constant;
/**
* <p>
* 团队成员类型
* </p>
*
* @author DengMin
* @since 2021/6/9
*/
public class MemberType {
/*
团队负责人只能有一个且是项目申请人
*/
public static final String PRINCIPAL = "团队负责人";
public static final String TEAM_MEMBER = "团队成员";
public static final String MENTOR = "指导教师";
}
package com.zhongzhi.common.constant;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class PDFCheckBox {
public static String getType(String type, String projectGroup) {
if (StringUtils.isBlank(type) &&
projectGroup.equals(ProjectType.TECHNOLOGY_INNOVATION_GROUP)) {
return "□方案设计类 □模型创意类 □虚拟演示类";
} else if (StringUtils.isBlank(type) &&
projectGroup.equals(ProjectType.CULTURAL_CREATIVE_GROUP)) {
return "□服装与服饰类设计 □视觉传达类 □产品设计类";
}
String[] typeT = {"方案设计类", "模型创意类", "虚拟演示类"};
String typeValue = "";
if (projectGroup.equals(ProjectType.TECHNOLOGY_INNOVATION_GROUP)) {
List<String> typeList = Arrays.stream(typeT).collect(Collectors.toList());
List<String> str = Arrays.stream(type.split(",")).collect(Collectors.toList());
for (String s : typeList) {
if (str.contains(s)) {
typeValue += "■" + s + " ";
} else {
typeValue += "□" + s + " ";
}
}
return typeValue;
} else if (projectGroup.equals(ProjectType.CULTURAL_CREATIVE_GROUP)) {
if (type.equals("服装与服饰类设计")) {
return "■服装与服饰类设计 □视觉传达类 □产品设计类";
} else if (type.equals("视觉传达类")) {
return "□服装与服饰类设计 ■视觉传达类 □产品设计类";
} else if (type.equals("产品设计类")) {
return "□服装与服饰类设计 □视觉传达类 ■产品设计类";
} else {
return "□服装与服饰类设计 □视觉传达类 □产品设计类";
}
}
return "";
}
public static String getRoadshow( String projectGroup) {
if (projectGroup.equals(ProjectType.TECHNOLOGY_INNOVATION_GROUP)) {
return "□模型展示 □数字化演示" +
" □PPT演示 □其他";
} else if (projectGroup.equals(ProjectType.CULTURAL_CREATIVE_GROUP)) {
return "□物化产品展示 □作品模型展示" +
" □数字化演示 □PPT演示 □其他";
}
String[] roadshowT = {"模型展示", "数字化演示", "PPT演示", "其他"};
String[] roadshowC = {"物化产品展示", "作品模型展示", "数字化演示", "PPT演示", "其他"};
// List<String> str = Arrays.stream(roadshow.split(",")).collect(Collectors.toList());
String roadshowValue = "";
if (projectGroup.equals(ProjectType.TECHNOLOGY_INNOVATION_GROUP)) {
List<String> roadshowTList = Arrays.stream(roadshowT).collect(Collectors.toList());
for (String s : roadshowTList) {
// if (str.contains(s)) {
// roadshowValue += "■" + s + " ";
// } else {
// roadshowValue += "□" + s + " ";
// }
}
return roadshowValue;
} else if (projectGroup.equals(ProjectType.CULTURAL_CREATIVE_GROUP)) {
List<String> roadshowCList = Arrays.stream(roadshowC).collect(Collectors.toList());
for (String s : roadshowCList) {
// if (str.contains(s)) {
// roadshowValue += "■" + s + " ";
// } else {
// roadshowValue += "□" + s + " ";
// }
}
return roadshowValue;
}
return "";
}
}
package com.zhongzhi.common.constant;
/**
* <p>
* 平台标识
* </p>
*
* @author DengMin
* @since 2021/6/9
*/
public class Platform {
/*
学生端
*/
public static final String student = "student";
/*
院校端
*/
public static final String school = "school";
/*
中心端
*/
public static final String center = "center";
/*
评审端
*/
public static final String review = "review";
}
package com.zhongzhi.common.constant;
public class ProjectProgress {
public static final String REGISTERED = "已注册公司";
public static final String UNREGISTERED = "创意设计阶段";
}
package com.zhongzhi.common.constant;
/**
* <p>
* 项目评审状态
* </p>
*
* @author DengMin
* @since 2021/6/9
*/
public class ProjectReview {
/**
* 评分状态(对于评分)
*/
public static final String SUBMITTED = "已评审";
public static final String TO_SCORE = "待评审";
/**
* 评审状态(对于项目)
*/
public static final String TO_REVIEWED = "待评审";
public static final String ASSIGNED = "已分配";
public static final String UNASSIGNED = "未分配";
public static final String REVIEW = "已评审";
}
package com.zhongzhi.common.constant;
/**
* <p>
* 项目进度
* </p>
*
* @author DengMin
* @since 2021/6/9
*/
public class ProjectSchedule {
//报名阶段
public static final String REGISTER = "报名阶段";
// 校内赛
public static final String SCHOOL_REVIEW = "校级申请项目";
// public static final String PRELIMINARY_REVIEW = "市级初赛项目";
public static final String SEMI_FINAL_REVIEW = "市级复赛项目";
public static final String FINAL_REVIEW = "市级决赛项目";
}
package com.zhongzhi.common.constant;
/**
* <p>
* 项目状态
* </p>
*
* @author DengMin
* @since 2021/6/9
*/
public class ProjectStatus {
// public static final String TO_REVIEW = "";
public static final String UN_SUBMITTED = "填写中";
public static final String WITHDRAWN = "已撤回";
public static final String SCHOOL_NOT_PASSED = "不予提交市级复赛";
public static final String REGISTER_NOT_PASSED = "报名不通过";
public static final String PRELIMINARY_NOT_PASSED = "不予提交市级初赛";
public static final String REMATCH_WINNING_AWARD = "市级优胜奖";
public static final String REMATCH_SILVER_AWARD = "市级银奖";
public static final String REMATCH_BRONZE_AWARD = "市级铜奖";
public static final String REMATCH_FINALS_GOLD_AWARD = "市级金奖";
}
package com.zhongzhi.common.constant;
/**
* <p>
* 项目组别
* </p>
*
* @author DengMin
* @since 2021/6/9
*/
public class ProjectType {
/**
* 赛道
*/
public static final String MAIN_TRACK = "主赛道";
public static final String SEED_TRACK = "种子赛道";
public static final String VOCATIONAL = "职教赛道";
/**
* 组别
*/
public static final String TECHNOLOGY_INNOVATION_GROUP = "科技创新";
public static final String CULTURAL_CREATIVE_GROUP = "文化创意";
public static final String VOCATIONAL_GROUP = "高职";
public static final String SECONDARY_GROUP = "中职";
}
package com.zhongzhi.common.constant;
public class SMSTemplate {
/*
项目进度通知
*/
public static final String PROJECT_PROGRESS = "2760175";
/*
项目提交通知
*/
public static final String PROJECT_SUBMIT = "270159";
/*
评审邀请通知 old
*/
public static final String REVIEW_INVITATION_OLD = "2765806";
/**
*
*/
public static final String REVIEW_INVITATION_NEW = "2939771";
/*
撤销评审项目通知
*/
public static final String CANCEL_REVIEW = "229303";
}
package com.zhongzhi.common.constant;
/**
* <p>
* 短信标识
* </p>
*
* @author DengMin
* @since 2021/6/9
*/
public class SmsCode {
/**
* 平台:student(学生端)、school(院校端)、center(中心端)、review(评审端)
*/
public static final String student = "student";
public static final String school = "school";
public static final String center = "center";
public static final String review = "review";
/**
* 行为标识:register(注册标识)、login(登录标识)
*/
public static final String register = "register";
public static final String login = "login";
}
package com.zhongzhi.common.exception;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.zhongzhi.common.configure.RemoteProperties;
import com.zhongzhi.common.constant.Code;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.vo.ResponseVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.NoHandlerFoundException;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
/**
* 自定义异常
*
* @param e
* @return
*/
@ExceptionHandler(value = HttpException.class)
public ResponseVO<T> handlerException(HttpServletRequest request, HttpException e) {
String message = RemoteProperties.getMessage(e.getCode());
if (StringUtils.isBlank(message)) {
message = e.getMessage();
}
String url = request.getRequestURI();
return ResponseData.generateCreatedResponse(e.getCode(), message, url);
}
/**
* 404
*
* @param request
* @return
*/
@ExceptionHandler(value = NoHandlerFoundException.class)
public ResponseVO<T> NoHandlerFoundException(HttpServletRequest request) {
String url = request.getRequestURI();
return ResponseData.generateCreatedResponse(Code.NOHANDLERFOUND.getCode(), Code.NOHANDLERFOUND.getMessage(), url);
}
/**
* 请求方式错误
*
* @param request
* @return
*/
@ExceptionHandler(value = HttpRequestMethodNotSupportedException.class)
public ResponseVO<T> HttpRequestMethodNotSupportedException(HttpServletRequest request) {
String url = request.getRequestURI();
return ResponseData.generateCreatedResponse(Code.NOHANDLERFOUND.getCode(), Code.NOHANDLERFOUND.getMessage(), url);
}
/**
* 参数不合法
*
* @param e
* @return
*/
@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseVO<T> validateException(MethodArgumentNotValidException e) {
final List<String> errList = new ArrayList<>();
e.getBindingResult().getAllErrors().stream().forEach(x -> {
errList.add(x.getDefaultMessage());
});
return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage(), errList.toString());
}
/**
* JSON 序列化异常
*
* @param e
* @return
*/
@ExceptionHandler(HttpMessageNotReadableException.class)
public ResponseVO<T> exceptionHandler(HttpMessageNotReadableException e) {
log.error(e.getMessage());
return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage() + ":{" + e.getMessage() + "}");
}
/**
* 校验异常
*
* @param e
* @return
*/
@ExceptionHandler(BindException.class)
public ResponseVO<T> BindException(BindException e) {
final List<String> errList = new ArrayList<>();
e.getBindingResult().getAllErrors().stream().forEach(x -> {
errList.add(x.getDefaultMessage());
});
return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage(), errList.toString());
}
/**
* 服务器内部错误
*
* @return
*/
@ExceptionHandler(value = Exception.class)
public ResponseVO<T> serverInternalError(Exception e, HttpServletRequest request) {
String url = request.getRequestURI();
log.error("path:" + url);
log.error("error:"+ e.getClass());
log.error("error message:"+ e.getLocalizedMessage() + e.getStackTrace()[0] + System.getProperty("line.separator"));
return ResponseData.generateCreatedResponse(Code.SERVER_INTERNAL_ERROR.getCode(), Code.SERVER_INTERNAL_ERROR.getMessage(), url);
}
}
\ No newline at end of file
package com.zhongzhi.common.exception;
import com.zhongzhi.common.configure.RemoteProperties;
/**
* 异常处理
*
* @author DengMin
* @date 2020/08/12
**/
public class HttpException extends RuntimeException {
private Integer code;
private String message;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
@Override
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public HttpException(Integer code) {
super(RemoteProperties.getMessage(code));
String message = RemoteProperties.getMessage(code);
this.message = message;
this.code = code;
}
public HttpException(Integer code, String message) {
this.message = message;
this.code = code;
}
}
package com.zhongzhi.common.generator;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import com.zhongzhi.model.base.BaseModel;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Scanner;
/**
* <p>
* 项目生成器
* </p>
*
* @author DengMin
*/
public class CodeGenerator {
public static String scanner(String tip) {
StringBuilder help = new StringBuilder();
help.append("1.生成全部表 2.输入需要生成表名");
System.out.println(help);
Scanner scanner = new Scanner(System.in);
Integer ipt = Integer.valueOf(scanner.next());
if (ipt == 1) {
return "";
} else if (ipt == 2) {
StringBuilder help1 = new StringBuilder();
help1.append("请输入" + tip + ":");
System.out.println(help1);
Scanner scanner1 = new Scanner(System.in);
if (scanner1.hasNext()) {
String name = scanner1.next();
if (StringUtils.isNotEmpty(name)) {
return name;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
return scanner(tip);
}
public static void main(String[] args) {
final ResourceBundle rb = ResourceBundle.getBundle("mybatis-generator");
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
gc.setOutputDir(System.getProperty("user.dir") + rb.getString("outputDir"));
gc.setOpen(false);
gc.setBaseResultMap(true);
gc.setBaseColumnList(true);
gc.setAuthor(rb.getString("author"));
gc.setMapperName("%sMapper");
gc.setEntityName("%sDO");
gc.setServiceName("%sService");
gc.setServiceImplName("%sServiceImpl");
gc.setControllerName("%sController");
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setDbType(DbType.MYSQL);
dsc.setUrl(rb.getString("url"));
dsc.setDriverName(rb.getString("driverName"));
dsc.setUsername(rb.getString("userName"));
dsc.setPassword(rb.getString("password"));
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
pc.setParent(rb.getString("setParent"));
pc.setController("controller");
pc.setService("service");
pc.setServiceImpl("service.impl");
pc.setEntity("model");
pc.setMapper("mapper");
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
List<FileOutConfig> focList = new ArrayList<>();
focList.add(new FileOutConfig("/templates/mapper.xml.ftl") {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输入文件名称
return System.getProperty("user.dir") + rb.getString("mapperPath") + tableInfo.getMapperName() + StringPool.DOT_XML;
}
});
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
mpg.setTemplate(new TemplateConfig().setXml(null));
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
strategy.setSuperEntityClass(BaseModel.class);
strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true);
String[] tables = scanner("表名,多个英文逗号分割").split(",");
if (StringUtils.isNotBlank(tables[0])) {
strategy.setInclude(tables);
}
strategy.setControllerMappingHyphenStyle(true);
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute();
}
}
package com.zhongzhi.common.handler;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
/**
* 填充配置
*
* @author DengMin
* @date 2020/07/21
**/
@Component
public class MetaHandler implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
this.setFieldValByName("createTime", LocalDateTime.now(), metaObject);
}
@Override
public void updateFill(MetaObject metaObject) {
this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject);
}
}
package com.zhongzhi.common.interceptor;
import com.auth0.jwt.interfaces.Claim;
import com.zhongzhi.common.constant.Code;
import com.zhongzhi.common.constant.SmsCode;
import com.zhongzhi.common.exception.HttpException;
import com.zhongzhi.common.utils.JwtUtil;
import com.zhongzhi.common.utils.Localstorage;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.model.AdministerDO;
import com.zhongzhi.model.CollegesDictDO;
import com.zhongzhi.model.ProjectJudgeDO;
import com.zhongzhi.model.StudentDO;
import com.zhongzhi.service.AdministerService;
import com.zhongzhi.service.CollegesDictService;
import com.zhongzhi.service.ProjectJudgeService;
import com.zhongzhi.service.StudentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map;
/**
* <p>
* 鉴权拦截器
* </p>
*
* @author DengMin
* @since 2021/4/26
*/
@Component
public class AuthenticationInterceptor implements HandlerInterceptor {
@Autowired
private StudentService studentService;
@Autowired
private AdministerService administerService;
@Autowired
private CollegesDictService collegesDictService;
@Autowired
private ProjectJudgeService projectJudgeService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
if (!(handler instanceof HandlerMethod)) {
return true;
}
HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod();
LoginRequired methodAnnotation = method.getAnnotation(LoginRequired.class);
if (methodAnnotation != null) {
String authorization = request.getHeader("Authorization");
if (StringUtils.isBlank(authorization)) {
throw new HttpException(Code.TOKEN_EXCEPTION.getCode(), Code.TOKEN_EXCEPTION.getMessage());
}
String token = authorization;
if (authorization.startsWith("Bearer")) {
token = authorization.replace("Bearer ", "");
}
if (token == null || JwtUtil.isExpired(token) || !JwtUtil.verifyToken(token)) {
throw new HttpException(Code.TOKEN_EXCEPTION.getCode(), Code.TOKEN_EXCEPTION.getMessage());
}
Map<String, Claim> claimMap = JwtUtil.getClaims(token);
if (claimMap != null) {
String[] role = methodAnnotation.value();
String type = claimMap.get("type").asString();
if (role.length > 0) {
if (Arrays.asList(role).contains(type)) {
if (SmsCode.student.equals(type)) {
StudentDO studentDO = studentService.getById(claimMap.get("id").asLong());
if (studentDO != null) {
Localstorage.setUser(studentDO, type);
return true;
} else {
Localstorage.remove();
throw new HttpException(Code.USERNAMENOTFOUND.getCode(), Code.USERNAMENOTFOUND.getMessage());
}
} else if (SmsCode.center.equals(type)) {
AdministerDO administerDO = administerService.getById(claimMap.get("id").asLong());
if (administerDO != null) {
Localstorage.setUser(administerDO, type);
return true;
} else {
Localstorage.remove();
throw new HttpException(Code.USERNAMENOTFOUND.getCode(), Code.USERNAMENOTFOUND.getMessage());
}
} else if (SmsCode.school.equals(type)) {
CollegesDictDO collegesDictDO = collegesDictService.getById(claimMap.get("id").asLong());
if (collegesDictDO != null) {
Localstorage.setUser(collegesDictDO, type);
return true;
} else {
Localstorage.remove();
throw new HttpException(Code.USERNAMENOTFOUND.getCode(), Code.USERNAMENOTFOUND.getMessage());
}
} else if (SmsCode.review.equals(type)) {
ProjectJudgeDO projectJudgeDO = projectJudgeService.getById(claimMap.get("id").asLong());
if (projectJudgeDO != null) {
Localstorage.setUser(projectJudgeDO, type);
return true;
} else {
Localstorage.remove();
throw new HttpException(Code.USERNAMENOTFOUND.getCode(), Code.USERNAMENOTFOUND.getMessage());
}
}
}
throw new HttpException(Code.ACCESSDENIED.getCode(), Code.ACCESSDENIED.getMessage());
}
}
}
return true;
}
}
package com.zhongzhi.common.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.zhongzhi.common.configure.AliyunSmsProperties;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.zhongzhi.common.constant.SMSTemplate;
import com.zhongzhi.common.exception.HttpException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* 阿里云短信
* </p>
*
* @author DengMin
* @since 2021/1/27
*/
@Slf4j
@Component
public class AliyunSmsUtil {
@Autowired
private AliyunSmsProperties aliyunSmsProperties;
/**
* 阿里云短信 -- 验证码
* @param phone
* @param code
* @return
*/
public SendSmsResponse send(String phone, int code) {
try {
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
//初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", aliyunSmsProperties.getAccessKeyId(), aliyunSmsProperties.getAccessKeySecret());
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", aliyunSmsProperties.getProduct(), aliyunSmsProperties.getDomain());
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
//必填:待发送手机号
request.setPhoneNumbers(phone);
//必填:短信签名-可在短信控制台中找到
request.setSignName("双创平台");
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode("SMS_229640297");
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request.setTemplateParam("{\"code\":\"" + code + "\"}");
//hint 此处可能会抛出异常,注意catch
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
if (sendSmsResponse != null && sendSmsResponse.getCode().equals("OK")) {
return sendSmsResponse;
}
throw new Exception(sendSmsResponse.getMessage());
} catch (Exception e) {
log.error("---短信发送失败:" + e);
throw new HttpException(10011);
}
}
public static void main(String[] args) {
// AliyunSmsUtil.sendNew("15201936167",000123);
}
/**
* 三网平台短信
* @param msg
* @param phone
* @param templateId
*/
public void sendTemplateMsg(String msg, String phone, String templateId) {
Map<String, Object> map = new HashMap<>();
try {
map.put("cpcode", aliyunSmsProperties.getCpcode());
map.put("msg", msg);
map.put("mobiles", phone);
map.put("excode", aliyunSmsProperties.getExcode());
map.put("templetid", templateId);
String md5source = aliyunSmsProperties.getCpcode() + msg + phone + aliyunSmsProperties.getExcode() + templateId + aliyunSmsProperties.getKey();
map.put("sign", makeMD5(new String(md5source.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8)).toLowerCase());
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> responseEntity = restTemplate.postForEntity(aliyunSmsProperties.getRcsapi(), map, String.class);
String body = responseEntity.getBody();
JSONObject object = JSON.parseObject(body);
if (Integer.valueOf(object.get("resultcode").toString()) != 0) {
log.error(object.get("resultmsg").toString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
// /**
// * 三网平台短信 新版本 https://flaginfo-cloud.yuque.com/staff-rozzgq/ofcpak
// * @param msg
// * @param phone
// * @param templateId
// */
// public static void sendTemplateMsgNew(String msg, String phone, String templateId) {
// String info = null;
// try{
// HttpClient httpclient = new HttpClient();
// PostMethod post = new PostMethod("https://opassapi.infocloud.cc/sms/Api/SendGBK.do");//
// post.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,"gb2312");
// post.addParameter("SpCode", templateId);
// post.addParameter("LoginName", "7db124d0baf189d1e485350xxx");
// post.addParameter("Password", "3df50b24fb8288b9da99d16bf527e9dbf13659748534dca6e0820xxx");
// post.addParameter("MessageContent", msg);
// post.addParameter("UserNumber", phone);
// post.addParameter("SerialNumber", "");
// post.addParameter("f", "1");
// httpclient.executeMethod(post);
// info = new String(post.getResponseBody(),"gbk");
// System.out.println(info);
// }catch (Exception e) {
// e.printStackTrace();
// }
// }
public void sendTemplateMsgP(String msg, String phone, String templateId) {
Map<String, Object> map = new HashMap<>();
try {
map.put("cpcode", aliyunSmsProperties.getCpcode());
map.put("msg", msg);
map.put("mobiles", phone);
map.put("excode", aliyunSmsProperties.getExcode());
map.put("templetid", templateId);
String md5source = aliyunSmsProperties.getCpcode() + msg + phone + aliyunSmsProperties.getExcode() + templateId + aliyunSmsProperties.getKey();
map.put("sign", makeMD5(new String(md5source.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8)).toLowerCase());
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> responseEntity = restTemplate.postForEntity(aliyunSmsProperties.getRcsapi(), map, String.class);
String body = responseEntity.getBody();
JSONObject object = JSON.parseObject(body);
if (Integer.valueOf(object.get("resultcode").toString()) != 0) {
log.error(object.get("resultmsg").toString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
public String makeMD5(String plainText) {
String re_md5 = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes(StandardCharsets.UTF_8));
byte[] b = md.digest();
int i;
StringBuffer buf = new StringBuffer();
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0) {
i += 256;
}
if (i < 16) {
buf.append("0");
}
buf.append(Integer.toHexString(i));
}
re_md5 = buf.toString().toLowerCase();
} catch (Exception e) {
e.printStackTrace();
}
return re_md5;
}
// public static String getByteString( byte[] buff_out )
// {
// StringBuffer strBuf = new StringBuffer(buff_out.length * 3);
// strBuf.append("Length[");
// strBuf.append(buff_out.length);
// strBuf.append("];Content[");
// for ( int i = 0 ; i < buff_out.length ; ++i ) {
// int l = buff_out[i] & 0x0F;
// int h = (buff_out[i] & 0xF0) >> 4;
//
// char ll = (char) (l > 9 ? 'a' + l - 10 : '0' + l);
// char hh = (char) (h > 9 ? 'a' + h - 10 : '0' + h);
//
// strBuf.append(hh);
// strBuf.append(ll);
// strBuf.append(" ");
// }
// strBuf.append("]");
// return strBuf.toString().toUpperCase();
// }
}
\ No newline at end of file
package com.zhongzhi.common.utils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class ApplicationContextUtil implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
ApplicationContextUtil.applicationContext = applicationContext;
}
public static <T> T getBean(Class<T> clazz) {
return applicationContext.getBean(clazz);
}
public static <T> T getBean(String name) {
return (T) applicationContext.getBean(name);
}
}
package com.zhongzhi.common.utils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import java.text.SimpleDateFormat;
import java.time.*;
import java.util.Date;
/**
* Date格式工具
*
* @author DengMin
* @date 2020/08/03
**/
public class DateFormatUtil {
public final static String FMT_sdf14_L = "yyyy-MM-dd HH:mm:ss";
public final static String FMT_sdf_yMd = "yyyy-MM-dd";
public final static String FMT_sdf_Hm = "H:mm";
public final static String cron = "s m H d M ? yyyy";
/**
* Date转String,自定义格式
*
* @param date
* @param pattern
* @return
*/
public static String format(Date date, String pattern) {
try {
if (date == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.format(date);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* String转Date,自定义格式
*
* @param date
* @param pattern
* @return
*/
public static Date parse(String date, String pattern) {
try {
if (StringUtils.isBlank(date)) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.parse(date);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* LocalDate转Date
*
* @param localDate
* @return
*/
public static Date localDateToDate(LocalDate localDate) {
if (localDate == null) {
return null;
}
ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
return Date.from(zonedDateTime.toInstant());
}
/**
* LocalDate转String
*
* @param localDate
* @return
*/
public static String localDateToString(LocalDate localDate) {
if (localDate == null) {
return null;
}
ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
return format(Date.from(zonedDateTime.toInstant()), FMT_sdf_yMd);
}
public static Date localDateTimeToDate(LocalDateTime localDateTime) {
if (localDateTime == null) {
return null;
}
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}
/**
* date转localDate
*
* @param date
* @return
*/
public static LocalDate dateTOLocalDate(Date date) {
if (date == null) {
return null;
}
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
/**
* String转LocalDate
*
* @param date
* @return
*/
public static LocalDate localDateParse(String date) {
if (StringUtils.isBlank(date)) {
return null;
}
return LocalDate.parse(date);
}
/**
* 时间戳转LocalDate
*
* @param timestamp
* @return
*/
public static LocalDate timestampTOLocalDate(Long timestamp) {
return Instant.ofEpochMilli(timestamp).atZone(ZoneOffset.ofHours(0)).toLocalDate();
}
/**
* 时间字符串转Cron
*
* @param date
* @return
*/
public static String getCron(String date) {
try {
Date d = parse(date, FMT_sdf14_L);
SimpleDateFormat sdf = new SimpleDateFormat(cron);
return sdf.format(d);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 时间戳转日期字符串
*
* @param timestamp 时间戳
* @return 日期字符串
* @author ALiang
*/
public static String timestampToDateString(Long timestamp) {
Date date = new Date(timestamp);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(FMT_sdf14_L);
return simpleDateFormat.format(date);
}
/**
* Date转LocalTime
*
* @param date
* @return
*/
public static LocalTime dateToLocalTime(Date date) {
Instant instant = date.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
LocalTime localTime = instant.atZone(zoneId).toLocalTime();
return localTime;
}
public static LocalDateTime dateToLocalDateTime(Date date) {
Instant instant = date.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
return localDateTime;
}
}
package com.zhongzhi.common.utils;
import java.lang.annotation.*;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ExcelColumn {
String value() default "";
int col() default 1;
}
package com.zhongzhi.common.utils;
import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class IpAddressUtil {
public static String getIpAddress(HttpServletRequest request) {
String ipAddress = request.getHeader("x-forwarded-for");
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getHeader("Proxy-Client-IP");
}
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getHeader("WL-Proxy-Client-IP");
}
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getRemoteAddr();
if (ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")) {
InetAddress inet = null;
try {
inet = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
ipAddress = inet.getHostAddress();
}
}
if (ipAddress != null && ipAddress.length() > 15) {
if (ipAddress.indexOf(",") > 0) {
ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
}
}
return ipAddress;
}
}
package com.zhongzhi.common.utils;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.Claim;
import java.util.Date;
import java.util.Map;
/**
* <p>
* Token工具
* </p>
*
* @author DengMin
* @since 2021/4/14
*/
public class JwtUtil {
private static final Long EXPIRE_TIME = 24 * 60 * 60 * 1000L;
private static final String SECRET = "PBKDF2SHA256:64000:18:24:N:GFHZ6Y0PTEUDYCJI3K6SOOXWYEKPOZED:WBWFJMX5DF252E0HR3BF3P/D";
/**
* 生成Token
*
* @param id
* @return
*/
public static String generateToken(Long id, String type) {
Date expireDate = new Date(System.currentTimeMillis() + EXPIRE_TIME);
return JWT.create()
.withClaim("id", id)
.withClaim("type", type)
.withAudience()
.withExpiresAt(expireDate)
.withIssuedAt(new Date())
.sign(Algorithm.HMAC256(SECRET));
}
/**
* 检验token是否正确
*
* @param token
* @return
*/
public static boolean verifyToken(String token) {
try {
Algorithm algorithm = Algorithm.HMAC256(SECRET);
JWTVerifier verifier = JWT.require(algorithm).build();
verifier.verify(token);
return true;
} catch (Exception e) {
return false;
}
}
/**
* 获取用户自定义Claim集合
*
* @param token
* @return
*/
public static Map<String, Claim> getClaims(String token) {
Algorithm algorithm = Algorithm.HMAC256(SECRET);
JWTVerifier verifier = JWT.require(algorithm).build();
Map<String, Claim> claims = verifier.verify(token).getClaims();
return claims;
}
/**
* 获取过期时间
*
* @param token
* @return
*/
public static Date getExpiresAt(String token) {
Algorithm algorithm = Algorithm.HMAC256(SECRET);
return JWT
.require(algorithm)
.build()
.verify(token)
.getExpiresAt();
}
/**
* 验证token是否失效
*
* @param token
* @return true: 过期, false: 没过期
*/
public static boolean isExpired(String token) {
try {
final Date expiration = getExpiresAt(token);
return expiration.before(new Date());
} catch (Exception e) {
return true;
}
}
}
package com.zhongzhi.common.utils;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@RestController
public class Localstorage {
private static final ThreadLocal<Object> local = ThreadLocal.withInitial(() -> null);
private static ConcurrentHashMap<String, Object> map = new ConcurrentHashMap<>();
public static void setUser(Object obj, String type) {
// Map<String, Object> map = new HashMap<>();
map.put("user", obj);
map.put("type", type);
Localstorage.local.set(map);
}
public static Map<String, Object> getMap() {
return (Map<String, Object>) Localstorage.local.get();
}
public static Object getUser() {
// Map<String, Object> map = (Map<String, Object>) Localstorage.local.get();
return map.get("user");
}
public static void remove() {
Localstorage.local.remove();
}
}
package com.zhongzhi.common.utils;
import java.lang.annotation.*;
/**
* <p>
* 自定义验证登陆注解
* </p>
*
* @author DengMin
* @since 2020/12/18
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface LoginRequired {
String[] value();
}
\ No newline at end of file
package com.zhongzhi.common.utils;
import java.util.Date;
import java.util.Random;
public class RandomUtil {
public static int getCode() {
return (int) ((Math.random() * 9 + 1) * 100000);
}
public static String randomPass(Integer count) {
StringBuffer stringBuffer = new StringBuffer();
Random random = new Random(new Date().getTime());
String flag = type[random.nextInt(type.length)];
int length = count;
for (int i = 0; i < length; i++) {
switch (flag) {
case "word":
stringBuffer.append(word[random.nextInt(word.length)]);
break;
case "num":
stringBuffer.append(num[random.nextInt(num.length)]);
break;
case "symbol":
stringBuffer.append(symbol[random.nextInt(symbol.length)]);
break;
default:
break;
}
flag = type[random.nextInt(type.length)];
}
return stringBuffer.toString();
}
public final static String[] type = {
"word", "num", "symbol"
};
public final static String[] word = {
"a", "b", "c", "d", "e", "f", "g",
"h", "j", "k", "m", "n",
"p", "q", "r", "s", "t",
"u", "v", "w", "x", "y", "z",
"A", "B", "C", "D", "E", "F", "G",
"H", "J", "K", "M", "N",
"P", "Q", "R", "S", "T",
"U", "V", "W", "X", "Y", "Z"
};
public final static String[] num = {
"1", "2", "3", "4", "5", "6", "7", "8", "9"
};
public final static String[] symbol = {
"!", "@", "#", "$", "%", "&"
};
}
package com.zhongzhi.common.utils;
import com.zhongzhi.common.configure.RemoteProperties;
import com.zhongzhi.vo.ResponseVO;
import lombok.Data;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
/**
* 返回数据
*
* @author DengMin
* @date 2019/08/27 13:57
**/
@Data
@EnableConfigurationProperties(RemoteProperties.class)
public class ResponseData {
public static <T> ResponseVO<T> generateCreatedResponse(int code) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(RemoteProperties.getMessage(code))
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, String message) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(message)
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, T data) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(RemoteProperties.getMessage(code))
.data(data)
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, String message, T data) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(message)
.data(data)
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, String message, String path) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(message)
.path(path)
.build();
}
}
\ No newline at end of file
package com.zhongzhi.common.utils;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.HmacAlgorithms;
import org.apache.commons.codec.digest.HmacUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.client.fluent.Request;
import org.apache.http.entity.ContentType;
import springfox.documentation.service.ApiKey;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
/***
* 短信发送工具类
*/
@Slf4j
public class SMSSendUtils {
/**
* 短信平台接口配置中申请,替换为企业自己的API_KEY
*/
private static String API_KEY = "01b0312e7d016d2af41a47e5ba2c2748";
/**
* 短信平台接口配置中申请,替换为企业自己的SECRET_KEY
*/
private static String SECRET_KEY = "bd985a3772ca3b362f8b049a3017b6edac604815e34be96631513e29afbcac47";
private static final String DOMAIN = "https://opassapi.infocloud.cc/";
private static final String MESSAGE_SEND="message/send";
private static final String MESSAGE_SEND_BATCH = "message/sendBatch";
public static String SMS_API_KEY = "sms.api.key";
public static String SMS_SECRET_KEY = "sms.secret.key";
public static final int CONNECT_TIMEOUT= 30_000;
public static final int SOCKET_TIMEOUT = 15_000;
private static ReentrantLock lock = new ReentrantLock(true);
private static AtomicBoolean init = new AtomicBoolean(false);
static void init(){
// String apiKey = API_KEY;
// String secretKey = SECRET_KEY;
// System.setProperty(SMSSendUtils.SMS_API_KEY,API_KEY);
// System.setProperty(SMSSendUtils.SMS_SECRET_KEY,SECRET_KEY);
// if(StringUtils.isAnyEmpty(apiKey,secretKey)){
// throw new NullPointerException("短信发送apiKey、secretKey不能为空。\n解决方式:\n1.代码设置。" +
// "System.setProperty(SMSSendUtils.SMS_API_KEY,\"从短信平台接口配置中获取\");" +
// "System.setProperty(SMSSendUtils.SMS_SECRET_KEY,\"从短信平台接口配置中获取\");\n" +
// "2.启动配置。java -Dsms.api.key=xx -Dsms.secret.key=xxx");
// }
// API_KEY = apiKey;
// SECRET_KEY = secretKey;
}
private SMSSendUtils(){}
/**
* 短信发送。无参短信模板内容发送,即所有手机号接收到的短信内容一样
* @param templateCode
* @param phones 手机号。手机号最大个数限制1000
* @return
*/
public static HttpResponse send(String templateCode, String ...phones) throws IOException {
return send(templateCode,null,phones);
}
/**
* 短信发送。不同手机号对应相同的短信模板变量值,即所有手机号接收到的短信内容一样
* @param templateCode
* @param params 模板参数变量值
* @param phones 手机号。手机号最大个数限制1000
* @return
*/
public static HttpResponse send(String templateCode, LinkedList<String> params, String ... phones) throws IOException {
//手机号先去重,然后再转换
return sendBatch(templateCode,params!=null&&!params.isEmpty()?JSON.toJSONString(params):null,Arrays.stream(phones).collect(Collectors.toSet()).stream().collect(Collectors.joining(",")), false);
}
/**
* 短信发送
* @param templateCode 模板ID
* @param paramsJson 模板参数
* @param phonesJson 手机号
* @param batch true:使用MESSAGE_SEND_BATCH接口发送;false:使用MESSAGE_SEND接口发送
* @return HttpResponse
* @throws IOException
*/
private static HttpResponse sendBatch(String templateCode,String paramsJson,String phonesJson,boolean batch) throws IOException {
if(StringUtils.isAnyEmpty(templateCode)){
throw new NullPointerException("模板id或手机号不能为空");
}
Map<String, Object> headers = getHeaders();
Map<String, Object> bodyParams = new HashMap<>(4);
if(batch){
if(StringUtils.isAnyEmpty(paramsJson)){
throw new NullPointerException("短信发送所有手机号接收到的短信内容不一样时,模板参数值不能为空");
}
bodyParams.put("phonesJson", phonesJson);
//模板变量内容
bodyParams.put("templateParamJson", paramsJson);
}else{
bodyParams.put("phones", phonesJson);
//模板变量内容
if(StringUtils.isNotEmpty(paramsJson)) {
bodyParams.put("templateParam", paramsJson);
}
}
bodyParams.put("templateCode", templateCode);
//排序
// bd985a3772ca3b362f8b049a3017b6edac604815e34be96631513e29afbcac47
SortedMap<String, Object> sortedMap = new TreeMap<>(bodyParams);
headers.forEach((k, v) -> sortedMap.put(k, v));
//生成签名
headers.put("x-sign", getSignature(SECRET_KEY, sortedMap, HmacAlgorithms.HMAC_SHA_224));
Request request = Request.Post(DOMAIN+(batch?MESSAGE_SEND_BATCH:MESSAGE_SEND))
.version(HttpVersion.HTTP_1_1)
//设置连接超时
.connectTimeout(CONNECT_TIMEOUT)
//设置文本读取超时
.socketTimeout(SOCKET_TIMEOUT);
headers.forEach((k,v)->request.addHeader(k,String.valueOf(v)));
return request.bodyString(JSON.toJSONString(bodyParams), ContentType.APPLICATION_JSON)
.execute()
.returnResponse();
}
private static Map<String, Object> getHeaders(){
if(init.get()==false){
lock.lock();
try {
if(init.get()==false) {
init.set(true);
init();
}
}catch (Exception e){
throw e;
}finally {
lock.unlock();
}
}
Map<String, Object> headers = new HashMap<>();
headers.put("x-api-key", API_KEY);
headers.put("x-sign-method", HmacAlgorithms.HMAC_SHA_224.getName());
headers.put("x-nonce", getRandomNickname(10));
headers.put("x-timestamp", String.valueOf(System.currentTimeMillis()));
return headers;
}
/**
* 签名生成
* @param secret
* @param sortedMap
* @param hmacAlgorithms
* @return
*/
private static String getSignature(String secret, SortedMap<String, Object> sortedMap, HmacAlgorithms hmacAlgorithms) {
// 将参数拼接为字符串
// e.g. "key1=value1&key2=value2"
StringBuffer plainText = new StringBuffer();
for (Map.Entry<String, Object> entry : sortedMap.entrySet()) {
plainText.append(entry.getKey() + "=" + entry.getValue());
plainText.append("&");
}
if(StringUtils.isNotEmpty(plainText)) {
plainText.deleteCharAt(plainText.length() - 1);
}
log.info("\n加密方式:{} \n排序后的请求参数:{}",hmacAlgorithms.getName(),plainText);
return new HmacUtils(hmacAlgorithms, secret).hmacHex(plainText.toString());
}
/**
* 随机数生成
* @param length
* @return
*/
private static String getRandomNickname(int length) {
String val = "";
Random random = new Random();
for (int i = 0; i < length; i++) {
// 输出字母还是数字
String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num";
// 字符串
if ("char".equalsIgnoreCase(charOrNum)) {
// 取得大写字母还是小写字母
int choice = random.nextInt(2) % 2 == 0 ? 65 : 97;
val += (char) (choice + random.nextInt(26));
} else if ("num".equalsIgnoreCase(charOrNum)) { // 数字
val += String.valueOf(random.nextInt(10));
}
}
return val;
}
}
package com.zhongzhi.common.utils;
import sun.misc.BASE64Encoder;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
/**
* @author: tuyp
* @create: 2020-07-29 12:42
*/
public class Signature {
private String secretId;
private String secretKey;
private long currentTime;
private int random;
private int signValidDuration;
private int classId;
private static final String HMAC_ALGORITHM = "HmacSHA1";
private static final String CONTENT_CHARSET = "UTF-8";
public static byte[] byteMerger(byte[] byte1, byte[] byte2) {
byte[] byte3 = new byte[byte1.length + byte2.length];
System.arraycopy(byte1, 0, byte3, 0, byte1.length);
System.arraycopy(byte2, 0, byte3, byte1.length, byte2.length);
return byte3;
}
public String getUploadSignature() throws Exception {
String strSign = "";
String contextStr = "";
long endTime = (currentTime + signValidDuration);
contextStr += "secretId=" + java.net.URLEncoder.encode(secretId, "utf8");
contextStr += "&currentTimeStamp=" + currentTime;
contextStr += "&expireTime=" + endTime;
contextStr += "&random=" + random;
contextStr += "&classId=" + classId;
try {
Mac mac = Mac.getInstance(HMAC_ALGORITHM);
SecretKeySpec secretKey = new SecretKeySpec(this.secretKey.getBytes(CONTENT_CHARSET), mac.getAlgorithm());
mac.init(secretKey);
byte[] hash = mac.doFinal(contextStr.getBytes(CONTENT_CHARSET));
byte[] sigBuf = byteMerger(hash, contextStr.getBytes(StandardCharsets.UTF_8));
strSign = base64Encode(sigBuf);
strSign = strSign.replace(" ", "").replace("\n", "").replace("\r", "");
} catch (Exception e) {
throw e;
}
return strSign;
}
private String base64Encode(byte[] buffer) {
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(buffer);
}
public void setSecretId(String secretId) {
this.secretId = secretId;
}
public void setSecretKey(String secretKey) {
this.secretKey = secretKey;
}
public void setCurrentTime(long currentTime) {
this.currentTime = currentTime;
}
public void setRandom(int random) {
this.random = random;
}
public void setSignValidDuration(int signValidDuration) {
this.signValidDuration = signValidDuration;
}
public void setClassId(int classId){this.classId = classId;}
}
package com.zhongzhi.common.utils;
import java.lang.annotation.*;
/**
* <p>
* 自定义日志注解
* </p>
*
* @author DengMin
* @since 2020/12/18
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SysLog {
String value() default "";
}
package com.zhongzhi.common.utils;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.vod.v20180717.VodClient;
import com.tencentcloudapi.vod.v20180717.models.*;
import com.zhongzhi.common.configure.VODConfig;
import com.zhongzhi.common.exception.HttpException;
import org.springframework.stereotype.Component;
/**
* <p>
* 腾讯云 - 云点播API
* </p>
*
* @author DengMin
* @since 2022/8/1
*/
@Component
public class VodUtil {
private static String endpoint = "vod.tencentcloudapi.com";
/**
* 根据视频模版进行转码
* @param vodCode
* @return
*/
public static ProcessMediaResponse processMedia(VODConfig vodConfig, String vodCode) {
try {
//上传后直接转码
Credential cred = new Credential(vodConfig.getSecretId(), vodConfig.getSecretKey());
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint(endpoint);
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
VodClient client = new VodClient(cred, "", clientProfile);
ProcessMediaRequest processMediaRequest = new ProcessMediaRequest();
MediaProcessTaskInput mediaProcessTaskInput1 = new MediaProcessTaskInput();
TranscodeTaskInput[] transcodeTaskInputs1 = new TranscodeTaskInput[1];
TranscodeTaskInput transcodeTaskInput1 = new TranscodeTaskInput();
transcodeTaskInput1.setDefinition(100030L);
transcodeTaskInputs1[0] = transcodeTaskInput1;
mediaProcessTaskInput1.setTranscodeTaskSet(transcodeTaskInputs1);
processMediaRequest.setMediaProcessTask(mediaProcessTaskInput1);
processMediaRequest.setFileId(vodCode);
return client.ProcessMedia(processMediaRequest);
} catch (Exception ex) {
throw new HttpException(50001);
}
}
/**
* 删除腾讯云上原视频
* @param vodCode
*/
public static void deleteMedia(VODConfig vodConfig, String vodCode) {
try {
//删除原视频
Credential cred = new Credential(vodConfig.getSecretId(), vodConfig.getSecretKey());
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint(endpoint);
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
VodClient client = new VodClient(cred, "", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
DeleteMediaRequest req = new DeleteMediaRequest();
req.setFileId(vodCode);
// 返回的resp是一个DeleteMediaResponse的实例,与请求对象对应
client.DeleteMedia(req);
} catch (TencentCloudSDKException e) {
throw new HttpException(99999, e.getMessage());
}
}
/**
* 云点播域名的CDN统计数据
* @param vodConfig
* @param DataType
* @param startTime
* @param endTime
* @return
*/
public static StatDataItem[] DescribeCDNStatDetails(VODConfig vodConfig, String DataType, String startTime, String endTime) {
try {
Credential cred = new Credential(vodConfig.getSecretId(), vodConfig.getSecretKey());
// 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint(endpoint);
// 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
VodClient client = new VodClient(cred, "", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
DescribeCDNUsageDataRequest req = new DescribeCDNUsageDataRequest();
req.setStartTime(startTime);
req.setEndTime(endTime);
req.setDataType(DataType);
// 返回的resp是一个DescribeCDNUsageDataResponse的实例,与请求对象对应
DescribeCDNUsageDataResponse resp = client.DescribeCDNUsageData(req);
// 返回的resp是一个DescribeCDNStatDetailsResponse的实例,与请求对象对应
return resp.getData();
} catch (TencentCloudSDKException e) {
e.printStackTrace();
throw new HttpException(99999, e.getMessage());
}
}
}
package com.zhongzhi.controller;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.administer.AdministerPageDTO;
import com.zhongzhi.dto.administer.LoginDTO;
import com.zhongzhi.model.AdministerDO;
import com.zhongzhi.service.AdministerService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 中心管理账户表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@RestController
@Api(tags = "中心管理账户")
@RequestMapping("/administer")
public class AdministerController {
@Autowired
private AdministerService administerService;
@PostMapping(value = "/login")
@ApiOperation("中心端 --- 登录:手机号/telephone, code/验证码")
public ResponseVO login(@RequestBody LoginDTO loginDTO) {
return ResponseData.generateCreatedResponse(0, administerService.login(loginDTO));
}
@PostMapping(value = "/getAdministerPage")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 成员管理分页查询:listItem/角色、 username/搜索名称、pageNo/当前页数、pageSize/每页显示条数")
public ResponseVO getAdministerPage(@RequestBody AdministerPageDTO administerPageDTO) {
return ResponseData.generateCreatedResponse(0, administerService.getAdministerPage(administerPageDTO));
}
@PostMapping(value = "/createAdminister")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 新增成员:username/名称、telephone/手机号、avatar/头像、role/角色")
public ResponseVO createAdminister(@RequestBody AdministerDO administerDO) {
administerService.save(administerDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/updateAdminister")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 编辑成员:id/成员ID、username/名称、telephone/手机号、avatar/头像、role/角色")
public ResponseVO updateAdminister(@RequestBody AdministerDO administerDO) {
administerService.updateById(administerDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/deleteById")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 删除成员:id/成员ID")
public ResponseVO delete(@RequestBody AdministerDO administerDO) {
administerService.removeById(administerDO.getId());
return ResponseData.generateCreatedResponse(0);
}
}
package com.zhongzhi.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 系统用户权限表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@RestController
@Api(tags = "用户权限")
@RequestMapping("/administerPermission")
public class AdministerPermissionController {
}
package com.zhongzhi.controller;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.course.CoursesDTO;
import com.zhongzhi.model.CourseDictDO;
import com.zhongzhi.service.CourseDictService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author DengMin
* @since 2022-11-14
*/
@RestController
@RequestMapping("/courseDict")
@Api(tags = "课程字典表")
public class CourseDictController {
@Autowired
private CourseDictService courseDictService;
@PostMapping("addCourse")
@ApiOperation("添加课程 courseName")
public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO) {
courseDictService.addCourse(courseDictDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("updateCourse")
@ApiOperation("编辑课程 id courseName")
public ResponseVO updateCourse(@RequestBody CourseDictDO courseDictDO){
courseDictService.updateCourse(courseDictDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("courses")
@ApiOperation("查询所有课程(+视频数量) pageSize pageNo courseName")
public ResponseVO courses(@RequestBody CoursesDTO coursesDTO){
return ResponseData.generateCreatedResponse(0,courseDictService.courses(coursesDTO));
}
@PostMapping("deleteCourse")
@ApiOperation("删除某个课程 id 课程id")
public ResponseVO deleteCourse(@RequestBody CourseDictDO courseDictDO){
courseDictService.deleteCourse(courseDictDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("courseVods")
@ApiOperation("课程+视频")
public ResponseVO courseVods(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.courseVods(courseDictDO));
}
}
package com.zhongzhi.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author DengMin
* @since 2024-07-12
*/
@RestController
@RequestMapping("/final-match-member-do")
public class FinalMatchMemberController {
}
package com.zhongzhi.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 届数表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@RestController
@Api(tags = "赛事届数")
@RequestMapping("/fundDict")
public class FundDictController {
}
package com.zhongzhi.controller;
import com.zhongzhi.service.ItemFieldDictService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 行业领域字典表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@RestController
@Api(tags = "行业领域")
@RequestMapping("/itemFieldDict")
public class ItemFieldDictController {
@Autowired
public ItemFieldDictService itemFieldDictService;
}
package com.zhongzhi.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.model.MajorDictDO;
import com.zhongzhi.service.MajorDictService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 专业字典表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@RestController
@Api(tags = "就读专业")
@RequestMapping("/majorDict")
public class MajorDictController {
@Autowired
private MajorDictService majorDictService;
@PostMapping(value = "/getMajorList")
@ApiOperation("查询全部就读专业: major/专业名称、education/学历、code/院校代码")
public ResponseVO getMajorList(@RequestBody MajorDictDO majorDictDO) {
return ResponseData.generateCreatedResponse(0, majorDictService.list(new QueryWrapper<MajorDictDO>()
.lambda()
.eq(StringUtils.isNotBlank(majorDictDO.getEducation()), MajorDictDO::getEducation, majorDictDO.getEducation())
.eq(StringUtils.isNotBlank(majorDictDO.getCode()), MajorDictDO::getCode, majorDictDO.getCode())
.like(StringUtils.isNotBlank(majorDictDO.getMajor()), MajorDictDO::getMajor, majorDictDO.getMajor())));
}
}
package com.zhongzhi.controller;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.project.ProjectListPageDTO;
import com.zhongzhi.model.MatchCollegePdfDO;
import com.zhongzhi.service.MatchCollegePdfService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author DengMin
* @since 2024-06-25
*/
@RestController
@RequestMapping("/matchCollegePdf")
@Api(tags = "pdf")
public class MatchCollegePdfController {
@Autowired
private MatchCollegePdfService matchCollegePdfService;
@PostMapping("uploadPdf")
@ApiOperation("上传盖章pdf attachment matchId fileName")
@LoginRequired(Platform.school)
public ResponseVO uploadPdf(@RequestBody MatchCollegePdfDO matchCollegePdfDO) {
matchCollegePdfService.uploadPdf(matchCollegePdfDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("dropPdf")
@ApiOperation("删除盖章pdf matchId")
@LoginRequired(Platform.school)
public ResponseVO dropPdf(@RequestBody MatchCollegePdfDO matchCollegePdfDO) {
matchCollegePdfService.dropPdf (matchCollegePdfDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("queryPdfStatus")
@ApiOperation("查看pdf matchId")
@LoginRequired(Platform.school)
public ResponseVO queryPdfStatus(@RequestBody MatchCollegePdfDO matchCollegePdfDO) {
return ResponseData.generateCreatedResponse(0, matchCollegePdfService.queryPdfStatus (matchCollegePdfDO));
}
}
package com.zhongzhi.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.constant.ProjectType;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.match.MatchDictDTO;
import com.zhongzhi.dto.match.SelectListPageDTO;
import com.zhongzhi.model.MatchDictDO;
import com.zhongzhi.service.MatchDictService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 赛事年份管理 前端控制器
* </p>
*
* @author DengMin
* @since 2021-05-17
*/
@RestController
@Api(tags = "赛事年份管理")
@RequestMapping("/match")
public class MatchDictController {
@Autowired
private MatchDictService matchDictService;
@PostMapping(value = "/getMainTrackMatch")
@LoginRequired({Platform.school, Platform.center, Platform.student})
@ApiOperation("查询主赛道启用赛事年份")
public ResponseVO getMainTrackMatch() {
return ResponseData.generateCreatedResponse(0, matchDictService.getMainTrackMatch());
}
@PostMapping(value = "/getSeedTrackMatch")
@LoginRequired({Platform.school, Platform.center, Platform.student})
@ApiOperation("查询种子赛道启用赛事年份")
public ResponseVO getSeedTrackMatch() {
return ResponseData.generateCreatedResponse(0, matchDictService.getSeedTrackMatch());
}
@PostMapping(value = "/getMatch")
@ApiOperation("查询启用种子赛事年份")
public ResponseVO getMatch() {
return ResponseData.generateCreatedResponse(0, matchDictService.getMatch());
}
@PostMapping(value = "/getVocationalMatch")
@ApiOperation("查询启用职教赛事年份")
public ResponseVO getVocationalMatch() {
return ResponseData.generateCreatedResponse(0, matchDictService.getVocationalMatch());
}
@PostMapping("updateMatchDate")
@ApiOperation("修改届数 id registrationStart registrationDeadline")
public ResponseVO updateMatch(@RequestBody MatchDictDO matchDictDO){
matchDictService.updateMatchDate(matchDictDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("getMatchInfo")
@ApiOperation("查看某届数详情 id")
public ResponseVO getMatch(@RequestBody MatchDictDO matchDictDO){
return ResponseData.generateCreatedResponse(0,matchDictService.getMatch(matchDictDO));
}
@PostMapping(value = "/getMainTrackMatchPage")
@LoginRequired({Platform.center, Platform.school})
@ApiOperation("中心端/院校端 ---分页查询主赛道赛事年份:pageNo、pageSize")
public ResponseVO getMainTrackMatchPage(@RequestBody SelectListPageDTO selectListPageDTO) {
Page page = new Page(selectListPageDTO.getPageNo(), selectListPageDTO.getPageSize());
return ResponseData.generateCreatedResponse(0, matchDictService.page(page, new QueryWrapper<MatchDictDO>()
.lambda()
.eq(MatchDictDO::getMatchType, ProjectType.MAIN_TRACK)));
}
@PostMapping(value = "/getSeedTrackMatchPage")
@LoginRequired({Platform.center, Platform.school, Platform.review})
@ApiOperation("中心端/院校端 ---分页查询种子赛道赛事年份:pageNo、pageSize")
public ResponseVO getSeedTrackMatchPage(@RequestBody SelectListPageDTO selectListPageDTO) {
return ResponseData.generateCreatedResponse(0, matchDictService.getSeedTrackMatchPage(selectListPageDTO));
}
@PostMapping(value = "/createMainTrackMatch")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---创建主赛道赛事年份:matchName/名称、matchDate/年份、startTime/报名起始时间、endTime/报名结束时间、" +
"schedule:[{ scheduleTime/时间安排、explain/说明 }]")
public ResponseVO createMainTrackMatch(@RequestBody MatchDictDTO matchDictDTO) {
matchDictDTO.setMatchType(ProjectType.MAIN_TRACK);
matchDictService.createMatch(matchDictDTO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/createSeedTrackMatch")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---创建种子赛道赛事年份:matchName/名称、matchDate/年份、startTime/报名起始时间、endTime/报名结束时间、" +
"schedule:[{ scheduleTime/时间安排、explains/说明 }]")
public ResponseVO createSeedTrackMatch(@RequestBody MatchDictDTO matchDictDTO) {
matchDictDTO.setMatchType(ProjectType.SEED_TRACK);
matchDictService.createMatch(matchDictDTO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/createVocationalMatch")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---创建职教赛道赛事年份:matchName/名称、matchDate/年份、startTime/报名起始时间、endTime/报名结束时间、" +
"schedule:[{ scheduleTime/时间安排、explains/说明 }]")
public ResponseVO createVocationalMatch(@RequestBody MatchDictDTO matchDictDTO) {
matchDictDTO.setMatchType(ProjectType.VOCATIONAL);
matchDictService.createMatch(matchDictDTO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/updateMatch")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---编辑赛事年份:id/ID、matchName/名称、matchDate/年份、startTime/报名起始时间、endTime/报名结束时间、status/状态(1:启动,0:暂停)" +
"schedule:[{ id/时间安排ID、scheduleTime/时间安排、explains/说明 }]")
public ResponseVO updateMatch(@RequestBody MatchDictDTO matchDictDTO) {
matchDictService.updateMatch(matchDictDTO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/delete")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---删除赛事年份:id/ID")
public ResponseVO delete(@RequestBody MatchDictDO matchDictDO) {
matchDictService.removeById(matchDictDO.getId());
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/getMainTrackMatchAll")
@LoginRequired({Platform.center, Platform.school, Platform.student, Platform.review})
@ApiOperation("中心端/学生端/院校端/审批端 ---查询全部主赛道赛事年份")
public ResponseVO getMainTrackMatchAll() {
return ResponseData.generateCreatedResponse(0, matchDictService.list(new QueryWrapper<MatchDictDO>()
.lambda()
.eq(MatchDictDO::getMatchType, ProjectType.MAIN_TRACK)));
}
@PostMapping(value = "/getSeedTrackMatchAll")
@LoginRequired({Platform.center, Platform.school, Platform.student, Platform.review})
@ApiOperation("中心端/学生端/院校端/审批端 ---查询全部种子赛道赛事年份")
public ResponseVO getSeedTrackMatchAll() {
return ResponseData.generateCreatedResponse(0, matchDictService.list(new QueryWrapper<MatchDictDO>()
.lambda()
.eq(MatchDictDO::getMatchType, ProjectType.SEED_TRACK)));
}
@PostMapping(value = "/getVocationalMatchAll")
@LoginRequired({Platform.center, Platform.school, Platform.student, Platform.review})
@ApiOperation("中心端/学生端/院校端/审批端 ---查询全部职教赛道赛事年份")
public ResponseVO getVocationalMatchAll() {
return ResponseData.generateCreatedResponse(0, matchDictService.list(new QueryWrapper<MatchDictDO>()
.lambda()
.eq(MatchDictDO::getMatchType, ProjectType.VOCATIONAL)));
}
/* 职教管理端 */
@PostMapping(value = "/getVocationalPage")
@LoginRequired({Platform.center, Platform.school, Platform.review})
@ApiOperation("中心端/院校端 ---分页查询职教赛道赛事年份:pageNo、pageSize")
public ResponseVO getVocationalPage(@RequestBody SelectListPageDTO selectListPageDTO) {
return ResponseData.generateCreatedResponse(0, matchDictService.getVocationalPage(selectListPageDTO));
}
}
\ No newline at end of file
package com.zhongzhi.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.constant.ProjectType;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.model.MatchDictDO;
import com.zhongzhi.model.MatchScheduleDO;
import com.zhongzhi.service.MatchDictService;
import com.zhongzhi.service.MatchScheduleService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 时间安排 前端控制器
* </p>
*
* @author DengMin
* @since 2021-05-27
*/
@RestController
@RequestMapping("/matchSchedule")
@Api(tags = "时间安排")
public class MatchScheduleController {
@Autowired
private MatchScheduleService matchScheduleService;
@Autowired
private MatchDictService matchDictService;
@PostMapping(value = "/getMatchSchedule")
@LoginRequired({Platform.student})
@ApiOperation("学生端 ---种子赛道查看时间安排:matchId/赛事年份ID")
public ResponseVO getMatchSchedule(@RequestBody MatchScheduleDO matchScheduleDO) {
MatchDictDO matchDictDO = matchDictService.getOne(new QueryWrapper<MatchDictDO>()
.lambda()
.eq(MatchDictDO::getId, matchScheduleDO.getMatchId())
.eq(MatchDictDO::getMatchType, ProjectType.SEED_TRACK)
.eq(MatchDictDO::getStatus, 1));
List<MatchScheduleDO> list = new ArrayList<>();
if (matchDictDO != null) {
list = matchScheduleService.list(new QueryWrapper<MatchScheduleDO>()
.lambda()
.eq(MatchScheduleDO::getMatchId, matchDictDO.getId()));
}
return ResponseData.generateCreatedResponse(0, list);
}
@PostMapping(value = "getVocationalMatchSchedule")
@LoginRequired({Platform.student})
@ApiOperation("学生端 ---职教赛道查看时间安排:matchId/赛事年份ID")
public ResponseVO getVocationalMatchSchedule(@RequestBody MatchScheduleDO matchScheduleDO) {
MatchDictDO matchDictDO = matchDictService.getOne(new QueryWrapper<MatchDictDO>()
.lambda()
.eq(MatchDictDO::getId, matchScheduleDO.getMatchId())
.eq(MatchDictDO::getMatchType, ProjectType.VOCATIONAL)
.eq(MatchDictDO::getStatus, 1));
List<MatchScheduleDO> list = new ArrayList<>();
if (matchDictDO != null) {
list = matchScheduleService.list(new QueryWrapper<MatchScheduleDO>()
.lambda()
.eq(MatchScheduleDO::getMatchId, matchDictDO.getId()));
}
return ResponseData.generateCreatedResponse(0, list);
}
}
package com.zhongzhi.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.DateFormatUtil;
import com.zhongzhi.common.utils.Localstorage;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.message.MessagePageDTO;
import com.zhongzhi.model.AdministerDO;
import com.zhongzhi.model.MessageDO;
import com.zhongzhi.service.MessageService;
import com.zhongzhi.vo.ResponseVO;
import com.zhongzhi.vo.message.MessageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
* 通知消息表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-05-17
*/
@RestController
@Api(tags = "通知消息")
@RequestMapping("/message")
public class MessageController {
@Autowired
private MessageService messageService;
@PostMapping(value = "/getMessage")
@ApiOperation("查询通知")
public ResponseVO getMessage() {
List<MessageVO> messages = new ArrayList();
List<MessageDO> list = messageService.list(new QueryWrapper<MessageDO>()
.lambda()
.orderByDesc(MessageDO::getCreateTime));
for (MessageDO messageDO : list) {
MessageVO messageVO = new MessageVO();
BeanUtils.copyProperties(messageDO, messageVO);
messageVO.setReleaseTime(DateFormatUtil.format(messageDO.getReleaseTime(), DateFormatUtil.FMT_sdf_yMd));
messages.add(messageVO);
}
return ResponseData.generateCreatedResponse(0, messages);
}
@PostMapping(value = "/getMessageById")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 根据ID查询详情:id/ID")
public ResponseVO getMessageById(@RequestBody MessageDO messageDO) {
return ResponseData.generateCreatedResponse(0, messageService.getById(messageDO.getId()));
}
@PostMapping(value = "/getMessagePage")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---分页查询通知: pageNo/当前页数, pageSize/每页显示条数")
public ResponseVO getMessagePage(@RequestBody MessagePageDTO messagePageDTO) {
return ResponseData.generateCreatedResponse(0, messageService.getMessagePage(messagePageDTO));
}
@PostMapping(value = "/createMessage")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---创建通知: title/标题, content/内容, attachmentUrl/附件地址, releaseTime/发布时间, attachmentName/附件名称, attachmentType/附件类型")
public ResponseVO createMessage(@RequestBody MessageDO messageDO) {
messageService.createMessage(messageDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/updateMessage")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---编辑通知: id/ID, title/标题, content/内容, attachmentUrl/附件地址, attachmentName/附件名称, attachmentType/附件类型")
public ResponseVO updateMessage(@RequestBody MessageDO messageDO) {
messageService.updateById(messageDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/delete")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---删除通知: id/ID, ")
public ResponseVO delete(@RequestBody MessageDO messageDO) {
messageService.removeById(messageDO.getId());
return ResponseData.generateCreatedResponse(0);
}
}
package com.zhongzhi.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 权限表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@RestController
@Api(tags = "权限")
@RequestMapping("/permissions")
public class PermissionsController {
}
package com.zhongzhi.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 项目奖项 前端控制器
* </p>
*
* @author DengMin
* @since 2022-04-25
*/
@RestController
@RequestMapping("/project-award-do")
public class ProjectAwardController {
}
package com.zhongzhi.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 项目软件著作权 前端控制器
* </p>
*
* @author DengMin
* @since 2022-04-25
*/
@RestController
@RequestMapping("/project-copyright-do")
public class ProjectCopyrightController {
}
package com.zhongzhi.controller;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.administer.LoginDTO;
import com.zhongzhi.dto.judge.ProjectJudgePageDTO;
import com.zhongzhi.model.ProjectJudgeDO;
import com.zhongzhi.service.ProjectJudgeService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 项目评审员 前端控制器
* </p>
*
* @author DengMin
* @since 2021-05-28
*/
@RestController
@Api(tags = "评委")
@RequestMapping("/projectJudge")
public class ProjectJudgeController {
@Autowired
private ProjectJudgeService projectJudgeService;
@PostMapping(value = "/login")
@ApiOperation("评审端 --- 登录:telephone/手机号、code/验证码")
public ResponseVO login(@RequestBody LoginDTO loginDTO) {
return ResponseData.generateCreatedResponse(0, projectJudgeService.login(loginDTO));
}
@PostMapping(value = "/getProjectJudgePage")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---评委列表:username/姓名、status/状态、pageNo/当前页数、 pageSize/每页显示条数")
public ResponseVO getProjectJudgePage(@RequestBody ProjectJudgePageDTO projectJudgePageDTO) {
return ResponseData.generateCreatedResponse(0, projectJudgeService.getProjectJudgePage(projectJudgePageDTO));
}
@PostMapping(value = "/createProjectJudge")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---添加评委:username/姓名、telephone/手机号、 position/职位、unit/单位")
public ResponseVO createProjectJudge(@RequestBody ProjectJudgeDO projectJudgeDO) {
projectJudgeService.createProjectJudge(projectJudgeDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/updateProjectJudge")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---编辑评委:id/ID、username/姓名、telephone/手机号、 position/职位、unit/单位, status/状态(1:启用,0:禁用)")
public ResponseVO updateProjectJudge(@RequestBody ProjectJudgeDO projectJudgeDO) {
projectJudgeService.updateProjectJudge(projectJudgeDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/delete")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---删除评委:id/ID")
public ResponseVO delete(@RequestBody ProjectJudgeDO projectJudgeDO) {
projectJudgeService.removeById(projectJudgeDO.getId());
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/projectJudgesAssigned")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---已分配项目评委列表: matchId/赛事ID、projectGroup/组别、projectSchedule/进度")
public ResponseVO projectJudgesAssigned(@RequestBody ProjectJudgePageDTO projectJudgePageDTO) {
return ResponseData.generateCreatedResponse(0, projectJudgeService.projectJudgesAssigned(projectJudgePageDTO));
}
@PostMapping(value = "/downloadJudgeTemplate")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---下载导入评委模板")
public ResponseVO downloadJudgeTemplate() {
projectJudgeService.downloadTemplate();
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/importJudge")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---导入评委:file/文件(数据格式:Form-Data)")
public ResponseVO importJudge(MultipartFile file) {
projectJudgeService.importJudge(file);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/exportProjectJudge")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---导出评委")
public void exportProjectJudge() {
projectJudgeService.exportProjectJudge();
}
}
package com.zhongzhi.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 项目材料 前端控制器
* </p>
*
* @author DengMin
* @since 2021-05-11
*/
@RestController
@RequestMapping("/projectMaterials")
public class ProjectMaterialsController {
}
package com.zhongzhi.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 项目团队信息表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-05-11
*/
@RestController
@RequestMapping("/projectMember")
public class ProjectMemberController {
}
package com.zhongzhi.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 股权结构表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-05-11
*/
@RestController
@RequestMapping("/projectOwnershipStructure")
public class ProjectOwnershipStructureController {
}
package com.zhongzhi.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 项目论文 前端控制器
* </p>
*
* @author DengMin
* @since 2022-04-25
*/
@RestController
@RequestMapping("/project-paper-do")
public class ProjectPaperController {
}
package com.zhongzhi.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 项目专利 前端控制器
* </p>
*
* @author DengMin
* @since 2022-04-25
*/
@RestController
@RequestMapping("/project-patent-do")
public class ProjectPatentController {
}
package com.zhongzhi.controller;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.review.CancelReviewDTO;
import com.zhongzhi.dto.review.ProjectReviewDTO;
import com.zhongzhi.dto.review.SetReviewDTO;
import com.zhongzhi.service.ProjectReviewService;
import com.zhongzhi.vo.ResponseVO;
import com.zhongzhi.vo.review.SendNoticeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 项目评审 前端控制器
* </p>
*
* @author DengMin
* @since 2021-05-18
*/
@RestController
@Api(tags = "项目评审")
@RequestMapping("/projectReview")
public class ProjectReviewController {
@Autowired
private ProjectReviewService projectReviewService;
@PostMapping(value = "/setReview")
@LoginRequired({Platform.center})
@ApiOperation("中心端 ---分配评审:[{projectId}]/项目ID、[{judgeId}]/评委ID、smsMessage/是否发送短信通知(0:不发送,1:发送)")
public ResponseVO setReview(@RequestBody SetReviewDTO setReviewDTO) {
projectReviewService.setReview(setReviewDTO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/sendNotice")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 发送通知评审:id/评委ID, matchId/赛事ID")
public ResponseVO sendNotice(@RequestBody SendNoticeVO sendNoticeVO) {
projectReviewService.sendNotice(sendNoticeVO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/cancelReview")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 撤销分配:projectId/项目ID、[{judgeId}]/评委ID、smsMessage/是否发送短信通知(0:不发送,1:发送)")
public ResponseVO cancelReview(@RequestBody CancelReviewDTO cancelReviewVO) {
projectReviewService.cancelReview(cancelReviewVO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/getProjectReview")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 已分配项目评审员:projectId/项目ID")
public ResponseVO getProjectReview(@RequestBody ProjectReviewDTO projectReviewDTO) {
return ResponseData.generateCreatedResponse(0, projectReviewService.getProjectReview(projectReviewDTO));
}
}
package com.zhongzhi.controller;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.period.ProjectReviewPeriodDTO;
import com.zhongzhi.model.ProjectReviewPeriodDO;
import com.zhongzhi.service.ProjectReviewPeriodService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 评审时段 前端控制器
* </p>
*
* @author DengMin
* @since 2021-06-10
*/
@RestController
@Api(tags = "评审时段")
@RequestMapping("/projectReviewPeriod")
public class ProjectReviewPeriodController {
@Autowired
private ProjectReviewPeriodService projectReviewPeriodService;
@PostMapping(value = "/getProjectReviewPeriod")
@LoginRequired({Platform.center, Platform.school, Platform.review})
@ApiOperation("中心端(种子赛道、职教赛道) --- 查询评审时间:matchId/赛事年份ID、projectGroup/项目组别(科技创新组、红色文创组、高职、中职)、projectSchedule/项目进度(市级初赛、市级复赛、市级决赛)")
public ResponseVO getProjectReviewPeriod(@RequestBody ProjectReviewPeriodDTO projectReviewPeriodDTO) {
return ResponseData.generateCreatedResponse(0, projectReviewPeriodService.getProjectReviewPeriod(projectReviewPeriodDTO));
}
@PostMapping(value = "/updateProjectReviewPeriod")
@LoginRequired(Platform.center)
@ApiOperation("中心端 --- 修改评审时间:id/ID、matchId/赛事ID、projectGroup/项目组别、projectSchedule/项目进度、startTime/开始时间、endTime/结束时间")
public ResponseVO updateProjectReviewPeriod(@RequestBody ProjectReviewPeriodDO projectReviewPeriodDO) {
projectReviewPeriodService.updateProjectReviewPeriod(projectReviewPeriodDO);
return ResponseData.generateCreatedResponse(0);
}
}
package com.zhongzhi.controller;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.scheduleRecord.ProjectScheduleRecordDTO;
import com.zhongzhi.service.ProjectScheduleRecordService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 项目进度记录 前端控制器
* </p>
*
* @author DengMin
* @since 2021-06-02
*/
@RestController
@Api(tags = "项目进度记录")
@RequestMapping("/projectScheduleRecord")
public class ProjectScheduleRecordController {
@Autowired
private ProjectScheduleRecordService projectScheduleRecordService;
@PostMapping(value = "/getProjectScheduleRecord")
@ApiOperation("中心端 ---获奖情况")
@LoginRequired({Platform.center})
public ResponseVO getProjectScheduleRecord(@RequestBody ProjectScheduleRecordDTO projectScheduleRecordDTO) {
return ResponseData.generateCreatedResponse(0, projectScheduleRecordService.getProjectScheduleRecord(projectScheduleRecordDTO));
}
}
package com.zhongzhi.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 项目作品 前端控制器
* </p>
*
* @author DengMin
* @since 2022-04-25
*/
@RestController
@RequestMapping("/project-trademark-do")
public class ProjectTrademarkController {
}
package com.zhongzhi.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 项目作品 前端控制器
* </p>
*
* @author DengMin
* @since 2022-04-25
*/
@RestController
@RequestMapping("/project-works-do")
public class ProjectWorksController {
}
package com.zhongzhi.controller;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.model.AdministerDO;
import com.zhongzhi.model.SmsCodeDO;
import com.zhongzhi.service.SmsCodeService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 短信验证码 前端控制器
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@RestController
@Api(tags = "短信验证码")
@RequestMapping("/smsCode")
public class SmsCodeController {
@Autowired
private SmsCodeService smsCodeService;
@PostMapping(value = "/sendRegisterCode")
@ApiOperation("学生端 ---注册验证码:telephone/手机号")
public ResponseVO sendRegisterCode(@RequestBody SmsCodeDO smsCodeDO) {
smsCodeService.sendRegisterCode(smsCodeDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/sendStudentLoginCode")
@ApiOperation("学生端 ---登陆验证码:telephone/手机号")
public ResponseVO sendStudentLoginCode(@RequestBody SmsCodeDO smsCodeDO) {
smsCodeService.sendStudentLoginCode(smsCodeDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/sendAdministerLoginCode")
@ApiOperation("中心端 --- 中心端登陆验证码:telephone/手机号")
public ResponseVO sendAdministerLoginCode(@RequestBody AdministerDO administerDO) {
smsCodeService.sendAdministerLoginCode(administerDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/sendJudgeLoginCode")
@ApiOperation("评审端 ---登陆验证码:telephone/手机号")
public ResponseVO sendJudgeLoginCode(@RequestBody SmsCodeDO smsCodeDO) {
smsCodeService.sendJudgeLoginCode(smsCodeDO);
return ResponseData.generateCreatedResponse(0);
}
}
package com.zhongzhi.controller;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.notice.SmsNoticeDTO;
import com.zhongzhi.dto.notice.SmsNoticePageDTO;
import com.zhongzhi.service.SmsNoticeService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 短信通知记录 前端控制器
* </p>
*
* @author DengMin
* @since 2022-04-15
*/
@RestController
@Api(tags = "短信通知")
@RequestMapping("/smsNotice")
public class SmsNoticeController {
@Autowired
private SmsNoticeService smsNoticeService;
@PostMapping(value = "batchSend")
@LoginRequired({Platform.center})
@ApiOperation("管理端 -- 批量发送短信:matchId/赛事年份ID、projectGroup/组别、projectSchedule/阶段、projectStatus/状态、name/搜索名称")
public ResponseVO batchSend(@RequestBody SmsNoticeDTO smsNoticeDTO) {
smsNoticeService.batchSend(smsNoticeDTO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "send")
@LoginRequired({Platform.center})
@ApiOperation("管理端 -- 发送短信:ids/项目ID(数组)")
public ResponseVO send(@RequestBody SmsNoticeDTO smsNoticeDTO) {
smsNoticeService.send(smsNoticeDTO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "getListByPage")
@LoginRequired({Platform.center})
@ApiOperation("管理端 -- 发送短信记录:date/日期、name/搜索名称、pageNo、pageSize")
public ResponseVO getListByPage(@RequestBody SmsNoticePageDTO smsNoticePageDTO) {
return ResponseData.generateCreatedResponse(0, smsNoticeService.getListByPage(smsNoticePageDTO));
}
}
\ No newline at end of file
package com.zhongzhi.controller;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.student.LoginDTO;
import com.zhongzhi.dto.student.RegisterDTO;
import com.zhongzhi.model.StudentDO;
import com.zhongzhi.service.StudentService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@RestController
@Api(tags = "学生")
@RequestMapping("/student")
public class StudentController {
@Autowired
private StudentService studentService;
@PostMapping(value = "/register")
@ApiOperation("注册:name/真实姓名, idCard/身份证, telephone/手机号, code/验证码, " +
"education/学历层次, school/就读院校, major/就读专业, enrollmentDate/入学年份, graduateDate/毕业年份")
public ResponseVO register(@RequestBody RegisterDTO registerDTO) {
return ResponseData.generateCreatedResponse(0, studentService.register(registerDTO));
}
@PostMapping(value = "/login")
@ApiOperation("登陆:telephone/手机号, code/验证码")
public ResponseVO login(@RequestBody LoginDTO loginDTO) {
return ResponseData.generateCreatedResponse(0, studentService.login(loginDTO));
}
@PostMapping(value = "updateStudentInfo")
@LoginRequired({ Platform.student })
@ApiOperation("登陆:id/ID, education/学历, college/就读院校, major/专业, enrollmentDate/入学年份, graduateDate/毕业年份")
public ResponseVO updateStudentInfo(@RequestBody StudentDO studentDO) {
studentService.updateStudentInfo(studentDO);
return ResponseData.generateCreatedResponse(0);
}
}
package com.zhongzhi.controller;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.course.ChangeOrdersDTO;
import com.zhongzhi.dto.course.VodsDTO;
import com.zhongzhi.model.CourseDictDO;
import com.zhongzhi.model.VodDictDO;
import com.zhongzhi.service.VodDictService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author DengMin
* @since 2022-11-14
*/
@RestController
@RequestMapping("/vodDict")
@Api(tags = "视频字典表")
public class VodDictController {
@Autowired
private VodDictService vodDictService;
@PostMapping("/signature")
@ApiOperation("获取签名")
public ResponseVO signature()throws Exception{
return ResponseData.generateCreatedResponse(0,vodDictService.signature());
}
@PostMapping("deleteVod")
@ApiOperation("删除视频 id")
public ResponseVO deleteVod(@RequestBody VodDictDO vodDictDO){
vodDictService.deleteVod(vodDictDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("addVod")
@ApiOperation("新增视频 courseId vodName vodUrl vodCode vodLength vodSize vodFormat coverPage")
public ResponseVO orderNo(@RequestBody VodDictDO vodDictDO){
vodDictService.addVod(vodDictDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("updateVod")
@ApiOperation("修改视频 id vodName vodName vodUrl vodCode vodLength vodSize vodFormat coverPage ")
public ResponseVO updateVod(@RequestBody VodDictDO vodDictDO){
vodDictService.updateVod(vodDictDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("changeOrders")
@ApiOperation("排序 ids[]")
public ResponseVO changeOrders(@RequestBody ChangeOrdersDTO changeOrdersDTO){
vodDictService.changeOrders(changeOrdersDTO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("vods")
@ApiOperation("查询课程下的视频 courseId vodName")
public ResponseVO vods(@RequestBody VodsDTO vodsDTO){
return ResponseData.generateCreatedResponse(0, vodDictService.vods(vodsDTO));
}
@PostMapping("fourVods")
@ApiOperation("首页只查询4个视频 yearId ")
public ResponseVO fourVods(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,vodDictService.fourVods(courseDictDO));
}
}
package com.zhongzhi.controller;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.model.YearDictDO;
import com.zhongzhi.service.YearDictService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 年份字典表 前端控制器
* </p>
*
* @author DengMin
* @since 2023-04-11
*/
@RestController
@RequestMapping("/yearDict")
@Api(tags = "年份管理")
public class YearDictController {
@Autowired
private YearDictService yearDictService;
@PostMapping("queryYears")
@ApiOperation("查询年份")
public ResponseVO queryYears(){
return ResponseData.generateCreatedResponse(0,yearDictService.queryYears());
}
@PostMapping("updateYear")
@ApiOperation("编辑年份 id year status")
public ResponseVO updateYear(@RequestBody YearDictDO yearDictDO){
yearDictService.updateYear(yearDictDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping("addYear")
@ApiOperation("添加年份 year status ")
public ResponseVO addYear(@RequestBody YearDictDO yearDictDO){
yearDictService.addYear(yearDictDO);
return ResponseData.generateCreatedResponse(0);
}
}
package com.zhongzhi.dao;
import com.zhongzhi.model.AdministerDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 中心管理账户表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@Repository
public interface AdministerDAO extends BaseMapper<AdministerDO> {
}
package com.zhongzhi.dao;
import com.zhongzhi.model.AdministerPermissionDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 系统用户权限表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@Repository
public interface AdministerPermissionDAO extends BaseMapper<AdministerPermissionDO> {
}
package com.zhongzhi.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongzhi.dto.college.ExportCollegeDTO;
import com.zhongzhi.model.CollegesDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhongzhi.vo.college.AwardedListVO;
import com.zhongzhi.vo.college.CollegePageVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 院校字典表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@Repository
public interface CollegesDictDAO extends BaseMapper<CollegesDictDO> {
IPage<CollegePageVO> listPage(Page page, String name);
IPage<AwardedListVO> getAwardedList(Page page, String name);
List<AwardedListVO> getAwardedListAll();
}
package com.zhongzhi.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhongzhi.model.CourseDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhongzhi.vo.course.CoursesVO;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-11-14
*/
@Repository
public interface CourseDictDAO extends BaseMapper<CourseDictDO> {
IPage<CoursesVO> courses(IPage page, String courseName,Long yearId);
}
package com.zhongzhi.dao;
import com.zhongzhi.model.FinalMatchMemberDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhongzhi.vo.college.ExportListVO;
import com.zhongzhi.vo.college.RegisterMembersVO;
import com.zhongzhi.vo.college.SchoolsVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author DengMin
* @since 2024-07-12
*/
@Repository
public interface FinalMatchMemberDAO extends BaseMapper<FinalMatchMemberDO> {
List<RegisterMembersVO> registerMembers(Long collegeId,Long matchId);
List<RegisterMembersVO> otherMembers(Long collegeId,Long matchId);
List<RegisterMembersVO> cars(Long collegeId,Long matchId);
String latestUpdateTime(Long collegeId);
List<SchoolsVO> schools(Long matchId,String name);
/**
* 导出名单
*/
List<ExportListVO> exportList(Long matchId,Long collegeId);
}
package com.zhongzhi.dao;
import com.zhongzhi.model.FundDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 届数表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@Repository
public interface FundDictDAO extends BaseMapper<FundDictDO> {
}
package com.zhongzhi.dao;
import com.zhongzhi.model.ItemFieldDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 行业领域字典表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@Repository
public interface ItemFieldDictDAO extends BaseMapper<ItemFieldDictDO> {
}
package com.zhongzhi.dao;
import com.zhongzhi.model.MajorDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 专业字典表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@Repository
public interface MajorDictDAO extends BaseMapper<MajorDictDO> {
}
package com.zhongzhi.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhongzhi.model.MatchCollegePdfDO;
import org.springframework.stereotype.Repository;
@Repository
public interface MatchCollegePdfMapper extends BaseMapper<MatchCollegePdfDO> {
}
No preview for this file type
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!