parent
9c84f0e1d4
commit
dbb7c5bcfb
22 changed files with 2536 additions and 0 deletions
@ -0,0 +1,31 @@ |
||||
HELP.md |
||||
target/ |
||||
!.mvn/wrapper/maven-wrapper.jar |
||||
!**/src/main/** |
||||
!**/src/test/** |
||||
|
||||
### STS ### |
||||
.apt_generated |
||||
.classpath |
||||
.factorypath |
||||
.project |
||||
.settings |
||||
.springBeans |
||||
.sts4-cache |
||||
|
||||
### IntelliJ IDEA ### |
||||
.idea |
||||
*.iws |
||||
*.iml |
||||
*.ipr |
||||
|
||||
### NetBeans ### |
||||
/nbproject/private/ |
||||
/nbbuild/ |
||||
/dist/ |
||||
/nbdist/ |
||||
/.nb-gradle/ |
||||
build/ |
||||
|
||||
### VS Code ### |
||||
.vscode/ |
@ -0,0 +1,310 @@ |
||||
#!/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 "$@" |
@ -0,0 +1,182 @@ |
||||
@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% |
@ -0,0 +1,95 @@ |
||||
<?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 http://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.2.5.RELEASE</version> |
||||
<relativePath/> <!-- lookup parent from repository --> |
||||
</parent> |
||||
<groupId>com.pdxm</groupId> |
||||
<artifactId>project_maagement-1</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
<packaging>war</packaging> |
||||
<name>project_maagement-1</name> |
||||
<description>我的第一个springboot程序</description> |
||||
|
||||
<properties> |
||||
<java.version>1.8</java.version> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-web</artifactId> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-tomcat</artifactId> |
||||
<scope>provided</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.mybatis.spring.boot</groupId> |
||||
<artifactId>mybatis-spring-boot-starter</artifactId> |
||||
<version>2.1.2</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-log4j</artifactId> |
||||
<version>1.3.8.RELEASE</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-devtools</artifactId> |
||||
<scope>runtime</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.github.pagehelper</groupId> |
||||
<artifactId>pagehelper-spring-boot-starter</artifactId> |
||||
<version>1.2.5</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>mysql</groupId> |
||||
<artifactId>mysql-connector-java</artifactId> |
||||
<scope>runtime</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.apache.commons</groupId> |
||||
<artifactId>commons-lang3</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-test</artifactId> |
||||
<scope>test</scope> |
||||
<exclusions> |
||||
<exclusion> |
||||
<groupId>org.junit.vintage</groupId> |
||||
<artifactId>junit-vintage-engine</artifactId> |
||||
</exclusion> |
||||
</exclusions> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>io.springfox</groupId> |
||||
<artifactId>springfox-swagger-ui</artifactId> |
||||
<version>2.7.0</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>io.springfox</groupId> |
||||
<artifactId>springfox-swagger2</artifactId> |
||||
<version>2.7.0</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<finalName>Projectmanagement</finalName> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
|
||||
</project> |
@ -0,0 +1,15 @@ |
||||
package com.yipin.liuwanr; |
||||
|
||||
import org.mybatis.spring.annotation.MapperScan; |
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
||||
@SpringBootApplication |
||||
@MapperScan(basePackages = {"com.yipin.liuwanr.mapper"}) |
||||
public class ProjectMaagementApplication { |
||||
|
||||
public static void main(String[] args) { |
||||
SpringApplication.run(ProjectMaagementApplication.class, args); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,13 @@ |
||||
package com.yipin.liuwanr; |
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder; |
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
||||
|
||||
public class ServletInitializer extends SpringBootServletInitializer { |
||||
|
||||
@Override |
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
||||
return application.sources(ProjectMaagementApplication.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,27 @@ |
||||
package com.yipin.liuwanr.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry; |
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
||||
|
||||
/** |
||||
* @Description 跨域配置 |
||||
* @Date 2019/2/27 13:31 |
||||
**/ |
||||
@Configuration |
||||
public class CORSConfig { |
||||
|
||||
@Bean |
||||
public WebMvcConfigurer corsConfigurer(){ |
||||
return new WebMvcConfigurer() { |
||||
@Override |
||||
public void addCorsMappings(CorsRegistry registry) { |
||||
registry.addMapping("/**") |
||||
.allowedHeaders("*") |
||||
.allowedMethods("*") |
||||
.allowedOrigins("*"); |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,45 @@ |
||||
package com.yipin.liuwanr.config; |
||||
|
||||
import io.swagger.annotations.ApiOperation; |
||||
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.service.ApiInfo; |
||||
import springfox.documentation.service.Contact; |
||||
import springfox.documentation.spi.DocumentationType; |
||||
import springfox.documentation.spring.web.plugins.Docket; |
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
||||
|
||||
@Configuration |
||||
@EnableSwagger2 |
||||
public class SwaggerConfig { |
||||
|
||||
@Bean |
||||
public Docket productApi() { |
||||
return new Docket(DocumentationType.SWAGGER_2) |
||||
.apiInfo(apiInfo()) |
||||
.select()//添加ApiOperiation注解的被扫描
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
||||
.paths(PathSelectors.any()) |
||||
.build(); |
||||
} |
||||
|
||||
private ApiInfo apiInfo() { |
||||
return new ApiInfoBuilder().title("项目管理").description("项目管理模块") |
||||
.version("1.0").build(); |
||||
} |
||||
|
||||
/*public ApiInfo createApi(){ |
||||
return new ApiInfoBuilder().title("项目管理"). |
||||
description("项目管理"). |
||||
contact(new Contact("龚世杰","http://projestmgs.com","projestmgs@qq.com")).build(); |
||||
} |
||||
@Bean //等价于 <bean>标签
|
||||
public Docket createDoc(){ |
||||
return new Docket(DocumentationType.SWAGGER_2).apiInfo(createApi()).select(). |
||||
apis(RequestHandlerSelectors.basePackage("com.yipin.liuwanr.controller")).build(); |
||||
}*/ |
||||
|
||||
} |
@ -0,0 +1,344 @@ |
||||
package com.yipin.liuwanr.controller; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.util.StringUtils; |
||||
import org.springframework.web.bind.annotation.CrossOrigin; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
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.RequestParam; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import com.yipin.liuwanr.entity.Judgment_Points; |
||||
import com.yipin.liuwanr.entity.ManagementAndPointVo; |
||||
import com.yipin.liuwanr.entity.Project_Management; |
||||
import com.yipin.liuwanr.entity.Response; |
||||
import com.yipin.liuwanr.entity.Role; |
||||
import com.yipin.liuwanr.service.Project_ManagementService; |
||||
|
||||
@Api(value = "项目管理", tags = "项目管理相关方法") |
||||
@RestController |
||||
@RequestMapping("/ProjectManagement") |
||||
@CrossOrigin |
||||
public class Project_ManagementController { |
||||
|
||||
@Autowired |
||||
private Project_ManagementService service; |
||||
|
||||
/** |
||||
* 查询用户角色 |
||||
* @param userId |
||||
* @return |
||||
*/ |
||||
@ApiOperation(value = "查询角色", notes = "查询角色") |
||||
@GetMapping("/queryRole") |
||||
Response queryRole(Integer userId) { |
||||
Response resp = new Response(); |
||||
HashMap<String, Object> ret = service.queryRole(userId); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 首页面查询 |
||||
* @param projectPermissions:权限 |
||||
* @param founder:创建人 |
||||
* @param state:状态 |
||||
* @param projectName:项目名称 |
||||
* @param systemId |
||||
* @return |
||||
*/ |
||||
@GetMapping("/queryAllManagements") |
||||
Response queryAllManagements(@RequestParam Integer projectPermissions,@RequestParam Integer founder,@RequestParam Integer state,@RequestParam String projectName, |
||||
@RequestParam Integer systemId,@RequestParam Integer userId,@RequestParam Integer pageNo,@RequestParam Integer pageSize){ |
||||
Response resp = new Response(); |
||||
Project_Management vo=new Project_Management(); |
||||
if(null!=projectPermissions) { |
||||
vo.setProjectPermissions(projectPermissions); |
||||
}if(null!=founder) { |
||||
vo.setFounder(founder); |
||||
}if(null!=state) { |
||||
vo.setState(state); |
||||
}if(null!=systemId) { |
||||
vo.setSystemId(systemId); |
||||
}if(null!=projectName&&projectName!="") { |
||||
vo.setProjectName(projectName); |
||||
}if(null!=userId) { |
||||
vo.setUserId(userId); |
||||
} |
||||
HashMap<String, Object> ret = service.queryAllManagements(vo,pageNo,pageSize); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 批量删除 |
||||
* @param point 项目id集合 |
||||
* @return |
||||
*/ |
||||
@PostMapping("/removeProjectManagement") |
||||
Response removeProjectManagement(@RequestBody List<Integer> point) { |
||||
Response resp = new Response(); |
||||
HashMap<String, Object> ret = service.deleteProjectManagement(point); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 根据项目管理id查询对应信息 |
||||
* @param projectId |
||||
* @return |
||||
*/ |
||||
@GetMapping("/getProjectId") |
||||
Response getProjectId(Integer projectId) { |
||||
Response resp = new Response(); |
||||
HashMap<String, Object> ret = service.getProjectId(projectId); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
/** |
||||
* 添加点面板的数据展示+条件筛选 |
||||
* @param judgmentPointsName 判分点名称 |
||||
* @return |
||||
*/ |
||||
@GetMapping("/queryAllJudgmentPoints") |
||||
Response queryAllJudgmentPoints(@RequestParam String judgmentPointsName,@RequestParam Integer systemId) { |
||||
Response resp = new Response(); |
||||
Judgment_Points points=new Judgment_Points(); |
||||
if(StringUtils.isEmpty(systemId)) { |
||||
resp.setStatus(300); |
||||
resp.setMessage("systemId cannot be empty"); |
||||
}else { |
||||
if(!StringUtils.isEmpty(judgmentPointsName)) { |
||||
points.setJudgmentPointsName(judgmentPointsName); |
||||
} |
||||
points.setSystemId(systemId); |
||||
|
||||
HashMap<String, Object> ret = service.queryAllJudgmentPoints(points); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 实验任务表格信息的展示,根据判分点id和项目 |
||||
* @param judgmentPointsIds 判分点id |
||||
* @return |
||||
*/ |
||||
@GetMapping("/getByjudgmentPointsId") |
||||
Response getByjudgmentPointsId(@RequestParam List<Integer> judgmentPointsIds,Integer projectId,Integer userId) { |
||||
Response resp = new Response(); |
||||
HashMap<String, Object> ret = service.getByjudgmentPointsId(judgmentPointsIds,projectId,userId); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 平均分配分值 |
||||
* @param number 判分点数量 |
||||
* @return |
||||
*/ |
||||
@GetMapping("/avgValues") |
||||
Response avgValues(Integer number) { |
||||
Response resp = new Response(); |
||||
HashMap<String, Object> ret = service.avgValues(number); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 添加角色 |
||||
* @param role 角色 |
||||
* @return |
||||
*/ |
||||
@PostMapping("/addRole") |
||||
Response addRole(@RequestBody Role role) { |
||||
Response resp = new Response(); |
||||
HashMap<String, Object> ret = service.insertRole(role); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 实验数据表格信息的展示,根据角色id |
||||
* @param roleId 角色Id |
||||
* @return |
||||
*/ |
||||
@GetMapping("/getByRoleId") |
||||
Response getByRoleId(@RequestParam List<Integer> roleId) { |
||||
Response resp = new Response(); |
||||
HashMap<String, Object> ret = service.getByRoleId(roleId); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 开启/关闭实验数据 |
||||
*/ |
||||
/*@ApiOperation(value = "开启/关闭实验数据", notes = "开启/关闭实验数据") |
||||
@PostMapping("/startexperimentalSwitch") |
||||
Response startexperimentalSwitch(@RequestParam Integer isStartexperimental) { |
||||
|
||||
}*/ |
||||
|
||||
/** |
||||
* 添加创建项目管理信息 |
||||
* @param vo 项目管理信息 |
||||
* @return |
||||
*/ |
||||
@ApiOperation(value = "新增项目管理信息", notes = "新增项目管理信息") |
||||
@PostMapping("/addProjectManagement") |
||||
Response insertProjectManagement(@RequestBody ManagementAndPointVo vo) { |
||||
Response resp = new Response(); |
||||
Project_Management pro = vo.getManagement(); |
||||
List<Judgment_Points> points=vo.getPooints(); |
||||
List<Integer> roles = vo.getRoleId(); |
||||
if(StringUtils.isEmpty(pro)) { |
||||
resp.setStatus(300); |
||||
resp.setMessage("management cannot be empty"); |
||||
return resp; |
||||
} |
||||
if(points.isEmpty()||points.size()<=0) { |
||||
resp.setStatus(300); |
||||
resp.setMessage("pooints cannot be empty"); |
||||
return resp; |
||||
} |
||||
|
||||
if (pro.getIsstartexperimental()==0){//开启实验数据
|
||||
if(roles.isEmpty()||roles.size()<=0) { |
||||
resp.setStatus(300); |
||||
resp.setMessage("roleId cannot be empty"); |
||||
return resp; |
||||
} |
||||
} |
||||
|
||||
HashMap<String, Object> ret = service.insertProjectManagement(pro,points,roles); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 修改项目管理信息 |
||||
* @param vo |
||||
* @return |
||||
*/ |
||||
@PostMapping("/updateProjectManagement") |
||||
Response updateProjectManagement(@RequestBody ManagementAndPointVo vo) { |
||||
Response resp = new Response(); |
||||
Project_Management pro = vo.getManagement(); |
||||
List<Judgment_Points> points=vo.getPooints(); |
||||
List<Integer> roles = vo.getRoleId(); |
||||
if(StringUtils.isEmpty(pro)) { |
||||
resp.setStatus(300); |
||||
resp.setMessage("management cannot be empty"); |
||||
return resp; |
||||
} |
||||
if(points.isEmpty()||points.size()<=0) { |
||||
resp.setStatus(300); |
||||
resp.setMessage("pooints cannot be empty"); |
||||
return resp; |
||||
} |
||||
if(roles.isEmpty()||roles.size()<=0) { |
||||
resp.setStatus(300); |
||||
resp.setMessage("roleId cannot be empty"); |
||||
return resp; |
||||
} |
||||
HashMap<String, Object> ret = service.updateProjectManagement(pro,points,roles); |
||||
int status = (int) ret.get("retcode"); |
||||
if (status == 200) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,93 @@ |
||||
package com.yipin.liuwanr.entity; |
||||
|
||||
/** |
||||
* 判分表 |
||||
*/ |
||||
public class Judgment_Points { |
||||
|
||||
|
||||
private Integer judgmentPointsId;// 判分点主键Id
|
||||
private String judgmentPointsName;// 判分点名称
|
||||
private String experimentalRequirements;//实验要求
|
||||
private String projectId;//绑定项目管理Id
|
||||
private Integer judgmentPointsType;// 判分点类型(1、编程类 2、交易类 3、工具类 4、业务类)
|
||||
private Integer isdel;// 是否删除(0、未删除 1、已删除)
|
||||
private Integer systemId; |
||||
private Integer userId; |
||||
|
||||
private Integer score;//判分点指标的分数
|
||||
|
||||
public Integer getSystemId() { |
||||
return systemId; |
||||
} |
||||
|
||||
public void setSystemId(Integer systemId) { |
||||
this.systemId = systemId; |
||||
} |
||||
|
||||
public Integer getUserId() { |
||||
return userId; |
||||
} |
||||
|
||||
public void setUserId(Integer userId) { |
||||
this.userId = userId; |
||||
} |
||||
|
||||
public Integer getScore() { |
||||
return score; |
||||
} |
||||
|
||||
public void setScore(Integer score) { |
||||
this.score = score; |
||||
} |
||||
|
||||
public Integer getJudgmentPointsId() { |
||||
return judgmentPointsId; |
||||
} |
||||
|
||||
public void setJudgmentPointsId(Integer judgmentPointsId) { |
||||
this.judgmentPointsId = judgmentPointsId; |
||||
} |
||||
|
||||
public String getJudgmentPointsName() { |
||||
return judgmentPointsName; |
||||
} |
||||
|
||||
public void setJudgmentPointsName(String judgmentPointsName) { |
||||
this.judgmentPointsName = judgmentPointsName; |
||||
} |
||||
|
||||
public String getExperimentalRequirements() { |
||||
return experimentalRequirements; |
||||
} |
||||
|
||||
public void setExperimentalRequirements(String experimentalRequirements) { |
||||
this.experimentalRequirements = experimentalRequirements; |
||||
} |
||||
|
||||
public String getProjectId() { |
||||
return projectId; |
||||
} |
||||
|
||||
public void setProjectId(String projectId) { |
||||
this.projectId = projectId; |
||||
} |
||||
|
||||
public Integer getJudgmentPointsType() { |
||||
return judgmentPointsType; |
||||
} |
||||
|
||||
public void setJudgmentPointsType(Integer judgmentPointsType) { |
||||
this.judgmentPointsType = judgmentPointsType; |
||||
} |
||||
|
||||
public Integer getIsdel() { |
||||
return isdel; |
||||
} |
||||
|
||||
public void setIsdel(Integer isdel) { |
||||
this.isdel = isdel; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,35 @@ |
||||
package com.yipin.liuwanr.entity; |
||||
|
||||
import java.util.List; |
||||
|
||||
public class ManagementAndPointVo { |
||||
|
||||
private Project_Management management;//项目管理
|
||||
private List<Judgment_Points> pooints;//判分点信息
|
||||
private List<Integer> roleId;//存储角色id
|
||||
|
||||
public Project_Management getManagement() { |
||||
return management; |
||||
} |
||||
|
||||
public void setManagement(Project_Management management) { |
||||
this.management = management; |
||||
} |
||||
|
||||
public List<Judgment_Points> getPooints() { |
||||
return pooints; |
||||
} |
||||
|
||||
public void setPooints(List<Judgment_Points> pooints) { |
||||
this.pooints = pooints; |
||||
} |
||||
|
||||
public List<Integer> getRoleId() { |
||||
return roleId; |
||||
} |
||||
|
||||
public void setRoleId(List<Integer> roleId) { |
||||
this.roleId = roleId; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,31 @@ |
||||
package com.yipin.liuwanr.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.List; |
||||
|
||||
public class PageResult implements Serializable{ |
||||
|
||||
//总记录数
|
||||
private Long total; |
||||
//总记录
|
||||
private List<?> rows; |
||||
|
||||
public PageResult(Long total, List<?> rows) { |
||||
this.total = total; |
||||
this.rows = rows; |
||||
} |
||||
public Long getTotal() { |
||||
return total; |
||||
} |
||||
public void setTotal(Long total) { |
||||
this.total = total; |
||||
} |
||||
public List<?> getRows() { |
||||
return rows; |
||||
} |
||||
public void setRows(List<?> rows) { |
||||
this.rows = rows; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,185 @@ |
||||
package com.yipin.liuwanr.entity; |
||||
|
||||
/** |
||||
* 项目管理 |
||||
* |
||||
* @author 86151 |
||||
* |
||||
*/ |
||||
public class Project_Management { |
||||
|
||||
private Integer projectId;// 项目主键ID
|
||||
private String projectName;// 项目名称
|
||||
private Integer projectPermissions;// 项目权限(0、练习 1、考核 2、竞赛)
|
||||
private Integer founder;// 创建人(0、系统 1、老师)
|
||||
private String creationTime;// 创建时间
|
||||
private Integer state;// 状态(0、草稿箱 1、已发布)
|
||||
private String experimentalGoal;// 实验目标
|
||||
private String caseDescription; // 案例描述
|
||||
private String experimentTask;// 实验任务
|
||||
private String experimentalDataId;// 绑定实验数据ID
|
||||
private String experimentSuggests; // 实验提示
|
||||
private Integer systemId;// 绑定服务配置ID
|
||||
private Integer isdel; |
||||
private Integer isShow; |
||||
private Integer isstartexperimental;//是否启用实验数据(0启用 1不启用)
|
||||
private Integer isstartexperimentSuggests; |
||||
private Integer isExperiment; |
||||
private Integer isAttendance; |
||||
private Integer userId; |
||||
|
||||
|
||||
public Integer getUserId() { |
||||
return userId; |
||||
} |
||||
|
||||
public void setUserId(Integer userId) { |
||||
this.userId = userId; |
||||
} |
||||
|
||||
public Integer getIsstartexperimental() { |
||||
return isstartexperimental; |
||||
} |
||||
|
||||
public void setIsstartexperimental(Integer isstartexperimental) { |
||||
this.isstartexperimental = isstartexperimental; |
||||
} |
||||
|
||||
public Integer getIsstartexperimentSuggests() { |
||||
return isstartexperimentSuggests; |
||||
} |
||||
|
||||
public void setIsstartexperimentSuggests(Integer isstartexperimentSuggests) { |
||||
this.isstartexperimentSuggests = isstartexperimentSuggests; |
||||
} |
||||
|
||||
public Integer getProjectId() { |
||||
return projectId; |
||||
} |
||||
|
||||
public void setProjectId(Integer projectId) { |
||||
this.projectId = projectId; |
||||
} |
||||
|
||||
public String getProjectName() { |
||||
return projectName; |
||||
} |
||||
|
||||
public void setProjectName(String projectName) { |
||||
this.projectName = projectName; |
||||
} |
||||
|
||||
public Integer getProjectPermissions() { |
||||
return projectPermissions; |
||||
} |
||||
|
||||
public void setProjectPermissions(Integer projectPermissions) { |
||||
this.projectPermissions = projectPermissions; |
||||
} |
||||
|
||||
public Integer getFounder() { |
||||
return founder; |
||||
} |
||||
|
||||
public void setFounder(Integer founder) { |
||||
this.founder = founder; |
||||
} |
||||
|
||||
public String getCreationTime() { |
||||
return creationTime; |
||||
} |
||||
|
||||
public void setCreationTime(String creationTime) { |
||||
this.creationTime = creationTime; |
||||
} |
||||
|
||||
public Integer getState() { |
||||
return state; |
||||
} |
||||
|
||||
public void setState(Integer state) { |
||||
this.state = state; |
||||
} |
||||
|
||||
public String getExperimentalGoal() { |
||||
return experimentalGoal; |
||||
} |
||||
|
||||
public void setExperimentalGoal(String experimentalGoal) { |
||||
this.experimentalGoal = experimentalGoal; |
||||
} |
||||
|
||||
public String getCaseDescription() { |
||||
return caseDescription; |
||||
} |
||||
|
||||
public void setCaseDescription(String caseDescription) { |
||||
this.caseDescription = caseDescription; |
||||
} |
||||
|
||||
public String getExperimentTask() { |
||||
return experimentTask; |
||||
} |
||||
|
||||
public void setExperimentTask(String experimentTask) { |
||||
this.experimentTask = experimentTask; |
||||
} |
||||
|
||||
public Integer getIsdel() { |
||||
return isdel; |
||||
} |
||||
|
||||
public void setIsdel(Integer isdel) { |
||||
this.isdel = isdel; |
||||
} |
||||
|
||||
public Integer getIsShow() { |
||||
return isShow; |
||||
} |
||||
|
||||
public void setIsShow(Integer isShow) { |
||||
this.isShow = isShow; |
||||
} |
||||
|
||||
public String getExperimentalDataId() { |
||||
return experimentalDataId; |
||||
} |
||||
|
||||
public void setExperimentalDataId(String experimentalDataId) { |
||||
this.experimentalDataId = experimentalDataId; |
||||
} |
||||
|
||||
public String getExperimentSuggests() { |
||||
return experimentSuggests; |
||||
} |
||||
|
||||
|
||||
public void setExperimentSuggests(String experimentSuggests) { |
||||
this.experimentSuggests = experimentSuggests; |
||||
} |
||||
|
||||
public Integer getSystemId() { |
||||
return systemId; |
||||
} |
||||
|
||||
public void setSystemId(Integer systemId) { |
||||
this.systemId = systemId; |
||||
} |
||||
|
||||
public Integer getIsExperiment() { |
||||
return isExperiment; |
||||
} |
||||
|
||||
public void setIsExperiment(Integer isExperiment) { |
||||
this.isExperiment = isExperiment; |
||||
} |
||||
|
||||
public Integer getIsAttendance() { |
||||
return isAttendance; |
||||
} |
||||
|
||||
public void setIsAttendance(Integer isAttendance) { |
||||
this.isAttendance = isAttendance; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,34 @@ |
||||
package com.yipin.liuwanr.entity; |
||||
|
||||
public class Response { |
||||
|
||||
private int status = 200; |
||||
|
||||
private Object message; |
||||
|
||||
private String errmessage; |
||||
|
||||
public int getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(int status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public Object getMessage() { |
||||
return message; |
||||
} |
||||
|
||||
public void setMessage(Object message) { |
||||
this.message = message; |
||||
} |
||||
|
||||
public String getErrmessage() { |
||||
return errmessage; |
||||
} |
||||
|
||||
public void setErrmessage(String errmessage) { |
||||
this.errmessage = errmessage; |
||||
} |
||||
} |
@ -0,0 +1,56 @@ |
||||
package com.yipin.liuwanr.entity; |
||||
|
||||
/** |
||||
* 角色表 |
||||
* @author 86151 |
||||
* |
||||
*/ |
||||
public class Role { |
||||
|
||||
private Integer roleId;// 角色ID
|
||||
private String roleName;// 角色名称
|
||||
private Integer roleNumber;// 角色数量
|
||||
private Integer roleType;// 角色类型
|
||||
private Integer roleAttribute;// 角色属性
|
||||
|
||||
public Integer getRoleId() { |
||||
return roleId; |
||||
} |
||||
|
||||
public void setRoleId(Integer roleId) { |
||||
this.roleId = roleId; |
||||
} |
||||
|
||||
public String getRoleName() { |
||||
return roleName; |
||||
} |
||||
|
||||
public void setRoleName(String roleName) { |
||||
this.roleName = roleName; |
||||
} |
||||
|
||||
public Integer getRoleNumber() { |
||||
return roleNumber; |
||||
} |
||||
|
||||
public void setRoleNumber(Integer roleNumber) { |
||||
this.roleNumber = roleNumber; |
||||
} |
||||
|
||||
public Integer getRoleType() { |
||||
return roleType; |
||||
} |
||||
|
||||
public void setRoleType(Integer roleType) { |
||||
this.roleType = roleType; |
||||
} |
||||
|
||||
public Integer getRoleAttribute() { |
||||
return roleAttribute; |
||||
} |
||||
|
||||
public void setRoleAttribute(Integer roleAttribute) { |
||||
this.roleAttribute = roleAttribute; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,79 @@ |
||||
package com.yipin.liuwanr.entity; |
||||
|
||||
/** |
||||
* 判分指标 |
||||
* |
||||
* @author 或然 |
||||
* |
||||
*/ |
||||
public class ScoreIndex { |
||||
|
||||
private Integer scoreindexId;//判分点指标id
|
||||
private Integer score;//分数
|
||||
private Integer judgmentPointsId;//判分点id
|
||||
private Integer projectId;//项目id
|
||||
private Integer isdel;//是否删除
|
||||
private Integer userId; |
||||
|
||||
public ScoreIndex( Integer score, Integer judgmentPointsId, Integer projectId,Integer userId) { |
||||
super(); |
||||
this.score = score; |
||||
this.judgmentPointsId = judgmentPointsId; |
||||
this.projectId = projectId; |
||||
this.userId = userId; |
||||
} |
||||
|
||||
public Integer getUserId() { |
||||
return userId; |
||||
} |
||||
|
||||
public void setUserId(Integer userId) { |
||||
this.userId = userId; |
||||
} |
||||
|
||||
public ScoreIndex() { |
||||
super(); |
||||
} |
||||
|
||||
public Integer getProjectId() { |
||||
return projectId; |
||||
} |
||||
|
||||
public void setProjectId(Integer projectId) { |
||||
this.projectId = projectId; |
||||
} |
||||
|
||||
public Integer getIsdel() { |
||||
return isdel; |
||||
} |
||||
|
||||
|
||||
public void setIsdel(Integer isdel) { |
||||
this.isdel = isdel; |
||||
} |
||||
|
||||
public Integer getScoreindexId() { |
||||
return scoreindexId; |
||||
} |
||||
|
||||
public void setScoreindexId(Integer scoreindexId) { |
||||
this.scoreindexId = scoreindexId; |
||||
} |
||||
|
||||
public Integer getScore() { |
||||
return score; |
||||
} |
||||
|
||||
public void setScore(Integer score) { |
||||
this.score = score; |
||||
} |
||||
|
||||
public Integer getJudgmentPointsId() { |
||||
return judgmentPointsId; |
||||
} |
||||
|
||||
public void setJudgmentPointsId(Integer judgmentPointsId) { |
||||
this.judgmentPointsId = judgmentPointsId; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,38 @@ |
||||
package com.yipin.liuwanr.helper; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class UserUtil { |
||||
|
||||
/** |
||||
* 平均分配分值 |
||||
* @param number 判分点数量 |
||||
* @return |
||||
*/ |
||||
public static List<Integer> averageValue(Integer number) { |
||||
Integer score=100/number; |
||||
Integer lastScore=score+100%number; |
||||
List<Integer> list=new ArrayList<Integer>(); |
||||
for (int i = 0; i < number-1; i++) { |
||||
list.add(score); |
||||
} |
||||
list.add(lastScore); |
||||
return list; |
||||
} |
||||
|
||||
/** |
||||
* 将string类型转成list集合 |
||||
* @param str |
||||
* @return |
||||
*/ |
||||
public static List<Integer> strToInteger(String str){ |
||||
String[] strs = str.split(","); |
||||
List<Integer> list=new ArrayList<Integer>(); |
||||
for (int i = 0; i < strs.length; i++) { |
||||
list.add(Integer.parseInt(strs[i])); |
||||
} |
||||
return list; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,240 @@ |
||||
package com.yipin.liuwanr.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.Options; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.Update; |
||||
|
||||
import com.yipin.liuwanr.entity.Judgment_Points; |
||||
import com.yipin.liuwanr.entity.Project_Management; |
||||
import com.yipin.liuwanr.entity.Role; |
||||
|
||||
/** |
||||
* 项目管理系统 项目管理表 |
||||
* |
||||
* @author 86151 |
||||
* |
||||
*/ |
||||
public interface Project_ManagementMapper { |
||||
|
||||
/** |
||||
* 查询项目名称 |
||||
* @param projectName |
||||
* @return |
||||
*/ |
||||
@Select("select count(*) from hr_project_management where projectName=#{projectName}") |
||||
Integer getByprojectName(String projectName); |
||||
|
||||
/** |
||||
* 分页查询+条件查询 |
||||
* |
||||
* @param management |
||||
* @return |
||||
*/ |
||||
@Select({ "<script>", |
||||
"select projectId,projectName,projectPermissions,founder,creationTime,state from hr_project_management where isdel=0", |
||||
" <if test='projectPermissions!=null'> and projectPermissions=#{projectPermissions}</if>", |
||||
" <if test='founder!=null'> and founder=#{founder}</if>", |
||||
" <if test='state!=null'> and state=#{state}</if>", |
||||
" <if test='systemId!=null'> and systemId=#{systemId}</if>", |
||||
" <if test='userId!=null'> and userId=#{userId}</if>", |
||||
" <if test='projectName!=null'> and projectName like concat('%',#{projectName},'%')</if>", |
||||
" ORDER BY creationTime desc", |
||||
"</script>" }) |
||||
List<Project_Management> queryManagements(Project_Management management); |
||||
|
||||
|
||||
/** |
||||
* 根据实验项目id查询信息 |
||||
* |
||||
* @param projectId |
||||
* @return |
||||
*/ |
||||
@Select("select projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId from hr_project_management where isdel=0 and projectId=#{projectId}") |
||||
Project_Management getProjectId(Integer projectId); |
||||
|
||||
|
||||
/** |
||||
* 批量删除 |
||||
* @param projectId |
||||
*/ |
||||
@Update("<script>" + "<foreach collection = 'point' item ='projectId' open='' close='' separator=';'>" |
||||
+ "update hr_project_management set isdel=1 where projectId=#{projectId}</foreach>" |
||||
+ "</script>") |
||||
void deleteProjectManagement(@Param("point") List<Integer> projectId); |
||||
|
||||
|
||||
/** |
||||
* 添加角色信息 |
||||
* |
||||
* @param role |
||||
* @return |
||||
*/ |
||||
@Insert("insert into hr_role (roleNumber,roleType,roleAttribute) VALUES (#{roleNumber},#{roleType},#{roleAttribute})") |
||||
@Options(useGeneratedKeys = true, keyProperty = "roleId", keyColumn = "roleId") |
||||
void insertRole(Role role); |
||||
|
||||
/** |
||||
* 点击实验数据中单个角色后的编辑按钮,修改角色信息 |
||||
* |
||||
* @param role |
||||
*/ |
||||
@Update("update hr_role set roleNumber=#{roleNumber},roleType=#{roleType},roleAttribute=#{roleAttribute} where roleId=#{roleId}") |
||||
void updateRole(Role role); |
||||
|
||||
|
||||
/** |
||||
* 点击编辑或者创建项目管理页面的保存按钮后, |
||||
* 修改角色表中的对应数据的项目id |
||||
* @param ids |
||||
* @param projectId |
||||
*/ |
||||
@Update("<script>" + |
||||
"<foreach collection = 'ids' item ='id' open='' close='' separator=';'>" |
||||
+ "update hr_role set projectId=#{projectId} where roleId=#{id}</foreach>" |
||||
+ "</script>") |
||||
void updateRoleProjectId(@Param("ids")List<Integer> ids,@Param("projectId")Integer projectId); |
||||
|
||||
|
||||
@Delete("delete from hr_role where projectId=#{projectId}") |
||||
void deleteRole(Integer projectId); |
||||
|
||||
/** |
||||
* 添加角色信息后,在创建编辑页面的角色信息展示 |
||||
* |
||||
* @param role |
||||
* @return |
||||
*/ |
||||
@Select({ "<script>", |
||||
"select roleId,roleNumber,roleType,roleAttribute from hr_role where roleId in", |
||||
"<foreach collection='role' item='ro' open='(' separator=',' close=')'>" + "#{ro} " + "</foreach> ", |
||||
"</script>" }) |
||||
List<Role> getByRoleId(@Param("role") List<Integer> role); |
||||
|
||||
|
||||
/** |
||||
* 点击具体某个项目信息的编辑按钮, |
||||
* 跳转到编辑项目管理页面的实验数据的信息展示 |
||||
* @param projectId |
||||
* @return |
||||
*/ |
||||
@Select("select roleId,roleNumber,roleType,roleAttribute from hr_role where projectId=#{projectId}") |
||||
List<Role> queryProjectId(Integer projectId); |
||||
|
||||
|
||||
/** |
||||
* 添加判分点面板的判分信息展示 |
||||
* @return |
||||
*/ |
||||
@Select({ "<script>", |
||||
"select judgmentPointsId,judgmentPointsName from hr_judgment_points where isdel=0 and systemId=#{systemId}", |
||||
" <if test='judgmentPointsName!=null'> and judgmentPointsName like concat('%','${judgmentPointsName}','%')</if>", |
||||
"</script>" }) |
||||
List<Judgment_Points> queryAllJudgmentPoints(Judgment_Points points); |
||||
|
||||
|
||||
/** |
||||
* 从判分点添加面板,选择完数据后, |
||||
* 创建项目管理页面的实验任务信息展示 |
||||
* @param point |
||||
* @return |
||||
*/ |
||||
@Select({ "<script>", |
||||
"select judgmentPointsId,judgmentPointsName,experimentalRequirements from hr_judgment_points where isdel=0 and judgmentPointsId in", |
||||
"<foreach collection='point' item='po' open='(' separator=',' close=')'>" + "#{po} " + "</foreach> ", |
||||
"</script>" }) |
||||
List<Judgment_Points> getByjudgmentPointsIds(@Param("point") List<Integer> point); |
||||
|
||||
/** |
||||
* 点击具体某个项目信息的编辑按钮, |
||||
* 跳转到编辑项目管理页面的实验任务的信息展示 |
||||
* @param projectId |
||||
* @return |
||||
*/ |
||||
@Select("select judgmentPointsId,judgmentPointsName,experimentalRequirements from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") |
||||
List<Judgment_Points> getByProjectId(Integer projectId); |
||||
|
||||
|
||||
@Select("select judgmentPointsId,projectId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") |
||||
List<Judgment_Points> queryProjectIds(Integer projectId); |
||||
|
||||
/** |
||||
* 取出判分点中的项目管理的id |
||||
* @param judgmentPointsId |
||||
* @return |
||||
*/ |
||||
@Select("select projectId,experimentalRequirements from hr_judgment_points where judgmentPointsId=#{judgmentPointsId}") |
||||
Judgment_Points getByjudgmentPointsId(Integer judgmentPointsId); |
||||
|
||||
/** |
||||
* 点击保存按按,需要修改判分点表中对应的项目id,实验要求 |
||||
* @param projectId |
||||
* @param judgmentPointsId |
||||
*/ |
||||
@Update({"<script>", |
||||
"update hr_judgment_points set projectId=#{projectId}", |
||||
" <if test='experimentalRequirements!=null'>,experimentalRequirements=#{experimentalRequirements}</if>", |
||||
" where judgmentPointsId=#{judgmentPointsId}", |
||||
"</script>"}) |
||||
void updateProject(String projectId,String experimentalRequirements,Integer judgmentPointsId); |
||||
|
||||
|
||||
/** |
||||
* 添加项目管理信息 |
||||
* |
||||
* @param management |
||||
*/ |
||||
@Insert("INSERT INTO hr_project_management(projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId,isExperiment,isAttendance,isdel)" |
||||
+ " VALUES (#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},1,#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},0,0,0)") |
||||
@Options(useGeneratedKeys = true,keyProperty = "projectId",keyColumn = "projectId") |
||||
void insertProjectManagement(Project_Management management); |
||||
|
||||
/** |
||||
* 修改项目管理信息 |
||||
* |
||||
* @param management |
||||
*/ |
||||
@Update("update hr_project_management set projectName=#{projectName},projectPermissions=#{projectPermissions},experimentalGoal=#{experimentalGoal},caseDescription=#{caseDescription},experimentSuggests=#{experimentSuggests},state=#{state}," |
||||
+ "isstartexperimental=#{isstartexperimental},isstartexperimentSuggests=#{isstartexperimentSuggests} where projectId=#{projectId}") |
||||
void updateProjectManagement(Project_Management management); |
||||
|
||||
/** |
||||
* 根据项目id,查询出该项目所有的判分点id |
||||
* @param projectId |
||||
* @return |
||||
*/ |
||||
@Select("select judgmentPointsId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") |
||||
List<Integer> getByPointProjectId(Integer projectId); |
||||
|
||||
/** |
||||
* 根据项目id,查询出该项目所有的角色id |
||||
* @param projectId |
||||
* @return |
||||
*/ |
||||
@Select("select roleId from hr_role where projectId=#{projectId}") |
||||
List<Integer> getByRoleProjectId(Integer projectId); |
||||
|
||||
|
||||
/** |
||||
* 查询用户角色 |
||||
* @param userId |
||||
* @return |
||||
*/ |
||||
@Select("SELECT ro.roleId FROM user us,role ro WHERE ro.roleId=us.accountRole AND us.userId=#{userId}") |
||||
Integer queryRole(Integer userId); |
||||
|
||||
|
||||
/** |
||||
* 查询用户角色 |
||||
* @param userId |
||||
* @return |
||||
*/ |
||||
@Select("SELECT accountRole FROM user WHERE userId=#{userId}") |
||||
Integer queryRoleId(Integer userId); |
||||
|
||||
|
||||
} |
@ -0,0 +1,63 @@ |
||||
package com.yipin.liuwanr.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.Options; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.Update; |
||||
|
||||
import com.yipin.liuwanr.entity.ScoreIndex; |
||||
|
||||
public interface ScoreIndexMapper { |
||||
|
||||
|
||||
/** |
||||
* 给判分指标添加分数 |
||||
* @param scoreIndex |
||||
*/ |
||||
@Insert("insert into hr_score_index (score,judgmentPointsId,projectId,userId,isdel) " |
||||
+ " values (#{score},#{judgmentPointsId},#{projectId},#{userId},0)") |
||||
@Options(useGeneratedKeys = true,keyProperty = "scoreindexId",keyColumn = "scoreindexId") |
||||
void addScoreIndex(ScoreIndex scoreIndex); |
||||
|
||||
|
||||
/** |
||||
* 修改分数 |
||||
* @param scoreIndex |
||||
*/ |
||||
@Update("update hr_score_index set score=#{score} where judgmentPointsId=#{judgmentPointsId} and projectId=#{projectId} and userId=#{userId} ") |
||||
void updateScore(ScoreIndex scoreIndex); |
||||
|
||||
|
||||
/** |
||||
* 删除分数 |
||||
* @param scoreIndex |
||||
*/ |
||||
@Delete("delete from hr_score_index where judgmentPointsId=#{judgmentPointsId} and projectId=#{projectId} and userId=#{userId}") |
||||
void removeScore(@Param("judgmentPointsId")Integer judgmentPointsId,@Param("projectId") Integer projectId,@Param("userId") Integer userId); |
||||
|
||||
@Delete("delete from hr_score_index where projectId=#{projectId} ") |
||||
void removeAllprojectId(@Param("projectId") Integer projectId); |
||||
|
||||
/** |
||||
* 根据判分点id和项目id查询具体分数 |
||||
* @return |
||||
*/ |
||||
@Select("select score from hr_score_index where isdel=0 and judgmentPointsId=#{judgmentPointsId} and projectId=#{projectId} and userId=#{userId}") |
||||
Integer getbyJudgmentPointsIdScore(@Param("judgmentPointsId")Integer judgmentPointsId,@Param("projectId") Integer projectId,@Param("userId") Integer userId); |
||||
|
||||
/** |
||||
* 查询判分点id和分数 |
||||
* @param judgmentPointsId:判分点id |
||||
* @param projectId:项目id |
||||
* @return |
||||
*/ |
||||
@Select({"<script>", |
||||
"select score,judgmentPointsId from hr_score_index where isdel=0 and userId=#{userId} and projectId=#{projectId} and judgmentPointsId in", |
||||
"<foreach collection='ids' item='id' open='(' separator=',' close=')'>" + "#{id} " + "</foreach> ", |
||||
"</script>"}) |
||||
List<ScoreIndex> queryScore(@Param("ids")List<Integer> judgmentPointsId,@Param("projectId")Integer projectId,@Param("userId") Integer userId); |
||||
} |
@ -0,0 +1,612 @@ |
||||
package com.yipin.liuwanr.service; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.yipin.liuwanr.entity.*; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.jboss.logging.Logger; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import com.yipin.liuwanr.helper.UserUtil; |
||||
import com.yipin.liuwanr.mapper.Project_ManagementMapper; |
||||
import com.yipin.liuwanr.mapper.ScoreIndexMapper; |
||||
|
||||
@Service |
||||
public class Project_ManagementService { |
||||
|
||||
private static Logger logger = Logger.getLogger(Project_ManagementService.class); |
||||
|
||||
@Autowired |
||||
private Project_ManagementMapper mapper; |
||||
|
||||
@Autowired |
||||
private ScoreIndexMapper indexMapper; |
||||
|
||||
|
||||
/** |
||||
* 查询用户角色 |
||||
* |
||||
* @param userId |
||||
* @return |
||||
*/ |
||||
public HashMap<String, Object> queryRole(Integer userId) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
Integer roleId = mapper.queryRoleId(userId); |
||||
if (null != roleId) { |
||||
//角色为教师
|
||||
if (roleId == 3) { |
||||
resp.put("retvalue", 1); |
||||
} |
||||
//角色为管理员
|
||||
else if (roleId == 1 || roleId == 2) { |
||||
resp.put("retvalue", 0); |
||||
} else if (roleId == 4) { |
||||
resp.put("retcode", 300); |
||||
resp.put("retvalue", "Role does not meet the requirements"); |
||||
return resp; |
||||
} |
||||
resp.put("retcode", 200); |
||||
} else { |
||||
resp.put("retcode", 300); |
||||
resp.put("retvalue", "user does not exist"); |
||||
} |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Inquiry Failed"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 分页查询+条件查询 |
||||
* |
||||
* @param vo |
||||
* @return |
||||
*/ |
||||
public HashMap<String, Object> queryAllManagements(Project_Management vo, Integer pageNo, Integer pageSize) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
//获取用户的角色信息
|
||||
Integer roleId = mapper.queryRoleId(vo.getUserId()); |
||||
if (null != roleId) { |
||||
//角色不对(学生没有权限)
|
||||
if (roleId == 4) { |
||||
resp.put("retcode", 300); |
||||
resp.put("retvalue", "Role does not meet the requirements"); |
||||
return resp; |
||||
} |
||||
//角色等于管理员或者超级管理员
|
||||
else if (roleId == 1 || roleId == 2) { |
||||
vo.setUserId(null); |
||||
} |
||||
} |
||||
PageHelper.startPage(pageNo, pageSize); |
||||
//条件查询
|
||||
List<Project_Management> list = mapper.queryManagements(vo); |
||||
PageInfo<Project_Management> info = new PageInfo<Project_Management>(list); |
||||
resp.put("retvalue", new PageResult(info.getTotal(), list)); |
||||
resp.put("retcode", 200); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Inquiry Failed"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 批量删除 |
||||
* |
||||
* @param point:项目管理id |
||||
* @return |
||||
*/ |
||||
@Transactional |
||||
public HashMap<String, Object> deleteProjectManagement(List<Integer> point) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
for (Integer po : point) { |
||||
//判分点
|
||||
List<Judgment_Points> points = mapper.queryProjectIds(po); |
||||
for (int i = 0; i < points.size(); i++) { |
||||
//判分点
|
||||
Judgment_Points pos = points.get(i); |
||||
Integer pointId = pos.getJudgmentPointsId();//判分点id
|
||||
String projectIds = pos.getProjectId();//项目id
|
||||
|
||||
//判分点中删除项目
|
||||
if (!StringUtils.isEmpty(projectIds)) { |
||||
List<String> lists = Arrays.asList(projectIds.split(",")); |
||||
List<String> obj = new ArrayList<String>(lists); |
||||
String prijectId = po.toString(); |
||||
if (lists.contains(prijectId)) { |
||||
obj.remove(prijectId); |
||||
projectIds = StringUtils.strip(obj.toString(), "[]").replace(" ", ""); |
||||
mapper.updateProject(projectIds, null, pointId); |
||||
} |
||||
} |
||||
} |
||||
//删除分数
|
||||
indexMapper.removeAllprojectId(po); |
||||
mapper.deleteRole(po); |
||||
} |
||||
mapper.deleteProjectManagement(point); |
||||
resp.put("retcode", 200); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Delete Failed"); |
||||
throw new RuntimeException(); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 根据项目管理id查询对应信息 |
||||
* |
||||
* @param projectId |
||||
* @return |
||||
*/ |
||||
public HashMap<String, Object> getProjectId(Integer projectId) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
List<Integer> judgmentPointsId = new ArrayList<Integer>(); |
||||
List<Object> obj = new ArrayList<Object>(); |
||||
List<Integer> indexs = new ArrayList<Integer>(); |
||||
|
||||
try { |
||||
// 项目信息
|
||||
Project_Management management = mapper.getProjectId(projectId); |
||||
|
||||
if (null != management) { |
||||
// 判分点信息
|
||||
List<Judgment_Points> points = mapper.getByProjectId(projectId); |
||||
//判分点不为空
|
||||
if (null != points && !points.isEmpty()) { |
||||
//存储判分点id
|
||||
for (int i = 0; i < points.size(); i++) { |
||||
judgmentPointsId.add(points.get(i).getJudgmentPointsId()); |
||||
} |
||||
//得到对应判分点的分数
|
||||
List<ScoreIndex> scores = indexMapper.queryScore(judgmentPointsId, projectId, management.getUserId()); |
||||
if (scores.size() > 0 && !scores.isEmpty()) { |
||||
//为有分数的赋值
|
||||
for (int i = 0; i < points.size(); i++) { |
||||
Judgment_Points point = points.get(i); |
||||
for (int j = 0; j < scores.size(); j++) { |
||||
ScoreIndex score = scores.get(j); |
||||
if (point.getJudgmentPointsId().equals(score.getJudgmentPointsId())) { |
||||
point.setScore(score.getScore()); |
||||
points.set(i, point); |
||||
indexs.add(i); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
//为没值的赋值
|
||||
for (int i = 0; i < points.size(); i++) { |
||||
if (!indexs.contains(i)) { |
||||
Judgment_Points points3 = points.get(i); |
||||
points3.setScore(0); |
||||
points.set(i, points3); |
||||
} |
||||
} |
||||
} else { |
||||
for (int i = 0; i < points.size(); i++) { |
||||
Judgment_Points point = points.get(i); |
||||
//给分数赋值
|
||||
point.setScore(0); |
||||
//修改该判分点
|
||||
points.set(i, point); |
||||
} |
||||
} |
||||
} |
||||
// 角色信息
|
||||
List<Role> roles = mapper.queryProjectId(projectId); |
||||
// 存数据
|
||||
obj.add(management); |
||||
obj.add(points); |
||||
obj.add(roles); |
||||
} |
||||
resp.put("retvalue", obj); |
||||
resp.put("retcode", 200); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Inquiry Failed"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 添加判分点页面的判分点信息展示 |
||||
* |
||||
* @return |
||||
*/ |
||||
public HashMap<String, Object> queryAllJudgmentPoints(Judgment_Points points) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
resp.put("retvalue", mapper.queryAllJudgmentPoints(points)); |
||||
resp.put("retcode", 200); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Add Failed"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 创建项目管理页面的判分点信息展示 |
||||
* |
||||
* @param judgmentPointsId 判分点id |
||||
* @return |
||||
*/ |
||||
public HashMap<String, Object> getByjudgmentPointsId(List<Integer> judgmentPointsId, Integer projectId, Integer userId) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
List<Judgment_Points> points = mapper.getByjudgmentPointsIds(judgmentPointsId); |
||||
List<ScoreIndex> scores = indexMapper.queryScore(judgmentPointsId, projectId, userId); |
||||
List<Integer> indexs = new ArrayList<Integer>(); |
||||
//为新增项目时勾选判分点赋值
|
||||
if (scores.size() <= 0) { |
||||
for (int i = 0; i < points.size(); i++) { |
||||
Judgment_Points points2 = points.get(i); |
||||
points2.setScore(0); |
||||
points.set(i, points2); |
||||
} |
||||
} |
||||
//为修改项目时勾选判分点赋值
|
||||
else { |
||||
//为有分数的赋值
|
||||
for (int i = 0; i < points.size(); i++) { |
||||
Judgment_Points point = points.get(i); |
||||
for (int j = 0; j < scores.size(); j++) { |
||||
ScoreIndex score = scores.get(j); |
||||
if (point.getJudgmentPointsId().equals(score.getJudgmentPointsId())) { |
||||
point.setScore(score.getScore()); |
||||
points.set(i, point); |
||||
indexs.add(i); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
//为没值的赋值
|
||||
for (int i = 0; i < points.size(); i++) { |
||||
if (!indexs.contains(i)) { |
||||
Judgment_Points points3 = points.get(i); |
||||
points3.setScore(0); |
||||
points.set(i, points3); |
||||
} |
||||
} |
||||
} |
||||
|
||||
resp.put("retvalue", points); |
||||
resp.put("retcode", 200); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Inquiry Failed"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 平均分配分值 |
||||
* |
||||
* @param number |
||||
* @return |
||||
*/ |
||||
public HashMap<String, Object> avgValues(Integer number) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
resp.put("retvalue", UserUtil.averageValue(number)); |
||||
resp.put("retcode", 200); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Calculation ERROR"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 添加完角色信息 角色信息展示 |
||||
* |
||||
* @param roleId 角色ID |
||||
* @return |
||||
*/ |
||||
public HashMap<String, Object> getByRoleId(List<Integer> roleId) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
resp.put("retvalue", mapper.getByRoleId(roleId)); |
||||
resp.put("retcode", 200); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Inquiry Failed"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 修改角色信息 |
||||
* |
||||
* @param role 角色信息 |
||||
* @return |
||||
*/ |
||||
public HashMap<String, Object> updateRole(Role role) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
mapper.updateRole(role); |
||||
resp.put("retcode", 200); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "UPDATE ERROR"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 添加角色信息 |
||||
* |
||||
* @param role 角色信息 |
||||
* @return |
||||
*/ |
||||
public HashMap<String, Object> insertRole(Role role) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
mapper.insertRole(role); |
||||
Integer roleId = role.getRoleId(); |
||||
resp.put("retvalue", roleId); |
||||
resp.put("retcode", 200); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Add Failed"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 添加项目管理信息 |
||||
* |
||||
* @return |
||||
*/ |
||||
@Transactional |
||||
public HashMap<String, Object> insertProjectManagement(Project_Management pro, List<Judgment_Points> points, |
||||
List<Integer> roles) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
String projectName = pro.getProjectName(); |
||||
Integer count = mapper.getByprojectName(projectName); |
||||
if (count != null) { |
||||
projectName += projectName + (count + 1); |
||||
pro.setProjectName(projectName); |
||||
} |
||||
// 添加项目信息
|
||||
mapper.insertProjectManagement(pro); |
||||
// 取出添加的项目信息的id
|
||||
Integer projectId = pro.getProjectId(); |
||||
for (int i = 0; i < points.size(); i++) { |
||||
//拼接判分点中的项目id
|
||||
StringBuffer buff = new StringBuffer(); |
||||
|
||||
//判分点id
|
||||
Integer pointId = points.get(i).getJudgmentPointsId(); |
||||
//根据该判分点得到数据库存储的对应数据
|
||||
Judgment_Points point = mapper.getByjudgmentPointsId(pointId); |
||||
//取出绑定的项目id
|
||||
String projectIds = point.getProjectId(); |
||||
//取出实验要求
|
||||
String experimentalRequirements = point.getExperimentalRequirements(); |
||||
|
||||
//数据库中该判分点已绑定过别的项目id,并且该判分点没有绑定过此时前端传来的项目id
|
||||
if (!StringUtils.isEmpty(projectIds)) { |
||||
List<String> lists = Arrays.asList(projectIds.split(",")); |
||||
if (!lists.contains(projectId.toString())) { |
||||
buff.append(projectIds); |
||||
buff.append(","); |
||||
buff.append(projectId); |
||||
} |
||||
} |
||||
//数据库中该判分点未绑定任何项目id
|
||||
else if (projectIds == null) { |
||||
buff.append(projectId); |
||||
} |
||||
//数据中实验要求不为空,且数据库中的实验要求与前端传来的实验要求信息一致
|
||||
if (experimentalRequirements != null && !experimentalRequirements.equals("") |
||||
&& experimentalRequirements.equals(points.get(i).getExperimentalRequirements())) { |
||||
mapper.updateProject(new String(buff), null, pointId); |
||||
} |
||||
//数据库中的实验要求与前端传来的实验要求信息不一致
|
||||
else if (!experimentalRequirements.equals(points.get(i).getExperimentalRequirements())) { |
||||
mapper.updateProject(new String(buff), points.get(i).getExperimentalRequirements(), pointId); |
||||
} |
||||
|
||||
// 得到判分指标信息
|
||||
ScoreIndex scoreIndex = new ScoreIndex(points.get(i).getScore(), pointId, projectId, pro.getUserId()); |
||||
// 在判分指标中添加对应信息
|
||||
indexMapper.addScoreIndex(scoreIndex); |
||||
} |
||||
// 修改角色信息中的项目管理id
|
||||
if (roles != null && roles.size() > 0) { |
||||
mapper.updateRoleProjectId(roles, projectId); |
||||
} |
||||
|
||||
resp.put("retcode", 200); |
||||
} catch (RuntimeException e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Add Failed"); |
||||
throw new RuntimeException(); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 修改项目管理信息 |
||||
* |
||||
* @return |
||||
*/ |
||||
@Transactional |
||||
public HashMap<String, Object> updateProjectManagement(Project_Management pro, List<Judgment_Points> points, |
||||
List<Integer> roles) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
|
||||
//项目id
|
||||
Integer project = pro.getProjectId(); |
||||
//用户id
|
||||
Integer userId = pro.getUserId(); |
||||
try { |
||||
// 取出该项目对应的判分点id
|
||||
List<Integer> judgments = mapper.getByPointProjectId(project); |
||||
// 取出该项目对应的角色id
|
||||
List<Integer> rolesIds = mapper.getByRoleProjectId(project); |
||||
|
||||
for (int i = 0; i < points.size(); i++) { |
||||
//拼接判分点中的项目id
|
||||
StringBuffer buff = new StringBuffer(); |
||||
|
||||
//前端传来的判分点id
|
||||
Integer pointId = points.get(i).getJudgmentPointsId(); |
||||
//前端传来的实验要求
|
||||
String experimentalRequirements1 = points.get(i).getExperimentalRequirements(); |
||||
//前端传来的分数
|
||||
Integer score1 = points.get(i).getScore(); |
||||
|
||||
//判分点信息
|
||||
Judgment_Points point = mapper.getByjudgmentPointsId(pointId); |
||||
String projectIds = point.getProjectId(); |
||||
String experimentalRequirements2 = point.getExperimentalRequirements(); |
||||
|
||||
// 如果数据库中有,则取出分数,进行比较
|
||||
if (judgments.contains(pointId)) { |
||||
//分数
|
||||
Integer score2 = indexMapper.getbyJudgmentPointsIdScore(pointId, project, userId); |
||||
// 如果分数不一致,则修改分数表中的分数
|
||||
if (score2 != null && score1 != score2) { |
||||
indexMapper.updateScore(new ScoreIndex(score1, pointId, project, userId)); |
||||
} |
||||
// 如果数据库中该判分点分数为空,则添加分数
|
||||
else if (score2 == null) { |
||||
indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId())); |
||||
} |
||||
//如果前端传来的实验要求与数据库中不一致,则修改数据库中的判分点信息
|
||||
if (!experimentalRequirements2.equals(experimentalRequirements1)) { |
||||
mapper.updateProject(point.getProjectId(), experimentalRequirements1, pointId); |
||||
} |
||||
} else { |
||||
//数据库中该判分点已绑定过别的项目id,并且该判分点没有绑定过此时前端传来的项目id
|
||||
if (!StringUtils.isEmpty(projectIds)) { |
||||
List<String> lists = Arrays.asList(projectIds.split(",")); |
||||
if (!lists.contains(project.toString())) { |
||||
buff.append(projectIds); |
||||
buff.append(","); |
||||
buff.append(project); |
||||
} |
||||
|
||||
} |
||||
//数据库中该判分点未绑定任何项目id
|
||||
else if (projectIds == null) { |
||||
buff.append(project); |
||||
} |
||||
//数据中实验要求不为空,且数据库中的实验要求与前端传来的实验要求信息一致
|
||||
if (experimentalRequirements2 != null && !experimentalRequirements2.equals("") |
||||
&& experimentalRequirements2.equals(experimentalRequirements1)) { |
||||
mapper.updateProject(new String(buff), null, pointId); |
||||
} |
||||
//数据库中的实验要求与前端传来的实验要求信息不一致
|
||||
else if (!experimentalRequirements2.equals(experimentalRequirements1)) { |
||||
mapper.updateProject(new String(buff), experimentalRequirements1, pointId); |
||||
} |
||||
// 添加分数
|
||||
indexMapper.addScoreIndex(new ScoreIndex(score1, pointId, project, pro.getUserId())); |
||||
} |
||||
judgments.remove(pointId); |
||||
} |
||||
|
||||
// 从判分点id中删除该项目的id
|
||||
for (int i = 0; i < judgments.size(); i++) { |
||||
Integer judgmentPointsId = judgments.get(i); |
||||
|
||||
Judgment_Points point = mapper.getByjudgmentPointsId(judgmentPointsId); |
||||
String projectIds = point.getProjectId(); |
||||
// 删除分数表中对应的判分点id+项目id数据
|
||||
indexMapper.removeScore(judgmentPointsId, project, userId); |
||||
|
||||
// 对取出的数据,删除该项目的id
|
||||
List<String> str3 = Arrays.asList(projectIds.split(",")); |
||||
if (str3.contains(project.toString())) { |
||||
List<String> arrayList = new ArrayList<String>(str3); |
||||
arrayList.remove(project.toString()); |
||||
// 删除字符中项目id
|
||||
projectIds = StringUtils.strip(arrayList.toString(), "[]").replace(" ", ""); |
||||
// 修改判分点中的项目id
|
||||
mapper.updateProject(projectIds, null, judgments.get(i)); |
||||
} |
||||
} |
||||
|
||||
// 用来存储需要修改的角色id
|
||||
List<Integer> roleid = new ArrayList<Integer>(); |
||||
|
||||
// 遍历前端传来的新的角色id
|
||||
for (int i = 0; i < roles.size(); i++) { |
||||
// 如果前端传来的数据,在数据库中没有,则存起来
|
||||
if (!rolesIds.contains(roles.get(i))) { |
||||
roleid.add(roles.get(i)); |
||||
} |
||||
} |
||||
|
||||
if (roleid.size() > 0 && !roleid.isEmpty()) { |
||||
// 修改对应角色的项目id
|
||||
mapper.updateRoleProjectId(roleid, project); |
||||
} |
||||
//项目名称去重
|
||||
String projectName = pro.getProjectName(); |
||||
Integer count = mapper.getByprojectName(projectName); |
||||
if (count != null) { |
||||
projectName += projectName + (count + 1); |
||||
pro.setProjectName(projectName); |
||||
} |
||||
//修改项目信息
|
||||
mapper.updateProjectManagement(pro); |
||||
resp.put("retcode", 200); |
||||
} catch (RuntimeException e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Update Failed"); |
||||
throw new RuntimeException(); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@ |
||||
spring.datasource.url=jdbc:mysql://www.liuwanr.cn:3306/huoran?useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true |
||||
spring.datasource.username=super |
||||
spring.datasource.password=huoran888 |
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver |
||||
|
||||
spring.jackson.default-property-inclusion=non-null |
||||
|
||||
logging.level.com.yipin.liuwanr.mapper=debug |
Loading…
Reference in new issue