Compare commits
No commits in common. "main" and "dev_2.0.0" have entirely different histories.
|
@ -1,26 +1,28 @@
|
|||
# ---> Java
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
.gradle
|
||||
/build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
/.idea/workspace.xml
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
/out/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
/logs/
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
group 'cn.palmte'
|
||||
//version '1.0'
|
||||
|
||||
buildscript {
|
||||
ext {
|
||||
springBootVersion = '1.5.7.RELEASE'
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'war'
|
||||
apply plugin: 'application'
|
||||
apply plugin: 'org.springframework.boot'
|
||||
apply plugin: 'findbugs'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven { url "http://maven.aliyun.com/nexus/content/groups/public/"}
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.hibernate:hibernate-java8:5.1.0.Final'
|
||||
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.10'
|
||||
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.10'
|
||||
compile "org.springframework.boot:spring-boot-starter:${springBootVersion}"
|
||||
compile 'org.springframework.boot:spring-boot-starter-web'
|
||||
compile 'org.springframework.boot:spring-boot-starter-freemarker'
|
||||
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
|
||||
//compile('org.springframework.boot:spring-boot-starter-data-redis')
|
||||
|
||||
compile 'com.gitee.xxssyyyyssxx.unihttp:unihttp-jdk:v2.0.2'
|
||||
compile 'com.gitee.xxssyyyyssxx:common-crypto:v1.8.1'
|
||||
compile 'com.gitee.xxssyyyyssxx:common-db:v1.8.7'
|
||||
compile 'com.gitee.xxssyyyyssxx.json:json-fastjson:v1.8.8'
|
||||
compile 'com.gitee.xxssyyyyssxx:token:v1.0'
|
||||
|
||||
compile 'com.jfinal:jfinal:2.2'
|
||||
compile 'com.alibaba:druid:1.1.9'
|
||||
compile 'mysql:mysql-connector-java:8.0.33'
|
||||
//compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
|
||||
//shiro
|
||||
compile group: 'org.apache.shiro', name: 'shiro-spring', version: '1.4.0'
|
||||
compile group: 'org.apache.shiro', name: 'shiro-core', version: '1.4.0'
|
||||
compile group: 'net.mingsoft', name: 'shiro-freemarker-tags', version: '0.1'
|
||||
|
||||
compile group: 'org.apache.poi', name: 'poi', version: '3.17'
|
||||
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.17'
|
||||
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.17'
|
||||
compile group: 'org.apache.poi', name: 'poi-scratchpad', version: '3.17'
|
||||
|
||||
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
|
||||
|
||||
|
||||
compile group: 'org.projectlombok', name: 'lombok', version: '1.16.20'
|
||||
|
||||
/*activiti start*/
|
||||
compile group: 'org.activiti', name: 'activiti-spring-boot-starter-basic', version: '6.0.0'
|
||||
|
||||
/*activiti在线编辑器相关*/
|
||||
compile group: 'org.activiti', name: 'activiti-json-converter', version: '6.0.0'
|
||||
compile group: 'org.apache.xmlgraphics', name: 'batik-codec', version: '1.7'
|
||||
/*activiti end*/
|
||||
|
||||
// https://mvnrepository.com/artifact/cn.afterturn/easypoi-base
|
||||
compile group: 'cn.afterturn', name: 'easypoi-base', version: '4.2.0'
|
||||
// https://mvnrepository.com/artifact/cn.afterturn/easypoi-annotation
|
||||
compile group: 'cn.afterturn', name: 'easypoi-annotation', version: '4.2.0'
|
||||
|
||||
compileOnly 'org.springframework.boot:spring-boot-configuration-processor'
|
||||
|
||||
testCompile 'junit:junit:4.12'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
compileJava.dependsOn(processResources){
|
||||
|
||||
}
|
||||
|
||||
findbugs{
|
||||
ignoreFailures=true
|
||||
findbugsTest.enabled=false
|
||||
}
|
||||
|
||||
tasks.withType(FindBugs) {
|
||||
reports {
|
||||
// 指定分析结果格式为xml 只能选一种格式
|
||||
xml.enabled = true
|
||||
html.enabled = false
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-bin.zip
|
|
@ -0,0 +1,172 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
|
@ -0,0 +1,84 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
|
@ -0,0 +1,2 @@
|
|||
rootProject.name = 'fourcal'
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package cn.palmte.work;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/30 15:26
|
||||
*/
|
||||
public class ErrorMessage implements Result {
|
||||
|
||||
private String message;
|
||||
|
||||
public ErrorMessage() { }
|
||||
|
||||
public ErrorMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public static ErrorMessage failed(String message) {
|
||||
return new ErrorMessage(message);
|
||||
}
|
||||
|
||||
public static ErrorMessage failed() {
|
||||
return new ErrorMessage("未知错误");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package cn.palmte.work;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/30 15:25
|
||||
*/
|
||||
public class ErrorMessageException extends NoStackTraceRuntimeException {
|
||||
|
||||
private final HttpStatus status;
|
||||
|
||||
public ErrorMessageException(/*@Nullable*/ String msg) {
|
||||
this(msg, null, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
public ErrorMessageException(/*@Nullable*/ String msg, /*@Nullable*/ Throwable cause, HttpStatus status) {
|
||||
super(msg, cause);
|
||||
Assert.notNull(status, "http status is required");
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public HttpStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public static ErrorMessageException failed(String message) {
|
||||
return new ErrorMessageException(message);
|
||||
}
|
||||
|
||||
public static ErrorMessageException failed(String message, HttpStatus status) {
|
||||
return new ErrorMessageException(message, null, status);
|
||||
}
|
||||
|
||||
public static void notNull(Object obj, String message) {
|
||||
if (obj == null) {
|
||||
throw ErrorMessageException.failed(message, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
public static void notNull(Object obj, Supplier<String> supplier) {
|
||||
if (obj == null) {
|
||||
throw new ErrorMessageException(supplier.get());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package cn.palmte.work;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 四算项目
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class FourCalApplication extends SpringBootServletInitializer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FourCalApplication.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||
/**
|
||||
* war包运行的话,为了不修改配置文件,在运行的tomcat的catalina.sh中添加jvm参数-Dspring.profiles.active=test,
|
||||
* 因为我们现在已经有一个env了,所以可以根据这个设置profile
|
||||
* 命令行java -jar运行的话直接通过-Dspring.profiles.active=test来指定
|
||||
*/
|
||||
setRegisterErrorPageFilter(false);
|
||||
String env = System.getProperty("env");
|
||||
if (null != env) {
|
||||
Map<String, Object> map = new HashMap<>(1);
|
||||
map.put("spring.profiles.active", env);
|
||||
builder.properties(map);
|
||||
//不能使用 builder.profiles(env);否则可能出现两个环境的都配置了
|
||||
}
|
||||
return builder.sources(FourCalApplication.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package cn.palmte.work;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/30 15:38
|
||||
*/
|
||||
|
||||
public class Json implements Result {
|
||||
|
||||
private Object data;
|
||||
private String message;
|
||||
private boolean success;
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public Json data(Object data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Json message(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Json success(boolean success) {
|
||||
this.success = success;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the common {@link Json} result
|
||||
*
|
||||
* @param func the {@link Function}
|
||||
* @param param parameter
|
||||
*/
|
||||
public static <T> Json apply(Function<T, Boolean> func, T param) {
|
||||
if (func.apply(param)) {
|
||||
return Json.ok();
|
||||
}
|
||||
return Json.failed();
|
||||
}
|
||||
|
||||
public static <T> Json apply(boolean success) {
|
||||
if (success) {
|
||||
return Json.ok();
|
||||
}
|
||||
return Json.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param success if success
|
||||
* @param message the message of the response
|
||||
* @param data response data
|
||||
*/
|
||||
public static Json create(boolean success, String message, Object data) {
|
||||
return new Json()
|
||||
.data(data)
|
||||
.message(message)
|
||||
.success(success);
|
||||
}
|
||||
|
||||
public static Json ok() {
|
||||
return create(true, "ok", null);
|
||||
}
|
||||
|
||||
public static Json ok(String message, Object data) {
|
||||
return create(true, message, data);
|
||||
}
|
||||
|
||||
public static Json ok(Object data) {
|
||||
return create(true, "ok", data);
|
||||
}
|
||||
|
||||
public static Json ok(String message) {
|
||||
return create(true, message, null);
|
||||
}
|
||||
|
||||
public static Json failed() {
|
||||
return create(false, "失败", null);
|
||||
}
|
||||
|
||||
public static Json failed(String message) {
|
||||
return create(false, message, null);
|
||||
}
|
||||
|
||||
public static Json failed(String message, Object data) {
|
||||
return create(false, message, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder()//
|
||||
.append("{\"message\":\"").append(message)//
|
||||
.append("\",\"data\":\"").append(data)//
|
||||
.append("\",\"success\":\"").append(success)//
|
||||
.append("\"}")//
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package cn.palmte.work;
|
||||
|
||||
import org.springframework.core.NestedExceptionUtils;
|
||||
import org.springframework.core.NestedRuntimeException;
|
||||
|
||||
/**
|
||||
* 没有堆栈的异常, 降低性能消耗
|
||||
*
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/30 15:25
|
||||
*/
|
||||
public class NoStackTraceRuntimeException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public NoStackTraceRuntimeException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NoStackTraceRuntimeException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public NoStackTraceRuntimeException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public NoStackTraceRuntimeException(/*@Nullable*/ String msg, /*@Nullable */Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final synchronized Throwable fillInStackTrace() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the innermost cause of this exception, if any.
|
||||
*
|
||||
* @return the innermost exception, or {@code null} if none
|
||||
*/
|
||||
// @Nullable
|
||||
public Throwable getRootCause() {
|
||||
return NestedExceptionUtils.getRootCause(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the most specific cause of this exception, that is,
|
||||
* either the innermost cause (root cause) or this exception itself.
|
||||
* <p>Differs from {@link #getRootCause()} in that it falls back
|
||||
* to the present exception if there is no root cause.
|
||||
*
|
||||
* @return the most specific cause (never {@code null})
|
||||
*/
|
||||
public Throwable getMostSpecificCause() {
|
||||
Throwable rootCause = getRootCause();
|
||||
return (rootCause != null ? rootCause : this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this exception contains an exception of the given type:
|
||||
* either it is of the given class itself or it contains a nested cause
|
||||
* of the given type.
|
||||
*
|
||||
* @param exType the exception type to look for
|
||||
* @return whether there is a nested exception of the specified type
|
||||
*/
|
||||
public boolean contains(Class<?> exType) {
|
||||
if (exType == null) {
|
||||
return false;
|
||||
}
|
||||
if (exType.isInstance(this)) {
|
||||
return true;
|
||||
}
|
||||
Throwable cause = getCause();
|
||||
if (cause == this) {
|
||||
return false;
|
||||
}
|
||||
if (cause instanceof NestedRuntimeException) {
|
||||
return ((NestedRuntimeException) cause).contains(exType);
|
||||
}
|
||||
else {
|
||||
while (cause != null) {
|
||||
if (exType.isInstance(cause)) {
|
||||
return true;
|
||||
}
|
||||
if (cause.getCause() == cause) {
|
||||
break;
|
||||
}
|
||||
cause = cause.getCause();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package cn.palmte.work;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/30 15:37
|
||||
*/
|
||||
public interface Result {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package cn.palmte.work;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/30 15:39
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class ValidationError implements Result {
|
||||
|
||||
private Object validation;
|
||||
|
||||
public static ValidationError failed(Object validation) {
|
||||
return new ValidationError(validation);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Object getData() {
|
||||
return validation;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public enum ApproveStatusEnum {
|
||||
APPROVAL_UNCOMMIT(0,"草稿"),
|
||||
APPROVAL_PENDING(1,"待审核"),
|
||||
APPROVAL_PASSED(2,"审核通过"),
|
||||
APPROVAL_UNPASS(3,"审核不通过");
|
||||
|
||||
private int approveStatus;
|
||||
private String approveStatusDesc;
|
||||
|
||||
ApproveStatusEnum(int approveStatus, String approveStatusDesc) {
|
||||
this.approveStatus = approveStatus;
|
||||
this.approveStatusDesc = approveStatusDesc;
|
||||
}
|
||||
|
||||
public int getApproveStatus() {
|
||||
return approveStatus;
|
||||
}
|
||||
|
||||
public void setApproveStatus(int approveStatus) {
|
||||
this.approveStatus = approveStatus;
|
||||
}
|
||||
|
||||
public String getApproveStatusDesc() {
|
||||
return approveStatusDesc;
|
||||
}
|
||||
|
||||
public void setApproveStatusDesc(String approveStatusDesc) {
|
||||
this.approveStatusDesc = approveStatusDesc;
|
||||
}
|
||||
|
||||
public static ApproveStatusEnum parseApproveStatus(int approveStatus){
|
||||
if(approveStatus == 0){
|
||||
return APPROVAL_UNCOMMIT;
|
||||
}
|
||||
if(approveStatus == 1){
|
||||
return APPROVAL_PENDING;
|
||||
}
|
||||
if(approveStatus == 2){
|
||||
return APPROVAL_PASSED;
|
||||
}
|
||||
if(approveStatus == 3){
|
||||
return APPROVAL_UNPASS;
|
||||
}
|
||||
throw new IllegalArgumentException("Unkown approveStatus:"+approveStatus);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 预算页面
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public class BudgetBean extends IncomeCostBean{
|
||||
/**
|
||||
* 总的采购成本不含税
|
||||
*/
|
||||
private BigDecimal costPurchaseTotalTaxExclude;
|
||||
/**
|
||||
* 总的采购成本含税
|
||||
*/
|
||||
private BigDecimal costPurchaseTotalTaxInclude;
|
||||
/**
|
||||
* 设备收入税金
|
||||
*/
|
||||
private BigDecimal incomeDeviceTax;
|
||||
/**
|
||||
* 设施收入税金
|
||||
*/
|
||||
private BigDecimal incomeEngineerTax;
|
||||
/**
|
||||
* 服务收入税金
|
||||
*/
|
||||
private BigDecimal incomeServiceTax;
|
||||
/**
|
||||
* 采购设备成本税金
|
||||
*/
|
||||
private BigDecimal costPurchaseDeviceTax;
|
||||
/**
|
||||
* 采购施工成本税金
|
||||
*/
|
||||
private BigDecimal costPurchaseBuildTax;
|
||||
/**
|
||||
* 采购服务成本税金
|
||||
*/
|
||||
private BigDecimal costPurchaseServiceTax;
|
||||
/**
|
||||
* 采购其他成本含税
|
||||
*/
|
||||
private BigDecimal costPurchaseOtherTax;
|
||||
/**
|
||||
* 采购其他成本含税
|
||||
*/
|
||||
private BigDecimal costOtherOtherTax;
|
||||
/**
|
||||
* 公司管理费用
|
||||
*/
|
||||
private BigDecimal costCompanyManageTaxExclude;
|
||||
/**
|
||||
* null就返回0
|
||||
*/
|
||||
@Override
|
||||
protected BigDecimal handleSpecial(BigDecimal src) {
|
||||
return null == src ? new BigDecimal(0) : src;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseTotalTaxExclude() {
|
||||
return handleSpecial(costPurchaseTotalTaxExclude);
|
||||
}
|
||||
|
||||
public void setCostPurchaseTotalTaxExclude(BigDecimal costPurchaseTotalTaxExclude) {
|
||||
this.costPurchaseTotalTaxExclude = costPurchaseTotalTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseTotalTaxInclude() {
|
||||
return handleSpecial(costPurchaseTotalTaxInclude);
|
||||
}
|
||||
|
||||
public void setCostPurchaseTotalTaxInclude(BigDecimal costPurchaseTotalTaxInclude) {
|
||||
this.costPurchaseTotalTaxInclude = costPurchaseTotalTaxInclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseTotalTax() {
|
||||
return getCostPurchaseTotalTaxInclude().subtract(getCostPurchaseTotalTaxExclude());
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeDeviceTax() {
|
||||
return handleSpecial(incomeDeviceTax);
|
||||
}
|
||||
|
||||
public void setIncomeDeviceTax(BigDecimal incomeDeviceTax) {
|
||||
this.incomeDeviceTax = incomeDeviceTax;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeEngineerTax() {
|
||||
return handleSpecial(incomeEngineerTax);
|
||||
}
|
||||
|
||||
public void setIncomeEngineerTax(BigDecimal incomeEngineerTax) {
|
||||
this.incomeEngineerTax = incomeEngineerTax;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeServiceTax() {
|
||||
return handleSpecial(incomeServiceTax);
|
||||
}
|
||||
|
||||
public void setIncomeServiceTax(BigDecimal incomeServiceTax) {
|
||||
this.incomeServiceTax = incomeServiceTax;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseDeviceTax() {
|
||||
return handleSpecial(costPurchaseDeviceTax);
|
||||
}
|
||||
|
||||
public void setCostPurchaseDeviceTax(BigDecimal costPurchaseDeviceTax) {
|
||||
this.costPurchaseDeviceTax = costPurchaseDeviceTax;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseBuildTax() {
|
||||
return handleSpecial(costPurchaseBuildTax);
|
||||
}
|
||||
|
||||
public void setCostPurchaseBuildTax(BigDecimal costPurchaseBuildTax) {
|
||||
this.costPurchaseBuildTax = costPurchaseBuildTax;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseServiceTax() {
|
||||
return handleSpecial(costPurchaseServiceTax);
|
||||
}
|
||||
|
||||
public void setCostPurchaseServiceTax(BigDecimal costPurchaseServiceTax) {
|
||||
this.costPurchaseServiceTax = costPurchaseServiceTax;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseOtherTax() {
|
||||
return handleSpecial(costPurchaseOtherTax);
|
||||
}
|
||||
|
||||
public void setCostPurchaseOtherTax(BigDecimal costPurchaseOtherTax) {
|
||||
this.costPurchaseOtherTax = costPurchaseOtherTax;
|
||||
}
|
||||
|
||||
public BigDecimal getCostOtherOtherTax() {
|
||||
return handleSpecial(costOtherOtherTax);
|
||||
}
|
||||
|
||||
public void setCostOtherOtherTax(BigDecimal costOtherOtherTax) {
|
||||
this.costOtherOtherTax = costOtherOtherTax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getCostCompanyManageTaxExclude() {
|
||||
return getIncomeTotalTaxExclude().multiply(BigDecimal.valueOf(0.028));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCostCompanyManageTaxExclude(BigDecimal costCompanyManageTaxExclude) {
|
||||
this.costCompanyManageTaxExclude = costCompanyManageTaxExclude;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,425 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class BudgetSettleBean {
|
||||
|
||||
//========================收入表================================
|
||||
|
||||
/**
|
||||
* 设备类决算总额
|
||||
*/
|
||||
private BigDecimal incomeDeviceBudgetTotal;
|
||||
|
||||
/**
|
||||
* 工程类决算总额
|
||||
*/
|
||||
private BigDecimal incomeEngineerBudgetTotal;
|
||||
|
||||
/**
|
||||
* 服务类决算总额
|
||||
*/
|
||||
private BigDecimal incomeServiceBudgetTotal;
|
||||
|
||||
//========================成本表================================
|
||||
|
||||
/**
|
||||
* 设备采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseDeviceBudgetTotal;
|
||||
|
||||
/**
|
||||
* 施工采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseBuildBudgetTotal;
|
||||
|
||||
/**
|
||||
* 服务采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseServiceBudgetTotal;
|
||||
|
||||
/**
|
||||
* 其他采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseOtherBudgetTotal;
|
||||
|
||||
/**
|
||||
* 项目管理成本决算总额
|
||||
*/
|
||||
private BigDecimal costProjectManageBudgetTotal;
|
||||
|
||||
/**
|
||||
* 其他成本决算总额
|
||||
*/
|
||||
private BigDecimal costOtherBudgetTotal;
|
||||
|
||||
|
||||
//========================管理表================================
|
||||
|
||||
/**
|
||||
* 财务费用决算总额
|
||||
*/
|
||||
private BigDecimal costExpropriationBudgetTotal;
|
||||
|
||||
/**
|
||||
* 公司管理费用决算总额
|
||||
*/
|
||||
private BigDecimal costCompanyManageBudgetTotal;
|
||||
|
||||
/**
|
||||
* 所得税费用决算总额
|
||||
*/
|
||||
private BigDecimal costIncomeTaxBudgetTotal;
|
||||
|
||||
|
||||
//========================利润率计算表================================
|
||||
|
||||
/**
|
||||
* 项目毛利决算总额
|
||||
*/
|
||||
private BigDecimal grossProfitBudgetTotal;
|
||||
|
||||
/**
|
||||
* 项目毛利利润率
|
||||
*/
|
||||
private BigDecimal grossProfitProfitMargin;
|
||||
|
||||
/**
|
||||
* 项目贡献利润决算总额
|
||||
*/
|
||||
private BigDecimal contributionProfitBudgetTotal;
|
||||
|
||||
/**
|
||||
* 项目贡献利润利润率
|
||||
*/
|
||||
private BigDecimal contributionProfitProfitMargin;
|
||||
|
||||
/**
|
||||
* 项目净利润决算总额
|
||||
*/
|
||||
private BigDecimal netProfitBudgetTotal;
|
||||
|
||||
/**
|
||||
* 项目净利润利润率
|
||||
*/
|
||||
private BigDecimal netProfitProfitMargin;
|
||||
|
||||
//========================结算现金流量表================================
|
||||
|
||||
/**
|
||||
* a销售商品、提供劳务收到的现金
|
||||
*/
|
||||
private BigDecimal saleIncomeCashBudget;
|
||||
/**
|
||||
* b收到的税费返还
|
||||
*/
|
||||
private BigDecimal taxReturnBudget;
|
||||
/**
|
||||
* c其他与经营活动有关的现金【保证金收入】
|
||||
*/
|
||||
private BigDecimal earnestMoneyIncomeBudget;
|
||||
/**
|
||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||
*/
|
||||
private BigDecimal purchaseCostBudget;
|
||||
/**
|
||||
* e支付的各项税费
|
||||
*/
|
||||
private BigDecimal taxCostBudget;
|
||||
/**
|
||||
* f支付其他与经营活动有关的现金
|
||||
*/
|
||||
private BigDecimal earnestMoneyCostBudget;
|
||||
/**
|
||||
* g经营活动产生的现金流量净额
|
||||
* g=a+c+b-d-f-e
|
||||
*/
|
||||
private BigDecimal netCashFlowBudget;
|
||||
/**
|
||||
* h投资活动现金流入
|
||||
*/
|
||||
private BigDecimal cashInflowFromInvestingActivitiesBudget;
|
||||
/**
|
||||
* i投资活动现金流出
|
||||
*/
|
||||
private BigDecimal cashOutflowFromInvestingActivitiesBudget;
|
||||
/**
|
||||
* j投资活动产生的现金流量净额
|
||||
*/
|
||||
private BigDecimal netCashFromInvestingActivitiesBudget;
|
||||
/**
|
||||
* k融资资金流入【垫资计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalInflowBudget;
|
||||
/**
|
||||
* l融资资金流出【还款计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalOutflowBudget;
|
||||
/**
|
||||
* m筹资活动产生的现金流量净额
|
||||
* m=k-l
|
||||
*/
|
||||
private BigDecimal financingCapitalCashflowBudget;
|
||||
/**
|
||||
* n货币资金净增加额
|
||||
* n=g+j+m
|
||||
*/
|
||||
private BigDecimal netIncreaseMonetaryFundsBudget;
|
||||
|
||||
|
||||
public BigDecimal getIncomeDeviceBudgetTotal() {
|
||||
return incomeDeviceBudgetTotal;
|
||||
}
|
||||
|
||||
public void setIncomeDeviceBudgetTotal(BigDecimal incomeDeviceBudgetTotal) {
|
||||
this.incomeDeviceBudgetTotal = incomeDeviceBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeEngineerBudgetTotal() {
|
||||
return incomeEngineerBudgetTotal;
|
||||
}
|
||||
|
||||
public void setIncomeEngineerBudgetTotal(BigDecimal incomeEngineerBudgetTotal) {
|
||||
this.incomeEngineerBudgetTotal = incomeEngineerBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeServiceBudgetTotal() {
|
||||
return incomeServiceBudgetTotal;
|
||||
}
|
||||
|
||||
public void setIncomeServiceBudgetTotal(BigDecimal incomeServiceBudgetTotal) {
|
||||
this.incomeServiceBudgetTotal = incomeServiceBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseDeviceBudgetTotal() {
|
||||
return costPurchaseDeviceBudgetTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseDeviceBudgetTotal(BigDecimal costPurchaseDeviceBudgetTotal) {
|
||||
this.costPurchaseDeviceBudgetTotal = costPurchaseDeviceBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseBuildBudgetTotal() {
|
||||
return costPurchaseBuildBudgetTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseBuildBudgetTotal(BigDecimal costPurchaseBuildBudgetTotal) {
|
||||
this.costPurchaseBuildBudgetTotal = costPurchaseBuildBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseServiceBudgetTotal() {
|
||||
return costPurchaseServiceBudgetTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseServiceBudgetTotal(BigDecimal costPurchaseServiceBudgetTotal) {
|
||||
this.costPurchaseServiceBudgetTotal = costPurchaseServiceBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseOtherBudgetTotal() {
|
||||
return costPurchaseOtherBudgetTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseOtherBudgetTotal(BigDecimal costPurchaseOtherBudgetTotal) {
|
||||
this.costPurchaseOtherBudgetTotal = costPurchaseOtherBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostProjectManageBudgetTotal() {
|
||||
return costProjectManageBudgetTotal;
|
||||
}
|
||||
|
||||
public void setCostProjectManageBudgetTotal(BigDecimal costProjectManageBudgetTotal) {
|
||||
this.costProjectManageBudgetTotal = costProjectManageBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostOtherBudgetTotal() {
|
||||
return (costOtherBudgetTotal == null)?BigDecimal.ZERO:costOtherBudgetTotal;
|
||||
}
|
||||
|
||||
public void setCostOtherBudgetTotal(BigDecimal costOtherBudgetTotal) {
|
||||
this.costOtherBudgetTotal = costOtherBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostExpropriationBudgetTotal() {
|
||||
return costExpropriationBudgetTotal;
|
||||
}
|
||||
|
||||
public void setCostExpropriationBudgetTotal(BigDecimal costExpropriationBudgetTotal) {
|
||||
this.costExpropriationBudgetTotal = costExpropriationBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostCompanyManageBudgetTotal() {
|
||||
return costCompanyManageBudgetTotal;
|
||||
}
|
||||
|
||||
public void setCostCompanyManageBudgetTotal(BigDecimal costCompanyManageBudgetTotal) {
|
||||
this.costCompanyManageBudgetTotal = costCompanyManageBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostIncomeTaxBudgetTotal() {
|
||||
return costIncomeTaxBudgetTotal;
|
||||
}
|
||||
|
||||
public void setCostIncomeTaxBudgetTotal(BigDecimal costIncomeTaxBudgetTotal) {
|
||||
this.costIncomeTaxBudgetTotal = costIncomeTaxBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfitBudgetTotal() {
|
||||
return grossProfitBudgetTotal;
|
||||
}
|
||||
|
||||
public void setGrossProfitBudgetTotal(BigDecimal grossProfitBudgetTotal) {
|
||||
this.grossProfitBudgetTotal = grossProfitBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfitProfitMargin() {
|
||||
return grossProfitProfitMargin;
|
||||
}
|
||||
|
||||
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
||||
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getContributionProfitBudgetTotal() {
|
||||
return contributionProfitBudgetTotal;
|
||||
}
|
||||
|
||||
public void setContributionProfitBudgetTotal(BigDecimal contributionProfitBudgetTotal) {
|
||||
this.contributionProfitBudgetTotal = contributionProfitBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getContributionProfitProfitMargin() {
|
||||
return contributionProfitProfitMargin;
|
||||
}
|
||||
|
||||
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
||||
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getNetProfitBudgetTotal() {
|
||||
return netProfitBudgetTotal;
|
||||
}
|
||||
|
||||
public void setNetProfitBudgetTotal(BigDecimal netProfitBudgetTotal) {
|
||||
this.netProfitBudgetTotal = netProfitBudgetTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getNetProfitProfitMargin() {
|
||||
return netProfitProfitMargin;
|
||||
}
|
||||
|
||||
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
||||
this.netProfitProfitMargin = netProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getSaleIncomeCashBudget() {
|
||||
return saleIncomeCashBudget;
|
||||
}
|
||||
|
||||
public void setSaleIncomeCashBudget(BigDecimal saleIncomeCashBudget) {
|
||||
this.saleIncomeCashBudget = saleIncomeCashBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxReturnBudget() {
|
||||
return taxReturnBudget;
|
||||
}
|
||||
|
||||
public void setTaxReturnBudget(BigDecimal taxReturnBudget) {
|
||||
this.taxReturnBudget = taxReturnBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyIncomeBudget() {
|
||||
return earnestMoneyIncomeBudget;
|
||||
}
|
||||
|
||||
public void setEarnestMoneyIncomeBudget(BigDecimal earnestMoneyIncomeBudget) {
|
||||
this.earnestMoneyIncomeBudget = earnestMoneyIncomeBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getPurchaseCostBudget() {
|
||||
return purchaseCostBudget;
|
||||
}
|
||||
|
||||
public void setPurchaseCostBudget(BigDecimal purchaseCostBudget) {
|
||||
this.purchaseCostBudget = purchaseCostBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxCostBudget() {
|
||||
return taxCostBudget;
|
||||
}
|
||||
|
||||
public void setTaxCostBudget(BigDecimal taxCostBudget) {
|
||||
this.taxCostBudget = taxCostBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyCostBudget() {
|
||||
return earnestMoneyCostBudget;
|
||||
}
|
||||
|
||||
public void setEarnestMoneyCostBudget(BigDecimal earnestMoneyCostBudget) {
|
||||
this.earnestMoneyCostBudget = earnestMoneyCostBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFlowBudget() {
|
||||
return netCashFlowBudget;
|
||||
}
|
||||
|
||||
public void setNetCashFlowBudget(BigDecimal netCashFlowBudget) {
|
||||
this.netCashFlowBudget = netCashFlowBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getCashInflowFromInvestingActivitiesBudget() {
|
||||
return cashInflowFromInvestingActivitiesBudget;
|
||||
}
|
||||
|
||||
public void setCashInflowFromInvestingActivitiesBudget(BigDecimal cashInflowFromInvestingActivitiesBudget) {
|
||||
this.cashInflowFromInvestingActivitiesBudget = cashInflowFromInvestingActivitiesBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getCashOutflowFromInvestingActivitiesBudget() {
|
||||
return cashOutflowFromInvestingActivitiesBudget;
|
||||
}
|
||||
|
||||
public void setCashOutflowFromInvestingActivitiesBudget(BigDecimal cashOutflowFromInvestingActivitiesBudget) {
|
||||
this.cashOutflowFromInvestingActivitiesBudget = cashOutflowFromInvestingActivitiesBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFromInvestingActivitiesBudget() {
|
||||
return netCashFromInvestingActivitiesBudget;
|
||||
}
|
||||
|
||||
public void setNetCashFromInvestingActivitiesBudget(BigDecimal netCashFromInvestingActivitiesBudget) {
|
||||
this.netCashFromInvestingActivitiesBudget = netCashFromInvestingActivitiesBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalInflowBudget() {
|
||||
return financingCapitalInflowBudget;
|
||||
}
|
||||
|
||||
public void setFinancingCapitalInflowBudget(BigDecimal financingCapitalInflowBudget) {
|
||||
this.financingCapitalInflowBudget = financingCapitalInflowBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalOutflowBudget() {
|
||||
return financingCapitalOutflowBudget;
|
||||
}
|
||||
|
||||
public void setFinancingCapitalOutflowBudget(BigDecimal financingCapitalOutflowBudget) {
|
||||
this.financingCapitalOutflowBudget = financingCapitalOutflowBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalCashflowBudget() {
|
||||
return financingCapitalCashflowBudget;
|
||||
}
|
||||
|
||||
public void setFinancingCapitalCashflowBudget(BigDecimal financingCapitalCashflowBudget) {
|
||||
this.financingCapitalCashflowBudget = financingCapitalCashflowBudget;
|
||||
}
|
||||
|
||||
public BigDecimal getNetIncreaseMonetaryFundsBudget() {
|
||||
return netIncreaseMonetaryFundsBudget;
|
||||
}
|
||||
|
||||
public void setNetIncreaseMonetaryFundsBudget(BigDecimal netIncreaseMonetaryFundsBudget) {
|
||||
this.netIncreaseMonetaryFundsBudget = netIncreaseMonetaryFundsBudget;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,229 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 现金流量
|
||||
* @author xiongshiyan at 2021/11/6 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public class CashFlowBean {
|
||||
/**
|
||||
* a销售商品、提供劳务收到的现金
|
||||
* */
|
||||
private BigDecimal saleIncomeCash;
|
||||
/**
|
||||
* b收到的税费返还
|
||||
* */
|
||||
private BigDecimal taxReturn;
|
||||
/**
|
||||
* c其他与经营活动有关的现金【保证金收入】
|
||||
*/
|
||||
private BigDecimal earnestMoneyIncome;
|
||||
/**
|
||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||
*/
|
||||
private BigDecimal purchaseCost;
|
||||
/**
|
||||
* e支付的各项税费
|
||||
*/
|
||||
private BigDecimal taxCost;
|
||||
/**
|
||||
*f支付其他与经营活动有关的现金
|
||||
*/
|
||||
private BigDecimal earnestMoneyCost;
|
||||
/**
|
||||
* g经营活动产生的现金流量净额
|
||||
* g=a+c+b-d-f-e
|
||||
*/
|
||||
//private BigDecimal netCashFlow;
|
||||
/**
|
||||
* h投资活动现金流入
|
||||
*/
|
||||
private BigDecimal cashInflowFromInvestingActivities;
|
||||
/**
|
||||
* i投资活动现金流出
|
||||
*/
|
||||
private BigDecimal cashOutflowFromInvestingActivities;
|
||||
/**
|
||||
* j投资活动产生的现金流量净额
|
||||
*/
|
||||
private BigDecimal netCashFromInvestingActivities;
|
||||
/**
|
||||
* k融资资金流入【垫资计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalInflow;
|
||||
/**
|
||||
* l融资资金流出【还款计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalOutflow;
|
||||
/**
|
||||
*m筹资活动产生的现金流量净额
|
||||
* m=k-l
|
||||
*/
|
||||
//private BigDecimal financingCapitalCashflow;
|
||||
/**
|
||||
* n货币资金净增加额
|
||||
* n=g+j+m
|
||||
*/
|
||||
//private BigDecimal netIncreaseMonetaryFunds;
|
||||
|
||||
public BigDecimal getSaleIncomeCash() {
|
||||
return handleSpecial(saleIncomeCash);
|
||||
}
|
||||
|
||||
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
|
||||
this.saleIncomeCash = saleIncomeCash;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxReturn() {
|
||||
return handleSpecial(taxReturn);
|
||||
}
|
||||
|
||||
public void setTaxReturn(BigDecimal taxReturn) {
|
||||
this.taxReturn = taxReturn;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyIncome() {
|
||||
return handleSpecial(earnestMoneyIncome);
|
||||
}
|
||||
|
||||
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
|
||||
this.earnestMoneyIncome = earnestMoneyIncome;
|
||||
}
|
||||
|
||||
public BigDecimal getPurchaseCost() {
|
||||
return handleSpecial(purchaseCost);
|
||||
}
|
||||
|
||||
public void setPurchaseCost(BigDecimal purchaseCost) {
|
||||
this.purchaseCost = purchaseCost;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxCost() {
|
||||
return handleSpecial(taxCost);
|
||||
}
|
||||
|
||||
public void setTaxCost(BigDecimal taxCost) {
|
||||
this.taxCost = taxCost;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyCost() {
|
||||
return handleSpecial(earnestMoneyCost);
|
||||
}
|
||||
|
||||
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
|
||||
this.earnestMoneyCost = earnestMoneyCost;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFlow() {
|
||||
|
||||
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
||||
BigDecimal taxReturn = getTaxReturn();
|
||||
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
||||
BigDecimal purchaseCost = getPurchaseCost();
|
||||
BigDecimal taxCost = getTaxCost();
|
||||
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
||||
|
||||
return saleIncomeCash
|
||||
.add(taxReturn)
|
||||
.add(earnestMoneyIncome)
|
||||
.subtract(purchaseCost)
|
||||
.subtract(taxCost)
|
||||
.subtract(earnestMoneyCost);
|
||||
}
|
||||
|
||||
public BigDecimal getCashInflowFromInvestingActivities() {
|
||||
return handleSpecial(cashInflowFromInvestingActivities);
|
||||
}
|
||||
|
||||
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
|
||||
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getCashOutflowFromInvestingActivities() {
|
||||
return handleSpecial(cashOutflowFromInvestingActivities);
|
||||
}
|
||||
|
||||
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
|
||||
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFromInvestingActivities() {
|
||||
return handleSpecial(netCashFromInvestingActivities);
|
||||
}
|
||||
|
||||
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
|
||||
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalInflow() {
|
||||
return handleSpecial(financingCapitalInflow);
|
||||
}
|
||||
|
||||
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
|
||||
this.financingCapitalInflow = financingCapitalInflow;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalOutflow() {
|
||||
return handleSpecial(financingCapitalOutflow);
|
||||
}
|
||||
|
||||
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
|
||||
this.financingCapitalOutflow = financingCapitalOutflow;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalCashflow() {
|
||||
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
||||
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
||||
return financingCapitalInflow.subtract(financingCapitalOutflow);
|
||||
}
|
||||
|
||||
public BigDecimal getNetIncreaseMonetaryFunds() {
|
||||
BigDecimal netCashFlow = getNetCashFlow();
|
||||
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
||||
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
||||
return netCashFlow
|
||||
.add(netCashFromInvestingActivities)
|
||||
.add(financingCapitalCashflow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有现金流量决算总额
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCashFluxTotal() {
|
||||
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
||||
BigDecimal taxReturn = getTaxReturn();
|
||||
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
||||
BigDecimal purchaseCost = getPurchaseCost();
|
||||
BigDecimal taxCost = getTaxCost();
|
||||
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
||||
BigDecimal netCashFlow = getNetCashFlow();
|
||||
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
|
||||
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
|
||||
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
||||
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
||||
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
||||
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
||||
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
|
||||
|
||||
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|
||||
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
|
||||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
|
||||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
|
||||
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
|
||||
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理特殊值
|
||||
* null就返回0
|
||||
*/
|
||||
protected BigDecimal handleSpecial(BigDecimal src) {
|
||||
return null == src ? new BigDecimal(0) : src;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class CashFlowStatisticsBean {
|
||||
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* a销售商品、提供劳务收到的现金
|
||||
* */
|
||||
private BigDecimal saleIncomeCash;
|
||||
/**
|
||||
* b收到的税费返还
|
||||
* */
|
||||
private BigDecimal taxReturn;
|
||||
/**
|
||||
* c其他与经营活动有关的现金【保证金收入】
|
||||
*/
|
||||
private BigDecimal earnestMoneyIncome;
|
||||
/**
|
||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||
*/
|
||||
private BigDecimal purchaseCost;
|
||||
/**
|
||||
* e支付的各项税费
|
||||
*/
|
||||
private BigDecimal taxCost;
|
||||
/**
|
||||
*f支付其他与经营活动有关的现金
|
||||
*/
|
||||
private BigDecimal earnestMoneyCost;
|
||||
/**
|
||||
* g经营活动产生的现金流量净额
|
||||
* g=a+c+b-d-f-e
|
||||
*/
|
||||
private BigDecimal netCashFlow;
|
||||
/**
|
||||
* h投资活动现金流入
|
||||
*/
|
||||
private BigDecimal cashInflowFromInvestingActivities;
|
||||
/**
|
||||
* i投资活动现金流出
|
||||
*/
|
||||
private BigDecimal cashOutflowFromInvestingActivities;
|
||||
/**
|
||||
* j投资活动产生的现金流量净额
|
||||
*/
|
||||
private BigDecimal netCashFromInvestingActivities;
|
||||
/**
|
||||
* k融资资金流入【垫资计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalInflow;
|
||||
/**
|
||||
* l融资资金流出【还款计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalOutflow;
|
||||
/**
|
||||
*m筹资活动产生的现金流量净额
|
||||
* m=k-l
|
||||
*/
|
||||
private BigDecimal financingCapitalCashflow;
|
||||
/**
|
||||
* n货币资金净增加额
|
||||
* n=g+j+m
|
||||
*/
|
||||
private BigDecimal netIncreaseMonetaryFunds;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public enum CertaintyEnum {
|
||||
PLAN_O(-1,""),
|
||||
PLAN_A(1,"A:项目成功率80%-100%"),
|
||||
PLAN_B(2,"B:项目成功率60%-80%"),
|
||||
PLAN_C(3,"C:项目成功率40%-60%");
|
||||
|
||||
private int certainty;
|
||||
private String certaintyStr;
|
||||
|
||||
private CertaintyEnum(int certainty, String certaintyStr) {
|
||||
this.certainty = certainty;
|
||||
this.certaintyStr = certaintyStr;
|
||||
}
|
||||
|
||||
public int getCertainty() {
|
||||
return certainty;
|
||||
}
|
||||
|
||||
public void setCertainty(int certainty) {
|
||||
this.certainty = certainty;
|
||||
}
|
||||
|
||||
public String getCertaintyStr() {
|
||||
return certaintyStr;
|
||||
}
|
||||
|
||||
public void setCertaintyStr(String certaintyStr) {
|
||||
this.certaintyStr = certaintyStr;
|
||||
}
|
||||
|
||||
public static CertaintyEnum parseCertainty(int certainty){
|
||||
if(certainty == 1){
|
||||
return PLAN_A;
|
||||
}
|
||||
if(certainty == 2){
|
||||
return PLAN_B;
|
||||
}
|
||||
if(certainty == 3){
|
||||
return PLAN_C;
|
||||
}
|
||||
throw new IllegalArgumentException("Unkown certainty:"+certainty);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
/**
|
||||
* 数据源等信息常量化
|
||||
* @author xiongshiyan
|
||||
*/
|
||||
public class Constant {
|
||||
|
||||
public static final String DATA = "Data";
|
||||
|
||||
public static final int ROLE_TYPE_SUPER_ADMIN = 0; // 系统管理员
|
||||
public static final int ROLE_TYPE_CMCC_ADMIN = 1;// 移动管理员
|
||||
public static final int ROLE_TYPE_ZJPT_ADMIN = 2; //资金平台管理员
|
||||
|
||||
|
||||
private Constant(){}
|
||||
/**
|
||||
* 全局状态码
|
||||
*/
|
||||
public static final class Status {
|
||||
private Status() {
|
||||
}
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static final int STATUS_SUCCESS = 0;
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static final int STATUS_FAILED = 1;
|
||||
/**
|
||||
* 异常
|
||||
*/
|
||||
public static final int STATUS_EXCEPTION = 2;
|
||||
/**
|
||||
* 提示登录
|
||||
*/
|
||||
public static final int STATUS_PROMPT_LOGIN = 1009;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public enum CooperateTypeEnum {
|
||||
PLAN_O(-1,""),
|
||||
PLAN_A(1,"战略合作类"),
|
||||
PLAN_B(2,"非战略合作类");
|
||||
|
||||
private int cooperateType;
|
||||
private String cooperateTypeStr;
|
||||
|
||||
private CooperateTypeEnum(int cooperateType, String cooperateTypeStr) {
|
||||
this.cooperateType = cooperateType;
|
||||
this.cooperateTypeStr = cooperateTypeStr;
|
||||
}
|
||||
|
||||
public int getCooperateType() {
|
||||
return cooperateType;
|
||||
}
|
||||
|
||||
public void setCooperateType(int cooperateType) {
|
||||
this.cooperateType = cooperateType;
|
||||
}
|
||||
|
||||
public String getCooperateTypeStr() {
|
||||
return cooperateTypeStr;
|
||||
}
|
||||
|
||||
public void setCooperateTypeStr(String cooperateTypeStr) {
|
||||
this.cooperateTypeStr = cooperateTypeStr;
|
||||
}
|
||||
|
||||
public static CooperateTypeEnum parseCooperateType(int cooperateType){
|
||||
if(cooperateType == 1){
|
||||
return PLAN_A;
|
||||
}
|
||||
if(cooperateType == 2){
|
||||
return PLAN_B;
|
||||
}
|
||||
throw new IllegalArgumentException("Unkown cooperateType:"+cooperateType);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 概算页面
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public class EstimateBean extends IncomeCostBean{
|
||||
/**
|
||||
* 原样返回
|
||||
*/
|
||||
@Override
|
||||
protected BigDecimal handleSpecial(BigDecimal src) {
|
||||
return null == src ? new BigDecimal(0) : src;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,250 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class EstimateSettleBean {
|
||||
|
||||
//========================收入表================================
|
||||
|
||||
/**
|
||||
* 设备类决算总额
|
||||
*/
|
||||
private BigDecimal incomeDeviceEstimateTotal;
|
||||
|
||||
/**
|
||||
* 工程类决算总额
|
||||
*/
|
||||
private BigDecimal incomeEngineerEstimateTotal;
|
||||
|
||||
/**
|
||||
* 服务类决算总额
|
||||
*/
|
||||
private BigDecimal incomeServiceEstimateTotal;
|
||||
|
||||
//========================成本表================================
|
||||
|
||||
/**
|
||||
* 设备采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseDeviceEstimateTotal;
|
||||
|
||||
/**
|
||||
* 施工采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseBuildEstimateTotal;
|
||||
|
||||
/**
|
||||
* 服务采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseServiceEstimateTotal;
|
||||
|
||||
/**
|
||||
* 其他采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseOtherEstimateTotal;
|
||||
|
||||
/**
|
||||
* 项目管理成本决算总额
|
||||
*/
|
||||
private BigDecimal costProjectManageEstimateTotal;
|
||||
|
||||
/**
|
||||
* 其他成本决算总额
|
||||
*/
|
||||
private BigDecimal costOtherEstimateTotal;
|
||||
|
||||
|
||||
//========================管理表================================
|
||||
|
||||
/**
|
||||
* 财务费用决算总额
|
||||
*/
|
||||
private BigDecimal costExpropriationEstimateTotal;
|
||||
|
||||
/**
|
||||
* 公司管理费用决算总额
|
||||
*/
|
||||
private BigDecimal costCompanyManageEstimateTotal;
|
||||
|
||||
/**
|
||||
* 所得税费用决算总额
|
||||
*/
|
||||
private BigDecimal costIncomeTaxEstimateTotal;
|
||||
|
||||
|
||||
//========================利润率计算表================================
|
||||
|
||||
/**
|
||||
* 项目毛利决算总额
|
||||
*/
|
||||
private BigDecimal grossProfitEstimateTotal;
|
||||
|
||||
/**
|
||||
* 项目毛利利润率
|
||||
*/
|
||||
private BigDecimal grossProfitProfitMargin;
|
||||
|
||||
/**
|
||||
* 项目贡献利润决算总额
|
||||
*/
|
||||
private BigDecimal contributionProfitEstimateTotal;
|
||||
|
||||
/**
|
||||
* 项目贡献利润利润率
|
||||
*/
|
||||
private BigDecimal contributionProfitProfitMargin;
|
||||
|
||||
/**
|
||||
* 项目净利润决算总额
|
||||
*/
|
||||
private BigDecimal netProfitEstimateTotal;
|
||||
|
||||
/**
|
||||
* 项目净利润利润率
|
||||
*/
|
||||
private BigDecimal netProfitProfitMargin;
|
||||
|
||||
public BigDecimal getIncomeDeviceEstimateTotal() {
|
||||
return incomeDeviceEstimateTotal;
|
||||
}
|
||||
|
||||
public void setIncomeDeviceEstimateTotal(BigDecimal incomeDeviceEstimateTotal) {
|
||||
this.incomeDeviceEstimateTotal = incomeDeviceEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeEngineerEstimateTotal() {
|
||||
return incomeEngineerEstimateTotal;
|
||||
}
|
||||
|
||||
public void setIncomeEngineerEstimateTotal(BigDecimal incomeEngineerEstimateTotal) {
|
||||
this.incomeEngineerEstimateTotal = incomeEngineerEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeServiceEstimateTotal() {
|
||||
return incomeServiceEstimateTotal;
|
||||
}
|
||||
|
||||
public void setIncomeServiceEstimateTotal(BigDecimal incomeServiceEstimateTotal) {
|
||||
this.incomeServiceEstimateTotal = incomeServiceEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseDeviceEstimateTotal() {
|
||||
return costPurchaseDeviceEstimateTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseDeviceEstimateTotal(BigDecimal costPurchaseDeviceEstimateTotal) {
|
||||
this.costPurchaseDeviceEstimateTotal = costPurchaseDeviceEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseBuildEstimateTotal() {
|
||||
return costPurchaseBuildEstimateTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseBuildEstimateTotal(BigDecimal costPurchaseBuildEstimateTotal) {
|
||||
this.costPurchaseBuildEstimateTotal = costPurchaseBuildEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseServiceEstimateTotal() {
|
||||
return costPurchaseServiceEstimateTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseServiceEstimateTotal(BigDecimal costPurchaseServiceEstimateTotal) {
|
||||
this.costPurchaseServiceEstimateTotal = costPurchaseServiceEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseOtherEstimateTotal() {
|
||||
return costPurchaseOtherEstimateTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseOtherEstimateTotal(BigDecimal costPurchaseOtherEstimateTotal) {
|
||||
this.costPurchaseOtherEstimateTotal = costPurchaseOtherEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostProjectManageEstimateTotal() {
|
||||
return costProjectManageEstimateTotal;
|
||||
}
|
||||
|
||||
public void setCostProjectManageEstimateTotal(BigDecimal costProjectManageEstimateTotal) {
|
||||
this.costProjectManageEstimateTotal = costProjectManageEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostOtherEstimateTotal() {
|
||||
return (costOtherEstimateTotal == null)?BigDecimal.ZERO:costOtherEstimateTotal;
|
||||
}
|
||||
|
||||
public void setCostOtherEstimateTotal(BigDecimal costOtherEstimateTotal) {
|
||||
this.costOtherEstimateTotal = costOtherEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostExpropriationEstimateTotal() {
|
||||
return costExpropriationEstimateTotal;
|
||||
}
|
||||
|
||||
public void setCostExpropriationEstimateTotal(BigDecimal costExpropriationEstimateTotal) {
|
||||
this.costExpropriationEstimateTotal = costExpropriationEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostCompanyManageEstimateTotal() {
|
||||
return costCompanyManageEstimateTotal;
|
||||
}
|
||||
|
||||
public void setCostCompanyManageEstimateTotal(BigDecimal costCompanyManageEstimateTotal) {
|
||||
this.costCompanyManageEstimateTotal = costCompanyManageEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostIncomeTaxEstimateTotal() {
|
||||
return costIncomeTaxEstimateTotal;
|
||||
}
|
||||
|
||||
public void setCostIncomeTaxEstimateTotal(BigDecimal costIncomeTaxEstimateTotal) {
|
||||
this.costIncomeTaxEstimateTotal = costIncomeTaxEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfitEstimateTotal() {
|
||||
return grossProfitEstimateTotal;
|
||||
}
|
||||
|
||||
public void setGrossProfitEstimateTotal(BigDecimal grossProfitEstimateTotal) {
|
||||
this.grossProfitEstimateTotal = grossProfitEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfitProfitMargin() {
|
||||
return grossProfitProfitMargin;
|
||||
}
|
||||
|
||||
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
||||
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getContributionProfitEstimateTotal() {
|
||||
return contributionProfitEstimateTotal;
|
||||
}
|
||||
|
||||
public void setContributionProfitEstimateTotal(BigDecimal contributionProfitEstimateTotal) {
|
||||
this.contributionProfitEstimateTotal = contributionProfitEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getContributionProfitProfitMargin() {
|
||||
return contributionProfitProfitMargin;
|
||||
}
|
||||
|
||||
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
||||
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getNetProfitEstimateTotal() {
|
||||
return netProfitEstimateTotal;
|
||||
}
|
||||
|
||||
public void setNetProfitEstimateTotal(BigDecimal netProfitEstimateTotal) {
|
||||
this.netProfitEstimateTotal = netProfitEstimateTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getNetProfitProfitMargin() {
|
||||
return netProfitProfitMargin;
|
||||
}
|
||||
|
||||
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
||||
this.netProfitProfitMargin = netProfitProfitMargin;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,595 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
public class FinalBean {
|
||||
|
||||
//========================收入表================================
|
||||
|
||||
/**
|
||||
* 设备类决算总额
|
||||
*/
|
||||
private BigDecimal incomeDeviceFinalTotal;
|
||||
|
||||
/**
|
||||
* 工程类决算总额
|
||||
*/
|
||||
private BigDecimal incomeEngineerFinalTotal;
|
||||
|
||||
/**
|
||||
* 服务类决算总额
|
||||
*/
|
||||
private BigDecimal incomeServiceFinalTotal;
|
||||
|
||||
/**
|
||||
* 获取所有收入决算总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getIncomeTotal() {
|
||||
BigDecimal incomeDeviceFinalTotal = getIncomeDeviceFinalTotal();
|
||||
BigDecimal incomeEngineerFinalTotal = getIncomeEngineerFinalTotal();
|
||||
BigDecimal incomeServiceFinalTotal = getIncomeServiceFinalTotal();
|
||||
if (null == incomeDeviceFinalTotal || null == incomeEngineerFinalTotal || null == incomeServiceFinalTotal) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return incomeDeviceFinalTotal.add(incomeEngineerFinalTotal).add(incomeServiceFinalTotal);
|
||||
}
|
||||
|
||||
//========================成本表================================
|
||||
|
||||
/**
|
||||
* 设备采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseDeviceFinalTotal;
|
||||
|
||||
/**
|
||||
* 施工采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseBuildFinalTotal;
|
||||
|
||||
/**
|
||||
* 服务采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseServiceFinalTotal;
|
||||
|
||||
/**
|
||||
* 其他采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseOtherFinalTotal;
|
||||
|
||||
/**
|
||||
* 项目管理成本决算总额
|
||||
*/
|
||||
private BigDecimal costProjectManageFinalTotal;
|
||||
|
||||
/**
|
||||
* 其他成本决算总额
|
||||
*/
|
||||
private BigDecimal costOtherFinalTotal;
|
||||
|
||||
/**
|
||||
* 获取所有成本决算总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCostTotal() {
|
||||
BigDecimal costPurchaseDeviceFinalTotal = getCostPurchaseDeviceFinalTotal();
|
||||
BigDecimal costPurchaseBuildFinalTotal = getCostPurchaseBuildFinalTotal();
|
||||
BigDecimal costPurchaseServiceFinalTotal = getCostPurchaseServiceFinalTotal();
|
||||
BigDecimal costPurchaseOtherFinalTotal = getCostPurchaseOtherFinalTotal();
|
||||
BigDecimal costProjectManageFinalTotal = getCostProjectManageFinalTotal();
|
||||
BigDecimal costOtherFinalTotal = getCostOtherFinalTotal();
|
||||
|
||||
if (null == costPurchaseDeviceFinalTotal || null == costPurchaseBuildFinalTotal || null == costPurchaseServiceFinalTotal
|
||||
|| null == costPurchaseOtherFinalTotal || null == costProjectManageFinalTotal) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costPurchaseDeviceFinalTotal.add(costPurchaseBuildFinalTotal).add(costPurchaseServiceFinalTotal)
|
||||
.add(costPurchaseOtherFinalTotal).add(costProjectManageFinalTotal).add(costOtherFinalTotal);
|
||||
}
|
||||
|
||||
|
||||
//========================管理表================================
|
||||
|
||||
/**
|
||||
* 财务费用决算总额
|
||||
*/
|
||||
private BigDecimal costExpropriationFinalTotal;
|
||||
|
||||
/**
|
||||
* 公司管理费用决算总额
|
||||
*/
|
||||
private BigDecimal costCompanyManageFinalTotal;
|
||||
|
||||
/**
|
||||
* 所得税费用决算总额
|
||||
*/
|
||||
private BigDecimal costIncomeTaxFinalTotal;
|
||||
|
||||
/**
|
||||
* 获取所有管理成本决算总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCostManageTotal() {
|
||||
BigDecimal costExpropriationFinalTotal = getCostExpropriationFinalTotal();
|
||||
BigDecimal costCompanyManageFinalTotal = getCostCompanyManageFinalTotal();
|
||||
BigDecimal costIncomeTaxFinalTotal = getCostIncomeTaxFinalTotal();
|
||||
|
||||
if (null == costExpropriationFinalTotal || null == costCompanyManageFinalTotal || null == costIncomeTaxFinalTotal) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costExpropriationFinalTotal.add(costCompanyManageFinalTotal).add(costIncomeTaxFinalTotal);
|
||||
}
|
||||
|
||||
|
||||
//========================利润率计算表================================
|
||||
|
||||
/**
|
||||
* 项目毛利决算总额
|
||||
*/
|
||||
private BigDecimal grossProfitFinalTotal;
|
||||
|
||||
public BigDecimal getGrossProfitFinalTotal() {
|
||||
BigDecimal incomeTotal = getIncomeTotal();
|
||||
BigDecimal costTotal = getCostTotal();
|
||||
BigDecimal costExpropriationFinalTotal = getCostExpropriationFinalTotal();
|
||||
|
||||
if (null == incomeTotal || null == costTotal || null == costExpropriationFinalTotal) {
|
||||
return null;
|
||||
}
|
||||
return incomeTotal.subtract(costTotal).subtract(costExpropriationFinalTotal);
|
||||
}
|
||||
|
||||
public void setGrossProfitFinalTotal(BigDecimal grossProfitFinalTotal) {
|
||||
this.grossProfitFinalTotal = grossProfitFinalTotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目毛利利润率
|
||||
*/
|
||||
private BigDecimal grossProfitProfitMargin;
|
||||
|
||||
public BigDecimal getGrossProfitProfitMargin() {
|
||||
BigDecimal grossProfitFinalTotal = getGrossProfitFinalTotal();
|
||||
BigDecimal incomeTotal = getIncomeTotal();
|
||||
|
||||
if(null == grossProfitFinalTotal || null == incomeTotal){
|
||||
return null;
|
||||
}
|
||||
if (incomeTotal.compareTo(BigDecimal.valueOf(0.01)) < 0 && incomeTotal.compareTo(BigDecimal.valueOf(-0.01)) > 0) {
|
||||
incomeTotal = BigDecimal.ONE;
|
||||
}
|
||||
return grossProfitFinalTotal.divide(incomeTotal,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||
}
|
||||
|
||||
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
||||
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目贡献利润决算总额
|
||||
*/
|
||||
private BigDecimal contributionMarginFinalTotal;
|
||||
|
||||
public BigDecimal getContributionMarginFinalTotal() {
|
||||
BigDecimal grossProfitFinalTotal = getGrossProfitFinalTotal();
|
||||
BigDecimal costCompanyManageFinalTotal = getCostCompanyManageFinalTotal();
|
||||
|
||||
if (null == grossProfitFinalTotal || null == costCompanyManageFinalTotal) {
|
||||
return null;
|
||||
}
|
||||
return grossProfitFinalTotal.subtract(costCompanyManageFinalTotal);
|
||||
}
|
||||
|
||||
public void setContributionMarginFinalTotal(BigDecimal contributionMarginFinalTotal) {
|
||||
this.contributionMarginFinalTotal = contributionMarginFinalTotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目贡献利润利润率
|
||||
*/
|
||||
private BigDecimal contributionMarginProfitMargin;
|
||||
|
||||
public BigDecimal getContributionMarginProfitMargin() {
|
||||
BigDecimal contributionMarginFinalTotal = getContributionMarginFinalTotal();
|
||||
BigDecimal incomeTotal = getIncomeTotal();
|
||||
|
||||
if(null == contributionMarginFinalTotal || null == incomeTotal){
|
||||
return null;
|
||||
}
|
||||
if (incomeTotal.compareTo(BigDecimal.valueOf(0.01)) < 0 && incomeTotal.compareTo(BigDecimal.valueOf(-0.01)) > 0) {
|
||||
incomeTotal = BigDecimal.ONE;
|
||||
}
|
||||
return contributionMarginFinalTotal.divide(incomeTotal,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||
}
|
||||
|
||||
public void setContributionMarginProfitMargin(BigDecimal contributionMarginProfitMargin) {
|
||||
this.contributionMarginProfitMargin = contributionMarginProfitMargin;
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目净利润决算总额
|
||||
*/
|
||||
private BigDecimal netMarginFinalTotal;
|
||||
|
||||
public BigDecimal getNetMarginFinalTotal() {
|
||||
BigDecimal contributionMarginFinalTotal = getContributionMarginFinalTotal();
|
||||
BigDecimal costIncomeTaxFinalTotal = getCostIncomeTaxFinalTotal();
|
||||
if (null == contributionMarginFinalTotal || null == costIncomeTaxFinalTotal) {
|
||||
return null;
|
||||
}
|
||||
return contributionMarginFinalTotal.subtract(costIncomeTaxFinalTotal);
|
||||
}
|
||||
|
||||
public void setNetMarginFinalTotal(BigDecimal netMarginFinalTotal) {
|
||||
this.netMarginFinalTotal = netMarginFinalTotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目净利润利润率
|
||||
*/
|
||||
private BigDecimal netMarginProfitMargin;
|
||||
|
||||
public BigDecimal getNetMarginProfitMargin() {
|
||||
BigDecimal netMarginFinalTotal = getNetMarginFinalTotal();
|
||||
BigDecimal incomeTotal = getIncomeTotal();
|
||||
|
||||
if(null == netMarginFinalTotal || null == incomeTotal){
|
||||
return null;
|
||||
}
|
||||
if (incomeTotal.compareTo(BigDecimal.valueOf(0.01)) < 0 && incomeTotal.compareTo(BigDecimal.valueOf(-0.01)) > 0) {
|
||||
incomeTotal = BigDecimal.ONE;
|
||||
}
|
||||
return netMarginFinalTotal.divide(incomeTotal,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||
}
|
||||
|
||||
public void setNetMarginProfitMargin(BigDecimal netMarginProfitMargin) {
|
||||
this.netMarginProfitMargin = netMarginProfitMargin;
|
||||
}
|
||||
|
||||
//========================结算现金流量表================================
|
||||
|
||||
/**
|
||||
* a销售商品、提供劳务收到的现金
|
||||
*/
|
||||
private BigDecimal saleIncomeCash;
|
||||
/**
|
||||
* b收到的税费返还
|
||||
*/
|
||||
private BigDecimal taxReturn;
|
||||
/**
|
||||
* c其他与经营活动有关的现金【保证金收入】
|
||||
*/
|
||||
private BigDecimal earnestMoneyIncome;
|
||||
/**
|
||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||
*/
|
||||
private BigDecimal purchaseCost;
|
||||
/**
|
||||
* e支付的各项税费
|
||||
*/
|
||||
private BigDecimal taxCost;
|
||||
/**
|
||||
* f支付其他与经营活动有关的现金
|
||||
*/
|
||||
private BigDecimal earnestMoneyCost;
|
||||
/**
|
||||
* g经营活动产生的现金流量净额
|
||||
* g=a+c+b-d-f-e
|
||||
*/
|
||||
private BigDecimal netCashFlow;
|
||||
|
||||
public BigDecimal getNetCashFlow() {
|
||||
|
||||
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
||||
BigDecimal taxReturn = getTaxReturn();
|
||||
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
||||
BigDecimal purchaseCost = getPurchaseCost();
|
||||
BigDecimal taxCost = getTaxCost();
|
||||
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
||||
|
||||
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome ||
|
||||
null == purchaseCost || null == taxCost || null == earnestMoneyCost) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return saleIncomeCash
|
||||
.add(taxReturn)
|
||||
.add(earnestMoneyIncome)
|
||||
.subtract(purchaseCost)
|
||||
.subtract(taxCost)
|
||||
.subtract(earnestMoneyCost);
|
||||
}
|
||||
|
||||
public void setNetCashFlow(BigDecimal netCashFlow) {
|
||||
this.netCashFlow = netCashFlow;
|
||||
}
|
||||
|
||||
/**
|
||||
* h投资活动现金流入
|
||||
*/
|
||||
private BigDecimal cashInflowFromInvestingActivities;
|
||||
/**
|
||||
* i投资活动现金流出
|
||||
*/
|
||||
private BigDecimal cashOutflowFromInvestingActivities;
|
||||
/**
|
||||
* j投资活动产生的现金流量净额
|
||||
*/
|
||||
private BigDecimal netCashFromInvestingActivities;
|
||||
/**
|
||||
* k融资资金流入【垫资计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalInflow;
|
||||
/**
|
||||
* l融资资金流出【还款计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalOutflow;
|
||||
/**
|
||||
* m筹资活动产生的现金流量净额
|
||||
* m=k-l
|
||||
*/
|
||||
private BigDecimal financingCapitalCashflow;
|
||||
|
||||
public BigDecimal getFinancingCapitalCashflow() {
|
||||
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
||||
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
||||
|
||||
if (null == financingCapitalInflow || null == financingCapitalOutflow) {
|
||||
return null;
|
||||
}
|
||||
return financingCapitalInflow.subtract(financingCapitalOutflow);
|
||||
}
|
||||
|
||||
public void setFinancingCapitalCashflow(BigDecimal financingCapitalCashflow) {
|
||||
this.financingCapitalCashflow = financingCapitalCashflow;
|
||||
}
|
||||
|
||||
/**
|
||||
* n货币资金净增加额
|
||||
* n=g+j+m
|
||||
*/
|
||||
private BigDecimal netIncreaseMonetaryFunds;
|
||||
|
||||
public BigDecimal getNetIncreaseMonetaryFunds() {
|
||||
BigDecimal netCashFlow = getNetCashFlow();
|
||||
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
||||
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
||||
|
||||
if (null == netCashFlow || null == netCashFromInvestingActivities || null == financingCapitalCashflow) {
|
||||
return null;
|
||||
}
|
||||
return netCashFlow
|
||||
.add(netCashFromInvestingActivities)
|
||||
.add(financingCapitalCashflow);
|
||||
}
|
||||
|
||||
public void setNetIncreaseMonetaryFunds(BigDecimal netIncreaseMonetaryFunds) {
|
||||
this.netIncreaseMonetaryFunds = netIncreaseMonetaryFunds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有现金流量决算总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCashFluxTotal() {
|
||||
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
||||
BigDecimal taxReturn = getTaxReturn();
|
||||
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
||||
BigDecimal purchaseCost = getPurchaseCost();
|
||||
BigDecimal taxCost = getTaxCost();
|
||||
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
||||
BigDecimal netCashFlow = getNetCashFlow();
|
||||
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
|
||||
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
|
||||
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
||||
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
||||
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
||||
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
||||
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
|
||||
|
||||
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|
||||
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
|
||||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
|
||||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
|
||||
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
|
||||
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
|
||||
}
|
||||
|
||||
|
||||
public BigDecimal getIncomeDeviceFinalTotal() {
|
||||
return incomeDeviceFinalTotal;
|
||||
}
|
||||
|
||||
public void setIncomeDeviceFinalTotal(BigDecimal incomeDeviceFinalTotal) {
|
||||
this.incomeDeviceFinalTotal = incomeDeviceFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeEngineerFinalTotal() {
|
||||
return incomeEngineerFinalTotal;
|
||||
}
|
||||
|
||||
public void setIncomeEngineerFinalTotal(BigDecimal incomeEngineerFinalTotal) {
|
||||
this.incomeEngineerFinalTotal = incomeEngineerFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeServiceFinalTotal() {
|
||||
return incomeServiceFinalTotal;
|
||||
}
|
||||
|
||||
public void setIncomeServiceFinalTotal(BigDecimal incomeServiceFinalTotal) {
|
||||
this.incomeServiceFinalTotal = incomeServiceFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseDeviceFinalTotal() {
|
||||
return costPurchaseDeviceFinalTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseDeviceFinalTotal(BigDecimal costPurchaseDeviceFinalTotal) {
|
||||
this.costPurchaseDeviceFinalTotal = costPurchaseDeviceFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseBuildFinalTotal() {
|
||||
return costPurchaseBuildFinalTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseBuildFinalTotal(BigDecimal costPurchaseBuildFinalTotal) {
|
||||
this.costPurchaseBuildFinalTotal = costPurchaseBuildFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseServiceFinalTotal() {
|
||||
return costPurchaseServiceFinalTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseServiceFinalTotal(BigDecimal costPurchaseServiceFinalTotal) {
|
||||
this.costPurchaseServiceFinalTotal = costPurchaseServiceFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseOtherFinalTotal() {
|
||||
return costPurchaseOtherFinalTotal;
|
||||
}
|
||||
|
||||
public void setCostPurchaseOtherFinalTotal(BigDecimal costPurchaseOtherFinalTotal) {
|
||||
this.costPurchaseOtherFinalTotal = costPurchaseOtherFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostProjectManageFinalTotal() {
|
||||
return costProjectManageFinalTotal;
|
||||
}
|
||||
|
||||
public void setCostProjectManageFinalTotal(BigDecimal costProjectManageFinalTotal) {
|
||||
this.costProjectManageFinalTotal = costProjectManageFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostOtherFinalTotal() {
|
||||
return (costOtherFinalTotal == null)?BigDecimal.ZERO:costOtherFinalTotal;
|
||||
}
|
||||
|
||||
public void setCostOtherFinalTotal(BigDecimal costOtherFinalTotal) {
|
||||
this.costOtherFinalTotal = costOtherFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostExpropriationFinalTotal() {
|
||||
return costExpropriationFinalTotal;
|
||||
}
|
||||
|
||||
public void setCostExpropriationFinalTotal(BigDecimal costExpropriationFinalTotal) {
|
||||
this.costExpropriationFinalTotal = costExpropriationFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostCompanyManageFinalTotal() {
|
||||
return costCompanyManageFinalTotal;
|
||||
}
|
||||
|
||||
public void setCostCompanyManageFinalTotal(BigDecimal costCompanyManageFinalTotal) {
|
||||
this.costCompanyManageFinalTotal = costCompanyManageFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getCostIncomeTaxFinalTotal() {
|
||||
return costIncomeTaxFinalTotal;
|
||||
}
|
||||
|
||||
public void setCostIncomeTaxFinalTotal(BigDecimal costIncomeTaxFinalTotal) {
|
||||
this.costIncomeTaxFinalTotal = costIncomeTaxFinalTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getSaleIncomeCash() {
|
||||
return saleIncomeCash;
|
||||
}
|
||||
|
||||
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
|
||||
this.saleIncomeCash = saleIncomeCash;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxReturn() {
|
||||
return taxReturn;
|
||||
}
|
||||
|
||||
public void setTaxReturn(BigDecimal taxReturn) {
|
||||
this.taxReturn = taxReturn;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyIncome() {
|
||||
return earnestMoneyIncome;
|
||||
}
|
||||
|
||||
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
|
||||
this.earnestMoneyIncome = earnestMoneyIncome;
|
||||
}
|
||||
|
||||
public BigDecimal getPurchaseCost() {
|
||||
return purchaseCost;
|
||||
}
|
||||
|
||||
public void setPurchaseCost(BigDecimal purchaseCost) {
|
||||
this.purchaseCost = purchaseCost;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxCost() {
|
||||
return taxCost;
|
||||
}
|
||||
|
||||
public void setTaxCost(BigDecimal taxCost) {
|
||||
this.taxCost = taxCost;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyCost() {
|
||||
return earnestMoneyCost;
|
||||
}
|
||||
|
||||
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
|
||||
this.earnestMoneyCost = earnestMoneyCost;
|
||||
}
|
||||
|
||||
public BigDecimal getCashInflowFromInvestingActivities() {
|
||||
return cashInflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
|
||||
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getCashOutflowFromInvestingActivities() {
|
||||
return cashOutflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
|
||||
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFromInvestingActivities() {
|
||||
return netCashFromInvestingActivities;
|
||||
}
|
||||
|
||||
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
|
||||
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalInflow() {
|
||||
return financingCapitalInflow;
|
||||
}
|
||||
|
||||
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
|
||||
this.financingCapitalInflow = financingCapitalInflow;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalOutflow() {
|
||||
return financingCapitalOutflow;
|
||||
}
|
||||
|
||||
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
|
||||
this.financingCapitalOutflow = financingCapitalOutflow;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,397 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* @author Yuanping Zhang
|
||||
* @date 2021/11/15
|
||||
*/
|
||||
public class FormerBean extends IncomeCostBean {
|
||||
|
||||
/**
|
||||
* 所得税
|
||||
*/
|
||||
private BigDecimal costIncomeTax;
|
||||
/**
|
||||
* 管理总计
|
||||
*/
|
||||
private BigDecimal costManageTotal;
|
||||
/**
|
||||
* 毛利润
|
||||
*/
|
||||
private BigDecimal grossProfit;
|
||||
/**
|
||||
* 毛利润
|
||||
*/
|
||||
private BigDecimal grossProfitMargin;
|
||||
/**
|
||||
* 贡献利润
|
||||
*/
|
||||
private BigDecimal contributionProfit;
|
||||
/**
|
||||
* 贡献利润
|
||||
*/
|
||||
private BigDecimal contributionProfitMargin;
|
||||
/**
|
||||
* 净利润
|
||||
*/
|
||||
private BigDecimal netProfit;
|
||||
/**
|
||||
* 净利润
|
||||
*/
|
||||
private BigDecimal netProfitMargin;
|
||||
/**
|
||||
* a销售商品、提供劳务收到的现金
|
||||
*/
|
||||
private BigDecimal saleIncomeCash;
|
||||
/**
|
||||
* b收到的税费返还
|
||||
*/
|
||||
private BigDecimal taxReturn;
|
||||
/**
|
||||
* c其他与经营活动有关的现金【保证金收入】
|
||||
*/
|
||||
private BigDecimal earnestMoneyIncome;
|
||||
/**
|
||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||
*/
|
||||
private BigDecimal purchaseCost;
|
||||
/**
|
||||
* e支付的各项税费
|
||||
*/
|
||||
private BigDecimal taxCost;
|
||||
/**
|
||||
* f支付其他与经营活动有关的现金
|
||||
*/
|
||||
private BigDecimal earnestMoneyCost;
|
||||
/**
|
||||
* g经营活动产生的现金流量净额
|
||||
*/
|
||||
private BigDecimal netCashFlow;
|
||||
/**
|
||||
* h投资活动现金流入
|
||||
*/
|
||||
private BigDecimal cashInflowFromInvestingActivities;
|
||||
/**
|
||||
* i投资活动现金流出
|
||||
*/
|
||||
private BigDecimal cashOutflowFromInvestingActivities;
|
||||
/**
|
||||
* j投资活动产生的现金流量净额
|
||||
*/
|
||||
private BigDecimal netCashFromInvestingActivities;
|
||||
/**
|
||||
* k融资资金流入【垫资计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalInflow;
|
||||
/**
|
||||
* l融资资金流出【还款计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalOutflow;
|
||||
/**
|
||||
* m筹资活动产生的现金流量净额
|
||||
*/
|
||||
private BigDecimal financingCapitalCashflow;
|
||||
/**
|
||||
* n货币资金净增加额
|
||||
*/
|
||||
private BigDecimal netIncreaseMonetaryFunds;
|
||||
/**
|
||||
* 现金流量总计
|
||||
*/
|
||||
private BigDecimal cashFlowTotal;
|
||||
|
||||
/**
|
||||
* 项目毛利利润率
|
||||
*/
|
||||
private BigDecimal grossProfitProfitMargin;
|
||||
|
||||
public BigDecimal getGrossProfitProfitMargin() {
|
||||
// 100 * grossProfit() / getIncomeTotalTaxExclude()
|
||||
BigDecimal grossProfit = getGrossProfit();
|
||||
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||
|
||||
if (null == grossProfit || null == incomeTotalTaxExclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return grossProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||
}
|
||||
|
||||
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
||||
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目贡献利润利润率
|
||||
*/
|
||||
private BigDecimal contributionProfitProfitMargin;
|
||||
|
||||
public BigDecimal getContributionProfitProfitMargin() {
|
||||
//100 * contributionProfit() / getIncomeTotalTaxExclude()
|
||||
BigDecimal contributionProfit = getContributionProfit();
|
||||
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||
|
||||
if (null == contributionProfit || null == incomeTotalTaxExclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return contributionProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||
}
|
||||
|
||||
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
||||
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目净利润利润率
|
||||
*/
|
||||
private BigDecimal netProfitProfitMargin;
|
||||
|
||||
public BigDecimal getNetProfitProfitMargin() {
|
||||
//100 * netProfit() / getIncomeTotalTaxExclude()
|
||||
BigDecimal netProfit = getNetProfit();
|
||||
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||
|
||||
if (null == netProfit || null == incomeTotalTaxExclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
if (incomeTotalTaxExclude.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return netProfit.divide(incomeTotalTaxExclude,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||
}
|
||||
|
||||
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
||||
this.netProfitProfitMargin = netProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getCostIncomeTax() {
|
||||
return costIncomeTax;
|
||||
}
|
||||
|
||||
public void setCostIncomeTax(BigDecimal costIncomeTax) {
|
||||
this.costIncomeTax = costIncomeTax;
|
||||
}
|
||||
|
||||
public BigDecimal getCostManageTotal() {
|
||||
BigDecimal costExpropriation = getCostExpropriationTaxExclude();
|
||||
BigDecimal costCompanyManage = getCostCompanyManageTaxExclude();
|
||||
BigDecimal costIncomeTax = getCostIncomeTax();
|
||||
|
||||
if (null == costExpropriation || null == costCompanyManage || null == costIncomeTax) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costExpropriation.add(costCompanyManage).add(costIncomeTax);
|
||||
}
|
||||
|
||||
public void setCostManageTotal(BigDecimal costManageTotal) {
|
||||
this.costManageTotal = costManageTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfit() {
|
||||
return grossProfit;
|
||||
}
|
||||
|
||||
public void setGrossProfit(BigDecimal grossProfit) {
|
||||
this.grossProfit = grossProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfitMargin() {
|
||||
return grossProfitMargin;
|
||||
}
|
||||
|
||||
public void setGrossProfitMargin(BigDecimal grossProfitMargin) {
|
||||
this.grossProfitMargin = grossProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getContributionProfit() {
|
||||
return contributionProfit;
|
||||
}
|
||||
|
||||
public void setContributionProfit(BigDecimal contributionProfit) {
|
||||
this.contributionProfit = contributionProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getContributionProfitMargin() {
|
||||
return contributionProfitMargin;
|
||||
}
|
||||
|
||||
public void setContributionProfitMargin(BigDecimal contributionProfitMargin) {
|
||||
this.contributionProfitMargin = contributionProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getNetProfit() {
|
||||
return netProfit;
|
||||
}
|
||||
|
||||
public void setNetProfit(BigDecimal netProfit) {
|
||||
this.netProfit = netProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getNetProfitMargin() {
|
||||
return netProfitMargin;
|
||||
}
|
||||
|
||||
public void setNetProfitMargin(BigDecimal netProfitMargin) {
|
||||
this.netProfitMargin = netProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getSaleIncomeCash() {
|
||||
return saleIncomeCash;
|
||||
}
|
||||
|
||||
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
|
||||
this.saleIncomeCash = saleIncomeCash;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxReturn() {
|
||||
return taxReturn;
|
||||
}
|
||||
|
||||
public void setTaxReturn(BigDecimal taxReturn) {
|
||||
this.taxReturn = taxReturn;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyIncome() {
|
||||
return earnestMoneyIncome;
|
||||
}
|
||||
|
||||
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
|
||||
this.earnestMoneyIncome = earnestMoneyIncome;
|
||||
}
|
||||
|
||||
public BigDecimal getPurchaseCost() {
|
||||
return purchaseCost;
|
||||
}
|
||||
|
||||
public void setPurchaseCost(BigDecimal purchaseCost) {
|
||||
this.purchaseCost = purchaseCost;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxCost() {
|
||||
return taxCost;
|
||||
}
|
||||
|
||||
public void setTaxCost(BigDecimal taxCost) {
|
||||
this.taxCost = taxCost;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyCost() {
|
||||
return earnestMoneyCost;
|
||||
}
|
||||
|
||||
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
|
||||
this.earnestMoneyCost = earnestMoneyCost;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFlow() {
|
||||
return netCashFlow;
|
||||
}
|
||||
|
||||
public void setNetCashFlow(BigDecimal netCashFlow) {
|
||||
this.netCashFlow = netCashFlow;
|
||||
}
|
||||
|
||||
public BigDecimal getCashInflowFromInvestingActivities() {
|
||||
return cashInflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
|
||||
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getCashOutflowFromInvestingActivities() {
|
||||
return cashOutflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
|
||||
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFromInvestingActivities() {
|
||||
return netCashFromInvestingActivities;
|
||||
}
|
||||
|
||||
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
|
||||
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalInflow() {
|
||||
return financingCapitalInflow;
|
||||
}
|
||||
|
||||
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
|
||||
this.financingCapitalInflow = financingCapitalInflow;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalOutflow() {
|
||||
return financingCapitalOutflow;
|
||||
}
|
||||
|
||||
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
|
||||
this.financingCapitalOutflow = financingCapitalOutflow;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalCashflow() {
|
||||
return financingCapitalCashflow;
|
||||
}
|
||||
|
||||
public void setFinancingCapitalCashflow(BigDecimal financingCapitalCashflow) {
|
||||
this.financingCapitalCashflow = financingCapitalCashflow;
|
||||
}
|
||||
|
||||
public BigDecimal getNetIncreaseMonetaryFunds() {
|
||||
return netIncreaseMonetaryFunds;
|
||||
}
|
||||
|
||||
public void setNetIncreaseMonetaryFunds(BigDecimal netIncreaseMonetaryFunds) {
|
||||
this.netIncreaseMonetaryFunds = netIncreaseMonetaryFunds;
|
||||
}
|
||||
|
||||
public BigDecimal getCashFlowTotal() {
|
||||
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
||||
BigDecimal taxReturn = getTaxReturn();
|
||||
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
||||
BigDecimal purchaseCost = getPurchaseCost();
|
||||
BigDecimal taxCost = getTaxCost();
|
||||
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
||||
BigDecimal netCashFlow = getNetCashFlow();
|
||||
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
|
||||
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
|
||||
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
||||
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
||||
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
||||
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
||||
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
|
||||
|
||||
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|
||||
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
|
||||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
|
||||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
|
||||
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
|
||||
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
|
||||
}
|
||||
|
||||
public void setCashFlowTotal(BigDecimal cashFlowTotal) {
|
||||
this.cashFlowTotal = cashFlowTotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 原样返回
|
||||
*/
|
||||
@Override
|
||||
protected BigDecimal handleSpecial(BigDecimal src) {
|
||||
return src;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,606 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 预算概算页面的公共属性
|
||||
*
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public abstract class IncomeCostBean {
|
||||
/**
|
||||
* 设备类收入含税
|
||||
*/
|
||||
private BigDecimal incomeDeviceTaxInclude;
|
||||
/**
|
||||
* 工程类收入含税
|
||||
*/
|
||||
private BigDecimal incomeEngineerTaxInclude;
|
||||
/**
|
||||
* 服务类收入含税
|
||||
*/
|
||||
private BigDecimal incomeServiceTaxInclude;
|
||||
|
||||
/**
|
||||
* 设备类收入不含税
|
||||
*/
|
||||
private BigDecimal incomeDeviceTaxExclude;
|
||||
/**
|
||||
* 工程类收入不含税
|
||||
*/
|
||||
private BigDecimal incomeEngineerTaxExclude;
|
||||
/**
|
||||
* 服务类收入不含税
|
||||
*/
|
||||
private BigDecimal incomeServiceTaxExclude;
|
||||
/**
|
||||
* 设备采购成本含税
|
||||
*/
|
||||
private BigDecimal costPurchaseDeviceTaxInclude;
|
||||
/**
|
||||
* 施工采购成本含税
|
||||
*/
|
||||
private BigDecimal costPurchaseBuildTaxInclude;
|
||||
/**
|
||||
* 服务采购成本含税
|
||||
*/
|
||||
private BigDecimal costPurchaseServiceTaxInclude;
|
||||
/* private BigDecimal costProjectManageTaxInclude; */
|
||||
/**
|
||||
* 其他采购成本含税
|
||||
*/
|
||||
private BigDecimal costPurchaseOtherTaxInclude;
|
||||
/**
|
||||
* 其他成本含税
|
||||
*/
|
||||
private BigDecimal costOtherOtherTaxInclude;
|
||||
/**
|
||||
* 设备采购成本不含税
|
||||
*/
|
||||
private BigDecimal costPurchaseDeviceTaxExclude;
|
||||
/**
|
||||
* 施工采购成本不含税
|
||||
*/
|
||||
private BigDecimal costPurchaseBuildTaxExclude;
|
||||
/**
|
||||
* 服务采购成本不含税
|
||||
*/
|
||||
private BigDecimal costPurchaseServiceTaxExclude;
|
||||
/**
|
||||
* 其他采购成本不含税
|
||||
*/
|
||||
private BigDecimal costPurchaseOtherTaxExclude;
|
||||
/**
|
||||
* 工程管理成本不含税
|
||||
*/
|
||||
private BigDecimal costProjectManageTaxExclude;
|
||||
/**
|
||||
* 其他成本不含税
|
||||
*/
|
||||
private BigDecimal costOtherOtherTaxExclude;
|
||||
|
||||
/**
|
||||
* 资金占用成本不含税
|
||||
*/
|
||||
private BigDecimal costExpropriationTaxExclude;
|
||||
/**
|
||||
* 公司管理成本不含税
|
||||
*/
|
||||
private BigDecimal costCompanyManageTaxExclude;
|
||||
|
||||
/**
|
||||
* 设备类收入税率
|
||||
*/
|
||||
private String incomeDeviceSelect;
|
||||
|
||||
/**
|
||||
* 工程类收入税率
|
||||
*/
|
||||
private String incomeEngineerSelect;
|
||||
|
||||
/**
|
||||
* 服务类收入税率
|
||||
*/
|
||||
private String incomeServiceSelect;
|
||||
|
||||
/**
|
||||
* 设备类采购成本税率
|
||||
*/
|
||||
private String costPurchaseDeviceSelect;
|
||||
|
||||
/**
|
||||
* 施工类采购成本税率
|
||||
*/
|
||||
private String costPurchaseBuildSelect;
|
||||
|
||||
/**
|
||||
* 服务类采购成本税率
|
||||
*/
|
||||
private String costPurchaseServiceSelect;
|
||||
|
||||
/**
|
||||
* 其他类采购成本税率
|
||||
*/
|
||||
private String costPurchaseOtherSelect;
|
||||
|
||||
/**
|
||||
* 其他成本税率
|
||||
*/
|
||||
private String costOtherOtherSelect;
|
||||
|
||||
public String getIncomeDeviceSelect() {
|
||||
return incomeDeviceSelect;
|
||||
}
|
||||
|
||||
public void setIncomeDeviceSelect(String incomeDeviceSelect) {
|
||||
this.incomeDeviceSelect = incomeDeviceSelect;
|
||||
}
|
||||
|
||||
public String getIncomeEngineerSelect() {
|
||||
return incomeEngineerSelect;
|
||||
}
|
||||
|
||||
public void setIncomeEngineerSelect(String incomeEngineerSelect) {
|
||||
this.incomeEngineerSelect = incomeEngineerSelect;
|
||||
}
|
||||
|
||||
public String getIncomeServiceSelect() {
|
||||
return incomeServiceSelect;
|
||||
}
|
||||
|
||||
public void setIncomeServiceSelect(String incomeServiceSelect) {
|
||||
this.incomeServiceSelect = incomeServiceSelect;
|
||||
}
|
||||
|
||||
public String getCostPurchaseDeviceSelect() {
|
||||
return costPurchaseDeviceSelect;
|
||||
}
|
||||
|
||||
public void setCostPurchaseDeviceSelect(String costPurchaseDeviceSelect) {
|
||||
this.costPurchaseDeviceSelect = costPurchaseDeviceSelect;
|
||||
}
|
||||
|
||||
public String getCostPurchaseBuildSelect() {
|
||||
return costPurchaseBuildSelect;
|
||||
}
|
||||
|
||||
public void setCostPurchaseBuildSelect(String costPurchaseBuildSelect) {
|
||||
this.costPurchaseBuildSelect = costPurchaseBuildSelect;
|
||||
}
|
||||
|
||||
public String getCostPurchaseServiceSelect() {
|
||||
return costPurchaseServiceSelect;
|
||||
}
|
||||
|
||||
public void setCostPurchaseServiceSelect(String costPurchaseServiceSelect) {
|
||||
this.costPurchaseServiceSelect = costPurchaseServiceSelect;
|
||||
}
|
||||
|
||||
public String getCostPurchaseOtherSelect() {
|
||||
return costPurchaseOtherSelect;
|
||||
}
|
||||
|
||||
public void setCostPurchaseOtherSelect(String costPurchaseOtherSelect) {
|
||||
this.costPurchaseOtherSelect = costPurchaseOtherSelect;
|
||||
}
|
||||
|
||||
public String getCostOtherOtherSelect() {
|
||||
return costOtherOtherSelect;
|
||||
}
|
||||
|
||||
public void setCostOtherOtherSelect(String costOtherOtherSelect) {
|
||||
this.costOtherOtherSelect = costOtherOtherSelect;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeDeviceTaxInclude() {
|
||||
return handleSpecial(incomeDeviceTaxInclude);
|
||||
}
|
||||
|
||||
public void setIncomeDeviceTaxInclude(BigDecimal incomeDeviceTaxInclude) {
|
||||
this.incomeDeviceTaxInclude = incomeDeviceTaxInclude;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeEngineerTaxInclude() {
|
||||
return handleSpecial(incomeEngineerTaxInclude);
|
||||
}
|
||||
|
||||
public void setIncomeEngineerTaxInclude(BigDecimal incomeEngineerTaxInclude) {
|
||||
this.incomeEngineerTaxInclude = incomeEngineerTaxInclude;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeServiceTaxInclude() {
|
||||
return handleSpecial(incomeServiceTaxInclude);
|
||||
}
|
||||
|
||||
public void setIncomeServiceTaxInclude(BigDecimal incomeServiceTaxInclude) {
|
||||
this.incomeServiceTaxInclude = incomeServiceTaxInclude;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeDeviceTaxExclude() {
|
||||
return handleSpecial(incomeDeviceTaxExclude);
|
||||
}
|
||||
|
||||
public void setIncomeDeviceTaxExclude(BigDecimal incomeDeviceTaxExclude) {
|
||||
this.incomeDeviceTaxExclude = incomeDeviceTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeEngineerTaxExclude() {
|
||||
return handleSpecial(incomeEngineerTaxExclude);
|
||||
}
|
||||
|
||||
public void setIncomeEngineerTaxExclude(BigDecimal incomeEngineerTaxExclude) {
|
||||
this.incomeEngineerTaxExclude = incomeEngineerTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeServiceTaxExclude() {
|
||||
return handleSpecial(incomeServiceTaxExclude);
|
||||
}
|
||||
|
||||
public void setIncomeServiceTaxExclude(BigDecimal incomeServiceTaxExclude) {
|
||||
this.incomeServiceTaxExclude = incomeServiceTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseDeviceTaxInclude() {
|
||||
return handleSpecial(costPurchaseDeviceTaxInclude);
|
||||
}
|
||||
|
||||
public void setCostPurchaseDeviceTaxInclude(BigDecimal costPurchaseDeviceTaxInclude) {
|
||||
this.costPurchaseDeviceTaxInclude = costPurchaseDeviceTaxInclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseBuildTaxInclude() {
|
||||
return handleSpecial(costPurchaseBuildTaxInclude);
|
||||
}
|
||||
|
||||
public void setCostPurchaseBuildTaxInclude(BigDecimal costPurchaseBuildTaxInclude) {
|
||||
this.costPurchaseBuildTaxInclude = costPurchaseBuildTaxInclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseServiceTaxInclude() {
|
||||
return handleSpecial(costPurchaseServiceTaxInclude);
|
||||
}
|
||||
|
||||
public void setCostPurchaseServiceTaxInclude(BigDecimal costPurchaseServiceTaxInclude) {
|
||||
this.costPurchaseServiceTaxInclude = costPurchaseServiceTaxInclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目管理成本含税=项目管理成本不含税
|
||||
*/
|
||||
public BigDecimal getCostProjectManageTaxInclude() {
|
||||
return getCostProjectManageTaxExclude();
|
||||
}
|
||||
|
||||
/*
|
||||
* public void setCostProjectManageTaxInclude(BigDecimal
|
||||
* costProjectManageTaxInclude) {
|
||||
* this.costProjectManageTaxInclude = costProjectManageTaxInclude;
|
||||
* }
|
||||
*/
|
||||
|
||||
public BigDecimal getCostPurchaseOtherTaxInclude() {
|
||||
return handleSpecial(costPurchaseOtherTaxInclude);
|
||||
}
|
||||
|
||||
public void setCostPurchaseOtherTaxInclude(BigDecimal costPurchaseOtherTaxInclude) {
|
||||
this.costPurchaseOtherTaxInclude = costPurchaseOtherTaxInclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostOtherOtherTaxInclude() {
|
||||
if (costOtherOtherTaxInclude == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return handleSpecial(costOtherOtherTaxInclude);
|
||||
}
|
||||
|
||||
public void setCostOtherOtherTaxInclude(BigDecimal costOtherOtherTaxInclude) {
|
||||
this.costOtherOtherTaxInclude = costOtherOtherTaxInclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseDeviceTaxExclude() {
|
||||
return handleSpecial(costPurchaseDeviceTaxExclude);
|
||||
}
|
||||
|
||||
public void setCostPurchaseDeviceTaxExclude(BigDecimal costPurchaseDeviceTaxExclude) {
|
||||
this.costPurchaseDeviceTaxExclude = costPurchaseDeviceTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseBuildTaxExclude() {
|
||||
return handleSpecial(costPurchaseBuildTaxExclude);
|
||||
}
|
||||
|
||||
public void setCostPurchaseBuildTaxExclude(BigDecimal costPurchaseBuildTaxExclude) {
|
||||
this.costPurchaseBuildTaxExclude = costPurchaseBuildTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseServiceTaxExclude() {
|
||||
return handleSpecial(costPurchaseServiceTaxExclude);
|
||||
}
|
||||
|
||||
public void setCostPurchaseServiceTaxExclude(BigDecimal costPurchaseServiceTaxExclude) {
|
||||
this.costPurchaseServiceTaxExclude = costPurchaseServiceTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseOtherTaxExclude() {
|
||||
return handleSpecial(costPurchaseOtherTaxExclude);
|
||||
}
|
||||
|
||||
public void setCostPurchaseOtherTaxExclude(BigDecimal costPurchaseOtherTaxExclude) {
|
||||
this.costPurchaseOtherTaxExclude = costPurchaseOtherTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostProjectManageTaxExclude() {
|
||||
return handleSpecial(costProjectManageTaxExclude);
|
||||
}
|
||||
|
||||
public void setCostProjectManageTaxExclude(BigDecimal costProjectManageTaxExclude) {
|
||||
this.costProjectManageTaxExclude = costProjectManageTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostOtherOtherTaxExclude() {
|
||||
if (costOtherOtherTaxExclude == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return handleSpecial(costOtherOtherTaxExclude);
|
||||
}
|
||||
|
||||
public void setCostOtherOtherTaxExclude(BigDecimal costOtherOtherTaxExclude) {
|
||||
this.costOtherOtherTaxExclude = costOtherOtherTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostExpropriationTaxExclude() {
|
||||
return handleSpecial(costExpropriationTaxExclude);
|
||||
}
|
||||
|
||||
public void setCostExpropriationTaxExclude(BigDecimal costExpropriationTaxExclude) {
|
||||
this.costExpropriationTaxExclude = costExpropriationTaxExclude;
|
||||
}
|
||||
|
||||
public BigDecimal getCostCompanyManageTaxExclude() {
|
||||
return handleSpecial(costCompanyManageTaxExclude);
|
||||
}
|
||||
|
||||
public void setCostCompanyManageTaxExclude(BigDecimal costCompanyManageTaxExclude) {
|
||||
this.costCompanyManageTaxExclude = costCompanyManageTaxExclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算管理成本不含税
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCostManageExclude() {
|
||||
BigDecimal costExpropriationTaxExclude = getCostExpropriationTaxExclude();
|
||||
BigDecimal costCompanyManageTaxExclude = getCostCompanyManageTaxExclude();
|
||||
if (null == costExpropriationTaxExclude || null == costCompanyManageTaxExclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
return costExpropriationTaxExclude.add(costCompanyManageTaxExclude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算所有的含税收入
|
||||
*/
|
||||
public BigDecimal getIncomeTotalTaxInclude() {
|
||||
BigDecimal incomeDeviceTaxInclude = getIncomeDeviceTaxInclude();
|
||||
BigDecimal incomeEngineerTaxInclude = getIncomeEngineerTaxInclude();
|
||||
BigDecimal incomeServiceTaxInclude = getIncomeServiceTaxInclude();
|
||||
if (null == incomeDeviceTaxInclude || null == incomeEngineerTaxInclude || null == incomeServiceTaxInclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
return incomeDeviceTaxInclude.add(incomeEngineerTaxInclude)
|
||||
.add(incomeServiceTaxInclude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算所有的不含税收入
|
||||
*/
|
||||
public BigDecimal getIncomeTotalTaxExclude() {
|
||||
BigDecimal incomeDeviceTaxExclude = getIncomeDeviceTaxExclude();
|
||||
BigDecimal incomeEngineerTaxExclude = getIncomeEngineerTaxExclude();
|
||||
BigDecimal incomeServiceTaxExclude = getIncomeServiceTaxExclude();
|
||||
if (null == incomeDeviceTaxExclude || null == incomeEngineerTaxExclude || null == incomeServiceTaxExclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
return incomeDeviceTaxExclude.add(incomeEngineerTaxExclude)
|
||||
.add(incomeServiceTaxExclude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算所有的成本税金
|
||||
*/
|
||||
public BigDecimal getIncomeTotalTax() {
|
||||
if (getIncomeTotalTaxInclude() == null || getIncomeTotalTaxExclude() == null) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
BigDecimal subtract = getIncomeTotalTaxInclude().subtract(getIncomeTotalTaxExclude());
|
||||
return subtract;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算所有的成本含税
|
||||
*/
|
||||
public BigDecimal getCostTotalTaxInclude() {
|
||||
BigDecimal costPurchaseDeviceTaxInclude = getCostPurchaseDeviceTaxInclude();
|
||||
BigDecimal costPurchaseBuildTaxInclude = getCostPurchaseBuildTaxInclude();
|
||||
BigDecimal costPurchaseServiceTaxInclude = getCostPurchaseServiceTaxInclude();
|
||||
BigDecimal costPurchaseOtherTaxInclude = getCostPurchaseOtherTaxInclude();
|
||||
// BigDecimal costProjectManageTaxInclude = getCostProjectManageTaxInclude();
|
||||
BigDecimal costOtherOtherTaxInclude = getCostOtherOtherTaxInclude();
|
||||
if (null == costPurchaseDeviceTaxInclude
|
||||
|| null == costPurchaseBuildTaxInclude
|
||||
|| null == costPurchaseServiceTaxInclude
|
||||
|| null == costPurchaseOtherTaxInclude
|
||||
// || null == costProjectManageTaxInclude
|
||||
// || null == costOtherOtherTaxInclude
|
||||
) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
return costPurchaseDeviceTaxInclude
|
||||
.add(costPurchaseBuildTaxInclude)
|
||||
.add(costPurchaseServiceTaxInclude)
|
||||
.add(costPurchaseOtherTaxInclude);
|
||||
// .add(costProjectManageTaxInclude)
|
||||
// .add(costOtherOtherTaxInclude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算所有的成本不含税
|
||||
*/
|
||||
public BigDecimal getCostTotalTaxExclude() {
|
||||
BigDecimal costPurchaseDeviceTaxExclude = getCostPurchaseDeviceTaxExclude();
|
||||
BigDecimal costPurchaseBuildTaxExclude = getCostPurchaseBuildTaxExclude();
|
||||
BigDecimal costPurchaseServiceTaxExclude = getCostPurchaseServiceTaxExclude();
|
||||
BigDecimal costPurchaseOtherTaxExclude = getCostPurchaseOtherTaxExclude();
|
||||
BigDecimal costProjectManageTaxExclude = getCostProjectManageTaxExclude();
|
||||
BigDecimal costOtherOtherTaxExclude = getCostOtherOtherTaxExclude();
|
||||
if (null == costPurchaseDeviceTaxExclude
|
||||
|| null == costPurchaseBuildTaxExclude
|
||||
|| null == costPurchaseServiceTaxExclude
|
||||
|| null == costPurchaseOtherTaxExclude
|
||||
// || null == costProjectManageTaxExclude
|
||||
// || null == costOtherOtherTaxExclude
|
||||
) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
return costPurchaseDeviceTaxExclude
|
||||
.add(costPurchaseBuildTaxExclude)
|
||||
.add(costPurchaseServiceTaxExclude)
|
||||
.add(costPurchaseOtherTaxExclude);
|
||||
// .add(costProjectManageTaxExclude)
|
||||
// .add(costOtherOtherTaxExclude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算所有的成本税金
|
||||
*/
|
||||
public BigDecimal getCostTotalTax() {
|
||||
if (getCostTotalTaxExclude() == null || getCostTotalTaxInclude() == null) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
return getCostTotalTaxInclude().subtract(getCostTotalTaxExclude());
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算项目毛利
|
||||
* 收入总计(不含税)-成本总计(不含税)-财务费用总计(不含税)
|
||||
*/
|
||||
public BigDecimal getProjectGrossProfitA() {
|
||||
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||
BigDecimal costTotalTaxExclude = getCostPurchaseDeviceTaxExclude().add(getCostPurchaseBuildTaxExclude())
|
||||
.add(getCostPurchaseServiceTaxExclude()).add(getCostPurchaseOtherTaxExclude());
|
||||
if (null == incomeTotalTaxExclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
return incomeTotalTaxExclude
|
||||
.subtract(costTotalTaxExclude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算项目毛利率
|
||||
* 毛利(不含税)/收入总计(不含税
|
||||
*/
|
||||
public BigDecimal getProjectGrossProfitARate() {
|
||||
BigDecimal projectGrossProfit = getProjectGrossProfitA();
|
||||
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||
if (null == projectGrossProfit || null == incomeTotalTaxExclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
BigDecimal zero = new BigDecimal(0);
|
||||
if (projectGrossProfit.compareTo(zero) == 0 || incomeTotalTaxExclude.compareTo(zero) == 0) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
return projectGrossProfit
|
||||
.multiply(new BigDecimal(100))
|
||||
.divide(incomeTotalTaxExclude, 2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算项目毛利
|
||||
* 项目毛利B=项目毛利A-财务费用-项目管理费用
|
||||
*/
|
||||
public BigDecimal getProjectGrossProfit() {
|
||||
// BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||
// BigDecimal costTotalTaxExclude = getCostTotalTaxExclude();
|
||||
// BigDecimal costExpropriationTaxExclude = getCostExpropriationTaxExclude();
|
||||
// if (null == incomeTotalTaxExclude || null == costTotalTaxExclude || null ==
|
||||
// costExpropriationTaxExclude) {
|
||||
// return handleSpecial(null);
|
||||
// }
|
||||
// return incomeTotalTaxExclude
|
||||
// .subtract(costTotalTaxExclude)
|
||||
// .subtract(costExpropriationTaxExclude);
|
||||
|
||||
BigDecimal projectGrossProfitA = getProjectGrossProfitA(); // 项目毛利A
|
||||
BigDecimal costExpropriationTaxExclude = getCostExpropriationTaxExclude(); // 财务费用
|
||||
BigDecimal costProjectManageTaxExclude = getCostProjectManageTaxExclude(); // 项目管理费用
|
||||
|
||||
if (null == projectGrossProfitA || null == costExpropriationTaxExclude || null == costProjectManageTaxExclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
|
||||
return projectGrossProfitA
|
||||
.subtract(costExpropriationTaxExclude)
|
||||
.subtract(costProjectManageTaxExclude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算项目毛利率
|
||||
* 毛利(不含税)/收入总计(不含税
|
||||
*/
|
||||
public BigDecimal getProjectGrossProfitRate() {
|
||||
BigDecimal projectGrossProfit = getProjectGrossProfit();
|
||||
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||
if (null == projectGrossProfit || null == incomeTotalTaxExclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
BigDecimal zero = new BigDecimal(0);
|
||||
if (projectGrossProfit.compareTo(zero) == 0 || incomeTotalTaxExclude.compareTo(zero) == 0) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
return projectGrossProfit
|
||||
.multiply(new BigDecimal(100))
|
||||
.divide(incomeTotalTaxExclude, 2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算项目贡献利润
|
||||
* 项目毛利(不含税)-公司管理费用总计(不含税)
|
||||
*/
|
||||
public BigDecimal getProjectContributionProfit() {
|
||||
BigDecimal projectGrossProfit = getProjectGrossProfit();
|
||||
BigDecimal costCompanyManageTaxExclude = getCostCompanyManageTaxExclude();
|
||||
if (null == projectGrossProfit || null == costCompanyManageTaxExclude) {
|
||||
return null;
|
||||
}
|
||||
return projectGrossProfit.subtract(costCompanyManageTaxExclude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算项目贡献利润率
|
||||
* 贡献利润(不含税)/收入总计(不含税)
|
||||
*/
|
||||
public BigDecimal getProjectContributionProfitRate() {
|
||||
BigDecimal projectContributionProfit = getProjectContributionProfit();
|
||||
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
|
||||
if (null == projectContributionProfit || null == incomeTotalTaxExclude) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
BigDecimal zero = new BigDecimal(0);
|
||||
if (projectContributionProfit.compareTo(zero) == 0 || incomeTotalTaxExclude.compareTo(zero) == 0) {
|
||||
return handleSpecial(null);
|
||||
}
|
||||
return projectContributionProfit
|
||||
.multiply(new BigDecimal(100))
|
||||
.divide(incomeTotalTaxExclude, 2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对null值如何处理
|
||||
*
|
||||
* @param src 原值
|
||||
* @return 特殊处理之后的值
|
||||
*/
|
||||
protected abstract BigDecimal handleSpecial(BigDecimal src);
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
public enum IndustrySceneEnum {
|
||||
PLAN_O(-1,""),
|
||||
PLAN_A(1,"信息安全"),
|
||||
PLAN_B(2,"政府"),
|
||||
PLAN_C(3,"公安"),
|
||||
PLAN_D(4,"企业"),
|
||||
PLAN_E(5,"教育"),
|
||||
PLAN_F(6,"交通"),
|
||||
PLAN_G(7,"医疗"),
|
||||
PLAN_H(8,"电力能源"),
|
||||
PLAN_I(9,"运营商"),
|
||||
PLAN_J(10,"金融"),
|
||||
PLAN_K(11,"专网"),
|
||||
PLAN_L(12,"其他"),
|
||||
PLAN_M(13,"互联网"),
|
||||
PLAN_N(14,"银行");
|
||||
|
||||
private int scene;
|
||||
private String scenario;
|
||||
|
||||
IndustrySceneEnum(int scene, String scenario) {
|
||||
this.scene = scene;
|
||||
this.scenario = scenario;
|
||||
}
|
||||
|
||||
public int getScene() {
|
||||
return scene;
|
||||
}
|
||||
|
||||
public void setScene(int scene) {
|
||||
this.scene = scene;
|
||||
}
|
||||
|
||||
public String getScenario() {
|
||||
return scenario;
|
||||
}
|
||||
|
||||
public void setScenario(String scenario) {
|
||||
this.scenario = scenario;
|
||||
}
|
||||
|
||||
public static IndustrySceneEnum parseScene(int scene){
|
||||
if(scene == 1){
|
||||
return PLAN_A;
|
||||
}
|
||||
if(scene == 2){
|
||||
return PLAN_B;
|
||||
}
|
||||
if(scene == 3){
|
||||
return PLAN_C;
|
||||
}
|
||||
if(scene == 4){
|
||||
return PLAN_D;
|
||||
}
|
||||
if(scene == 5){
|
||||
return PLAN_E;
|
||||
}
|
||||
if(scene == 6){
|
||||
return PLAN_F;
|
||||
}
|
||||
if(scene == 7){
|
||||
return PLAN_G;
|
||||
}
|
||||
if(scene == 8){
|
||||
return PLAN_H;
|
||||
}
|
||||
if(scene == 9){
|
||||
return PLAN_I;
|
||||
}
|
||||
if(scene == 10){
|
||||
return PLAN_J;
|
||||
}
|
||||
if(scene == 11){
|
||||
return PLAN_K;
|
||||
}
|
||||
if(scene == 12){
|
||||
return PLAN_L;
|
||||
}
|
||||
if(scene == 13){
|
||||
return PLAN_M;
|
||||
}
|
||||
if(scene == 14){
|
||||
return PLAN_N;
|
||||
}
|
||||
throw new IllegalArgumentException("Unkown scene:"+scene);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public enum IsSecondEnum {
|
||||
PLAN_O(-1,""),
|
||||
PLAN_A(1,"是"),
|
||||
PLAN_B(2,"否");
|
||||
|
||||
private int isSecond;
|
||||
private String isSecondStr;
|
||||
|
||||
private IsSecondEnum(int isSecond, String isSecondStr) {
|
||||
this.isSecond = isSecond;
|
||||
this.isSecondStr = isSecondStr;
|
||||
}
|
||||
|
||||
public int getIsSecond() {
|
||||
return isSecond;
|
||||
}
|
||||
|
||||
public void setIsSecond(int isSecond) {
|
||||
this.isSecond = isSecond;
|
||||
}
|
||||
|
||||
public String getIsSecondStr() {
|
||||
return isSecondStr;
|
||||
}
|
||||
|
||||
public void setIsSecondStr(String isSecondStr) {
|
||||
this.isSecondStr = isSecondStr;
|
||||
}
|
||||
|
||||
public static IsSecondEnum parseIsSecond(int isSecond){
|
||||
if(isSecond == 1){
|
||||
return PLAN_A;
|
||||
}
|
||||
if(isSecond == 2){
|
||||
return PLAN_B;
|
||||
}
|
||||
return PLAN_O;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 主要指标数据
|
||||
*/
|
||||
@Data
|
||||
public class PrimaryIndicatorBean {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 收入--设备类
|
||||
*/
|
||||
private BigDecimal incomeDevice;
|
||||
|
||||
/**
|
||||
* 收入--施工类
|
||||
*/
|
||||
private BigDecimal incomeEngineer;
|
||||
|
||||
/**
|
||||
* 收入--服务类
|
||||
*/
|
||||
private BigDecimal incomeService;
|
||||
|
||||
/**
|
||||
* 采购成本--设备类
|
||||
*/
|
||||
private BigDecimal costPurchaseDevice;
|
||||
|
||||
/**
|
||||
* 采购成本--施工类
|
||||
*/
|
||||
private BigDecimal costPurchaseBuild;
|
||||
|
||||
/**
|
||||
* 采购成本--服务类
|
||||
*/
|
||||
private BigDecimal costPurchaseService;
|
||||
|
||||
/**
|
||||
* 采购成本--其他
|
||||
*/
|
||||
private BigDecimal costPurchaseOther;
|
||||
|
||||
/**
|
||||
* 成本--其他
|
||||
*/
|
||||
private BigDecimal costOtherOther;
|
||||
|
||||
/**
|
||||
* 成本--项目管理成本
|
||||
*/
|
||||
private BigDecimal costProjectManage;
|
||||
|
||||
/**
|
||||
* 财务费用--资金占用成本
|
||||
*/
|
||||
private BigDecimal costExpropriation;
|
||||
|
||||
/**
|
||||
* 公司管理费用
|
||||
*/
|
||||
private BigDecimal costCompanyManage;
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 损益表数据
|
||||
*/
|
||||
@Data
|
||||
public class ProfitAndLossBean {
|
||||
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 营业收入
|
||||
*/
|
||||
private BigDecimal income;
|
||||
|
||||
/**
|
||||
* 营业成本
|
||||
*/
|
||||
private BigDecimal cost;
|
||||
|
||||
/**
|
||||
* 项目管理成本
|
||||
*/
|
||||
private BigDecimal manageCost;
|
||||
|
||||
/**
|
||||
* 其他
|
||||
*/
|
||||
private BigDecimal other;
|
||||
|
||||
/**
|
||||
* 财务费用
|
||||
*/
|
||||
private BigDecimal expropriation;
|
||||
|
||||
/**
|
||||
* 项目毛利
|
||||
*/
|
||||
private BigDecimal grossProfit;
|
||||
|
||||
/**
|
||||
* 项目毛利率
|
||||
*/
|
||||
private BigDecimal grossProfitProfit;
|
||||
|
||||
/**
|
||||
* 公司管理费用
|
||||
*/
|
||||
private BigDecimal CompanyManage;
|
||||
|
||||
/**
|
||||
* 项目贡献利润
|
||||
*/
|
||||
private BigDecimal contributionMargin;
|
||||
|
||||
/**
|
||||
* 项目贡献利润率
|
||||
*/
|
||||
private BigDecimal contributionMarginProfit;
|
||||
|
||||
/**
|
||||
* 所得税费用
|
||||
*/
|
||||
private BigDecimal incomeTax;
|
||||
|
||||
/**
|
||||
* 项目净利润
|
||||
*/
|
||||
private BigDecimal netMargin;
|
||||
|
||||
/**
|
||||
* 项目净利润率
|
||||
*/
|
||||
private BigDecimal netMarginProfit;
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 项目相关的配置
|
||||
* @author xiongshiyan at 2021/11/5 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public class ProjectConfigBean {
|
||||
/**
|
||||
* 资金利率
|
||||
*/
|
||||
private BigDecimal underwrittenTaxRate;
|
||||
/**
|
||||
* 项目贡献利润率阀值
|
||||
*/
|
||||
private BigDecimal projectContributionProfitRateThreshold;
|
||||
|
||||
public BigDecimal getUnderwrittenTaxRate() {
|
||||
return underwrittenTaxRate;
|
||||
}
|
||||
|
||||
public void setUnderwrittenTaxRate(BigDecimal underwrittenTaxRate) {
|
||||
this.underwrittenTaxRate = underwrittenTaxRate;
|
||||
}
|
||||
|
||||
public BigDecimal getProjectContributionProfitRateThreshold() {
|
||||
return projectContributionProfitRateThreshold;
|
||||
}
|
||||
|
||||
public void setProjectContributionProfitRateThreshold(BigDecimal projectContributionProfitRateThreshold) {
|
||||
this.projectContributionProfitRateThreshold = projectContributionProfitRateThreshold;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 项目预算资金计划表统计信息
|
||||
* @author xiongshiyan at 2021/11/5 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public class ProjectUnderwrittenPlanStatisticBean {
|
||||
/**
|
||||
* 峰值月份
|
||||
*/
|
||||
private String maxMonth;
|
||||
/**
|
||||
* 峰值金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 资金利息
|
||||
*/
|
||||
private BigDecimal capitalInterest;
|
||||
|
||||
public String getMaxMonth() {
|
||||
return maxMonth;
|
||||
}
|
||||
|
||||
public void setMaxMonth(String maxMonth) {
|
||||
this.maxMonth = maxMonth;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public BigDecimal getCapitalInterest() {
|
||||
return capitalInterest;
|
||||
}
|
||||
|
||||
public void setCapitalInterest(BigDecimal capitalInterest) {
|
||||
this.capitalInterest = capitalInterest;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
public interface RegexConstant {
|
||||
|
||||
/**
|
||||
* 手机号校验正则
|
||||
*/
|
||||
String REGEX = "^1[0-9][0-9]\\d{8}$";
|
||||
|
||||
String SERVERADDRESS = "^(http|https|ftp)\\://(((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|([a-zA-Z0-9_\\-\\.])+\\.(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|uk|me))((:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\\-\\._\\?\\,\\'/\\\\\\+&%\\$#\\=~])*)$";
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public enum ResolvePlanEnum {
|
||||
PLAN_O(-1,""),
|
||||
PLAN_A(1,"公共服务(智慧交通、雪亮工程、治安防控体系等)"),
|
||||
PLAN_B(2,"泛行业(智慧园区、智慧医疗、智慧工地等)"),
|
||||
PLAN_C(3,"其他生态");
|
||||
|
||||
private int resolvePlan;
|
||||
private String resolvePlanStr;
|
||||
|
||||
private ResolvePlanEnum(int resolvePlan, String resolvePlanStr) {
|
||||
this.resolvePlan = resolvePlan;
|
||||
this.resolvePlanStr = resolvePlanStr;
|
||||
}
|
||||
|
||||
public int getResolvePlan() {
|
||||
return resolvePlan;
|
||||
}
|
||||
|
||||
public void setResolvePlan(int resolvePlan) {
|
||||
this.resolvePlan = resolvePlan;
|
||||
}
|
||||
|
||||
public String getResolvePlanStr() {
|
||||
return resolvePlanStr;
|
||||
}
|
||||
|
||||
public void setResolvePlanStr(String resolvePlanStr) {
|
||||
this.resolvePlanStr = resolvePlanStr;
|
||||
}
|
||||
|
||||
public static ResolvePlanEnum parseResolvePlan(int resolvePlan){
|
||||
if(resolvePlan == 1){
|
||||
return PLAN_A;
|
||||
}
|
||||
if(resolvePlan == 2){
|
||||
return PLAN_B;
|
||||
}
|
||||
if(resolvePlan == 3){
|
||||
return PLAN_C;
|
||||
}
|
||||
throw new IllegalArgumentException("Unkown resolvePlan:"+resolvePlan);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
|
||||
import cn.palmte.work.config.Constant;
|
||||
|
||||
|
||||
public class ResponseMsg {
|
||||
private int status;
|
||||
private String msg;
|
||||
private Object data;
|
||||
|
||||
public ResponseMsg() {
|
||||
}
|
||||
|
||||
public ResponseMsg(int status, String msg) {
|
||||
this.status = status;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static ResponseMsg buildSuccessMsg(String msg) {
|
||||
return new ResponseMsg(Constant.Status.STATUS_SUCCESS, msg);
|
||||
}
|
||||
|
||||
public static ResponseMsg buildSuccessData(Object data) {
|
||||
return buildSuccessMsg("ok", data);
|
||||
}
|
||||
|
||||
public static ResponseMsg buildSuccessMsg(String msg, Object data) {
|
||||
ResponseMsg responseMsg = new ResponseMsg(Constant.Status.STATUS_SUCCESS, msg);
|
||||
responseMsg.setData(data);
|
||||
return responseMsg;
|
||||
}
|
||||
|
||||
public static ResponseMsg buildMsg(int status, String msg, Object data) {
|
||||
ResponseMsg responseMsg = new ResponseMsg(status, msg);
|
||||
responseMsg.setData(data);
|
||||
return responseMsg;
|
||||
}
|
||||
|
||||
public static ResponseMsg buildFailedMsg(String msg) {
|
||||
return new ResponseMsg(Constant.Status.STATUS_FAILED, msg);
|
||||
}
|
||||
|
||||
public static ResponseMsg buildFailedMsg(String msg, Object data) {
|
||||
ResponseMsg responseMsg = new ResponseMsg(Constant.Status.STATUS_FAILED, msg);
|
||||
responseMsg.setData(data);
|
||||
return responseMsg;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
public boolean isSuccess() {
|
||||
return Constant.Status.STATUS_SUCCESS == this.status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResponseMsg{" +
|
||||
"status=" + status +
|
||||
", msg='" + msg + '\'' +
|
||||
", data=" + data +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,543 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class SettleBean {
|
||||
|
||||
//========================收入表================================
|
||||
|
||||
/**
|
||||
* 设备类决算总额
|
||||
*/
|
||||
private BigDecimal incomeDevice;
|
||||
|
||||
/**
|
||||
* 工程类决算总额
|
||||
*/
|
||||
private BigDecimal incomeEngineer;
|
||||
|
||||
/**
|
||||
* 服务类决算总额
|
||||
*/
|
||||
private BigDecimal incomeService;
|
||||
|
||||
/**
|
||||
* 获取所有收入总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getIncomeTotal() {
|
||||
BigDecimal incomeDevice = getIncomeDevice();
|
||||
BigDecimal incomeEngineer = getIncomeEngineer();
|
||||
BigDecimal incomeService = getIncomeService();
|
||||
if (null == incomeDevice || null == incomeEngineer || null == incomeService) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return incomeDevice.add(incomeEngineer).add(incomeService);
|
||||
}
|
||||
|
||||
|
||||
//========================成本表================================
|
||||
|
||||
/**
|
||||
*设备采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseDevice;
|
||||
|
||||
/**
|
||||
*施工采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseBuild;
|
||||
|
||||
/**
|
||||
*服务采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseService;
|
||||
|
||||
/**
|
||||
*其他采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseOther;
|
||||
|
||||
/**
|
||||
* 项目管理成本决算总额
|
||||
*/
|
||||
private BigDecimal costProjectManage;
|
||||
|
||||
/**
|
||||
* 其他成本决算总额
|
||||
*/
|
||||
private BigDecimal costOther;
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有成本总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCostTotal() {
|
||||
BigDecimal costPurchaseDevice = getCostPurchaseDevice();
|
||||
BigDecimal costPurchaseBuild = getCostPurchaseBuild();
|
||||
BigDecimal costPurchaseService = getCostPurchaseService();
|
||||
BigDecimal costPurchaseOther = getCostPurchaseOther();
|
||||
BigDecimal costProjectManage = getCostProjectManage();
|
||||
BigDecimal costOther = getCostOther();
|
||||
|
||||
if (null == costPurchaseDevice || null == costPurchaseBuild || null == costPurchaseService
|
||||
|| null == costPurchaseOther || null == costProjectManage || null == costOther) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costPurchaseDevice.add(costPurchaseBuild).add(costPurchaseService)
|
||||
.add(costPurchaseOther).add(costProjectManage).add(costOther);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有成本总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCostTotal2() {
|
||||
BigDecimal costPurchaseDevice = getCostPurchaseDevice();
|
||||
BigDecimal costPurchaseBuild = getCostPurchaseBuild();
|
||||
BigDecimal costPurchaseService = getCostPurchaseService();
|
||||
BigDecimal costPurchaseOther = getCostPurchaseOther();
|
||||
|
||||
if (null == costPurchaseDevice || null == costPurchaseBuild || null == costPurchaseService
|
||||
|| null == costPurchaseOther) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costPurchaseDevice.add(costPurchaseBuild).add(costPurchaseService)
|
||||
.add(costPurchaseOther);
|
||||
}
|
||||
|
||||
//========================管理表================================
|
||||
|
||||
/**
|
||||
* 财务费用决算总额
|
||||
*/
|
||||
private BigDecimal costExpropriation;
|
||||
|
||||
/**
|
||||
* 公司管理费用决算总额
|
||||
*/
|
||||
private BigDecimal costCompanyManage;
|
||||
|
||||
/**
|
||||
* 所得税费用决算总额
|
||||
*/
|
||||
private BigDecimal costIncomeTax;
|
||||
|
||||
public BigDecimal getCostManageTotal() {
|
||||
BigDecimal costExpropriation = getCostExpropriation();
|
||||
BigDecimal costCompanyManage = getCostCompanyManage();
|
||||
BigDecimal costIncomeTax = getCostIncomeTax();
|
||||
|
||||
if (null == costExpropriation || null == costCompanyManage || null == costIncomeTax) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costExpropriation.add(costCompanyManage).add(costIncomeTax);
|
||||
}
|
||||
|
||||
|
||||
//========================利润率计算表================================
|
||||
|
||||
/**
|
||||
* 项目毛利决算总额
|
||||
*/
|
||||
private BigDecimal grossProfit;
|
||||
|
||||
/**
|
||||
* 项目毛利利润率
|
||||
*/
|
||||
private BigDecimal grossProfitProfitMargin;
|
||||
|
||||
/**
|
||||
* 项目贡献利润决算总额
|
||||
*/
|
||||
private BigDecimal contributionProfit;
|
||||
|
||||
/**
|
||||
* 项目贡献利润利润率
|
||||
*/
|
||||
private BigDecimal contributionProfitProfitMargin;
|
||||
|
||||
/**
|
||||
* 项目净利润决算总额
|
||||
*/
|
||||
private BigDecimal netProfit;
|
||||
|
||||
/**
|
||||
* 项目净利润利润率
|
||||
*/
|
||||
private BigDecimal netProfitProfitMargin;
|
||||
|
||||
//========================结算现金流量表================================
|
||||
|
||||
/**
|
||||
* a销售商品、提供劳务收到的现金
|
||||
* */
|
||||
private BigDecimal saleIncomeCash;
|
||||
/**
|
||||
* b收到的税费返还
|
||||
* */
|
||||
private BigDecimal taxReturn;
|
||||
/**
|
||||
* c其他与经营活动有关的现金【保证金收入】
|
||||
*/
|
||||
private BigDecimal earnestMoneyIncome;
|
||||
/**
|
||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||
*/
|
||||
private BigDecimal purchaseCost;
|
||||
/**
|
||||
* e支付的各项税费
|
||||
*/
|
||||
private BigDecimal taxCost;
|
||||
/**
|
||||
*f支付其他与经营活动有关的现金
|
||||
*/
|
||||
private BigDecimal earnestMoneyCost;
|
||||
/**
|
||||
* g经营活动产生的现金流量净额
|
||||
* g=a+c+b-d-f-e
|
||||
*/
|
||||
private BigDecimal netCashFlow;
|
||||
/**
|
||||
* h投资活动现金流入
|
||||
*/
|
||||
private BigDecimal cashInflowFromInvestingActivities;
|
||||
/**
|
||||
* i投资活动现金流出
|
||||
*/
|
||||
private BigDecimal cashOutflowFromInvestingActivities;
|
||||
/**
|
||||
* j投资活动产生的现金流量净额
|
||||
*/
|
||||
private BigDecimal netCashFromInvestingActivities;
|
||||
/**
|
||||
* k融资资金流入【垫资计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalInflow;
|
||||
/**
|
||||
* l融资资金流出【还款计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalOutflow;
|
||||
/**
|
||||
*m筹资活动产生的现金流量净额
|
||||
* m=k-l
|
||||
*/
|
||||
private BigDecimal financingCapitalCashflow;
|
||||
/**
|
||||
* n货币资金净增加额
|
||||
* n=g+j+m
|
||||
*/
|
||||
private BigDecimal netIncreaseMonetaryFunds;
|
||||
|
||||
/**
|
||||
* 获取所有现金流量总额
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCashFlowTotal() {
|
||||
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
||||
BigDecimal taxReturn = getTaxReturn();
|
||||
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
||||
BigDecimal purchaseCost = getPurchaseCost();
|
||||
BigDecimal taxCost = getTaxCost();
|
||||
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
||||
BigDecimal netCashFlow = getNetCashFlow();
|
||||
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
|
||||
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
|
||||
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
||||
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
||||
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
||||
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
||||
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
|
||||
|
||||
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|
||||
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
|
||||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
|
||||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
|
||||
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
|
||||
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
|
||||
}
|
||||
|
||||
private String projectName;
|
||||
|
||||
protected BigDecimal handleSpecial(BigDecimal src) {
|
||||
return null == src ? new BigDecimal(0) : src;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeDevice() {
|
||||
return handleSpecial(incomeDevice);
|
||||
}
|
||||
|
||||
public void setIncomeDevice(BigDecimal incomeDevice) {
|
||||
this.incomeDevice = incomeDevice;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeEngineer() {
|
||||
return handleSpecial(incomeEngineer);
|
||||
}
|
||||
|
||||
public void setIncomeEngineer(BigDecimal incomeEngineer) {
|
||||
this.incomeEngineer = incomeEngineer;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeService() {
|
||||
return handleSpecial(incomeService);
|
||||
}
|
||||
|
||||
public void setIncomeService(BigDecimal incomeService) {
|
||||
this.incomeService = incomeService;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseDevice() {
|
||||
return handleSpecial(costPurchaseDevice);
|
||||
}
|
||||
|
||||
public void setCostPurchaseDevice(BigDecimal costPurchaseDevice) {
|
||||
this.costPurchaseDevice = costPurchaseDevice;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseBuild() {
|
||||
return handleSpecial(costPurchaseBuild);
|
||||
}
|
||||
|
||||
public void setCostPurchaseBuild(BigDecimal costPurchaseBuild) {
|
||||
this.costPurchaseBuild = costPurchaseBuild;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseService() {
|
||||
return handleSpecial(costPurchaseService);
|
||||
}
|
||||
|
||||
public void setCostPurchaseService(BigDecimal costPurchaseService) {
|
||||
this.costPurchaseService = costPurchaseService;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseOther() {
|
||||
return handleSpecial(costPurchaseOther);
|
||||
}
|
||||
|
||||
public void setCostPurchaseOther(BigDecimal costPurchaseOther) {
|
||||
this.costPurchaseOther = costPurchaseOther;
|
||||
}
|
||||
|
||||
public BigDecimal getCostProjectManage() {
|
||||
return handleSpecial(costProjectManage);
|
||||
}
|
||||
|
||||
public void setCostProjectManage(BigDecimal costProjectManage) {
|
||||
this.costProjectManage = costProjectManage;
|
||||
}
|
||||
|
||||
public BigDecimal getCostOther() {
|
||||
if (costOther == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return handleSpecial(costOther);
|
||||
}
|
||||
|
||||
public void setCostOther(BigDecimal costOther) {
|
||||
this.costOther = costOther;
|
||||
}
|
||||
|
||||
public BigDecimal getCostExpropriation() {
|
||||
return handleSpecial(costExpropriation);
|
||||
}
|
||||
|
||||
public void setCostExpropriation(BigDecimal costExpropriation) {
|
||||
this.costExpropriation = costExpropriation;
|
||||
}
|
||||
|
||||
public BigDecimal getCostCompanyManage() {
|
||||
return handleSpecial(costCompanyManage);
|
||||
}
|
||||
|
||||
public void setCostCompanyManage(BigDecimal costCompanyManage) {
|
||||
this.costCompanyManage = costCompanyManage;
|
||||
}
|
||||
|
||||
public BigDecimal getCostIncomeTax() {
|
||||
return handleSpecial(costIncomeTax);
|
||||
}
|
||||
|
||||
public void setCostIncomeTax(BigDecimal costIncomeTax) {
|
||||
this.costIncomeTax = costIncomeTax;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfit() {
|
||||
return handleSpecial(grossProfit);
|
||||
}
|
||||
|
||||
public void setGrossProfit(BigDecimal grossProfit) {
|
||||
this.grossProfit = grossProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfitProfitMargin() {
|
||||
return handleSpecial(grossProfitProfitMargin);
|
||||
}
|
||||
|
||||
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
||||
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getContributionProfit() {
|
||||
return handleSpecial(contributionProfit);
|
||||
}
|
||||
|
||||
public void setContributionProfit(BigDecimal contributionProfit) {
|
||||
this.contributionProfit = contributionProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getContributionProfitProfitMargin() {
|
||||
return handleSpecial(contributionProfitProfitMargin);
|
||||
}
|
||||
|
||||
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
||||
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getNetProfit() {
|
||||
return handleSpecial(netProfit);
|
||||
}
|
||||
|
||||
public void setNetProfit(BigDecimal netProfit) {
|
||||
this.netProfit = netProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getNetProfitProfitMargin() {
|
||||
return handleSpecial(netProfitProfitMargin);
|
||||
}
|
||||
|
||||
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
||||
this.netProfitProfitMargin = netProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getSaleIncomeCash() {
|
||||
return handleSpecial(saleIncomeCash);
|
||||
}
|
||||
|
||||
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
|
||||
this.saleIncomeCash = saleIncomeCash;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxReturn() {
|
||||
return handleSpecial(taxReturn);
|
||||
}
|
||||
|
||||
public void setTaxReturn(BigDecimal taxReturn) {
|
||||
this.taxReturn = taxReturn;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyIncome() {
|
||||
return handleSpecial(earnestMoneyIncome);
|
||||
}
|
||||
|
||||
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
|
||||
this.earnestMoneyIncome = earnestMoneyIncome;
|
||||
}
|
||||
|
||||
public BigDecimal getPurchaseCost() {
|
||||
return handleSpecial(purchaseCost);
|
||||
}
|
||||
|
||||
public void setPurchaseCost(BigDecimal purchaseCost) {
|
||||
this.purchaseCost = purchaseCost;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxCost() {
|
||||
return handleSpecial(taxCost);
|
||||
}
|
||||
|
||||
public void setTaxCost(BigDecimal taxCost) {
|
||||
this.taxCost = taxCost;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyCost() {
|
||||
return handleSpecial(earnestMoneyCost);
|
||||
}
|
||||
|
||||
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
|
||||
this.earnestMoneyCost = earnestMoneyCost;
|
||||
}
|
||||
|
||||
public BigDecimal getCashInflowFromInvestingActivities() {
|
||||
return handleSpecial(cashInflowFromInvestingActivities);
|
||||
}
|
||||
|
||||
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
|
||||
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getCashOutflowFromInvestingActivities() {
|
||||
return handleSpecial(cashOutflowFromInvestingActivities);
|
||||
}
|
||||
|
||||
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
|
||||
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFromInvestingActivities() {
|
||||
return handleSpecial(netCashFromInvestingActivities);
|
||||
}
|
||||
|
||||
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
|
||||
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalInflow() {
|
||||
return handleSpecial(financingCapitalInflow);
|
||||
}
|
||||
|
||||
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
|
||||
this.financingCapitalInflow = financingCapitalInflow;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalOutflow() {
|
||||
return handleSpecial(financingCapitalOutflow);
|
||||
}
|
||||
|
||||
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
|
||||
this.financingCapitalOutflow = financingCapitalOutflow;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalCashflow() {
|
||||
return handleSpecial(financingCapitalCashflow);
|
||||
}
|
||||
|
||||
public void setFinancingCapitalCashflow(BigDecimal financingCapitalCashflow) {
|
||||
this.financingCapitalCashflow = financingCapitalCashflow;
|
||||
}
|
||||
|
||||
public BigDecimal getNetIncreaseMonetaryFunds() {
|
||||
return handleSpecial(netIncreaseMonetaryFunds);
|
||||
}
|
||||
|
||||
public void setNetIncreaseMonetaryFunds(BigDecimal netIncreaseMonetaryFunds) {
|
||||
this.netIncreaseMonetaryFunds = netIncreaseMonetaryFunds;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFlow() {
|
||||
return handleSpecial(netCashFlow);
|
||||
}
|
||||
|
||||
public void setNetCashFlow(BigDecimal netCashFlow) {
|
||||
this.netCashFlow = netCashFlow;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,968 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class SettleMonthBean {
|
||||
|
||||
//========================收入表================================
|
||||
|
||||
/**
|
||||
* 设备类决算总额
|
||||
*/
|
||||
private BigDecimal incomeDevice;
|
||||
|
||||
private BigDecimal budgetIncomeDevice;
|
||||
|
||||
private BigDecimal estimateIncomeDevice;
|
||||
|
||||
/**
|
||||
* 工程类决算总额
|
||||
*/
|
||||
private BigDecimal incomeEngineer;
|
||||
|
||||
private BigDecimal budgetIncomeEngineer;
|
||||
|
||||
private BigDecimal estimateIncomeEngineer;
|
||||
|
||||
/**
|
||||
* 服务类决算总额
|
||||
*/
|
||||
private BigDecimal incomeService;
|
||||
|
||||
private BigDecimal budgetIncomeService;
|
||||
|
||||
private BigDecimal estimateIncomeService;
|
||||
|
||||
/**
|
||||
* 获取所有收入总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getIncomeTotal() {
|
||||
BigDecimal incomeDevice = getIncomeDevice();
|
||||
BigDecimal incomeEngineer = getIncomeEngineer();
|
||||
BigDecimal incomeService = getIncomeService();
|
||||
if (null == incomeDevice || null == incomeEngineer || null == incomeService) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return incomeDevice.add(incomeEngineer).add(incomeService);
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetIncomeTotal() {
|
||||
BigDecimal incomeDevice = getBudgetIncomeDevice();
|
||||
BigDecimal incomeEngineer = getBudgetIncomeEngineer();
|
||||
BigDecimal incomeService = getBudgetIncomeService();
|
||||
if (null == incomeDevice || null == incomeEngineer || null == incomeService) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return incomeDevice.add(incomeEngineer).add(incomeService);
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateIncomeTotal() {
|
||||
BigDecimal incomeDevice = getEstimateIncomeDevice();
|
||||
BigDecimal incomeEngineer = getEstimateIncomeEngineer();
|
||||
BigDecimal incomeService = getEstimateIncomeService();
|
||||
if (null == incomeDevice || null == incomeEngineer || null == incomeService) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return incomeDevice.add(incomeEngineer).add(incomeService);
|
||||
}
|
||||
|
||||
|
||||
//========================成本表================================
|
||||
|
||||
/**
|
||||
*设备采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseDevice;
|
||||
|
||||
private BigDecimal budgetCostPurchaseDevice;
|
||||
|
||||
private BigDecimal estimateCostPurchaseDevice;
|
||||
|
||||
/**
|
||||
*施工采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseBuild;
|
||||
|
||||
private BigDecimal budgetCostPurchaseBuild;
|
||||
|
||||
private BigDecimal estimateCostPurchaseBuild;
|
||||
|
||||
/**
|
||||
*服务采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseService;
|
||||
|
||||
private BigDecimal budgetCostPurchaseService;
|
||||
|
||||
private BigDecimal estimateCostPurchaseService;
|
||||
|
||||
/**
|
||||
*其他采购成本决算总额
|
||||
*/
|
||||
private BigDecimal costPurchaseOther;
|
||||
|
||||
private BigDecimal budgetCostPurchaseOther;
|
||||
|
||||
private BigDecimal estimateCostPurchaseOther;
|
||||
|
||||
/**
|
||||
* 项目管理成本决算总额
|
||||
*/
|
||||
private BigDecimal costProjectManage;
|
||||
|
||||
private BigDecimal budgetCostProjectManage;
|
||||
|
||||
private BigDecimal estimateCostProjectManage;
|
||||
|
||||
/**
|
||||
* 其他成本决算总额
|
||||
*/
|
||||
private BigDecimal costOther;
|
||||
|
||||
private BigDecimal budgetCostOther;
|
||||
|
||||
private BigDecimal estimateCostOther;
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有成本总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCostTotal() {
|
||||
BigDecimal costPurchaseDevice = getCostPurchaseDevice();
|
||||
BigDecimal costPurchaseBuild = getCostPurchaseBuild();
|
||||
BigDecimal costPurchaseService = getCostPurchaseService();
|
||||
BigDecimal costPurchaseOther = getCostPurchaseOther();
|
||||
BigDecimal costProjectManage = getCostProjectManage();
|
||||
BigDecimal costOther = getCostOther();
|
||||
|
||||
if (null == costPurchaseDevice || null == costPurchaseBuild || null == costPurchaseService
|
||||
|| null == costPurchaseOther || null == costProjectManage || null == costOther) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costPurchaseDevice.add(costPurchaseBuild).add(costPurchaseService)
|
||||
.add(costPurchaseOther).add(costProjectManage).add(costOther);
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetCostTotal() {
|
||||
BigDecimal costPurchaseDevice = getBudgetCostPurchaseDevice();
|
||||
BigDecimal costPurchaseBuild = getBudgetCostPurchaseBuild();
|
||||
BigDecimal costPurchaseService = getBudgetCostPurchaseService();
|
||||
BigDecimal costPurchaseOther = getBudgetCostPurchaseOther();
|
||||
BigDecimal costProjectManage = getBudgetCostProjectManage();
|
||||
BigDecimal costOther = getBudgetCostOther();
|
||||
|
||||
if (null == costPurchaseDevice || null == costPurchaseBuild || null == costPurchaseService
|
||||
|| null == costPurchaseOther || null == costProjectManage || null == costOther) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costPurchaseDevice.add(costPurchaseBuild).add(costPurchaseService)
|
||||
.add(costPurchaseOther).add(costProjectManage).add(costOther);
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateCostTotal() {
|
||||
BigDecimal costPurchaseDevice = getEstimateCostPurchaseDevice();
|
||||
BigDecimal costPurchaseBuild = getEstimateCostPurchaseBuild();
|
||||
BigDecimal costPurchaseService = getEstimateCostPurchaseService();
|
||||
BigDecimal costPurchaseOther = getEstimateCostPurchaseOther();
|
||||
BigDecimal costProjectManage = getEstimateCostProjectManage();
|
||||
BigDecimal costOther = getEstimateCostOther();
|
||||
|
||||
if (null == costPurchaseDevice || null == costPurchaseBuild || null == costPurchaseService
|
||||
|| null == costPurchaseOther || null == costProjectManage || null == costOther) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costPurchaseDevice.add(costPurchaseBuild).add(costPurchaseService)
|
||||
.add(costPurchaseOther).add(costProjectManage).add(costOther);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有成本总额
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCostTotal2() {
|
||||
BigDecimal costPurchaseDevice = getCostPurchaseDevice();
|
||||
BigDecimal costPurchaseBuild = getCostPurchaseBuild();
|
||||
BigDecimal costPurchaseService = getCostPurchaseService();
|
||||
BigDecimal costPurchaseOther = getCostPurchaseOther();
|
||||
|
||||
if (null == costPurchaseDevice || null == costPurchaseBuild || null == costPurchaseService
|
||||
|| null == costPurchaseOther) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costPurchaseDevice.add(costPurchaseBuild).add(costPurchaseService)
|
||||
.add(costPurchaseOther);
|
||||
}
|
||||
|
||||
//========================管理表================================
|
||||
|
||||
/**
|
||||
* 财务费用决算总额
|
||||
*/
|
||||
private BigDecimal costExpropriation;
|
||||
|
||||
private BigDecimal estimateCostExpropriation;
|
||||
|
||||
private BigDecimal budgetCostExpropriation;
|
||||
|
||||
/**
|
||||
* 公司管理费用决算总额
|
||||
*/
|
||||
private BigDecimal costCompanyManage;
|
||||
|
||||
private BigDecimal estimateCostCompanyManage;
|
||||
|
||||
private BigDecimal budgetCostCompanyManage;
|
||||
|
||||
/**
|
||||
* 所得税费用决算总额
|
||||
*/
|
||||
private BigDecimal costIncomeTax;
|
||||
|
||||
public BigDecimal getCostManageTotal() {
|
||||
BigDecimal costExpropriation = getCostExpropriation();
|
||||
BigDecimal costCompanyManage = getCostCompanyManage();
|
||||
BigDecimal costIncomeTax = getCostIncomeTax();
|
||||
|
||||
if (null == costExpropriation || null == costCompanyManage || null == costIncomeTax) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costExpropriation.add(costCompanyManage).add(costIncomeTax);
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateCostManageTotal() {
|
||||
BigDecimal costExpropriation = getEstimateCostExpropriation();
|
||||
BigDecimal costCompanyManage = getEstimateCostCompanyManage();
|
||||
|
||||
if (null == costExpropriation || null == costCompanyManage ) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costExpropriation.add(costCompanyManage);
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetCostManageTotal() {
|
||||
BigDecimal costExpropriation = getBudgetCostExpropriation();
|
||||
BigDecimal costCompanyManage = getBudgetCostCompanyManage();
|
||||
|
||||
if (null == costExpropriation || null == costCompanyManage ) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return costExpropriation.add(costCompanyManage);
|
||||
}
|
||||
|
||||
//========================利润率计算表================================
|
||||
|
||||
/**
|
||||
* 项目毛利决算总额
|
||||
*/
|
||||
private BigDecimal grossProfit;
|
||||
|
||||
private BigDecimal estimateGrossProfit;
|
||||
|
||||
private BigDecimal budgetGrossProfit;
|
||||
|
||||
/**
|
||||
* 项目毛利利润率
|
||||
*/
|
||||
private BigDecimal grossProfitProfitMargin;
|
||||
|
||||
/**
|
||||
* 项目贡献利润决算总额
|
||||
*/
|
||||
private BigDecimal contributionProfit;
|
||||
|
||||
private BigDecimal estimateContributionProfit;
|
||||
|
||||
private BigDecimal budgetContributionProfit;
|
||||
|
||||
/**
|
||||
* 项目贡献利润利润率
|
||||
*/
|
||||
private BigDecimal contributionProfitProfitMargin;
|
||||
|
||||
/**
|
||||
* 项目净利润决算总额
|
||||
*/
|
||||
private BigDecimal netProfit;
|
||||
|
||||
/**
|
||||
* 项目净利润利润率
|
||||
*/
|
||||
private BigDecimal netProfitProfitMargin;
|
||||
|
||||
//========================结算现金流量表================================
|
||||
|
||||
/**
|
||||
* a销售商品、提供劳务收到的现金
|
||||
* */
|
||||
private BigDecimal saleIncomeCash;
|
||||
|
||||
private BigDecimal budgetSaleIncomeCash;
|
||||
/**
|
||||
* b收到的税费返还
|
||||
* */
|
||||
private BigDecimal taxReturn;
|
||||
/**
|
||||
* c其他与经营活动有关的现金【保证金收入】
|
||||
*/
|
||||
private BigDecimal earnestMoneyIncome;
|
||||
|
||||
private BigDecimal budgetEarnestMoneyIncome;
|
||||
/**
|
||||
* d购买商品、接受劳务支付的现金【设备支出+工程支出】
|
||||
*/
|
||||
private BigDecimal purchaseCost;
|
||||
|
||||
private BigDecimal budgetPurchaseCost;
|
||||
/**
|
||||
* e支付的各项税费
|
||||
*/
|
||||
private BigDecimal taxCost;
|
||||
/**
|
||||
*f支付其他与经营活动有关的现金
|
||||
*/
|
||||
private BigDecimal earnestMoneyCost;
|
||||
|
||||
private BigDecimal budgetEarnestMoneyCost;
|
||||
/**
|
||||
* g经营活动产生的现金流量净额
|
||||
* g=a+c+b-d-f-e
|
||||
*/
|
||||
private BigDecimal netCashFlow;
|
||||
|
||||
private BigDecimal budgetNetCashFlow;
|
||||
/**
|
||||
* h投资活动现金流入
|
||||
*/
|
||||
private BigDecimal cashInflowFromInvestingActivities;
|
||||
/**
|
||||
* i投资活动现金流出
|
||||
*/
|
||||
private BigDecimal cashOutflowFromInvestingActivities;
|
||||
/**
|
||||
* j投资活动产生的现金流量净额
|
||||
*/
|
||||
private BigDecimal netCashFromInvestingActivities;
|
||||
/**
|
||||
* k融资资金流入【垫资计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalInflow;
|
||||
|
||||
private BigDecimal budgetFinancingCapitalInflow;
|
||||
/**
|
||||
* l融资资金流出【还款计划】
|
||||
*/
|
||||
private BigDecimal financingCapitalOutflow;
|
||||
|
||||
private BigDecimal budgetFinancingCapitalOutflow;
|
||||
/**
|
||||
*m筹资活动产生的现金流量净额
|
||||
* m=k-l
|
||||
*/
|
||||
private BigDecimal financingCapitalCashflow;
|
||||
|
||||
private BigDecimal budgetFinancingCapitalCashflow;
|
||||
/**
|
||||
* n货币资金净增加额
|
||||
* n=g+j+m
|
||||
*/
|
||||
private BigDecimal netIncreaseMonetaryFunds;
|
||||
|
||||
private BigDecimal budgetNetIncreaseMonetaryFunds;
|
||||
|
||||
/**
|
||||
* 获取所有现金流量总额
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getCashFlowTotal() {
|
||||
BigDecimal saleIncomeCash = getSaleIncomeCash();
|
||||
BigDecimal taxReturn = getTaxReturn();
|
||||
BigDecimal earnestMoneyIncome = getEarnestMoneyIncome();
|
||||
BigDecimal purchaseCost = getPurchaseCost();
|
||||
BigDecimal taxCost = getTaxCost();
|
||||
BigDecimal earnestMoneyCost = getEarnestMoneyCost();
|
||||
BigDecimal netCashFlow = getNetCashFlow();
|
||||
BigDecimal cashInflowFromInvestingActivities = getCashInflowFromInvestingActivities();
|
||||
BigDecimal cashOutflowFromInvestingActivities = getCashOutflowFromInvestingActivities();
|
||||
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
|
||||
BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
|
||||
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
|
||||
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
|
||||
BigDecimal netIncreaseMonetaryFunds = getNetIncreaseMonetaryFunds();
|
||||
|
||||
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || null == purchaseCost || null == taxCost
|
||||
|| null == earnestMoneyCost || null == netCashFlow || null == cashInflowFromInvestingActivities ||
|
||||
null == cashOutflowFromInvestingActivities || null == netCashFromInvestingActivities ||
|
||||
null == financingCapitalInflow || null == financingCapitalOutflow || null == financingCapitalCashflow || null == netIncreaseMonetaryFunds) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
return saleIncomeCash.add(taxReturn).add(earnestMoneyIncome).add(purchaseCost).add(taxCost).add(earnestMoneyCost)
|
||||
.add(netCashFlow).add(cashInflowFromInvestingActivities).add(cashOutflowFromInvestingActivities).add(netCashFromInvestingActivities)
|
||||
.add(financingCapitalInflow).add(financingCapitalOutflow).add(financingCapitalCashflow).add(netIncreaseMonetaryFunds);
|
||||
}
|
||||
|
||||
private String projectName;
|
||||
|
||||
protected BigDecimal handleSpecial(BigDecimal src) {
|
||||
return null == src ? new BigDecimal(0) : src;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeDevice() {
|
||||
return handleSpecial(incomeDevice);
|
||||
}
|
||||
|
||||
public void setIncomeDevice(BigDecimal incomeDevice) {
|
||||
this.incomeDevice = incomeDevice;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeEngineer() {
|
||||
return handleSpecial(incomeEngineer);
|
||||
}
|
||||
|
||||
public void setIncomeEngineer(BigDecimal incomeEngineer) {
|
||||
this.incomeEngineer = incomeEngineer;
|
||||
}
|
||||
|
||||
public BigDecimal getIncomeService() {
|
||||
return handleSpecial(incomeService);
|
||||
}
|
||||
|
||||
public void setIncomeService(BigDecimal incomeService) {
|
||||
this.incomeService = incomeService;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseDevice() {
|
||||
return handleSpecial(costPurchaseDevice);
|
||||
}
|
||||
|
||||
public void setCostPurchaseDevice(BigDecimal costPurchaseDevice) {
|
||||
this.costPurchaseDevice = costPurchaseDevice;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseBuild() {
|
||||
return handleSpecial(costPurchaseBuild);
|
||||
}
|
||||
|
||||
public void setCostPurchaseBuild(BigDecimal costPurchaseBuild) {
|
||||
this.costPurchaseBuild = costPurchaseBuild;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseService() {
|
||||
return handleSpecial(costPurchaseService);
|
||||
}
|
||||
|
||||
public void setCostPurchaseService(BigDecimal costPurchaseService) {
|
||||
this.costPurchaseService = costPurchaseService;
|
||||
}
|
||||
|
||||
public BigDecimal getCostPurchaseOther() {
|
||||
return handleSpecial(costPurchaseOther);
|
||||
}
|
||||
|
||||
public void setCostPurchaseOther(BigDecimal costPurchaseOther) {
|
||||
this.costPurchaseOther = costPurchaseOther;
|
||||
}
|
||||
|
||||
public BigDecimal getCostProjectManage() {
|
||||
return handleSpecial(costProjectManage);
|
||||
}
|
||||
|
||||
public void setCostProjectManage(BigDecimal costProjectManage) {
|
||||
this.costProjectManage = costProjectManage;
|
||||
}
|
||||
|
||||
public BigDecimal getCostOther() {
|
||||
if (costOther == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return handleSpecial(costOther);
|
||||
}
|
||||
|
||||
public void setCostOther(BigDecimal costOther) {
|
||||
this.costOther = costOther;
|
||||
}
|
||||
|
||||
public BigDecimal getCostExpropriation() {
|
||||
return handleSpecial(costExpropriation);
|
||||
}
|
||||
|
||||
public void setCostExpropriation(BigDecimal costExpropriation) {
|
||||
this.costExpropriation = costExpropriation;
|
||||
}
|
||||
|
||||
public BigDecimal getCostCompanyManage() {
|
||||
return handleSpecial(costCompanyManage);
|
||||
}
|
||||
|
||||
public void setCostCompanyManage(BigDecimal costCompanyManage) {
|
||||
this.costCompanyManage = costCompanyManage;
|
||||
}
|
||||
|
||||
public BigDecimal getCostIncomeTax() {
|
||||
return handleSpecial(costIncomeTax);
|
||||
}
|
||||
|
||||
public void setCostIncomeTax(BigDecimal costIncomeTax) {
|
||||
this.costIncomeTax = costIncomeTax;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfit() {
|
||||
return handleSpecial(grossProfit);
|
||||
}
|
||||
|
||||
public void setGrossProfit(BigDecimal grossProfit) {
|
||||
this.grossProfit = grossProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfitProfitMargin() {
|
||||
return handleSpecial(grossProfitProfitMargin);
|
||||
}
|
||||
|
||||
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
|
||||
this.grossProfitProfitMargin = grossProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getContributionProfit() {
|
||||
return handleSpecial(contributionProfit);
|
||||
}
|
||||
|
||||
public void setContributionProfit(BigDecimal contributionProfit) {
|
||||
this.contributionProfit = contributionProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getContributionProfitProfitMargin() {
|
||||
return handleSpecial(contributionProfitProfitMargin);
|
||||
}
|
||||
|
||||
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
|
||||
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getNetProfit() {
|
||||
return handleSpecial(netProfit);
|
||||
}
|
||||
|
||||
public void setNetProfit(BigDecimal netProfit) {
|
||||
this.netProfit = netProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getNetProfitProfitMargin() {
|
||||
return handleSpecial(netProfitProfitMargin);
|
||||
}
|
||||
|
||||
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
|
||||
this.netProfitProfitMargin = netProfitProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getSaleIncomeCash() {
|
||||
return handleSpecial(saleIncomeCash);
|
||||
}
|
||||
|
||||
public void setSaleIncomeCash(BigDecimal saleIncomeCash) {
|
||||
this.saleIncomeCash = saleIncomeCash;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxReturn() {
|
||||
return handleSpecial(taxReturn);
|
||||
}
|
||||
|
||||
public void setTaxReturn(BigDecimal taxReturn) {
|
||||
this.taxReturn = taxReturn;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyIncome() {
|
||||
return handleSpecial(earnestMoneyIncome);
|
||||
}
|
||||
|
||||
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
|
||||
this.earnestMoneyIncome = earnestMoneyIncome;
|
||||
}
|
||||
|
||||
public BigDecimal getPurchaseCost() {
|
||||
return handleSpecial(purchaseCost);
|
||||
}
|
||||
|
||||
public void setPurchaseCost(BigDecimal purchaseCost) {
|
||||
this.purchaseCost = purchaseCost;
|
||||
}
|
||||
|
||||
public BigDecimal getTaxCost() {
|
||||
return handleSpecial(taxCost);
|
||||
}
|
||||
|
||||
public void setTaxCost(BigDecimal taxCost) {
|
||||
this.taxCost = taxCost;
|
||||
}
|
||||
|
||||
public BigDecimal getEarnestMoneyCost() {
|
||||
return handleSpecial(earnestMoneyCost);
|
||||
}
|
||||
|
||||
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
|
||||
this.earnestMoneyCost = earnestMoneyCost;
|
||||
}
|
||||
|
||||
public BigDecimal getCashInflowFromInvestingActivities() {
|
||||
return handleSpecial(cashInflowFromInvestingActivities);
|
||||
}
|
||||
|
||||
public void setCashInflowFromInvestingActivities(BigDecimal cashInflowFromInvestingActivities) {
|
||||
this.cashInflowFromInvestingActivities = cashInflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getCashOutflowFromInvestingActivities() {
|
||||
return handleSpecial(cashOutflowFromInvestingActivities);
|
||||
}
|
||||
|
||||
public void setCashOutflowFromInvestingActivities(BigDecimal cashOutflowFromInvestingActivities) {
|
||||
this.cashOutflowFromInvestingActivities = cashOutflowFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFromInvestingActivities() {
|
||||
return handleSpecial(netCashFromInvestingActivities);
|
||||
}
|
||||
|
||||
public void setNetCashFromInvestingActivities(BigDecimal netCashFromInvestingActivities) {
|
||||
this.netCashFromInvestingActivities = netCashFromInvestingActivities;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalInflow() {
|
||||
return handleSpecial(financingCapitalInflow);
|
||||
}
|
||||
|
||||
public void setFinancingCapitalInflow(BigDecimal financingCapitalInflow) {
|
||||
this.financingCapitalInflow = financingCapitalInflow;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalOutflow() {
|
||||
return handleSpecial(financingCapitalOutflow);
|
||||
}
|
||||
|
||||
public void setFinancingCapitalOutflow(BigDecimal financingCapitalOutflow) {
|
||||
this.financingCapitalOutflow = financingCapitalOutflow;
|
||||
}
|
||||
|
||||
public BigDecimal getFinancingCapitalCashflow() {
|
||||
return handleSpecial(financingCapitalCashflow);
|
||||
}
|
||||
|
||||
public void setFinancingCapitalCashflow(BigDecimal financingCapitalCashflow) {
|
||||
this.financingCapitalCashflow = financingCapitalCashflow;
|
||||
}
|
||||
|
||||
public BigDecimal getNetIncreaseMonetaryFunds() {
|
||||
return handleSpecial(netIncreaseMonetaryFunds);
|
||||
}
|
||||
|
||||
public void setNetIncreaseMonetaryFunds(BigDecimal netIncreaseMonetaryFunds) {
|
||||
this.netIncreaseMonetaryFunds = netIncreaseMonetaryFunds;
|
||||
}
|
||||
|
||||
public BigDecimal getNetCashFlow() {
|
||||
return handleSpecial(netCashFlow);
|
||||
}
|
||||
|
||||
public void setNetCashFlow(BigDecimal netCashFlow) {
|
||||
this.netCashFlow = netCashFlow;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetIncomeDevice() {
|
||||
return budgetIncomeDevice;
|
||||
}
|
||||
|
||||
public void setBudgetIncomeDevice(BigDecimal budgetIncomeDevice) {
|
||||
this.budgetIncomeDevice = budgetIncomeDevice;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateIncomeDevice() {
|
||||
return estimateIncomeDevice;
|
||||
}
|
||||
|
||||
public void setEstimateIncomeDevice(BigDecimal estimateIncomeDevice) {
|
||||
this.estimateIncomeDevice = estimateIncomeDevice;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetIncomeEngineer() {
|
||||
return budgetIncomeEngineer;
|
||||
}
|
||||
|
||||
public void setBudgetIncomeEngineer(BigDecimal budgetIncomeEngineer) {
|
||||
this.budgetIncomeEngineer = budgetIncomeEngineer;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateIncomeEngineer() {
|
||||
return estimateIncomeEngineer;
|
||||
}
|
||||
|
||||
public void setEstimateIncomeEngineer(BigDecimal estimateIncomeEngineer) {
|
||||
this.estimateIncomeEngineer = estimateIncomeEngineer;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetIncomeService() {
|
||||
return budgetIncomeService;
|
||||
}
|
||||
|
||||
public void setBudgetIncomeService(BigDecimal budgetIncomeService) {
|
||||
this.budgetIncomeService = budgetIncomeService;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateIncomeService() {
|
||||
return estimateIncomeService;
|
||||
}
|
||||
|
||||
public void setEstimateIncomeService(BigDecimal estimateIncomeService) {
|
||||
this.estimateIncomeService = estimateIncomeService;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetCostPurchaseDevice() {
|
||||
return budgetCostPurchaseDevice;
|
||||
}
|
||||
|
||||
public void setBudgetCostPurchaseDevice(BigDecimal budgetCostPurchaseDevice) {
|
||||
this.budgetCostPurchaseDevice = budgetCostPurchaseDevice;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateCostPurchaseDevice() {
|
||||
return estimateCostPurchaseDevice;
|
||||
}
|
||||
|
||||
public void setEstimateCostPurchaseDevice(BigDecimal estimateCostPurchaseDevice) {
|
||||
this.estimateCostPurchaseDevice = estimateCostPurchaseDevice;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetCostPurchaseBuild() {
|
||||
return budgetCostPurchaseBuild;
|
||||
}
|
||||
|
||||
public void setBudgetCostPurchaseBuild(BigDecimal budgetCostPurchaseBuild) {
|
||||
this.budgetCostPurchaseBuild = budgetCostPurchaseBuild;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateCostPurchaseBuild() {
|
||||
return estimateCostPurchaseBuild;
|
||||
}
|
||||
|
||||
public void setEstimateCostPurchaseBuild(BigDecimal estimateCostPurchaseBuild) {
|
||||
this.estimateCostPurchaseBuild = estimateCostPurchaseBuild;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetCostPurchaseService() {
|
||||
return budgetCostPurchaseService;
|
||||
}
|
||||
|
||||
public void setBudgetCostPurchaseService(BigDecimal budgetCostPurchaseService) {
|
||||
this.budgetCostPurchaseService = budgetCostPurchaseService;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateCostPurchaseService() {
|
||||
return estimateCostPurchaseService;
|
||||
}
|
||||
|
||||
public void setEstimateCostPurchaseService(BigDecimal estimateCostPurchaseService) {
|
||||
this.estimateCostPurchaseService = estimateCostPurchaseService;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetCostPurchaseOther() {
|
||||
return budgetCostPurchaseOther;
|
||||
}
|
||||
|
||||
public void setBudgetCostPurchaseOther(BigDecimal budgetCostPurchaseOther) {
|
||||
this.budgetCostPurchaseOther = budgetCostPurchaseOther;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateCostPurchaseOther() {
|
||||
return estimateCostPurchaseOther;
|
||||
}
|
||||
|
||||
public void setEstimateCostPurchaseOther(BigDecimal estimateCostPurchaseOther) {
|
||||
this.estimateCostPurchaseOther = estimateCostPurchaseOther;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetCostProjectManage() {
|
||||
return budgetCostProjectManage;
|
||||
}
|
||||
|
||||
public void setBudgetCostProjectManage(BigDecimal budgetCostProjectManage) {
|
||||
this.budgetCostProjectManage = budgetCostProjectManage;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateCostProjectManage() {
|
||||
return estimateCostProjectManage;
|
||||
}
|
||||
|
||||
public void setEstimateCostProjectManage(BigDecimal estimateCostProjectManage) {
|
||||
this.estimateCostProjectManage = estimateCostProjectManage;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetCostOther() {
|
||||
return budgetCostOther;
|
||||
}
|
||||
|
||||
public void setBudgetCostOther(BigDecimal budgetCostOther) {
|
||||
this.budgetCostOther = budgetCostOther;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateCostOther() {
|
||||
return estimateCostOther;
|
||||
}
|
||||
|
||||
public void setEstimateCostOther(BigDecimal estimateCostOther) {
|
||||
this.estimateCostOther = estimateCostOther;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateCostExpropriation() {
|
||||
return estimateCostExpropriation;
|
||||
}
|
||||
|
||||
public void setEstimateCostExpropriation(BigDecimal estimateCostExpropriation) {
|
||||
this.estimateCostExpropriation = estimateCostExpropriation;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetCostExpropriation() {
|
||||
return budgetCostExpropriation;
|
||||
}
|
||||
|
||||
public void setBudgetCostExpropriation(BigDecimal budgetCostExpropriation) {
|
||||
this.budgetCostExpropriation = budgetCostExpropriation;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateCostCompanyManage() {
|
||||
return estimateCostCompanyManage;
|
||||
}
|
||||
|
||||
public void setEstimateCostCompanyManage(BigDecimal estimateCostCompanyManage) {
|
||||
this.estimateCostCompanyManage = estimateCostCompanyManage;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetCostCompanyManage() {
|
||||
return budgetCostCompanyManage;
|
||||
}
|
||||
|
||||
public void setBudgetCostCompanyManage(BigDecimal budgetCostCompanyManage) {
|
||||
this.budgetCostCompanyManage = budgetCostCompanyManage;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateGrossProfit() {
|
||||
return estimateGrossProfit;
|
||||
}
|
||||
|
||||
public void setEstimateGrossProfit(BigDecimal estimateGrossProfit) {
|
||||
this.estimateGrossProfit = estimateGrossProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetGrossProfit() {
|
||||
return budgetGrossProfit;
|
||||
}
|
||||
|
||||
public void setBudgetGrossProfit(BigDecimal budgetGrossProfit) {
|
||||
this.budgetGrossProfit = budgetGrossProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getEstimateContributionProfit() {
|
||||
return estimateContributionProfit;
|
||||
}
|
||||
|
||||
public void setEstimateContributionProfit(BigDecimal estimateContributionProfit) {
|
||||
this.estimateContributionProfit = estimateContributionProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetContributionProfit() {
|
||||
return budgetContributionProfit;
|
||||
}
|
||||
|
||||
public void setBudgetContributionProfit(BigDecimal budgetContributionProfit) {
|
||||
this.budgetContributionProfit = budgetContributionProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetSaleIncomeCash() {
|
||||
return budgetSaleIncomeCash;
|
||||
}
|
||||
|
||||
public void setBudgetSaleIncomeCash(BigDecimal budgetSaleIncomeCash) {
|
||||
this.budgetSaleIncomeCash = budgetSaleIncomeCash;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetEarnestMoneyIncome() {
|
||||
return budgetEarnestMoneyIncome;
|
||||
}
|
||||
|
||||
public void setBudgetEarnestMoneyIncome(BigDecimal budgetEarnestMoneyIncome) {
|
||||
this.budgetEarnestMoneyIncome = budgetEarnestMoneyIncome;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetPurchaseCost() {
|
||||
return budgetPurchaseCost;
|
||||
}
|
||||
|
||||
public void setBudgetPurchaseCost(BigDecimal budgetPurchaseCost) {
|
||||
this.budgetPurchaseCost = budgetPurchaseCost;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetEarnestMoneyCost() {
|
||||
return budgetEarnestMoneyCost;
|
||||
}
|
||||
|
||||
public void setBudgetEarnestMoneyCost(BigDecimal budgetEarnestMoneyCost) {
|
||||
this.budgetEarnestMoneyCost = budgetEarnestMoneyCost;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetNetCashFlow() {
|
||||
return budgetNetCashFlow;
|
||||
}
|
||||
|
||||
public void setBudgetNetCashFlow(BigDecimal budgetNetCashFlow) {
|
||||
this.budgetNetCashFlow = budgetNetCashFlow;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetFinancingCapitalInflow() {
|
||||
return budgetFinancingCapitalInflow;
|
||||
}
|
||||
|
||||
public void setBudgetFinancingCapitalInflow(BigDecimal budgetFinancingCapitalInflow) {
|
||||
this.budgetFinancingCapitalInflow = budgetFinancingCapitalInflow;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetFinancingCapitalOutflow() {
|
||||
return budgetFinancingCapitalOutflow;
|
||||
}
|
||||
|
||||
public void setBudgetFinancingCapitalOutflow(BigDecimal budgetFinancingCapitalOutflow) {
|
||||
this.budgetFinancingCapitalOutflow = budgetFinancingCapitalOutflow;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetFinancingCapitalCashflow() {
|
||||
return budgetFinancingCapitalCashflow;
|
||||
}
|
||||
|
||||
public void setBudgetFinancingCapitalCashflow(BigDecimal budgetFinancingCapitalCashflow) {
|
||||
this.budgetFinancingCapitalCashflow = budgetFinancingCapitalCashflow;
|
||||
}
|
||||
|
||||
public BigDecimal getBudgetNetIncreaseMonetaryFunds() {
|
||||
return budgetNetIncreaseMonetaryFunds;
|
||||
}
|
||||
|
||||
public void setBudgetNetIncreaseMonetaryFunds(BigDecimal budgetNetIncreaseMonetaryFunds) {
|
||||
this.budgetNetIncreaseMonetaryFunds = budgetNetIncreaseMonetaryFunds;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public enum SignTypeEnum {
|
||||
PLAN_O(-1,""),
|
||||
PLAN_A(1,"是"),
|
||||
PLAN_B(2,"否");
|
||||
|
||||
private int signType;
|
||||
private String signTypeStr;
|
||||
|
||||
private SignTypeEnum(int signType, String signTypeStr) {
|
||||
this.signType = signType;
|
||||
this.signTypeStr = signTypeStr;
|
||||
}
|
||||
|
||||
public int getSignType() {
|
||||
return signType;
|
||||
}
|
||||
|
||||
public void setSignType(int signType) {
|
||||
this.signType = signType;
|
||||
}
|
||||
|
||||
public String getSignTypeStr() {
|
||||
return signTypeStr;
|
||||
}
|
||||
|
||||
public void setSignTypeStr(String signTypeStr) {
|
||||
this.signTypeStr = signTypeStr;
|
||||
}
|
||||
|
||||
public static SignTypeEnum parseSignType(int signType){
|
||||
if(signType == 1){
|
||||
return PLAN_A;
|
||||
}
|
||||
if(signType == 2){
|
||||
return PLAN_B;
|
||||
}
|
||||
return PLAN_O;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StatisticsBean {
|
||||
|
||||
private List<PrimaryIndicatorBean> primaryIndicatorBeanList;
|
||||
|
||||
private List<ProfitAndLossBean> profitAndLossBeanList;
|
||||
|
||||
private List<CashFlowStatisticsBean> cashFlowStatisticsBeanList;
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public enum StatusEnum {
|
||||
ESTIMATE_ACCOUNTS(1,"项目创建(概算)"),
|
||||
BUDGET_ACCOUNTS(5,"预算"),
|
||||
SETTLE_ACCOUNTS(10,"结算"),
|
||||
FINAL_ACCOUNTS(15,"决算");
|
||||
|
||||
private int status;
|
||||
private String statusDesc;
|
||||
|
||||
private StatusEnum(int status, String statusDesc) {
|
||||
this.status = status;
|
||||
this.statusDesc = statusDesc;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatusDesc() {
|
||||
return statusDesc;
|
||||
}
|
||||
|
||||
public void setStatusDesc(String statusDesc) {
|
||||
this.statusDesc = statusDesc;
|
||||
}
|
||||
|
||||
public static StatusEnum parseStatus(int status){
|
||||
if(status == 1){
|
||||
return ESTIMATE_ACCOUNTS;
|
||||
}
|
||||
if(status == 5){
|
||||
return BUDGET_ACCOUNTS;
|
||||
}
|
||||
if(status == 10){
|
||||
return SETTLE_ACCOUNTS;
|
||||
}
|
||||
if(status == 15){
|
||||
return FINAL_ACCOUNTS;
|
||||
}
|
||||
throw new IllegalArgumentException("Unkown status:"+status);
|
||||
}
|
||||
|
||||
|
||||
public static StatusEnum parseByProcDefId(String proDefId){
|
||||
if(proDefId.startsWith(ActProcessKeyEnum.ESTIMATE.getKey())){
|
||||
return ESTIMATE_ACCOUNTS;
|
||||
}
|
||||
if(proDefId.startsWith(ActProcessKeyEnum.BUDGET.getKey())){
|
||||
return BUDGET_ACCOUNTS;
|
||||
}
|
||||
if(proDefId.startsWith(ActProcessKeyEnum.SETTLE.getKey())){
|
||||
return SETTLE_ACCOUNTS;
|
||||
}
|
||||
if(proDefId.startsWith(ActProcessKeyEnum.FINAL.getKey())){
|
||||
return FINAL_ACCOUNTS;
|
||||
}
|
||||
throw new IllegalArgumentException("Unkown proDefId:"+ proDefId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public enum TypeEnum {
|
||||
PROJECT_INTEGRATION(1,"工程集成类"),
|
||||
DEVICE_INTEGRATION(2,"设备集成类"),
|
||||
STRATEGIC_PARTNER(3,"工程集成类");
|
||||
|
||||
private int type;
|
||||
private String typeDesc;
|
||||
|
||||
private TypeEnum(int type, String typeDesc) {
|
||||
this.type = type;
|
||||
this.typeDesc = typeDesc;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTypeDesc() {
|
||||
return typeDesc;
|
||||
}
|
||||
|
||||
public void setTypeDesc(String typeDesc) {
|
||||
this.typeDesc = typeDesc;
|
||||
}
|
||||
|
||||
public static TypeEnum parseType(int type){
|
||||
if(type == 1){
|
||||
return PROJECT_INTEGRATION;
|
||||
}
|
||||
if(type == 2){
|
||||
return DEVICE_INTEGRATION;
|
||||
}
|
||||
if(type == 3){
|
||||
return STRATEGIC_PARTNER;
|
||||
}
|
||||
throw new IllegalArgumentException("Unkown type:"+type);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public enum UnderwrittenModeEnum {
|
||||
PLAN_O(-1,""),
|
||||
PLAN_A(1,"不垫资"),
|
||||
// PLAN_B(2,"不垫资(背靠背)"),
|
||||
PLAN_C(3,"垫资(账期覆盖)"),
|
||||
PLAN_D(4,"垫资(账期不覆盖)");
|
||||
|
||||
private int underwrittenMode;
|
||||
private String underwrittenModeStr;
|
||||
|
||||
private UnderwrittenModeEnum(int underwrittenMode, String underwrittenModeStr) {
|
||||
this.underwrittenMode = underwrittenMode;
|
||||
this.underwrittenModeStr = underwrittenModeStr;
|
||||
}
|
||||
|
||||
public int getUnderwrittenMode() {
|
||||
return underwrittenMode;
|
||||
}
|
||||
|
||||
public void setUnderwrittenMode(int underwrittenMode) {
|
||||
this.underwrittenMode = underwrittenMode;
|
||||
}
|
||||
|
||||
public String getUnderwrittenModeStr() {
|
||||
return underwrittenModeStr;
|
||||
}
|
||||
|
||||
public void setUnderwrittenModeStr(String underwrittenModeStr) {
|
||||
this.underwrittenModeStr = underwrittenModeStr;
|
||||
}
|
||||
|
||||
public static UnderwrittenModeEnum parseUnderwrittenMode(int underwrittenMode){
|
||||
if(underwrittenMode == 1){
|
||||
return PLAN_A;
|
||||
}
|
||||
// if(underwrittenMode == 2){
|
||||
// return PLAN_B;
|
||||
// }
|
||||
if(underwrittenMode == 3){
|
||||
return PLAN_C;
|
||||
}
|
||||
if(underwrittenMode == 4){
|
||||
return PLAN_D;
|
||||
}
|
||||
throw new IllegalArgumentException("Unkown underwrittenMode:"+underwrittenMode);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
/**
|
||||
* { id:2, pId:0, name:"随意勾选 2", checked:true, open:true},
|
||||
* @author xiongshiyan at 2021/11/18 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
public class ZTreeNode {
|
||||
private String id;
|
||||
private String pId;
|
||||
private String name;
|
||||
private boolean checked = false;
|
||||
private boolean open = false;
|
||||
|
||||
public ZTreeNode(String id, String pId, String name, boolean checked, boolean open) {
|
||||
this.id = id;
|
||||
this.pId = pId;
|
||||
this.name = name;
|
||||
this.checked = checked;
|
||||
this.open = open;
|
||||
}
|
||||
|
||||
public ZTreeNode(String id, String pId, String name) {
|
||||
this.id = id;
|
||||
this.pId = pId;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getpId() {
|
||||
return pId;
|
||||
}
|
||||
|
||||
public void setpId(String pId) {
|
||||
this.pId = pId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
this.checked = checked;
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return open;
|
||||
}
|
||||
|
||||
public void setOpen(boolean open) {
|
||||
this.open = open;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
package cn.palmte.work.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.http.converter.HttpMessageNotWritableException;
|
||||
import org.springframework.transaction.TransactionSystemException;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.HttpMediaTypeNotSupportedException;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||
import org.springframework.web.multipart.MultipartException;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.palmte.work.ErrorMessage;
|
||||
import cn.palmte.work.ErrorMessageException;
|
||||
import cn.palmte.work.Json;
|
||||
import cn.palmte.work.Result;
|
||||
import cn.palmte.work.ValidationError;
|
||||
import cn.palmte.work.controller.backend.ProcessController;
|
||||
|
||||
/**
|
||||
* 异常处理
|
||||
*
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/30 15:24
|
||||
*/
|
||||
@RestControllerAdvice(assignableTypes = ProcessController.class)
|
||||
public class ApplicationExceptionHandler {
|
||||
private static final Logger log = LoggerFactory.getLogger(ApplicationExceptionHandler.class);
|
||||
|
||||
public static final ErrorMessage argsErrorMessage = ErrorMessage.failed("参数错误");
|
||||
public static final ErrorMessage sizeExceeded = ErrorMessage.failed("上传文件大小超出限制");
|
||||
public static final ErrorMessage methodNotSupported = ErrorMessage.failed("请求方式不支持");
|
||||
public static final ErrorMessage internalServerError = ErrorMessage.failed("服务器内部异常");
|
||||
public static final ErrorMessage notWritableError = ErrorMessage.failed("数据无法正常返回到客户端");
|
||||
|
||||
@ExceptionHandler(ErrorMessageException.class)
|
||||
public ResponseEntity<ErrorMessage> errorMessage(ErrorMessageException errorMessage) {
|
||||
HttpStatus httpStatus = errorMessage.getStatus();
|
||||
return ResponseEntity.status(httpStatus)
|
||||
.body(ErrorMessage.failed(errorMessage.getMessage()));
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(IllegalArgumentException.class)
|
||||
public ErrorMessage badRequest(IllegalArgumentException exception) {
|
||||
return ErrorMessage.failed(exception.getMessage());
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler({ MaxUploadSizeExceededException.class })
|
||||
public ErrorMessage badRequest() {
|
||||
return sizeExceeded;
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
public ErrorMessage methodNotSupported() {
|
||||
return methodNotSupported;
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public ErrorMessage error(Exception exception) {
|
||||
log.error("An Exception occurred", exception);
|
||||
if (exception instanceof SQLException) {
|
||||
return internalServerError;
|
||||
}
|
||||
if (exception instanceof HttpMessageNotWritableException) {
|
||||
return notWritableError;
|
||||
}
|
||||
if (exception instanceof TransactionSystemException) {
|
||||
return ErrorMessage.failed("数据库出错");
|
||||
}
|
||||
return ErrorMessage.failed(exception.getMessage());
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
|
||||
public ErrorMessage typeMismatch(MethodArgumentTypeMismatchException mismatch) {
|
||||
return ErrorMessage.failed("参数'" + mismatch.getName() + "'不能转换到对应类型");
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(MissingServletRequestParameterException.class)
|
||||
public ErrorMessage parameterError(MissingServletRequestParameterException e) {
|
||||
return ErrorMessage.failed("缺少参数'" + e.getParameterName() + "'");
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler({
|
||||
MultipartException.class,
|
||||
HttpMessageNotReadableException.class,
|
||||
HttpMediaTypeNotSupportedException.class
|
||||
})
|
||||
public ErrorMessage messageNotReadable() {
|
||||
return argsErrorMessage;
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler({ BindException.class, MethodArgumentNotValidException.class })
|
||||
public Result validExceptionHandler(Exception e) {
|
||||
|
||||
BindingResult result;
|
||||
if (e instanceof MethodArgumentNotValidException) {
|
||||
result = ((MethodArgumentNotValidException) e).getBindingResult();
|
||||
}
|
||||
else if (e instanceof BindException) {
|
||||
result = (BindingResult) e;
|
||||
}
|
||||
else {
|
||||
return ErrorMessage.failed();
|
||||
}
|
||||
List<ObjectError> allErrors = result.getAllErrors();
|
||||
Map<String, String> model = new HashMap<>(16);
|
||||
|
||||
for (ObjectError error : allErrors) {
|
||||
if (error instanceof FieldError) {
|
||||
FieldError fieldError = (FieldError) error;
|
||||
String field = fieldError.getField();
|
||||
String defaultMessage = error.getDefaultMessage();
|
||||
model.put(field, defaultMessage);
|
||||
// log.error("[{}] -> [{}]", field, defaultMessage);
|
||||
}
|
||||
}
|
||||
return ValidationError.failed(model);
|
||||
}
|
||||
|
||||
@ExceptionHandler(NullPointerException.class)
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public Json nullPointer(NullPointerException exception) {
|
||||
log.error("An Exception occurred", exception);
|
||||
final StackTraceElement[] stackTrace = exception.getStackTrace();
|
||||
if (ObjectUtils.isEmpty(stackTrace)) {
|
||||
return Json.failed("空指针", "暂无堆栈信息");
|
||||
}
|
||||
return Json.failed("空指针", stackTrace[0]);
|
||||
}
|
||||
|
||||
@ExceptionHandler(DataAccessException.class)
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public ErrorMessage dataAccessException(DataAccessException accessException) {
|
||||
String message = getDataAccessMessage(accessException.getCause());
|
||||
log.error(message, accessException);
|
||||
return ErrorMessage.failed(message);
|
||||
}
|
||||
|
||||
String getDataAccessMessage(Throwable cause) {
|
||||
return "数据库出错";
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ExceptionHandler(DataAccessResourceFailureException.class)
|
||||
public ErrorMessage dataAccessException(DataAccessResourceFailureException accessException) {
|
||||
log.error("数据库连接出错", accessException);
|
||||
return ErrorMessage.failed("数据库连接出错");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package cn.palmte.work.config;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 注入配置属性
|
||||
*
|
||||
* @author pengqiang
|
||||
* @date 2018/6/26
|
||||
*/
|
||||
@Component
|
||||
public class ConfigProperties {
|
||||
|
||||
/**
|
||||
* 上传路径
|
||||
*/
|
||||
//@Value("${upload.path}")
|
||||
private String uploadPath = "/mnt/dzg/image";
|
||||
/**
|
||||
* 上传前缀
|
||||
*/
|
||||
//@Value("${upload.prefix}")
|
||||
private String uploadPrefix = "/upload";
|
||||
|
||||
/**
|
||||
* admin服务器域名
|
||||
* 格式: https://dzgtest.palmte.cn
|
||||
*/
|
||||
//@Value("${admin.domain}")
|
||||
private String adminDomain = "";
|
||||
|
||||
public String getUploadPath() {
|
||||
return uploadPath;
|
||||
}
|
||||
|
||||
public String getUploadPrefix() {
|
||||
return uploadPrefix;
|
||||
}
|
||||
|
||||
public String getAdminDomain() {
|
||||
return adminDomain;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package cn.palmte.work.config;
|
||||
|
||||
/**
|
||||
* 数据源等信息常量化
|
||||
* @author xiongshiyan
|
||||
*/
|
||||
public class Constant {
|
||||
public static final String PAGINATION = "pagination";
|
||||
public static final String PRIVATEKEY = "privatekey";
|
||||
public static final String PUBLICKEY = "publickey";
|
||||
public static final String HEADER_TOKEN = "token";
|
||||
public static final String API_TOKEN_MANAGER = "apiTokenManager";
|
||||
public static final String PC_TOKEN_MANAGER = "pcTokenManager";
|
||||
public static final String API_ERROR_COUNT_MANAGER = "apiErrorCountManager";
|
||||
public static final String PC_ERROR_COUNT_MANAGER = "pcErrorCountManager";
|
||||
public static final String API_CAPTCHA_MANGER = "apiCaptchaManger";
|
||||
public static final String PC_CAPTCHA_MANGER = "pcCaptchaManger";
|
||||
|
||||
public static final String PREFIX_API_V3 = "/api/v3";
|
||||
public static final String PREFIX_API_PC = "/api/pc";
|
||||
public static final String PREFIX_API_DRAG = "/api/drag";
|
||||
|
||||
private Constant() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 全局状态码
|
||||
*/
|
||||
public static final class Status {
|
||||
private Status() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static final int STATUS_SUCCESS = 0;
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static final int STATUS_FAILED = 1;
|
||||
/**
|
||||
* 异常
|
||||
*/
|
||||
public static final int STATUS_EXCEPTION = 2;
|
||||
/**
|
||||
* 提示登录
|
||||
*/
|
||||
public static final int STATUS_PROMPT_LOGIN = 1009;
|
||||
public static final int STATUS_PROMPT_UNAUTH = 1010;
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static final int STATUS_SUCCESS = 0;
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static final int STATUS_FAILED = 1;
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package cn.palmte.work.config;
|
||||
|
||||
import cn.palmte.work.config.interceptor.TokenLoggingInterceptor;
|
||||
import cn.palmte.work.utils.StrKit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
/**
|
||||
* 配置拦截器等
|
||||
* @author xiongshiyan
|
||||
*/
|
||||
@Component
|
||||
public class GoodWebAppConfigurer extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private TokenLoggingInterceptor tokenLoggingInterceptor;
|
||||
|
||||
/**
|
||||
* 排除某些url不需要校验
|
||||
*/
|
||||
@Value("${fourcal.excluded.client.urls}")
|
||||
private String excludesClientUrls;
|
||||
@Value("${fourcal.excluded.pc.urls}")
|
||||
private String excludesPCUrls;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
/**拦截任意URL,打印token header参数*/
|
||||
addInterceptor(registry , tokenLoggingInterceptor , "" , "/**");
|
||||
|
||||
/**拦截所有排除指定的*/
|
||||
}
|
||||
private void addInterceptor(InterceptorRegistry registry , HandlerInterceptor handlerInterceptor , String excludeUrls , String... addPartterns) {
|
||||
InterceptorRegistration registration = registry.addInterceptor(handlerInterceptor)
|
||||
.addPathPatterns(addPartterns);
|
||||
String[] p = excludeUrls.split(",");
|
||||
StrKit.trim(p);
|
||||
if( p.length > 0 ){
|
||||
registration.excludePathPatterns(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 允许跨域
|
||||
*/
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedHeaders("*")
|
||||
.allowedOrigins("*")
|
||||
.allowedMethods("GET", "POST", "DELETE", "PUT", "OPTIONS")
|
||||
.allowCredentials(false).maxAge(3600);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package cn.palmte.work.config;
|
||||
|
||||
import cn.palmte.work.security.ReplaceSpecialCharFilter;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import top.jfunc.http.SmartHttpClient;
|
||||
import top.jfunc.http.smart.JdkSmartHttpClient;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2020/9/30 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
@Configuration
|
||||
public class HttpConfig {
|
||||
@Bean
|
||||
public SmartHttpClient smartHttpClient(){
|
||||
return new JdkSmartHttpClient();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xss过滤拦截器
|
||||
*/
|
||||
@Bean
|
||||
public FilterRegistrationBean xssFilterRegistrationBean() {
|
||||
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
|
||||
filterRegistrationBean.setFilter(new ReplaceSpecialCharFilter());
|
||||
filterRegistrationBean.setOrder(1);
|
||||
filterRegistrationBean.setEnabled(true);
|
||||
filterRegistrationBean.addUrlPatterns("/*");
|
||||
Map<String, String> initParameters = new HashMap<>();
|
||||
initParameters.put("includes", "/fourcal/admin/err");
|
||||
filterRegistrationBean.setInitParameters(initParameters);
|
||||
return filterRegistrationBean;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package cn.palmte.work.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import top.jfunc.common.db.utils.Pagination;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2018/7/23 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
@Configuration
|
||||
public class PaginationConfig {
|
||||
|
||||
@PersistenceContext
|
||||
@Autowired
|
||||
private EntityManager entityManagerPrimary;
|
||||
|
||||
///错误的注入方式
|
||||
/*@Primary
|
||||
@Bean(Constant.PRIMARY_PAGINATION)
|
||||
public Pagination primary(@Qualifier(Constant.ENTITY_MANAGER_PRIMARY_DB) EntityManager entityManager){
|
||||
return new Pagination(entityManager);
|
||||
}*/
|
||||
@Primary
|
||||
@Bean
|
||||
public Pagination primaryPagination(){
|
||||
return new Pagination(entityManagerPrimary);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package cn.palmte.work.config;
|
||||
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.model.AdminRepository;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.model.ProjectRepository;
|
||||
import cn.palmte.work.service.ActProcDefService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Configuration //1.主要用于标记配置类,兼备Component的效果。
|
||||
@EnableScheduling // 2.开启定时任务
|
||||
public class StaticScheduleTask {
|
||||
private static final Logger logger = LoggerFactory.getLogger(StaticScheduleTask.class);
|
||||
|
||||
@Autowired
|
||||
public AdminRepository adminRepository;
|
||||
|
||||
@Autowired
|
||||
public ProjectRepository projectRepository;
|
||||
|
||||
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
private void temp() throws Exception {
|
||||
}
|
||||
|
||||
/*@Scheduled(cron = "0 0/1 * * * ?")
|
||||
private void changeUserName() throws Exception {
|
||||
|
||||
logger.info("更新项目创建者姓名开始");
|
||||
List<Project> all = projectRepository.findAll();
|
||||
for (Project project : all) {
|
||||
logger.info("更新前:"+project.getCreatorName());
|
||||
Admin one = adminRepository.findOne(project.getCreatorId());
|
||||
project.setCreatorName(one.getRealName());
|
||||
Project project1 = projectRepository.saveAndFlush(project);
|
||||
logger.info("更新后:"+project1.getCreatorName());
|
||||
}
|
||||
logger.info("更新项目创建者姓名结束");
|
||||
}*/
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package cn.palmte.work.config;
|
||||
|
||||
import cn.palmte.work.service.map.MemorySimpleMap;
|
||||
import cn.palmte.work.service.map.SimpleMap;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2018/8/14 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
@Configuration
|
||||
public class SystemConfigWithMemory {
|
||||
|
||||
@Value("${fourcal.token.api.prefix}")
|
||||
private String apiTokenPrefix;
|
||||
|
||||
@Value("#{${fourcal.token.api.expires}}")
|
||||
private long apiExpires;
|
||||
|
||||
@Value("${fourcal.token.pc.prefix}")
|
||||
private String pcTokenPrefix;
|
||||
|
||||
@Value("#{${fourcal.token.pc.expires}}")
|
||||
private long pcExpires;
|
||||
|
||||
|
||||
@Bean
|
||||
public SimpleMap<String, String> simpleMap() {
|
||||
return new MemorySimpleMap<>();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package cn.palmte.work.config;
|
||||
|
||||
/*import cn.palmte.work.model.Manager;
|
||||
import cn.palmte.work.service.CaptchaCodeService;
|
||||
import cn.palmte.work.service.token.redis.ApiTokenManager;
|
||||
import cn.palmte.work.service.token.redis.RedisCaptchaManager;
|
||||
import cn.palmte.work.service.token.redis.RedisErrorCountManager;
|
||||
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
import top.jfunc.token.CaptchaManger;
|
||||
import top.jfunc.token.ErrorCountManager;
|
||||
import top.jfunc.token.TokenManager;
|
||||
|
||||
import static cn.palmte.work.config.SystemConfigWithMemory.API_TOKEN_MANAGER;*/
|
||||
|
||||
|
||||
/*@Configuration
|
||||
public class SystemConfigWithRedis {
|
||||
|
||||
@Autowired(required = false)
|
||||
RedisConnectionFactory connectionFactory;
|
||||
|
||||
@Bean(name = "stringRedisTemplate")
|
||||
public StringRedisTemplate stringRedisTemplate() {
|
||||
return new StringRedisTemplate(connectionFactory);
|
||||
}
|
||||
|
||||
@Bean(name = "redisTemplate")
|
||||
public RedisTemplate<Object, Object> redisTemplate(){
|
||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(connectionFactory);
|
||||
//避免key出现乱码
|
||||
template.setKeySerializer(new StringRedisSerializer());
|
||||
//value使用FastJson转换
|
||||
template.setValueSerializer(new GenericFastJsonRedisSerializer());
|
||||
template.setHashKeySerializer(new StringRedisSerializer());
|
||||
template.setHashValueSerializer(new GenericFastJsonRedisSerializer());
|
||||
return template;
|
||||
}
|
||||
@Value("${fourcal.token.api.prefix}")
|
||||
private String apiTokenPrefix;
|
||||
|
||||
@Value("#{${fourcal.token.api.expires}}")
|
||||
private long apiExpires;
|
||||
|
||||
|
||||
@Bean(Constant.API_TOKEN_MANAGER)
|
||||
public TokenManager<Manager> apiTokenManagerRedis(){
|
||||
ApiTokenManager apiTokenManager = new ApiTokenManager();
|
||||
apiTokenManager.setRedisTemplate(redisTemplate());
|
||||
apiTokenManager.setApiExpires(apiExpires);
|
||||
apiTokenManager.setMulti(true);
|
||||
apiTokenManager.setTokenPrefix(apiTokenPrefix);
|
||||
return apiTokenManager;
|
||||
}
|
||||
@Bean
|
||||
public ErrorCountManager errorCountManager() {
|
||||
RedisErrorCountManager redisErrorCountManager = new RedisErrorCountManager();
|
||||
redisErrorCountManager.setThreshold(3);
|
||||
redisErrorCountManager.setRedisTemplate(redisTemplate());
|
||||
return redisErrorCountManager;
|
||||
}
|
||||
@Bean
|
||||
public CaptchaManger captchaManger(@Autowired CaptchaCodeService captchaCodeService) {
|
||||
RedisCaptchaManager captchaManger = new RedisCaptchaManager();
|
||||
captchaManger.setRedisTemplate(redisTemplate());
|
||||
captchaManger.setCaptchaCodeService(captchaCodeService);
|
||||
return captchaManger;
|
||||
}
|
||||
}*/
|
|
@ -0,0 +1,27 @@
|
|||
package cn.palmte.work.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "upload")
|
||||
public class UploadProperties {
|
||||
private String path;
|
||||
private String prefix;
|
||||
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
public void setPrefix(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程审批类型枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum ActApproveTypeEnum {
|
||||
APPROVAL_PASSED(2, "审核通过"),
|
||||
APPROVAL_UN_PASS(3, "审核不通过");
|
||||
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
||||
ActApproveTypeEnum(int type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static ActApproveTypeEnum ofType(int type) {
|
||||
if (type == APPROVAL_PASSED.getType()) {
|
||||
return APPROVAL_PASSED;
|
||||
} else if (type == APPROVAL_UN_PASS.getType()) {
|
||||
return APPROVAL_UN_PASS;
|
||||
} else {
|
||||
throw new ResponseException("不支持的审批类型【" + type + "】");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 审批人设置枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum ActCandidateTypeEnum {
|
||||
USER(0, "按用户设置审批人"),
|
||||
ROLE(1, "按角色设置审批人"),
|
||||
STARTER_LEADER(2, "按发起人部门领导设置审批人"),
|
||||
DEPT_LEADER(3, "按指定的部门领导设置审批人");
|
||||
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
||||
ActCandidateTypeEnum(int type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static ActCandidateTypeEnum ofType(int type) {
|
||||
if (type == USER.getType()) {
|
||||
return USER;
|
||||
} else if (type == ROLE.getType()) {
|
||||
return ROLE;
|
||||
} else if (type == STARTER_LEADER.getType()) {
|
||||
return STARTER_LEADER;
|
||||
} else if (type == DEPT_LEADER.getType()) {
|
||||
return DEPT_LEADER;
|
||||
} else {
|
||||
throw new ResponseException("不支持的类型【" + type + "】");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
public class ActConstant {
|
||||
|
||||
/**
|
||||
* 流程启动用户变量
|
||||
*/
|
||||
public static final String START_PROCESS_USERID = "startUserId";
|
||||
|
||||
/**
|
||||
* 部门领导id
|
||||
*/
|
||||
public static final String DEPT_LEADER_ID = "deptLeaderId";
|
||||
|
||||
/**
|
||||
* 单实例 或签
|
||||
*/
|
||||
public static final int TASK_TYPE_SINGE = 0;
|
||||
/**
|
||||
* 多实例 会签
|
||||
*/
|
||||
public static final int TASK_TYPE_MULTI = 1;
|
||||
|
||||
|
||||
public static final String PROCESS_TASKS_ESTIMATE = "填报概算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
||||
public static final String PROCESS_TASKS_BUDGET = "填报预算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
||||
public static final String PROCESS_TASKS_SETTLE = "填报结算#财务总监";
|
||||
public static final String PROCESS_TASKS_FINAL = "填报决算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
||||
|
||||
public static final String KEY_PROJECT_TYPE = "projectType";
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程定义key枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum ActProcessKeyEnum {
|
||||
ESTIMATE("estimate", "概算审批流程"),
|
||||
BUDGET("budget", "预算审批流程"),
|
||||
SETTLE("settle", "结算审批流程"),
|
||||
FINAL("final", "决算审批流程"),
|
||||
SALE_CONTRACT("saleContract", "销售合同审批流程"),
|
||||
BUSINESS_PURCHASE("businessPurchase", "业务采购审批流程");
|
||||
|
||||
|
||||
private String key;
|
||||
private String name;
|
||||
|
||||
ActProcessKeyEnum(String key, String name) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static ActProcessKeyEnum ofKey(String key) {
|
||||
if (ESTIMATE.getKey().equals(key)) {
|
||||
return ESTIMATE;
|
||||
} else if (BUDGET.getKey().equals(key)) {
|
||||
return BUDGET;
|
||||
} else if (SETTLE.getKey().equals(key)) {
|
||||
return SETTLE;
|
||||
} else if (FINAL.getKey().equals(key)) {
|
||||
return FINAL;
|
||||
} else if (SALE_CONTRACT.getKey().equals(key)) {
|
||||
return SALE_CONTRACT;
|
||||
} else if (BUSINESS_PURCHASE.getKey().equals(key)) {
|
||||
return BUSINESS_PURCHASE;
|
||||
} else {
|
||||
throw new ResponseException("不支持的流程key【" + key + "】");
|
||||
}
|
||||
}
|
||||
|
||||
public static ActProcessKeyEnum ofProcDefId(String proDefId) {
|
||||
if (proDefId.startsWith(ESTIMATE.getKey())) {
|
||||
return ESTIMATE;
|
||||
} else if (proDefId.startsWith(BUDGET.getKey())) {
|
||||
return BUDGET;
|
||||
} else if (proDefId.startsWith(SETTLE.getKey())) {
|
||||
return SETTLE;
|
||||
} else if (proDefId.startsWith(FINAL.getKey())) {
|
||||
return FINAL;
|
||||
} else if (proDefId.startsWith(SALE_CONTRACT.getKey())) {
|
||||
return SALE_CONTRACT;
|
||||
} else if (proDefId.startsWith(BUSINESS_PURCHASE.getKey())) {
|
||||
return BUSINESS_PURCHASE;
|
||||
} else {
|
||||
throw new ResponseException("不支持的流程key【" + proDefId + "】");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程里的项目类型枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum ActProjectTypeEnum {
|
||||
FOURCAL(0, "四算项目"),
|
||||
SALE_CONTRACT(1, "销售合同项目"),
|
||||
BUSINESS_PURCHASE(2, "业务采购项目");
|
||||
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
||||
ActProjectTypeEnum(int type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static ActProjectTypeEnum ofType(int type) {
|
||||
if (type == FOURCAL.getType()) {
|
||||
return FOURCAL;
|
||||
} else if (type == SALE_CONTRACT.getType()) {
|
||||
return SALE_CONTRACT;
|
||||
} else if (type == BUSINESS_PURCHASE.getType()) {
|
||||
return BUSINESS_PURCHASE;
|
||||
} else {
|
||||
throw new ResponseException("不支持的项目类型【" + type + "】");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程里的节点类型枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum ActTaskIndexEnum {
|
||||
END(-1, "结束节点"),
|
||||
COMMON(0, "除发起审批外的用户节点"),
|
||||
START(1, "开始节点"),
|
||||
FIRST_USER_TASK(2, "发起审批节点");
|
||||
|
||||
|
||||
private int index;
|
||||
private String name;
|
||||
|
||||
ActTaskIndexEnum(int index, String name) {
|
||||
this.index = index;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static ActTaskIndexEnum ofIndex(int index) {
|
||||
if (index == END.getIndex()) {
|
||||
return END;
|
||||
} else if (index == COMMON.getIndex()) {
|
||||
return COMMON;
|
||||
} else if (index == START.getIndex()) {
|
||||
return START;
|
||||
} else if (index == FIRST_USER_TASK.getIndex()) {
|
||||
return FIRST_USER_TASK;
|
||||
} else {
|
||||
throw new ResponseException("不支持的节点类型【" + index + "】");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
import org.activiti.engine.ProcessEngineConfiguration;
|
||||
import org.activiti.spring.SpringProcessEngineConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
||||
@Configuration
|
||||
public class ActivitiConfig {
|
||||
|
||||
@Autowired
|
||||
PlatformTransactionManager transactionManager;
|
||||
|
||||
@Autowired
|
||||
DataSource dataSource;
|
||||
|
||||
@Bean
|
||||
public SpringProcessEngineConfiguration getProcessEngineConfiguration() {
|
||||
SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
|
||||
config.setDataSource(dataSource);
|
||||
config.setTransactionManager(transactionManager);
|
||||
config.setDbHistoryUsed(true);
|
||||
config.setHistory("full");
|
||||
config.setActivityFontName("宋体");
|
||||
|
||||
//数据库更新策略
|
||||
//flase: 默认值。activiti在启动时,会对比数据库表中保存的版本,如果没有表或者版本不匹配,将抛出异常。(生产环境常用)
|
||||
//true: activiti会对数据库中所有表进行更新操作。如果表不存在,则自动创建。(开发时常用)
|
||||
//create_drop: 在activiti启动时创建表,在关闭时删除表(必须手动关闭引擎,才能删除表)。(单元测试常用)
|
||||
//drop-create: 在activiti启动时删除原来的旧表,然后在创建新表(不需要手动关闭引擎)。
|
||||
config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);
|
||||
return config;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
import org.activiti.engine.impl.cmd.NeedsActiveTaskCmd;
|
||||
import org.activiti.engine.impl.interceptor.CommandContext;
|
||||
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.TaskEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.TaskEntityManagerImpl;
|
||||
|
||||
/**
|
||||
* 删除当前运行时任务命令,并返回当前任务的执行对象id
|
||||
*/
|
||||
public class DeleteTaskCommand extends NeedsActiveTaskCmd<String> {
|
||||
public DeleteTaskCommand(String taskId) {
|
||||
super(taskId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String execute(CommandContext commandContext, TaskEntity currentTask) {
|
||||
//获取所需服务
|
||||
TaskEntityManagerImpl taskEntityManager = (TaskEntityManagerImpl) commandContext.getTaskEntityManager();
|
||||
//获取当前任务的来源任务及来源节点信息
|
||||
ExecutionEntity executionEntity = currentTask.getExecution();
|
||||
//删除当前任务,来源任务
|
||||
taskEntityManager.deleteTask(currentTask, "驳回", false, false);
|
||||
return executionEntity.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuspendedTaskException() {
|
||||
return "挂起的任务不能跳转";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
import org.activiti.bpmn.model.FlowNode;
|
||||
import org.activiti.bpmn.model.SequenceFlow;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.impl.interceptor.Command;
|
||||
import org.activiti.engine.impl.interceptor.CommandContext;
|
||||
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 根据提供节点和执行对象id,进行跳转命令
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public class JumpCommand implements Command<Void> {
|
||||
private FlowNode flowElement;
|
||||
private String executionId;
|
||||
|
||||
public JumpCommand(FlowNode flowElement, String executionId) {
|
||||
this.flowElement = flowElement;
|
||||
this.executionId = executionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void execute(CommandContext commandContext) {
|
||||
//获取目标节点的来源连线
|
||||
List<SequenceFlow> flows = flowElement.getIncomingFlows();
|
||||
if (flows == null || flows.isEmpty()) {
|
||||
throw new ActivitiException("回退错误,目标节点没有来源连线");
|
||||
}
|
||||
|
||||
//随便选一条连线来执行,当前执行计划为,从连线流转到目标节点,实现跳转
|
||||
ExecutionEntity executionEntity = commandContext.getExecutionEntityManager().findById(executionId);
|
||||
executionEntity.setCurrentFlowElement(flows.get(0));
|
||||
commandContext.getAgenda().planTakeOutgoingSequenceFlowsOperation(executionEntity, true);
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package cn.palmte.work.config.interceptor;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.config.Constant;
|
||||
import cn.palmte.work.config.log.LogExcluder;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
import top.jfunc.token.TokenManager;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
import static cn.palmte.work.config.Constant.HEADER_TOKEN;
|
||||
|
||||
|
||||
/**
|
||||
* @author xiongshiyan
|
||||
*/
|
||||
public abstract class AbstractLoginInterceptor extends HandlerInterceptorAdapter {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstractLoginInterceptor.class);
|
||||
|
||||
protected void printNeccery(HttpServletRequest request, LogExcluder logExcluder) {
|
||||
//拦截特殊字符
|
||||
String[] specialStr = {"|", "&", ";", "$", "%", "@", "'", "\"", "\\'", "\\\"", "<", ">", "(", ")", "+", "CR", "LF", ",", "\\"};
|
||||
for (String s : specialStr) {
|
||||
if (request.getRequestURI().contains(s)) {
|
||||
logger.info("uri:" + request.getRequestURI() + "含有特殊字符:" + s);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (logExcluder.needExcluded(request.getRequestURI())) {
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info("uri:" + request.getRequestURI() + ",token:" + request.getHeader(HEADER_TOKEN));
|
||||
}
|
||||
|
||||
protected boolean verifyLogin(HttpServletResponse response, TokenManager<?> tokenManager, String token, boolean cors) throws IOException {
|
||||
/// Object o = tokenManager.findByToken(token);
|
||||
boolean exist = tokenManager.existByToken(token);
|
||||
if (!exist) {
|
||||
promptLogin(response, cors);
|
||||
return false;
|
||||
} else {
|
||||
tokenManager.updateExpires(token);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean verifyLogin(HttpServletResponse response, TokenManager<String> tokenManager, String token, boolean cors, String phone) throws IOException {
|
||||
if (null == phone) {
|
||||
promptLogin(response, cors);
|
||||
return false;
|
||||
} else {
|
||||
tokenManager.updateExpires(token);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void promptLogin(HttpServletResponse response, boolean cors) throws IOException {
|
||||
response.setContentType("application/json;charset=utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
if (cors) {
|
||||
cors(response);
|
||||
}
|
||||
response.getWriter().write(JSON.toJSONString(ResponseMsg.buildMsg(Constant.Status.STATUS_PROMPT_LOGIN, "login first please", "")));
|
||||
}
|
||||
|
||||
protected void promptNoPermission(HttpServletResponse response, boolean cors) throws IOException {
|
||||
response.setContentType("application/json;charset=utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
if (cors) {
|
||||
cors(response);
|
||||
}
|
||||
response.getWriter().write(JSON.toJSONString(ResponseMsg.buildMsg(Constant.Status.STATUS_PROMPT_UNAUTH, "you have no permission", "")));
|
||||
}
|
||||
|
||||
protected void promptLogin(HttpServletResponse response) throws IOException {
|
||||
promptLogin(response, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理跨域
|
||||
*
|
||||
* @param response HttpServletResponse
|
||||
*/
|
||||
private void cors(HttpServletResponse response) {
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Access-Control-Allow-Headers", "*");
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST,GET,DELETE,PUT,OPTIONS");
|
||||
response.setHeader("Access-Control-Max-Age", "3600");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package cn.palmte.work.config.interceptor;
|
||||
|
||||
import cn.palmte.work.config.log.LogExcluder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 打印header中的token,有助于排查问题
|
||||
* @author xiongshiyan
|
||||
*/
|
||||
@Component
|
||||
public class TokenLoggingInterceptor extends AbstractLoginInterceptor {
|
||||
@Autowired
|
||||
private LogExcluder logExcluder;
|
||||
/**
|
||||
* 在Handler执行之前处理
|
||||
*/
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
printNeccery(request , logExcluder);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package cn.palmte.work.config.log;
|
||||
|
||||
import cn.palmte.work.utils.StrKit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 日志打印排除器,排除某些日志的打印
|
||||
* @author xiongshiyan at 2018/12/23 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
@Component
|
||||
public class LogExcluder implements InitializingBean{
|
||||
private static final Logger logger = LoggerFactory.getLogger(LogExcluder.class);
|
||||
|
||||
@Value("${server.context-path:/fourcal}")
|
||||
private String contextPath;
|
||||
@Value("${fourcal.log.excluded.urls:}")
|
||||
private String[] logExcludedUrls;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if(isEmpty(logExcludedUrls)){
|
||||
return;
|
||||
}
|
||||
StrKit.trim(logExcludedUrls);
|
||||
logger.info(Arrays.asList(logExcludedUrls).toString());
|
||||
}
|
||||
|
||||
public boolean needExcluded(String uri){
|
||||
//没有需要排除的
|
||||
if(isEmpty(logExcludedUrls)){
|
||||
return false;
|
||||
}
|
||||
|
||||
//去除前端轮询的
|
||||
if(uri.contains("api/pc/alarm/fetchAlarm")){
|
||||
return true;
|
||||
}
|
||||
|
||||
//去掉前缀
|
||||
uri = uri.replace(contextPath , "");
|
||||
return StrKit.targetInArray(logExcludedUrls , uri);
|
||||
}
|
||||
|
||||
private <T> boolean isEmpty(T[] array){
|
||||
return null == array || 0 == array.length;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package cn.palmte.work.config.log;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan
|
||||
* 统一打印日志
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@Order(1)
|
||||
public class WebLogAspect {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
|
||||
|
||||
@Autowired
|
||||
private LogExcluder logExcluder;
|
||||
|
||||
@Pointcut("execution(public * cn.palmte.work.controller..*.*(..))")
|
||||
public void webLog(){}
|
||||
|
||||
@Around(value = "webLog()")
|
||||
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
|
||||
if(logExcluder.needExcluded(request.getRequestURI())){
|
||||
return proceedingJoinPoint.proceed();
|
||||
}
|
||||
|
||||
logger.info("REQUEST : " + request.getRequestURI() + " : "
|
||||
+(proceedingJoinPoint.getSignature().getDeclaringTypeName() + "." + proceedingJoinPoint.getSignature().getName() + " : ")
|
||||
+ Arrays.toString(proceedingJoinPoint.getArgs()));
|
||||
|
||||
Object proceed = proceedingJoinPoint.proceed();
|
||||
|
||||
logger.info("RESPONSE : " + proceed);
|
||||
return proceed;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,277 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.config.Constant;
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.model.Dept;
|
||||
import cn.palmte.work.model.DeptRepository;
|
||||
import cn.palmte.work.model.UserPositionRepository;
|
||||
import cn.palmte.work.pojo.ModifyPasswordRequest;
|
||||
import cn.palmte.work.service.AccountService;
|
||||
import cn.palmte.work.service.AdminService;
|
||||
import cn.palmte.work.service.SysRoleService;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import cn.palmte.work.utils.excel.ExcelLogs;
|
||||
import cn.palmte.work.utils.excel.ExcelUtil;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.EncryptedDocumentException;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import top.jfunc.common.crypto.symmetric.DESAS;
|
||||
import top.jfunc.common.db.bean.Page;
|
||||
import top.jfunc.common.utils.CollectionUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/account")
|
||||
public class AccountController extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AccountController.class);
|
||||
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Autowired
|
||||
private DeptRepository deptRepository;
|
||||
|
||||
@Autowired
|
||||
private UserPositionRepository userPositionRepository;
|
||||
|
||||
@RequestMapping(value = "/updatePassword")
|
||||
@ResponseBody
|
||||
public ResponseMsg updatePassword(HttpServletRequest request, ModifyPasswordRequest modifyPasswordRequest) {
|
||||
ResponseMsg responseMsg = new ResponseMsg();
|
||||
try {
|
||||
String privateKey = (String) request.getSession().getAttribute(Constant.PRIVATEKEY);
|
||||
adminService.updatePassword(modifyPasswordRequest.getId(), modifyPasswordRequest.getPassword(),
|
||||
modifyPasswordRequest.getNewPassword(), privateKey);
|
||||
responseMsg.setStatus(0);
|
||||
responseMsg.setMsg("密码修改成功");
|
||||
} catch (Exception e) {
|
||||
responseMsg.setStatus(1);
|
||||
responseMsg.setMsg("密码修改失败:" + e.getMessage());
|
||||
}
|
||||
return responseMsg;
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
// 初始化参数
|
||||
setModel(keywords, model);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
model.put("deptList", deptRepository.findFirstLevelDept());
|
||||
model.put("positionList", userPositionRepository.findAll());
|
||||
Page<Admin> page = accountService.list(searchInfo, pageNumber, pageSize);
|
||||
List<Admin> list = page.getList();
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
|
||||
int offset = (pageNumber - 1) * pageSize;
|
||||
for (int i = 0 , size = list.size(); i < size; i++) {
|
||||
list.get(i).setTempId(i+1 + offset);
|
||||
}
|
||||
}
|
||||
model.put("pager", page);
|
||||
return "/admin/account_list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到新增页面
|
||||
*/
|
||||
@RequestMapping("/add")
|
||||
public String add(HttpServletRequest request, Map<String, Object> model) {
|
||||
genRSAKeyPair(request, model);
|
||||
model.put("userId", -1);
|
||||
model.put("account", new Admin());
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
model.put("deptList", deptRepository.findEnable());
|
||||
model.put("positionList", userPositionRepository.findAll());
|
||||
return "/admin/account_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转编辑页面
|
||||
*/
|
||||
@RequestMapping("/edit")
|
||||
public String edit(@RequestParam("userId") int userId, Map<String, Object> model) {
|
||||
Admin admin = accountService.findUserById(userId);
|
||||
model.put("account", admin);
|
||||
model.put("userId", userId);
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
model.put("deptList", deptRepository.findEnable());
|
||||
model.put("positionList", userPositionRepository.findAll());
|
||||
return "/admin/account_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或更新用户
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public String save(@RequestParam("userId") int userId, Admin admin, HttpServletRequest request, Map<String, Object> model) throws IOException {
|
||||
if (admin.getRoleId() <= 0) {
|
||||
model.put("errorMessage", "角色不能为空!");
|
||||
return "/common/error";
|
||||
}
|
||||
//获取验证用户信息
|
||||
String message = accountService.validateUserExistInfo(userId, admin);
|
||||
if (StringUtils.isNotEmpty(message)) {
|
||||
model.put("errorMessage", message);
|
||||
return "/common/error";
|
||||
}
|
||||
|
||||
try {
|
||||
HttpSession session = request.getSession();
|
||||
String privateKey = (String) session.getAttribute(Constant.PRIVATEKEY);
|
||||
|
||||
accountService.saveOrUpdateAccount(userId, admin.getRoleId(), admin, privateKey);
|
||||
} catch (Exception e) {
|
||||
model.put("errorMessage", "保存账号出错!请联系管理员处理");
|
||||
return "/common/error";
|
||||
}
|
||||
return "redirect:/account/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用、禁用用户
|
||||
*/
|
||||
@RequestMapping("/changeStatus")
|
||||
public ResponseMsg changeStatus(Admin admin) {
|
||||
boolean locked = accountService.changeStatus(admin.getId(), admin.getEnabled());
|
||||
if (locked) {
|
||||
return ResponseMsg.buildSuccessMsg("操作成功");
|
||||
} else {
|
||||
return ResponseMsg.buildFailedMsg("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据删除用户
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
@ResponseBody
|
||||
public ResponseMsg delete(@RequestParam("userId") int userId) {
|
||||
ResponseMsg responseMsg = new ResponseMsg();
|
||||
boolean deleted = accountService.deleteAccount(userId);
|
||||
|
||||
if (deleted) {
|
||||
responseMsg.setStatus(0);
|
||||
responseMsg.setMsg("删除成功");
|
||||
} else {
|
||||
responseMsg.setStatus(1);
|
||||
responseMsg.setMsg("删除失败");
|
||||
}
|
||||
return responseMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID重置用户密码
|
||||
*/
|
||||
@RequestMapping("/resetPassword")
|
||||
@ResponseBody
|
||||
public ResponseMsg resetPassword(@RequestParam("userId") int userId, HttpServletRequest request) {
|
||||
HttpSession session = request.getSession();
|
||||
String privateKey = (String) session.getAttribute(Constant.PRIVATEKEY);
|
||||
boolean flag = accountService.resetPassword(userId, privateKey);
|
||||
ResponseMsg responseMsg = new ResponseMsg();
|
||||
if (flag) {
|
||||
responseMsg.setStatus(0);
|
||||
responseMsg.setMsg("重置密码成功");
|
||||
} else {
|
||||
responseMsg.setStatus(1);
|
||||
responseMsg.setMsg("重置密码失败");
|
||||
}
|
||||
return responseMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码请求
|
||||
*/
|
||||
@RequestMapping("/password")
|
||||
public String password(HttpServletRequest request, Map<String, Object> model) {
|
||||
Admin admin = adminService.getAdminById(InterfaceUtil.getAdminId());
|
||||
try {
|
||||
String id = new DESAS().encrypt(admin.getId().toString());
|
||||
model.put("userId", id);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
model.put("SysUser", admin);
|
||||
genRSAKeyPair(request, model);
|
||||
return "/admin/account_password";
|
||||
}
|
||||
|
||||
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
|
||||
model.put("roleType", "-1");
|
||||
model.put("keywords", keywords);
|
||||
}
|
||||
|
||||
@RequestMapping("/export")
|
||||
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||
downloadHeader(httpServletResponse, Utils.generateExcelName("人员信息"), "application/octet-stream");
|
||||
String[] headers = {"四算系统登录账号", "手机号码", "姓名", "常驻地", "一级部门", "二级部门", "三级部门", "直接主管", "职位", "角色名称", "公司邮件地址"};
|
||||
String[] exportColumns = {"userName", "telephone", "realName", "workLocation", "deptFirstName", "deptSecondName", "deptThirdName", "directManager", "positionName", "roleName", "companyEmail"};
|
||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||
httpServletResponse.getOutputStream(), (pN, pS) -> accountService.list(searchInfo, pN, pS).getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*/
|
||||
@RequestMapping("/template")
|
||||
public void template(HttpServletResponse response) throws Exception {
|
||||
|
||||
String[] headers = new String[]{"四算系统登录账号", "手机号码", "姓名", "常驻地", "所属部门", "直接主管", "职位", "角色名称", "公司邮件地址"};
|
||||
downloadHeader(response, Utils.generateExcelName("人员信息批量导入模板"));
|
||||
ExportUtils exportUtils = new ExportUtils(headers);
|
||||
exportUtils.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入
|
||||
*/
|
||||
@RequestMapping("/batchImport")
|
||||
@ResponseBody
|
||||
public String batchImport(MultipartFile file) {
|
||||
try {
|
||||
ExcelLogs logs = new ExcelLogs();
|
||||
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
|
||||
"yyyy/MM/dd HH:mm:ss", logs, 0);
|
||||
synchronized (this) {
|
||||
return JSON.toJSONString(accountService.check(maps));
|
||||
}
|
||||
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
|
||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误,请上传excel 2003/2007格式文件"));
|
||||
} catch (Exception e) {
|
||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.service.ActModelService;
|
||||
|
||||
import cn.palmte.work.utils.ActUtil;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 流程模型
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/actModel")
|
||||
public class ActModelController extends BaseController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ActModelController.class);
|
||||
|
||||
@Autowired
|
||||
ActUtil actUtil;
|
||||
|
||||
@Autowired
|
||||
private ActModelService activitiModelService;
|
||||
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||
model.put("pager", activitiModelService.list(searchInfo, pageNumber, pageSize));
|
||||
model.put("userName", InterfaceUtil.getAdmin().getUserName());
|
||||
return "/admin/act_model_list";
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/add")
|
||||
public String add() {
|
||||
return "/admin/act_model_input";
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
public String save(HttpServletRequest request, Map<String, Object> model) {
|
||||
String procDefKey = request.getParameter("procDefKey");
|
||||
if (activitiModelService.findByProcDefKey(procDefKey) != null) {
|
||||
model.put("errorMessage", "流程标识已经存在!");
|
||||
return "/common/error";
|
||||
}
|
||||
try {
|
||||
activitiModelService.createModel(procDefKey, request.getParameter("modelName"));
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
}
|
||||
return "redirect:/actModel/list";
|
||||
}
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping(value = "/delete")
|
||||
public ResponseMsg delete(@RequestParam("ids") String ids) {
|
||||
if ("".equals(ids)) {
|
||||
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
|
||||
} else {
|
||||
String[] deleteIds = ids.split("#%#");
|
||||
for (String id : deleteIds) {
|
||||
activitiModelService.deleteModel(id);
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("删除成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 部署流程
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping(value = "/deploy")
|
||||
public ResponseMsg deploy(@RequestParam("id") String id) {
|
||||
try {
|
||||
activitiModelService.deploy(id);
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
return ResponseMsg.buildFailedMsg(e.getMessage());
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("部署成功");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.batik.transcoder.TranscoderInput;
|
||||
import org.apache.batik.transcoder.TranscoderOutput;
|
||||
import org.apache.batik.transcoder.image.PNGTranscoder;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 流程网页编辑器
|
||||
*/
|
||||
@RestController
|
||||
public class ActModelEditorController implements ModelDataJsonConstants {
|
||||
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(ActModelEditorController.class);
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 获取编辑器汉化文件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
|
||||
public String getStencilset() {
|
||||
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
|
||||
try {
|
||||
return IOUtils.toString(stencilsetStream, "utf-8");
|
||||
} catch (Exception e) {
|
||||
//logger.error("an exception happens in try catch statement", e);
|
||||
throw new ActivitiException("Error while loading stencil set", e);
|
||||
} finally {
|
||||
if (stencilsetStream != null) {
|
||||
try {
|
||||
stencilsetStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据模型id获取json格式的数据
|
||||
*
|
||||
* @param modelId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
|
||||
public ObjectNode getEditorJson(@PathVariable String modelId) {
|
||||
ObjectNode modelNode = null;
|
||||
Model model = repositoryService.getModel(modelId);
|
||||
if (model != null) {
|
||||
try {
|
||||
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
|
||||
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
|
||||
} else {
|
||||
modelNode = objectMapper.createObjectNode();
|
||||
modelNode.put(MODEL_NAME, model.getName());
|
||||
}
|
||||
modelNode.put(MODEL_ID, model.getId());
|
||||
String content = new String(repositoryService.getModelEditorSource(model.getId()), "utf-8");
|
||||
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(content);
|
||||
modelNode.put("model", editorJsonNode);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("an exception happens in try catch statement", e);
|
||||
throw new ActivitiException("Error creating model JSON", e);
|
||||
}
|
||||
}
|
||||
return modelNode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存模型数据
|
||||
*
|
||||
* @param modelId
|
||||
* @param values
|
||||
*/
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@RequestMapping(value = "/model/{modelId}/save", method = RequestMethod.PUT)
|
||||
public void saveModel(@PathVariable String modelId, @RequestParam MultiValueMap<String, String> values) {
|
||||
try {
|
||||
Model model = repositoryService.getModel(modelId);
|
||||
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
|
||||
modelJson.put(MODEL_NAME, values.getFirst("name"));
|
||||
modelJson.put(MODEL_DESCRIPTION, values.getFirst("description"));
|
||||
model.setMetaInfo(modelJson.toString());
|
||||
model.setName(values.getFirst("name"));
|
||||
repositoryService.saveModel(model);
|
||||
repositoryService.addModelEditorSource(model.getId(), values.getFirst("json_xml").getBytes("utf-8"));
|
||||
InputStream svgStream = new ByteArrayInputStream(values.getFirst("svg_xml").getBytes("utf-8"));
|
||||
TranscoderInput input = new TranscoderInput(svgStream);
|
||||
PNGTranscoder transcoder = new PNGTranscoder();
|
||||
// Setup output
|
||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
||||
TranscoderOutput output = new TranscoderOutput(outStream);
|
||||
// Do the transformation
|
||||
transcoder.transcode(input, output);
|
||||
final byte[] result = outStream.toByteArray();
|
||||
repositoryService.addModelEditorSourceExtra(model.getId(), result);
|
||||
outStream.close();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("an exception happens in try catch statement", e);
|
||||
throw new ActivitiException("Error saving model", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.service.ActProcDefService;
|
||||
import cn.palmte.work.utils.ActUtil;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 流程定义
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/actProcDef")
|
||||
public class ActProcDefController extends BaseController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ActProcDefController.class);
|
||||
|
||||
@Autowired
|
||||
private ActProcDefService actProcDefService;
|
||||
|
||||
@Autowired
|
||||
private ActUtil actUtil;
|
||||
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||
model.put("userName", InterfaceUtil.getAdmin().getUserName());
|
||||
model.put("pager", actProcDefService.list(searchInfo, pageNumber, pageSize));
|
||||
return "/admin/act_proc_def_list";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看默认的未标红的流程图片
|
||||
*
|
||||
* @param response
|
||||
* @param deploymentId
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/procDefPng/{deploymentId}")
|
||||
public void png(HttpServletResponse response, @PathVariable("deploymentId") String deploymentId) throws Exception {
|
||||
actProcDefService.createProcDefPng(response, deploymentId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看流程xml
|
||||
*
|
||||
* @param deploymentId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/xml/{deploymentId}")
|
||||
public void xml(HttpServletResponse response, @PathVariable("deploymentId") String deploymentId) throws Exception {
|
||||
actUtil.responseXml(response, deploymentId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除流程
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping(value = "/delete")
|
||||
public ResponseMsg delete(@RequestParam("ids") String ids) {
|
||||
if ("".equals(ids)) {
|
||||
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
|
||||
} else {
|
||||
String[] deleteIds = ids.split("#%#");
|
||||
for (String id : deleteIds) {
|
||||
actProcDefService.deleteDeployment(id);
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("删除成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 挂起与激活
|
||||
*
|
||||
* @param id
|
||||
* @param status 1-激活 2-挂起
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping(value = "/suspend")
|
||||
public String suspend(@RequestParam String id, @RequestParam int status) {
|
||||
actProcDefService.suspend(id, status);
|
||||
return "redirect:/actProcDef/list";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,151 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.config.activiti.ActApproveTypeEnum;
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import cn.palmte.work.service.ActProcInsService;
|
||||
import cn.palmte.work.service.ActTaskDefService;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 流程实列相关
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/actProcIns")
|
||||
public class ActProcInsController extends BaseController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ActProcInsController.class);
|
||||
|
||||
@Autowired
|
||||
private ActProcInsService actProcInsService;
|
||||
@Autowired
|
||||
private ActTaskDefService actTaskDefService;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param keywords
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||
model.put("pager", actProcInsService.list(searchInfo, pageNumber, pageSize));
|
||||
return "/admin/act_proc_ins_list";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除流程实例
|
||||
*
|
||||
* @param procInsId
|
||||
* @param reason
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping(value = "/deleteProcessInstance")
|
||||
public ResponseMsg deleteProcessInstance(@RequestParam String procInsId, @RequestParam String reason) {
|
||||
actProcInsService.deleteProcessInstance(procInsId, reason);
|
||||
return ResponseMsg.buildSuccessMsg("撤销成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 流程实列图片
|
||||
*
|
||||
* @param response
|
||||
* @param procInstId
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/procInsPng/{procInstId}")
|
||||
public void png(HttpServletResponse response, @PathVariable("procInstId") String procInstId) throws Exception {
|
||||
actProcInsService.createProcInsPng(response, procInstId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动流程
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/startProcIns/{procDefKey}")
|
||||
public ResponseMsg startProcessInstance(@PathVariable String procDefKey, @RequestBody String body) {
|
||||
JSONObject json = JSON.parseObject(body);
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
for (Object key : json.keySet()) {
|
||||
variables.put((String) key, json.get(key));
|
||||
}
|
||||
|
||||
variables.put(ActConstant.START_PROCESS_USERID, InterfaceUtil.getAdminId());
|
||||
String procInsId = null;
|
||||
try {
|
||||
procInsId = actProcInsService.startProcessInstance(procDefKey, "0", variables);
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
return ResponseMsg.buildFailedMsg("流程启动失败:" + e.getMessage());
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("流程启动成功", procInsId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 流程测试使用
|
||||
* http://localhost:8282/fourcal/actProcIns/test?procDefKey=final¶ms=typeVVV1FFFprojectTypeVVV1FFFcontractAmountVVV10000FFFcooperationTypeVVV1FFFisPrepaidVVVtrueFFFrepaidAmountVVV10000
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping(value = "/test")
|
||||
public ResponseMsg test(@RequestParam String procDefKey, @RequestParam String params) {
|
||||
try {
|
||||
HashMap<String, Object> variables = new HashMap<>();
|
||||
for (String s : params.split("FFF")) {
|
||||
String[] split = s.split("VVV");
|
||||
variables.put(split[0], split[1]);
|
||||
}
|
||||
String procInsId = actProcInsService.startProcessInstance(procDefKey, "0", variables);
|
||||
logger.info("==============> startProcessInstance procInsId:{}", procInsId);
|
||||
|
||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(procInsId).list();
|
||||
int i = 1;
|
||||
while (!CollectionUtils.isEmpty(taskList)) {
|
||||
for (Task task : taskList) {
|
||||
logger.info("==============> completeTaskByProcInsId procInsId:{}, taskName:{}, i:{}", procInsId, task.getName(), i++);
|
||||
actTaskDefService.completeTask(task.getId(), procInsId, "sysTest", ActApproveTypeEnum.APPROVAL_PASSED, "");
|
||||
}
|
||||
|
||||
taskList = taskService.createTaskQuery().processInstanceId(procInsId).list();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
return ResponseMsg.buildFailedMsg(e.getMessage());
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("ok");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.ActTaskDef;
|
||||
import cn.palmte.work.model.AdminRepository;
|
||||
import cn.palmte.work.pojo.ActHisTask;
|
||||
import cn.palmte.work.service.ActTaskDefService;
|
||||
import cn.palmte.work.service.SysRoleService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程任务
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/actTaskDef")
|
||||
public class ActTaskDefController extends BaseController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ActTaskDefController.class);
|
||||
|
||||
@Autowired
|
||||
private AdminRepository adminRepository;
|
||||
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ActTaskDefService actTaskDefService;
|
||||
|
||||
/**
|
||||
* 去任务配置页面
|
||||
*
|
||||
* @param procDefId
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/config/{procDefId}")
|
||||
public String list(@PathVariable String procDefId, Map<String, Object> model) {
|
||||
List<ActTaskDef> list = actTaskDefService.findByProcDefId(procDefId);
|
||||
//过滤掉发起节点的全是审批节点
|
||||
List<ActTaskDef> approveList = list.stream().filter(t-> t.getTaskIndex() == 0).collect(Collectors.toList());
|
||||
model.put("procDefId", procDefId);
|
||||
model.put("taskList", list);
|
||||
model.put("approveList", approveList);
|
||||
model.put("procDefName", list.get(0).getProcDefName());
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
model.put("adminList", adminRepository.getAllEnable());
|
||||
|
||||
return "/admin/act_task_def";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 任务配置保存
|
||||
*
|
||||
* @param taskDef
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping(value = "/saveConfig")
|
||||
public ResponseMsg saveConfig(ActTaskDef taskDef) {
|
||||
actTaskDefService.saveConfig(taskDef);
|
||||
return ResponseMsg.buildSuccessMsg("成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 管理员完成某个任务
|
||||
* 审批通过或者驳回
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/completeTask")
|
||||
public ResponseMsg completeTask(@RequestBody String json) {
|
||||
JSONObject jsonParam = JSON.parseObject(json);
|
||||
actTaskDefService.completeTask(jsonParam);
|
||||
return ResponseMsg.buildSuccessMsg("处理成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批过程查看
|
||||
*
|
||||
* @param procInsId
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/hisTaskList/{procInsId}")
|
||||
public String taskList(@PathVariable String procInsId, Map<String, Object> model) {
|
||||
List<ActHisTask> list = actTaskDefService.hisTaskList(procInsId);
|
||||
model.put("taskList", list);
|
||||
model.put("procInsId", procInsId);
|
||||
return "/admin/act_his_task_list";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,301 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.config.Constant;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.pojo.LoginRequest;
|
||||
import cn.palmte.work.pojo.LoginResponse;
|
||||
import cn.palmte.work.service.AdminService;
|
||||
import cn.palmte.work.service.LoginLogService;
|
||||
import cn.palmte.work.service.ProjectService;
|
||||
import cn.palmte.work.utils.*;
|
||||
import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.IncorrectCredentialsException;
|
||||
import org.apache.shiro.authc.LockedAccountException;
|
||||
import org.apache.shiro.authc.UnknownAccountException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import top.jfunc.common.db.bean.Page;
|
||||
import top.jfunc.common.utils.CollectionUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin")
|
||||
public class AdminController extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AdminController.class);
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
@Autowired
|
||||
private LoginLogService loginLogService;
|
||||
@Autowired
|
||||
private SysRoleRepository sysRoleRepository;
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
|
||||
@PostMapping(value = "/singIn")
|
||||
public String singIn(RedirectAttributes attr, LoginRequest loginRequest, HttpServletRequest request) throws Exception {
|
||||
String userName = loginRequest.getUserName();
|
||||
String password = loginRequest.getPassword();
|
||||
//String captchaToken = loginRequest.getCaptchaToken();
|
||||
String code;
|
||||
String message;
|
||||
try{
|
||||
/*try{
|
||||
code = request.getSession().getAttribute(CaptchaUtils.RANDOM_CODE_KEY).toString();
|
||||
}catch(Exception e){
|
||||
logger.info(e.getMessage() , e);
|
||||
message ="验证码错误";
|
||||
attr.addAttribute("errorMessages",message);
|
||||
return "redirect:/admin/err";
|
||||
}*/
|
||||
try {
|
||||
String privateKey = request.getSession().getAttribute(Constant.PRIVATEKEY).toString();
|
||||
userName = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(userName), privateKey));
|
||||
password = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(password), privateKey));
|
||||
//captchaToken = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(captchaToken),privateKey));
|
||||
} catch (Exception e) {
|
||||
logger.error("解密出错", e);
|
||||
attr.addAttribute("errorMessages", "用户名密码错误");
|
||||
return "redirect:/admin/err";
|
||||
}
|
||||
attr.addAttribute("userName", userName);
|
||||
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)) {
|
||||
message = "用户名或密码错误!";
|
||||
attr.addAttribute("errorMessages", message);
|
||||
return "redirect:/admin/err";
|
||||
}
|
||||
/*if(!captchaToken.toUpperCase().equals(code)){
|
||||
message ="验证码错误!";
|
||||
attr.addAttribute("errorMessages",message);
|
||||
return "redirect:/admin/err";
|
||||
}*/
|
||||
/**
|
||||
* 移除验证数据
|
||||
*/
|
||||
//request.getSession().removeAttribute(CaptchaUtils.RANDOM_CODE_KEY);
|
||||
Admin admin = adminService.getAdminByUsername(userName);
|
||||
if (null == admin) {
|
||||
message = "用户名或密码错误~~~";
|
||||
attr.addAttribute("errorMessages", message);
|
||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||
return "redirect:/admin/err";
|
||||
}
|
||||
if (admin.getEnabled() == 0) {
|
||||
message = "该用户已禁用~~~";
|
||||
attr.addAttribute("errorMessages", message);
|
||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||
return "redirect:/admin/err";
|
||||
}
|
||||
if (adminService.isLocked(admin)) {
|
||||
message = "该用户已被锁定~~~";
|
||||
attr.addAttribute("errorMessages", message);
|
||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||
return "redirect:/admin/err";
|
||||
}
|
||||
int roleId = admin.getRoleId();
|
||||
SysRole role = sysRoleRepository.findOne(roleId);
|
||||
|
||||
if (role.getIsEnable() == 0) {
|
||||
message = "该用户绑定的角色已禁用~~~";
|
||||
attr.addAttribute("errorMessages", message);
|
||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||
return "redirect:/admin/err";
|
||||
}
|
||||
|
||||
String salt = admin.getSalt();
|
||||
request.getSession().setAttribute("realsName", admin.getRealName());
|
||||
//request.getSession().setAttribute("telephone", admin.getTelephone());
|
||||
request.getSession().setAttribute("lastLoginTime", admin.getLoginDate());
|
||||
String newPassword;
|
||||
try {
|
||||
newPassword = DESCrypto.encryptPassword(password, salt);
|
||||
} catch (Exception e) {
|
||||
logger.error("加密出错", e);
|
||||
message = "密码出错";
|
||||
attr.addAttribute("errorMessages", message);
|
||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||
return "redirect:/admin/err";
|
||||
}
|
||||
|
||||
boolean bool = checkUpdatePasswordTime(admin);
|
||||
if (bool) {
|
||||
request.getSession().setAttribute("message", "您已超过90天未修改密码!");
|
||||
} else {
|
||||
request.getSession().setAttribute("message", "");
|
||||
}
|
||||
|
||||
// message = login(userName, admin.getPassword(), false, false);
|
||||
message = login(userName, newPassword, false, false);
|
||||
if (!message.isEmpty()) {
|
||||
attr.addAttribute("errorMessages", message);
|
||||
|
||||
//增加登录失败次数
|
||||
adminService.addLoginError(admin);
|
||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||
|
||||
return "redirect:/admin/err";
|
||||
}
|
||||
adminService.updateLoginInfo(admin, request);
|
||||
loginLogService.saveLog(userName, LoginLog.SUCCESS, "登录成功");
|
||||
|
||||
/**
|
||||
* admin用户去检查,如果检查job有失败的,显示弹出框[1]
|
||||
*/
|
||||
return "redirect:/admin/center?uid=0";
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
message = "登录发生未知错误,e=" + e.getMessage();
|
||||
attr.addAttribute("errorMessages", message);
|
||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||
return "redirect:/admin/err";
|
||||
} catch (Throwable t) {
|
||||
logger.error(t.getMessage(), t);
|
||||
message = "登录发生未知错误,t=" + t.getMessage();
|
||||
attr.addAttribute("errorMessages", message);
|
||||
loginLogService.saveLog(userName, LoginLog.FAILED, message);
|
||||
return "redirect:/admin/err";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算当前时间和最后一次修改密码的天数
|
||||
* @param admin
|
||||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
public boolean checkUpdatePasswordTime(Admin admin) throws ParseException {
|
||||
if (null != admin.getUpdatedPasswordTime()) {
|
||||
int days = DateKit.daysBetween(admin.getUpdatedPasswordTime(), new Date());
|
||||
if (days >= 90) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一的的登录方法
|
||||
*
|
||||
* @param returnJson 是否返回json格式的数据,否就是返回登录页面
|
||||
*/
|
||||
public String login(String username, String password, boolean rememberMe, boolean returnJson) {
|
||||
//TODO:登录验证逻辑(待补充)
|
||||
String errorMessage = "";
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
|
||||
token.setRememberMe(rememberMe);
|
||||
|
||||
try {
|
||||
subject.login(token);
|
||||
} catch (UnknownAccountException | LockedAccountException ue) {
|
||||
token.clear();
|
||||
errorMessage = ue.getMessage();
|
||||
} catch (IncorrectCredentialsException ie) {
|
||||
token.clear();
|
||||
errorMessage = "用户名或密码错误~~~";
|
||||
} catch (RuntimeException re) {
|
||||
re.printStackTrace();
|
||||
token.clear();
|
||||
errorMessage = "登录失败!";
|
||||
}
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/login", method = {RequestMethod.GET})
|
||||
public String login(HttpServletRequest request) throws Exception {
|
||||
//TODO:登录页面初始化代码
|
||||
InterfaceUtil.genRSAKeyPair(request);
|
||||
return "/admin/admin_login";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/center", method = RequestMethod.GET)
|
||||
public String center(@ModelAttribute("userName") String userName, @RequestParam("uid") int uid,
|
||||
@RequestParam(value = "showJobMonitorError", defaultValue = "0") int showJobMonitorError, Map<String, Object> model) {
|
||||
logger.info("------------------------------------------重定向到首页信息查询center方法内部-----------------------用户名====" + userName);
|
||||
|
||||
LoginResponse loginResponse = adminService.initMenuList(uid);
|
||||
model.put("userName", userName);
|
||||
model.put("loginResponse", loginResponse);
|
||||
if (uid == 0) {
|
||||
uid = (loginResponse.getTopMenuList() != null && loginResponse.getTopMenuList().size() > 0) ? loginResponse.getTopMenuList().get(0).getId() : 0;
|
||||
}
|
||||
model.put("uid", uid);
|
||||
model.put("showJobMonitorError", showJobMonitorError);
|
||||
logger.info("------------------------------------------跳转到admin_index-----------------------");
|
||||
return "/admin/admin_index";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/topMenu", method = RequestMethod.GET)
|
||||
public String topMenu(@RequestParam("uid") int uid, Map<String, Object> model) {
|
||||
LoginResponse loginResponse = adminService.initMenuList(uid);
|
||||
model.put("loginResponse", loginResponse);
|
||||
return "/admin/admin_index";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/console", method = RequestMethod.GET)
|
||||
public String console(@RequestParam("uid") int uid, Map<String, Object> model, HttpServletRequest request) {
|
||||
logger.info(uid + "");
|
||||
model.put("statistic", "");
|
||||
return "/admin/console";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/err", method = RequestMethod.GET)
|
||||
public String loginErr(HttpServletRequest request, @ModelAttribute("errorMessages") String errorMessages) {
|
||||
InterfaceUtil.genRSAKeyPair(request);
|
||||
request.setAttribute("base", request.getContextPath());
|
||||
return "/admin/admin_login";
|
||||
}
|
||||
|
||||
|
||||
// 管理员退出
|
||||
@RequestMapping(value = "/logout", method = RequestMethod.GET)
|
||||
public String logout(HttpServletRequest request) {
|
||||
// ShiroPrincipal principal = (ShiroPrincipal) SecurityUtils.getSubject().getPrincipal();
|
||||
// // 如果已经登录,则跳转到管理首页
|
||||
// if(principal != null){
|
||||
// SecurityUtils.getSubject().logout();
|
||||
// }
|
||||
return "redirect:/admin/login";
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成随机验证码图片
|
||||
*/
|
||||
@RequestMapping(value = "/captcha", method = RequestMethod.GET)
|
||||
public void captcha(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
new CaptchaUtils().getRandCode(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自己是否有审核任务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/approveProjectsMsg")
|
||||
public ResponseMsg approveProjectsMsg() {
|
||||
Page<Project> myApproveProjects = projectService.findMyApproveProjects(new HashMap<>(), InterfaceUtil.getAdminId(), 1, 1);
|
||||
if (myApproveProjects != null && !myApproveProjects.getList().isEmpty()) {
|
||||
return ResponseMsg.buildSuccessMsg("您有新的待审核项目,请及时确认。");
|
||||
} else {
|
||||
return ResponseMsg.buildSuccessMsg("");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
|
||||
import cn.palmte.work.config.Constant;
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import cn.palmte.work.utils.RSAUtils;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
public class BaseController {
|
||||
public static final String KEYWORDS = "keywords";
|
||||
public static final String PAGE_NUMBER = "pageNumber";
|
||||
public static final String PAGE_SIZE = "pageSize";
|
||||
public static final String PAGER = "pager";
|
||||
public static final String DEFAULT_PAGE_NUMBER = "1";
|
||||
public static final String DEFAULT_PAGE_SIZE = "10";
|
||||
|
||||
/**
|
||||
* Gets the request.
|
||||
*
|
||||
* @return the request
|
||||
*/
|
||||
protected HttpServletRequest getRequest() {
|
||||
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the response.
|
||||
*
|
||||
* @return the response
|
||||
*/
|
||||
protected HttpServletResponse getResponse() {
|
||||
return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the session
|
||||
*
|
||||
* @return the session
|
||||
*/
|
||||
protected HttpSession getSession() {
|
||||
return getRequest().getSession();
|
||||
}
|
||||
|
||||
protected void downloadHeader(HttpServletResponse response, String fileName) {
|
||||
downloadHeader(response, fileName, "application/octet-stream");
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理下载文件的http header
|
||||
*
|
||||
* @param response HttpServletResponse
|
||||
* @param fileName 文件名
|
||||
*/
|
||||
protected void downloadHeader(HttpServletResponse response, String fileName, String contentType) {
|
||||
response.setContentType(contentType);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
try {
|
||||
response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + java.net.URLEncoder.encode(fileName, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BaseController {@link #downloadHeader(HttpServletResponse, String, String)}
|
||||
*/
|
||||
protected void downloadHearder(HttpServletResponse response, String fileName) {
|
||||
downloadHeader(response, fileName, "application/octet-stream");
|
||||
}
|
||||
|
||||
|
||||
public ConcurrentHashMap<String, String> getSearchInfo(String keywords, Map<String, Object> model) {
|
||||
ConcurrentHashMap<String, String> searchMap = Utils.parseMap(keywords);
|
||||
setModers(searchMap, model);
|
||||
return searchMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存搜索条件到model
|
||||
*/
|
||||
public void setModers(ConcurrentHashMap<String, String> searchInfo, Map<String, Object> model) {
|
||||
for (Map.Entry<String, String> item : searchInfo.entrySet()) {
|
||||
model.put(item.getKey(), item.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存搜索条件到request
|
||||
*/
|
||||
public void setAttrs(Map<String, String> searchInfo) {
|
||||
HttpServletRequest request = getRequest();
|
||||
for (Map.Entry<String, String> item : searchInfo.entrySet()) {
|
||||
request.setAttribute(item.getKey(), item.getValue());
|
||||
}
|
||||
keepKeywords(searchInfo);
|
||||
}
|
||||
|
||||
public Map<String, String> getSearchInfo(String keywords) {
|
||||
|
||||
Map<String, String> searchMap = Utils.parseMap(keywords);
|
||||
setAttrs(searchMap);
|
||||
return searchMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将搜索条件按“keywords”保存 ,分页才能带上搜索条件
|
||||
*/
|
||||
protected void keepKeywords(Map<String, String> map) {
|
||||
HttpServletRequest request = getRequest();
|
||||
request.setAttribute(KEYWORDS, JSON.toJSONString(map));
|
||||
}
|
||||
|
||||
public void genRSAKeyPair(HttpServletRequest request, Map<String, Object> model) {
|
||||
/* 生成KeyPair */
|
||||
Map<String, Object> keyMap;
|
||||
try {
|
||||
keyMap = RSAUtils.genKeyPair();
|
||||
String publicKey = RSAUtils.getPublicKey(keyMap);
|
||||
String privateKey = RSAUtils.getPrivateKey(keyMap);
|
||||
|
||||
/* 保存私钥到session */
|
||||
request.getSession().setAttribute(Constant.PRIVATEKEY, privateKey);
|
||||
|
||||
/* 公钥给前端页面 */
|
||||
model.put(Constant.PUBLICKEY, publicKey);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户对象
|
||||
*/
|
||||
public Admin getAdmin() {
|
||||
return InterfaceUtil.getAdmin();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户对象Id
|
||||
*/
|
||||
public int getAdminId() {
|
||||
return InterfaceUtil.getAdmin().getId();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/business")
|
||||
public class BusinessController extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
|
||||
|
||||
@RequestMapping("/bak1")
|
||||
public String bak1(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak1";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak2")
|
||||
public String bak2(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak2";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak3")
|
||||
public String bak3(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak3";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak4")
|
||||
public String bak4(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak4";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak5")
|
||||
public String bak5(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak5";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak6")
|
||||
public String bak6(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak6";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak7")
|
||||
public String bak7(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak7";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak8")
|
||||
public String bak8(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak8";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak9")
|
||||
public String bak9(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak9";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak10")
|
||||
public String bak10(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak10";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak11")
|
||||
public String bak11(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak11";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak12")
|
||||
public String bak12(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak12";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak13")
|
||||
public String bak13(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak13";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak14")
|
||||
public String bak14(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak14";
|
||||
}
|
||||
|
||||
@RequestMapping("/bak15")
|
||||
public String bak15(Map<String, Object> model) {
|
||||
|
||||
return "/admin/bak15";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.service.DeptService;
|
||||
import cn.palmte.work.service.ProcurementTypeService;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import top.jfunc.common.db.bean.Page;
|
||||
import top.jfunc.common.utils.CollectionUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/department")
|
||||
public class DepartmentController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private DeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private DeptRepository deptRepository;
|
||||
|
||||
@Autowired
|
||||
private AdminRepository adminRepository;
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* @param keywords
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
model.put("keywords",keywords);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||
Page<Dept> page = deptService.list(searchInfo, pageNumber, pageSize);
|
||||
List<Dept> list = page.getList();
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
|
||||
int offset = (pageNumber - 1) * pageSize;
|
||||
for (int i = 0 , size = list.size(); i < size; i++) {
|
||||
list.get(i).setTempId(i+1 + offset);
|
||||
}
|
||||
}
|
||||
model.put("pager", page);
|
||||
List<Dept> deptList = deptRepository.findEnableParent();
|
||||
model.put("parentList", deptList);
|
||||
return "/admin/department_list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转新增页面
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/add")
|
||||
public String add( Map<String, Object> model){
|
||||
Dept department = new Dept();
|
||||
model.put("deptId",-1);
|
||||
model.put("department",department);
|
||||
List<Admin> adminList = adminRepository.getAllEnableWoAdmin();
|
||||
model.put("userList", adminList);
|
||||
List<Dept> deptList = deptRepository.findEnableParent();
|
||||
model.put("parentList", deptList);
|
||||
return "/admin/department_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转编辑页面
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/edit")
|
||||
public String edit( Map<String, Object> model, @RequestParam("id") int id){
|
||||
Dept dept = deptRepository.findOne(id);
|
||||
model.put("deptId", id);
|
||||
model.put("department", dept);
|
||||
List<Admin> adminList = adminRepository.getAllEnableWoAdmin();
|
||||
model.put("userList", adminList);
|
||||
List<Dept> deptList = deptRepository.findEnableParent();
|
||||
model.put("parentList", deptList);
|
||||
return "/admin/department_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param deptId
|
||||
* @param dept
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/save")
|
||||
public String save(@RequestParam("deptId") int deptId,
|
||||
Dept dept, Map<String, Object> model){
|
||||
|
||||
deptService.saveOtUpdate(deptId,dept);
|
||||
return "redirect:/department/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用 禁用
|
||||
*/
|
||||
@RequestMapping("/enableOrDisable")
|
||||
@ResponseBody
|
||||
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
|
||||
@RequestParam("status") int status, RedirectAttributes attr) {
|
||||
boolean isSuccess = false;
|
||||
try {
|
||||
isSuccess = deptService.enableOrDisable(status, id);
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
}
|
||||
if (isSuccess) {
|
||||
return ResponseMsg.buildSuccessMsg("操作成功");
|
||||
} else {
|
||||
return ResponseMsg.buildSuccessMsg("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用 禁用
|
||||
*/
|
||||
@RequestMapping("/checkName")
|
||||
@ResponseBody
|
||||
public ResponseMsg checkName(@RequestParam("id") int id,
|
||||
@RequestParam("name") String name, RedirectAttributes attr) {
|
||||
Dept dept = deptRepository.findByNameEquals(name);
|
||||
if (dept != null && id != dept.getId()) {
|
||||
return ResponseMsg.buildFailedMsg("失败");
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
@RequestMapping("/export")
|
||||
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||
downloadHeader(httpServletResponse , Utils.generateExcelName("部门表"), "application/octet-stream");
|
||||
String[] headers = {"部门名称", "部门领导", "所属上级", "创建人","创建时间", "状态"};
|
||||
String[] exportColumns = {"name", "realName", "parentName", "createdBy","createdTime", "status"};
|
||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||
httpServletResponse.getOutputStream(), (pN, pS) -> deptService.list(searchInfo, pN, pS).getList());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.config.Constant;
|
||||
import cn.palmte.work.config.UploadProperties;
|
||||
import cn.palmte.work.pojo.UploadResult;
|
||||
import cn.palmte.work.utils.UploadUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
/**
|
||||
* @author pengqiang
|
||||
* @date 2018/4/21
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/file")
|
||||
public class FileController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private UploadProperties uploadProperties;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @return 返回状态和下载地址
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
@ResponseBody
|
||||
public ResponseMsg upload(@RequestParam(value = "files[]") MultipartFile[] multipartfiles) {
|
||||
ResponseMsg responseMsg = ResponseMsg.buildFailedMsg("failed");
|
||||
if (null != multipartfiles && multipartfiles.length > 0) {
|
||||
MultipartFile file = multipartfiles[0];
|
||||
UploadResult result = UploadUtil.upload(file,
|
||||
uploadProperties.getPath() , uploadProperties.getPrefix());
|
||||
if (Constant.STATUS_SUCCESS == result.getStatus()) {
|
||||
responseMsg = ResponseMsg.buildSuccessMsg("成功", result);
|
||||
} else {
|
||||
responseMsg.setMsg(result.getMsg());
|
||||
}
|
||||
}
|
||||
return responseMsg;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.service.HumanCostService;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import cn.palmte.work.utils.excel.ExcelUtil;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.poi.EncryptedDocumentException;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import top.jfunc.common.db.bean.Page;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 人力成本管理
|
||||
* @author Yuanping Zhang
|
||||
* @date 2021/11/1
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/humanCost")
|
||||
public class HumanCostController extends BaseController{
|
||||
private static final Logger logger = LoggerFactory.getLogger(HumanCostController.class);
|
||||
|
||||
@Autowired
|
||||
private DeptRepository deptRepository;
|
||||
|
||||
@Autowired
|
||||
private HumanCostService humanCostService;
|
||||
|
||||
@Autowired
|
||||
private AdminRepository adminRepository;
|
||||
|
||||
@Autowired
|
||||
private ProjectRepository projectRepository;
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = KEYWORDS,required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
//当前登录人的角色类型
|
||||
Admin admin = getAdmin();
|
||||
int roleLevel = admin.getRoleLevel();
|
||||
List<Project> selfProjects = projectRepository.findByCreator(admin.getId(), new Date());
|
||||
if (roleLevel <= 3 || roleLevel == 6) {
|
||||
model.put("deptVary", 1);
|
||||
model.put("deptList", deptRepository.findAll());
|
||||
model.put("projectList", projectRepository.findAll());
|
||||
model.put("showSalary", 1);
|
||||
} else if (roleLevel == 4 || roleLevel == 5) {
|
||||
model.put("deptVary", -1);
|
||||
model.put("deptList", new ArrayList<>());
|
||||
model.put("projectList", projectRepository.findByDeptId(admin.getDeptId()));
|
||||
model.put("showSalary", -1);
|
||||
} else if (selfProjects != null) {
|
||||
model.put("deptVary", -1);
|
||||
model.put("deptList", new ArrayList<>());
|
||||
model.put("projectList", selfProjects);
|
||||
model.put("showSalary", -1);
|
||||
} else {
|
||||
keywords = setDate(keywords);
|
||||
model.put("keywords",keywords);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||
if (searchInfo.containsKey("time")) {
|
||||
String time = searchInfo.get("time");
|
||||
if (time.length() == 7) {
|
||||
String individualTime = time.substring(0, 4) + "年" + time.substring(5, 7) + "月";
|
||||
model.put("individualTime", individualTime);
|
||||
}
|
||||
}
|
||||
model.put("pager",humanCostService.individual(searchInfo, admin.getId(), pageNumber, pageSize));
|
||||
return "admin/human_cost_individual";
|
||||
}
|
||||
keywords = setDate(keywords);
|
||||
model.put("keywords",keywords);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||
Page<ProjectUserTime> project = humanCostService.project(searchInfo, admin, pageNumber, pageSize);
|
||||
List<ProjectUserTime> staff = humanCostService.staff(searchInfo, admin);
|
||||
Map<String, BigDecimal> map = humanCostService.map(searchInfo, admin, pageNumber, pageSize);
|
||||
BigDecimal total = humanCostService.sum(searchInfo, admin);
|
||||
model.put("pager", project);
|
||||
model.put("staff", staff);
|
||||
model.put("map", map);
|
||||
model.put("total", total);
|
||||
return "admin/human_cost_list";
|
||||
}
|
||||
|
||||
private String setDate(String keywords) {
|
||||
if (keywords == null || keywords.length() == 0) {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1);
|
||||
date = calendar.getTime();
|
||||
String accDate = sf.format(date);
|
||||
keywords = "{time: '" + accDate + "'}";
|
||||
}
|
||||
return keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
@RequestMapping("/export")
|
||||
public void export(@RequestParam(value = KEYWORDS,required = false) String keywords,
|
||||
HttpServletResponse response) throws Exception{
|
||||
Admin admin = getAdmin();
|
||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||
downloadHeader(response , Utils.generateExcelName("人力成本表"));
|
||||
Page<ProjectUserTime> project = humanCostService.project((ConcurrentHashMap<String, String>) searchInfo, admin, 1, 5000);
|
||||
List<ProjectUserTime> staff = humanCostService.staff((ConcurrentHashMap<String, String>) searchInfo, admin);
|
||||
Map<String, BigDecimal> map = humanCostService.map((ConcurrentHashMap<String, String>) searchInfo, admin, 1, 5000);
|
||||
String[] headers = humanCostService.getHeaders(staff);
|
||||
String[] columns = humanCostService.getColumns(project.getList());
|
||||
ExportUtils.exportHumanCost(headers, columns, staff, project.getList(),
|
||||
response.getOutputStream() , map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载导入模板
|
||||
*/
|
||||
@RequestMapping("/template")
|
||||
public void importTemplate(HttpServletResponse response) throws IOException {
|
||||
String[] columns = new String[]{""};
|
||||
downloadHeader(response , Utils.generateExcelName("人力成本导入模板"));
|
||||
List<String> data = new ArrayList<>();
|
||||
data.add("成本");
|
||||
String[] headers = humanCostService.template(data);
|
||||
ExportUtils exportUtils = new ExportUtils(headers);
|
||||
exportUtils.exportTemplate(columns , data, "yyyy-MM-dd HH:mm:ss" , 1);
|
||||
exportUtils.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
@RequestMapping("/batchImport")
|
||||
@ResponseBody
|
||||
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
|
||||
try {
|
||||
Map<String, String> title = new HashMap<>();
|
||||
Collection<Map> maps = ExcelUtil.importHumanCost(Map.class, file.getInputStream(),
|
||||
title,0);
|
||||
return JSON.toJSONString(humanCostService.check(maps, title, date));
|
||||
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
|
||||
logger.error("", e);
|
||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误,请上传excel 2003/2007格式文件"));
|
||||
} catch (Exception e) {
|
||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/")
|
||||
public class IndexController extends BaseController{
|
||||
@GetMapping(value = "/")
|
||||
public String index() throws Exception {
|
||||
return "redirect:/admin/login";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.MonthlySettle;
|
||||
import cn.palmte.work.model.MonthlySettleRepository;
|
||||
import cn.palmte.work.service.MonthlySettleService;
|
||||
import cn.palmte.work.utils.FreeMarkerUtil;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import cn.palmte.work.utils.excel.AppendMore;
|
||||
import cn.palmte.work.utils.excel.ExcelLogs;
|
||||
import cn.palmte.work.utils.excel.ExcelUtil;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.poi.EncryptedDocumentException;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author Yuanping Zhang
|
||||
* @date 2022/08/08
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monthlySettle")
|
||||
public class MonthlySettleController extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(MonthlySettleController.class);
|
||||
|
||||
@Autowired
|
||||
private MonthlySettleService monthlySettleService;
|
||||
|
||||
@Autowired
|
||||
private MonthlySettleRepository monthlySettleRepository;
|
||||
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
// 初始化参数
|
||||
setModel(keywords, model);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||
model.put("pager", monthlySettleService.list(searchInfo, pageNumber, pageSize));
|
||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||
return "/admin/monthly_settle_list";
|
||||
}
|
||||
|
||||
@RequestMapping("/info")
|
||||
public String info(@RequestParam("id") int id, Map<String, Object> model) {
|
||||
MonthlySettle monthlySettle = monthlySettleService.findById(id);
|
||||
model.put("monthlySettle", monthlySettle);
|
||||
model.put("projectNameStr", monthlySettle.getProjectName());
|
||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||
return "/admin/monthly_settle_info";
|
||||
}
|
||||
|
||||
@RequestMapping("/infoByTime")
|
||||
public String infoByTime(@RequestParam String month, @RequestParam("projectName") String projectName, Map<String, Object> model) {
|
||||
MonthlySettle monthlySettle = monthlySettleService.findByMonthAndProjectName(month, projectName);
|
||||
if (monthlySettle == null) {
|
||||
monthlySettle = new MonthlySettle();
|
||||
}
|
||||
model.put("monthlySettle", monthlySettle);
|
||||
model.put("projectNameStr", projectName);
|
||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||
return "/admin/monthly_settle_info";
|
||||
}
|
||||
|
||||
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
|
||||
model.put("keywords", keywords);
|
||||
}
|
||||
|
||||
@RequestMapping("/export")
|
||||
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||
downloadHeader(httpServletResponse, Utils.generateExcelName("PMO项目执行进度管理"), "application/octet-stream");
|
||||
String[] headers = {"项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额",
|
||||
"销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "到货证明", "项目风险预警", "已计收金额", "未计收金额", "超期天数", "验收报告时间"};
|
||||
String[] exportColumns = {"projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound",
|
||||
"totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound",
|
||||
"collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "productCertificate", "riskWarning", "uncalColAmountRound", "calColAmountRound", "timeOutDay", "inspectionReportTimeStr"};
|
||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||
httpServletResponse.getOutputStream(), (pN, pS) -> monthlySettleService.list(searchInfo, pN, pS).getList());
|
||||
}
|
||||
|
||||
@RequestMapping("/exportSingle")
|
||||
public void exportSingle(@RequestParam String id, @RequestParam String time, @RequestParam String projectName, HttpServletResponse httpServletResponse) throws IOException {
|
||||
downloadHeader(httpServletResponse, Utils.generateExcelName("PMO项目执行进度管理明细"), "application/octet-stream");
|
||||
String[] headers = {"月份", "项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额",
|
||||
"销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"};
|
||||
String[] exportColumns = {"month", "projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound",
|
||||
"totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound",
|
||||
"collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "timeOutDay", "productCertificate", "inspectionReportTimeStr", "riskWarning", "uncalColAmountRound", "calColAmountRound"};
|
||||
ExportUtils.exportToExcel2(headers, exportColumns, 1, 10000,
|
||||
httpServletResponse.getOutputStream(), monthlySettleService.findOne(id, time, projectName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*/
|
||||
@RequestMapping("/template")
|
||||
public void template(HttpServletResponse response) throws Exception {
|
||||
String[] headers = new String[]{"项目编号", "最终业主", "合同方", "项目名称", "合同金额", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额", "合同编号", "项目类型", "合同签订时间", "销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额",
|
||||
"实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"};
|
||||
downloadHeader(response, Utils.generateExcelName("PMO项目执行进度管理导入模板"));
|
||||
ExportUtils exportUtils = new ExportUtils(headers);
|
||||
exportUtils.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入
|
||||
*/
|
||||
@RequestMapping("/batchImport")
|
||||
@ResponseBody
|
||||
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
|
||||
try {
|
||||
ExcelLogs logs = new ExcelLogs();
|
||||
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
|
||||
"yyyy/MM/dd HH:mm:ss", logs, 0);
|
||||
synchronized (this) {
|
||||
return JSON.toJSONString(monthlySettleService.check(maps, date));
|
||||
}
|
||||
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
|
||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误,请上传excel 2003/2007格式文件"));
|
||||
} catch (Exception e) {
|
||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.SettleBean;
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.pojo.MonthlySettleCount;
|
||||
import cn.palmte.work.service.MonthlySettleStatisticsService;
|
||||
import cn.palmte.work.utils.DateKit;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/monthlySettleStatistics")
|
||||
public class MonthlySettleStatisticsController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private MonthlySettleStatisticsService monthlySettleStatisticsService;
|
||||
|
||||
/**
|
||||
* 开卡订单图表
|
||||
*
|
||||
* @param keywords
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
||||
@RequestParam(value = "pageNumber", defaultValue = "1") int pageNumber,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
|
||||
Map<String, Object> model) {
|
||||
//当前登录人的角色类型
|
||||
Admin admin = getAdmin();
|
||||
model.put("keywords",keywords);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||
String time;
|
||||
if (!searchInfo.containsKey("time")) {
|
||||
Calendar instance = Calendar.getInstance();
|
||||
instance.setTime(new Date());
|
||||
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH));
|
||||
Date current = instance.getTime();
|
||||
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||
model.put("time", time);
|
||||
}
|
||||
return "/admin/monthly_settle_statistics";
|
||||
}
|
||||
|
||||
@RequestMapping("/listData")
|
||||
@ResponseBody
|
||||
public String listData(@RequestParam(value = "time", required = false) String time,
|
||||
Map<String, Object> model) {
|
||||
// 初始化参数
|
||||
List<MonthlySettleCount> countList = monthlySettleStatisticsService.getListData(time);
|
||||
return JSONObject.toJSONString(countList);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,858 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.ExampleMatcher;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.convert.QueryByExamplePredicateBuilder;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.persistence.criteria.Expression;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import cn.palmte.work.ErrorMessageException;
|
||||
import cn.palmte.work.bean.BudgetBean;
|
||||
import cn.palmte.work.config.activiti.ActApproveTypeEnum;
|
||||
import cn.palmte.work.config.activiti.ActProjectTypeEnum;
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.model.DeptRepository;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.model.ProjectBudgetIncomeDetail;
|
||||
import cn.palmte.work.model.ProjectRepository;
|
||||
import cn.palmte.work.model.ProjectTaskRecord;
|
||||
import cn.palmte.work.model.SysRole;
|
||||
import cn.palmte.work.model.enums.CooperationType;
|
||||
import cn.palmte.work.model.enums.Enumerable;
|
||||
import cn.palmte.work.model.enums.ProcessStatus;
|
||||
import cn.palmte.work.model.enums.ProcessType;
|
||||
import cn.palmte.work.model.enums.ProcurementMode;
|
||||
import cn.palmte.work.model.enums.ProjectType;
|
||||
import cn.palmte.work.model.enums.SealType;
|
||||
import cn.palmte.work.model.process.BudgetPurchaseAmount;
|
||||
import cn.palmte.work.model.process.BudgetPurchaseAmountModel;
|
||||
import cn.palmte.work.model.process.BudgetPurchaseDetail;
|
||||
import cn.palmte.work.model.process.BudgetPurchaseDetailModel;
|
||||
import cn.palmte.work.model.process.ProcessAttachment;
|
||||
import cn.palmte.work.model.process.ProcurementContract;
|
||||
import cn.palmte.work.model.process.ProcurementDetail;
|
||||
import cn.palmte.work.model.process.ProjectProcess;
|
||||
import cn.palmte.work.model.process.ProjectProcessDetail;
|
||||
import cn.palmte.work.model.process.ProjectProcessRepository;
|
||||
import cn.palmte.work.model.process.SaleContract;
|
||||
import cn.palmte.work.model.process.SealTypeArray;
|
||||
import cn.palmte.work.model.process.SupplierMaterial;
|
||||
import cn.palmte.work.model.process.form.ProcessCreationForm;
|
||||
import cn.palmte.work.model.process.form.ProcessQueryForm;
|
||||
import cn.palmte.work.model.process.form.ProcessUpdateForm;
|
||||
import cn.palmte.work.service.ProjectBudgetService;
|
||||
import cn.palmte.work.service.ProjectInstanceService;
|
||||
import cn.palmte.work.service.ProjectProcessService;
|
||||
import cn.palmte.work.service.ProjectTaskRecordService;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 1.0 2022/12/8 11:03
|
||||
*/
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/process")
|
||||
public class ProcessController {
|
||||
static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
private final ProjectRepository projectRepository;
|
||||
private final ProjectBudgetService projectBudgetService;
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final EntityManager entityManager;
|
||||
|
||||
private final ProjectProcessRepository repository;
|
||||
private final ProjectInstanceService projectInstanceService;
|
||||
private final ProjectProcessService processService;
|
||||
private final ProjectTaskRecordService projectTaskRecordService;
|
||||
|
||||
static class FormMetadata {
|
||||
// 部门
|
||||
|
||||
// 印章类型
|
||||
public Map<String, String> sealTypes;
|
||||
|
||||
// 税率
|
||||
public List<Integer> taxRate;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping("/form/metadata")
|
||||
public FormMetadata metadata() {
|
||||
FormMetadata metadata = new FormMetadata();
|
||||
metadata.sealTypes = Arrays.stream(SealType.values())
|
||||
.collect(Collectors.toMap(SealType::getDescription, Enum::name));
|
||||
metadata.taxRate = Arrays.asList(0, 1, 3, 4, 5, 6, 9, 10, 13);
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建流程
|
||||
*/
|
||||
@GetMapping("/new")
|
||||
public String newProcess(Model model) {
|
||||
model.addAttribute("sealTypes", SealType.values());
|
||||
model.addAttribute("procurementMode", ProcurementMode.values());
|
||||
model.addAttribute("taxRate", Arrays.asList(0, 1, 3, 4, 5, 6, 9, 10, 13));
|
||||
model.addAttribute("applyDeptSectorOptions", JSON.toJSONString(processService.filterDept()));
|
||||
return "/admin/business/process-new";
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑流程
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String editProcess(Model model, @PathVariable int id) {
|
||||
model.addAttribute("processId", id);
|
||||
model.addAttribute("sealTypes", SealType.values());
|
||||
model.addAttribute("procurementMode", ProcurementMode.values());
|
||||
model.addAttribute("taxRate", Arrays.asList(0, 1, 3, 4, 5, 6, 9, 10, 13));
|
||||
model.addAttribute("applyDeptSectorOptions", JSON.toJSONString(processService.filterDept()));
|
||||
return "/admin/business/process-edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 已办流程
|
||||
*/
|
||||
@GetMapping("/completed")
|
||||
public String completed(Model model) {
|
||||
Admin admin = getLoginUser();
|
||||
// 超级管理员,只有查看权限,不能编辑和删除除非是自己的
|
||||
model.addAttribute("adminId", admin.getId());
|
||||
model.addAttribute("isAdmin", isAdministrator(admin));
|
||||
model.addAttribute("processTypes", ProcessType.values());
|
||||
model.addAttribute("processStatus", ProcessStatus.values());
|
||||
return "/admin/business/process-completed";
|
||||
}
|
||||
|
||||
/**
|
||||
* 待我审核
|
||||
*/
|
||||
@GetMapping("/review")
|
||||
public String review(Model model) {
|
||||
model.addAttribute("processTypes", ProcessType.values());
|
||||
return "/admin/business/process-review";
|
||||
}
|
||||
|
||||
@GetMapping("/detail/{id}")
|
||||
public String detail(@PathVariable int id, Model model, @RequestParam(defaultValue = "false") boolean forAudit) {
|
||||
model.addAttribute("processId", id);
|
||||
|
||||
ProjectProcess process = obtainProjectProcess(id);
|
||||
model.addAttribute("process", process);
|
||||
|
||||
Project project = projectRepository.findById(process.getProjectId());
|
||||
model.addAttribute("project", project);
|
||||
model.addAttribute("projectType", Enumerable.of(ProjectType.class, project.getType()).getDescription());
|
||||
model.addAttribute("cooperationType", Enumerable.of(CooperationType.class, project.getCooperateType()).getDescription());
|
||||
List<ProcessAttachment> attachments = JSONArray.parseArray(process.getAttachmentUri(), ProcessAttachment.class);
|
||||
model.addAttribute("attachments", attachments);
|
||||
BigDecimal repaidAmount = getRepaidAmount(process.getProjectId());
|
||||
model.addAttribute("isPrepaid", isPrepaid(repaidAmount));
|
||||
model.addAttribute("repaidAmount", repaidAmount);
|
||||
|
||||
if (isAdministrator(getLoginUser())) {
|
||||
// 管理员不能审核
|
||||
model.addAttribute("forAudit", false);
|
||||
}
|
||||
else {
|
||||
model.addAttribute("forAudit", forAudit);
|
||||
}
|
||||
|
||||
if (process.getProcessType() != null) {
|
||||
switch (process.getProcessType()) {
|
||||
case sale_contract: {
|
||||
TypedQuery<SaleContract> query = entityManager.createQuery(
|
||||
"from SaleContract where processId=:processId", SaleContract.class);
|
||||
query.setParameter("processId", process.getId());
|
||||
SaleContract contract = query.getSingleResult();
|
||||
model.addAttribute("contract", contract);
|
||||
break;
|
||||
}
|
||||
case procurement_contract: {
|
||||
TypedQuery<ProcurementContract> query = entityManager.createQuery(
|
||||
"from ProcurementContract where processId=:processId", ProcurementContract.class);
|
||||
query.setParameter("processId", process.getId());
|
||||
ProcurementContract contract = query.getSingleResult();
|
||||
model.addAttribute("contract", contract);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new UnsupportedOperationException("还不支持");
|
||||
}
|
||||
}
|
||||
|
||||
return "/admin/business/process-detail";
|
||||
}
|
||||
|
||||
private BigDecimal getRepaidAmount(int id) {
|
||||
return processService.getProjectRepaidAmount(id);
|
||||
}
|
||||
|
||||
private BigDecimal getContractAmount(int id) {
|
||||
return processService.getContractAmount(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索符合条件的项目,供给选择
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/projects")
|
||||
public List<Map<String, Object>> query(@RequestParam String q, @RequestParam ProcessType processType) {
|
||||
Admin admin = getLoginUser();
|
||||
List<Project> projects = processService.queryProjects(q, processType, admin);
|
||||
return projects.stream()
|
||||
.map(project -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("id", project.getId());
|
||||
map.put("name", project.getName());
|
||||
map.put("projectNo", project.getProjectNo());
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static Admin getLoginUser() {
|
||||
Admin admin = InterfaceUtil.getAdmin();
|
||||
if (admin == null) {
|
||||
throw ErrorMessageException.failed("未登录或登录失效");
|
||||
}
|
||||
return admin;
|
||||
}
|
||||
|
||||
@Builder
|
||||
public static class ProjectReturnValue {
|
||||
public final String applyDate = LocalDate.now().format(formatter);
|
||||
public String projectNo;
|
||||
public Integer projectId;
|
||||
public String projectName;
|
||||
|
||||
// 申请人
|
||||
public String applyPersonName;
|
||||
|
||||
// 项目类型
|
||||
public String projectType;
|
||||
|
||||
// 合作类型
|
||||
public String cooperationType;
|
||||
|
||||
// 合同金额
|
||||
public BigDecimal contractAmount;
|
||||
|
||||
public String terminalCustomer;
|
||||
|
||||
public List<ProjectBudgetIncomeDetail> incomeDetails;
|
||||
public List<ProcurementDetail> procurementDetails;
|
||||
|
||||
// FIXME 垫资
|
||||
// 是否垫资
|
||||
public String isPrepaid;
|
||||
|
||||
// 垫资金额
|
||||
public BigDecimal repaidAmount;
|
||||
|
||||
// 预算毛利率
|
||||
public BigDecimal budgetGrossMargin;
|
||||
|
||||
public Object contract;
|
||||
public ProjectProcess process;
|
||||
|
||||
public List<SupplierMaterial> supplierMaterials;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取调谐表单的初始数据
|
||||
*
|
||||
* @param id 项目ID
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/projects/{id}")
|
||||
public ProjectReturnValue getProject(@PathVariable int id, @RequestParam ProcessType processType) {
|
||||
Project project = projectRepository.findById(id);
|
||||
Admin admin = getLoginUser();
|
||||
// project_budget_plan_detail 垫资金额计算
|
||||
BigDecimal repaidAmount = getRepaidAmount(id);
|
||||
|
||||
BigDecimal contractAmount = getContractAmount(id);
|
||||
|
||||
List<ProcurementDetail> procurementDetails = Collections.emptyList();
|
||||
List<ProjectBudgetIncomeDetail> incomeDetails = Collections.emptyList();
|
||||
if (processType == ProcessType.sale_contract) {
|
||||
incomeDetails = projectBudgetService.getBudgetIncomeDetail(project);
|
||||
}
|
||||
else if (processType == ProcessType.procurement_contract) {
|
||||
procurementDetails = processService.getProcurementDetails(id, null);
|
||||
}
|
||||
|
||||
BudgetBean budgetBean = projectBudgetService.getBudget(project);
|
||||
|
||||
return ProjectReturnValue.builder()
|
||||
.isPrepaid(isPrepaid(repaidAmount))
|
||||
.projectId(project.getId())
|
||||
.incomeDetails(incomeDetails)
|
||||
.procurementDetails(procurementDetails)
|
||||
.projectName(project.getName())
|
||||
.repaidAmount(repaidAmount)
|
||||
.budgetGrossMargin(budgetBean.getProjectGrossProfitRate())
|
||||
.projectNo(project.getProjectNo())
|
||||
.applyPersonName(admin.getRealName())
|
||||
.contractAmount(contractAmount)
|
||||
.terminalCustomer(project.getTerminalCustomer())
|
||||
.projectType(Enumerable.of(ProjectType.class, project.getType()).getDescription())
|
||||
.cooperationType(Enumerable.of(CooperationType.class, project.getCooperateType()).getDescription())
|
||||
.build();
|
||||
}
|
||||
|
||||
private String isPrepaid(BigDecimal repaidAmount) {
|
||||
return processService.isProjectPrepaid(repaidAmount) ? "是" : "否";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程详情,不同类型字段有不同
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/{id}")
|
||||
public ProjectProcessDetail get(@PathVariable int id) {
|
||||
ProjectProcess process = obtainProjectProcess(id);
|
||||
|
||||
ProjectProcessDetail detail = new ProjectProcessDetail();
|
||||
detail.setProcessId(id);
|
||||
|
||||
detail.setProcess(process);
|
||||
Project project = projectRepository.findById(process.getProjectId());
|
||||
BudgetBean budgetBean = projectBudgetService.getBudget(project);
|
||||
|
||||
detail.setProject(project);
|
||||
BigDecimal repaidAmount = getRepaidAmount(process.getProjectId());
|
||||
detail.setRepaidAmount(repaidAmount);
|
||||
detail.setBudgetGrossMargin(budgetBean.getProjectGrossProfitRate());
|
||||
Object contract = null;
|
||||
|
||||
List<SupplierMaterial> supplierMaterials = Collections.emptyList();
|
||||
List<ProcurementDetail> procurementDetails = Collections.emptyList();
|
||||
List<ProjectBudgetIncomeDetail> incomeDetails = Collections.emptyList();
|
||||
if (process.getProcessType() == ProcessType.sale_contract) {
|
||||
contract = processService.findSaleContract(id);
|
||||
incomeDetails = projectBudgetService.getBudgetIncomeDetail(project);
|
||||
detail.setContractAmount(getContractAmount(project.getId()));
|
||||
}
|
||||
else if (process.getProcessType() == ProcessType.procurement_contract) {
|
||||
contract = processService.findProcurementContract(id);
|
||||
supplierMaterials = processService.getSupplierMaterials(id);
|
||||
procurementDetails = processService.getProcurementDetails(project.getId(), id);
|
||||
BigDecimal contractAmount = ProjectProcess.getContractAmount(procurementDetails);
|
||||
detail.setContractAmount(contractAmount);
|
||||
}
|
||||
|
||||
detail.setIsPrepaid(isPrepaid(repaidAmount));
|
||||
detail.setContract(contract);
|
||||
detail.setIncomeDetails(incomeDetails);
|
||||
detail.setSupplierMaterials(supplierMaterials);
|
||||
detail.setProcurementDetails(procurementDetails);
|
||||
detail.setProjectType(Enumerable.of(ProjectType.class, project.getType()));
|
||||
detail.setCooperationType(Enumerable.of(CooperationType.class, project.getCooperateType()));
|
||||
List<ProcessAttachment> attachments = JSONArray.parseArray(process.getAttachmentUri(), ProcessAttachment.class);
|
||||
detail.setAttachments(attachments);
|
||||
return detail;
|
||||
}
|
||||
|
||||
// 合同流程
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void post(@RequestBody ProcessCreationForm form) throws Exception {
|
||||
Assert.notNull(form.getProjectId(), "未选择项目");
|
||||
ProcessType processType = form.getProcessType();
|
||||
Assert.notNull(processType, "流程类型不能为空");
|
||||
|
||||
ProjectProcess entity = new ProjectProcess();
|
||||
BeanUtils.copyProperties(form, entity, "sealTypes", "applyDate", "attachments");
|
||||
entity.setApplyDate(LocalDate.parse(form.getApplyDate(), formatter));
|
||||
entity.setSealTypes(SealTypeArray.of(form.getSealTypes()));
|
||||
Admin admin = getLoginUser();
|
||||
entity.setApplyPersonId(admin.getId());
|
||||
entity.setAttachmentUri(JSON.toJSONString(form.getAttachments()));
|
||||
|
||||
entityManager.persist(entity);
|
||||
|
||||
// 保存后流程ID可以获取
|
||||
Integer processId = entity.getId();
|
||||
|
||||
if (processType == ProcessType.sale_contract) {
|
||||
SaleContract contract = SaleContract.from(form);
|
||||
contract.setProcessId(processId);
|
||||
entityManager.persist(contract);
|
||||
|
||||
processService.updateIncomeDetails(form.getIncomeDetails());
|
||||
}
|
||||
else if (processType == ProcessType.procurement_contract) {
|
||||
// 采购合同
|
||||
ProcurementContract contract = ProcurementContract.from(form);
|
||||
contract.setProcessId(processId);
|
||||
entityManager.persist(contract);
|
||||
|
||||
Integer contractId = contract.getId();
|
||||
|
||||
if (!CollectionUtils.isEmpty(form.getSupplierMaterials())) {
|
||||
for (SupplierMaterial material : form.getSupplierMaterials()) {
|
||||
material.setProcessId(processId);
|
||||
material.setContractId(contractId);
|
||||
|
||||
entityManager.persist(material);
|
||||
}
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(form.getPurchaseAmount())) {
|
||||
for (BudgetPurchaseAmountModel amountForm : form.getPurchaseAmount()) {
|
||||
// 草稿模式也不允许为空 (基础数据)
|
||||
Assert.notNull(amountForm.amount, "合同明细填写不完整");
|
||||
Assert.notNull(amountForm.budgetCostId, "合同明细填写不完整");
|
||||
Assert.notNull(amountForm.amountCurrent, "合同明细填写不完整");
|
||||
|
||||
// 新建
|
||||
BudgetPurchaseAmount purchaseAmount = new BudgetPurchaseAmount();
|
||||
purchaseAmount.setProcessId(processId);
|
||||
purchaseAmount.setContractId(contractId);
|
||||
purchaseAmount.setAmount(amountForm.amount);
|
||||
purchaseAmount.setBudgetCostId(amountForm.budgetCostId);
|
||||
purchaseAmount.setAmountCurrent(amountForm.amountCurrent);
|
||||
|
||||
// 提交时该次数量条目生效,撤回的时候 取消该状态
|
||||
purchaseAmount.setSubmit(form.getStatus() == ProcessStatus.to_be_audit);
|
||||
|
||||
entityManager.persist(purchaseAmount);
|
||||
|
||||
Integer amountId = purchaseAmount.getId(); // ID 自动生成或者使用之前已经有的
|
||||
// 保存成本对应的 明细
|
||||
if (!CollectionUtils.isEmpty(amountForm.details)) {
|
||||
for (BudgetPurchaseDetailModel detail : amountForm.details) {
|
||||
BudgetPurchaseDetail purchaseDetail = new BudgetPurchaseDetail();
|
||||
// 关联主键
|
||||
purchaseDetail.setAmountId(amountId);
|
||||
purchaseDetail.setProcessId(processId);
|
||||
purchaseDetail.setContractId(contractId);
|
||||
purchaseDetail.setBudgetCostId(amountForm.budgetCostId);
|
||||
|
||||
BeanUtils.copyProperties(detail, purchaseDetail, "details");
|
||||
entityManager.persist(purchaseDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (form.getStatus() == ProcessStatus.to_be_audit) {
|
||||
// 发起流程
|
||||
processService.startAuditProgress(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PutMapping("/{id}")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(@PathVariable int id, @RequestBody @Valid ProcessUpdateForm form) throws Exception {
|
||||
ProjectProcess entity = obtainProjectProcess(id);
|
||||
|
||||
Integer processId = entity.getId();
|
||||
ProcessType processType = entity.getProcessType();
|
||||
|
||||
entity.setTaxRate(form.getTaxRate());
|
||||
entity.setContractNo(form.getContractNo());
|
||||
entity.setContractName(form.getContractName());
|
||||
entity.setSealTypes(SealTypeArray.of(form.getSealTypes()));
|
||||
entity.setAttachmentUri(JSON.toJSONString(form.getAttachments()));
|
||||
|
||||
entity.setRemark(form.getRemark());
|
||||
entity.setStatus(form.getStatus());
|
||||
entity.setApplyDept(form.getApplyDept());
|
||||
entity.setApplyDeptId(form.getApplyDeptId());
|
||||
entity.setApplyDeptLeaderId(form.getApplyDeptLeaderId());
|
||||
entity.setApplyDeptLeaderName(form.getApplyDeptLeaderName());
|
||||
|
||||
entityManager.merge(entity);
|
||||
|
||||
if (processType == ProcessType.sale_contract) {
|
||||
SaleContract contract = processService.findSaleContract(id);
|
||||
contract.setClientName(form.getClientName());
|
||||
contract.setPaymentTerms(form.getPaymentTerms());
|
||||
contract.setApplyPersonPhone(form.getApplyPersonPhone());
|
||||
entityManager.merge(contract);
|
||||
|
||||
processService.updateIncomeDetails(form.getIncomeDetails());
|
||||
}
|
||||
else if (processType == ProcessType.procurement_contract) {
|
||||
ProcurementContract contract = processService.findProcurementContract(id);
|
||||
contract.setProcurementMode(form.getProcurementMode());
|
||||
contract.setPaymentTerms(form.getPaymentTerms());
|
||||
contract.setSupplierName(form.getSupplierName());
|
||||
entityManager.merge(contract);
|
||||
|
||||
Integer contractId = contract.getId();
|
||||
|
||||
// 本次表单的数据为全量数据 需要删除
|
||||
List<SupplierMaterial> supplierMaterialsToRemove = processService.getSupplierMaterials(processId);
|
||||
if (!CollectionUtils.isEmpty(form.supplierMaterials)) {
|
||||
for (SupplierMaterial material : form.supplierMaterials) {
|
||||
material.setProcessId(processId);
|
||||
material.setContractId(contractId);
|
||||
// 更新或者新增
|
||||
if (material.getId() != null) {
|
||||
// 更新了某个ID的数据就不删除了
|
||||
supplierMaterialsToRemove.remove(material);
|
||||
entityManager.merge(material);
|
||||
}
|
||||
else {
|
||||
entityManager.persist(material);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (SupplierMaterial material : supplierMaterialsToRemove) {
|
||||
entityManager.remove(material);
|
||||
}
|
||||
|
||||
List<BudgetPurchaseAmount> purchaseAmountToRemove = processService.getProcessPurchaseAmount(processId);
|
||||
List<BudgetPurchaseDetail> purchaseDetailToRemove = processService.getProcessPurchaseDetail(processId);
|
||||
|
||||
if (!CollectionUtils.isEmpty(form.purchaseAmount)) {
|
||||
for (BudgetPurchaseAmountModel amountForm : form.purchaseAmount) {
|
||||
// 草稿模式也不允许为空 (基础数据), 更新ID不能为空
|
||||
Assert.notNull(amountForm.amount, "合同明细填写不完整");
|
||||
Assert.notNull(amountForm.budgetCostId, "合同明细填写不完整");
|
||||
|
||||
// 新建
|
||||
BudgetPurchaseAmount purchaseAmount = new BudgetPurchaseAmount();
|
||||
purchaseAmount.setProcessId(processId);
|
||||
purchaseAmount.setContractId(contractId);
|
||||
purchaseAmount.setAmount(amountForm.amount);
|
||||
purchaseAmount.setBudgetCostId(amountForm.budgetCostId);
|
||||
purchaseAmount.setAmountCurrent(amountForm.amountCurrent);
|
||||
purchaseAmount.setSubmit(form.getStatus() == ProcessStatus.to_be_audit);
|
||||
|
||||
if (amountForm.amountId != null) {
|
||||
// 更新了某个ID的数据就不删除了
|
||||
purchaseAmount.setId(amountForm.amountId);
|
||||
purchaseAmountToRemove.remove(purchaseAmount);
|
||||
entityManager.merge(purchaseAmount);
|
||||
}
|
||||
else {
|
||||
entityManager.persist(purchaseAmount);
|
||||
}
|
||||
|
||||
Integer amountId = purchaseAmount.getId(); // ID 自动生成或者使用之前已经有的
|
||||
// 保存成本对应的 明细
|
||||
if (!CollectionUtils.isEmpty(amountForm.details)) {
|
||||
for (BudgetPurchaseDetailModel detail : amountForm.details) {
|
||||
BudgetPurchaseDetail purchaseDetail = new BudgetPurchaseDetail();
|
||||
// 关联主键
|
||||
purchaseDetail.setAmountId(amountId);
|
||||
purchaseDetail.setProcessId(processId);
|
||||
purchaseDetail.setContractId(contractId);
|
||||
purchaseDetail.setBudgetCostId(amountForm.budgetCostId);
|
||||
|
||||
BeanUtils.copyProperties(detail, purchaseDetail, "details");
|
||||
|
||||
if (detail.id != null) {
|
||||
// 更新了某个ID的数据就不删除了
|
||||
purchaseDetail.setId(detail.id);
|
||||
purchaseDetailToRemove.remove(purchaseDetail);
|
||||
entityManager.merge(purchaseDetail);
|
||||
}
|
||||
else {
|
||||
entityManager.persist(purchaseDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
for (BudgetPurchaseAmount amount : purchaseAmountToRemove) {
|
||||
entityManager.remove(amount);
|
||||
}
|
||||
|
||||
for (BudgetPurchaseDetail detail : purchaseDetailToRemove) {
|
||||
entityManager.remove(detail);
|
||||
}
|
||||
}
|
||||
|
||||
if (form.getStatus() == ProcessStatus.to_be_audit) {
|
||||
processService.startAuditProgress(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/query")
|
||||
public Page<ProjectProcess> list(@RequestBody ProcessQueryForm form, Pageable pageable,
|
||||
@RequestParam(defaultValue = "false") boolean forAudit) {
|
||||
// 从 0 开始
|
||||
PageRequest pageRequest = new PageRequest(pageable.getPageNumber() - 1, pageable.getPageSize(),
|
||||
new Sort(Sort.Direction.DESC, "lastUpdateAt", "createAt"));
|
||||
|
||||
ProjectProcess projectProcess = new ProjectProcess();
|
||||
BeanUtils.copyProperties(form, projectProcess);
|
||||
projectProcess.setStatus(form.getProcessStatus());
|
||||
|
||||
ExampleMatcher exampleMatcher = ExampleMatcher.matching()
|
||||
.withMatcher("contractNo", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("projectNo", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("projectTitle", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("applyPersonName", ExampleMatcher.GenericPropertyMatcher::contains);
|
||||
Admin admin = getLoginUser();
|
||||
Integer loginUserId = admin.getId();
|
||||
|
||||
// 待我审核
|
||||
if (forAudit) {
|
||||
// 超级管理员也看不到,除非该他审核
|
||||
return repository.findAll((root, query, cb) -> {
|
||||
Predicate predicate = QueryByExamplePredicateBuilder.getPredicate(root, cb, Example.of(projectProcess, exampleMatcher));
|
||||
// 添加新的条件
|
||||
Expression<Integer> findInSet = cb.function("find_in_set", Integer.class, cb.literal(loginUserId), root.get("currentAuditId"));
|
||||
return cb.and(predicate, cb.greaterThan(findInSet, 0));
|
||||
}, pageRequest);
|
||||
}
|
||||
|
||||
// 已办流程
|
||||
|
||||
if (isAdministrator(admin)) {
|
||||
// 超级好管理员不需要
|
||||
return repository.findAll(Example.of(projectProcess, exampleMatcher), pageRequest);
|
||||
}
|
||||
|
||||
return repository.findAll((root, query, cb) -> {
|
||||
Predicate predicate = QueryByExamplePredicateBuilder.getPredicate(root, cb, Example.of(projectProcess, exampleMatcher));
|
||||
// 添加新的条件
|
||||
Predicate applyPersonId = cb.equal(root.get("applyPersonId"), loginUserId);
|
||||
|
||||
// 待自己审的
|
||||
Expression<Integer> findInSet = cb.function("find_in_set", Integer.class, cb.literal(loginUserId), root.get("currentAuditId"));
|
||||
Expression<Integer> reviewedIdFindInSet = cb.function("find_in_set", Integer.class, cb.literal(loginUserId), root.get("reviewedId"));
|
||||
|
||||
Predicate or = cb.or(applyPersonId,
|
||||
cb.greaterThan(reviewedIdFindInSet, 0),
|
||||
cb.greaterThan(findInSet, 0));
|
||||
|
||||
return cb.and(predicate, or);
|
||||
}, pageRequest);
|
||||
}
|
||||
|
||||
private boolean isAdministrator(Admin admin) {
|
||||
return admin != null && admin.getRoleType() == SysRole.ROLE_TYPE_SYSTEM;
|
||||
}
|
||||
|
||||
// 审核
|
||||
@Data
|
||||
static class AuditForm {
|
||||
|
||||
// 流程ID
|
||||
private Integer processId;
|
||||
|
||||
// 审核意见
|
||||
@NotNull
|
||||
private String auditOpinion;
|
||||
|
||||
// 审核状态
|
||||
private ProcessStatus processStatus;
|
||||
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@Transactional
|
||||
@PostMapping("/audit")
|
||||
public void audit(@RequestBody @Valid AuditForm form) {
|
||||
if (form.processId == null) {
|
||||
throw ErrorMessageException.failed("表单错误");
|
||||
}
|
||||
ProjectProcess process = obtainProjectProcess(form.processId);
|
||||
ActApproveTypeEnum approveType = form.processStatus == ProcessStatus.audit_passed ? ActApproveTypeEnum.APPROVAL_PASSED :
|
||||
ActApproveTypeEnum.APPROVAL_UN_PASS;
|
||||
|
||||
Admin admin = getLoginUser();
|
||||
String reviewedId = process.getReviewedId();
|
||||
|
||||
ArrayList<String> reviewed = new ArrayList<>();
|
||||
if (reviewedId != null) {
|
||||
String[] split = reviewedId.split(",");
|
||||
Collections.addAll(reviewed, split);
|
||||
}
|
||||
reviewed.add(String.valueOf(admin.getId()));
|
||||
reviewedId = String.join(",", reviewed);
|
||||
process.setReviewedId(reviewedId);
|
||||
entityManager.merge(process);
|
||||
// jdbcTemplate.update("update project_process set reviewed_id =? where id=?", reviewed, process.getId());
|
||||
|
||||
switch (process.getProcessType()) {
|
||||
case procurement_contract:
|
||||
projectInstanceService.completeTaskByProjectId(process.getId(), ActProjectTypeEnum.BUSINESS_PURCHASE, approveType, form.auditOpinion);
|
||||
break;
|
||||
case sale_contract:
|
||||
projectInstanceService.completeTaskByProjectId(process.getId(), ActProjectTypeEnum.SALE_CONTRACT, approveType, form.auditOpinion);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/revoke/{id}")
|
||||
public void revoke(@PathVariable("id") int id) {
|
||||
Admin admin = getLoginUser();
|
||||
if (isAdministrator(admin)) {
|
||||
processService.revoke(id);
|
||||
}
|
||||
else {
|
||||
ProjectProcess process = obtainProjectProcess(id);
|
||||
Integer applyPersonId = process.getApplyPersonId();
|
||||
if (!Objects.equals(admin.getId(), applyPersonId)) {
|
||||
throw ErrorMessageException.failed("流程不属于自己");
|
||||
}
|
||||
List<ProjectTaskRecord> projectTaskRecords = getProjectTaskRecords(id, process.getProcessType());
|
||||
if (projectTaskRecords.size() > 1) {
|
||||
// 可能存在撤销情况 会出现 多次 -> 提交申请 提交销售合同流程
|
||||
// 第一个审核详情肯定是 提交申请 ,检查最后一个是不是 提交申请 是的话就可以撤回
|
||||
ProjectTaskRecord lastRecord = projectTaskRecords.get(projectTaskRecords.size() - 1);
|
||||
if (!isStartAuditProgress(lastRecord)) {
|
||||
// 有多个人审核过
|
||||
throw ErrorMessageException.failed("流程已经在审核中,不能撤回");
|
||||
}
|
||||
}
|
||||
processService.revoke(id);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isStartAuditProgress(ProjectTaskRecord record) {
|
||||
return Objects.equals("提交申请", record.getTaskName());
|
||||
}
|
||||
|
||||
private ProjectProcess obtainProjectProcess(int id) {
|
||||
ProjectProcess projectProcess = processService.getById(id);
|
||||
if (projectProcess == null) {
|
||||
throw ErrorMessageException.failed("流程不存在");
|
||||
}
|
||||
return projectProcess;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public void delete(@PathVariable("id") int id) {
|
||||
ProjectProcess process = obtainProjectProcess(id);
|
||||
Integer applyUserId = getLoginUser().getId();
|
||||
if (!Objects.equals(process.getApplyPersonId(), applyUserId)) {
|
||||
throw ErrorMessageException.failed("删除的流程不存在或者不属于自己");
|
||||
}
|
||||
|
||||
if (process.getProcessType() == ProcessType.sale_contract) {
|
||||
Query query = entityManager.createQuery("delete from SaleContract where processId=:processId");
|
||||
query.setParameter("processId", id);
|
||||
query.executeUpdate();
|
||||
}
|
||||
else if (process.getProcessType() == ProcessType.procurement_contract) {
|
||||
Query query = entityManager.createQuery("delete from ProcurementContract where processId=:processId");
|
||||
query.setParameter("processId", id);
|
||||
query.executeUpdate();
|
||||
|
||||
query = entityManager.createQuery("delete from SupplierMaterial where processId=:processId");
|
||||
query.setParameter("processId", id);
|
||||
query.executeUpdate();
|
||||
|
||||
query = entityManager.createQuery("delete from BudgetPurchaseAmount where processId=:processId");
|
||||
query.setParameter("processId", id);
|
||||
query.executeUpdate();
|
||||
|
||||
query = entityManager.createQuery("delete from BudgetPurchaseDetail where processId=:processId");
|
||||
query.setParameter("processId", id);
|
||||
query.executeUpdate();
|
||||
|
||||
}
|
||||
|
||||
Query query = entityManager.createQuery("delete from ProjectProcess where id=:processId");
|
||||
query.setParameter("processId", id);
|
||||
query.executeUpdate();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看审核流程
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/audits/{id}")
|
||||
public List<Map<String, String>> showAudits(@PathVariable("id") int id) {
|
||||
// ArrayList<Map<String, String>> ret = new ArrayList<>();
|
||||
// ret.add(create("2021-01-03 12:07:45", "提交审核"));
|
||||
// ret.add(create("2021-01-28 12:15:05", "工程运维管理部孙果审核已通过"));
|
||||
// ret.add(create("2021-02-03 22:01:12", "系统产品集成部尹浩审核已通过"));
|
||||
// ret.add(create("2021-03-03 22:05:12", "财务部主管何丹审核已通过"));
|
||||
|
||||
ProjectProcess process = obtainProjectProcess(id);
|
||||
ProcessType processType = process.getProcessType();
|
||||
List<ProjectTaskRecord> projectTaskRecords = getProjectTaskRecords(id, processType);
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return projectTaskRecords.stream()
|
||||
.map(item -> {
|
||||
Date createTime = item.getCreateTime();
|
||||
return create(format.format(createTime), item.getTaskName() + ": " + item.getTaskComment());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<ProjectTaskRecord> getProjectTaskRecords(int id, ProcessType processType) {
|
||||
return projectTaskRecordService.listV2(id,
|
||||
processType == ProcessType.sale_contract ? ActProjectTypeEnum.SALE_CONTRACT : ActProjectTypeEnum.BUSINESS_PURCHASE);
|
||||
}
|
||||
|
||||
private Map<String, String> create(String timestamp, String content) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("content", content);
|
||||
map.put("timestamp", timestamp);
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.ProcurementType;
|
||||
import cn.palmte.work.service.ProcurementTypeService;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/procurement/type")
|
||||
public class ProcurementTypeController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private ProcurementTypeService procurementTypeService;
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* @param keywords
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
model.put("keywords",keywords);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||
model.put(PAGER,procurementTypeService.list(searchInfo,pageNumber,pageSize));
|
||||
return "/admin/procurement_type_list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转新增页面
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/add")
|
||||
public String add( Map<String, Object> model){
|
||||
ProcurementType procurementType = new ProcurementType();
|
||||
model.put("procurementTypeId",-1);
|
||||
model.put("procurementType",procurementType);
|
||||
return "/admin/procurement_type_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到编辑页面
|
||||
*/
|
||||
@RequestMapping("/edit")
|
||||
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
||||
ProcurementType procurementType = procurementTypeService.findOne(id);
|
||||
model.put("procurementTypeId",id);
|
||||
model.put("procurementType", procurementType);
|
||||
return "/admin/procurement_type_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param procurementTypeId
|
||||
* @param procurementType
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/save")
|
||||
public String save(@RequestParam("procurementTypeId") int procurementTypeId,
|
||||
ProcurementType procurementType, Map<String, Object> model){
|
||||
|
||||
procurementTypeService.saveOtUpdate(procurementTypeId,procurementType);
|
||||
return "redirect:/procurement/type/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/delete")
|
||||
@ResponseBody
|
||||
public ResponseMsg delete(@RequestParam("ids") String ids){
|
||||
String[] deleteIds=ids.split("#%#");
|
||||
boolean deleted = procurementTypeService.deleteByIDs(deleteIds);
|
||||
|
||||
ResponseMsg responseMsge=new ResponseMsg();
|
||||
if(deleted){
|
||||
responseMsge.setStatus(0);
|
||||
responseMsge.setMsg("删除成功");
|
||||
} else{
|
||||
responseMsge.setStatus(1);
|
||||
responseMsge.setMsg("删除失败");
|
||||
}
|
||||
return responseMsge;
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用 禁用
|
||||
*/
|
||||
@RequestMapping("/enableOrDisable")
|
||||
@ResponseBody
|
||||
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
|
||||
@RequestParam("status") int status, RedirectAttributes attr) {
|
||||
boolean isSuccess = false;
|
||||
try {
|
||||
isSuccess = procurementTypeService.enableOrDisable(status, id);
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
}
|
||||
if (isSuccess) {
|
||||
return ResponseMsg.buildSuccessMsg("操作成功");
|
||||
} else {
|
||||
return ResponseMsg.buildSuccessMsg("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
@RequestMapping("/export")
|
||||
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||
downloadHeader(httpServletResponse , Utils.generateExcelName("采购类型表"), "application/octet-stream");
|
||||
String[] headers = {"采购类型名称","所属大类","创建人","创建时间"};
|
||||
String[] exportColumns = {"name","typeName","createdBy","createdTime"};
|
||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||
httpServletResponse.getOutputStream(), (pN, pS) -> procurementTypeService.list(searchInfo, pN, pS).getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 类型和类别的映射关系
|
||||
*/
|
||||
@RequestMapping("/map")
|
||||
@ResponseBody
|
||||
public ResponseMsg map() {
|
||||
List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList();
|
||||
Map<Integer, List<ProcurementType>> map = procurementTypes.stream().collect(Collectors.groupingBy(ProcurementType::getType));
|
||||
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
objectMap.put("procurementTypes", procurementTypes);
|
||||
objectMap.put("map", map);
|
||||
return ResponseMsg.buildSuccessData(objectMap);
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,110 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.FinalBean;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.model.ProjectBudgetPlanDetail;
|
||||
import cn.palmte.work.model.ProjectSettleIncome;
|
||||
import cn.palmte.work.model.ProjectSettleIncomeRepository;
|
||||
import cn.palmte.work.service.*;
|
||||
import cn.palmte.work.utils.FreeMarkerUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.datetime.DateFormatter;
|
||||
import org.springframework.format.number.NumberStyleFormatter;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/project/final")
|
||||
public class ProjectFinalController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private ProjectFinalSevice projectFinalSevice;
|
||||
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
|
||||
@Autowired
|
||||
private ProjectEstimateService projectEstimateService;
|
||||
|
||||
@Autowired
|
||||
private ProjectBudgetService projectBudgetService;
|
||||
|
||||
@Autowired
|
||||
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
|
||||
|
||||
@Autowired
|
||||
private ProjectSettleService projectSettleService;
|
||||
|
||||
@RequestMapping("/add")
|
||||
public String add(@RequestParam("id") int id, Map<String, Object> model) {
|
||||
Project project = projectService.getProject(id);
|
||||
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
||||
String time = "";
|
||||
if(null != projectSettleIncome){
|
||||
time = projectSettleIncome.getTime();
|
||||
}
|
||||
|
||||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||
model.put("project", project);
|
||||
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
||||
model.put("budgetBean", projectBudgetService.getBudget(project));
|
||||
model.put("settleBean",projectSettleService.getCurrentSettle(project, time));
|
||||
model.put("finalBean",new FinalBean());
|
||||
//现金表
|
||||
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
||||
//freemarker可以利用的静态方法
|
||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||
return "admin/project_final_add";
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
||||
Project project = projectService.getProject(id);
|
||||
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
||||
String time = projectSettleIncome.getTime();
|
||||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||
model.put("project", project);
|
||||
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
||||
model.put("budgetBean", projectBudgetService.getBudget(project));
|
||||
model.put("settleBean",projectSettleService.getCurrentSettle(project, time));
|
||||
model.put("finalBean",projectFinalSevice.getFinal(project));
|
||||
//现金表
|
||||
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
||||
//freemarker可以利用的静态方法
|
||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||
return "admin/project_final_edit";
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
public String estimateAddSave(Project project, FinalBean finalBean, Map<String, Object> model) {
|
||||
projectFinalSevice.save(project,finalBean);
|
||||
return "redirect:/project/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存并提交审批
|
||||
*
|
||||
* @param project
|
||||
* @param finalBean
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/saveAndApprove")
|
||||
public String saveAndApprove(Project project, FinalBean finalBean, Map<String, Object> model) throws Exception{
|
||||
projectFinalSevice.saveAndApprove(project,finalBean);
|
||||
return "redirect:/project/list";
|
||||
}
|
||||
|
||||
@InitBinder
|
||||
public void initBinder(WebDataBinder webDataBinder) {
|
||||
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
|
||||
webDataBinder.addCustomFormatter(new NumberStyleFormatter());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.BudgetSettleBean;
|
||||
import cn.palmte.work.bean.EstimateSettleBean;
|
||||
import cn.palmte.work.bean.FormerBean;
|
||||
import cn.palmte.work.bean.SettleBean;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.service.ProjectBudgetService;
|
||||
import cn.palmte.work.service.ProjectEstimateService;
|
||||
import cn.palmte.work.service.ProjectService;
|
||||
import cn.palmte.work.service.ProjectSettleService;
|
||||
import cn.palmte.work.utils.DateKit;
|
||||
import cn.palmte.work.utils.FreeMarkerUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.datetime.DateFormatter;
|
||||
import org.springframework.format.number.NumberStyleFormatter;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import top.jfunc.common.utils.CollectionUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Yuanping Zhang
|
||||
* @date 2021/11/15
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/project/settle")
|
||||
public class ProjectSettleController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
|
||||
@Autowired
|
||||
private ProjectEstimateService projectEstimateService;
|
||||
|
||||
@Autowired
|
||||
private ProjectBudgetService projectBudgetService;
|
||||
|
||||
@Autowired
|
||||
private ProjectSettleService projectSettleService;
|
||||
|
||||
@Autowired
|
||||
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
|
||||
|
||||
@Autowired
|
||||
private ProjectUserTimeRepository projectUserTimeRepository;
|
||||
|
||||
@Autowired
|
||||
private ProjectSettleMonthRangeRepository projectSettleMonthRangeRepository;
|
||||
|
||||
@RequestMapping("/add")
|
||||
public String add(@RequestParam("id") int id, Map<String, Object> model) {
|
||||
String time = null;
|
||||
Project project = projectService.getProject(id);
|
||||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
||||
if (projectSettleIncome != null) {
|
||||
String former = projectSettleIncome.getTime();
|
||||
Date date = DateKit.getDate(former, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||
Calendar instance = Calendar.getInstance();
|
||||
instance.setTime(date);
|
||||
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH) + 1);
|
||||
Date current = instance.getTime();
|
||||
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||
model.put("startMonth", time);
|
||||
model.put("endMonth", time);
|
||||
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
|
||||
} else {
|
||||
time = DateKit.toStr(project.getStartDate(), DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||
|
||||
model.put("startMonth", time);
|
||||
model.put("endMonth", time);
|
||||
model.put("formerBean", new FormerBean());
|
||||
}
|
||||
|
||||
model.put("project", project);
|
||||
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
||||
model.put("budgetBean", projectBudgetService.getBudget(project));
|
||||
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
|
||||
if(CollectionUtil.isNotEmpty(projectUserTimes)){
|
||||
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
model.put("salary", result);
|
||||
} else {
|
||||
model.put("salary", new BigDecimal(0));
|
||||
}
|
||||
//现金表
|
||||
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
||||
//freemarker可以利用的静态方法
|
||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||
return "admin/project_settle_add";
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
||||
Project project = projectService.getProject(id);
|
||||
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
||||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||
String time = projectSettleIncome.getTime();
|
||||
ProjectSettleMonthRange projectSettleMonthRange = projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(id, time);
|
||||
if (projectSettleMonthRange != null) {
|
||||
model.put("startMonth", projectSettleMonthRange.getStartDate());
|
||||
} else {
|
||||
model.put("startMonth", time);
|
||||
}
|
||||
model.put("endMonth", time);
|
||||
model.put("project", project);
|
||||
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
||||
model.put("budgetBean", projectBudgetService.getBudget(project));
|
||||
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
|
||||
model.put("monthBean", projectSettleService.getMonthSettle(project, time));
|
||||
model.put("currentBean", projectSettleService.getCurrentSettle(project, time));
|
||||
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
|
||||
if(CollectionUtil.isNotEmpty(projectUserTimes)){
|
||||
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
model.put("salary", result);
|
||||
} else {
|
||||
model.put("salary", new BigDecimal(0));
|
||||
}
|
||||
//现金表
|
||||
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
||||
//freemarker可以利用的静态方法
|
||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||
return "admin/project_settle_edit";
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
public String save(Project project, BindingResult bindingResult, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String startMonth, String endMonth) {
|
||||
if (!startMonth.equals(endMonth) && projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(project.getId(), endMonth) == null) {
|
||||
ProjectSettleMonthRange range = new ProjectSettleMonthRange();
|
||||
range.setProjectId(project.getId());
|
||||
range.setStartDate(startMonth);
|
||||
range.setEndDate(endMonth);
|
||||
projectSettleMonthRangeRepository.save(range);
|
||||
}
|
||||
projectSettleService.save(project, settleBean, budgetBean, estimateBean, endMonth);
|
||||
return "redirect:/project/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存并提交审批
|
||||
* @param project
|
||||
* @param settleBean
|
||||
* @param budgetBean
|
||||
* @param estimateBean
|
||||
* @param endMonth
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/saveAndApprove")
|
||||
public String saveAndApprove(Project project, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String startMonth, String endMonth) throws Exception{
|
||||
if (!startMonth.equals(endMonth) && projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(project.getId(), endMonth) == null) {
|
||||
ProjectSettleMonthRange range = new ProjectSettleMonthRange();
|
||||
range.setProjectId(project.getId());
|
||||
range.setStartDate(startMonth);
|
||||
range.setEndDate(endMonth);
|
||||
projectSettleMonthRangeRepository.save(range);
|
||||
}
|
||||
projectSettleService.saveAndApprove(project, settleBean, budgetBean, estimateBean, endMonth);
|
||||
return "redirect:/project/list";
|
||||
}
|
||||
|
||||
@InitBinder
|
||||
public void initBinder(WebDataBinder webDataBinder) {
|
||||
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
|
||||
webDataBinder.addCustomFormatter(new NumberStyleFormatter());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.SettleBean;
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.service.ProjectSummaryService;
|
||||
import cn.palmte.work.utils.DateKit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 项目汇总统计
|
||||
* @author Yuanping Zhang
|
||||
* @date 2021/11/10
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/projectSummary")
|
||||
public class ProjectSummaryController extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProjectSummaryController.class);
|
||||
|
||||
@Autowired
|
||||
private ProjectSummaryService projectSummaryService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = KEYWORDS, required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
//当前登录人的角色类型
|
||||
Admin admin = getAdmin();
|
||||
model.put("keywords",keywords);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||
String time;
|
||||
if (!searchInfo.containsKey("time")) {
|
||||
Calendar instance = Calendar.getInstance();
|
||||
instance.setTime(new Date());
|
||||
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH));
|
||||
Date current = instance.getTime();
|
||||
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||
model.put("time", time);
|
||||
} else {
|
||||
time = searchInfo.get("time");
|
||||
}
|
||||
List<SettleBean> list = projectSummaryService.getList(searchInfo, time, admin);
|
||||
model.put("pager", list);
|
||||
|
||||
return "admin/project_statistics";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.pojo.SpaceVO;
|
||||
import cn.palmte.work.service.ProjectService;
|
||||
import cn.palmte.work.service.SpaceService;
|
||||
import cn.palmte.work.utils.FreeMarkerUtil;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import top.jfunc.common.db.bean.Page;
|
||||
import top.jfunc.common.utils.CollectionUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/space")
|
||||
public class SpaceController extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
|
||||
|
||||
@Autowired
|
||||
private SpaceService spaceService;
|
||||
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
|
||||
/**
|
||||
* 项目列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
||||
@RequestParam(value = "certainty") int certainty,
|
||||
@RequestParam(value = "certaintyStr", required = false) String certaintyStr,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
//当前登录人的角色类型
|
||||
model.put("keywords", keywords);
|
||||
model.put("pageNumber", pageNumber);
|
||||
Admin admin = InterfaceUtil.getAdmin();
|
||||
model.put("adminId", admin.getId());
|
||||
model.put("admin", admin);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||
if (certainty == 0) {
|
||||
if (certaintyStr.startsWith("A")) {
|
||||
certainty = 1;
|
||||
} else if (certaintyStr.startsWith("B")) {
|
||||
certainty = 2;
|
||||
} else if (certaintyStr.startsWith("C")) {
|
||||
certainty = 3;
|
||||
}
|
||||
}
|
||||
model.put("certainty", certainty);
|
||||
searchInfo.putIfAbsent("certainty", String.valueOf(certainty));
|
||||
searchInfo.putIfAbsent("deptName", "销售管理部");
|
||||
searchInfo.putIfAbsent("estimateStatus", String.valueOf(1));
|
||||
Page<Project> page = spaceService.list(searchInfo, pageNumber, pageSize);
|
||||
List<Project> list = page.getList();
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
|
||||
int offset = (pageNumber - 1) * pageSize;
|
||||
for (int i = 0 , size = list.size(); i < size; i++) {
|
||||
list.get(i).setTempId(i+1 + offset);
|
||||
}
|
||||
}
|
||||
model.put("pager", page);
|
||||
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
|
||||
return "admin/space_list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目导出
|
||||
*/
|
||||
@RequestMapping("/export")
|
||||
public void export(@RequestParam(value = "keywords", required = false) String keywords, @RequestParam(value = "certainty") int certainty, HttpServletResponse httpServletResponse) throws IOException {
|
||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||
searchInfo.putIfAbsent("certainty", String.valueOf(certainty));
|
||||
searchInfo.putIfAbsent("deptName", "销售管理部");
|
||||
searchInfo.putIfAbsent("estimateStatus", String.valueOf(1));
|
||||
downloadHeader(httpServletResponse, Utils.generateExcelName("项目报表"), "application/octet-stream");
|
||||
String[] headers = {"项目编号", "项目名称", "项目类型", "垫资模式", "华智产品金额", "华三产品金额", "汇智产品金额", "其他产品金额", "项目把握度", "项目计划招标时间", "预计合同签订时间",
|
||||
"计收计划", "项目毛利", "合同金额", "项目解决方案", "具体解决方案", "是否二次签单", "最终用户名称", "客户名称", "紫光汇智直接投标/集成商转签", "负责人", "备注","项目阶段"};
|
||||
String[] exportColumns = {"projectNo", "name", "typeDesc", "underwrittenModeStr", "huazhiRound", "huasanRound", "huizhiRound", "ziguangRound", "certaintyStr", "bidsTimeStr", "contractTimeStr",
|
||||
"calculationCollection", "grossProfitRound", "contractRound", "resolvePlanStr", "mainContractResolvePlan", "isSecondStr", "terminalCustomer", "customer", "signTypeStr", "principal", "remark","stageName"};
|
||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||
httpServletResponse.getOutputStream(), (pN, pS) -> spaceService.list(searchInfo, pN, pS).getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转页面
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/statistics")
|
||||
public String statistics(Map<String, Object> model) {
|
||||
|
||||
return "/admin/space_statistics";
|
||||
}
|
||||
|
||||
@RequestMapping("/listData")
|
||||
@ResponseBody
|
||||
public String listData() {
|
||||
|
||||
SpaceVO spaceVO = spaceService.getListData();
|
||||
return JSONObject.toJSONString(spaceVO);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.CashFlowStatisticsBean;
|
||||
import cn.palmte.work.bean.PrimaryIndicatorBean;
|
||||
import cn.palmte.work.bean.StatisticsBean;
|
||||
import cn.palmte.work.service.StatisticsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/statistics")
|
||||
public class StatisticsController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private StatisticsService statisticsService;
|
||||
|
||||
@RequestMapping("/month")
|
||||
public String month(Map<String, Object> model){
|
||||
StatisticsBean statisticsData = statisticsService.getStatisticsData();
|
||||
model.put("primaryIndicatorList",statisticsData.getPrimaryIndicatorBeanList());
|
||||
model.put("profitAndLossList",statisticsData.getProfitAndLossBeanList());
|
||||
model.put("cashFlowList",statisticsData.getCashFlowStatisticsBeanList());
|
||||
return "admin/month_statistics";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.model.SysConfig;
|
||||
import cn.palmte.work.model.SysConfigRepository;
|
||||
import cn.palmte.work.pojo.SysConfigRequest;
|
||||
import cn.palmte.work.service.SysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/sys/config")
|
||||
public class SysConfigController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private SysConfigService sysConfigService;
|
||||
|
||||
@Autowired
|
||||
private SysConfigRepository sysConfigRepository;
|
||||
|
||||
@RequestMapping("/edit")
|
||||
public String edit(Map<String, Object> model) {
|
||||
model.put(SysConfig.KEY_UNDERWRITTENTAXRATE,sysConfigRepository.findByCodeEquals(SysConfig.KEY_UNDERWRITTENTAXRATE).getValue());
|
||||
model.put(SysConfig.KEY_PROJECTCONTRIBUTIONPROFITRATETHRESHOLD,sysConfigRepository.findByCodeEquals(SysConfig.KEY_PROJECTCONTRIBUTIONPROFITRATETHRESHOLD).getValue());
|
||||
return "admin/profit_marfin_config_input";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/save")
|
||||
public ResponseMsg save(@RequestBody String json) {
|
||||
return sysConfigService.saveOrUpdate(json);
|
||||
}
|
||||
|
||||
@RequestMapping("/checkRate")
|
||||
@ResponseBody
|
||||
public ResponseMsg checkRate() {
|
||||
String value = sysConfigRepository.findByCodeEquals(SysConfig.KEY_UNDERWRITTENTAXRATE).getValue();
|
||||
double rate = Double.parseDouble(value);
|
||||
if (rate <= 0) {
|
||||
return ResponseMsg.buildFailedMsg("项目年利率未填写或小于等于0,请联系管理员配置");
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("成功");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.SysPermission;
|
||||
import cn.palmte.work.model.SysPermissionRepository;
|
||||
import cn.palmte.work.service.SysPermissionService;
|
||||
import cn.palmte.work.service.SysRolePermissionService;
|
||||
import cn.palmte.work.utils.DateKit;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 资源管理
|
||||
*@author nsp
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/permission")
|
||||
|
||||
public class SysPermissionController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService sysPermissionService;
|
||||
@Autowired
|
||||
private SysPermissionRepository sysPermissionRepository;
|
||||
@Autowired
|
||||
private SysRolePermissionService sysRolePermissionService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SysPermissionController.class);
|
||||
|
||||
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
||||
@RequestParam(value = "pageNumber",defaultValue = "1") String pageNumber,
|
||||
@RequestParam(value = "sql", required = false) String sql,
|
||||
Map<String, Object> model){
|
||||
// 初始化参数
|
||||
setModel(keywords, model);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||
model.put("pager",sysPermissionService.getAllPermissionListByPage(searchInfo,pageNumber));
|
||||
model.put("sql", sql);
|
||||
|
||||
return "/admin/sys_permission_list";
|
||||
}
|
||||
|
||||
private void setModel(String keywords, Map<String, Object> model){
|
||||
model.put("pmsLevel","0");
|
||||
model.put("pmsType","0");
|
||||
model.put("pmsDeleted","-1");
|
||||
model.put("permissionID","-1");
|
||||
model.put("keywords",keywords);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/add")
|
||||
public String add( Map<String, Object> model){
|
||||
SysPermission permission=new SysPermission();
|
||||
model.put("permissionID","-1");
|
||||
model.put("permission",permission);
|
||||
model.put("ps", sysPermissionRepository.findPermissions());
|
||||
return "/admin/sys_permission_input";
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/save")
|
||||
public String save(@RequestParam("permissionID") String permissionID,
|
||||
SysPermission sysPermission, RedirectAttributes attr, Map<String, Object> model) throws IOException{
|
||||
|
||||
final SysPermission parent = sysPermissionRepository.findOne(sysPermission.getParentId());
|
||||
sysPermission.setLevel(parent.getLevel()+1);
|
||||
int type = (parent.getLevel()==4) ? 2 : 1;
|
||||
sysPermission.setType(type);
|
||||
|
||||
String message = sysPermissionService.check(sysPermission,permissionID);
|
||||
|
||||
if (StringUtils.isNotEmpty(message)) {
|
||||
model.put("errorMessage", message);
|
||||
return "/common/error";
|
||||
}
|
||||
|
||||
if ("-1".equals(permissionID)){
|
||||
getSql(sysPermission, attr, parent);
|
||||
sysPermissionService.addPermission(sysPermission); //新增
|
||||
}else {
|
||||
sysPermissionService.updatePermission(sysPermission,permissionID); // 修改
|
||||
}
|
||||
return "redirect:/permission/list";
|
||||
}
|
||||
|
||||
private void getSql(SysPermission sysPermission, RedirectAttributes attr, SysPermission parent) {
|
||||
String sql1 = "INSERT INTO `sys_permission` (`name`, `icon`, `url`, `permission`, `parent_id`, `level`, `type`, `sort`, `remark`, `is_deleted`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES ('{name}', '', '{url}', '{permission}', (SELECT id FROM sys_permission sp WHERE sp.permission = '{parentPermission}'), '{level}', '{type}', '{sort}', '', b'0', '1', '{time}', '1', '{time}');"
|
||||
.replace("{name}", sysPermission.getName())
|
||||
.replace("{url}", sysPermission.getUrl())
|
||||
.replace("{permission}", sysPermission.getPermission())
|
||||
.replace("{parentPermission}", parent.getPermission())
|
||||
.replace("{level}", sysPermission.getLevel()+"")
|
||||
.replace("{type}", sysPermission.getType()+"")
|
||||
.replace("{sort}", sysPermission.getSort()+"")
|
||||
.replace("{time}", DateKit.toStr(new Date(), DateKit.TIME_FORMAT));
|
||||
|
||||
String sql2 = "INSERT INTO `sys_role_permission` (`role_id`, `permission_id`, `is_deleted`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES ('1', (SELECT id FROM sys_permission WHERE permission = '{permission}'), b'0', '1', '{time}', '1', '{time}');"
|
||||
.replace("{permission}", sysPermission.getPermission())
|
||||
.replace("{time}", DateKit.toStr(new Date(), DateKit.TIME_FORMAT));
|
||||
attr.addAttribute("sql", sql1 + "</br>" + sql2);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/edit")
|
||||
public String edit(@RequestParam("id") String permissionID,Map<String, Object> model){
|
||||
SysPermission permission =sysPermissionRepository.findOne(Integer.parseInt(permissionID));
|
||||
model.put("permissionID",permissionID);
|
||||
model.put("permission",permission);
|
||||
model.put("ps", sysPermissionRepository.findPermissions());
|
||||
return "/admin/sys_permission_input";
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/delete")
|
||||
@ResponseBody
|
||||
public ResponseMsg delete(@RequestParam("ids") String ids){
|
||||
String[] deleteIds=ids.split("#%#");
|
||||
boolean deleted = sysPermissionService.deletePermissionByIDs(deleteIds);
|
||||
boolean bDel = sysRolePermissionService.deleteSysRolePermissionByIDs(deleteIds);
|
||||
|
||||
ResponseMsg responseMsge=new ResponseMsg();
|
||||
if(deleted && bDel){
|
||||
logger.info("删除成功");
|
||||
responseMsge.setStatus(0);
|
||||
responseMsge.setMsg("删除成功");
|
||||
} else{
|
||||
responseMsge.setStatus(1);
|
||||
responseMsge.setMsg("删除失败");
|
||||
}
|
||||
return responseMsge;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,262 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.Constant;
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.SysRole;
|
||||
import cn.palmte.work.pojo.PermissionNode;
|
||||
import cn.palmte.work.pojo.RoleBean;
|
||||
import cn.palmte.work.service.AdminService;
|
||||
import cn.palmte.work.service.SysRoleService;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 角色管理
|
||||
* @author nsp
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/role")
|
||||
public class SysRoleController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SysRoleController.class);
|
||||
private static final int[] ROLE_TYPE_ARRAY = new int[] { Constant.ROLE_TYPE_CMCC_ADMIN,Constant.ROLE_TYPE_ZJPT_ADMIN};
|
||||
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
logger.info("获取角色列表");
|
||||
//当前登录人的角色类型
|
||||
model.put("keywords",keywords);
|
||||
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||
model.put("pager",sysRoleService.list(searchInfo,pageNumber,pageSize));
|
||||
return "admin/role_list";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/add")
|
||||
public String add( Map<String, Object> model){
|
||||
//当前登录人的角色
|
||||
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
|
||||
PermissionNode root= sysRoleService.getPermissionNodeTree(adminSysRole.getId());
|
||||
List<RoleBean> roleLevels = getRoleLevels(adminSysRole.getId(), 0);
|
||||
List<RoleBean> roleTypes = getRoleTypes(adminSysRole.getId(), adminSysRole.getType(),0);
|
||||
SysRole role = new SysRole();
|
||||
model.put("permnode",root);
|
||||
model.put("roleID",-1);
|
||||
model.put("isActive",1);
|
||||
model.put("level",roleLevels);//默认 省级
|
||||
model.put("type",roleTypes);//角色类型
|
||||
model.put("role",role);
|
||||
//model.put("selectedType",roleLevels.get(0).getValue());
|
||||
|
||||
return "/admin/role_input";
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
public String edit(@RequestParam(value = "id")int id, Map<String, Object> model){
|
||||
//当前登录人的角色
|
||||
SysRole adminSysRole=adminService.getRole(InterfaceUtil.getAdminId()+"");
|
||||
SysRole role = sysRoleService.fingSysRoleById(id);
|
||||
PermissionNode root = sysRoleService.getPermissionNodeTreeForEdit(adminSysRole.getId(), id);
|
||||
List<RoleBean> roleLevels = getRoleLevels(adminSysRole.getId(), role.getLevel());
|
||||
List<RoleBean> roleTypes = getRoleTypes(adminSysRole.getId(),adminSysRole.getType(), role.getType());
|
||||
model.put("permnode",root);
|
||||
model.put("roleID",id);
|
||||
model.put("roleName",role.getName());
|
||||
model.put("level",roleLevels);
|
||||
model.put("type",roleTypes);
|
||||
//model.put("selectedType",role.getType());
|
||||
model.put("role",role);
|
||||
return "admin/role_input";
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
public String save(@RequestParam Map<String, Object> reqMap,@RequestParam(value = "roleID")int roleID
|
||||
) {
|
||||
logger.info("新增编辑保存,roleID="+roleID);
|
||||
sysRoleService.addOrUpdatePermission(reqMap,roleID);
|
||||
return "redirect:/role/list";
|
||||
}
|
||||
|
||||
@RequestMapping("/check")
|
||||
@ResponseBody
|
||||
public ResponseMsg check(@RequestParam(value = "role_id")String role_id, @RequestParam(value = "role_name")String role_name,
|
||||
HttpServletResponse response) throws Exception{
|
||||
int result=sysRoleService.cheakRoleName(Integer.parseInt(role_id),role_name);
|
||||
ResponseMsg responseMsg=new ResponseMsg();
|
||||
if (result>0){
|
||||
responseMsg.setStatus(0);
|
||||
responseMsg.setMsg("该角色名已存在,请重新输入!");
|
||||
}else {
|
||||
responseMsg.setStatus(1);
|
||||
responseMsg.setMsg("");
|
||||
}
|
||||
return responseMsg;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/delete")
|
||||
@ResponseBody
|
||||
public ResponseMsg delete(@RequestParam("ids") String ids){
|
||||
ResponseMsg responseMsge=new ResponseMsg();
|
||||
if ("".equals(ids)){
|
||||
responseMsge.setStatus(1);
|
||||
responseMsge.setMsg("删除失败,无选中项!");
|
||||
}else {
|
||||
String[] deleteIds=ids.split("#%#");
|
||||
String msg = sysRoleService.deleteSelectedPermission(deleteIds);
|
||||
responseMsge.setStatus(0);
|
||||
responseMsge.setMsg(msg);
|
||||
}
|
||||
return responseMsge;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Title: 根据当前管理员所属角色的等级,获取角色等级列表
|
||||
* @Description:角色等级(省级1>地级市级2>区县级3>网点级4),获取角色等级列表时,只能获取级别小于等于当前级别的
|
||||
* @param adminRoleId
|
||||
* 当前管理员角色ID
|
||||
* @param selectedLevel
|
||||
* 默认选中等级
|
||||
* @return List<PermissionLevel>
|
||||
*/
|
||||
private List<RoleBean> getRoleLevels(int adminRoleId, int selectedLevel){
|
||||
SysRole role = sysRoleService.fingSysRoleById(adminRoleId);
|
||||
int adminLevel = role.getLevel();
|
||||
if(selectedLevel == 0){
|
||||
selectedLevel = adminLevel;
|
||||
}
|
||||
List<RoleBean> roleLevels = new ArrayList<RoleBean>(3);
|
||||
for(int i = adminLevel; i <= 3; i++){
|
||||
String name = getRoleLevelName(i);
|
||||
if(null != name){
|
||||
RoleBean permissionLevel = new RoleBean(name, i);
|
||||
if(selectedLevel == i){
|
||||
permissionLevel.setSelected(true);
|
||||
}
|
||||
roleLevels.add(permissionLevel);
|
||||
}
|
||||
}
|
||||
return roleLevels;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取角色类型列表
|
||||
* @param adminRoleId
|
||||
* @param selectedType
|
||||
* @return
|
||||
*/
|
||||
private List<RoleBean> getRoleTypes(int adminRoleId,int adminRoleType, int selectedType){
|
||||
SysRole role = sysRoleService.fingSysRoleById(adminRoleId);
|
||||
int roleType = role.getType();
|
||||
if(selectedType == 0){
|
||||
selectedType = roleType;
|
||||
}
|
||||
List<RoleBean> roleLevels = new ArrayList<RoleBean>(4);
|
||||
for(int i = 0; i < ROLE_TYPE_ARRAY.length; i++){
|
||||
if (adminRoleType<ROLE_TYPE_ARRAY[i]){
|
||||
String name = getRoleTypeName(ROLE_TYPE_ARRAY[i]);
|
||||
if(null != name){
|
||||
RoleBean roleTypeBean = new RoleBean(name, ROLE_TYPE_ARRAY[i]);
|
||||
if(selectedType == ROLE_TYPE_ARRAY[i]){
|
||||
roleTypeBean.setSelected(true);
|
||||
}
|
||||
roleLevels.add(roleTypeBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
return roleLevels;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 目前末梢渠道中默认都为省级
|
||||
* 根据type值获取角色类型名称
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
private String getRoleTypeName(int type){
|
||||
String typeName = null;
|
||||
switch(type){
|
||||
case Constant.ROLE_TYPE_CMCC_ADMIN:
|
||||
typeName = "移动管理员";
|
||||
break;
|
||||
case Constant.ROLE_TYPE_ZJPT_ADMIN:
|
||||
typeName = "资金平台管理员";
|
||||
break;
|
||||
default:typeName = null;
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据Level值获取角色等级名称
|
||||
* @param level
|
||||
* @return
|
||||
*/
|
||||
private String getRoleLevelName(int level){
|
||||
String levelName = null;
|
||||
switch(level){
|
||||
case 1:
|
||||
levelName = "省级";
|
||||
break;
|
||||
/*case 2:
|
||||
levelName = "地市级";
|
||||
break;
|
||||
case 3:
|
||||
levelName = "区县级";
|
||||
break;
|
||||
case 4:
|
||||
levelName = "网点级";
|
||||
break;*/
|
||||
default:levelName = null;
|
||||
}
|
||||
return levelName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用 禁用
|
||||
*/
|
||||
@RequestMapping("/enableOrDisable")
|
||||
@ResponseBody
|
||||
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
|
||||
@RequestParam("enabled") int status, RedirectAttributes attr) {
|
||||
boolean isSuccess = false;
|
||||
try {
|
||||
isSuccess = sysRoleService.enableOrDisable(status, id);
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
}
|
||||
if (isSuccess) {
|
||||
return ResponseMsg.buildSuccessMsg("操作成功");
|
||||
} else {
|
||||
return ResponseMsg.buildSuccessMsg("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package cn.palmte.work.exception;
|
||||
|
||||
import cn.palmte.work.config.Constant;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan
|
||||
* 使用的时候直接抛出异常ResponseException(如果想携带ResultCode,Message,Data等信息)
|
||||
*/
|
||||
public class ResponseException extends RuntimeException{
|
||||
private int status = Constant.Status.STATUS_FAILED;
|
||||
private Object data = null;
|
||||
|
||||
public ResponseException(int resultCode, String message, Object data){
|
||||
super(message);
|
||||
this.status = resultCode;
|
||||
this.data = data;
|
||||
}
|
||||
public ResponseException(int status, String message){
|
||||
this(status, message, null);
|
||||
}
|
||||
public ResponseException(String message){
|
||||
super(message);
|
||||
}
|
||||
public int getStatus(){
|
||||
return status;
|
||||
}
|
||||
public void setStatus(int status){ this.status = status; }
|
||||
public Object getData(){
|
||||
return data;
|
||||
}
|
||||
public void setData(Object data){
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package cn.palmte.work.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程图里解析出来的任务定义
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "act_task_def")
|
||||
public class ActTaskDef {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
@Column(name = "task_name")
|
||||
private String taskName;
|
||||
|
||||
@Column(name = "task_key")
|
||||
private String taskKey;
|
||||
|
||||
/**
|
||||
* 任务类型 0-单实例(或签) 1-多实例(会签)
|
||||
*/
|
||||
@Column(name = "task_type")
|
||||
private int taskType;
|
||||
|
||||
@Column(name = "proc_def_id")
|
||||
private String procDefId;
|
||||
|
||||
@Column(name = "proc_def_name")
|
||||
private String procDefName;
|
||||
|
||||
@Column(name = "proc_def_key")
|
||||
private String procDefKey;
|
||||
|
||||
/**
|
||||
* 回退任务key
|
||||
*/
|
||||
@Column(name = "rollback_task_key")
|
||||
private String rollbackTaskKey;
|
||||
|
||||
/**
|
||||
* 任务节点位置 -1结束节点 0-未知或者其他节点 1-开始节点 2-发起审批节点
|
||||
*/
|
||||
@Column(name = "task_index")
|
||||
private int taskIndex;
|
||||
|
||||
|
||||
/**
|
||||
* 候选人
|
||||
*/
|
||||
@Column(name = "candidate_users")
|
||||
private String candidateUsers;
|
||||
|
||||
/**
|
||||
* 候选角色
|
||||
*/
|
||||
@Column(name = "candidate_roles")
|
||||
private String candidateRoles;
|
||||
|
||||
|
||||
/**
|
||||
* 按类型查询
|
||||
*/
|
||||
@Column(name = "candidate_types")
|
||||
private String candidateTypes;
|
||||
|
||||
|
||||
@Column(name = "created_time")
|
||||
private Date createdTime;
|
||||
|
||||
@Column(name = "last_updated_time")
|
||||
private Date lastUpdatedTime;
|
||||
|
||||
|
||||
|
||||
@Transient
|
||||
private List<String> candidateUserList;
|
||||
|
||||
@Transient
|
||||
private List<String> candidateRoleList;
|
||||
|
||||
@Transient
|
||||
private List<String> candidateTypeList;
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package cn.palmte.work.model;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface ActTaskDefRepository extends JpaRepository<ActTaskDef, Integer> {
|
||||
|
||||
|
||||
List<ActTaskDef> findByProcDefId(String procDefId);
|
||||
|
||||
|
||||
ActTaskDef findFirstByProcDefIdAndTaskKey(String procDefId, String taskKey);
|
||||
|
||||
void deleteByProcDefId(String procDefId);
|
||||
|
||||
|
||||
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "update ACT_HI_ACTINST a SET a.ASSIGNEE_=? WHERE PROC_INST_ID_=? AND TASK_ID_=?", nativeQuery = true)
|
||||
int updateHiActAssign(String assign, String procInsId, String taskId);
|
||||
|
||||
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "update ACT_HI_TASKINST a SET a.ASSIGNEE_=? WHERE PROC_INST_ID_=? AND ID_=?", nativeQuery = true)
|
||||
int updateHiTaskAssign(String assign, String procInsId, String taskId);
|
||||
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "update act_re_procdef SET DESCRIPTION_=? WHERE ID_=?", nativeQuery = true)
|
||||
int updateProcDefDesc(String des, String procDefId);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue