Compare commits

...

10 Commits

Author SHA1 Message Date
mula.liu 4e495c3eff 1.0.1 2024-10-18 17:01:41 +08:00
ZhangYP 01e4db1415 去掉ABCD 2024-03-04 17:06:32 +08:00
OathK1per 600ad2a773 修改行宽 2023-11-08 12:35:28 +08:00
OathK1per e927912aed 导出功能自动换行 2023-11-06 14:03:46 +08:00
OathK1per 9750722925 项目审核页面优化 2023-11-01 14:50:58 +08:00
OathK1per 25188514ac 修改MySQL密码 2023-10-29 12:05:48 +08:00
OathK1per 4a95260a26 毛利A计算更新 2023-10-17 16:55:13 +08:00
OathK1per 19dbd05ad9 毛利A计算 2023-10-13 16:22:25 +08:00
OathK1per 1eadf7fd26 项目预算基本信息同步预算计算方式 2023-08-29 15:06:58 +08:00
OathK1per 3b36524aca 修改bug 2023-07-17 17:54:39 +08:00
891 changed files with 509735 additions and 458614 deletions

BIN
.DS_Store vendored 100644

Binary file not shown.

56
.gitignore vendored
View File

@ -1,28 +1,28 @@
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
/.idea/workspace.xml
*.iws
*.iml
*.ipr
/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
/logs/
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
/.idea/workspace.xml
*.iws
*.iml
*.ipr
/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
/logs/

View File

@ -1,104 +1,104 @@
group 'cn.palmte'
//version '1.0'
buildscript {
ext {
springBootVersion = '1.5.7.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'application'
apply plugin: 'org.springframework.boot'
apply plugin: 'findbugs'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "http://maven.aliyun.com/nexus/content/groups/public/"}
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'org.hibernate:hibernate-java8:5.1.0.Final'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.10'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.10'
compile "org.springframework.boot:spring-boot-starter:${springBootVersion}"
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-freemarker'
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
//compile('org.springframework.boot:spring-boot-starter-data-redis')
compile 'com.gitee.xxssyyyyssxx.unihttp:unihttp-jdk:v2.0.2'
compile 'com.gitee.xxssyyyyssxx:common-crypto:v1.8.1'
compile 'com.gitee.xxssyyyyssxx:common-db:v1.8.7'
compile 'com.gitee.xxssyyyyssxx.json:json-fastjson:v1.8.8'
compile 'com.gitee.xxssyyyyssxx:token:v1.0'
compile 'com.jfinal:jfinal:2.2'
compile 'com.alibaba:druid:1.1.9'
compile 'mysql:mysql-connector-java:6.0.6'
//compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
//shiro
compile group: 'org.apache.shiro', name: 'shiro-spring', version: '1.4.0'
compile group: 'org.apache.shiro', name: 'shiro-core', version: '1.4.0'
compile group: 'net.mingsoft', name: 'shiro-freemarker-tags', version: '0.1'
compile group: 'org.apache.poi', name: 'poi', version: '3.17'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.17'
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.17'
compile group: 'org.apache.poi', name: 'poi-scratchpad', version: '3.17'
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
compile group: 'org.projectlombok', name: 'lombok', version: '1.16.20'
/*activiti start*/
compile group: 'org.activiti', name: 'activiti-spring-boot-starter-basic', version: '6.0.0'
/*activiti在线编辑器相关*/
compile group: 'org.activiti', name: 'activiti-json-converter', version: '6.0.0'
compile group: 'org.apache.xmlgraphics', name: 'batik-codec', version: '1.7'
/*activiti end*/
// https://mvnrepository.com/artifact/cn.afterturn/easypoi-base
compile group: 'cn.afterturn', name: 'easypoi-base', version: '4.2.0'
// https://mvnrepository.com/artifact/cn.afterturn/easypoi-annotation
compile group: 'cn.afterturn', name: 'easypoi-annotation', version: '4.2.0'
compileOnly 'org.springframework.boot:spring-boot-configuration-processor'
testCompile 'junit:junit:4.12'
testCompile 'org.springframework.boot:spring-boot-starter-test'
}
compileJava.dependsOn(processResources){
}
findbugs{
ignoreFailures=true
findbugsTest.enabled=false
}
tasks.withType(FindBugs) {
reports {
// xml
xml.enabled = true
html.enabled = false
}
}
group 'cn.palmte'
//version '1.0'
buildscript {
ext {
springBootVersion = '1.5.7.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'application'
apply plugin: 'org.springframework.boot'
apply plugin: 'findbugs'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "http://maven.aliyun.com/nexus/content/groups/public/"}
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'org.hibernate:hibernate-java8:5.1.0.Final'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.10'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.10'
compile "org.springframework.boot:spring-boot-starter:${springBootVersion}"
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-freemarker'
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
//compile('org.springframework.boot:spring-boot-starter-data-redis')
compile 'com.gitee.xxssyyyyssxx.unihttp:unihttp-jdk:v2.0.2'
compile 'com.gitee.xxssyyyyssxx:common-crypto:v1.8.1'
compile 'com.gitee.xxssyyyyssxx:common-db:v1.8.7'
compile 'com.gitee.xxssyyyyssxx.json:json-fastjson:v1.8.8'
compile 'com.gitee.xxssyyyyssxx:token:v1.0'
compile 'com.jfinal:jfinal:2.2'
compile 'com.alibaba:druid:1.1.9'
compile 'mysql:mysql-connector-java:6.0.6'
//compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
//shiro
compile group: 'org.apache.shiro', name: 'shiro-spring', version: '1.4.0'
compile group: 'org.apache.shiro', name: 'shiro-core', version: '1.4.0'
compile group: 'net.mingsoft', name: 'shiro-freemarker-tags', version: '0.1'
compile group: 'org.apache.poi', name: 'poi', version: '3.17'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.17'
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.17'
compile group: 'org.apache.poi', name: 'poi-scratchpad', version: '3.17'
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
compile group: 'org.projectlombok', name: 'lombok', version: '1.16.20'
/*activiti start*/
compile group: 'org.activiti', name: 'activiti-spring-boot-starter-basic', version: '6.0.0'
/*activiti在线编辑器相关*/
compile group: 'org.activiti', name: 'activiti-json-converter', version: '6.0.0'
compile group: 'org.apache.xmlgraphics', name: 'batik-codec', version: '1.7'
/*activiti end*/
// https://mvnrepository.com/artifact/cn.afterturn/easypoi-base
compile group: 'cn.afterturn', name: 'easypoi-base', version: '4.2.0'
// https://mvnrepository.com/artifact/cn.afterturn/easypoi-annotation
compile group: 'cn.afterturn', name: 'easypoi-annotation', version: '4.2.0'
compileOnly 'org.springframework.boot:spring-boot-configuration-processor'
testCompile 'junit:junit:4.12'
testCompile 'org.springframework.boot:spring-boot-starter-test'
}
compileJava.dependsOn(processResources){
}
findbugs{
ignoreFailures=true
findbugsTest.enabled=false
}
tasks.withType(FindBugs) {
reports {
// xml
xml.enabled = true
html.enabled = false
}
}

50811
db/fourcal_db.sql 100644

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
#Thu Oct 28 15:13:01 CST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-rc-2-bin.zip
#Thu Oct 28 15:13:01 CST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-rc-2-bin.zip

344
gradlew vendored
View File

@ -1,172 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save ( ) {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save ( ) {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

168
gradlew.bat vendored
View File

@ -1,84 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,2 +1,2 @@
rootProject.name = 'fourcal'
rootProject.name = 'fourcal'

View File

@ -1,33 +1,33 @@
package cn.palmte.work;
/**
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:26
*/
public class ErrorMessage implements Result {
private String message;
public ErrorMessage() { }
public ErrorMessage(String message) {
this.message = message;
}
public void setMessage(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public static ErrorMessage failed(String message) {
return new ErrorMessage(message);
}
public static ErrorMessage failed() {
return new ErrorMessage("未知错误");
}
}
package cn.palmte.work;
/**
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:26
*/
public class ErrorMessage implements Result {
private String message;
public ErrorMessage() { }
public ErrorMessage(String message) {
this.message = message;
}
public void setMessage(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public static ErrorMessage failed(String message) {
return new ErrorMessage(message);
}
public static ErrorMessage failed() {
return new ErrorMessage("未知错误");
}
}

View File

@ -1,50 +1,50 @@
package cn.palmte.work;
import org.springframework.http.HttpStatus;
import org.springframework.util.Assert;
import java.util.function.Supplier;
/**
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:25
*/
public class ErrorMessageException extends NoStackTraceRuntimeException {
private final HttpStatus status;
public ErrorMessageException(/*@Nullable*/ String msg) {
this(msg, null, HttpStatus.BAD_REQUEST);
}
public ErrorMessageException(/*@Nullable*/ String msg, /*@Nullable*/ Throwable cause, HttpStatus status) {
super(msg, cause);
Assert.notNull(status, "http status is required");
this.status = status;
}
public HttpStatus getStatus() {
return status;
}
public static ErrorMessageException failed(String message) {
return new ErrorMessageException(message);
}
public static ErrorMessageException failed(String message, HttpStatus status) {
return new ErrorMessageException(message, null, status);
}
public static void notNull(Object obj, String message) {
if (obj == null) {
throw ErrorMessageException.failed(message, HttpStatus.NOT_FOUND);
}
}
public static void notNull(Object obj, Supplier<String> supplier) {
if (obj == null) {
throw new ErrorMessageException(supplier.get());
}
}
}
package cn.palmte.work;
import org.springframework.http.HttpStatus;
import org.springframework.util.Assert;
import java.util.function.Supplier;
/**
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:25
*/
public class ErrorMessageException extends NoStackTraceRuntimeException {
private final HttpStatus status;
public ErrorMessageException(/*@Nullable*/ String msg) {
this(msg, null, HttpStatus.BAD_REQUEST);
}
public ErrorMessageException(/*@Nullable*/ String msg, /*@Nullable*/ Throwable cause, HttpStatus status) {
super(msg, cause);
Assert.notNull(status, "http status is required");
this.status = status;
}
public HttpStatus getStatus() {
return status;
}
public static ErrorMessageException failed(String message) {
return new ErrorMessageException(message);
}
public static ErrorMessageException failed(String message, HttpStatus status) {
return new ErrorMessageException(message, null, status);
}
public static void notNull(Object obj, String message) {
if (obj == null) {
throw ErrorMessageException.failed(message, HttpStatus.NOT_FOUND);
}
}
public static void notNull(Object obj, Supplier<String> supplier) {
if (obj == null) {
throw new ErrorMessageException(supplier.get());
}
}
}

View File

@ -1,40 +1,40 @@
package cn.palmte.work;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
@SpringBootApplication
public class FourCalApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(FourCalApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
/**
* wartomcatcatalina.shjvm-Dspring.profiles.active=test
* envprofile
* java -jar-Dspring.profiles.active=test
*/
setRegisterErrorPageFilter(false);
String env = System.getProperty("env");
if (null != env) {
Map<String, Object> map = new HashMap<>(1);
map.put("spring.profiles.active", env);
builder.properties(map);
//不能使用 builder.profiles(env);否则可能出现两个环境的都配置了
}
return builder.sources(FourCalApplication.class);
}
}
package cn.palmte.work;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
@SpringBootApplication
public class FourCalApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(FourCalApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
/**
* wartomcatcatalina.shjvm-Dspring.profiles.active=test
* envprofile
* java -jar-Dspring.profiles.active=test
*/
setRegisterErrorPageFilter(false);
String env = System.getProperty("env");
if (null != env) {
Map<String, Object> map = new HashMap<>(1);
map.put("spring.profiles.active", env);
builder.properties(map);
//不能使用 builder.profiles(env);否则可能出现两个环境的都配置了
}
return builder.sources(FourCalApplication.class);
}
}

View File

@ -1,113 +1,113 @@
package cn.palmte.work;
import java.util.function.Function;
/**
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:38
*/
public class Json implements Result {
private Object data;
private String message;
private boolean success;
public Object getData() {
return data;
}
public boolean isSuccess() {
return success;
}
public String getMessage() {
return message;
}
public Json data(Object data) {
this.data = data;
return this;
}
public Json message(String message) {
this.message = message;
return this;
}
public Json success(boolean success) {
this.success = success;
return this;
}
/**
* Apply the common {@link Json} result
*
* @param func the {@link Function}
* @param param parameter
*/
public static <T> Json apply(Function<T, Boolean> func, T param) {
if (func.apply(param)) {
return Json.ok();
}
return Json.failed();
}
public static <T> Json apply(boolean success) {
if (success) {
return Json.ok();
}
return Json.failed();
}
/**
* @param success if success
* @param message the message of the response
* @param data response data
*/
public static Json create(boolean success, String message, Object data) {
return new Json()
.data(data)
.message(message)
.success(success);
}
public static Json ok() {
return create(true, "ok", null);
}
public static Json ok(String message, Object data) {
return create(true, message, data);
}
public static Json ok(Object data) {
return create(true, "ok", data);
}
public static Json ok(String message) {
return create(true, message, null);
}
public static Json failed() {
return create(false, "失败", null);
}
public static Json failed(String message) {
return create(false, message, null);
}
public static Json failed(String message, Object data) {
return create(false, message, data);
}
@Override
public String toString() {
return new StringBuilder()//
.append("{\"message\":\"").append(message)//
.append("\",\"data\":\"").append(data)//
.append("\",\"success\":\"").append(success)//
.append("\"}")//
.toString();
}
}
package cn.palmte.work;
import java.util.function.Function;
/**
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:38
*/
public class Json implements Result {
private Object data;
private String message;
private boolean success;
public Object getData() {
return data;
}
public boolean isSuccess() {
return success;
}
public String getMessage() {
return message;
}
public Json data(Object data) {
this.data = data;
return this;
}
public Json message(String message) {
this.message = message;
return this;
}
public Json success(boolean success) {
this.success = success;
return this;
}
/**
* Apply the common {@link Json} result
*
* @param func the {@link Function}
* @param param parameter
*/
public static <T> Json apply(Function<T, Boolean> func, T param) {
if (func.apply(param)) {
return Json.ok();
}
return Json.failed();
}
public static <T> Json apply(boolean success) {
if (success) {
return Json.ok();
}
return Json.failed();
}
/**
* @param success if success
* @param message the message of the response
* @param data response data
*/
public static Json create(boolean success, String message, Object data) {
return new Json()
.data(data)
.message(message)
.success(success);
}
public static Json ok() {
return create(true, "ok", null);
}
public static Json ok(String message, Object data) {
return create(true, message, data);
}
public static Json ok(Object data) {
return create(true, "ok", data);
}
public static Json ok(String message) {
return create(true, message, null);
}
public static Json failed() {
return create(false, "失败", null);
}
public static Json failed(String message) {
return create(false, message, null);
}
public static Json failed(String message, Object data) {
return create(false, message, data);
}
@Override
public String toString() {
return new StringBuilder()//
.append("{\"message\":\"").append(message)//
.append("\",\"data\":\"").append(data)//
.append("\",\"success\":\"").append(success)//
.append("\"}")//
.toString();
}
}

View File

@ -1,96 +1,96 @@
package cn.palmte.work;
import org.springframework.core.NestedExceptionUtils;
import org.springframework.core.NestedRuntimeException;
/**
* ,
*
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:25
*/
public class NoStackTraceRuntimeException extends RuntimeException {
private static final long serialVersionUID = 1L;
public NoStackTraceRuntimeException() {
super();
}
public NoStackTraceRuntimeException(Throwable cause) {
super(cause);
}
public NoStackTraceRuntimeException(String msg) {
super(msg);
}
public NoStackTraceRuntimeException(/*@Nullable*/ String msg, /*@Nullable */Throwable cause) {
super(msg, cause);
}
@Override
public final synchronized Throwable fillInStackTrace() {
return this;
}
/**
* Retrieve the innermost cause of this exception, if any.
*
* @return the innermost exception, or {@code null} if none
*/
// @Nullable
public Throwable getRootCause() {
return NestedExceptionUtils.getRootCause(this);
}
/**
* Retrieve the most specific cause of this exception, that is,
* either the innermost cause (root cause) or this exception itself.
* <p>Differs from {@link #getRootCause()} in that it falls back
* to the present exception if there is no root cause.
*
* @return the most specific cause (never {@code null})
*/
public Throwable getMostSpecificCause() {
Throwable rootCause = getRootCause();
return (rootCause != null ? rootCause : this);
}
/**
* Check whether this exception contains an exception of the given type:
* either it is of the given class itself or it contains a nested cause
* of the given type.
*
* @param exType the exception type to look for
* @return whether there is a nested exception of the specified type
*/
public boolean contains(Class<?> exType) {
if (exType == null) {
return false;
}
if (exType.isInstance(this)) {
return true;
}
Throwable cause = getCause();
if (cause == this) {
return false;
}
if (cause instanceof NestedRuntimeException) {
return ((NestedRuntimeException) cause).contains(exType);
}
else {
while (cause != null) {
if (exType.isInstance(cause)) {
return true;
}
if (cause.getCause() == cause) {
break;
}
cause = cause.getCause();
}
return false;
}
}
}
package cn.palmte.work;
import org.springframework.core.NestedExceptionUtils;
import org.springframework.core.NestedRuntimeException;
/**
* ,
*
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:25
*/
public class NoStackTraceRuntimeException extends RuntimeException {
private static final long serialVersionUID = 1L;
public NoStackTraceRuntimeException() {
super();
}
public NoStackTraceRuntimeException(Throwable cause) {
super(cause);
}
public NoStackTraceRuntimeException(String msg) {
super(msg);
}
public NoStackTraceRuntimeException(/*@Nullable*/ String msg, /*@Nullable */Throwable cause) {
super(msg, cause);
}
@Override
public final synchronized Throwable fillInStackTrace() {
return this;
}
/**
* Retrieve the innermost cause of this exception, if any.
*
* @return the innermost exception, or {@code null} if none
*/
// @Nullable
public Throwable getRootCause() {
return NestedExceptionUtils.getRootCause(this);
}
/**
* Retrieve the most specific cause of this exception, that is,
* either the innermost cause (root cause) or this exception itself.
* <p>Differs from {@link #getRootCause()} in that it falls back
* to the present exception if there is no root cause.
*
* @return the most specific cause (never {@code null})
*/
public Throwable getMostSpecificCause() {
Throwable rootCause = getRootCause();
return (rootCause != null ? rootCause : this);
}
/**
* Check whether this exception contains an exception of the given type:
* either it is of the given class itself or it contains a nested cause
* of the given type.
*
* @param exType the exception type to look for
* @return whether there is a nested exception of the specified type
*/
public boolean contains(Class<?> exType) {
if (exType == null) {
return false;
}
if (exType.isInstance(this)) {
return true;
}
Throwable cause = getCause();
if (cause == this) {
return false;
}
if (cause instanceof NestedRuntimeException) {
return ((NestedRuntimeException) cause).contains(exType);
}
else {
while (cause != null) {
if (exType.isInstance(cause)) {
return true;
}
if (cause.getCause() == cause) {
break;
}
cause = cause.getCause();
}
return false;
}
}
}

View File

@ -1,10 +1,10 @@
package cn.palmte.work;
/**
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:37
*/
public interface Result {
}
package cn.palmte.work;
/**
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:37
*/
public interface Result {
}

View File

@ -1,30 +1,30 @@
package cn.palmte.work;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:39
*/
@Getter
@Setter
@AllArgsConstructor
public class ValidationError implements Result {
private Object validation;
public static ValidationError failed(Object validation) {
return new ValidationError(validation);
}
@JsonIgnore
public Object getData() {
return validation;
}
}
package cn.palmte.work;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:39
*/
@Getter
@Setter
@AllArgsConstructor
public class ValidationError implements Result {
private Object validation;
public static ValidationError failed(Object validation) {
return new ValidationError(validation);
}
@JsonIgnore
public Object getData() {
return validation;
}
}

View File

@ -1,51 +1,51 @@
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum ApproveStatusEnum {
APPROVAL_UNCOMMIT(0,"草稿"),
APPROVAL_PENDING(1,"待审核"),
APPROVAL_PASSED(2,"审核通过"),
APPROVAL_UNPASS(3,"审核不通过");
private int approveStatus;
private String approveStatusDesc;
ApproveStatusEnum(int approveStatus, String approveStatusDesc) {
this.approveStatus = approveStatus;
this.approveStatusDesc = approveStatusDesc;
}
public int getApproveStatus() {
return approveStatus;
}
public void setApproveStatus(int approveStatus) {
this.approveStatus = approveStatus;
}
public String getApproveStatusDesc() {
return approveStatusDesc;
}
public void setApproveStatusDesc(String approveStatusDesc) {
this.approveStatusDesc = approveStatusDesc;
}
public static ApproveStatusEnum parseApproveStatus(int approveStatus){
if(approveStatus == 0){
return APPROVAL_UNCOMMIT;
}
if(approveStatus == 1){
return APPROVAL_PENDING;
}
if(approveStatus == 2){
return APPROVAL_PASSED;
}
if(approveStatus == 3){
return APPROVAL_UNPASS;
}
throw new IllegalArgumentException("Unkown approveStatus:"+approveStatus);
}
}
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum ApproveStatusEnum {
APPROVAL_UNCOMMIT(0,"草稿"),
APPROVAL_PENDING(1,"待审核"),
APPROVAL_PASSED(2,"审核通过"),
APPROVAL_UNPASS(3,"审核不通过");
private int approveStatus;
private String approveStatusDesc;
ApproveStatusEnum(int approveStatus, String approveStatusDesc) {
this.approveStatus = approveStatus;
this.approveStatusDesc = approveStatusDesc;
}
public int getApproveStatus() {
return approveStatus;
}
public void setApproveStatus(int approveStatus) {
this.approveStatus = approveStatus;
}
public String getApproveStatusDesc() {
return approveStatusDesc;
}
public void setApproveStatusDesc(String approveStatusDesc) {
this.approveStatusDesc = approveStatusDesc;
}
public static ApproveStatusEnum parseApproveStatus(int approveStatus){
if(approveStatus == 0){
return APPROVAL_UNCOMMIT;
}
if(approveStatus == 1){
return APPROVAL_PENDING;
}
if(approveStatus == 2){
return APPROVAL_PASSED;
}
if(approveStatus == 3){
return APPROVAL_UNPASS;
}
throw new IllegalArgumentException("Unkown approveStatus:"+approveStatus);
}
}

View File

@ -1,155 +1,155 @@
package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
*
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class BudgetBean extends IncomeCostBean{
/**
*
*/
private BigDecimal costPurchaseTotalTaxExclude;
/**
*
*/
private BigDecimal costPurchaseTotalTaxInclude;
/**
*
*/
private BigDecimal incomeDeviceTax;
/**
*
*/
private BigDecimal incomeEngineerTax;
/**
*
*/
private BigDecimal incomeServiceTax;
/**
*
*/
private BigDecimal costPurchaseDeviceTax;
/**
*
*/
private BigDecimal costPurchaseBuildTax;
/**
*
*/
private BigDecimal costPurchaseServiceTax;
/**
*
*/
private BigDecimal costPurchaseOtherTax;
/**
*
*/
private BigDecimal costOtherOtherTax;
/**
*
*/
private BigDecimal costCompanyManageTaxExclude;
/**
* null0
*/
@Override
protected BigDecimal handleSpecial(BigDecimal src) {
return null == src ? new BigDecimal(0) : src;
}
public BigDecimal getCostPurchaseTotalTaxExclude() {
return handleSpecial(costPurchaseTotalTaxExclude);
}
public void setCostPurchaseTotalTaxExclude(BigDecimal costPurchaseTotalTaxExclude) {
this.costPurchaseTotalTaxExclude = costPurchaseTotalTaxExclude;
}
public BigDecimal getCostPurchaseTotalTaxInclude() {
return handleSpecial(costPurchaseTotalTaxInclude);
}
public void setCostPurchaseTotalTaxInclude(BigDecimal costPurchaseTotalTaxInclude) {
this.costPurchaseTotalTaxInclude = costPurchaseTotalTaxInclude;
}
public BigDecimal getCostPurchaseTotalTax() {
return getCostPurchaseTotalTaxInclude().subtract(getCostPurchaseTotalTaxExclude());
}
public BigDecimal getIncomeDeviceTax() {
return handleSpecial(incomeDeviceTax);
}
public void setIncomeDeviceTax(BigDecimal incomeDeviceTax) {
this.incomeDeviceTax = incomeDeviceTax;
}
public BigDecimal getIncomeEngineerTax() {
return handleSpecial(incomeEngineerTax);
}
public void setIncomeEngineerTax(BigDecimal incomeEngineerTax) {
this.incomeEngineerTax = incomeEngineerTax;
}
public BigDecimal getIncomeServiceTax() {
return handleSpecial(incomeServiceTax);
}
public void setIncomeServiceTax(BigDecimal incomeServiceTax) {
this.incomeServiceTax = incomeServiceTax;
}
public BigDecimal getCostPurchaseDeviceTax() {
return handleSpecial(costPurchaseDeviceTax);
}
public void setCostPurchaseDeviceTax(BigDecimal costPurchaseDeviceTax) {
this.costPurchaseDeviceTax = costPurchaseDeviceTax;
}
public BigDecimal getCostPurchaseBuildTax() {
return handleSpecial(costPurchaseBuildTax);
}
public void setCostPurchaseBuildTax(BigDecimal costPurchaseBuildTax) {
this.costPurchaseBuildTax = costPurchaseBuildTax;
}
public BigDecimal getCostPurchaseServiceTax() {
return handleSpecial(costPurchaseServiceTax);
}
public void setCostPurchaseServiceTax(BigDecimal costPurchaseServiceTax) {
this.costPurchaseServiceTax = costPurchaseServiceTax;
}
public BigDecimal getCostPurchaseOtherTax() {
return handleSpecial(costPurchaseOtherTax);
}
public void setCostPurchaseOtherTax(BigDecimal costPurchaseOtherTax) {
this.costPurchaseOtherTax = costPurchaseOtherTax;
}
public BigDecimal getCostOtherOtherTax() {
return handleSpecial(costOtherOtherTax);
}
public void setCostOtherOtherTax(BigDecimal costOtherOtherTax) {
this.costOtherOtherTax = costOtherOtherTax;
}
@Override
public BigDecimal getCostCompanyManageTaxExclude() {
return getIncomeTotalTaxExclude().multiply(BigDecimal.valueOf(0.028));
}
@Override
public void setCostCompanyManageTaxExclude(BigDecimal costCompanyManageTaxExclude) {
this.costCompanyManageTaxExclude = costCompanyManageTaxExclude;
}
}
package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
*
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class BudgetBean extends IncomeCostBean{
/**
*
*/
private BigDecimal costPurchaseTotalTaxExclude;
/**
*
*/
private BigDecimal costPurchaseTotalTaxInclude;
/**
*
*/
private BigDecimal incomeDeviceTax;
/**
*
*/
private BigDecimal incomeEngineerTax;
/**
*
*/
private BigDecimal incomeServiceTax;
/**
*
*/
private BigDecimal costPurchaseDeviceTax;
/**
*
*/
private BigDecimal costPurchaseBuildTax;
/**
*
*/
private BigDecimal costPurchaseServiceTax;
/**
*
*/
private BigDecimal costPurchaseOtherTax;
/**
*
*/
private BigDecimal costOtherOtherTax;
/**
*
*/
private BigDecimal costCompanyManageTaxExclude;
/**
* null0
*/
@Override
protected BigDecimal handleSpecial(BigDecimal src) {
return null == src ? new BigDecimal(0) : src;
}
public BigDecimal getCostPurchaseTotalTaxExclude() {
return handleSpecial(costPurchaseTotalTaxExclude);
}
public void setCostPurchaseTotalTaxExclude(BigDecimal costPurchaseTotalTaxExclude) {
this.costPurchaseTotalTaxExclude = costPurchaseTotalTaxExclude;
}
public BigDecimal getCostPurchaseTotalTaxInclude() {
return handleSpecial(costPurchaseTotalTaxInclude);
}
public void setCostPurchaseTotalTaxInclude(BigDecimal costPurchaseTotalTaxInclude) {
this.costPurchaseTotalTaxInclude = costPurchaseTotalTaxInclude;
}
public BigDecimal getCostPurchaseTotalTax() {
return getCostPurchaseTotalTaxInclude().subtract(getCostPurchaseTotalTaxExclude());
}
public BigDecimal getIncomeDeviceTax() {
return handleSpecial(incomeDeviceTax);
}
public void setIncomeDeviceTax(BigDecimal incomeDeviceTax) {
this.incomeDeviceTax = incomeDeviceTax;
}
public BigDecimal getIncomeEngineerTax() {
return handleSpecial(incomeEngineerTax);
}
public void setIncomeEngineerTax(BigDecimal incomeEngineerTax) {
this.incomeEngineerTax = incomeEngineerTax;
}
public BigDecimal getIncomeServiceTax() {
return handleSpecial(incomeServiceTax);
}
public void setIncomeServiceTax(BigDecimal incomeServiceTax) {
this.incomeServiceTax = incomeServiceTax;
}
public BigDecimal getCostPurchaseDeviceTax() {
return handleSpecial(costPurchaseDeviceTax);
}
public void setCostPurchaseDeviceTax(BigDecimal costPurchaseDeviceTax) {
this.costPurchaseDeviceTax = costPurchaseDeviceTax;
}
public BigDecimal getCostPurchaseBuildTax() {
return handleSpecial(costPurchaseBuildTax);
}
public void setCostPurchaseBuildTax(BigDecimal costPurchaseBuildTax) {
this.costPurchaseBuildTax = costPurchaseBuildTax;
}
public BigDecimal getCostPurchaseServiceTax() {
return handleSpecial(costPurchaseServiceTax);
}
public void setCostPurchaseServiceTax(BigDecimal costPurchaseServiceTax) {
this.costPurchaseServiceTax = costPurchaseServiceTax;
}
public BigDecimal getCostPurchaseOtherTax() {
return handleSpecial(costPurchaseOtherTax);
}
public void setCostPurchaseOtherTax(BigDecimal costPurchaseOtherTax) {
this.costPurchaseOtherTax = costPurchaseOtherTax;
}
public BigDecimal getCostOtherOtherTax() {
return handleSpecial(costOtherOtherTax);
}
public void setCostOtherOtherTax(BigDecimal costOtherOtherTax) {
this.costOtherOtherTax = costOtherOtherTax;
}
@Override
public BigDecimal getCostCompanyManageTaxExclude() {
return getIncomeTotalTaxExclude().multiply(BigDecimal.valueOf(0.028));
}
@Override
public void setCostCompanyManageTaxExclude(BigDecimal costCompanyManageTaxExclude) {
this.costCompanyManageTaxExclude = costCompanyManageTaxExclude;
}
}

View File

@ -1,425 +1,425 @@
package cn.palmte.work.bean;
import java.math.BigDecimal;
public class BudgetSettleBean {
//========================收入表================================
/**
*
*/
private BigDecimal incomeDeviceBudgetTotal;
/**
*
*/
private BigDecimal incomeEngineerBudgetTotal;
/**
*
*/
private BigDecimal incomeServiceBudgetTotal;
//========================成本表================================
/**
*
*/
private BigDecimal costPurchaseDeviceBudgetTotal;
/**
*
*/
private BigDecimal costPurchaseBuildBudgetTotal;
/**
*
*/
private BigDecimal costPurchaseServiceBudgetTotal;
/**
*
*/
private BigDecimal costPurchaseOtherBudgetTotal;
/**
*
*/
private BigDecimal costProjectManageBudgetTotal;
/**
*
*/
private BigDecimal costOtherBudgetTotal;
//========================管理表================================
/**
*
*/
private BigDecimal costExpropriationBudgetTotal;
/**
*
*/
private BigDecimal costCompanyManageBudgetTotal;
/**
*
*/
private BigDecimal costIncomeTaxBudgetTotal;
//========================利润率计算表================================
/**
*
*/
private BigDecimal grossProfitBudgetTotal;
/**
*
*/
private BigDecimal grossProfitProfitMargin;
/**
*
*/
private BigDecimal contributionProfitBudgetTotal;
/**
*
*/
private BigDecimal contributionProfitProfitMargin;
/**
*
*/
private BigDecimal netProfitBudgetTotal;
/**
*
*/
private BigDecimal netProfitProfitMargin;
//========================结算现金流量表================================
/**
* a
*/
private BigDecimal saleIncomeCashBudget;
/**
* b
*/
private BigDecimal taxReturnBudget;
/**
* c
*/
private BigDecimal earnestMoneyIncomeBudget;
/**
* d+
*/
private BigDecimal purchaseCostBudget;
/**
* e
*/
private BigDecimal taxCostBudget;
/**
* f
*/
private BigDecimal earnestMoneyCostBudget;
/**
* g
* g=a+c+b-d-f-e
*/
private BigDecimal netCashFlowBudget;
/**
* h
*/
private BigDecimal cashInflowFromInvestingActivitiesBudget;
/**
* i
*/
private BigDecimal cashOutflowFromInvestingActivitiesBudget;
/**
* j
*/
private BigDecimal netCashFromInvestingActivitiesBudget;
/**
* k
*/
private BigDecimal financingCapitalInflowBudget;
/**
* l
*/
private BigDecimal financingCapitalOutflowBudget;
/**
* m
* m=k-l
*/
private BigDecimal financingCapitalCashflowBudget;
/**
* n
* n=g+j+m
*/
private BigDecimal netIncreaseMonetaryFundsBudget;
public BigDecimal getIncomeDeviceBudgetTotal() {
return incomeDeviceBudgetTotal;
}
public void setIncomeDeviceBudgetTotal(BigDecimal incomeDeviceBudgetTotal) {
this.incomeDeviceBudgetTotal = incomeDeviceBudgetTotal;
}
public BigDecimal getIncomeEngineerBudgetTotal() {
return incomeEngineerBudgetTotal;
}
public void setIncomeEngineerBudgetTotal(BigDecimal incomeEngineerBudgetTotal) {
this.incomeEngineerBudgetTotal = incomeEngineerBudgetTotal;
}
public BigDecimal getIncomeServiceBudgetTotal() {
return incomeServiceBudgetTotal;
}
public void setIncomeServiceBudgetTotal(BigDecimal incomeServiceBudgetTotal) {
this.incomeServiceBudgetTotal = incomeServiceBudgetTotal;
}
public BigDecimal getCostPurchaseDeviceBudgetTotal() {
return costPurchaseDeviceBudgetTotal;
}
public void setCostPurchaseDeviceBudgetTotal(BigDecimal costPurchaseDeviceBudgetTotal) {
this.costPurchaseDeviceBudgetTotal = costPurchaseDeviceBudgetTotal;
}
public BigDecimal getCostPurchaseBuildBudgetTotal() {
return costPurchaseBuildBudgetTotal;
}
public void setCostPurchaseBuildBudgetTotal(BigDecimal costPurchaseBuildBudgetTotal) {
this.costPurchaseBuildBudgetTotal = costPurchaseBuildBudgetTotal;
}
public BigDecimal getCostPurchaseServiceBudgetTotal() {
return costPurchaseServiceBudgetTotal;
}
public void setCostPurchaseServiceBudgetTotal(BigDecimal costPurchaseServiceBudgetTotal) {
this.costPurchaseServiceBudgetTotal = costPurchaseServiceBudgetTotal;
}
public BigDecimal getCostPurchaseOtherBudgetTotal() {
return costPurchaseOtherBudgetTotal;
}
public void setCostPurchaseOtherBudgetTotal(BigDecimal costPurchaseOtherBudgetTotal) {
this.costPurchaseOtherBudgetTotal = costPurchaseOtherBudgetTotal;
}
public BigDecimal getCostProjectManageBudgetTotal() {
return costProjectManageBudgetTotal;
}
public void setCostProjectManageBudgetTotal(BigDecimal costProjectManageBudgetTotal) {
this.costProjectManageBudgetTotal = costProjectManageBudgetTotal;
}
public BigDecimal getCostOtherBudgetTotal() {
return (costOtherBudgetTotal == null)?BigDecimal.ZERO:costOtherBudgetTotal;
}
public void setCostOtherBudgetTotal(BigDecimal costOtherBudgetTotal) {
this.costOtherBudgetTotal = costOtherBudgetTotal;
}
public BigDecimal getCostExpropriationBudgetTotal() {
return costExpropriationBudgetTotal;
}
public void setCostExpropriationBudgetTotal(BigDecimal costExpropriationBudgetTotal) {
this.costExpropriationBudgetTotal = costExpropriationBudgetTotal;
}
public BigDecimal getCostCompanyManageBudgetTotal() {
return costCompanyManageBudgetTotal;
}
public void setCostCompanyManageBudgetTotal(BigDecimal costCompanyManageBudgetTotal) {
this.costCompanyManageBudgetTotal = costCompanyManageBudgetTotal;
}
public BigDecimal getCostIncomeTaxBudgetTotal() {
return costIncomeTaxBudgetTotal;
}
public void setCostIncomeTaxBudgetTotal(BigDecimal costIncomeTaxBudgetTotal) {
this.costIncomeTaxBudgetTotal = costIncomeTaxBudgetTotal;
}
public BigDecimal getGrossProfitBudgetTotal() {
return grossProfitBudgetTotal;
}
public void setGrossProfitBudgetTotal(BigDecimal grossProfitBudgetTotal) {
this.grossProfitBudgetTotal = grossProfitBudgetTotal;
}
public BigDecimal getGrossProfitProfitMargin() {
return grossProfitProfitMargin;
}
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
this.grossProfitProfitMargin = grossProfitProfitMargin;
}
public BigDecimal getContributionProfitBudgetTotal() {
return contributionProfitBudgetTotal;
}
public void setContributionProfitBudgetTotal(BigDecimal contributionProfitBudgetTotal) {
this.contributionProfitBudgetTotal = contributionProfitBudgetTotal;
}
public BigDecimal getContributionProfitProfitMargin() {
return contributionProfitProfitMargin;
}
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
}
public BigDecimal getNetProfitBudgetTotal() {
return netProfitBudgetTotal;
}
public void setNetProfitBudgetTotal(BigDecimal netProfitBudgetTotal) {
this.netProfitBudgetTotal = netProfitBudgetTotal;
}
public BigDecimal getNetProfitProfitMargin() {
return netProfitProfitMargin;
}
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
this.netProfitProfitMargin = netProfitProfitMargin;
}
public BigDecimal getSaleIncomeCashBudget() {
return saleIncomeCashBudget;
}
public void setSaleIncomeCashBudget(BigDecimal saleIncomeCashBudget) {
this.saleIncomeCashBudget = saleIncomeCashBudget;
}
public BigDecimal getTaxReturnBudget() {
return taxReturnBudget;
}
public void setTaxReturnBudget(BigDecimal taxReturnBudget) {
this.taxReturnBudget = taxReturnBudget;
}
public BigDecimal getEarnestMoneyIncomeBudget() {
return earnestMoneyIncomeBudget;
}
public void setEarnestMoneyIncomeBudget(BigDecimal earnestMoneyIncomeBudget) {
this.earnestMoneyIncomeBudget = earnestMoneyIncomeBudget;
}
public BigDecimal getPurchaseCostBudget() {
return purchaseCostBudget;
}
public void setPurchaseCostBudget(BigDecimal purchaseCostBudget) {
this.purchaseCostBudget = purchaseCostBudget;
}
public BigDecimal getTaxCostBudget() {
return taxCostBudget;
}
public void setTaxCostBudget(BigDecimal taxCostBudget) {
this.taxCostBudget = taxCostBudget;
}
public BigDecimal getEarnestMoneyCostBudget() {
return earnestMoneyCostBudget;
}
public void setEarnestMoneyCostBudget(BigDecimal earnestMoneyCostBudget) {
this.earnestMoneyCostBudget = earnestMoneyCostBudget;
}
public BigDecimal getNetCashFlowBudget() {
return netCashFlowBudget;
}
public void setNetCashFlowBudget(BigDecimal netCashFlowBudget) {
this.netCashFlowBudget = netCashFlowBudget;
}
public BigDecimal getCashInflowFromInvestingActivitiesBudget() {
return cashInflowFromInvestingActivitiesBudget;
}
public void setCashInflowFromInvestingActivitiesBudget(BigDecimal cashInflowFromInvestingActivitiesBudget) {
this.cashInflowFromInvestingActivitiesBudget = cashInflowFromInvestingActivitiesBudget;
}
public BigDecimal getCashOutflowFromInvestingActivitiesBudget() {
return cashOutflowFromInvestingActivitiesBudget;
}
public void setCashOutflowFromInvestingActivitiesBudget(BigDecimal cashOutflowFromInvestingActivitiesBudget) {
this.cashOutflowFromInvestingActivitiesBudget = cashOutflowFromInvestingActivitiesBudget;
}
public BigDecimal getNetCashFromInvestingActivitiesBudget() {
return netCashFromInvestingActivitiesBudget;
}
public void setNetCashFromInvestingActivitiesBudget(BigDecimal netCashFromInvestingActivitiesBudget) {
this.netCashFromInvestingActivitiesBudget = netCashFromInvestingActivitiesBudget;
}
public BigDecimal getFinancingCapitalInflowBudget() {
return financingCapitalInflowBudget;
}
public void setFinancingCapitalInflowBudget(BigDecimal financingCapitalInflowBudget) {
this.financingCapitalInflowBudget = financingCapitalInflowBudget;
}
public BigDecimal getFinancingCapitalOutflowBudget() {
return financingCapitalOutflowBudget;
}
public void setFinancingCapitalOutflowBudget(BigDecimal financingCapitalOutflowBudget) {
this.financingCapitalOutflowBudget = financingCapitalOutflowBudget;
}
public BigDecimal getFinancingCapitalCashflowBudget() {
return financingCapitalCashflowBudget;
}
public void setFinancingCapitalCashflowBudget(BigDecimal financingCapitalCashflowBudget) {
this.financingCapitalCashflowBudget = financingCapitalCashflowBudget;
}
public BigDecimal getNetIncreaseMonetaryFundsBudget() {
return netIncreaseMonetaryFundsBudget;
}
public void setNetIncreaseMonetaryFundsBudget(BigDecimal netIncreaseMonetaryFundsBudget) {
this.netIncreaseMonetaryFundsBudget = netIncreaseMonetaryFundsBudget;
}
}
package cn.palmte.work.bean;
import java.math.BigDecimal;
public class BudgetSettleBean {
//========================收入表================================
/**
*
*/
private BigDecimal incomeDeviceBudgetTotal;
/**
*
*/
private BigDecimal incomeEngineerBudgetTotal;
/**
*
*/
private BigDecimal incomeServiceBudgetTotal;
//========================成本表================================
/**
*
*/
private BigDecimal costPurchaseDeviceBudgetTotal;
/**
*
*/
private BigDecimal costPurchaseBuildBudgetTotal;
/**
*
*/
private BigDecimal costPurchaseServiceBudgetTotal;
/**
*
*/
private BigDecimal costPurchaseOtherBudgetTotal;
/**
*
*/
private BigDecimal costProjectManageBudgetTotal;
/**
*
*/
private BigDecimal costOtherBudgetTotal;
//========================管理表================================
/**
*
*/
private BigDecimal costExpropriationBudgetTotal;
/**
*
*/
private BigDecimal costCompanyManageBudgetTotal;
/**
*
*/
private BigDecimal costIncomeTaxBudgetTotal;
//========================利润率计算表================================
/**
*
*/
private BigDecimal grossProfitBudgetTotal;
/**
*
*/
private BigDecimal grossProfitProfitMargin;
/**
*
*/
private BigDecimal contributionProfitBudgetTotal;
/**
*
*/
private BigDecimal contributionProfitProfitMargin;
/**
*
*/
private BigDecimal netProfitBudgetTotal;
/**
*
*/
private BigDecimal netProfitProfitMargin;
//========================结算现金流量表================================
/**
* a
*/
private BigDecimal saleIncomeCashBudget;
/**
* b
*/
private BigDecimal taxReturnBudget;
/**
* c
*/
private BigDecimal earnestMoneyIncomeBudget;
/**
* d+
*/
private BigDecimal purchaseCostBudget;
/**
* e
*/
private BigDecimal taxCostBudget;
/**
* f
*/
private BigDecimal earnestMoneyCostBudget;
/**
* g
* g=a+c+b-d-f-e
*/
private BigDecimal netCashFlowBudget;
/**
* h
*/
private BigDecimal cashInflowFromInvestingActivitiesBudget;
/**
* i
*/
private BigDecimal cashOutflowFromInvestingActivitiesBudget;
/**
* j
*/
private BigDecimal netCashFromInvestingActivitiesBudget;
/**
* k
*/
private BigDecimal financingCapitalInflowBudget;
/**
* l
*/
private BigDecimal financingCapitalOutflowBudget;
/**
* m
* m=k-l
*/
private BigDecimal financingCapitalCashflowBudget;
/**
* n
* n=g+j+m
*/
private BigDecimal netIncreaseMonetaryFundsBudget;
public BigDecimal getIncomeDeviceBudgetTotal() {
return incomeDeviceBudgetTotal;
}
public void setIncomeDeviceBudgetTotal(BigDecimal incomeDeviceBudgetTotal) {
this.incomeDeviceBudgetTotal = incomeDeviceBudgetTotal;
}
public BigDecimal getIncomeEngineerBudgetTotal() {
return incomeEngineerBudgetTotal;
}
public void setIncomeEngineerBudgetTotal(BigDecimal incomeEngineerBudgetTotal) {
this.incomeEngineerBudgetTotal = incomeEngineerBudgetTotal;
}
public BigDecimal getIncomeServiceBudgetTotal() {
return incomeServiceBudgetTotal;
}
public void setIncomeServiceBudgetTotal(BigDecimal incomeServiceBudgetTotal) {
this.incomeServiceBudgetTotal = incomeServiceBudgetTotal;
}
public BigDecimal getCostPurchaseDeviceBudgetTotal() {
return costPurchaseDeviceBudgetTotal;
}
public void setCostPurchaseDeviceBudgetTotal(BigDecimal costPurchaseDeviceBudgetTotal) {
this.costPurchaseDeviceBudgetTotal = costPurchaseDeviceBudgetTotal;
}
public BigDecimal getCostPurchaseBuildBudgetTotal() {
return costPurchaseBuildBudgetTotal;
}
public void setCostPurchaseBuildBudgetTotal(BigDecimal costPurchaseBuildBudgetTotal) {
this.costPurchaseBuildBudgetTotal = costPurchaseBuildBudgetTotal;
}
public BigDecimal getCostPurchaseServiceBudgetTotal() {
return costPurchaseServiceBudgetTotal;
}
public void setCostPurchaseServiceBudgetTotal(BigDecimal costPurchaseServiceBudgetTotal) {
this.costPurchaseServiceBudgetTotal = costPurchaseServiceBudgetTotal;
}
public BigDecimal getCostPurchaseOtherBudgetTotal() {
return costPurchaseOtherBudgetTotal;
}
public void setCostPurchaseOtherBudgetTotal(BigDecimal costPurchaseOtherBudgetTotal) {
this.costPurchaseOtherBudgetTotal = costPurchaseOtherBudgetTotal;
}
public BigDecimal getCostProjectManageBudgetTotal() {
return costProjectManageBudgetTotal;
}
public void setCostProjectManageBudgetTotal(BigDecimal costProjectManageBudgetTotal) {
this.costProjectManageBudgetTotal = costProjectManageBudgetTotal;
}
public BigDecimal getCostOtherBudgetTotal() {
return (costOtherBudgetTotal == null)?BigDecimal.ZERO:costOtherBudgetTotal;
}
public void setCostOtherBudgetTotal(BigDecimal costOtherBudgetTotal) {
this.costOtherBudgetTotal = costOtherBudgetTotal;
}
public BigDecimal getCostExpropriationBudgetTotal() {
return costExpropriationBudgetTotal;
}
public void setCostExpropriationBudgetTotal(BigDecimal costExpropriationBudgetTotal) {
this.costExpropriationBudgetTotal = costExpropriationBudgetTotal;
}
public BigDecimal getCostCompanyManageBudgetTotal() {
return costCompanyManageBudgetTotal;
}
public void setCostCompanyManageBudgetTotal(BigDecimal costCompanyManageBudgetTotal) {
this.costCompanyManageBudgetTotal = costCompanyManageBudgetTotal;
}
public BigDecimal getCostIncomeTaxBudgetTotal() {
return costIncomeTaxBudgetTotal;
}
public void setCostIncomeTaxBudgetTotal(BigDecimal costIncomeTaxBudgetTotal) {
this.costIncomeTaxBudgetTotal = costIncomeTaxBudgetTotal;
}
public BigDecimal getGrossProfitBudgetTotal() {
return grossProfitBudgetTotal;
}
public void setGrossProfitBudgetTotal(BigDecimal grossProfitBudgetTotal) {
this.grossProfitBudgetTotal = grossProfitBudgetTotal;
}
public BigDecimal getGrossProfitProfitMargin() {
return grossProfitProfitMargin;
}
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
this.grossProfitProfitMargin = grossProfitProfitMargin;
}
public BigDecimal getContributionProfitBudgetTotal() {
return contributionProfitBudgetTotal;
}
public void setContributionProfitBudgetTotal(BigDecimal contributionProfitBudgetTotal) {
this.contributionProfitBudgetTotal = contributionProfitBudgetTotal;
}
public BigDecimal getContributionProfitProfitMargin() {
return contributionProfitProfitMargin;
}
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
}
public BigDecimal getNetProfitBudgetTotal() {
return netProfitBudgetTotal;
}
public void setNetProfitBudgetTotal(BigDecimal netProfitBudgetTotal) {
this.netProfitBudgetTotal = netProfitBudgetTotal;
}
public BigDecimal getNetProfitProfitMargin() {
return netProfitProfitMargin;
}
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
this.netProfitProfitMargin = netProfitProfitMargin;
}
public BigDecimal getSaleIncomeCashBudget() {
return saleIncomeCashBudget;
}
public void setSaleIncomeCashBudget(BigDecimal saleIncomeCashBudget) {
this.saleIncomeCashBudget = saleIncomeCashBudget;
}
public BigDecimal getTaxReturnBudget() {
return taxReturnBudget;
}
public void setTaxReturnBudget(BigDecimal taxReturnBudget) {
this.taxReturnBudget = taxReturnBudget;
}
public BigDecimal getEarnestMoneyIncomeBudget() {
return earnestMoneyIncomeBudget;
}
public void setEarnestMoneyIncomeBudget(BigDecimal earnestMoneyIncomeBudget) {
this.earnestMoneyIncomeBudget = earnestMoneyIncomeBudget;
}
public BigDecimal getPurchaseCostBudget() {
return purchaseCostBudget;
}
public void setPurchaseCostBudget(BigDecimal purchaseCostBudget) {
this.purchaseCostBudget = purchaseCostBudget;
}
public BigDecimal getTaxCostBudget() {
return taxCostBudget;
}
public void setTaxCostBudget(BigDecimal taxCostBudget) {
this.taxCostBudget = taxCostBudget;
}
public BigDecimal getEarnestMoneyCostBudget() {
return earnestMoneyCostBudget;
}
public void setEarnestMoneyCostBudget(BigDecimal earnestMoneyCostBudget) {
this.earnestMoneyCostBudget = earnestMoneyCostBudget;
}
public BigDecimal getNetCashFlowBudget() {
return netCashFlowBudget;
}
public void setNetCashFlowBudget(BigDecimal netCashFlowBudget) {
this.netCashFlowBudget = netCashFlowBudget;
}
public BigDecimal getCashInflowFromInvestingActivitiesBudget() {
return cashInflowFromInvestingActivitiesBudget;
}
public void setCashInflowFromInvestingActivitiesBudget(BigDecimal cashInflowFromInvestingActivitiesBudget) {
this.cashInflowFromInvestingActivitiesBudget = cashInflowFromInvestingActivitiesBudget;
}
public BigDecimal getCashOutflowFromInvestingActivitiesBudget() {
return cashOutflowFromInvestingActivitiesBudget;
}
public void setCashOutflowFromInvestingActivitiesBudget(BigDecimal cashOutflowFromInvestingActivitiesBudget) {
this.cashOutflowFromInvestingActivitiesBudget = cashOutflowFromInvestingActivitiesBudget;
}
public BigDecimal getNetCashFromInvestingActivitiesBudget() {
return netCashFromInvestingActivitiesBudget;
}
public void setNetCashFromInvestingActivitiesBudget(BigDecimal netCashFromInvestingActivitiesBudget) {
this.netCashFromInvestingActivitiesBudget = netCashFromInvestingActivitiesBudget;
}
public BigDecimal getFinancingCapitalInflowBudget() {
return financingCapitalInflowBudget;
}
public void setFinancingCapitalInflowBudget(BigDecimal financingCapitalInflowBudget) {
this.financingCapitalInflowBudget = financingCapitalInflowBudget;
}
public BigDecimal getFinancingCapitalOutflowBudget() {
return financingCapitalOutflowBudget;
}
public void setFinancingCapitalOutflowBudget(BigDecimal financingCapitalOutflowBudget) {
this.financingCapitalOutflowBudget = financingCapitalOutflowBudget;
}
public BigDecimal getFinancingCapitalCashflowBudget() {
return financingCapitalCashflowBudget;
}
public void setFinancingCapitalCashflowBudget(BigDecimal financingCapitalCashflowBudget) {
this.financingCapitalCashflowBudget = financingCapitalCashflowBudget;
}
public BigDecimal getNetIncreaseMonetaryFundsBudget() {
return netIncreaseMonetaryFundsBudget;
}
public void setNetIncreaseMonetaryFundsBudget(BigDecimal netIncreaseMonetaryFundsBudget) {
this.netIncreaseMonetaryFundsBudget = netIncreaseMonetaryFundsBudget;
}
}

View File

@ -1,229 +1,229 @@
package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
*
* @author xiongshiyan at 2021/11/6 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class CashFlowBean {
/**
* a
* */
private BigDecimal saleIncomeCash;
/**
* b
* */
private BigDecimal taxReturn;
/**
* c
*/
private BigDecimal earnestMoneyIncome;
/**
* d+
*/
private BigDecimal purchaseCost;
/**
* e
*/
private BigDecimal taxCost;
/**
*f
*/
private BigDecimal earnestMoneyCost;
/**
* g
* g=a+c+b-d-f-e
*/
//private BigDecimal netCashFlow;
/**
* h
*/
private BigDecimal cashInflowFromInvestingActivities;
/**
* i
*/
private BigDecimal cashOutflowFromInvestingActivities;
/**
* j
*/
private BigDecimal netCashFromInvestingActivities;
/**
* k
*/
private BigDecimal financingCapitalInflow;
/**
* l
*/
private BigDecimal financingCapitalOutflow;
/**
*m
* m=k-l
*/
//private BigDecimal financingCapitalCashflow;
/**
* n
* n=g+j+m
*/
//private BigDecimal netIncreaseMonetaryFunds;
public BigDecimal getSaleIncomeCash() {
return handleSpecial(saleIncomeCash);
}
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
this.saleIncomeCash = saleIncomeCash;
}
public BigDecimal getTaxReturn() {
return handleSpecial(taxReturn);
}
public void setTaxReturn(BigDecimal taxReturn) {
this.taxReturn = taxReturn;
}
public BigDecimal getEarnestMoneyIncome() {
return handleSpecial(earnestMoneyIncome);
}
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
this.earnestMoneyIncome = earnestMoneyIncome;
}
public BigDecimal getPurchaseCost() {
return handleSpecial(purchaseCost);
}
public void setPurchaseCost(BigDecimal purchaseCost) {
this.purchaseCost = purchaseCost;
}
public BigDecimal getTaxCost() {
return handleSpecial(taxCost);
}
public void setTaxCost(BigDecimal taxCost) {
this.taxCost = taxCost;
}
public BigDecimal getEarnestMoneyCost() {
return handleSpecial(earnestMoneyCost);
}
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
this.earnestMoneyCost = earnestMoneyCost;
}
public BigDecimal getNetCashFlow() {
BigDecimal saleIncomeCash = getSaleIncomeCash();
BigDecimal taxReturn = getTaxReturn();
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
BigDecimal purchaseCost = getPurchaseCost();
BigDecimal taxCost = getTaxCost();
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
return saleIncomeCash
.add(taxReturn)
.add(earnestMoneyIncome)
.subtract(purchaseCost)
.subtract(taxCost)
.subtract(earnestMoneyCost);
}
public BigDecimal getCashInflowFromInvestingActivities() {
return handleSpecial(cashInflowFromInvestingActivities);
}
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
}
public BigDecimal getCashOutflowFromInvestingActivities() {
return handleSpecial(cashOutflowFromInvestingActivities);
}
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
}
public BigDecimal getNetCashFromInvestingActivities() {
return handleSpecial(netCashFromInvestingActivities);
}
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
}
public BigDecimal getFinancingCapitalInflow() {
return handleSpecial(financingCapitalInflow);
}
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
this.financingCapitalInflow = financingCapitalInflow;
}
public BigDecimal getFinancingCapitalOutflow() {
return handleSpecial(financingCapitalOutflow);
}
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
this.financingCapitalOutflow = financingCapitalOutflow;
}
public BigDecimal getFinancingCapitalCashflow() {
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
return financingCapitalInflow.subtract(financingCapitalOutflow);
}
public BigDecimal getNetIncreaseMonetaryFunds() {
BigDecimal netCashFlow = getNetCashFlow();
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
return netCashFlow
.add(netCashFromInvestingActivities)
.add(financingCapitalCashflow);
}
/**
*
* @return
*/
public BigDecimal getCashFluxTotal() {
BigDecimal saleIncomeCash = getSaleIncomeCash();
BigDecimal taxReturn = getTaxReturn();
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
BigDecimal purchaseCost = getPurchaseCost();
BigDecimal taxCost = getTaxCost();
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
BigDecimal netCashFlow = getNetCashFlow();
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
return new BigDecimal(0);
}
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
}
/**
*
* null0
*/
protected BigDecimal handleSpecial(BigDecimal src) {
return null == src ? new BigDecimal(0) : src;
}
}
package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
*
* @author xiongshiyan at 2021/11/6 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class CashFlowBean {
/**
* a
* */
private BigDecimal saleIncomeCash;
/**
* b
* */
private BigDecimal taxReturn;
/**
* c
*/
private BigDecimal earnestMoneyIncome;
/**
* d+
*/
private BigDecimal purchaseCost;
/**
* e
*/
private BigDecimal taxCost;
/**
*f
*/
private BigDecimal earnestMoneyCost;
/**
* g
* g=a+c+b-d-f-e
*/
//private BigDecimal netCashFlow;
/**
* h
*/
private BigDecimal cashInflowFromInvestingActivities;
/**
* i
*/
private BigDecimal cashOutflowFromInvestingActivities;
/**
* j
*/
private BigDecimal netCashFromInvestingActivities;
/**
* k
*/
private BigDecimal financingCapitalInflow;
/**
* l
*/
private BigDecimal financingCapitalOutflow;
/**
*m
* m=k-l
*/
//private BigDecimal financingCapitalCashflow;
/**
* n
* n=g+j+m
*/
//private BigDecimal netIncreaseMonetaryFunds;
public BigDecimal getSaleIncomeCash() {
return handleSpecial(saleIncomeCash);
}
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
this.saleIncomeCash = saleIncomeCash;
}
public BigDecimal getTaxReturn() {
return handleSpecial(taxReturn);
}
public void setTaxReturn(BigDecimal taxReturn) {
this.taxReturn = taxReturn;
}
public BigDecimal getEarnestMoneyIncome() {
return handleSpecial(earnestMoneyIncome);
}
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
this.earnestMoneyIncome = earnestMoneyIncome;
}
public BigDecimal getPurchaseCost() {
return handleSpecial(purchaseCost);
}
public void setPurchaseCost(BigDecimal purchaseCost) {
this.purchaseCost = purchaseCost;
}
public BigDecimal getTaxCost() {
return handleSpecial(taxCost);
}
public void setTaxCost(BigDecimal taxCost) {
this.taxCost = taxCost;
}
public BigDecimal getEarnestMoneyCost() {
return handleSpecial(earnestMoneyCost);
}
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
this.earnestMoneyCost = earnestMoneyCost;
}
public BigDecimal getNetCashFlow() {
BigDecimal saleIncomeCash = getSaleIncomeCash();
BigDecimal taxReturn = getTaxReturn();
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
BigDecimal purchaseCost = getPurchaseCost();
BigDecimal taxCost = getTaxCost();
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
return saleIncomeCash
.add(taxReturn)
.add(earnestMoneyIncome)
.subtract(purchaseCost)
.subtract(taxCost)
.subtract(earnestMoneyCost);
}
public BigDecimal getCashInflowFromInvestingActivities() {
return handleSpecial(cashInflowFromInvestingActivities);
}
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
}
public BigDecimal getCashOutflowFromInvestingActivities() {
return handleSpecial(cashOutflowFromInvestingActivities);
}
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
}
public BigDecimal getNetCashFromInvestingActivities() {
return handleSpecial(netCashFromInvestingActivities);
}
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
}
public BigDecimal getFinancingCapitalInflow() {
return handleSpecial(financingCapitalInflow);
}
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
this.financingCapitalInflow = financingCapitalInflow;
}
public BigDecimal getFinancingCapitalOutflow() {
return handleSpecial(financingCapitalOutflow);
}
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
this.financingCapitalOutflow = financingCapitalOutflow;
}
public BigDecimal getFinancingCapitalCashflow() {
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
return financingCapitalInflow.subtract(financingCapitalOutflow);
}
public BigDecimal getNetIncreaseMonetaryFunds() {
BigDecimal netCashFlow = getNetCashFlow();
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
return netCashFlow
.add(netCashFromInvestingActivities)
.add(financingCapitalCashflow);
}
/**
*
* @return
*/
public BigDecimal getCashFluxTotal() {
BigDecimal saleIncomeCash = getSaleIncomeCash();
BigDecimal taxReturn = getTaxReturn();
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
BigDecimal purchaseCost = getPurchaseCost();
BigDecimal taxCost = getTaxCost();
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
BigDecimal netCashFlow = getNetCashFlow();
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
return new BigDecimal(0);
}
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
}
/**
*
* null0
*/
protected BigDecimal handleSpecial(BigDecimal src) {
return null == src ? new BigDecimal(0) : src;
}
}

View File

@ -1,71 +1,71 @@
package cn.palmte.work.bean;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class CashFlowStatisticsBean {
private String title;
/**
* a
* */
private BigDecimal saleIncomeCash;
/**
* b
* */
private BigDecimal taxReturn;
/**
* c
*/
private BigDecimal earnestMoneyIncome;
/**
* d+
*/
private BigDecimal purchaseCost;
/**
* e
*/
private BigDecimal taxCost;
/**
*f
*/
private BigDecimal earnestMoneyCost;
/**
* g
* g=a+c+b-d-f-e
*/
private BigDecimal netCashFlow;
/**
* h
*/
private BigDecimal cashInflowFromInvestingActivities;
/**
* i
*/
private BigDecimal cashOutflowFromInvestingActivities;
/**
* j
*/
private BigDecimal netCashFromInvestingActivities;
/**
* k
*/
private BigDecimal financingCapitalInflow;
/**
* l
*/
private BigDecimal financingCapitalOutflow;
/**
*m
* m=k-l
*/
private BigDecimal financingCapitalCashflow;
/**
* n
* n=g+j+m
*/
private BigDecimal netIncreaseMonetaryFunds;
}
package cn.palmte.work.bean;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class CashFlowStatisticsBean {
private String title;
/**
* a
* */
private BigDecimal saleIncomeCash;
/**
* b
* */
private BigDecimal taxReturn;
/**
* c
*/
private BigDecimal earnestMoneyIncome;
/**
* d+
*/
private BigDecimal purchaseCost;
/**
* e
*/
private BigDecimal taxCost;
/**
*f
*/
private BigDecimal earnestMoneyCost;
/**
* g
* g=a+c+b-d-f-e
*/
private BigDecimal netCashFlow;
/**
* h
*/
private BigDecimal cashInflowFromInvestingActivities;
/**
* i
*/
private BigDecimal cashOutflowFromInvestingActivities;
/**
* j
*/
private BigDecimal netCashFromInvestingActivities;
/**
* k
*/
private BigDecimal financingCapitalInflow;
/**
* l
*/
private BigDecimal financingCapitalOutflow;
/**
*m
* m=k-l
*/
private BigDecimal financingCapitalCashflow;
/**
* n
* n=g+j+m
*/
private BigDecimal netIncreaseMonetaryFunds;
}

View File

@ -1,48 +1,48 @@
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum CertaintyEnum {
PLAN_O(-1,""),
PLAN_A(1,"A项目成功率80%-100%"),
PLAN_B(2,"B项目成功率60%-80%"),
PLAN_C(3,"C项目成功率40%-60%");
private int certainty;
private String certaintyStr;
private CertaintyEnum(int certainty, String certaintyStr) {
this.certainty = certainty;
this.certaintyStr = certaintyStr;
}
public int getCertainty() {
return certainty;
}
public void setCertainty(int certainty) {
this.certainty = certainty;
}
public String getCertaintyStr() {
return certaintyStr;
}
public void setCertaintyStr(String certaintyStr) {
this.certaintyStr = certaintyStr;
}
public static CertaintyEnum parseCertainty(int certainty){
if(certainty == 1){
return PLAN_A;
}
if(certainty == 2){
return PLAN_B;
}
if(certainty == 3){
return PLAN_C;
}
throw new IllegalArgumentException("Unkown certainty:"+certainty);
}
}
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum CertaintyEnum {
PLAN_O(-1,""),
PLAN_A(1,"A项目成功率80%-100%"),
PLAN_B(2,"B项目成功率60%-80%"),
PLAN_C(3,"C项目成功率40%-60%");
private int certainty;
private String certaintyStr;
private CertaintyEnum(int certainty, String certaintyStr) {
this.certainty = certainty;
this.certaintyStr = certaintyStr;
}
public int getCertainty() {
return certainty;
}
public void setCertainty(int certainty) {
this.certainty = certainty;
}
public String getCertaintyStr() {
return certaintyStr;
}
public void setCertaintyStr(String certaintyStr) {
this.certaintyStr = certaintyStr;
}
public static CertaintyEnum parseCertainty(int certainty){
if(certainty == 1){
return PLAN_A;
}
if(certainty == 2){
return PLAN_B;
}
if(certainty == 3){
return PLAN_C;
}
throw new IllegalArgumentException("Unkown certainty:"+certainty);
}
}

View File

@ -1,41 +1,41 @@
package cn.palmte.work.bean;
/**
*
* @author xiongshiyan
*/
public class Constant {
public static final String DATA = "Data";
public static final int ROLE_TYPE_SUPER_ADMIN = 0; // 系统管理员
public static final int ROLE_TYPE_CMCC_ADMIN = 1;// 移动管理员
public static final int ROLE_TYPE_ZJPT_ADMIN = 2; //资金平台管理员
private Constant(){}
/**
*
*/
public static final class Status {
private Status() {
}
/**
*
*/
public static final int STATUS_SUCCESS = 0;
/**
*
*/
public static final int STATUS_FAILED = 1;
/**
*
*/
public static final int STATUS_EXCEPTION = 2;
/**
*
*/
public static final int STATUS_PROMPT_LOGIN = 1009;
}
}
package cn.palmte.work.bean;
/**
*
* @author xiongshiyan
*/
public class Constant {
public static final String DATA = "Data";
public static final int ROLE_TYPE_SUPER_ADMIN = 0; // 系统管理员
public static final int ROLE_TYPE_CMCC_ADMIN = 1;// 移动管理员
public static final int ROLE_TYPE_ZJPT_ADMIN = 2; //资金平台管理员
private Constant(){}
/**
*
*/
public static final class Status {
private Status() {
}
/**
*
*/
public static final int STATUS_SUCCESS = 0;
/**
*
*/
public static final int STATUS_FAILED = 1;
/**
*
*/
public static final int STATUS_EXCEPTION = 2;
/**
*
*/
public static final int STATUS_PROMPT_LOGIN = 1009;
}
}

View File

@ -1,44 +1,44 @@
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum CooperateTypeEnum {
PLAN_O(-1,""),
PLAN_A(1,"战略合作类"),
PLAN_B(2,"非战略合作类");
private int cooperateType;
private String cooperateTypeStr;
private CooperateTypeEnum(int cooperateType, String cooperateTypeStr) {
this.cooperateType = cooperateType;
this.cooperateTypeStr = cooperateTypeStr;
}
public int getCooperateType() {
return cooperateType;
}
public void setCooperateType(int cooperateType) {
this.cooperateType = cooperateType;
}
public String getCooperateTypeStr() {
return cooperateTypeStr;
}
public void setCooperateTypeStr(String cooperateTypeStr) {
this.cooperateTypeStr = cooperateTypeStr;
}
public static CooperateTypeEnum parseCooperateType(int cooperateType){
if(cooperateType == 1){
return PLAN_A;
}
if(cooperateType == 2){
return PLAN_B;
}
throw new IllegalArgumentException("Unkown cooperateType:"+cooperateType);
}
}
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum CooperateTypeEnum {
PLAN_O(-1,""),
PLAN_A(1,"战略合作类"),
PLAN_B(2,"非战略合作类");
private int cooperateType;
private String cooperateTypeStr;
private CooperateTypeEnum(int cooperateType, String cooperateTypeStr) {
this.cooperateType = cooperateType;
this.cooperateTypeStr = cooperateTypeStr;
}
public int getCooperateType() {
return cooperateType;
}
public void setCooperateType(int cooperateType) {
this.cooperateType = cooperateType;
}
public String getCooperateTypeStr() {
return cooperateTypeStr;
}
public void setCooperateTypeStr(String cooperateTypeStr) {
this.cooperateTypeStr = cooperateTypeStr;
}
public static CooperateTypeEnum parseCooperateType(int cooperateType){
if(cooperateType == 1){
return PLAN_A;
}
if(cooperateType == 2){
return PLAN_B;
}
throw new IllegalArgumentException("Unkown cooperateType:"+cooperateType);
}
}

View File

@ -1,17 +1,17 @@
package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
*
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class EstimateBean extends IncomeCostBean{
/**
*
*/
@Override
protected BigDecimal handleSpecial(BigDecimal src) {
return null == src ? new BigDecimal(0) : src;
}
}
package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
*
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class EstimateBean extends IncomeCostBean{
/**
*
*/
@Override
protected BigDecimal handleSpecial(BigDecimal src) {
return null == src ? new BigDecimal(0) : src;
}
}

View File

@ -1,250 +1,250 @@
package cn.palmte.work.bean;
import java.math.BigDecimal;
public class EstimateSettleBean {
//========================收入表================================
/**
*
*/
private BigDecimal incomeDeviceEstimateTotal;
/**
*
*/
private BigDecimal incomeEngineerEstimateTotal;
/**
*
*/
private BigDecimal incomeServiceEstimateTotal;
//========================成本表================================
/**
*
*/
private BigDecimal costPurchaseDeviceEstimateTotal;
/**
*
*/
private BigDecimal costPurchaseBuildEstimateTotal;
/**
*
*/
private BigDecimal costPurchaseServiceEstimateTotal;
/**
*
*/
private BigDecimal costPurchaseOtherEstimateTotal;
/**
*
*/
private BigDecimal costProjectManageEstimateTotal;
/**
*
*/
private BigDecimal costOtherEstimateTotal;
//========================管理表================================
/**
*
*/
private BigDecimal costExpropriationEstimateTotal;
/**
*
*/
private BigDecimal costCompanyManageEstimateTotal;
/**
*
*/
private BigDecimal costIncomeTaxEstimateTotal;
//========================利润率计算表================================
/**
*
*/
private BigDecimal grossProfitEstimateTotal;
/**
*
*/
private BigDecimal grossProfitProfitMargin;
/**
*
*/
private BigDecimal contributionProfitEstimateTotal;
/**
*
*/
private BigDecimal contributionProfitProfitMargin;
/**
*
*/
private BigDecimal netProfitEstimateTotal;
/**
*
*/
private BigDecimal netProfitProfitMargin;
public BigDecimal getIncomeDeviceEstimateTotal() {
return incomeDeviceEstimateTotal;
}
public void setIncomeDeviceEstimateTotal(BigDecimal incomeDeviceEstimateTotal) {
this.incomeDeviceEstimateTotal = incomeDeviceEstimateTotal;
}
public BigDecimal getIncomeEngineerEstimateTotal() {
return incomeEngineerEstimateTotal;
}
public void setIncomeEngineerEstimateTotal(BigDecimal incomeEngineerEstimateTotal) {
this.incomeEngineerEstimateTotal = incomeEngineerEstimateTotal;
}
public BigDecimal getIncomeServiceEstimateTotal() {
return incomeServiceEstimateTotal;
}
public void setIncomeServiceEstimateTotal(BigDecimal incomeServiceEstimateTotal) {
this.incomeServiceEstimateTotal = incomeServiceEstimateTotal;
}
public BigDecimal getCostPurchaseDeviceEstimateTotal() {
return costPurchaseDeviceEstimateTotal;
}
public void setCostPurchaseDeviceEstimateTotal(BigDecimal costPurchaseDeviceEstimateTotal) {
this.costPurchaseDeviceEstimateTotal = costPurchaseDeviceEstimateTotal;
}
public BigDecimal getCostPurchaseBuildEstimateTotal() {
return costPurchaseBuildEstimateTotal;
}
public void setCostPurchaseBuildEstimateTotal(BigDecimal costPurchaseBuildEstimateTotal) {
this.costPurchaseBuildEstimateTotal = costPurchaseBuildEstimateTotal;
}
public BigDecimal getCostPurchaseServiceEstimateTotal() {
return costPurchaseServiceEstimateTotal;
}
public void setCostPurchaseServiceEstimateTotal(BigDecimal costPurchaseServiceEstimateTotal) {
this.costPurchaseServiceEstimateTotal = costPurchaseServiceEstimateTotal;
}
public BigDecimal getCostPurchaseOtherEstimateTotal() {
return costPurchaseOtherEstimateTotal;
}
public void setCostPurchaseOtherEstimateTotal(BigDecimal costPurchaseOtherEstimateTotal) {
this.costPurchaseOtherEstimateTotal = costPurchaseOtherEstimateTotal;
}
public BigDecimal getCostProjectManageEstimateTotal() {
return costProjectManageEstimateTotal;
}
public void setCostProjectManageEstimateTotal(BigDecimal costProjectManageEstimateTotal) {
this.costProjectManageEstimateTotal = costProjectManageEstimateTotal;
}
public BigDecimal getCostOtherEstimateTotal() {
return (costOtherEstimateTotal == null)?BigDecimal.ZERO:costOtherEstimateTotal;
}
public void setCostOtherEstimateTotal(BigDecimal costOtherEstimateTotal) {
this.costOtherEstimateTotal = costOtherEstimateTotal;
}
public BigDecimal getCostExpropriationEstimateTotal() {
return costExpropriationEstimateTotal;
}
public void setCostExpropriationEstimateTotal(BigDecimal costExpropriationEstimateTotal) {
this.costExpropriationEstimateTotal = costExpropriationEstimateTotal;
}
public BigDecimal getCostCompanyManageEstimateTotal() {
return costCompanyManageEstimateTotal;
}
public void setCostCompanyManageEstimateTotal(BigDecimal costCompanyManageEstimateTotal) {
this.costCompanyManageEstimateTotal = costCompanyManageEstimateTotal;
}
public BigDecimal getCostIncomeTaxEstimateTotal() {
return costIncomeTaxEstimateTotal;
}
public void setCostIncomeTaxEstimateTotal(BigDecimal costIncomeTaxEstimateTotal) {
this.costIncomeTaxEstimateTotal = costIncomeTaxEstimateTotal;
}
public BigDecimal getGrossProfitEstimateTotal() {
return grossProfitEstimateTotal;
}
public void setGrossProfitEstimateTotal(BigDecimal grossProfitEstimateTotal) {
this.grossProfitEstimateTotal = grossProfitEstimateTotal;
}
public BigDecimal getGrossProfitProfitMargin() {
return grossProfitProfitMargin;
}
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
this.grossProfitProfitMargin = grossProfitProfitMargin;
}
public BigDecimal getContributionProfitEstimateTotal() {
return contributionProfitEstimateTotal;
}
public void setContributionProfitEstimateTotal(BigDecimal contributionProfitEstimateTotal) {
this.contributionProfitEstimateTotal = contributionProfitEstimateTotal;
}
public BigDecimal getContributionProfitProfitMargin() {
return contributionProfitProfitMargin;
}
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
}
public BigDecimal getNetProfitEstimateTotal() {
return netProfitEstimateTotal;
}
public void setNetProfitEstimateTotal(BigDecimal netProfitEstimateTotal) {
this.netProfitEstimateTotal = netProfitEstimateTotal;
}
public BigDecimal getNetProfitProfitMargin() {
return netProfitProfitMargin;
}
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
this.netProfitProfitMargin = netProfitProfitMargin;
}
}
package cn.palmte.work.bean;
import java.math.BigDecimal;
public class EstimateSettleBean {
//========================收入表================================
/**
*
*/
private BigDecimal incomeDeviceEstimateTotal;
/**
*
*/
private BigDecimal incomeEngineerEstimateTotal;
/**
*
*/
private BigDecimal incomeServiceEstimateTotal;
//========================成本表================================
/**
*
*/
private BigDecimal costPurchaseDeviceEstimateTotal;
/**
*
*/
private BigDecimal costPurchaseBuildEstimateTotal;
/**
*
*/
private BigDecimal costPurchaseServiceEstimateTotal;
/**
*
*/
private BigDecimal costPurchaseOtherEstimateTotal;
/**
*
*/
private BigDecimal costProjectManageEstimateTotal;
/**
*
*/
private BigDecimal costOtherEstimateTotal;
//========================管理表================================
/**
*
*/
private BigDecimal costExpropriationEstimateTotal;
/**
*
*/
private BigDecimal costCompanyManageEstimateTotal;
/**
*
*/
private BigDecimal costIncomeTaxEstimateTotal;
//========================利润率计算表================================
/**
*
*/
private BigDecimal grossProfitEstimateTotal;
/**
*
*/
private BigDecimal grossProfitProfitMargin;
/**
*
*/
private BigDecimal contributionProfitEstimateTotal;
/**
*
*/
private BigDecimal contributionProfitProfitMargin;
/**
*
*/
private BigDecimal netProfitEstimateTotal;
/**
*
*/
private BigDecimal netProfitProfitMargin;
public BigDecimal getIncomeDeviceEstimateTotal() {
return incomeDeviceEstimateTotal;
}
public void setIncomeDeviceEstimateTotal(BigDecimal incomeDeviceEstimateTotal) {
this.incomeDeviceEstimateTotal = incomeDeviceEstimateTotal;
}
public BigDecimal getIncomeEngineerEstimateTotal() {
return incomeEngineerEstimateTotal;
}
public void setIncomeEngineerEstimateTotal(BigDecimal incomeEngineerEstimateTotal) {
this.incomeEngineerEstimateTotal = incomeEngineerEstimateTotal;
}
public BigDecimal getIncomeServiceEstimateTotal() {
return incomeServiceEstimateTotal;
}
public void setIncomeServiceEstimateTotal(BigDecimal incomeServiceEstimateTotal) {
this.incomeServiceEstimateTotal = incomeServiceEstimateTotal;
}
public BigDecimal getCostPurchaseDeviceEstimateTotal() {
return costPurchaseDeviceEstimateTotal;
}
public void setCostPurchaseDeviceEstimateTotal(BigDecimal costPurchaseDeviceEstimateTotal) {
this.costPurchaseDeviceEstimateTotal = costPurchaseDeviceEstimateTotal;
}
public BigDecimal getCostPurchaseBuildEstimateTotal() {
return costPurchaseBuildEstimateTotal;
}
public void setCostPurchaseBuildEstimateTotal(BigDecimal costPurchaseBuildEstimateTotal) {
this.costPurchaseBuildEstimateTotal = costPurchaseBuildEstimateTotal;
}
public BigDecimal getCostPurchaseServiceEstimateTotal() {
return costPurchaseServiceEstimateTotal;
}
public void setCostPurchaseServiceEstimateTotal(BigDecimal costPurchaseServiceEstimateTotal) {
this.costPurchaseServiceEstimateTotal = costPurchaseServiceEstimateTotal;
}
public BigDecimal getCostPurchaseOtherEstimateTotal() {
return costPurchaseOtherEstimateTotal;
}
public void setCostPurchaseOtherEstimateTotal(BigDecimal costPurchaseOtherEstimateTotal) {
this.costPurchaseOtherEstimateTotal = costPurchaseOtherEstimateTotal;
}
public BigDecimal getCostProjectManageEstimateTotal() {
return costProjectManageEstimateTotal;
}
public void setCostProjectManageEstimateTotal(BigDecimal costProjectManageEstimateTotal) {
this.costProjectManageEstimateTotal = costProjectManageEstimateTotal;
}
public BigDecimal getCostOtherEstimateTotal() {
return (costOtherEstimateTotal == null)?BigDecimal.ZERO:costOtherEstimateTotal;
}
public void setCostOtherEstimateTotal(BigDecimal costOtherEstimateTotal) {
this.costOtherEstimateTotal = costOtherEstimateTotal;
}
public BigDecimal getCostExpropriationEstimateTotal() {
return costExpropriationEstimateTotal;
}
public void setCostExpropriationEstimateTotal(BigDecimal costExpropriationEstimateTotal) {
this.costExpropriationEstimateTotal = costExpropriationEstimateTotal;
}
public BigDecimal getCostCompanyManageEstimateTotal() {
return costCompanyManageEstimateTotal;
}
public void setCostCompanyManageEstimateTotal(BigDecimal costCompanyManageEstimateTotal) {
this.costCompanyManageEstimateTotal = costCompanyManageEstimateTotal;
}
public BigDecimal getCostIncomeTaxEstimateTotal() {
return costIncomeTaxEstimateTotal;
}
public void setCostIncomeTaxEstimateTotal(BigDecimal costIncomeTaxEstimateTotal) {
this.costIncomeTaxEstimateTotal = costIncomeTaxEstimateTotal;
}
public BigDecimal getGrossProfitEstimateTotal() {
return grossProfitEstimateTotal;
}
public void setGrossProfitEstimateTotal(BigDecimal grossProfitEstimateTotal) {
this.grossProfitEstimateTotal = grossProfitEstimateTotal;
}
public BigDecimal getGrossProfitProfitMargin() {
return grossProfitProfitMargin;
}
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
this.grossProfitProfitMargin = grossProfitProfitMargin;
}
public BigDecimal getContributionProfitEstimateTotal() {
return contributionProfitEstimateTotal;
}
public void setContributionProfitEstimateTotal(BigDecimal contributionProfitEstimateTotal) {
this.contributionProfitEstimateTotal = contributionProfitEstimateTotal;
}
public BigDecimal getContributionProfitProfitMargin() {
return contributionProfitProfitMargin;
}
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
}
public BigDecimal getNetProfitEstimateTotal() {
return netProfitEstimateTotal;
}
public void setNetProfitEstimateTotal(BigDecimal netProfitEstimateTotal) {
this.netProfitEstimateTotal = netProfitEstimateTotal;
}
public BigDecimal getNetProfitProfitMargin() {
return netProfitProfitMargin;
}
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
this.netProfitProfitMargin = netProfitProfitMargin;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,397 +1,397 @@
package cn.palmte.work.bean;
import java.math.BigDecimal;
import java.math.RoundingMode;
/**
* @author Yuanping Zhang
* @date 2021/11/15
*/
public class FormerBean extends IncomeCostBean {
/**
*
*/
private BigDecimal costIncomeTax;
/**
*
*/
private BigDecimal costManageTotal;
/**
*
*/
private BigDecimal grossProfit;
/**
*
*/
private BigDecimal grossProfitMargin;
/**
*
*/
private BigDecimal contributionProfit;
/**
*
*/
private BigDecimal contributionProfitMargin;
/**
*
*/
private BigDecimal netProfit;
/**
*
*/
private BigDecimal netProfitMargin;
/**
* a
*/
private BigDecimal saleIncomeCash;
/**
* b
*/
private BigDecimal taxReturn;
/**
* c
*/
private BigDecimal earnestMoneyIncome;
/**
* d+
*/
private BigDecimal purchaseCost;
/**
* e
*/
private BigDecimal taxCost;
/**
* f
*/
private BigDecimal earnestMoneyCost;
/**
* g
*/
private BigDecimal netCashFlow;
/**
* h
*/
private BigDecimal cashInflowFromInvestingActivities;
/**
* i
*/
private BigDecimal cashOutflowFromInvestingActivities;
/**
* j
*/
private BigDecimal netCashFromInvestingActivities;
/**
* k
*/
private BigDecimal financingCapitalInflow;
/**
* l
*/
private BigDecimal financingCapitalOutflow;
/**
* m
*/
private BigDecimal financingCapitalCashflow;
/**
* n
*/
private BigDecimal netIncreaseMonetaryFunds;
/**
*
*/
private BigDecimal cashFlowTotal;
/**
*
*/
private BigDecimal grossProfitProfitMargin;
public BigDecimal getGrossProfitProfitMargin() {
// 100 * grossProfit() / getIncomeTotalTaxExclude()
BigDecimal grossProfit = getGrossProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == grossProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
}
return grossProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
this.grossProfitProfitMargin = grossProfitProfitMargin;
}
/**
*
*/
private BigDecimal contributionProfitProfitMargin;
public BigDecimal getContributionProfitProfitMargin() {
//100 * contributionProfit() / getIncomeTotalTaxExclude()
BigDecimal contributionProfit = getContributionProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == contributionProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
}
return contributionProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
}
/**
*
*/
private BigDecimal netProfitProfitMargin;
public BigDecimal getNetProfitProfitMargin() {
//100 * netProfit() / getIncomeTotalTaxExclude()
BigDecimal netProfit = getNetProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == netProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
}
return netProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
this.netProfitProfitMargin = netProfitProfitMargin;
}
public BigDecimal getCostIncomeTax() {
return costIncomeTax;
}
public void setCostIncomeTax(BigDecimal costIncomeTax) {
this.costIncomeTax = costIncomeTax;
}
public BigDecimal getCostManageTotal() {
BigDecimal costExpropriation = getCostExpropriationTaxExclude();
BigDecimal costCompanyManage = getCostCompanyManageTaxExclude();
BigDecimal costIncomeTax = getCostIncomeTax();
if (null == costExpropriation || null == costCompanyManage || null == costIncomeTax) {
return new BigDecimal(0);
}
return costExpropriation.add(costCompanyManage).add(costIncomeTax);
}
public void setCostManageTotal(BigDecimal costManageTotal) {
this.costManageTotal = costManageTotal;
}
public BigDecimal getGrossProfit() {
return grossProfit;
}
public void setGrossProfit(BigDecimal grossProfit) {
this.grossProfit = grossProfit;
}
public BigDecimal getGrossProfitMargin() {
return grossProfitMargin;
}
public void setGrossProfitMargin(BigDecimal grossProfitMargin) {
this.grossProfitMargin = grossProfitMargin;
}
public BigDecimal getContributionProfit() {
return contributionProfit;
}
public void setContributionProfit(BigDecimal contributionProfit) {
this.contributionProfit = contributionProfit;
}
public BigDecimal getContributionProfitMargin() {
return contributionProfitMargin;
}
public void setContributionProfitMargin(BigDecimal contributionProfitMargin) {
this.contributionProfitMargin = contributionProfitMargin;
}
public BigDecimal getNetProfit() {
return netProfit;
}
public void setNetProfit(BigDecimal netProfit) {
this.netProfit = netProfit;
}
public BigDecimal getNetProfitMargin() {
return netProfitMargin;
}
public void setNetProfitMargin(BigDecimal netProfitMargin) {
this.netProfitMargin = netProfitMargin;
}
public BigDecimal getSaleIncomeCash() {
return saleIncomeCash;
}
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
this.saleIncomeCash = saleIncomeCash;
}
public BigDecimal getTaxReturn() {
return taxReturn;
}
public void setTaxReturn(BigDecimal taxReturn) {
this.taxReturn = taxReturn;
}
public BigDecimal getEarnestMoneyIncome() {
return earnestMoneyIncome;
}
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
this.earnestMoneyIncome = earnestMoneyIncome;
}
public BigDecimal getPurchaseCost() {
return purchaseCost;
}
public void setPurchaseCost(BigDecimal purchaseCost) {
this.purchaseCost = purchaseCost;
}
public BigDecimal getTaxCost() {
return taxCost;
}
public void setTaxCost(BigDecimal taxCost) {
this.taxCost = taxCost;
}
public BigDecimal getEarnestMoneyCost() {
return earnestMoneyCost;
}
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
this.earnestMoneyCost = earnestMoneyCost;
}
public BigDecimal getNetCashFlow() {
return netCashFlow;
}
public void setNetCashFlow(BigDecimal netCashFlow) {
this.netCashFlow = netCashFlow;
}
public BigDecimal getCashInflowFromInvestingActivities() {
return cashInflowFromInvestingActivities;
}
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
}
public BigDecimal getCashOutflowFromInvestingActivities() {
return cashOutflowFromInvestingActivities;
}
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
}
public BigDecimal getNetCashFromInvestingActivities() {
return netCashFromInvestingActivities;
}
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
}
public BigDecimal getFinancingCapitalInflow() {
return financingCapitalInflow;
}
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
this.financingCapitalInflow = financingCapitalInflow;
}
public BigDecimal getFinancingCapitalOutflow() {
return financingCapitalOutflow;
}
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
this.financingCapitalOutflow = financingCapitalOutflow;
}
public BigDecimal getFinancingCapitalCashflow() {
return financingCapitalCashflow;
}
public void setFinancingCapitalCashflow(BigDecimal financingCapitalCashflow) {
this.financingCapitalCashflow = financingCapitalCashflow;
}
public BigDecimal getNetIncreaseMonetaryFunds() {
return netIncreaseMonetaryFunds;
}
public void setNetIncreaseMonetaryFunds(BigDecimal netIncreaseMonetaryFunds) {
this.netIncreaseMonetaryFunds = netIncreaseMonetaryFunds;
}
public BigDecimal getCashFlowTotal() {
BigDecimal saleIncomeCash = getSaleIncomeCash();
BigDecimal taxReturn = getTaxReturn();
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
BigDecimal purchaseCost = getPurchaseCost();
BigDecimal taxCost = getTaxCost();
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
BigDecimal netCashFlow = getNetCashFlow();
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
return new BigDecimal(0);
}
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
}
public void setCashFlowTotal(BigDecimal cashFlowTotal) {
this.cashFlowTotal = cashFlowTotal;
}
/**
*
*/
@Override
protected BigDecimal handleSpecial(BigDecimal src) {
return src;
}
}
package cn.palmte.work.bean;
import java.math.BigDecimal;
import java.math.RoundingMode;
/**
* @author Yuanping Zhang
* @date 2021/11/15
*/
public class FormerBean extends IncomeCostBean {
/**
*
*/
private BigDecimal costIncomeTax;
/**
*
*/
private BigDecimal costManageTotal;
/**
*
*/
private BigDecimal grossProfit;
/**
*
*/
private BigDecimal grossProfitMargin;
/**
*
*/
private BigDecimal contributionProfit;
/**
*
*/
private BigDecimal contributionProfitMargin;
/**
*
*/
private BigDecimal netProfit;
/**
*
*/
private BigDecimal netProfitMargin;
/**
* a
*/
private BigDecimal saleIncomeCash;
/**
* b
*/
private BigDecimal taxReturn;
/**
* c
*/
private BigDecimal earnestMoneyIncome;
/**
* d+
*/
private BigDecimal purchaseCost;
/**
* e
*/
private BigDecimal taxCost;
/**
* f
*/
private BigDecimal earnestMoneyCost;
/**
* g
*/
private BigDecimal netCashFlow;
/**
* h
*/
private BigDecimal cashInflowFromInvestingActivities;
/**
* i
*/
private BigDecimal cashOutflowFromInvestingActivities;
/**
* j
*/
private BigDecimal netCashFromInvestingActivities;
/**
* k
*/
private BigDecimal financingCapitalInflow;
/**
* l
*/
private BigDecimal financingCapitalOutflow;
/**
* m
*/
private BigDecimal financingCapitalCashflow;
/**
* n
*/
private BigDecimal netIncreaseMonetaryFunds;
/**
*
*/
private BigDecimal cashFlowTotal;
/**
*
*/
private BigDecimal grossProfitProfitMargin;
public BigDecimal getGrossProfitProfitMargin() {
// 100 * grossProfit() / getIncomeTotalTaxExclude()
BigDecimal grossProfit = getGrossProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == grossProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
}
return grossProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
this.grossProfitProfitMargin = grossProfitProfitMargin;
}
/**
*
*/
private BigDecimal contributionProfitProfitMargin;
public BigDecimal getContributionProfitProfitMargin() {
//100 * contributionProfit() / getIncomeTotalTaxExclude()
BigDecimal contributionProfit = getContributionProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == contributionProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
}
return contributionProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
}
/**
*
*/
private BigDecimal netProfitProfitMargin;
public BigDecimal getNetProfitProfitMargin() {
//100 * netProfit() / getIncomeTotalTaxExclude()
BigDecimal netProfit = getNetProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == netProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
}
return netProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
this.netProfitProfitMargin = netProfitProfitMargin;
}
public BigDecimal getCostIncomeTax() {
return costIncomeTax;
}
public void setCostIncomeTax(BigDecimal costIncomeTax) {
this.costIncomeTax = costIncomeTax;
}
public BigDecimal getCostManageTotal() {
BigDecimal costExpropriation = getCostExpropriationTaxExclude();
BigDecimal costCompanyManage = getCostCompanyManageTaxExclude();
BigDecimal costIncomeTax = getCostIncomeTax();
if (null == costExpropriation || null == costCompanyManage || null == costIncomeTax) {
return new BigDecimal(0);
}
return costExpropriation.add(costCompanyManage).add(costIncomeTax);
}
public void setCostManageTotal(BigDecimal costManageTotal) {
this.costManageTotal = costManageTotal;
}
public BigDecimal getGrossProfit() {
return grossProfit;
}
public void setGrossProfit(BigDecimal grossProfit) {
this.grossProfit = grossProfit;
}
public BigDecimal getGrossProfitMargin() {
return grossProfitMargin;
}
public void setGrossProfitMargin(BigDecimal grossProfitMargin) {
this.grossProfitMargin = grossProfitMargin;
}
public BigDecimal getContributionProfit() {
return contributionProfit;
}
public void setContributionProfit(BigDecimal contributionProfit) {
this.contributionProfit = contributionProfit;
}
public BigDecimal getContributionProfitMargin() {
return contributionProfitMargin;
}
public void setContributionProfitMargin(BigDecimal contributionProfitMargin) {
this.contributionProfitMargin = contributionProfitMargin;
}
public BigDecimal getNetProfit() {
return netProfit;
}
public void setNetProfit(BigDecimal netProfit) {
this.netProfit = netProfit;
}
public BigDecimal getNetProfitMargin() {
return netProfitMargin;
}
public void setNetProfitMargin(BigDecimal netProfitMargin) {
this.netProfitMargin = netProfitMargin;
}
public BigDecimal getSaleIncomeCash() {
return saleIncomeCash;
}
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
this.saleIncomeCash = saleIncomeCash;
}
public BigDecimal getTaxReturn() {
return taxReturn;
}
public void setTaxReturn(BigDecimal taxReturn) {
this.taxReturn = taxReturn;
}
public BigDecimal getEarnestMoneyIncome() {
return earnestMoneyIncome;
}
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
this.earnestMoneyIncome = earnestMoneyIncome;
}
public BigDecimal getPurchaseCost() {
return purchaseCost;
}
public void setPurchaseCost(BigDecimal purchaseCost) {
this.purchaseCost = purchaseCost;
}
public BigDecimal getTaxCost() {
return taxCost;
}
public void setTaxCost(BigDecimal taxCost) {
this.taxCost = taxCost;
}
public BigDecimal getEarnestMoneyCost() {
return earnestMoneyCost;
}
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
this.earnestMoneyCost = earnestMoneyCost;
}
public BigDecimal getNetCashFlow() {
return netCashFlow;
}
public void setNetCashFlow(BigDecimal netCashFlow) {
this.netCashFlow = netCashFlow;
}
public BigDecimal getCashInflowFromInvestingActivities() {
return cashInflowFromInvestingActivities;
}
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
}
public BigDecimal getCashOutflowFromInvestingActivities() {
return cashOutflowFromInvestingActivities;
}
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
}
public BigDecimal getNetCashFromInvestingActivities() {
return netCashFromInvestingActivities;
}
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
}
public BigDecimal getFinancingCapitalInflow() {
return financingCapitalInflow;
}
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
this.financingCapitalInflow = financingCapitalInflow;
}
public BigDecimal getFinancingCapitalOutflow() {
return financingCapitalOutflow;
}
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
this.financingCapitalOutflow = financingCapitalOutflow;
}
public BigDecimal getFinancingCapitalCashflow() {
return financingCapitalCashflow;
}
public void setFinancingCapitalCashflow(BigDecimal financingCapitalCashflow) {
this.financingCapitalCashflow = financingCapitalCashflow;
}
public BigDecimal getNetIncreaseMonetaryFunds() {
return netIncreaseMonetaryFunds;
}
public void setNetIncreaseMonetaryFunds(BigDecimal netIncreaseMonetaryFunds) {
this.netIncreaseMonetaryFunds = netIncreaseMonetaryFunds;
}
public BigDecimal getCashFlowTotal() {
BigDecimal saleIncomeCash = getSaleIncomeCash();
BigDecimal taxReturn = getTaxReturn();
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
BigDecimal purchaseCost = getPurchaseCost();
BigDecimal taxCost = getTaxCost();
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
BigDecimal netCashFlow = getNetCashFlow();
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
return new BigDecimal(0);
}
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
}
public void setCashFlowTotal(BigDecimal cashFlowTotal) {
this.cashFlowTotal = cashFlowTotal;
}
/**
*
*/
@Override
protected BigDecimal handleSpecial(BigDecimal src) {
return src;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,89 +1,89 @@
package cn.palmte.work.bean;
public enum IndustrySceneEnum {
PLAN_O(-1,""),
PLAN_A(1,"信息安全"),
PLAN_B(2,"政府"),
PLAN_C(3,"公安"),
PLAN_D(4,"企业"),
PLAN_E(5,"教育"),
PLAN_F(6,"交通"),
PLAN_G(7,"医疗"),
PLAN_H(8,"电力能源"),
PLAN_I(9,"运营商"),
PLAN_J(10,"金融"),
PLAN_K(11,"专网"),
PLAN_L(12,"其他"),
PLAN_M(13,"互联网"),
PLAN_N(14,"银行");
private int scene;
private String scenario;
IndustrySceneEnum(int scene, String scenario) {
this.scene = scene;
this.scenario = scenario;
}
public int getScene() {
return scene;
}
public void setScene(int scene) {
this.scene = scene;
}
public String getScenario() {
return scenario;
}
public void setScenario(String scenario) {
this.scenario = scenario;
}
public static IndustrySceneEnum parseScene(int scene){
if(scene == 1){
return PLAN_A;
}
if(scene == 2){
return PLAN_B;
}
if(scene == 3){
return PLAN_C;
}
if(scene == 4){
return PLAN_D;
}
if(scene == 5){
return PLAN_E;
}
if(scene == 6){
return PLAN_F;
}
if(scene == 7){
return PLAN_G;
}
if(scene == 8){
return PLAN_H;
}
if(scene == 9){
return PLAN_I;
}
if(scene == 10){
return PLAN_J;
}
if(scene == 11){
return PLAN_K;
}
if(scene == 12){
return PLAN_L;
}
if(scene == 13){
return PLAN_M;
}
if(scene == 14){
return PLAN_N;
}
throw new IllegalArgumentException("Unkown scene:"+scene);
}
}
package cn.palmte.work.bean;
public enum IndustrySceneEnum {
PLAN_O(-1,""),
PLAN_A(1,"信息安全"),
PLAN_B(2,"政府"),
PLAN_C(3,"公安"),
PLAN_D(4,"企业"),
PLAN_E(5,"教育"),
PLAN_F(6,"交通"),
PLAN_G(7,"医疗"),
PLAN_H(8,"电力能源"),
PLAN_I(9,"运营商"),
PLAN_J(10,"金融"),
PLAN_K(11,"专网"),
PLAN_L(12,"其他"),
PLAN_M(13,"互联网"),
PLAN_N(14,"银行");
private int scene;
private String scenario;
IndustrySceneEnum(int scene, String scenario) {
this.scene = scene;
this.scenario = scenario;
}
public int getScene() {
return scene;
}
public void setScene(int scene) {
this.scene = scene;
}
public String getScenario() {
return scenario;
}
public void setScenario(String scenario) {
this.scenario = scenario;
}
public static IndustrySceneEnum parseScene(int scene){
if(scene == 1){
return PLAN_A;
}
if(scene == 2){
return PLAN_B;
}
if(scene == 3){
return PLAN_C;
}
if(scene == 4){
return PLAN_D;
}
if(scene == 5){
return PLAN_E;
}
if(scene == 6){
return PLAN_F;
}
if(scene == 7){
return PLAN_G;
}
if(scene == 8){
return PLAN_H;
}
if(scene == 9){
return PLAN_I;
}
if(scene == 10){
return PLAN_J;
}
if(scene == 11){
return PLAN_K;
}
if(scene == 12){
return PLAN_L;
}
if(scene == 13){
return PLAN_M;
}
if(scene == 14){
return PLAN_N;
}
throw new IllegalArgumentException("Unkown scene:"+scene);
}
}

View File

@ -1,44 +1,44 @@
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum IsSecondEnum {
PLAN_O(-1,""),
PLAN_A(1,"是"),
PLAN_B(2,"否");
private int isSecond;
private String isSecondStr;
private IsSecondEnum(int isSecond, String isSecondStr) {
this.isSecond = isSecond;
this.isSecondStr = isSecondStr;
}
public int getIsSecond() {
return isSecond;
}
public void setIsSecond(int isSecond) {
this.isSecond = isSecond;
}
public String getIsSecondStr() {
return isSecondStr;
}
public void setIsSecondStr(String isSecondStr) {
this.isSecondStr = isSecondStr;
}
public static IsSecondEnum parseIsSecond(int isSecond){
if(isSecond == 1){
return PLAN_A;
}
if(isSecond == 2){
return PLAN_B;
}
return PLAN_O;
}
}
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum IsSecondEnum {
PLAN_O(-1,""),
PLAN_A(1,"是"),
PLAN_B(2,"否");
private int isSecond;
private String isSecondStr;
private IsSecondEnum(int isSecond, String isSecondStr) {
this.isSecond = isSecond;
this.isSecondStr = isSecondStr;
}
public int getIsSecond() {
return isSecond;
}
public void setIsSecond(int isSecond) {
this.isSecond = isSecond;
}
public String getIsSecondStr() {
return isSecondStr;
}
public void setIsSecondStr(String isSecondStr) {
this.isSecondStr = isSecondStr;
}
public static IsSecondEnum parseIsSecond(int isSecond){
if(isSecond == 1){
return PLAN_A;
}
if(isSecond == 2){
return PLAN_B;
}
return PLAN_O;
}
}

View File

@ -1,73 +1,73 @@
package cn.palmte.work.bean;
import lombok.Data;
import java.math.BigDecimal;
/**
*
*/
@Data
public class PrimaryIndicatorBean {
/**
*
*/
private String title;
/**
* --
*/
private BigDecimal incomeDevice;
/**
* --
*/
private BigDecimal incomeEngineer;
/**
* --
*/
private BigDecimal incomeService;
/**
* --
*/
private BigDecimal costPurchaseDevice;
/**
* --
*/
private BigDecimal costPurchaseBuild;
/**
* --
*/
private BigDecimal costPurchaseService;
/**
* --
*/
private BigDecimal costPurchaseOther;
/**
* --
*/
private BigDecimal costOtherOther;
/**
* --
*/
private BigDecimal costProjectManage;
/**
* --
*/
private BigDecimal costExpropriation;
/**
*
*/
private BigDecimal costCompanyManage;
}
package cn.palmte.work.bean;
import lombok.Data;
import java.math.BigDecimal;
/**
*
*/
@Data
public class PrimaryIndicatorBean {
/**
*
*/
private String title;
/**
* --
*/
private BigDecimal incomeDevice;
/**
* --
*/
private BigDecimal incomeEngineer;
/**
* --
*/
private BigDecimal incomeService;
/**
* --
*/
private BigDecimal costPurchaseDevice;
/**
* --
*/
private BigDecimal costPurchaseBuild;
/**
* --
*/
private BigDecimal costPurchaseService;
/**
* --
*/
private BigDecimal costPurchaseOther;
/**
* --
*/
private BigDecimal costOtherOther;
/**
* --
*/
private BigDecimal costProjectManage;
/**
* --
*/
private BigDecimal costExpropriation;
/**
*
*/
private BigDecimal costCompanyManage;
}

View File

@ -1,80 +1,80 @@
package cn.palmte.work.bean;
import lombok.Data;
import java.math.BigDecimal;
/**
*
*/
@Data
public class ProfitAndLossBean {
private String title;
/**
*
*/
private BigDecimal income;
/**
*
*/
private BigDecimal cost;
/**
*
*/
private BigDecimal manageCost;
/**
*
*/
private BigDecimal other;
/**
*
*/
private BigDecimal expropriation;
/**
*
*/
private BigDecimal grossProfit;
/**
*
*/
private BigDecimal grossProfitProfit;
/**
*
*/
private BigDecimal CompanyManage;
/**
*
*/
private BigDecimal contributionMargin;
/**
*
*/
private BigDecimal contributionMarginProfit;
/**
*
*/
private BigDecimal incomeTax;
/**
*
*/
private BigDecimal netMargin;
/**
*
*/
private BigDecimal netMarginProfit;
}
package cn.palmte.work.bean;
import lombok.Data;
import java.math.BigDecimal;
/**
*
*/
@Data
public class ProfitAndLossBean {
private String title;
/**
*
*/
private BigDecimal income;
/**
*
*/
private BigDecimal cost;
/**
*
*/
private BigDecimal manageCost;
/**
*
*/
private BigDecimal other;
/**
*
*/
private BigDecimal expropriation;
/**
*
*/
private BigDecimal grossProfit;
/**
*
*/
private BigDecimal grossProfitProfit;
/**
*
*/
private BigDecimal CompanyManage;
/**
*
*/
private BigDecimal contributionMargin;
/**
*
*/
private BigDecimal contributionMarginProfit;
/**
*
*/
private BigDecimal incomeTax;
/**
*
*/
private BigDecimal netMargin;
/**
*
*/
private BigDecimal netMarginProfit;
}

View File

@ -1,34 +1,34 @@
package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
*
* @author xiongshiyan at 2021/11/5 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class ProjectConfigBean {
/**
*
*/
private BigDecimal underwrittenTaxRate;
/**
*
*/
private BigDecimal projectContributionProfitRateThreshold;
public BigDecimal getUnderwrittenTaxRate() {
return underwrittenTaxRate;
}
public void setUnderwrittenTaxRate(BigDecimal underwrittenTaxRate) {
this.underwrittenTaxRate = underwrittenTaxRate;
}
public BigDecimal getProjectContributionProfitRateThreshold() {
return projectContributionProfitRateThreshold;
}
public void setProjectContributionProfitRateThreshold(BigDecimal projectContributionProfitRateThreshold) {
this.projectContributionProfitRateThreshold = projectContributionProfitRateThreshold;
}
}
package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
*
* @author xiongshiyan at 2021/11/5 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class ProjectConfigBean {
/**
*
*/
private BigDecimal underwrittenTaxRate;
/**
*
*/
private BigDecimal projectContributionProfitRateThreshold;
public BigDecimal getUnderwrittenTaxRate() {
return underwrittenTaxRate;
}
public void setUnderwrittenTaxRate(BigDecimal underwrittenTaxRate) {
this.underwrittenTaxRate = underwrittenTaxRate;
}
public BigDecimal getProjectContributionProfitRateThreshold() {
return projectContributionProfitRateThreshold;
}
public void setProjectContributionProfitRateThreshold(BigDecimal projectContributionProfitRateThreshold) {
this.projectContributionProfitRateThreshold = projectContributionProfitRateThreshold;
}
}

View File

@ -1,46 +1,46 @@
package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
*
* @author xiongshiyan at 2021/11/5 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class ProjectUnderwrittenPlanStatisticBean {
/**
*
*/
private String maxMonth;
/**
*
*/
private BigDecimal amount;
/**
*
*/
private BigDecimal capitalInterest;
public String getMaxMonth() {
return maxMonth;
}
public void setMaxMonth(String maxMonth) {
this.maxMonth = maxMonth;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public BigDecimal getCapitalInterest() {
return capitalInterest;
}
public void setCapitalInterest(BigDecimal capitalInterest) {
this.capitalInterest = capitalInterest;
}
}
package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
*
* @author xiongshiyan at 2021/11/5 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class ProjectUnderwrittenPlanStatisticBean {
/**
*
*/
private String maxMonth;
/**
*
*/
private BigDecimal amount;
/**
*
*/
private BigDecimal capitalInterest;
public String getMaxMonth() {
return maxMonth;
}
public void setMaxMonth(String maxMonth) {
this.maxMonth = maxMonth;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public BigDecimal getCapitalInterest() {
return capitalInterest;
}
public void setCapitalInterest(BigDecimal capitalInterest) {
this.capitalInterest = capitalInterest;
}
}

View File

@ -1,11 +1,11 @@
package cn.palmte.work.bean;
public interface RegexConstant {
/**
*
*/
String REGEX = "^1[0-9][0-9]\\d{8}$";
String SERVERADDRESS = "^(http|https|ftp)\\://(((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|([a-zA-Z0-9_\\-\\.])+\\.(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|uk|me))((:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\\-\\._\\?\\,\\'/\\\\\\+&amp;%\\$#\\=~])*)$";
}
package cn.palmte.work.bean;
public interface RegexConstant {
/**
*
*/
String REGEX = "^1[0-9][0-9]\\d{8}$";
String SERVERADDRESS = "^(http|https|ftp)\\://(((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|([a-zA-Z0-9_\\-\\.])+\\.(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|uk|me))((:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\\-\\._\\?\\,\\'/\\\\\\+&amp;%\\$#\\=~])*)$";
}

View File

@ -1,48 +1,48 @@
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum ResolvePlanEnum {
PLAN_O(-1,""),
PLAN_A(1,"公共服务(智慧交通、雪亮工程、治安防控体系等)"),
PLAN_B(2,"泛行业(智慧园区、智慧医疗、智慧工地等)"),
PLAN_C(3,"其他生态");
private int resolvePlan;
private String resolvePlanStr;
private ResolvePlanEnum(int resolvePlan, String resolvePlanStr) {
this.resolvePlan = resolvePlan;
this.resolvePlanStr = resolvePlanStr;
}
public int getResolvePlan() {
return resolvePlan;
}
public void setResolvePlan(int resolvePlan) {
this.resolvePlan = resolvePlan;
}
public String getResolvePlanStr() {
return resolvePlanStr;
}
public void setResolvePlanStr(String resolvePlanStr) {
this.resolvePlanStr = resolvePlanStr;
}
public static ResolvePlanEnum parseResolvePlan(int resolvePlan){
if(resolvePlan == 1){
return PLAN_A;
}
if(resolvePlan == 2){
return PLAN_B;
}
if(resolvePlan == 3){
return PLAN_C;
}
throw new IllegalArgumentException("Unkown resolvePlan:"+resolvePlan);
}
}
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum ResolvePlanEnum {
PLAN_O(-1,""),
PLAN_A(1,"公共服务(智慧交通、雪亮工程、治安防控体系等)"),
PLAN_B(2,"泛行业(智慧园区、智慧医疗、智慧工地等)"),
PLAN_C(3,"其他生态");
private int resolvePlan;
private String resolvePlanStr;
private ResolvePlanEnum(int resolvePlan, String resolvePlanStr) {
this.resolvePlan = resolvePlan;
this.resolvePlanStr = resolvePlanStr;
}
public int getResolvePlan() {
return resolvePlan;
}
public void setResolvePlan(int resolvePlan) {
this.resolvePlan = resolvePlan;
}
public String getResolvePlanStr() {
return resolvePlanStr;
}
public void setResolvePlanStr(String resolvePlanStr) {
this.resolvePlanStr = resolvePlanStr;
}
public static ResolvePlanEnum parseResolvePlan(int resolvePlan){
if(resolvePlan == 1){
return PLAN_A;
}
if(resolvePlan == 2){
return PLAN_B;
}
if(resolvePlan == 3){
return PLAN_C;
}
throw new IllegalArgumentException("Unkown resolvePlan:"+resolvePlan);
}
}

View File

@ -1,88 +1,88 @@
package cn.palmte.work.bean;
import cn.palmte.work.config.Constant;
public class ResponseMsg {
private int status;
private String msg;
private Object data;
public ResponseMsg() {
}
public ResponseMsg(int status, String msg) {
this.status = status;
this.msg = msg;
}
public static ResponseMsg buildSuccessMsg(String msg) {
return new ResponseMsg(Constant.Status.STATUS_SUCCESS, msg);
}
public static ResponseMsg buildSuccessData(Object data) {
return buildSuccessMsg("ok", data);
}
public static ResponseMsg buildSuccessMsg(String msg, Object data) {
ResponseMsg responseMsg = new ResponseMsg(Constant.Status.STATUS_SUCCESS, msg);
responseMsg.setData(data);
return responseMsg;
}
public static ResponseMsg buildMsg(int status, String msg, Object data) {
ResponseMsg responseMsg = new ResponseMsg(status, msg);
responseMsg.setData(data);
return responseMsg;
}
public static ResponseMsg buildFailedMsg(String msg) {
return new ResponseMsg(Constant.Status.STATUS_FAILED, msg);
}
public static ResponseMsg buildFailedMsg(String msg, Object data) {
ResponseMsg responseMsg = new ResponseMsg(Constant.Status.STATUS_FAILED, msg);
responseMsg.setData(data);
return responseMsg;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public boolean isSuccess() {
return Constant.Status.STATUS_SUCCESS == this.status;
}
@Override
public String toString() {
return "ResponseMsg{" +
"status=" + status +
", msg='" + msg + '\'' +
", data=" + data +
'}';
}
package cn.palmte.work.bean;
import cn.palmte.work.config.Constant;
public class ResponseMsg {
private int status;
private String msg;
private Object data;
public ResponseMsg() {
}
public ResponseMsg(int status, String msg) {
this.status = status;
this.msg = msg;
}
public static ResponseMsg buildSuccessMsg(String msg) {
return new ResponseMsg(Constant.Status.STATUS_SUCCESS, msg);
}
public static ResponseMsg buildSuccessData(Object data) {
return buildSuccessMsg("ok", data);
}
public static ResponseMsg buildSuccessMsg(String msg, Object data) {
ResponseMsg responseMsg = new ResponseMsg(Constant.Status.STATUS_SUCCESS, msg);
responseMsg.setData(data);
return responseMsg;
}
public static ResponseMsg buildMsg(int status, String msg, Object data) {
ResponseMsg responseMsg = new ResponseMsg(status, msg);
responseMsg.setData(data);
return responseMsg;
}
public static ResponseMsg buildFailedMsg(String msg) {
return new ResponseMsg(Constant.Status.STATUS_FAILED, msg);
}
public static ResponseMsg buildFailedMsg(String msg, Object data) {
ResponseMsg responseMsg = new ResponseMsg(Constant.Status.STATUS_FAILED, msg);
responseMsg.setData(data);
return responseMsg;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public boolean isSuccess() {
return Constant.Status.STATUS_SUCCESS == this.status;
}
@Override
public String toString() {
return "ResponseMsg{" +
"status=" + status +
", msg='" + msg + '\'' +
", data=" + data +
'}';
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +1,44 @@
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum SignTypeEnum {
PLAN_O(-1,""),
PLAN_A(1,"是"),
PLAN_B(2,"否");
private int signType;
private String signTypeStr;
private SignTypeEnum(int signType, String signTypeStr) {
this.signType = signType;
this.signTypeStr = signTypeStr;
}
public int getSignType() {
return signType;
}
public void setSignType(int signType) {
this.signType = signType;
}
public String getSignTypeStr() {
return signTypeStr;
}
public void setSignTypeStr(String signTypeStr) {
this.signTypeStr = signTypeStr;
}
public static SignTypeEnum parseSignType(int signType){
if(signType == 1){
return PLAN_A;
}
if(signType == 2){
return PLAN_B;
}
return PLAN_O;
}
}
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum SignTypeEnum {
PLAN_O(-1,""),
PLAN_A(1,"是"),
PLAN_B(2,"否");
private int signType;
private String signTypeStr;
private SignTypeEnum(int signType, String signTypeStr) {
this.signType = signType;
this.signTypeStr = signTypeStr;
}
public int getSignType() {
return signType;
}
public void setSignType(int signType) {
this.signType = signType;
}
public String getSignTypeStr() {
return signTypeStr;
}
public void setSignTypeStr(String signTypeStr) {
this.signTypeStr = signTypeStr;
}
public static SignTypeEnum parseSignType(int signType){
if(signType == 1){
return PLAN_A;
}
if(signType == 2){
return PLAN_B;
}
return PLAN_O;
}
}

View File

@ -1,16 +1,16 @@
package cn.palmte.work.bean;
import lombok.Data;
import java.util.List;
@Data
public class StatisticsBean {
private List<PrimaryIndicatorBean> primaryIndicatorBeanList;
private List<ProfitAndLossBean> profitAndLossBeanList;
private List<CashFlowStatisticsBean> cashFlowStatisticsBeanList;
}
package cn.palmte.work.bean;
import lombok.Data;
import java.util.List;
@Data
public class StatisticsBean {
private List<PrimaryIndicatorBean> primaryIndicatorBeanList;
private List<ProfitAndLossBean> profitAndLossBeanList;
private List<CashFlowStatisticsBean> cashFlowStatisticsBeanList;
}

View File

@ -1,70 +1,70 @@
package cn.palmte.work.bean;
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum StatusEnum {
ESTIMATE_ACCOUNTS(1,"项目创建(概算)"),
BUDGET_ACCOUNTS(5,"预算"),
SETTLE_ACCOUNTS(10,"结算"),
FINAL_ACCOUNTS(15,"决算");
private int status;
private String statusDesc;
private StatusEnum(int status, String statusDesc) {
this.status = status;
this.statusDesc = statusDesc;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getStatusDesc() {
return statusDesc;
}
public void setStatusDesc(String statusDesc) {
this.statusDesc = statusDesc;
}
public static StatusEnum parseStatus(int status){
if(status == 1){
return ESTIMATE_ACCOUNTS;
}
if(status == 5){
return BUDGET_ACCOUNTS;
}
if(status == 10){
return SETTLE_ACCOUNTS;
}
if(status == 15){
return FINAL_ACCOUNTS;
}
throw new IllegalArgumentException("Unkown status:"+status);
}
public static StatusEnum parseByProcDefId(String proDefId){
if(proDefId.startsWith(ActProcessKeyEnum.ESTIMATE.getKey())){
return ESTIMATE_ACCOUNTS;
}
if(proDefId.startsWith(ActProcessKeyEnum.BUDGET.getKey())){
return BUDGET_ACCOUNTS;
}
if(proDefId.startsWith(ActProcessKeyEnum.SETTLE.getKey())){
return SETTLE_ACCOUNTS;
}
if(proDefId.startsWith(ActProcessKeyEnum.FINAL.getKey())){
return FINAL_ACCOUNTS;
}
throw new IllegalArgumentException("Unkown proDefId:"+ proDefId);
}
}
package cn.palmte.work.bean;
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum StatusEnum {
ESTIMATE_ACCOUNTS(1,"项目创建(概算)"),
BUDGET_ACCOUNTS(5,"预算"),
SETTLE_ACCOUNTS(10,"结算"),
FINAL_ACCOUNTS(15,"决算");
private int status;
private String statusDesc;
private StatusEnum(int status, String statusDesc) {
this.status = status;
this.statusDesc = statusDesc;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getStatusDesc() {
return statusDesc;
}
public void setStatusDesc(String statusDesc) {
this.statusDesc = statusDesc;
}
public static StatusEnum parseStatus(int status){
if(status == 1){
return ESTIMATE_ACCOUNTS;
}
if(status == 5){
return BUDGET_ACCOUNTS;
}
if(status == 10){
return SETTLE_ACCOUNTS;
}
if(status == 15){
return FINAL_ACCOUNTS;
}
throw new IllegalArgumentException("Unkown status:"+status);
}
public static StatusEnum parseByProcDefId(String proDefId){
if(proDefId.startsWith(ActProcessKeyEnum.ESTIMATE.getKey())){
return ESTIMATE_ACCOUNTS;
}
if(proDefId.startsWith(ActProcessKeyEnum.BUDGET.getKey())){
return BUDGET_ACCOUNTS;
}
if(proDefId.startsWith(ActProcessKeyEnum.SETTLE.getKey())){
return SETTLE_ACCOUNTS;
}
if(proDefId.startsWith(ActProcessKeyEnum.FINAL.getKey())){
return FINAL_ACCOUNTS;
}
throw new IllegalArgumentException("Unkown proDefId:"+ proDefId);
}
}

View File

@ -1,47 +1,47 @@
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum TypeEnum {
PROJECT_INTEGRATION(1,"工程集成类"),
DEVICE_INTEGRATION(2,"设备集成类"),
STRATEGIC_PARTNER(3,"工程集成类");
private int type;
private String typeDesc;
private TypeEnum(int type, String typeDesc) {
this.type = type;
this.typeDesc = typeDesc;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getTypeDesc() {
return typeDesc;
}
public void setTypeDesc(String typeDesc) {
this.typeDesc = typeDesc;
}
public static TypeEnum parseType(int type){
if(type == 1){
return PROJECT_INTEGRATION;
}
if(type == 2){
return DEVICE_INTEGRATION;
}
if(type == 3){
return STRATEGIC_PARTNER;
}
throw new IllegalArgumentException("Unkown type:"+type);
}
}
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum TypeEnum {
PROJECT_INTEGRATION(1,"工程集成类"),
DEVICE_INTEGRATION(2,"设备集成类"),
STRATEGIC_PARTNER(3,"工程集成类");
private int type;
private String typeDesc;
private TypeEnum(int type, String typeDesc) {
this.type = type;
this.typeDesc = typeDesc;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getTypeDesc() {
return typeDesc;
}
public void setTypeDesc(String typeDesc) {
this.typeDesc = typeDesc;
}
public static TypeEnum parseType(int type){
if(type == 1){
return PROJECT_INTEGRATION;
}
if(type == 2){
return DEVICE_INTEGRATION;
}
if(type == 3){
return STRATEGIC_PARTNER;
}
throw new IllegalArgumentException("Unkown type:"+type);
}
}

View File

@ -1,52 +1,52 @@
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum UnderwrittenModeEnum {
PLAN_O(-1,""),
PLAN_A(1,"A类-不垫资"),
// PLAN_B(2,"B类-不垫资(背靠背)"),
PLAN_C(3,"B类-垫资(账期覆盖)"),
PLAN_D(4,"C类-垫资(账期不覆盖)");
private int underwrittenMode;
private String underwrittenModeStr;
private UnderwrittenModeEnum(int underwrittenMode, String underwrittenModeStr) {
this.underwrittenMode = underwrittenMode;
this.underwrittenModeStr = underwrittenModeStr;
}
public int getUnderwrittenMode() {
return underwrittenMode;
}
public void setUnderwrittenMode(int underwrittenMode) {
this.underwrittenMode = underwrittenMode;
}
public String getUnderwrittenModeStr() {
return underwrittenModeStr;
}
public void setUnderwrittenModeStr(String underwrittenModeStr) {
this.underwrittenModeStr = underwrittenModeStr;
}
public static UnderwrittenModeEnum parseUnderwrittenMode(int underwrittenMode){
if(underwrittenMode == 1){
return PLAN_A;
}
// if(underwrittenMode == 2){
// return PLAN_B;
// }
if(underwrittenMode == 3){
return PLAN_C;
}
if(underwrittenMode == 4){
return PLAN_D;
}
throw new IllegalArgumentException("Unkown underwrittenMode:"+underwrittenMode);
}
}
package cn.palmte.work.bean;
/**
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum UnderwrittenModeEnum {
PLAN_O(-1,""),
PLAN_A(1,"不垫资"),
// PLAN_B(2,"不垫资(背靠背)"),
PLAN_C(3,"垫资(账期覆盖)"),
PLAN_D(4,"垫资(账期不覆盖)");
private int underwrittenMode;
private String underwrittenModeStr;
private UnderwrittenModeEnum(int underwrittenMode, String underwrittenModeStr) {
this.underwrittenMode = underwrittenMode;
this.underwrittenModeStr = underwrittenModeStr;
}
public int getUnderwrittenMode() {
return underwrittenMode;
}
public void setUnderwrittenMode(int underwrittenMode) {
this.underwrittenMode = underwrittenMode;
}
public String getUnderwrittenModeStr() {
return underwrittenModeStr;
}
public void setUnderwrittenModeStr(String underwrittenModeStr) {
this.underwrittenModeStr = underwrittenModeStr;
}
public static UnderwrittenModeEnum parseUnderwrittenMode(int underwrittenMode){
if(underwrittenMode == 1){
return PLAN_A;
}
// if(underwrittenMode == 2){
// return PLAN_B;
// }
if(underwrittenMode == 3){
return PLAN_C;
}
if(underwrittenMode == 4){
return PLAN_D;
}
throw new IllegalArgumentException("Unkown underwrittenMode:"+underwrittenMode);
}
}

View File

@ -1,67 +1,67 @@
package cn.palmte.work.bean;
/**
* { id:2, pId:0, name:"随意勾选 2", checked:true, open:true},
* @author xiongshiyan at 2021/11/18 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class ZTreeNode {
private String id;
private String pId;
private String name;
private boolean checked = false;
private boolean open = false;
public ZTreeNode(String id, String pId, String name, boolean checked, boolean open) {
this.id = id;
this.pId = pId;
this.name = name;
this.checked = checked;
this.open = open;
}
public ZTreeNode(String id, String pId, String name) {
this.id = id;
this.pId = pId;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getpId() {
return pId;
}
public void setpId(String pId) {
this.pId = pId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public boolean isOpen() {
return open;
}
public void setOpen(boolean open) {
this.open = open;
}
}
package cn.palmte.work.bean;
/**
* { id:2, pId:0, name:"随意勾选 2", checked:true, open:true},
* @author xiongshiyan at 2021/11/18 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class ZTreeNode {
private String id;
private String pId;
private String name;
private boolean checked = false;
private boolean open = false;
public ZTreeNode(String id, String pId, String name, boolean checked, boolean open) {
this.id = id;
this.pId = pId;
this.name = name;
this.checked = checked;
this.open = open;
}
public ZTreeNode(String id, String pId, String name) {
this.id = id;
this.pId = pId;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getpId() {
return pId;
}
public void setpId(String pId) {
this.pId = pId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public boolean isOpen() {
return open;
}
public void setOpen(boolean open) {
this.open = open;
}
}

View File

@ -1,177 +1,177 @@
package cn.palmte.work.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.http.HttpStatus;
import org.springframework.util.ObjectUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import org.springframework.transaction.TransactionSystemException;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
import org.springframework.web.multipart.MultipartException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.palmte.work.ErrorMessage;
import cn.palmte.work.ErrorMessageException;
import cn.palmte.work.Json;
import cn.palmte.work.Result;
import cn.palmte.work.ValidationError;
import cn.palmte.work.controller.backend.ProcessController;
/**
*
*
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:24
*/
@RestControllerAdvice(assignableTypes = ProcessController.class)
public class ApplicationExceptionHandler {
private static final Logger log = LoggerFactory.getLogger(ApplicationExceptionHandler.class);
public static final ErrorMessage argsErrorMessage = ErrorMessage.failed("参数错误");
public static final ErrorMessage sizeExceeded = ErrorMessage.failed("上传文件大小超出限制");
public static final ErrorMessage methodNotSupported = ErrorMessage.failed("请求方式不支持");
public static final ErrorMessage internalServerError = ErrorMessage.failed("服务器内部异常");
public static final ErrorMessage notWritableError = ErrorMessage.failed("数据无法正常返回到客户端");
@ExceptionHandler(ErrorMessageException.class)
public ResponseEntity<ErrorMessage> errorMessage(ErrorMessageException errorMessage) {
HttpStatus httpStatus = errorMessage.getStatus();
return ResponseEntity.status(httpStatus)
.body(ErrorMessage.failed(errorMessage.getMessage()));
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(IllegalArgumentException.class)
public ErrorMessage badRequest(IllegalArgumentException exception) {
return ErrorMessage.failed(exception.getMessage());
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler({ MaxUploadSizeExceededException.class })
public ErrorMessage badRequest() {
return sizeExceeded;
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public ErrorMessage methodNotSupported() {
return methodNotSupported;
}
@ExceptionHandler
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ErrorMessage error(Exception exception) {
log.error("An Exception occurred", exception);
if (exception instanceof SQLException) {
return internalServerError;
}
if (exception instanceof HttpMessageNotWritableException) {
return notWritableError;
}
if (exception instanceof TransactionSystemException) {
return ErrorMessage.failed("数据库出错");
}
return ErrorMessage.failed(exception.getMessage());
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
public ErrorMessage typeMismatch(MethodArgumentTypeMismatchException mismatch) {
return ErrorMessage.failed("参数'" + mismatch.getName() + "'不能转换到对应类型");
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(MissingServletRequestParameterException.class)
public ErrorMessage parameterError(MissingServletRequestParameterException e) {
return ErrorMessage.failed("缺少参数'" + e.getParameterName() + "'");
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler({
MultipartException.class,
HttpMessageNotReadableException.class,
HttpMediaTypeNotSupportedException.class
})
public ErrorMessage messageNotReadable() {
return argsErrorMessage;
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler({ BindException.class, MethodArgumentNotValidException.class })
public Result validExceptionHandler(Exception e) {
BindingResult result;
if (e instanceof MethodArgumentNotValidException) {
result = ((MethodArgumentNotValidException) e).getBindingResult();
}
else if (e instanceof BindException) {
result = (BindingResult) e;
}
else {
return ErrorMessage.failed();
}
List<ObjectError> allErrors = result.getAllErrors();
Map<String, String> model = new HashMap<>(16);
for (ObjectError error : allErrors) {
if (error instanceof FieldError) {
FieldError fieldError = (FieldError) error;
String field = fieldError.getField();
String defaultMessage = error.getDefaultMessage();
model.put(field, defaultMessage);
// log.error("[{}] -> [{}]", field, defaultMessage);
}
}
return ValidationError.failed(model);
}
@ExceptionHandler(NullPointerException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public Json nullPointer(NullPointerException exception) {
log.error("An Exception occurred", exception);
final StackTraceElement[] stackTrace = exception.getStackTrace();
if (ObjectUtils.isEmpty(stackTrace)) {
return Json.failed("空指针", "暂无堆栈信息");
}
return Json.failed("空指针", stackTrace[0]);
}
@ExceptionHandler(DataAccessException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ErrorMessage dataAccessException(DataAccessException accessException) {
String message = getDataAccessMessage(accessException.getCause());
log.error(message, accessException);
return ErrorMessage.failed(message);
}
String getDataAccessMessage(Throwable cause) {
return "数据库出错";
}
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(DataAccessResourceFailureException.class)
public ErrorMessage dataAccessException(DataAccessResourceFailureException accessException) {
log.error("数据库连接出错", accessException);
return ErrorMessage.failed("数据库连接出错");
}
}
package cn.palmte.work.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.http.HttpStatus;
import org.springframework.util.ObjectUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import org.springframework.transaction.TransactionSystemException;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
import org.springframework.web.multipart.MultipartException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.palmte.work.ErrorMessage;
import cn.palmte.work.ErrorMessageException;
import cn.palmte.work.Json;
import cn.palmte.work.Result;
import cn.palmte.work.ValidationError;
import cn.palmte.work.controller.backend.ProcessController;
/**
*
*
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 2.0 2022/12/30 15:24
*/
@RestControllerAdvice(assignableTypes = ProcessController.class)
public class ApplicationExceptionHandler {
private static final Logger log = LoggerFactory.getLogger(ApplicationExceptionHandler.class);
public static final ErrorMessage argsErrorMessage = ErrorMessage.failed("参数错误");
public static final ErrorMessage sizeExceeded = ErrorMessage.failed("上传文件大小超出限制");
public static final ErrorMessage methodNotSupported = ErrorMessage.failed("请求方式不支持");
public static final ErrorMessage internalServerError = ErrorMessage.failed("服务器内部异常");
public static final ErrorMessage notWritableError = ErrorMessage.failed("数据无法正常返回到客户端");
@ExceptionHandler(ErrorMessageException.class)
public ResponseEntity<ErrorMessage> errorMessage(ErrorMessageException errorMessage) {
HttpStatus httpStatus = errorMessage.getStatus();
return ResponseEntity.status(httpStatus)
.body(ErrorMessage.failed(errorMessage.getMessage()));
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(IllegalArgumentException.class)
public ErrorMessage badRequest(IllegalArgumentException exception) {
return ErrorMessage.failed(exception.getMessage());
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler({ MaxUploadSizeExceededException.class })
public ErrorMessage badRequest() {
return sizeExceeded;
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public ErrorMessage methodNotSupported() {
return methodNotSupported;
}
@ExceptionHandler
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ErrorMessage error(Exception exception) {
log.error("An Exception occurred", exception);
if (exception instanceof SQLException) {
return internalServerError;
}
if (exception instanceof HttpMessageNotWritableException) {
return notWritableError;
}
if (exception instanceof TransactionSystemException) {
return ErrorMessage.failed("数据库出错");
}
return ErrorMessage.failed(exception.getMessage());
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
public ErrorMessage typeMismatch(MethodArgumentTypeMismatchException mismatch) {
return ErrorMessage.failed("参数'" + mismatch.getName() + "'不能转换到对应类型");
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(MissingServletRequestParameterException.class)
public ErrorMessage parameterError(MissingServletRequestParameterException e) {
return ErrorMessage.failed("缺少参数'" + e.getParameterName() + "'");
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler({
MultipartException.class,
HttpMessageNotReadableException.class,
HttpMediaTypeNotSupportedException.class
})
public ErrorMessage messageNotReadable() {
return argsErrorMessage;
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler({ BindException.class, MethodArgumentNotValidException.class })
public Result validExceptionHandler(Exception e) {
BindingResult result;
if (e instanceof MethodArgumentNotValidException) {
result = ((MethodArgumentNotValidException) e).getBindingResult();
}
else if (e instanceof BindException) {
result = (BindingResult) e;
}
else {
return ErrorMessage.failed();
}
List<ObjectError> allErrors = result.getAllErrors();
Map<String, String> model = new HashMap<>(16);
for (ObjectError error : allErrors) {
if (error instanceof FieldError) {
FieldError fieldError = (FieldError) error;
String field = fieldError.getField();
String defaultMessage = error.getDefaultMessage();
model.put(field, defaultMessage);
// log.error("[{}] -> [{}]", field, defaultMessage);
}
}
return ValidationError.failed(model);
}
@ExceptionHandler(NullPointerException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public Json nullPointer(NullPointerException exception) {
log.error("An Exception occurred", exception);
final StackTraceElement[] stackTrace = exception.getStackTrace();
if (ObjectUtils.isEmpty(stackTrace)) {
return Json.failed("空指针", "暂无堆栈信息");
}
return Json.failed("空指针", stackTrace[0]);
}
@ExceptionHandler(DataAccessException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ErrorMessage dataAccessException(DataAccessException accessException) {
String message = getDataAccessMessage(accessException.getCause());
log.error(message, accessException);
return ErrorMessage.failed(message);
}
String getDataAccessMessage(Throwable cause) {
return "数据库出错";
}
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(DataAccessResourceFailureException.class)
public ErrorMessage dataAccessException(DataAccessResourceFailureException accessException) {
log.error("数据库连接出错", accessException);
return ErrorMessage.failed("数据库连接出错");
}
}

View File

@ -1,44 +1,44 @@
package cn.palmte.work.config;
import org.springframework.stereotype.Component;
/**
*
*
* @author pengqiang
* @date 2018/6/26
*/
@Component
public class ConfigProperties {
/**
*
*/
//@Value("${upload.path}")
private String uploadPath = "/mnt/dzg/image";
/**
*
*/
//@Value("${upload.prefix}")
private String uploadPrefix = "/upload";
/**
* admin
* https://dzgtest.palmte.cn
*/
//@Value("${admin.domain}")
private String adminDomain = "";
public String getUploadPath() {
return uploadPath;
}
public String getUploadPrefix() {
return uploadPrefix;
}
public String getAdminDomain() {
return adminDomain;
}
}
package cn.palmte.work.config;
import org.springframework.stereotype.Component;
/**
*
*
* @author pengqiang
* @date 2018/6/26
*/
@Component
public class ConfigProperties {
/**
*
*/
//@Value("${upload.path}")
private String uploadPath = "/mnt/dzg/image";
/**
*
*/
//@Value("${upload.prefix}")
private String uploadPrefix = "/upload";
/**
* admin
* https://dzgtest.palmte.cn
*/
//@Value("${admin.domain}")
private String adminDomain = "";
public String getUploadPath() {
return uploadPath;
}
public String getUploadPrefix() {
return uploadPrefix;
}
public String getAdminDomain() {
return adminDomain;
}
}

View File

@ -1,62 +1,62 @@
package cn.palmte.work.config;
/**
*
* @author xiongshiyan
*/
public class Constant {
public static final String PAGINATION = "pagination";
public static final String PRIVATEKEY = "privatekey";
public static final String PUBLICKEY = "publickey";
public static final String HEADER_TOKEN = "token";
public static final String API_TOKEN_MANAGER = "apiTokenManager";
public static final String PC_TOKEN_MANAGER = "pcTokenManager";
public static final String API_ERROR_COUNT_MANAGER = "apiErrorCountManager";
public static final String PC_ERROR_COUNT_MANAGER = "pcErrorCountManager";
public static final String API_CAPTCHA_MANGER = "apiCaptchaManger";
public static final String PC_CAPTCHA_MANGER = "pcCaptchaManger";
public static final String PREFIX_API_V3 = "/api/v3";
public static final String PREFIX_API_PC = "/api/pc";
public static final String PREFIX_API_DRAG = "/api/drag";
private Constant() {
}
/**
*
*/
public static final class Status {
private Status() {
}
/**
*
*/
public static final int STATUS_SUCCESS = 0;
/**
*
*/
public static final int STATUS_FAILED = 1;
/**
*
*/
public static final int STATUS_EXCEPTION = 2;
/**
*
*/
public static final int STATUS_PROMPT_LOGIN = 1009;
public static final int STATUS_PROMPT_UNAUTH = 1010;
}
/**
*
*/
public static final int STATUS_SUCCESS = 0;
/**
*
*/
public static final int STATUS_FAILED = 1;
package cn.palmte.work.config;
/**
*
* @author xiongshiyan
*/
public class Constant {
public static final String PAGINATION = "pagination";
public static final String PRIVATEKEY = "privatekey";
public static final String PUBLICKEY = "publickey";
public static final String HEADER_TOKEN = "token";
public static final String API_TOKEN_MANAGER = "apiTokenManager";
public static final String PC_TOKEN_MANAGER = "pcTokenManager";
public static final String API_ERROR_COUNT_MANAGER = "apiErrorCountManager";
public static final String PC_ERROR_COUNT_MANAGER = "pcErrorCountManager";
public static final String API_CAPTCHA_MANGER = "apiCaptchaManger";
public static final String PC_CAPTCHA_MANGER = "pcCaptchaManger";
public static final String PREFIX_API_V3 = "/api/v3";
public static final String PREFIX_API_PC = "/api/pc";
public static final String PREFIX_API_DRAG = "/api/drag";
private Constant() {
}
/**
*
*/
public static final class Status {
private Status() {
}
/**
*
*/
public static final int STATUS_SUCCESS = 0;
/**
*
*/
public static final int STATUS_FAILED = 1;
/**
*
*/
public static final int STATUS_EXCEPTION = 2;
/**
*
*/
public static final int STATUS_PROMPT_LOGIN = 1009;
public static final int STATUS_PROMPT_UNAUTH = 1010;
}
/**
*
*/
public static final int STATUS_SUCCESS = 0;
/**
*
*/
public static final int STATUS_FAILED = 1;
}

View File

@ -1,61 +1,61 @@
package cn.palmte.work.config;
import cn.palmte.work.config.interceptor.TokenLoggingInterceptor;
import cn.palmte.work.utils.StrKit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
*
* @author xiongshiyan
*/
@Component
public class GoodWebAppConfigurer extends WebMvcConfigurerAdapter {
@Autowired
private TokenLoggingInterceptor tokenLoggingInterceptor;
/**
* url
*/
@Value("${fourcal.excluded.client.urls}")
private String excludesClientUrls;
@Value("${fourcal.excluded.pc.urls}")
private String excludesPCUrls;
@Override
public void addInterceptors(InterceptorRegistry registry) {
/**拦截任意URL,打印token header参数*/
addInterceptor(registry , tokenLoggingInterceptor , "" , "/**");
/**拦截所有排除指定的*/
}
private void addInterceptor(InterceptorRegistry registry , HandlerInterceptor handlerInterceptor , String excludeUrls , String... addPartterns) {
InterceptorRegistration registration = registry.addInterceptor(handlerInterceptor)
.addPathPatterns(addPartterns);
String[] p = excludeUrls.split(",");
StrKit.trim(p);
if( p.length > 0 ){
registration.excludePathPatterns(p);
}
}
/**
*
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedHeaders("*")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "DELETE", "PUT", "OPTIONS")
.allowCredentials(false).maxAge(3600);
}
package cn.palmte.work.config;
import cn.palmte.work.config.interceptor.TokenLoggingInterceptor;
import cn.palmte.work.utils.StrKit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
*
* @author xiongshiyan
*/
@Component
public class GoodWebAppConfigurer extends WebMvcConfigurerAdapter {
@Autowired
private TokenLoggingInterceptor tokenLoggingInterceptor;
/**
* url
*/
@Value("${fourcal.excluded.client.urls}")
private String excludesClientUrls;
@Value("${fourcal.excluded.pc.urls}")
private String excludesPCUrls;
@Override
public void addInterceptors(InterceptorRegistry registry) {
/**拦截任意URL,打印token header参数*/
addInterceptor(registry , tokenLoggingInterceptor , "" , "/**");
/**拦截所有排除指定的*/
}
private void addInterceptor(InterceptorRegistry registry , HandlerInterceptor handlerInterceptor , String excludeUrls , String... addPartterns) {
InterceptorRegistration registration = registry.addInterceptor(handlerInterceptor)
.addPathPatterns(addPartterns);
String[] p = excludeUrls.split(",");
StrKit.trim(p);
if( p.length > 0 ){
registration.excludePathPatterns(p);
}
}
/**
*
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedHeaders("*")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "DELETE", "PUT", "OPTIONS")
.allowCredentials(false).maxAge(3600);
}
}

View File

@ -1,40 +1,40 @@
package cn.palmte.work.config;
import cn.palmte.work.security.ReplaceSpecialCharFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.jfunc.http.SmartHttpClient;
import top.jfunc.http.smart.JdkSmartHttpClient;
import java.util.HashMap;
import java.util.Map;
/**
* @author xiongshiyan at 2020/9/30 , contact me with email yanshixiong@126.com or phone 15208384257
*/
@Configuration
public class HttpConfig {
@Bean
public SmartHttpClient smartHttpClient(){
return new JdkSmartHttpClient();
}
/**
* xss
*/
@Bean
public FilterRegistrationBean xssFilterRegistrationBean() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
filterRegistrationBean.setFilter(new ReplaceSpecialCharFilter());
filterRegistrationBean.setOrder(1);
filterRegistrationBean.setEnabled(true);
filterRegistrationBean.addUrlPatterns("/*");
Map<String, String> initParameters = new HashMap<>();
initParameters.put("includes", "/fourcal/admin/err");
filterRegistrationBean.setInitParameters(initParameters);
return filterRegistrationBean;
}
}
package cn.palmte.work.config;
import cn.palmte.work.security.ReplaceSpecialCharFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.jfunc.http.SmartHttpClient;
import top.jfunc.http.smart.JdkSmartHttpClient;
import java.util.HashMap;
import java.util.Map;
/**
* @author xiongshiyan at 2020/9/30 , contact me with email yanshixiong@126.com or phone 15208384257
*/
@Configuration
public class HttpConfig {
@Bean
public SmartHttpClient smartHttpClient(){
return new JdkSmartHttpClient();
}
/**
* xss
*/
@Bean
public FilterRegistrationBean xssFilterRegistrationBean() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
filterRegistrationBean.setFilter(new ReplaceSpecialCharFilter());
filterRegistrationBean.setOrder(1);
filterRegistrationBean.setEnabled(true);
filterRegistrationBean.addUrlPatterns("/*");
Map<String, String> initParameters = new HashMap<>();
initParameters.put("includes", "/fourcal/admin/err");
filterRegistrationBean.setInitParameters(initParameters);
return filterRegistrationBean;
}
}

View File

@ -1,33 +1,33 @@
package cn.palmte.work.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import top.jfunc.common.db.utils.Pagination;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
* @author xiongshiyan at 2018/7/23 , contact me with email yanshixiong@126.com or phone 15208384257
*/
@Configuration
public class PaginationConfig {
@PersistenceContext
@Autowired
private EntityManager entityManagerPrimary;
///错误的注入方式
/*@Primary
@Bean(Constant.PRIMARY_PAGINATION)
public Pagination primary(@Qualifier(Constant.ENTITY_MANAGER_PRIMARY_DB) EntityManager entityManager){
return new Pagination(entityManager);
}*/
@Primary
@Bean
public Pagination primaryPagination(){
return new Pagination(entityManagerPrimary);
}
}
package cn.palmte.work.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import top.jfunc.common.db.utils.Pagination;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
* @author xiongshiyan at 2018/7/23 , contact me with email yanshixiong@126.com or phone 15208384257
*/
@Configuration
public class PaginationConfig {
@PersistenceContext
@Autowired
private EntityManager entityManagerPrimary;
///错误的注入方式
/*@Primary
@Bean(Constant.PRIMARY_PAGINATION)
public Pagination primary(@Qualifier(Constant.ENTITY_MANAGER_PRIMARY_DB) EntityManager entityManager){
return new Pagination(entityManager);
}*/
@Primary
@Bean
public Pagination primaryPagination(){
return new Pagination(entityManagerPrimary);
}
}

View File

@ -1,47 +1,47 @@
package cn.palmte.work.config;
import cn.palmte.work.model.Admin;
import cn.palmte.work.model.AdminRepository;
import cn.palmte.work.model.Project;
import cn.palmte.work.model.ProjectRepository;
import cn.palmte.work.service.ActProcDefService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.util.List;
@Configuration //1.主要用于标记配置类兼备Component的效果。
@EnableScheduling // 2.开启定时任务
public class StaticScheduleTask {
private static final Logger logger = LoggerFactory.getLogger(StaticScheduleTask.class);
@Autowired
public AdminRepository adminRepository;
@Autowired
public ProjectRepository projectRepository;
@Scheduled(cron = "0 0/5 * * * ?")
private void temp() throws Exception {
}
/*@Scheduled(cron = "0 0/1 * * * ?")
private void changeUserName() throws Exception {
logger.info("更新项目创建者姓名开始");
List<Project> all = projectRepository.findAll();
for (Project project : all) {
logger.info("更新前:"+project.getCreatorName());
Admin one = adminRepository.findOne(project.getCreatorId());
project.setCreatorName(one.getRealName());
Project project1 = projectRepository.saveAndFlush(project);
logger.info("更新后:"+project1.getCreatorName());
}
logger.info("更新项目创建者姓名结束");
}*/
}
package cn.palmte.work.config;
import cn.palmte.work.model.Admin;
import cn.palmte.work.model.AdminRepository;
import cn.palmte.work.model.Project;
import cn.palmte.work.model.ProjectRepository;
import cn.palmte.work.service.ActProcDefService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.util.List;
@Configuration //1.主要用于标记配置类兼备Component的效果。
@EnableScheduling // 2.开启定时任务
public class StaticScheduleTask {
private static final Logger logger = LoggerFactory.getLogger(StaticScheduleTask.class);
@Autowired
public AdminRepository adminRepository;
@Autowired
public ProjectRepository projectRepository;
@Scheduled(cron = "0 0/5 * * * ?")
private void temp() throws Exception {
}
/*@Scheduled(cron = "0 0/1 * * * ?")
private void changeUserName() throws Exception {
logger.info("更新项目创建者姓名开始");
List<Project> all = projectRepository.findAll();
for (Project project : all) {
logger.info("更新前:"+project.getCreatorName());
Admin one = adminRepository.findOne(project.getCreatorId());
project.setCreatorName(one.getRealName());
Project project1 = projectRepository.saveAndFlush(project);
logger.info("更新后:"+project1.getCreatorName());
}
logger.info("更新项目创建者姓名结束");
}*/
}

View File

@ -1,32 +1,32 @@
package cn.palmte.work.config;
import cn.palmte.work.service.map.MemorySimpleMap;
import cn.palmte.work.service.map.SimpleMap;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author xiongshiyan at 2018/8/14 , contact me with email yanshixiong@126.com or phone 15208384257
*/
@Configuration
public class SystemConfigWithMemory {
@Value("${fourcal.token.api.prefix}")
private String apiTokenPrefix;
@Value("#{${fourcal.token.api.expires}}")
private long apiExpires;
@Value("${fourcal.token.pc.prefix}")
private String pcTokenPrefix;
@Value("#{${fourcal.token.pc.expires}}")
private long pcExpires;
@Bean
public SimpleMap<String, String> simpleMap() {
return new MemorySimpleMap<>();
}
}
package cn.palmte.work.config;
import cn.palmte.work.service.map.MemorySimpleMap;
import cn.palmte.work.service.map.SimpleMap;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author xiongshiyan at 2018/8/14 , contact me with email yanshixiong@126.com or phone 15208384257
*/
@Configuration
public class SystemConfigWithMemory {
@Value("${fourcal.token.api.prefix}")
private String apiTokenPrefix;
@Value("#{${fourcal.token.api.expires}}")
private long apiExpires;
@Value("${fourcal.token.pc.prefix}")
private String pcTokenPrefix;
@Value("#{${fourcal.token.pc.expires}}")
private long pcExpires;
@Bean
public SimpleMap<String, String> simpleMap() {
return new MemorySimpleMap<>();
}
}

View File

@ -1,78 +1,78 @@
package cn.palmte.work.config;
/*import cn.palmte.work.model.Manager;
import cn.palmte.work.service.CaptchaCodeService;
import cn.palmte.work.service.token.redis.ApiTokenManager;
import cn.palmte.work.service.token.redis.RedisCaptchaManager;
import cn.palmte.work.service.token.redis.RedisErrorCountManager;
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import top.jfunc.token.CaptchaManger;
import top.jfunc.token.ErrorCountManager;
import top.jfunc.token.TokenManager;
import static cn.palmte.work.config.SystemConfigWithMemory.API_TOKEN_MANAGER;*/
/*@Configuration
public class SystemConfigWithRedis {
@Autowired(required = false)
RedisConnectionFactory connectionFactory;
@Bean(name = "stringRedisTemplate")
public StringRedisTemplate stringRedisTemplate() {
return new StringRedisTemplate(connectionFactory);
}
@Bean(name = "redisTemplate")
public RedisTemplate<Object, Object> redisTemplate(){
RedisTemplate<Object, Object> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory);
//避免key出现乱码
template.setKeySerializer(new StringRedisSerializer());
//value使用FastJson转换
template.setValueSerializer(new GenericFastJsonRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(new GenericFastJsonRedisSerializer());
return template;
}
@Value("${fourcal.token.api.prefix}")
private String apiTokenPrefix;
@Value("#{${fourcal.token.api.expires}}")
private long apiExpires;
@Bean(Constant.API_TOKEN_MANAGER)
public TokenManager<Manager> apiTokenManagerRedis(){
ApiTokenManager apiTokenManager = new ApiTokenManager();
apiTokenManager.setRedisTemplate(redisTemplate());
apiTokenManager.setApiExpires(apiExpires);
apiTokenManager.setMulti(true);
apiTokenManager.setTokenPrefix(apiTokenPrefix);
return apiTokenManager;
}
@Bean
public ErrorCountManager errorCountManager() {
RedisErrorCountManager redisErrorCountManager = new RedisErrorCountManager();
redisErrorCountManager.setThreshold(3);
redisErrorCountManager.setRedisTemplate(redisTemplate());
return redisErrorCountManager;
}
@Bean
public CaptchaManger captchaManger(@Autowired CaptchaCodeService captchaCodeService) {
RedisCaptchaManager captchaManger = new RedisCaptchaManager();
captchaManger.setRedisTemplate(redisTemplate());
captchaManger.setCaptchaCodeService(captchaCodeService);
return captchaManger;
}
}*/
package cn.palmte.work.config;
/*import cn.palmte.work.model.Manager;
import cn.palmte.work.service.CaptchaCodeService;
import cn.palmte.work.service.token.redis.ApiTokenManager;
import cn.palmte.work.service.token.redis.RedisCaptchaManager;
import cn.palmte.work.service.token.redis.RedisErrorCountManager;
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import top.jfunc.token.CaptchaManger;
import top.jfunc.token.ErrorCountManager;
import top.jfunc.token.TokenManager;
import static cn.palmte.work.config.SystemConfigWithMemory.API_TOKEN_MANAGER;*/
/*@Configuration
public class SystemConfigWithRedis {
@Autowired(required = false)
RedisConnectionFactory connectionFactory;
@Bean(name = "stringRedisTemplate")
public StringRedisTemplate stringRedisTemplate() {
return new StringRedisTemplate(connectionFactory);
}
@Bean(name = "redisTemplate")
public RedisTemplate<Object, Object> redisTemplate(){
RedisTemplate<Object, Object> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory);
//避免key出现乱码
template.setKeySerializer(new StringRedisSerializer());
//value使用FastJson转换
template.setValueSerializer(new GenericFastJsonRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(new GenericFastJsonRedisSerializer());
return template;
}
@Value("${fourcal.token.api.prefix}")
private String apiTokenPrefix;
@Value("#{${fourcal.token.api.expires}}")
private long apiExpires;
@Bean(Constant.API_TOKEN_MANAGER)
public TokenManager<Manager> apiTokenManagerRedis(){
ApiTokenManager apiTokenManager = new ApiTokenManager();
apiTokenManager.setRedisTemplate(redisTemplate());
apiTokenManager.setApiExpires(apiExpires);
apiTokenManager.setMulti(true);
apiTokenManager.setTokenPrefix(apiTokenPrefix);
return apiTokenManager;
}
@Bean
public ErrorCountManager errorCountManager() {
RedisErrorCountManager redisErrorCountManager = new RedisErrorCountManager();
redisErrorCountManager.setThreshold(3);
redisErrorCountManager.setRedisTemplate(redisTemplate());
return redisErrorCountManager;
}
@Bean
public CaptchaManger captchaManger(@Autowired CaptchaCodeService captchaCodeService) {
RedisCaptchaManager captchaManger = new RedisCaptchaManager();
captchaManger.setRedisTemplate(redisTemplate());
captchaManger.setCaptchaCodeService(captchaCodeService);
return captchaManger;
}
}*/

View File

@ -1,27 +1,27 @@
package cn.palmte.work.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "upload")
public class UploadProperties {
private String path;
private String prefix;
public String getPath() {
return path;
}
public String getPrefix() {
return prefix;
}
public void setPath(String path) {
this.path = path;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
}
package cn.palmte.work.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "upload")
public class UploadProperties {
private String path;
private String prefix;
public String getPath() {
return path;
}
public String getPrefix() {
return prefix;
}
public void setPath(String path) {
this.path = path;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
}

View File

@ -1,33 +1,33 @@
package cn.palmte.work.config.activiti;
import cn.palmte.work.exception.ResponseException;
import lombok.Getter;
/**
*
*/
@Getter
public enum ActApproveTypeEnum {
APPROVAL_PASSED(2, "审核通过"),
APPROVAL_UN_PASS(3, "审核不通过");
private int type;
private String name;
ActApproveTypeEnum(int type, String name) {
this.type = type;
this.name = name;
}
public static ActApproveTypeEnum ofType(int type) {
if (type == APPROVAL_PASSED.getType()) {
return APPROVAL_PASSED;
} else if (type == APPROVAL_UN_PASS.getType()) {
return APPROVAL_UN_PASS;
} else {
throw new ResponseException("不支持的审批类型【" + type + "】");
}
}
}
package cn.palmte.work.config.activiti;
import cn.palmte.work.exception.ResponseException;
import lombok.Getter;
/**
*
*/
@Getter
public enum ActApproveTypeEnum {
APPROVAL_PASSED(2, "审核通过"),
APPROVAL_UN_PASS(3, "审核不通过");
private int type;
private String name;
ActApproveTypeEnum(int type, String name) {
this.type = type;
this.name = name;
}
public static ActApproveTypeEnum ofType(int type) {
if (type == APPROVAL_PASSED.getType()) {
return APPROVAL_PASSED;
} else if (type == APPROVAL_UN_PASS.getType()) {
return APPROVAL_UN_PASS;
} else {
throw new ResponseException("不支持的审批类型【" + type + "】");
}
}
}

View File

@ -1,39 +1,39 @@
package cn.palmte.work.config.activiti;
import cn.palmte.work.exception.ResponseException;
import lombok.Getter;
/**
*
*/
@Getter
public enum ActCandidateTypeEnum {
USER(0, "按用户设置审批人"),
ROLE(1, "按角色设置审批人"),
STARTER_LEADER(2, "按发起人部门领导设置审批人"),
DEPT_LEADER(3, "按指定的部门领导设置审批人");
private int type;
private String name;
ActCandidateTypeEnum(int type, String name) {
this.type = type;
this.name = name;
}
public static ActCandidateTypeEnum ofType(int type) {
if (type == USER.getType()) {
return USER;
} else if (type == ROLE.getType()) {
return ROLE;
} else if (type == STARTER_LEADER.getType()) {
return STARTER_LEADER;
} else if (type == DEPT_LEADER.getType()) {
return DEPT_LEADER;
} else {
throw new ResponseException("不支持的类型【" + type + "】");
}
}
}
package cn.palmte.work.config.activiti;
import cn.palmte.work.exception.ResponseException;
import lombok.Getter;
/**
*
*/
@Getter
public enum ActCandidateTypeEnum {
USER(0, "按用户设置审批人"),
ROLE(1, "按角色设置审批人"),
STARTER_LEADER(2, "按发起人部门领导设置审批人"),
DEPT_LEADER(3, "按指定的部门领导设置审批人");
private int type;
private String name;
ActCandidateTypeEnum(int type, String name) {
this.type = type;
this.name = name;
}
public static ActCandidateTypeEnum ofType(int type) {
if (type == USER.getType()) {
return USER;
} else if (type == ROLE.getType()) {
return ROLE;
} else if (type == STARTER_LEADER.getType()) {
return STARTER_LEADER;
} else if (type == DEPT_LEADER.getType()) {
return DEPT_LEADER;
} else {
throw new ResponseException("不支持的类型【" + type + "】");
}
}
}

View File

@ -1,33 +1,33 @@
package cn.palmte.work.config.activiti;
public class ActConstant {
/**
*
*/
public static final String START_PROCESS_USERID = "startUserId";
/**
* id
*/
public static final String DEPT_LEADER_ID = "deptLeaderId";
/**
*
*/
public static final int TASK_TYPE_SINGE = 0;
/**
*
*/
public static final int TASK_TYPE_MULTI = 1;
public static final String PROCESS_TASKS_ESTIMATE = "填报概算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
public static final String PROCESS_TASKS_BUDGET = "填报预算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
public static final String PROCESS_TASKS_SETTLE = "填报结算#财务总监";
public static final String PROCESS_TASKS_FINAL = "填报决算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
public static final String KEY_PROJECT_TYPE = "projectType";
}
package cn.palmte.work.config.activiti;
public class ActConstant {
/**
*
*/
public static final String START_PROCESS_USERID = "startUserId";
/**
* id
*/
public static final String DEPT_LEADER_ID = "deptLeaderId";
/**
*
*/
public static final int TASK_TYPE_SINGE = 0;
/**
*
*/
public static final int TASK_TYPE_MULTI = 1;
public static final String PROCESS_TASKS_ESTIMATE = "填报概算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
public static final String PROCESS_TASKS_BUDGET = "填报预算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
public static final String PROCESS_TASKS_SETTLE = "填报结算#财务总监";
public static final String PROCESS_TASKS_FINAL = "填报决算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
public static final String KEY_PROJECT_TYPE = "projectType";
}

View File

@ -1,63 +1,63 @@
package cn.palmte.work.config.activiti;
import cn.palmte.work.exception.ResponseException;
import lombok.Getter;
/**
* key
*/
@Getter
public enum ActProcessKeyEnum {
ESTIMATE("estimate", "概算审批流程"),
BUDGET("budget", "预算审批流程"),
SETTLE("settle", "结算审批流程"),
FINAL("final", "决算审批流程"),
SALE_CONTRACT("saleContract", "销售合同审批流程"),
BUSINESS_PURCHASE("businessPurchase", "业务采购审批流程");
private String key;
private String name;
ActProcessKeyEnum(String key, String name) {
this.key = key;
this.name = name;
}
public static ActProcessKeyEnum ofKey(String key) {
if (ESTIMATE.getKey().equals(key)) {
return ESTIMATE;
} else if (BUDGET.getKey().equals(key)) {
return BUDGET;
} else if (SETTLE.getKey().equals(key)) {
return SETTLE;
} else if (FINAL.getKey().equals(key)) {
return FINAL;
} else if (SALE_CONTRACT.getKey().equals(key)) {
return SALE_CONTRACT;
} else if (BUSINESS_PURCHASE.getKey().equals(key)) {
return BUSINESS_PURCHASE;
} else {
throw new ResponseException("不支持的流程key【" + key + "】");
}
}
public static ActProcessKeyEnum ofProcDefId(String proDefId) {
if (proDefId.startsWith(ESTIMATE.getKey())) {
return ESTIMATE;
} else if (proDefId.startsWith(BUDGET.getKey())) {
return BUDGET;
} else if (proDefId.startsWith(SETTLE.getKey())) {
return SETTLE;
} else if (proDefId.startsWith(FINAL.getKey())) {
return FINAL;
} else if (proDefId.startsWith(SALE_CONTRACT.getKey())) {
return SALE_CONTRACT;
} else if (proDefId.startsWith(BUSINESS_PURCHASE.getKey())) {
return BUSINESS_PURCHASE;
} else {
throw new ResponseException("不支持的流程key【" + proDefId + "】");
}
}
}
package cn.palmte.work.config.activiti;
import cn.palmte.work.exception.ResponseException;
import lombok.Getter;
/**
* key
*/
@Getter
public enum ActProcessKeyEnum {
ESTIMATE("estimate", "概算审批流程"),
BUDGET("budget", "预算审批流程"),
SETTLE("settle", "结算审批流程"),
FINAL("final", "决算审批流程"),
SALE_CONTRACT("saleContract", "销售合同审批流程"),
BUSINESS_PURCHASE("businessPurchase", "业务采购审批流程");
private String key;
private String name;
ActProcessKeyEnum(String key, String name) {
this.key = key;
this.name = name;
}
public static ActProcessKeyEnum ofKey(String key) {
if (ESTIMATE.getKey().equals(key)) {
return ESTIMATE;
} else if (BUDGET.getKey().equals(key)) {
return BUDGET;
} else if (SETTLE.getKey().equals(key)) {
return SETTLE;
} else if (FINAL.getKey().equals(key)) {
return FINAL;
} else if (SALE_CONTRACT.getKey().equals(key)) {
return SALE_CONTRACT;
} else if (BUSINESS_PURCHASE.getKey().equals(key)) {
return BUSINESS_PURCHASE;
} else {
throw new ResponseException("不支持的流程key【" + key + "】");
}
}
public static ActProcessKeyEnum ofProcDefId(String proDefId) {
if (proDefId.startsWith(ESTIMATE.getKey())) {
return ESTIMATE;
} else if (proDefId.startsWith(BUDGET.getKey())) {
return BUDGET;
} else if (proDefId.startsWith(SETTLE.getKey())) {
return SETTLE;
} else if (proDefId.startsWith(FINAL.getKey())) {
return FINAL;
} else if (proDefId.startsWith(SALE_CONTRACT.getKey())) {
return SALE_CONTRACT;
} else if (proDefId.startsWith(BUSINESS_PURCHASE.getKey())) {
return BUSINESS_PURCHASE;
} else {
throw new ResponseException("不支持的流程key【" + proDefId + "】");
}
}
}

View File

@ -1,36 +1,36 @@
package cn.palmte.work.config.activiti;
import cn.palmte.work.exception.ResponseException;
import lombok.Getter;
/**
*
*/
@Getter
public enum ActProjectTypeEnum {
FOURCAL(0, "四算项目"),
SALE_CONTRACT(1, "销售合同项目"),
BUSINESS_PURCHASE(2, "业务采购项目");
private int type;
private String name;
ActProjectTypeEnum(int type, String name) {
this.type = type;
this.name = name;
}
public static ActProjectTypeEnum ofType(int type) {
if (type == FOURCAL.getType()) {
return FOURCAL;
} else if (type == SALE_CONTRACT.getType()) {
return SALE_CONTRACT;
} else if (type == BUSINESS_PURCHASE.getType()) {
return BUSINESS_PURCHASE;
} else {
throw new ResponseException("不支持的项目类型【" + type + "】");
}
}
}
package cn.palmte.work.config.activiti;
import cn.palmte.work.exception.ResponseException;
import lombok.Getter;
/**
*
*/
@Getter
public enum ActProjectTypeEnum {
FOURCAL(0, "四算项目"),
SALE_CONTRACT(1, "销售合同项目"),
BUSINESS_PURCHASE(2, "业务采购项目");
private int type;
private String name;
ActProjectTypeEnum(int type, String name) {
this.type = type;
this.name = name;
}
public static ActProjectTypeEnum ofType(int type) {
if (type == FOURCAL.getType()) {
return FOURCAL;
} else if (type == SALE_CONTRACT.getType()) {
return SALE_CONTRACT;
} else if (type == BUSINESS_PURCHASE.getType()) {
return BUSINESS_PURCHASE;
} else {
throw new ResponseException("不支持的项目类型【" + type + "】");
}
}
}

View File

@ -1,39 +1,39 @@
package cn.palmte.work.config.activiti;
import cn.palmte.work.exception.ResponseException;
import lombok.Getter;
/**
*
*/
@Getter
public enum ActTaskIndexEnum {
END(-1, "结束节点"),
COMMON(0, "除发起审批外的用户节点"),
START(1, "开始节点"),
FIRST_USER_TASK(2, "发起审批节点");
private int index;
private String name;
ActTaskIndexEnum(int index, String name) {
this.index = index;
this.name = name;
}
public static ActTaskIndexEnum ofIndex(int index) {
if (index == END.getIndex()) {
return END;
} else if (index == COMMON.getIndex()) {
return COMMON;
} else if (index == START.getIndex()) {
return START;
} else if (index == FIRST_USER_TASK.getIndex()) {
return FIRST_USER_TASK;
} else {
throw new ResponseException("不支持的节点类型【" + index + "】");
}
}
}
package cn.palmte.work.config.activiti;
import cn.palmte.work.exception.ResponseException;
import lombok.Getter;
/**
*
*/
@Getter
public enum ActTaskIndexEnum {
END(-1, "结束节点"),
COMMON(0, "除发起审批外的用户节点"),
START(1, "开始节点"),
FIRST_USER_TASK(2, "发起审批节点");
private int index;
private String name;
ActTaskIndexEnum(int index, String name) {
this.index = index;
this.name = name;
}
public static ActTaskIndexEnum ofIndex(int index) {
if (index == END.getIndex()) {
return END;
} else if (index == COMMON.getIndex()) {
return COMMON;
} else if (index == START.getIndex()) {
return START;
} else if (index == FIRST_USER_TASK.getIndex()) {
return FIRST_USER_TASK;
} else {
throw new ResponseException("不支持的节点类型【" + index + "】");
}
}
}

View File

@ -1,40 +1,40 @@
package cn.palmte.work.config.activiti;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
@Configuration
public class ActivitiConfig {
@Autowired
PlatformTransactionManager transactionManager;
@Autowired
DataSource dataSource;
@Bean
public SpringProcessEngineConfiguration getProcessEngineConfiguration() {
SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
config.setDataSource(dataSource);
config.setTransactionManager(transactionManager);
config.setDbHistoryUsed(true);
config.setHistory("full");
config.setActivityFontName("宋体");
//数据库更新策略
//flase 默认值。activiti在启动时会对比数据库表中保存的版本如果没有表或者版本不匹配将抛出异常。生产环境常用
//true activiti会对数据库中所有表进行更新操作。如果表不存在则自动创建。开发时常用
//create_drop 在activiti启动时创建表在关闭时删除表必须手动关闭引擎才能删除表单元测试常用
//drop-create 在activiti启动时删除原来的旧表然后在创建新表不需要手动关闭引擎
config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);
return config;
}
}
package cn.palmte.work.config.activiti;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
@Configuration
public class ActivitiConfig {
@Autowired
PlatformTransactionManager transactionManager;
@Autowired
DataSource dataSource;
@Bean
public SpringProcessEngineConfiguration getProcessEngineConfiguration() {
SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
config.setDataSource(dataSource);
config.setTransactionManager(transactionManager);
config.setDbHistoryUsed(true);
config.setHistory("full");
config.setActivityFontName("宋体");
//数据库更新策略
//flase 默认值。activiti在启动时会对比数据库表中保存的版本如果没有表或者版本不匹配将抛出异常。生产环境常用
//true activiti会对数据库中所有表进行更新操作。如果表不存在则自动创建。开发时常用
//create_drop 在activiti启动时创建表在关闭时删除表必须手动关闭引擎才能删除表单元测试常用
//drop-create 在activiti启动时删除原来的旧表然后在创建新表不需要手动关闭引擎
config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);
return config;
}
}

View File

@ -1,32 +1,32 @@
package cn.palmte.work.config.activiti;
import org.activiti.engine.impl.cmd.NeedsActiveTaskCmd;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.TaskEntity;
import org.activiti.engine.impl.persistence.entity.TaskEntityManagerImpl;
/**
* id
*/
public class DeleteTaskCommand extends NeedsActiveTaskCmd<String> {
public DeleteTaskCommand(String taskId) {
super(taskId);
}
@Override
public String execute(CommandContext commandContext, TaskEntity currentTask) {
//获取所需服务
TaskEntityManagerImpl taskEntityManager = (TaskEntityManagerImpl) commandContext.getTaskEntityManager();
//获取当前任务的来源任务及来源节点信息
ExecutionEntity executionEntity = currentTask.getExecution();
//删除当前任务,来源任务
taskEntityManager.deleteTask(currentTask, "驳回", false, false);
return executionEntity.getId();
}
@Override
public String getSuspendedTaskException() {
return "挂起的任务不能跳转";
}
}
package cn.palmte.work.config.activiti;
import org.activiti.engine.impl.cmd.NeedsActiveTaskCmd;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.TaskEntity;
import org.activiti.engine.impl.persistence.entity.TaskEntityManagerImpl;
/**
* id
*/
public class DeleteTaskCommand extends NeedsActiveTaskCmd<String> {
public DeleteTaskCommand(String taskId) {
super(taskId);
}
@Override
public String execute(CommandContext commandContext, TaskEntity currentTask) {
//获取所需服务
TaskEntityManagerImpl taskEntityManager = (TaskEntityManagerImpl) commandContext.getTaskEntityManager();
//获取当前任务的来源任务及来源节点信息
ExecutionEntity executionEntity = currentTask.getExecution();
//删除当前任务,来源任务
taskEntityManager.deleteTask(currentTask, "驳回", false, false);
return executionEntity.getId();
}
@Override
public String getSuspendedTaskException() {
return "挂起的任务不能跳转";
}
}

View File

@ -1,40 +1,40 @@
package cn.palmte.work.config.activiti;
import org.activiti.bpmn.model.FlowNode;
import org.activiti.bpmn.model.SequenceFlow;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import java.util.List;
/**
* id
*
* @author
*/
public class JumpCommand implements Command<Void> {
private FlowNode flowElement;
private String executionId;
public JumpCommand(FlowNode flowElement, String executionId) {
this.flowElement = flowElement;
this.executionId = executionId;
}
@Override
public Void execute(CommandContext commandContext) {
//获取目标节点的来源连线
List<SequenceFlow> flows = flowElement.getIncomingFlows();
if (flows == null || flows.isEmpty()) {
throw new ActivitiException("回退错误,目标节点没有来源连线");
}
//随便选一条连线来执行,当前执行计划为,从连线流转到目标节点,实现跳转
ExecutionEntity executionEntity = commandContext.getExecutionEntityManager().findById(executionId);
executionEntity.setCurrentFlowElement(flows.get(0));
commandContext.getAgenda().planTakeOutgoingSequenceFlowsOperation(executionEntity, true);
return null;
}
}
package cn.palmte.work.config.activiti;
import org.activiti.bpmn.model.FlowNode;
import org.activiti.bpmn.model.SequenceFlow;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import java.util.List;
/**
* id
*
* @author
*/
public class JumpCommand implements Command<Void> {
private FlowNode flowElement;
private String executionId;
public JumpCommand(FlowNode flowElement, String executionId) {
this.flowElement = flowElement;
this.executionId = executionId;
}
@Override
public Void execute(CommandContext commandContext) {
//获取目标节点的来源连线
List<SequenceFlow> flows = flowElement.getIncomingFlows();
if (flows == null || flows.isEmpty()) {
throw new ActivitiException("回退错误,目标节点没有来源连线");
}
//随便选一条连线来执行,当前执行计划为,从连线流转到目标节点,实现跳转
ExecutionEntity executionEntity = commandContext.getExecutionEntityManager().findById(executionId);
executionEntity.setCurrentFlowElement(flows.get(0));
commandContext.getAgenda().planTakeOutgoingSequenceFlowsOperation(executionEntity, true);
return null;
}
}

View File

@ -1,97 +1,97 @@
package cn.palmte.work.config.interceptor;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.config.Constant;
import cn.palmte.work.config.log.LogExcluder;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import top.jfunc.token.TokenManager;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import static cn.palmte.work.config.Constant.HEADER_TOKEN;
/**
* @author xiongshiyan
*/
public abstract class AbstractLoginInterceptor extends HandlerInterceptorAdapter {
private static final Logger logger = LoggerFactory.getLogger(AbstractLoginInterceptor.class);
protected void printNeccery(HttpServletRequest request, LogExcluder logExcluder) {
//拦截特殊字符
String[] specialStr = {"|", "&", ";", "$", "%", "@", "'", "\"", "\\'", "\\\"", "<", ">", "(", ")", "+", "CR", "LF", ",", "\\"};
for (String s : specialStr) {
if (request.getRequestURI().contains(s)) {
logger.info("uri:" + request.getRequestURI() + "含有特殊字符:" + s);
return;
}
}
if (logExcluder.needExcluded(request.getRequestURI())) {
return;
}
logger.info("uri:" + request.getRequestURI() + ",token:" + request.getHeader(HEADER_TOKEN));
}
protected boolean verifyLogin(HttpServletResponse response, TokenManager<?> tokenManager, String token, boolean cors) throws IOException {
/// Object o = tokenManager.findByToken(token);
boolean exist = tokenManager.existByToken(token);
if (!exist) {
promptLogin(response, cors);
return false;
} else {
tokenManager.updateExpires(token);
return true;
}
}
protected boolean verifyLogin(HttpServletResponse response, TokenManager<String> tokenManager, String token, boolean cors, String phone) throws IOException {
if (null == phone) {
promptLogin(response, cors);
return false;
} else {
tokenManager.updateExpires(token);
return true;
}
}
protected void promptLogin(HttpServletResponse response, boolean cors) throws IOException {
response.setContentType("application/json;charset=utf-8");
response.setCharacterEncoding("utf-8");
if (cors) {
cors(response);
}
response.getWriter().write(JSON.toJSONString(ResponseMsg.buildMsg(Constant.Status.STATUS_PROMPT_LOGIN, "login first please", "")));
}
protected void promptNoPermission(HttpServletResponse response, boolean cors) throws IOException {
response.setContentType("application/json;charset=utf-8");
response.setCharacterEncoding("utf-8");
if (cors) {
cors(response);
}
response.getWriter().write(JSON.toJSONString(ResponseMsg.buildMsg(Constant.Status.STATUS_PROMPT_UNAUTH, "you have no permission", "")));
}
protected void promptLogin(HttpServletResponse response) throws IOException {
promptLogin(response, false);
}
/**
*
*
* @param response HttpServletResponse
*/
private void cors(HttpServletResponse response) {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Allow-Methods", "POST,GET,DELETE,PUT,OPTIONS");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Credentials", "true");
}
package cn.palmte.work.config.interceptor;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.config.Constant;
import cn.palmte.work.config.log.LogExcluder;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import top.jfunc.token.TokenManager;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import static cn.palmte.work.config.Constant.HEADER_TOKEN;
/**
* @author xiongshiyan
*/
public abstract class AbstractLoginInterceptor extends HandlerInterceptorAdapter {
private static final Logger logger = LoggerFactory.getLogger(AbstractLoginInterceptor.class);
protected void printNeccery(HttpServletRequest request, LogExcluder logExcluder) {
//拦截特殊字符
String[] specialStr = {"|", "&", ";", "$", "%", "@", "'", "\"", "\\'", "\\\"", "<", ">", "(", ")", "+", "CR", "LF", ",", "\\"};
for (String s : specialStr) {
if (request.getRequestURI().contains(s)) {
logger.info("uri:" + request.getRequestURI() + "含有特殊字符:" + s);
return;
}
}
if (logExcluder.needExcluded(request.getRequestURI())) {
return;
}
logger.info("uri:" + request.getRequestURI() + ",token:" + request.getHeader(HEADER_TOKEN));
}
protected boolean verifyLogin(HttpServletResponse response, TokenManager<?> tokenManager, String token, boolean cors) throws IOException {
/// Object o = tokenManager.findByToken(token);
boolean exist = tokenManager.existByToken(token);
if (!exist) {
promptLogin(response, cors);
return false;
} else {
tokenManager.updateExpires(token);
return true;
}
}
protected boolean verifyLogin(HttpServletResponse response, TokenManager<String> tokenManager, String token, boolean cors, String phone) throws IOException {
if (null == phone) {
promptLogin(response, cors);
return false;
} else {
tokenManager.updateExpires(token);
return true;
}
}
protected void promptLogin(HttpServletResponse response, boolean cors) throws IOException {
response.setContentType("application/json;charset=utf-8");
response.setCharacterEncoding("utf-8");
if (cors) {
cors(response);
}
response.getWriter().write(JSON.toJSONString(ResponseMsg.buildMsg(Constant.Status.STATUS_PROMPT_LOGIN, "login first please", "")));
}
protected void promptNoPermission(HttpServletResponse response, boolean cors) throws IOException {
response.setContentType("application/json;charset=utf-8");
response.setCharacterEncoding("utf-8");
if (cors) {
cors(response);
}
response.getWriter().write(JSON.toJSONString(ResponseMsg.buildMsg(Constant.Status.STATUS_PROMPT_UNAUTH, "you have no permission", "")));
}
protected void promptLogin(HttpServletResponse response) throws IOException {
promptLogin(response, false);
}
/**
*
*
* @param response HttpServletResponse
*/
private void cors(HttpServletResponse response) {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Allow-Methods", "POST,GET,DELETE,PUT,OPTIONS");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Credentials", "true");
}
}

View File

@ -1,27 +1,27 @@
package cn.palmte.work.config.interceptor;
import cn.palmte.work.config.log.LogExcluder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* headertoken
* @author xiongshiyan
*/
@Component
public class TokenLoggingInterceptor extends AbstractLoginInterceptor {
@Autowired
private LogExcluder logExcluder;
/**
* Handler
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
printNeccery(request , logExcluder);
return true;
}
package cn.palmte.work.config.interceptor;
import cn.palmte.work.config.log.LogExcluder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* headertoken
* @author xiongshiyan
*/
@Component
public class TokenLoggingInterceptor extends AbstractLoginInterceptor {
@Autowired
private LogExcluder logExcluder;
/**
* Handler
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
printNeccery(request , logExcluder);
return true;
}
}

View File

@ -1,53 +1,53 @@
package cn.palmte.work.config.log;
import cn.palmte.work.utils.StrKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Arrays;
/**
*
* @author xiongshiyan at 2018/12/23 , contact me with email yanshixiong@126.com or phone 15208384257
*/
@Component
public class LogExcluder implements InitializingBean{
private static final Logger logger = LoggerFactory.getLogger(LogExcluder.class);
@Value("${server.context-path:/fourcal}")
private String contextPath;
@Value("${fourcal.log.excluded.urls:}")
private String[] logExcludedUrls;
@Override
public void afterPropertiesSet() throws Exception {
if(isEmpty(logExcludedUrls)){
return;
}
StrKit.trim(logExcludedUrls);
logger.info(Arrays.asList(logExcludedUrls).toString());
}
public boolean needExcluded(String uri){
//没有需要排除的
if(isEmpty(logExcludedUrls)){
return false;
}
//去除前端轮询的
if(uri.contains("api/pc/alarm/fetchAlarm")){
return true;
}
//去掉前缀
uri = uri.replace(contextPath , "");
return StrKit.targetInArray(logExcludedUrls , uri);
}
private <T> boolean isEmpty(T[] array){
return null == array || 0 == array.length;
}
}
package cn.palmte.work.config.log;
import cn.palmte.work.utils.StrKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Arrays;
/**
*
* @author xiongshiyan at 2018/12/23 , contact me with email yanshixiong@126.com or phone 15208384257
*/
@Component
public class LogExcluder implements InitializingBean{
private static final Logger logger = LoggerFactory.getLogger(LogExcluder.class);
@Value("${server.context-path:/fourcal}")
private String contextPath;
@Value("${fourcal.log.excluded.urls:}")
private String[] logExcludedUrls;
@Override
public void afterPropertiesSet() throws Exception {
if(isEmpty(logExcludedUrls)){
return;
}
StrKit.trim(logExcludedUrls);
logger.info(Arrays.asList(logExcludedUrls).toString());
}
public boolean needExcluded(String uri){
//没有需要排除的
if(isEmpty(logExcludedUrls)){
return false;
}
//去除前端轮询的
if(uri.contains("api/pc/alarm/fetchAlarm")){
return true;
}
//去掉前缀
uri = uri.replace(contextPath , "");
return StrKit.targetInArray(logExcludedUrls , uri);
}
private <T> boolean isEmpty(T[] array){
return null == array || 0 == array.length;
}
}

View File

@ -1,53 +1,53 @@
package cn.palmte.work.config.log;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
/**
* @author xiongshiyan
*
*/
@Aspect
@Component
@Order(1)
public class WebLogAspect {
private static final Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
@Autowired
private LogExcluder logExcluder;
@Pointcut("execution(public * cn.palmte.work.controller..*.*(..))")
public void webLog(){}
@Around(value = "webLog()")
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
if(logExcluder.needExcluded(request.getRequestURI())){
return proceedingJoinPoint.proceed();
}
logger.info("REQUEST : " + request.getRequestURI() + " : "
+(proceedingJoinPoint.getSignature().getDeclaringTypeName() + "." + proceedingJoinPoint.getSignature().getName() + " : ")
+ Arrays.toString(proceedingJoinPoint.getArgs()));
Object proceed = proceedingJoinPoint.proceed();
logger.info("RESPONSE : " + proceed);
return proceed;
}
}
package cn.palmte.work.config.log;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
/**
* @author xiongshiyan
*
*/
@Aspect
@Component
@Order(1)
public class WebLogAspect {
private static final Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
@Autowired
private LogExcluder logExcluder;
@Pointcut("execution(public * cn.palmte.work.controller..*.*(..))")
public void webLog(){}
@Around(value = "webLog()")
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
if(logExcluder.needExcluded(request.getRequestURI())){
return proceedingJoinPoint.proceed();
}
logger.info("REQUEST : " + request.getRequestURI() + " : "
+(proceedingJoinPoint.getSignature().getDeclaringTypeName() + "." + proceedingJoinPoint.getSignature().getName() + " : ")
+ Arrays.toString(proceedingJoinPoint.getArgs()));
Object proceed = proceedingJoinPoint.proceed();
logger.info("RESPONSE : " + proceed);
return proceed;
}
}

View File

@ -1,277 +1,277 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.config.Constant;
import cn.palmte.work.model.Admin;
import cn.palmte.work.model.Dept;
import cn.palmte.work.model.DeptRepository;
import cn.palmte.work.model.UserPositionRepository;
import cn.palmte.work.pojo.ModifyPasswordRequest;
import cn.palmte.work.service.AccountService;
import cn.palmte.work.service.AdminService;
import cn.palmte.work.service.SysRoleService;
import cn.palmte.work.utils.InterfaceUtil;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.ExcelLogs;
import cn.palmte.work.utils.excel.ExcelUtil;
import cn.palmte.work.utils.excel.ExportUtils;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import top.jfunc.common.crypto.symmetric.DESAS;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.utils.CollectionUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Controller
@RequestMapping("/account")
public class AccountController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(AccountController.class);
@Autowired
private AccountService accountService;
@Autowired
private AdminService adminService;
@Autowired
private SysRoleService sysRoleService;
@Autowired
private DeptRepository deptRepository;
@Autowired
private UserPositionRepository userPositionRepository;
@RequestMapping(value = "/updatePassword")
@ResponseBody
public ResponseMsg updatePassword(HttpServletRequest request, ModifyPasswordRequest modifyPasswordRequest) {
ResponseMsg responseMsg = new ResponseMsg();
try {
String privateKey = (String) request.getSession().getAttribute(Constant.PRIVATEKEY);
adminService.updatePassword(modifyPasswordRequest.getId(), modifyPasswordRequest.getPassword(),
modifyPasswordRequest.getNewPassword(), privateKey);
responseMsg.setStatus(0);
responseMsg.setMsg("密码修改成功");
} catch (Exception e) {
responseMsg.setStatus(1);
responseMsg.setMsg("密码修改失败:" + e.getMessage());
}
return responseMsg;
}
@RequestMapping("/list")
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
// 初始化参数
setModel(keywords, model);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("roleList", sysRoleService.getAllEnableSysRole());
model.put("deptList", deptRepository.findFirstLevelDept());
model.put("positionList", userPositionRepository.findAll());
Page<Admin> page = accountService.list(searchInfo, pageNumber, pageSize);
List<Admin> list = page.getList();
if(CollectionUtil.isNotEmpty(list)){
int offset = (pageNumber - 1) * pageSize;
for (int i = 0 , size = list.size(); i < size; i++) {
list.get(i).setTempId(i+1 + offset);
}
}
model.put("pager", page);
return "/admin/account_list";
}
/**
*
*/
@RequestMapping("/add")
public String add(HttpServletRequest request, Map<String, Object> model) {
genRSAKeyPair(request, model);
model.put("userId", -1);
model.put("account", new Admin());
model.put("roleList", sysRoleService.getAllEnableSysRole());
model.put("deptList", deptRepository.findEnable());
model.put("positionList", userPositionRepository.findAll());
return "/admin/account_input";
}
/**
*
*/
@RequestMapping("/edit")
public String edit(@RequestParam("userId") int userId, Map<String, Object> model) {
Admin admin = accountService.findUserById(userId);
model.put("account", admin);
model.put("userId", userId);
model.put("roleList", sysRoleService.getAllEnableSysRole());
model.put("deptList", deptRepository.findEnable());
model.put("positionList", userPositionRepository.findAll());
return "/admin/account_input";
}
/**
*
*/
@RequestMapping("/save")
public String save(@RequestParam("userId") int userId, Admin admin, HttpServletRequest request, Map<String, Object> model) throws IOException {
if (admin.getRoleId() <= 0) {
model.put("errorMessage", "角色不能为空!");
return "/common/error";
}
//获取验证用户信息
String message = accountService.validateUserExistInfo(userId, admin);
if (StringUtils.isNotEmpty(message)) {
model.put("errorMessage", message);
return "/common/error";
}
try {
HttpSession session = request.getSession();
String privateKey = (String) session.getAttribute(Constant.PRIVATEKEY);
accountService.saveOrUpdateAccount(userId, admin.getRoleId(), admin, privateKey);
} catch (Exception e) {
model.put("errorMessage", "保存账号出错!请联系管理员处理");
return "/common/error";
}
return "redirect:/account/list";
}
/**
*
*/
@RequestMapping("/changeStatus")
public ResponseMsg changeStatus(Admin admin) {
boolean locked = accountService.changeStatus(admin.getId(), admin.getEnabled());
if (locked) {
return ResponseMsg.buildSuccessMsg("操作成功");
} else {
return ResponseMsg.buildFailedMsg("操作失败");
}
}
/**
*
*/
@RequestMapping("/delete")
@ResponseBody
public ResponseMsg delete(@RequestParam("userId") int userId) {
ResponseMsg responseMsg = new ResponseMsg();
boolean deleted = accountService.deleteAccount(userId);
if (deleted) {
responseMsg.setStatus(0);
responseMsg.setMsg("删除成功");
} else {
responseMsg.setStatus(1);
responseMsg.setMsg("删除失败");
}
return responseMsg;
}
/**
* ID
*/
@RequestMapping("/resetPassword")
@ResponseBody
public ResponseMsg resetPassword(@RequestParam("userId") int userId, HttpServletRequest request) {
HttpSession session = request.getSession();
String privateKey = (String) session.getAttribute(Constant.PRIVATEKEY);
boolean flag = accountService.resetPassword(userId, privateKey);
ResponseMsg responseMsg = new ResponseMsg();
if (flag) {
responseMsg.setStatus(0);
responseMsg.setMsg("重置密码成功");
} else {
responseMsg.setStatus(1);
responseMsg.setMsg("重置密码失败");
}
return responseMsg;
}
/**
*
*/
@RequestMapping("/password")
public String password(HttpServletRequest request, Map<String, Object> model) {
Admin admin = adminService.getAdminById(InterfaceUtil.getAdminId());
try {
String id = new DESAS().encrypt(admin.getId().toString());
model.put("userId", id);
} catch (Exception e) {
e.printStackTrace();
}
model.put("SysUser", admin);
genRSAKeyPair(request, model);
return "/admin/account_password";
}
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
model.put("roleType", "-1");
model.put("keywords", keywords);
}
@RequestMapping("/export")
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(httpServletResponse, Utils.generateExcelName("人员信息"), "application/octet-stream");
String[] headers = {"四算系统登录账号", "手机号码", "姓名", "常驻地", "一级部门", "二级部门", "三级部门", "直接主管", "职位", "角色名称", "公司邮件地址"};
String[] exportColumns = {"userName", "telephone", "realName", "workLocation", "deptFirstName", "deptSecondName", "deptThirdName", "directManager", "positionName", "roleName", "companyEmail"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> accountService.list(searchInfo, pN, pS).getList());
}
/**
*
*/
@RequestMapping("/template")
public void template(HttpServletResponse response) throws Exception {
String[] headers = new String[]{"四算系统登录账号", "手机号码", "姓名", "常驻地", "所属部门", "直接主管", "职位", "角色名称", "公司邮件地址"};
downloadHeader(response, Utils.generateExcelName("人员信息批量导入模板"));
ExportUtils exportUtils = new ExportUtils(headers);
exportUtils.write(response.getOutputStream());
}
/**
*
*/
@RequestMapping("/batchImport")
@ResponseBody
public String batchImport(MultipartFile file) {
try {
ExcelLogs logs = new ExcelLogs();
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
"yyyy/MM/dd HH:mm:ss", logs, 0);
synchronized (this) {
return JSON.toJSONString(accountService.check(maps));
}
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误请上传excel 2003/2007格式文件"));
} catch (Exception e) {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
}
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.config.Constant;
import cn.palmte.work.model.Admin;
import cn.palmte.work.model.Dept;
import cn.palmte.work.model.DeptRepository;
import cn.palmte.work.model.UserPositionRepository;
import cn.palmte.work.pojo.ModifyPasswordRequest;
import cn.palmte.work.service.AccountService;
import cn.palmte.work.service.AdminService;
import cn.palmte.work.service.SysRoleService;
import cn.palmte.work.utils.InterfaceUtil;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.ExcelLogs;
import cn.palmte.work.utils.excel.ExcelUtil;
import cn.palmte.work.utils.excel.ExportUtils;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import top.jfunc.common.crypto.symmetric.DESAS;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.utils.CollectionUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Controller
@RequestMapping("/account")
public class AccountController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(AccountController.class);
@Autowired
private AccountService accountService;
@Autowired
private AdminService adminService;
@Autowired
private SysRoleService sysRoleService;
@Autowired
private DeptRepository deptRepository;
@Autowired
private UserPositionRepository userPositionRepository;
@RequestMapping(value = "/updatePassword")
@ResponseBody
public ResponseMsg updatePassword(HttpServletRequest request, ModifyPasswordRequest modifyPasswordRequest) {
ResponseMsg responseMsg = new ResponseMsg();
try {
String privateKey = (String) request.getSession().getAttribute(Constant.PRIVATEKEY);
adminService.updatePassword(modifyPasswordRequest.getId(), modifyPasswordRequest.getPassword(),
modifyPasswordRequest.getNewPassword(), privateKey);
responseMsg.setStatus(0);
responseMsg.setMsg("密码修改成功");
} catch (Exception e) {
responseMsg.setStatus(1);
responseMsg.setMsg("密码修改失败:" + e.getMessage());
}
return responseMsg;
}
@RequestMapping("/list")
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
// 初始化参数
setModel(keywords, model);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("roleList", sysRoleService.getAllEnableSysRole());
model.put("deptList", deptRepository.findFirstLevelDept());
model.put("positionList", userPositionRepository.findAll());
Page<Admin> page = accountService.list(searchInfo, pageNumber, pageSize);
List<Admin> list = page.getList();
if(CollectionUtil.isNotEmpty(list)){
int offset = (pageNumber - 1) * pageSize;
for (int i = 0 , size = list.size(); i < size; i++) {
list.get(i).setTempId(i+1 + offset);
}
}
model.put("pager", page);
return "/admin/account_list";
}
/**
*
*/
@RequestMapping("/add")
public String add(HttpServletRequest request, Map<String, Object> model) {
genRSAKeyPair(request, model);
model.put("userId", -1);
model.put("account", new Admin());
model.put("roleList", sysRoleService.getAllEnableSysRole());
model.put("deptList", deptRepository.findEnable());
model.put("positionList", userPositionRepository.findAll());
return "/admin/account_input";
}
/**
*
*/
@RequestMapping("/edit")
public String edit(@RequestParam("userId") int userId, Map<String, Object> model) {
Admin admin = accountService.findUserById(userId);
model.put("account", admin);
model.put("userId", userId);
model.put("roleList", sysRoleService.getAllEnableSysRole());
model.put("deptList", deptRepository.findEnable());
model.put("positionList", userPositionRepository.findAll());
return "/admin/account_input";
}
/**
*
*/
@RequestMapping("/save")
public String save(@RequestParam("userId") int userId, Admin admin, HttpServletRequest request, Map<String, Object> model) throws IOException {
if (admin.getRoleId() <= 0) {
model.put("errorMessage", "角色不能为空!");
return "/common/error";
}
//获取验证用户信息
String message = accountService.validateUserExistInfo(userId, admin);
if (StringUtils.isNotEmpty(message)) {
model.put("errorMessage", message);
return "/common/error";
}
try {
HttpSession session = request.getSession();
String privateKey = (String) session.getAttribute(Constant.PRIVATEKEY);
accountService.saveOrUpdateAccount(userId, admin.getRoleId(), admin, privateKey);
} catch (Exception e) {
model.put("errorMessage", "保存账号出错!请联系管理员处理");
return "/common/error";
}
return "redirect:/account/list";
}
/**
*
*/
@RequestMapping("/changeStatus")
public ResponseMsg changeStatus(Admin admin) {
boolean locked = accountService.changeStatus(admin.getId(), admin.getEnabled());
if (locked) {
return ResponseMsg.buildSuccessMsg("操作成功");
} else {
return ResponseMsg.buildFailedMsg("操作失败");
}
}
/**
*
*/
@RequestMapping("/delete")
@ResponseBody
public ResponseMsg delete(@RequestParam("userId") int userId) {
ResponseMsg responseMsg = new ResponseMsg();
boolean deleted = accountService.deleteAccount(userId);
if (deleted) {
responseMsg.setStatus(0);
responseMsg.setMsg("删除成功");
} else {
responseMsg.setStatus(1);
responseMsg.setMsg("删除失败");
}
return responseMsg;
}
/**
* ID
*/
@RequestMapping("/resetPassword")
@ResponseBody
public ResponseMsg resetPassword(@RequestParam("userId") int userId, HttpServletRequest request) {
HttpSession session = request.getSession();
String privateKey = (String) session.getAttribute(Constant.PRIVATEKEY);
boolean flag = accountService.resetPassword(userId, privateKey);
ResponseMsg responseMsg = new ResponseMsg();
if (flag) {
responseMsg.setStatus(0);
responseMsg.setMsg("重置密码成功");
} else {
responseMsg.setStatus(1);
responseMsg.setMsg("重置密码失败");
}
return responseMsg;
}
/**
*
*/
@RequestMapping("/password")
public String password(HttpServletRequest request, Map<String, Object> model) {
Admin admin = adminService.getAdminById(InterfaceUtil.getAdminId());
try {
String id = new DESAS().encrypt(admin.getId().toString());
model.put("userId", id);
} catch (Exception e) {
e.printStackTrace();
}
model.put("SysUser", admin);
genRSAKeyPair(request, model);
return "/admin/account_password";
}
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
model.put("roleType", "-1");
model.put("keywords", keywords);
}
@RequestMapping("/export")
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(httpServletResponse, Utils.generateExcelName("人员信息"), "application/octet-stream");
String[] headers = {"四算系统登录账号", "手机号码", "姓名", "常驻地", "一级部门", "二级部门", "三级部门", "直接主管", "职位", "角色名称", "公司邮件地址"};
String[] exportColumns = {"userName", "telephone", "realName", "workLocation", "deptFirstName", "deptSecondName", "deptThirdName", "directManager", "positionName", "roleName", "companyEmail"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> accountService.list(searchInfo, pN, pS).getList());
}
/**
*
*/
@RequestMapping("/template")
public void template(HttpServletResponse response) throws Exception {
String[] headers = new String[]{"四算系统登录账号", "手机号码", "姓名", "常驻地", "所属部门", "直接主管", "职位", "角色名称", "公司邮件地址"};
downloadHeader(response, Utils.generateExcelName("人员信息批量导入模板"));
ExportUtils exportUtils = new ExportUtils(headers);
exportUtils.write(response.getOutputStream());
}
/**
*
*/
@RequestMapping("/batchImport")
@ResponseBody
public String batchImport(MultipartFile file) {
try {
ExcelLogs logs = new ExcelLogs();
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
"yyyy/MM/dd HH:mm:ss", logs, 0);
synchronized (this) {
return JSON.toJSONString(accountService.check(maps));
}
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误请上传excel 2003/2007格式文件"));
} catch (Exception e) {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
}
}
}

View File

@ -1,100 +1,100 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.service.ActModelService;
import cn.palmte.work.utils.ActUtil;
import cn.palmte.work.utils.InterfaceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
*/
@Controller
@RequestMapping("/actModel")
public class ActModelController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ActModelController.class);
@Autowired
ActUtil actUtil;
@Autowired
private ActModelService activitiModelService;
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords", required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("pager", activitiModelService.list(searchInfo, pageNumber, pageSize));
model.put("userName", InterfaceUtil.getAdmin().getUserName());
return "/admin/act_model_list";
}
@GetMapping(value = "/add")
public String add() {
return "/admin/act_model_input";
}
@RequestMapping("/save")
public String save(HttpServletRequest request, Map<String, Object> model) {
String procDefKey = request.getParameter("procDefKey");
if (activitiModelService.findByProcDefKey(procDefKey) != null) {
model.put("errorMessage", "流程标识已经存在!");
return "/common/error";
}
try {
activitiModelService.createModel(procDefKey, request.getParameter("modelName"));
} catch (Exception e) {
logger.error("", e);
}
return "redirect:/actModel/list";
}
@ResponseBody
@GetMapping(value = "/delete")
public ResponseMsg delete(@RequestParam("ids") String ids) {
if ("".equals(ids)) {
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
} else {
String[] deleteIds = ids.split("#%#");
for (String id : deleteIds) {
activitiModelService.deleteModel(id);
}
return ResponseMsg.buildSuccessMsg("删除成功");
}
}
/**
*
*
* @param id
* @return
*/
@ResponseBody
@GetMapping(value = "/deploy")
public ResponseMsg deploy(@RequestParam("id") String id) {
try {
activitiModelService.deploy(id);
} catch (Exception e) {
logger.error("", e);
return ResponseMsg.buildFailedMsg(e.getMessage());
}
return ResponseMsg.buildSuccessMsg("部署成功");
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.service.ActModelService;
import cn.palmte.work.utils.ActUtil;
import cn.palmte.work.utils.InterfaceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
*/
@Controller
@RequestMapping("/actModel")
public class ActModelController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ActModelController.class);
@Autowired
ActUtil actUtil;
@Autowired
private ActModelService activitiModelService;
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords", required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("pager", activitiModelService.list(searchInfo, pageNumber, pageSize));
model.put("userName", InterfaceUtil.getAdmin().getUserName());
return "/admin/act_model_list";
}
@GetMapping(value = "/add")
public String add() {
return "/admin/act_model_input";
}
@RequestMapping("/save")
public String save(HttpServletRequest request, Map<String, Object> model) {
String procDefKey = request.getParameter("procDefKey");
if (activitiModelService.findByProcDefKey(procDefKey) != null) {
model.put("errorMessage", "流程标识已经存在!");
return "/common/error";
}
try {
activitiModelService.createModel(procDefKey, request.getParameter("modelName"));
} catch (Exception e) {
logger.error("", e);
}
return "redirect:/actModel/list";
}
@ResponseBody
@GetMapping(value = "/delete")
public ResponseMsg delete(@RequestParam("ids") String ids) {
if ("".equals(ids)) {
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
} else {
String[] deleteIds = ids.split("#%#");
for (String id : deleteIds) {
activitiModelService.deleteModel(id);
}
return ResponseMsg.buildSuccessMsg("删除成功");
}
}
/**
*
*
* @param id
* @return
*/
@ResponseBody
@GetMapping(value = "/deploy")
public ResponseMsg deploy(@RequestParam("id") String id) {
try {
activitiModelService.deploy(id);
} catch (Exception e) {
logger.error("", e);
return ResponseMsg.buildFailedMsg(e.getMessage());
}
return ResponseMsg.buildSuccessMsg("部署成功");
}
}

View File

@ -1,132 +1,132 @@
package cn.palmte.work.controller.backend;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Model;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
*
*/
@RestController
public class ActModelEditorController implements ModelDataJsonConstants {
protected static final Logger LOGGER = LoggerFactory.getLogger(ActModelEditorController.class);
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
/**
*
*
* @return
*/
@ResponseBody
@RequestMapping(value = "/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
public String getStencilset() {
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
try {
return IOUtils.toString(stencilsetStream, "utf-8");
} catch (Exception e) {
//logger.error("an exception happens in try catch statement", e);
throw new ActivitiException("Error while loading stencil set", e);
} finally {
if (stencilsetStream != null) {
try {
stencilsetStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
* idjson
*
* @param modelId
* @return
*/
@RequestMapping(value = "/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getEditorJson(@PathVariable String modelId) {
ObjectNode modelNode = null;
Model model = repositoryService.getModel(modelId);
if (model != null) {
try {
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
} else {
modelNode = objectMapper.createObjectNode();
modelNode.put(MODEL_NAME, model.getName());
}
modelNode.put(MODEL_ID, model.getId());
String content = new String(repositoryService.getModelEditorSource(model.getId()), "utf-8");
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(content);
modelNode.put("model", editorJsonNode);
} catch (Exception e) {
LOGGER.error("an exception happens in try catch statement", e);
throw new ActivitiException("Error creating model JSON", e);
}
}
return modelNode;
}
/**
*
*
* @param modelId
* @param values
*/
@ResponseStatus(value = HttpStatus.OK)
@RequestMapping(value = "/model/{modelId}/save", method = RequestMethod.PUT)
public void saveModel(@PathVariable String modelId, @RequestParam MultiValueMap<String, String> values) {
try {
Model model = repositoryService.getModel(modelId);
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
modelJson.put(MODEL_NAME, values.getFirst("name"));
modelJson.put(MODEL_DESCRIPTION, values.getFirst("description"));
model.setMetaInfo(modelJson.toString());
model.setName(values.getFirst("name"));
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), values.getFirst("json_xml").getBytes("utf-8"));
InputStream svgStream = new ByteArrayInputStream(values.getFirst("svg_xml").getBytes("utf-8"));
TranscoderInput input = new TranscoderInput(svgStream);
PNGTranscoder transcoder = new PNGTranscoder();
// Setup output
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(outStream);
// Do the transformation
transcoder.transcode(input, output);
final byte[] result = outStream.toByteArray();
repositoryService.addModelEditorSourceExtra(model.getId(), result);
outStream.close();
} catch (Exception e) {
LOGGER.error("an exception happens in try catch statement", e);
throw new ActivitiException("Error saving model", e);
}
}
}
package cn.palmte.work.controller.backend;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Model;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
*
*/
@RestController
public class ActModelEditorController implements ModelDataJsonConstants {
protected static final Logger LOGGER = LoggerFactory.getLogger(ActModelEditorController.class);
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
/**
*
*
* @return
*/
@ResponseBody
@RequestMapping(value = "/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
public String getStencilset() {
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
try {
return IOUtils.toString(stencilsetStream, "utf-8");
} catch (Exception e) {
//logger.error("an exception happens in try catch statement", e);
throw new ActivitiException("Error while loading stencil set", e);
} finally {
if (stencilsetStream != null) {
try {
stencilsetStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
* idjson
*
* @param modelId
* @return
*/
@RequestMapping(value = "/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getEditorJson(@PathVariable String modelId) {
ObjectNode modelNode = null;
Model model = repositoryService.getModel(modelId);
if (model != null) {
try {
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
} else {
modelNode = objectMapper.createObjectNode();
modelNode.put(MODEL_NAME, model.getName());
}
modelNode.put(MODEL_ID, model.getId());
String content = new String(repositoryService.getModelEditorSource(model.getId()), "utf-8");
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(content);
modelNode.put("model", editorJsonNode);
} catch (Exception e) {
LOGGER.error("an exception happens in try catch statement", e);
throw new ActivitiException("Error creating model JSON", e);
}
}
return modelNode;
}
/**
*
*
* @param modelId
* @param values
*/
@ResponseStatus(value = HttpStatus.OK)
@RequestMapping(value = "/model/{modelId}/save", method = RequestMethod.PUT)
public void saveModel(@PathVariable String modelId, @RequestParam MultiValueMap<String, String> values) {
try {
Model model = repositoryService.getModel(modelId);
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
modelJson.put(MODEL_NAME, values.getFirst("name"));
modelJson.put(MODEL_DESCRIPTION, values.getFirst("description"));
model.setMetaInfo(modelJson.toString());
model.setName(values.getFirst("name"));
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), values.getFirst("json_xml").getBytes("utf-8"));
InputStream svgStream = new ByteArrayInputStream(values.getFirst("svg_xml").getBytes("utf-8"));
TranscoderInput input = new TranscoderInput(svgStream);
PNGTranscoder transcoder = new PNGTranscoder();
// Setup output
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(outStream);
// Do the transformation
transcoder.transcode(input, output);
final byte[] result = outStream.toByteArray();
repositoryService.addModelEditorSourceExtra(model.getId(), result);
outStream.close();
} catch (Exception e) {
LOGGER.error("an exception happens in try catch statement", e);
throw new ActivitiException("Error saving model", e);
}
}
}

View File

@ -1,106 +1,106 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.service.ActProcDefService;
import cn.palmte.work.utils.ActUtil;
import cn.palmte.work.utils.InterfaceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
*/
@Controller
@RequestMapping("/actProcDef")
public class ActProcDefController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ActProcDefController.class);
@Autowired
private ActProcDefService actProcDefService;
@Autowired
private ActUtil actUtil;
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords", required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("userName", InterfaceUtil.getAdmin().getUserName());
model.put("pager", actProcDefService.list(searchInfo, pageNumber, pageSize));
return "/admin/act_proc_def_list";
}
/**
*
*
* @param response
* @param deploymentId
* @throws Exception
*/
@RequestMapping("/procDefPng/{deploymentId}")
public void png(HttpServletResponse response, @PathVariable("deploymentId") String deploymentId) throws Exception {
actProcDefService.createProcDefPng(response, deploymentId);
}
/**
* xml
*
* @param deploymentId
* @return
*/
@RequestMapping("/xml/{deploymentId}")
public void xml(HttpServletResponse response, @PathVariable("deploymentId") String deploymentId) throws Exception {
actUtil.responseXml(response, deploymentId);
}
/**
*
*
* @param ids
* @return
*/
@ResponseBody
@GetMapping(value = "/delete")
public ResponseMsg delete(@RequestParam("ids") String ids) {
if ("".equals(ids)) {
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
} else {
String[] deleteIds = ids.split("#%#");
for (String id : deleteIds) {
actProcDefService.deleteDeployment(id);
}
return ResponseMsg.buildSuccessMsg("删除成功");
}
}
/**
*
*
* @param id
* @param status 1- 2-
* @return
*/
@ResponseBody
@GetMapping(value = "/suspend")
public String suspend(@RequestParam String id, @RequestParam int status) {
actProcDefService.suspend(id, status);
return "redirect:/actProcDef/list";
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.service.ActProcDefService;
import cn.palmte.work.utils.ActUtil;
import cn.palmte.work.utils.InterfaceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
*/
@Controller
@RequestMapping("/actProcDef")
public class ActProcDefController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ActProcDefController.class);
@Autowired
private ActProcDefService actProcDefService;
@Autowired
private ActUtil actUtil;
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords", required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("userName", InterfaceUtil.getAdmin().getUserName());
model.put("pager", actProcDefService.list(searchInfo, pageNumber, pageSize));
return "/admin/act_proc_def_list";
}
/**
*
*
* @param response
* @param deploymentId
* @throws Exception
*/
@RequestMapping("/procDefPng/{deploymentId}")
public void png(HttpServletResponse response, @PathVariable("deploymentId") String deploymentId) throws Exception {
actProcDefService.createProcDefPng(response, deploymentId);
}
/**
* xml
*
* @param deploymentId
* @return
*/
@RequestMapping("/xml/{deploymentId}")
public void xml(HttpServletResponse response, @PathVariable("deploymentId") String deploymentId) throws Exception {
actUtil.responseXml(response, deploymentId);
}
/**
*
*
* @param ids
* @return
*/
@ResponseBody
@GetMapping(value = "/delete")
public ResponseMsg delete(@RequestParam("ids") String ids) {
if ("".equals(ids)) {
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
} else {
String[] deleteIds = ids.split("#%#");
for (String id : deleteIds) {
actProcDefService.deleteDeployment(id);
}
return ResponseMsg.buildSuccessMsg("删除成功");
}
}
/**
*
*
* @param id
* @param status 1- 2-
* @return
*/
@ResponseBody
@GetMapping(value = "/suspend")
public String suspend(@RequestParam String id, @RequestParam int status) {
actProcDefService.suspend(id, status);
return "redirect:/actProcDef/list";
}
}

View File

@ -1,106 +1,106 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.config.activiti.ActConstant;
import cn.palmte.work.service.ActProcInsService;
import cn.palmte.work.utils.InterfaceUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
*/
@Controller
@RequestMapping("/actProcIns")
public class ActProcInsController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ActProcInsController.class);
@Autowired
private ActProcInsService actProcInsService;
/**
*
*
* @param keywords
* @param pageNumber
* @param pageSize
* @param model
* @return
*/
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords", required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("pager", actProcInsService.list(searchInfo, pageNumber, pageSize));
return "/admin/act_proc_ins_list";
}
/**
*
*
* @param procInsId
* @param reason
* @return
*/
@ResponseBody
@GetMapping(value = "/deleteProcessInstance")
public ResponseMsg deleteProcessInstance(@RequestParam String procInsId, @RequestParam String reason) {
actProcInsService.deleteProcessInstance(procInsId, reason);
return ResponseMsg.buildSuccessMsg("撤销成功");
}
/**
*
*
* @param response
* @param procInstId
* @throws Exception
*/
@RequestMapping("/procInsPng/{procInstId}")
public void png(HttpServletResponse response, @PathVariable("procInstId") String procInstId) throws Exception {
actProcInsService.createProcInsPng(response, procInstId);
}
/**
*
*
* @return
*/
@ResponseBody
@PostMapping(value = "/startProcIns/{procDefKey}")
public ResponseMsg startProcessInstance(@PathVariable String procDefKey, @RequestBody String body) {
JSONObject json = JSON.parseObject(body);
Map<String, Object> variables = new HashMap<>();
for (Object key : json.keySet()) {
variables.put((String)key, json.get(key));
}
variables.put(ActConstant.START_PROCESS_USERID, InterfaceUtil.getAdminId());
String procInsId = null;
try {
procInsId = actProcInsService.startProcessInstance(procDefKey, "0", variables);
} catch (Exception e) {
logger.error("", e);
return ResponseMsg.buildFailedMsg("流程启动失败:" + e.getMessage());
}
return ResponseMsg.buildSuccessMsg("流程启动成功", procInsId);
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.config.activiti.ActConstant;
import cn.palmte.work.service.ActProcInsService;
import cn.palmte.work.utils.InterfaceUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
*/
@Controller
@RequestMapping("/actProcIns")
public class ActProcInsController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ActProcInsController.class);
@Autowired
private ActProcInsService actProcInsService;
/**
*
*
* @param keywords
* @param pageNumber
* @param pageSize
* @param model
* @return
*/
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords", required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("pager", actProcInsService.list(searchInfo, pageNumber, pageSize));
return "/admin/act_proc_ins_list";
}
/**
*
*
* @param procInsId
* @param reason
* @return
*/
@ResponseBody
@GetMapping(value = "/deleteProcessInstance")
public ResponseMsg deleteProcessInstance(@RequestParam String procInsId, @RequestParam String reason) {
actProcInsService.deleteProcessInstance(procInsId, reason);
return ResponseMsg.buildSuccessMsg("撤销成功");
}
/**
*
*
* @param response
* @param procInstId
* @throws Exception
*/
@RequestMapping("/procInsPng/{procInstId}")
public void png(HttpServletResponse response, @PathVariable("procInstId") String procInstId) throws Exception {
actProcInsService.createProcInsPng(response, procInstId);
}
/**
*
*
* @return
*/
@ResponseBody
@PostMapping(value = "/startProcIns/{procDefKey}")
public ResponseMsg startProcessInstance(@PathVariable String procDefKey, @RequestBody String body) {
JSONObject json = JSON.parseObject(body);
Map<String, Object> variables = new HashMap<>();
for (Object key : json.keySet()) {
variables.put((String)key, json.get(key));
}
variables.put(ActConstant.START_PROCESS_USERID, InterfaceUtil.getAdminId());
String procInsId = null;
try {
procInsId = actProcInsService.startProcessInstance(procDefKey, "0", variables);
} catch (Exception e) {
logger.error("", e);
return ResponseMsg.buildFailedMsg("流程启动失败:" + e.getMessage());
}
return ResponseMsg.buildSuccessMsg("流程启动成功", procInsId);
}
}

View File

@ -1,107 +1,107 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.ActTaskDef;
import cn.palmte.work.model.AdminRepository;
import cn.palmte.work.pojo.ActHisTask;
import cn.palmte.work.service.ActTaskDefService;
import cn.palmte.work.service.SysRoleService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*/
@Controller
@RequestMapping("/actTaskDef")
public class ActTaskDefController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ActTaskDefController.class);
@Autowired
private AdminRepository adminRepository;
@Autowired
private SysRoleService sysRoleService;
@Autowired
private ActTaskDefService actTaskDefService;
/**
*
*
* @param procDefId
* @param model
* @return
*/
@RequestMapping("/config/{procDefId}")
public String list(@PathVariable String procDefId, Map<String, Object> model) {
List<ActTaskDef> list = actTaskDefService.findByProcDefId(procDefId);
//过滤掉发起节点的全是审批节点
List<ActTaskDef> approveList = list.stream().filter(t-> t.getTaskIndex() == 0).collect(Collectors.toList());
model.put("procDefId", procDefId);
model.put("taskList", list);
model.put("approveList", approveList);
model.put("procDefName", list.get(0).getProcDefName());
model.put("roleList", sysRoleService.getAllEnableSysRole());
model.put("adminList", adminRepository.getAllEnable());
return "/admin/act_task_def";
}
/**
*
*
* @param taskDef
* @return
*/
@ResponseBody
@GetMapping(value = "/saveConfig")
public ResponseMsg saveConfig(ActTaskDef taskDef) {
actTaskDefService.saveConfig(taskDef);
return ResponseMsg.buildSuccessMsg("成功");
}
/**
*
*
*
* @return
*/
@ResponseBody
@PostMapping(value = "/completeTask")
public ResponseMsg completeTask(@RequestBody String json) {
JSONObject jsonParam = JSON.parseObject(json);
actTaskDefService.completeTask(jsonParam);
return ResponseMsg.buildSuccessMsg("处理成功");
}
/**
*
*
* @param procInsId
* @param model
* @return
*/
@RequestMapping("/hisTaskList/{procInsId}")
public String taskList(@PathVariable String procInsId, Map<String, Object> model) {
List<ActHisTask> list = actTaskDefService.hisTaskList(procInsId);
model.put("taskList", list);
model.put("procInsId", procInsId);
return "/admin/act_his_task_list";
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.ActTaskDef;
import cn.palmte.work.model.AdminRepository;
import cn.palmte.work.pojo.ActHisTask;
import cn.palmte.work.service.ActTaskDefService;
import cn.palmte.work.service.SysRoleService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*/
@Controller
@RequestMapping("/actTaskDef")
public class ActTaskDefController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ActTaskDefController.class);
@Autowired
private AdminRepository adminRepository;
@Autowired
private SysRoleService sysRoleService;
@Autowired
private ActTaskDefService actTaskDefService;
/**
*
*
* @param procDefId
* @param model
* @return
*/
@RequestMapping("/config/{procDefId}")
public String list(@PathVariable String procDefId, Map<String, Object> model) {
List<ActTaskDef> list = actTaskDefService.findByProcDefId(procDefId);
//过滤掉发起节点的全是审批节点
List<ActTaskDef> approveList = list.stream().filter(t-> t.getTaskIndex() == 0).collect(Collectors.toList());
model.put("procDefId", procDefId);
model.put("taskList", list);
model.put("approveList", approveList);
model.put("procDefName", list.get(0).getProcDefName());
model.put("roleList", sysRoleService.getAllEnableSysRole());
model.put("adminList", adminRepository.getAllEnable());
return "/admin/act_task_def";
}
/**
*
*
* @param taskDef
* @return
*/
@ResponseBody
@GetMapping(value = "/saveConfig")
public ResponseMsg saveConfig(ActTaskDef taskDef) {
actTaskDefService.saveConfig(taskDef);
return ResponseMsg.buildSuccessMsg("成功");
}
/**
*
*
*
* @return
*/
@ResponseBody
@PostMapping(value = "/completeTask")
public ResponseMsg completeTask(@RequestBody String json) {
JSONObject jsonParam = JSON.parseObject(json);
actTaskDefService.completeTask(jsonParam);
return ResponseMsg.buildSuccessMsg("处理成功");
}
/**
*
*
* @param procInsId
* @param model
* @return
*/
@RequestMapping("/hisTaskList/{procInsId}")
public String taskList(@PathVariable String procInsId, Map<String, Object> model) {
List<ActHisTask> list = actTaskDefService.hisTaskList(procInsId);
model.put("taskList", list);
model.put("procInsId", procInsId);
return "/admin/act_his_task_list";
}
}

View File

@ -1,300 +1,300 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.config.Constant;
import cn.palmte.work.model.*;
import cn.palmte.work.pojo.LoginRequest;
import cn.palmte.work.pojo.LoginResponse;
import cn.palmte.work.service.AdminService;
import cn.palmte.work.service.LoginLogService;
import cn.palmte.work.service.ProjectService;
import cn.palmte.work.utils.*;
import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.utils.CollectionUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping("/admin")
public class AdminController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(AdminController.class);
@Autowired
private AdminService adminService;
@Autowired
private LoginLogService loginLogService;
@Autowired
private SysRoleRepository sysRoleRepository;
@Autowired
private ProjectService projectService;
@PostMapping(value = "/singIn")
public String singIn(RedirectAttributes attr, LoginRequest loginRequest, HttpServletRequest request) throws Exception {
String userName = loginRequest.getUserName();
String password = loginRequest.getPassword();
//String captchaToken = loginRequest.getCaptchaToken();
String code;
String message;
try{
/*try{
code = request.getSession().getAttribute(CaptchaUtils.RANDOM_CODE_KEY).toString();
}catch(Exception e){
logger.info(e.getMessage() , e);
message ="验证码错误";
attr.addAttribute("errorMessages",message);
return "redirect:/admin/err";
}*/
try {
String privateKey = request.getSession().getAttribute(Constant.PRIVATEKEY).toString();
userName = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(userName), privateKey));
password = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(password), privateKey));
//captchaToken = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(captchaToken),privateKey));
} catch (Exception e) {
logger.error("解密出错", e);
attr.addAttribute("errorMessages", "用户名密码错误");
return "redirect:/admin/err";
}
attr.addAttribute("userName", userName);
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)) {
message = "用户名或密码错误!";
attr.addAttribute("errorMessages", message);
return "redirect:/admin/err";
}
/*if(!captchaToken.toUpperCase().equals(code)){
message ="验证码错误!";
attr.addAttribute("errorMessages",message);
return "redirect:/admin/err";
}*/
/**
*
*/
//request.getSession().removeAttribute(CaptchaUtils.RANDOM_CODE_KEY);
Admin admin = adminService.getAdminByUsername(userName);
if (null == admin) {
message = "用户名或密码错误~~~";
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
if (admin.getEnabled() == 0) {
message = "该用户已禁用~~~";
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
if (adminService.isLocked(admin)) {
message = "该用户已被锁定~~~";
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
int roleId = admin.getRoleId();
SysRole role = sysRoleRepository.findOne(roleId);
if (role.getIsEnable() == 0) {
message = "该用户绑定的角色已禁用~~~";
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
String salt = admin.getSalt();
request.getSession().setAttribute("realsName", admin.getRealName());
//request.getSession().setAttribute("telephone", admin.getTelephone());
request.getSession().setAttribute("lastLoginTime", admin.getLoginDate());
String newPassword;
try {
newPassword = DESCrypto.encryptPassword(password, salt);
} catch (Exception e) {
logger.error("加密出错", e);
message = "密码出错";
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
boolean bool = checkUpdatePasswordTime(admin);
if (bool) {
request.getSession().setAttribute("message", "您已超过90天未修改密码");
} else {
request.getSession().setAttribute("message", "");
}
message = login(userName, newPassword, false, false);
if (!message.isEmpty()) {
attr.addAttribute("errorMessages", message);
//增加登录失败次数
adminService.addLoginError(admin);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
adminService.updateLoginInfo(admin, request);
loginLogService.saveLog(userName, LoginLog.SUCCESS, "登录成功");
/**
* admin,job,[1]
*/
return "redirect:/admin/center?uid=0";
} catch (Exception e) {
logger.error(e.getMessage(), e);
message = "登录发生未知错误e=" + e.getMessage();
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
} catch (Throwable t) {
logger.error(t.getMessage(), t);
message = "登录发生未知错误t=" + t.getMessage();
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
}
/**
*
* @param admin
* @return
* @throws ParseException
*/
public boolean checkUpdatePasswordTime(Admin admin) throws ParseException {
if (null != admin.getUpdatedPasswordTime()) {
int days = DateKit.daysBetween(admin.getUpdatedPasswordTime(), new Date());
if (days >= 90) {
return true;
}
}
return false;
}
/**
*
*
* @param returnJson json
*/
public String login(String username, String password, boolean rememberMe, boolean returnJson) {
//TODO:登录验证逻辑(待补充)
String errorMessage = "";
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
token.setRememberMe(rememberMe);
try {
subject.login(token);
} catch (UnknownAccountException | LockedAccountException ue) {
token.clear();
errorMessage = ue.getMessage();
} catch (IncorrectCredentialsException ie) {
token.clear();
errorMessage = "用户名或密码错误~~~";
} catch (RuntimeException re) {
re.printStackTrace();
token.clear();
errorMessage = "登录失败!";
}
return errorMessage;
}
@RequestMapping(value = "/login", method = {RequestMethod.GET})
public String login(HttpServletRequest request) throws Exception {
//TODO:登录页面初始化代码
InterfaceUtil.genRSAKeyPair(request);
return "/admin/admin_login";
}
@RequestMapping(value = "/center", method = RequestMethod.GET)
public String center(@ModelAttribute("userName") String userName, @RequestParam("uid") int uid,
@RequestParam(value = "showJobMonitorError", defaultValue = "0") int showJobMonitorError, Map<String, Object> model) {
logger.info("------------------------------------------重定向到首页信息查询center方法内部-----------------------用户名====" + userName);
LoginResponse loginResponse = adminService.initMenuList(uid);
model.put("userName", userName);
model.put("loginResponse", loginResponse);
if (uid == 0) {
uid = (loginResponse.getTopMenuList() != null && loginResponse.getTopMenuList().size() > 0) ? loginResponse.getTopMenuList().get(0).getId() : 0;
}
model.put("uid", uid);
model.put("showJobMonitorError", showJobMonitorError);
logger.info("------------------------------------------跳转到admin_index-----------------------");
return "/admin/admin_index";
}
@RequestMapping(value = "/topMenu", method = RequestMethod.GET)
public String topMenu(@RequestParam("uid") int uid, Map<String, Object> model) {
LoginResponse loginResponse = adminService.initMenuList(uid);
model.put("loginResponse", loginResponse);
return "/admin/admin_index";
}
@RequestMapping(value = "/console", method = RequestMethod.GET)
public String console(@RequestParam("uid") int uid, Map<String, Object> model, HttpServletRequest request) {
logger.info(uid + "");
model.put("statistic", "");
return "/admin/console";
}
@RequestMapping(value = "/err", method = RequestMethod.GET)
public String loginErr(HttpServletRequest request, @ModelAttribute("errorMessages") String errorMessages) {
InterfaceUtil.genRSAKeyPair(request);
request.setAttribute("base", request.getContextPath());
return "/admin/admin_login";
}
// 管理员退出
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout(HttpServletRequest request) {
// ShiroPrincipal principal = (ShiroPrincipal) SecurityUtils.getSubject().getPrincipal();
// // 如果已经登录,则跳转到管理首页
// if(principal != null){
// SecurityUtils.getSubject().logout();
// }
return "redirect:/admin/login";
}
/**
*
*/
@RequestMapping(value = "/captcha", method = RequestMethod.GET)
public void captcha(HttpServletRequest request, HttpServletResponse response) throws Exception {
new CaptchaUtils().getRandCode(request, response);
}
/**
*
*
* @return
*/
@ResponseBody
@RequestMapping("/approveProjectsMsg")
public ResponseMsg approveProjectsMsg() {
Page<Project> myApproveProjects = projectService.findMyApproveProjects(new HashMap<>(), InterfaceUtil.getAdminId(), 1, 1);
if (myApproveProjects != null && !myApproveProjects.getList().isEmpty()) {
return ResponseMsg.buildSuccessMsg("您有新的待审核项目,请及时确认。");
} else {
return ResponseMsg.buildSuccessMsg("");
}
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.config.Constant;
import cn.palmte.work.model.*;
import cn.palmte.work.pojo.LoginRequest;
import cn.palmte.work.pojo.LoginResponse;
import cn.palmte.work.service.AdminService;
import cn.palmte.work.service.LoginLogService;
import cn.palmte.work.service.ProjectService;
import cn.palmte.work.utils.*;
import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.utils.CollectionUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping("/admin")
public class AdminController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(AdminController.class);
@Autowired
private AdminService adminService;
@Autowired
private LoginLogService loginLogService;
@Autowired
private SysRoleRepository sysRoleRepository;
@Autowired
private ProjectService projectService;
@PostMapping(value = "/singIn")
public String singIn(RedirectAttributes attr, LoginRequest loginRequest, HttpServletRequest request) throws Exception {
String userName = loginRequest.getUserName();
String password = loginRequest.getPassword();
//String captchaToken = loginRequest.getCaptchaToken();
String code;
String message;
try{
/*try{
code = request.getSession().getAttribute(CaptchaUtils.RANDOM_CODE_KEY).toString();
}catch(Exception e){
logger.info(e.getMessage() , e);
message ="验证码错误";
attr.addAttribute("errorMessages",message);
return "redirect:/admin/err";
}*/
try {
String privateKey = request.getSession().getAttribute(Constant.PRIVATEKEY).toString();
userName = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(userName), privateKey));
password = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(password), privateKey));
//captchaToken = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(captchaToken),privateKey));
} catch (Exception e) {
logger.error("解密出错", e);
attr.addAttribute("errorMessages", "用户名密码错误");
return "redirect:/admin/err";
}
attr.addAttribute("userName", userName);
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)) {
message = "用户名或密码错误!";
attr.addAttribute("errorMessages", message);
return "redirect:/admin/err";
}
/*if(!captchaToken.toUpperCase().equals(code)){
message ="验证码错误!";
attr.addAttribute("errorMessages",message);
return "redirect:/admin/err";
}*/
/**
*
*/
//request.getSession().removeAttribute(CaptchaUtils.RANDOM_CODE_KEY);
Admin admin = adminService.getAdminByUsername(userName);
if (null == admin) {
message = "用户名或密码错误~~~";
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
if (admin.getEnabled() == 0) {
message = "该用户已禁用~~~";
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
if (adminService.isLocked(admin)) {
message = "该用户已被锁定~~~";
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
int roleId = admin.getRoleId();
SysRole role = sysRoleRepository.findOne(roleId);
if (role.getIsEnable() == 0) {
message = "该用户绑定的角色已禁用~~~";
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
String salt = admin.getSalt();
request.getSession().setAttribute("realsName", admin.getRealName());
//request.getSession().setAttribute("telephone", admin.getTelephone());
request.getSession().setAttribute("lastLoginTime", admin.getLoginDate());
String newPassword;
try {
newPassword = DESCrypto.encryptPassword(password, salt);
} catch (Exception e) {
logger.error("加密出错", e);
message = "密码出错";
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
boolean bool = checkUpdatePasswordTime(admin);
if (bool) {
request.getSession().setAttribute("message", "您已超过90天未修改密码");
} else {
request.getSession().setAttribute("message", "");
}
message = login(userName, admin.getPassword(), false, false);
if (!message.isEmpty()) {
attr.addAttribute("errorMessages", message);
//增加登录失败次数
adminService.addLoginError(admin);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
adminService.updateLoginInfo(admin, request);
loginLogService.saveLog(userName, LoginLog.SUCCESS, "登录成功");
/**
* admin,job,[1]
*/
return "redirect:/admin/center?uid=0";
} catch (Exception e) {
logger.error(e.getMessage(), e);
message = "登录发生未知错误e=" + e.getMessage();
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
} catch (Throwable t) {
logger.error(t.getMessage(), t);
message = "登录发生未知错误t=" + t.getMessage();
attr.addAttribute("errorMessages", message);
loginLogService.saveLog(userName, LoginLog.FAILED, message);
return "redirect:/admin/err";
}
}
/**
*
* @param admin
* @return
* @throws ParseException
*/
public boolean checkUpdatePasswordTime(Admin admin) throws ParseException {
if (null != admin.getUpdatedPasswordTime()) {
int days = DateKit.daysBetween(admin.getUpdatedPasswordTime(), new Date());
if (days >= 90) {
return true;
}
}
return false;
}
/**
*
*
* @param returnJson json
*/
public String login(String username, String password, boolean rememberMe, boolean returnJson) {
//TODO:登录验证逻辑(待补充)
String errorMessage = "";
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
token.setRememberMe(rememberMe);
try {
subject.login(token);
} catch (UnknownAccountException | LockedAccountException ue) {
token.clear();
errorMessage = ue.getMessage();
} catch (IncorrectCredentialsException ie) {
token.clear();
errorMessage = "用户名或密码错误~~~";
} catch (RuntimeException re) {
re.printStackTrace();
token.clear();
errorMessage = "登录失败!";
}
return errorMessage;
}
@RequestMapping(value = "/login", method = {RequestMethod.GET})
public String login(HttpServletRequest request) throws Exception {
//TODO:登录页面初始化代码
InterfaceUtil.genRSAKeyPair(request);
return "/admin/admin_login";
}
@RequestMapping(value = "/center", method = RequestMethod.GET)
public String center(@ModelAttribute("userName") String userName, @RequestParam("uid") int uid,
@RequestParam(value = "showJobMonitorError", defaultValue = "0") int showJobMonitorError, Map<String, Object> model) {
logger.info("------------------------------------------重定向到首页信息查询center方法内部-----------------------用户名====" + userName);
LoginResponse loginResponse = adminService.initMenuList(uid);
model.put("userName", userName);
model.put("loginResponse", loginResponse);
if (uid == 0) {
uid = (loginResponse.getTopMenuList() != null && loginResponse.getTopMenuList().size() > 0) ? loginResponse.getTopMenuList().get(0).getId() : 0;
}
model.put("uid", uid);
model.put("showJobMonitorError", showJobMonitorError);
logger.info("------------------------------------------跳转到admin_index-----------------------");
return "/admin/admin_index";
}
@RequestMapping(value = "/topMenu", method = RequestMethod.GET)
public String topMenu(@RequestParam("uid") int uid, Map<String, Object> model) {
LoginResponse loginResponse = adminService.initMenuList(uid);
model.put("loginResponse", loginResponse);
return "/admin/admin_index";
}
@RequestMapping(value = "/console", method = RequestMethod.GET)
public String console(@RequestParam("uid") int uid, Map<String, Object> model, HttpServletRequest request) {
logger.info(uid + "");
model.put("statistic", "");
return "/admin/console";
}
@RequestMapping(value = "/err", method = RequestMethod.GET)
public String loginErr(HttpServletRequest request, @ModelAttribute("errorMessages") String errorMessages) {
InterfaceUtil.genRSAKeyPair(request);
request.setAttribute("base", request.getContextPath());
return "/admin/admin_login";
}
// 管理员退出
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout(HttpServletRequest request) {
// ShiroPrincipal principal = (ShiroPrincipal) SecurityUtils.getSubject().getPrincipal();
// // 如果已经登录,则跳转到管理首页
// if(principal != null){
// SecurityUtils.getSubject().logout();
// }
return "redirect:/admin/login";
}
/**
*
*/
@RequestMapping(value = "/captcha", method = RequestMethod.GET)
public void captcha(HttpServletRequest request, HttpServletResponse response) throws Exception {
new CaptchaUtils().getRandCode(request, response);
}
/**
*
*
* @return
*/
@ResponseBody
@RequestMapping("/approveProjectsMsg")
public ResponseMsg approveProjectsMsg() {
Page<Project> myApproveProjects = projectService.findMyApproveProjects(new HashMap<>(), InterfaceUtil.getAdminId(), 1, 1);
if (myApproveProjects != null && !myApproveProjects.getList().isEmpty()) {
return ResponseMsg.buildSuccessMsg("您有新的待审核项目,请及时确认。");
} else {
return ResponseMsg.buildSuccessMsg("");
}
}
}

View File

@ -1,161 +1,161 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.config.Constant;
import cn.palmte.work.model.Admin;
import cn.palmte.work.utils.InterfaceUtil;
import cn.palmte.work.utils.RSAUtils;
import cn.palmte.work.utils.Utils;
import com.alibaba.fastjson.JSON;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class BaseController {
public static final String KEYWORDS = "keywords";
public static final String PAGE_NUMBER = "pageNumber";
public static final String PAGE_SIZE = "pageSize";
public static final String PAGER = "pager";
public static final String DEFAULT_PAGE_NUMBER = "1";
public static final String DEFAULT_PAGE_SIZE = "10";
/**
* Gets the request.
*
* @return the request
*/
protected HttpServletRequest getRequest() {
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
}
/**
* Gets the response.
*
* @return the response
*/
protected HttpServletResponse getResponse() {
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse();
}
/**
* Gets the session
*
* @return the session
*/
protected HttpSession getSession() {
return getRequest().getSession();
}
protected void downloadHeader(HttpServletResponse response, String fileName) {
downloadHeader(response, fileName, "application/octet-stream");
}
/**
* http header
*
* @param response HttpServletResponse
* @param fileName
*/
protected void downloadHeader(HttpServletResponse response, String fileName, String contentType) {
response.setContentType(contentType);
response.setCharacterEncoding("UTF-8");
try {
response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + java.net.URLEncoder.encode(fileName, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
/**
* @see BaseController {@link #downloadHeader(HttpServletResponse, String, String)}
*/
protected void downloadHearder(HttpServletResponse response, String fileName) {
downloadHeader(response, fileName, "application/octet-stream");
}
public ConcurrentHashMap<String, String> getSearchInfo(String keywords, Map<String, Object> model) {
ConcurrentHashMap<String, String> searchMap = Utils.parseMap(keywords);
setModers(searchMap, model);
return searchMap;
}
/**
* model
*/
public void setModers(ConcurrentHashMap<String, String> searchInfo, Map<String, Object> model) {
for (Map.Entry<String, String> item : searchInfo.entrySet()) {
model.put(item.getKey(), item.getValue());
}
}
/**
* request
*/
public void setAttrs(Map<String, String> searchInfo) {
HttpServletRequest request = getRequest();
for (Map.Entry<String, String> item : searchInfo.entrySet()) {
request.setAttribute(item.getKey(), item.getValue());
}
keepKeywords(searchInfo);
}
public Map<String, String> getSearchInfo(String keywords) {
Map<String, String> searchMap = Utils.parseMap(keywords);
setAttrs(searchMap);
return searchMap;
}
/**
* keywords
*/
protected void keepKeywords(Map<String, String> map) {
HttpServletRequest request = getRequest();
request.setAttribute(KEYWORDS, JSON.toJSONString(map));
}
public void genRSAKeyPair(HttpServletRequest request, Map<String, Object> model) {
/* 生成KeyPair */
Map<String, Object> keyMap;
try {
keyMap = RSAUtils.genKeyPair();
String publicKey = RSAUtils.getPublicKey(keyMap);
String privateKey = RSAUtils.getPrivateKey(keyMap);
/* 保存私钥到session */
request.getSession().setAttribute(Constant.PRIVATEKEY, privateKey);
/* 公钥给前端页面 */
model.put(Constant.PUBLICKEY, publicKey);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*
*/
public Admin getAdmin() {
return InterfaceUtil.getAdmin();
}
/**
* Id
*/
public int getAdminId() {
return InterfaceUtil.getAdmin().getId();
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.config.Constant;
import cn.palmte.work.model.Admin;
import cn.palmte.work.utils.InterfaceUtil;
import cn.palmte.work.utils.RSAUtils;
import cn.palmte.work.utils.Utils;
import com.alibaba.fastjson.JSON;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class BaseController {
public static final String KEYWORDS = "keywords";
public static final String PAGE_NUMBER = "pageNumber";
public static final String PAGE_SIZE = "pageSize";
public static final String PAGER = "pager";
public static final String DEFAULT_PAGE_NUMBER = "1";
public static final String DEFAULT_PAGE_SIZE = "10";
/**
* Gets the request.
*
* @return the request
*/
protected HttpServletRequest getRequest() {
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
}
/**
* Gets the response.
*
* @return the response
*/
protected HttpServletResponse getResponse() {
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse();
}
/**
* Gets the session
*
* @return the session
*/
protected HttpSession getSession() {
return getRequest().getSession();
}
protected void downloadHeader(HttpServletResponse response, String fileName) {
downloadHeader(response, fileName, "application/octet-stream");
}
/**
* http header
*
* @param response HttpServletResponse
* @param fileName
*/
protected void downloadHeader(HttpServletResponse response, String fileName, String contentType) {
response.setContentType(contentType);
response.setCharacterEncoding("UTF-8");
try {
response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + java.net.URLEncoder.encode(fileName, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
/**
* @see BaseController {@link #downloadHeader(HttpServletResponse, String, String)}
*/
protected void downloadHearder(HttpServletResponse response, String fileName) {
downloadHeader(response, fileName, "application/octet-stream");
}
public ConcurrentHashMap<String, String> getSearchInfo(String keywords, Map<String, Object> model) {
ConcurrentHashMap<String, String> searchMap = Utils.parseMap(keywords);
setModers(searchMap, model);
return searchMap;
}
/**
* model
*/
public void setModers(ConcurrentHashMap<String, String> searchInfo, Map<String, Object> model) {
for (Map.Entry<String, String> item : searchInfo.entrySet()) {
model.put(item.getKey(), item.getValue());
}
}
/**
* request
*/
public void setAttrs(Map<String, String> searchInfo) {
HttpServletRequest request = getRequest();
for (Map.Entry<String, String> item : searchInfo.entrySet()) {
request.setAttribute(item.getKey(), item.getValue());
}
keepKeywords(searchInfo);
}
public Map<String, String> getSearchInfo(String keywords) {
Map<String, String> searchMap = Utils.parseMap(keywords);
setAttrs(searchMap);
return searchMap;
}
/**
* keywords
*/
protected void keepKeywords(Map<String, String> map) {
HttpServletRequest request = getRequest();
request.setAttribute(KEYWORDS, JSON.toJSONString(map));
}
public void genRSAKeyPair(HttpServletRequest request, Map<String, Object> model) {
/* 生成KeyPair */
Map<String, Object> keyMap;
try {
keyMap = RSAUtils.genKeyPair();
String publicKey = RSAUtils.getPublicKey(keyMap);
String privateKey = RSAUtils.getPrivateKey(keyMap);
/* 保存私钥到session */
request.getSession().setAttribute(Constant.PRIVATEKEY, privateKey);
/* 公钥给前端页面 */
model.put(Constant.PUBLICKEY, publicKey);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*
*/
public Admin getAdmin() {
return InterfaceUtil.getAdmin();
}
/**
* Id
*/
public int getAdminId() {
return InterfaceUtil.getAdmin().getId();
}
}

View File

@ -1,105 +1,105 @@
package cn.palmte.work.controller.backend;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Map;
@Controller
@RequestMapping("/business")
public class BusinessController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
@RequestMapping("/bak1")
public String bak1(Map<String, Object> model) {
return "/admin/bak1";
}
@RequestMapping("/bak2")
public String bak2(Map<String, Object> model) {
return "/admin/bak2";
}
@RequestMapping("/bak3")
public String bak3(Map<String, Object> model) {
return "/admin/bak3";
}
@RequestMapping("/bak4")
public String bak4(Map<String, Object> model) {
return "/admin/bak4";
}
@RequestMapping("/bak5")
public String bak5(Map<String, Object> model) {
return "/admin/bak5";
}
@RequestMapping("/bak6")
public String bak6(Map<String, Object> model) {
return "/admin/bak6";
}
@RequestMapping("/bak7")
public String bak7(Map<String, Object> model) {
return "/admin/bak7";
}
@RequestMapping("/bak8")
public String bak8(Map<String, Object> model) {
return "/admin/bak8";
}
@RequestMapping("/bak9")
public String bak9(Map<String, Object> model) {
return "/admin/bak9";
}
@RequestMapping("/bak10")
public String bak10(Map<String, Object> model) {
return "/admin/bak10";
}
@RequestMapping("/bak11")
public String bak11(Map<String, Object> model) {
return "/admin/bak11";
}
@RequestMapping("/bak12")
public String bak12(Map<String, Object> model) {
return "/admin/bak12";
}
@RequestMapping("/bak13")
public String bak13(Map<String, Object> model) {
return "/admin/bak13";
}
@RequestMapping("/bak14")
public String bak14(Map<String, Object> model) {
return "/admin/bak14";
}
@RequestMapping("/bak15")
public String bak15(Map<String, Object> model) {
return "/admin/bak15";
}
}
package cn.palmte.work.controller.backend;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Map;
@Controller
@RequestMapping("/business")
public class BusinessController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
@RequestMapping("/bak1")
public String bak1(Map<String, Object> model) {
return "/admin/bak1";
}
@RequestMapping("/bak2")
public String bak2(Map<String, Object> model) {
return "/admin/bak2";
}
@RequestMapping("/bak3")
public String bak3(Map<String, Object> model) {
return "/admin/bak3";
}
@RequestMapping("/bak4")
public String bak4(Map<String, Object> model) {
return "/admin/bak4";
}
@RequestMapping("/bak5")
public String bak5(Map<String, Object> model) {
return "/admin/bak5";
}
@RequestMapping("/bak6")
public String bak6(Map<String, Object> model) {
return "/admin/bak6";
}
@RequestMapping("/bak7")
public String bak7(Map<String, Object> model) {
return "/admin/bak7";
}
@RequestMapping("/bak8")
public String bak8(Map<String, Object> model) {
return "/admin/bak8";
}
@RequestMapping("/bak9")
public String bak9(Map<String, Object> model) {
return "/admin/bak9";
}
@RequestMapping("/bak10")
public String bak10(Map<String, Object> model) {
return "/admin/bak10";
}
@RequestMapping("/bak11")
public String bak11(Map<String, Object> model) {
return "/admin/bak11";
}
@RequestMapping("/bak12")
public String bak12(Map<String, Object> model) {
return "/admin/bak12";
}
@RequestMapping("/bak13")
public String bak13(Map<String, Object> model) {
return "/admin/bak13";
}
@RequestMapping("/bak14")
public String bak14(Map<String, Object> model) {
return "/admin/bak14";
}
@RequestMapping("/bak15")
public String bak15(Map<String, Object> model) {
return "/admin/bak15";
}
}

View File

@ -1,163 +1,163 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.*;
import cn.palmte.work.service.DeptService;
import cn.palmte.work.service.ProcurementTypeService;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.ExportUtils;
import org.activiti.engine.task.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.utils.CollectionUtil;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@Controller
@RequestMapping("/department")
public class DepartmentController extends BaseController{
@Autowired
private DeptService deptService;
@Autowired
private DeptRepository deptRepository;
@Autowired
private AdminRepository adminRepository;
/**
*
* @param keywords
* @param pageNumber
* @param pageSize
* @param model
* @return
*/
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords",required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
Page<Dept> page = deptService.list(searchInfo, pageNumber, pageSize);
List<Dept> list = page.getList();
if(CollectionUtil.isNotEmpty(list)){
int offset = (pageNumber - 1) * pageSize;
for (int i = 0 , size = list.size(); i < size; i++) {
list.get(i).setTempId(i+1 + offset);
}
}
model.put("pager", page);
List<Dept> deptList = deptRepository.findEnableParent();
model.put("parentList", deptList);
return "/admin/department_list";
}
/**
*
* @param model
* @return
*/
@GetMapping(value = "/add")
public String add( Map<String, Object> model){
Dept department = new Dept();
model.put("deptId",-1);
model.put("department",department);
List<Admin> adminList = adminRepository.getAllEnableWoAdmin();
model.put("userList", adminList);
List<Dept> deptList = deptRepository.findEnableParent();
model.put("parentList", deptList);
return "/admin/department_input";
}
/**
*
* @param model
* @return
*/
@GetMapping(value = "/edit")
public String edit( Map<String, Object> model, @RequestParam("id") int id){
Dept dept = deptRepository.findOne(id);
model.put("deptId", id);
model.put("department", dept);
List<Admin> adminList = adminRepository.getAllEnableWoAdmin();
model.put("userList", adminList);
List<Dept> deptList = deptRepository.findEnableParent();
model.put("parentList", deptList);
return "/admin/department_input";
}
/**
*
* @param deptId
* @param dept
* @param model
* @return
*/
@PostMapping(value = "/save")
public String save(@RequestParam("deptId") int deptId,
Dept dept, Map<String, Object> model){
deptService.saveOtUpdate(deptId,dept);
return "redirect:/department/list";
}
/**
*
*/
@RequestMapping("/enableOrDisable")
@ResponseBody
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
@RequestParam("status") int status, RedirectAttributes attr) {
boolean isSuccess = false;
try {
isSuccess = deptService.enableOrDisable(status, id);
} catch (Exception e) {
e.getMessage();
}
if (isSuccess) {
return ResponseMsg.buildSuccessMsg("操作成功");
} else {
return ResponseMsg.buildSuccessMsg("操作失败");
}
}
/**
*
*/
@RequestMapping("/checkName")
@ResponseBody
public ResponseMsg checkName(@RequestParam("id") int id,
@RequestParam("name") String name, RedirectAttributes attr) {
Dept dept = deptRepository.findByNameEquals(name);
if (dept != null && id != dept.getId()) {
return ResponseMsg.buildFailedMsg("失败");
}
return ResponseMsg.buildSuccessMsg("成功");
}
/**
*
*/
@RequestMapping("/export")
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(httpServletResponse , Utils.generateExcelName("部门表"), "application/octet-stream");
String[] headers = {"部门名称", "部门领导", "所属上级", "创建人","创建时间", "状态"};
String[] exportColumns = {"name", "realName", "parentName", "createdBy","createdTime", "status"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> deptService.list(searchInfo, pN, pS).getList());
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.*;
import cn.palmte.work.service.DeptService;
import cn.palmte.work.service.ProcurementTypeService;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.ExportUtils;
import org.activiti.engine.task.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.utils.CollectionUtil;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@Controller
@RequestMapping("/department")
public class DepartmentController extends BaseController{
@Autowired
private DeptService deptService;
@Autowired
private DeptRepository deptRepository;
@Autowired
private AdminRepository adminRepository;
/**
*
* @param keywords
* @param pageNumber
* @param pageSize
* @param model
* @return
*/
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords",required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
Page<Dept> page = deptService.list(searchInfo, pageNumber, pageSize);
List<Dept> list = page.getList();
if(CollectionUtil.isNotEmpty(list)){
int offset = (pageNumber - 1) * pageSize;
for (int i = 0 , size = list.size(); i < size; i++) {
list.get(i).setTempId(i+1 + offset);
}
}
model.put("pager", page);
List<Dept> deptList = deptRepository.findEnableParent();
model.put("parentList", deptList);
return "/admin/department_list";
}
/**
*
* @param model
* @return
*/
@GetMapping(value = "/add")
public String add( Map<String, Object> model){
Dept department = new Dept();
model.put("deptId",-1);
model.put("department",department);
List<Admin> adminList = adminRepository.getAllEnableWoAdmin();
model.put("userList", adminList);
List<Dept> deptList = deptRepository.findEnableParent();
model.put("parentList", deptList);
return "/admin/department_input";
}
/**
*
* @param model
* @return
*/
@GetMapping(value = "/edit")
public String edit( Map<String, Object> model, @RequestParam("id") int id){
Dept dept = deptRepository.findOne(id);
model.put("deptId", id);
model.put("department", dept);
List<Admin> adminList = adminRepository.getAllEnableWoAdmin();
model.put("userList", adminList);
List<Dept> deptList = deptRepository.findEnableParent();
model.put("parentList", deptList);
return "/admin/department_input";
}
/**
*
* @param deptId
* @param dept
* @param model
* @return
*/
@PostMapping(value = "/save")
public String save(@RequestParam("deptId") int deptId,
Dept dept, Map<String, Object> model){
deptService.saveOtUpdate(deptId,dept);
return "redirect:/department/list";
}
/**
*
*/
@RequestMapping("/enableOrDisable")
@ResponseBody
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
@RequestParam("status") int status, RedirectAttributes attr) {
boolean isSuccess = false;
try {
isSuccess = deptService.enableOrDisable(status, id);
} catch (Exception e) {
e.getMessage();
}
if (isSuccess) {
return ResponseMsg.buildSuccessMsg("操作成功");
} else {
return ResponseMsg.buildSuccessMsg("操作失败");
}
}
/**
*
*/
@RequestMapping("/checkName")
@ResponseBody
public ResponseMsg checkName(@RequestParam("id") int id,
@RequestParam("name") String name, RedirectAttributes attr) {
Dept dept = deptRepository.findByNameEquals(name);
if (dept != null && id != dept.getId()) {
return ResponseMsg.buildFailedMsg("失败");
}
return ResponseMsg.buildSuccessMsg("成功");
}
/**
*
*/
@RequestMapping("/export")
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(httpServletResponse , Utils.generateExcelName("部门表"), "application/octet-stream");
String[] headers = {"部门名称", "部门领导", "所属上级", "创建人","创建时间", "状态"};
String[] exportColumns = {"name", "realName", "parentName", "createdBy","createdTime", "status"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> deptService.list(searchInfo, pN, pS).getList());
}
}

View File

@ -1,49 +1,49 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.config.Constant;
import cn.palmte.work.config.UploadProperties;
import cn.palmte.work.pojo.UploadResult;
import cn.palmte.work.utils.UploadUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
/**
* @author pengqiang
* @date 2018/4/21
*/
@Controller
@RequestMapping("/file")
public class FileController extends BaseController {
@Autowired
private UploadProperties uploadProperties;
/**
*
* @return
*/
@PostMapping("/upload")
@ResponseBody
public ResponseMsg upload(@RequestParam(value = "files[]") MultipartFile[] multipartfiles) {
ResponseMsg responseMsg = ResponseMsg.buildFailedMsg("failed");
if (null != multipartfiles && multipartfiles.length > 0) {
MultipartFile file = multipartfiles[0];
UploadResult result = UploadUtil.upload(file,
uploadProperties.getPath() , uploadProperties.getPrefix());
if (Constant.STATUS_SUCCESS == result.getStatus()) {
responseMsg = ResponseMsg.buildSuccessMsg("成功", result);
} else {
responseMsg.setMsg(result.getMsg());
}
}
return responseMsg;
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.config.Constant;
import cn.palmte.work.config.UploadProperties;
import cn.palmte.work.pojo.UploadResult;
import cn.palmte.work.utils.UploadUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
/**
* @author pengqiang
* @date 2018/4/21
*/
@Controller
@RequestMapping("/file")
public class FileController extends BaseController {
@Autowired
private UploadProperties uploadProperties;
/**
*
* @return
*/
@PostMapping("/upload")
@ResponseBody
public ResponseMsg upload(@RequestParam(value = "files[]") MultipartFile[] multipartfiles) {
ResponseMsg responseMsg = ResponseMsg.buildFailedMsg("failed");
if (null != multipartfiles && multipartfiles.length > 0) {
MultipartFile file = multipartfiles[0];
UploadResult result = UploadUtil.upload(file,
uploadProperties.getPath() , uploadProperties.getPrefix());
if (Constant.STATUS_SUCCESS == result.getStatus()) {
responseMsg = ResponseMsg.buildSuccessMsg("成功", result);
} else {
responseMsg.setMsg(result.getMsg());
}
}
return responseMsg;
}
}

View File

@ -1,168 +1,168 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.*;
import cn.palmte.work.service.HumanCostService;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.ExcelUtil;
import cn.palmte.work.utils.excel.ExportUtils;
import com.alibaba.fastjson.JSON;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import top.jfunc.common.db.bean.Page;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
*
* @author Yuanping Zhang
* @date 2021/11/1
*/
@Controller
@RequestMapping("/humanCost")
public class HumanCostController extends BaseController{
private static final Logger logger = LoggerFactory.getLogger(HumanCostController.class);
@Autowired
private DeptRepository deptRepository;
@Autowired
private HumanCostService humanCostService;
@Autowired
private AdminRepository adminRepository;
@Autowired
private ProjectRepository projectRepository;
/**
*
*/
@RequestMapping("/list")
public String list(@RequestParam(value = KEYWORDS,required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
//当前登录人的角色类型
Admin admin = getAdmin();
int roleLevel = admin.getRoleLevel();
List<Project> selfProjects = projectRepository.findByCreator(admin.getId(), new Date());
if (roleLevel <= 3 || roleLevel == 6) {
model.put("deptVary", 1);
model.put("deptList", deptRepository.findAll());
model.put("projectList", projectRepository.findAll());
model.put("showSalary", 1);
} else if (roleLevel == 4 || roleLevel == 5) {
model.put("deptVary", -1);
model.put("deptList", new ArrayList<>());
model.put("projectList", projectRepository.findByDeptId(admin.getDeptId()));
model.put("showSalary", -1);
} else if (selfProjects != null) {
model.put("deptVary", -1);
model.put("deptList", new ArrayList<>());
model.put("projectList", selfProjects);
model.put("showSalary", -1);
} else {
keywords = setDate(keywords);
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
if (searchInfo.containsKey("time")) {
String time = searchInfo.get("time");
if (time.length() == 7) {
String individualTime = time.substring(0, 4) + "年" + time.substring(5, 7) + "月";
model.put("individualTime", individualTime);
}
}
model.put("pager",humanCostService.individual(searchInfo, admin.getId(), pageNumber, pageSize));
return "admin/human_cost_individual";
}
keywords = setDate(keywords);
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
Page<ProjectUserTime> project = humanCostService.project(searchInfo, admin, pageNumber, pageSize);
List<ProjectUserTime> staff = humanCostService.staff(searchInfo, admin);
Map<String, BigDecimal> map = humanCostService.map(searchInfo, admin, pageNumber, pageSize);
BigDecimal total = humanCostService.sum(searchInfo, admin);
model.put("pager", project);
model.put("staff", staff);
model.put("map", map);
model.put("total", total);
return "admin/human_cost_list";
}
private String setDate(String keywords) {
if (keywords == null || keywords.length() == 0) {
Date date = new Date();
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1);
date = calendar.getTime();
String accDate = sf.format(date);
keywords = "{time: '" + accDate + "'}";
}
return keywords;
}
/**
*
*/
@RequestMapping("/export")
public void export(@RequestParam(value = KEYWORDS,required = false) String keywords,
HttpServletResponse response) throws Exception{
Admin admin = getAdmin();
Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(response , Utils.generateExcelName("人力成本表"));
Page<ProjectUserTime> project = humanCostService.project((ConcurrentHashMap<String, String>) searchInfo, admin, 1, 5000);
List<ProjectUserTime> staff = humanCostService.staff((ConcurrentHashMap<String, String>) searchInfo, admin);
Map<String, BigDecimal> map = humanCostService.map((ConcurrentHashMap<String, String>) searchInfo, admin, 1, 5000);
String[] headers = humanCostService.getHeaders(staff);
String[] columns = humanCostService.getColumns(project.getList());
ExportUtils.exportHumanCost(headers, columns, staff, project.getList(),
response.getOutputStream() , map);
}
/**
*
*/
@RequestMapping("/template")
public void importTemplate(HttpServletResponse response) throws IOException {
String[] columns = new String[]{""};
downloadHeader(response , Utils.generateExcelName("人力成本导入模板"));
List<String> data = new ArrayList<>();
data.add("成本");
String[] headers = humanCostService.template(data);
ExportUtils exportUtils = new ExportUtils(headers);
exportUtils.exportTemplate(columns , data, "yyyy-MM-dd HH:mm:ss" , 1);
exportUtils.write(response.getOutputStream());
}
@RequestMapping("/batchImport")
@ResponseBody
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
try {
Map<String, String> title = new HashMap<>();
Collection<Map> maps = ExcelUtil.importHumanCost(Map.class, file.getInputStream(),
title,0);
return JSON.toJSONString(humanCostService.check(maps, title, date));
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
logger.error("", e);
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误请上传excel 2003/2007格式文件"));
} catch (Exception e) {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
}
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.*;
import cn.palmte.work.service.HumanCostService;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.ExcelUtil;
import cn.palmte.work.utils.excel.ExportUtils;
import com.alibaba.fastjson.JSON;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import top.jfunc.common.db.bean.Page;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
*
* @author Yuanping Zhang
* @date 2021/11/1
*/
@Controller
@RequestMapping("/humanCost")
public class HumanCostController extends BaseController{
private static final Logger logger = LoggerFactory.getLogger(HumanCostController.class);
@Autowired
private DeptRepository deptRepository;
@Autowired
private HumanCostService humanCostService;
@Autowired
private AdminRepository adminRepository;
@Autowired
private ProjectRepository projectRepository;
/**
*
*/
@RequestMapping("/list")
public String list(@RequestParam(value = KEYWORDS,required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
//当前登录人的角色类型
Admin admin = getAdmin();
int roleLevel = admin.getRoleLevel();
List<Project> selfProjects = projectRepository.findByCreator(admin.getId(), new Date());
if (roleLevel <= 3 || roleLevel == 6) {
model.put("deptVary", 1);
model.put("deptList", deptRepository.findAll());
model.put("projectList", projectRepository.findAll());
model.put("showSalary", 1);
} else if (roleLevel == 4 || roleLevel == 5) {
model.put("deptVary", -1);
model.put("deptList", new ArrayList<>());
model.put("projectList", projectRepository.findByDeptId(admin.getDeptId()));
model.put("showSalary", -1);
} else if (selfProjects != null) {
model.put("deptVary", -1);
model.put("deptList", new ArrayList<>());
model.put("projectList", selfProjects);
model.put("showSalary", -1);
} else {
keywords = setDate(keywords);
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
if (searchInfo.containsKey("time")) {
String time = searchInfo.get("time");
if (time.length() == 7) {
String individualTime = time.substring(0, 4) + "年" + time.substring(5, 7) + "月";
model.put("individualTime", individualTime);
}
}
model.put("pager",humanCostService.individual(searchInfo, admin.getId(), pageNumber, pageSize));
return "admin/human_cost_individual";
}
keywords = setDate(keywords);
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
Page<ProjectUserTime> project = humanCostService.project(searchInfo, admin, pageNumber, pageSize);
List<ProjectUserTime> staff = humanCostService.staff(searchInfo, admin);
Map<String, BigDecimal> map = humanCostService.map(searchInfo, admin, pageNumber, pageSize);
BigDecimal total = humanCostService.sum(searchInfo, admin);
model.put("pager", project);
model.put("staff", staff);
model.put("map", map);
model.put("total", total);
return "admin/human_cost_list";
}
private String setDate(String keywords) {
if (keywords == null || keywords.length() == 0) {
Date date = new Date();
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1);
date = calendar.getTime();
String accDate = sf.format(date);
keywords = "{time: '" + accDate + "'}";
}
return keywords;
}
/**
*
*/
@RequestMapping("/export")
public void export(@RequestParam(value = KEYWORDS,required = false) String keywords,
HttpServletResponse response) throws Exception{
Admin admin = getAdmin();
Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(response , Utils.generateExcelName("人力成本表"));
Page<ProjectUserTime> project = humanCostService.project((ConcurrentHashMap<String, String>) searchInfo, admin, 1, 5000);
List<ProjectUserTime> staff = humanCostService.staff((ConcurrentHashMap<String, String>) searchInfo, admin);
Map<String, BigDecimal> map = humanCostService.map((ConcurrentHashMap<String, String>) searchInfo, admin, 1, 5000);
String[] headers = humanCostService.getHeaders(staff);
String[] columns = humanCostService.getColumns(project.getList());
ExportUtils.exportHumanCost(headers, columns, staff, project.getList(),
response.getOutputStream() , map);
}
/**
*
*/
@RequestMapping("/template")
public void importTemplate(HttpServletResponse response) throws IOException {
String[] columns = new String[]{""};
downloadHeader(response , Utils.generateExcelName("人力成本导入模板"));
List<String> data = new ArrayList<>();
data.add("成本");
String[] headers = humanCostService.template(data);
ExportUtils exportUtils = new ExportUtils(headers);
exportUtils.exportTemplate(columns , data, "yyyy-MM-dd HH:mm:ss" , 1);
exportUtils.write(response.getOutputStream());
}
@RequestMapping("/batchImport")
@ResponseBody
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
try {
Map<String, String> title = new HashMap<>();
Collection<Map> maps = ExcelUtil.importHumanCost(Map.class, file.getInputStream(),
title,0);
return JSON.toJSONString(humanCostService.check(maps, title, date));
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
logger.error("", e);
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误请上传excel 2003/2007格式文件"));
} catch (Exception e) {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
}
}
}

View File

@ -1,15 +1,15 @@
package cn.palmte.work.controller.backend;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/")
public class IndexController extends BaseController{
@GetMapping(value = "/")
public String index() throws Exception {
return "redirect:/admin/login";
}
}
package cn.palmte.work.controller.backend;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/")
public class IndexController extends BaseController{
@GetMapping(value = "/")
public String index() throws Exception {
return "redirect:/admin/login";
}
}

View File

@ -1,142 +1,142 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.MonthlySettle;
import cn.palmte.work.model.MonthlySettleRepository;
import cn.palmte.work.service.MonthlySettleService;
import cn.palmte.work.utils.FreeMarkerUtil;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.AppendMore;
import cn.palmte.work.utils.excel.ExcelLogs;
import cn.palmte.work.utils.excel.ExcelUtil;
import cn.palmte.work.utils.excel.ExportUtils;
import com.alibaba.fastjson.JSON;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author Yuanping Zhang
* @date 2022/08/08
*/
@Controller
@RequestMapping("/monthlySettle")
public class MonthlySettleController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(MonthlySettleController.class);
@Autowired
private MonthlySettleService monthlySettleService;
@Autowired
private MonthlySettleRepository monthlySettleRepository;
@RequestMapping("/list")
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
// 初始化参数
setModel(keywords, model);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("pager", monthlySettleService.list(searchInfo, pageNumber, pageSize));
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "/admin/monthly_settle_list";
}
@RequestMapping("/info")
public String info(@RequestParam("id") int id, Map<String, Object> model) {
MonthlySettle monthlySettle = monthlySettleService.findById(id);
model.put("monthlySettle", monthlySettle);
model.put("projectNameStr", monthlySettle.getProjectName());
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "/admin/monthly_settle_info";
}
@RequestMapping("/infoByTime")
public String infoByTime(@RequestParam String month, @RequestParam("projectName") String projectName, Map<String, Object> model) {
MonthlySettle monthlySettle = monthlySettleService.findByMonthAndProjectName(month, projectName);
if (monthlySettle == null) {
monthlySettle = new MonthlySettle();
}
model.put("monthlySettle", monthlySettle);
model.put("projectNameStr", projectName);
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "/admin/monthly_settle_info";
}
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
model.put("keywords", keywords);
}
@RequestMapping("/export")
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(httpServletResponse, Utils.generateExcelName("PMO项目执行进度管理"), "application/octet-stream");
String[] headers = {"项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额",
"销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "到货证明", "项目风险预警", "已计收金额", "未计收金额", "超期天数", "验收报告时间"};
String[] exportColumns = {"projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound",
"totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound",
"collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "productCertificate", "riskWarning", "uncalColAmountRound", "calColAmountRound", "timeOutDay", "inspectionReportTimeStr"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> monthlySettleService.list(searchInfo, pN, pS).getList());
}
@RequestMapping("/exportSingle")
public void exportSingle(@RequestParam String id, @RequestParam String time, @RequestParam String projectName, HttpServletResponse httpServletResponse) throws IOException {
downloadHeader(httpServletResponse, Utils.generateExcelName("PMO项目执行进度管理明细"), "application/octet-stream");
String[] headers = {"月份", "项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额",
"销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"};
String[] exportColumns = {"month", "projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound",
"totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound",
"collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "timeOutDay", "productCertificate", "inspectionReportTimeStr", "riskWarning", "uncalColAmountRound", "calColAmountRound"};
ExportUtils.exportToExcel2(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), monthlySettleService.findOne(id, time, projectName));
}
/**
*
*/
@RequestMapping("/template")
public void template(HttpServletResponse response) throws Exception {
String[] headers = new String[]{"项目编号", "最终业主", "合同方", "项目名称", "合同金额", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额", "合同编号", "项目类型", "合同签订时间", "销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额",
"实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"};
downloadHeader(response, Utils.generateExcelName("PMO项目执行进度管理导入模板"));
ExportUtils exportUtils = new ExportUtils(headers);
exportUtils.write(response.getOutputStream());
}
/**
*
*/
@RequestMapping("/batchImport")
@ResponseBody
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
try {
ExcelLogs logs = new ExcelLogs();
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
"yyyy/MM/dd HH:mm:ss", logs, 0);
synchronized (this) {
return JSON.toJSONString(monthlySettleService.check(maps, date));
}
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误请上传excel 2003/2007格式文件"));
} catch (Exception e) {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
}
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.MonthlySettle;
import cn.palmte.work.model.MonthlySettleRepository;
import cn.palmte.work.service.MonthlySettleService;
import cn.palmte.work.utils.FreeMarkerUtil;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.AppendMore;
import cn.palmte.work.utils.excel.ExcelLogs;
import cn.palmte.work.utils.excel.ExcelUtil;
import cn.palmte.work.utils.excel.ExportUtils;
import com.alibaba.fastjson.JSON;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author Yuanping Zhang
* @date 2022/08/08
*/
@Controller
@RequestMapping("/monthlySettle")
public class MonthlySettleController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(MonthlySettleController.class);
@Autowired
private MonthlySettleService monthlySettleService;
@Autowired
private MonthlySettleRepository monthlySettleRepository;
@RequestMapping("/list")
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
// 初始化参数
setModel(keywords, model);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.put("pager", monthlySettleService.list(searchInfo, pageNumber, pageSize));
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "/admin/monthly_settle_list";
}
@RequestMapping("/info")
public String info(@RequestParam("id") int id, Map<String, Object> model) {
MonthlySettle monthlySettle = monthlySettleService.findById(id);
model.put("monthlySettle", monthlySettle);
model.put("projectNameStr", monthlySettle.getProjectName());
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "/admin/monthly_settle_info";
}
@RequestMapping("/infoByTime")
public String infoByTime(@RequestParam String month, @RequestParam("projectName") String projectName, Map<String, Object> model) {
MonthlySettle monthlySettle = monthlySettleService.findByMonthAndProjectName(month, projectName);
if (monthlySettle == null) {
monthlySettle = new MonthlySettle();
}
model.put("monthlySettle", monthlySettle);
model.put("projectNameStr", projectName);
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "/admin/monthly_settle_info";
}
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
model.put("keywords", keywords);
}
@RequestMapping("/export")
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(httpServletResponse, Utils.generateExcelName("PMO项目执行进度管理"), "application/octet-stream");
String[] headers = {"项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额",
"销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "到货证明", "项目风险预警", "已计收金额", "未计收金额", "超期天数", "验收报告时间"};
String[] exportColumns = {"projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound",
"totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound",
"collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "productCertificate", "riskWarning", "uncalColAmountRound", "calColAmountRound", "timeOutDay", "inspectionReportTimeStr"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> monthlySettleService.list(searchInfo, pN, pS).getList());
}
@RequestMapping("/exportSingle")
public void exportSingle(@RequestParam String id, @RequestParam String time, @RequestParam String projectName, HttpServletResponse httpServletResponse) throws IOException {
downloadHeader(httpServletResponse, Utils.generateExcelName("PMO项目执行进度管理明细"), "application/octet-stream");
String[] headers = {"月份", "项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额",
"销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"};
String[] exportColumns = {"month", "projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound",
"totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound",
"collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "timeOutDay", "productCertificate", "inspectionReportTimeStr", "riskWarning", "uncalColAmountRound", "calColAmountRound"};
ExportUtils.exportToExcel2(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), monthlySettleService.findOne(id, time, projectName));
}
/**
*
*/
@RequestMapping("/template")
public void template(HttpServletResponse response) throws Exception {
String[] headers = new String[]{"项目编号", "最终业主", "合同方", "项目名称", "合同金额", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额", "合同编号", "项目类型", "合同签订时间", "销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额",
"实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"};
downloadHeader(response, Utils.generateExcelName("PMO项目执行进度管理导入模板"));
ExportUtils exportUtils = new ExportUtils(headers);
exportUtils.write(response.getOutputStream());
}
/**
*
*/
@RequestMapping("/batchImport")
@ResponseBody
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
try {
ExcelLogs logs = new ExcelLogs();
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
"yyyy/MM/dd HH:mm:ss", logs, 0);
synchronized (this) {
return JSON.toJSONString(monthlySettleService.check(maps, date));
}
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误请上传excel 2003/2007格式文件"));
} catch (Exception e) {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
}
}
}

View File

@ -1,67 +1,67 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.SettleBean;
import cn.palmte.work.model.Admin;
import cn.palmte.work.pojo.MonthlySettleCount;
import cn.palmte.work.service.MonthlySettleStatisticsService;
import cn.palmte.work.utils.DateKit;
import cn.palmte.work.utils.InterfaceUtil;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Controller
@RequestMapping("/monthlySettleStatistics")
public class MonthlySettleStatisticsController extends BaseController {
@Autowired
private MonthlySettleStatisticsService monthlySettleStatisticsService;
/**
*
*
* @param keywords
* @param pageNumber
* @param pageSize
* @param model
* @return
*/
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords", required = false) String keywords,
@RequestParam(value = "pageNumber", defaultValue = "1") int pageNumber,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
Map<String, Object> model) {
//当前登录人的角色类型
Admin admin = getAdmin();
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
String time;
if (!searchInfo.containsKey("time")) {
Calendar instance = Calendar.getInstance();
instance.setTime(new Date());
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH));
Date current = instance.getTime();
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
model.put("time", time);
}
return "/admin/monthly_settle_statistics";
}
@RequestMapping("/listData")
@ResponseBody
public String listData(@RequestParam(value = "time", required = false) String time,
Map<String, Object> model) {
// 初始化参数
List<MonthlySettleCount> countList = monthlySettleStatisticsService.getListData(time);
return JSONObject.toJSONString(countList);
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.SettleBean;
import cn.palmte.work.model.Admin;
import cn.palmte.work.pojo.MonthlySettleCount;
import cn.palmte.work.service.MonthlySettleStatisticsService;
import cn.palmte.work.utils.DateKit;
import cn.palmte.work.utils.InterfaceUtil;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Controller
@RequestMapping("/monthlySettleStatistics")
public class MonthlySettleStatisticsController extends BaseController {
@Autowired
private MonthlySettleStatisticsService monthlySettleStatisticsService;
/**
*
*
* @param keywords
* @param pageNumber
* @param pageSize
* @param model
* @return
*/
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords", required = false) String keywords,
@RequestParam(value = "pageNumber", defaultValue = "1") int pageNumber,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
Map<String, Object> model) {
//当前登录人的角色类型
Admin admin = getAdmin();
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
String time;
if (!searchInfo.containsKey("time")) {
Calendar instance = Calendar.getInstance();
instance.setTime(new Date());
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH));
Date current = instance.getTime();
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
model.put("time", time);
}
return "/admin/monthly_settle_statistics";
}
@RequestMapping("/listData")
@ResponseBody
public String listData(@RequestParam(value = "time", required = false) String time,
Map<String, Object> model) {
// 初始化参数
List<MonthlySettleCount> countList = monthlySettleStatisticsService.getListData(time);
return JSONObject.toJSONString(countList);
}
}

View File

@ -1,156 +1,156 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.ProcurementType;
import cn.palmte.work.service.ProcurementTypeService;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.ExportUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@Controller
@RequestMapping("/procurement/type")
public class ProcurementTypeController extends BaseController{
@Autowired
private ProcurementTypeService procurementTypeService;
/**
*
* @param keywords
* @param pageNumber
* @param pageSize
* @param model
* @return
*/
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords",required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
model.put(PAGER,procurementTypeService.list(searchInfo,pageNumber,pageSize));
return "/admin/procurement_type_list";
}
/**
*
* @param model
* @return
*/
@GetMapping(value = "/add")
public String add( Map<String, Object> model){
ProcurementType procurementType = new ProcurementType();
model.put("procurementTypeId",-1);
model.put("procurementType",procurementType);
return "/admin/procurement_type_input";
}
/**
*
*/
@RequestMapping("/edit")
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
ProcurementType procurementType = procurementTypeService.findOne(id);
model.put("procurementTypeId",id);
model.put("procurementType", procurementType);
return "/admin/procurement_type_input";
}
/**
*
* @param procurementTypeId
* @param procurementType
* @param model
* @return
*/
@PostMapping(value = "/save")
public String save(@RequestParam("procurementTypeId") int procurementTypeId,
ProcurementType procurementType, Map<String, Object> model){
procurementTypeService.saveOtUpdate(procurementTypeId,procurementType);
return "redirect:/procurement/type/list";
}
/**
*
* @param ids
* @return
*/
@GetMapping(value = "/delete")
@ResponseBody
public ResponseMsg delete(@RequestParam("ids") String ids){
String[] deleteIds=ids.split("#%#");
boolean deleted = procurementTypeService.deleteByIDs(deleteIds);
ResponseMsg responseMsge=new ResponseMsg();
if(deleted){
responseMsge.setStatus(0);
responseMsge.setMsg("删除成功");
} else{
responseMsge.setStatus(1);
responseMsge.setMsg("删除失败");
}
return responseMsge;
}
/**
*
*/
@RequestMapping("/enableOrDisable")
@ResponseBody
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
@RequestParam("status") int status, RedirectAttributes attr) {
boolean isSuccess = false;
try {
isSuccess = procurementTypeService.enableOrDisable(status, id);
} catch (Exception e) {
e.getMessage();
}
if (isSuccess) {
return ResponseMsg.buildSuccessMsg("操作成功");
} else {
return ResponseMsg.buildSuccessMsg("操作失败");
}
}
/**
*
*/
@RequestMapping("/export")
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(httpServletResponse , Utils.generateExcelName("采购类型表"), "application/octet-stream");
String[] headers = {"采购类型名称","所属大类","创建人","创建时间"};
String[] exportColumns = {"name","typeName","createdBy","createdTime"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> procurementTypeService.list(searchInfo, pN, pS).getList());
}
/**
*
*/
@RequestMapping("/map")
@ResponseBody
public ResponseMsg map() {
List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList();
Map<Integer, List<ProcurementType>> map = procurementTypes.stream().collect(Collectors.groupingBy(ProcurementType::getType));
Map<String, Object> objectMap = new HashMap<>();
objectMap.put("procurementTypes", procurementTypes);
objectMap.put("map", map);
return ResponseMsg.buildSuccessData(objectMap);
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.ProcurementType;
import cn.palmte.work.service.ProcurementTypeService;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.ExportUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@Controller
@RequestMapping("/procurement/type")
public class ProcurementTypeController extends BaseController{
@Autowired
private ProcurementTypeService procurementTypeService;
/**
*
* @param keywords
* @param pageNumber
* @param pageSize
* @param model
* @return
*/
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords",required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
model.put(PAGER,procurementTypeService.list(searchInfo,pageNumber,pageSize));
return "/admin/procurement_type_list";
}
/**
*
* @param model
* @return
*/
@GetMapping(value = "/add")
public String add( Map<String, Object> model){
ProcurementType procurementType = new ProcurementType();
model.put("procurementTypeId",-1);
model.put("procurementType",procurementType);
return "/admin/procurement_type_input";
}
/**
*
*/
@RequestMapping("/edit")
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
ProcurementType procurementType = procurementTypeService.findOne(id);
model.put("procurementTypeId",id);
model.put("procurementType", procurementType);
return "/admin/procurement_type_input";
}
/**
*
* @param procurementTypeId
* @param procurementType
* @param model
* @return
*/
@PostMapping(value = "/save")
public String save(@RequestParam("procurementTypeId") int procurementTypeId,
ProcurementType procurementType, Map<String, Object> model){
procurementTypeService.saveOtUpdate(procurementTypeId,procurementType);
return "redirect:/procurement/type/list";
}
/**
*
* @param ids
* @return
*/
@GetMapping(value = "/delete")
@ResponseBody
public ResponseMsg delete(@RequestParam("ids") String ids){
String[] deleteIds=ids.split("#%#");
boolean deleted = procurementTypeService.deleteByIDs(deleteIds);
ResponseMsg responseMsge=new ResponseMsg();
if(deleted){
responseMsge.setStatus(0);
responseMsge.setMsg("删除成功");
} else{
responseMsge.setStatus(1);
responseMsge.setMsg("删除失败");
}
return responseMsge;
}
/**
*
*/
@RequestMapping("/enableOrDisable")
@ResponseBody
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
@RequestParam("status") int status, RedirectAttributes attr) {
boolean isSuccess = false;
try {
isSuccess = procurementTypeService.enableOrDisable(status, id);
} catch (Exception e) {
e.getMessage();
}
if (isSuccess) {
return ResponseMsg.buildSuccessMsg("操作成功");
} else {
return ResponseMsg.buildSuccessMsg("操作失败");
}
}
/**
*
*/
@RequestMapping("/export")
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(httpServletResponse , Utils.generateExcelName("采购类型表"), "application/octet-stream");
String[] headers = {"采购类型名称","所属大类","创建人","创建时间"};
String[] exportColumns = {"name","typeName","createdBy","createdTime"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> procurementTypeService.list(searchInfo, pN, pS).getList());
}
/**
*
*/
@RequestMapping("/map")
@ResponseBody
public ResponseMsg map() {
List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList();
Map<Integer, List<ProcurementType>> map = procurementTypes.stream().collect(Collectors.groupingBy(ProcurementType::getType));
Map<String, Object> objectMap = new HashMap<>();
objectMap.put("procurementTypes", procurementTypes);
objectMap.put("map", map);
return ResponseMsg.buildSuccessData(objectMap);
}
}

View File

@ -1,110 +1,110 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.FinalBean;
import cn.palmte.work.model.Project;
import cn.palmte.work.model.ProjectBudgetPlanDetail;
import cn.palmte.work.model.ProjectSettleIncome;
import cn.palmte.work.model.ProjectSettleIncomeRepository;
import cn.palmte.work.service.*;
import cn.palmte.work.utils.FreeMarkerUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.format.number.NumberStyleFormatter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/project/final")
public class ProjectFinalController extends BaseController{
@Autowired
private ProjectFinalSevice projectFinalSevice;
@Autowired
private ProjectService projectService;
@Autowired
private ProjectEstimateService projectEstimateService;
@Autowired
private ProjectBudgetService projectBudgetService;
@Autowired
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
@Autowired
private ProjectSettleService projectSettleService;
@RequestMapping("/add")
public String add(@RequestParam("id") int id, Map<String, Object> model) {
Project project = projectService.getProject(id);
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
String time = "";
if(null != projectSettleIncome){
time = projectSettleIncome.getTime();
}
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
model.put("settleBean",projectSettleService.getCurrentSettle(project, time));
model.put("finalBean",new FinalBean());
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/project_final_add";
}
@RequestMapping("/edit")
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
Project project = projectService.getProject(id);
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
String time = projectSettleIncome.getTime();
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
model.put("settleBean",projectSettleService.getCurrentSettle(project, time));
model.put("finalBean",projectFinalSevice.getFinal(project));
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/project_final_edit";
}
@RequestMapping("/save")
public String estimateAddSave(Project project, FinalBean finalBean, Map<String, Object> model) {
projectFinalSevice.save(project,finalBean);
return "redirect:/project/list";
}
/**
*
*
* @param project
* @param finalBean
* @param model
* @return
* @throws Exception
*/
@RequestMapping("/saveAndApprove")
public String saveAndApprove(Project project, FinalBean finalBean, Map<String, Object> model) throws Exception{
projectFinalSevice.saveAndApprove(project,finalBean);
return "redirect:/project/list";
}
@InitBinder
public void initBinder(WebDataBinder webDataBinder) {
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
webDataBinder.addCustomFormatter(new NumberStyleFormatter());
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.FinalBean;
import cn.palmte.work.model.Project;
import cn.palmte.work.model.ProjectBudgetPlanDetail;
import cn.palmte.work.model.ProjectSettleIncome;
import cn.palmte.work.model.ProjectSettleIncomeRepository;
import cn.palmte.work.service.*;
import cn.palmte.work.utils.FreeMarkerUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.format.number.NumberStyleFormatter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/project/final")
public class ProjectFinalController extends BaseController{
@Autowired
private ProjectFinalSevice projectFinalSevice;
@Autowired
private ProjectService projectService;
@Autowired
private ProjectEstimateService projectEstimateService;
@Autowired
private ProjectBudgetService projectBudgetService;
@Autowired
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
@Autowired
private ProjectSettleService projectSettleService;
@RequestMapping("/add")
public String add(@RequestParam("id") int id, Map<String, Object> model) {
Project project = projectService.getProject(id);
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
String time = "";
if(null != projectSettleIncome){
time = projectSettleIncome.getTime();
}
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
model.put("settleBean",projectSettleService.getCurrentSettle(project, time));
model.put("finalBean",new FinalBean());
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/project_final_add";
}
@RequestMapping("/edit")
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
Project project = projectService.getProject(id);
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
String time = projectSettleIncome.getTime();
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
model.put("settleBean",projectSettleService.getCurrentSettle(project, time));
model.put("finalBean",projectFinalSevice.getFinal(project));
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/project_final_edit";
}
@RequestMapping("/save")
public String estimateAddSave(Project project, FinalBean finalBean, Map<String, Object> model) {
projectFinalSevice.save(project,finalBean);
return "redirect:/project/list";
}
/**
*
*
* @param project
* @param finalBean
* @param model
* @return
* @throws Exception
*/
@RequestMapping("/saveAndApprove")
public String saveAndApprove(Project project, FinalBean finalBean, Map<String, Object> model) throws Exception{
projectFinalSevice.saveAndApprove(project,finalBean);
return "redirect:/project/list";
}
@InitBinder
public void initBinder(WebDataBinder webDataBinder) {
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
webDataBinder.addCustomFormatter(new NumberStyleFormatter());
}
}

View File

@ -1,177 +1,177 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.BudgetSettleBean;
import cn.palmte.work.bean.EstimateSettleBean;
import cn.palmte.work.bean.FormerBean;
import cn.palmte.work.bean.SettleBean;
import cn.palmte.work.model.*;
import cn.palmte.work.service.ProjectBudgetService;
import cn.palmte.work.service.ProjectEstimateService;
import cn.palmte.work.service.ProjectService;
import cn.palmte.work.service.ProjectSettleService;
import cn.palmte.work.utils.DateKit;
import cn.palmte.work.utils.FreeMarkerUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.format.number.NumberStyleFormatter;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import top.jfunc.common.utils.CollectionUtil;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
* @author Yuanping Zhang
* @date 2021/11/15
*/
@Controller
@RequestMapping("/project/settle")
public class ProjectSettleController extends BaseController{
@Autowired
private ProjectService projectService;
@Autowired
private ProjectEstimateService projectEstimateService;
@Autowired
private ProjectBudgetService projectBudgetService;
@Autowired
private ProjectSettleService projectSettleService;
@Autowired
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
@Autowired
private ProjectUserTimeRepository projectUserTimeRepository;
@Autowired
private ProjectSettleMonthRangeRepository projectSettleMonthRangeRepository;
@RequestMapping("/add")
public String add(@RequestParam("id") int id, Map<String, Object> model) {
String time = null;
Project project = projectService.getProject(id);
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
if (projectSettleIncome != null) {
String former = projectSettleIncome.getTime();
Date date = DateKit.getDate(former, DateKit.DATE_FORMAT_YEAR_MONTH2);
Calendar instance = Calendar.getInstance();
instance.setTime(date);
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH) + 1);
Date current = instance.getTime();
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
model.put("startMonth", time);
model.put("endMonth", time);
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
} else {
time = DateKit.toStr(project.getStartDate(), DateKit.DATE_FORMAT_YEAR_MONTH2);
model.put("startMonth", time);
model.put("endMonth", time);
model.put("formerBean", new FormerBean());
}
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(projectUserTimes)){
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
model.put("salary", result);
} else {
model.put("salary", new BigDecimal(0));
}
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/project_settle_add";
}
@RequestMapping("/edit")
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
Project project = projectService.getProject(id);
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
String time = projectSettleIncome.getTime();
ProjectSettleMonthRange projectSettleMonthRange = projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(id, time);
if (projectSettleMonthRange != null) {
model.put("startMonth", projectSettleMonthRange.getStartDate());
} else {
model.put("startMonth", time);
}
model.put("endMonth", time);
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
model.put("monthBean", projectSettleService.getMonthSettle(project, time));
model.put("currentBean", projectSettleService.getCurrentSettle(project, time));
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(projectUserTimes)){
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
model.put("salary", result);
} else {
model.put("salary", new BigDecimal(0));
}
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/project_settle_edit";
}
@RequestMapping("/save")
public String save(Project project, BindingResult bindingResult, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String startMonth, String endMonth) {
if (!startMonth.equals(endMonth) && projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(project.getId(), endMonth) == null) {
ProjectSettleMonthRange range = new ProjectSettleMonthRange();
range.setProjectId(project.getId());
range.setStartDate(startMonth);
range.setEndDate(endMonth);
projectSettleMonthRangeRepository.save(range);
}
projectSettleService.save(project, settleBean, budgetBean, estimateBean, endMonth);
return "redirect:/project/list";
}
/**
*
* @param project
* @param settleBean
* @param budgetBean
* @param estimateBean
* @param endMonth
* @return
* @throws Exception
*/
@RequestMapping("/saveAndApprove")
public String saveAndApprove(Project project, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String startMonth, String endMonth) throws Exception{
if (!startMonth.equals(endMonth) && projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(project.getId(), endMonth) == null) {
ProjectSettleMonthRange range = new ProjectSettleMonthRange();
range.setProjectId(project.getId());
range.setStartDate(startMonth);
range.setEndDate(endMonth);
projectSettleMonthRangeRepository.save(range);
}
projectSettleService.saveAndApprove(project, settleBean, budgetBean, estimateBean, endMonth);
return "redirect:/project/list";
}
@InitBinder
public void initBinder(WebDataBinder webDataBinder) {
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
webDataBinder.addCustomFormatter(new NumberStyleFormatter());
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.BudgetSettleBean;
import cn.palmte.work.bean.EstimateSettleBean;
import cn.palmte.work.bean.FormerBean;
import cn.palmte.work.bean.SettleBean;
import cn.palmte.work.model.*;
import cn.palmte.work.service.ProjectBudgetService;
import cn.palmte.work.service.ProjectEstimateService;
import cn.palmte.work.service.ProjectService;
import cn.palmte.work.service.ProjectSettleService;
import cn.palmte.work.utils.DateKit;
import cn.palmte.work.utils.FreeMarkerUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.format.number.NumberStyleFormatter;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import top.jfunc.common.utils.CollectionUtil;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
* @author Yuanping Zhang
* @date 2021/11/15
*/
@Controller
@RequestMapping("/project/settle")
public class ProjectSettleController extends BaseController{
@Autowired
private ProjectService projectService;
@Autowired
private ProjectEstimateService projectEstimateService;
@Autowired
private ProjectBudgetService projectBudgetService;
@Autowired
private ProjectSettleService projectSettleService;
@Autowired
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
@Autowired
private ProjectUserTimeRepository projectUserTimeRepository;
@Autowired
private ProjectSettleMonthRangeRepository projectSettleMonthRangeRepository;
@RequestMapping("/add")
public String add(@RequestParam("id") int id, Map<String, Object> model) {
String time = null;
Project project = projectService.getProject(id);
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
if (projectSettleIncome != null) {
String former = projectSettleIncome.getTime();
Date date = DateKit.getDate(former, DateKit.DATE_FORMAT_YEAR_MONTH2);
Calendar instance = Calendar.getInstance();
instance.setTime(date);
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH) + 1);
Date current = instance.getTime();
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
model.put("startMonth", time);
model.put("endMonth", time);
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
} else {
time = DateKit.toStr(project.getStartDate(), DateKit.DATE_FORMAT_YEAR_MONTH2);
model.put("startMonth", time);
model.put("endMonth", time);
model.put("formerBean", new FormerBean());
}
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(projectUserTimes)){
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
model.put("salary", result);
} else {
model.put("salary", new BigDecimal(0));
}
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/project_settle_add";
}
@RequestMapping("/edit")
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
Project project = projectService.getProject(id);
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
String time = projectSettleIncome.getTime();
ProjectSettleMonthRange projectSettleMonthRange = projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(id, time);
if (projectSettleMonthRange != null) {
model.put("startMonth", projectSettleMonthRange.getStartDate());
} else {
model.put("startMonth", time);
}
model.put("endMonth", time);
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
model.put("monthBean", projectSettleService.getMonthSettle(project, time));
model.put("currentBean", projectSettleService.getCurrentSettle(project, time));
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(projectUserTimes)){
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
model.put("salary", result);
} else {
model.put("salary", new BigDecimal(0));
}
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/project_settle_edit";
}
@RequestMapping("/save")
public String save(Project project, BindingResult bindingResult, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String startMonth, String endMonth) {
if (!startMonth.equals(endMonth) && projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(project.getId(), endMonth) == null) {
ProjectSettleMonthRange range = new ProjectSettleMonthRange();
range.setProjectId(project.getId());
range.setStartDate(startMonth);
range.setEndDate(endMonth);
projectSettleMonthRangeRepository.save(range);
}
projectSettleService.save(project, settleBean, budgetBean, estimateBean, endMonth);
return "redirect:/project/list";
}
/**
*
* @param project
* @param settleBean
* @param budgetBean
* @param estimateBean
* @param endMonth
* @return
* @throws Exception
*/
@RequestMapping("/saveAndApprove")
public String saveAndApprove(Project project, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String startMonth, String endMonth) throws Exception{
if (!startMonth.equals(endMonth) && projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(project.getId(), endMonth) == null) {
ProjectSettleMonthRange range = new ProjectSettleMonthRange();
range.setProjectId(project.getId());
range.setStartDate(startMonth);
range.setEndDate(endMonth);
projectSettleMonthRangeRepository.save(range);
}
projectSettleService.saveAndApprove(project, settleBean, budgetBean, estimateBean, endMonth);
return "redirect:/project/list";
}
@InitBinder
public void initBinder(WebDataBinder webDataBinder) {
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
webDataBinder.addCustomFormatter(new NumberStyleFormatter());
}
}

View File

@ -1,61 +1,61 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.SettleBean;
import cn.palmte.work.model.Admin;
import cn.palmte.work.service.ProjectSummaryService;
import cn.palmte.work.utils.DateKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
* @author Yuanping Zhang
* @date 2021/11/10
*/
@Controller
@RequestMapping("/projectSummary")
public class ProjectSummaryController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProjectSummaryController.class);
@Autowired
private ProjectSummaryService projectSummaryService;
/**
*
*/
@RequestMapping("/list")
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
//当前登录人的角色类型
Admin admin = getAdmin();
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
String time;
if (!searchInfo.containsKey("time")) {
Calendar instance = Calendar.getInstance();
instance.setTime(new Date());
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH));
Date current = instance.getTime();
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
model.put("time", time);
} else {
time = searchInfo.get("time");
}
List<SettleBean> list = projectSummaryService.getList(searchInfo, time, admin);
model.put("pager", list);
return "admin/project_statistics";
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.SettleBean;
import cn.palmte.work.model.Admin;
import cn.palmte.work.service.ProjectSummaryService;
import cn.palmte.work.utils.DateKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
* @author Yuanping Zhang
* @date 2021/11/10
*/
@Controller
@RequestMapping("/projectSummary")
public class ProjectSummaryController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProjectSummaryController.class);
@Autowired
private ProjectSummaryService projectSummaryService;
/**
*
*/
@RequestMapping("/list")
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
//当前登录人的角色类型
Admin admin = getAdmin();
model.put("keywords",keywords);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
String time;
if (!searchInfo.containsKey("time")) {
Calendar instance = Calendar.getInstance();
instance.setTime(new Date());
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH));
Date current = instance.getTime();
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
model.put("time", time);
} else {
time = searchInfo.get("time");
}
List<SettleBean> list = projectSummaryService.getList(searchInfo, time, admin);
model.put("pager", list);
return "admin/project_statistics";
}
}

View File

@ -1,121 +1,121 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.model.Admin;
import cn.palmte.work.model.Project;
import cn.palmte.work.pojo.SpaceVO;
import cn.palmte.work.service.ProjectService;
import cn.palmte.work.service.SpaceService;
import cn.palmte.work.utils.FreeMarkerUtil;
import cn.palmte.work.utils.InterfaceUtil;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.ExportUtils;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.utils.CollectionUtil;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Controller
@RequestMapping("/space")
public class SpaceController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
@Autowired
private SpaceService spaceService;
@Autowired
private ProjectService projectService;
/**
*
*/
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords", required = false) String keywords,
@RequestParam(value = "certainty") int certainty,
@RequestParam(value = "certaintyStr", required = false) String certaintyStr,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
//当前登录人的角色类型
model.put("keywords", keywords);
model.put("pageNumber", pageNumber);
Admin admin = InterfaceUtil.getAdmin();
model.put("adminId", admin.getId());
model.put("admin", admin);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
if (certainty == 0) {
if (certaintyStr.startsWith("A")) {
certainty = 1;
} else if (certaintyStr.startsWith("B")) {
certainty = 2;
} else if (certaintyStr.startsWith("C")) {
certainty = 3;
}
}
model.put("certainty", certainty);
searchInfo.putIfAbsent("certainty", String.valueOf(certainty));
searchInfo.putIfAbsent("deptName", "销售管理部");
searchInfo.putIfAbsent("estimateStatus", String.valueOf(1));
Page<Project> page = spaceService.list(searchInfo, pageNumber, pageSize);
List<Project> list = page.getList();
if(CollectionUtil.isNotEmpty(list)){
int offset = (pageNumber - 1) * pageSize;
for (int i = 0 , size = list.size(); i < size; i++) {
list.get(i).setTempId(i+1 + offset);
}
}
model.put("pager", page);
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/space_list";
}
/**
*
*/
@RequestMapping("/export")
public void export(@RequestParam(value = "keywords", required = false) String keywords, @RequestParam(value = "certainty") int certainty, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords);
searchInfo.putIfAbsent("certainty", String.valueOf(certainty));
searchInfo.putIfAbsent("deptName", "销售管理部");
searchInfo.putIfAbsent("estimateStatus", String.valueOf(1));
downloadHeader(httpServletResponse, Utils.generateExcelName("项目报表"), "application/octet-stream");
String[] headers = {"项目编号", "项目名称", "项目类型", "垫资模式", "华智产品金额", "华三产品金额", "汇智产品金额", "其他产品金额", "项目把握度", "项目计划招标时间", "预计合同签订时间",
"计收计划", "项目毛利", "合同金额", "项目解决方案", "具体解决方案", "是否二次签单", "最终用户名称", "客户名称", "紫光汇智直接投标/集成商转签", "负责人", "备注","项目阶段"};
String[] exportColumns = {"projectNo", "name", "typeDesc", "underwrittenModeStr", "huazhiRound", "huasanRound", "huizhiRound", "ziguangRound", "certaintyStr", "bidsTimeStr", "contractTimeStr",
"calculationCollection", "grossProfitRound", "contractRound", "resolvePlanStr", "mainContractResolvePlan", "isSecondStr", "terminalCustomer", "customer", "signTypeStr", "principal", "remark","stageName"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> spaceService.list(searchInfo, pN, pS).getList());
}
/**
*
*
* @param model
* @return
*/
@RequestMapping("/statistics")
public String statistics(Map<String, Object> model) {
return "/admin/space_statistics";
}
@RequestMapping("/listData")
@ResponseBody
public String listData() {
SpaceVO spaceVO = spaceService.getListData();
return JSONObject.toJSONString(spaceVO);
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.model.Admin;
import cn.palmte.work.model.Project;
import cn.palmte.work.pojo.SpaceVO;
import cn.palmte.work.service.ProjectService;
import cn.palmte.work.service.SpaceService;
import cn.palmte.work.utils.FreeMarkerUtil;
import cn.palmte.work.utils.InterfaceUtil;
import cn.palmte.work.utils.Utils;
import cn.palmte.work.utils.excel.ExportUtils;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.utils.CollectionUtil;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Controller
@RequestMapping("/space")
public class SpaceController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
@Autowired
private SpaceService spaceService;
@Autowired
private ProjectService projectService;
/**
*
*/
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords", required = false) String keywords,
@RequestParam(value = "certainty") int certainty,
@RequestParam(value = "certaintyStr", required = false) String certaintyStr,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
//当前登录人的角色类型
model.put("keywords", keywords);
model.put("pageNumber", pageNumber);
Admin admin = InterfaceUtil.getAdmin();
model.put("adminId", admin.getId());
model.put("admin", admin);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
if (certainty == 0) {
if (certaintyStr.startsWith("A")) {
certainty = 1;
} else if (certaintyStr.startsWith("B")) {
certainty = 2;
} else if (certaintyStr.startsWith("C")) {
certainty = 3;
}
}
model.put("certainty", certainty);
searchInfo.putIfAbsent("certainty", String.valueOf(certainty));
searchInfo.putIfAbsent("deptName", "销售管理部");
searchInfo.putIfAbsent("estimateStatus", String.valueOf(1));
Page<Project> page = spaceService.list(searchInfo, pageNumber, pageSize);
List<Project> list = page.getList();
if(CollectionUtil.isNotEmpty(list)){
int offset = (pageNumber - 1) * pageSize;
for (int i = 0 , size = list.size(); i < size; i++) {
list.get(i).setTempId(i+1 + offset);
}
}
model.put("pager", page);
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/space_list";
}
/**
*
*/
@RequestMapping("/export")
public void export(@RequestParam(value = "keywords", required = false) String keywords, @RequestParam(value = "certainty") int certainty, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords);
searchInfo.putIfAbsent("certainty", String.valueOf(certainty));
searchInfo.putIfAbsent("deptName", "销售管理部");
searchInfo.putIfAbsent("estimateStatus", String.valueOf(1));
downloadHeader(httpServletResponse, Utils.generateExcelName("项目报表"), "application/octet-stream");
String[] headers = {"项目编号", "项目名称", "项目类型", "垫资模式", "华智产品金额", "华三产品金额", "汇智产品金额", "其他产品金额", "项目把握度", "项目计划招标时间", "预计合同签订时间",
"计收计划", "项目毛利", "合同金额", "项目解决方案", "具体解决方案", "是否二次签单", "最终用户名称", "客户名称", "紫光汇智直接投标/集成商转签", "负责人", "备注","项目阶段"};
String[] exportColumns = {"projectNo", "name", "typeDesc", "underwrittenModeStr", "huazhiRound", "huasanRound", "huizhiRound", "ziguangRound", "certaintyStr", "bidsTimeStr", "contractTimeStr",
"calculationCollection", "grossProfitRound", "contractRound", "resolvePlanStr", "mainContractResolvePlan", "isSecondStr", "terminalCustomer", "customer", "signTypeStr", "principal", "remark","stageName"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> spaceService.list(searchInfo, pN, pS).getList());
}
/**
*
*
* @param model
* @return
*/
@RequestMapping("/statistics")
public String statistics(Map<String, Object> model) {
return "/admin/space_statistics";
}
@RequestMapping("/listData")
@ResponseBody
public String listData() {
SpaceVO spaceVO = spaceService.getListData();
return JSONObject.toJSONString(spaceVO);
}
}

View File

@ -1,30 +1,30 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.CashFlowStatisticsBean;
import cn.palmte.work.bean.PrimaryIndicatorBean;
import cn.palmte.work.bean.StatisticsBean;
import cn.palmte.work.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/statistics")
public class StatisticsController extends BaseController{
@Autowired
private StatisticsService statisticsService;
@RequestMapping("/month")
public String month(Map<String, Object> model){
StatisticsBean statisticsData = statisticsService.getStatisticsData();
model.put("primaryIndicatorList",statisticsData.getPrimaryIndicatorBeanList());
model.put("profitAndLossList",statisticsData.getProfitAndLossBeanList());
model.put("cashFlowList",statisticsData.getCashFlowStatisticsBeanList());
return "admin/month_statistics";
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.CashFlowStatisticsBean;
import cn.palmte.work.bean.PrimaryIndicatorBean;
import cn.palmte.work.bean.StatisticsBean;
import cn.palmte.work.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/statistics")
public class StatisticsController extends BaseController{
@Autowired
private StatisticsService statisticsService;
@RequestMapping("/month")
public String month(Map<String, Object> model){
StatisticsBean statisticsData = statisticsService.getStatisticsData();
model.put("primaryIndicatorList",statisticsData.getPrimaryIndicatorBeanList());
model.put("profitAndLossList",statisticsData.getProfitAndLossBeanList());
model.put("cashFlowList",statisticsData.getCashFlowStatisticsBeanList());
return "admin/month_statistics";
}
}

View File

@ -1,52 +1,52 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.Project;
import cn.palmte.work.model.SysConfig;
import cn.palmte.work.model.SysConfigRepository;
import cn.palmte.work.pojo.SysConfigRequest;
import cn.palmte.work.service.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Map;
@Controller
@RequestMapping("/sys/config")
public class SysConfigController extends BaseController{
@Autowired
private SysConfigService sysConfigService;
@Autowired
private SysConfigRepository sysConfigRepository;
@RequestMapping("/edit")
public String edit(Map<String, Object> model) {
model.put(SysConfig.KEY_UNDERWRITTENTAXRATE,sysConfigRepository.findByCodeEquals(SysConfig.KEY_UNDERWRITTENTAXRATE).getValue());
model.put(SysConfig.KEY_PROJECTCONTRIBUTIONPROFITRATETHRESHOLD,sysConfigRepository.findByCodeEquals(SysConfig.KEY_PROJECTCONTRIBUTIONPROFITRATETHRESHOLD).getValue());
return "admin/profit_marfin_config_input";
}
@ResponseBody
@RequestMapping("/save")
public ResponseMsg save(@RequestBody String json) {
return sysConfigService.saveOrUpdate(json);
}
@RequestMapping("/checkRate")
@ResponseBody
public ResponseMsg checkRate() {
String value = sysConfigRepository.findByCodeEquals(SysConfig.KEY_UNDERWRITTENTAXRATE).getValue();
double rate = Double.parseDouble(value);
if (rate <= 0) {
return ResponseMsg.buildFailedMsg("项目年利率未填写或小于等于0请联系管理员配置");
}
return ResponseMsg.buildSuccessMsg("成功");
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.Project;
import cn.palmte.work.model.SysConfig;
import cn.palmte.work.model.SysConfigRepository;
import cn.palmte.work.pojo.SysConfigRequest;
import cn.palmte.work.service.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Map;
@Controller
@RequestMapping("/sys/config")
public class SysConfigController extends BaseController{
@Autowired
private SysConfigService sysConfigService;
@Autowired
private SysConfigRepository sysConfigRepository;
@RequestMapping("/edit")
public String edit(Map<String, Object> model) {
model.put(SysConfig.KEY_UNDERWRITTENTAXRATE,sysConfigRepository.findByCodeEquals(SysConfig.KEY_UNDERWRITTENTAXRATE).getValue());
model.put(SysConfig.KEY_PROJECTCONTRIBUTIONPROFITRATETHRESHOLD,sysConfigRepository.findByCodeEquals(SysConfig.KEY_PROJECTCONTRIBUTIONPROFITRATETHRESHOLD).getValue());
return "admin/profit_marfin_config_input";
}
@ResponseBody
@RequestMapping("/save")
public ResponseMsg save(@RequestBody String json) {
return sysConfigService.saveOrUpdate(json);
}
@RequestMapping("/checkRate")
@ResponseBody
public ResponseMsg checkRate() {
String value = sysConfigRepository.findByCodeEquals(SysConfig.KEY_UNDERWRITTENTAXRATE).getValue();
double rate = Double.parseDouble(value);
if (rate <= 0) {
return ResponseMsg.buildFailedMsg("项目年利率未填写或小于等于0请联系管理员配置");
}
return ResponseMsg.buildSuccessMsg("成功");
}
}

View File

@ -1,148 +1,148 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.SysPermission;
import cn.palmte.work.model.SysPermissionRepository;
import cn.palmte.work.service.SysPermissionService;
import cn.palmte.work.service.SysRolePermissionService;
import cn.palmte.work.utils.DateKit;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.io.IOException;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
*@author nsp
*
*/
@Controller
@RequestMapping("/permission")
public class SysPermissionController extends BaseController{
@Autowired
private SysPermissionService sysPermissionService;
@Autowired
private SysPermissionRepository sysPermissionRepository;
@Autowired
private SysRolePermissionService sysRolePermissionService;
private static final Logger logger = LoggerFactory.getLogger(SysPermissionController.class);
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords",required = false) String keywords,
@RequestParam(value = "pageNumber",defaultValue = "1") String pageNumber,
@RequestParam(value = "sql", required = false) String sql,
Map<String, Object> model){
// 初始化参数
setModel(keywords, model);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
model.put("pager",sysPermissionService.getAllPermissionListByPage(searchInfo,pageNumber));
model.put("sql", sql);
return "/admin/sys_permission_list";
}
private void setModel(String keywords, Map<String, Object> model){
model.put("pmsLevel","0");
model.put("pmsType","0");
model.put("pmsDeleted","-1");
model.put("permissionID","-1");
model.put("keywords",keywords);
}
@GetMapping(value = "/add")
public String add( Map<String, Object> model){
SysPermission permission=new SysPermission();
model.put("permissionID","-1");
model.put("permission",permission);
model.put("ps", sysPermissionRepository.findPermissions());
return "/admin/sys_permission_input";
}
@PostMapping(value = "/save")
public String save(@RequestParam("permissionID") String permissionID,
SysPermission sysPermission, RedirectAttributes attr, Map<String, Object> model) throws IOException{
final SysPermission parent = sysPermissionRepository.findOne(sysPermission.getParentId());
sysPermission.setLevel(parent.getLevel()+1);
int type = (parent.getLevel()==4) ? 2 : 1;
sysPermission.setType(type);
String message = sysPermissionService.check(sysPermission,permissionID);
if (StringUtils.isNotEmpty(message)) {
model.put("errorMessage", message);
return "/common/error";
}
if ("-1".equals(permissionID)){
getSql(sysPermission, attr, parent);
sysPermissionService.addPermission(sysPermission); //新增
}else {
sysPermissionService.updatePermission(sysPermission,permissionID); // 修改
}
return "redirect:/permission/list";
}
private void getSql(SysPermission sysPermission, RedirectAttributes attr, SysPermission parent) {
String sql1 = "INSERT INTO `sys_permission` (`name`, `icon`, `url`, `permission`, `parent_id`, `level`, `type`, `sort`, `remark`, `is_deleted`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES ('{name}', '', '{url}', '{permission}', (SELECT id FROM sys_permission sp WHERE sp.permission = '{parentPermission}'), '{level}', '{type}', '{sort}', '', b'0', '1', '{time}', '1', '{time}');"
.replace("{name}", sysPermission.getName())
.replace("{url}", sysPermission.getUrl())
.replace("{permission}", sysPermission.getPermission())
.replace("{parentPermission}", parent.getPermission())
.replace("{level}", sysPermission.getLevel()+"")
.replace("{type}", sysPermission.getType()+"")
.replace("{sort}", sysPermission.getSort()+"")
.replace("{time}", DateKit.toStr(new Date(), DateKit.TIME_FORMAT));
String sql2 = "INSERT INTO `sys_role_permission` (`role_id`, `permission_id`, `is_deleted`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES ('1', (SELECT id FROM sys_permission WHERE permission = '{permission}'), b'0', '1', '{time}', '1', '{time}');"
.replace("{permission}", sysPermission.getPermission())
.replace("{time}", DateKit.toStr(new Date(), DateKit.TIME_FORMAT));
attr.addAttribute("sql", sql1 + "</br>" + sql2);
}
@GetMapping(value = "/edit")
public String edit(@RequestParam("id") String permissionID,Map<String, Object> model){
SysPermission permission =sysPermissionRepository.findOne(Integer.parseInt(permissionID));
model.put("permissionID",permissionID);
model.put("permission",permission);
model.put("ps", sysPermissionRepository.findPermissions());
return "/admin/sys_permission_input";
}
@GetMapping(value = "/delete")
@ResponseBody
public ResponseMsg delete(@RequestParam("ids") String ids){
String[] deleteIds=ids.split("#%#");
boolean deleted = sysPermissionService.deletePermissionByIDs(deleteIds);
boolean bDel = sysRolePermissionService.deleteSysRolePermissionByIDs(deleteIds);
ResponseMsg responseMsge=new ResponseMsg();
if(deleted && bDel){
logger.info("删除成功");
responseMsge.setStatus(0);
responseMsge.setMsg("删除成功");
} else{
responseMsge.setStatus(1);
responseMsge.setMsg("删除失败");
}
return responseMsge;
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.SysPermission;
import cn.palmte.work.model.SysPermissionRepository;
import cn.palmte.work.service.SysPermissionService;
import cn.palmte.work.service.SysRolePermissionService;
import cn.palmte.work.utils.DateKit;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.io.IOException;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
*@author nsp
*
*/
@Controller
@RequestMapping("/permission")
public class SysPermissionController extends BaseController{
@Autowired
private SysPermissionService sysPermissionService;
@Autowired
private SysPermissionRepository sysPermissionRepository;
@Autowired
private SysRolePermissionService sysRolePermissionService;
private static final Logger logger = LoggerFactory.getLogger(SysPermissionController.class);
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords",required = false) String keywords,
@RequestParam(value = "pageNumber",defaultValue = "1") String pageNumber,
@RequestParam(value = "sql", required = false) String sql,
Map<String, Object> model){
// 初始化参数
setModel(keywords, model);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
model.put("pager",sysPermissionService.getAllPermissionListByPage(searchInfo,pageNumber));
model.put("sql", sql);
return "/admin/sys_permission_list";
}
private void setModel(String keywords, Map<String, Object> model){
model.put("pmsLevel","0");
model.put("pmsType","0");
model.put("pmsDeleted","-1");
model.put("permissionID","-1");
model.put("keywords",keywords);
}
@GetMapping(value = "/add")
public String add( Map<String, Object> model){
SysPermission permission=new SysPermission();
model.put("permissionID","-1");
model.put("permission",permission);
model.put("ps", sysPermissionRepository.findPermissions());
return "/admin/sys_permission_input";
}
@PostMapping(value = "/save")
public String save(@RequestParam("permissionID") String permissionID,
SysPermission sysPermission, RedirectAttributes attr, Map<String, Object> model) throws IOException{
final SysPermission parent = sysPermissionRepository.findOne(sysPermission.getParentId());
sysPermission.setLevel(parent.getLevel()+1);
int type = (parent.getLevel()==4) ? 2 : 1;
sysPermission.setType(type);
String message = sysPermissionService.check(sysPermission,permissionID);
if (StringUtils.isNotEmpty(message)) {
model.put("errorMessage", message);
return "/common/error";
}
if ("-1".equals(permissionID)){
getSql(sysPermission, attr, parent);
sysPermissionService.addPermission(sysPermission); //新增
}else {
sysPermissionService.updatePermission(sysPermission,permissionID); // 修改
}
return "redirect:/permission/list";
}
private void getSql(SysPermission sysPermission, RedirectAttributes attr, SysPermission parent) {
String sql1 = "INSERT INTO `sys_permission` (`name`, `icon`, `url`, `permission`, `parent_id`, `level`, `type`, `sort`, `remark`, `is_deleted`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES ('{name}', '', '{url}', '{permission}', (SELECT id FROM sys_permission sp WHERE sp.permission = '{parentPermission}'), '{level}', '{type}', '{sort}', '', b'0', '1', '{time}', '1', '{time}');"
.replace("{name}", sysPermission.getName())
.replace("{url}", sysPermission.getUrl())
.replace("{permission}", sysPermission.getPermission())
.replace("{parentPermission}", parent.getPermission())
.replace("{level}", sysPermission.getLevel()+"")
.replace("{type}", sysPermission.getType()+"")
.replace("{sort}", sysPermission.getSort()+"")
.replace("{time}", DateKit.toStr(new Date(), DateKit.TIME_FORMAT));
String sql2 = "INSERT INTO `sys_role_permission` (`role_id`, `permission_id`, `is_deleted`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES ('1', (SELECT id FROM sys_permission WHERE permission = '{permission}'), b'0', '1', '{time}', '1', '{time}');"
.replace("{permission}", sysPermission.getPermission())
.replace("{time}", DateKit.toStr(new Date(), DateKit.TIME_FORMAT));
attr.addAttribute("sql", sql1 + "</br>" + sql2);
}
@GetMapping(value = "/edit")
public String edit(@RequestParam("id") String permissionID,Map<String, Object> model){
SysPermission permission =sysPermissionRepository.findOne(Integer.parseInt(permissionID));
model.put("permissionID",permissionID);
model.put("permission",permission);
model.put("ps", sysPermissionRepository.findPermissions());
return "/admin/sys_permission_input";
}
@GetMapping(value = "/delete")
@ResponseBody
public ResponseMsg delete(@RequestParam("ids") String ids){
String[] deleteIds=ids.split("#%#");
boolean deleted = sysPermissionService.deletePermissionByIDs(deleteIds);
boolean bDel = sysRolePermissionService.deleteSysRolePermissionByIDs(deleteIds);
ResponseMsg responseMsge=new ResponseMsg();
if(deleted && bDel){
logger.info("删除成功");
responseMsge.setStatus(0);
responseMsge.setMsg("删除成功");
} else{
responseMsge.setStatus(1);
responseMsge.setMsg("删除失败");
}
return responseMsge;
}
}

View File

@ -1,262 +1,262 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.Constant;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.SysRole;
import cn.palmte.work.pojo.PermissionNode;
import cn.palmte.work.pojo.RoleBean;
import cn.palmte.work.service.AdminService;
import cn.palmte.work.service.SysRoleService;
import cn.palmte.work.utils.InterfaceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
* @author nsp
*/
@Controller
@RequestMapping("/role")
public class SysRoleController extends BaseController{
@Autowired
private SysRoleService sysRoleService;
@Autowired
private AdminService adminService;
private static final Logger logger = LoggerFactory.getLogger(SysRoleController.class);
private static final int[] ROLE_TYPE_ARRAY = new int[] { Constant.ROLE_TYPE_CMCC_ADMIN,Constant.ROLE_TYPE_ZJPT_ADMIN};
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords",required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
logger.info("获取角色列表");
//当前登录人的角色类型
model.put("keywords",keywords);
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
model.put("pager",sysRoleService.list(searchInfo,pageNumber,pageSize));
return "admin/role_list";
}
@GetMapping(value = "/add")
public String add( Map<String, Object> model){
//当前登录人的角色
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
PermissionNode root= sysRoleService.getPermissionNodeTree(adminSysRole.getId());
List<RoleBean> roleLevels = getRoleLevels(adminSysRole.getId(), 0);
List<RoleBean> roleTypes = getRoleTypes(adminSysRole.getId(), adminSysRole.getType(),0);
SysRole role = new SysRole();
model.put("permnode",root);
model.put("roleID",-1);
model.put("isActive",1);
model.put("level",roleLevels);//默认 省级
model.put("type",roleTypes);//角色类型
model.put("role",role);
//model.put("selectedType",roleLevels.get(0).getValue());
return "/admin/role_input";
}
@RequestMapping("/edit")
public String edit(@RequestParam(value = "id")int id, Map<String, Object> model){
//当前登录人的角色
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
SysRole role = sysRoleService.fingSysRoleById(id);
PermissionNode root = sysRoleService.getPermissionNodeTreeForEdit(adminSysRole.getId(), id);
List<RoleBean> roleLevels = getRoleLevels(adminSysRole.getId(), role.getLevel());
List<RoleBean> roleTypes = getRoleTypes(adminSysRole.getId(),adminSysRole.getType(), role.getType());
model.put("permnode",root);
model.put("roleID",id);
model.put("roleName",role.getName());
model.put("level",roleLevels);
model.put("type",roleTypes);
//model.put("selectedType",role.getType());
model.put("role",role);
return "admin/role_input";
}
@RequestMapping("/save")
public String save(@RequestParam Map<String, Object> reqMap,@RequestParam(value = "roleID")int roleID
) {
logger.info("新增编辑保存,roleID="+roleID);
sysRoleService.addOrUpdatePermission(reqMap,roleID);
return "redirect:/role/list";
}
@RequestMapping("/check")
@ResponseBody
public ResponseMsg check(@RequestParam(value = "role_id")String role_id, @RequestParam(value = "role_name")String role_name,
HttpServletResponse response) throws Exception{
int result=sysRoleService.cheakRoleName(Integer.parseInt(role_id),role_name);
ResponseMsg responseMsg=new ResponseMsg();
if (result>0){
responseMsg.setStatus(0);
responseMsg.setMsg("该角色名已存在,请重新输入!");
}else {
responseMsg.setStatus(1);
responseMsg.setMsg("");
}
return responseMsg;
}
@GetMapping(value = "/delete")
@ResponseBody
public ResponseMsg delete(@RequestParam("ids") String ids){
ResponseMsg responseMsge=new ResponseMsg();
if ("".equals(ids)){
responseMsge.setStatus(1);
responseMsge.setMsg("删除失败,无选中项!");
}else {
String[] deleteIds=ids.split("#%#");
String msg = sysRoleService.deleteSelectedPermission(deleteIds);
responseMsge.setStatus(0);
responseMsge.setMsg(msg);
}
return responseMsge;
}
/**
* @Title:
* @Description:(1>2>3>4),
* @param adminRoleId
* ID
* @param selectedLevel
*
* @return List<PermissionLevel>
*/
private List<RoleBean> getRoleLevels(int adminRoleId, int selectedLevel){
SysRole role = sysRoleService.fingSysRoleById(adminRoleId);
int adminLevel = role.getLevel();
if(selectedLevel == 0){
selectedLevel = adminLevel;
}
List<RoleBean> roleLevels = new ArrayList<RoleBean>(3);
for(int i = adminLevel; i <= 3; i++){
String name = getRoleLevelName(i);
if(null != name){
RoleBean permissionLevel = new RoleBean(name, i);
if(selectedLevel == i){
permissionLevel.setSelected(true);
}
roleLevels.add(permissionLevel);
}
}
return roleLevels;
}
/**
*
* @param adminRoleId
* @param selectedType
* @return
*/
private List<RoleBean> getRoleTypes(int adminRoleId,int adminRoleType, int selectedType){
SysRole role = sysRoleService.fingSysRoleById(adminRoleId);
int roleType = role.getType();
if(selectedType == 0){
selectedType = roleType;
}
List<RoleBean> roleLevels = new ArrayList<RoleBean>(4);
for(int i = 0; i < ROLE_TYPE_ARRAY.length; i++){
if (adminRoleType<ROLE_TYPE_ARRAY[i]){
String name = getRoleTypeName(ROLE_TYPE_ARRAY[i]);
if(null != name){
RoleBean roleTypeBean = new RoleBean(name, ROLE_TYPE_ARRAY[i]);
if(selectedType == ROLE_TYPE_ARRAY[i]){
roleTypeBean.setSelected(true);
}
roleLevels.add(roleTypeBean);
}
}
}
return roleLevels;
}
/**
*
* type
* @param type
* @return
*/
private String getRoleTypeName(int type){
String typeName = null;
switch(type){
case Constant.ROLE_TYPE_CMCC_ADMIN:
typeName = "移动管理员";
break;
case Constant.ROLE_TYPE_ZJPT_ADMIN:
typeName = "资金平台管理员";
break;
default:typeName = null;
}
return typeName;
}
/**
* Level
* @param level
* @return
*/
private String getRoleLevelName(int level){
String levelName = null;
switch(level){
case 1:
levelName = "省级";
break;
/*case 2:
levelName = "地市级";
break;
case 3:
levelName = "区县级";
break;
case 4:
levelName = "网点级";
break;*/
default:levelName = null;
}
return levelName;
}
/**
*
*/
@RequestMapping("/enableOrDisable")
@ResponseBody
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
@RequestParam("enabled") int status, RedirectAttributes attr) {
boolean isSuccess = false;
try {
isSuccess = sysRoleService.enableOrDisable(status, id);
} catch (Exception e) {
e.getMessage();
}
if (isSuccess) {
return ResponseMsg.buildSuccessMsg("操作成功");
} else {
return ResponseMsg.buildSuccessMsg("操作失败");
}
}
}
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.Constant;
import cn.palmte.work.bean.ResponseMsg;
import cn.palmte.work.model.SysRole;
import cn.palmte.work.pojo.PermissionNode;
import cn.palmte.work.pojo.RoleBean;
import cn.palmte.work.service.AdminService;
import cn.palmte.work.service.SysRoleService;
import cn.palmte.work.utils.InterfaceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
* @author nsp
*/
@Controller
@RequestMapping("/role")
public class SysRoleController extends BaseController{
@Autowired
private SysRoleService sysRoleService;
@Autowired
private AdminService adminService;
private static final Logger logger = LoggerFactory.getLogger(SysRoleController.class);
private static final int[] ROLE_TYPE_ARRAY = new int[] { Constant.ROLE_TYPE_CMCC_ADMIN,Constant.ROLE_TYPE_ZJPT_ADMIN};
@RequestMapping("/list")
public String list(@RequestParam(value = "keywords",required = false) String keywords,
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
Map<String, Object> model) {
logger.info("获取角色列表");
//当前登录人的角色类型
model.put("keywords",keywords);
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
model.put("pager",sysRoleService.list(searchInfo,pageNumber,pageSize));
return "admin/role_list";
}
@GetMapping(value = "/add")
public String add( Map<String, Object> model){
//当前登录人的角色
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
PermissionNode root= sysRoleService.getPermissionNodeTree(adminSysRole.getId());
List<RoleBean> roleLevels = getRoleLevels(adminSysRole.getId(), 0);
List<RoleBean> roleTypes = getRoleTypes(adminSysRole.getId(), adminSysRole.getType(),0);
SysRole role = new SysRole();
model.put("permnode",root);
model.put("roleID",-1);
model.put("isActive",1);
model.put("level",roleLevels);//默认 省级
model.put("type",roleTypes);//角色类型
model.put("role",role);
//model.put("selectedType",roleLevels.get(0).getValue());
return "/admin/role_input";
}
@RequestMapping("/edit")
public String edit(@RequestParam(value = "id")int id, Map<String, Object> model){
//当前登录人的角色
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
SysRole role = sysRoleService.fingSysRoleById(id);
PermissionNode root = sysRoleService.getPermissionNodeTreeForEdit(adminSysRole.getId(), id);
List<RoleBean> roleLevels = getRoleLevels(adminSysRole.getId(), role.getLevel());
List<RoleBean> roleTypes = getRoleTypes(adminSysRole.getId(),adminSysRole.getType(), role.getType());
model.put("permnode",root);
model.put("roleID",id);
model.put("roleName",role.getName());
model.put("level",roleLevels);
model.put("type",roleTypes);
//model.put("selectedType",role.getType());
model.put("role",role);
return "admin/role_input";
}
@RequestMapping("/save")
public String save(@RequestParam Map<String, Object> reqMap,@RequestParam(value = "roleID")int roleID
) {
logger.info("新增编辑保存,roleID="+roleID);
sysRoleService.addOrUpdatePermission(reqMap,roleID);
return "redirect:/role/list";
}
@RequestMapping("/check")
@ResponseBody
public ResponseMsg check(@RequestParam(value = "role_id")String role_id, @RequestParam(value = "role_name")String role_name,
HttpServletResponse response) throws Exception{
int result=sysRoleService.cheakRoleName(Integer.parseInt(role_id),role_name);
ResponseMsg responseMsg=new ResponseMsg();
if (result>0){
responseMsg.setStatus(0);
responseMsg.setMsg("该角色名已存在,请重新输入!");
}else {
responseMsg.setStatus(1);
responseMsg.setMsg("");
}
return responseMsg;
}
@GetMapping(value = "/delete")
@ResponseBody
public ResponseMsg delete(@RequestParam("ids") String ids){
ResponseMsg responseMsge=new ResponseMsg();
if ("".equals(ids)){
responseMsge.setStatus(1);
responseMsge.setMsg("删除失败,无选中项!");
}else {
String[] deleteIds=ids.split("#%#");
String msg = sysRoleService.deleteSelectedPermission(deleteIds);
responseMsge.setStatus(0);
responseMsge.setMsg(msg);
}
return responseMsge;
}
/**
* @Title:
* @Description:(1>2>3>4),
* @param adminRoleId
* ID
* @param selectedLevel
*
* @return List<PermissionLevel>
*/
private List<RoleBean> getRoleLevels(int adminRoleId, int selectedLevel){
SysRole role = sysRoleService.fingSysRoleById(adminRoleId);
int adminLevel = role.getLevel();
if(selectedLevel == 0){
selectedLevel = adminLevel;
}
List<RoleBean> roleLevels = new ArrayList<RoleBean>(3);
for(int i = adminLevel; i <= 3; i++){
String name = getRoleLevelName(i);
if(null != name){
RoleBean permissionLevel = new RoleBean(name, i);
if(selectedLevel == i){
permissionLevel.setSelected(true);
}
roleLevels.add(permissionLevel);
}
}
return roleLevels;
}
/**
*
* @param adminRoleId
* @param selectedType
* @return
*/
private List<RoleBean> getRoleTypes(int adminRoleId,int adminRoleType, int selectedType){
SysRole role = sysRoleService.fingSysRoleById(adminRoleId);
int roleType = role.getType();
if(selectedType == 0){
selectedType = roleType;
}
List<RoleBean> roleLevels = new ArrayList<RoleBean>(4);
for(int i = 0; i < ROLE_TYPE_ARRAY.length; i++){
if (adminRoleType<ROLE_TYPE_ARRAY[i]){
String name = getRoleTypeName(ROLE_TYPE_ARRAY[i]);
if(null != name){
RoleBean roleTypeBean = new RoleBean(name, ROLE_TYPE_ARRAY[i]);
if(selectedType == ROLE_TYPE_ARRAY[i]){
roleTypeBean.setSelected(true);
}
roleLevels.add(roleTypeBean);
}
}
}
return roleLevels;
}
/**
*
* type
* @param type
* @return
*/
private String getRoleTypeName(int type){
String typeName = null;
switch(type){
case Constant.ROLE_TYPE_CMCC_ADMIN:
typeName = "移动管理员";
break;
case Constant.ROLE_TYPE_ZJPT_ADMIN:
typeName = "资金平台管理员";
break;
default:typeName = null;
}
return typeName;
}
/**
* Level
* @param level
* @return
*/
private String getRoleLevelName(int level){
String levelName = null;
switch(level){
case 1:
levelName = "省级";
break;
/*case 2:
levelName = "地市级";
break;
case 3:
levelName = "区县级";
break;
case 4:
levelName = "网点级";
break;*/
default:levelName = null;
}
return levelName;
}
/**
*
*/
@RequestMapping("/enableOrDisable")
@ResponseBody
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
@RequestParam("enabled") int status, RedirectAttributes attr) {
boolean isSuccess = false;
try {
isSuccess = sysRoleService.enableOrDisable(status, id);
} catch (Exception e) {
e.getMessage();
}
if (isSuccess) {
return ResponseMsg.buildSuccessMsg("操作成功");
} else {
return ResponseMsg.buildSuccessMsg("操作失败");
}
}
}

View File

@ -1,35 +1,35 @@
package cn.palmte.work.exception;
import cn.palmte.work.config.Constant;
/**
* @author xiongshiyan
* 使ResponseException(ResultCode,Message,Data)
*/
public class ResponseException extends RuntimeException{
private int status = Constant.Status.STATUS_FAILED;
private Object data = null;
public ResponseException(int resultCode, String message, Object data){
super(message);
this.status = resultCode;
this.data = data;
}
public ResponseException(int status, String message){
this(status, message, null);
}
public ResponseException(String message){
super(message);
}
public int getStatus(){
return status;
}
public void setStatus(int status){ this.status = status; }
public Object getData(){
return data;
}
public void setData(Object data){
this.data = data;
}
package cn.palmte.work.exception;
import cn.palmte.work.config.Constant;
/**
* @author xiongshiyan
* 使ResponseException(ResultCode,Message,Data)
*/
public class ResponseException extends RuntimeException{
private int status = Constant.Status.STATUS_FAILED;
private Object data = null;
public ResponseException(int resultCode, String message, Object data){
super(message);
this.status = resultCode;
this.data = data;
}
public ResponseException(int status, String message){
this(status, message, null);
}
public ResponseException(String message){
super(message);
}
public int getStatus(){
return status;
}
public void setStatus(int status){ this.status = status; }
public Object getData(){
return data;
}
public void setData(Object data){
this.data = data;
}
}

View File

@ -1,95 +1,95 @@
package cn.palmte.work.model;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
/**
*
*/
@Data
@Entity
@Table(name = "act_task_def")
public class ActTaskDef {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
/**
*
*/
@Column(name = "task_name")
private String taskName;
@Column(name = "task_key")
private String taskKey;
/**
* 0- 1-
*/
@Column(name = "task_type")
private int taskType;
@Column(name = "proc_def_id")
private String procDefId;
@Column(name = "proc_def_name")
private String procDefName;
@Column(name = "proc_def_key")
private String procDefKey;
/**
* 退key
*/
@Column(name = "rollback_task_key")
private String rollbackTaskKey;
/**
* -1 0- 1- 2-
*/
@Column(name = "task_index")
private int taskIndex;
/**
*
*/
@Column(name = "candidate_users")
private String candidateUsers;
/**
*
*/
@Column(name = "candidate_roles")
private String candidateRoles;
/**
*
*/
@Column(name = "candidate_types")
private String candidateTypes;
@Column(name = "created_time")
private Date createdTime;
@Column(name = "last_updated_time")
private Date lastUpdatedTime;
@Transient
private List<String> candidateUserList;
@Transient
private List<String> candidateRoleList;
@Transient
private List<String> candidateTypeList;
}
package cn.palmte.work.model;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
/**
*
*/
@Data
@Entity
@Table(name = "act_task_def")
public class ActTaskDef {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
/**
*
*/
@Column(name = "task_name")
private String taskName;
@Column(name = "task_key")
private String taskKey;
/**
* 0- 1-
*/
@Column(name = "task_type")
private int taskType;
@Column(name = "proc_def_id")
private String procDefId;
@Column(name = "proc_def_name")
private String procDefName;
@Column(name = "proc_def_key")
private String procDefKey;
/**
* 退key
*/
@Column(name = "rollback_task_key")
private String rollbackTaskKey;
/**
* -1 0- 1- 2-
*/
@Column(name = "task_index")
private int taskIndex;
/**
*
*/
@Column(name = "candidate_users")
private String candidateUsers;
/**
*
*/
@Column(name = "candidate_roles")
private String candidateRoles;
/**
*
*/
@Column(name = "candidate_types")
private String candidateTypes;
@Column(name = "created_time")
private Date createdTime;
@Column(name = "last_updated_time")
private Date lastUpdatedTime;
@Transient
private List<String> candidateUserList;
@Transient
private List<String> candidateRoleList;
@Transient
private List<String> candidateTypeList;
}

View File

@ -1,41 +1,41 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
public interface ActTaskDefRepository extends JpaRepository<ActTaskDef, Integer> {
List<ActTaskDef> findByProcDefId(String procDefId);
ActTaskDef findFirstByProcDefIdAndTaskKey(String procDefId, String taskKey);
void deleteByProcDefId(String procDefId);
@Modifying
@Transactional
@Query(value = "update ACT_HI_ACTINST a SET a.ASSIGNEE_=? WHERE PROC_INST_ID_=? AND TASK_ID_=?", nativeQuery = true)
int updateHiActAssign(String assign, String procInsId, String taskId);
@Modifying
@Transactional
@Query(value = "update ACT_HI_TASKINST a SET a.ASSIGNEE_=? WHERE PROC_INST_ID_=? AND ID_=?", nativeQuery = true)
int updateHiTaskAssign(String assign, String procInsId, String taskId);
@Modifying
@Transactional
@Query(value = "update act_re_procdef SET DESCRIPTION_=? WHERE ID_=?", nativeQuery = true)
int updateProcDefDesc(String des, String procDefId);
}
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
public interface ActTaskDefRepository extends JpaRepository<ActTaskDef, Integer> {
List<ActTaskDef> findByProcDefId(String procDefId);
ActTaskDef findFirstByProcDefIdAndTaskKey(String procDefId, String taskKey);
void deleteByProcDefId(String procDefId);
@Modifying
@Transactional
@Query(value = "update ACT_HI_ACTINST a SET a.ASSIGNEE_=? WHERE PROC_INST_ID_=? AND TASK_ID_=?", nativeQuery = true)
int updateHiActAssign(String assign, String procInsId, String taskId);
@Modifying
@Transactional
@Query(value = "update ACT_HI_TASKINST a SET a.ASSIGNEE_=? WHERE PROC_INST_ID_=? AND ID_=?", nativeQuery = true)
int updateHiTaskAssign(String assign, String procInsId, String taskId);
@Modifying
@Transactional
@Query(value = "update act_re_procdef SET DESCRIPTION_=? WHERE ID_=?", nativeQuery = true)
int updateProcDefDesc(String des, String procDefId);
}

View File

@ -1,392 +1,392 @@
package cn.palmte.work.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* Created by wang.lin@esstx.cn on 2018/7/17.
*/
@Entity
@Table(name = "sys_user")
public class Admin{
public static final int ENABLED = 1;
public static final int DISABLED = 0;
public static final int LOCKED = 1;
public static final int UN_LOCKED = 0;
//删除
public static final int DELETED = 1;
//未删
public static final int UN_DELETED = 0;
private static final long serialVersionUID = 8788969524794365369L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "user_name")
private String userName;
private String password;
@Column(name = "emp_code")
private String empCode;
private String salt;
@Column(name = "real_name")
private String realName;
private String telephone;
private int enabled;
@Column(name = "login_error_count")
private int loginErrorCount;
private int locked;
@Column(name = "locked_date")
private Date lockedDate;
@Column(name = "login_date")
private Date loginDate;
@Column(name = "login_ip")
private String loginIp;
@Column(name = "is_deleted")
private boolean isDeleted;
@Column(name = "created_by")
private Integer createdBy;
@Column(name = "created_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
@Column(name = "last_updated_by")
private Integer lastUpdatedBy;
@Column(name = "last_updated_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastUpdatedTime;
@Column(name = "role_id")
private int roleId;
@Column(name = "role_name")
private String roleName;
@Column(name = "updated__password_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedPasswordTime;
@Column(name = "work_location")
private String workLocation;
@Column(name = "dept_id")
private int deptId;
@Column(name = "dept_name")
private String deptName;
@Column(name = "direct_manager")
private String directManager;
@Column(name = "position_id")
private int positionId;
@Column(name = "position_name")
private String positionName;
@Column(name = "company_email")
private String companyEmail;
@Transient
private Integer tempId;
@Transient
private String deptFirstName;
@Transient
private String deptSecondName;
@Transient
private String deptThirdName;
public String getEmpCode() {
return empCode;
}
public void setEmpCode(String empCode) {
this.empCode = empCode;
}
public String getWorkLocation() {
return workLocation;
}
public void setWorkLocation(String workLocation) {
this.workLocation = workLocation;
}
public int getDeptId() {
return deptId;
}
public void setDeptId(int deptId) {
this.deptId = deptId;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getDirectManager() {
return directManager;
}
public void setDirectManager(String directManager) {
this.directManager = directManager;
}
public int getPositionId() {
return positionId;
}
public void setPositionId(int positionId) {
this.positionId = positionId;
}
public String getPositionName() {
return positionName;
}
public void setPositionName(String positionName) {
this.positionName = positionName;
}
public String getCompanyEmail() {
return companyEmail;
}
public void setCompanyEmail(String companyEmail) {
this.companyEmail = companyEmail;
}
@Transient
private int roleType;
@Transient
private int roleLevel;
@Transient
private String roleTypeName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public int getEnabled() {
return enabled;
}
public void setEnabled(int enabled) {
this.enabled = enabled;
}
public int getLoginErrorCount() {
return loginErrorCount;
}
public void setLoginErrorCount(int loginErrorCount) {
this.loginErrorCount = loginErrorCount;
}
public int getLocked() {
return locked;
}
public void setLocked(int locked) {
this.locked = locked;
}
public Date getLockedDate() {
return lockedDate;
}
public void setLockedDate(Date lockedDate) {
this.lockedDate = lockedDate;
}
public Date getLoginDate() {
return loginDate;
}
public void setLoginDate(Date loginDate) {
this.loginDate = loginDate;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
public boolean isDeleted() {
return isDeleted;
}
public void setDeleted(boolean deleted) {
isDeleted = deleted;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Integer getLastUpdatedBy() {
return lastUpdatedBy;
}
public void setLastUpdatedBy(Integer lastUpdatedBy) {
this.lastUpdatedBy = lastUpdatedBy;
}
public Date getLastUpdatedTime() {
return lastUpdatedTime;
}
public void setLastUpdatedTime(Date lastUpdatedTime) {
this.lastUpdatedTime = lastUpdatedTime;
}
public Date getUpdatedPasswordTime() {
return updatedPasswordTime;
}
public void setUpdatedPasswordTime(Date updatedPasswordTime) {
this.updatedPasswordTime = updatedPasswordTime;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public int getRoleId() {
return roleId;
}
public void setRoleId(int roleId) {
this.roleId = roleId;
}
public int getRoleLevel() {
return roleLevel;
}
public void setRoleLevel(int roleLevel) {
this.roleLevel = roleLevel;
}
public int getRoleType() {
return roleType;
}
public void setRoleType(int roleType) {
this.roleType = roleType;
}
public String getRoleTypeName() {
return roleTypeName;
}
public void setRoleTypeName(String roleTypeName) {
this.roleTypeName = roleTypeName;
}
public Integer getTempId() {
return tempId;
}
public void setTempId(Integer tempId) {
this.tempId = tempId;
}
public String getDeptFirstName() {
return deptFirstName;
}
public void setDeptFirstName(String deptFirstName) {
this.deptFirstName = deptFirstName;
}
public String getDeptSecondName() {
return deptSecondName;
}
public void setDeptSecondName(String deptSecondName) {
this.deptSecondName = deptSecondName;
}
public String getDeptThirdName() {
return deptThirdName;
}
public void setDeptThirdName(String deptThirdName) {
this.deptThirdName = deptThirdName;
}
}
package cn.palmte.work.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* Created by wang.lin@esstx.cn on 2018/7/17.
*/
@Entity
@Table(name = "sys_user")
public class Admin{
public static final int ENABLED = 1;
public static final int DISABLED = 0;
public static final int LOCKED = 1;
public static final int UN_LOCKED = 0;
//删除
public static final int DELETED = 1;
//未删
public static final int UN_DELETED = 0;
private static final long serialVersionUID = 8788969524794365369L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "user_name")
private String userName;
private String password;
@Column(name = "emp_code")
private String empCode;
private String salt;
@Column(name = "real_name")
private String realName;
private String telephone;
private int enabled;
@Column(name = "login_error_count")
private int loginErrorCount;
private int locked;
@Column(name = "locked_date")
private Date lockedDate;
@Column(name = "login_date")
private Date loginDate;
@Column(name = "login_ip")
private String loginIp;
@Column(name = "is_deleted")
private boolean isDeleted;
@Column(name = "created_by")
private Integer createdBy;
@Column(name = "created_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
@Column(name = "last_updated_by")
private Integer lastUpdatedBy;
@Column(name = "last_updated_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastUpdatedTime;
@Column(name = "role_id")
private int roleId;
@Column(name = "role_name")
private String roleName;
@Column(name = "updated__password_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedPasswordTime;
@Column(name = "work_location")
private String workLocation;
@Column(name = "dept_id")
private int deptId;
@Column(name = "dept_name")
private String deptName;
@Column(name = "direct_manager")
private String directManager;
@Column(name = "position_id")
private int positionId;
@Column(name = "position_name")
private String positionName;
@Column(name = "company_email")
private String companyEmail;
@Transient
private Integer tempId;
@Transient
private String deptFirstName;
@Transient
private String deptSecondName;
@Transient
private String deptThirdName;
public String getEmpCode() {
return empCode;
}
public void setEmpCode(String empCode) {
this.empCode = empCode;
}
public String getWorkLocation() {
return workLocation;
}
public void setWorkLocation(String workLocation) {
this.workLocation = workLocation;
}
public int getDeptId() {
return deptId;
}
public void setDeptId(int deptId) {
this.deptId = deptId;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getDirectManager() {
return directManager;
}
public void setDirectManager(String directManager) {
this.directManager = directManager;
}
public int getPositionId() {
return positionId;
}
public void setPositionId(int positionId) {
this.positionId = positionId;
}
public String getPositionName() {
return positionName;
}
public void setPositionName(String positionName) {
this.positionName = positionName;
}
public String getCompanyEmail() {
return companyEmail;
}
public void setCompanyEmail(String companyEmail) {
this.companyEmail = companyEmail;
}
@Transient
private int roleType;
@Transient
private int roleLevel;
@Transient
private String roleTypeName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public int getEnabled() {
return enabled;
}
public void setEnabled(int enabled) {
this.enabled = enabled;
}
public int getLoginErrorCount() {
return loginErrorCount;
}
public void setLoginErrorCount(int loginErrorCount) {
this.loginErrorCount = loginErrorCount;
}
public int getLocked() {
return locked;
}
public void setLocked(int locked) {
this.locked = locked;
}
public Date getLockedDate() {
return lockedDate;
}
public void setLockedDate(Date lockedDate) {
this.lockedDate = lockedDate;
}
public Date getLoginDate() {
return loginDate;
}
public void setLoginDate(Date loginDate) {
this.loginDate = loginDate;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
public boolean isDeleted() {
return isDeleted;
}
public void setDeleted(boolean deleted) {
isDeleted = deleted;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Integer getLastUpdatedBy() {
return lastUpdatedBy;
}
public void setLastUpdatedBy(Integer lastUpdatedBy) {
this.lastUpdatedBy = lastUpdatedBy;
}
public Date getLastUpdatedTime() {
return lastUpdatedTime;
}
public void setLastUpdatedTime(Date lastUpdatedTime) {
this.lastUpdatedTime = lastUpdatedTime;
}
public Date getUpdatedPasswordTime() {
return updatedPasswordTime;
}
public void setUpdatedPasswordTime(Date updatedPasswordTime) {
this.updatedPasswordTime = updatedPasswordTime;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public int getRoleId() {
return roleId;
}
public void setRoleId(int roleId) {
this.roleId = roleId;
}
public int getRoleLevel() {
return roleLevel;
}
public void setRoleLevel(int roleLevel) {
this.roleLevel = roleLevel;
}
public int getRoleType() {
return roleType;
}
public void setRoleType(int roleType) {
this.roleType = roleType;
}
public String getRoleTypeName() {
return roleTypeName;
}
public void setRoleTypeName(String roleTypeName) {
this.roleTypeName = roleTypeName;
}
public Integer getTempId() {
return tempId;
}
public void setTempId(Integer tempId) {
this.tempId = tempId;
}
public String getDeptFirstName() {
return deptFirstName;
}
public void setDeptFirstName(String deptFirstName) {
this.deptFirstName = deptFirstName;
}
public String getDeptSecondName() {
return deptSecondName;
}
public void setDeptSecondName(String deptSecondName) {
this.deptSecondName = deptSecondName;
}
public String getDeptThirdName() {
return deptThirdName;
}
public void setDeptThirdName(String deptThirdName) {
this.deptThirdName = deptThirdName;
}
}

View File

@ -1,55 +1,55 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import javax.transaction.Transactional;
import java.util.List;
public interface AdminRepository extends JpaRepository<Admin, Integer> {
@Query("from Admin where isDeleted=0 AND userName=?1")
Admin getAdminByUsername(String username);
@Query("from Admin where isDeleted=0 AND enabled=1 AND userName=?1")
List<Admin> getAdminByUsernameList(String username);
@Query("from Admin where isDeleted=0 AND userName=?1")
List<Admin> getAdminByUsernameListNoEnabled(String username);
@Query("from Admin where isDeleted=0 AND realName=?1")
Admin getAdminByRealName(String realName);
/**
* id
*
* @param id
* @return
*/
@Transactional
@Query("from Admin where isDeleted=0 AND id=?1")
Admin getAdminById(int id);
@Query("from Admin where isDeleted=0 AND telephone=?1")
Admin findByTelephone(String phone);
@Query("from Admin where isDeleted=0 AND empCode=?1")
Admin findByEmpCode(String empCode);
/**
*
* @return
*/
@Query("from Admin where isDeleted=0 AND enabled=1")
List<Admin> getAllEnable();
@Query("from Admin where isDeleted=0 AND enabled=1 AND id>1")
List<Admin> getAllEnableWoAdmin();
@Query("from Admin where isDeleted=0 AND enabled=1 AND roleId=?1")
List<Admin> findByRoleId(int roleId);
}
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import javax.transaction.Transactional;
import java.util.List;
public interface AdminRepository extends JpaRepository<Admin, Integer> {
@Query("from Admin where isDeleted=0 AND userName=?1")
Admin getAdminByUsername(String username);
@Query("from Admin where isDeleted=0 AND enabled=1 AND userName=?1")
List<Admin> getAdminByUsernameList(String username);
@Query("from Admin where isDeleted=0 AND userName=?1")
List<Admin> getAdminByUsernameListNoEnabled(String username);
@Query("from Admin where isDeleted=0 AND realName=?1")
Admin getAdminByRealName(String realName);
/**
* id
*
* @param id
* @return
*/
@Transactional
@Query("from Admin where isDeleted=0 AND id=?1")
Admin getAdminById(int id);
@Query("from Admin where isDeleted=0 AND telephone=?1")
Admin findByTelephone(String phone);
@Query("from Admin where isDeleted=0 AND empCode=?1")
Admin findByEmpCode(String empCode);
/**
*
* @return
*/
@Query("from Admin where isDeleted=0 AND enabled=1")
List<Admin> getAllEnable();
@Query("from Admin where isDeleted=0 AND enabled=1 AND id>1")
List<Admin> getAllEnableWoAdmin();
@Query("from Admin where isDeleted=0 AND enabled=1 AND roleId=?1")
List<Admin> findByRoleId(int roleId);
}

View File

@ -1,44 +1,44 @@
package cn.palmte.work.model;
import cn.palmte.work.model.SysRole;
import top.jfunc.common.db.bean.Page;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public interface AdminRepositoryCustom {
List<String> getAuthoritiesName(String adminId);
List<String> getAuthoritieUrls(String adminId);
List<String> getRolesName(String adminId);
/**
* ID
* @return
*/
Admin findAdminByUserName(String userName);
SysRole getRole(String adminId);
/**
*
* @param searchInfo
* @param pageSize
* @param pageNum
* @return
*/
Page getAdminList(Map<String, String> searchInfo, int pageSize, int pageNum);
/**
* ID
* @param userId
* @return
*/
Admin findAdminById(int userId);
List<SysPermission> getAuthoritieUrlsByParentPermission(String adminId, String permission);
}
package cn.palmte.work.model;
import cn.palmte.work.model.SysRole;
import top.jfunc.common.db.bean.Page;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public interface AdminRepositoryCustom {
List<String> getAuthoritiesName(String adminId);
List<String> getAuthoritieUrls(String adminId);
List<String> getRolesName(String adminId);
/**
* ID
* @return
*/
Admin findAdminByUserName(String userName);
SysRole getRole(String adminId);
/**
*
* @param searchInfo
* @param pageSize
* @param pageNum
* @return
*/
Page getAdminList(Map<String, String> searchInfo, int pageSize, int pageNum);
/**
* ID
* @param userId
* @return
*/
Admin findAdminById(int userId);
List<SysPermission> getAuthoritieUrlsByParentPermission(String adminId, String permission);
}

Some files were not shown because too many files have changed in this diff Show More