Compare commits
10 Commits
835407bcc8
...
4e495c3eff
| Author | SHA1 | Date |
|---|---|---|
|
|
4e495c3eff | |
|
|
01e4db1415 | |
|
|
600ad2a773 | |
|
|
e927912aed | |
|
|
9750722925 | |
|
|
25188514ac | |
|
|
4a95260a26 | |
|
|
19dbd05ad9 | |
|
|
1eadf7fd26 | |
|
|
3b36524aca |
|
|
@ -1,28 +1,28 @@
|
||||||
.gradle
|
.gradle
|
||||||
/build/
|
/build/
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
### STS ###
|
### STS ###
|
||||||
.apt_generated
|
.apt_generated
|
||||||
.classpath
|
.classpath
|
||||||
.factorypath
|
.factorypath
|
||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
.springBeans
|
.springBeans
|
||||||
.sts4-cache
|
.sts4-cache
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
### IntelliJ IDEA ###
|
||||||
.idea
|
.idea
|
||||||
/.idea/workspace.xml
|
/.idea/workspace.xml
|
||||||
*.iws
|
*.iws
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
/out/
|
/out/
|
||||||
|
|
||||||
### NetBeans ###
|
### NetBeans ###
|
||||||
/nbproject/private/
|
/nbproject/private/
|
||||||
/nbbuild/
|
/nbbuild/
|
||||||
/dist/
|
/dist/
|
||||||
/nbdist/
|
/nbdist/
|
||||||
/.nb-gradle/
|
/.nb-gradle/
|
||||||
/logs/
|
/logs/
|
||||||
|
|
|
||||||
208
build.gradle
208
build.gradle
|
|
@ -1,104 +1,104 @@
|
||||||
group 'cn.palmte'
|
group 'cn.palmte'
|
||||||
//version '1.0'
|
//version '1.0'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
springBootVersion = '1.5.7.RELEASE'
|
springBootVersion = '1.5.7.RELEASE'
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
|
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'war'
|
apply plugin: 'war'
|
||||||
apply plugin: 'application'
|
apply plugin: 'application'
|
||||||
apply plugin: 'org.springframework.boot'
|
apply plugin: 'org.springframework.boot'
|
||||||
apply plugin: 'findbugs'
|
apply plugin: 'findbugs'
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
jcenter()
|
||||||
maven { url "http://maven.aliyun.com/nexus/content/groups/public/"}
|
maven { url "http://maven.aliyun.com/nexus/content/groups/public/"}
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.hibernate:hibernate-java8:5.1.0.Final'
|
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-jsr310:2.8.10'
|
||||||
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8: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:${springBootVersion}"
|
||||||
compile 'org.springframework.boot:spring-boot-starter-web'
|
compile 'org.springframework.boot:spring-boot-starter-web'
|
||||||
compile 'org.springframework.boot:spring-boot-starter-freemarker'
|
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-jpa'
|
||||||
|
|
||||||
//compile('org.springframework.boot:spring-boot-starter-data-redis')
|
//compile('org.springframework.boot:spring-boot-starter-data-redis')
|
||||||
|
|
||||||
compile 'com.gitee.xxssyyyyssxx.unihttp:unihttp-jdk:v2.0.2'
|
compile 'com.gitee.xxssyyyyssxx.unihttp:unihttp-jdk:v2.0.2'
|
||||||
compile 'com.gitee.xxssyyyyssxx:common-crypto:v1.8.1'
|
compile 'com.gitee.xxssyyyyssxx:common-crypto:v1.8.1'
|
||||||
compile 'com.gitee.xxssyyyyssxx:common-db:v1.8.7'
|
compile 'com.gitee.xxssyyyyssxx:common-db:v1.8.7'
|
||||||
compile 'com.gitee.xxssyyyyssxx.json:json-fastjson:v1.8.8'
|
compile 'com.gitee.xxssyyyyssxx.json:json-fastjson:v1.8.8'
|
||||||
compile 'com.gitee.xxssyyyyssxx:token:v1.0'
|
compile 'com.gitee.xxssyyyyssxx:token:v1.0'
|
||||||
|
|
||||||
compile 'com.jfinal:jfinal:2.2'
|
compile 'com.jfinal:jfinal:2.2'
|
||||||
compile 'com.alibaba:druid:1.1.9'
|
compile 'com.alibaba:druid:1.1.9'
|
||||||
compile 'mysql:mysql-connector-java:6.0.6'
|
compile 'mysql:mysql-connector-java:6.0.6'
|
||||||
//compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
|
//compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
|
||||||
//shiro
|
//shiro
|
||||||
compile group: 'org.apache.shiro', name: 'shiro-spring', version: '1.4.0'
|
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: 'org.apache.shiro', name: 'shiro-core', version: '1.4.0'
|
||||||
compile group: 'net.mingsoft', name: 'shiro-freemarker-tags', version: '0.1'
|
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', version: '3.17'
|
||||||
compile group: 'org.apache.poi', name: 'poi-ooxml', 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-ooxml-schemas', version: '3.17'
|
||||||
compile group: 'org.apache.poi', name: 'poi-scratchpad', 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: 'commons-lang', name: 'commons-lang', version: '2.6'
|
||||||
|
|
||||||
|
|
||||||
compile group: 'org.projectlombok', name: 'lombok', version: '1.16.20'
|
compile group: 'org.projectlombok', name: 'lombok', version: '1.16.20'
|
||||||
|
|
||||||
/*activiti start*/
|
/*activiti start*/
|
||||||
compile group: 'org.activiti', name: 'activiti-spring-boot-starter-basic', version: '6.0.0'
|
compile group: 'org.activiti', name: 'activiti-spring-boot-starter-basic', version: '6.0.0'
|
||||||
|
|
||||||
/*activiti在线编辑器相关*/
|
/*activiti在线编辑器相关*/
|
||||||
compile group: 'org.activiti', name: 'activiti-json-converter', version: '6.0.0'
|
compile group: 'org.activiti', name: 'activiti-json-converter', version: '6.0.0'
|
||||||
compile group: 'org.apache.xmlgraphics', name: 'batik-codec', version: '1.7'
|
compile group: 'org.apache.xmlgraphics', name: 'batik-codec', version: '1.7'
|
||||||
/*activiti end*/
|
/*activiti end*/
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/cn.afterturn/easypoi-base
|
// https://mvnrepository.com/artifact/cn.afterturn/easypoi-base
|
||||||
compile group: 'cn.afterturn', name: 'easypoi-base', version: '4.2.0'
|
compile group: 'cn.afterturn', name: 'easypoi-base', version: '4.2.0'
|
||||||
// https://mvnrepository.com/artifact/cn.afterturn/easypoi-annotation
|
// https://mvnrepository.com/artifact/cn.afterturn/easypoi-annotation
|
||||||
compile group: 'cn.afterturn', name: 'easypoi-annotation', version: '4.2.0'
|
compile group: 'cn.afterturn', name: 'easypoi-annotation', version: '4.2.0'
|
||||||
|
|
||||||
compileOnly 'org.springframework.boot:spring-boot-configuration-processor'
|
compileOnly 'org.springframework.boot:spring-boot-configuration-processor'
|
||||||
|
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.dependsOn(processResources){
|
compileJava.dependsOn(processResources){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
findbugs{
|
findbugs{
|
||||||
ignoreFailures=true
|
ignoreFailures=true
|
||||||
findbugsTest.enabled=false
|
findbugsTest.enabled=false
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(FindBugs) {
|
tasks.withType(FindBugs) {
|
||||||
reports {
|
reports {
|
||||||
// 指定分析结果格式为xml 只能选一种格式
|
// 指定分析结果格式为xml 只能选一种格式
|
||||||
xml.enabled = true
|
xml.enabled = true
|
||||||
html.enabled = false
|
html.enabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
||||||
#Thu Oct 28 15:13:01 CST 2021
|
#Thu Oct 28 15:13:01 CST 2021
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-rc-2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-rc-2-bin.zip
|
||||||
|
|
|
||||||
|
|
@ -1,172 +1,172 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
##
|
##
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
PRG="$0"
|
||||||
# Need this for relative symlinks.
|
# Need this for relative symlinks.
|
||||||
while [ -h "$PRG" ] ; do
|
while [ -h "$PRG" ] ; do
|
||||||
ls=`ls -ld "$PRG"`
|
ls=`ls -ld "$PRG"`
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
PRG="$link"
|
PRG="$link"
|
||||||
else
|
else
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
SAVED="`pwd`"
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
APP_HOME="`pwd -P`"
|
APP_HOME="`pwd -P`"
|
||||||
cd "$SAVED" >/dev/null
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
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.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS=""
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
|
||||||
warn ( ) {
|
warn ( ) {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
die ( ) {
|
die ( ) {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "`uname`" in
|
||||||
CYGWIN* )
|
CYGWIN* )
|
||||||
cygwin=true
|
cygwin=true
|
||||||
;;
|
;;
|
||||||
Darwin* )
|
Darwin* )
|
||||||
darwin=true
|
darwin=true
|
||||||
;;
|
;;
|
||||||
MINGW* )
|
MINGW* )
|
||||||
msys=true
|
msys=true
|
||||||
;;
|
;;
|
||||||
NONSTOP* )
|
NONSTOP* )
|
||||||
nonstop=true
|
nonstop=true
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
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.
|
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
fi
|
fi
|
||||||
ulimit -n $MAX_FD
|
ulimit -n $MAX_FD
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
if $darwin; then
|
if $darwin; then
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if $cygwin ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
SEP=""
|
SEP=""
|
||||||
for dir in $ROOTDIRSRAW ; do
|
for dir in $ROOTDIRSRAW ; do
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
SEP="|"
|
SEP="|"
|
||||||
done
|
done
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
fi
|
fi
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
i=0
|
i=0
|
||||||
for arg in "$@" ; do
|
for arg in "$@" ; do
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
(0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
(1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
(2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Escape application args
|
||||||
save ( ) {
|
save ( ) {
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# 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"
|
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
|
# 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
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
|
||||||
|
|
@ -1,84 +1,84 @@
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@rem
|
@rem
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
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.
|
@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=
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
echo.
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation.
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
:findJavaFromJavaHome
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
echo.
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation.
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
:init
|
||||||
@rem Get command-line arguments, handling Windows variants
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
:win9xME_args
|
:win9xME_args
|
||||||
@rem Slurp the command line arguments.
|
@rem Slurp the command line arguments.
|
||||||
set CMD_LINE_ARGS=
|
set CMD_LINE_ARGS=
|
||||||
set _SKIP=2
|
set _SKIP=2
|
||||||
|
|
||||||
:win9xME_args_slurp
|
:win9xME_args_slurp
|
||||||
if "x%~1" == "x" goto execute
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
@rem Execute Gradle
|
@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%
|
"%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
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
:omega
|
:omega
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
rootProject.name = 'fourcal'
|
rootProject.name = 'fourcal'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,33 @@
|
||||||
package cn.palmte.work;
|
package cn.palmte.work;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||||
* @since 2.0 2022/12/30 15:26
|
* @since 2.0 2022/12/30 15:26
|
||||||
*/
|
*/
|
||||||
public class ErrorMessage implements Result {
|
public class ErrorMessage implements Result {
|
||||||
|
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
public ErrorMessage() { }
|
public ErrorMessage() { }
|
||||||
|
|
||||||
public ErrorMessage(String message) {
|
public ErrorMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessage(String message) {
|
public void setMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ErrorMessage failed(String message) {
|
public static ErrorMessage failed(String message) {
|
||||||
return new ErrorMessage(message);
|
return new ErrorMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ErrorMessage failed() {
|
public static ErrorMessage failed() {
|
||||||
return new ErrorMessage("未知错误");
|
return new ErrorMessage("未知错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,50 @@
|
||||||
package cn.palmte.work;
|
package cn.palmte.work;
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||||
* @since 2.0 2022/12/30 15:25
|
* @since 2.0 2022/12/30 15:25
|
||||||
*/
|
*/
|
||||||
public class ErrorMessageException extends NoStackTraceRuntimeException {
|
public class ErrorMessageException extends NoStackTraceRuntimeException {
|
||||||
|
|
||||||
private final HttpStatus status;
|
private final HttpStatus status;
|
||||||
|
|
||||||
public ErrorMessageException(/*@Nullable*/ String msg) {
|
public ErrorMessageException(/*@Nullable*/ String msg) {
|
||||||
this(msg, null, HttpStatus.BAD_REQUEST);
|
this(msg, null, HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ErrorMessageException(/*@Nullable*/ String msg, /*@Nullable*/ Throwable cause, HttpStatus status) {
|
public ErrorMessageException(/*@Nullable*/ String msg, /*@Nullable*/ Throwable cause, HttpStatus status) {
|
||||||
super(msg, cause);
|
super(msg, cause);
|
||||||
Assert.notNull(status, "http status is required");
|
Assert.notNull(status, "http status is required");
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpStatus getStatus() {
|
public HttpStatus getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ErrorMessageException failed(String message) {
|
public static ErrorMessageException failed(String message) {
|
||||||
return new ErrorMessageException(message);
|
return new ErrorMessageException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ErrorMessageException failed(String message, HttpStatus status) {
|
public static ErrorMessageException failed(String message, HttpStatus status) {
|
||||||
return new ErrorMessageException(message, null, status);
|
return new ErrorMessageException(message, null, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void notNull(Object obj, String message) {
|
public static void notNull(Object obj, String message) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
throw ErrorMessageException.failed(message, HttpStatus.NOT_FOUND);
|
throw ErrorMessageException.failed(message, HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void notNull(Object obj, Supplier<String> supplier) {
|
public static void notNull(Object obj, Supplier<String> supplier) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
throw new ErrorMessageException(supplier.get());
|
throw new ErrorMessageException(supplier.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,40 @@
|
||||||
package cn.palmte.work;
|
package cn.palmte.work;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 四算项目
|
* 四算项目
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class FourCalApplication extends SpringBootServletInitializer {
|
public class FourCalApplication extends SpringBootServletInitializer {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(FourCalApplication.class, args);
|
SpringApplication.run(FourCalApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||||
/**
|
/**
|
||||||
* war包运行的话,为了不修改配置文件,在运行的tomcat的catalina.sh中添加jvm参数-Dspring.profiles.active=test,
|
* war包运行的话,为了不修改配置文件,在运行的tomcat的catalina.sh中添加jvm参数-Dspring.profiles.active=test,
|
||||||
* 因为我们现在已经有一个env了,所以可以根据这个设置profile
|
* 因为我们现在已经有一个env了,所以可以根据这个设置profile
|
||||||
* 命令行java -jar运行的话直接通过-Dspring.profiles.active=test来指定
|
* 命令行java -jar运行的话直接通过-Dspring.profiles.active=test来指定
|
||||||
*/
|
*/
|
||||||
setRegisterErrorPageFilter(false);
|
setRegisterErrorPageFilter(false);
|
||||||
String env = System.getProperty("env");
|
String env = System.getProperty("env");
|
||||||
if (null != env) {
|
if (null != env) {
|
||||||
Map<String, Object> map = new HashMap<>(1);
|
Map<String, Object> map = new HashMap<>(1);
|
||||||
map.put("spring.profiles.active", env);
|
map.put("spring.profiles.active", env);
|
||||||
builder.properties(map);
|
builder.properties(map);
|
||||||
//不能使用 builder.profiles(env);否则可能出现两个环境的都配置了
|
//不能使用 builder.profiles(env);否则可能出现两个环境的都配置了
|
||||||
}
|
}
|
||||||
return builder.sources(FourCalApplication.class);
|
return builder.sources(FourCalApplication.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,113 +1,113 @@
|
||||||
package cn.palmte.work;
|
package cn.palmte.work;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||||
* @since 2.0 2022/12/30 15:38
|
* @since 2.0 2022/12/30 15:38
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Json implements Result {
|
public class Json implements Result {
|
||||||
|
|
||||||
private Object data;
|
private Object data;
|
||||||
private String message;
|
private String message;
|
||||||
private boolean success;
|
private boolean success;
|
||||||
|
|
||||||
public Object getData() {
|
public Object getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSuccess() {
|
public boolean isSuccess() {
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Json data(Object data) {
|
public Json data(Object data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Json message(String message) {
|
public Json message(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Json success(boolean success) {
|
public Json success(boolean success) {
|
||||||
this.success = success;
|
this.success = success;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply the common {@link Json} result
|
* Apply the common {@link Json} result
|
||||||
*
|
*
|
||||||
* @param func the {@link Function}
|
* @param func the {@link Function}
|
||||||
* @param param parameter
|
* @param param parameter
|
||||||
*/
|
*/
|
||||||
public static <T> Json apply(Function<T, Boolean> func, T param) {
|
public static <T> Json apply(Function<T, Boolean> func, T param) {
|
||||||
if (func.apply(param)) {
|
if (func.apply(param)) {
|
||||||
return Json.ok();
|
return Json.ok();
|
||||||
}
|
}
|
||||||
return Json.failed();
|
return Json.failed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Json apply(boolean success) {
|
public static <T> Json apply(boolean success) {
|
||||||
if (success) {
|
if (success) {
|
||||||
return Json.ok();
|
return Json.ok();
|
||||||
}
|
}
|
||||||
return Json.failed();
|
return Json.failed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param success if success
|
* @param success if success
|
||||||
* @param message the message of the response
|
* @param message the message of the response
|
||||||
* @param data response data
|
* @param data response data
|
||||||
*/
|
*/
|
||||||
public static Json create(boolean success, String message, Object data) {
|
public static Json create(boolean success, String message, Object data) {
|
||||||
return new Json()
|
return new Json()
|
||||||
.data(data)
|
.data(data)
|
||||||
.message(message)
|
.message(message)
|
||||||
.success(success);
|
.success(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Json ok() {
|
public static Json ok() {
|
||||||
return create(true, "ok", null);
|
return create(true, "ok", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Json ok(String message, Object data) {
|
public static Json ok(String message, Object data) {
|
||||||
return create(true, message, data);
|
return create(true, message, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Json ok(Object data) {
|
public static Json ok(Object data) {
|
||||||
return create(true, "ok", data);
|
return create(true, "ok", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Json ok(String message) {
|
public static Json ok(String message) {
|
||||||
return create(true, message, null);
|
return create(true, message, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Json failed() {
|
public static Json failed() {
|
||||||
return create(false, "失败", null);
|
return create(false, "失败", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Json failed(String message) {
|
public static Json failed(String message) {
|
||||||
return create(false, message, null);
|
return create(false, message, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Json failed(String message, Object data) {
|
public static Json failed(String message, Object data) {
|
||||||
return create(false, message, data);
|
return create(false, message, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new StringBuilder()//
|
return new StringBuilder()//
|
||||||
.append("{\"message\":\"").append(message)//
|
.append("{\"message\":\"").append(message)//
|
||||||
.append("\",\"data\":\"").append(data)//
|
.append("\",\"data\":\"").append(data)//
|
||||||
.append("\",\"success\":\"").append(success)//
|
.append("\",\"success\":\"").append(success)//
|
||||||
.append("\"}")//
|
.append("\"}")//
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,96 +1,96 @@
|
||||||
package cn.palmte.work;
|
package cn.palmte.work;
|
||||||
|
|
||||||
import org.springframework.core.NestedExceptionUtils;
|
import org.springframework.core.NestedExceptionUtils;
|
||||||
import org.springframework.core.NestedRuntimeException;
|
import org.springframework.core.NestedRuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 没有堆栈的异常, 降低性能消耗
|
* 没有堆栈的异常, 降低性能消耗
|
||||||
*
|
*
|
||||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||||
* @since 2.0 2022/12/30 15:25
|
* @since 2.0 2022/12/30 15:25
|
||||||
*/
|
*/
|
||||||
public class NoStackTraceRuntimeException extends RuntimeException {
|
public class NoStackTraceRuntimeException extends RuntimeException {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public NoStackTraceRuntimeException() {
|
public NoStackTraceRuntimeException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NoStackTraceRuntimeException(Throwable cause) {
|
public NoStackTraceRuntimeException(Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NoStackTraceRuntimeException(String msg) {
|
public NoStackTraceRuntimeException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NoStackTraceRuntimeException(/*@Nullable*/ String msg, /*@Nullable */Throwable cause) {
|
public NoStackTraceRuntimeException(/*@Nullable*/ String msg, /*@Nullable */Throwable cause) {
|
||||||
super(msg, cause);
|
super(msg, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final synchronized Throwable fillInStackTrace() {
|
public final synchronized Throwable fillInStackTrace() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the innermost cause of this exception, if any.
|
* Retrieve the innermost cause of this exception, if any.
|
||||||
*
|
*
|
||||||
* @return the innermost exception, or {@code null} if none
|
* @return the innermost exception, or {@code null} if none
|
||||||
*/
|
*/
|
||||||
// @Nullable
|
// @Nullable
|
||||||
public Throwable getRootCause() {
|
public Throwable getRootCause() {
|
||||||
return NestedExceptionUtils.getRootCause(this);
|
return NestedExceptionUtils.getRootCause(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the most specific cause of this exception, that is,
|
* Retrieve the most specific cause of this exception, that is,
|
||||||
* either the innermost cause (root cause) or this exception itself.
|
* either the innermost cause (root cause) or this exception itself.
|
||||||
* <p>Differs from {@link #getRootCause()} in that it falls back
|
* <p>Differs from {@link #getRootCause()} in that it falls back
|
||||||
* to the present exception if there is no root cause.
|
* to the present exception if there is no root cause.
|
||||||
*
|
*
|
||||||
* @return the most specific cause (never {@code null})
|
* @return the most specific cause (never {@code null})
|
||||||
*/
|
*/
|
||||||
public Throwable getMostSpecificCause() {
|
public Throwable getMostSpecificCause() {
|
||||||
Throwable rootCause = getRootCause();
|
Throwable rootCause = getRootCause();
|
||||||
return (rootCause != null ? rootCause : this);
|
return (rootCause != null ? rootCause : this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether this exception contains an exception of the given type:
|
* 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
|
* either it is of the given class itself or it contains a nested cause
|
||||||
* of the given type.
|
* of the given type.
|
||||||
*
|
*
|
||||||
* @param exType the exception type to look for
|
* @param exType the exception type to look for
|
||||||
* @return whether there is a nested exception of the specified type
|
* @return whether there is a nested exception of the specified type
|
||||||
*/
|
*/
|
||||||
public boolean contains(Class<?> exType) {
|
public boolean contains(Class<?> exType) {
|
||||||
if (exType == null) {
|
if (exType == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (exType.isInstance(this)) {
|
if (exType.isInstance(this)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Throwable cause = getCause();
|
Throwable cause = getCause();
|
||||||
if (cause == this) {
|
if (cause == this) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (cause instanceof NestedRuntimeException) {
|
if (cause instanceof NestedRuntimeException) {
|
||||||
return ((NestedRuntimeException) cause).contains(exType);
|
return ((NestedRuntimeException) cause).contains(exType);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
while (cause != null) {
|
while (cause != null) {
|
||||||
if (exType.isInstance(cause)) {
|
if (exType.isInstance(cause)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (cause.getCause() == cause) {
|
if (cause.getCause() == cause) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cause = cause.getCause();
|
cause = cause.getCause();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package cn.palmte.work;
|
package cn.palmte.work;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||||
* @since 2.0 2022/12/30 15:37
|
* @since 2.0 2022/12/30 15:37
|
||||||
*/
|
*/
|
||||||
public interface Result {
|
public interface Result {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,30 @@
|
||||||
package cn.palmte.work;
|
package cn.palmte.work;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||||
* @since 2.0 2022/12/30 15:39
|
* @since 2.0 2022/12/30 15:39
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ValidationError implements Result {
|
public class ValidationError implements Result {
|
||||||
|
|
||||||
private Object validation;
|
private Object validation;
|
||||||
|
|
||||||
public static ValidationError failed(Object validation) {
|
public static ValidationError failed(Object validation) {
|
||||||
return new ValidationError(validation);
|
return new ValidationError(validation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public Object getData() {
|
public Object getData() {
|
||||||
return validation;
|
return validation;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,51 +1,51 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public enum ApproveStatusEnum {
|
public enum ApproveStatusEnum {
|
||||||
APPROVAL_UNCOMMIT(0,"草稿"),
|
APPROVAL_UNCOMMIT(0,"草稿"),
|
||||||
APPROVAL_PENDING(1,"待审核"),
|
APPROVAL_PENDING(1,"待审核"),
|
||||||
APPROVAL_PASSED(2,"审核通过"),
|
APPROVAL_PASSED(2,"审核通过"),
|
||||||
APPROVAL_UNPASS(3,"审核不通过");
|
APPROVAL_UNPASS(3,"审核不通过");
|
||||||
|
|
||||||
private int approveStatus;
|
private int approveStatus;
|
||||||
private String approveStatusDesc;
|
private String approveStatusDesc;
|
||||||
|
|
||||||
ApproveStatusEnum(int approveStatus, String approveStatusDesc) {
|
ApproveStatusEnum(int approveStatus, String approveStatusDesc) {
|
||||||
this.approveStatus = approveStatus;
|
this.approveStatus = approveStatus;
|
||||||
this.approveStatusDesc = approveStatusDesc;
|
this.approveStatusDesc = approveStatusDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getApproveStatus() {
|
public int getApproveStatus() {
|
||||||
return approveStatus;
|
return approveStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApproveStatus(int approveStatus) {
|
public void setApproveStatus(int approveStatus) {
|
||||||
this.approveStatus = approveStatus;
|
this.approveStatus = approveStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApproveStatusDesc() {
|
public String getApproveStatusDesc() {
|
||||||
return approveStatusDesc;
|
return approveStatusDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApproveStatusDesc(String approveStatusDesc) {
|
public void setApproveStatusDesc(String approveStatusDesc) {
|
||||||
this.approveStatusDesc = approveStatusDesc;
|
this.approveStatusDesc = approveStatusDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ApproveStatusEnum parseApproveStatus(int approveStatus){
|
public static ApproveStatusEnum parseApproveStatus(int approveStatus){
|
||||||
if(approveStatus == 0){
|
if(approveStatus == 0){
|
||||||
return APPROVAL_UNCOMMIT;
|
return APPROVAL_UNCOMMIT;
|
||||||
}
|
}
|
||||||
if(approveStatus == 1){
|
if(approveStatus == 1){
|
||||||
return APPROVAL_PENDING;
|
return APPROVAL_PENDING;
|
||||||
}
|
}
|
||||||
if(approveStatus == 2){
|
if(approveStatus == 2){
|
||||||
return APPROVAL_PASSED;
|
return APPROVAL_PASSED;
|
||||||
}
|
}
|
||||||
if(approveStatus == 3){
|
if(approveStatus == 3){
|
||||||
return APPROVAL_UNPASS;
|
return APPROVAL_UNPASS;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unkown approveStatus:"+approveStatus);
|
throw new IllegalArgumentException("Unkown approveStatus:"+approveStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,155 +1,155 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预算页面
|
* 预算页面
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public class BudgetBean extends IncomeCostBean{
|
public class BudgetBean extends IncomeCostBean{
|
||||||
/**
|
/**
|
||||||
* 总的采购成本不含税
|
* 总的采购成本不含税
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseTotalTaxExclude;
|
private BigDecimal costPurchaseTotalTaxExclude;
|
||||||
/**
|
/**
|
||||||
* 总的采购成本含税
|
* 总的采购成本含税
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseTotalTaxInclude;
|
private BigDecimal costPurchaseTotalTaxInclude;
|
||||||
/**
|
/**
|
||||||
* 设备收入税金
|
* 设备收入税金
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeDeviceTax;
|
private BigDecimal incomeDeviceTax;
|
||||||
/**
|
/**
|
||||||
* 设施收入税金
|
* 设施收入税金
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeEngineerTax;
|
private BigDecimal incomeEngineerTax;
|
||||||
/**
|
/**
|
||||||
* 服务收入税金
|
* 服务收入税金
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeServiceTax;
|
private BigDecimal incomeServiceTax;
|
||||||
/**
|
/**
|
||||||
* 采购设备成本税金
|
* 采购设备成本税金
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseDeviceTax;
|
private BigDecimal costPurchaseDeviceTax;
|
||||||
/**
|
/**
|
||||||
* 采购施工成本税金
|
* 采购施工成本税金
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseBuildTax;
|
private BigDecimal costPurchaseBuildTax;
|
||||||
/**
|
/**
|
||||||
* 采购服务成本税金
|
* 采购服务成本税金
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseServiceTax;
|
private BigDecimal costPurchaseServiceTax;
|
||||||
/**
|
/**
|
||||||
* 采购其他成本含税
|
* 采购其他成本含税
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseOtherTax;
|
private BigDecimal costPurchaseOtherTax;
|
||||||
/**
|
/**
|
||||||
* 采购其他成本含税
|
* 采购其他成本含税
|
||||||
*/
|
*/
|
||||||
private BigDecimal costOtherOtherTax;
|
private BigDecimal costOtherOtherTax;
|
||||||
/**
|
/**
|
||||||
* 公司管理费用
|
* 公司管理费用
|
||||||
*/
|
*/
|
||||||
private BigDecimal costCompanyManageTaxExclude;
|
private BigDecimal costCompanyManageTaxExclude;
|
||||||
/**
|
/**
|
||||||
* null就返回0
|
* null就返回0
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected BigDecimal handleSpecial(BigDecimal src) {
|
protected BigDecimal handleSpecial(BigDecimal src) {
|
||||||
return null == src ? new BigDecimal(0) : src;
|
return null == src ? new BigDecimal(0) : src;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseTotalTaxExclude() {
|
public BigDecimal getCostPurchaseTotalTaxExclude() {
|
||||||
return handleSpecial(costPurchaseTotalTaxExclude);
|
return handleSpecial(costPurchaseTotalTaxExclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseTotalTaxExclude(BigDecimal costPurchaseTotalTaxExclude) {
|
public void setCostPurchaseTotalTaxExclude(BigDecimal costPurchaseTotalTaxExclude) {
|
||||||
this.costPurchaseTotalTaxExclude = costPurchaseTotalTaxExclude;
|
this.costPurchaseTotalTaxExclude = costPurchaseTotalTaxExclude;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseTotalTaxInclude() {
|
public BigDecimal getCostPurchaseTotalTaxInclude() {
|
||||||
return handleSpecial(costPurchaseTotalTaxInclude);
|
return handleSpecial(costPurchaseTotalTaxInclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseTotalTaxInclude(BigDecimal costPurchaseTotalTaxInclude) {
|
public void setCostPurchaseTotalTaxInclude(BigDecimal costPurchaseTotalTaxInclude) {
|
||||||
this.costPurchaseTotalTaxInclude = costPurchaseTotalTaxInclude;
|
this.costPurchaseTotalTaxInclude = costPurchaseTotalTaxInclude;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseTotalTax() {
|
public BigDecimal getCostPurchaseTotalTax() {
|
||||||
return getCostPurchaseTotalTaxInclude().subtract(getCostPurchaseTotalTaxExclude());
|
return getCostPurchaseTotalTaxInclude().subtract(getCostPurchaseTotalTaxExclude());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getIncomeDeviceTax() {
|
public BigDecimal getIncomeDeviceTax() {
|
||||||
return handleSpecial(incomeDeviceTax);
|
return handleSpecial(incomeDeviceTax);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIncomeDeviceTax(BigDecimal incomeDeviceTax) {
|
public void setIncomeDeviceTax(BigDecimal incomeDeviceTax) {
|
||||||
this.incomeDeviceTax = incomeDeviceTax;
|
this.incomeDeviceTax = incomeDeviceTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getIncomeEngineerTax() {
|
public BigDecimal getIncomeEngineerTax() {
|
||||||
return handleSpecial(incomeEngineerTax);
|
return handleSpecial(incomeEngineerTax);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIncomeEngineerTax(BigDecimal incomeEngineerTax) {
|
public void setIncomeEngineerTax(BigDecimal incomeEngineerTax) {
|
||||||
this.incomeEngineerTax = incomeEngineerTax;
|
this.incomeEngineerTax = incomeEngineerTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getIncomeServiceTax() {
|
public BigDecimal getIncomeServiceTax() {
|
||||||
return handleSpecial(incomeServiceTax);
|
return handleSpecial(incomeServiceTax);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIncomeServiceTax(BigDecimal incomeServiceTax) {
|
public void setIncomeServiceTax(BigDecimal incomeServiceTax) {
|
||||||
this.incomeServiceTax = incomeServiceTax;
|
this.incomeServiceTax = incomeServiceTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseDeviceTax() {
|
public BigDecimal getCostPurchaseDeviceTax() {
|
||||||
return handleSpecial(costPurchaseDeviceTax);
|
return handleSpecial(costPurchaseDeviceTax);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseDeviceTax(BigDecimal costPurchaseDeviceTax) {
|
public void setCostPurchaseDeviceTax(BigDecimal costPurchaseDeviceTax) {
|
||||||
this.costPurchaseDeviceTax = costPurchaseDeviceTax;
|
this.costPurchaseDeviceTax = costPurchaseDeviceTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseBuildTax() {
|
public BigDecimal getCostPurchaseBuildTax() {
|
||||||
return handleSpecial(costPurchaseBuildTax);
|
return handleSpecial(costPurchaseBuildTax);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseBuildTax(BigDecimal costPurchaseBuildTax) {
|
public void setCostPurchaseBuildTax(BigDecimal costPurchaseBuildTax) {
|
||||||
this.costPurchaseBuildTax = costPurchaseBuildTax;
|
this.costPurchaseBuildTax = costPurchaseBuildTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseServiceTax() {
|
public BigDecimal getCostPurchaseServiceTax() {
|
||||||
return handleSpecial(costPurchaseServiceTax);
|
return handleSpecial(costPurchaseServiceTax);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseServiceTax(BigDecimal costPurchaseServiceTax) {
|
public void setCostPurchaseServiceTax(BigDecimal costPurchaseServiceTax) {
|
||||||
this.costPurchaseServiceTax = costPurchaseServiceTax;
|
this.costPurchaseServiceTax = costPurchaseServiceTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseOtherTax() {
|
public BigDecimal getCostPurchaseOtherTax() {
|
||||||
return handleSpecial(costPurchaseOtherTax);
|
return handleSpecial(costPurchaseOtherTax);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseOtherTax(BigDecimal costPurchaseOtherTax) {
|
public void setCostPurchaseOtherTax(BigDecimal costPurchaseOtherTax) {
|
||||||
this.costPurchaseOtherTax = costPurchaseOtherTax;
|
this.costPurchaseOtherTax = costPurchaseOtherTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostOtherOtherTax() {
|
public BigDecimal getCostOtherOtherTax() {
|
||||||
return handleSpecial(costOtherOtherTax);
|
return handleSpecial(costOtherOtherTax);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostOtherOtherTax(BigDecimal costOtherOtherTax) {
|
public void setCostOtherOtherTax(BigDecimal costOtherOtherTax) {
|
||||||
this.costOtherOtherTax = costOtherOtherTax;
|
this.costOtherOtherTax = costOtherOtherTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal getCostCompanyManageTaxExclude() {
|
public BigDecimal getCostCompanyManageTaxExclude() {
|
||||||
return getIncomeTotalTaxExclude().multiply(BigDecimal.valueOf(0.028));
|
return getIncomeTotalTaxExclude().multiply(BigDecimal.valueOf(0.028));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCostCompanyManageTaxExclude(BigDecimal costCompanyManageTaxExclude) {
|
public void setCostCompanyManageTaxExclude(BigDecimal costCompanyManageTaxExclude) {
|
||||||
this.costCompanyManageTaxExclude = costCompanyManageTaxExclude;
|
this.costCompanyManageTaxExclude = costCompanyManageTaxExclude;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,425 +1,425 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
public class BudgetSettleBean {
|
public class BudgetSettleBean {
|
||||||
|
|
||||||
//========================收入表================================
|
//========================收入表================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备类决算总额
|
* 设备类决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeDeviceBudgetTotal;
|
private BigDecimal incomeDeviceBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工程类决算总额
|
* 工程类决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeEngineerBudgetTotal;
|
private BigDecimal incomeEngineerBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务类决算总额
|
* 服务类决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeServiceBudgetTotal;
|
private BigDecimal incomeServiceBudgetTotal;
|
||||||
|
|
||||||
//========================成本表================================
|
//========================成本表================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备采购成本决算总额
|
* 设备采购成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseDeviceBudgetTotal;
|
private BigDecimal costPurchaseDeviceBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 施工采购成本决算总额
|
* 施工采购成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseBuildBudgetTotal;
|
private BigDecimal costPurchaseBuildBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务采购成本决算总额
|
* 服务采购成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseServiceBudgetTotal;
|
private BigDecimal costPurchaseServiceBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他采购成本决算总额
|
* 其他采购成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseOtherBudgetTotal;
|
private BigDecimal costPurchaseOtherBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目管理成本决算总额
|
* 项目管理成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costProjectManageBudgetTotal;
|
private BigDecimal costProjectManageBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他成本决算总额
|
* 其他成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costOtherBudgetTotal;
|
private BigDecimal costOtherBudgetTotal;
|
||||||
|
|
||||||
|
|
||||||
//========================管理表================================
|
//========================管理表================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 财务费用决算总额
|
* 财务费用决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costExpropriationBudgetTotal;
|
private BigDecimal costExpropriationBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司管理费用决算总额
|
* 公司管理费用决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costCompanyManageBudgetTotal;
|
private BigDecimal costCompanyManageBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所得税费用决算总额
|
* 所得税费用决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costIncomeTaxBudgetTotal;
|
private BigDecimal costIncomeTaxBudgetTotal;
|
||||||
|
|
||||||
|
|
||||||
//========================利润率计算表================================
|
//========================利润率计算表================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目毛利决算总额
|
* 项目毛利决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal grossProfitBudgetTotal;
|
private BigDecimal grossProfitBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目毛利利润率
|
* 项目毛利利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal grossProfitProfitMargin;
|
private BigDecimal grossProfitProfitMargin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目贡献利润决算总额
|
* 项目贡献利润决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal contributionProfitBudgetTotal;
|
private BigDecimal contributionProfitBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目贡献利润利润率
|
* 项目贡献利润利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal contributionProfitProfitMargin;
|
private BigDecimal contributionProfitProfitMargin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目净利润决算总额
|
* 项目净利润决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal netProfitBudgetTotal;
|
private BigDecimal netProfitBudgetTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目净利润利润率
|
* 项目净利润利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal netProfitProfitMargin;
|
private BigDecimal netProfitProfitMargin;
|
||||||
|
|
||||||
//========================结算现金流量表================================
|
//========================结算现金流量表================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a销售商品、提供劳务收到的现金
|
* a销售商品、提供劳务收到的现金
|
||||||
*/
|
*/
|
||||||
private BigDecimal saleIncomeCashBudget;
|
private BigDecimal saleIncomeCashBudget;
|
||||||
/**
|
/**
|
||||||
* b收到的税费返还
|
* b收到的税费返还
|
||||||
*/
|
*/
|
||||||
private BigDecimal taxReturnBudget;
|
private BigDecimal taxReturnBudget;
|
||||||
/**
|
/**
|
||||||
* c其他与经营活动有关的现金【保证金收入】
|
* c其他与经营活动有关的现金【保证金收入】
|
||||||
*/
|
*/
|
||||||
private BigDecimal earnestMoneyIncomeBudget;
|
private BigDecimal earnestMoneyIncomeBudget;
|
||||||
/**
|
/**
|
||||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||||
*/
|
*/
|
||||||
private BigDecimal purchaseCostBudget;
|
private BigDecimal purchaseCostBudget;
|
||||||
/**
|
/**
|
||||||
* e支付的各项税费
|
* e支付的各项税费
|
||||||
*/
|
*/
|
||||||
private BigDecimal taxCostBudget;
|
private BigDecimal taxCostBudget;
|
||||||
/**
|
/**
|
||||||
* f支付其他与经营活动有关的现金
|
* f支付其他与经营活动有关的现金
|
||||||
*/
|
*/
|
||||||
private BigDecimal earnestMoneyCostBudget;
|
private BigDecimal earnestMoneyCostBudget;
|
||||||
/**
|
/**
|
||||||
* g经营活动产生的现金流量净额
|
* g经营活动产生的现金流量净额
|
||||||
* g=a+c+b-d-f-e
|
* g=a+c+b-d-f-e
|
||||||
*/
|
*/
|
||||||
private BigDecimal netCashFlowBudget;
|
private BigDecimal netCashFlowBudget;
|
||||||
/**
|
/**
|
||||||
* h投资活动现金流入
|
* h投资活动现金流入
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashInflowFromInvestingActivitiesBudget;
|
private BigDecimal cashInflowFromInvestingActivitiesBudget;
|
||||||
/**
|
/**
|
||||||
* i投资活动现金流出
|
* i投资活动现金流出
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashOutflowFromInvestingActivitiesBudget;
|
private BigDecimal cashOutflowFromInvestingActivitiesBudget;
|
||||||
/**
|
/**
|
||||||
* j投资活动产生的现金流量净额
|
* j投资活动产生的现金流量净额
|
||||||
*/
|
*/
|
||||||
private BigDecimal netCashFromInvestingActivitiesBudget;
|
private BigDecimal netCashFromInvestingActivitiesBudget;
|
||||||
/**
|
/**
|
||||||
* k融资资金流入【垫资计划】
|
* k融资资金流入【垫资计划】
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalInflowBudget;
|
private BigDecimal financingCapitalInflowBudget;
|
||||||
/**
|
/**
|
||||||
* l融资资金流出【还款计划】
|
* l融资资金流出【还款计划】
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalOutflowBudget;
|
private BigDecimal financingCapitalOutflowBudget;
|
||||||
/**
|
/**
|
||||||
* m筹资活动产生的现金流量净额
|
* m筹资活动产生的现金流量净额
|
||||||
* m=k-l
|
* m=k-l
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalCashflowBudget;
|
private BigDecimal financingCapitalCashflowBudget;
|
||||||
/**
|
/**
|
||||||
* n货币资金净增加额
|
* n货币资金净增加额
|
||||||
* n=g+j+m
|
* n=g+j+m
|
||||||
*/
|
*/
|
||||||
private BigDecimal netIncreaseMonetaryFundsBudget;
|
private BigDecimal netIncreaseMonetaryFundsBudget;
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getIncomeDeviceBudgetTotal() {
|
public BigDecimal getIncomeDeviceBudgetTotal() {
|
||||||
return incomeDeviceBudgetTotal;
|
return incomeDeviceBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIncomeDeviceBudgetTotal(BigDecimal incomeDeviceBudgetTotal) {
|
public void setIncomeDeviceBudgetTotal(BigDecimal incomeDeviceBudgetTotal) {
|
||||||
this.incomeDeviceBudgetTotal = incomeDeviceBudgetTotal;
|
this.incomeDeviceBudgetTotal = incomeDeviceBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getIncomeEngineerBudgetTotal() {
|
public BigDecimal getIncomeEngineerBudgetTotal() {
|
||||||
return incomeEngineerBudgetTotal;
|
return incomeEngineerBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIncomeEngineerBudgetTotal(BigDecimal incomeEngineerBudgetTotal) {
|
public void setIncomeEngineerBudgetTotal(BigDecimal incomeEngineerBudgetTotal) {
|
||||||
this.incomeEngineerBudgetTotal = incomeEngineerBudgetTotal;
|
this.incomeEngineerBudgetTotal = incomeEngineerBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getIncomeServiceBudgetTotal() {
|
public BigDecimal getIncomeServiceBudgetTotal() {
|
||||||
return incomeServiceBudgetTotal;
|
return incomeServiceBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIncomeServiceBudgetTotal(BigDecimal incomeServiceBudgetTotal) {
|
public void setIncomeServiceBudgetTotal(BigDecimal incomeServiceBudgetTotal) {
|
||||||
this.incomeServiceBudgetTotal = incomeServiceBudgetTotal;
|
this.incomeServiceBudgetTotal = incomeServiceBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseDeviceBudgetTotal() {
|
public BigDecimal getCostPurchaseDeviceBudgetTotal() {
|
||||||
return costPurchaseDeviceBudgetTotal;
|
return costPurchaseDeviceBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseDeviceBudgetTotal(BigDecimal costPurchaseDeviceBudgetTotal) {
|
public void setCostPurchaseDeviceBudgetTotal(BigDecimal costPurchaseDeviceBudgetTotal) {
|
||||||
this.costPurchaseDeviceBudgetTotal = costPurchaseDeviceBudgetTotal;
|
this.costPurchaseDeviceBudgetTotal = costPurchaseDeviceBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseBuildBudgetTotal() {
|
public BigDecimal getCostPurchaseBuildBudgetTotal() {
|
||||||
return costPurchaseBuildBudgetTotal;
|
return costPurchaseBuildBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseBuildBudgetTotal(BigDecimal costPurchaseBuildBudgetTotal) {
|
public void setCostPurchaseBuildBudgetTotal(BigDecimal costPurchaseBuildBudgetTotal) {
|
||||||
this.costPurchaseBuildBudgetTotal = costPurchaseBuildBudgetTotal;
|
this.costPurchaseBuildBudgetTotal = costPurchaseBuildBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseServiceBudgetTotal() {
|
public BigDecimal getCostPurchaseServiceBudgetTotal() {
|
||||||
return costPurchaseServiceBudgetTotal;
|
return costPurchaseServiceBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseServiceBudgetTotal(BigDecimal costPurchaseServiceBudgetTotal) {
|
public void setCostPurchaseServiceBudgetTotal(BigDecimal costPurchaseServiceBudgetTotal) {
|
||||||
this.costPurchaseServiceBudgetTotal = costPurchaseServiceBudgetTotal;
|
this.costPurchaseServiceBudgetTotal = costPurchaseServiceBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseOtherBudgetTotal() {
|
public BigDecimal getCostPurchaseOtherBudgetTotal() {
|
||||||
return costPurchaseOtherBudgetTotal;
|
return costPurchaseOtherBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseOtherBudgetTotal(BigDecimal costPurchaseOtherBudgetTotal) {
|
public void setCostPurchaseOtherBudgetTotal(BigDecimal costPurchaseOtherBudgetTotal) {
|
||||||
this.costPurchaseOtherBudgetTotal = costPurchaseOtherBudgetTotal;
|
this.costPurchaseOtherBudgetTotal = costPurchaseOtherBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostProjectManageBudgetTotal() {
|
public BigDecimal getCostProjectManageBudgetTotal() {
|
||||||
return costProjectManageBudgetTotal;
|
return costProjectManageBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostProjectManageBudgetTotal(BigDecimal costProjectManageBudgetTotal) {
|
public void setCostProjectManageBudgetTotal(BigDecimal costProjectManageBudgetTotal) {
|
||||||
this.costProjectManageBudgetTotal = costProjectManageBudgetTotal;
|
this.costProjectManageBudgetTotal = costProjectManageBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostOtherBudgetTotal() {
|
public BigDecimal getCostOtherBudgetTotal() {
|
||||||
return (costOtherBudgetTotal == null)?BigDecimal.ZERO:costOtherBudgetTotal;
|
return (costOtherBudgetTotal == null)?BigDecimal.ZERO:costOtherBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostOtherBudgetTotal(BigDecimal costOtherBudgetTotal) {
|
public void setCostOtherBudgetTotal(BigDecimal costOtherBudgetTotal) {
|
||||||
this.costOtherBudgetTotal = costOtherBudgetTotal;
|
this.costOtherBudgetTotal = costOtherBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostExpropriationBudgetTotal() {
|
public BigDecimal getCostExpropriationBudgetTotal() {
|
||||||
return costExpropriationBudgetTotal;
|
return costExpropriationBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostExpropriationBudgetTotal(BigDecimal costExpropriationBudgetTotal) {
|
public void setCostExpropriationBudgetTotal(BigDecimal costExpropriationBudgetTotal) {
|
||||||
this.costExpropriationBudgetTotal = costExpropriationBudgetTotal;
|
this.costExpropriationBudgetTotal = costExpropriationBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostCompanyManageBudgetTotal() {
|
public BigDecimal getCostCompanyManageBudgetTotal() {
|
||||||
return costCompanyManageBudgetTotal;
|
return costCompanyManageBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostCompanyManageBudgetTotal(BigDecimal costCompanyManageBudgetTotal) {
|
public void setCostCompanyManageBudgetTotal(BigDecimal costCompanyManageBudgetTotal) {
|
||||||
this.costCompanyManageBudgetTotal = costCompanyManageBudgetTotal;
|
this.costCompanyManageBudgetTotal = costCompanyManageBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostIncomeTaxBudgetTotal() {
|
public BigDecimal getCostIncomeTaxBudgetTotal() {
|
||||||
return costIncomeTaxBudgetTotal;
|
return costIncomeTaxBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostIncomeTaxBudgetTotal(BigDecimal costIncomeTaxBudgetTotal) {
|
public void setCostIncomeTaxBudgetTotal(BigDecimal costIncomeTaxBudgetTotal) {
|
||||||
this.costIncomeTaxBudgetTotal = costIncomeTaxBudgetTotal;
|
this.costIncomeTaxBudgetTotal = costIncomeTaxBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getGrossProfitBudgetTotal() {
|
public BigDecimal getGrossProfitBudgetTotal() {
|
||||||
return grossProfitBudgetTotal;
|
return grossProfitBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrossProfitBudgetTotal(BigDecimal grossProfitBudgetTotal) {
|
public void setGrossProfitBudgetTotal(BigDecimal grossProfitBudgetTotal) {
|
||||||
this.grossProfitBudgetTotal = grossProfitBudgetTotal;
|
this.grossProfitBudgetTotal = grossProfitBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getGrossProfitProfitMargin() {
|
public BigDecimal getGrossProfitProfitMargin() {
|
||||||
return grossProfitProfitMargin;
|
return grossProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
||||||
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getContributionProfitBudgetTotal() {
|
public BigDecimal getContributionProfitBudgetTotal() {
|
||||||
return contributionProfitBudgetTotal;
|
return contributionProfitBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContributionProfitBudgetTotal(BigDecimal contributionProfitBudgetTotal) {
|
public void setContributionProfitBudgetTotal(BigDecimal contributionProfitBudgetTotal) {
|
||||||
this.contributionProfitBudgetTotal = contributionProfitBudgetTotal;
|
this.contributionProfitBudgetTotal = contributionProfitBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getContributionProfitProfitMargin() {
|
public BigDecimal getContributionProfitProfitMargin() {
|
||||||
return contributionProfitProfitMargin;
|
return contributionProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
||||||
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetProfitBudgetTotal() {
|
public BigDecimal getNetProfitBudgetTotal() {
|
||||||
return netProfitBudgetTotal;
|
return netProfitBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetProfitBudgetTotal(BigDecimal netProfitBudgetTotal) {
|
public void setNetProfitBudgetTotal(BigDecimal netProfitBudgetTotal) {
|
||||||
this.netProfitBudgetTotal = netProfitBudgetTotal;
|
this.netProfitBudgetTotal = netProfitBudgetTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetProfitProfitMargin() {
|
public BigDecimal getNetProfitProfitMargin() {
|
||||||
return netProfitProfitMargin;
|
return netProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
||||||
this.netProfitProfitMargin = netProfitProfitMargin;
|
this.netProfitProfitMargin = netProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getSaleIncomeCashBudget() {
|
public BigDecimal getSaleIncomeCashBudget() {
|
||||||
return saleIncomeCashBudget;
|
return saleIncomeCashBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSaleIncomeCashBudget(BigDecimal saleIncomeCashBudget) {
|
public void setSaleIncomeCashBudget(BigDecimal saleIncomeCashBudget) {
|
||||||
this.saleIncomeCashBudget = saleIncomeCashBudget;
|
this.saleIncomeCashBudget = saleIncomeCashBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getTaxReturnBudget() {
|
public BigDecimal getTaxReturnBudget() {
|
||||||
return taxReturnBudget;
|
return taxReturnBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaxReturnBudget(BigDecimal taxReturnBudget) {
|
public void setTaxReturnBudget(BigDecimal taxReturnBudget) {
|
||||||
this.taxReturnBudget = taxReturnBudget;
|
this.taxReturnBudget = taxReturnBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getEarnestMoneyIncomeBudget() {
|
public BigDecimal getEarnestMoneyIncomeBudget() {
|
||||||
return earnestMoneyIncomeBudget;
|
return earnestMoneyIncomeBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEarnestMoneyIncomeBudget(BigDecimal earnestMoneyIncomeBudget) {
|
public void setEarnestMoneyIncomeBudget(BigDecimal earnestMoneyIncomeBudget) {
|
||||||
this.earnestMoneyIncomeBudget = earnestMoneyIncomeBudget;
|
this.earnestMoneyIncomeBudget = earnestMoneyIncomeBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getPurchaseCostBudget() {
|
public BigDecimal getPurchaseCostBudget() {
|
||||||
return purchaseCostBudget;
|
return purchaseCostBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPurchaseCostBudget(BigDecimal purchaseCostBudget) {
|
public void setPurchaseCostBudget(BigDecimal purchaseCostBudget) {
|
||||||
this.purchaseCostBudget = purchaseCostBudget;
|
this.purchaseCostBudget = purchaseCostBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getTaxCostBudget() {
|
public BigDecimal getTaxCostBudget() {
|
||||||
return taxCostBudget;
|
return taxCostBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaxCostBudget(BigDecimal taxCostBudget) {
|
public void setTaxCostBudget(BigDecimal taxCostBudget) {
|
||||||
this.taxCostBudget = taxCostBudget;
|
this.taxCostBudget = taxCostBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getEarnestMoneyCostBudget() {
|
public BigDecimal getEarnestMoneyCostBudget() {
|
||||||
return earnestMoneyCostBudget;
|
return earnestMoneyCostBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEarnestMoneyCostBudget(BigDecimal earnestMoneyCostBudget) {
|
public void setEarnestMoneyCostBudget(BigDecimal earnestMoneyCostBudget) {
|
||||||
this.earnestMoneyCostBudget = earnestMoneyCostBudget;
|
this.earnestMoneyCostBudget = earnestMoneyCostBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetCashFlowBudget() {
|
public BigDecimal getNetCashFlowBudget() {
|
||||||
return netCashFlowBudget;
|
return netCashFlowBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetCashFlowBudget(BigDecimal netCashFlowBudget) {
|
public void setNetCashFlowBudget(BigDecimal netCashFlowBudget) {
|
||||||
this.netCashFlowBudget = netCashFlowBudget;
|
this.netCashFlowBudget = netCashFlowBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCashInflowFromInvestingActivitiesBudget() {
|
public BigDecimal getCashInflowFromInvestingActivitiesBudget() {
|
||||||
return cashInflowFromInvestingActivitiesBudget;
|
return cashInflowFromInvestingActivitiesBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCashInflowFromInvestingActivitiesBudget(BigDecimal cashInflowFromInvestingActivitiesBudget) {
|
public void setCashInflowFromInvestingActivitiesBudget(BigDecimal cashInflowFromInvestingActivitiesBudget) {
|
||||||
this.cashInflowFromInvestingActivitiesBudget = cashInflowFromInvestingActivitiesBudget;
|
this.cashInflowFromInvestingActivitiesBudget = cashInflowFromInvestingActivitiesBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCashOutflowFromInvestingActivitiesBudget() {
|
public BigDecimal getCashOutflowFromInvestingActivitiesBudget() {
|
||||||
return cashOutflowFromInvestingActivitiesBudget;
|
return cashOutflowFromInvestingActivitiesBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCashOutflowFromInvestingActivitiesBudget(BigDecimal cashOutflowFromInvestingActivitiesBudget) {
|
public void setCashOutflowFromInvestingActivitiesBudget(BigDecimal cashOutflowFromInvestingActivitiesBudget) {
|
||||||
this.cashOutflowFromInvestingActivitiesBudget = cashOutflowFromInvestingActivitiesBudget;
|
this.cashOutflowFromInvestingActivitiesBudget = cashOutflowFromInvestingActivitiesBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetCashFromInvestingActivitiesBudget() {
|
public BigDecimal getNetCashFromInvestingActivitiesBudget() {
|
||||||
return netCashFromInvestingActivitiesBudget;
|
return netCashFromInvestingActivitiesBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetCashFromInvestingActivitiesBudget(BigDecimal netCashFromInvestingActivitiesBudget) {
|
public void setNetCashFromInvestingActivitiesBudget(BigDecimal netCashFromInvestingActivitiesBudget) {
|
||||||
this.netCashFromInvestingActivitiesBudget = netCashFromInvestingActivitiesBudget;
|
this.netCashFromInvestingActivitiesBudget = netCashFromInvestingActivitiesBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getFinancingCapitalInflowBudget() {
|
public BigDecimal getFinancingCapitalInflowBudget() {
|
||||||
return financingCapitalInflowBudget;
|
return financingCapitalInflowBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinancingCapitalInflowBudget(BigDecimal financingCapitalInflowBudget) {
|
public void setFinancingCapitalInflowBudget(BigDecimal financingCapitalInflowBudget) {
|
||||||
this.financingCapitalInflowBudget = financingCapitalInflowBudget;
|
this.financingCapitalInflowBudget = financingCapitalInflowBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getFinancingCapitalOutflowBudget() {
|
public BigDecimal getFinancingCapitalOutflowBudget() {
|
||||||
return financingCapitalOutflowBudget;
|
return financingCapitalOutflowBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinancingCapitalOutflowBudget(BigDecimal financingCapitalOutflowBudget) {
|
public void setFinancingCapitalOutflowBudget(BigDecimal financingCapitalOutflowBudget) {
|
||||||
this.financingCapitalOutflowBudget = financingCapitalOutflowBudget;
|
this.financingCapitalOutflowBudget = financingCapitalOutflowBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getFinancingCapitalCashflowBudget() {
|
public BigDecimal getFinancingCapitalCashflowBudget() {
|
||||||
return financingCapitalCashflowBudget;
|
return financingCapitalCashflowBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinancingCapitalCashflowBudget(BigDecimal financingCapitalCashflowBudget) {
|
public void setFinancingCapitalCashflowBudget(BigDecimal financingCapitalCashflowBudget) {
|
||||||
this.financingCapitalCashflowBudget = financingCapitalCashflowBudget;
|
this.financingCapitalCashflowBudget = financingCapitalCashflowBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetIncreaseMonetaryFundsBudget() {
|
public BigDecimal getNetIncreaseMonetaryFundsBudget() {
|
||||||
return netIncreaseMonetaryFundsBudget;
|
return netIncreaseMonetaryFundsBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetIncreaseMonetaryFundsBudget(BigDecimal netIncreaseMonetaryFundsBudget) {
|
public void setNetIncreaseMonetaryFundsBudget(BigDecimal netIncreaseMonetaryFundsBudget) {
|
||||||
this.netIncreaseMonetaryFundsBudget = netIncreaseMonetaryFundsBudget;
|
this.netIncreaseMonetaryFundsBudget = netIncreaseMonetaryFundsBudget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,229 +1,229 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 现金流量
|
* 现金流量
|
||||||
* @author xiongshiyan at 2021/11/6 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/6 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public class CashFlowBean {
|
public class CashFlowBean {
|
||||||
/**
|
/**
|
||||||
* a销售商品、提供劳务收到的现金
|
* a销售商品、提供劳务收到的现金
|
||||||
* */
|
* */
|
||||||
private BigDecimal saleIncomeCash;
|
private BigDecimal saleIncomeCash;
|
||||||
/**
|
/**
|
||||||
* b收到的税费返还
|
* b收到的税费返还
|
||||||
* */
|
* */
|
||||||
private BigDecimal taxReturn;
|
private BigDecimal taxReturn;
|
||||||
/**
|
/**
|
||||||
* c其他与经营活动有关的现金【保证金收入】
|
* c其他与经营活动有关的现金【保证金收入】
|
||||||
*/
|
*/
|
||||||
private BigDecimal earnestMoneyIncome;
|
private BigDecimal earnestMoneyIncome;
|
||||||
/**
|
/**
|
||||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||||
*/
|
*/
|
||||||
private BigDecimal purchaseCost;
|
private BigDecimal purchaseCost;
|
||||||
/**
|
/**
|
||||||
* e支付的各项税费
|
* e支付的各项税费
|
||||||
*/
|
*/
|
||||||
private BigDecimal taxCost;
|
private BigDecimal taxCost;
|
||||||
/**
|
/**
|
||||||
*f支付其他与经营活动有关的现金
|
*f支付其他与经营活动有关的现金
|
||||||
*/
|
*/
|
||||||
private BigDecimal earnestMoneyCost;
|
private BigDecimal earnestMoneyCost;
|
||||||
/**
|
/**
|
||||||
* g经营活动产生的现金流量净额
|
* g经营活动产生的现金流量净额
|
||||||
* g=a+c+b-d-f-e
|
* g=a+c+b-d-f-e
|
||||||
*/
|
*/
|
||||||
//private BigDecimal netCashFlow;
|
//private BigDecimal netCashFlow;
|
||||||
/**
|
/**
|
||||||
* h投资活动现金流入
|
* h投资活动现金流入
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashInflowFromInvestingActivities;
|
private BigDecimal cashInflowFromInvestingActivities;
|
||||||
/**
|
/**
|
||||||
* i投资活动现金流出
|
* i投资活动现金流出
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashOutflowFromInvestingActivities;
|
private BigDecimal cashOutflowFromInvestingActivities;
|
||||||
/**
|
/**
|
||||||
* j投资活动产生的现金流量净额
|
* j投资活动产生的现金流量净额
|
||||||
*/
|
*/
|
||||||
private BigDecimal netCashFromInvestingActivities;
|
private BigDecimal netCashFromInvestingActivities;
|
||||||
/**
|
/**
|
||||||
* k融资资金流入【垫资计划】
|
* k融资资金流入【垫资计划】
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalInflow;
|
private BigDecimal financingCapitalInflow;
|
||||||
/**
|
/**
|
||||||
* l融资资金流出【还款计划】
|
* l融资资金流出【还款计划】
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalOutflow;
|
private BigDecimal financingCapitalOutflow;
|
||||||
/**
|
/**
|
||||||
*m筹资活动产生的现金流量净额
|
*m筹资活动产生的现金流量净额
|
||||||
* m=k-l
|
* m=k-l
|
||||||
*/
|
*/
|
||||||
//private BigDecimal financingCapitalCashflow;
|
//private BigDecimal financingCapitalCashflow;
|
||||||
/**
|
/**
|
||||||
* n货币资金净增加额
|
* n货币资金净增加额
|
||||||
* n=g+j+m
|
* n=g+j+m
|
||||||
*/
|
*/
|
||||||
//private BigDecimal netIncreaseMonetaryFunds;
|
//private BigDecimal netIncreaseMonetaryFunds;
|
||||||
|
|
||||||
public BigDecimal getSaleIncomeCash() {
|
public BigDecimal getSaleIncomeCash() {
|
||||||
return handleSpecial(saleIncomeCash);
|
return handleSpecial(saleIncomeCash);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
|
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
|
||||||
this.saleIncomeCash = saleIncomeCash;
|
this.saleIncomeCash = saleIncomeCash;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getTaxReturn() {
|
public BigDecimal getTaxReturn() {
|
||||||
return handleSpecial(taxReturn);
|
return handleSpecial(taxReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaxReturn(BigDecimal taxReturn) {
|
public void setTaxReturn(BigDecimal taxReturn) {
|
||||||
this.taxReturn = taxReturn;
|
this.taxReturn = taxReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getEarnestMoneyIncome() {
|
public BigDecimal getEarnestMoneyIncome() {
|
||||||
return handleSpecial(earnestMoneyIncome);
|
return handleSpecial(earnestMoneyIncome);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
|
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
|
||||||
this.earnestMoneyIncome = earnestMoneyIncome;
|
this.earnestMoneyIncome = earnestMoneyIncome;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getPurchaseCost() {
|
public BigDecimal getPurchaseCost() {
|
||||||
return handleSpecial(purchaseCost);
|
return handleSpecial(purchaseCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPurchaseCost(BigDecimal purchaseCost) {
|
public void setPurchaseCost(BigDecimal purchaseCost) {
|
||||||
this.purchaseCost = purchaseCost;
|
this.purchaseCost = purchaseCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getTaxCost() {
|
public BigDecimal getTaxCost() {
|
||||||
return handleSpecial(taxCost);
|
return handleSpecial(taxCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaxCost(BigDecimal taxCost) {
|
public void setTaxCost(BigDecimal taxCost) {
|
||||||
this.taxCost = taxCost;
|
this.taxCost = taxCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getEarnestMoneyCost() {
|
public BigDecimal getEarnestMoneyCost() {
|
||||||
return handleSpecial(earnestMoneyCost);
|
return handleSpecial(earnestMoneyCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
|
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
|
||||||
this.earnestMoneyCost = earnestMoneyCost;
|
this.earnestMoneyCost = earnestMoneyCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetCashFlow() {
|
public BigDecimal getNetCashFlow() {
|
||||||
|
|
||||||
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
||||||
BigDecimal taxReturn = getTaxReturn();
|
BigDecimal taxReturn = getTaxReturn();
|
||||||
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
||||||
BigDecimal purchaseCost = getPurchaseCost();
|
BigDecimal purchaseCost = getPurchaseCost();
|
||||||
BigDecimal taxCost = getTaxCost();
|
BigDecimal taxCost = getTaxCost();
|
||||||
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
||||||
|
|
||||||
return saleIncomeCash
|
return saleIncomeCash
|
||||||
.add(taxReturn)
|
.add(taxReturn)
|
||||||
.add(earnestMoneyIncome)
|
.add(earnestMoneyIncome)
|
||||||
.subtract(purchaseCost)
|
.subtract(purchaseCost)
|
||||||
.subtract(taxCost)
|
.subtract(taxCost)
|
||||||
.subtract(earnestMoneyCost);
|
.subtract(earnestMoneyCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCashInflowFromInvestingActivities() {
|
public BigDecimal getCashInflowFromInvestingActivities() {
|
||||||
return handleSpecial(cashInflowFromInvestingActivities);
|
return handleSpecial(cashInflowFromInvestingActivities);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
|
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
|
||||||
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
|
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCashOutflowFromInvestingActivities() {
|
public BigDecimal getCashOutflowFromInvestingActivities() {
|
||||||
return handleSpecial(cashOutflowFromInvestingActivities);
|
return handleSpecial(cashOutflowFromInvestingActivities);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
|
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
|
||||||
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
|
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetCashFromInvestingActivities() {
|
public BigDecimal getNetCashFromInvestingActivities() {
|
||||||
return handleSpecial(netCashFromInvestingActivities);
|
return handleSpecial(netCashFromInvestingActivities);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
|
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
|
||||||
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
|
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getFinancingCapitalInflow() {
|
public BigDecimal getFinancingCapitalInflow() {
|
||||||
return handleSpecial(financingCapitalInflow);
|
return handleSpecial(financingCapitalInflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
|
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
|
||||||
this.financingCapitalInflow = financingCapitalInflow;
|
this.financingCapitalInflow = financingCapitalInflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getFinancingCapitalOutflow() {
|
public BigDecimal getFinancingCapitalOutflow() {
|
||||||
return handleSpecial(financingCapitalOutflow);
|
return handleSpecial(financingCapitalOutflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
|
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
|
||||||
this.financingCapitalOutflow = financingCapitalOutflow;
|
this.financingCapitalOutflow = financingCapitalOutflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getFinancingCapitalCashflow() {
|
public BigDecimal getFinancingCapitalCashflow() {
|
||||||
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
||||||
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
||||||
return financingCapitalInflow.subtract(financingCapitalOutflow);
|
return financingCapitalInflow.subtract(financingCapitalOutflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetIncreaseMonetaryFunds() {
|
public BigDecimal getNetIncreaseMonetaryFunds() {
|
||||||
BigDecimal netCashFlow = getNetCashFlow();
|
BigDecimal netCashFlow = getNetCashFlow();
|
||||||
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
||||||
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
||||||
return netCashFlow
|
return netCashFlow
|
||||||
.add(netCashFromInvestingActivities)
|
.add(netCashFromInvestingActivities)
|
||||||
.add(financingCapitalCashflow);
|
.add(financingCapitalCashflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有现金流量决算总额
|
* 获取所有现金流量决算总额
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal getCashFluxTotal() {
|
public BigDecimal getCashFluxTotal() {
|
||||||
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
||||||
BigDecimal taxReturn = getTaxReturn();
|
BigDecimal taxReturn = getTaxReturn();
|
||||||
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
||||||
BigDecimal purchaseCost = getPurchaseCost();
|
BigDecimal purchaseCost = getPurchaseCost();
|
||||||
BigDecimal taxCost = getTaxCost();
|
BigDecimal taxCost = getTaxCost();
|
||||||
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
||||||
BigDecimal netCashFlow = getNetCashFlow();
|
BigDecimal netCashFlow = getNetCashFlow();
|
||||||
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
|
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
|
||||||
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
|
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
|
||||||
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
||||||
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
||||||
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
||||||
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
||||||
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
|
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
|
||||||
|
|
||||||
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|
||||||
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
|
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
|
||||||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
|
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
|
||||||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
|
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
|
||||||
return new BigDecimal(0);
|
return new BigDecimal(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
|
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
|
||||||
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
|
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
|
||||||
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
|
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理特殊值
|
* 处理特殊值
|
||||||
* null就返回0
|
* null就返回0
|
||||||
*/
|
*/
|
||||||
protected BigDecimal handleSpecial(BigDecimal src) {
|
protected BigDecimal handleSpecial(BigDecimal src) {
|
||||||
return null == src ? new BigDecimal(0) : src;
|
return null == src ? new BigDecimal(0) : src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,71 +1,71 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CashFlowStatisticsBean {
|
public class CashFlowStatisticsBean {
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a销售商品、提供劳务收到的现金
|
* a销售商品、提供劳务收到的现金
|
||||||
* */
|
* */
|
||||||
private BigDecimal saleIncomeCash;
|
private BigDecimal saleIncomeCash;
|
||||||
/**
|
/**
|
||||||
* b收到的税费返还
|
* b收到的税费返还
|
||||||
* */
|
* */
|
||||||
private BigDecimal taxReturn;
|
private BigDecimal taxReturn;
|
||||||
/**
|
/**
|
||||||
* c其他与经营活动有关的现金【保证金收入】
|
* c其他与经营活动有关的现金【保证金收入】
|
||||||
*/
|
*/
|
||||||
private BigDecimal earnestMoneyIncome;
|
private BigDecimal earnestMoneyIncome;
|
||||||
/**
|
/**
|
||||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||||
*/
|
*/
|
||||||
private BigDecimal purchaseCost;
|
private BigDecimal purchaseCost;
|
||||||
/**
|
/**
|
||||||
* e支付的各项税费
|
* e支付的各项税费
|
||||||
*/
|
*/
|
||||||
private BigDecimal taxCost;
|
private BigDecimal taxCost;
|
||||||
/**
|
/**
|
||||||
*f支付其他与经营活动有关的现金
|
*f支付其他与经营活动有关的现金
|
||||||
*/
|
*/
|
||||||
private BigDecimal earnestMoneyCost;
|
private BigDecimal earnestMoneyCost;
|
||||||
/**
|
/**
|
||||||
* g经营活动产生的现金流量净额
|
* g经营活动产生的现金流量净额
|
||||||
* g=a+c+b-d-f-e
|
* g=a+c+b-d-f-e
|
||||||
*/
|
*/
|
||||||
private BigDecimal netCashFlow;
|
private BigDecimal netCashFlow;
|
||||||
/**
|
/**
|
||||||
* h投资活动现金流入
|
* h投资活动现金流入
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashInflowFromInvestingActivities;
|
private BigDecimal cashInflowFromInvestingActivities;
|
||||||
/**
|
/**
|
||||||
* i投资活动现金流出
|
* i投资活动现金流出
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashOutflowFromInvestingActivities;
|
private BigDecimal cashOutflowFromInvestingActivities;
|
||||||
/**
|
/**
|
||||||
* j投资活动产生的现金流量净额
|
* j投资活动产生的现金流量净额
|
||||||
*/
|
*/
|
||||||
private BigDecimal netCashFromInvestingActivities;
|
private BigDecimal netCashFromInvestingActivities;
|
||||||
/**
|
/**
|
||||||
* k融资资金流入【垫资计划】
|
* k融资资金流入【垫资计划】
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalInflow;
|
private BigDecimal financingCapitalInflow;
|
||||||
/**
|
/**
|
||||||
* l融资资金流出【还款计划】
|
* l融资资金流出【还款计划】
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalOutflow;
|
private BigDecimal financingCapitalOutflow;
|
||||||
/**
|
/**
|
||||||
*m筹资活动产生的现金流量净额
|
*m筹资活动产生的现金流量净额
|
||||||
* m=k-l
|
* m=k-l
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalCashflow;
|
private BigDecimal financingCapitalCashflow;
|
||||||
/**
|
/**
|
||||||
* n货币资金净增加额
|
* n货币资金净增加额
|
||||||
* n=g+j+m
|
* n=g+j+m
|
||||||
*/
|
*/
|
||||||
private BigDecimal netIncreaseMonetaryFunds;
|
private BigDecimal netIncreaseMonetaryFunds;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,48 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public enum CertaintyEnum {
|
public enum CertaintyEnum {
|
||||||
PLAN_O(-1,""),
|
PLAN_O(-1,""),
|
||||||
PLAN_A(1,"A:项目成功率80%-100%"),
|
PLAN_A(1,"A:项目成功率80%-100%"),
|
||||||
PLAN_B(2,"B:项目成功率60%-80%"),
|
PLAN_B(2,"B:项目成功率60%-80%"),
|
||||||
PLAN_C(3,"C:项目成功率40%-60%");
|
PLAN_C(3,"C:项目成功率40%-60%");
|
||||||
|
|
||||||
private int certainty;
|
private int certainty;
|
||||||
private String certaintyStr;
|
private String certaintyStr;
|
||||||
|
|
||||||
private CertaintyEnum(int certainty, String certaintyStr) {
|
private CertaintyEnum(int certainty, String certaintyStr) {
|
||||||
this.certainty = certainty;
|
this.certainty = certainty;
|
||||||
this.certaintyStr = certaintyStr;
|
this.certaintyStr = certaintyStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCertainty() {
|
public int getCertainty() {
|
||||||
return certainty;
|
return certainty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCertainty(int certainty) {
|
public void setCertainty(int certainty) {
|
||||||
this.certainty = certainty;
|
this.certainty = certainty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCertaintyStr() {
|
public String getCertaintyStr() {
|
||||||
return certaintyStr;
|
return certaintyStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCertaintyStr(String certaintyStr) {
|
public void setCertaintyStr(String certaintyStr) {
|
||||||
this.certaintyStr = certaintyStr;
|
this.certaintyStr = certaintyStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CertaintyEnum parseCertainty(int certainty){
|
public static CertaintyEnum parseCertainty(int certainty){
|
||||||
if(certainty == 1){
|
if(certainty == 1){
|
||||||
return PLAN_A;
|
return PLAN_A;
|
||||||
}
|
}
|
||||||
if(certainty == 2){
|
if(certainty == 2){
|
||||||
return PLAN_B;
|
return PLAN_B;
|
||||||
}
|
}
|
||||||
if(certainty == 3){
|
if(certainty == 3){
|
||||||
return PLAN_C;
|
return PLAN_C;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unkown certainty:"+certainty);
|
throw new IllegalArgumentException("Unkown certainty:"+certainty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,41 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源等信息常量化
|
* 数据源等信息常量化
|
||||||
* @author xiongshiyan
|
* @author xiongshiyan
|
||||||
*/
|
*/
|
||||||
public class Constant {
|
public class Constant {
|
||||||
|
|
||||||
public static final String DATA = "Data";
|
public static final String DATA = "Data";
|
||||||
|
|
||||||
public static final int ROLE_TYPE_SUPER_ADMIN = 0; // 系统管理员
|
public static final int ROLE_TYPE_SUPER_ADMIN = 0; // 系统管理员
|
||||||
public static final int ROLE_TYPE_CMCC_ADMIN = 1;// 移动管理员
|
public static final int ROLE_TYPE_CMCC_ADMIN = 1;// 移动管理员
|
||||||
public static final int ROLE_TYPE_ZJPT_ADMIN = 2; //资金平台管理员
|
public static final int ROLE_TYPE_ZJPT_ADMIN = 2; //资金平台管理员
|
||||||
|
|
||||||
|
|
||||||
private Constant(){}
|
private Constant(){}
|
||||||
/**
|
/**
|
||||||
* 全局状态码
|
* 全局状态码
|
||||||
*/
|
*/
|
||||||
public static final class Status {
|
public static final class Status {
|
||||||
private Status() {
|
private Status() {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 成功
|
* 成功
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_SUCCESS = 0;
|
public static final int STATUS_SUCCESS = 0;
|
||||||
/**
|
/**
|
||||||
* 失败
|
* 失败
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_FAILED = 1;
|
public static final int STATUS_FAILED = 1;
|
||||||
/**
|
/**
|
||||||
* 异常
|
* 异常
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_EXCEPTION = 2;
|
public static final int STATUS_EXCEPTION = 2;
|
||||||
/**
|
/**
|
||||||
* 提示登录
|
* 提示登录
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_PROMPT_LOGIN = 1009;
|
public static final int STATUS_PROMPT_LOGIN = 1009;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,44 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public enum CooperateTypeEnum {
|
public enum CooperateTypeEnum {
|
||||||
PLAN_O(-1,""),
|
PLAN_O(-1,""),
|
||||||
PLAN_A(1,"战略合作类"),
|
PLAN_A(1,"战略合作类"),
|
||||||
PLAN_B(2,"非战略合作类");
|
PLAN_B(2,"非战略合作类");
|
||||||
|
|
||||||
private int cooperateType;
|
private int cooperateType;
|
||||||
private String cooperateTypeStr;
|
private String cooperateTypeStr;
|
||||||
|
|
||||||
private CooperateTypeEnum(int cooperateType, String cooperateTypeStr) {
|
private CooperateTypeEnum(int cooperateType, String cooperateTypeStr) {
|
||||||
this.cooperateType = cooperateType;
|
this.cooperateType = cooperateType;
|
||||||
this.cooperateTypeStr = cooperateTypeStr;
|
this.cooperateTypeStr = cooperateTypeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCooperateType() {
|
public int getCooperateType() {
|
||||||
return cooperateType;
|
return cooperateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCooperateType(int cooperateType) {
|
public void setCooperateType(int cooperateType) {
|
||||||
this.cooperateType = cooperateType;
|
this.cooperateType = cooperateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCooperateTypeStr() {
|
public String getCooperateTypeStr() {
|
||||||
return cooperateTypeStr;
|
return cooperateTypeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCooperateTypeStr(String cooperateTypeStr) {
|
public void setCooperateTypeStr(String cooperateTypeStr) {
|
||||||
this.cooperateTypeStr = cooperateTypeStr;
|
this.cooperateTypeStr = cooperateTypeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CooperateTypeEnum parseCooperateType(int cooperateType){
|
public static CooperateTypeEnum parseCooperateType(int cooperateType){
|
||||||
if(cooperateType == 1){
|
if(cooperateType == 1){
|
||||||
return PLAN_A;
|
return PLAN_A;
|
||||||
}
|
}
|
||||||
if(cooperateType == 2){
|
if(cooperateType == 2){
|
||||||
return PLAN_B;
|
return PLAN_B;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unkown cooperateType:"+cooperateType);
|
throw new IllegalArgumentException("Unkown cooperateType:"+cooperateType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 概算页面
|
* 概算页面
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public class EstimateBean extends IncomeCostBean{
|
public class EstimateBean extends IncomeCostBean{
|
||||||
/**
|
/**
|
||||||
* 原样返回
|
* 原样返回
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected BigDecimal handleSpecial(BigDecimal src) {
|
protected BigDecimal handleSpecial(BigDecimal src) {
|
||||||
return null == src ? new BigDecimal(0) : src;
|
return null == src ? new BigDecimal(0) : src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,250 +1,250 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
public class EstimateSettleBean {
|
public class EstimateSettleBean {
|
||||||
|
|
||||||
//========================收入表================================
|
//========================收入表================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备类决算总额
|
* 设备类决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeDeviceEstimateTotal;
|
private BigDecimal incomeDeviceEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工程类决算总额
|
* 工程类决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeEngineerEstimateTotal;
|
private BigDecimal incomeEngineerEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务类决算总额
|
* 服务类决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeServiceEstimateTotal;
|
private BigDecimal incomeServiceEstimateTotal;
|
||||||
|
|
||||||
//========================成本表================================
|
//========================成本表================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备采购成本决算总额
|
* 设备采购成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseDeviceEstimateTotal;
|
private BigDecimal costPurchaseDeviceEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 施工采购成本决算总额
|
* 施工采购成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseBuildEstimateTotal;
|
private BigDecimal costPurchaseBuildEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务采购成本决算总额
|
* 服务采购成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseServiceEstimateTotal;
|
private BigDecimal costPurchaseServiceEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他采购成本决算总额
|
* 其他采购成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseOtherEstimateTotal;
|
private BigDecimal costPurchaseOtherEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目管理成本决算总额
|
* 项目管理成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costProjectManageEstimateTotal;
|
private BigDecimal costProjectManageEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他成本决算总额
|
* 其他成本决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costOtherEstimateTotal;
|
private BigDecimal costOtherEstimateTotal;
|
||||||
|
|
||||||
|
|
||||||
//========================管理表================================
|
//========================管理表================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 财务费用决算总额
|
* 财务费用决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costExpropriationEstimateTotal;
|
private BigDecimal costExpropriationEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司管理费用决算总额
|
* 公司管理费用决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costCompanyManageEstimateTotal;
|
private BigDecimal costCompanyManageEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所得税费用决算总额
|
* 所得税费用决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal costIncomeTaxEstimateTotal;
|
private BigDecimal costIncomeTaxEstimateTotal;
|
||||||
|
|
||||||
|
|
||||||
//========================利润率计算表================================
|
//========================利润率计算表================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目毛利决算总额
|
* 项目毛利决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal grossProfitEstimateTotal;
|
private BigDecimal grossProfitEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目毛利利润率
|
* 项目毛利利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal grossProfitProfitMargin;
|
private BigDecimal grossProfitProfitMargin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目贡献利润决算总额
|
* 项目贡献利润决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal contributionProfitEstimateTotal;
|
private BigDecimal contributionProfitEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目贡献利润利润率
|
* 项目贡献利润利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal contributionProfitProfitMargin;
|
private BigDecimal contributionProfitProfitMargin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目净利润决算总额
|
* 项目净利润决算总额
|
||||||
*/
|
*/
|
||||||
private BigDecimal netProfitEstimateTotal;
|
private BigDecimal netProfitEstimateTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目净利润利润率
|
* 项目净利润利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal netProfitProfitMargin;
|
private BigDecimal netProfitProfitMargin;
|
||||||
|
|
||||||
public BigDecimal getIncomeDeviceEstimateTotal() {
|
public BigDecimal getIncomeDeviceEstimateTotal() {
|
||||||
return incomeDeviceEstimateTotal;
|
return incomeDeviceEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIncomeDeviceEstimateTotal(BigDecimal incomeDeviceEstimateTotal) {
|
public void setIncomeDeviceEstimateTotal(BigDecimal incomeDeviceEstimateTotal) {
|
||||||
this.incomeDeviceEstimateTotal = incomeDeviceEstimateTotal;
|
this.incomeDeviceEstimateTotal = incomeDeviceEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getIncomeEngineerEstimateTotal() {
|
public BigDecimal getIncomeEngineerEstimateTotal() {
|
||||||
return incomeEngineerEstimateTotal;
|
return incomeEngineerEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIncomeEngineerEstimateTotal(BigDecimal incomeEngineerEstimateTotal) {
|
public void setIncomeEngineerEstimateTotal(BigDecimal incomeEngineerEstimateTotal) {
|
||||||
this.incomeEngineerEstimateTotal = incomeEngineerEstimateTotal;
|
this.incomeEngineerEstimateTotal = incomeEngineerEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getIncomeServiceEstimateTotal() {
|
public BigDecimal getIncomeServiceEstimateTotal() {
|
||||||
return incomeServiceEstimateTotal;
|
return incomeServiceEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIncomeServiceEstimateTotal(BigDecimal incomeServiceEstimateTotal) {
|
public void setIncomeServiceEstimateTotal(BigDecimal incomeServiceEstimateTotal) {
|
||||||
this.incomeServiceEstimateTotal = incomeServiceEstimateTotal;
|
this.incomeServiceEstimateTotal = incomeServiceEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseDeviceEstimateTotal() {
|
public BigDecimal getCostPurchaseDeviceEstimateTotal() {
|
||||||
return costPurchaseDeviceEstimateTotal;
|
return costPurchaseDeviceEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseDeviceEstimateTotal(BigDecimal costPurchaseDeviceEstimateTotal) {
|
public void setCostPurchaseDeviceEstimateTotal(BigDecimal costPurchaseDeviceEstimateTotal) {
|
||||||
this.costPurchaseDeviceEstimateTotal = costPurchaseDeviceEstimateTotal;
|
this.costPurchaseDeviceEstimateTotal = costPurchaseDeviceEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseBuildEstimateTotal() {
|
public BigDecimal getCostPurchaseBuildEstimateTotal() {
|
||||||
return costPurchaseBuildEstimateTotal;
|
return costPurchaseBuildEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseBuildEstimateTotal(BigDecimal costPurchaseBuildEstimateTotal) {
|
public void setCostPurchaseBuildEstimateTotal(BigDecimal costPurchaseBuildEstimateTotal) {
|
||||||
this.costPurchaseBuildEstimateTotal = costPurchaseBuildEstimateTotal;
|
this.costPurchaseBuildEstimateTotal = costPurchaseBuildEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseServiceEstimateTotal() {
|
public BigDecimal getCostPurchaseServiceEstimateTotal() {
|
||||||
return costPurchaseServiceEstimateTotal;
|
return costPurchaseServiceEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseServiceEstimateTotal(BigDecimal costPurchaseServiceEstimateTotal) {
|
public void setCostPurchaseServiceEstimateTotal(BigDecimal costPurchaseServiceEstimateTotal) {
|
||||||
this.costPurchaseServiceEstimateTotal = costPurchaseServiceEstimateTotal;
|
this.costPurchaseServiceEstimateTotal = costPurchaseServiceEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostPurchaseOtherEstimateTotal() {
|
public BigDecimal getCostPurchaseOtherEstimateTotal() {
|
||||||
return costPurchaseOtherEstimateTotal;
|
return costPurchaseOtherEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostPurchaseOtherEstimateTotal(BigDecimal costPurchaseOtherEstimateTotal) {
|
public void setCostPurchaseOtherEstimateTotal(BigDecimal costPurchaseOtherEstimateTotal) {
|
||||||
this.costPurchaseOtherEstimateTotal = costPurchaseOtherEstimateTotal;
|
this.costPurchaseOtherEstimateTotal = costPurchaseOtherEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostProjectManageEstimateTotal() {
|
public BigDecimal getCostProjectManageEstimateTotal() {
|
||||||
return costProjectManageEstimateTotal;
|
return costProjectManageEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostProjectManageEstimateTotal(BigDecimal costProjectManageEstimateTotal) {
|
public void setCostProjectManageEstimateTotal(BigDecimal costProjectManageEstimateTotal) {
|
||||||
this.costProjectManageEstimateTotal = costProjectManageEstimateTotal;
|
this.costProjectManageEstimateTotal = costProjectManageEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostOtherEstimateTotal() {
|
public BigDecimal getCostOtherEstimateTotal() {
|
||||||
return (costOtherEstimateTotal == null)?BigDecimal.ZERO:costOtherEstimateTotal;
|
return (costOtherEstimateTotal == null)?BigDecimal.ZERO:costOtherEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostOtherEstimateTotal(BigDecimal costOtherEstimateTotal) {
|
public void setCostOtherEstimateTotal(BigDecimal costOtherEstimateTotal) {
|
||||||
this.costOtherEstimateTotal = costOtherEstimateTotal;
|
this.costOtherEstimateTotal = costOtherEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostExpropriationEstimateTotal() {
|
public BigDecimal getCostExpropriationEstimateTotal() {
|
||||||
return costExpropriationEstimateTotal;
|
return costExpropriationEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostExpropriationEstimateTotal(BigDecimal costExpropriationEstimateTotal) {
|
public void setCostExpropriationEstimateTotal(BigDecimal costExpropriationEstimateTotal) {
|
||||||
this.costExpropriationEstimateTotal = costExpropriationEstimateTotal;
|
this.costExpropriationEstimateTotal = costExpropriationEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostCompanyManageEstimateTotal() {
|
public BigDecimal getCostCompanyManageEstimateTotal() {
|
||||||
return costCompanyManageEstimateTotal;
|
return costCompanyManageEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostCompanyManageEstimateTotal(BigDecimal costCompanyManageEstimateTotal) {
|
public void setCostCompanyManageEstimateTotal(BigDecimal costCompanyManageEstimateTotal) {
|
||||||
this.costCompanyManageEstimateTotal = costCompanyManageEstimateTotal;
|
this.costCompanyManageEstimateTotal = costCompanyManageEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostIncomeTaxEstimateTotal() {
|
public BigDecimal getCostIncomeTaxEstimateTotal() {
|
||||||
return costIncomeTaxEstimateTotal;
|
return costIncomeTaxEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostIncomeTaxEstimateTotal(BigDecimal costIncomeTaxEstimateTotal) {
|
public void setCostIncomeTaxEstimateTotal(BigDecimal costIncomeTaxEstimateTotal) {
|
||||||
this.costIncomeTaxEstimateTotal = costIncomeTaxEstimateTotal;
|
this.costIncomeTaxEstimateTotal = costIncomeTaxEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getGrossProfitEstimateTotal() {
|
public BigDecimal getGrossProfitEstimateTotal() {
|
||||||
return grossProfitEstimateTotal;
|
return grossProfitEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrossProfitEstimateTotal(BigDecimal grossProfitEstimateTotal) {
|
public void setGrossProfitEstimateTotal(BigDecimal grossProfitEstimateTotal) {
|
||||||
this.grossProfitEstimateTotal = grossProfitEstimateTotal;
|
this.grossProfitEstimateTotal = grossProfitEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getGrossProfitProfitMargin() {
|
public BigDecimal getGrossProfitProfitMargin() {
|
||||||
return grossProfitProfitMargin;
|
return grossProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
||||||
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getContributionProfitEstimateTotal() {
|
public BigDecimal getContributionProfitEstimateTotal() {
|
||||||
return contributionProfitEstimateTotal;
|
return contributionProfitEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContributionProfitEstimateTotal(BigDecimal contributionProfitEstimateTotal) {
|
public void setContributionProfitEstimateTotal(BigDecimal contributionProfitEstimateTotal) {
|
||||||
this.contributionProfitEstimateTotal = contributionProfitEstimateTotal;
|
this.contributionProfitEstimateTotal = contributionProfitEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getContributionProfitProfitMargin() {
|
public BigDecimal getContributionProfitProfitMargin() {
|
||||||
return contributionProfitProfitMargin;
|
return contributionProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
||||||
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetProfitEstimateTotal() {
|
public BigDecimal getNetProfitEstimateTotal() {
|
||||||
return netProfitEstimateTotal;
|
return netProfitEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetProfitEstimateTotal(BigDecimal netProfitEstimateTotal) {
|
public void setNetProfitEstimateTotal(BigDecimal netProfitEstimateTotal) {
|
||||||
this.netProfitEstimateTotal = netProfitEstimateTotal;
|
this.netProfitEstimateTotal = netProfitEstimateTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetProfitProfitMargin() {
|
public BigDecimal getNetProfitProfitMargin() {
|
||||||
return netProfitProfitMargin;
|
return netProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
||||||
this.netProfitProfitMargin = netProfitProfitMargin;
|
this.netProfitProfitMargin = netProfitProfitMargin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,397 +1,397 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yuanping Zhang
|
* @author Yuanping Zhang
|
||||||
* @date 2021/11/15
|
* @date 2021/11/15
|
||||||
*/
|
*/
|
||||||
public class FormerBean extends IncomeCostBean {
|
public class FormerBean extends IncomeCostBean {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所得税
|
* 所得税
|
||||||
*/
|
*/
|
||||||
private BigDecimal costIncomeTax;
|
private BigDecimal costIncomeTax;
|
||||||
/**
|
/**
|
||||||
* 管理总计
|
* 管理总计
|
||||||
*/
|
*/
|
||||||
private BigDecimal costManageTotal;
|
private BigDecimal costManageTotal;
|
||||||
/**
|
/**
|
||||||
* 毛利润
|
* 毛利润
|
||||||
*/
|
*/
|
||||||
private BigDecimal grossProfit;
|
private BigDecimal grossProfit;
|
||||||
/**
|
/**
|
||||||
* 毛利润
|
* 毛利润
|
||||||
*/
|
*/
|
||||||
private BigDecimal grossProfitMargin;
|
private BigDecimal grossProfitMargin;
|
||||||
/**
|
/**
|
||||||
* 贡献利润
|
* 贡献利润
|
||||||
*/
|
*/
|
||||||
private BigDecimal contributionProfit;
|
private BigDecimal contributionProfit;
|
||||||
/**
|
/**
|
||||||
* 贡献利润
|
* 贡献利润
|
||||||
*/
|
*/
|
||||||
private BigDecimal contributionProfitMargin;
|
private BigDecimal contributionProfitMargin;
|
||||||
/**
|
/**
|
||||||
* 净利润
|
* 净利润
|
||||||
*/
|
*/
|
||||||
private BigDecimal netProfit;
|
private BigDecimal netProfit;
|
||||||
/**
|
/**
|
||||||
* 净利润
|
* 净利润
|
||||||
*/
|
*/
|
||||||
private BigDecimal netProfitMargin;
|
private BigDecimal netProfitMargin;
|
||||||
/**
|
/**
|
||||||
* a销售商品、提供劳务收到的现金
|
* a销售商品、提供劳务收到的现金
|
||||||
*/
|
*/
|
||||||
private BigDecimal saleIncomeCash;
|
private BigDecimal saleIncomeCash;
|
||||||
/**
|
/**
|
||||||
* b收到的税费返还
|
* b收到的税费返还
|
||||||
*/
|
*/
|
||||||
private BigDecimal taxReturn;
|
private BigDecimal taxReturn;
|
||||||
/**
|
/**
|
||||||
* c其他与经营活动有关的现金【保证金收入】
|
* c其他与经营活动有关的现金【保证金收入】
|
||||||
*/
|
*/
|
||||||
private BigDecimal earnestMoneyIncome;
|
private BigDecimal earnestMoneyIncome;
|
||||||
/**
|
/**
|
||||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||||
*/
|
*/
|
||||||
private BigDecimal purchaseCost;
|
private BigDecimal purchaseCost;
|
||||||
/**
|
/**
|
||||||
* e支付的各项税费
|
* e支付的各项税费
|
||||||
*/
|
*/
|
||||||
private BigDecimal taxCost;
|
private BigDecimal taxCost;
|
||||||
/**
|
/**
|
||||||
* f支付其他与经营活动有关的现金
|
* f支付其他与经营活动有关的现金
|
||||||
*/
|
*/
|
||||||
private BigDecimal earnestMoneyCost;
|
private BigDecimal earnestMoneyCost;
|
||||||
/**
|
/**
|
||||||
* g经营活动产生的现金流量净额
|
* g经营活动产生的现金流量净额
|
||||||
*/
|
*/
|
||||||
private BigDecimal netCashFlow;
|
private BigDecimal netCashFlow;
|
||||||
/**
|
/**
|
||||||
* h投资活动现金流入
|
* h投资活动现金流入
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashInflowFromInvestingActivities;
|
private BigDecimal cashInflowFromInvestingActivities;
|
||||||
/**
|
/**
|
||||||
* i投资活动现金流出
|
* i投资活动现金流出
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashOutflowFromInvestingActivities;
|
private BigDecimal cashOutflowFromInvestingActivities;
|
||||||
/**
|
/**
|
||||||
* j投资活动产生的现金流量净额
|
* j投资活动产生的现金流量净额
|
||||||
*/
|
*/
|
||||||
private BigDecimal netCashFromInvestingActivities;
|
private BigDecimal netCashFromInvestingActivities;
|
||||||
/**
|
/**
|
||||||
* k融资资金流入【垫资计划】
|
* k融资资金流入【垫资计划】
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalInflow;
|
private BigDecimal financingCapitalInflow;
|
||||||
/**
|
/**
|
||||||
* l融资资金流出【还款计划】
|
* l融资资金流出【还款计划】
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalOutflow;
|
private BigDecimal financingCapitalOutflow;
|
||||||
/**
|
/**
|
||||||
* m筹资活动产生的现金流量净额
|
* m筹资活动产生的现金流量净额
|
||||||
*/
|
*/
|
||||||
private BigDecimal financingCapitalCashflow;
|
private BigDecimal financingCapitalCashflow;
|
||||||
/**
|
/**
|
||||||
* n货币资金净增加额
|
* n货币资金净增加额
|
||||||
*/
|
*/
|
||||||
private BigDecimal netIncreaseMonetaryFunds;
|
private BigDecimal netIncreaseMonetaryFunds;
|
||||||
/**
|
/**
|
||||||
* 现金流量总计
|
* 现金流量总计
|
||||||
*/
|
*/
|
||||||
private BigDecimal cashFlowTotal;
|
private BigDecimal cashFlowTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目毛利利润率
|
* 项目毛利利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal grossProfitProfitMargin;
|
private BigDecimal grossProfitProfitMargin;
|
||||||
|
|
||||||
public BigDecimal getGrossProfitProfitMargin() {
|
public BigDecimal getGrossProfitProfitMargin() {
|
||||||
// 100 * grossProfit() / getIncomeTotalTaxExclude()
|
// 100 * grossProfit() / getIncomeTotalTaxExclude()
|
||||||
BigDecimal grossProfit = getGrossProfit();
|
BigDecimal grossProfit = getGrossProfit();
|
||||||
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||||
|
|
||||||
if (null == grossProfit || null == incomeTotalTaxExclude) {
|
if (null == grossProfit || null == incomeTotalTaxExclude) {
|
||||||
return handleSpecial(null);
|
return handleSpecial(null);
|
||||||
}
|
}
|
||||||
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
|
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
return BigDecimal.ZERO;
|
return BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
return grossProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
return grossProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
||||||
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目贡献利润利润率
|
* 项目贡献利润利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal contributionProfitProfitMargin;
|
private BigDecimal contributionProfitProfitMargin;
|
||||||
|
|
||||||
public BigDecimal getContributionProfitProfitMargin() {
|
public BigDecimal getContributionProfitProfitMargin() {
|
||||||
//100 * contributionProfit() / getIncomeTotalTaxExclude()
|
//100 * contributionProfit() / getIncomeTotalTaxExclude()
|
||||||
BigDecimal contributionProfit = getContributionProfit();
|
BigDecimal contributionProfit = getContributionProfit();
|
||||||
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||||
|
|
||||||
if (null == contributionProfit || null == incomeTotalTaxExclude) {
|
if (null == contributionProfit || null == incomeTotalTaxExclude) {
|
||||||
return handleSpecial(null);
|
return handleSpecial(null);
|
||||||
}
|
}
|
||||||
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
|
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
return BigDecimal.ZERO;
|
return BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
return contributionProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
return contributionProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
||||||
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目净利润利润率
|
* 项目净利润利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal netProfitProfitMargin;
|
private BigDecimal netProfitProfitMargin;
|
||||||
|
|
||||||
public BigDecimal getNetProfitProfitMargin() {
|
public BigDecimal getNetProfitProfitMargin() {
|
||||||
//100 * netProfit() / getIncomeTotalTaxExclude()
|
//100 * netProfit() / getIncomeTotalTaxExclude()
|
||||||
BigDecimal netProfit = getNetProfit();
|
BigDecimal netProfit = getNetProfit();
|
||||||
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||||
|
|
||||||
if (null == netProfit || null == incomeTotalTaxExclude) {
|
if (null == netProfit || null == incomeTotalTaxExclude) {
|
||||||
return handleSpecial(null);
|
return handleSpecial(null);
|
||||||
}
|
}
|
||||||
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
|
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
return BigDecimal.ZERO;
|
return BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
return netProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
return netProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
||||||
this.netProfitProfitMargin = netProfitProfitMargin;
|
this.netProfitProfitMargin = netProfitProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostIncomeTax() {
|
public BigDecimal getCostIncomeTax() {
|
||||||
return costIncomeTax;
|
return costIncomeTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostIncomeTax(BigDecimal costIncomeTax) {
|
public void setCostIncomeTax(BigDecimal costIncomeTax) {
|
||||||
this.costIncomeTax = costIncomeTax;
|
this.costIncomeTax = costIncomeTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCostManageTotal() {
|
public BigDecimal getCostManageTotal() {
|
||||||
BigDecimal costExpropriation = getCostExpropriationTaxExclude();
|
BigDecimal costExpropriation = getCostExpropriationTaxExclude();
|
||||||
BigDecimal costCompanyManage = getCostCompanyManageTaxExclude();
|
BigDecimal costCompanyManage = getCostCompanyManageTaxExclude();
|
||||||
BigDecimal costIncomeTax = getCostIncomeTax();
|
BigDecimal costIncomeTax = getCostIncomeTax();
|
||||||
|
|
||||||
if (null == costExpropriation || null == costCompanyManage || null == costIncomeTax) {
|
if (null == costExpropriation || null == costCompanyManage || null == costIncomeTax) {
|
||||||
return new BigDecimal(0);
|
return new BigDecimal(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return costExpropriation.add(costCompanyManage).add(costIncomeTax);
|
return costExpropriation.add(costCompanyManage).add(costIncomeTax);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCostManageTotal(BigDecimal costManageTotal) {
|
public void setCostManageTotal(BigDecimal costManageTotal) {
|
||||||
this.costManageTotal = costManageTotal;
|
this.costManageTotal = costManageTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getGrossProfit() {
|
public BigDecimal getGrossProfit() {
|
||||||
return grossProfit;
|
return grossProfit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrossProfit(BigDecimal grossProfit) {
|
public void setGrossProfit(BigDecimal grossProfit) {
|
||||||
this.grossProfit = grossProfit;
|
this.grossProfit = grossProfit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getGrossProfitMargin() {
|
public BigDecimal getGrossProfitMargin() {
|
||||||
return grossProfitMargin;
|
return grossProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrossProfitMargin(BigDecimal grossProfitMargin) {
|
public void setGrossProfitMargin(BigDecimal grossProfitMargin) {
|
||||||
this.grossProfitMargin = grossProfitMargin;
|
this.grossProfitMargin = grossProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getContributionProfit() {
|
public BigDecimal getContributionProfit() {
|
||||||
return contributionProfit;
|
return contributionProfit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContributionProfit(BigDecimal contributionProfit) {
|
public void setContributionProfit(BigDecimal contributionProfit) {
|
||||||
this.contributionProfit = contributionProfit;
|
this.contributionProfit = contributionProfit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getContributionProfitMargin() {
|
public BigDecimal getContributionProfitMargin() {
|
||||||
return contributionProfitMargin;
|
return contributionProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContributionProfitMargin(BigDecimal contributionProfitMargin) {
|
public void setContributionProfitMargin(BigDecimal contributionProfitMargin) {
|
||||||
this.contributionProfitMargin = contributionProfitMargin;
|
this.contributionProfitMargin = contributionProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetProfit() {
|
public BigDecimal getNetProfit() {
|
||||||
return netProfit;
|
return netProfit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetProfit(BigDecimal netProfit) {
|
public void setNetProfit(BigDecimal netProfit) {
|
||||||
this.netProfit = netProfit;
|
this.netProfit = netProfit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetProfitMargin() {
|
public BigDecimal getNetProfitMargin() {
|
||||||
return netProfitMargin;
|
return netProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetProfitMargin(BigDecimal netProfitMargin) {
|
public void setNetProfitMargin(BigDecimal netProfitMargin) {
|
||||||
this.netProfitMargin = netProfitMargin;
|
this.netProfitMargin = netProfitMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getSaleIncomeCash() {
|
public BigDecimal getSaleIncomeCash() {
|
||||||
return saleIncomeCash;
|
return saleIncomeCash;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
|
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
|
||||||
this.saleIncomeCash = saleIncomeCash;
|
this.saleIncomeCash = saleIncomeCash;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getTaxReturn() {
|
public BigDecimal getTaxReturn() {
|
||||||
return taxReturn;
|
return taxReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaxReturn(BigDecimal taxReturn) {
|
public void setTaxReturn(BigDecimal taxReturn) {
|
||||||
this.taxReturn = taxReturn;
|
this.taxReturn = taxReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getEarnestMoneyIncome() {
|
public BigDecimal getEarnestMoneyIncome() {
|
||||||
return earnestMoneyIncome;
|
return earnestMoneyIncome;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
|
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
|
||||||
this.earnestMoneyIncome = earnestMoneyIncome;
|
this.earnestMoneyIncome = earnestMoneyIncome;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getPurchaseCost() {
|
public BigDecimal getPurchaseCost() {
|
||||||
return purchaseCost;
|
return purchaseCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPurchaseCost(BigDecimal purchaseCost) {
|
public void setPurchaseCost(BigDecimal purchaseCost) {
|
||||||
this.purchaseCost = purchaseCost;
|
this.purchaseCost = purchaseCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getTaxCost() {
|
public BigDecimal getTaxCost() {
|
||||||
return taxCost;
|
return taxCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaxCost(BigDecimal taxCost) {
|
public void setTaxCost(BigDecimal taxCost) {
|
||||||
this.taxCost = taxCost;
|
this.taxCost = taxCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getEarnestMoneyCost() {
|
public BigDecimal getEarnestMoneyCost() {
|
||||||
return earnestMoneyCost;
|
return earnestMoneyCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
|
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
|
||||||
this.earnestMoneyCost = earnestMoneyCost;
|
this.earnestMoneyCost = earnestMoneyCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetCashFlow() {
|
public BigDecimal getNetCashFlow() {
|
||||||
return netCashFlow;
|
return netCashFlow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetCashFlow(BigDecimal netCashFlow) {
|
public void setNetCashFlow(BigDecimal netCashFlow) {
|
||||||
this.netCashFlow = netCashFlow;
|
this.netCashFlow = netCashFlow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCashInflowFromInvestingActivities() {
|
public BigDecimal getCashInflowFromInvestingActivities() {
|
||||||
return cashInflowFromInvestingActivities;
|
return cashInflowFromInvestingActivities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
|
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
|
||||||
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
|
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCashOutflowFromInvestingActivities() {
|
public BigDecimal getCashOutflowFromInvestingActivities() {
|
||||||
return cashOutflowFromInvestingActivities;
|
return cashOutflowFromInvestingActivities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
|
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
|
||||||
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
|
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetCashFromInvestingActivities() {
|
public BigDecimal getNetCashFromInvestingActivities() {
|
||||||
return netCashFromInvestingActivities;
|
return netCashFromInvestingActivities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
|
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
|
||||||
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
|
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getFinancingCapitalInflow() {
|
public BigDecimal getFinancingCapitalInflow() {
|
||||||
return financingCapitalInflow;
|
return financingCapitalInflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
|
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
|
||||||
this.financingCapitalInflow = financingCapitalInflow;
|
this.financingCapitalInflow = financingCapitalInflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getFinancingCapitalOutflow() {
|
public BigDecimal getFinancingCapitalOutflow() {
|
||||||
return financingCapitalOutflow;
|
return financingCapitalOutflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
|
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
|
||||||
this.financingCapitalOutflow = financingCapitalOutflow;
|
this.financingCapitalOutflow = financingCapitalOutflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getFinancingCapitalCashflow() {
|
public BigDecimal getFinancingCapitalCashflow() {
|
||||||
return financingCapitalCashflow;
|
return financingCapitalCashflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinancingCapitalCashflow(BigDecimal financingCapitalCashflow) {
|
public void setFinancingCapitalCashflow(BigDecimal financingCapitalCashflow) {
|
||||||
this.financingCapitalCashflow = financingCapitalCashflow;
|
this.financingCapitalCashflow = financingCapitalCashflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getNetIncreaseMonetaryFunds() {
|
public BigDecimal getNetIncreaseMonetaryFunds() {
|
||||||
return netIncreaseMonetaryFunds;
|
return netIncreaseMonetaryFunds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNetIncreaseMonetaryFunds(BigDecimal netIncreaseMonetaryFunds) {
|
public void setNetIncreaseMonetaryFunds(BigDecimal netIncreaseMonetaryFunds) {
|
||||||
this.netIncreaseMonetaryFunds = netIncreaseMonetaryFunds;
|
this.netIncreaseMonetaryFunds = netIncreaseMonetaryFunds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCashFlowTotal() {
|
public BigDecimal getCashFlowTotal() {
|
||||||
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
||||||
BigDecimal taxReturn = getTaxReturn();
|
BigDecimal taxReturn = getTaxReturn();
|
||||||
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
||||||
BigDecimal purchaseCost = getPurchaseCost();
|
BigDecimal purchaseCost = getPurchaseCost();
|
||||||
BigDecimal taxCost = getTaxCost();
|
BigDecimal taxCost = getTaxCost();
|
||||||
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
||||||
BigDecimal netCashFlow = getNetCashFlow();
|
BigDecimal netCashFlow = getNetCashFlow();
|
||||||
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
|
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
|
||||||
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
|
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
|
||||||
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
||||||
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
||||||
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
||||||
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
||||||
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
|
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
|
||||||
|
|
||||||
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|
||||||
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
|
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
|
||||||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
|
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
|
||||||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
|
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
|
||||||
return new BigDecimal(0);
|
return new BigDecimal(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
|
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
|
||||||
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
|
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
|
||||||
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
|
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCashFlowTotal(BigDecimal cashFlowTotal) {
|
public void setCashFlowTotal(BigDecimal cashFlowTotal) {
|
||||||
this.cashFlowTotal = cashFlowTotal;
|
this.cashFlowTotal = cashFlowTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 原样返回
|
* 原样返回
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected BigDecimal handleSpecial(BigDecimal src) {
|
protected BigDecimal handleSpecial(BigDecimal src) {
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,89 +1,89 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
public enum IndustrySceneEnum {
|
public enum IndustrySceneEnum {
|
||||||
PLAN_O(-1,""),
|
PLAN_O(-1,""),
|
||||||
PLAN_A(1,"信息安全"),
|
PLAN_A(1,"信息安全"),
|
||||||
PLAN_B(2,"政府"),
|
PLAN_B(2,"政府"),
|
||||||
PLAN_C(3,"公安"),
|
PLAN_C(3,"公安"),
|
||||||
PLAN_D(4,"企业"),
|
PLAN_D(4,"企业"),
|
||||||
PLAN_E(5,"教育"),
|
PLAN_E(5,"教育"),
|
||||||
PLAN_F(6,"交通"),
|
PLAN_F(6,"交通"),
|
||||||
PLAN_G(7,"医疗"),
|
PLAN_G(7,"医疗"),
|
||||||
PLAN_H(8,"电力能源"),
|
PLAN_H(8,"电力能源"),
|
||||||
PLAN_I(9,"运营商"),
|
PLAN_I(9,"运营商"),
|
||||||
PLAN_J(10,"金融"),
|
PLAN_J(10,"金融"),
|
||||||
PLAN_K(11,"专网"),
|
PLAN_K(11,"专网"),
|
||||||
PLAN_L(12,"其他"),
|
PLAN_L(12,"其他"),
|
||||||
PLAN_M(13,"互联网"),
|
PLAN_M(13,"互联网"),
|
||||||
PLAN_N(14,"银行");
|
PLAN_N(14,"银行");
|
||||||
|
|
||||||
private int scene;
|
private int scene;
|
||||||
private String scenario;
|
private String scenario;
|
||||||
|
|
||||||
IndustrySceneEnum(int scene, String scenario) {
|
IndustrySceneEnum(int scene, String scenario) {
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
this.scenario = scenario;
|
this.scenario = scenario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getScene() {
|
public int getScene() {
|
||||||
return scene;
|
return scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScene(int scene) {
|
public void setScene(int scene) {
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getScenario() {
|
public String getScenario() {
|
||||||
return scenario;
|
return scenario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScenario(String scenario) {
|
public void setScenario(String scenario) {
|
||||||
this.scenario = scenario;
|
this.scenario = scenario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IndustrySceneEnum parseScene(int scene){
|
public static IndustrySceneEnum parseScene(int scene){
|
||||||
if(scene == 1){
|
if(scene == 1){
|
||||||
return PLAN_A;
|
return PLAN_A;
|
||||||
}
|
}
|
||||||
if(scene == 2){
|
if(scene == 2){
|
||||||
return PLAN_B;
|
return PLAN_B;
|
||||||
}
|
}
|
||||||
if(scene == 3){
|
if(scene == 3){
|
||||||
return PLAN_C;
|
return PLAN_C;
|
||||||
}
|
}
|
||||||
if(scene == 4){
|
if(scene == 4){
|
||||||
return PLAN_D;
|
return PLAN_D;
|
||||||
}
|
}
|
||||||
if(scene == 5){
|
if(scene == 5){
|
||||||
return PLAN_E;
|
return PLAN_E;
|
||||||
}
|
}
|
||||||
if(scene == 6){
|
if(scene == 6){
|
||||||
return PLAN_F;
|
return PLAN_F;
|
||||||
}
|
}
|
||||||
if(scene == 7){
|
if(scene == 7){
|
||||||
return PLAN_G;
|
return PLAN_G;
|
||||||
}
|
}
|
||||||
if(scene == 8){
|
if(scene == 8){
|
||||||
return PLAN_H;
|
return PLAN_H;
|
||||||
}
|
}
|
||||||
if(scene == 9){
|
if(scene == 9){
|
||||||
return PLAN_I;
|
return PLAN_I;
|
||||||
}
|
}
|
||||||
if(scene == 10){
|
if(scene == 10){
|
||||||
return PLAN_J;
|
return PLAN_J;
|
||||||
}
|
}
|
||||||
if(scene == 11){
|
if(scene == 11){
|
||||||
return PLAN_K;
|
return PLAN_K;
|
||||||
}
|
}
|
||||||
if(scene == 12){
|
if(scene == 12){
|
||||||
return PLAN_L;
|
return PLAN_L;
|
||||||
}
|
}
|
||||||
if(scene == 13){
|
if(scene == 13){
|
||||||
return PLAN_M;
|
return PLAN_M;
|
||||||
}
|
}
|
||||||
if(scene == 14){
|
if(scene == 14){
|
||||||
return PLAN_N;
|
return PLAN_N;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unkown scene:"+scene);
|
throw new IllegalArgumentException("Unkown scene:"+scene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,44 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public enum IsSecondEnum {
|
public enum IsSecondEnum {
|
||||||
PLAN_O(-1,""),
|
PLAN_O(-1,""),
|
||||||
PLAN_A(1,"是"),
|
PLAN_A(1,"是"),
|
||||||
PLAN_B(2,"否");
|
PLAN_B(2,"否");
|
||||||
|
|
||||||
private int isSecond;
|
private int isSecond;
|
||||||
private String isSecondStr;
|
private String isSecondStr;
|
||||||
|
|
||||||
private IsSecondEnum(int isSecond, String isSecondStr) {
|
private IsSecondEnum(int isSecond, String isSecondStr) {
|
||||||
this.isSecond = isSecond;
|
this.isSecond = isSecond;
|
||||||
this.isSecondStr = isSecondStr;
|
this.isSecondStr = isSecondStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIsSecond() {
|
public int getIsSecond() {
|
||||||
return isSecond;
|
return isSecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsSecond(int isSecond) {
|
public void setIsSecond(int isSecond) {
|
||||||
this.isSecond = isSecond;
|
this.isSecond = isSecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIsSecondStr() {
|
public String getIsSecondStr() {
|
||||||
return isSecondStr;
|
return isSecondStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsSecondStr(String isSecondStr) {
|
public void setIsSecondStr(String isSecondStr) {
|
||||||
this.isSecondStr = isSecondStr;
|
this.isSecondStr = isSecondStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IsSecondEnum parseIsSecond(int isSecond){
|
public static IsSecondEnum parseIsSecond(int isSecond){
|
||||||
if(isSecond == 1){
|
if(isSecond == 1){
|
||||||
return PLAN_A;
|
return PLAN_A;
|
||||||
}
|
}
|
||||||
if(isSecond == 2){
|
if(isSecond == 2){
|
||||||
return PLAN_B;
|
return PLAN_B;
|
||||||
}
|
}
|
||||||
return PLAN_O;
|
return PLAN_O;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,73 +1,73 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主要指标数据
|
* 主要指标数据
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class PrimaryIndicatorBean {
|
public class PrimaryIndicatorBean {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收入--设备类
|
* 收入--设备类
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeDevice;
|
private BigDecimal incomeDevice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收入--施工类
|
* 收入--施工类
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeEngineer;
|
private BigDecimal incomeEngineer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收入--服务类
|
* 收入--服务类
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeService;
|
private BigDecimal incomeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购成本--设备类
|
* 采购成本--设备类
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseDevice;
|
private BigDecimal costPurchaseDevice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购成本--施工类
|
* 采购成本--施工类
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseBuild;
|
private BigDecimal costPurchaseBuild;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购成本--服务类
|
* 采购成本--服务类
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseService;
|
private BigDecimal costPurchaseService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购成本--其他
|
* 采购成本--其他
|
||||||
*/
|
*/
|
||||||
private BigDecimal costPurchaseOther;
|
private BigDecimal costPurchaseOther;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成本--其他
|
* 成本--其他
|
||||||
*/
|
*/
|
||||||
private BigDecimal costOtherOther;
|
private BigDecimal costOtherOther;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成本--项目管理成本
|
* 成本--项目管理成本
|
||||||
*/
|
*/
|
||||||
private BigDecimal costProjectManage;
|
private BigDecimal costProjectManage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 财务费用--资金占用成本
|
* 财务费用--资金占用成本
|
||||||
*/
|
*/
|
||||||
private BigDecimal costExpropriation;
|
private BigDecimal costExpropriation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司管理费用
|
* 公司管理费用
|
||||||
*/
|
*/
|
||||||
private BigDecimal costCompanyManage;
|
private BigDecimal costCompanyManage;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,80 +1,80 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 损益表数据
|
* 损益表数据
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class ProfitAndLossBean {
|
public class ProfitAndLossBean {
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 营业收入
|
* 营业收入
|
||||||
*/
|
*/
|
||||||
private BigDecimal income;
|
private BigDecimal income;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 营业成本
|
* 营业成本
|
||||||
*/
|
*/
|
||||||
private BigDecimal cost;
|
private BigDecimal cost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目管理成本
|
* 项目管理成本
|
||||||
*/
|
*/
|
||||||
private BigDecimal manageCost;
|
private BigDecimal manageCost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他
|
* 其他
|
||||||
*/
|
*/
|
||||||
private BigDecimal other;
|
private BigDecimal other;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 财务费用
|
* 财务费用
|
||||||
*/
|
*/
|
||||||
private BigDecimal expropriation;
|
private BigDecimal expropriation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目毛利
|
* 项目毛利
|
||||||
*/
|
*/
|
||||||
private BigDecimal grossProfit;
|
private BigDecimal grossProfit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目毛利率
|
* 项目毛利率
|
||||||
*/
|
*/
|
||||||
private BigDecimal grossProfitProfit;
|
private BigDecimal grossProfitProfit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司管理费用
|
* 公司管理费用
|
||||||
*/
|
*/
|
||||||
private BigDecimal CompanyManage;
|
private BigDecimal CompanyManage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目贡献利润
|
* 项目贡献利润
|
||||||
*/
|
*/
|
||||||
private BigDecimal contributionMargin;
|
private BigDecimal contributionMargin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目贡献利润率
|
* 项目贡献利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal contributionMarginProfit;
|
private BigDecimal contributionMarginProfit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所得税费用
|
* 所得税费用
|
||||||
*/
|
*/
|
||||||
private BigDecimal incomeTax;
|
private BigDecimal incomeTax;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目净利润
|
* 项目净利润
|
||||||
*/
|
*/
|
||||||
private BigDecimal netMargin;
|
private BigDecimal netMargin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目净利润率
|
* 项目净利润率
|
||||||
*/
|
*/
|
||||||
private BigDecimal netMarginProfit;
|
private BigDecimal netMarginProfit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,34 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目相关的配置
|
* 项目相关的配置
|
||||||
* @author xiongshiyan at 2021/11/5 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/5 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public class ProjectConfigBean {
|
public class ProjectConfigBean {
|
||||||
/**
|
/**
|
||||||
* 资金利率
|
* 资金利率
|
||||||
*/
|
*/
|
||||||
private BigDecimal underwrittenTaxRate;
|
private BigDecimal underwrittenTaxRate;
|
||||||
/**
|
/**
|
||||||
* 项目贡献利润率阀值
|
* 项目贡献利润率阀值
|
||||||
*/
|
*/
|
||||||
private BigDecimal projectContributionProfitRateThreshold;
|
private BigDecimal projectContributionProfitRateThreshold;
|
||||||
|
|
||||||
public BigDecimal getUnderwrittenTaxRate() {
|
public BigDecimal getUnderwrittenTaxRate() {
|
||||||
return underwrittenTaxRate;
|
return underwrittenTaxRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUnderwrittenTaxRate(BigDecimal underwrittenTaxRate) {
|
public void setUnderwrittenTaxRate(BigDecimal underwrittenTaxRate) {
|
||||||
this.underwrittenTaxRate = underwrittenTaxRate;
|
this.underwrittenTaxRate = underwrittenTaxRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getProjectContributionProfitRateThreshold() {
|
public BigDecimal getProjectContributionProfitRateThreshold() {
|
||||||
return projectContributionProfitRateThreshold;
|
return projectContributionProfitRateThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectContributionProfitRateThreshold(BigDecimal projectContributionProfitRateThreshold) {
|
public void setProjectContributionProfitRateThreshold(BigDecimal projectContributionProfitRateThreshold) {
|
||||||
this.projectContributionProfitRateThreshold = projectContributionProfitRateThreshold;
|
this.projectContributionProfitRateThreshold = projectContributionProfitRateThreshold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,46 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目预算资金计划表统计信息
|
* 项目预算资金计划表统计信息
|
||||||
* @author xiongshiyan at 2021/11/5 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/5 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public class ProjectUnderwrittenPlanStatisticBean {
|
public class ProjectUnderwrittenPlanStatisticBean {
|
||||||
/**
|
/**
|
||||||
* 峰值月份
|
* 峰值月份
|
||||||
*/
|
*/
|
||||||
private String maxMonth;
|
private String maxMonth;
|
||||||
/**
|
/**
|
||||||
* 峰值金额
|
* 峰值金额
|
||||||
*/
|
*/
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
/**
|
/**
|
||||||
* 资金利息
|
* 资金利息
|
||||||
*/
|
*/
|
||||||
private BigDecimal capitalInterest;
|
private BigDecimal capitalInterest;
|
||||||
|
|
||||||
public String getMaxMonth() {
|
public String getMaxMonth() {
|
||||||
return maxMonth;
|
return maxMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxMonth(String maxMonth) {
|
public void setMaxMonth(String maxMonth) {
|
||||||
this.maxMonth = maxMonth;
|
this.maxMonth = maxMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getAmount() {
|
public BigDecimal getAmount() {
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAmount(BigDecimal amount) {
|
public void setAmount(BigDecimal amount) {
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getCapitalInterest() {
|
public BigDecimal getCapitalInterest() {
|
||||||
return capitalInterest;
|
return capitalInterest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCapitalInterest(BigDecimal capitalInterest) {
|
public void setCapitalInterest(BigDecimal capitalInterest) {
|
||||||
this.capitalInterest = capitalInterest;
|
this.capitalInterest = capitalInterest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
public interface RegexConstant {
|
public interface RegexConstant {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号校验正则
|
* 手机号校验正则
|
||||||
*/
|
*/
|
||||||
String REGEX = "^1[0-9][0-9]\\d{8}$";
|
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\\-\\._\\?\\,\\'/\\\\\\+&%\\$#\\=~])*)$";
|
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\\-\\._\\?\\,\\'/\\\\\\+&%\\$#\\=~])*)$";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,48 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public enum ResolvePlanEnum {
|
public enum ResolvePlanEnum {
|
||||||
PLAN_O(-1,""),
|
PLAN_O(-1,""),
|
||||||
PLAN_A(1,"公共服务(智慧交通、雪亮工程、治安防控体系等)"),
|
PLAN_A(1,"公共服务(智慧交通、雪亮工程、治安防控体系等)"),
|
||||||
PLAN_B(2,"泛行业(智慧园区、智慧医疗、智慧工地等)"),
|
PLAN_B(2,"泛行业(智慧园区、智慧医疗、智慧工地等)"),
|
||||||
PLAN_C(3,"其他生态");
|
PLAN_C(3,"其他生态");
|
||||||
|
|
||||||
private int resolvePlan;
|
private int resolvePlan;
|
||||||
private String resolvePlanStr;
|
private String resolvePlanStr;
|
||||||
|
|
||||||
private ResolvePlanEnum(int resolvePlan, String resolvePlanStr) {
|
private ResolvePlanEnum(int resolvePlan, String resolvePlanStr) {
|
||||||
this.resolvePlan = resolvePlan;
|
this.resolvePlan = resolvePlan;
|
||||||
this.resolvePlanStr = resolvePlanStr;
|
this.resolvePlanStr = resolvePlanStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getResolvePlan() {
|
public int getResolvePlan() {
|
||||||
return resolvePlan;
|
return resolvePlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResolvePlan(int resolvePlan) {
|
public void setResolvePlan(int resolvePlan) {
|
||||||
this.resolvePlan = resolvePlan;
|
this.resolvePlan = resolvePlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResolvePlanStr() {
|
public String getResolvePlanStr() {
|
||||||
return resolvePlanStr;
|
return resolvePlanStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResolvePlanStr(String resolvePlanStr) {
|
public void setResolvePlanStr(String resolvePlanStr) {
|
||||||
this.resolvePlanStr = resolvePlanStr;
|
this.resolvePlanStr = resolvePlanStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResolvePlanEnum parseResolvePlan(int resolvePlan){
|
public static ResolvePlanEnum parseResolvePlan(int resolvePlan){
|
||||||
if(resolvePlan == 1){
|
if(resolvePlan == 1){
|
||||||
return PLAN_A;
|
return PLAN_A;
|
||||||
}
|
}
|
||||||
if(resolvePlan == 2){
|
if(resolvePlan == 2){
|
||||||
return PLAN_B;
|
return PLAN_B;
|
||||||
}
|
}
|
||||||
if(resolvePlan == 3){
|
if(resolvePlan == 3){
|
||||||
return PLAN_C;
|
return PLAN_C;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unkown resolvePlan:"+resolvePlan);
|
throw new IllegalArgumentException("Unkown resolvePlan:"+resolvePlan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,88 +1,88 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.config.Constant;
|
import cn.palmte.work.config.Constant;
|
||||||
|
|
||||||
|
|
||||||
public class ResponseMsg {
|
public class ResponseMsg {
|
||||||
private int status;
|
private int status;
|
||||||
private String msg;
|
private String msg;
|
||||||
private Object data;
|
private Object data;
|
||||||
|
|
||||||
public ResponseMsg() {
|
public ResponseMsg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseMsg(int status, String msg) {
|
public ResponseMsg(int status, String msg) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseMsg buildSuccessMsg(String msg) {
|
public static ResponseMsg buildSuccessMsg(String msg) {
|
||||||
return new ResponseMsg(Constant.Status.STATUS_SUCCESS, msg);
|
return new ResponseMsg(Constant.Status.STATUS_SUCCESS, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseMsg buildSuccessData(Object data) {
|
public static ResponseMsg buildSuccessData(Object data) {
|
||||||
return buildSuccessMsg("ok", data);
|
return buildSuccessMsg("ok", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseMsg buildSuccessMsg(String msg, Object data) {
|
public static ResponseMsg buildSuccessMsg(String msg, Object data) {
|
||||||
ResponseMsg responseMsg = new ResponseMsg(Constant.Status.STATUS_SUCCESS, msg);
|
ResponseMsg responseMsg = new ResponseMsg(Constant.Status.STATUS_SUCCESS, msg);
|
||||||
responseMsg.setData(data);
|
responseMsg.setData(data);
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseMsg buildMsg(int status, String msg, Object data) {
|
public static ResponseMsg buildMsg(int status, String msg, Object data) {
|
||||||
ResponseMsg responseMsg = new ResponseMsg(status, msg);
|
ResponseMsg responseMsg = new ResponseMsg(status, msg);
|
||||||
responseMsg.setData(data);
|
responseMsg.setData(data);
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseMsg buildFailedMsg(String msg) {
|
public static ResponseMsg buildFailedMsg(String msg) {
|
||||||
return new ResponseMsg(Constant.Status.STATUS_FAILED, msg);
|
return new ResponseMsg(Constant.Status.STATUS_FAILED, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseMsg buildFailedMsg(String msg, Object data) {
|
public static ResponseMsg buildFailedMsg(String msg, Object data) {
|
||||||
ResponseMsg responseMsg = new ResponseMsg(Constant.Status.STATUS_FAILED, msg);
|
ResponseMsg responseMsg = new ResponseMsg(Constant.Status.STATUS_FAILED, msg);
|
||||||
responseMsg.setData(data);
|
responseMsg.setData(data);
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStatus() {
|
public int getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(int status) {
|
public void setStatus(int status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMsg() {
|
public String getMsg() {
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMsg(String msg) {
|
public void setMsg(String msg) {
|
||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getData() {
|
public Object getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(Object data) {
|
public void setData(Object data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isSuccess() {
|
public boolean isSuccess() {
|
||||||
return Constant.Status.STATUS_SUCCESS == this.status;
|
return Constant.Status.STATUS_SUCCESS == this.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ResponseMsg{" +
|
return "ResponseMsg{" +
|
||||||
"status=" + status +
|
"status=" + status +
|
||||||
", msg='" + msg + '\'' +
|
", msg='" + msg + '\'' +
|
||||||
", data=" + data +
|
", data=" + data +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,44 +1,44 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public enum SignTypeEnum {
|
public enum SignTypeEnum {
|
||||||
PLAN_O(-1,""),
|
PLAN_O(-1,""),
|
||||||
PLAN_A(1,"是"),
|
PLAN_A(1,"是"),
|
||||||
PLAN_B(2,"否");
|
PLAN_B(2,"否");
|
||||||
|
|
||||||
private int signType;
|
private int signType;
|
||||||
private String signTypeStr;
|
private String signTypeStr;
|
||||||
|
|
||||||
private SignTypeEnum(int signType, String signTypeStr) {
|
private SignTypeEnum(int signType, String signTypeStr) {
|
||||||
this.signType = signType;
|
this.signType = signType;
|
||||||
this.signTypeStr = signTypeStr;
|
this.signTypeStr = signTypeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSignType() {
|
public int getSignType() {
|
||||||
return signType;
|
return signType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSignType(int signType) {
|
public void setSignType(int signType) {
|
||||||
this.signType = signType;
|
this.signType = signType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSignTypeStr() {
|
public String getSignTypeStr() {
|
||||||
return signTypeStr;
|
return signTypeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSignTypeStr(String signTypeStr) {
|
public void setSignTypeStr(String signTypeStr) {
|
||||||
this.signTypeStr = signTypeStr;
|
this.signTypeStr = signTypeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SignTypeEnum parseSignType(int signType){
|
public static SignTypeEnum parseSignType(int signType){
|
||||||
if(signType == 1){
|
if(signType == 1){
|
||||||
return PLAN_A;
|
return PLAN_A;
|
||||||
}
|
}
|
||||||
if(signType == 2){
|
if(signType == 2){
|
||||||
return PLAN_B;
|
return PLAN_B;
|
||||||
}
|
}
|
||||||
return PLAN_O;
|
return PLAN_O;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class StatisticsBean {
|
public class StatisticsBean {
|
||||||
|
|
||||||
private List<PrimaryIndicatorBean> primaryIndicatorBeanList;
|
private List<PrimaryIndicatorBean> primaryIndicatorBeanList;
|
||||||
|
|
||||||
private List<ProfitAndLossBean> profitAndLossBeanList;
|
private List<ProfitAndLossBean> profitAndLossBeanList;
|
||||||
|
|
||||||
private List<CashFlowStatisticsBean> cashFlowStatisticsBeanList;
|
private List<CashFlowStatisticsBean> cashFlowStatisticsBeanList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,70 +1,70 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public enum StatusEnum {
|
public enum StatusEnum {
|
||||||
ESTIMATE_ACCOUNTS(1,"项目创建(概算)"),
|
ESTIMATE_ACCOUNTS(1,"项目创建(概算)"),
|
||||||
BUDGET_ACCOUNTS(5,"预算"),
|
BUDGET_ACCOUNTS(5,"预算"),
|
||||||
SETTLE_ACCOUNTS(10,"结算"),
|
SETTLE_ACCOUNTS(10,"结算"),
|
||||||
FINAL_ACCOUNTS(15,"决算");
|
FINAL_ACCOUNTS(15,"决算");
|
||||||
|
|
||||||
private int status;
|
private int status;
|
||||||
private String statusDesc;
|
private String statusDesc;
|
||||||
|
|
||||||
private StatusEnum(int status, String statusDesc) {
|
private StatusEnum(int status, String statusDesc) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.statusDesc = statusDesc;
|
this.statusDesc = statusDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStatus() {
|
public int getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(int status) {
|
public void setStatus(int status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatusDesc() {
|
public String getStatusDesc() {
|
||||||
return statusDesc;
|
return statusDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatusDesc(String statusDesc) {
|
public void setStatusDesc(String statusDesc) {
|
||||||
this.statusDesc = statusDesc;
|
this.statusDesc = statusDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StatusEnum parseStatus(int status){
|
public static StatusEnum parseStatus(int status){
|
||||||
if(status == 1){
|
if(status == 1){
|
||||||
return ESTIMATE_ACCOUNTS;
|
return ESTIMATE_ACCOUNTS;
|
||||||
}
|
}
|
||||||
if(status == 5){
|
if(status == 5){
|
||||||
return BUDGET_ACCOUNTS;
|
return BUDGET_ACCOUNTS;
|
||||||
}
|
}
|
||||||
if(status == 10){
|
if(status == 10){
|
||||||
return SETTLE_ACCOUNTS;
|
return SETTLE_ACCOUNTS;
|
||||||
}
|
}
|
||||||
if(status == 15){
|
if(status == 15){
|
||||||
return FINAL_ACCOUNTS;
|
return FINAL_ACCOUNTS;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unkown status:"+status);
|
throw new IllegalArgumentException("Unkown status:"+status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static StatusEnum parseByProcDefId(String proDefId){
|
public static StatusEnum parseByProcDefId(String proDefId){
|
||||||
if(proDefId.startsWith(ActProcessKeyEnum.ESTIMATE.getKey())){
|
if(proDefId.startsWith(ActProcessKeyEnum.ESTIMATE.getKey())){
|
||||||
return ESTIMATE_ACCOUNTS;
|
return ESTIMATE_ACCOUNTS;
|
||||||
}
|
}
|
||||||
if(proDefId.startsWith(ActProcessKeyEnum.BUDGET.getKey())){
|
if(proDefId.startsWith(ActProcessKeyEnum.BUDGET.getKey())){
|
||||||
return BUDGET_ACCOUNTS;
|
return BUDGET_ACCOUNTS;
|
||||||
}
|
}
|
||||||
if(proDefId.startsWith(ActProcessKeyEnum.SETTLE.getKey())){
|
if(proDefId.startsWith(ActProcessKeyEnum.SETTLE.getKey())){
|
||||||
return SETTLE_ACCOUNTS;
|
return SETTLE_ACCOUNTS;
|
||||||
}
|
}
|
||||||
if(proDefId.startsWith(ActProcessKeyEnum.FINAL.getKey())){
|
if(proDefId.startsWith(ActProcessKeyEnum.FINAL.getKey())){
|
||||||
return FINAL_ACCOUNTS;
|
return FINAL_ACCOUNTS;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unkown proDefId:"+ proDefId);
|
throw new IllegalArgumentException("Unkown proDefId:"+ proDefId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,47 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public enum TypeEnum {
|
public enum TypeEnum {
|
||||||
PROJECT_INTEGRATION(1,"工程集成类"),
|
PROJECT_INTEGRATION(1,"工程集成类"),
|
||||||
DEVICE_INTEGRATION(2,"设备集成类"),
|
DEVICE_INTEGRATION(2,"设备集成类"),
|
||||||
STRATEGIC_PARTNER(3,"工程集成类");
|
STRATEGIC_PARTNER(3,"工程集成类");
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
private String typeDesc;
|
private String typeDesc;
|
||||||
|
|
||||||
private TypeEnum(int type, String typeDesc) {
|
private TypeEnum(int type, String typeDesc) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.typeDesc = typeDesc;
|
this.typeDesc = typeDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(int type) {
|
public void setType(int type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTypeDesc() {
|
public String getTypeDesc() {
|
||||||
return typeDesc;
|
return typeDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTypeDesc(String typeDesc) {
|
public void setTypeDesc(String typeDesc) {
|
||||||
this.typeDesc = typeDesc;
|
this.typeDesc = typeDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TypeEnum parseType(int type){
|
public static TypeEnum parseType(int type){
|
||||||
if(type == 1){
|
if(type == 1){
|
||||||
return PROJECT_INTEGRATION;
|
return PROJECT_INTEGRATION;
|
||||||
}
|
}
|
||||||
if(type == 2){
|
if(type == 2){
|
||||||
return DEVICE_INTEGRATION;
|
return DEVICE_INTEGRATION;
|
||||||
}
|
}
|
||||||
if(type == 3){
|
if(type == 3){
|
||||||
return STRATEGIC_PARTNER;
|
return STRATEGIC_PARTNER;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unkown type:"+type);
|
throw new IllegalArgumentException("Unkown type:"+type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,52 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public enum UnderwrittenModeEnum {
|
public enum UnderwrittenModeEnum {
|
||||||
PLAN_O(-1,""),
|
PLAN_O(-1,""),
|
||||||
PLAN_A(1,"A类-不垫资"),
|
PLAN_A(1,"不垫资"),
|
||||||
// PLAN_B(2,"B类-不垫资(背靠背)"),
|
// PLAN_B(2,"不垫资(背靠背)"),
|
||||||
PLAN_C(3,"B类-垫资(账期覆盖)"),
|
PLAN_C(3,"垫资(账期覆盖)"),
|
||||||
PLAN_D(4,"C类-垫资(账期不覆盖)");
|
PLAN_D(4,"垫资(账期不覆盖)");
|
||||||
|
|
||||||
private int underwrittenMode;
|
private int underwrittenMode;
|
||||||
private String underwrittenModeStr;
|
private String underwrittenModeStr;
|
||||||
|
|
||||||
private UnderwrittenModeEnum(int underwrittenMode, String underwrittenModeStr) {
|
private UnderwrittenModeEnum(int underwrittenMode, String underwrittenModeStr) {
|
||||||
this.underwrittenMode = underwrittenMode;
|
this.underwrittenMode = underwrittenMode;
|
||||||
this.underwrittenModeStr = underwrittenModeStr;
|
this.underwrittenModeStr = underwrittenModeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUnderwrittenMode() {
|
public int getUnderwrittenMode() {
|
||||||
return underwrittenMode;
|
return underwrittenMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUnderwrittenMode(int underwrittenMode) {
|
public void setUnderwrittenMode(int underwrittenMode) {
|
||||||
this.underwrittenMode = underwrittenMode;
|
this.underwrittenMode = underwrittenMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnderwrittenModeStr() {
|
public String getUnderwrittenModeStr() {
|
||||||
return underwrittenModeStr;
|
return underwrittenModeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUnderwrittenModeStr(String underwrittenModeStr) {
|
public void setUnderwrittenModeStr(String underwrittenModeStr) {
|
||||||
this.underwrittenModeStr = underwrittenModeStr;
|
this.underwrittenModeStr = underwrittenModeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UnderwrittenModeEnum parseUnderwrittenMode(int underwrittenMode){
|
public static UnderwrittenModeEnum parseUnderwrittenMode(int underwrittenMode){
|
||||||
if(underwrittenMode == 1){
|
if(underwrittenMode == 1){
|
||||||
return PLAN_A;
|
return PLAN_A;
|
||||||
}
|
}
|
||||||
// if(underwrittenMode == 2){
|
// if(underwrittenMode == 2){
|
||||||
// return PLAN_B;
|
// return PLAN_B;
|
||||||
// }
|
// }
|
||||||
if(underwrittenMode == 3){
|
if(underwrittenMode == 3){
|
||||||
return PLAN_C;
|
return PLAN_C;
|
||||||
}
|
}
|
||||||
if(underwrittenMode == 4){
|
if(underwrittenMode == 4){
|
||||||
return PLAN_D;
|
return PLAN_D;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unkown underwrittenMode:"+underwrittenMode);
|
throw new IllegalArgumentException("Unkown underwrittenMode:"+underwrittenMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,67 +1,67 @@
|
||||||
package cn.palmte.work.bean;
|
package cn.palmte.work.bean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* { id:2, pId:0, name:"随意勾选 2", checked:true, open:true},
|
* { 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
|
* @author xiongshiyan at 2021/11/18 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
public class ZTreeNode {
|
public class ZTreeNode {
|
||||||
private String id;
|
private String id;
|
||||||
private String pId;
|
private String pId;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean checked = false;
|
private boolean checked = false;
|
||||||
private boolean open = false;
|
private boolean open = false;
|
||||||
|
|
||||||
public ZTreeNode(String id, String pId, String name, boolean checked, boolean open) {
|
public ZTreeNode(String id, String pId, String name, boolean checked, boolean open) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.pId = pId;
|
this.pId = pId;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.checked = checked;
|
this.checked = checked;
|
||||||
this.open = open;
|
this.open = open;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZTreeNode(String id, String pId, String name) {
|
public ZTreeNode(String id, String pId, String name) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.pId = pId;
|
this.pId = pId;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getpId() {
|
public String getpId() {
|
||||||
return pId;
|
return pId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setpId(String pId) {
|
public void setpId(String pId) {
|
||||||
this.pId = pId;
|
this.pId = pId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChecked() {
|
public boolean isChecked() {
|
||||||
return checked;
|
return checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChecked(boolean checked) {
|
public void setChecked(boolean checked) {
|
||||||
this.checked = checked;
|
this.checked = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOpen() {
|
public boolean isOpen() {
|
||||||
return open;
|
return open;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOpen(boolean open) {
|
public void setOpen(boolean open) {
|
||||||
this.open = open;
|
this.open = open;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,177 +1,177 @@
|
||||||
package cn.palmte.work.config;
|
package cn.palmte.work.config;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
import org.springframework.dao.DataAccessResourceFailureException;
|
import org.springframework.dao.DataAccessResourceFailureException;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||||
import org.springframework.http.converter.HttpMessageNotWritableException;
|
import org.springframework.http.converter.HttpMessageNotWritableException;
|
||||||
import org.springframework.transaction.TransactionSystemException;
|
import org.springframework.transaction.TransactionSystemException;
|
||||||
import org.springframework.validation.BindException;
|
import org.springframework.validation.BindException;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.validation.FieldError;
|
import org.springframework.validation.FieldError;
|
||||||
import org.springframework.validation.ObjectError;
|
import org.springframework.validation.ObjectError;
|
||||||
import org.springframework.web.HttpMediaTypeNotSupportedException;
|
import org.springframework.web.HttpMediaTypeNotSupportedException;
|
||||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||||
import org.springframework.web.bind.MissingServletRequestParameterException;
|
import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||||
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||||
import org.springframework.web.multipart.MultipartException;
|
import org.springframework.web.multipart.MultipartException;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import cn.palmte.work.ErrorMessage;
|
import cn.palmte.work.ErrorMessage;
|
||||||
import cn.palmte.work.ErrorMessageException;
|
import cn.palmte.work.ErrorMessageException;
|
||||||
import cn.palmte.work.Json;
|
import cn.palmte.work.Json;
|
||||||
import cn.palmte.work.Result;
|
import cn.palmte.work.Result;
|
||||||
import cn.palmte.work.ValidationError;
|
import cn.palmte.work.ValidationError;
|
||||||
import cn.palmte.work.controller.backend.ProcessController;
|
import cn.palmte.work.controller.backend.ProcessController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异常处理
|
* 异常处理
|
||||||
*
|
*
|
||||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||||
* @since 2.0 2022/12/30 15:24
|
* @since 2.0 2022/12/30 15:24
|
||||||
*/
|
*/
|
||||||
@RestControllerAdvice(assignableTypes = ProcessController.class)
|
@RestControllerAdvice(assignableTypes = ProcessController.class)
|
||||||
public class ApplicationExceptionHandler {
|
public class ApplicationExceptionHandler {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ApplicationExceptionHandler.class);
|
private static final Logger log = LoggerFactory.getLogger(ApplicationExceptionHandler.class);
|
||||||
|
|
||||||
public static final ErrorMessage argsErrorMessage = ErrorMessage.failed("参数错误");
|
public static final ErrorMessage argsErrorMessage = ErrorMessage.failed("参数错误");
|
||||||
public static final ErrorMessage sizeExceeded = ErrorMessage.failed("上传文件大小超出限制");
|
public static final ErrorMessage sizeExceeded = ErrorMessage.failed("上传文件大小超出限制");
|
||||||
public static final ErrorMessage methodNotSupported = ErrorMessage.failed("请求方式不支持");
|
public static final ErrorMessage methodNotSupported = ErrorMessage.failed("请求方式不支持");
|
||||||
public static final ErrorMessage internalServerError = ErrorMessage.failed("服务器内部异常");
|
public static final ErrorMessage internalServerError = ErrorMessage.failed("服务器内部异常");
|
||||||
public static final ErrorMessage notWritableError = ErrorMessage.failed("数据无法正常返回到客户端");
|
public static final ErrorMessage notWritableError = ErrorMessage.failed("数据无法正常返回到客户端");
|
||||||
|
|
||||||
@ExceptionHandler(ErrorMessageException.class)
|
@ExceptionHandler(ErrorMessageException.class)
|
||||||
public ResponseEntity<ErrorMessage> errorMessage(ErrorMessageException errorMessage) {
|
public ResponseEntity<ErrorMessage> errorMessage(ErrorMessageException errorMessage) {
|
||||||
HttpStatus httpStatus = errorMessage.getStatus();
|
HttpStatus httpStatus = errorMessage.getStatus();
|
||||||
return ResponseEntity.status(httpStatus)
|
return ResponseEntity.status(httpStatus)
|
||||||
.body(ErrorMessage.failed(errorMessage.getMessage()));
|
.body(ErrorMessage.failed(errorMessage.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
@ExceptionHandler(IllegalArgumentException.class)
|
@ExceptionHandler(IllegalArgumentException.class)
|
||||||
public ErrorMessage badRequest(IllegalArgumentException exception) {
|
public ErrorMessage badRequest(IllegalArgumentException exception) {
|
||||||
return ErrorMessage.failed(exception.getMessage());
|
return ErrorMessage.failed(exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
@ExceptionHandler({ MaxUploadSizeExceededException.class })
|
@ExceptionHandler({ MaxUploadSizeExceededException.class })
|
||||||
public ErrorMessage badRequest() {
|
public ErrorMessage badRequest() {
|
||||||
return sizeExceeded;
|
return sizeExceeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||||
public ErrorMessage methodNotSupported() {
|
public ErrorMessage methodNotSupported() {
|
||||||
return methodNotSupported;
|
return methodNotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler
|
@ExceptionHandler
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
public ErrorMessage error(Exception exception) {
|
public ErrorMessage error(Exception exception) {
|
||||||
log.error("An Exception occurred", exception);
|
log.error("An Exception occurred", exception);
|
||||||
if (exception instanceof SQLException) {
|
if (exception instanceof SQLException) {
|
||||||
return internalServerError;
|
return internalServerError;
|
||||||
}
|
}
|
||||||
if (exception instanceof HttpMessageNotWritableException) {
|
if (exception instanceof HttpMessageNotWritableException) {
|
||||||
return notWritableError;
|
return notWritableError;
|
||||||
}
|
}
|
||||||
if (exception instanceof TransactionSystemException) {
|
if (exception instanceof TransactionSystemException) {
|
||||||
return ErrorMessage.failed("数据库出错");
|
return ErrorMessage.failed("数据库出错");
|
||||||
}
|
}
|
||||||
return ErrorMessage.failed(exception.getMessage());
|
return ErrorMessage.failed(exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
|
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
|
||||||
public ErrorMessage typeMismatch(MethodArgumentTypeMismatchException mismatch) {
|
public ErrorMessage typeMismatch(MethodArgumentTypeMismatchException mismatch) {
|
||||||
return ErrorMessage.failed("参数'" + mismatch.getName() + "'不能转换到对应类型");
|
return ErrorMessage.failed("参数'" + mismatch.getName() + "'不能转换到对应类型");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
@ExceptionHandler(MissingServletRequestParameterException.class)
|
@ExceptionHandler(MissingServletRequestParameterException.class)
|
||||||
public ErrorMessage parameterError(MissingServletRequestParameterException e) {
|
public ErrorMessage parameterError(MissingServletRequestParameterException e) {
|
||||||
return ErrorMessage.failed("缺少参数'" + e.getParameterName() + "'");
|
return ErrorMessage.failed("缺少参数'" + e.getParameterName() + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
@ExceptionHandler({
|
@ExceptionHandler({
|
||||||
MultipartException.class,
|
MultipartException.class,
|
||||||
HttpMessageNotReadableException.class,
|
HttpMessageNotReadableException.class,
|
||||||
HttpMediaTypeNotSupportedException.class
|
HttpMediaTypeNotSupportedException.class
|
||||||
})
|
})
|
||||||
public ErrorMessage messageNotReadable() {
|
public ErrorMessage messageNotReadable() {
|
||||||
return argsErrorMessage;
|
return argsErrorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
@ExceptionHandler({ BindException.class, MethodArgumentNotValidException.class })
|
@ExceptionHandler({ BindException.class, MethodArgumentNotValidException.class })
|
||||||
public Result validExceptionHandler(Exception e) {
|
public Result validExceptionHandler(Exception e) {
|
||||||
|
|
||||||
BindingResult result;
|
BindingResult result;
|
||||||
if (e instanceof MethodArgumentNotValidException) {
|
if (e instanceof MethodArgumentNotValidException) {
|
||||||
result = ((MethodArgumentNotValidException) e).getBindingResult();
|
result = ((MethodArgumentNotValidException) e).getBindingResult();
|
||||||
}
|
}
|
||||||
else if (e instanceof BindException) {
|
else if (e instanceof BindException) {
|
||||||
result = (BindingResult) e;
|
result = (BindingResult) e;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return ErrorMessage.failed();
|
return ErrorMessage.failed();
|
||||||
}
|
}
|
||||||
List<ObjectError> allErrors = result.getAllErrors();
|
List<ObjectError> allErrors = result.getAllErrors();
|
||||||
Map<String, String> model = new HashMap<>(16);
|
Map<String, String> model = new HashMap<>(16);
|
||||||
|
|
||||||
for (ObjectError error : allErrors) {
|
for (ObjectError error : allErrors) {
|
||||||
if (error instanceof FieldError) {
|
if (error instanceof FieldError) {
|
||||||
FieldError fieldError = (FieldError) error;
|
FieldError fieldError = (FieldError) error;
|
||||||
String field = fieldError.getField();
|
String field = fieldError.getField();
|
||||||
String defaultMessage = error.getDefaultMessage();
|
String defaultMessage = error.getDefaultMessage();
|
||||||
model.put(field, defaultMessage);
|
model.put(field, defaultMessage);
|
||||||
// log.error("[{}] -> [{}]", field, defaultMessage);
|
// log.error("[{}] -> [{}]", field, defaultMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ValidationError.failed(model);
|
return ValidationError.failed(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(NullPointerException.class)
|
@ExceptionHandler(NullPointerException.class)
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
public Json nullPointer(NullPointerException exception) {
|
public Json nullPointer(NullPointerException exception) {
|
||||||
log.error("An Exception occurred", exception);
|
log.error("An Exception occurred", exception);
|
||||||
final StackTraceElement[] stackTrace = exception.getStackTrace();
|
final StackTraceElement[] stackTrace = exception.getStackTrace();
|
||||||
if (ObjectUtils.isEmpty(stackTrace)) {
|
if (ObjectUtils.isEmpty(stackTrace)) {
|
||||||
return Json.failed("空指针", "暂无堆栈信息");
|
return Json.failed("空指针", "暂无堆栈信息");
|
||||||
}
|
}
|
||||||
return Json.failed("空指针", stackTrace[0]);
|
return Json.failed("空指针", stackTrace[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(DataAccessException.class)
|
@ExceptionHandler(DataAccessException.class)
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
public ErrorMessage dataAccessException(DataAccessException accessException) {
|
public ErrorMessage dataAccessException(DataAccessException accessException) {
|
||||||
String message = getDataAccessMessage(accessException.getCause());
|
String message = getDataAccessMessage(accessException.getCause());
|
||||||
log.error(message, accessException);
|
log.error(message, accessException);
|
||||||
return ErrorMessage.failed(message);
|
return ErrorMessage.failed(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getDataAccessMessage(Throwable cause) {
|
String getDataAccessMessage(Throwable cause) {
|
||||||
return "数据库出错";
|
return "数据库出错";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
@ExceptionHandler(DataAccessResourceFailureException.class)
|
@ExceptionHandler(DataAccessResourceFailureException.class)
|
||||||
public ErrorMessage dataAccessException(DataAccessResourceFailureException accessException) {
|
public ErrorMessage dataAccessException(DataAccessResourceFailureException accessException) {
|
||||||
log.error("数据库连接出错", accessException);
|
log.error("数据库连接出错", accessException);
|
||||||
return ErrorMessage.failed("数据库连接出错");
|
return ErrorMessage.failed("数据库连接出错");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,44 @@
|
||||||
package cn.palmte.work.config;
|
package cn.palmte.work.config;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注入配置属性
|
* 注入配置属性
|
||||||
*
|
*
|
||||||
* @author pengqiang
|
* @author pengqiang
|
||||||
* @date 2018/6/26
|
* @date 2018/6/26
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class ConfigProperties {
|
public class ConfigProperties {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传路径
|
* 上传路径
|
||||||
*/
|
*/
|
||||||
//@Value("${upload.path}")
|
//@Value("${upload.path}")
|
||||||
private String uploadPath = "/mnt/dzg/image";
|
private String uploadPath = "/mnt/dzg/image";
|
||||||
/**
|
/**
|
||||||
* 上传前缀
|
* 上传前缀
|
||||||
*/
|
*/
|
||||||
//@Value("${upload.prefix}")
|
//@Value("${upload.prefix}")
|
||||||
private String uploadPrefix = "/upload";
|
private String uploadPrefix = "/upload";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* admin服务器域名
|
* admin服务器域名
|
||||||
* 格式: https://dzgtest.palmte.cn
|
* 格式: https://dzgtest.palmte.cn
|
||||||
*/
|
*/
|
||||||
//@Value("${admin.domain}")
|
//@Value("${admin.domain}")
|
||||||
private String adminDomain = "";
|
private String adminDomain = "";
|
||||||
|
|
||||||
public String getUploadPath() {
|
public String getUploadPath() {
|
||||||
return uploadPath;
|
return uploadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUploadPrefix() {
|
public String getUploadPrefix() {
|
||||||
return uploadPrefix;
|
return uploadPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdminDomain() {
|
public String getAdminDomain() {
|
||||||
return adminDomain;
|
return adminDomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,62 +1,62 @@
|
||||||
package cn.palmte.work.config;
|
package cn.palmte.work.config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源等信息常量化
|
* 数据源等信息常量化
|
||||||
* @author xiongshiyan
|
* @author xiongshiyan
|
||||||
*/
|
*/
|
||||||
public class Constant {
|
public class Constant {
|
||||||
public static final String PAGINATION = "pagination";
|
public static final String PAGINATION = "pagination";
|
||||||
public static final String PRIVATEKEY = "privatekey";
|
public static final String PRIVATEKEY = "privatekey";
|
||||||
public static final String PUBLICKEY = "publickey";
|
public static final String PUBLICKEY = "publickey";
|
||||||
public static final String HEADER_TOKEN = "token";
|
public static final String HEADER_TOKEN = "token";
|
||||||
public static final String API_TOKEN_MANAGER = "apiTokenManager";
|
public static final String API_TOKEN_MANAGER = "apiTokenManager";
|
||||||
public static final String PC_TOKEN_MANAGER = "pcTokenManager";
|
public static final String PC_TOKEN_MANAGER = "pcTokenManager";
|
||||||
public static final String API_ERROR_COUNT_MANAGER = "apiErrorCountManager";
|
public static final String API_ERROR_COUNT_MANAGER = "apiErrorCountManager";
|
||||||
public static final String PC_ERROR_COUNT_MANAGER = "pcErrorCountManager";
|
public static final String PC_ERROR_COUNT_MANAGER = "pcErrorCountManager";
|
||||||
public static final String API_CAPTCHA_MANGER = "apiCaptchaManger";
|
public static final String API_CAPTCHA_MANGER = "apiCaptchaManger";
|
||||||
public static final String PC_CAPTCHA_MANGER = "pcCaptchaManger";
|
public static final String PC_CAPTCHA_MANGER = "pcCaptchaManger";
|
||||||
|
|
||||||
public static final String PREFIX_API_V3 = "/api/v3";
|
public static final String PREFIX_API_V3 = "/api/v3";
|
||||||
public static final String PREFIX_API_PC = "/api/pc";
|
public static final String PREFIX_API_PC = "/api/pc";
|
||||||
public static final String PREFIX_API_DRAG = "/api/drag";
|
public static final String PREFIX_API_DRAG = "/api/drag";
|
||||||
|
|
||||||
private Constant() {
|
private Constant() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全局状态码
|
* 全局状态码
|
||||||
*/
|
*/
|
||||||
public static final class Status {
|
public static final class Status {
|
||||||
private Status() {
|
private Status() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成功
|
* 成功
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_SUCCESS = 0;
|
public static final int STATUS_SUCCESS = 0;
|
||||||
/**
|
/**
|
||||||
* 失败
|
* 失败
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_FAILED = 1;
|
public static final int STATUS_FAILED = 1;
|
||||||
/**
|
/**
|
||||||
* 异常
|
* 异常
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_EXCEPTION = 2;
|
public static final int STATUS_EXCEPTION = 2;
|
||||||
/**
|
/**
|
||||||
* 提示登录
|
* 提示登录
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_PROMPT_LOGIN = 1009;
|
public static final int STATUS_PROMPT_LOGIN = 1009;
|
||||||
public static final int STATUS_PROMPT_UNAUTH = 1010;
|
public static final int STATUS_PROMPT_UNAUTH = 1010;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成功
|
* 成功
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_SUCCESS = 0;
|
public static final int STATUS_SUCCESS = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 失败
|
* 失败
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_FAILED = 1;
|
public static final int STATUS_FAILED = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,61 +1,61 @@
|
||||||
package cn.palmte.work.config;
|
package cn.palmte.work.config;
|
||||||
|
|
||||||
import cn.palmte.work.config.interceptor.TokenLoggingInterceptor;
|
import cn.palmte.work.config.interceptor.TokenLoggingInterceptor;
|
||||||
import cn.palmte.work.utils.StrKit;
|
import cn.palmte.work.utils.StrKit;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置拦截器等
|
* 配置拦截器等
|
||||||
* @author xiongshiyan
|
* @author xiongshiyan
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class GoodWebAppConfigurer extends WebMvcConfigurerAdapter {
|
public class GoodWebAppConfigurer extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TokenLoggingInterceptor tokenLoggingInterceptor;
|
private TokenLoggingInterceptor tokenLoggingInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排除某些url不需要校验
|
* 排除某些url不需要校验
|
||||||
*/
|
*/
|
||||||
@Value("${fourcal.excluded.client.urls}")
|
@Value("${fourcal.excluded.client.urls}")
|
||||||
private String excludesClientUrls;
|
private String excludesClientUrls;
|
||||||
@Value("${fourcal.excluded.pc.urls}")
|
@Value("${fourcal.excluded.pc.urls}")
|
||||||
private String excludesPCUrls;
|
private String excludesPCUrls;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
/**拦截任意URL,打印token header参数*/
|
/**拦截任意URL,打印token header参数*/
|
||||||
addInterceptor(registry , tokenLoggingInterceptor , "" , "/**");
|
addInterceptor(registry , tokenLoggingInterceptor , "" , "/**");
|
||||||
|
|
||||||
/**拦截所有排除指定的*/
|
/**拦截所有排除指定的*/
|
||||||
}
|
}
|
||||||
private void addInterceptor(InterceptorRegistry registry , HandlerInterceptor handlerInterceptor , String excludeUrls , String... addPartterns) {
|
private void addInterceptor(InterceptorRegistry registry , HandlerInterceptor handlerInterceptor , String excludeUrls , String... addPartterns) {
|
||||||
InterceptorRegistration registration = registry.addInterceptor(handlerInterceptor)
|
InterceptorRegistration registration = registry.addInterceptor(handlerInterceptor)
|
||||||
.addPathPatterns(addPartterns);
|
.addPathPatterns(addPartterns);
|
||||||
String[] p = excludeUrls.split(",");
|
String[] p = excludeUrls.split(",");
|
||||||
StrKit.trim(p);
|
StrKit.trim(p);
|
||||||
if( p.length > 0 ){
|
if( p.length > 0 ){
|
||||||
registration.excludePathPatterns(p);
|
registration.excludePathPatterns(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 允许跨域
|
* 允许跨域
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addCorsMappings(CorsRegistry registry) {
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
registry.addMapping("/**")
|
registry.addMapping("/**")
|
||||||
.allowedHeaders("*")
|
.allowedHeaders("*")
|
||||||
.allowedOrigins("*")
|
.allowedOrigins("*")
|
||||||
.allowedMethods("GET", "POST", "DELETE", "PUT", "OPTIONS")
|
.allowedMethods("GET", "POST", "DELETE", "PUT", "OPTIONS")
|
||||||
.allowCredentials(false).maxAge(3600);
|
.allowCredentials(false).maxAge(3600);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,40 +1,40 @@
|
||||||
package cn.palmte.work.config;
|
package cn.palmte.work.config;
|
||||||
|
|
||||||
import cn.palmte.work.security.ReplaceSpecialCharFilter;
|
import cn.palmte.work.security.ReplaceSpecialCharFilter;
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import top.jfunc.http.SmartHttpClient;
|
import top.jfunc.http.SmartHttpClient;
|
||||||
import top.jfunc.http.smart.JdkSmartHttpClient;
|
import top.jfunc.http.smart.JdkSmartHttpClient;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2020/9/30 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2020/9/30 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class HttpConfig {
|
public class HttpConfig {
|
||||||
@Bean
|
@Bean
|
||||||
public SmartHttpClient smartHttpClient(){
|
public SmartHttpClient smartHttpClient(){
|
||||||
return new JdkSmartHttpClient();
|
return new JdkSmartHttpClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xss过滤拦截器
|
* xss过滤拦截器
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public FilterRegistrationBean xssFilterRegistrationBean() {
|
public FilterRegistrationBean xssFilterRegistrationBean() {
|
||||||
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
|
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
|
||||||
filterRegistrationBean.setFilter(new ReplaceSpecialCharFilter());
|
filterRegistrationBean.setFilter(new ReplaceSpecialCharFilter());
|
||||||
filterRegistrationBean.setOrder(1);
|
filterRegistrationBean.setOrder(1);
|
||||||
filterRegistrationBean.setEnabled(true);
|
filterRegistrationBean.setEnabled(true);
|
||||||
filterRegistrationBean.addUrlPatterns("/*");
|
filterRegistrationBean.addUrlPatterns("/*");
|
||||||
Map<String, String> initParameters = new HashMap<>();
|
Map<String, String> initParameters = new HashMap<>();
|
||||||
initParameters.put("includes", "/fourcal/admin/err");
|
initParameters.put("includes", "/fourcal/admin/err");
|
||||||
filterRegistrationBean.setInitParameters(initParameters);
|
filterRegistrationBean.setInitParameters(initParameters);
|
||||||
return filterRegistrationBean;
|
return filterRegistrationBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,33 @@
|
||||||
package cn.palmte.work.config;
|
package cn.palmte.work.config;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import top.jfunc.common.db.utils.Pagination;
|
import top.jfunc.common.db.utils.Pagination;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2018/7/23 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2018/7/23 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class PaginationConfig {
|
public class PaginationConfig {
|
||||||
|
|
||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
@Autowired
|
@Autowired
|
||||||
private EntityManager entityManagerPrimary;
|
private EntityManager entityManagerPrimary;
|
||||||
|
|
||||||
///错误的注入方式
|
///错误的注入方式
|
||||||
/*@Primary
|
/*@Primary
|
||||||
@Bean(Constant.PRIMARY_PAGINATION)
|
@Bean(Constant.PRIMARY_PAGINATION)
|
||||||
public Pagination primary(@Qualifier(Constant.ENTITY_MANAGER_PRIMARY_DB) EntityManager entityManager){
|
public Pagination primary(@Qualifier(Constant.ENTITY_MANAGER_PRIMARY_DB) EntityManager entityManager){
|
||||||
return new Pagination(entityManager);
|
return new Pagination(entityManager);
|
||||||
}*/
|
}*/
|
||||||
@Primary
|
@Primary
|
||||||
@Bean
|
@Bean
|
||||||
public Pagination primaryPagination(){
|
public Pagination primaryPagination(){
|
||||||
return new Pagination(entityManagerPrimary);
|
return new Pagination(entityManagerPrimary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,47 @@
|
||||||
package cn.palmte.work.config;
|
package cn.palmte.work.config;
|
||||||
|
|
||||||
import cn.palmte.work.model.Admin;
|
import cn.palmte.work.model.Admin;
|
||||||
import cn.palmte.work.model.AdminRepository;
|
import cn.palmte.work.model.AdminRepository;
|
||||||
import cn.palmte.work.model.Project;
|
import cn.palmte.work.model.Project;
|
||||||
import cn.palmte.work.model.ProjectRepository;
|
import cn.palmte.work.model.ProjectRepository;
|
||||||
import cn.palmte.work.service.ActProcDefService;
|
import cn.palmte.work.service.ActProcDefService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Configuration //1.主要用于标记配置类,兼备Component的效果。
|
@Configuration //1.主要用于标记配置类,兼备Component的效果。
|
||||||
@EnableScheduling // 2.开启定时任务
|
@EnableScheduling // 2.开启定时任务
|
||||||
public class StaticScheduleTask {
|
public class StaticScheduleTask {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(StaticScheduleTask.class);
|
private static final Logger logger = LoggerFactory.getLogger(StaticScheduleTask.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public AdminRepository adminRepository;
|
public AdminRepository adminRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ProjectRepository projectRepository;
|
public ProjectRepository projectRepository;
|
||||||
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/5 * * * ?")
|
@Scheduled(cron = "0 0/5 * * * ?")
|
||||||
private void temp() throws Exception {
|
private void temp() throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Scheduled(cron = "0 0/1 * * * ?")
|
/*@Scheduled(cron = "0 0/1 * * * ?")
|
||||||
private void changeUserName() throws Exception {
|
private void changeUserName() throws Exception {
|
||||||
|
|
||||||
logger.info("更新项目创建者姓名开始");
|
logger.info("更新项目创建者姓名开始");
|
||||||
List<Project> all = projectRepository.findAll();
|
List<Project> all = projectRepository.findAll();
|
||||||
for (Project project : all) {
|
for (Project project : all) {
|
||||||
logger.info("更新前:"+project.getCreatorName());
|
logger.info("更新前:"+project.getCreatorName());
|
||||||
Admin one = adminRepository.findOne(project.getCreatorId());
|
Admin one = adminRepository.findOne(project.getCreatorId());
|
||||||
project.setCreatorName(one.getRealName());
|
project.setCreatorName(one.getRealName());
|
||||||
Project project1 = projectRepository.saveAndFlush(project);
|
Project project1 = projectRepository.saveAndFlush(project);
|
||||||
logger.info("更新后:"+project1.getCreatorName());
|
logger.info("更新后:"+project1.getCreatorName());
|
||||||
}
|
}
|
||||||
logger.info("更新项目创建者姓名结束");
|
logger.info("更新项目创建者姓名结束");
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,32 @@
|
||||||
package cn.palmte.work.config;
|
package cn.palmte.work.config;
|
||||||
|
|
||||||
import cn.palmte.work.service.map.MemorySimpleMap;
|
import cn.palmte.work.service.map.MemorySimpleMap;
|
||||||
import cn.palmte.work.service.map.SimpleMap;
|
import cn.palmte.work.service.map.SimpleMap;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan at 2018/8/14 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2018/8/14 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class SystemConfigWithMemory {
|
public class SystemConfigWithMemory {
|
||||||
|
|
||||||
@Value("${fourcal.token.api.prefix}")
|
@Value("${fourcal.token.api.prefix}")
|
||||||
private String apiTokenPrefix;
|
private String apiTokenPrefix;
|
||||||
|
|
||||||
@Value("#{${fourcal.token.api.expires}}")
|
@Value("#{${fourcal.token.api.expires}}")
|
||||||
private long apiExpires;
|
private long apiExpires;
|
||||||
|
|
||||||
@Value("${fourcal.token.pc.prefix}")
|
@Value("${fourcal.token.pc.prefix}")
|
||||||
private String pcTokenPrefix;
|
private String pcTokenPrefix;
|
||||||
|
|
||||||
@Value("#{${fourcal.token.pc.expires}}")
|
@Value("#{${fourcal.token.pc.expires}}")
|
||||||
private long pcExpires;
|
private long pcExpires;
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SimpleMap<String, String> simpleMap() {
|
public SimpleMap<String, String> simpleMap() {
|
||||||
return new MemorySimpleMap<>();
|
return new MemorySimpleMap<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,78 +1,78 @@
|
||||||
package cn.palmte.work.config;
|
package cn.palmte.work.config;
|
||||||
|
|
||||||
/*import cn.palmte.work.model.Manager;
|
/*import cn.palmte.work.model.Manager;
|
||||||
import cn.palmte.work.service.CaptchaCodeService;
|
import cn.palmte.work.service.CaptchaCodeService;
|
||||||
import cn.palmte.work.service.token.redis.ApiTokenManager;
|
import cn.palmte.work.service.token.redis.ApiTokenManager;
|
||||||
import cn.palmte.work.service.token.redis.RedisCaptchaManager;
|
import cn.palmte.work.service.token.redis.RedisCaptchaManager;
|
||||||
import cn.palmte.work.service.token.redis.RedisErrorCountManager;
|
import cn.palmte.work.service.token.redis.RedisErrorCountManager;
|
||||||
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
|
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
import top.jfunc.token.CaptchaManger;
|
import top.jfunc.token.CaptchaManger;
|
||||||
import top.jfunc.token.ErrorCountManager;
|
import top.jfunc.token.ErrorCountManager;
|
||||||
import top.jfunc.token.TokenManager;
|
import top.jfunc.token.TokenManager;
|
||||||
|
|
||||||
import static cn.palmte.work.config.SystemConfigWithMemory.API_TOKEN_MANAGER;*/
|
import static cn.palmte.work.config.SystemConfigWithMemory.API_TOKEN_MANAGER;*/
|
||||||
|
|
||||||
|
|
||||||
/*@Configuration
|
/*@Configuration
|
||||||
public class SystemConfigWithRedis {
|
public class SystemConfigWithRedis {
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
RedisConnectionFactory connectionFactory;
|
RedisConnectionFactory connectionFactory;
|
||||||
|
|
||||||
@Bean(name = "stringRedisTemplate")
|
@Bean(name = "stringRedisTemplate")
|
||||||
public StringRedisTemplate stringRedisTemplate() {
|
public StringRedisTemplate stringRedisTemplate() {
|
||||||
return new StringRedisTemplate(connectionFactory);
|
return new StringRedisTemplate(connectionFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "redisTemplate")
|
@Bean(name = "redisTemplate")
|
||||||
public RedisTemplate<Object, Object> redisTemplate(){
|
public RedisTemplate<Object, Object> redisTemplate(){
|
||||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
||||||
template.setConnectionFactory(connectionFactory);
|
template.setConnectionFactory(connectionFactory);
|
||||||
//避免key出现乱码
|
//避免key出现乱码
|
||||||
template.setKeySerializer(new StringRedisSerializer());
|
template.setKeySerializer(new StringRedisSerializer());
|
||||||
//value使用FastJson转换
|
//value使用FastJson转换
|
||||||
template.setValueSerializer(new GenericFastJsonRedisSerializer());
|
template.setValueSerializer(new GenericFastJsonRedisSerializer());
|
||||||
template.setHashKeySerializer(new StringRedisSerializer());
|
template.setHashKeySerializer(new StringRedisSerializer());
|
||||||
template.setHashValueSerializer(new GenericFastJsonRedisSerializer());
|
template.setHashValueSerializer(new GenericFastJsonRedisSerializer());
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
@Value("${fourcal.token.api.prefix}")
|
@Value("${fourcal.token.api.prefix}")
|
||||||
private String apiTokenPrefix;
|
private String apiTokenPrefix;
|
||||||
|
|
||||||
@Value("#{${fourcal.token.api.expires}}")
|
@Value("#{${fourcal.token.api.expires}}")
|
||||||
private long apiExpires;
|
private long apiExpires;
|
||||||
|
|
||||||
|
|
||||||
@Bean(Constant.API_TOKEN_MANAGER)
|
@Bean(Constant.API_TOKEN_MANAGER)
|
||||||
public TokenManager<Manager> apiTokenManagerRedis(){
|
public TokenManager<Manager> apiTokenManagerRedis(){
|
||||||
ApiTokenManager apiTokenManager = new ApiTokenManager();
|
ApiTokenManager apiTokenManager = new ApiTokenManager();
|
||||||
apiTokenManager.setRedisTemplate(redisTemplate());
|
apiTokenManager.setRedisTemplate(redisTemplate());
|
||||||
apiTokenManager.setApiExpires(apiExpires);
|
apiTokenManager.setApiExpires(apiExpires);
|
||||||
apiTokenManager.setMulti(true);
|
apiTokenManager.setMulti(true);
|
||||||
apiTokenManager.setTokenPrefix(apiTokenPrefix);
|
apiTokenManager.setTokenPrefix(apiTokenPrefix);
|
||||||
return apiTokenManager;
|
return apiTokenManager;
|
||||||
}
|
}
|
||||||
@Bean
|
@Bean
|
||||||
public ErrorCountManager errorCountManager() {
|
public ErrorCountManager errorCountManager() {
|
||||||
RedisErrorCountManager redisErrorCountManager = new RedisErrorCountManager();
|
RedisErrorCountManager redisErrorCountManager = new RedisErrorCountManager();
|
||||||
redisErrorCountManager.setThreshold(3);
|
redisErrorCountManager.setThreshold(3);
|
||||||
redisErrorCountManager.setRedisTemplate(redisTemplate());
|
redisErrorCountManager.setRedisTemplate(redisTemplate());
|
||||||
return redisErrorCountManager;
|
return redisErrorCountManager;
|
||||||
}
|
}
|
||||||
@Bean
|
@Bean
|
||||||
public CaptchaManger captchaManger(@Autowired CaptchaCodeService captchaCodeService) {
|
public CaptchaManger captchaManger(@Autowired CaptchaCodeService captchaCodeService) {
|
||||||
RedisCaptchaManager captchaManger = new RedisCaptchaManager();
|
RedisCaptchaManager captchaManger = new RedisCaptchaManager();
|
||||||
captchaManger.setRedisTemplate(redisTemplate());
|
captchaManger.setRedisTemplate(redisTemplate());
|
||||||
captchaManger.setCaptchaCodeService(captchaCodeService);
|
captchaManger.setCaptchaCodeService(captchaCodeService);
|
||||||
return captchaManger;
|
return captchaManger;
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
package cn.palmte.work.config;
|
package cn.palmte.work.config;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConfigurationProperties(prefix = "upload")
|
@ConfigurationProperties(prefix = "upload")
|
||||||
public class UploadProperties {
|
public class UploadProperties {
|
||||||
private String path;
|
private String path;
|
||||||
private String prefix;
|
private String prefix;
|
||||||
|
|
||||||
|
|
||||||
public String getPath() {
|
public String getPath() {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrefix() {
|
public String getPrefix() {
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPath(String path) {
|
public void setPath(String path) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
public void setPrefix(String prefix) {
|
public void setPrefix(String prefix) {
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,33 @@
|
||||||
package cn.palmte.work.config.activiti;
|
package cn.palmte.work.config.activiti;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.exception.ResponseException;
|
import cn.palmte.work.exception.ResponseException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程审批类型枚举
|
* 流程审批类型枚举
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum ActApproveTypeEnum {
|
public enum ActApproveTypeEnum {
|
||||||
APPROVAL_PASSED(2, "审核通过"),
|
APPROVAL_PASSED(2, "审核通过"),
|
||||||
APPROVAL_UN_PASS(3, "审核不通过");
|
APPROVAL_UN_PASS(3, "审核不通过");
|
||||||
|
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
ActApproveTypeEnum(int type, String name) {
|
ActApproveTypeEnum(int type, String name) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ActApproveTypeEnum ofType(int type) {
|
public static ActApproveTypeEnum ofType(int type) {
|
||||||
if (type == APPROVAL_PASSED.getType()) {
|
if (type == APPROVAL_PASSED.getType()) {
|
||||||
return APPROVAL_PASSED;
|
return APPROVAL_PASSED;
|
||||||
} else if (type == APPROVAL_UN_PASS.getType()) {
|
} else if (type == APPROVAL_UN_PASS.getType()) {
|
||||||
return APPROVAL_UN_PASS;
|
return APPROVAL_UN_PASS;
|
||||||
} else {
|
} else {
|
||||||
throw new ResponseException("不支持的审批类型【" + type + "】");
|
throw new ResponseException("不支持的审批类型【" + type + "】");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,39 @@
|
||||||
package cn.palmte.work.config.activiti;
|
package cn.palmte.work.config.activiti;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.exception.ResponseException;
|
import cn.palmte.work.exception.ResponseException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批人设置枚举
|
* 审批人设置枚举
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum ActCandidateTypeEnum {
|
public enum ActCandidateTypeEnum {
|
||||||
USER(0, "按用户设置审批人"),
|
USER(0, "按用户设置审批人"),
|
||||||
ROLE(1, "按角色设置审批人"),
|
ROLE(1, "按角色设置审批人"),
|
||||||
STARTER_LEADER(2, "按发起人部门领导设置审批人"),
|
STARTER_LEADER(2, "按发起人部门领导设置审批人"),
|
||||||
DEPT_LEADER(3, "按指定的部门领导设置审批人");
|
DEPT_LEADER(3, "按指定的部门领导设置审批人");
|
||||||
|
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
ActCandidateTypeEnum(int type, String name) {
|
ActCandidateTypeEnum(int type, String name) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ActCandidateTypeEnum ofType(int type) {
|
public static ActCandidateTypeEnum ofType(int type) {
|
||||||
if (type == USER.getType()) {
|
if (type == USER.getType()) {
|
||||||
return USER;
|
return USER;
|
||||||
} else if (type == ROLE.getType()) {
|
} else if (type == ROLE.getType()) {
|
||||||
return ROLE;
|
return ROLE;
|
||||||
} else if (type == STARTER_LEADER.getType()) {
|
} else if (type == STARTER_LEADER.getType()) {
|
||||||
return STARTER_LEADER;
|
return STARTER_LEADER;
|
||||||
} else if (type == DEPT_LEADER.getType()) {
|
} else if (type == DEPT_LEADER.getType()) {
|
||||||
return DEPT_LEADER;
|
return DEPT_LEADER;
|
||||||
} else {
|
} else {
|
||||||
throw new ResponseException("不支持的类型【" + type + "】");
|
throw new ResponseException("不支持的类型【" + type + "】");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,33 @@
|
||||||
package cn.palmte.work.config.activiti;
|
package cn.palmte.work.config.activiti;
|
||||||
|
|
||||||
public class ActConstant {
|
public class ActConstant {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程启动用户变量
|
* 流程启动用户变量
|
||||||
*/
|
*/
|
||||||
public static final String START_PROCESS_USERID = "startUserId";
|
public static final String START_PROCESS_USERID = "startUserId";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门领导id
|
* 部门领导id
|
||||||
*/
|
*/
|
||||||
public static final String DEPT_LEADER_ID = "deptLeaderId";
|
public static final String DEPT_LEADER_ID = "deptLeaderId";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单实例 或签
|
* 单实例 或签
|
||||||
*/
|
*/
|
||||||
public static final int TASK_TYPE_SINGE = 0;
|
public static final int TASK_TYPE_SINGE = 0;
|
||||||
/**
|
/**
|
||||||
* 多实例 会签
|
* 多实例 会签
|
||||||
*/
|
*/
|
||||||
public static final int TASK_TYPE_MULTI = 1;
|
public static final int TASK_TYPE_MULTI = 1;
|
||||||
|
|
||||||
|
|
||||||
public static final String PROCESS_TASKS_ESTIMATE = "填报概算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
public static final String PROCESS_TASKS_ESTIMATE = "填报概算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
||||||
public static final String PROCESS_TASKS_BUDGET = "填报预算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
public static final String PROCESS_TASKS_BUDGET = "填报预算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
||||||
public static final String PROCESS_TASKS_SETTLE = "填报结算#财务总监";
|
public static final String PROCESS_TASKS_SETTLE = "填报结算#财务总监";
|
||||||
public static final String PROCESS_TASKS_FINAL = "填报决算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
public static final String PROCESS_TASKS_FINAL = "填报决算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
||||||
|
|
||||||
public static final String KEY_PROJECT_TYPE = "projectType";
|
public static final String KEY_PROJECT_TYPE = "projectType";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,63 +1,63 @@
|
||||||
package cn.palmte.work.config.activiti;
|
package cn.palmte.work.config.activiti;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.exception.ResponseException;
|
import cn.palmte.work.exception.ResponseException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程定义key枚举
|
* 流程定义key枚举
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum ActProcessKeyEnum {
|
public enum ActProcessKeyEnum {
|
||||||
ESTIMATE("estimate", "概算审批流程"),
|
ESTIMATE("estimate", "概算审批流程"),
|
||||||
BUDGET("budget", "预算审批流程"),
|
BUDGET("budget", "预算审批流程"),
|
||||||
SETTLE("settle", "结算审批流程"),
|
SETTLE("settle", "结算审批流程"),
|
||||||
FINAL("final", "决算审批流程"),
|
FINAL("final", "决算审批流程"),
|
||||||
SALE_CONTRACT("saleContract", "销售合同审批流程"),
|
SALE_CONTRACT("saleContract", "销售合同审批流程"),
|
||||||
BUSINESS_PURCHASE("businessPurchase", "业务采购审批流程");
|
BUSINESS_PURCHASE("businessPurchase", "业务采购审批流程");
|
||||||
|
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
ActProcessKeyEnum(String key, String name) {
|
ActProcessKeyEnum(String key, String name) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ActProcessKeyEnum ofKey(String key) {
|
public static ActProcessKeyEnum ofKey(String key) {
|
||||||
if (ESTIMATE.getKey().equals(key)) {
|
if (ESTIMATE.getKey().equals(key)) {
|
||||||
return ESTIMATE;
|
return ESTIMATE;
|
||||||
} else if (BUDGET.getKey().equals(key)) {
|
} else if (BUDGET.getKey().equals(key)) {
|
||||||
return BUDGET;
|
return BUDGET;
|
||||||
} else if (SETTLE.getKey().equals(key)) {
|
} else if (SETTLE.getKey().equals(key)) {
|
||||||
return SETTLE;
|
return SETTLE;
|
||||||
} else if (FINAL.getKey().equals(key)) {
|
} else if (FINAL.getKey().equals(key)) {
|
||||||
return FINAL;
|
return FINAL;
|
||||||
} else if (SALE_CONTRACT.getKey().equals(key)) {
|
} else if (SALE_CONTRACT.getKey().equals(key)) {
|
||||||
return SALE_CONTRACT;
|
return SALE_CONTRACT;
|
||||||
} else if (BUSINESS_PURCHASE.getKey().equals(key)) {
|
} else if (BUSINESS_PURCHASE.getKey().equals(key)) {
|
||||||
return BUSINESS_PURCHASE;
|
return BUSINESS_PURCHASE;
|
||||||
} else {
|
} else {
|
||||||
throw new ResponseException("不支持的流程key【" + key + "】");
|
throw new ResponseException("不支持的流程key【" + key + "】");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ActProcessKeyEnum ofProcDefId(String proDefId) {
|
public static ActProcessKeyEnum ofProcDefId(String proDefId) {
|
||||||
if (proDefId.startsWith(ESTIMATE.getKey())) {
|
if (proDefId.startsWith(ESTIMATE.getKey())) {
|
||||||
return ESTIMATE;
|
return ESTIMATE;
|
||||||
} else if (proDefId.startsWith(BUDGET.getKey())) {
|
} else if (proDefId.startsWith(BUDGET.getKey())) {
|
||||||
return BUDGET;
|
return BUDGET;
|
||||||
} else if (proDefId.startsWith(SETTLE.getKey())) {
|
} else if (proDefId.startsWith(SETTLE.getKey())) {
|
||||||
return SETTLE;
|
return SETTLE;
|
||||||
} else if (proDefId.startsWith(FINAL.getKey())) {
|
} else if (proDefId.startsWith(FINAL.getKey())) {
|
||||||
return FINAL;
|
return FINAL;
|
||||||
} else if (proDefId.startsWith(SALE_CONTRACT.getKey())) {
|
} else if (proDefId.startsWith(SALE_CONTRACT.getKey())) {
|
||||||
return SALE_CONTRACT;
|
return SALE_CONTRACT;
|
||||||
} else if (proDefId.startsWith(BUSINESS_PURCHASE.getKey())) {
|
} else if (proDefId.startsWith(BUSINESS_PURCHASE.getKey())) {
|
||||||
return BUSINESS_PURCHASE;
|
return BUSINESS_PURCHASE;
|
||||||
} else {
|
} else {
|
||||||
throw new ResponseException("不支持的流程key【" + proDefId + "】");
|
throw new ResponseException("不支持的流程key【" + proDefId + "】");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,36 @@
|
||||||
package cn.palmte.work.config.activiti;
|
package cn.palmte.work.config.activiti;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.exception.ResponseException;
|
import cn.palmte.work.exception.ResponseException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程里的项目类型枚举
|
* 流程里的项目类型枚举
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum ActProjectTypeEnum {
|
public enum ActProjectTypeEnum {
|
||||||
FOURCAL(0, "四算项目"),
|
FOURCAL(0, "四算项目"),
|
||||||
SALE_CONTRACT(1, "销售合同项目"),
|
SALE_CONTRACT(1, "销售合同项目"),
|
||||||
BUSINESS_PURCHASE(2, "业务采购项目");
|
BUSINESS_PURCHASE(2, "业务采购项目");
|
||||||
|
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
ActProjectTypeEnum(int type, String name) {
|
ActProjectTypeEnum(int type, String name) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ActProjectTypeEnum ofType(int type) {
|
public static ActProjectTypeEnum ofType(int type) {
|
||||||
if (type == FOURCAL.getType()) {
|
if (type == FOURCAL.getType()) {
|
||||||
return FOURCAL;
|
return FOURCAL;
|
||||||
} else if (type == SALE_CONTRACT.getType()) {
|
} else if (type == SALE_CONTRACT.getType()) {
|
||||||
return SALE_CONTRACT;
|
return SALE_CONTRACT;
|
||||||
} else if (type == BUSINESS_PURCHASE.getType()) {
|
} else if (type == BUSINESS_PURCHASE.getType()) {
|
||||||
return BUSINESS_PURCHASE;
|
return BUSINESS_PURCHASE;
|
||||||
} else {
|
} else {
|
||||||
throw new ResponseException("不支持的项目类型【" + type + "】");
|
throw new ResponseException("不支持的项目类型【" + type + "】");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,39 @@
|
||||||
package cn.palmte.work.config.activiti;
|
package cn.palmte.work.config.activiti;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.exception.ResponseException;
|
import cn.palmte.work.exception.ResponseException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程里的节点类型枚举
|
* 流程里的节点类型枚举
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum ActTaskIndexEnum {
|
public enum ActTaskIndexEnum {
|
||||||
END(-1, "结束节点"),
|
END(-1, "结束节点"),
|
||||||
COMMON(0, "除发起审批外的用户节点"),
|
COMMON(0, "除发起审批外的用户节点"),
|
||||||
START(1, "开始节点"),
|
START(1, "开始节点"),
|
||||||
FIRST_USER_TASK(2, "发起审批节点");
|
FIRST_USER_TASK(2, "发起审批节点");
|
||||||
|
|
||||||
|
|
||||||
private int index;
|
private int index;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
ActTaskIndexEnum(int index, String name) {
|
ActTaskIndexEnum(int index, String name) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ActTaskIndexEnum ofIndex(int index) {
|
public static ActTaskIndexEnum ofIndex(int index) {
|
||||||
if (index == END.getIndex()) {
|
if (index == END.getIndex()) {
|
||||||
return END;
|
return END;
|
||||||
} else if (index == COMMON.getIndex()) {
|
} else if (index == COMMON.getIndex()) {
|
||||||
return COMMON;
|
return COMMON;
|
||||||
} else if (index == START.getIndex()) {
|
} else if (index == START.getIndex()) {
|
||||||
return START;
|
return START;
|
||||||
} else if (index == FIRST_USER_TASK.getIndex()) {
|
} else if (index == FIRST_USER_TASK.getIndex()) {
|
||||||
return FIRST_USER_TASK;
|
return FIRST_USER_TASK;
|
||||||
} else {
|
} else {
|
||||||
throw new ResponseException("不支持的节点类型【" + index + "】");
|
throw new ResponseException("不支持的节点类型【" + index + "】");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,40 @@
|
||||||
package cn.palmte.work.config.activiti;
|
package cn.palmte.work.config.activiti;
|
||||||
|
|
||||||
import org.activiti.engine.ProcessEngineConfiguration;
|
import org.activiti.engine.ProcessEngineConfiguration;
|
||||||
import org.activiti.spring.SpringProcessEngineConfiguration;
|
import org.activiti.spring.SpringProcessEngineConfiguration;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ActivitiConfig {
|
public class ActivitiConfig {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
PlatformTransactionManager transactionManager;
|
PlatformTransactionManager transactionManager;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DataSource dataSource;
|
DataSource dataSource;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SpringProcessEngineConfiguration getProcessEngineConfiguration() {
|
public SpringProcessEngineConfiguration getProcessEngineConfiguration() {
|
||||||
SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
|
SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
|
||||||
config.setDataSource(dataSource);
|
config.setDataSource(dataSource);
|
||||||
config.setTransactionManager(transactionManager);
|
config.setTransactionManager(transactionManager);
|
||||||
config.setDbHistoryUsed(true);
|
config.setDbHistoryUsed(true);
|
||||||
config.setHistory("full");
|
config.setHistory("full");
|
||||||
config.setActivityFontName("宋体");
|
config.setActivityFontName("宋体");
|
||||||
|
|
||||||
//数据库更新策略
|
//数据库更新策略
|
||||||
//flase: 默认值。activiti在启动时,会对比数据库表中保存的版本,如果没有表或者版本不匹配,将抛出异常。(生产环境常用)
|
//flase: 默认值。activiti在启动时,会对比数据库表中保存的版本,如果没有表或者版本不匹配,将抛出异常。(生产环境常用)
|
||||||
//true: activiti会对数据库中所有表进行更新操作。如果表不存在,则自动创建。(开发时常用)
|
//true: activiti会对数据库中所有表进行更新操作。如果表不存在,则自动创建。(开发时常用)
|
||||||
//create_drop: 在activiti启动时创建表,在关闭时删除表(必须手动关闭引擎,才能删除表)。(单元测试常用)
|
//create_drop: 在activiti启动时创建表,在关闭时删除表(必须手动关闭引擎,才能删除表)。(单元测试常用)
|
||||||
//drop-create: 在activiti启动时删除原来的旧表,然后在创建新表(不需要手动关闭引擎)。
|
//drop-create: 在activiti启动时删除原来的旧表,然后在创建新表(不需要手动关闭引擎)。
|
||||||
config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);
|
config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,32 @@
|
||||||
package cn.palmte.work.config.activiti;
|
package cn.palmte.work.config.activiti;
|
||||||
|
|
||||||
import org.activiti.engine.impl.cmd.NeedsActiveTaskCmd;
|
import org.activiti.engine.impl.cmd.NeedsActiveTaskCmd;
|
||||||
import org.activiti.engine.impl.interceptor.CommandContext;
|
import org.activiti.engine.impl.interceptor.CommandContext;
|
||||||
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
|
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
|
||||||
import org.activiti.engine.impl.persistence.entity.TaskEntity;
|
import org.activiti.engine.impl.persistence.entity.TaskEntity;
|
||||||
import org.activiti.engine.impl.persistence.entity.TaskEntityManagerImpl;
|
import org.activiti.engine.impl.persistence.entity.TaskEntityManagerImpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除当前运行时任务命令,并返回当前任务的执行对象id
|
* 删除当前运行时任务命令,并返回当前任务的执行对象id
|
||||||
*/
|
*/
|
||||||
public class DeleteTaskCommand extends NeedsActiveTaskCmd<String> {
|
public class DeleteTaskCommand extends NeedsActiveTaskCmd<String> {
|
||||||
public DeleteTaskCommand(String taskId) {
|
public DeleteTaskCommand(String taskId) {
|
||||||
super(taskId);
|
super(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String execute(CommandContext commandContext, TaskEntity currentTask) {
|
public String execute(CommandContext commandContext, TaskEntity currentTask) {
|
||||||
//获取所需服务
|
//获取所需服务
|
||||||
TaskEntityManagerImpl taskEntityManager = (TaskEntityManagerImpl) commandContext.getTaskEntityManager();
|
TaskEntityManagerImpl taskEntityManager = (TaskEntityManagerImpl) commandContext.getTaskEntityManager();
|
||||||
//获取当前任务的来源任务及来源节点信息
|
//获取当前任务的来源任务及来源节点信息
|
||||||
ExecutionEntity executionEntity = currentTask.getExecution();
|
ExecutionEntity executionEntity = currentTask.getExecution();
|
||||||
//删除当前任务,来源任务
|
//删除当前任务,来源任务
|
||||||
taskEntityManager.deleteTask(currentTask, "驳回", false, false);
|
taskEntityManager.deleteTask(currentTask, "驳回", false, false);
|
||||||
return executionEntity.getId();
|
return executionEntity.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSuspendedTaskException() {
|
public String getSuspendedTaskException() {
|
||||||
return "挂起的任务不能跳转";
|
return "挂起的任务不能跳转";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,40 @@
|
||||||
package cn.palmte.work.config.activiti;
|
package cn.palmte.work.config.activiti;
|
||||||
|
|
||||||
import org.activiti.bpmn.model.FlowNode;
|
import org.activiti.bpmn.model.FlowNode;
|
||||||
import org.activiti.bpmn.model.SequenceFlow;
|
import org.activiti.bpmn.model.SequenceFlow;
|
||||||
import org.activiti.engine.ActivitiException;
|
import org.activiti.engine.ActivitiException;
|
||||||
import org.activiti.engine.impl.interceptor.Command;
|
import org.activiti.engine.impl.interceptor.Command;
|
||||||
import org.activiti.engine.impl.interceptor.CommandContext;
|
import org.activiti.engine.impl.interceptor.CommandContext;
|
||||||
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
|
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据提供节点和执行对象id,进行跳转命令
|
* 根据提供节点和执行对象id,进行跳转命令
|
||||||
*
|
*
|
||||||
* @author
|
* @author
|
||||||
*/
|
*/
|
||||||
public class JumpCommand implements Command<Void> {
|
public class JumpCommand implements Command<Void> {
|
||||||
private FlowNode flowElement;
|
private FlowNode flowElement;
|
||||||
private String executionId;
|
private String executionId;
|
||||||
|
|
||||||
public JumpCommand(FlowNode flowElement, String executionId) {
|
public JumpCommand(FlowNode flowElement, String executionId) {
|
||||||
this.flowElement = flowElement;
|
this.flowElement = flowElement;
|
||||||
this.executionId = executionId;
|
this.executionId = executionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void execute(CommandContext commandContext) {
|
public Void execute(CommandContext commandContext) {
|
||||||
//获取目标节点的来源连线
|
//获取目标节点的来源连线
|
||||||
List<SequenceFlow> flows = flowElement.getIncomingFlows();
|
List<SequenceFlow> flows = flowElement.getIncomingFlows();
|
||||||
if (flows == null || flows.isEmpty()) {
|
if (flows == null || flows.isEmpty()) {
|
||||||
throw new ActivitiException("回退错误,目标节点没有来源连线");
|
throw new ActivitiException("回退错误,目标节点没有来源连线");
|
||||||
}
|
}
|
||||||
|
|
||||||
//随便选一条连线来执行,当前执行计划为,从连线流转到目标节点,实现跳转
|
//随便选一条连线来执行,当前执行计划为,从连线流转到目标节点,实现跳转
|
||||||
ExecutionEntity executionEntity = commandContext.getExecutionEntityManager().findById(executionId);
|
ExecutionEntity executionEntity = commandContext.getExecutionEntityManager().findById(executionId);
|
||||||
executionEntity.setCurrentFlowElement(flows.get(0));
|
executionEntity.setCurrentFlowElement(flows.get(0));
|
||||||
commandContext.getAgenda().planTakeOutgoingSequenceFlowsOperation(executionEntity, true);
|
commandContext.getAgenda().planTakeOutgoingSequenceFlowsOperation(executionEntity, true);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,97 +1,97 @@
|
||||||
package cn.palmte.work.config.interceptor;
|
package cn.palmte.work.config.interceptor;
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.config.Constant;
|
import cn.palmte.work.config.Constant;
|
||||||
import cn.palmte.work.config.log.LogExcluder;
|
import cn.palmte.work.config.log.LogExcluder;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
import top.jfunc.token.TokenManager;
|
import top.jfunc.token.TokenManager;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static cn.palmte.work.config.Constant.HEADER_TOKEN;
|
import static cn.palmte.work.config.Constant.HEADER_TOKEN;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan
|
* @author xiongshiyan
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractLoginInterceptor extends HandlerInterceptorAdapter {
|
public abstract class AbstractLoginInterceptor extends HandlerInterceptorAdapter {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(AbstractLoginInterceptor.class);
|
private static final Logger logger = LoggerFactory.getLogger(AbstractLoginInterceptor.class);
|
||||||
|
|
||||||
protected void printNeccery(HttpServletRequest request, LogExcluder logExcluder) {
|
protected void printNeccery(HttpServletRequest request, LogExcluder logExcluder) {
|
||||||
//拦截特殊字符
|
//拦截特殊字符
|
||||||
String[] specialStr = {"|", "&", ";", "$", "%", "@", "'", "\"", "\\'", "\\\"", "<", ">", "(", ")", "+", "CR", "LF", ",", "\\"};
|
String[] specialStr = {"|", "&", ";", "$", "%", "@", "'", "\"", "\\'", "\\\"", "<", ">", "(", ")", "+", "CR", "LF", ",", "\\"};
|
||||||
for (String s : specialStr) {
|
for (String s : specialStr) {
|
||||||
if (request.getRequestURI().contains(s)) {
|
if (request.getRequestURI().contains(s)) {
|
||||||
logger.info("uri:" + request.getRequestURI() + "含有特殊字符:" + s);
|
logger.info("uri:" + request.getRequestURI() + "含有特殊字符:" + s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (logExcluder.needExcluded(request.getRequestURI())) {
|
if (logExcluder.needExcluded(request.getRequestURI())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("uri:" + request.getRequestURI() + ",token:" + request.getHeader(HEADER_TOKEN));
|
logger.info("uri:" + request.getRequestURI() + ",token:" + request.getHeader(HEADER_TOKEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean verifyLogin(HttpServletResponse response, TokenManager<?> tokenManager, String token, boolean cors) throws IOException {
|
protected boolean verifyLogin(HttpServletResponse response, TokenManager<?> tokenManager, String token, boolean cors) throws IOException {
|
||||||
/// Object o = tokenManager.findByToken(token);
|
/// Object o = tokenManager.findByToken(token);
|
||||||
boolean exist = tokenManager.existByToken(token);
|
boolean exist = tokenManager.existByToken(token);
|
||||||
if (!exist) {
|
if (!exist) {
|
||||||
promptLogin(response, cors);
|
promptLogin(response, cors);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
tokenManager.updateExpires(token);
|
tokenManager.updateExpires(token);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean verifyLogin(HttpServletResponse response, TokenManager<String> tokenManager, String token, boolean cors, String phone) throws IOException {
|
protected boolean verifyLogin(HttpServletResponse response, TokenManager<String> tokenManager, String token, boolean cors, String phone) throws IOException {
|
||||||
if (null == phone) {
|
if (null == phone) {
|
||||||
promptLogin(response, cors);
|
promptLogin(response, cors);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
tokenManager.updateExpires(token);
|
tokenManager.updateExpires(token);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void promptLogin(HttpServletResponse response, boolean cors) throws IOException {
|
protected void promptLogin(HttpServletResponse response, boolean cors) throws IOException {
|
||||||
response.setContentType("application/json;charset=utf-8");
|
response.setContentType("application/json;charset=utf-8");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
if (cors) {
|
if (cors) {
|
||||||
cors(response);
|
cors(response);
|
||||||
}
|
}
|
||||||
response.getWriter().write(JSON.toJSONString(ResponseMsg.buildMsg(Constant.Status.STATUS_PROMPT_LOGIN, "login first please", "")));
|
response.getWriter().write(JSON.toJSONString(ResponseMsg.buildMsg(Constant.Status.STATUS_PROMPT_LOGIN, "login first please", "")));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void promptNoPermission(HttpServletResponse response, boolean cors) throws IOException {
|
protected void promptNoPermission(HttpServletResponse response, boolean cors) throws IOException {
|
||||||
response.setContentType("application/json;charset=utf-8");
|
response.setContentType("application/json;charset=utf-8");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
if (cors) {
|
if (cors) {
|
||||||
cors(response);
|
cors(response);
|
||||||
}
|
}
|
||||||
response.getWriter().write(JSON.toJSONString(ResponseMsg.buildMsg(Constant.Status.STATUS_PROMPT_UNAUTH, "you have no permission", "")));
|
response.getWriter().write(JSON.toJSONString(ResponseMsg.buildMsg(Constant.Status.STATUS_PROMPT_UNAUTH, "you have no permission", "")));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void promptLogin(HttpServletResponse response) throws IOException {
|
protected void promptLogin(HttpServletResponse response) throws IOException {
|
||||||
promptLogin(response, false);
|
promptLogin(response, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理跨域
|
* 处理跨域
|
||||||
*
|
*
|
||||||
* @param response HttpServletResponse
|
* @param response HttpServletResponse
|
||||||
*/
|
*/
|
||||||
private void cors(HttpServletResponse response) {
|
private void cors(HttpServletResponse response) {
|
||||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
response.setHeader("Access-Control-Allow-Headers", "*");
|
response.setHeader("Access-Control-Allow-Headers", "*");
|
||||||
response.setHeader("Access-Control-Allow-Methods", "POST,GET,DELETE,PUT,OPTIONS");
|
response.setHeader("Access-Control-Allow-Methods", "POST,GET,DELETE,PUT,OPTIONS");
|
||||||
response.setHeader("Access-Control-Max-Age", "3600");
|
response.setHeader("Access-Control-Max-Age", "3600");
|
||||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
package cn.palmte.work.config.interceptor;
|
package cn.palmte.work.config.interceptor;
|
||||||
|
|
||||||
import cn.palmte.work.config.log.LogExcluder;
|
import cn.palmte.work.config.log.LogExcluder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印header中的token,有助于排查问题
|
* 打印header中的token,有助于排查问题
|
||||||
* @author xiongshiyan
|
* @author xiongshiyan
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class TokenLoggingInterceptor extends AbstractLoginInterceptor {
|
public class TokenLoggingInterceptor extends AbstractLoginInterceptor {
|
||||||
@Autowired
|
@Autowired
|
||||||
private LogExcluder logExcluder;
|
private LogExcluder logExcluder;
|
||||||
/**
|
/**
|
||||||
* 在Handler执行之前处理
|
* 在Handler执行之前处理
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
printNeccery(request , logExcluder);
|
printNeccery(request , logExcluder);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,53 +1,53 @@
|
||||||
package cn.palmte.work.config.log;
|
package cn.palmte.work.config.log;
|
||||||
|
|
||||||
import cn.palmte.work.utils.StrKit;
|
import cn.palmte.work.utils.StrKit;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志打印排除器,排除某些日志的打印
|
* 日志打印排除器,排除某些日志的打印
|
||||||
* @author xiongshiyan at 2018/12/23 , contact me with email yanshixiong@126.com or phone 15208384257
|
* @author xiongshiyan at 2018/12/23 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class LogExcluder implements InitializingBean{
|
public class LogExcluder implements InitializingBean{
|
||||||
private static final Logger logger = LoggerFactory.getLogger(LogExcluder.class);
|
private static final Logger logger = LoggerFactory.getLogger(LogExcluder.class);
|
||||||
|
|
||||||
@Value("${server.context-path:/fourcal}")
|
@Value("${server.context-path:/fourcal}")
|
||||||
private String contextPath;
|
private String contextPath;
|
||||||
@Value("${fourcal.log.excluded.urls:}")
|
@Value("${fourcal.log.excluded.urls:}")
|
||||||
private String[] logExcludedUrls;
|
private String[] logExcludedUrls;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
if(isEmpty(logExcludedUrls)){
|
if(isEmpty(logExcludedUrls)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StrKit.trim(logExcludedUrls);
|
StrKit.trim(logExcludedUrls);
|
||||||
logger.info(Arrays.asList(logExcludedUrls).toString());
|
logger.info(Arrays.asList(logExcludedUrls).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean needExcluded(String uri){
|
public boolean needExcluded(String uri){
|
||||||
//没有需要排除的
|
//没有需要排除的
|
||||||
if(isEmpty(logExcludedUrls)){
|
if(isEmpty(logExcludedUrls)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//去除前端轮询的
|
//去除前端轮询的
|
||||||
if(uri.contains("api/pc/alarm/fetchAlarm")){
|
if(uri.contains("api/pc/alarm/fetchAlarm")){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//去掉前缀
|
//去掉前缀
|
||||||
uri = uri.replace(contextPath , "");
|
uri = uri.replace(contextPath , "");
|
||||||
return StrKit.targetInArray(logExcludedUrls , uri);
|
return StrKit.targetInArray(logExcludedUrls , uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> boolean isEmpty(T[] array){
|
private <T> boolean isEmpty(T[] array){
|
||||||
return null == array || 0 == array.length;
|
return null == array || 0 == array.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,53 +1,53 @@
|
||||||
package cn.palmte.work.config.log;
|
package cn.palmte.work.config.log;
|
||||||
|
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.Around;
|
import org.aspectj.lang.annotation.Around;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan
|
* @author xiongshiyan
|
||||||
* 统一打印日志
|
* 统一打印日志
|
||||||
*/
|
*/
|
||||||
@Aspect
|
@Aspect
|
||||||
@Component
|
@Component
|
||||||
@Order(1)
|
@Order(1)
|
||||||
public class WebLogAspect {
|
public class WebLogAspect {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
|
private static final Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LogExcluder logExcluder;
|
private LogExcluder logExcluder;
|
||||||
|
|
||||||
@Pointcut("execution(public * cn.palmte.work.controller..*.*(..))")
|
@Pointcut("execution(public * cn.palmte.work.controller..*.*(..))")
|
||||||
public void webLog(){}
|
public void webLog(){}
|
||||||
|
|
||||||
@Around(value = "webLog()")
|
@Around(value = "webLog()")
|
||||||
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
||||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
HttpServletRequest request = attributes.getRequest();
|
HttpServletRequest request = attributes.getRequest();
|
||||||
|
|
||||||
if(logExcluder.needExcluded(request.getRequestURI())){
|
if(logExcluder.needExcluded(request.getRequestURI())){
|
||||||
return proceedingJoinPoint.proceed();
|
return proceedingJoinPoint.proceed();
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("REQUEST : " + request.getRequestURI() + " : "
|
logger.info("REQUEST : " + request.getRequestURI() + " : "
|
||||||
+(proceedingJoinPoint.getSignature().getDeclaringTypeName() + "." + proceedingJoinPoint.getSignature().getName() + " : ")
|
+(proceedingJoinPoint.getSignature().getDeclaringTypeName() + "." + proceedingJoinPoint.getSignature().getName() + " : ")
|
||||||
+ Arrays.toString(proceedingJoinPoint.getArgs()));
|
+ Arrays.toString(proceedingJoinPoint.getArgs()));
|
||||||
|
|
||||||
Object proceed = proceedingJoinPoint.proceed();
|
Object proceed = proceedingJoinPoint.proceed();
|
||||||
|
|
||||||
logger.info("RESPONSE : " + proceed);
|
logger.info("RESPONSE : " + proceed);
|
||||||
return proceed;
|
return proceed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,277 +1,277 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.config.Constant;
|
import cn.palmte.work.config.Constant;
|
||||||
import cn.palmte.work.model.Admin;
|
import cn.palmte.work.model.Admin;
|
||||||
import cn.palmte.work.model.Dept;
|
import cn.palmte.work.model.Dept;
|
||||||
import cn.palmte.work.model.DeptRepository;
|
import cn.palmte.work.model.DeptRepository;
|
||||||
import cn.palmte.work.model.UserPositionRepository;
|
import cn.palmte.work.model.UserPositionRepository;
|
||||||
import cn.palmte.work.pojo.ModifyPasswordRequest;
|
import cn.palmte.work.pojo.ModifyPasswordRequest;
|
||||||
import cn.palmte.work.service.AccountService;
|
import cn.palmte.work.service.AccountService;
|
||||||
import cn.palmte.work.service.AdminService;
|
import cn.palmte.work.service.AdminService;
|
||||||
import cn.palmte.work.service.SysRoleService;
|
import cn.palmte.work.service.SysRoleService;
|
||||||
import cn.palmte.work.utils.InterfaceUtil;
|
import cn.palmte.work.utils.InterfaceUtil;
|
||||||
import cn.palmte.work.utils.Utils;
|
import cn.palmte.work.utils.Utils;
|
||||||
import cn.palmte.work.utils.excel.ExcelLogs;
|
import cn.palmte.work.utils.excel.ExcelLogs;
|
||||||
import cn.palmte.work.utils.excel.ExcelUtil;
|
import cn.palmte.work.utils.excel.ExcelUtil;
|
||||||
import cn.palmte.work.utils.excel.ExportUtils;
|
import cn.palmte.work.utils.excel.ExportUtils;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.poi.EncryptedDocumentException;
|
import org.apache.poi.EncryptedDocumentException;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import top.jfunc.common.crypto.symmetric.DESAS;
|
import top.jfunc.common.crypto.symmetric.DESAS;
|
||||||
import top.jfunc.common.db.bean.Page;
|
import top.jfunc.common.db.bean.Page;
|
||||||
import top.jfunc.common.utils.CollectionUtil;
|
import top.jfunc.common.utils.CollectionUtil;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/account")
|
@RequestMapping("/account")
|
||||||
public class AccountController extends BaseController {
|
public class AccountController extends BaseController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(AccountController.class);
|
private static final Logger logger = LoggerFactory.getLogger(AccountController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountService accountService;
|
private AccountService accountService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AdminService adminService;
|
private AdminService adminService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRoleService sysRoleService;
|
private SysRoleService sysRoleService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeptRepository deptRepository;
|
private DeptRepository deptRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserPositionRepository userPositionRepository;
|
private UserPositionRepository userPositionRepository;
|
||||||
|
|
||||||
@RequestMapping(value = "/updatePassword")
|
@RequestMapping(value = "/updatePassword")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg updatePassword(HttpServletRequest request, ModifyPasswordRequest modifyPasswordRequest) {
|
public ResponseMsg updatePassword(HttpServletRequest request, ModifyPasswordRequest modifyPasswordRequest) {
|
||||||
ResponseMsg responseMsg = new ResponseMsg();
|
ResponseMsg responseMsg = new ResponseMsg();
|
||||||
try {
|
try {
|
||||||
String privateKey = (String) request.getSession().getAttribute(Constant.PRIVATEKEY);
|
String privateKey = (String) request.getSession().getAttribute(Constant.PRIVATEKEY);
|
||||||
adminService.updatePassword(modifyPasswordRequest.getId(), modifyPasswordRequest.getPassword(),
|
adminService.updatePassword(modifyPasswordRequest.getId(), modifyPasswordRequest.getPassword(),
|
||||||
modifyPasswordRequest.getNewPassword(), privateKey);
|
modifyPasswordRequest.getNewPassword(), privateKey);
|
||||||
responseMsg.setStatus(0);
|
responseMsg.setStatus(0);
|
||||||
responseMsg.setMsg("密码修改成功");
|
responseMsg.setMsg("密码修改成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
responseMsg.setStatus(1);
|
responseMsg.setStatus(1);
|
||||||
responseMsg.setMsg("密码修改失败:" + e.getMessage());
|
responseMsg.setMsg("密码修改失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
|
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
// 初始化参数
|
// 初始化参数
|
||||||
setModel(keywords, model);
|
setModel(keywords, model);
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||||
model.put("deptList", deptRepository.findFirstLevelDept());
|
model.put("deptList", deptRepository.findFirstLevelDept());
|
||||||
model.put("positionList", userPositionRepository.findAll());
|
model.put("positionList", userPositionRepository.findAll());
|
||||||
Page<Admin> page = accountService.list(searchInfo, pageNumber, pageSize);
|
Page<Admin> page = accountService.list(searchInfo, pageNumber, pageSize);
|
||||||
List<Admin> list = page.getList();
|
List<Admin> list = page.getList();
|
||||||
if(CollectionUtil.isNotEmpty(list)){
|
if(CollectionUtil.isNotEmpty(list)){
|
||||||
|
|
||||||
int offset = (pageNumber - 1) * pageSize;
|
int offset = (pageNumber - 1) * pageSize;
|
||||||
for (int i = 0 , size = list.size(); i < size; i++) {
|
for (int i = 0 , size = list.size(); i < size; i++) {
|
||||||
list.get(i).setTempId(i+1 + offset);
|
list.get(i).setTempId(i+1 + offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.put("pager", page);
|
model.put("pager", page);
|
||||||
return "/admin/account_list";
|
return "/admin/account_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转到新增页面
|
* 跳转到新增页面
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/add")
|
@RequestMapping("/add")
|
||||||
public String add(HttpServletRequest request, Map<String, Object> model) {
|
public String add(HttpServletRequest request, Map<String, Object> model) {
|
||||||
genRSAKeyPair(request, model);
|
genRSAKeyPair(request, model);
|
||||||
model.put("userId", -1);
|
model.put("userId", -1);
|
||||||
model.put("account", new Admin());
|
model.put("account", new Admin());
|
||||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||||
model.put("deptList", deptRepository.findEnable());
|
model.put("deptList", deptRepository.findEnable());
|
||||||
model.put("positionList", userPositionRepository.findAll());
|
model.put("positionList", userPositionRepository.findAll());
|
||||||
return "/admin/account_input";
|
return "/admin/account_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转编辑页面
|
* 跳转编辑页面
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
public String edit(@RequestParam("userId") int userId, Map<String, Object> model) {
|
public String edit(@RequestParam("userId") int userId, Map<String, Object> model) {
|
||||||
Admin admin = accountService.findUserById(userId);
|
Admin admin = accountService.findUserById(userId);
|
||||||
model.put("account", admin);
|
model.put("account", admin);
|
||||||
model.put("userId", userId);
|
model.put("userId", userId);
|
||||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||||
model.put("deptList", deptRepository.findEnable());
|
model.put("deptList", deptRepository.findEnable());
|
||||||
model.put("positionList", userPositionRepository.findAll());
|
model.put("positionList", userPositionRepository.findAll());
|
||||||
return "/admin/account_input";
|
return "/admin/account_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存或更新用户
|
* 保存或更新用户
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
public String save(@RequestParam("userId") int userId, Admin admin, HttpServletRequest request, Map<String, Object> model) throws IOException {
|
public String save(@RequestParam("userId") int userId, Admin admin, HttpServletRequest request, Map<String, Object> model) throws IOException {
|
||||||
if (admin.getRoleId() <= 0) {
|
if (admin.getRoleId() <= 0) {
|
||||||
model.put("errorMessage", "角色不能为空!");
|
model.put("errorMessage", "角色不能为空!");
|
||||||
return "/common/error";
|
return "/common/error";
|
||||||
}
|
}
|
||||||
//获取验证用户信息
|
//获取验证用户信息
|
||||||
String message = accountService.validateUserExistInfo(userId, admin);
|
String message = accountService.validateUserExistInfo(userId, admin);
|
||||||
if (StringUtils.isNotEmpty(message)) {
|
if (StringUtils.isNotEmpty(message)) {
|
||||||
model.put("errorMessage", message);
|
model.put("errorMessage", message);
|
||||||
return "/common/error";
|
return "/common/error";
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
String privateKey = (String) session.getAttribute(Constant.PRIVATEKEY);
|
String privateKey = (String) session.getAttribute(Constant.PRIVATEKEY);
|
||||||
|
|
||||||
accountService.saveOrUpdateAccount(userId, admin.getRoleId(), admin, privateKey);
|
accountService.saveOrUpdateAccount(userId, admin.getRoleId(), admin, privateKey);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
model.put("errorMessage", "保存账号出错!请联系管理员处理");
|
model.put("errorMessage", "保存账号出错!请联系管理员处理");
|
||||||
return "/common/error";
|
return "/common/error";
|
||||||
}
|
}
|
||||||
return "redirect:/account/list";
|
return "redirect:/account/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启用、禁用用户
|
* 启用、禁用用户
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/changeStatus")
|
@RequestMapping("/changeStatus")
|
||||||
public ResponseMsg changeStatus(Admin admin) {
|
public ResponseMsg changeStatus(Admin admin) {
|
||||||
boolean locked = accountService.changeStatus(admin.getId(), admin.getEnabled());
|
boolean locked = accountService.changeStatus(admin.getId(), admin.getEnabled());
|
||||||
if (locked) {
|
if (locked) {
|
||||||
return ResponseMsg.buildSuccessMsg("操作成功");
|
return ResponseMsg.buildSuccessMsg("操作成功");
|
||||||
} else {
|
} else {
|
||||||
return ResponseMsg.buildFailedMsg("操作失败");
|
return ResponseMsg.buildFailedMsg("操作失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据删除用户
|
* 根据删除用户
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/delete")
|
@RequestMapping("/delete")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg delete(@RequestParam("userId") int userId) {
|
public ResponseMsg delete(@RequestParam("userId") int userId) {
|
||||||
ResponseMsg responseMsg = new ResponseMsg();
|
ResponseMsg responseMsg = new ResponseMsg();
|
||||||
boolean deleted = accountService.deleteAccount(userId);
|
boolean deleted = accountService.deleteAccount(userId);
|
||||||
|
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
responseMsg.setStatus(0);
|
responseMsg.setStatus(0);
|
||||||
responseMsg.setMsg("删除成功");
|
responseMsg.setMsg("删除成功");
|
||||||
} else {
|
} else {
|
||||||
responseMsg.setStatus(1);
|
responseMsg.setStatus(1);
|
||||||
responseMsg.setMsg("删除失败");
|
responseMsg.setMsg("删除失败");
|
||||||
}
|
}
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID重置用户密码
|
* 根据ID重置用户密码
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/resetPassword")
|
@RequestMapping("/resetPassword")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg resetPassword(@RequestParam("userId") int userId, HttpServletRequest request) {
|
public ResponseMsg resetPassword(@RequestParam("userId") int userId, HttpServletRequest request) {
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
String privateKey = (String) session.getAttribute(Constant.PRIVATEKEY);
|
String privateKey = (String) session.getAttribute(Constant.PRIVATEKEY);
|
||||||
boolean flag = accountService.resetPassword(userId, privateKey);
|
boolean flag = accountService.resetPassword(userId, privateKey);
|
||||||
ResponseMsg responseMsg = new ResponseMsg();
|
ResponseMsg responseMsg = new ResponseMsg();
|
||||||
if (flag) {
|
if (flag) {
|
||||||
responseMsg.setStatus(0);
|
responseMsg.setStatus(0);
|
||||||
responseMsg.setMsg("重置密码成功");
|
responseMsg.setMsg("重置密码成功");
|
||||||
} else {
|
} else {
|
||||||
responseMsg.setStatus(1);
|
responseMsg.setStatus(1);
|
||||||
responseMsg.setMsg("重置密码失败");
|
responseMsg.setMsg("重置密码失败");
|
||||||
}
|
}
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改密码请求
|
* 修改密码请求
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/password")
|
@RequestMapping("/password")
|
||||||
public String password(HttpServletRequest request, Map<String, Object> model) {
|
public String password(HttpServletRequest request, Map<String, Object> model) {
|
||||||
Admin admin = adminService.getAdminById(InterfaceUtil.getAdminId());
|
Admin admin = adminService.getAdminById(InterfaceUtil.getAdminId());
|
||||||
try {
|
try {
|
||||||
String id = new DESAS().encrypt(admin.getId().toString());
|
String id = new DESAS().encrypt(admin.getId().toString());
|
||||||
model.put("userId", id);
|
model.put("userId", id);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
model.put("SysUser", admin);
|
model.put("SysUser", admin);
|
||||||
genRSAKeyPair(request, model);
|
genRSAKeyPair(request, model);
|
||||||
return "/admin/account_password";
|
return "/admin/account_password";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
|
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
|
||||||
model.put("roleType", "-1");
|
model.put("roleType", "-1");
|
||||||
model.put("keywords", keywords);
|
model.put("keywords", keywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/export")
|
@RequestMapping("/export")
|
||||||
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
||||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||||
downloadHeader(httpServletResponse, Utils.generateExcelName("人员信息"), "application/octet-stream");
|
downloadHeader(httpServletResponse, Utils.generateExcelName("人员信息"), "application/octet-stream");
|
||||||
String[] headers = {"四算系统登录账号", "手机号码", "姓名", "常驻地", "一级部门", "二级部门", "三级部门", "直接主管", "职位", "角色名称", "公司邮件地址"};
|
String[] headers = {"四算系统登录账号", "手机号码", "姓名", "常驻地", "一级部门", "二级部门", "三级部门", "直接主管", "职位", "角色名称", "公司邮件地址"};
|
||||||
String[] exportColumns = {"userName", "telephone", "realName", "workLocation", "deptFirstName", "deptSecondName", "deptThirdName", "directManager", "positionName", "roleName", "companyEmail"};
|
String[] exportColumns = {"userName", "telephone", "realName", "workLocation", "deptFirstName", "deptSecondName", "deptThirdName", "directManager", "positionName", "roleName", "companyEmail"};
|
||||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||||
httpServletResponse.getOutputStream(), (pN, pS) -> accountService.list(searchInfo, pN, pS).getList());
|
httpServletResponse.getOutputStream(), (pN, pS) -> accountService.list(searchInfo, pN, pS).getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板下载
|
* 模板下载
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/template")
|
@RequestMapping("/template")
|
||||||
public void template(HttpServletResponse response) throws Exception {
|
public void template(HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
String[] headers = new String[]{"四算系统登录账号", "手机号码", "姓名", "常驻地", "所属部门", "直接主管", "职位", "角色名称", "公司邮件地址"};
|
String[] headers = new String[]{"四算系统登录账号", "手机号码", "姓名", "常驻地", "所属部门", "直接主管", "职位", "角色名称", "公司邮件地址"};
|
||||||
downloadHeader(response, Utils.generateExcelName("人员信息批量导入模板"));
|
downloadHeader(response, Utils.generateExcelName("人员信息批量导入模板"));
|
||||||
ExportUtils exportUtils = new ExportUtils(headers);
|
ExportUtils exportUtils = new ExportUtils(headers);
|
||||||
exportUtils.write(response.getOutputStream());
|
exportUtils.write(response.getOutputStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量导入
|
* 批量导入
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/batchImport")
|
@RequestMapping("/batchImport")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String batchImport(MultipartFile file) {
|
public String batchImport(MultipartFile file) {
|
||||||
try {
|
try {
|
||||||
ExcelLogs logs = new ExcelLogs();
|
ExcelLogs logs = new ExcelLogs();
|
||||||
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
|
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
|
||||||
"yyyy/MM/dd HH:mm:ss", logs, 0);
|
"yyyy/MM/dd HH:mm:ss", logs, 0);
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
return JSON.toJSONString(accountService.check(maps));
|
return JSON.toJSONString(accountService.check(maps));
|
||||||
}
|
}
|
||||||
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
|
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
|
||||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误,请上传excel 2003/2007格式文件"));
|
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误,请上传excel 2003/2007格式文件"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
|
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,100 +1,100 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.service.ActModelService;
|
import cn.palmte.work.service.ActModelService;
|
||||||
|
|
||||||
import cn.palmte.work.utils.ActUtil;
|
import cn.palmte.work.utils.ActUtil;
|
||||||
import cn.palmte.work.utils.InterfaceUtil;
|
import cn.palmte.work.utils.InterfaceUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程模型
|
* 流程模型
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/actModel")
|
@RequestMapping("/actModel")
|
||||||
public class ActModelController extends BaseController {
|
public class ActModelController extends BaseController {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ActModelController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ActModelController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ActUtil actUtil;
|
ActUtil actUtil;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActModelService activitiModelService;
|
private ActModelService activitiModelService;
|
||||||
|
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||||
model.put("pager", activitiModelService.list(searchInfo, pageNumber, pageSize));
|
model.put("pager", activitiModelService.list(searchInfo, pageNumber, pageSize));
|
||||||
model.put("userName", InterfaceUtil.getAdmin().getUserName());
|
model.put("userName", InterfaceUtil.getAdmin().getUserName());
|
||||||
return "/admin/act_model_list";
|
return "/admin/act_model_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/add")
|
@GetMapping(value = "/add")
|
||||||
public String add() {
|
public String add() {
|
||||||
return "/admin/act_model_input";
|
return "/admin/act_model_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
public String save(HttpServletRequest request, Map<String, Object> model) {
|
public String save(HttpServletRequest request, Map<String, Object> model) {
|
||||||
String procDefKey = request.getParameter("procDefKey");
|
String procDefKey = request.getParameter("procDefKey");
|
||||||
if (activitiModelService.findByProcDefKey(procDefKey) != null) {
|
if (activitiModelService.findByProcDefKey(procDefKey) != null) {
|
||||||
model.put("errorMessage", "流程标识已经存在!");
|
model.put("errorMessage", "流程标识已经存在!");
|
||||||
return "/common/error";
|
return "/common/error";
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
activitiModelService.createModel(procDefKey, request.getParameter("modelName"));
|
activitiModelService.createModel(procDefKey, request.getParameter("modelName"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("", e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
return "redirect:/actModel/list";
|
return "redirect:/actModel/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping(value = "/delete")
|
@GetMapping(value = "/delete")
|
||||||
public ResponseMsg delete(@RequestParam("ids") String ids) {
|
public ResponseMsg delete(@RequestParam("ids") String ids) {
|
||||||
if ("".equals(ids)) {
|
if ("".equals(ids)) {
|
||||||
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
|
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
|
||||||
} else {
|
} else {
|
||||||
String[] deleteIds = ids.split("#%#");
|
String[] deleteIds = ids.split("#%#");
|
||||||
for (String id : deleteIds) {
|
for (String id : deleteIds) {
|
||||||
activitiModelService.deleteModel(id);
|
activitiModelService.deleteModel(id);
|
||||||
}
|
}
|
||||||
return ResponseMsg.buildSuccessMsg("删除成功");
|
return ResponseMsg.buildSuccessMsg("删除成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部署流程
|
* 部署流程
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping(value = "/deploy")
|
@GetMapping(value = "/deploy")
|
||||||
public ResponseMsg deploy(@RequestParam("id") String id) {
|
public ResponseMsg deploy(@RequestParam("id") String id) {
|
||||||
try {
|
try {
|
||||||
activitiModelService.deploy(id);
|
activitiModelService.deploy(id);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("", e);
|
logger.error("", e);
|
||||||
return ResponseMsg.buildFailedMsg(e.getMessage());
|
return ResponseMsg.buildFailedMsg(e.getMessage());
|
||||||
}
|
}
|
||||||
return ResponseMsg.buildSuccessMsg("部署成功");
|
return ResponseMsg.buildSuccessMsg("部署成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,132 +1,132 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||||
import org.activiti.engine.ActivitiException;
|
import org.activiti.engine.ActivitiException;
|
||||||
import org.activiti.engine.RepositoryService;
|
import org.activiti.engine.RepositoryService;
|
||||||
import org.activiti.engine.repository.Model;
|
import org.activiti.engine.repository.Model;
|
||||||
import org.apache.batik.transcoder.TranscoderInput;
|
import org.apache.batik.transcoder.TranscoderInput;
|
||||||
import org.apache.batik.transcoder.TranscoderOutput;
|
import org.apache.batik.transcoder.TranscoderOutput;
|
||||||
import org.apache.batik.transcoder.image.PNGTranscoder;
|
import org.apache.batik.transcoder.image.PNGTranscoder;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程网页编辑器
|
* 流程网页编辑器
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class ActModelEditorController implements ModelDataJsonConstants {
|
public class ActModelEditorController implements ModelDataJsonConstants {
|
||||||
|
|
||||||
protected static final Logger LOGGER = LoggerFactory.getLogger(ActModelEditorController.class);
|
protected static final Logger LOGGER = LoggerFactory.getLogger(ActModelEditorController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RepositoryService repositoryService;
|
private RepositoryService repositoryService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ObjectMapper objectMapper;
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取编辑器汉化文件
|
* 获取编辑器汉化文件
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping(value = "/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
|
@RequestMapping(value = "/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
|
||||||
public String getStencilset() {
|
public String getStencilset() {
|
||||||
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
|
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
|
||||||
try {
|
try {
|
||||||
return IOUtils.toString(stencilsetStream, "utf-8");
|
return IOUtils.toString(stencilsetStream, "utf-8");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//logger.error("an exception happens in try catch statement", e);
|
//logger.error("an exception happens in try catch statement", e);
|
||||||
throw new ActivitiException("Error while loading stencil set", e);
|
throw new ActivitiException("Error while loading stencil set", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (stencilsetStream != null) {
|
if (stencilsetStream != null) {
|
||||||
try {
|
try {
|
||||||
stencilsetStream.close();
|
stencilsetStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据模型id获取json格式的数据
|
* 根据模型id获取json格式的数据
|
||||||
*
|
*
|
||||||
* @param modelId
|
* @param modelId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
|
@RequestMapping(value = "/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
|
||||||
public ObjectNode getEditorJson(@PathVariable String modelId) {
|
public ObjectNode getEditorJson(@PathVariable String modelId) {
|
||||||
ObjectNode modelNode = null;
|
ObjectNode modelNode = null;
|
||||||
Model model = repositoryService.getModel(modelId);
|
Model model = repositoryService.getModel(modelId);
|
||||||
if (model != null) {
|
if (model != null) {
|
||||||
try {
|
try {
|
||||||
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
|
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
|
||||||
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
|
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
|
||||||
} else {
|
} else {
|
||||||
modelNode = objectMapper.createObjectNode();
|
modelNode = objectMapper.createObjectNode();
|
||||||
modelNode.put(MODEL_NAME, model.getName());
|
modelNode.put(MODEL_NAME, model.getName());
|
||||||
}
|
}
|
||||||
modelNode.put(MODEL_ID, model.getId());
|
modelNode.put(MODEL_ID, model.getId());
|
||||||
String content = new String(repositoryService.getModelEditorSource(model.getId()), "utf-8");
|
String content = new String(repositoryService.getModelEditorSource(model.getId()), "utf-8");
|
||||||
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(content);
|
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(content);
|
||||||
modelNode.put("model", editorJsonNode);
|
modelNode.put("model", editorJsonNode);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("an exception happens in try catch statement", e);
|
LOGGER.error("an exception happens in try catch statement", e);
|
||||||
throw new ActivitiException("Error creating model JSON", e);
|
throw new ActivitiException("Error creating model JSON", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return modelNode;
|
return modelNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存模型数据
|
* 保存模型数据
|
||||||
*
|
*
|
||||||
* @param modelId
|
* @param modelId
|
||||||
* @param values
|
* @param values
|
||||||
*/
|
*/
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@RequestMapping(value = "/model/{modelId}/save", method = RequestMethod.PUT)
|
@RequestMapping(value = "/model/{modelId}/save", method = RequestMethod.PUT)
|
||||||
public void saveModel(@PathVariable String modelId, @RequestParam MultiValueMap<String, String> values) {
|
public void saveModel(@PathVariable String modelId, @RequestParam MultiValueMap<String, String> values) {
|
||||||
try {
|
try {
|
||||||
Model model = repositoryService.getModel(modelId);
|
Model model = repositoryService.getModel(modelId);
|
||||||
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
|
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
|
||||||
modelJson.put(MODEL_NAME, values.getFirst("name"));
|
modelJson.put(MODEL_NAME, values.getFirst("name"));
|
||||||
modelJson.put(MODEL_DESCRIPTION, values.getFirst("description"));
|
modelJson.put(MODEL_DESCRIPTION, values.getFirst("description"));
|
||||||
model.setMetaInfo(modelJson.toString());
|
model.setMetaInfo(modelJson.toString());
|
||||||
model.setName(values.getFirst("name"));
|
model.setName(values.getFirst("name"));
|
||||||
repositoryService.saveModel(model);
|
repositoryService.saveModel(model);
|
||||||
repositoryService.addModelEditorSource(model.getId(), values.getFirst("json_xml").getBytes("utf-8"));
|
repositoryService.addModelEditorSource(model.getId(), values.getFirst("json_xml").getBytes("utf-8"));
|
||||||
InputStream svgStream = new ByteArrayInputStream(values.getFirst("svg_xml").getBytes("utf-8"));
|
InputStream svgStream = new ByteArrayInputStream(values.getFirst("svg_xml").getBytes("utf-8"));
|
||||||
TranscoderInput input = new TranscoderInput(svgStream);
|
TranscoderInput input = new TranscoderInput(svgStream);
|
||||||
PNGTranscoder transcoder = new PNGTranscoder();
|
PNGTranscoder transcoder = new PNGTranscoder();
|
||||||
// Setup output
|
// Setup output
|
||||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
||||||
TranscoderOutput output = new TranscoderOutput(outStream);
|
TranscoderOutput output = new TranscoderOutput(outStream);
|
||||||
// Do the transformation
|
// Do the transformation
|
||||||
transcoder.transcode(input, output);
|
transcoder.transcode(input, output);
|
||||||
final byte[] result = outStream.toByteArray();
|
final byte[] result = outStream.toByteArray();
|
||||||
repositoryService.addModelEditorSourceExtra(model.getId(), result);
|
repositoryService.addModelEditorSourceExtra(model.getId(), result);
|
||||||
outStream.close();
|
outStream.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("an exception happens in try catch statement", e);
|
LOGGER.error("an exception happens in try catch statement", e);
|
||||||
throw new ActivitiException("Error saving model", e);
|
throw new ActivitiException("Error saving model", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,106 +1,106 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.service.ActProcDefService;
|
import cn.palmte.work.service.ActProcDefService;
|
||||||
import cn.palmte.work.utils.ActUtil;
|
import cn.palmte.work.utils.ActUtil;
|
||||||
import cn.palmte.work.utils.InterfaceUtil;
|
import cn.palmte.work.utils.InterfaceUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程定义
|
* 流程定义
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/actProcDef")
|
@RequestMapping("/actProcDef")
|
||||||
public class ActProcDefController extends BaseController {
|
public class ActProcDefController extends BaseController {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ActProcDefController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ActProcDefController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActProcDefService actProcDefService;
|
private ActProcDefService actProcDefService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActUtil actUtil;
|
private ActUtil actUtil;
|
||||||
|
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||||
model.put("userName", InterfaceUtil.getAdmin().getUserName());
|
model.put("userName", InterfaceUtil.getAdmin().getUserName());
|
||||||
model.put("pager", actProcDefService.list(searchInfo, pageNumber, pageSize));
|
model.put("pager", actProcDefService.list(searchInfo, pageNumber, pageSize));
|
||||||
return "/admin/act_proc_def_list";
|
return "/admin/act_proc_def_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看默认的未标红的流程图片
|
* 查看默认的未标红的流程图片
|
||||||
*
|
*
|
||||||
* @param response
|
* @param response
|
||||||
* @param deploymentId
|
* @param deploymentId
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/procDefPng/{deploymentId}")
|
@RequestMapping("/procDefPng/{deploymentId}")
|
||||||
public void png(HttpServletResponse response, @PathVariable("deploymentId") String deploymentId) throws Exception {
|
public void png(HttpServletResponse response, @PathVariable("deploymentId") String deploymentId) throws Exception {
|
||||||
actProcDefService.createProcDefPng(response, deploymentId);
|
actProcDefService.createProcDefPng(response, deploymentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看流程xml
|
* 查看流程xml
|
||||||
*
|
*
|
||||||
* @param deploymentId
|
* @param deploymentId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/xml/{deploymentId}")
|
@RequestMapping("/xml/{deploymentId}")
|
||||||
public void xml(HttpServletResponse response, @PathVariable("deploymentId") String deploymentId) throws Exception {
|
public void xml(HttpServletResponse response, @PathVariable("deploymentId") String deploymentId) throws Exception {
|
||||||
actUtil.responseXml(response, deploymentId);
|
actUtil.responseXml(response, deploymentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除流程
|
* 删除流程
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping(value = "/delete")
|
@GetMapping(value = "/delete")
|
||||||
public ResponseMsg delete(@RequestParam("ids") String ids) {
|
public ResponseMsg delete(@RequestParam("ids") String ids) {
|
||||||
if ("".equals(ids)) {
|
if ("".equals(ids)) {
|
||||||
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
|
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
|
||||||
} else {
|
} else {
|
||||||
String[] deleteIds = ids.split("#%#");
|
String[] deleteIds = ids.split("#%#");
|
||||||
for (String id : deleteIds) {
|
for (String id : deleteIds) {
|
||||||
actProcDefService.deleteDeployment(id);
|
actProcDefService.deleteDeployment(id);
|
||||||
}
|
}
|
||||||
return ResponseMsg.buildSuccessMsg("删除成功");
|
return ResponseMsg.buildSuccessMsg("删除成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 挂起与激活
|
* 挂起与激活
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param status 1-激活 2-挂起
|
* @param status 1-激活 2-挂起
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping(value = "/suspend")
|
@GetMapping(value = "/suspend")
|
||||||
public String suspend(@RequestParam String id, @RequestParam int status) {
|
public String suspend(@RequestParam String id, @RequestParam int status) {
|
||||||
actProcDefService.suspend(id, status);
|
actProcDefService.suspend(id, status);
|
||||||
return "redirect:/actProcDef/list";
|
return "redirect:/actProcDef/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,106 +1,106 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.config.activiti.ActConstant;
|
import cn.palmte.work.config.activiti.ActConstant;
|
||||||
import cn.palmte.work.service.ActProcInsService;
|
import cn.palmte.work.service.ActProcInsService;
|
||||||
import cn.palmte.work.utils.InterfaceUtil;
|
import cn.palmte.work.utils.InterfaceUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程实列相关
|
* 流程实列相关
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/actProcIns")
|
@RequestMapping("/actProcIns")
|
||||||
public class ActProcInsController extends BaseController {
|
public class ActProcInsController extends BaseController {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ActProcInsController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ActProcInsController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActProcInsService actProcInsService;
|
private ActProcInsService actProcInsService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*
|
*
|
||||||
* @param keywords
|
* @param keywords
|
||||||
* @param pageNumber
|
* @param pageNumber
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||||
model.put("pager", actProcInsService.list(searchInfo, pageNumber, pageSize));
|
model.put("pager", actProcInsService.list(searchInfo, pageNumber, pageSize));
|
||||||
return "/admin/act_proc_ins_list";
|
return "/admin/act_proc_ins_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除流程实例
|
* 删除流程实例
|
||||||
*
|
*
|
||||||
* @param procInsId
|
* @param procInsId
|
||||||
* @param reason
|
* @param reason
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping(value = "/deleteProcessInstance")
|
@GetMapping(value = "/deleteProcessInstance")
|
||||||
public ResponseMsg deleteProcessInstance(@RequestParam String procInsId, @RequestParam String reason) {
|
public ResponseMsg deleteProcessInstance(@RequestParam String procInsId, @RequestParam String reason) {
|
||||||
actProcInsService.deleteProcessInstance(procInsId, reason);
|
actProcInsService.deleteProcessInstance(procInsId, reason);
|
||||||
return ResponseMsg.buildSuccessMsg("撤销成功");
|
return ResponseMsg.buildSuccessMsg("撤销成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程实列图片
|
* 流程实列图片
|
||||||
*
|
*
|
||||||
* @param response
|
* @param response
|
||||||
* @param procInstId
|
* @param procInstId
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/procInsPng/{procInstId}")
|
@RequestMapping("/procInsPng/{procInstId}")
|
||||||
public void png(HttpServletResponse response, @PathVariable("procInstId") String procInstId) throws Exception {
|
public void png(HttpServletResponse response, @PathVariable("procInstId") String procInstId) throws Exception {
|
||||||
actProcInsService.createProcInsPng(response, procInstId);
|
actProcInsService.createProcInsPng(response, procInstId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动流程
|
* 启动流程
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping(value = "/startProcIns/{procDefKey}")
|
@PostMapping(value = "/startProcIns/{procDefKey}")
|
||||||
public ResponseMsg startProcessInstance(@PathVariable String procDefKey, @RequestBody String body) {
|
public ResponseMsg startProcessInstance(@PathVariable String procDefKey, @RequestBody String body) {
|
||||||
JSONObject json = JSON.parseObject(body);
|
JSONObject json = JSON.parseObject(body);
|
||||||
Map<String, Object> variables = new HashMap<>();
|
Map<String, Object> variables = new HashMap<>();
|
||||||
for (Object key : json.keySet()) {
|
for (Object key : json.keySet()) {
|
||||||
variables.put((String)key, json.get(key));
|
variables.put((String)key, json.get(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
variables.put(ActConstant.START_PROCESS_USERID, InterfaceUtil.getAdminId());
|
variables.put(ActConstant.START_PROCESS_USERID, InterfaceUtil.getAdminId());
|
||||||
String procInsId = null;
|
String procInsId = null;
|
||||||
try {
|
try {
|
||||||
procInsId = actProcInsService.startProcessInstance(procDefKey, "0", variables);
|
procInsId = actProcInsService.startProcessInstance(procDefKey, "0", variables);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("", e);
|
logger.error("", e);
|
||||||
return ResponseMsg.buildFailedMsg("流程启动失败:" + e.getMessage());
|
return ResponseMsg.buildFailedMsg("流程启动失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
return ResponseMsg.buildSuccessMsg("流程启动成功", procInsId);
|
return ResponseMsg.buildSuccessMsg("流程启动成功", procInsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,107 +1,107 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.model.ActTaskDef;
|
import cn.palmte.work.model.ActTaskDef;
|
||||||
import cn.palmte.work.model.AdminRepository;
|
import cn.palmte.work.model.AdminRepository;
|
||||||
import cn.palmte.work.pojo.ActHisTask;
|
import cn.palmte.work.pojo.ActHisTask;
|
||||||
import cn.palmte.work.service.ActTaskDefService;
|
import cn.palmte.work.service.ActTaskDefService;
|
||||||
import cn.palmte.work.service.SysRoleService;
|
import cn.palmte.work.service.SysRoleService;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程任务
|
* 流程任务
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/actTaskDef")
|
@RequestMapping("/actTaskDef")
|
||||||
public class ActTaskDefController extends BaseController {
|
public class ActTaskDefController extends BaseController {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ActTaskDefController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ActTaskDefController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AdminRepository adminRepository;
|
private AdminRepository adminRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRoleService sysRoleService;
|
private SysRoleService sysRoleService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActTaskDefService actTaskDefService;
|
private ActTaskDefService actTaskDefService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 去任务配置页面
|
* 去任务配置页面
|
||||||
*
|
*
|
||||||
* @param procDefId
|
* @param procDefId
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/config/{procDefId}")
|
@RequestMapping("/config/{procDefId}")
|
||||||
public String list(@PathVariable String procDefId, Map<String, Object> model) {
|
public String list(@PathVariable String procDefId, Map<String, Object> model) {
|
||||||
List<ActTaskDef> list = actTaskDefService.findByProcDefId(procDefId);
|
List<ActTaskDef> list = actTaskDefService.findByProcDefId(procDefId);
|
||||||
//过滤掉发起节点的全是审批节点
|
//过滤掉发起节点的全是审批节点
|
||||||
List<ActTaskDef> approveList = list.stream().filter(t-> t.getTaskIndex() == 0).collect(Collectors.toList());
|
List<ActTaskDef> approveList = list.stream().filter(t-> t.getTaskIndex() == 0).collect(Collectors.toList());
|
||||||
model.put("procDefId", procDefId);
|
model.put("procDefId", procDefId);
|
||||||
model.put("taskList", list);
|
model.put("taskList", list);
|
||||||
model.put("approveList", approveList);
|
model.put("approveList", approveList);
|
||||||
model.put("procDefName", list.get(0).getProcDefName());
|
model.put("procDefName", list.get(0).getProcDefName());
|
||||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||||
model.put("adminList", adminRepository.getAllEnable());
|
model.put("adminList", adminRepository.getAllEnable());
|
||||||
|
|
||||||
return "/admin/act_task_def";
|
return "/admin/act_task_def";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务配置保存
|
* 任务配置保存
|
||||||
*
|
*
|
||||||
* @param taskDef
|
* @param taskDef
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping(value = "/saveConfig")
|
@GetMapping(value = "/saveConfig")
|
||||||
public ResponseMsg saveConfig(ActTaskDef taskDef) {
|
public ResponseMsg saveConfig(ActTaskDef taskDef) {
|
||||||
actTaskDefService.saveConfig(taskDef);
|
actTaskDefService.saveConfig(taskDef);
|
||||||
return ResponseMsg.buildSuccessMsg("成功");
|
return ResponseMsg.buildSuccessMsg("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理员完成某个任务
|
* 管理员完成某个任务
|
||||||
* 审批通过或者驳回
|
* 审批通过或者驳回
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping(value = "/completeTask")
|
@PostMapping(value = "/completeTask")
|
||||||
public ResponseMsg completeTask(@RequestBody String json) {
|
public ResponseMsg completeTask(@RequestBody String json) {
|
||||||
JSONObject jsonParam = JSON.parseObject(json);
|
JSONObject jsonParam = JSON.parseObject(json);
|
||||||
actTaskDefService.completeTask(jsonParam);
|
actTaskDefService.completeTask(jsonParam);
|
||||||
return ResponseMsg.buildSuccessMsg("处理成功");
|
return ResponseMsg.buildSuccessMsg("处理成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批过程查看
|
* 审批过程查看
|
||||||
*
|
*
|
||||||
* @param procInsId
|
* @param procInsId
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/hisTaskList/{procInsId}")
|
@RequestMapping("/hisTaskList/{procInsId}")
|
||||||
public String taskList(@PathVariable String procInsId, Map<String, Object> model) {
|
public String taskList(@PathVariable String procInsId, Map<String, Object> model) {
|
||||||
List<ActHisTask> list = actTaskDefService.hisTaskList(procInsId);
|
List<ActHisTask> list = actTaskDefService.hisTaskList(procInsId);
|
||||||
model.put("taskList", list);
|
model.put("taskList", list);
|
||||||
model.put("procInsId", procInsId);
|
model.put("procInsId", procInsId);
|
||||||
return "/admin/act_his_task_list";
|
return "/admin/act_his_task_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,300 +1,300 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.config.Constant;
|
import cn.palmte.work.config.Constant;
|
||||||
import cn.palmte.work.model.*;
|
import cn.palmte.work.model.*;
|
||||||
import cn.palmte.work.pojo.LoginRequest;
|
import cn.palmte.work.pojo.LoginRequest;
|
||||||
import cn.palmte.work.pojo.LoginResponse;
|
import cn.palmte.work.pojo.LoginResponse;
|
||||||
import cn.palmte.work.service.AdminService;
|
import cn.palmte.work.service.AdminService;
|
||||||
import cn.palmte.work.service.LoginLogService;
|
import cn.palmte.work.service.LoginLogService;
|
||||||
import cn.palmte.work.service.ProjectService;
|
import cn.palmte.work.service.ProjectService;
|
||||||
import cn.palmte.work.utils.*;
|
import cn.palmte.work.utils.*;
|
||||||
import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils;
|
import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.authc.IncorrectCredentialsException;
|
import org.apache.shiro.authc.IncorrectCredentialsException;
|
||||||
import org.apache.shiro.authc.LockedAccountException;
|
import org.apache.shiro.authc.LockedAccountException;
|
||||||
import org.apache.shiro.authc.UnknownAccountException;
|
import org.apache.shiro.authc.UnknownAccountException;
|
||||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
import top.jfunc.common.db.bean.Page;
|
import top.jfunc.common.db.bean.Page;
|
||||||
import top.jfunc.common.utils.CollectionUtil;
|
import top.jfunc.common.utils.CollectionUtil;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/admin")
|
@RequestMapping("/admin")
|
||||||
public class AdminController extends BaseController {
|
public class AdminController extends BaseController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(AdminController.class);
|
private static final Logger logger = LoggerFactory.getLogger(AdminController.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
private AdminService adminService;
|
private AdminService adminService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private LoginLogService loginLogService;
|
private LoginLogService loginLogService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRoleRepository sysRoleRepository;
|
private SysRoleRepository sysRoleRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
|
|
||||||
@PostMapping(value = "/singIn")
|
@PostMapping(value = "/singIn")
|
||||||
public String singIn(RedirectAttributes attr, LoginRequest loginRequest, HttpServletRequest request) throws Exception {
|
public String singIn(RedirectAttributes attr, LoginRequest loginRequest, HttpServletRequest request) throws Exception {
|
||||||
String userName = loginRequest.getUserName();
|
String userName = loginRequest.getUserName();
|
||||||
String password = loginRequest.getPassword();
|
String password = loginRequest.getPassword();
|
||||||
//String captchaToken = loginRequest.getCaptchaToken();
|
//String captchaToken = loginRequest.getCaptchaToken();
|
||||||
String code;
|
String code;
|
||||||
String message;
|
String message;
|
||||||
try{
|
try{
|
||||||
/*try{
|
/*try{
|
||||||
code = request.getSession().getAttribute(CaptchaUtils.RANDOM_CODE_KEY).toString();
|
code = request.getSession().getAttribute(CaptchaUtils.RANDOM_CODE_KEY).toString();
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.info(e.getMessage() , e);
|
logger.info(e.getMessage() , e);
|
||||||
message ="验证码错误";
|
message ="验证码错误";
|
||||||
attr.addAttribute("errorMessages",message);
|
attr.addAttribute("errorMessages",message);
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}*/
|
}*/
|
||||||
try {
|
try {
|
||||||
String privateKey = request.getSession().getAttribute(Constant.PRIVATEKEY).toString();
|
String privateKey = request.getSession().getAttribute(Constant.PRIVATEKEY).toString();
|
||||||
userName = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(userName), privateKey));
|
userName = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(userName), privateKey));
|
||||||
password = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(password), privateKey));
|
password = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(password), privateKey));
|
||||||
//captchaToken = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(captchaToken),privateKey));
|
//captchaToken = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(captchaToken),privateKey));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("解密出错", e);
|
logger.error("解密出错", e);
|
||||||
attr.addAttribute("errorMessages", "用户名密码错误");
|
attr.addAttribute("errorMessages", "用户名密码错误");
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}
|
}
|
||||||
attr.addAttribute("userName", userName);
|
attr.addAttribute("userName", userName);
|
||||||
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)) {
|
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)) {
|
||||||
message = "用户名或密码错误!";
|
message = "用户名或密码错误!";
|
||||||
attr.addAttribute("errorMessages", message);
|
attr.addAttribute("errorMessages", message);
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}
|
}
|
||||||
/*if(!captchaToken.toUpperCase().equals(code)){
|
/*if(!captchaToken.toUpperCase().equals(code)){
|
||||||
message ="验证码错误!";
|
message ="验证码错误!";
|
||||||
attr.addAttribute("errorMessages",message);
|
attr.addAttribute("errorMessages",message);
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}*/
|
}*/
|
||||||
/**
|
/**
|
||||||
* 移除验证数据
|
* 移除验证数据
|
||||||
*/
|
*/
|
||||||
//request.getSession().removeAttribute(CaptchaUtils.RANDOM_CODE_KEY);
|
//request.getSession().removeAttribute(CaptchaUtils.RANDOM_CODE_KEY);
|
||||||
Admin admin = adminService.getAdminByUsername(userName);
|
Admin admin = adminService.getAdminByUsername(userName);
|
||||||
if (null == admin) {
|
if (null == admin) {
|
||||||
message = "用户名或密码错误~~~";
|
message = "用户名或密码错误~~~";
|
||||||
attr.addAttribute("errorMessages", message);
|
attr.addAttribute("errorMessages", message);
|
||||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}
|
}
|
||||||
if (admin.getEnabled() == 0) {
|
if (admin.getEnabled() == 0) {
|
||||||
message = "该用户已禁用~~~";
|
message = "该用户已禁用~~~";
|
||||||
attr.addAttribute("errorMessages", message);
|
attr.addAttribute("errorMessages", message);
|
||||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}
|
}
|
||||||
if (adminService.isLocked(admin)) {
|
if (adminService.isLocked(admin)) {
|
||||||
message = "该用户已被锁定~~~";
|
message = "该用户已被锁定~~~";
|
||||||
attr.addAttribute("errorMessages", message);
|
attr.addAttribute("errorMessages", message);
|
||||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}
|
}
|
||||||
int roleId = admin.getRoleId();
|
int roleId = admin.getRoleId();
|
||||||
SysRole role = sysRoleRepository.findOne(roleId);
|
SysRole role = sysRoleRepository.findOne(roleId);
|
||||||
|
|
||||||
if (role.getIsEnable() == 0) {
|
if (role.getIsEnable() == 0) {
|
||||||
message = "该用户绑定的角色已禁用~~~";
|
message = "该用户绑定的角色已禁用~~~";
|
||||||
attr.addAttribute("errorMessages", message);
|
attr.addAttribute("errorMessages", message);
|
||||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}
|
}
|
||||||
|
|
||||||
String salt = admin.getSalt();
|
String salt = admin.getSalt();
|
||||||
request.getSession().setAttribute("realsName", admin.getRealName());
|
request.getSession().setAttribute("realsName", admin.getRealName());
|
||||||
//request.getSession().setAttribute("telephone", admin.getTelephone());
|
//request.getSession().setAttribute("telephone", admin.getTelephone());
|
||||||
request.getSession().setAttribute("lastLoginTime", admin.getLoginDate());
|
request.getSession().setAttribute("lastLoginTime", admin.getLoginDate());
|
||||||
String newPassword;
|
String newPassword;
|
||||||
try {
|
try {
|
||||||
newPassword = DESCrypto.encryptPassword(password, salt);
|
newPassword = DESCrypto.encryptPassword(password, salt);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("加密出错", e);
|
logger.error("加密出错", e);
|
||||||
message = "密码出错";
|
message = "密码出错";
|
||||||
attr.addAttribute("errorMessages", message);
|
attr.addAttribute("errorMessages", message);
|
||||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean bool = checkUpdatePasswordTime(admin);
|
boolean bool = checkUpdatePasswordTime(admin);
|
||||||
if (bool) {
|
if (bool) {
|
||||||
request.getSession().setAttribute("message", "您已超过90天未修改密码!");
|
request.getSession().setAttribute("message", "您已超过90天未修改密码!");
|
||||||
} else {
|
} else {
|
||||||
request.getSession().setAttribute("message", "");
|
request.getSession().setAttribute("message", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
message = login(userName, newPassword, false, false);
|
message = login(userName, admin.getPassword(), false, false);
|
||||||
if (!message.isEmpty()) {
|
if (!message.isEmpty()) {
|
||||||
attr.addAttribute("errorMessages", message);
|
attr.addAttribute("errorMessages", message);
|
||||||
|
|
||||||
//增加登录失败次数
|
//增加登录失败次数
|
||||||
adminService.addLoginError(admin);
|
adminService.addLoginError(admin);
|
||||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||||
|
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}
|
}
|
||||||
adminService.updateLoginInfo(admin, request);
|
adminService.updateLoginInfo(admin, request);
|
||||||
loginLogService.saveLog(userName, LoginLog.SUCCESS, "登录成功");
|
loginLogService.saveLog(userName, LoginLog.SUCCESS, "登录成功");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* admin用户去检查,如果检查job有失败的,显示弹出框[1]
|
* admin用户去检查,如果检查job有失败的,显示弹出框[1]
|
||||||
*/
|
*/
|
||||||
return "redirect:/admin/center?uid=0";
|
return "redirect:/admin/center?uid=0";
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
message = "登录发生未知错误,e=" + e.getMessage();
|
message = "登录发生未知错误,e=" + e.getMessage();
|
||||||
attr.addAttribute("errorMessages", message);
|
attr.addAttribute("errorMessages", message);
|
||||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
logger.error(t.getMessage(), t);
|
logger.error(t.getMessage(), t);
|
||||||
message = "登录发生未知错误,t=" + t.getMessage();
|
message = "登录发生未知错误,t=" + t.getMessage();
|
||||||
attr.addAttribute("errorMessages", message);
|
attr.addAttribute("errorMessages", message);
|
||||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||||
return "redirect:/admin/err";
|
return "redirect:/admin/err";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算当前时间和最后一次修改密码的天数
|
* 计算当前时间和最后一次修改密码的天数
|
||||||
* @param admin
|
* @param admin
|
||||||
* @return
|
* @return
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
*/
|
*/
|
||||||
public boolean checkUpdatePasswordTime(Admin admin) throws ParseException {
|
public boolean checkUpdatePasswordTime(Admin admin) throws ParseException {
|
||||||
if (null != admin.getUpdatedPasswordTime()) {
|
if (null != admin.getUpdatedPasswordTime()) {
|
||||||
int days = DateKit.daysBetween(admin.getUpdatedPasswordTime(), new Date());
|
int days = DateKit.daysBetween(admin.getUpdatedPasswordTime(), new Date());
|
||||||
if (days >= 90) {
|
if (days >= 90) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统一的的登录方法
|
* 统一的的登录方法
|
||||||
*
|
*
|
||||||
* @param returnJson 是否返回json格式的数据,否就是返回登录页面
|
* @param returnJson 是否返回json格式的数据,否就是返回登录页面
|
||||||
*/
|
*/
|
||||||
public String login(String username, String password, boolean rememberMe, boolean returnJson) {
|
public String login(String username, String password, boolean rememberMe, boolean returnJson) {
|
||||||
//TODO:登录验证逻辑(待补充)
|
//TODO:登录验证逻辑(待补充)
|
||||||
String errorMessage = "";
|
String errorMessage = "";
|
||||||
Subject subject = SecurityUtils.getSubject();
|
Subject subject = SecurityUtils.getSubject();
|
||||||
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
|
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
|
||||||
token.setRememberMe(rememberMe);
|
token.setRememberMe(rememberMe);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
} catch (UnknownAccountException | LockedAccountException ue) {
|
} catch (UnknownAccountException | LockedAccountException ue) {
|
||||||
token.clear();
|
token.clear();
|
||||||
errorMessage = ue.getMessage();
|
errorMessage = ue.getMessage();
|
||||||
} catch (IncorrectCredentialsException ie) {
|
} catch (IncorrectCredentialsException ie) {
|
||||||
token.clear();
|
token.clear();
|
||||||
errorMessage = "用户名或密码错误~~~";
|
errorMessage = "用户名或密码错误~~~";
|
||||||
} catch (RuntimeException re) {
|
} catch (RuntimeException re) {
|
||||||
re.printStackTrace();
|
re.printStackTrace();
|
||||||
token.clear();
|
token.clear();
|
||||||
errorMessage = "登录失败!";
|
errorMessage = "登录失败!";
|
||||||
}
|
}
|
||||||
return errorMessage;
|
return errorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/login", method = {RequestMethod.GET})
|
@RequestMapping(value = "/login", method = {RequestMethod.GET})
|
||||||
public String login(HttpServletRequest request) throws Exception {
|
public String login(HttpServletRequest request) throws Exception {
|
||||||
//TODO:登录页面初始化代码
|
//TODO:登录页面初始化代码
|
||||||
InterfaceUtil.genRSAKeyPair(request);
|
InterfaceUtil.genRSAKeyPair(request);
|
||||||
return "/admin/admin_login";
|
return "/admin/admin_login";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/center", method = RequestMethod.GET)
|
@RequestMapping(value = "/center", method = RequestMethod.GET)
|
||||||
public String center(@ModelAttribute("userName") String userName, @RequestParam("uid") int uid,
|
public String center(@ModelAttribute("userName") String userName, @RequestParam("uid") int uid,
|
||||||
@RequestParam(value = "showJobMonitorError", defaultValue = "0") int showJobMonitorError, Map<String, Object> model) {
|
@RequestParam(value = "showJobMonitorError", defaultValue = "0") int showJobMonitorError, Map<String, Object> model) {
|
||||||
logger.info("------------------------------------------重定向到首页信息查询center方法内部-----------------------用户名====" + userName);
|
logger.info("------------------------------------------重定向到首页信息查询center方法内部-----------------------用户名====" + userName);
|
||||||
|
|
||||||
LoginResponse loginResponse = adminService.initMenuList(uid);
|
LoginResponse loginResponse = adminService.initMenuList(uid);
|
||||||
model.put("userName", userName);
|
model.put("userName", userName);
|
||||||
model.put("loginResponse", loginResponse);
|
model.put("loginResponse", loginResponse);
|
||||||
if (uid == 0) {
|
if (uid == 0) {
|
||||||
uid = (loginResponse.getTopMenuList() != null && loginResponse.getTopMenuList().size() > 0) ? loginResponse.getTopMenuList().get(0).getId() : 0;
|
uid = (loginResponse.getTopMenuList() != null && loginResponse.getTopMenuList().size() > 0) ? loginResponse.getTopMenuList().get(0).getId() : 0;
|
||||||
}
|
}
|
||||||
model.put("uid", uid);
|
model.put("uid", uid);
|
||||||
model.put("showJobMonitorError", showJobMonitorError);
|
model.put("showJobMonitorError", showJobMonitorError);
|
||||||
logger.info("------------------------------------------跳转到admin_index-----------------------");
|
logger.info("------------------------------------------跳转到admin_index-----------------------");
|
||||||
return "/admin/admin_index";
|
return "/admin/admin_index";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/topMenu", method = RequestMethod.GET)
|
@RequestMapping(value = "/topMenu", method = RequestMethod.GET)
|
||||||
public String topMenu(@RequestParam("uid") int uid, Map<String, Object> model) {
|
public String topMenu(@RequestParam("uid") int uid, Map<String, Object> model) {
|
||||||
LoginResponse loginResponse = adminService.initMenuList(uid);
|
LoginResponse loginResponse = adminService.initMenuList(uid);
|
||||||
model.put("loginResponse", loginResponse);
|
model.put("loginResponse", loginResponse);
|
||||||
return "/admin/admin_index";
|
return "/admin/admin_index";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/console", method = RequestMethod.GET)
|
@RequestMapping(value = "/console", method = RequestMethod.GET)
|
||||||
public String console(@RequestParam("uid") int uid, Map<String, Object> model, HttpServletRequest request) {
|
public String console(@RequestParam("uid") int uid, Map<String, Object> model, HttpServletRequest request) {
|
||||||
logger.info(uid + "");
|
logger.info(uid + "");
|
||||||
model.put("statistic", "");
|
model.put("statistic", "");
|
||||||
return "/admin/console";
|
return "/admin/console";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/err", method = RequestMethod.GET)
|
@RequestMapping(value = "/err", method = RequestMethod.GET)
|
||||||
public String loginErr(HttpServletRequest request, @ModelAttribute("errorMessages") String errorMessages) {
|
public String loginErr(HttpServletRequest request, @ModelAttribute("errorMessages") String errorMessages) {
|
||||||
InterfaceUtil.genRSAKeyPair(request);
|
InterfaceUtil.genRSAKeyPair(request);
|
||||||
request.setAttribute("base", request.getContextPath());
|
request.setAttribute("base", request.getContextPath());
|
||||||
return "/admin/admin_login";
|
return "/admin/admin_login";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 管理员退出
|
// 管理员退出
|
||||||
@RequestMapping(value = "/logout", method = RequestMethod.GET)
|
@RequestMapping(value = "/logout", method = RequestMethod.GET)
|
||||||
public String logout(HttpServletRequest request) {
|
public String logout(HttpServletRequest request) {
|
||||||
// ShiroPrincipal principal = (ShiroPrincipal) SecurityUtils.getSubject().getPrincipal();
|
// ShiroPrincipal principal = (ShiroPrincipal) SecurityUtils.getSubject().getPrincipal();
|
||||||
// // 如果已经登录,则跳转到管理首页
|
// // 如果已经登录,则跳转到管理首页
|
||||||
// if(principal != null){
|
// if(principal != null){
|
||||||
// SecurityUtils.getSubject().logout();
|
// SecurityUtils.getSubject().logout();
|
||||||
// }
|
// }
|
||||||
return "redirect:/admin/login";
|
return "redirect:/admin/login";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成随机验证码图片
|
* 生成随机验证码图片
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/captcha", method = RequestMethod.GET)
|
@RequestMapping(value = "/captcha", method = RequestMethod.GET)
|
||||||
public void captcha(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
public void captcha(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
new CaptchaUtils().getRandCode(request, response);
|
new CaptchaUtils().getRandCode(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询自己是否有审核任务
|
* 查询自己是否有审核任务
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/approveProjectsMsg")
|
@RequestMapping("/approveProjectsMsg")
|
||||||
public ResponseMsg approveProjectsMsg() {
|
public ResponseMsg approveProjectsMsg() {
|
||||||
Page<Project> myApproveProjects = projectService.findMyApproveProjects(new HashMap<>(), InterfaceUtil.getAdminId(), 1, 1);
|
Page<Project> myApproveProjects = projectService.findMyApproveProjects(new HashMap<>(), InterfaceUtil.getAdminId(), 1, 1);
|
||||||
if (myApproveProjects != null && !myApproveProjects.getList().isEmpty()) {
|
if (myApproveProjects != null && !myApproveProjects.getList().isEmpty()) {
|
||||||
return ResponseMsg.buildSuccessMsg("您有新的待审核项目,请及时确认。");
|
return ResponseMsg.buildSuccessMsg("您有新的待审核项目,请及时确认。");
|
||||||
} else {
|
} else {
|
||||||
return ResponseMsg.buildSuccessMsg("");
|
return ResponseMsg.buildSuccessMsg("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,161 +1,161 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.config.Constant;
|
import cn.palmte.work.config.Constant;
|
||||||
import cn.palmte.work.model.Admin;
|
import cn.palmte.work.model.Admin;
|
||||||
import cn.palmte.work.utils.InterfaceUtil;
|
import cn.palmte.work.utils.InterfaceUtil;
|
||||||
import cn.palmte.work.utils.RSAUtils;
|
import cn.palmte.work.utils.RSAUtils;
|
||||||
import cn.palmte.work.utils.Utils;
|
import cn.palmte.work.utils.Utils;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
|
||||||
public class BaseController {
|
public class BaseController {
|
||||||
public static final String KEYWORDS = "keywords";
|
public static final String KEYWORDS = "keywords";
|
||||||
public static final String PAGE_NUMBER = "pageNumber";
|
public static final String PAGE_NUMBER = "pageNumber";
|
||||||
public static final String PAGE_SIZE = "pageSize";
|
public static final String PAGE_SIZE = "pageSize";
|
||||||
public static final String PAGER = "pager";
|
public static final String PAGER = "pager";
|
||||||
public static final String DEFAULT_PAGE_NUMBER = "1";
|
public static final String DEFAULT_PAGE_NUMBER = "1";
|
||||||
public static final String DEFAULT_PAGE_SIZE = "10";
|
public static final String DEFAULT_PAGE_SIZE = "10";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the request.
|
* Gets the request.
|
||||||
*
|
*
|
||||||
* @return the request
|
* @return the request
|
||||||
*/
|
*/
|
||||||
protected HttpServletRequest getRequest() {
|
protected HttpServletRequest getRequest() {
|
||||||
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
|
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the response.
|
* Gets the response.
|
||||||
*
|
*
|
||||||
* @return the response
|
* @return the response
|
||||||
*/
|
*/
|
||||||
protected HttpServletResponse getResponse() {
|
protected HttpServletResponse getResponse() {
|
||||||
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse();
|
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the session
|
* Gets the session
|
||||||
*
|
*
|
||||||
* @return the session
|
* @return the session
|
||||||
*/
|
*/
|
||||||
protected HttpSession getSession() {
|
protected HttpSession getSession() {
|
||||||
return getRequest().getSession();
|
return getRequest().getSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void downloadHeader(HttpServletResponse response, String fileName) {
|
protected void downloadHeader(HttpServletResponse response, String fileName) {
|
||||||
downloadHeader(response, fileName, "application/octet-stream");
|
downloadHeader(response, fileName, "application/octet-stream");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理下载文件的http header
|
* 处理下载文件的http header
|
||||||
*
|
*
|
||||||
* @param response HttpServletResponse
|
* @param response HttpServletResponse
|
||||||
* @param fileName 文件名
|
* @param fileName 文件名
|
||||||
*/
|
*/
|
||||||
protected void downloadHeader(HttpServletResponse response, String fileName, String contentType) {
|
protected void downloadHeader(HttpServletResponse response, String fileName, String contentType) {
|
||||||
response.setContentType(contentType);
|
response.setContentType(contentType);
|
||||||
response.setCharacterEncoding("UTF-8");
|
response.setCharacterEncoding("UTF-8");
|
||||||
try {
|
try {
|
||||||
response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + java.net.URLEncoder.encode(fileName, "UTF-8"));
|
response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + java.net.URLEncoder.encode(fileName, "UTF-8"));
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see BaseController {@link #downloadHeader(HttpServletResponse, String, String)}
|
* @see BaseController {@link #downloadHeader(HttpServletResponse, String, String)}
|
||||||
*/
|
*/
|
||||||
protected void downloadHearder(HttpServletResponse response, String fileName) {
|
protected void downloadHearder(HttpServletResponse response, String fileName) {
|
||||||
downloadHeader(response, fileName, "application/octet-stream");
|
downloadHeader(response, fileName, "application/octet-stream");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ConcurrentHashMap<String, String> getSearchInfo(String keywords, Map<String, Object> model) {
|
public ConcurrentHashMap<String, String> getSearchInfo(String keywords, Map<String, Object> model) {
|
||||||
ConcurrentHashMap<String, String> searchMap = Utils.parseMap(keywords);
|
ConcurrentHashMap<String, String> searchMap = Utils.parseMap(keywords);
|
||||||
setModers(searchMap, model);
|
setModers(searchMap, model);
|
||||||
return searchMap;
|
return searchMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存搜索条件到model
|
* 保存搜索条件到model
|
||||||
*/
|
*/
|
||||||
public void setModers(ConcurrentHashMap<String, String> searchInfo, Map<String, Object> model) {
|
public void setModers(ConcurrentHashMap<String, String> searchInfo, Map<String, Object> model) {
|
||||||
for (Map.Entry<String, String> item : searchInfo.entrySet()) {
|
for (Map.Entry<String, String> item : searchInfo.entrySet()) {
|
||||||
model.put(item.getKey(), item.getValue());
|
model.put(item.getKey(), item.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存搜索条件到request
|
* 保存搜索条件到request
|
||||||
*/
|
*/
|
||||||
public void setAttrs(Map<String, String> searchInfo) {
|
public void setAttrs(Map<String, String> searchInfo) {
|
||||||
HttpServletRequest request = getRequest();
|
HttpServletRequest request = getRequest();
|
||||||
for (Map.Entry<String, String> item : searchInfo.entrySet()) {
|
for (Map.Entry<String, String> item : searchInfo.entrySet()) {
|
||||||
request.setAttribute(item.getKey(), item.getValue());
|
request.setAttribute(item.getKey(), item.getValue());
|
||||||
}
|
}
|
||||||
keepKeywords(searchInfo);
|
keepKeywords(searchInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getSearchInfo(String keywords) {
|
public Map<String, String> getSearchInfo(String keywords) {
|
||||||
|
|
||||||
Map<String, String> searchMap = Utils.parseMap(keywords);
|
Map<String, String> searchMap = Utils.parseMap(keywords);
|
||||||
setAttrs(searchMap);
|
setAttrs(searchMap);
|
||||||
return searchMap;
|
return searchMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将搜索条件按“keywords”保存 ,分页才能带上搜索条件
|
* 将搜索条件按“keywords”保存 ,分页才能带上搜索条件
|
||||||
*/
|
*/
|
||||||
protected void keepKeywords(Map<String, String> map) {
|
protected void keepKeywords(Map<String, String> map) {
|
||||||
HttpServletRequest request = getRequest();
|
HttpServletRequest request = getRequest();
|
||||||
request.setAttribute(KEYWORDS, JSON.toJSONString(map));
|
request.setAttribute(KEYWORDS, JSON.toJSONString(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void genRSAKeyPair(HttpServletRequest request, Map<String, Object> model) {
|
public void genRSAKeyPair(HttpServletRequest request, Map<String, Object> model) {
|
||||||
/* 生成KeyPair */
|
/* 生成KeyPair */
|
||||||
Map<String, Object> keyMap;
|
Map<String, Object> keyMap;
|
||||||
try {
|
try {
|
||||||
keyMap = RSAUtils.genKeyPair();
|
keyMap = RSAUtils.genKeyPair();
|
||||||
String publicKey = RSAUtils.getPublicKey(keyMap);
|
String publicKey = RSAUtils.getPublicKey(keyMap);
|
||||||
String privateKey = RSAUtils.getPrivateKey(keyMap);
|
String privateKey = RSAUtils.getPrivateKey(keyMap);
|
||||||
|
|
||||||
/* 保存私钥到session */
|
/* 保存私钥到session */
|
||||||
request.getSession().setAttribute(Constant.PRIVATEKEY, privateKey);
|
request.getSession().setAttribute(Constant.PRIVATEKEY, privateKey);
|
||||||
|
|
||||||
/* 公钥给前端页面 */
|
/* 公钥给前端页面 */
|
||||||
model.put(Constant.PUBLICKEY, publicKey);
|
model.put(Constant.PUBLICKEY, publicKey);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前用户对象
|
* 获取当前用户对象
|
||||||
*/
|
*/
|
||||||
public Admin getAdmin() {
|
public Admin getAdmin() {
|
||||||
return InterfaceUtil.getAdmin();
|
return InterfaceUtil.getAdmin();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前用户对象Id
|
* 获取当前用户对象Id
|
||||||
*/
|
*/
|
||||||
public int getAdminId() {
|
public int getAdminId() {
|
||||||
return InterfaceUtil.getAdmin().getId();
|
return InterfaceUtil.getAdmin().getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,105 +1,105 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/business")
|
@RequestMapping("/business")
|
||||||
public class BusinessController extends BaseController {
|
public class BusinessController extends BaseController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
|
||||||
|
|
||||||
@RequestMapping("/bak1")
|
@RequestMapping("/bak1")
|
||||||
public String bak1(Map<String, Object> model) {
|
public String bak1(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak1";
|
return "/admin/bak1";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak2")
|
@RequestMapping("/bak2")
|
||||||
public String bak2(Map<String, Object> model) {
|
public String bak2(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak2";
|
return "/admin/bak2";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak3")
|
@RequestMapping("/bak3")
|
||||||
public String bak3(Map<String, Object> model) {
|
public String bak3(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak3";
|
return "/admin/bak3";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak4")
|
@RequestMapping("/bak4")
|
||||||
public String bak4(Map<String, Object> model) {
|
public String bak4(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak4";
|
return "/admin/bak4";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak5")
|
@RequestMapping("/bak5")
|
||||||
public String bak5(Map<String, Object> model) {
|
public String bak5(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak5";
|
return "/admin/bak5";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak6")
|
@RequestMapping("/bak6")
|
||||||
public String bak6(Map<String, Object> model) {
|
public String bak6(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak6";
|
return "/admin/bak6";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak7")
|
@RequestMapping("/bak7")
|
||||||
public String bak7(Map<String, Object> model) {
|
public String bak7(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak7";
|
return "/admin/bak7";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak8")
|
@RequestMapping("/bak8")
|
||||||
public String bak8(Map<String, Object> model) {
|
public String bak8(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak8";
|
return "/admin/bak8";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak9")
|
@RequestMapping("/bak9")
|
||||||
public String bak9(Map<String, Object> model) {
|
public String bak9(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak9";
|
return "/admin/bak9";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak10")
|
@RequestMapping("/bak10")
|
||||||
public String bak10(Map<String, Object> model) {
|
public String bak10(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak10";
|
return "/admin/bak10";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak11")
|
@RequestMapping("/bak11")
|
||||||
public String bak11(Map<String, Object> model) {
|
public String bak11(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak11";
|
return "/admin/bak11";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak12")
|
@RequestMapping("/bak12")
|
||||||
public String bak12(Map<String, Object> model) {
|
public String bak12(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak12";
|
return "/admin/bak12";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak13")
|
@RequestMapping("/bak13")
|
||||||
public String bak13(Map<String, Object> model) {
|
public String bak13(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak13";
|
return "/admin/bak13";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak14")
|
@RequestMapping("/bak14")
|
||||||
public String bak14(Map<String, Object> model) {
|
public String bak14(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak14";
|
return "/admin/bak14";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/bak15")
|
@RequestMapping("/bak15")
|
||||||
public String bak15(Map<String, Object> model) {
|
public String bak15(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/bak15";
|
return "/admin/bak15";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,163 +1,163 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.model.*;
|
import cn.palmte.work.model.*;
|
||||||
import cn.palmte.work.service.DeptService;
|
import cn.palmte.work.service.DeptService;
|
||||||
import cn.palmte.work.service.ProcurementTypeService;
|
import cn.palmte.work.service.ProcurementTypeService;
|
||||||
import cn.palmte.work.utils.Utils;
|
import cn.palmte.work.utils.Utils;
|
||||||
import cn.palmte.work.utils.excel.ExportUtils;
|
import cn.palmte.work.utils.excel.ExportUtils;
|
||||||
import org.activiti.engine.task.Task;
|
import org.activiti.engine.task.Task;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
import top.jfunc.common.db.bean.Page;
|
import top.jfunc.common.db.bean.Page;
|
||||||
import top.jfunc.common.utils.CollectionUtil;
|
import top.jfunc.common.utils.CollectionUtil;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/department")
|
@RequestMapping("/department")
|
||||||
public class DepartmentController extends BaseController{
|
public class DepartmentController extends BaseController{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeptService deptService;
|
private DeptService deptService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeptRepository deptRepository;
|
private DeptRepository deptRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AdminRepository adminRepository;
|
private AdminRepository adminRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表查询
|
* 列表查询
|
||||||
* @param keywords
|
* @param keywords
|
||||||
* @param pageNumber
|
* @param pageNumber
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
model.put("keywords",keywords);
|
model.put("keywords",keywords);
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||||
Page<Dept> page = deptService.list(searchInfo, pageNumber, pageSize);
|
Page<Dept> page = deptService.list(searchInfo, pageNumber, pageSize);
|
||||||
List<Dept> list = page.getList();
|
List<Dept> list = page.getList();
|
||||||
if(CollectionUtil.isNotEmpty(list)){
|
if(CollectionUtil.isNotEmpty(list)){
|
||||||
|
|
||||||
int offset = (pageNumber - 1) * pageSize;
|
int offset = (pageNumber - 1) * pageSize;
|
||||||
for (int i = 0 , size = list.size(); i < size; i++) {
|
for (int i = 0 , size = list.size(); i < size; i++) {
|
||||||
list.get(i).setTempId(i+1 + offset);
|
list.get(i).setTempId(i+1 + offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.put("pager", page);
|
model.put("pager", page);
|
||||||
List<Dept> deptList = deptRepository.findEnableParent();
|
List<Dept> deptList = deptRepository.findEnableParent();
|
||||||
model.put("parentList", deptList);
|
model.put("parentList", deptList);
|
||||||
return "/admin/department_list";
|
return "/admin/department_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转新增页面
|
* 跳转新增页面
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/add")
|
@GetMapping(value = "/add")
|
||||||
public String add( Map<String, Object> model){
|
public String add( Map<String, Object> model){
|
||||||
Dept department = new Dept();
|
Dept department = new Dept();
|
||||||
model.put("deptId",-1);
|
model.put("deptId",-1);
|
||||||
model.put("department",department);
|
model.put("department",department);
|
||||||
List<Admin> adminList = adminRepository.getAllEnableWoAdmin();
|
List<Admin> adminList = adminRepository.getAllEnableWoAdmin();
|
||||||
model.put("userList", adminList);
|
model.put("userList", adminList);
|
||||||
List<Dept> deptList = deptRepository.findEnableParent();
|
List<Dept> deptList = deptRepository.findEnableParent();
|
||||||
model.put("parentList", deptList);
|
model.put("parentList", deptList);
|
||||||
return "/admin/department_input";
|
return "/admin/department_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转编辑页面
|
* 跳转编辑页面
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/edit")
|
@GetMapping(value = "/edit")
|
||||||
public String edit( Map<String, Object> model, @RequestParam("id") int id){
|
public String edit( Map<String, Object> model, @RequestParam("id") int id){
|
||||||
Dept dept = deptRepository.findOne(id);
|
Dept dept = deptRepository.findOne(id);
|
||||||
model.put("deptId", id);
|
model.put("deptId", id);
|
||||||
model.put("department", dept);
|
model.put("department", dept);
|
||||||
List<Admin> adminList = adminRepository.getAllEnableWoAdmin();
|
List<Admin> adminList = adminRepository.getAllEnableWoAdmin();
|
||||||
model.put("userList", adminList);
|
model.put("userList", adminList);
|
||||||
List<Dept> deptList = deptRepository.findEnableParent();
|
List<Dept> deptList = deptRepository.findEnableParent();
|
||||||
model.put("parentList", deptList);
|
model.put("parentList", deptList);
|
||||||
return "/admin/department_input";
|
return "/admin/department_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
* @param deptId
|
* @param deptId
|
||||||
* @param dept
|
* @param dept
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/save")
|
@PostMapping(value = "/save")
|
||||||
public String save(@RequestParam("deptId") int deptId,
|
public String save(@RequestParam("deptId") int deptId,
|
||||||
Dept dept, Map<String, Object> model){
|
Dept dept, Map<String, Object> model){
|
||||||
|
|
||||||
deptService.saveOtUpdate(deptId,dept);
|
deptService.saveOtUpdate(deptId,dept);
|
||||||
return "redirect:/department/list";
|
return "redirect:/department/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启用 禁用
|
* 启用 禁用
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/enableOrDisable")
|
@RequestMapping("/enableOrDisable")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
|
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
|
||||||
@RequestParam("status") int status, RedirectAttributes attr) {
|
@RequestParam("status") int status, RedirectAttributes attr) {
|
||||||
boolean isSuccess = false;
|
boolean isSuccess = false;
|
||||||
try {
|
try {
|
||||||
isSuccess = deptService.enableOrDisable(status, id);
|
isSuccess = deptService.enableOrDisable(status, id);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.getMessage();
|
e.getMessage();
|
||||||
}
|
}
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
return ResponseMsg.buildSuccessMsg("操作成功");
|
return ResponseMsg.buildSuccessMsg("操作成功");
|
||||||
} else {
|
} else {
|
||||||
return ResponseMsg.buildSuccessMsg("操作失败");
|
return ResponseMsg.buildSuccessMsg("操作失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启用 禁用
|
* 启用 禁用
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/checkName")
|
@RequestMapping("/checkName")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg checkName(@RequestParam("id") int id,
|
public ResponseMsg checkName(@RequestParam("id") int id,
|
||||||
@RequestParam("name") String name, RedirectAttributes attr) {
|
@RequestParam("name") String name, RedirectAttributes attr) {
|
||||||
Dept dept = deptRepository.findByNameEquals(name);
|
Dept dept = deptRepository.findByNameEquals(name);
|
||||||
if (dept != null && id != dept.getId()) {
|
if (dept != null && id != dept.getId()) {
|
||||||
return ResponseMsg.buildFailedMsg("失败");
|
return ResponseMsg.buildFailedMsg("失败");
|
||||||
}
|
}
|
||||||
return ResponseMsg.buildSuccessMsg("成功");
|
return ResponseMsg.buildSuccessMsg("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出
|
* 导出
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/export")
|
@RequestMapping("/export")
|
||||||
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
||||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||||
downloadHeader(httpServletResponse , Utils.generateExcelName("部门表"), "application/octet-stream");
|
downloadHeader(httpServletResponse , Utils.generateExcelName("部门表"), "application/octet-stream");
|
||||||
String[] headers = {"部门名称", "部门领导", "所属上级", "创建人","创建时间", "状态"};
|
String[] headers = {"部门名称", "部门领导", "所属上级", "创建人","创建时间", "状态"};
|
||||||
String[] exportColumns = {"name", "realName", "parentName", "createdBy","createdTime", "status"};
|
String[] exportColumns = {"name", "realName", "parentName", "createdBy","createdTime", "status"};
|
||||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||||
httpServletResponse.getOutputStream(), (pN, pS) -> deptService.list(searchInfo, pN, pS).getList());
|
httpServletResponse.getOutputStream(), (pN, pS) -> deptService.list(searchInfo, pN, pS).getList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,49 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.config.Constant;
|
import cn.palmte.work.config.Constant;
|
||||||
import cn.palmte.work.config.UploadProperties;
|
import cn.palmte.work.config.UploadProperties;
|
||||||
import cn.palmte.work.pojo.UploadResult;
|
import cn.palmte.work.pojo.UploadResult;
|
||||||
import cn.palmte.work.utils.UploadUtil;
|
import cn.palmte.work.utils.UploadUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author pengqiang
|
* @author pengqiang
|
||||||
* @date 2018/4/21
|
* @date 2018/4/21
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/file")
|
@RequestMapping("/file")
|
||||||
public class FileController extends BaseController {
|
public class FileController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UploadProperties uploadProperties;
|
private UploadProperties uploadProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文件
|
* 上传文件
|
||||||
* @return 返回状态和下载地址
|
* @return 返回状态和下载地址
|
||||||
*/
|
*/
|
||||||
@PostMapping("/upload")
|
@PostMapping("/upload")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg upload(@RequestParam(value = "files[]") MultipartFile[] multipartfiles) {
|
public ResponseMsg upload(@RequestParam(value = "files[]") MultipartFile[] multipartfiles) {
|
||||||
ResponseMsg responseMsg = ResponseMsg.buildFailedMsg("failed");
|
ResponseMsg responseMsg = ResponseMsg.buildFailedMsg("failed");
|
||||||
if (null != multipartfiles && multipartfiles.length > 0) {
|
if (null != multipartfiles && multipartfiles.length > 0) {
|
||||||
MultipartFile file = multipartfiles[0];
|
MultipartFile file = multipartfiles[0];
|
||||||
UploadResult result = UploadUtil.upload(file,
|
UploadResult result = UploadUtil.upload(file,
|
||||||
uploadProperties.getPath() , uploadProperties.getPrefix());
|
uploadProperties.getPath() , uploadProperties.getPrefix());
|
||||||
if (Constant.STATUS_SUCCESS == result.getStatus()) {
|
if (Constant.STATUS_SUCCESS == result.getStatus()) {
|
||||||
responseMsg = ResponseMsg.buildSuccessMsg("成功", result);
|
responseMsg = ResponseMsg.buildSuccessMsg("成功", result);
|
||||||
} else {
|
} else {
|
||||||
responseMsg.setMsg(result.getMsg());
|
responseMsg.setMsg(result.getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,168 +1,168 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.model.*;
|
import cn.palmte.work.model.*;
|
||||||
import cn.palmte.work.service.HumanCostService;
|
import cn.palmte.work.service.HumanCostService;
|
||||||
import cn.palmte.work.utils.Utils;
|
import cn.palmte.work.utils.Utils;
|
||||||
import cn.palmte.work.utils.excel.ExcelUtil;
|
import cn.palmte.work.utils.excel.ExcelUtil;
|
||||||
import cn.palmte.work.utils.excel.ExportUtils;
|
import cn.palmte.work.utils.excel.ExportUtils;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import org.apache.poi.EncryptedDocumentException;
|
import org.apache.poi.EncryptedDocumentException;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import top.jfunc.common.db.bean.Page;
|
import top.jfunc.common.db.bean.Page;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人力成本管理
|
* 人力成本管理
|
||||||
* @author Yuanping Zhang
|
* @author Yuanping Zhang
|
||||||
* @date 2021/11/1
|
* @date 2021/11/1
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/humanCost")
|
@RequestMapping("/humanCost")
|
||||||
public class HumanCostController extends BaseController{
|
public class HumanCostController extends BaseController{
|
||||||
private static final Logger logger = LoggerFactory.getLogger(HumanCostController.class);
|
private static final Logger logger = LoggerFactory.getLogger(HumanCostController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeptRepository deptRepository;
|
private DeptRepository deptRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HumanCostService humanCostService;
|
private HumanCostService humanCostService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AdminRepository adminRepository;
|
private AdminRepository adminRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectRepository projectRepository;
|
private ProjectRepository projectRepository;
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = KEYWORDS,required = false) String keywords,
|
public String list(@RequestParam(value = KEYWORDS,required = false) String keywords,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
//当前登录人的角色类型
|
//当前登录人的角色类型
|
||||||
Admin admin = getAdmin();
|
Admin admin = getAdmin();
|
||||||
int roleLevel = admin.getRoleLevel();
|
int roleLevel = admin.getRoleLevel();
|
||||||
List<Project> selfProjects = projectRepository.findByCreator(admin.getId(), new Date());
|
List<Project> selfProjects = projectRepository.findByCreator(admin.getId(), new Date());
|
||||||
if (roleLevel <= 3 || roleLevel == 6) {
|
if (roleLevel <= 3 || roleLevel == 6) {
|
||||||
model.put("deptVary", 1);
|
model.put("deptVary", 1);
|
||||||
model.put("deptList", deptRepository.findAll());
|
model.put("deptList", deptRepository.findAll());
|
||||||
model.put("projectList", projectRepository.findAll());
|
model.put("projectList", projectRepository.findAll());
|
||||||
model.put("showSalary", 1);
|
model.put("showSalary", 1);
|
||||||
} else if (roleLevel == 4 || roleLevel == 5) {
|
} else if (roleLevel == 4 || roleLevel == 5) {
|
||||||
model.put("deptVary", -1);
|
model.put("deptVary", -1);
|
||||||
model.put("deptList", new ArrayList<>());
|
model.put("deptList", new ArrayList<>());
|
||||||
model.put("projectList", projectRepository.findByDeptId(admin.getDeptId()));
|
model.put("projectList", projectRepository.findByDeptId(admin.getDeptId()));
|
||||||
model.put("showSalary", -1);
|
model.put("showSalary", -1);
|
||||||
} else if (selfProjects != null) {
|
} else if (selfProjects != null) {
|
||||||
model.put("deptVary", -1);
|
model.put("deptVary", -1);
|
||||||
model.put("deptList", new ArrayList<>());
|
model.put("deptList", new ArrayList<>());
|
||||||
model.put("projectList", selfProjects);
|
model.put("projectList", selfProjects);
|
||||||
model.put("showSalary", -1);
|
model.put("showSalary", -1);
|
||||||
} else {
|
} else {
|
||||||
keywords = setDate(keywords);
|
keywords = setDate(keywords);
|
||||||
model.put("keywords",keywords);
|
model.put("keywords",keywords);
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||||
if (searchInfo.containsKey("time")) {
|
if (searchInfo.containsKey("time")) {
|
||||||
String time = searchInfo.get("time");
|
String time = searchInfo.get("time");
|
||||||
if (time.length() == 7) {
|
if (time.length() == 7) {
|
||||||
String individualTime = time.substring(0, 4) + "年" + time.substring(5, 7) + "月";
|
String individualTime = time.substring(0, 4) + "年" + time.substring(5, 7) + "月";
|
||||||
model.put("individualTime", individualTime);
|
model.put("individualTime", individualTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.put("pager",humanCostService.individual(searchInfo, admin.getId(), pageNumber, pageSize));
|
model.put("pager",humanCostService.individual(searchInfo, admin.getId(), pageNumber, pageSize));
|
||||||
return "admin/human_cost_individual";
|
return "admin/human_cost_individual";
|
||||||
}
|
}
|
||||||
keywords = setDate(keywords);
|
keywords = setDate(keywords);
|
||||||
model.put("keywords",keywords);
|
model.put("keywords",keywords);
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||||
Page<ProjectUserTime> project = humanCostService.project(searchInfo, admin, pageNumber, pageSize);
|
Page<ProjectUserTime> project = humanCostService.project(searchInfo, admin, pageNumber, pageSize);
|
||||||
List<ProjectUserTime> staff = humanCostService.staff(searchInfo, admin);
|
List<ProjectUserTime> staff = humanCostService.staff(searchInfo, admin);
|
||||||
Map<String, BigDecimal> map = humanCostService.map(searchInfo, admin, pageNumber, pageSize);
|
Map<String, BigDecimal> map = humanCostService.map(searchInfo, admin, pageNumber, pageSize);
|
||||||
BigDecimal total = humanCostService.sum(searchInfo, admin);
|
BigDecimal total = humanCostService.sum(searchInfo, admin);
|
||||||
model.put("pager", project);
|
model.put("pager", project);
|
||||||
model.put("staff", staff);
|
model.put("staff", staff);
|
||||||
model.put("map", map);
|
model.put("map", map);
|
||||||
model.put("total", total);
|
model.put("total", total);
|
||||||
return "admin/human_cost_list";
|
return "admin/human_cost_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String setDate(String keywords) {
|
private String setDate(String keywords) {
|
||||||
if (keywords == null || keywords.length() == 0) {
|
if (keywords == null || keywords.length() == 0) {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM");
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM");
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTime(date);
|
calendar.setTime(date);
|
||||||
calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1);
|
calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1);
|
||||||
date = calendar.getTime();
|
date = calendar.getTime();
|
||||||
String accDate = sf.format(date);
|
String accDate = sf.format(date);
|
||||||
keywords = "{time: '" + accDate + "'}";
|
keywords = "{time: '" + accDate + "'}";
|
||||||
}
|
}
|
||||||
return keywords;
|
return keywords;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出
|
* 导出
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/export")
|
@RequestMapping("/export")
|
||||||
public void export(@RequestParam(value = KEYWORDS,required = false) String keywords,
|
public void export(@RequestParam(value = KEYWORDS,required = false) String keywords,
|
||||||
HttpServletResponse response) throws Exception{
|
HttpServletResponse response) throws Exception{
|
||||||
Admin admin = getAdmin();
|
Admin admin = getAdmin();
|
||||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||||
downloadHeader(response , Utils.generateExcelName("人力成本表"));
|
downloadHeader(response , Utils.generateExcelName("人力成本表"));
|
||||||
Page<ProjectUserTime> project = humanCostService.project((ConcurrentHashMap<String, String>) searchInfo, admin, 1, 5000);
|
Page<ProjectUserTime> project = humanCostService.project((ConcurrentHashMap<String, String>) searchInfo, admin, 1, 5000);
|
||||||
List<ProjectUserTime> staff = humanCostService.staff((ConcurrentHashMap<String, String>) searchInfo, admin);
|
List<ProjectUserTime> staff = humanCostService.staff((ConcurrentHashMap<String, String>) searchInfo, admin);
|
||||||
Map<String, BigDecimal> map = humanCostService.map((ConcurrentHashMap<String, String>) searchInfo, admin, 1, 5000);
|
Map<String, BigDecimal> map = humanCostService.map((ConcurrentHashMap<String, String>) searchInfo, admin, 1, 5000);
|
||||||
String[] headers = humanCostService.getHeaders(staff);
|
String[] headers = humanCostService.getHeaders(staff);
|
||||||
String[] columns = humanCostService.getColumns(project.getList());
|
String[] columns = humanCostService.getColumns(project.getList());
|
||||||
ExportUtils.exportHumanCost(headers, columns, staff, project.getList(),
|
ExportUtils.exportHumanCost(headers, columns, staff, project.getList(),
|
||||||
response.getOutputStream() , map);
|
response.getOutputStream() , map);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载导入模板
|
* 下载导入模板
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/template")
|
@RequestMapping("/template")
|
||||||
public void importTemplate(HttpServletResponse response) throws IOException {
|
public void importTemplate(HttpServletResponse response) throws IOException {
|
||||||
String[] columns = new String[]{""};
|
String[] columns = new String[]{""};
|
||||||
downloadHeader(response , Utils.generateExcelName("人力成本导入模板"));
|
downloadHeader(response , Utils.generateExcelName("人力成本导入模板"));
|
||||||
List<String> data = new ArrayList<>();
|
List<String> data = new ArrayList<>();
|
||||||
data.add("成本");
|
data.add("成本");
|
||||||
String[] headers = humanCostService.template(data);
|
String[] headers = humanCostService.template(data);
|
||||||
ExportUtils exportUtils = new ExportUtils(headers);
|
ExportUtils exportUtils = new ExportUtils(headers);
|
||||||
exportUtils.exportTemplate(columns , data, "yyyy-MM-dd HH:mm:ss" , 1);
|
exportUtils.exportTemplate(columns , data, "yyyy-MM-dd HH:mm:ss" , 1);
|
||||||
exportUtils.write(response.getOutputStream());
|
exportUtils.write(response.getOutputStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/batchImport")
|
@RequestMapping("/batchImport")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
|
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
|
||||||
try {
|
try {
|
||||||
Map<String, String> title = new HashMap<>();
|
Map<String, String> title = new HashMap<>();
|
||||||
Collection<Map> maps = ExcelUtil.importHumanCost(Map.class, file.getInputStream(),
|
Collection<Map> maps = ExcelUtil.importHumanCost(Map.class, file.getInputStream(),
|
||||||
title,0);
|
title,0);
|
||||||
return JSON.toJSONString(humanCostService.check(maps, title, date));
|
return JSON.toJSONString(humanCostService.check(maps, title, date));
|
||||||
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
|
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
|
||||||
logger.error("", e);
|
logger.error("", e);
|
||||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误,请上传excel 2003/2007格式文件"));
|
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误,请上传excel 2003/2007格式文件"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
|
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
public class IndexController extends BaseController{
|
public class IndexController extends BaseController{
|
||||||
@GetMapping(value = "/")
|
@GetMapping(value = "/")
|
||||||
public String index() throws Exception {
|
public String index() throws Exception {
|
||||||
return "redirect:/admin/login";
|
return "redirect:/admin/login";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,142 +1,142 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.model.MonthlySettle;
|
import cn.palmte.work.model.MonthlySettle;
|
||||||
import cn.palmte.work.model.MonthlySettleRepository;
|
import cn.palmte.work.model.MonthlySettleRepository;
|
||||||
import cn.palmte.work.service.MonthlySettleService;
|
import cn.palmte.work.service.MonthlySettleService;
|
||||||
import cn.palmte.work.utils.FreeMarkerUtil;
|
import cn.palmte.work.utils.FreeMarkerUtil;
|
||||||
import cn.palmte.work.utils.Utils;
|
import cn.palmte.work.utils.Utils;
|
||||||
import cn.palmte.work.utils.excel.AppendMore;
|
import cn.palmte.work.utils.excel.AppendMore;
|
||||||
import cn.palmte.work.utils.excel.ExcelLogs;
|
import cn.palmte.work.utils.excel.ExcelLogs;
|
||||||
import cn.palmte.work.utils.excel.ExcelUtil;
|
import cn.palmte.work.utils.excel.ExcelUtil;
|
||||||
import cn.palmte.work.utils.excel.ExportUtils;
|
import cn.palmte.work.utils.excel.ExportUtils;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import org.apache.poi.EncryptedDocumentException;
|
import org.apache.poi.EncryptedDocumentException;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yuanping Zhang
|
* @author Yuanping Zhang
|
||||||
* @date 2022/08/08
|
* @date 2022/08/08
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monthlySettle")
|
@RequestMapping("/monthlySettle")
|
||||||
public class MonthlySettleController extends BaseController {
|
public class MonthlySettleController extends BaseController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(MonthlySettleController.class);
|
private static final Logger logger = LoggerFactory.getLogger(MonthlySettleController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MonthlySettleService monthlySettleService;
|
private MonthlySettleService monthlySettleService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MonthlySettleRepository monthlySettleRepository;
|
private MonthlySettleRepository monthlySettleRepository;
|
||||||
|
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
|
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
// 初始化参数
|
// 初始化参数
|
||||||
setModel(keywords, model);
|
setModel(keywords, model);
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||||
model.put("pager", monthlySettleService.list(searchInfo, pageNumber, pageSize));
|
model.put("pager", monthlySettleService.list(searchInfo, pageNumber, pageSize));
|
||||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||||
return "/admin/monthly_settle_list";
|
return "/admin/monthly_settle_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/info")
|
@RequestMapping("/info")
|
||||||
public String info(@RequestParam("id") int id, Map<String, Object> model) {
|
public String info(@RequestParam("id") int id, Map<String, Object> model) {
|
||||||
MonthlySettle monthlySettle = monthlySettleService.findById(id);
|
MonthlySettle monthlySettle = monthlySettleService.findById(id);
|
||||||
model.put("monthlySettle", monthlySettle);
|
model.put("monthlySettle", monthlySettle);
|
||||||
model.put("projectNameStr", monthlySettle.getProjectName());
|
model.put("projectNameStr", monthlySettle.getProjectName());
|
||||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||||
return "/admin/monthly_settle_info";
|
return "/admin/monthly_settle_info";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/infoByTime")
|
@RequestMapping("/infoByTime")
|
||||||
public String infoByTime(@RequestParam String month, @RequestParam("projectName") String projectName, Map<String, Object> model) {
|
public String infoByTime(@RequestParam String month, @RequestParam("projectName") String projectName, Map<String, Object> model) {
|
||||||
MonthlySettle monthlySettle = monthlySettleService.findByMonthAndProjectName(month, projectName);
|
MonthlySettle monthlySettle = monthlySettleService.findByMonthAndProjectName(month, projectName);
|
||||||
if (monthlySettle == null) {
|
if (monthlySettle == null) {
|
||||||
monthlySettle = new MonthlySettle();
|
monthlySettle = new MonthlySettle();
|
||||||
}
|
}
|
||||||
model.put("monthlySettle", monthlySettle);
|
model.put("monthlySettle", monthlySettle);
|
||||||
model.put("projectNameStr", projectName);
|
model.put("projectNameStr", projectName);
|
||||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||||
return "/admin/monthly_settle_info";
|
return "/admin/monthly_settle_info";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
|
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
|
||||||
model.put("keywords", keywords);
|
model.put("keywords", keywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/export")
|
@RequestMapping("/export")
|
||||||
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
||||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||||
downloadHeader(httpServletResponse, Utils.generateExcelName("PMO项目执行进度管理"), "application/octet-stream");
|
downloadHeader(httpServletResponse, Utils.generateExcelName("PMO项目执行进度管理"), "application/octet-stream");
|
||||||
String[] headers = {"项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额",
|
String[] headers = {"项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额",
|
||||||
"销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "到货证明", "项目风险预警", "已计收金额", "未计收金额", "超期天数", "验收报告时间"};
|
"销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "到货证明", "项目风险预警", "已计收金额", "未计收金额", "超期天数", "验收报告时间"};
|
||||||
String[] exportColumns = {"projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound",
|
String[] exportColumns = {"projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound",
|
||||||
"totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound",
|
"totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound",
|
||||||
"collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "productCertificate", "riskWarning", "uncalColAmountRound", "calColAmountRound", "timeOutDay", "inspectionReportTimeStr"};
|
"collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "productCertificate", "riskWarning", "uncalColAmountRound", "calColAmountRound", "timeOutDay", "inspectionReportTimeStr"};
|
||||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||||
httpServletResponse.getOutputStream(), (pN, pS) -> monthlySettleService.list(searchInfo, pN, pS).getList());
|
httpServletResponse.getOutputStream(), (pN, pS) -> monthlySettleService.list(searchInfo, pN, pS).getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/exportSingle")
|
@RequestMapping("/exportSingle")
|
||||||
public void exportSingle(@RequestParam String id, @RequestParam String time, @RequestParam String projectName, HttpServletResponse httpServletResponse) throws IOException {
|
public void exportSingle(@RequestParam String id, @RequestParam String time, @RequestParam String projectName, HttpServletResponse httpServletResponse) throws IOException {
|
||||||
downloadHeader(httpServletResponse, Utils.generateExcelName("PMO项目执行进度管理明细"), "application/octet-stream");
|
downloadHeader(httpServletResponse, Utils.generateExcelName("PMO项目执行进度管理明细"), "application/octet-stream");
|
||||||
String[] headers = {"月份", "项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额",
|
String[] headers = {"月份", "项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额",
|
||||||
"销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"};
|
"销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"};
|
||||||
String[] exportColumns = {"month", "projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound",
|
String[] exportColumns = {"month", "projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound",
|
||||||
"totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound",
|
"totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound",
|
||||||
"collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "timeOutDay", "productCertificate", "inspectionReportTimeStr", "riskWarning", "uncalColAmountRound", "calColAmountRound"};
|
"collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "timeOutDay", "productCertificate", "inspectionReportTimeStr", "riskWarning", "uncalColAmountRound", "calColAmountRound"};
|
||||||
ExportUtils.exportToExcel2(headers, exportColumns, 1, 10000,
|
ExportUtils.exportToExcel2(headers, exportColumns, 1, 10000,
|
||||||
httpServletResponse.getOutputStream(), monthlySettleService.findOne(id, time, projectName));
|
httpServletResponse.getOutputStream(), monthlySettleService.findOne(id, time, projectName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板下载
|
* 模板下载
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/template")
|
@RequestMapping("/template")
|
||||||
public void template(HttpServletResponse response) throws Exception {
|
public void template(HttpServletResponse response) throws Exception {
|
||||||
String[] headers = new String[]{"项目编号", "最终业主", "合同方", "项目名称", "合同金额", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额", "合同编号", "项目类型", "合同签订时间", "销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额",
|
String[] headers = new String[]{"项目编号", "最终业主", "合同方", "项目名称", "合同金额", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额", "合同编号", "项目类型", "合同签订时间", "销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额",
|
||||||
"实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"};
|
"实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"};
|
||||||
downloadHeader(response, Utils.generateExcelName("PMO项目执行进度管理导入模板"));
|
downloadHeader(response, Utils.generateExcelName("PMO项目执行进度管理导入模板"));
|
||||||
ExportUtils exportUtils = new ExportUtils(headers);
|
ExportUtils exportUtils = new ExportUtils(headers);
|
||||||
exportUtils.write(response.getOutputStream());
|
exportUtils.write(response.getOutputStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量导入
|
* 批量导入
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/batchImport")
|
@RequestMapping("/batchImport")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
|
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
|
||||||
try {
|
try {
|
||||||
ExcelLogs logs = new ExcelLogs();
|
ExcelLogs logs = new ExcelLogs();
|
||||||
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
|
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
|
||||||
"yyyy/MM/dd HH:mm:ss", logs, 0);
|
"yyyy/MM/dd HH:mm:ss", logs, 0);
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
return JSON.toJSONString(monthlySettleService.check(maps, date));
|
return JSON.toJSONString(monthlySettleService.check(maps, date));
|
||||||
}
|
}
|
||||||
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
|
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
|
||||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误,请上传excel 2003/2007格式文件"));
|
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误,请上传excel 2003/2007格式文件"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
|
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,67 +1,67 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.SettleBean;
|
import cn.palmte.work.bean.SettleBean;
|
||||||
import cn.palmte.work.model.Admin;
|
import cn.palmte.work.model.Admin;
|
||||||
import cn.palmte.work.pojo.MonthlySettleCount;
|
import cn.palmte.work.pojo.MonthlySettleCount;
|
||||||
import cn.palmte.work.service.MonthlySettleStatisticsService;
|
import cn.palmte.work.service.MonthlySettleStatisticsService;
|
||||||
import cn.palmte.work.utils.DateKit;
|
import cn.palmte.work.utils.DateKit;
|
||||||
import cn.palmte.work.utils.InterfaceUtil;
|
import cn.palmte.work.utils.InterfaceUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monthlySettleStatistics")
|
@RequestMapping("/monthlySettleStatistics")
|
||||||
public class MonthlySettleStatisticsController extends BaseController {
|
public class MonthlySettleStatisticsController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MonthlySettleStatisticsService monthlySettleStatisticsService;
|
private MonthlySettleStatisticsService monthlySettleStatisticsService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开卡订单图表
|
* 开卡订单图表
|
||||||
*
|
*
|
||||||
* @param keywords
|
* @param keywords
|
||||||
* @param pageNumber
|
* @param pageNumber
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
||||||
@RequestParam(value = "pageNumber", defaultValue = "1") int pageNumber,
|
@RequestParam(value = "pageNumber", defaultValue = "1") int pageNumber,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
|
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
//当前登录人的角色类型
|
//当前登录人的角色类型
|
||||||
Admin admin = getAdmin();
|
Admin admin = getAdmin();
|
||||||
model.put("keywords",keywords);
|
model.put("keywords",keywords);
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||||
String time;
|
String time;
|
||||||
if (!searchInfo.containsKey("time")) {
|
if (!searchInfo.containsKey("time")) {
|
||||||
Calendar instance = Calendar.getInstance();
|
Calendar instance = Calendar.getInstance();
|
||||||
instance.setTime(new Date());
|
instance.setTime(new Date());
|
||||||
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH));
|
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH));
|
||||||
Date current = instance.getTime();
|
Date current = instance.getTime();
|
||||||
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||||
model.put("time", time);
|
model.put("time", time);
|
||||||
}
|
}
|
||||||
return "/admin/monthly_settle_statistics";
|
return "/admin/monthly_settle_statistics";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/listData")
|
@RequestMapping("/listData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String listData(@RequestParam(value = "time", required = false) String time,
|
public String listData(@RequestParam(value = "time", required = false) String time,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
// 初始化参数
|
// 初始化参数
|
||||||
List<MonthlySettleCount> countList = monthlySettleStatisticsService.getListData(time);
|
List<MonthlySettleCount> countList = monthlySettleStatisticsService.getListData(time);
|
||||||
return JSONObject.toJSONString(countList);
|
return JSONObject.toJSONString(countList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,156 +1,156 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.model.ProcurementType;
|
import cn.palmte.work.model.ProcurementType;
|
||||||
import cn.palmte.work.service.ProcurementTypeService;
|
import cn.palmte.work.service.ProcurementTypeService;
|
||||||
import cn.palmte.work.utils.Utils;
|
import cn.palmte.work.utils.Utils;
|
||||||
import cn.palmte.work.utils.excel.ExportUtils;
|
import cn.palmte.work.utils.excel.ExportUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/procurement/type")
|
@RequestMapping("/procurement/type")
|
||||||
public class ProcurementTypeController extends BaseController{
|
public class ProcurementTypeController extends BaseController{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProcurementTypeService procurementTypeService;
|
private ProcurementTypeService procurementTypeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表查询
|
* 列表查询
|
||||||
* @param keywords
|
* @param keywords
|
||||||
* @param pageNumber
|
* @param pageNumber
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
model.put("keywords",keywords);
|
model.put("keywords",keywords);
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||||
model.put(PAGER,procurementTypeService.list(searchInfo,pageNumber,pageSize));
|
model.put(PAGER,procurementTypeService.list(searchInfo,pageNumber,pageSize));
|
||||||
return "/admin/procurement_type_list";
|
return "/admin/procurement_type_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转新增页面
|
* 跳转新增页面
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/add")
|
@GetMapping(value = "/add")
|
||||||
public String add( Map<String, Object> model){
|
public String add( Map<String, Object> model){
|
||||||
ProcurementType procurementType = new ProcurementType();
|
ProcurementType procurementType = new ProcurementType();
|
||||||
model.put("procurementTypeId",-1);
|
model.put("procurementTypeId",-1);
|
||||||
model.put("procurementType",procurementType);
|
model.put("procurementType",procurementType);
|
||||||
return "/admin/procurement_type_input";
|
return "/admin/procurement_type_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转到编辑页面
|
* 跳转到编辑页面
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
||||||
ProcurementType procurementType = procurementTypeService.findOne(id);
|
ProcurementType procurementType = procurementTypeService.findOne(id);
|
||||||
model.put("procurementTypeId",id);
|
model.put("procurementTypeId",id);
|
||||||
model.put("procurementType", procurementType);
|
model.put("procurementType", procurementType);
|
||||||
return "/admin/procurement_type_input";
|
return "/admin/procurement_type_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
* @param procurementTypeId
|
* @param procurementTypeId
|
||||||
* @param procurementType
|
* @param procurementType
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/save")
|
@PostMapping(value = "/save")
|
||||||
public String save(@RequestParam("procurementTypeId") int procurementTypeId,
|
public String save(@RequestParam("procurementTypeId") int procurementTypeId,
|
||||||
ProcurementType procurementType, Map<String, Object> model){
|
ProcurementType procurementType, Map<String, Object> model){
|
||||||
|
|
||||||
procurementTypeService.saveOtUpdate(procurementTypeId,procurementType);
|
procurementTypeService.saveOtUpdate(procurementTypeId,procurementType);
|
||||||
return "redirect:/procurement/type/list";
|
return "redirect:/procurement/type/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 批量删除
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/delete")
|
@GetMapping(value = "/delete")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg delete(@RequestParam("ids") String ids){
|
public ResponseMsg delete(@RequestParam("ids") String ids){
|
||||||
String[] deleteIds=ids.split("#%#");
|
String[] deleteIds=ids.split("#%#");
|
||||||
boolean deleted = procurementTypeService.deleteByIDs(deleteIds);
|
boolean deleted = procurementTypeService.deleteByIDs(deleteIds);
|
||||||
|
|
||||||
ResponseMsg responseMsge=new ResponseMsg();
|
ResponseMsg responseMsge=new ResponseMsg();
|
||||||
if(deleted){
|
if(deleted){
|
||||||
responseMsge.setStatus(0);
|
responseMsge.setStatus(0);
|
||||||
responseMsge.setMsg("删除成功");
|
responseMsge.setMsg("删除成功");
|
||||||
} else{
|
} else{
|
||||||
responseMsge.setStatus(1);
|
responseMsge.setStatus(1);
|
||||||
responseMsge.setMsg("删除失败");
|
responseMsge.setMsg("删除失败");
|
||||||
}
|
}
|
||||||
return responseMsge;
|
return responseMsge;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启用 禁用
|
* 启用 禁用
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/enableOrDisable")
|
@RequestMapping("/enableOrDisable")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
|
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
|
||||||
@RequestParam("status") int status, RedirectAttributes attr) {
|
@RequestParam("status") int status, RedirectAttributes attr) {
|
||||||
boolean isSuccess = false;
|
boolean isSuccess = false;
|
||||||
try {
|
try {
|
||||||
isSuccess = procurementTypeService.enableOrDisable(status, id);
|
isSuccess = procurementTypeService.enableOrDisable(status, id);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.getMessage();
|
e.getMessage();
|
||||||
}
|
}
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
return ResponseMsg.buildSuccessMsg("操作成功");
|
return ResponseMsg.buildSuccessMsg("操作成功");
|
||||||
} else {
|
} else {
|
||||||
return ResponseMsg.buildSuccessMsg("操作失败");
|
return ResponseMsg.buildSuccessMsg("操作失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出
|
* 导出
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/export")
|
@RequestMapping("/export")
|
||||||
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
||||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||||
downloadHeader(httpServletResponse , Utils.generateExcelName("采购类型表"), "application/octet-stream");
|
downloadHeader(httpServletResponse , Utils.generateExcelName("采购类型表"), "application/octet-stream");
|
||||||
String[] headers = {"采购类型名称","所属大类","创建人","创建时间"};
|
String[] headers = {"采购类型名称","所属大类","创建人","创建时间"};
|
||||||
String[] exportColumns = {"name","typeName","createdBy","createdTime"};
|
String[] exportColumns = {"name","typeName","createdBy","createdTime"};
|
||||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||||
httpServletResponse.getOutputStream(), (pN, pS) -> procurementTypeService.list(searchInfo, pN, pS).getList());
|
httpServletResponse.getOutputStream(), (pN, pS) -> procurementTypeService.list(searchInfo, pN, pS).getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型和类别的映射关系
|
* 类型和类别的映射关系
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/map")
|
@RequestMapping("/map")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg map() {
|
public ResponseMsg map() {
|
||||||
List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList();
|
List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList();
|
||||||
Map<Integer, List<ProcurementType>> map = procurementTypes.stream().collect(Collectors.groupingBy(ProcurementType::getType));
|
Map<Integer, List<ProcurementType>> map = procurementTypes.stream().collect(Collectors.groupingBy(ProcurementType::getType));
|
||||||
|
|
||||||
Map<String, Object> objectMap = new HashMap<>();
|
Map<String, Object> objectMap = new HashMap<>();
|
||||||
objectMap.put("procurementTypes", procurementTypes);
|
objectMap.put("procurementTypes", procurementTypes);
|
||||||
objectMap.put("map", map);
|
objectMap.put("map", map);
|
||||||
return ResponseMsg.buildSuccessData(objectMap);
|
return ResponseMsg.buildSuccessData(objectMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,110 +1,110 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.FinalBean;
|
import cn.palmte.work.bean.FinalBean;
|
||||||
import cn.palmte.work.model.Project;
|
import cn.palmte.work.model.Project;
|
||||||
import cn.palmte.work.model.ProjectBudgetPlanDetail;
|
import cn.palmte.work.model.ProjectBudgetPlanDetail;
|
||||||
import cn.palmte.work.model.ProjectSettleIncome;
|
import cn.palmte.work.model.ProjectSettleIncome;
|
||||||
import cn.palmte.work.model.ProjectSettleIncomeRepository;
|
import cn.palmte.work.model.ProjectSettleIncomeRepository;
|
||||||
import cn.palmte.work.service.*;
|
import cn.palmte.work.service.*;
|
||||||
import cn.palmte.work.utils.FreeMarkerUtil;
|
import cn.palmte.work.utils.FreeMarkerUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.format.datetime.DateFormatter;
|
import org.springframework.format.datetime.DateFormatter;
|
||||||
import org.springframework.format.number.NumberStyleFormatter;
|
import org.springframework.format.number.NumberStyleFormatter;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.WebDataBinder;
|
import org.springframework.web.bind.WebDataBinder;
|
||||||
import org.springframework.web.bind.annotation.InitBinder;
|
import org.springframework.web.bind.annotation.InitBinder;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/project/final")
|
@RequestMapping("/project/final")
|
||||||
public class ProjectFinalController extends BaseController{
|
public class ProjectFinalController extends BaseController{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectFinalSevice projectFinalSevice;
|
private ProjectFinalSevice projectFinalSevice;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectEstimateService projectEstimateService;
|
private ProjectEstimateService projectEstimateService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectBudgetService projectBudgetService;
|
private ProjectBudgetService projectBudgetService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
|
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectSettleService projectSettleService;
|
private ProjectSettleService projectSettleService;
|
||||||
|
|
||||||
@RequestMapping("/add")
|
@RequestMapping("/add")
|
||||||
public String add(@RequestParam("id") int id, Map<String, Object> model) {
|
public String add(@RequestParam("id") int id, Map<String, Object> model) {
|
||||||
Project project = projectService.getProject(id);
|
Project project = projectService.getProject(id);
|
||||||
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
||||||
String time = "";
|
String time = "";
|
||||||
if(null != projectSettleIncome){
|
if(null != projectSettleIncome){
|
||||||
time = projectSettleIncome.getTime();
|
time = projectSettleIncome.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||||
model.put("project", project);
|
model.put("project", project);
|
||||||
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
||||||
model.put("budgetBean", projectBudgetService.getBudget(project));
|
model.put("budgetBean", projectBudgetService.getBudget(project));
|
||||||
model.put("settleBean",projectSettleService.getCurrentSettle(project, time));
|
model.put("settleBean",projectSettleService.getCurrentSettle(project, time));
|
||||||
model.put("finalBean",new FinalBean());
|
model.put("finalBean",new FinalBean());
|
||||||
//现金表
|
//现金表
|
||||||
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
||||||
//freemarker可以利用的静态方法
|
//freemarker可以利用的静态方法
|
||||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||||
return "admin/project_final_add";
|
return "admin/project_final_add";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
||||||
Project project = projectService.getProject(id);
|
Project project = projectService.getProject(id);
|
||||||
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
||||||
String time = projectSettleIncome.getTime();
|
String time = projectSettleIncome.getTime();
|
||||||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||||
model.put("project", project);
|
model.put("project", project);
|
||||||
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
||||||
model.put("budgetBean", projectBudgetService.getBudget(project));
|
model.put("budgetBean", projectBudgetService.getBudget(project));
|
||||||
model.put("settleBean",projectSettleService.getCurrentSettle(project, time));
|
model.put("settleBean",projectSettleService.getCurrentSettle(project, time));
|
||||||
model.put("finalBean",projectFinalSevice.getFinal(project));
|
model.put("finalBean",projectFinalSevice.getFinal(project));
|
||||||
//现金表
|
//现金表
|
||||||
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
||||||
//freemarker可以利用的静态方法
|
//freemarker可以利用的静态方法
|
||||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||||
return "admin/project_final_edit";
|
return "admin/project_final_edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
public String estimateAddSave(Project project, FinalBean finalBean, Map<String, Object> model) {
|
public String estimateAddSave(Project project, FinalBean finalBean, Map<String, Object> model) {
|
||||||
projectFinalSevice.save(project,finalBean);
|
projectFinalSevice.save(project,finalBean);
|
||||||
return "redirect:/project/list";
|
return "redirect:/project/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存并提交审批
|
* 保存并提交审批
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project
|
||||||
* @param finalBean
|
* @param finalBean
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/saveAndApprove")
|
@RequestMapping("/saveAndApprove")
|
||||||
public String saveAndApprove(Project project, FinalBean finalBean, Map<String, Object> model) throws Exception{
|
public String saveAndApprove(Project project, FinalBean finalBean, Map<String, Object> model) throws Exception{
|
||||||
projectFinalSevice.saveAndApprove(project,finalBean);
|
projectFinalSevice.saveAndApprove(project,finalBean);
|
||||||
return "redirect:/project/list";
|
return "redirect:/project/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@InitBinder
|
@InitBinder
|
||||||
public void initBinder(WebDataBinder webDataBinder) {
|
public void initBinder(WebDataBinder webDataBinder) {
|
||||||
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
|
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
|
||||||
webDataBinder.addCustomFormatter(new NumberStyleFormatter());
|
webDataBinder.addCustomFormatter(new NumberStyleFormatter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,177 +1,177 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.BudgetSettleBean;
|
import cn.palmte.work.bean.BudgetSettleBean;
|
||||||
import cn.palmte.work.bean.EstimateSettleBean;
|
import cn.palmte.work.bean.EstimateSettleBean;
|
||||||
import cn.palmte.work.bean.FormerBean;
|
import cn.palmte.work.bean.FormerBean;
|
||||||
import cn.palmte.work.bean.SettleBean;
|
import cn.palmte.work.bean.SettleBean;
|
||||||
import cn.palmte.work.model.*;
|
import cn.palmte.work.model.*;
|
||||||
import cn.palmte.work.service.ProjectBudgetService;
|
import cn.palmte.work.service.ProjectBudgetService;
|
||||||
import cn.palmte.work.service.ProjectEstimateService;
|
import cn.palmte.work.service.ProjectEstimateService;
|
||||||
import cn.palmte.work.service.ProjectService;
|
import cn.palmte.work.service.ProjectService;
|
||||||
import cn.palmte.work.service.ProjectSettleService;
|
import cn.palmte.work.service.ProjectSettleService;
|
||||||
import cn.palmte.work.utils.DateKit;
|
import cn.palmte.work.utils.DateKit;
|
||||||
import cn.palmte.work.utils.FreeMarkerUtil;
|
import cn.palmte.work.utils.FreeMarkerUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.format.datetime.DateFormatter;
|
import org.springframework.format.datetime.DateFormatter;
|
||||||
import org.springframework.format.number.NumberStyleFormatter;
|
import org.springframework.format.number.NumberStyleFormatter;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.WebDataBinder;
|
import org.springframework.web.bind.WebDataBinder;
|
||||||
import org.springframework.web.bind.annotation.InitBinder;
|
import org.springframework.web.bind.annotation.InitBinder;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import top.jfunc.common.utils.CollectionUtil;
|
import top.jfunc.common.utils.CollectionUtil;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Yuanping Zhang
|
* @author Yuanping Zhang
|
||||||
* @date 2021/11/15
|
* @date 2021/11/15
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/project/settle")
|
@RequestMapping("/project/settle")
|
||||||
public class ProjectSettleController extends BaseController{
|
public class ProjectSettleController extends BaseController{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectEstimateService projectEstimateService;
|
private ProjectEstimateService projectEstimateService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectBudgetService projectBudgetService;
|
private ProjectBudgetService projectBudgetService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectSettleService projectSettleService;
|
private ProjectSettleService projectSettleService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
|
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectUserTimeRepository projectUserTimeRepository;
|
private ProjectUserTimeRepository projectUserTimeRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectSettleMonthRangeRepository projectSettleMonthRangeRepository;
|
private ProjectSettleMonthRangeRepository projectSettleMonthRangeRepository;
|
||||||
|
|
||||||
@RequestMapping("/add")
|
@RequestMapping("/add")
|
||||||
public String add(@RequestParam("id") int id, Map<String, Object> model) {
|
public String add(@RequestParam("id") int id, Map<String, Object> model) {
|
||||||
String time = null;
|
String time = null;
|
||||||
Project project = projectService.getProject(id);
|
Project project = projectService.getProject(id);
|
||||||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||||
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
||||||
if (projectSettleIncome != null) {
|
if (projectSettleIncome != null) {
|
||||||
String former = projectSettleIncome.getTime();
|
String former = projectSettleIncome.getTime();
|
||||||
Date date = DateKit.getDate(former, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
Date date = DateKit.getDate(former, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||||
Calendar instance = Calendar.getInstance();
|
Calendar instance = Calendar.getInstance();
|
||||||
instance.setTime(date);
|
instance.setTime(date);
|
||||||
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH) + 1);
|
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH) + 1);
|
||||||
Date current = instance.getTime();
|
Date current = instance.getTime();
|
||||||
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||||
model.put("startMonth", time);
|
model.put("startMonth", time);
|
||||||
model.put("endMonth", time);
|
model.put("endMonth", time);
|
||||||
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
|
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
|
||||||
} else {
|
} else {
|
||||||
time = DateKit.toStr(project.getStartDate(), DateKit.DATE_FORMAT_YEAR_MONTH2);
|
time = DateKit.toStr(project.getStartDate(), DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||||
|
|
||||||
model.put("startMonth", time);
|
model.put("startMonth", time);
|
||||||
model.put("endMonth", time);
|
model.put("endMonth", time);
|
||||||
model.put("formerBean", new FormerBean());
|
model.put("formerBean", new FormerBean());
|
||||||
}
|
}
|
||||||
|
|
||||||
model.put("project", project);
|
model.put("project", project);
|
||||||
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
||||||
model.put("budgetBean", projectBudgetService.getBudget(project));
|
model.put("budgetBean", projectBudgetService.getBudget(project));
|
||||||
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
|
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
|
||||||
if(CollectionUtil.isNotEmpty(projectUserTimes)){
|
if(CollectionUtil.isNotEmpty(projectUserTimes)){
|
||||||
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
model.put("salary", result);
|
model.put("salary", result);
|
||||||
} else {
|
} else {
|
||||||
model.put("salary", new BigDecimal(0));
|
model.put("salary", new BigDecimal(0));
|
||||||
}
|
}
|
||||||
//现金表
|
//现金表
|
||||||
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
||||||
//freemarker可以利用的静态方法
|
//freemarker可以利用的静态方法
|
||||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||||
return "admin/project_settle_add";
|
return "admin/project_settle_add";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
||||||
Project project = projectService.getProject(id);
|
Project project = projectService.getProject(id);
|
||||||
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
||||||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||||
String time = projectSettleIncome.getTime();
|
String time = projectSettleIncome.getTime();
|
||||||
ProjectSettleMonthRange projectSettleMonthRange = projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(id, time);
|
ProjectSettleMonthRange projectSettleMonthRange = projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(id, time);
|
||||||
if (projectSettleMonthRange != null) {
|
if (projectSettleMonthRange != null) {
|
||||||
model.put("startMonth", projectSettleMonthRange.getStartDate());
|
model.put("startMonth", projectSettleMonthRange.getStartDate());
|
||||||
} else {
|
} else {
|
||||||
model.put("startMonth", time);
|
model.put("startMonth", time);
|
||||||
}
|
}
|
||||||
model.put("endMonth", time);
|
model.put("endMonth", time);
|
||||||
model.put("project", project);
|
model.put("project", project);
|
||||||
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
||||||
model.put("budgetBean", projectBudgetService.getBudget(project));
|
model.put("budgetBean", projectBudgetService.getBudget(project));
|
||||||
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
|
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
|
||||||
model.put("monthBean", projectSettleService.getMonthSettle(project, time));
|
model.put("monthBean", projectSettleService.getMonthSettle(project, time));
|
||||||
model.put("currentBean", projectSettleService.getCurrentSettle(project, time));
|
model.put("currentBean", projectSettleService.getCurrentSettle(project, time));
|
||||||
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
|
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
|
||||||
if(CollectionUtil.isNotEmpty(projectUserTimes)){
|
if(CollectionUtil.isNotEmpty(projectUserTimes)){
|
||||||
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
model.put("salary", result);
|
model.put("salary", result);
|
||||||
} else {
|
} else {
|
||||||
model.put("salary", new BigDecimal(0));
|
model.put("salary", new BigDecimal(0));
|
||||||
}
|
}
|
||||||
//现金表
|
//现金表
|
||||||
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
||||||
//freemarker可以利用的静态方法
|
//freemarker可以利用的静态方法
|
||||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||||
return "admin/project_settle_edit";
|
return "admin/project_settle_edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
public String save(Project project, BindingResult bindingResult, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String startMonth, String endMonth) {
|
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) {
|
if (!startMonth.equals(endMonth) && projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(project.getId(), endMonth) == null) {
|
||||||
ProjectSettleMonthRange range = new ProjectSettleMonthRange();
|
ProjectSettleMonthRange range = new ProjectSettleMonthRange();
|
||||||
range.setProjectId(project.getId());
|
range.setProjectId(project.getId());
|
||||||
range.setStartDate(startMonth);
|
range.setStartDate(startMonth);
|
||||||
range.setEndDate(endMonth);
|
range.setEndDate(endMonth);
|
||||||
projectSettleMonthRangeRepository.save(range);
|
projectSettleMonthRangeRepository.save(range);
|
||||||
}
|
}
|
||||||
projectSettleService.save(project, settleBean, budgetBean, estimateBean, endMonth);
|
projectSettleService.save(project, settleBean, budgetBean, estimateBean, endMonth);
|
||||||
return "redirect:/project/list";
|
return "redirect:/project/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存并提交审批
|
* 保存并提交审批
|
||||||
* @param project
|
* @param project
|
||||||
* @param settleBean
|
* @param settleBean
|
||||||
* @param budgetBean
|
* @param budgetBean
|
||||||
* @param estimateBean
|
* @param estimateBean
|
||||||
* @param endMonth
|
* @param endMonth
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/saveAndApprove")
|
@RequestMapping("/saveAndApprove")
|
||||||
public String saveAndApprove(Project project, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String startMonth, String endMonth) throws Exception{
|
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) {
|
if (!startMonth.equals(endMonth) && projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(project.getId(), endMonth) == null) {
|
||||||
ProjectSettleMonthRange range = new ProjectSettleMonthRange();
|
ProjectSettleMonthRange range = new ProjectSettleMonthRange();
|
||||||
range.setProjectId(project.getId());
|
range.setProjectId(project.getId());
|
||||||
range.setStartDate(startMonth);
|
range.setStartDate(startMonth);
|
||||||
range.setEndDate(endMonth);
|
range.setEndDate(endMonth);
|
||||||
projectSettleMonthRangeRepository.save(range);
|
projectSettleMonthRangeRepository.save(range);
|
||||||
}
|
}
|
||||||
projectSettleService.saveAndApprove(project, settleBean, budgetBean, estimateBean, endMonth);
|
projectSettleService.saveAndApprove(project, settleBean, budgetBean, estimateBean, endMonth);
|
||||||
return "redirect:/project/list";
|
return "redirect:/project/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@InitBinder
|
@InitBinder
|
||||||
public void initBinder(WebDataBinder webDataBinder) {
|
public void initBinder(WebDataBinder webDataBinder) {
|
||||||
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
|
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
|
||||||
webDataBinder.addCustomFormatter(new NumberStyleFormatter());
|
webDataBinder.addCustomFormatter(new NumberStyleFormatter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,61 +1,61 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.SettleBean;
|
import cn.palmte.work.bean.SettleBean;
|
||||||
import cn.palmte.work.model.Admin;
|
import cn.palmte.work.model.Admin;
|
||||||
import cn.palmte.work.service.ProjectSummaryService;
|
import cn.palmte.work.service.ProjectSummaryService;
|
||||||
import cn.palmte.work.utils.DateKit;
|
import cn.palmte.work.utils.DateKit;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目汇总统计
|
* 项目汇总统计
|
||||||
* @author Yuanping Zhang
|
* @author Yuanping Zhang
|
||||||
* @date 2021/11/10
|
* @date 2021/11/10
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/projectSummary")
|
@RequestMapping("/projectSummary")
|
||||||
public class ProjectSummaryController extends BaseController {
|
public class ProjectSummaryController extends BaseController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProjectSummaryController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ProjectSummaryController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectSummaryService projectSummaryService;
|
private ProjectSummaryService projectSummaryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
|
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
//当前登录人的角色类型
|
//当前登录人的角色类型
|
||||||
Admin admin = getAdmin();
|
Admin admin = getAdmin();
|
||||||
model.put("keywords",keywords);
|
model.put("keywords",keywords);
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||||
String time;
|
String time;
|
||||||
if (!searchInfo.containsKey("time")) {
|
if (!searchInfo.containsKey("time")) {
|
||||||
Calendar instance = Calendar.getInstance();
|
Calendar instance = Calendar.getInstance();
|
||||||
instance.setTime(new Date());
|
instance.setTime(new Date());
|
||||||
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH));
|
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH));
|
||||||
Date current = instance.getTime();
|
Date current = instance.getTime();
|
||||||
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||||
model.put("time", time);
|
model.put("time", time);
|
||||||
} else {
|
} else {
|
||||||
time = searchInfo.get("time");
|
time = searchInfo.get("time");
|
||||||
}
|
}
|
||||||
List<SettleBean> list = projectSummaryService.getList(searchInfo, time, admin);
|
List<SettleBean> list = projectSummaryService.getList(searchInfo, time, admin);
|
||||||
model.put("pager", list);
|
model.put("pager", list);
|
||||||
|
|
||||||
return "admin/project_statistics";
|
return "admin/project_statistics";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,121 +1,121 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.model.Admin;
|
import cn.palmte.work.model.Admin;
|
||||||
import cn.palmte.work.model.Project;
|
import cn.palmte.work.model.Project;
|
||||||
import cn.palmte.work.pojo.SpaceVO;
|
import cn.palmte.work.pojo.SpaceVO;
|
||||||
import cn.palmte.work.service.ProjectService;
|
import cn.palmte.work.service.ProjectService;
|
||||||
import cn.palmte.work.service.SpaceService;
|
import cn.palmte.work.service.SpaceService;
|
||||||
import cn.palmte.work.utils.FreeMarkerUtil;
|
import cn.palmte.work.utils.FreeMarkerUtil;
|
||||||
import cn.palmte.work.utils.InterfaceUtil;
|
import cn.palmte.work.utils.InterfaceUtil;
|
||||||
import cn.palmte.work.utils.Utils;
|
import cn.palmte.work.utils.Utils;
|
||||||
import cn.palmte.work.utils.excel.ExportUtils;
|
import cn.palmte.work.utils.excel.ExportUtils;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import top.jfunc.common.db.bean.Page;
|
import top.jfunc.common.db.bean.Page;
|
||||||
import top.jfunc.common.utils.CollectionUtil;
|
import top.jfunc.common.utils.CollectionUtil;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/space")
|
@RequestMapping("/space")
|
||||||
public class SpaceController extends BaseController {
|
public class SpaceController extends BaseController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SpaceService spaceService;
|
private SpaceService spaceService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目列表
|
* 项目列表
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
||||||
@RequestParam(value = "certainty") int certainty,
|
@RequestParam(value = "certainty") int certainty,
|
||||||
@RequestParam(value = "certaintyStr", required = false) String certaintyStr,
|
@RequestParam(value = "certaintyStr", required = false) String certaintyStr,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
//当前登录人的角色类型
|
//当前登录人的角色类型
|
||||||
model.put("keywords", keywords);
|
model.put("keywords", keywords);
|
||||||
model.put("pageNumber", pageNumber);
|
model.put("pageNumber", pageNumber);
|
||||||
Admin admin = InterfaceUtil.getAdmin();
|
Admin admin = InterfaceUtil.getAdmin();
|
||||||
model.put("adminId", admin.getId());
|
model.put("adminId", admin.getId());
|
||||||
model.put("admin", admin);
|
model.put("admin", admin);
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||||
if (certainty == 0) {
|
if (certainty == 0) {
|
||||||
if (certaintyStr.startsWith("A")) {
|
if (certaintyStr.startsWith("A")) {
|
||||||
certainty = 1;
|
certainty = 1;
|
||||||
} else if (certaintyStr.startsWith("B")) {
|
} else if (certaintyStr.startsWith("B")) {
|
||||||
certainty = 2;
|
certainty = 2;
|
||||||
} else if (certaintyStr.startsWith("C")) {
|
} else if (certaintyStr.startsWith("C")) {
|
||||||
certainty = 3;
|
certainty = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.put("certainty", certainty);
|
model.put("certainty", certainty);
|
||||||
searchInfo.putIfAbsent("certainty", String.valueOf(certainty));
|
searchInfo.putIfAbsent("certainty", String.valueOf(certainty));
|
||||||
searchInfo.putIfAbsent("deptName", "销售管理部");
|
searchInfo.putIfAbsent("deptName", "销售管理部");
|
||||||
searchInfo.putIfAbsent("estimateStatus", String.valueOf(1));
|
searchInfo.putIfAbsent("estimateStatus", String.valueOf(1));
|
||||||
Page<Project> page = spaceService.list(searchInfo, pageNumber, pageSize);
|
Page<Project> page = spaceService.list(searchInfo, pageNumber, pageSize);
|
||||||
List<Project> list = page.getList();
|
List<Project> list = page.getList();
|
||||||
if(CollectionUtil.isNotEmpty(list)){
|
if(CollectionUtil.isNotEmpty(list)){
|
||||||
|
|
||||||
int offset = (pageNumber - 1) * pageSize;
|
int offset = (pageNumber - 1) * pageSize;
|
||||||
for (int i = 0 , size = list.size(); i < size; i++) {
|
for (int i = 0 , size = list.size(); i < size; i++) {
|
||||||
list.get(i).setTempId(i+1 + offset);
|
list.get(i).setTempId(i+1 + offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.put("pager", page);
|
model.put("pager", page);
|
||||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||||
return "admin/space_list";
|
return "admin/space_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目导出
|
* 项目导出
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/export")
|
@RequestMapping("/export")
|
||||||
public void export(@RequestParam(value = "keywords", required = false) String keywords, @RequestParam(value = "certainty") int certainty, HttpServletResponse httpServletResponse) throws IOException {
|
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);
|
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||||
searchInfo.putIfAbsent("certainty", String.valueOf(certainty));
|
searchInfo.putIfAbsent("certainty", String.valueOf(certainty));
|
||||||
searchInfo.putIfAbsent("deptName", "销售管理部");
|
searchInfo.putIfAbsent("deptName", "销售管理部");
|
||||||
searchInfo.putIfAbsent("estimateStatus", String.valueOf(1));
|
searchInfo.putIfAbsent("estimateStatus", String.valueOf(1));
|
||||||
downloadHeader(httpServletResponse, Utils.generateExcelName("项目报表"), "application/octet-stream");
|
downloadHeader(httpServletResponse, Utils.generateExcelName("项目报表"), "application/octet-stream");
|
||||||
String[] headers = {"项目编号", "项目名称", "项目类型", "垫资模式", "华智产品金额", "华三产品金额", "汇智产品金额", "其他产品金额", "项目把握度", "项目计划招标时间", "预计合同签订时间",
|
String[] headers = {"项目编号", "项目名称", "项目类型", "垫资模式", "华智产品金额", "华三产品金额", "汇智产品金额", "其他产品金额", "项目把握度", "项目计划招标时间", "预计合同签订时间",
|
||||||
"计收计划", "项目毛利", "合同金额", "项目解决方案", "具体解决方案", "是否二次签单", "最终用户名称", "客户名称", "紫光汇智直接投标/集成商转签", "负责人", "备注","项目阶段"};
|
"计收计划", "项目毛利", "合同金额", "项目解决方案", "具体解决方案", "是否二次签单", "最终用户名称", "客户名称", "紫光汇智直接投标/集成商转签", "负责人", "备注","项目阶段"};
|
||||||
String[] exportColumns = {"projectNo", "name", "typeDesc", "underwrittenModeStr", "huazhiRound", "huasanRound", "huizhiRound", "ziguangRound", "certaintyStr", "bidsTimeStr", "contractTimeStr",
|
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"};
|
"calculationCollection", "grossProfitRound", "contractRound", "resolvePlanStr", "mainContractResolvePlan", "isSecondStr", "terminalCustomer", "customer", "signTypeStr", "principal", "remark","stageName"};
|
||||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||||
httpServletResponse.getOutputStream(), (pN, pS) -> spaceService.list(searchInfo, pN, pS).getList());
|
httpServletResponse.getOutputStream(), (pN, pS) -> spaceService.list(searchInfo, pN, pS).getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转页面
|
* 跳转页面
|
||||||
*
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/statistics")
|
@RequestMapping("/statistics")
|
||||||
public String statistics(Map<String, Object> model) {
|
public String statistics(Map<String, Object> model) {
|
||||||
|
|
||||||
return "/admin/space_statistics";
|
return "/admin/space_statistics";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/listData")
|
@RequestMapping("/listData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String listData() {
|
public String listData() {
|
||||||
|
|
||||||
SpaceVO spaceVO = spaceService.getListData();
|
SpaceVO spaceVO = spaceService.getListData();
|
||||||
return JSONObject.toJSONString(spaceVO);
|
return JSONObject.toJSONString(spaceVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,30 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.CashFlowStatisticsBean;
|
import cn.palmte.work.bean.CashFlowStatisticsBean;
|
||||||
import cn.palmte.work.bean.PrimaryIndicatorBean;
|
import cn.palmte.work.bean.PrimaryIndicatorBean;
|
||||||
import cn.palmte.work.bean.StatisticsBean;
|
import cn.palmte.work.bean.StatisticsBean;
|
||||||
import cn.palmte.work.service.StatisticsService;
|
import cn.palmte.work.service.StatisticsService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/statistics")
|
@RequestMapping("/statistics")
|
||||||
public class StatisticsController extends BaseController{
|
public class StatisticsController extends BaseController{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StatisticsService statisticsService;
|
private StatisticsService statisticsService;
|
||||||
|
|
||||||
@RequestMapping("/month")
|
@RequestMapping("/month")
|
||||||
public String month(Map<String, Object> model){
|
public String month(Map<String, Object> model){
|
||||||
StatisticsBean statisticsData = statisticsService.getStatisticsData();
|
StatisticsBean statisticsData = statisticsService.getStatisticsData();
|
||||||
model.put("primaryIndicatorList",statisticsData.getPrimaryIndicatorBeanList());
|
model.put("primaryIndicatorList",statisticsData.getPrimaryIndicatorBeanList());
|
||||||
model.put("profitAndLossList",statisticsData.getProfitAndLossBeanList());
|
model.put("profitAndLossList",statisticsData.getProfitAndLossBeanList());
|
||||||
model.put("cashFlowList",statisticsData.getCashFlowStatisticsBeanList());
|
model.put("cashFlowList",statisticsData.getCashFlowStatisticsBeanList());
|
||||||
return "admin/month_statistics";
|
return "admin/month_statistics";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,52 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.model.Project;
|
import cn.palmte.work.model.Project;
|
||||||
import cn.palmte.work.model.SysConfig;
|
import cn.palmte.work.model.SysConfig;
|
||||||
import cn.palmte.work.model.SysConfigRepository;
|
import cn.palmte.work.model.SysConfigRepository;
|
||||||
import cn.palmte.work.pojo.SysConfigRequest;
|
import cn.palmte.work.pojo.SysConfigRequest;
|
||||||
import cn.palmte.work.service.SysConfigService;
|
import cn.palmte.work.service.SysConfigService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/sys/config")
|
@RequestMapping("/sys/config")
|
||||||
public class SysConfigController extends BaseController{
|
public class SysConfigController extends BaseController{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysConfigService sysConfigService;
|
private SysConfigService sysConfigService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysConfigRepository sysConfigRepository;
|
private SysConfigRepository sysConfigRepository;
|
||||||
|
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
public String edit(Map<String, Object> model) {
|
public String edit(Map<String, Object> model) {
|
||||||
model.put(SysConfig.KEY_UNDERWRITTENTAXRATE,sysConfigRepository.findByCodeEquals(SysConfig.KEY_UNDERWRITTENTAXRATE).getValue());
|
model.put(SysConfig.KEY_UNDERWRITTENTAXRATE,sysConfigRepository.findByCodeEquals(SysConfig.KEY_UNDERWRITTENTAXRATE).getValue());
|
||||||
model.put(SysConfig.KEY_PROJECTCONTRIBUTIONPROFITRATETHRESHOLD,sysConfigRepository.findByCodeEquals(SysConfig.KEY_PROJECTCONTRIBUTIONPROFITRATETHRESHOLD).getValue());
|
model.put(SysConfig.KEY_PROJECTCONTRIBUTIONPROFITRATETHRESHOLD,sysConfigRepository.findByCodeEquals(SysConfig.KEY_PROJECTCONTRIBUTIONPROFITRATETHRESHOLD).getValue());
|
||||||
return "admin/profit_marfin_config_input";
|
return "admin/profit_marfin_config_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
public ResponseMsg save(@RequestBody String json) {
|
public ResponseMsg save(@RequestBody String json) {
|
||||||
return sysConfigService.saveOrUpdate(json);
|
return sysConfigService.saveOrUpdate(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/checkRate")
|
@RequestMapping("/checkRate")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg checkRate() {
|
public ResponseMsg checkRate() {
|
||||||
String value = sysConfigRepository.findByCodeEquals(SysConfig.KEY_UNDERWRITTENTAXRATE).getValue();
|
String value = sysConfigRepository.findByCodeEquals(SysConfig.KEY_UNDERWRITTENTAXRATE).getValue();
|
||||||
double rate = Double.parseDouble(value);
|
double rate = Double.parseDouble(value);
|
||||||
if (rate <= 0) {
|
if (rate <= 0) {
|
||||||
return ResponseMsg.buildFailedMsg("项目年利率未填写或小于等于0,请联系管理员配置");
|
return ResponseMsg.buildFailedMsg("项目年利率未填写或小于等于0,请联系管理员配置");
|
||||||
}
|
}
|
||||||
return ResponseMsg.buildSuccessMsg("成功");
|
return ResponseMsg.buildSuccessMsg("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,148 +1,148 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.model.SysPermission;
|
import cn.palmte.work.model.SysPermission;
|
||||||
import cn.palmte.work.model.SysPermissionRepository;
|
import cn.palmte.work.model.SysPermissionRepository;
|
||||||
import cn.palmte.work.service.SysPermissionService;
|
import cn.palmte.work.service.SysPermissionService;
|
||||||
import cn.palmte.work.service.SysRolePermissionService;
|
import cn.palmte.work.service.SysRolePermissionService;
|
||||||
import cn.palmte.work.utils.DateKit;
|
import cn.palmte.work.utils.DateKit;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资源管理
|
* 资源管理
|
||||||
*@author nsp
|
*@author nsp
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/permission")
|
@RequestMapping("/permission")
|
||||||
|
|
||||||
public class SysPermissionController extends BaseController{
|
public class SysPermissionController extends BaseController{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysPermissionService sysPermissionService;
|
private SysPermissionService sysPermissionService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysPermissionRepository sysPermissionRepository;
|
private SysPermissionRepository sysPermissionRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRolePermissionService sysRolePermissionService;
|
private SysRolePermissionService sysRolePermissionService;
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SysPermissionController.class);
|
private static final Logger logger = LoggerFactory.getLogger(SysPermissionController.class);
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
||||||
@RequestParam(value = "pageNumber",defaultValue = "1") String pageNumber,
|
@RequestParam(value = "pageNumber",defaultValue = "1") String pageNumber,
|
||||||
@RequestParam(value = "sql", required = false) String sql,
|
@RequestParam(value = "sql", required = false) String sql,
|
||||||
Map<String, Object> model){
|
Map<String, Object> model){
|
||||||
// 初始化参数
|
// 初始化参数
|
||||||
setModel(keywords, model);
|
setModel(keywords, model);
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||||
model.put("pager",sysPermissionService.getAllPermissionListByPage(searchInfo,pageNumber));
|
model.put("pager",sysPermissionService.getAllPermissionListByPage(searchInfo,pageNumber));
|
||||||
model.put("sql", sql);
|
model.put("sql", sql);
|
||||||
|
|
||||||
return "/admin/sys_permission_list";
|
return "/admin/sys_permission_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setModel(String keywords, Map<String, Object> model){
|
private void setModel(String keywords, Map<String, Object> model){
|
||||||
model.put("pmsLevel","0");
|
model.put("pmsLevel","0");
|
||||||
model.put("pmsType","0");
|
model.put("pmsType","0");
|
||||||
model.put("pmsDeleted","-1");
|
model.put("pmsDeleted","-1");
|
||||||
model.put("permissionID","-1");
|
model.put("permissionID","-1");
|
||||||
model.put("keywords",keywords);
|
model.put("keywords",keywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/add")
|
@GetMapping(value = "/add")
|
||||||
public String add( Map<String, Object> model){
|
public String add( Map<String, Object> model){
|
||||||
SysPermission permission=new SysPermission();
|
SysPermission permission=new SysPermission();
|
||||||
model.put("permissionID","-1");
|
model.put("permissionID","-1");
|
||||||
model.put("permission",permission);
|
model.put("permission",permission);
|
||||||
model.put("ps", sysPermissionRepository.findPermissions());
|
model.put("ps", sysPermissionRepository.findPermissions());
|
||||||
return "/admin/sys_permission_input";
|
return "/admin/sys_permission_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(value = "/save")
|
@PostMapping(value = "/save")
|
||||||
public String save(@RequestParam("permissionID") String permissionID,
|
public String save(@RequestParam("permissionID") String permissionID,
|
||||||
SysPermission sysPermission, RedirectAttributes attr, Map<String, Object> model) throws IOException{
|
SysPermission sysPermission, RedirectAttributes attr, Map<String, Object> model) throws IOException{
|
||||||
|
|
||||||
final SysPermission parent = sysPermissionRepository.findOne(sysPermission.getParentId());
|
final SysPermission parent = sysPermissionRepository.findOne(sysPermission.getParentId());
|
||||||
sysPermission.setLevel(parent.getLevel()+1);
|
sysPermission.setLevel(parent.getLevel()+1);
|
||||||
int type = (parent.getLevel()==4) ? 2 : 1;
|
int type = (parent.getLevel()==4) ? 2 : 1;
|
||||||
sysPermission.setType(type);
|
sysPermission.setType(type);
|
||||||
|
|
||||||
String message = sysPermissionService.check(sysPermission,permissionID);
|
String message = sysPermissionService.check(sysPermission,permissionID);
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(message)) {
|
if (StringUtils.isNotEmpty(message)) {
|
||||||
model.put("errorMessage", message);
|
model.put("errorMessage", message);
|
||||||
return "/common/error";
|
return "/common/error";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("-1".equals(permissionID)){
|
if ("-1".equals(permissionID)){
|
||||||
getSql(sysPermission, attr, parent);
|
getSql(sysPermission, attr, parent);
|
||||||
sysPermissionService.addPermission(sysPermission); //新增
|
sysPermissionService.addPermission(sysPermission); //新增
|
||||||
}else {
|
}else {
|
||||||
sysPermissionService.updatePermission(sysPermission,permissionID); // 修改
|
sysPermissionService.updatePermission(sysPermission,permissionID); // 修改
|
||||||
}
|
}
|
||||||
return "redirect:/permission/list";
|
return "redirect:/permission/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getSql(SysPermission sysPermission, RedirectAttributes attr, SysPermission parent) {
|
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}');"
|
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("{name}", sysPermission.getName())
|
||||||
.replace("{url}", sysPermission.getUrl())
|
.replace("{url}", sysPermission.getUrl())
|
||||||
.replace("{permission}", sysPermission.getPermission())
|
.replace("{permission}", sysPermission.getPermission())
|
||||||
.replace("{parentPermission}", parent.getPermission())
|
.replace("{parentPermission}", parent.getPermission())
|
||||||
.replace("{level}", sysPermission.getLevel()+"")
|
.replace("{level}", sysPermission.getLevel()+"")
|
||||||
.replace("{type}", sysPermission.getType()+"")
|
.replace("{type}", sysPermission.getType()+"")
|
||||||
.replace("{sort}", sysPermission.getSort()+"")
|
.replace("{sort}", sysPermission.getSort()+"")
|
||||||
.replace("{time}", DateKit.toStr(new Date(), DateKit.TIME_FORMAT));
|
.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}');"
|
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("{permission}", sysPermission.getPermission())
|
||||||
.replace("{time}", DateKit.toStr(new Date(), DateKit.TIME_FORMAT));
|
.replace("{time}", DateKit.toStr(new Date(), DateKit.TIME_FORMAT));
|
||||||
attr.addAttribute("sql", sql1 + "</br>" + sql2);
|
attr.addAttribute("sql", sql1 + "</br>" + sql2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/edit")
|
@GetMapping(value = "/edit")
|
||||||
public String edit(@RequestParam("id") String permissionID,Map<String, Object> model){
|
public String edit(@RequestParam("id") String permissionID,Map<String, Object> model){
|
||||||
SysPermission permission =sysPermissionRepository.findOne(Integer.parseInt(permissionID));
|
SysPermission permission =sysPermissionRepository.findOne(Integer.parseInt(permissionID));
|
||||||
model.put("permissionID",permissionID);
|
model.put("permissionID",permissionID);
|
||||||
model.put("permission",permission);
|
model.put("permission",permission);
|
||||||
model.put("ps", sysPermissionRepository.findPermissions());
|
model.put("ps", sysPermissionRepository.findPermissions());
|
||||||
return "/admin/sys_permission_input";
|
return "/admin/sys_permission_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/delete")
|
@GetMapping(value = "/delete")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg delete(@RequestParam("ids") String ids){
|
public ResponseMsg delete(@RequestParam("ids") String ids){
|
||||||
String[] deleteIds=ids.split("#%#");
|
String[] deleteIds=ids.split("#%#");
|
||||||
boolean deleted = sysPermissionService.deletePermissionByIDs(deleteIds);
|
boolean deleted = sysPermissionService.deletePermissionByIDs(deleteIds);
|
||||||
boolean bDel = sysRolePermissionService.deleteSysRolePermissionByIDs(deleteIds);
|
boolean bDel = sysRolePermissionService.deleteSysRolePermissionByIDs(deleteIds);
|
||||||
|
|
||||||
ResponseMsg responseMsge=new ResponseMsg();
|
ResponseMsg responseMsge=new ResponseMsg();
|
||||||
if(deleted && bDel){
|
if(deleted && bDel){
|
||||||
logger.info("删除成功");
|
logger.info("删除成功");
|
||||||
responseMsge.setStatus(0);
|
responseMsge.setStatus(0);
|
||||||
responseMsge.setMsg("删除成功");
|
responseMsge.setMsg("删除成功");
|
||||||
} else{
|
} else{
|
||||||
responseMsge.setStatus(1);
|
responseMsge.setStatus(1);
|
||||||
responseMsge.setMsg("删除失败");
|
responseMsge.setMsg("删除失败");
|
||||||
}
|
}
|
||||||
return responseMsge;
|
return responseMsge;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,262 +1,262 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.Constant;
|
import cn.palmte.work.bean.Constant;
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.model.SysRole;
|
import cn.palmte.work.model.SysRole;
|
||||||
import cn.palmte.work.pojo.PermissionNode;
|
import cn.palmte.work.pojo.PermissionNode;
|
||||||
import cn.palmte.work.pojo.RoleBean;
|
import cn.palmte.work.pojo.RoleBean;
|
||||||
import cn.palmte.work.service.AdminService;
|
import cn.palmte.work.service.AdminService;
|
||||||
import cn.palmte.work.service.SysRoleService;
|
import cn.palmte.work.service.SysRoleService;
|
||||||
import cn.palmte.work.utils.InterfaceUtil;
|
import cn.palmte.work.utils.InterfaceUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色管理
|
* 角色管理
|
||||||
* @author nsp
|
* @author nsp
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/role")
|
@RequestMapping("/role")
|
||||||
public class SysRoleController extends BaseController{
|
public class SysRoleController extends BaseController{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRoleService sysRoleService;
|
private SysRoleService sysRoleService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AdminService adminService;
|
private AdminService adminService;
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SysRoleController.class);
|
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};
|
private static final int[] ROLE_TYPE_ARRAY = new int[] { Constant.ROLE_TYPE_CMCC_ADMIN,Constant.ROLE_TYPE_ZJPT_ADMIN};
|
||||||
|
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||||
Map<String, Object> model) {
|
Map<String, Object> model) {
|
||||||
logger.info("获取角色列表");
|
logger.info("获取角色列表");
|
||||||
//当前登录人的角色类型
|
//当前登录人的角色类型
|
||||||
model.put("keywords",keywords);
|
model.put("keywords",keywords);
|
||||||
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
|
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||||
model.put("pager",sysRoleService.list(searchInfo,pageNumber,pageSize));
|
model.put("pager",sysRoleService.list(searchInfo,pageNumber,pageSize));
|
||||||
return "admin/role_list";
|
return "admin/role_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/add")
|
@GetMapping(value = "/add")
|
||||||
public String add( Map<String, Object> model){
|
public String add( Map<String, Object> model){
|
||||||
//当前登录人的角色
|
//当前登录人的角色
|
||||||
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
|
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
|
||||||
PermissionNode root= sysRoleService.getPermissionNodeTree(adminSysRole.getId());
|
PermissionNode root= sysRoleService.getPermissionNodeTree(adminSysRole.getId());
|
||||||
List<RoleBean> roleLevels = getRoleLevels(adminSysRole.getId(), 0);
|
List<RoleBean> roleLevels = getRoleLevels(adminSysRole.getId(), 0);
|
||||||
List<RoleBean> roleTypes = getRoleTypes(adminSysRole.getId(), adminSysRole.getType(),0);
|
List<RoleBean> roleTypes = getRoleTypes(adminSysRole.getId(), adminSysRole.getType(),0);
|
||||||
SysRole role = new SysRole();
|
SysRole role = new SysRole();
|
||||||
model.put("permnode",root);
|
model.put("permnode",root);
|
||||||
model.put("roleID",-1);
|
model.put("roleID",-1);
|
||||||
model.put("isActive",1);
|
model.put("isActive",1);
|
||||||
model.put("level",roleLevels);//默认 省级
|
model.put("level",roleLevels);//默认 省级
|
||||||
model.put("type",roleTypes);//角色类型
|
model.put("type",roleTypes);//角色类型
|
||||||
model.put("role",role);
|
model.put("role",role);
|
||||||
//model.put("selectedType",roleLevels.get(0).getValue());
|
//model.put("selectedType",roleLevels.get(0).getValue());
|
||||||
|
|
||||||
return "/admin/role_input";
|
return "/admin/role_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
public String edit(@RequestParam(value = "id")int id, Map<String, Object> model){
|
public String edit(@RequestParam(value = "id")int id, Map<String, Object> model){
|
||||||
//当前登录人的角色
|
//当前登录人的角色
|
||||||
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
|
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
|
||||||
SysRole role = sysRoleService.fingSysRoleById(id);
|
SysRole role = sysRoleService.fingSysRoleById(id);
|
||||||
PermissionNode root = sysRoleService.getPermissionNodeTreeForEdit(adminSysRole.getId(), id);
|
PermissionNode root = sysRoleService.getPermissionNodeTreeForEdit(adminSysRole.getId(), id);
|
||||||
List<RoleBean> roleLevels = getRoleLevels(adminSysRole.getId(), role.getLevel());
|
List<RoleBean> roleLevels = getRoleLevels(adminSysRole.getId(), role.getLevel());
|
||||||
List<RoleBean> roleTypes = getRoleTypes(adminSysRole.getId(),adminSysRole.getType(), role.getType());
|
List<RoleBean> roleTypes = getRoleTypes(adminSysRole.getId(),adminSysRole.getType(), role.getType());
|
||||||
model.put("permnode",root);
|
model.put("permnode",root);
|
||||||
model.put("roleID",id);
|
model.put("roleID",id);
|
||||||
model.put("roleName",role.getName());
|
model.put("roleName",role.getName());
|
||||||
model.put("level",roleLevels);
|
model.put("level",roleLevels);
|
||||||
model.put("type",roleTypes);
|
model.put("type",roleTypes);
|
||||||
//model.put("selectedType",role.getType());
|
//model.put("selectedType",role.getType());
|
||||||
model.put("role",role);
|
model.put("role",role);
|
||||||
return "admin/role_input";
|
return "admin/role_input";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
public String save(@RequestParam Map<String, Object> reqMap,@RequestParam(value = "roleID")int roleID
|
public String save(@RequestParam Map<String, Object> reqMap,@RequestParam(value = "roleID")int roleID
|
||||||
) {
|
) {
|
||||||
logger.info("新增编辑保存,roleID="+roleID);
|
logger.info("新增编辑保存,roleID="+roleID);
|
||||||
sysRoleService.addOrUpdatePermission(reqMap,roleID);
|
sysRoleService.addOrUpdatePermission(reqMap,roleID);
|
||||||
return "redirect:/role/list";
|
return "redirect:/role/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/check")
|
@RequestMapping("/check")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg check(@RequestParam(value = "role_id")String role_id, @RequestParam(value = "role_name")String role_name,
|
public ResponseMsg check(@RequestParam(value = "role_id")String role_id, @RequestParam(value = "role_name")String role_name,
|
||||||
HttpServletResponse response) throws Exception{
|
HttpServletResponse response) throws Exception{
|
||||||
int result=sysRoleService.cheakRoleName(Integer.parseInt(role_id),role_name);
|
int result=sysRoleService.cheakRoleName(Integer.parseInt(role_id),role_name);
|
||||||
ResponseMsg responseMsg=new ResponseMsg();
|
ResponseMsg responseMsg=new ResponseMsg();
|
||||||
if (result>0){
|
if (result>0){
|
||||||
responseMsg.setStatus(0);
|
responseMsg.setStatus(0);
|
||||||
responseMsg.setMsg("该角色名已存在,请重新输入!");
|
responseMsg.setMsg("该角色名已存在,请重新输入!");
|
||||||
}else {
|
}else {
|
||||||
responseMsg.setStatus(1);
|
responseMsg.setStatus(1);
|
||||||
responseMsg.setMsg("");
|
responseMsg.setMsg("");
|
||||||
}
|
}
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/delete")
|
@GetMapping(value = "/delete")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg delete(@RequestParam("ids") String ids){
|
public ResponseMsg delete(@RequestParam("ids") String ids){
|
||||||
ResponseMsg responseMsge=new ResponseMsg();
|
ResponseMsg responseMsge=new ResponseMsg();
|
||||||
if ("".equals(ids)){
|
if ("".equals(ids)){
|
||||||
responseMsge.setStatus(1);
|
responseMsge.setStatus(1);
|
||||||
responseMsge.setMsg("删除失败,无选中项!");
|
responseMsge.setMsg("删除失败,无选中项!");
|
||||||
}else {
|
}else {
|
||||||
String[] deleteIds=ids.split("#%#");
|
String[] deleteIds=ids.split("#%#");
|
||||||
String msg = sysRoleService.deleteSelectedPermission(deleteIds);
|
String msg = sysRoleService.deleteSelectedPermission(deleteIds);
|
||||||
responseMsge.setStatus(0);
|
responseMsge.setStatus(0);
|
||||||
responseMsge.setMsg(msg);
|
responseMsge.setMsg(msg);
|
||||||
}
|
}
|
||||||
return responseMsge;
|
return responseMsge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Title: 根据当前管理员所属角色的等级,获取角色等级列表
|
* @Title: 根据当前管理员所属角色的等级,获取角色等级列表
|
||||||
* @Description:角色等级(省级1>地级市级2>区县级3>网点级4),获取角色等级列表时,只能获取级别小于等于当前级别的
|
* @Description:角色等级(省级1>地级市级2>区县级3>网点级4),获取角色等级列表时,只能获取级别小于等于当前级别的
|
||||||
* @param adminRoleId
|
* @param adminRoleId
|
||||||
* 当前管理员角色ID
|
* 当前管理员角色ID
|
||||||
* @param selectedLevel
|
* @param selectedLevel
|
||||||
* 默认选中等级
|
* 默认选中等级
|
||||||
* @return List<PermissionLevel>
|
* @return List<PermissionLevel>
|
||||||
*/
|
*/
|
||||||
private List<RoleBean> getRoleLevels(int adminRoleId, int selectedLevel){
|
private List<RoleBean> getRoleLevels(int adminRoleId, int selectedLevel){
|
||||||
SysRole role = sysRoleService.fingSysRoleById(adminRoleId);
|
SysRole role = sysRoleService.fingSysRoleById(adminRoleId);
|
||||||
int adminLevel = role.getLevel();
|
int adminLevel = role.getLevel();
|
||||||
if(selectedLevel == 0){
|
if(selectedLevel == 0){
|
||||||
selectedLevel = adminLevel;
|
selectedLevel = adminLevel;
|
||||||
}
|
}
|
||||||
List<RoleBean> roleLevels = new ArrayList<RoleBean>(3);
|
List<RoleBean> roleLevels = new ArrayList<RoleBean>(3);
|
||||||
for(int i = adminLevel; i <= 3; i++){
|
for(int i = adminLevel; i <= 3; i++){
|
||||||
String name = getRoleLevelName(i);
|
String name = getRoleLevelName(i);
|
||||||
if(null != name){
|
if(null != name){
|
||||||
RoleBean permissionLevel = new RoleBean(name, i);
|
RoleBean permissionLevel = new RoleBean(name, i);
|
||||||
if(selectedLevel == i){
|
if(selectedLevel == i){
|
||||||
permissionLevel.setSelected(true);
|
permissionLevel.setSelected(true);
|
||||||
}
|
}
|
||||||
roleLevels.add(permissionLevel);
|
roleLevels.add(permissionLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return roleLevels;
|
return roleLevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取角色类型列表
|
* 获取角色类型列表
|
||||||
* @param adminRoleId
|
* @param adminRoleId
|
||||||
* @param selectedType
|
* @param selectedType
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<RoleBean> getRoleTypes(int adminRoleId,int adminRoleType, int selectedType){
|
private List<RoleBean> getRoleTypes(int adminRoleId,int adminRoleType, int selectedType){
|
||||||
SysRole role = sysRoleService.fingSysRoleById(adminRoleId);
|
SysRole role = sysRoleService.fingSysRoleById(adminRoleId);
|
||||||
int roleType = role.getType();
|
int roleType = role.getType();
|
||||||
if(selectedType == 0){
|
if(selectedType == 0){
|
||||||
selectedType = roleType;
|
selectedType = roleType;
|
||||||
}
|
}
|
||||||
List<RoleBean> roleLevels = new ArrayList<RoleBean>(4);
|
List<RoleBean> roleLevels = new ArrayList<RoleBean>(4);
|
||||||
for(int i = 0; i < ROLE_TYPE_ARRAY.length; i++){
|
for(int i = 0; i < ROLE_TYPE_ARRAY.length; i++){
|
||||||
if (adminRoleType<ROLE_TYPE_ARRAY[i]){
|
if (adminRoleType<ROLE_TYPE_ARRAY[i]){
|
||||||
String name = getRoleTypeName(ROLE_TYPE_ARRAY[i]);
|
String name = getRoleTypeName(ROLE_TYPE_ARRAY[i]);
|
||||||
if(null != name){
|
if(null != name){
|
||||||
RoleBean roleTypeBean = new RoleBean(name, ROLE_TYPE_ARRAY[i]);
|
RoleBean roleTypeBean = new RoleBean(name, ROLE_TYPE_ARRAY[i]);
|
||||||
if(selectedType == ROLE_TYPE_ARRAY[i]){
|
if(selectedType == ROLE_TYPE_ARRAY[i]){
|
||||||
roleTypeBean.setSelected(true);
|
roleTypeBean.setSelected(true);
|
||||||
}
|
}
|
||||||
roleLevels.add(roleTypeBean);
|
roleLevels.add(roleTypeBean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return roleLevels;
|
return roleLevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 目前末梢渠道中默认都为省级
|
* 目前末梢渠道中默认都为省级
|
||||||
* 根据type值获取角色类型名称
|
* 根据type值获取角色类型名称
|
||||||
* @param type
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String getRoleTypeName(int type){
|
private String getRoleTypeName(int type){
|
||||||
String typeName = null;
|
String typeName = null;
|
||||||
switch(type){
|
switch(type){
|
||||||
case Constant.ROLE_TYPE_CMCC_ADMIN:
|
case Constant.ROLE_TYPE_CMCC_ADMIN:
|
||||||
typeName = "移动管理员";
|
typeName = "移动管理员";
|
||||||
break;
|
break;
|
||||||
case Constant.ROLE_TYPE_ZJPT_ADMIN:
|
case Constant.ROLE_TYPE_ZJPT_ADMIN:
|
||||||
typeName = "资金平台管理员";
|
typeName = "资金平台管理员";
|
||||||
break;
|
break;
|
||||||
default:typeName = null;
|
default:typeName = null;
|
||||||
}
|
}
|
||||||
return typeName;
|
return typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据Level值获取角色等级名称
|
* 根据Level值获取角色等级名称
|
||||||
* @param level
|
* @param level
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String getRoleLevelName(int level){
|
private String getRoleLevelName(int level){
|
||||||
String levelName = null;
|
String levelName = null;
|
||||||
switch(level){
|
switch(level){
|
||||||
case 1:
|
case 1:
|
||||||
levelName = "省级";
|
levelName = "省级";
|
||||||
break;
|
break;
|
||||||
/*case 2:
|
/*case 2:
|
||||||
levelName = "地市级";
|
levelName = "地市级";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
levelName = "区县级";
|
levelName = "区县级";
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
levelName = "网点级";
|
levelName = "网点级";
|
||||||
break;*/
|
break;*/
|
||||||
default:levelName = null;
|
default:levelName = null;
|
||||||
}
|
}
|
||||||
return levelName;
|
return levelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启用 禁用
|
* 启用 禁用
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/enableOrDisable")
|
@RequestMapping("/enableOrDisable")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
|
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
|
||||||
@RequestParam("enabled") int status, RedirectAttributes attr) {
|
@RequestParam("enabled") int status, RedirectAttributes attr) {
|
||||||
boolean isSuccess = false;
|
boolean isSuccess = false;
|
||||||
try {
|
try {
|
||||||
isSuccess = sysRoleService.enableOrDisable(status, id);
|
isSuccess = sysRoleService.enableOrDisable(status, id);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.getMessage();
|
e.getMessage();
|
||||||
}
|
}
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
return ResponseMsg.buildSuccessMsg("操作成功");
|
return ResponseMsg.buildSuccessMsg("操作成功");
|
||||||
} else {
|
} else {
|
||||||
return ResponseMsg.buildSuccessMsg("操作失败");
|
return ResponseMsg.buildSuccessMsg("操作失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,35 @@
|
||||||
package cn.palmte.work.exception;
|
package cn.palmte.work.exception;
|
||||||
|
|
||||||
import cn.palmte.work.config.Constant;
|
import cn.palmte.work.config.Constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiongshiyan
|
* @author xiongshiyan
|
||||||
* 使用的时候直接抛出异常ResponseException(如果想携带ResultCode,Message,Data等信息)
|
* 使用的时候直接抛出异常ResponseException(如果想携带ResultCode,Message,Data等信息)
|
||||||
*/
|
*/
|
||||||
public class ResponseException extends RuntimeException{
|
public class ResponseException extends RuntimeException{
|
||||||
private int status = Constant.Status.STATUS_FAILED;
|
private int status = Constant.Status.STATUS_FAILED;
|
||||||
private Object data = null;
|
private Object data = null;
|
||||||
|
|
||||||
public ResponseException(int resultCode, String message, Object data){
|
public ResponseException(int resultCode, String message, Object data){
|
||||||
super(message);
|
super(message);
|
||||||
this.status = resultCode;
|
this.status = resultCode;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
public ResponseException(int status, String message){
|
public ResponseException(int status, String message){
|
||||||
this(status, message, null);
|
this(status, message, null);
|
||||||
}
|
}
|
||||||
public ResponseException(String message){
|
public ResponseException(String message){
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
public int getStatus(){
|
public int getStatus(){
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
public void setStatus(int status){ this.status = status; }
|
public void setStatus(int status){ this.status = status; }
|
||||||
public Object getData(){
|
public Object getData(){
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
public void setData(Object data){
|
public void setData(Object data){
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,95 +1,95 @@
|
||||||
package cn.palmte.work.model;
|
package cn.palmte.work.model;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程图里解析出来的任务定义
|
* 流程图里解析出来的任务定义
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "act_task_def")
|
@Table(name = "act_task_def")
|
||||||
public class ActTaskDef {
|
public class ActTaskDef {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务名称
|
* 任务名称
|
||||||
*/
|
*/
|
||||||
@Column(name = "task_name")
|
@Column(name = "task_name")
|
||||||
private String taskName;
|
private String taskName;
|
||||||
|
|
||||||
@Column(name = "task_key")
|
@Column(name = "task_key")
|
||||||
private String taskKey;
|
private String taskKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务类型 0-单实例(或签) 1-多实例(会签)
|
* 任务类型 0-单实例(或签) 1-多实例(会签)
|
||||||
*/
|
*/
|
||||||
@Column(name = "task_type")
|
@Column(name = "task_type")
|
||||||
private int taskType;
|
private int taskType;
|
||||||
|
|
||||||
@Column(name = "proc_def_id")
|
@Column(name = "proc_def_id")
|
||||||
private String procDefId;
|
private String procDefId;
|
||||||
|
|
||||||
@Column(name = "proc_def_name")
|
@Column(name = "proc_def_name")
|
||||||
private String procDefName;
|
private String procDefName;
|
||||||
|
|
||||||
@Column(name = "proc_def_key")
|
@Column(name = "proc_def_key")
|
||||||
private String procDefKey;
|
private String procDefKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 回退任务key
|
* 回退任务key
|
||||||
*/
|
*/
|
||||||
@Column(name = "rollback_task_key")
|
@Column(name = "rollback_task_key")
|
||||||
private String rollbackTaskKey;
|
private String rollbackTaskKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务节点位置 -1结束节点 0-未知或者其他节点 1-开始节点 2-发起审批节点
|
* 任务节点位置 -1结束节点 0-未知或者其他节点 1-开始节点 2-发起审批节点
|
||||||
*/
|
*/
|
||||||
@Column(name = "task_index")
|
@Column(name = "task_index")
|
||||||
private int taskIndex;
|
private int taskIndex;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 候选人
|
* 候选人
|
||||||
*/
|
*/
|
||||||
@Column(name = "candidate_users")
|
@Column(name = "candidate_users")
|
||||||
private String candidateUsers;
|
private String candidateUsers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 候选角色
|
* 候选角色
|
||||||
*/
|
*/
|
||||||
@Column(name = "candidate_roles")
|
@Column(name = "candidate_roles")
|
||||||
private String candidateRoles;
|
private String candidateRoles;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按类型查询
|
* 按类型查询
|
||||||
*/
|
*/
|
||||||
@Column(name = "candidate_types")
|
@Column(name = "candidate_types")
|
||||||
private String candidateTypes;
|
private String candidateTypes;
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "created_time")
|
@Column(name = "created_time")
|
||||||
private Date createdTime;
|
private Date createdTime;
|
||||||
|
|
||||||
@Column(name = "last_updated_time")
|
@Column(name = "last_updated_time")
|
||||||
private Date lastUpdatedTime;
|
private Date lastUpdatedTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private List<String> candidateUserList;
|
private List<String> candidateUserList;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private List<String> candidateRoleList;
|
private List<String> candidateRoleList;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private List<String> candidateTypeList;
|
private List<String> candidateTypeList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,41 @@
|
||||||
package cn.palmte.work.model;
|
package cn.palmte.work.model;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface ActTaskDefRepository extends JpaRepository<ActTaskDef, Integer> {
|
public interface ActTaskDefRepository extends JpaRepository<ActTaskDef, Integer> {
|
||||||
|
|
||||||
|
|
||||||
List<ActTaskDef> findByProcDefId(String procDefId);
|
List<ActTaskDef> findByProcDefId(String procDefId);
|
||||||
|
|
||||||
|
|
||||||
ActTaskDef findFirstByProcDefIdAndTaskKey(String procDefId, String taskKey);
|
ActTaskDef findFirstByProcDefIdAndTaskKey(String procDefId, String taskKey);
|
||||||
|
|
||||||
void deleteByProcDefId(String procDefId);
|
void deleteByProcDefId(String procDefId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional
|
||||||
@Query(value = "update ACT_HI_ACTINST a SET a.ASSIGNEE_=? WHERE PROC_INST_ID_=? AND TASK_ID_=?", nativeQuery = true)
|
@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);
|
int updateHiActAssign(String assign, String procInsId, String taskId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional
|
||||||
@Query(value = "update ACT_HI_TASKINST a SET a.ASSIGNEE_=? WHERE PROC_INST_ID_=? AND ID_=?", nativeQuery = true)
|
@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);
|
int updateHiTaskAssign(String assign, String procInsId, String taskId);
|
||||||
|
|
||||||
|
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional
|
||||||
@Query(value = "update act_re_procdef SET DESCRIPTION_=? WHERE ID_=?", nativeQuery = true)
|
@Query(value = "update act_re_procdef SET DESCRIPTION_=? WHERE ID_=?", nativeQuery = true)
|
||||||
int updateProcDefDesc(String des, String procDefId);
|
int updateProcDefDesc(String des, String procDefId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,392 +1,392 @@
|
||||||
package cn.palmte.work.model;
|
package cn.palmte.work.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by wang.lin@esstx.cn on 2018/7/17.
|
* Created by wang.lin@esstx.cn on 2018/7/17.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "sys_user")
|
@Table(name = "sys_user")
|
||||||
public class Admin{
|
public class Admin{
|
||||||
public static final int ENABLED = 1;
|
public static final int ENABLED = 1;
|
||||||
public static final int DISABLED = 0;
|
public static final int DISABLED = 0;
|
||||||
public static final int LOCKED = 1;
|
public static final int LOCKED = 1;
|
||||||
public static final int UN_LOCKED = 0;
|
public static final int UN_LOCKED = 0;
|
||||||
//删除
|
//删除
|
||||||
public static final int DELETED = 1;
|
public static final int DELETED = 1;
|
||||||
//未删
|
//未删
|
||||||
public static final int UN_DELETED = 0;
|
public static final int UN_DELETED = 0;
|
||||||
|
|
||||||
private static final long serialVersionUID = 8788969524794365369L;
|
private static final long serialVersionUID = 8788969524794365369L;
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
|
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
|
||||||
private Integer id;
|
private Integer id;
|
||||||
@Column(name = "user_name")
|
@Column(name = "user_name")
|
||||||
private String userName;
|
private String userName;
|
||||||
private String password;
|
private String password;
|
||||||
@Column(name = "emp_code")
|
@Column(name = "emp_code")
|
||||||
private String empCode;
|
private String empCode;
|
||||||
private String salt;
|
private String salt;
|
||||||
@Column(name = "real_name")
|
@Column(name = "real_name")
|
||||||
private String realName;
|
private String realName;
|
||||||
private String telephone;
|
private String telephone;
|
||||||
private int enabled;
|
private int enabled;
|
||||||
@Column(name = "login_error_count")
|
@Column(name = "login_error_count")
|
||||||
private int loginErrorCount;
|
private int loginErrorCount;
|
||||||
private int locked;
|
private int locked;
|
||||||
@Column(name = "locked_date")
|
@Column(name = "locked_date")
|
||||||
private Date lockedDate;
|
private Date lockedDate;
|
||||||
@Column(name = "login_date")
|
@Column(name = "login_date")
|
||||||
private Date loginDate;
|
private Date loginDate;
|
||||||
@Column(name = "login_ip")
|
@Column(name = "login_ip")
|
||||||
private String loginIp;
|
private String loginIp;
|
||||||
@Column(name = "is_deleted")
|
@Column(name = "is_deleted")
|
||||||
private boolean isDeleted;
|
private boolean isDeleted;
|
||||||
@Column(name = "created_by")
|
@Column(name = "created_by")
|
||||||
private Integer createdBy;
|
private Integer createdBy;
|
||||||
@Column(name = "created_time")
|
@Column(name = "created_time")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createdTime;
|
private Date createdTime;
|
||||||
@Column(name = "last_updated_by")
|
@Column(name = "last_updated_by")
|
||||||
private Integer lastUpdatedBy;
|
private Integer lastUpdatedBy;
|
||||||
@Column(name = "last_updated_time")
|
@Column(name = "last_updated_time")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date lastUpdatedTime;
|
private Date lastUpdatedTime;
|
||||||
@Column(name = "role_id")
|
@Column(name = "role_id")
|
||||||
private int roleId;
|
private int roleId;
|
||||||
@Column(name = "role_name")
|
@Column(name = "role_name")
|
||||||
private String roleName;
|
private String roleName;
|
||||||
|
|
||||||
@Column(name = "updated__password_time")
|
@Column(name = "updated__password_time")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updatedPasswordTime;
|
private Date updatedPasswordTime;
|
||||||
|
|
||||||
@Column(name = "work_location")
|
@Column(name = "work_location")
|
||||||
private String workLocation;
|
private String workLocation;
|
||||||
|
|
||||||
@Column(name = "dept_id")
|
@Column(name = "dept_id")
|
||||||
private int deptId;
|
private int deptId;
|
||||||
|
|
||||||
@Column(name = "dept_name")
|
@Column(name = "dept_name")
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
@Column(name = "direct_manager")
|
@Column(name = "direct_manager")
|
||||||
private String directManager;
|
private String directManager;
|
||||||
|
|
||||||
@Column(name = "position_id")
|
@Column(name = "position_id")
|
||||||
private int positionId;
|
private int positionId;
|
||||||
|
|
||||||
@Column(name = "position_name")
|
@Column(name = "position_name")
|
||||||
private String positionName;
|
private String positionName;
|
||||||
|
|
||||||
@Column(name = "company_email")
|
@Column(name = "company_email")
|
||||||
private String companyEmail;
|
private String companyEmail;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private Integer tempId;
|
private Integer tempId;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String deptFirstName;
|
private String deptFirstName;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String deptSecondName;
|
private String deptSecondName;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String deptThirdName;
|
private String deptThirdName;
|
||||||
|
|
||||||
public String getEmpCode() {
|
public String getEmpCode() {
|
||||||
return empCode;
|
return empCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmpCode(String empCode) {
|
public void setEmpCode(String empCode) {
|
||||||
this.empCode = empCode;
|
this.empCode = empCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWorkLocation() {
|
public String getWorkLocation() {
|
||||||
return workLocation;
|
return workLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWorkLocation(String workLocation) {
|
public void setWorkLocation(String workLocation) {
|
||||||
this.workLocation = workLocation;
|
this.workLocation = workLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDeptId() {
|
public int getDeptId() {
|
||||||
return deptId;
|
return deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptId(int deptId) {
|
public void setDeptId(int deptId) {
|
||||||
this.deptId = deptId;
|
this.deptId = deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeptName() {
|
public String getDeptName() {
|
||||||
return deptName;
|
return deptName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptName(String deptName) {
|
public void setDeptName(String deptName) {
|
||||||
this.deptName = deptName;
|
this.deptName = deptName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDirectManager() {
|
public String getDirectManager() {
|
||||||
return directManager;
|
return directManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDirectManager(String directManager) {
|
public void setDirectManager(String directManager) {
|
||||||
this.directManager = directManager;
|
this.directManager = directManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPositionId() {
|
public int getPositionId() {
|
||||||
return positionId;
|
return positionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPositionId(int positionId) {
|
public void setPositionId(int positionId) {
|
||||||
this.positionId = positionId;
|
this.positionId = positionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPositionName() {
|
public String getPositionName() {
|
||||||
return positionName;
|
return positionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPositionName(String positionName) {
|
public void setPositionName(String positionName) {
|
||||||
this.positionName = positionName;
|
this.positionName = positionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCompanyEmail() {
|
public String getCompanyEmail() {
|
||||||
return companyEmail;
|
return companyEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCompanyEmail(String companyEmail) {
|
public void setCompanyEmail(String companyEmail) {
|
||||||
this.companyEmail = companyEmail;
|
this.companyEmail = companyEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private int roleType;
|
private int roleType;
|
||||||
@Transient
|
@Transient
|
||||||
private int roleLevel;
|
private int roleLevel;
|
||||||
@Transient
|
@Transient
|
||||||
private String roleTypeName;
|
private String roleTypeName;
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Integer id) {
|
public void setId(Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName() {
|
public String getUserName() {
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserName(String userName) {
|
public void setUserName(String userName) {
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSalt() {
|
public String getSalt() {
|
||||||
return salt;
|
return salt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSalt(String salt) {
|
public void setSalt(String salt) {
|
||||||
this.salt = salt;
|
this.salt = salt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRealName() {
|
public String getRealName() {
|
||||||
return realName;
|
return realName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRealName(String realName) {
|
public void setRealName(String realName) {
|
||||||
this.realName = realName;
|
this.realName = realName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTelephone() {
|
public String getTelephone() {
|
||||||
return telephone;
|
return telephone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTelephone(String telephone) {
|
public void setTelephone(String telephone) {
|
||||||
this.telephone = telephone;
|
this.telephone = telephone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEnabled() {
|
public int getEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnabled(int enabled) {
|
public void setEnabled(int enabled) {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLoginErrorCount() {
|
public int getLoginErrorCount() {
|
||||||
return loginErrorCount;
|
return loginErrorCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoginErrorCount(int loginErrorCount) {
|
public void setLoginErrorCount(int loginErrorCount) {
|
||||||
this.loginErrorCount = loginErrorCount;
|
this.loginErrorCount = loginErrorCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLocked() {
|
public int getLocked() {
|
||||||
return locked;
|
return locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocked(int locked) {
|
public void setLocked(int locked) {
|
||||||
this.locked = locked;
|
this.locked = locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getLockedDate() {
|
public Date getLockedDate() {
|
||||||
return lockedDate;
|
return lockedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLockedDate(Date lockedDate) {
|
public void setLockedDate(Date lockedDate) {
|
||||||
this.lockedDate = lockedDate;
|
this.lockedDate = lockedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getLoginDate() {
|
public Date getLoginDate() {
|
||||||
return loginDate;
|
return loginDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoginDate(Date loginDate) {
|
public void setLoginDate(Date loginDate) {
|
||||||
this.loginDate = loginDate;
|
this.loginDate = loginDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLoginIp() {
|
public String getLoginIp() {
|
||||||
return loginIp;
|
return loginIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoginIp(String loginIp) {
|
public void setLoginIp(String loginIp) {
|
||||||
this.loginIp = loginIp;
|
this.loginIp = loginIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeleted() {
|
public boolean isDeleted() {
|
||||||
return isDeleted;
|
return isDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeleted(boolean deleted) {
|
public void setDeleted(boolean deleted) {
|
||||||
isDeleted = deleted;
|
isDeleted = deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCreatedBy() {
|
public Integer getCreatedBy() {
|
||||||
return createdBy;
|
return createdBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedBy(Integer createdBy) {
|
public void setCreatedBy(Integer createdBy) {
|
||||||
this.createdBy = createdBy;
|
this.createdBy = createdBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreatedTime() {
|
public Date getCreatedTime() {
|
||||||
return createdTime;
|
return createdTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedTime(Date createdTime) {
|
public void setCreatedTime(Date createdTime) {
|
||||||
this.createdTime = createdTime;
|
this.createdTime = createdTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getLastUpdatedBy() {
|
public Integer getLastUpdatedBy() {
|
||||||
return lastUpdatedBy;
|
return lastUpdatedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastUpdatedBy(Integer lastUpdatedBy) {
|
public void setLastUpdatedBy(Integer lastUpdatedBy) {
|
||||||
this.lastUpdatedBy = lastUpdatedBy;
|
this.lastUpdatedBy = lastUpdatedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getLastUpdatedTime() {
|
public Date getLastUpdatedTime() {
|
||||||
return lastUpdatedTime;
|
return lastUpdatedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastUpdatedTime(Date lastUpdatedTime) {
|
public void setLastUpdatedTime(Date lastUpdatedTime) {
|
||||||
this.lastUpdatedTime = lastUpdatedTime;
|
this.lastUpdatedTime = lastUpdatedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getUpdatedPasswordTime() {
|
public Date getUpdatedPasswordTime() {
|
||||||
return updatedPasswordTime;
|
return updatedPasswordTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdatedPasswordTime(Date updatedPasswordTime) {
|
public void setUpdatedPasswordTime(Date updatedPasswordTime) {
|
||||||
this.updatedPasswordTime = updatedPasswordTime;
|
this.updatedPasswordTime = updatedPasswordTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRoleName() {
|
public String getRoleName() {
|
||||||
return roleName;
|
return roleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleName(String roleName) {
|
public void setRoleName(String roleName) {
|
||||||
this.roleName = roleName;
|
this.roleName = roleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRoleId() {
|
public int getRoleId() {
|
||||||
return roleId;
|
return roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleId(int roleId) {
|
public void setRoleId(int roleId) {
|
||||||
this.roleId = roleId;
|
this.roleId = roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRoleLevel() {
|
public int getRoleLevel() {
|
||||||
return roleLevel;
|
return roleLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleLevel(int roleLevel) {
|
public void setRoleLevel(int roleLevel) {
|
||||||
this.roleLevel = roleLevel;
|
this.roleLevel = roleLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRoleType() {
|
public int getRoleType() {
|
||||||
return roleType;
|
return roleType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleType(int roleType) {
|
public void setRoleType(int roleType) {
|
||||||
this.roleType = roleType;
|
this.roleType = roleType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRoleTypeName() {
|
public String getRoleTypeName() {
|
||||||
return roleTypeName;
|
return roleTypeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleTypeName(String roleTypeName) {
|
public void setRoleTypeName(String roleTypeName) {
|
||||||
this.roleTypeName = roleTypeName;
|
this.roleTypeName = roleTypeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Integer getTempId() {
|
public Integer getTempId() {
|
||||||
return tempId;
|
return tempId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTempId(Integer tempId) {
|
public void setTempId(Integer tempId) {
|
||||||
this.tempId = tempId;
|
this.tempId = tempId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeptFirstName() {
|
public String getDeptFirstName() {
|
||||||
return deptFirstName;
|
return deptFirstName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptFirstName(String deptFirstName) {
|
public void setDeptFirstName(String deptFirstName) {
|
||||||
this.deptFirstName = deptFirstName;
|
this.deptFirstName = deptFirstName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeptSecondName() {
|
public String getDeptSecondName() {
|
||||||
return deptSecondName;
|
return deptSecondName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptSecondName(String deptSecondName) {
|
public void setDeptSecondName(String deptSecondName) {
|
||||||
this.deptSecondName = deptSecondName;
|
this.deptSecondName = deptSecondName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeptThirdName() {
|
public String getDeptThirdName() {
|
||||||
return deptThirdName;
|
return deptThirdName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptThirdName(String deptThirdName) {
|
public void setDeptThirdName(String deptThirdName) {
|
||||||
this.deptThirdName = deptThirdName;
|
this.deptThirdName = deptThirdName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,55 +1,55 @@
|
||||||
package cn.palmte.work.model;
|
package cn.palmte.work.model;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public interface AdminRepository extends JpaRepository<Admin, Integer> {
|
public interface AdminRepository extends JpaRepository<Admin, Integer> {
|
||||||
@Query("from Admin where isDeleted=0 AND userName=?1")
|
@Query("from Admin where isDeleted=0 AND userName=?1")
|
||||||
Admin getAdminByUsername(String username);
|
Admin getAdminByUsername(String username);
|
||||||
|
|
||||||
@Query("from Admin where isDeleted=0 AND enabled=1 AND userName=?1")
|
@Query("from Admin where isDeleted=0 AND enabled=1 AND userName=?1")
|
||||||
List<Admin> getAdminByUsernameList(String username);
|
List<Admin> getAdminByUsernameList(String username);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Query("from Admin where isDeleted=0 AND userName=?1")
|
@Query("from Admin where isDeleted=0 AND userName=?1")
|
||||||
List<Admin> getAdminByUsernameListNoEnabled(String username);
|
List<Admin> getAdminByUsernameListNoEnabled(String username);
|
||||||
|
|
||||||
@Query("from Admin where isDeleted=0 AND realName=?1")
|
@Query("from Admin where isDeleted=0 AND realName=?1")
|
||||||
Admin getAdminByRealName(String realName);
|
Admin getAdminByRealName(String realName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询
|
* 通过id查询
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Query("from Admin where isDeleted=0 AND id=?1")
|
@Query("from Admin where isDeleted=0 AND id=?1")
|
||||||
Admin getAdminById(int id);
|
Admin getAdminById(int id);
|
||||||
|
|
||||||
@Query("from Admin where isDeleted=0 AND telephone=?1")
|
@Query("from Admin where isDeleted=0 AND telephone=?1")
|
||||||
Admin findByTelephone(String phone);
|
Admin findByTelephone(String phone);
|
||||||
|
|
||||||
@Query("from Admin where isDeleted=0 AND empCode=?1")
|
@Query("from Admin where isDeleted=0 AND empCode=?1")
|
||||||
Admin findByEmpCode(String empCode);
|
Admin findByEmpCode(String empCode);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有未删除启用的账号
|
* 查询所有未删除启用的账号
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query("from Admin where isDeleted=0 AND enabled=1")
|
@Query("from Admin where isDeleted=0 AND enabled=1")
|
||||||
List<Admin> getAllEnable();
|
List<Admin> getAllEnable();
|
||||||
|
|
||||||
@Query("from Admin where isDeleted=0 AND enabled=1 AND id>1")
|
@Query("from Admin where isDeleted=0 AND enabled=1 AND id>1")
|
||||||
List<Admin> getAllEnableWoAdmin();
|
List<Admin> getAllEnableWoAdmin();
|
||||||
|
|
||||||
@Query("from Admin where isDeleted=0 AND enabled=1 AND roleId=?1")
|
@Query("from Admin where isDeleted=0 AND enabled=1 AND roleId=?1")
|
||||||
List<Admin> findByRoleId(int roleId);
|
List<Admin> findByRoleId(int roleId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,44 @@
|
||||||
package cn.palmte.work.model;
|
package cn.palmte.work.model;
|
||||||
|
|
||||||
import cn.palmte.work.model.SysRole;
|
import cn.palmte.work.model.SysRole;
|
||||||
import top.jfunc.common.db.bean.Page;
|
import top.jfunc.common.db.bean.Page;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public interface AdminRepositoryCustom {
|
public interface AdminRepositoryCustom {
|
||||||
|
|
||||||
List<String> getAuthoritiesName(String adminId);
|
List<String> getAuthoritiesName(String adminId);
|
||||||
|
|
||||||
List<String> getAuthoritieUrls(String adminId);
|
List<String> getAuthoritieUrls(String adminId);
|
||||||
|
|
||||||
List<String> getRolesName(String adminId);
|
List<String> getRolesName(String adminId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询用户信息
|
* 根据用户ID查询用户信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Admin findAdminByUserName(String userName);
|
Admin findAdminByUserName(String userName);
|
||||||
|
|
||||||
|
|
||||||
SysRole getRole(String adminId);
|
SysRole getRole(String adminId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有账号
|
* 查询所有账号
|
||||||
* @param searchInfo
|
* @param searchInfo
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
* @param pageNum
|
* @param pageNum
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Page getAdminList(Map<String, String> searchInfo, int pageSize, int pageNum);
|
Page getAdminList(Map<String, String> searchInfo, int pageSize, int pageNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询用户信息
|
* 根据用户ID查询用户信息
|
||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Admin findAdminById(int userId);
|
Admin findAdminById(int userId);
|
||||||
|
|
||||||
List<SysPermission> getAuthoritieUrlsByParentPermission(String adminId, String permission);
|
List<SysPermission> getAuthoritieUrlsByParentPermission(String adminId, String permission);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue