init...
This commit is contained in:
8
.idea/compiler.xml
generated
Normal file
8
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="true" />
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
18
.idea/gradle.xml
generated
Normal file
18
.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="distributionType" value="WRAPPED" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="useAutoImport" value="true" />
|
||||||
|
<option name="useQualifiedModuleNames" value="true" />
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
40
build.gradle
Normal file
40
build.gradle
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '2.7.0'
|
||||||
|
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
||||||
|
}
|
||||||
|
|
||||||
|
group 'com.hongliang.videotask'
|
||||||
|
version '1.0-SNAPSHOT'
|
||||||
|
|
||||||
|
sourceCompatibility = 1.8
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test' // Spring Boot测试模块
|
||||||
|
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.4' // MyBatis Spring Boot Starter的最新版本为2.1.4
|
||||||
|
implementation 'org.mybatis:mybatis:3.5.8'
|
||||||
|
implementation 'org.mybatis:mybatis-spring:2.0.6'
|
||||||
|
implementation 'mysql:mysql-connector-java:8.0.26' // MySQL Connector
|
||||||
|
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
|
||||||
|
implementation 'com.alibaba:druid:1.1.10'
|
||||||
|
implementation 'com.alibaba:druid-spring-boot-starter:1.1.10'
|
||||||
|
|
||||||
|
implementation 'com.alibaba:fastjson:1.2.67'
|
||||||
|
|
||||||
|
compile "org.projectlombok:lombok:1.18.6"
|
||||||
|
compileOnly 'org.projectlombok:lombok:1.18.6'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok:1.18.6'
|
||||||
|
|
||||||
|
// Sa-Token 权限认证,在线文档:https://sa-token.cc
|
||||||
|
implementation 'cn.dev33:sa-token-spring-boot-starter:1.37.0'
|
||||||
|
|
||||||
|
testImplementation platform('org.junit:junit-bom:5.9.1')
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||||
|
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||||
|
}
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
172
gradlew
vendored
Normal file
172
gradlew
vendored
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
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
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
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
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
84
gradlew.bat
vendored
Normal file
84
gradlew.bat
vendored
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
2
settings.gradle
Normal file
2
settings.gradle
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
rootProject.name = 'videotask'
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.hongliang.videotask.CustomEnum;
|
||||||
|
|
||||||
|
public enum RecordStatusEnum {
|
||||||
|
NORMAL,
|
||||||
|
DELETE
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.hongliang.videotask.CustomEnum;
|
||||||
|
|
||||||
|
public enum UserTypeEnum {
|
||||||
|
SUPER_ADMIN, //超级管理员
|
||||||
|
SYSTEM_ADMIN, //系统管理员
|
||||||
|
USER, //普通用户
|
||||||
|
INTERFACE_USER, //接口用户
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.hongliang.videotask;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.SaManager;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.hongliang.videotask.mappers")
|
||||||
|
public class VideoTaskApplication {
|
||||||
|
public static void main(String[] args) throws JsonProcessingException {
|
||||||
|
SpringApplication.run(VideoTaskApplication.class, args);
|
||||||
|
System.out.println("启动成功,Sa-Token 配置如下:" + SaManager.getConfig());
|
||||||
|
}
|
||||||
|
}
|
||||||
13
src/main/java/com/hongliang/videotask/bean/LoginBean.java
Normal file
13
src/main/java/com/hongliang/videotask/bean/LoginBean.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.hongliang.videotask.bean;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class LoginBean {
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.hongliang.videotask.bean;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LoginResultBean {
|
||||||
|
private Integer userid;
|
||||||
|
private String username;
|
||||||
|
private String name;
|
||||||
|
private String access_token;
|
||||||
|
private String expire_datetime;
|
||||||
|
}
|
||||||
17
src/main/java/com/hongliang/videotask/bean/UserBean.java
Normal file
17
src/main/java/com/hongliang/videotask/bean/UserBean.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.hongliang.videotask.bean;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class UserBean {
|
||||||
|
private Integer id;
|
||||||
|
private String username;
|
||||||
|
private String name;
|
||||||
|
private String createdate;
|
||||||
|
private String updatedate;
|
||||||
|
}
|
||||||
15
src/main/java/com/hongliang/videotask/common/Response.java
Normal file
15
src/main/java/com/hongliang/videotask/common/Response.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package com.hongliang.videotask.common;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Response {
|
||||||
|
private int code;
|
||||||
|
private String msg;
|
||||||
|
private Object data;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.hongliang.videotask.common;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Controller返回的状态码
|
||||||
|
* */
|
||||||
|
public class ResponseCode {
|
||||||
|
public static Integer OK = 200; //正常
|
||||||
|
public static Integer LOGIN_ERROR=8001; //登录错误
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.hongliang.videotask.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import com.hongliang.videotask.bean.LoginBean;
|
||||||
|
import com.hongliang.videotask.bean.LoginResultBean;
|
||||||
|
import com.hongliang.videotask.common.Response;
|
||||||
|
import com.hongliang.videotask.common.ResponseCode;
|
||||||
|
import com.hongliang.videotask.service.impl.LoginServiceImpl;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/user")
|
||||||
|
public class UserControl {
|
||||||
|
@Resource
|
||||||
|
private LoginServiceImpl loginService;
|
||||||
|
|
||||||
|
@GetMapping("hello")
|
||||||
|
public ResponseEntity<?> hello(){
|
||||||
|
return ResponseEntity.ok(new Response(200,"ok","hello world!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("login")
|
||||||
|
public ResponseEntity<?> login(@RequestBody LoginBean loginBean){
|
||||||
|
LoginResultBean loginResultBean= loginService.Login(loginBean.getUsername(),loginBean.getPassword());
|
||||||
|
if (loginResultBean==null){
|
||||||
|
return ResponseEntity.ok(new Response(ResponseCode.LOGIN_ERROR,"用户名或密码错误",null));
|
||||||
|
}else{
|
||||||
|
StpUtil.login(loginResultBean.getUserid()); //saToken登录
|
||||||
|
//获取token
|
||||||
|
loginResultBean.setAccess_token(StpUtil.getTokenInfo().tokenValue);
|
||||||
|
//获取过期时间
|
||||||
|
LocalDateTime now=LocalDateTime.now();
|
||||||
|
LocalDateTime newTime=now.plusSeconds(StpUtil.getTokenInfo().getTokenTimeout());
|
||||||
|
loginResultBean.setExpire_datetime(newTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
|
return ResponseEntity.ok(new Response(ResponseCode.OK,"登录成功",loginResultBean));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("islogin")
|
||||||
|
public ResponseEntity<?> isLogin(){
|
||||||
|
return ResponseEntity.ok(new Response(ResponseCode.OK,StpUtil.isLogin()?"已登录":"未登录",StpUtil.isLogin()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("logout")
|
||||||
|
public ResponseEntity<?> logout(){
|
||||||
|
return ResponseEntity.ok(new Response(ResponseCode.OK,"成功退出",null));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.hongliang.videotask.mappers;
|
||||||
|
|
||||||
|
import com.hongliang.videotask.bean.LoginResultBean;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface LoginMapper {
|
||||||
|
@Select("select *,id as userid from users where username=#{username} and password=#{password}")
|
||||||
|
LoginResultBean Login(String username,String password);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.hongliang.videotask.mappers;
|
||||||
|
|
||||||
|
import com.hongliang.videotask.bean.UserBean;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface UserMapper {
|
||||||
|
/**
|
||||||
|
* 根据用户ID获取用户信息
|
||||||
|
* @param id 用户ID
|
||||||
|
* @return UserBean
|
||||||
|
*/
|
||||||
|
@Select("select * from users where id=#{id}")
|
||||||
|
UserBean GetUserByID(int id);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.hongliang.videotask.service;
|
||||||
|
|
||||||
|
import com.hongliang.videotask.bean.LoginResultBean;
|
||||||
|
|
||||||
|
public interface LoginService {
|
||||||
|
LoginResultBean Login(String username,String password);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.hongliang.videotask.service;
|
||||||
|
|
||||||
|
import com.hongliang.videotask.bean.UserBean;
|
||||||
|
|
||||||
|
public interface UserService {
|
||||||
|
UserBean GetUserByID(int id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.hongliang.videotask.service.impl;
|
||||||
|
|
||||||
|
import com.hongliang.videotask.bean.LoginResultBean;
|
||||||
|
import com.hongliang.videotask.mappers.LoginMapper;
|
||||||
|
import com.hongliang.videotask.service.LoginService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class LoginServiceImpl implements LoginService {
|
||||||
|
@Autowired
|
||||||
|
private LoginMapper loginMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoginResultBean Login(String username, String password){
|
||||||
|
return this.loginMapper.Login(username,password);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.hongliang.videotask.service.impl;
|
||||||
|
|
||||||
|
import com.hongliang.videotask.bean.UserBean;
|
||||||
|
import com.hongliang.videotask.mappers.UserMapper;
|
||||||
|
import com.hongliang.videotask.service.UserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserServiceImpl implements UserService {
|
||||||
|
@Autowired
|
||||||
|
private UserMapper userMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserBean GetUserByID(int id){
|
||||||
|
return this.userMapper.GetUserByID(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
72
src/main/java/com/hongliang/videotask/utils/AES.java
Normal file
72
src/main/java/com/hongliang/videotask/utils/AES.java
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
package com.hongliang.videotask.utils;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
public class AES {
|
||||||
|
private static final String AES_ALGORITHM = "AES";
|
||||||
|
// AES加密模式为CBC,填充方式为PKCS5Padding
|
||||||
|
private static final String AES_TRANSFORMATION = "AES/CBC/PKCS5Padding";
|
||||||
|
// AES密钥为16位
|
||||||
|
private static final String AES_KEY = "1234567890123456";
|
||||||
|
// AES初始化向量为16位
|
||||||
|
private static final String AES_IV = "abcdefghijklmnop";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AES加密
|
||||||
|
*
|
||||||
|
* @param data 待加密的数据
|
||||||
|
* @return 加密后的数据,使用Base64编码
|
||||||
|
*/
|
||||||
|
public static String encrypt(String data) throws Exception {
|
||||||
|
// 将AES密钥转换为SecretKeySpec对象
|
||||||
|
SecretKeySpec secretKeySpec = new SecretKeySpec(AES_KEY.getBytes(), AES_ALGORITHM);
|
||||||
|
// 将AES初始化向量转换为IvParameterSpec对象
|
||||||
|
IvParameterSpec ivParameterSpec = new IvParameterSpec(AES_IV.getBytes());
|
||||||
|
// 根据加密算法获取加密器
|
||||||
|
Cipher cipher = Cipher.getInstance(AES_TRANSFORMATION);
|
||||||
|
// 初始化加密器,设置加密模式、密钥和初始化向量
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
|
||||||
|
// 加密数据
|
||||||
|
byte[] encryptedData = cipher.doFinal(data.getBytes(StandardCharsets.UTF_8));
|
||||||
|
// 对加密后的数据使用Base64编码
|
||||||
|
return Base64.getEncoder().encodeToString(encryptedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AES解密
|
||||||
|
*
|
||||||
|
* @param encryptedData 加密后的数据,使用Base64编码
|
||||||
|
* @return 解密后的数据
|
||||||
|
*/
|
||||||
|
public static String decrypt(String encryptedData) throws Exception {
|
||||||
|
// 将AES密钥转换为SecretKeySpec对象
|
||||||
|
SecretKeySpec secretKeySpec = new SecretKeySpec(AES_KEY.getBytes(), AES_ALGORITHM);
|
||||||
|
// 将AES初始化向量转换为IvParameterSpec对象
|
||||||
|
IvParameterSpec ivParameterSpec = new IvParameterSpec(AES_IV.getBytes());
|
||||||
|
// 根据加密算法获取解密器
|
||||||
|
Cipher cipher = Cipher.getInstance(AES_TRANSFORMATION);
|
||||||
|
// 初始化解密器,设置解密模式、密钥和初始化向量
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
|
||||||
|
// 对加密后的数据使用Base64解码
|
||||||
|
byte[] decodedData = Base64.getDecoder().decode(encryptedData);
|
||||||
|
// 解密数据
|
||||||
|
byte[] decryptedData = cipher.doFinal(decodedData);
|
||||||
|
// 返回解密后的数据
|
||||||
|
return new String(decryptedData, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) throws Exception {
|
||||||
|
// String data = "Hello World";
|
||||||
|
//
|
||||||
|
// String encryptedData = encrypt(data);
|
||||||
|
// System.out.println("加密后的数据:" + encryptedData);
|
||||||
|
//
|
||||||
|
// String decryptedData = decrypt(encryptedData);
|
||||||
|
// System.out.println("解密后的数据:" + decryptedData);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
76
src/main/java/com/hongliang/videotask/utils/DES.java
Normal file
76
src/main/java/com/hongliang/videotask/utils/DES.java
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
package com.hongliang.videotask.utils;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
|
import javax.crypto.SecretKeyFactory;
|
||||||
|
import javax.crypto.spec.DESKeySpec;
|
||||||
|
import java.security.spec.KeySpec;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
public class DES {
|
||||||
|
private static final String DES_ALGORITHM = "DES";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DES加密
|
||||||
|
*
|
||||||
|
* @param data 待加密的数据
|
||||||
|
* @param key 密钥,长度必须为8位
|
||||||
|
* @return 加密后的数据,使用Base64编码
|
||||||
|
*/
|
||||||
|
public static String encrypt(String data, String key) throws Exception {
|
||||||
|
// 根据密钥生成密钥规范
|
||||||
|
KeySpec keySpec = new DESKeySpec(key.getBytes());
|
||||||
|
// 根据密钥规范生成密钥工厂
|
||||||
|
SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(DES_ALGORITHM);
|
||||||
|
// 根据密钥工厂和密钥规范生成密钥
|
||||||
|
SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
|
||||||
|
|
||||||
|
// 根据加密算法获取加密器
|
||||||
|
Cipher cipher = Cipher.getInstance(DES_ALGORITHM);
|
||||||
|
// 初始化加密器,设置加密模式和密钥
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
||||||
|
// 加密数据
|
||||||
|
byte[] encryptedData = cipher.doFinal(data.getBytes());
|
||||||
|
// 对加密后的数据进行Base64编码
|
||||||
|
return Base64.getEncoder().encodeToString(encryptedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DES解密
|
||||||
|
*
|
||||||
|
* @param encryptedData 加密后的数据,使用Base64编码
|
||||||
|
* @param key 密钥,长度必须为8位
|
||||||
|
* @return 解密后的数据
|
||||||
|
*/
|
||||||
|
public static String decrypt(String encryptedData, String key) throws Exception {
|
||||||
|
// 根据密钥生成密钥规范
|
||||||
|
KeySpec keySpec = new DESKeySpec(key.getBytes());
|
||||||
|
// 根据密钥规范生成密钥工厂
|
||||||
|
SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(DES_ALGORITHM);
|
||||||
|
// 根据密钥工厂和密钥规范生成密钥
|
||||||
|
SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
|
||||||
|
|
||||||
|
// 对加密后的数据进行Base64解码
|
||||||
|
byte[] decodedData = Base64.getDecoder().decode(encryptedData);
|
||||||
|
// 根据加密算法获取解密器
|
||||||
|
Cipher cipher = Cipher.getInstance(DES_ALGORITHM);
|
||||||
|
// 初始化解密器,设置解密模式和密钥
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, secretKey);
|
||||||
|
// 解密数据
|
||||||
|
byte[] decryptedData = cipher.doFinal(decodedData);
|
||||||
|
// 将解密后的数据转换为字符串
|
||||||
|
return new String(decryptedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) throws Exception {
|
||||||
|
// String data = "Hello World";
|
||||||
|
// String key = "12345678";
|
||||||
|
//
|
||||||
|
// String encryptedData = encrypt(data, key);
|
||||||
|
// System.out.println("加密后的数据:" + encryptedData);
|
||||||
|
//
|
||||||
|
// String decryptedData = decrypt(encryptedData, key);
|
||||||
|
// System.out.println("解密后的数据:" + decryptedData);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
27
src/main/java/com/hongliang/videotask/utils/MD5.java
Normal file
27
src/main/java/com/hongliang/videotask/utils/MD5.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package com.hongliang.videotask.utils;
|
||||||
|
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.util.Formatter;
|
||||||
|
|
||||||
|
public class MD5 {
|
||||||
|
private static final String MD5_ALGORITHM = "MD5";
|
||||||
|
public static String encrypt(String data) throws Exception {
|
||||||
|
// 获取MD5算法实例
|
||||||
|
MessageDigest messageDigest = MessageDigest.getInstance(MD5_ALGORITHM);
|
||||||
|
// 计算散列值
|
||||||
|
byte[] digest = messageDigest.digest(data.getBytes());
|
||||||
|
Formatter formatter = new Formatter();
|
||||||
|
// 补齐前导0,并格式化
|
||||||
|
for (byte b : digest) {
|
||||||
|
formatter.format("%02x", b);
|
||||||
|
}
|
||||||
|
return formatter.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) throws Exception {
|
||||||
|
// String data = "Hello World";
|
||||||
|
// String encryptedData = encrypt(data);
|
||||||
|
// System.out.println("加密后的数据:" + encryptedData);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
65
src/main/java/com/hongliang/videotask/utils/RSA.java
Normal file
65
src/main/java/com/hongliang/videotask/utils/RSA.java
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package com.hongliang.videotask.utils;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.*;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
public class RSA {
|
||||||
|
private static final String RSA_ALGORITHM = "RSA";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成RSA密钥对
|
||||||
|
*
|
||||||
|
* @return RSA密钥对
|
||||||
|
*/
|
||||||
|
public static KeyPair generateKeyPair() throws NoSuchAlgorithmException {
|
||||||
|
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(RSA_ALGORITHM);
|
||||||
|
keyPairGenerator.initialize(2048); // 密钥大小为2048位
|
||||||
|
return keyPairGenerator.generateKeyPair();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用公钥加密数据
|
||||||
|
*
|
||||||
|
* @param data 待加密的数据
|
||||||
|
* @param publicKey 公钥
|
||||||
|
* @return 加密后的数据
|
||||||
|
*/
|
||||||
|
public static String encrypt(String data, PublicKey publicKey) throws Exception {
|
||||||
|
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||||
|
byte[] encryptedData = cipher.doFinal(data.getBytes(StandardCharsets.UTF_8));
|
||||||
|
return Base64.getEncoder().encodeToString(encryptedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用私钥解密数据
|
||||||
|
*
|
||||||
|
* @param encryptedData 加密后的数据
|
||||||
|
* @param privateKey 私钥
|
||||||
|
* @return 解密后的数据
|
||||||
|
*/
|
||||||
|
public static String decrypt(String encryptedData, PrivateKey privateKey) throws Exception {
|
||||||
|
byte[] decodedData = Base64.getDecoder().decode(encryptedData);
|
||||||
|
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||||
|
byte[] decryptedData = cipher.doFinal(decodedData);
|
||||||
|
return new String(decryptedData, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) throws Exception {
|
||||||
|
// KeyPair keyPair = generateKeyPair();
|
||||||
|
// PublicKey publicKey = keyPair.getPublic();
|
||||||
|
// PrivateKey privateKey = keyPair.getPrivate();
|
||||||
|
//
|
||||||
|
// String data = "Hello World";
|
||||||
|
//
|
||||||
|
// String encryptedData = encrypt(data, publicKey);
|
||||||
|
// System.out.println("加密后的数据:" + encryptedData);
|
||||||
|
//
|
||||||
|
// String decryptedData = decrypt(encryptedData, privateKey);
|
||||||
|
// System.out.println("解密后的数据:" + decryptedData);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
25
src/main/java/com/hongliang/videotask/utils/SHA256.java
Normal file
25
src/main/java/com/hongliang/videotask/utils/SHA256.java
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package com.hongliang.videotask.utils;
|
||||||
|
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
|
public class SHA256 {
|
||||||
|
private static final String SHA_256_ALGORITHM = "SHA-256";
|
||||||
|
public static String encrypt(String data) throws Exception {
|
||||||
|
//获取SHA-256算法实例
|
||||||
|
MessageDigest messageDigest = MessageDigest.getInstance(SHA_256_ALGORITHM);
|
||||||
|
//计算散列值
|
||||||
|
byte[] digest = messageDigest.digest(data.getBytes());
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
//将byte数组转换为15进制字符串
|
||||||
|
for (byte b : digest) {
|
||||||
|
stringBuilder.append(Integer.toHexString((b & 0xFF) | 0x100), 1, 3);
|
||||||
|
}
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) throws Exception {
|
||||||
|
// String data = "Hello World";
|
||||||
|
// String encryptedData = encrypt(data);
|
||||||
|
// System.out.println("加密后的数据:" + encryptedData);
|
||||||
|
// }
|
||||||
|
}
|
||||||
75
src/main/resources/application-dev.properties
Normal file
75
src/main/resources/application-dev.properties
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
#配置端口号
|
||||||
|
server.port=8426
|
||||||
|
|
||||||
|
#返回json的全局时间格式
|
||||||
|
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||||
|
spring.jackson.time-zone=GMT+8
|
||||||
|
|
||||||
|
############## Sa-Token 配置 (文档: https://sa-token.cc) ##############
|
||||||
|
# token 名称(同时也是 cookie 名称)
|
||||||
|
sa-token.token-name=x-access-token
|
||||||
|
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
|
||||||
|
sa-token.timeout=2592000
|
||||||
|
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||||
|
sa-token.active-timeout=-1
|
||||||
|
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
|
||||||
|
sa-token.is-concurrent=true
|
||||||
|
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
|
||||||
|
sa-token.is-share=true
|
||||||
|
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik)
|
||||||
|
sa-token.token-style=uuid
|
||||||
|
# 是否输出操作日志
|
||||||
|
sa-token.is-log=true
|
||||||
|
# token前缀
|
||||||
|
sa-token.token-prefix=Bearer
|
||||||
|
# 是否从header中读取token
|
||||||
|
sa-token.is-read-header=true
|
||||||
|
|
||||||
|
|
||||||
|
#=============================druid_config==========================
|
||||||
|
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||||
|
### 人大金仓连接k8######
|
||||||
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
|
spring.datasource.url=jdbc:mysql://localhost:3306/videotask?characterEncoding=utf-8
|
||||||
|
spring.datasource.username=videotask
|
||||||
|
spring.datasource.password=123456
|
||||||
|
# 初始化大小,最小,最大
|
||||||
|
#spring.datasource.druid.initial-size=5
|
||||||
|
#spring.datasource.druid.min-idle= 3
|
||||||
|
#spring.datasource.druid.max-active= 20
|
||||||
|
## 配置获取连接等待超时的时间
|
||||||
|
#spring.datasource.druid.max-wait= 60000
|
||||||
|
## 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒,下面是:1分钟
|
||||||
|
#spring.datasource.druid.time-between-eviction-runs-millis= 60000
|
||||||
|
## 配置一个连接在池中最小生存的时间,单位是毫秒,下面是:5分钟
|
||||||
|
#spring.datasource.druid.min-evictable-idle-time-millis= 300000
|
||||||
|
## 打开PSCache,并且指定每个连接上PSCache的大小
|
||||||
|
#spring.datasource.druid.pool-prepared-statements= true
|
||||||
|
#spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
|
||||||
|
## 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||||
|
#spring.datasource.druid.filters=stat
|
||||||
|
## asyncInit是1.1.4中新增加的配置,如果有initialSize数量较多时,打开会加快应用启动时间
|
||||||
|
#spring.datasource.druid.asyncInit=true
|
||||||
|
## 验证连接是否可用,使用的SQL语句
|
||||||
|
#spring.datasource.druid.validation-query=select 1
|
||||||
|
## 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除.
|
||||||
|
#spring.datasource.druid.test-while-idle=true
|
||||||
|
#spring.datasource.druid.stat-view-servlet.login-username=druid_admin
|
||||||
|
#spring.datasource.druid.stat-view-servlet.login-password=1qaz2wsx#EDC
|
||||||
|
spring.datasource.druid.initial-size=5
|
||||||
|
spring.datasource.druid.min-idle=5
|
||||||
|
spring.datasource.druid.max-active=20
|
||||||
|
spring.datasource.druid.max-wait=60000
|
||||||
|
spring.datasource.druid.test-while-idle=true
|
||||||
|
spring.datasource.druid.time-between-eviction-runs-millis=60000
|
||||||
|
spring.datasource.druid.min-evictable-idle-time-millis=30000
|
||||||
|
spring.datasource.druid.validation-query=select 'x'
|
||||||
|
spring.datasource.druid.test-on-borrow=false
|
||||||
|
spring.datasource.druid.test-on-return=false
|
||||||
|
spring.datasource.druid.pool-prepared-statements=true
|
||||||
|
spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
|
||||||
|
spring.datasource.druid.filters=stat
|
||||||
|
spring.datasource.druid.connection-properties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
|
||||||
|
spring.datasource.druid.use-global-data-source-stat=true
|
||||||
|
spring.datasource.druid.stat-view-servlet.login-username=druid_admin
|
||||||
|
spring.datasource.druid.stat-view-servlet.login-password=1qaz2wsx#EDC
|
||||||
0
src/main/resources/application-prod.properties
Normal file
0
src/main/resources/application-prod.properties
Normal file
1
src/main/resources/application.properties
Normal file
1
src/main/resources/application.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
spring.profiles.active=dev
|
||||||
17
src/test/java/AESTest.java
Normal file
17
src/test/java/AESTest.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import com.hongliang.videotask.utils.AES;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class AESTest {
|
||||||
|
@Test
|
||||||
|
public void AES(){
|
||||||
|
String data="123456";
|
||||||
|
try{
|
||||||
|
String strEncrypt=AES.encrypt(data);
|
||||||
|
System.out.println("加密后:"+strEncrypt);
|
||||||
|
System.out.println("解密后:"+AES.decrypt(strEncrypt));
|
||||||
|
}catch (Exception e){
|
||||||
|
System.out.println(e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/test/java/LoginTest.java
Normal file
8
src/test/java/LoginTest.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class LoginTest {
|
||||||
|
@Test
|
||||||
|
public void testAdd(){
|
||||||
|
System.out.println("this is a test!");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user