commit
182eb516b6
50 changed files with 3807 additions and 0 deletions
@ -0,0 +1,33 @@ |
|||
HELP.md |
|||
target/ |
|||
!.mvn/wrapper/maven-wrapper.jar |
|||
!**/src/main/**/target/ |
|||
!**/src/test/**/target/ |
|||
|
|||
### STS ### |
|||
.apt_generated |
|||
.classpath |
|||
.factorypath |
|||
.project |
|||
.settings |
|||
.springBeans |
|||
.sts4-cache |
|||
|
|||
### IntelliJ IDEA ### |
|||
.idea |
|||
*.iws |
|||
*.iml |
|||
*.ipr |
|||
|
|||
### NetBeans ### |
|||
/nbproject/private/ |
|||
/nbbuild/ |
|||
/dist/ |
|||
/nbdist/ |
|||
/.nb-gradle/ |
|||
build/ |
|||
!**/src/main/**/build/ |
|||
!**/src/test/**/build/ |
|||
|
|||
### VS Code ### |
|||
.vscode/ |
@ -0,0 +1,118 @@ |
|||
/* |
|||
* Copyright 2007-present the original author or authors. |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* https://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
|
|||
import java.net.*; |
|||
import java.io.*; |
|||
import java.nio.channels.*; |
|||
import java.util.Properties; |
|||
|
|||
public class MavenWrapperDownloader { |
|||
|
|||
private static final String WRAPPER_VERSION = "0.5.6"; |
|||
/** |
|||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. |
|||
*/ |
|||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" |
|||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; |
|||
|
|||
/** |
|||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to |
|||
* use instead of the default one. |
|||
*/ |
|||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH = |
|||
".mvn/wrapper/maven-wrapper.properties"; |
|||
|
|||
/** |
|||
* Path where the maven-wrapper.jar will be saved to. |
|||
*/ |
|||
private static final String MAVEN_WRAPPER_JAR_PATH = |
|||
".mvn/wrapper/maven-wrapper.jar"; |
|||
|
|||
/** |
|||
* Name of the property which should be used to override the default download url for the wrapper. |
|||
*/ |
|||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; |
|||
|
|||
public static void main(String args[]) { |
|||
System.out.println("- Downloader started"); |
|||
File baseDirectory = new File(args[0]); |
|||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); |
|||
|
|||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
|||
// wrapperUrl parameter.
|
|||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); |
|||
String url = DEFAULT_DOWNLOAD_URL; |
|||
if (mavenWrapperPropertyFile.exists()) { |
|||
FileInputStream mavenWrapperPropertyFileInputStream = null; |
|||
try { |
|||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); |
|||
Properties mavenWrapperProperties = new Properties(); |
|||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); |
|||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); |
|||
} catch (IOException e) { |
|||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); |
|||
} finally { |
|||
try { |
|||
if (mavenWrapperPropertyFileInputStream != null) { |
|||
mavenWrapperPropertyFileInputStream.close(); |
|||
} |
|||
} catch (IOException e) { |
|||
// Ignore ...
|
|||
} |
|||
} |
|||
} |
|||
System.out.println("- Downloading from: " + url); |
|||
|
|||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); |
|||
if (!outputFile.getParentFile().exists()) { |
|||
if (!outputFile.getParentFile().mkdirs()) { |
|||
System.out.println( |
|||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); |
|||
} |
|||
} |
|||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); |
|||
try { |
|||
downloadFileFromURL(url, outputFile); |
|||
System.out.println("Done"); |
|||
System.exit(0); |
|||
} catch (Throwable e) { |
|||
System.out.println("- Error downloading"); |
|||
e.printStackTrace(); |
|||
System.exit(1); |
|||
} |
|||
} |
|||
|
|||
private static void downloadFileFromURL(String urlString, File destination) throws Exception { |
|||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { |
|||
String username = System.getenv("MVNW_USERNAME"); |
|||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); |
|||
Authenticator.setDefault(new Authenticator() { |
|||
@Override |
|||
protected PasswordAuthentication getPasswordAuthentication() { |
|||
return new PasswordAuthentication(username, password); |
|||
} |
|||
}); |
|||
} |
|||
URL website = new URL(urlString); |
|||
ReadableByteChannel rbc; |
|||
rbc = Channels.newChannel(website.openStream()); |
|||
FileOutputStream fos = new FileOutputStream(destination); |
|||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
|||
fos.close(); |
|||
rbc.close(); |
|||
} |
|||
|
|||
} |
Binary file not shown.
@ -0,0 +1,2 @@ |
|||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip |
|||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar |
@ -0,0 +1,322 @@ |
|||
#!/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,85 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
|
|||
<groupId>com.ccsens</groupId> |
|||
<artifactId>ptccsens</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
<name>ptccsens</name> |
|||
|
|||
<description>Demo project for Spring Boot</description> |
|||
<properties> |
|||
<java.version>1.8</java.version> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
<!--cloud 工具类--> |
|||
<dependency> |
|||
<artifactId>cloudutil</artifactId> |
|||
<groupId>com.ccsens</groupId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
</dependency> |
|||
<!--公用接口--> |
|||
<dependency> |
|||
<artifactId>common</artifactId> |
|||
<groupId>com.ccsens</groupId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
</dependency> |
|||
<!--util 工具类--> |
|||
<dependency> |
|||
<groupId>com.ccsens</groupId> |
|||
<artifactId>util</artifactId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
<!--微信工具包--> |
|||
<dependency> |
|||
<artifactId>wechatutil</artifactId> |
|||
<groupId>com.ccsens</groupId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
</dependency> |
|||
|
|||
|
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.mybatis.generator</groupId> |
|||
<artifactId>mybatis-generator-maven-plugin</artifactId> |
|||
<version>1.3.7</version> |
|||
<configuration> |
|||
<configurationFile>${basedir}/src/main/resources/mbg.xml</configurationFile> |
|||
<overwrite>true</overwrite> |
|||
</configuration> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<version>5.1.34</version> |
|||
</dependency> |
|||
</dependencies> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
<configuration> |
|||
<mainClass>com.ccsens.ptccsens.PtCcsensApplication</mainClass> |
|||
<!--<skip>true</skip>--> |
|||
</configuration> |
|||
<executions> |
|||
<execution> |
|||
<goals> |
|||
<goal>repackage</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
|
|||
</plugins> |
|||
</build> |
|||
|
|||
|
|||
</project> |
@ -0,0 +1,31 @@ |
|||
package com.ccsens.ptccsens; |
|||
|
|||
import com.ccsens.cloudutil.ribbon.RibbonConfiguration; |
|||
import org.mybatis.spring.annotation.MapperScan; |
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.boot.web.servlet.ServletComponentScan; |
|||
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
|||
import org.springframework.cloud.openfeign.EnableFeignClients; |
|||
import org.springframework.context.annotation.ComponentScan; |
|||
import org.springframework.context.annotation.FilterType; |
|||
import org.springframework.scheduling.annotation.EnableAsync; |
|||
|
|||
/** |
|||
* @author whj |
|||
*/ |
|||
@MapperScan(basePackages = {"com.ccsens.ptccsens.persist.*","com.ccsens.common.persist.*"}) |
|||
@ServletComponentScan |
|||
@EnableAsync |
|||
//开启断路器功能
|
|||
@EnableCircuitBreaker |
|||
@EnableFeignClients(basePackages = "com.ccsens.cloudutil.feign") |
|||
@SpringBootApplication |
|||
@ComponentScan(basePackages = "com.ccsens", excludeFilters = { @ComponentScan.Filter(type= FilterType.ASSIGNABLE_TYPE, value = RibbonConfiguration.class)}) |
|||
public class PtCcsensApplication { |
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(PtCcsensApplication.class, args); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.ccsens.ptccsens.api; |
|||
|
|||
import com.ccsens.util.JsonResponse; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiImplicitParams; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
@Api(tags = "DEBUG" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/debug") |
|||
@Slf4j |
|||
public class DebugController { |
|||
|
|||
@ApiOperation(value = "/测试",notes = "") |
|||
@ApiImplicitParams({ |
|||
}) |
|||
@RequestMapping(value="",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse debug(HttpServletRequest request) throws Exception { |
|||
|
|||
return JsonResponse.newInstance().ok("测试"); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,92 @@ |
|||
package com.ccsens.ptccsens.api.project; |
|||
|
|||
import com.ccsens.cloudutil.annotation.MustLogin; |
|||
import com.ccsens.common.bean.dto.CMemberDto; |
|||
import com.ccsens.common.bean.vo.CMemberVo; |
|||
import com.ccsens.common.service.MemberService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "角色相关" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/member") |
|||
@Slf4j |
|||
public class MemberController { |
|||
@Resource |
|||
private MemberService memberService; |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "查找项目下的成员", notes = "") |
|||
@RequestMapping(value = "/query", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CMemberVo.MemberInfo>> queryByProjectId(@ApiParam @Validated @RequestBody QueryDto<CMemberDto.QueryMemberByProject> params) { |
|||
log.info("查找项目下的成员:{}",params); |
|||
List<CMemberVo.MemberInfo> memberInfoList = memberService.queryByProject(params.getParam(), params.getUserId()); |
|||
log.info("项目下的成员列表:{}",memberInfoList); |
|||
return JsonResponse.newInstance().ok(memberInfoList); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "根据id查找成员", notes = "") |
|||
@RequestMapping(value = "/getById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CMemberVo.MemberInfo>> getMemberById(@ApiParam @Validated @RequestBody QueryDto<CMemberDto.GetMember> params) { |
|||
log.info("根据id查找成员:{}",params); |
|||
CMemberVo.MemberInfo memberInfo = memberService.getMemberById(params.getParam(), params.getUserId()); |
|||
log.info("根据id查找成员信息:{}",memberInfo); |
|||
return JsonResponse.newInstance().ok(memberInfo); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "添加成员", notes = "") |
|||
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse saveMember(@ApiParam @Validated @RequestBody QueryDto<CMemberDto.SaveMemberInfo> params) { |
|||
log.info("添加成员:{}",params); |
|||
memberService.saveMember(params.getParam(), params.getUserId()); |
|||
log.info("添加成员成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "修改成员信息", notes = "") |
|||
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse updateMember(@ApiParam @Validated @RequestBody QueryDto<CMemberDto.UpdateMemberInfo> params) { |
|||
log.info("修改成员信息:{}",params); |
|||
memberService.updateMember(params.getParam(), params.getUserId()); |
|||
log.info("修改成员信息成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "删除成员信息", notes = "") |
|||
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse delMember(@ApiParam @Validated @RequestBody QueryDto<CMemberDto.GetMember> params) { |
|||
log.info("删除成员信息:{}",params); |
|||
memberService.deleteMember(params.getParam(), params.getUserId()); |
|||
log.info("删除成员信息成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "修改成员所属的角色", notes = "") |
|||
@RequestMapping(value = "/memberRoles", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse updateMemberRoles(@ApiParam @Validated @RequestBody QueryDto<CMemberDto.UpdateMemberRoles> params) { |
|||
log.info("修改成员所属的角色:{}",params); |
|||
memberService.updateMemberRoles(params.getParam(), params.getUserId()); |
|||
log.info("修改成员所属的角色成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.ccsens.ptccsens.api.project; |
|||
|
|||
import com.ccsens.cloudutil.annotation.MustLogin; |
|||
import com.ccsens.common.bean.dto.CPluginDto; |
|||
import com.ccsens.common.service.IPluginService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "插件相关" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/plugin") |
|||
@Slf4j |
|||
public class PluginController { |
|||
@Resource |
|||
private IPluginService pluginService; |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "给任务添加插件", notes = "") |
|||
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse queryPatientList(@ApiParam @Validated @RequestBody QueryDto<List<CPluginDto.UpdateTaskPlugin>> params) throws Exception{ |
|||
pluginService.updateTaskPlugin(params.getParam()); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.ccsens.ptccsens.api.project; |
|||
|
|||
import com.ccsens.common.bean.dto.CProjectDto; |
|||
import com.ccsens.common.service.IPowerService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "权限相关" , description = "") |
|||
@RestController |
|||
@RequestMapping("/power") |
|||
@Slf4j |
|||
public class PowerController { |
|||
|
|||
@Resource |
|||
private IPowerService powerService; |
|||
|
|||
|
|||
@ApiOperation(value = "查询用户在项目中的权限", notes = "") |
|||
@RequestMapping(value = "/query", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<Integer> queryPatientList(@ApiParam @Validated @RequestBody CProjectDto.QueryPower params) throws Exception{ |
|||
Integer power = powerService.queryUserPower(params.getProjectId(), params.getUserId()); |
|||
return JsonResponse.newInstance().ok(power); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
package com.ccsens.ptccsens.api.project; |
|||
|
|||
import com.ccsens.common.bean.dto.CProjectDto; |
|||
import com.ccsens.common.bean.vo.CProjectVo; |
|||
import com.ccsens.common.service.IProjectService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "项目相关" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/project") |
|||
@Slf4j |
|||
public class ProjectController { |
|||
|
|||
@Resource |
|||
private IProjectService projectService; |
|||
|
|||
@ApiOperation(value = "根据id查询项目信息", notes = "根据id查询项目信息") |
|||
@RequestMapping(value = "/findProjectById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<CProjectVo.ProjectInfo> findProjectById(@ApiParam @Validated @RequestBody QueryDto<CProjectDto.ProjectById> params) throws Exception{ |
|||
CProjectVo.ProjectInfo projectById = projectService.findProjectById(params.getParam(), params.getUserId()); |
|||
return JsonResponse.newInstance().ok(projectById); |
|||
} |
|||
|
|||
@ApiOperation(value = "查询子项目", notes = "查询子项目") |
|||
@RequestMapping(value = "/findSonProject", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CProjectVo.ProjectInfo>> findSonProject(@ApiParam @Validated @RequestBody QueryDto<CProjectDto.FindSonProject> params) throws Exception{ |
|||
log.info("查询子项目开始"); |
|||
List<CProjectVo.ProjectInfo> projectInfoList = projectService.findSonProject(params.getParam(), params.getUserId()); |
|||
log.info("查询子项目结束{}",projectInfoList); |
|||
return JsonResponse.newInstance().ok(projectInfoList); |
|||
} |
|||
|
|||
|
|||
@ApiOperation(value = "删除项目", notes = "删除项目") |
|||
@RequestMapping(value = "/deleteProject", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse deleteProject(@ApiParam @Validated @RequestBody QueryDto<CProjectDto.ProjectById> params) throws Exception{ |
|||
log.info("删除项目开始"); |
|||
projectService.deleteProjectById(params.getParam(), params.getUserId()); |
|||
log.info("删除项目结束"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@RequestMapping(value = "/tallDelProject", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse deleteProject(@ApiParam @Validated @RequestBody CProjectDto.ProjectById params) throws Exception{ |
|||
log.info("删除项目开始"); |
|||
projectService.deleteProjectById(params,null); |
|||
log.info("删除项目结束"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
} |
@ -0,0 +1,99 @@ |
|||
package com.ccsens.ptccsens.api.project; |
|||
|
|||
import com.ccsens.cloudutil.annotation.MustLogin; |
|||
import com.ccsens.common.bean.dto.CRoleDto; |
|||
import com.ccsens.common.bean.vo.CRoleVo; |
|||
import com.ccsens.common.service.IProRoleService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "角色相关" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/role") |
|||
@Slf4j |
|||
public class RoleController { |
|||
@Resource |
|||
private IProRoleService roleService; |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "根据项目id查找角色", notes = "") |
|||
@RequestMapping(value = "/show", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<CRoleVo.QueryRole> queryByProjectId(@ApiParam @Validated @RequestBody QueryDto<CRoleDto.QueryRoleById> params) { |
|||
CRoleVo.QueryRole queryRole = roleService.queryShowRole(params.getParam(), params.getUserId()); |
|||
return JsonResponse.newInstance().ok(queryRole); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "修改角色展示", notes = "") |
|||
@RequestMapping(value = "/updateShow", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse updateShow(@ApiParam @Validated @RequestBody QueryDto<CRoleDto.UpdateRoleShow> params) { |
|||
roleService.updateShowRole(params.getParam(),params.getUserId()); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "查询角色下的所有成员", notes = "") |
|||
@RequestMapping(value = "/queryMemberOfRole", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CRoleVo.MemberOfRoleInfo>> queryMemberOfRole(@ApiParam @Validated @RequestBody QueryDto<CRoleDto.QueryMemberOfRole> params) { |
|||
log.info("查询角色下的所有成员开始{}",params); |
|||
List<CRoleVo.MemberOfRoleInfo> member = roleService.queryMemberOfRole(params.getParam(),params.getUserId()); |
|||
log.info("查询角色下的所有成员开始{}",params); |
|||
return JsonResponse.newInstance().ok(member); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "添加角色", notes = "") |
|||
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse saveRole(@ApiParam @Validated @RequestBody QueryDto<CRoleDto.SaveRole> params) { |
|||
log.info("添加角色{}",params); |
|||
roleService.saveRole(params.getParam(),params.getUserId()); |
|||
log.info("添加角色成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "修改角色信息", notes = "") |
|||
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse updateRole(@ApiParam @Validated @RequestBody QueryDto<CRoleDto.UpdateRole> params) { |
|||
log.info("修改角色信息{}",params); |
|||
roleService.updateRole(params.getParam(),params.getUserId()); |
|||
log.info("修改角色信息成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "删除角色", notes = "") |
|||
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse deleteRole(@ApiParam @Validated @RequestBody QueryDto<CRoleDto.QueryMemberOfRole> params) { |
|||
log.info("删除角色{}",params); |
|||
roleService.delRole(params.getParam(),params.getUserId()); |
|||
log.info("删除角色成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "修改角色下的成员", notes = "") |
|||
@RequestMapping(value = "/roleMembers", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse updateRoleMembers(@ApiParam @Validated @RequestBody QueryDto<CRoleDto.UpdateRoleMembers> params) { |
|||
log.info("修改角色下的成员{}",params); |
|||
roleService.updateRoleMembers(params.getParam(),params.getUserId()); |
|||
log.info("修改角色下的成员成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.ccsens.ptccsens.api.project; |
|||
|
|||
import com.ccsens.cloudutil.annotation.MustLogin; |
|||
import com.ccsens.common.bean.dto.CShareDto; |
|||
import com.ccsens.common.bean.vo.CShareVo; |
|||
import com.ccsens.common.service.IShareService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
@Api(tags = "分享相关") |
|||
@RestController |
|||
@RequestMapping("/share") |
|||
@Slf4j |
|||
public class ShareController { |
|||
|
|||
@Resource |
|||
private IShareService shareService; |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "创建分享连接", notes = "") |
|||
@RequestMapping(value = "/create", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<CShareVo.CreateShareUrl> createShareUrl(@ApiParam @Validated @RequestBody QueryDto<CShareDto.CreateShareUrl> params) { |
|||
CShareVo.CreateShareUrl shareUrl = shareService.createShareUrl(params.getParam(), params.getUserId()); |
|||
return JsonResponse.newInstance().ok(shareUrl); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "点击分享连接", notes = "") |
|||
@RequestMapping(value = "/click", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<CShareVo.ClickShareInfo> queryByProjectId(@ApiParam @Validated @RequestBody QueryDto<CShareDto.ClickShareUrl> params) { |
|||
CShareVo.ClickShareInfo clickShareInfo = shareService.clickShareUrl(params.getParam(), params.getUserId(),params.getUserName(),params.getPhone()); |
|||
return JsonResponse.newInstance().ok(clickShareInfo); |
|||
} |
|||
} |
@ -0,0 +1,129 @@ |
|||
package com.ccsens.ptccsens.api.project; |
|||
|
|||
import com.ccsens.cloudutil.annotation.MustLogin; |
|||
import com.ccsens.common.bean.dto.CPluginDto; |
|||
import com.ccsens.common.bean.dto.CTaskDto; |
|||
import com.ccsens.common.bean.vo.CPluginVo; |
|||
import com.ccsens.common.bean.vo.CTaskVo; |
|||
import com.ccsens.common.service.ITaskService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "任务相关" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/task") |
|||
@Slf4j |
|||
public class TaskController { |
|||
@Resource |
|||
private ITaskService taskService; |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "查找永久日常任务", notes = "") |
|||
@RequestMapping(value = "/permanent", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CTaskVo.QueryTask>> queryPermanentGlobalTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.QueryPermanentGlobalTask> params) { |
|||
List<CTaskVo.QueryTask> queryTasks = taskService.queryPermanentGlobalTask(params.getParam(), params.getUserId()); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "查找带时间的日常任务", notes = "") |
|||
@RequestMapping(value = "/global", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CTaskVo.QueryTask>> queryGlobalTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.QueryGlobalTask> params) { |
|||
List<CTaskVo.QueryTask> queryTasks = taskService.queryGlobalTask(params.getParam(), params.getUserId()); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "查找定期任务", notes = "") |
|||
@RequestMapping(value = "/regular", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CTaskVo.QueryTask>> queryRegularTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.QueryRegularTask> params) { |
|||
List<CTaskVo.QueryTask> queryTasks = taskService.queryRegularTask(params.getParam(), params.getUserId()); |
|||
return JsonResponse.newInstance().ok(queryTasks); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "修改任务状态", notes = "") |
|||
@RequestMapping(value = "/type", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse updateTaskType(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.UpdateTaskType> params) throws Exception { |
|||
taskService.updateTaskType(params.getParam(),params.getUserId()); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@ApiOperation(value = "查询子任务", notes = "") |
|||
@RequestMapping(value = "/findSonTask", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CTaskVo.SonTaskDetail>> findSonTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.FindSonTask> params) throws Exception { |
|||
log.info("查询子任务开始"); |
|||
List<CTaskVo.SonTaskDetail> sonTask = taskService.findSonTask(params.getParam(), params.getUserId()); |
|||
log.info("查询子任务开始{}",sonTask); |
|||
return JsonResponse.newInstance().ok(sonTask); |
|||
} |
|||
|
|||
@ApiOperation(value = "添加任务", notes = "") |
|||
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CTaskVo.QueryTask>> saveTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.SaveTask> params) throws Exception { |
|||
log.info("添加任务开始"); |
|||
List<CTaskVo.QueryTask> taskList = taskService.saveTask(params.getParam(), params.getUserId()); |
|||
log.info("添加任务结束{}",taskList); |
|||
return JsonResponse.newInstance().ok(taskList); |
|||
} |
|||
|
|||
@ApiOperation(value = "查找项目下的任务", notes = "") |
|||
@RequestMapping(value = "/queryTaskOfProject", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CTaskVo.TaskOfProject>> queryTaskOfProject(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.QueryTaskOfProject> params) throws Exception { |
|||
log.info("查找项目下的任务开始{}",params); |
|||
List<CTaskVo.TaskOfProject> taskList = taskService.queryTaskOfProject(params.getParam(), params.getUserId()); |
|||
log.info("查找项目下的任务结束{}",taskList); |
|||
return JsonResponse.newInstance().ok(taskList); |
|||
} |
|||
|
|||
@ApiOperation(value = "修改任务信息", notes = "") |
|||
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse updateTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.UpdateTask> params) throws Exception { |
|||
log.info("修改任务信息开始{}",params); |
|||
taskService.updateTaskDetail(params.getParam(), params.getUserId()); |
|||
log.info("修改任务信息结束"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@ApiOperation(value = "删除任务", notes = "") |
|||
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse deleteTask(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.FindSonTask> params) throws Exception { |
|||
log.info("删除任务开始{}",params); |
|||
taskService.deleteTaskDetail(params.getParam(), params.getUserId()); |
|||
log.info("删除任务结束"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@ApiOperation(value = "查找任务下的插件列表", notes = "") |
|||
@RequestMapping(value = "/queryTaskPlugin", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<CPluginVo.TaskPlugin>> queryTaskPlugin(@ApiParam @Validated @RequestBody QueryDto<CTaskDto.FindSonTask> params) throws Exception { |
|||
log.info("查找任务下的插件列表开始{}",params); |
|||
List<CPluginVo.TaskPlugin> taskPlugins = taskService.queryPluginByTaskId(params.getParam(), params.getUserId()); |
|||
log.info("查找任务下的插件列表结束:{}",taskPlugins); |
|||
return JsonResponse.newInstance().ok(taskPlugins); |
|||
} |
|||
|
|||
@ApiOperation(value = "给任务添加关联插件", notes = "") |
|||
@RequestMapping(value = "/saveTaskPlugin", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse saveTaskPlugin(@ApiParam @Validated @RequestBody QueryDto<CPluginDto.SaveTaskPlugin> params) throws Exception { |
|||
log.info("给任务添加关联插件{}",params); |
|||
taskService.saveTaskPlugin(params.getParam(), params.getUserId()); |
|||
log.info("给任务添加关联插件结束"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
} |
@ -0,0 +1,46 @@ |
|||
package com.ccsens.ptccsens.api.project; |
|||
|
|||
import com.ccsens.common.bean.dto.CMemberDto; |
|||
import com.ccsens.ptccsens.service.IUserService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiImplicitParams; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
@Api(tags = "DEBUG" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/user") |
|||
@Slf4j |
|||
public class UserController { |
|||
@Resource |
|||
private IUserService userService; |
|||
|
|||
@ApiOperation(value = "根据手机号更新成员的userId",notes = "") |
|||
@ApiImplicitParams({ |
|||
}) |
|||
@RequestMapping(value="/memberWithPhone",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse memberWithPhone(@ApiParam @Validated @RequestBody CMemberDto.PhoneAndUserId params) throws Exception { |
|||
log.info("根据手机号更新成员userId"); |
|||
userService.memberWithPhone(params); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
|
|||
@ApiOperation(value = "合并用户后修改userId",notes = "") |
|||
@ApiImplicitParams({ |
|||
}) |
|||
@RequestMapping(value="/mergeUser",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse mergeUser(@ApiParam @Validated @RequestBody CMemberDto.MergeUser params) throws Exception { |
|||
log.info("合并用户后修改userId"); |
|||
userService.mergeUser(params); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
} |
@ -0,0 +1,74 @@ |
|||
package com.ccsens.ptccsens.api.project; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.io.FileUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.ccsens.ptccsens.util.BasicsConstant; |
|||
import com.ccsens.ptccsens.util.BasicsCodeError; |
|||
import com.ccsens.cloudutil.annotation.MustLogin; |
|||
import com.ccsens.ptccsens.bean.vo.ProjectVo; |
|||
import com.ccsens.ptccsens.service.IImportService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.WebConstant; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import com.ccsens.util.exception.BaseException; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiImplicitParams; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.io.File; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Api(tags = "导入wbs" , description = "DebugController | ") |
|||
@RestController |
|||
@RequestMapping("/wbs") |
|||
@Slf4j |
|||
public class WbsController { |
|||
|
|||
@Resource |
|||
private IImportService importService; |
|||
|
|||
|
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "导入WBS",notes = "文件大小不能超过20M,支持后缀:.xls|.xlsx") |
|||
@ApiImplicitParams({ |
|||
// @ApiImplicitParam(name = "file", value = "WBS表", required = true, paramType = "form",dataType = "__file")
|
|||
}) |
|||
@RequestMapping(value = "", method = RequestMethod.POST) |
|||
public JsonResponse<ProjectVo.ProjectInfo> importWbs(QueryDto<MultipartFile> params, Long projectId) throws Exception { |
|||
|
|||
MultipartFile f = params.getParam(); |
|||
String ext = FileUtil.extName(f.getOriginalFilename()); |
|||
if(StrUtil.isEmpty(ext) || !BasicsConstant.WbsExcel.WBS_FILE_FORMAT.contains(ext)){ |
|||
throw new BaseException(BasicsCodeError.FILE_FORMAT_ERROR); |
|||
} |
|||
//文件路径
|
|||
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; |
|||
String extraPath = DateUtil.format(new Date(), "yyyyMMdd"); |
|||
String path = extraPath + File.separator + IdUtil.simpleUUID() + "." + ext; |
|||
//转成file
|
|||
File file = new File(dir + extraPath); |
|||
if (!file.exists()) { |
|||
file.mkdirs(); |
|||
} |
|||
String fullPath = dir + File.separator + path; |
|||
FileUtil.writeFromStream(f.getInputStream(), fullPath); |
|||
|
|||
//导入数据库
|
|||
ProjectVo.ProjectInfo projectInfo = importService.importWbs(fullPath,params.getUserId(),projectId); |
|||
|
|||
return JsonResponse.newInstance().ok(projectInfo); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.ccsens.ptccsens.bean.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class RoleDto { |
|||
|
|||
@Data |
|||
public static class WbsMember{ |
|||
//成员id
|
|||
private Long id; |
|||
//userId
|
|||
private Long userId; |
|||
|
|||
public WbsMember(Long id, Long userId) { |
|||
this.id = id; |
|||
this.userId = userId; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.ccsens.ptccsens.bean.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TaskDto { |
|||
|
|||
/** |
|||
* 导入wbs--插件关联表id |
|||
*/ |
|||
@Data |
|||
public static class TaskPluginId{ |
|||
private Long taskPluginId1; |
|||
private Long taskPluginId2; |
|||
private Long taskPluginId3; |
|||
|
|||
public TaskPluginId(Long id1, Long id2,Long id3) { |
|||
this.taskPluginId1 = id1; |
|||
this.taskPluginId2 = id2; |
|||
this.taskPluginId3 = id3; |
|||
} |
|||
|
|||
public TaskPluginId() { |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,60 @@ |
|||
package com.ccsens.ptccsens.bean.vo; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.ccsens.util.WebConstant; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
@Data |
|||
public class ProjectVo { |
|||
@Data |
|||
@ApiModel("项目信息defaultProject") |
|||
public static class ProjectInfo{ |
|||
@ApiModelProperty("id") |
|||
private Long id; |
|||
@ApiModelProperty("项目名") |
|||
private String name; |
|||
@ApiModelProperty("开始时间") |
|||
private Long startTime; |
|||
@ApiModelProperty("结束时间") |
|||
private Long endTime; |
|||
@ApiModelProperty("项目完成状态(0-未开始,1-进行中,2-暂停,3-已完成)") |
|||
private byte status; |
|||
@ApiModelProperty("访问路径)") |
|||
private String url; |
|||
|
|||
public Byte getStatus() { |
|||
long current = System.currentTimeMillis(); |
|||
if(ObjectUtil.isNull(getStartTime()) || ObjectUtil.isNull(getEndTime())) { |
|||
return null; |
|||
} |
|||
if(getStartTime() > current){ |
|||
this.status = (byte) WebConstant.EVENT_PROCESS.Pending.value; |
|||
}else if(getEndTime() < current){ |
|||
this.status = (byte) WebConstant.EVENT_PROCESS.Expired.value; |
|||
}else{ |
|||
this.status = (byte) WebConstant.EVENT_PROCESS.Processing.value; |
|||
} |
|||
return this.status; |
|||
} |
|||
|
|||
} |
|||
|
|||
@Data |
|||
public static class SysProject{ |
|||
@ApiModelProperty("项目id") |
|||
private Long id; |
|||
@ApiModelProperty("项目名称") |
|||
private String name; |
|||
@ApiModelProperty("开始时间") |
|||
private Long beginTime; |
|||
@ApiModelProperty("结束时间") |
|||
private Long endTime; |
|||
@ApiModelProperty("导入类型(0-第一次导入,1-修改WBS)") |
|||
private Byte importType = 0;; |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.ccsens.ptccsens.config; |
|||
|
|||
import com.ccsens.ptccsens.intercept.MybatisInterceptor; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: wuHuiJuan |
|||
* @create: 2019/12/03 18:01 |
|||
*/ |
|||
@Configuration |
|||
public class BeanConfig { |
|||
/** |
|||
* 注册拦截器 |
|||
*/ |
|||
@Bean |
|||
public MybatisInterceptor mybatisInterceptor() { |
|||
MybatisInterceptor interceptor = new MybatisInterceptor(); |
|||
return interceptor; |
|||
} |
|||
} |
@ -0,0 +1,128 @@ |
|||
package com.ccsens.ptccsens.config; |
|||
|
|||
|
|||
import cn.hutool.core.lang.Snowflake; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import com.ccsens.util.config.DruidProps; |
|||
import com.fasterxml.jackson.databind.DeserializationFeature; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.fasterxml.jackson.databind.module.SimpleModule; |
|||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.http.converter.HttpMessageConverter; |
|||
import org.springframework.http.converter.StringHttpMessageConverter; |
|||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
|||
import org.springframework.web.servlet.config.annotation.*; |
|||
|
|||
import javax.annotation.Resource; |
|||
import javax.sql.DataSource; |
|||
import java.nio.charset.Charset; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.TimeZone; |
|||
|
|||
@Configuration |
|||
public class SpringConfig implements WebMvcConfigurer { |
|||
@Resource |
|||
private DruidProps druidPropsUtil; |
|||
@Value("${spring.snowflake.workerId}") |
|||
private String workerId; |
|||
@Value("${spring.snowflake.datacenterId}") |
|||
private String datacenterId; |
|||
|
|||
/** |
|||
* 配置Converter |
|||
* @return |
|||
*/ |
|||
@Bean |
|||
public HttpMessageConverter<String> responseStringConverter() { |
|||
StringHttpMessageConverter converter = new StringHttpMessageConverter( |
|||
Charset.forName("UTF-8")); |
|||
return converter; |
|||
} |
|||
|
|||
@Bean |
|||
public HttpMessageConverter<Object> responseJsonConverter(){ |
|||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); |
|||
List<MediaType> mediaTypeList = new ArrayList<>(); |
|||
mediaTypeList.add(MediaType.TEXT_HTML); |
|||
mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8); |
|||
converter.setSupportedMediaTypes(mediaTypeList); |
|||
|
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
SimpleModule simpleModule = new SimpleModule(); |
|||
simpleModule.addSerializer(Long.class, ToStringSerializer.instance); |
|||
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); |
|||
objectMapper.registerModule(simpleModule); |
|||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
|||
objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8")); |
|||
converter.setObjectMapper(objectMapper); |
|||
|
|||
return converter; |
|||
} |
|||
|
|||
@Override |
|||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
|||
converters.add(responseStringConverter()); |
|||
converters.add(responseJsonConverter()); |
|||
} |
|||
|
|||
@Override |
|||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { |
|||
configurer.favorPathExtension(false); |
|||
} |
|||
|
|||
@Override |
|||
public void addCorsMappings(CorsRegistry registry) { |
|||
registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") |
|||
// .allowedMethods("*") // 允许提交请求的方法,*表示全部允许
|
|||
.allowedOrigins("*") // #允许向该服务器提交请求的URI,*表示全部允许
|
|||
.allowCredentials(true) // 允许cookies跨域
|
|||
.allowedHeaders("*") // #允许访问的头信息,*表示全部
|
|||
.maxAge(18000L); // 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 配置静态资源 |
|||
*/ |
|||
@Override |
|||
public void addResourceHandlers(ResourceHandlerRegistry registry) { |
|||
registry.addResourceHandler("swagger-ui.html") |
|||
.addResourceLocations("classpath:/META-INF/resources/"); |
|||
registry.addResourceHandler("/webjars/**") |
|||
.addResourceLocations("classpath:/META-INF/resources/webjars/"); |
|||
|
|||
registry.addResourceHandler("/uploads/**") |
|||
.addResourceLocations("file:///home/cloud/ccbasics/uploads/"); |
|||
} |
|||
|
|||
/** |
|||
* 配置拦截器 |
|||
* @param registry |
|||
*/ |
|||
@Override |
|||
public void addInterceptors(InterceptorRegistry registry) { |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 配置数据源(单数据源) |
|||
*/ |
|||
@Bean |
|||
public DataSource dataSource(){ |
|||
return druidPropsUtil.createDruidDataSource(); |
|||
} |
|||
|
|||
@Bean |
|||
public Snowflake snowflake(){ |
|||
return IdUtil.createSnowflake(Long.valueOf(workerId),Long.valueOf(datacenterId)); |
|||
} |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.ccsens.ptccsens.config; |
|||
|
|||
import com.ccsens.util.WebConstant; |
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import springfox.documentation.builders.ParameterBuilder; |
|||
import springfox.documentation.builders.RequestHandlerSelectors; |
|||
import springfox.documentation.schema.ModelRef; |
|||
import springfox.documentation.service.ApiInfo; |
|||
import springfox.documentation.service.Parameter; |
|||
import springfox.documentation.spi.DocumentationType; |
|||
import springfox.documentation.spring.web.plugins.Docket; |
|||
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
@Configuration |
|||
@EnableSwagger2 |
|||
@ConditionalOnExpression("${swagger.enable}") |
|||
//public class SwaggerConfigure extends WebMvcConfigurationSupport {
|
|||
public class SwaggerConfigure /*implements WebMvcConfigurer*/ { |
|||
@Bean |
|||
public Docket customDocket() { |
|||
//
|
|||
return new Docket(DocumentationType.SWAGGER_2) |
|||
.apiInfo(apiInfo()) |
|||
.select() |
|||
.apis(RequestHandlerSelectors |
|||
.basePackage("com.ccsens.ccbasics.api")) |
|||
.build() |
|||
.globalOperationParameters(setHeaderToken()); |
|||
} |
|||
|
|||
private ApiInfo apiInfo() { |
|||
return new ApiInfo("Swagger Tall-game",//大标题 title
|
|||
"This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",//小标题
|
|||
"1.0.0",//版本
|
|||
"http://swagger.io/terms/",//termsOfServiceUrl
|
|||
"zhangsan",//作者
|
|||
"Apache 2.0",//链接显示文字
|
|||
"http://www.apache.org/licenses/LICENSE-2.0.html"//网站链接
|
|||
); |
|||
} |
|||
|
|||
private List<Parameter> setHeaderToken() { |
|||
ParameterBuilder tokenPar = new ParameterBuilder(); |
|||
List<Parameter> pars = new ArrayList<>(); |
|||
tokenPar.name(WebConstant.HEADER_KEY_TOKEN).description("token") |
|||
.defaultValue(WebConstant.HEADER_KEY_TOKEN_PREFIX) |
|||
.modelRef(new ModelRef("string")).parameterType("header").required(false).build(); |
|||
pars.add(tokenPar.build()); |
|||
return pars; |
|||
} |
|||
} |
@ -0,0 +1,159 @@ |
|||
package com.ccsens.ptccsens.intercept; |
|||
|
|||
import cn.hutool.core.collection.CollectionUtil; |
|||
import com.ccsens.util.WebConstant; |
|||
import org.apache.ibatis.executor.Executor; |
|||
import org.apache.ibatis.mapping.BoundSql; |
|||
import org.apache.ibatis.mapping.MappedStatement; |
|||
import org.apache.ibatis.mapping.ResultMap; |
|||
import org.apache.ibatis.mapping.SqlSource; |
|||
import org.apache.ibatis.plugin.*; |
|||
import org.apache.ibatis.reflection.DefaultReflectorFactory; |
|||
import org.apache.ibatis.reflection.MetaObject; |
|||
import org.apache.ibatis.reflection.factory.DefaultObjectFactory; |
|||
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory; |
|||
import org.apache.ibatis.session.ResultHandler; |
|||
import org.apache.ibatis.session.RowBounds; |
|||
|
|||
import java.lang.reflect.InvocationTargetException; |
|||
import java.lang.reflect.Method; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Properties; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: wuHuiJuan |
|||
* @create: 2019/12/11 10:58 |
|||
*/ |
|||
@Intercepts({ |
|||
@Signature( |
|||
type = Executor.class, |
|||
method = "query", |
|||
args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class} |
|||
) |
|||
}) |
|||
public class MybatisInterceptor implements Interceptor { |
|||
@Override |
|||
public Object intercept(Invocation invocation) throws Throwable { |
|||
|
|||
|
|||
String selectByExample = "selectByExample"; |
|||
String countByExample = "countByExample"; |
|||
String countByExample2 = "selectByExample_COUNT"; |
|||
String selectByPrimaryKey = "selectByPrimaryKey"; |
|||
|
|||
Object[] args = invocation.getArgs(); |
|||
MappedStatement statement = (MappedStatement) args[0]; |
|||
if (statement.getId().endsWith(selectByExample) |
|||
|| statement.getId().endsWith(countByExample) |
|||
|| statement.getId().endsWith(countByExample2)) { |
|||
//XXXExample
|
|||
Object example = args[1]; |
|||
|
|||
addCondition(statement, example); |
|||
|
|||
|
|||
|
|||
|
|||
} else if (statement.getId().endsWith(selectByPrimaryKey)) { |
|||
BoundSql boundSql = statement.getBoundSql(args[1]); |
|||
String sql = boundSql.getSql() + " and rec_status = 0"; |
|||
MappedStatement newStatement = newMappedStatement(statement, new BoundSqlSqlSource(boundSql)); |
|||
MetaObject msObject = MetaObject.forObject(newStatement, new DefaultObjectFactory(), new DefaultObjectWrapperFactory(),new DefaultReflectorFactory()); |
|||
msObject.setValue("sqlSource.boundSql.sql", sql); |
|||
args[0] = newStatement; |
|||
} |
|||
|
|||
return invocation.proceed(); |
|||
} |
|||
|
|||
private void addCondition(MappedStatement statement, Object example) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException { |
|||
if (example instanceof Map) { |
|||
example = ((Map) example).get("_ORIGINAL_PARAMETER_OBJECT"); |
|||
} |
|||
|
|||
|
|||
Method method = example.getClass().getMethod("getOredCriteria", null); |
|||
//获取到条件数组,第一个是Criteria
|
|||
List list = (List) method.invoke(example); |
|||
if (CollectionUtil.isEmpty(list)) { |
|||
Class clazz = ((ResultMap) statement.getResultMaps().get(0)).getType(); |
|||
String exampleName = clazz.getName() + "Example"; |
|||
Object paramExample = Class.forName(exampleName).newInstance(); |
|||
Method createCriteria = paramExample.getClass().getMethod("createCriteria"); |
|||
Object criteria = createCriteria.invoke(paramExample); |
|||
Method andIsDelEqualTo = criteria.getClass().getMethod("andRecStatusEqualTo", Byte.class); |
|||
andIsDelEqualTo.invoke(criteria, WebConstant.REC_STATUS.Normal.value); |
|||
list.add(criteria); |
|||
} else { |
|||
Object criteria = list.get(0); |
|||
Method getCriteria = criteria.getClass().getMethod("getCriteria"); |
|||
List params = (List) getCriteria.invoke(criteria); |
|||
boolean hasDel = false; |
|||
for (Object param : params) { |
|||
Method getCondition = param.getClass().getMethod("getCondition"); |
|||
Object condition = getCondition.invoke(param); |
|||
if ("rec_status =".equals(condition)) { |
|||
hasDel = true; |
|||
} |
|||
} |
|||
if (!hasDel) { |
|||
Method andIsDelEqualTo = criteria.getClass().getMethod("andRecStatusEqualTo", Byte.class); |
|||
andIsDelEqualTo.invoke(criteria, WebConstant.REC_STATUS.Normal.value); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public Object plugin(Object target) { |
|||
return Plugin.wrap(target, this); |
|||
} |
|||
|
|||
@Override |
|||
public void setProperties(Properties properties) { |
|||
|
|||
} |
|||
|
|||
private MappedStatement newMappedStatement(MappedStatement ms, SqlSource newSqlSource) { |
|||
MappedStatement.Builder builder = |
|||
new MappedStatement.Builder(ms.getConfiguration(), ms.getId(), newSqlSource, ms.getSqlCommandType()); |
|||
builder.resource(ms.getResource()); |
|||
builder.fetchSize(ms.getFetchSize()); |
|||
builder.statementType(ms.getStatementType()); |
|||
builder.keyGenerator(ms.getKeyGenerator()); |
|||
if (ms.getKeyProperties() != null && ms.getKeyProperties().length != 0) { |
|||
StringBuilder keyProperties = new StringBuilder(); |
|||
for (String keyProperty : ms.getKeyProperties()) { |
|||
keyProperties.append(keyProperty).append(","); |
|||
} |
|||
keyProperties.delete(keyProperties.length() - 1, keyProperties.length()); |
|||
builder.keyProperty(keyProperties.toString()); |
|||
} |
|||
builder.timeout(ms.getTimeout()); |
|||
builder.parameterMap(ms.getParameterMap()); |
|||
builder.resultMaps(ms.getResultMaps()); |
|||
builder.resultSetType(ms.getResultSetType()); |
|||
builder.cache(ms.getCache()); |
|||
builder.flushCacheRequired(ms.isFlushCacheRequired()); |
|||
builder.useCache(ms.isUseCache()); |
|||
|
|||
return builder.build(); |
|||
} |
|||
|
|||
|
|||
// 定义一个内部辅助类,作用是包装sq
|
|||
class BoundSqlSqlSource implements SqlSource { |
|||
private BoundSql boundSql; |
|||
public BoundSqlSqlSource(BoundSql boundSql) { |
|||
this.boundSql = boundSql; |
|||
} |
|||
@Override |
|||
public BoundSql getBoundSql(Object parameterObject) { |
|||
return boundSql; |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,12 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public interface SPluginDao { |
|||
Long getPluginIdByName(@Param("pluginName") String pluginName); |
|||
|
|||
void updateParamById(@Param("param")String param,@Param("taskPluginId")Long taskPluginId); |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import com.ccsens.ptccsens.bean.vo.ProjectVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Repository |
|||
public interface SProjectDao { |
|||
|
|||
List<ProjectVo.SysProject> queryByCreator(@Param("userId") Long userId); |
|||
|
|||
/** |
|||
* 根据项目id查询项目 |
|||
* @param projectId 项目id |
|||
* @return 项目信息 |
|||
*/ |
|||
ProjectVo.SysProject selectById(@Param("projectId") Long projectId); |
|||
|
|||
/** |
|||
* 逻辑删除项目 |
|||
* @param projectId 项目id |
|||
*/ |
|||
void updateStatusById(@Param("projectId") Long projectId); |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import com.ccsens.common.bean.po.ProTaskSub; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public interface STaskDao { |
|||
|
|||
void insertSelectiveList(@Param("proTaskSubList") List<ProTaskSub> proTaskSubList); |
|||
|
|||
/** |
|||
* 根据任务名和项目id查找当前时间下的任务的分解id |
|||
* @param taskName 任务名 |
|||
* @param projectId 项目id |
|||
* @param now 当前时间 |
|||
* @return 返回任务分解id |
|||
*/ |
|||
Long getNowTask(@Param("taskName") String taskName, @Param("projectId") Long projectId, @Param("now") long now); |
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import com.ccsens.common.persist.dao.LabelDao; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Repository |
|||
public interface SubLabelDao extends LabelDao { |
|||
Long getLabelByName(@Param("type") int type, @Param("sysRole") String sysRole); |
|||
|
|||
Long getLabelByTypeAndLevel(@Param("type") int type, @Param("level") int level); |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.ccsens.ptccsens.service; |
|||
|
|||
|
|||
import com.ccsens.ptccsens.bean.vo.ProjectVo; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public interface IImportService { |
|||
/** |
|||
* 读取excel |
|||
* @param path 路径 |
|||
* @param userId userId |
|||
* @throws Exception 异常 |
|||
*/ |
|||
ProjectVo.ProjectInfo importWbs(String path, Long userId, Long projectId) throws Exception; |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.ccsens.ptccsens.service; |
|||
|
|||
import com.ccsens.common.bean.dto.CMemberDto; |
|||
|
|||
public interface IUserService { |
|||
/** |
|||
* 根据手机号修改成员的userId |
|||
* @param params 手机号和userId |
|||
*/ |
|||
void memberWithPhone(CMemberDto.PhoneAndUserId params); |
|||
|
|||
/** |
|||
* 合并用户后修改userId |
|||
* @param params 新旧userId |
|||
*/ |
|||
void mergeUser(CMemberDto.MergeUser params); |
|||
} |
@ -0,0 +1,896 @@ |
|||
package com.ccsens.ptccsens.service; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.collection.CollectionUtil; |
|||
import cn.hutool.core.lang.Snowflake; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.ccsens.ptccsens.util.BasicsCodeError; |
|||
import com.ccsens.cloudutil.bean.tall.dto.ProjectDto; |
|||
import com.ccsens.cloudutil.feign.Tall3FeignClient; |
|||
import com.ccsens.common.bean.po.*; |
|||
import com.ccsens.common.persist.dao.*; |
|||
import com.ccsens.common.persist.mapper.ProMemberStakeholderMapper; |
|||
import com.ccsens.ptccsens.bean.dto.RoleDto; |
|||
import com.ccsens.ptccsens.bean.dto.TaskDto; |
|||
import com.ccsens.ptccsens.bean.vo.ProjectVo; |
|||
import com.ccsens.ptccsens.persist.dao.SPluginDao; |
|||
import com.ccsens.ptccsens.persist.dao.SProjectDao; |
|||
import com.ccsens.ptccsens.persist.dao.STaskDao; |
|||
import com.ccsens.ptccsens.persist.dao.SubLabelDao; |
|||
import com.ccsens.ptccsens.util.BasicsConstant; |
|||
import com.ccsens.util.ExcelUtil; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.PropUtil; |
|||
import com.ccsens.util.StringUtil; |
|||
import com.ccsens.util.cron.CronConstant; |
|||
import com.ccsens.util.cron.NatureToDate; |
|||
import com.ccsens.util.exception.BaseException; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.poi.xssf.usermodel.XSSFCell; |
|||
import org.apache.poi.xssf.usermodel.XSSFRow; |
|||
import org.apache.poi.xssf.usermodel.XSSFSheet; |
|||
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.io.FileInputStream; |
|||
import java.io.InputStream; |
|||
import java.util.*; |
|||
import java.util.regex.Matcher; |
|||
import java.util.regex.Pattern; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|||
public class ImportService implements IImportService { |
|||
|
|||
@Resource |
|||
private Snowflake snowflake; |
|||
@Resource |
|||
private ProTaskDetailDao taskDetailDao; |
|||
@Resource |
|||
private ProTaskSubDao taskSubDao; |
|||
@Resource |
|||
private ProTaskVersionDao taskVersionMapper; |
|||
@Resource |
|||
private SubLabelDao subLabelDao; |
|||
@Resource |
|||
private LabelDao labelDao; |
|||
@Resource |
|||
private ProRoleDao roleDao; |
|||
@Resource |
|||
private ProMemberDao memberDao; |
|||
@Resource |
|||
private ProRoleMemberDao roleMemberDao; |
|||
@Resource |
|||
private ProMemberStakeholderMapper memberStakeholderMapper; |
|||
@Resource |
|||
private ProRoleRepulsionDao repulsionDao; |
|||
@Resource |
|||
private LabelBusinessDao labelBusinessDao; |
|||
@Resource |
|||
private ProParentTaskDao parentTaskMapper; |
|||
@Resource |
|||
private ProRoleTaskDao roleTaskMapper; |
|||
@Resource |
|||
private UserDao userDao; |
|||
@Resource |
|||
private SProjectDao projectDao; |
|||
@Resource |
|||
private STaskDao sTaskDao; |
|||
@Resource |
|||
private SPluginDao sTaskPluginDao; |
|||
@Resource |
|||
private ProTaskPluginDao proTaskPluginDao; |
|||
@Resource |
|||
private Tall3FeignClient tall3FeignClient; |
|||
|
|||
/** |
|||
* 读取wbs文件 |
|||
* @param path 路径 |
|||
* @param userId userId |
|||
* @throws Exception 异常 |
|||
*/ |
|||
@Override |
|||
public ProjectVo.ProjectInfo importWbs(String path, Long userId,Long projectId) throws Exception { |
|||
ProjectVo.ProjectInfo projectInfo = new ProjectVo.ProjectInfo(); |
|||
//获取excel文件
|
|||
InputStream is = new FileInputStream(path); |
|||
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(is); |
|||
//角色
|
|||
Map<String, Long> roleMap = new HashMap<>(); |
|||
//成员
|
|||
Map<String, RoleDto.WbsMember> memberMap = new HashMap<>(); |
|||
//任务
|
|||
Map<String, Object> taskMap = new HashMap<>(); |
|||
|
|||
//读取文件
|
|||
readExcel(xssfWorkbook, userId, roleMap, memberMap, taskMap,projectId,projectInfo); |
|||
|
|||
//读取插件配置表
|
|||
readPluginConfig(xssfWorkbook,taskMap); |
|||
|
|||
return projectInfo; |
|||
} |
|||
|
|||
/** |
|||
* 读取插件配置表 |
|||
*/ |
|||
private void readPluginConfig(XSSFWorkbook wb, Map<String, Object> taskMap) { |
|||
//获取插件配置表Sheet
|
|||
XSSFSheet wbsSheet = wb.getSheet(BasicsConstant.WbsExcel.WBS_PLUGIN_CONFIG); |
|||
if (ObjectUtil.isNotNull(wbsSheet)) { |
|||
for (int i = 0; i <= wbsSheet.getLastRowNum(); i++) { |
|||
//获取行
|
|||
XSSFRow row = wbsSheet.getRow(i); |
|||
if (row == null) { |
|||
continue; |
|||
} |
|||
//序号
|
|||
String sequence = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(0))); |
|||
//任务名
|
|||
String taskName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1))); |
|||
if(StrUtil.isEmpty(taskName)){ |
|||
continue; |
|||
} |
|||
//插件1
|
|||
String pluginParam1 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2))); |
|||
//插件2
|
|||
String pluginParam2 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3))); |
|||
//插件3
|
|||
String pluginParam3 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4))); |
|||
Object o = taskMap.get(sequence + "_" + taskName); |
|||
if(ObjectUtil.isNull(o)){ |
|||
continue; |
|||
} |
|||
TaskDto.TaskPluginId taskPlugin = (TaskDto.TaskPluginId) o; |
|||
if(StrUtil.isNotEmpty(pluginParam1)){ |
|||
//修改插件表的param
|
|||
sTaskPluginDao.updateParamById(pluginParam1,taskPlugin.getTaskPluginId1()); |
|||
} |
|||
if(StrUtil.isNotEmpty(pluginParam2)){ |
|||
//修改插件表的param
|
|||
sTaskPluginDao.updateParamById(pluginParam2,taskPlugin.getTaskPluginId2()); |
|||
} |
|||
if(StrUtil.isNotEmpty(pluginParam3)){ |
|||
//修改插件表的param
|
|||
sTaskPluginDao.updateParamById(pluginParam3,taskPlugin.getTaskPluginId3()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 读取每个sheet |
|||
*/ |
|||
private void readExcel(XSSFWorkbook wb, Long userId, Map<String, Long> roleMap, Map<String, RoleDto.WbsMember> memberMap, Map<String, Object> taskMap,Long projectId,ProjectVo.ProjectInfo projectInfo) { |
|||
//获取wbsSheet
|
|||
XSSFSheet wbsSheet = wb.getSheet(BasicsConstant.WbsExcel.WBS_SHEET); |
|||
if (ObjectUtil.isNull(wbsSheet)) { |
|||
throw new BaseException(BasicsCodeError.NOT_WBS_SHEET); |
|||
} |
|||
//获取项目成员表
|
|||
XSSFSheet memberSheet = wb.getSheet(BasicsConstant.WbsExcel.MEMBER_SHEET); |
|||
if (ObjectUtil.isNull(memberSheet)) { |
|||
throw new BaseException(BasicsCodeError.NOT_MEMBER_SHEET); |
|||
} |
|||
//读取项目信息和任务分解信息的开始结束行
|
|||
int projectStart = 0; |
|||
int taskStart = 0; |
|||
for (int i = 0; i <= wbsSheet.getLastRowNum(); i++) { |
|||
//获取行
|
|||
XSSFRow xssfRow = wbsSheet.getRow(i); |
|||
if (xssfRow == null) { |
|||
continue; |
|||
} |
|||
//获取第一列
|
|||
XSSFCell xssfCell = xssfRow.getCell(0); |
|||
if (xssfCell == null) { |
|||
continue; |
|||
} |
|||
String s = ExcelUtil.getCellValue(xssfCell); |
|||
//获取项目开始行
|
|||
if (s.indexOf(BasicsConstant.WbsExcel.PROJECT_INFO_TITLE) == 0) { |
|||
projectStart = i + 1; |
|||
} |
|||
//获取任务开始行
|
|||
if (s.indexOf(BasicsConstant.WbsExcel.TASK_INFO_TITLE) == 0) { |
|||
taskStart = i + 1; |
|||
} |
|||
} |
|||
if (projectStart == 0) { |
|||
throw new BaseException(BasicsCodeError.WSB_NOT_PROJECT_HEADER); |
|||
} |
|||
if (taskStart == 0) { |
|||
throw new BaseException(BasicsCodeError.WSB_NOT_TASK_HEADER); |
|||
} |
|||
//添加项目
|
|||
ProjectVo.SysProject project = readProject(wbsSheet, projectStart, userId,projectId); |
|||
if(ObjectUtil.isNull(project)){ |
|||
throw new BaseException(BasicsCodeError.WSB_NOT_PROJECT_HEADER); |
|||
} |
|||
//读取成员表
|
|||
readMemberSheet(memberSheet,project,roleMap,memberMap); |
|||
//添加任务
|
|||
readTask(wbsSheet,taskStart,project,roleMap,taskMap); |
|||
//获取用户列表
|
|||
Set<Long> userIdSet = new HashSet<>(); |
|||
userIdSet.add(userId); |
|||
//处理创建人的权限问题(添加创建人角色)
|
|||
//查找创建者标签id
|
|||
Long roleLabelId = labelDao.getLabelByTypeAndLevel(5, 5); |
|||
//添加创建者角色
|
|||
ProRole role = new ProRole(); |
|||
role.setId(snowflake.nextId()); |
|||
role.setName("创建者"); |
|||
role.setProjectId(project.getId()); |
|||
role.setLabelId(roleLabelId); |
|||
roleDao.insertSelective(role); |
|||
//查找创建者在项目下的成员信息
|
|||
Long memberId = null; |
|||
if(CollectionUtil.isNotEmpty(memberMap)){ |
|||
for(RoleDto.WbsMember member : memberMap.values()){ |
|||
if(ObjectUtil.isNotNull(member.getUserId())){ |
|||
if(member.getUserId().equals(userId)){ |
|||
memberId = member.getId(); |
|||
} |
|||
userIdSet.add(member.getUserId()); |
|||
} |
|||
} |
|||
} |
|||
//如果当前用户不是项目成员,则添加为成员
|
|||
if(ObjectUtil.isNull(memberId)){ |
|||
//添加成员至数据库
|
|||
ProMember proMember = new ProMember(); |
|||
proMember.setId(snowflake.nextId()); |
|||
proMember.setProjectId(projectId); |
|||
proMember.setUserId(userId); |
|||
memberDao.insertSelective(proMember); |
|||
memberId = proMember.getId(); |
|||
} |
|||
//添加当前用户未创建者
|
|||
//添加角色成员关联信息
|
|||
ProRoleMember roleMember = new ProRoleMember(); |
|||
roleMember.setId(snowflake.nextId()); |
|||
roleMember.setRoleId(role.getId()); |
|||
roleMember.setMemberId(memberId); |
|||
roleMemberDao.insertSelective(roleMember); |
|||
|
|||
//TODO 在tall客户端添加项目和用户的关联信息
|
|||
ProjectDto.SaveProjectDto saveProjectDto = new ProjectDto.SaveProjectDto(); |
|||
saveProjectDto.setId(project.getId()); |
|||
saveProjectDto.setName(project.getName()); |
|||
saveProjectDto.setStartTime(project.getBeginTime()); |
|||
saveProjectDto.setEndTime(project.getEndTime()); |
|||
saveProjectDto.setUrl(PropUtil.domain); |
|||
|
|||
saveProjectDto.setUserIdList(userIdSet); |
|||
JsonResponse jsonResponse = tall3FeignClient.saveProjectList(saveProjectDto); |
|||
if (null == jsonResponse){ |
|||
throw new BaseException(BasicsCodeError.FEIGN_ERROR); |
|||
} |
|||
|
|||
//获取项目信息
|
|||
BeanUtil.copyProperties(saveProjectDto,projectInfo); |
|||
} |
|||
|
|||
/** |
|||
* 读取项目信息 |
|||
*/ |
|||
private ProjectVo.SysProject readProject(XSSFSheet wbsSheet, int projectStart, Long userId,Long projectId) { |
|||
ProjectVo.SysProject project = new ProjectVo.SysProject(); |
|||
// TODO 查询是否项目是否存在
|
|||
if (ObjectUtil.isNotNull(projectId)) { |
|||
project = projectDao.selectById(projectId); |
|||
if (ObjectUtil.isNotNull(project)) { |
|||
project.setId(projectId); |
|||
project.setImportType((byte)1); |
|||
//删除之前的项目详情
|
|||
projectDao.updateStatusById(projectId); |
|||
//删除之前的项目分解
|
|||
ProTaskSubExample taskSubExample = new ProTaskSubExample(); |
|||
taskSubExample.createCriteria().andTaskDetailIdEqualTo(projectId); |
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setRecStatus((byte)2); |
|||
taskSubDao.updateByExampleSelective(taskSub,taskSubExample); |
|||
//删除之前的版本信息
|
|||
ProTaskVersion taskVersion = new ProTaskVersion(); |
|||
taskVersion.setRecStatus((byte)2); |
|||
ProTaskVersionExample taskVersionExample = new ProTaskVersionExample(); |
|||
taskVersionExample.createCriteria().andTaskDetailIdEqualTo(projectId); |
|||
taskVersionMapper.updateByExampleSelective(taskVersion,taskVersionExample); |
|||
//删除项目标签相关的
|
|||
LabelBusiness labelBusiness = new LabelBusiness(); |
|||
labelBusiness.setRecStatus((byte)2); |
|||
LabelBusinessExample labelBusinessExample = new LabelBusinessExample(); |
|||
labelBusinessExample.createCriteria().andBusinessIdEqualTo(projectId); |
|||
labelBusinessDao.updateByExampleSelective(labelBusiness,labelBusinessExample); |
|||
} |
|||
} |
|||
//获取项目信息的那一行
|
|||
XSSFRow row = wbsSheet.getRow(projectStart + 1); |
|||
if (ObjectUtil.isNull(row)) { |
|||
throw new BaseException(BasicsCodeError.WSB_NOT_PROJECT_HEADER); |
|||
} |
|||
//项目名
|
|||
String projectName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(0))); |
|||
//详情
|
|||
String description = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1))); |
|||
//项目时间
|
|||
String address = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2))); |
|||
//开始时间
|
|||
String beginTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3))); |
|||
//结束时间
|
|||
String endTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4))); |
|||
//版本
|
|||
String version = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(5))); |
|||
if (StrUtil.isEmpty(projectName)) { |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_PROJECT_NAME.addMsg(wbsSheet.getSheetName(),projectStart+1)); |
|||
} |
|||
//项目名不能重复(当前用户创建的项目内名字不能重复)
|
|||
//根据userId查找已创建的项目
|
|||
List<ProjectVo.SysProject> sysProjectList = projectDao.queryByCreator(userId); |
|||
if(CollectionUtil.isNotEmpty(sysProjectList)){ |
|||
sysProjectList.forEach(p -> { |
|||
if(projectName.equalsIgnoreCase(p.getName())){ |
|||
//如果名称重复则提示错误信息
|
|||
throw new BaseException(BasicsCodeError.PROJECT_NAME_REPEAT.addMsg(wbsSheet.getSheetName(),projectStart+1,projectName)); |
|||
} |
|||
}); |
|||
} |
|||
//判断时间是否正确
|
|||
String begin = ExcelUtil.getCellValue(row.getCell(3)); |
|||
String end = ExcelUtil.getCellValue(row.getCell(4)); |
|||
if (StrUtil.isEmpty(begin) || StrUtil.isEmpty(end)) { |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_PROJECT_TIME.addMsg(wbsSheet.getSheetName(),projectStart+1)); |
|||
} |
|||
long bTime; |
|||
long eTime; |
|||
try { |
|||
bTime = Long.parseLong(beginTime); |
|||
eTime = Long.parseLong(endTime); |
|||
} catch (Exception e) { |
|||
//日期格式错误
|
|||
throw new BaseException(BasicsCodeError.WBS_PROJECT_TIME_ERROR.addMsg(wbsSheet.getSheetName(),projectStart+1)); |
|||
} |
|||
//添加项目信息(任务详情)
|
|||
ProTaskDetail taskDetail = new ProTaskDetail(); |
|||
if (0 == project.getImportType()) { |
|||
taskDetail.setId(snowflake.nextId()); |
|||
} |
|||
if (1 == project.getImportType()) { |
|||
taskDetail.setId(projectId); |
|||
} |
|||
taskDetail.setName(projectName); |
|||
taskDetail.setDescription(description); |
|||
if (0 == project.getImportType()){ |
|||
taskDetailDao.insertSelective(taskDetail); |
|||
} |
|||
if (1 == project.getImportType()){ |
|||
taskDetailDao.updateByPrimaryKeySelective(taskDetail); |
|||
} |
|||
project.setId(taskDetail.getId()); |
|||
project.setName(projectName); |
|||
//添加(任务分解)
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setId(snowflake.nextId()); |
|||
taskSub.setTaskDetailId(taskDetail.getId()); |
|||
taskSub.setPlanStartTime(bTime); |
|||
taskSub.setPlanEndTime(eTime); |
|||
taskSub.setPlanDuration(eTime - bTime); |
|||
taskSubDao.insertSelective(taskSub); |
|||
project.setBeginTime(bTime); |
|||
project.setEndTime(eTime); |
|||
//添加版本信息
|
|||
ProTaskVersion taskVersion = new ProTaskVersion(); |
|||
taskVersion.setId(snowflake.nextId()); |
|||
taskVersion.setTaskDetailId(taskDetail.getId()); |
|||
taskVersion.setTaskVersionInfo(version); |
|||
taskVersion.setAddress(address); |
|||
taskVersionMapper.insertSelective(taskVersion); |
|||
//查找项目标签
|
|||
Long labelId = labelDao.getLabelByTypeAndLevel(1, 0); |
|||
//添加任务标签关联信息
|
|||
saveLabelTask(taskDetail.getId(), labelId); |
|||
|
|||
return project; |
|||
} |
|||
|
|||
/** |
|||
* 添加任务标签关联 |
|||
*/ |
|||
private void saveLabelTask(Long taskDetailId,Long labelId) { |
|||
//添加标签
|
|||
LabelBusiness labelBusiness = new LabelBusiness(); |
|||
labelBusiness.setId(snowflake.nextId()); |
|||
labelBusiness.setBusinessType((byte) 0); |
|||
labelBusiness.setBusinessId(taskDetailId); |
|||
labelBusiness.setLabelId(labelId); |
|||
labelBusinessDao.insertSelective(labelBusiness); |
|||
} |
|||
|
|||
/** |
|||
* 读取项目成员表 |
|||
*/ |
|||
private void readMemberSheet(XSSFSheet memberSheet,ProjectVo.SysProject project, Map<String, Long> roleMap, Map<String, RoleDto.WbsMember> memberMap) { |
|||
//系统角色id
|
|||
Long sysRoleId = null; |
|||
//项目角色id
|
|||
Long roleId = null; |
|||
//如果是修改WBS,先进行删除
|
|||
if (1 == project.getImportType()){ |
|||
//删除角色和成员
|
|||
List<Long> roleIdList = roleDao.queryRoleListOfProject(project.getId()); |
|||
ProRole role = new ProRole(); |
|||
role.setRecStatus((byte)2); |
|||
ProRoleExample roleExample = new ProRoleExample(); |
|||
roleExample.createCriteria().andIdIn(roleIdList); |
|||
roleDao.updateByExampleSelective(role,roleExample); |
|||
List<Long> memberIdList = memberDao.queryMembersOfProject(project.getId()); |
|||
ProMember member = new ProMember(); |
|||
member.setRecStatus((byte)2); |
|||
ProMemberExample memberExample = new ProMemberExample(); |
|||
memberExample.createCriteria().andIdIn(memberIdList); |
|||
memberDao.updateByExampleSelective(member,memberExample); |
|||
//删除奖惩干系人
|
|||
ProMemberStakeholder memberStakeholder = new ProMemberStakeholder(); |
|||
memberStakeholder.setRecStatus((byte)2); |
|||
ProMemberStakeholderExample memberStakeholderExample = new ProMemberStakeholderExample(); |
|||
memberStakeholderExample.createCriteria().andMemeberIdIn(memberIdList); |
|||
memberStakeholderMapper.updateByExampleSelective(memberStakeholder,memberStakeholderExample); |
|||
//删除对谁不可见
|
|||
ProRoleRepulsion roleRepulsion = new ProRoleRepulsion(); |
|||
roleRepulsion.setRecStatus((byte)2); |
|||
ProRoleRepulsionExample roleRepulsionExample = new ProRoleRepulsionExample(); |
|||
roleRepulsionExample.createCriteria().andRoleIdIn(roleIdList); |
|||
repulsionDao.updateByExampleSelective(roleRepulsion,roleRepulsionExample); |
|||
//删除角色成员关联
|
|||
ProRoleMember roleMember = new ProRoleMember(); |
|||
roleMember.setRecStatus((byte)2); |
|||
ProRoleMemberExample roleMemberExample = new ProRoleMemberExample(); |
|||
roleMemberExample.createCriteria().andRoleIdIn(roleIdList); |
|||
roleMemberDao.updateByExampleSelective(roleMember,roleMemberExample); |
|||
} |
|||
|
|||
for (int i = 2; i <= memberSheet.getLastRowNum(); i++) { |
|||
//获取当前行
|
|||
XSSFRow row = memberSheet.getRow(i); |
|||
if(ObjectUtil.isNull(row)){ continue; } |
|||
//系统角色名
|
|||
String sysRole = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1))); |
|||
if(StrUtil.isEmpty(sysRole) && ObjectUtil.isNull(sysRoleId)){ |
|||
continue; |
|||
} |
|||
//验证系统角色(查询标签)
|
|||
if(StrUtil.isNotEmpty(sysRole) && !"/".equalsIgnoreCase(sysRole)){ |
|||
Long labelId = subLabelDao.getLabelByName(5,sysRole); |
|||
if(ObjectUtil.isNull(labelId)){ |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_FIRST_ROLE.addMsg(memberSheet.getSheetName(),i+1,sysRole)); |
|||
} |
|||
sysRoleId = labelId; |
|||
} |
|||
//项目角色
|
|||
String roleName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2))); |
|||
if((StrUtil.isEmpty(roleName) || "/".equalsIgnoreCase(roleName)) && ObjectUtil.isNull(roleId)){ continue; } |
|||
//成员
|
|||
String memberName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3))); |
|||
|
|||
//角色手机号
|
|||
String memberPhone = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4))); |
|||
if((StrUtil.isNotEmpty(memberName) && !"/".equalsIgnoreCase(memberName)) && (StrUtil.isEmpty(memberPhone) || !memberPhone.matches(BasicsConstant.PHONE_REGEX))){ |
|||
throw new BaseException(BasicsCodeError.WBS_PHONE_ERROR.addMsg(memberSheet.getSheetName(),i+1,memberPhone)); |
|||
} |
|||
//奖惩干系人
|
|||
String stakeholderName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(5))); |
|||
//干系人电话
|
|||
String stakeholderPhone = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(6))); |
|||
if((StrUtil.isNotEmpty(stakeholderName) && !"/".equalsIgnoreCase(stakeholderName)) && (StrUtil.isEmpty(stakeholderPhone) || !stakeholderPhone.matches(BasicsConstant.PHONE_REGEX))){ |
|||
throw new BaseException(BasicsCodeError.WBS_PHONE_ERROR.addMsg(memberSheet.getSheetName(),i+1,stakeholderName)); |
|||
} |
|||
//添加角色
|
|||
if(StrUtil.isNotEmpty(roleName) && !"/".equalsIgnoreCase(roleName)){ |
|||
ProRole role = new ProRole(); |
|||
role.setId(snowflake.nextId()); |
|||
role.setName(roleName); |
|||
role.setProjectId(project.getId()); |
|||
role.setLabelId(sysRoleId); |
|||
roleDao.insertSelective(role); |
|||
roleId = role.getId(); |
|||
roleMap.put(roleName,role.getId()); |
|||
} |
|||
//添加成员
|
|||
if(StrUtil.isNotEmpty(memberName) && !"/".equalsIgnoreCase(roleName)){ |
|||
//如果成员名和手机号重复当做一个人来处理
|
|||
RoleDto.WbsMember wbsMembers = memberMap.get(memberName + "_" + memberPhone); |
|||
Long memberId = null; |
|||
if(ObjectUtil.isNotNull(wbsMembers)){ |
|||
memberId = wbsMembers.getId(); |
|||
} |
|||
if(ObjectUtil.isNull(memberId)){ |
|||
//根据成员手机号查找userId 成员关联userId
|
|||
Long userId = userDao.getUserIdByPhone(memberPhone); |
|||
//添加成员至数据库
|
|||
ProMember proMember = new ProMember(); |
|||
proMember.setId(snowflake.nextId()); |
|||
proMember.setName(memberName); |
|||
proMember.setPhone(memberPhone); |
|||
proMember.setProjectId(project.getId()); |
|||
proMember.setUserId(userId); |
|||
memberDao.insertSelective(proMember); |
|||
RoleDto.WbsMember member = new RoleDto.WbsMember(proMember.getId(),userId); |
|||
memberMap.put(memberName+"_"+memberPhone,member); |
|||
memberId = proMember.getId(); |
|||
} |
|||
//添加角色成员关联信息
|
|||
ProRoleMember roleMember = new ProRoleMember(); |
|||
roleMember.setId(snowflake.nextId()); |
|||
roleMember.setRoleId(roleId); |
|||
roleMember.setMemberId(memberId); |
|||
roleMemberDao.insertSelective(roleMember); |
|||
//添加奖惩干系人
|
|||
if(StrUtil.isNotEmpty(stakeholderName) && !"/".equalsIgnoreCase(roleName)){ |
|||
//根据干系人手机号查找userId 奖惩干系人关联userId
|
|||
Long userId = userDao.getUserIdByPhone(memberPhone); |
|||
ProMemberStakeholder memberStakeholder = new ProMemberStakeholder(); |
|||
memberStakeholder.setId(snowflake.nextId()); |
|||
memberStakeholder.setMemeberId(memberId); |
|||
memberStakeholder.setStakeholderName(stakeholderName); |
|||
memberStakeholder.setStakeholderPhone(stakeholderPhone); |
|||
memberStakeholder.setUserId(userId); |
|||
memberStakeholderMapper.insertSelective(memberStakeholder); |
|||
} |
|||
} |
|||
} |
|||
//添加对谁不可见
|
|||
roleRepulsion(memberSheet, roleMap); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 处理对谁不可见 |
|||
*/ |
|||
private void roleRepulsion(XSSFSheet memberSheet, Map<String, Long> roleMap) { |
|||
//角色排斥表需要的角色id
|
|||
Long roleIdRepulsion = null; |
|||
for (int i = 2; i <= memberSheet.getLastRowNum(); i++) { |
|||
//获取当前行
|
|||
XSSFRow row = memberSheet.getRow(i); |
|||
if(ObjectUtil.isNull(row)){ continue; } |
|||
//项目角色
|
|||
String roleName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2))); |
|||
if(StrUtil.isNotEmpty(roleName)){ |
|||
roleIdRepulsion = roleMap.get(roleName); |
|||
} |
|||
if(ObjectUtil.isNull(roleIdRepulsion)){ |
|||
continue; |
|||
} |
|||
//对谁不可见
|
|||
String repulsion = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(7))); |
|||
if(StrUtil.isEmpty(repulsion)){ |
|||
continue; |
|||
} |
|||
//分解对谁不可见
|
|||
String[] split = repulsion.split(BasicsConstant.STRING_REGEX); |
|||
for (String repulsionName : split) { |
|||
Long repulsionId = roleMap.get(repulsionName); |
|||
if (ObjectUtil.isNull(repulsionId)) { |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_FIND_ROLE.addMsg(memberSheet.getSheetName(),i+1,repulsionName)); |
|||
} |
|||
//添加数据
|
|||
ProRoleRepulsion roleRepulsion = new ProRoleRepulsion(); |
|||
roleRepulsion.setId(snowflake.nextId()); |
|||
roleRepulsion.setRoleId(roleIdRepulsion); |
|||
roleRepulsion.setRepulsionRoleId(repulsionId); |
|||
repulsionDao.insertSelective(roleRepulsion); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 读取任务信息 |
|||
*/ |
|||
private void readTask(XSSFSheet wbsSheet, int taskStart, ProjectVo.SysProject project, Map<String, Long> roleMap, Map<String, Object> taskMap) { |
|||
|
|||
//一级任务id
|
|||
Long firstTaskId = null; |
|||
Long taskStartTime = project.getBeginTime(); |
|||
|
|||
//如果是修改WBS需要先删除
|
|||
if (1 == project.getImportType()) { |
|||
List<Long> allTaskId = parentTaskMapper.queryAllTaskIdByProjectId(project.getId()); |
|||
//删除所有的任务详情
|
|||
ProTaskDetail taskDetail = new ProTaskDetail(); |
|||
taskDetail.setRecStatus((byte)2); |
|||
ProTaskDetailExample taskDetailExample = new ProTaskDetailExample(); |
|||
taskDetailExample.createCriteria().andIdIn(allTaskId); |
|||
taskDetailDao.updateByExampleSelective(taskDetail,taskDetailExample); |
|||
//删除所有的分解任务
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setRecStatus((byte)2); |
|||
ProTaskSubExample taskSubExample = new ProTaskSubExample(); |
|||
taskSubExample.createCriteria().andTaskDetailIdIn(allTaskId); |
|||
taskSubDao.updateByExampleSelective(taskSub,taskSubExample); |
|||
//删除所有的任务标签
|
|||
LabelBusiness labelBusiness = new LabelBusiness(); |
|||
labelBusiness.setRecStatus((byte)2); |
|||
LabelBusinessExample labelBusinessExample = new LabelBusinessExample(); |
|||
labelBusinessExample.createCriteria().andBusinessIdIn(allTaskId); |
|||
labelBusinessDao.updateByExampleSelective(labelBusiness,labelBusinessExample); |
|||
//删除任务角色关联表
|
|||
ProRoleTask roleTask = new ProRoleTask(); |
|||
roleTask.setRecStatus((byte)2); |
|||
ProRoleTaskExample roleTaskExample = new ProRoleTaskExample(); |
|||
roleTaskExample.createCriteria().andTaskIdIn(allTaskId); |
|||
roleTaskMapper.updateByExampleSelective(roleTask,roleTaskExample); |
|||
//删除任务插件关联信息
|
|||
ProTaskPlugin taskPlugin = new ProTaskPlugin(); |
|||
taskPlugin.setRecStatus((byte)2); |
|||
ProTaskPluginExample taskPluginExample = new ProTaskPluginExample(); |
|||
taskPluginExample.createCriteria().andTaskDetailIdIn(allTaskId); |
|||
proTaskPluginDao.updateByExampleSelective(taskPlugin,taskPluginExample); |
|||
//删除任务关系表
|
|||
allTaskId.add(project.getId()); |
|||
ProParentTask parentTask = new ProParentTask(); |
|||
parentTask.setRecStatus((byte)2); |
|||
ProParentTaskExample parentTaskExample = new ProParentTaskExample(); |
|||
parentTaskExample.createCriteria().andTaskDetailIdIn(allTaskId); |
|||
parentTaskMapper.updateByExampleSelective(parentTask,parentTaskExample); |
|||
} |
|||
|
|||
for (int i = taskStart + 1; i <= wbsSheet.getLastRowNum(); i++) { |
|||
//获取当前行
|
|||
XSSFRow row = wbsSheet.getRow(i); |
|||
if(ObjectUtil.isNull(row)){ continue; } |
|||
//序号
|
|||
String sequence = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(0))); |
|||
//一级任务名
|
|||
String firstTaskName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1))); |
|||
if(StrUtil.isEmpty(firstTaskName) && ObjectUtil.isNull(firstTaskId)){ |
|||
continue; |
|||
} |
|||
if(StrUtil.isNotEmpty(firstTaskName)){ |
|||
//添加一级任务
|
|||
firstTaskId = saveFirstTask(project, firstTaskName); |
|||
} |
|||
//二级任务名
|
|||
String taskName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2))); |
|||
if(StrUtil.isEmpty(taskName)){ |
|||
continue; |
|||
} |
|||
//任务描述
|
|||
String description = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3))); |
|||
//重要性标签
|
|||
String vitalLabel = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(7))); |
|||
//负责人
|
|||
String executorRole = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(8))); |
|||
//开始时间
|
|||
String beginTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4))); |
|||
//结束时间
|
|||
String endTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(5))); |
|||
//时长
|
|||
String duration = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(6))); |
|||
//插件
|
|||
String plugin1 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(12))); |
|||
String plugin2 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(13))); |
|||
String plugin3 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(14))); |
|||
if(StrUtil.isNotEmpty(taskName)){ |
|||
//添加二级任务信息(任务详情)
|
|||
ProTaskDetail taskDetail = new ProTaskDetail(); |
|||
taskDetail.setId(snowflake.nextId()); |
|||
taskDetail.setName(taskName); |
|||
taskDetail.setDescription(description); |
|||
taskDetailDao.insertSelective(taskDetail); |
|||
//任务关联信息(关联一级任务)
|
|||
ProParentTask parentTask = new ProParentTask(); |
|||
parentTask.setId(snowflake.nextId()); |
|||
parentTask.setTaskDetailId(taskDetail.getId()); |
|||
parentTask.setParentTaskDetailId(firstTaskId); |
|||
parentTaskMapper.insertSelective(parentTask); |
|||
//查找重要性标签
|
|||
Long labelId = subLabelDao.getLabelByName(2,vitalLabel); |
|||
if(ObjectUtil.isNull(labelId)){ |
|||
throw new BaseException(BasicsCodeError.TASK_VITAL_LABEL_ERROR.addMsg(wbsSheet.getSheetName(),i+1,vitalLabel)); |
|||
} |
|||
LabelBusiness labelBusiness = new LabelBusiness(); |
|||
labelBusiness.setId(snowflake.nextId()); |
|||
labelBusiness.setBusinessType((byte) 0); |
|||
labelBusiness.setBusinessId(taskDetail.getId()); |
|||
labelBusiness.setLabelId(labelId); |
|||
labelBusinessDao.insertSelective(labelBusiness); |
|||
//任务和角色关联
|
|||
if(StrUtil.isEmpty(executorRole)){ |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_FIND_ROLE.addMsg(wbsSheet.getSheetName(),i+1,executorRole)); |
|||
} |
|||
String[] split = executorRole.split(BasicsConstant.STRING_REGEX); |
|||
for (String repulsionName : split) { |
|||
Long executorRoleId = roleMap.get(repulsionName); |
|||
if(ObjectUtil.isNull(executorRoleId)){ |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_FIND_ROLE.addMsg(wbsSheet.getSheetName(),i+1,repulsionName)); |
|||
} |
|||
ProRoleTask roleTask = new ProRoleTask(); |
|||
roleTask.setId(snowflake.nextId()); |
|||
roleTask.setRoleId(executorRoleId); |
|||
roleTask.setTaskId(taskDetail.getId()); |
|||
roleTaskMapper.insertSelective(roleTask); |
|||
} |
|||
|
|||
//处理时间、添加任务分解、添加任务标签
|
|||
taskStartTime = taskSaveTime(taskStartTime, project, beginTime, endTime, duration, taskDetail.getId(),wbsSheet,i+1); |
|||
//添加时间颗粒度标签并关联
|
|||
Long timeLabel = labelDao.getLabelByTypeAndLevel(0, 4); |
|||
saveLabelTask(taskDetail.getId(),timeLabel); |
|||
//插件
|
|||
Long taskPlugin1 = plugin(plugin1,taskDetail.getId(),1,wbsSheet,i+1); |
|||
Long taskPlugin2 = plugin(plugin2,taskDetail.getId(),2,wbsSheet,i+1); |
|||
Long taskPlugin3 = plugin(plugin3,taskDetail.getId(),3,wbsSheet,i+1); |
|||
TaskDto.TaskPluginId taskPlugin = new TaskDto.TaskPluginId(taskPlugin1,taskPlugin2,taskPlugin3); |
|||
taskMap.put(sequence + "_" + taskName, taskPlugin); |
|||
} |
|||
//TODO 检查人
|
|||
//TODO 及时奖惩
|
|||
//TODO 交付物
|
|||
//TODO 添加默认插件
|
|||
} |
|||
} |
|||
private Long plugin(String plugin,Long taskId,int row,XSSFSheet wbsSheet,int errorRow) { |
|||
Long taskPlugin = null; |
|||
if(StrUtil.isNotEmpty(plugin)){ |
|||
//根据插件名称查找插件id
|
|||
Long pluginId = sTaskPluginDao.getPluginIdByName(plugin); |
|||
if(ObjectUtil.isNull(pluginId)){ |
|||
throw new BaseException(BasicsCodeError.PLUGIN_NAME_ERROR.addMsg(wbsSheet.getSheetName(),errorRow,plugin)); |
|||
} |
|||
//添加插件
|
|||
ProTaskPlugin proTaskPlugin = new ProTaskPlugin(); |
|||
proTaskPlugin.setId(snowflake.nextId()); |
|||
proTaskPlugin.setTaskDetailId(taskId); |
|||
proTaskPlugin.setPluginId(pluginId); |
|||
proTaskPlugin.setPlginRow(row); |
|||
proTaskPlugin.setPlginCol(1); |
|||
proTaskPlugin.setRowspan(1); |
|||
proTaskPlugin.setColspan(1); |
|||
proTaskPluginDao.insertSelective(proTaskPlugin); |
|||
taskPlugin = proTaskPlugin.getId(); |
|||
} |
|||
return taskPlugin; |
|||
} |
|||
|
|||
private Long taskSaveTime(Long taskStartTime,ProjectVo.SysProject project, String beginTime, String endTime, String duration, Long taskDetailId,XSSFSheet wbsSheet,int row) { |
|||
|
|||
if(StrUtil.isEmpty(beginTime) || "日常".equalsIgnoreCase(beginTime)){ |
|||
if(StrUtil.isEmpty(beginTime) && StrUtil.isNotEmpty(duration)){ |
|||
//获取时长内的字符串
|
|||
String str = "[0-9]"; |
|||
Pattern pStr = Pattern.compile(str); |
|||
Matcher mStr = pStr.matcher(duration); |
|||
String trimStr = mStr.replaceAll("").trim(); |
|||
Long aLong = BasicsConstant.WBS_DURATION.get(trimStr); |
|||
if(ObjectUtil.isNull(aLong)){ |
|||
throw new BaseException(BasicsCodeError.WBS_PROJECT_TIME_ERROR.addMsg(wbsSheet.getSheetName(),row)); |
|||
} |
|||
//获取字符串内的数字
|
|||
String num = "[^0-9]"; |
|||
Pattern pNum = Pattern.compile(num); |
|||
Matcher mNum = pNum.matcher(duration); |
|||
String trimNum = mNum.replaceAll("").trim(); |
|||
//计算时长
|
|||
Long durationTime = Long.parseLong(trimNum) * aLong; |
|||
//添加任务分解
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setId(snowflake.nextId()); |
|||
taskSub.setTaskDetailId(taskDetailId); |
|||
taskSub.setPlanDuration(durationTime); |
|||
taskSub.setPlanStartTime(taskStartTime); |
|||
taskStartTime += durationTime; |
|||
taskSub.setPlanEndTime(taskStartTime); |
|||
taskSubDao.insertSelective(taskSub); |
|||
//查找定期任务标签并关联任务
|
|||
Long taskLabel = labelDao.getLabelByTypeAndLevel(1, 3); |
|||
saveLabelTask(taskDetailId,taskLabel); |
|||
|
|||
}else { |
|||
//添加任务分解
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setId(snowflake.nextId()); |
|||
taskSub.setTaskDetailId(taskDetailId); |
|||
taskSubDao.insertSelective(taskSub); |
|||
//查找日常任务标签并关联信息
|
|||
Long label = labelDao.getLabelByTypeAndLevel(1, 2); |
|||
saveLabelTask(taskDetailId,label); |
|||
} |
|||
}else { |
|||
Long bTime; |
|||
Long eTime; |
|||
try { |
|||
bTime = Long.parseLong(beginTime); |
|||
eTime = StrUtil.isEmpty(endTime) ? project.getEndTime() : Long.parseLong(endTime); |
|||
//添加任务分解
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setId(snowflake.nextId()); |
|||
taskSub.setTaskDetailId(taskDetailId); |
|||
taskSub.setPlanEndTime(eTime); |
|||
taskSub.setPlanStartTime(bTime); |
|||
taskSub.setPlanDuration(eTime - bTime); |
|||
taskSubDao.insertSelective(taskSub); |
|||
//查找定期任务标签并关联任务
|
|||
Long taskLabel = labelDao.getLabelByTypeAndLevel(1, 3); |
|||
saveLabelTask(taskDetailId,taskLabel); |
|||
// //添加时间颗粒度标签并关联
|
|||
// Long timeLabel = subLabelDao.getLabelByTypeAndLevel(0, 4);
|
|||
// saveLabelTask(taskDetailId,timeLabel);
|
|||
}catch (Exception e){ |
|||
Date startDate = new Date(project.getBeginTime()); |
|||
Date endDate = new Date(project.getEndTime()); |
|||
try { |
|||
List<CronConstant.TaskDate> taskDateList = |
|||
NatureToDate.generateDates(beginTime, startDate, endDate); |
|||
if (CollectionUtil.isEmpty(taskDateList)) { |
|||
return taskStartTime; |
|||
} |
|||
List<ProTaskSub> proTaskSubList = new ArrayList<>(); |
|||
for (CronConstant.TaskDate taskDate : taskDateList) { |
|||
|
|||
ProTaskSub proTaskSub = new ProTaskSub(); |
|||
proTaskSub.setId(snowflake.nextId()); |
|||
proTaskSub.setTaskDetailId(taskDetailId); |
|||
proTaskSub.setPlanStartTime(taskDate.getStartDate().getTime()); |
|||
proTaskSub.setPlanEndTime(taskDate.getEndDate().getTime()); |
|||
proTaskSub.setPlanDuration(proTaskSub.getPlanEndTime() - proTaskSub.getPlanStartTime()); |
|||
proTaskSubList.add(proTaskSub); |
|||
} |
|||
if(CollectionUtil.isNotEmpty(proTaskSubList)){ |
|||
sTaskDao.insertSelectiveList(proTaskSubList); |
|||
} |
|||
//查找定期任务标签并关联任务
|
|||
Long taskLabel = labelDao.getLabelByTypeAndLevel(1, 3); |
|||
saveLabelTask(taskDetailId,taskLabel); |
|||
}catch (Exception e1){ |
|||
throw new BaseException(String.valueOf(e1)); |
|||
// throw new BaseException(SportsCodeError.WBS_PROJECT_TIME_ERROR);
|
|||
} |
|||
} |
|||
} |
|||
return taskStartTime; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 添加一级任务 |
|||
*/ |
|||
private Long saveFirstTask(ProjectVo.SysProject project, String firstTaskName) { |
|||
//TODO 一级任务负责人是项目经理
|
|||
Long firstTaskId; |
|||
ProTaskDetail taskDetail = new ProTaskDetail(); |
|||
taskDetail.setId(snowflake.nextId()); |
|||
taskDetail.setName(firstTaskName); |
|||
taskDetailDao.insertSelective(taskDetail); |
|||
firstTaskId = taskDetail.getId(); |
|||
//添加任务分解
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setId(snowflake.nextId()); |
|||
taskSub.setTaskDetailId(taskDetail.getId()); |
|||
taskSub.setPlanStartTime(project.getBeginTime()); |
|||
taskSub.setPlanEndTime(project.getEndTime()); |
|||
taskSub.setPlanDuration(project.getEndTime() - project.getBeginTime()); |
|||
taskSubDao.insertSelective(taskSub); |
|||
//任务关联信息(关联项目)
|
|||
ProParentTask parentTask = new ProParentTask(); |
|||
parentTask.setId(snowflake.nextId()); |
|||
parentTask.setTaskDetailId(taskDetail.getId()); |
|||
parentTask.setParentTaskDetailId(project.getId()); |
|||
parentTaskMapper.insertSelective(parentTask); |
|||
//查找一级任务标签
|
|||
Long labelId = labelDao.getLabelByTypeAndLevel(1, 1); |
|||
//添加任务标签关联信息
|
|||
saveLabelTask(taskDetail.getId(), labelId); |
|||
return firstTaskId; |
|||
} |
|||
} |
|||
|
|||
|
@ -0,0 +1,33 @@ |
|||
package com.ccsens.ptccsens.service; |
|||
|
|||
import com.ccsens.common.bean.dto.CMemberDto; |
|||
import com.ccsens.common.service.IMemberService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|||
public class UserService implements IUserService{ |
|||
|
|||
@Resource |
|||
private IMemberService memberService; |
|||
|
|||
@Override |
|||
public void memberWithPhone(CMemberDto.PhoneAndUserId params) { |
|||
memberService.relevancePhone(params); |
|||
} |
|||
|
|||
@Override |
|||
public void mergeUser(CMemberDto.MergeUser params) { |
|||
//最小项目关联的userId
|
|||
memberService.mergeUser(params); |
|||
//TODO 其他业务
|
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.ccsens.ptccsens.util; |
|||
|
|||
import com.ccsens.util.CodeError; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public class BasicsCodeError extends CodeError { |
|||
|
|||
public static final Code NOT_WBS_SHEET = new Code(501,"找不到wbs表",true); |
|||
public static final Code NOT_MEMBER_SHEET = new Code(502,"找不到项目成员表",true); |
|||
public static final Code WSB_NOT_PROJECT_HEADER = new Code(503,"读取项目信息异常",true); |
|||
public static final Code WSB_NOT_TASK_HEADER = new Code(504,"读取任务分解异常",true); |
|||
public static final Code WBS_PROJECT_TIME_ERROR = new Code(505,"时间格式异常", true); |
|||
public static final Code WBS_PHONE_ERROR = new Code(506,"手机号格式错误", true); |
|||
public static final Code WBS_NOT_FIRST_ROLE = new Code(507,"系统角色名称错误", true); |
|||
public static final Code WBS_NOT_FIND_ROLE = new Code(508,"未找到对应的角色", true); |
|||
public static final Code FILE_FORMAT_ERROR = new Code(509,"不支持的格式类型", true); |
|||
public static final Code WBS_NOT_PROJECT_TIME = new Code(510,"项目时间不能为空", true); |
|||
public static final Code TASK_VITAL_LABEL_ERROR = new Code(511,"任务标签异常", true); |
|||
public static final Code WBS_NOT_PROJECT_NAME = new Code(512,"项目名称不能为空", true); |
|||
public static final Code PROJECT_NAME_REPEAT = new Code(513,"项目名称重复", true); |
|||
public static final Code PLUGIN_NAME_ERROR = new Code(514,"请填写正确的插件名称", true); |
|||
public static final Code FEIGN_ERROR = new Code(515,"导入项目失败", true); |
|||
|
|||
public static final Code NOT_ORGANIZATION = new Code(516,"您不属于任何体育机构,请联系运维人员", true); |
|||
public static final Code NO_POWER = new Code(517,"权限不足", true); |
|||
public static final Code NOT_TRAINING_PLAN = new Code(518,"未找到培训计划", true); |
|||
public static final Code TRAINING_NOT_CHECK = new Code(519,"培训计划未审核通过", true); |
|||
public static final Code NOT_TRAINING_TEACHER = new Code(520,"未找到对应的委派通知", true); |
|||
public static final Code TRAINING_TEACHER_NOT_MINE = new Code(521,"您不是被委托人,无法接受", true); |
|||
public static final Code NOT_PLAYER = new Code(522,"未找到对应的运动员信息", true); |
|||
public static final Code NOT_PLAYER_APPLY = new Code(523,"未找到报名信息信息", true); |
|||
public static final Code ID_CODE_ERROR = new Code(524,"请输入正确的身份证", true); |
|||
public static final Code NOT_FILE = new Code(525,"找不到文件", true); |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.ccsens.ptccsens.util; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public class BasicsConstant { |
|||
|
|||
/**图片类型*/ |
|||
public static final String FILE_TYPE_IMG = "bmp,jpg,jpeg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,WMF,webp"; |
|||
/**文档类型*/ |
|||
public static final String FILE_TYPE_DOCUMENT = "doc, dot, wps, wpt, docx, dotx, docm, dotm, xls, xlt, et, xlsx, xltx, csv, xlsm, xltm, ppt,pptx,pptm,ppsx,ppsm,pps,potx,potm,dpt,dps, pdf"; |
|||
|
|||
|
|||
/**验证手机正则*/ |
|||
public static final String PHONE_REGEX = "^[1]([3-9])[0-9]{9}$"; |
|||
/**字符串分隔符*/ |
|||
public static final String STRING_REGEX = ",|,|;|;|、|/"; |
|||
/**wbs相关*/ |
|||
public static final class WbsExcel { |
|||
/**wbsSheet*/ |
|||
public static final String WBS_SHEET = "WBS"; |
|||
/**项目成员Sheet*/ |
|||
public static final String MEMBER_SHEET = "项目成员表"; |
|||
/**项目信息头*/ |
|||
public static final String PROJECT_INFO_TITLE = "项目信息"; |
|||
/**任务信息头*/ |
|||
public static final String TASK_INFO_TITLE = "项目任务分解"; |
|||
/**excel文件格式验证*/ |
|||
public static final String WBS_FILE_FORMAT = "xls,xlsx"; |
|||
/**插件配置表*/ |
|||
public static final String WBS_PLUGIN_CONFIG = "插件配置表"; |
|||
} |
|||
|
|||
/**wbs表时长对应关系表*/ |
|||
public static final Map<String,Long> WBS_DURATION = new HashMap<>(); |
|||
static { |
|||
WBS_DURATION.put("s",1000L); |
|||
WBS_DURATION.put("min",60 * 1000L); |
|||
WBS_DURATION.put("h",60 * 60 * 1000L); |
|||
WBS_DURATION.put("d",24 * 60 * 60 * 1000L); |
|||
WBS_DURATION.put("w",7 * 24 * 60 * 60 * 1000L); |
|||
WBS_DURATION.put("m",30 * 24 * 60 * 60 * 1000L); |
|||
WBS_DURATION.put("y",365 * 24 * 60 * 60 * 1000L); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
logging: |
|||
level: |
|||
com: |
|||
favorites: DEBUG |
|||
org: |
|||
hibernate: ERROR |
|||
springframework: |
|||
web: DEBUG |
|||
mybatis: |
|||
config-location: classpath:mybatis/mybatis-config.xml |
|||
mapper-locations: classpath*:mapper_*/*.xml |
|||
# type-aliases-package: com.ccsens.mtpro.bean |
|||
#server: |
|||
# tomcat: |
|||
# uri-encoding: UTF-8 |
|||
spring: |
|||
http: |
|||
encoding: |
|||
charset: UTF-8 |
|||
enabled: true |
|||
force: true |
|||
log-request-details: true |
|||
servlet: |
|||
multipart: |
|||
max-file-size: 10MB |
|||
max-request-size: 100MB |
|||
snowflake: |
|||
datacenterId: 2 |
|||
workerId: 2 |
|||
|
@ -0,0 +1,50 @@ |
|||
server: |
|||
port: 7210 |
|||
servlet: |
|||
context-path: |
|||
spring: |
|||
application: |
|||
name: ccbasics |
|||
datasource: |
|||
type: com.alibaba.druid.pool.DruidDataSource |
|||
# rabbitmq: |
|||
# host: 192.168.0.99 |
|||
# password: 111111 |
|||
# port: 5672 |
|||
# username: admin |
|||
rabbitmq: |
|||
host: dd.tall.wiki |
|||
password: 111111 |
|||
port: 5672 |
|||
username: admin |
|||
redis: |
|||
database: 0 |
|||
host: 127.0.0.1 |
|||
jedis: |
|||
pool: |
|||
max-active: 200 |
|||
max-idle: 10 |
|||
max-wait: -1ms |
|||
min-idle: 0 |
|||
password: '' |
|||
port: 6379 |
|||
timeout: 1000ms |
|||
swagger: |
|||
enable: true |
|||
mybatisCache: |
|||
database: 1 |
|||
host: 127.0.0.1 |
|||
jedis: |
|||
pool: |
|||
max-active: 200 |
|||
max-idle: 10 |
|||
max-wait: -1 |
|||
min-idle: 0 |
|||
password: '' |
|||
port: 6379 |
|||
timeout: 1000 |
|||
|
|||
file: |
|||
path: /home/cloud/ccbasics/uploads/ |
|||
domain: https://test.tall.wiki/gateway/ccbasics |
|||
imgDomain: https://test.tall.wiki/gateway/ccbasics/uploads/ |
@ -0,0 +1,40 @@ |
|||
server: |
|||
port: 7210 |
|||
servlet: |
|||
context-path: |
|||
spring: |
|||
application: |
|||
name: ccbasics |
|||
datasource: |
|||
type: com.alibaba.druid.pool.DruidDataSource |
|||
rabbitmq: |
|||
host: 121.36.3.207 |
|||
password: 111111 |
|||
port: 5672 |
|||
username: admin |
|||
redis: |
|||
database: 0 |
|||
host: 127.0.0.1 |
|||
jedis: |
|||
pool: |
|||
max-active: 200 |
|||
max-idle: 10 |
|||
max-wait: -1ms |
|||
min-idle: 0 |
|||
password: '' |
|||
# password: 'areowqr!@43ef' |
|||
port: 6379 |
|||
timeout: 1000ms |
|||
swagger: |
|||
enable: true |
|||
eureka: |
|||
instance: |
|||
ip-address: 121.36.106.168 |
|||
|
|||
gatewayUrl: https://www.tall.wiki/gateway/ |
|||
notGatewayUrl: https://www.tall.wiki/ |
|||
apiUrl: https://www.tall.wiki/ |
|||
file: |
|||
path: /home/cloud/ccbasics/uploads/ |
|||
domain: https://www.tall.wiki/gateway/ccbasics |
|||
imgDomain: https://www.tall.wiki/gateway/ccbasics/uploads/ |
@ -0,0 +1,48 @@ |
|||
server: |
|||
port: 7210 |
|||
servlet: |
|||
context-path: |
|||
spring: |
|||
application: |
|||
name: ccbasics |
|||
datasource: |
|||
type: com.alibaba.druid.pool.DruidDataSource |
|||
rabbitmq: |
|||
host: dd.tall.wiki |
|||
password: 111111 |
|||
port: 5672 |
|||
username: admin |
|||
redis: |
|||
database: 0 |
|||
host: 127.0.0.1 |
|||
jedis: |
|||
pool: |
|||
max-active: 200 |
|||
max-idle: 10 |
|||
max-wait: -1ms |
|||
min-idle: 0 |
|||
password: '' |
|||
port: 6379 |
|||
timeout: 1000ms |
|||
swagger: |
|||
enable: true |
|||
mybatisCache: |
|||
database: 1 |
|||
host: 127.0.0.1 |
|||
jedis: |
|||
pool: |
|||
max-active: 200 |
|||
max-idle: 10 |
|||
max-wait: -1 |
|||
min-idle: 0 |
|||
password: '' |
|||
port: 6379 |
|||
timeout: 1000 |
|||
eureka: |
|||
instance: |
|||
ip-address: 127.0.0.1 |
|||
|
|||
file: |
|||
path: /home/cloud/ccbasics/uploads/ |
|||
domain: https://test.tall.wiki/gateway/ccbasics |
|||
imgDomain: https://test.tall.wiki/gateway/ccbasics/uploads/ |
@ -0,0 +1,4 @@ |
|||
spring: |
|||
profiles: |
|||
active: dev |
|||
include: common, util-dev |
@ -0,0 +1,35 @@ |
|||
spring: |
|||
datasource: |
|||
druid: |
|||
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
|||
driverClassName: com.mysql.cj.jdbc.Driver |
|||
dynamicUrl: jdbc:mysql://localhost:3306/${schema} |
|||
filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' |
|||
filterName: druidFilter |
|||
filterProfileEnable: true |
|||
filterUrlPattern: /* |
|||
filters: stat,wall |
|||
initialSize: 5 |
|||
maxActive: 20 |
|||
maxPoolPreparedStatementPerConnectionSize: 20 |
|||
maxWait: 60000 |
|||
minEvictableIdleTimeMillis: 300000 |
|||
minIdle: 5 |
|||
# password: 37080c1f223685592316b02dad8816c019290a476e54ebb638f9aa3ba8b6bdb9 |
|||
password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 |
|||
poolPreparedStatements: true |
|||
servletLogSlowSql: true |
|||
servletLoginPassword: 111111 |
|||
servletLoginUsername: druid |
|||
servletName: druidServlet |
|||
servletResetEnable: true |
|||
servletUrlMapping: /druid/* |
|||
testOnBorrow: false |
|||
testOnReturn: false |
|||
testWhileIdle: true |
|||
timeBetweenEvictionRunsMillis: 60000 |
|||
url: jdbc:mysql://49.233.89.188:3306/pt_ccsens?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true |
|||
username: root |
|||
validationQuery: SELECT 1 FROM DUAL |
|||
# env: CCSENS_GAME |
|||
env: CCSENS_TALL |
@ -0,0 +1,35 @@ |
|||
spring: |
|||
datasource: |
|||
druid: |
|||
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
|||
driverClassName: com.mysql.cj.jdbc.Driver |
|||
dynamicUrl: jdbc:mysql://localhost:3306/${schema} |
|||
filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' |
|||
filterName: druidFilter |
|||
filterProfileEnable: true |
|||
filterUrlPattern: /* |
|||
filters: stat,wall |
|||
initialSize: 5 |
|||
maxActive: 20 |
|||
maxPoolPreparedStatementPerConnectionSize: 20 |
|||
maxWait: 60000 |
|||
minEvictableIdleTimeMillis: 300000 |
|||
minIdle: 5 |
|||
# password: |
|||
password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 |
|||
poolPreparedStatements: true |
|||
servletLogSlowSql: true |
|||
servletLoginPassword: 111111 |
|||
servletLoginUsername: druid |
|||
servletName: druidServlet |
|||
servletResetEnable: true |
|||
servletUrlMapping: /druid/* |
|||
testOnBorrow: false |
|||
testOnReturn: false |
|||
testWhileIdle: true |
|||
timeBetweenEvictionRunsMillis: 60000 |
|||
# url: jdbc:mysql://127.0.0.1/defaultwbs?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true |
|||
url: jdbc:mysql://www.tall.wiki/pt_ccsens?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true |
|||
username: root |
|||
validationQuery: SELECT 1 FROM DUAL |
|||
env: CCSENS_TALL |
@ -0,0 +1,33 @@ |
|||
spring: |
|||
datasource: |
|||
druid: |
|||
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
|||
driverClassName: com.mysql.cj.jdbc.Driver |
|||
dynamicUrl: jdbc:mysql://localhost:3306/${schema} |
|||
filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' |
|||
filterName: druidFilter |
|||
filterProfileEnable: true |
|||
filterUrlPattern: /* |
|||
filters: stat,wall |
|||
initialSize: 5 |
|||
maxActive: 20 |
|||
maxPoolPreparedStatementPerConnectionSize: 20 |
|||
maxWait: 60000 |
|||
minEvictableIdleTimeMillis: 300000 |
|||
minIdle: 5 |
|||
password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 |
|||
poolPreparedStatements: true |
|||
servletLogSlowSql: true |
|||
servletLoginPassword: 111111 |
|||
servletLoginUsername: druid |
|||
servletName: druidServlet |
|||
servletResetEnable: true |
|||
servletUrlMapping: /druid/* |
|||
testOnBorrow: false |
|||
testOnReturn: false |
|||
testWhileIdle: true |
|||
timeBetweenEvictionRunsMillis: 60000 |
|||
url: jdbc:mysql://test.tall.wiki/pt_ccsens?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true |
|||
username: root |
|||
validationQuery: SELECT 1 FROM DUAL |
|||
env: CCSENS_TALL |
@ -0,0 +1,196 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 --> |
|||
<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true --> |
|||
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> |
|||
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> |
|||
<configuration scan="true" scanPeriod="10 seconds"> |
|||
|
|||
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />--> |
|||
|
|||
<contextName>logback</contextName> |
|||
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 --> |
|||
<property name="log.path" value="/home/cloud/ccbasics/log/" /> |
|||
|
|||
<!-- 彩色日志 --> |
|||
<!-- 彩色日志依赖的渲染类 --> |
|||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> |
|||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> |
|||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> |
|||
<!-- 彩色日志格式 --> |
|||
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
|||
|
|||
|
|||
<!--输出到控制台--> |
|||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
|||
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
|||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
|||
<level>info</level> |
|||
</filter> |
|||
<encoder> |
|||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
|||
<!-- 设置字符集 --> |
|||
<charset>UTF-8</charset> |
|||
</encoder> |
|||
</appender> |
|||
|
|||
|
|||
<!--输出到文件--> |
|||
|
|||
<!-- 时间滚动输出 level为 DEBUG 日志 --> |
|||
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文件的路径及文件名 --> |
|||
<file>${log.path}/log_debug.log</file> |
|||
<!--日志文件输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> <!-- 设置字符集 --> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<!-- 日志归档 --> |
|||
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文件保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文件只记录debug级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>debug</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 时间滚动输出 level为 INFO 日志 --> |
|||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文件的路径及文件名 --> |
|||
<file>${log.path}/log_info.log</file> |
|||
<!--日志文件输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<!-- 每天日志归档路径以及格式 --> |
|||
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文件保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文件只记录info级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>info</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 时间滚动输出 level为 WARN 日志 --> |
|||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文件的路径及文件名 --> |
|||
<file>${log.path}/log_warn.log</file> |
|||
<!--日志文件输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文件保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文件只记录warn级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>warn</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
|
|||
<!-- 时间滚动输出 level为 ERROR 日志 --> |
|||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文件的路径及文件名 --> |
|||
<file>${log.path}/log_error.log</file> |
|||
<!--日志文件输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文件保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文件只记录ERROR级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>ERROR</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- |
|||
<logger>用来设置某一个包或者具体的某一个类的日志打印级别、 |
|||
以及指定<appender>。<logger>仅有一个name属性, |
|||
一个可选的level和一个可选的addtivity属性。 |
|||
name:用来指定受此logger约束的某一个包或者具体的某一个类。 |
|||
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
|||
还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。 |
|||
如果未设置此属性,那么当前logger将会继承上级的级别。 |
|||
addtivity:是否向上级logger传递打印信息。默认是true。 |
|||
--> |
|||
<!--<logger name="org.springframework.web" level="info"/>--> |
|||
<!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>--> |
|||
<!-- |
|||
使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作: |
|||
第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息 |
|||
第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别: |
|||
--> |
|||
|
|||
|
|||
<!-- |
|||
root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 |
|||
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
|||
不能设置为INHERITED或者同义词NULL。默认是DEBUG |
|||
可以包含零个或多个元素,标识这个appender将会添加到这个logger。 |
|||
--> |
|||
|
|||
<!--开发环境:打印控制台--> |
|||
<springProfile name="dev"> |
|||
<logger name="com.ccsens.ptpro.persist.*" level="debug"/> |
|||
</springProfile> |
|||
|
|||
<root level="info"> |
|||
<appender-ref ref="CONSOLE" /> |
|||
<appender-ref ref="DEBUG_FILE" /> |
|||
<appender-ref ref="INFO_FILE" /> |
|||
<appender-ref ref="WARN_FILE" /> |
|||
<appender-ref ref="ERROR_FILE" /> |
|||
</root> |
|||
|
|||
<!--生产环境:输出到文件--> |
|||
<!--<springProfile name="pro">--> |
|||
<!--<root level="info">--> |
|||
<!--<appender-ref ref="CONSOLE" />--> |
|||
<!--<appender-ref ref="DEBUG_FILE" />--> |
|||
<!--<appender-ref ref="INFO_FILE" />--> |
|||
<!--<appender-ref ref="ERROR_FILE" />--> |
|||
<!--<appender-ref ref="WARN_FILE" />--> |
|||
<!--</root>--> |
|||
<!--</springProfile>--> |
|||
|
|||
</configuration> |
@ -0,0 +1,25 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.ccsens.ptccsens.persist.dao.SPluginDao"> |
|||
|
|||
<select id="getPluginIdByName" resultType="java.lang.Long"> |
|||
SELECT |
|||
id |
|||
FROM |
|||
`plugin`.t_pro_plugin |
|||
WHERE |
|||
`name` = #{pluginName} |
|||
and rec_status = 0 |
|||
limit 1 |
|||
</select> |
|||
|
|||
<update id="updateParamById"> |
|||
update |
|||
t_pro_task_plugin |
|||
set |
|||
param = #{param} |
|||
where |
|||
id = #{taskPluginId} |
|||
and rec_status = 0 |
|||
</update> |
|||
</mapper> |
@ -0,0 +1,50 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.ccsens.ptccsens.persist.dao.SProjectDao"> |
|||
|
|||
<update id="updateStatusById"> |
|||
UPDATE t_pro_task_detail |
|||
SET rec_status = 2 |
|||
WHERE |
|||
id = #{projectId} |
|||
</update> |
|||
|
|||
<select id="queryByCreator" resultType="com.ccsens.ptccsens.bean.vo.ProjectVo$SysProject"> |
|||
SELECT |
|||
t.id, |
|||
t.`name` |
|||
FROM |
|||
t_pro_member m, |
|||
t_pro_role_member rm, |
|||
t_pro_role r, |
|||
t_label l, |
|||
t_pro_task_detail t |
|||
WHERE |
|||
m.id = rm.member_id |
|||
and r.id = rm.role_id |
|||
and r.label_id = l.id |
|||
and l.`level` = 5 |
|||
and r.project_id = t.id |
|||
and m.user_id = #{userId} |
|||
and m.rec_status = 0 |
|||
and rm.rec_status = 0 |
|||
and r.rec_status = 0 |
|||
and t.rec_status = 0 |
|||
and l.rec_status = 0 |
|||
</select> |
|||
|
|||
<select id="selectById" resultType="com.ccsens.ptccsens.bean.vo.ProjectVo$SysProject"> |
|||
SELECT |
|||
d.id, |
|||
d.`name`, |
|||
s.plan_start_time AS beginTime, |
|||
s.plan_end_time AS endTime |
|||
FROM |
|||
t_pro_task_detail AS d |
|||
LEFT JOIN t_pro_task_sub AS s ON d.id = s.task_detail_id |
|||
WHERE |
|||
d.rec_status = 0 |
|||
AND s.rec_status = 0 |
|||
AND d.id = #{projectId} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,38 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.ccsens.ptccsens.persist.dao.STaskDao"> |
|||
|
|||
<insert id="insertSelectiveList"> |
|||
INSERT INTO t_pro_task_sub |
|||
( |
|||
id, |
|||
task_detail_id, |
|||
plan_start_time, |
|||
plan_end_time, |
|||
plan_duration |
|||
) |
|||
VALUES |
|||
<foreach collection="proTaskSubList" item="item" separator=","> |
|||
(#{item.id},#{item.taskDetailId},#{item.planStartTime},#{item.planEndTime},#{item.planDuration}) |
|||
</foreach> |
|||
</insert> |
|||
<select id="getNowTask" resultType="java.lang.Long"> |
|||
SELECT |
|||
s.id |
|||
FROM |
|||
t_pro_task_detail d |
|||
LEFT JOIN t_pro_parent_task p on d.id = p.task_detail_id |
|||
LEFT JOIN (SELECT * FROM t_pro_parent_task WHERE parent_task_detail_id = #{projectId}) p1 on p.parent_task_detail_id = p1.task_detail_id |
|||
LEFT JOIN |
|||
t_pro_task_sub s on d.id = s.task_detail_id and s.rec_status = 0 |
|||
WHERE |
|||
`name` = #{taskName} |
|||
and s.plan_start_time <= #{now} |
|||
and s.plan_end_time >= #{now} |
|||
and d.rec_status = 0 |
|||
and p.rec_status = 0 |
|||
and p1.rec_status = 0 |
|||
limit 1 |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,29 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.ccsens.ptccsens.persist.dao.SubLabelDao"> |
|||
|
|||
<select id="getLabelByName" resultType="java.lang.Long"> |
|||
SELECT |
|||
l.id |
|||
FROM |
|||
t_label l |
|||
LEFT JOIN t_label_type lt on l.label_type_id = lt.id |
|||
WHERE |
|||
lt.label_type = #{type} |
|||
and |
|||
l.description = #{sysRole} |
|||
limit 1 |
|||
</select> |
|||
<select id="getLabelByTypeAndLevel" resultType="java.lang.Long"> |
|||
SELECT |
|||
l.id |
|||
FROM |
|||
t_label l |
|||
LEFT JOIN t_label_type lt on l.label_type_id = lt.id |
|||
WHERE |
|||
lt.label_type = #{type} |
|||
and |
|||
l.level = #{level} |
|||
limit 1 |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,90 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE generatorConfiguration |
|||
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> |
|||
|
|||
<generatorConfiguration> |
|||
<context id="MySQL" targetRuntime="MyBatis3"> |
|||
<!-- 为生成的Java模型创建一个toString方法 --> |
|||
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"></plugin> |
|||
|
|||
<!-- 自定义的序列化 类文件 插件 --> |
|||
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"></plugin> |
|||
|
|||
<!-- 重新生成xml文件,而不是追加 --> |
|||
<plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin" /> |
|||
|
|||
<commentGenerator> |
|||
<!-- 是否去除自动生成的注释 true:是 : false:否 --> |
|||
<property name="suppressAllComments" value="true" /> |
|||
</commentGenerator> |
|||
|
|||
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 --> |
|||
<jdbcConnection driverClass="com.mysql.jdbc.Driver" |
|||
connectionURL="jdbc:mysql://49.233.89.188:3306/pt_ccsens?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false" |
|||
userId="root" |
|||
password="po3OynBO[M3579p6L7)o"> |
|||
</jdbcConnection> |
|||
|
|||
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和 |
|||
NUMERIC 类型解析为java.math.BigDecimal --> |
|||
<javaTypeResolver> |
|||
<property name="forceBigDecimals" value="true" /> |
|||
</javaTypeResolver> |
|||
|
|||
<!-- targetProject:生成PO类的位置 --> |
|||
<javaModelGenerator targetPackage="com.ccsens.ptccsens.bean.po" |
|||
targetProject=".\src\main\java"> |
|||
<!-- enableSubPackages:是否让schema作为包的后缀 --> |
|||
<property name="enableSubPackages" value="false" /> |
|||
<!-- 从数据库返回的值被清理前后的空格 --> |
|||
<property name="trimStrings" value="true" /> |
|||
</javaModelGenerator> |
|||
|
|||
<!-- targetProject:mapper映射文件生成的位置 --> |
|||
<sqlMapGenerator targetPackage="mapper_raw" |
|||
targetProject=".\src\main\resources"> |
|||
<!-- enableSubPackages:是否让schema作为包的后缀 --> |
|||
<property name="enableSubPackages" value="false" /> |
|||
</sqlMapGenerator> |
|||
|
|||
<!-- targetPackage:mapper接口生成的位置 --> |
|||
<javaClientGenerator type="XMLMAPPER" |
|||
targetPackage="com.ccsens.ptccsens.persist.mapper" |
|||
targetProject=".\src\main\java"> |
|||
<!-- enableSubPackages:是否让schema作为包的后缀 --> |
|||
<property name="enableSubPackages" value="false" /> |
|||
</javaClientGenerator> |
|||
|
|||
<!-- <table tableName="t_constant" domainObjectName="Constant"></table>--> |
|||
<!-- <table tableName="t_label" domainObjectName="Label"></table>--> |
|||
<!-- <table tableName="t_label_business" domainObjectName="LabelBusiness"></table>--> |
|||
<!-- <table tableName="t_label_type" domainObjectName="LabelType"></table>--> |
|||
<!-- <table tableName="t_pro_member" domainObjectName="ProMember"></table>--> |
|||
<!-- <table tableName="t_pro_parent_task" domainObjectName="ProParentTask"></table>--> |
|||
<!-- <table tableName="t_pro_role" domainObjectName="ProRole"></table>--> |
|||
<!-- <table tableName="t_pro_role_member" domainObjectName="ProRoleMember"></table>--> |
|||
<!-- <table tableName="t_pro_role_repulsion" domainObjectName="ProRoleRepulsion"></table>--> |
|||
<!-- <table tableName="t_pro_role_show" domainObjectName="ProRoleShow"></table>--> |
|||
<!-- <table tableName="t_pro_role_task" domainObjectName="ProRoleTask"></table>--> |
|||
<!-- <table tableName="t_pro_task_detail" domainObjectName="ProTaskDetail"></table>--> |
|||
<!-- <table tableName="t_pro_task_flow" domainObjectName="ProTaskFlow"></table>--> |
|||
<!-- <table tableName="t_pro_task_notify" domainObjectName="ProTaskNotify"></table>--> |
|||
<!-- <table tableName="t_pro_task_panel_info" domainObjectName="ProTaskPanelInfo"></table>--> |
|||
<!-- <table tableName="t_pro_task_plugin" domainObjectName="ProTaskPlugin"></table>--> |
|||
<!-- <table tableName="t_pro_task_process" domainObjectName="ProTaskProcess"></table>--> |
|||
<!-- <table tableName="t_pro_task_share" domainObjectName="ProTaskShare"></table>--> |
|||
<!-- <table tableName="t_pro_task_status_record" domainObjectName="ProTaskStatusRecord"></table>--> |
|||
<!-- <table tableName="t_pro_task_sub" domainObjectName="ProTaskSub"></table>--> |
|||
<!-- <table tableName="t_pro_task_version" domainObjectName="ProTaskVersion"></table>--> |
|||
<!-- <table tableName="t_pro_member_stakeholder" domainObjectName="ProMemberStakeholder"></table>--> |
|||
<table tableName="t_pro_deliver" domainObjectName="ProDeliver"></table> |
|||
<table tableName="t_pro_deliver_checker" domainObjectName="ProDeliverChecker"></table> |
|||
<table tableName="t_pro_clocking_in" domainObjectName="ProClockingIn"></table> |
|||
|
|||
<!-- 有些表的字段需要指定java类型 |
|||
<table schema="" tableName=""> |
|||
<columnOverride column="" javaType="" /> |
|||
</table> --> |
|||
</context> |
|||
</generatorConfiguration> |
@ -0,0 +1,62 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE configuration |
|||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-config.dtd"> |
|||
|
|||
<configuration> |
|||
<!-- 全局参数 --> |
|||
<settings> |
|||
<!-- 打印SQL语句 --> |
|||
<setting name="logImpl" value="STDOUT_LOGGING" /> |
|||
<!-- 使全局的映射器启用或禁用缓存。 --> |
|||
<setting name="cacheEnabled" value="true"/> |
|||
<!-- 全局启用或禁用延迟加载。当禁用时,所有关联对象都会即时加载。 --> |
|||
<setting name="lazyLoadingEnabled" value="true"/> |
|||
<!-- 当启用时,有延迟加载属性的对象在被调用时将会完全加载任意属性。否则,每种属性将会按需要加载。 --> |
|||
<setting name="aggressiveLazyLoading" value="true"/> |
|||
<!-- 是否允许单条sql 返回多个数据集 (取决于驱动的兼容性) default:true --> |
|||
<setting name="multipleResultSetsEnabled" value="true"/> |
|||
<!-- 是否可以使用列的别名 (取决于驱动的兼容性) default:true --> |
|||
<setting name="useColumnLabel" value="true"/> |
|||
<!-- 允许JDBC 生成主键。需要驱动器支持。如果设为了true,这个设置将强制使用被生成的主键,有一些驱动器不兼容不过仍然可以执行。 default:false --> |
|||
<setting name="useGeneratedKeys" value="true"/> |
|||
<!-- 指定 MyBatis 如何自动映射 数据基表的列 NONE:不隐射 PARTIAL:部分 FULL:全部 --> |
|||
<setting name="autoMappingBehavior" value="PARTIAL"/> |
|||
<!-- 这是默认的执行类型 (SIMPLE: 简单; REUSE: 执行器可能重复使用prepared statements语句;BATCH: 执行器可以重复执行语句和批量更新) --> |
|||
<setting name="defaultExecutorType" value="SIMPLE"/> |
|||
<!-- 使用驼峰命名法转换字段。 --> |
|||
<setting name="mapUnderscoreToCamelCase" value="true"/> |
|||
<!-- 设置本地缓存范围 session:就会有数据的共享 statement:语句范围 (这样就不会有数据的共享 ) defalut:session --> |
|||
<setting name="localCacheScope" value="SESSION"/> |
|||
<!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER,插入空值时不需要指定类型 --> |
|||
<setting name="jdbcTypeForNull" value="NULL"/> |
|||
</settings> |
|||
|
|||
<typeAliases> |
|||
<typeAlias alias="Integer" type="java.lang.Integer" /> |
|||
<typeAlias alias="Long" type="java.lang.Long" /> |
|||
<typeAlias alias="HashMap" type="java.util.HashMap" /> |
|||
<typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap" /> |
|||
<typeAlias alias="ArrayList" type="java.util.ArrayList" /> |
|||
<typeAlias alias="LinkedList" type="java.util.LinkedList" /> |
|||
<typeAlias alias="String" type="java.lang.String" /> |
|||
</typeAliases> |
|||
|
|||
<plugins> |
|||
<!-- com.github.pagehelper为PageHelper类所在包名 --> |
|||
<plugin interceptor="com.github.pagehelper.PageHelper"> |
|||
<property name="dialect" value="mysql"/> |
|||
<!-- 该参数默认为false --> |
|||
<!-- 设置为true时,会将RowBounds第一个参数offset当成pageNum页码使用 --> |
|||
<!-- 和startPage中的pageNum效果一样--> |
|||
<property name="offsetAsPageNum" value="false"/> |
|||
<!-- 该参数默认为false --> |
|||
<!-- 设置为true时,使用RowBounds分页会进行count查询 --> |
|||
<property name="rowBoundsWithCount" value="false"/> |
|||
<property name="pageSizeZero" value="true"/> |
|||
<property name="reasonable" value="false"/> |
|||
<property name="supportMethodsArguments" value="false"/> |
|||
<property name="returnPageInfo" value="none"/> |
|||
</plugin> |
|||
</plugins> |
|||
</configuration> |
Loading…
Reference in new issue