Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
collectionDemo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Bugzilla
Bugzilla
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
电子档案
collectionDemo
Commits
817b21b7
Commit
817b21b7
authored
Mar 22, 2023
by
lihuiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
collectionDemo项目初始化
parents
Hide whitespace changes
Inline
Side-by-side
Showing
84 changed files
with
7076 additions
and
0 deletions
+7076
-0
.gitignore
.gitignore
+33
-0
maven-wrapper.jar
.mvn/wrapper/maven-wrapper.jar
+0
-0
maven-wrapper.properties
.mvn/wrapper/maven-wrapper.properties
+18
-0
mvnw
mvnw
+316
-0
mvnw.cmd
mvnw.cmd
+188
-0
pom.xml
pom.xml
+222
-0
CollectionApplication.java
...n/java/com/greatchn/collection/CollectionApplication.java
+28
-0
CollectController.java
...com/greatchn/collection/controller/CollectController.java
+29
-0
CcFileInfoMapper.java
...java/com/greatchn/collection/entity/CcFileInfoMapper.java
+168
-0
CcFileInfoMapper.xml
.../java/com/greatchn/collection/entity/CcFileInfoMapper.xml
+148
-0
CcFileSaveInfoMapper.java
.../com/greatchn/collection/entity/CcFileSaveInfoMapper.java
+16
-0
CcFileSaveInfoMapper.xml
...a/com/greatchn/collection/entity/CcFileSaveInfoMapper.xml
+5
-0
CcFileSaveInfoPO.java
...java/com/greatchn/collection/entity/CcFileSaveInfoPO.java
+67
-0
ErmsFileTypeMapper.java
...va/com/greatchn/collection/entity/ErmsFileTypeMapper.java
+24
-0
ErmsFileTypeMapper.xml
...ava/com/greatchn/collection/entity/ErmsFileTypeMapper.xml
+82
-0
ErmsFileTypePO.java
...n/java/com/greatchn/collection/entity/ErmsFileTypePO.java
+91
-0
ErmsOrganizationMapper.java
...om/greatchn/collection/entity/ErmsOrganizationMapper.java
+34
-0
ErmsOrganizationMapper.xml
...com/greatchn/collection/entity/ErmsOrganizationMapper.xml
+57
-0
ErmsOrganizationPO.java
...va/com/greatchn/collection/entity/ErmsOrganizationPO.java
+108
-0
ErmsQiyeMapper.java
...n/java/com/greatchn/collection/entity/ErmsQiyeMapper.java
+25
-0
ErmsQiyeMapper.xml
...in/java/com/greatchn/collection/entity/ErmsQiyeMapper.xml
+17
-0
ErmsQiyePO.java
src/main/java/com/greatchn/collection/entity/ErmsQiyePO.java
+145
-0
ErmsQzCertMapper.java
...java/com/greatchn/collection/entity/ErmsQzCertMapper.java
+9
-0
ErmsQzCertMapper.xml
.../java/com/greatchn/collection/entity/ErmsQzCertMapper.xml
+5
-0
ErmsQzCertPO.java
...ain/java/com/greatchn/collection/entity/ErmsQzCertPO.java
+125
-0
FileMapper.java
src/main/java/com/greatchn/collection/entity/FileMapper.java
+7
-0
FilePO.java
src/main/java/com/greatchn/collection/entity/FilePO.java
+60
-0
GxFileAttMapper.java
.../java/com/greatchn/collection/entity/GxFileAttMapper.java
+58
-0
GxFileAttMapper.xml
...n/java/com/greatchn/collection/entity/GxFileAttMapper.xml
+29
-0
GxFileAttPO.java
...main/java/com/greatchn/collection/entity/GxFileAttPO.java
+75
-0
PzFileSjMapper.java
...n/java/com/greatchn/collection/entity/PzFileSjMapper.java
+24
-0
PzFileSjMapper.xml
...in/java/com/greatchn/collection/entity/PzFileSjMapper.xml
+8
-0
PzFileSjPO.java
src/main/java/com/greatchn/collection/entity/PzFileSjPO.java
+63
-0
SjFileAttRelMapper.java
...va/com/greatchn/collection/entity/SjFileAttRelMapper.java
+16
-0
SjFileAttRelPO.java
...n/java/com/greatchn/collection/entity/SjFileAttRelPO.java
+75
-0
SjFileSaveParamMapper.java
...com/greatchn/collection/entity/SjFileSaveParamMapper.java
+11
-0
SjFileSaveParamMapper.xml
.../com/greatchn/collection/entity/SjFileSaveParamMapper.xml
+9
-0
SjFileSaveParamPO.java
...ava/com/greatchn/collection/entity/SjFileSaveParamPO.java
+89
-0
SjLogErrorMapper.java
...java/com/greatchn/collection/entity/SjLogErrorMapper.java
+15
-0
SjLogErrorPO.java
...ain/java/com/greatchn/collection/entity/SjLogErrorPO.java
+55
-0
SjLogMapper.java
...main/java/com/greatchn/collection/entity/SjLogMapper.java
+45
-0
SjLogMapper.xml
src/main/java/com/greatchn/collection/entity/SjLogMapper.xml
+68
-0
SjLogPO.java
src/main/java/com/greatchn/collection/entity/SjLogPO.java
+166
-0
SjLogSub1InfoMapper.java
...a/com/greatchn/collection/entity/SjLogSub1InfoMapper.java
+17
-0
SjLogSub1InfoMapper.xml
...va/com/greatchn/collection/entity/SjLogSub1InfoMapper.xml
+12
-0
SjLogSub1InfoPO.java
.../java/com/greatchn/collection/entity/SjLogSub1InfoPO.java
+66
-0
SjLogSub1Mapper.java
.../java/com/greatchn/collection/entity/SjLogSub1Mapper.java
+38
-0
SjLogSub1Mapper.xml
...n/java/com/greatchn/collection/entity/SjLogSub1Mapper.xml
+56
-0
SjLogSub1PO.java
...main/java/com/greatchn/collection/entity/SjLogSub1PO.java
+119
-0
SjLogSub2InfoMapper.java
...a/com/greatchn/collection/entity/SjLogSub2InfoMapper.java
+17
-0
SjLogSub2InfoMapper.xml
...va/com/greatchn/collection/entity/SjLogSub2InfoMapper.xml
+12
-0
SjLogSub2InfoPO.java
.../java/com/greatchn/collection/entity/SjLogSub2InfoPO.java
+66
-0
SjLogSub2Mapper.java
.../java/com/greatchn/collection/entity/SjLogSub2Mapper.java
+22
-0
SjLogSub2Mapper.xml
...n/java/com/greatchn/collection/entity/SjLogSub2Mapper.xml
+21
-0
SjLogSub2PO.java
...main/java/com/greatchn/collection/entity/SjLogSub2PO.java
+126
-0
SjMdXtMapper.java
...ain/java/com/greatchn/collection/entity/SjMdXtMapper.java
+13
-0
SjMdXtMapper.xml
...main/java/com/greatchn/collection/entity/SjMdXtMapper.xml
+27
-0
SjMdXtPO.java
src/main/java/com/greatchn/collection/entity/SjMdXtPO.java
+99
-0
AuthIgnore.java
.../greatchn/collection/framework/annotation/AuthIgnore.java
+16
-0
DateConvert.java
...com/greatchn/collection/framework/config/DateConvert.java
+68
-0
WebMvcConfig.java
...om/greatchn/collection/framework/config/WebMvcConfig.java
+70
-0
AuthConstant.java
.../greatchn/collection/framework/constant/AuthConstant.java
+57
-0
LogConstant.java
...m/greatchn/collection/framework/constant/LogConstant.java
+85
-0
ManageConstant.java
...reatchn/collection/framework/constant/ManageConstant.java
+174
-0
ReturnMsgEnum.java
...greatchn/collection/framework/constant/ReturnMsgEnum.java
+43
-0
SignatureStateEnum.java
...chn/collection/framework/constant/SignatureStateEnum.java
+21
-0
AssertException.java
...atchn/collection/framework/exception/AssertException.java
+70
-0
AuthInterceptor.java
...chn/collection/framework/interceptor/AuthInterceptor.java
+206
-0
GlobalExceptionHandler.java
...lection/framework/interceptor/GlobalExceptionHandler.java
+65
-0
LogInterceptor.java
...tchn/collection/framework/interceptor/LogInterceptor.java
+81
-0
AposePdfUtil.java
.../com/greatchn/collection/framework/util/AposePdfUtil.java
+176
-0
AssertUtil.java
...va/com/greatchn/collection/framework/util/AssertUtil.java
+654
-0
AuthUtil.java
...java/com/greatchn/collection/framework/util/AuthUtil.java
+84
-0
CommonUtil.java
...va/com/greatchn/collection/framework/util/CommonUtil.java
+66
-0
DateUtil.java
...java/com/greatchn/collection/framework/util/DateUtil.java
+140
-0
HttpUtil.java
...java/com/greatchn/collection/framework/util/HttpUtil.java
+387
-0
SpringContextHolder.java
...eatchn/collection/framework/util/SpringContextHolder.java
+66
-0
ReturnMsgVO.java
...ava/com/greatchn/collection/framework/vo/ReturnMsgVO.java
+67
-0
CollectJob.java
src/main/java/com/greatchn/collection/job/CollectJob.java
+26
-0
CollectService.java
.../java/com/greatchn/collection/service/CollectService.java
+679
-0
FileService.java
...ain/java/com/greatchn/collection/service/FileService.java
+168
-0
CcFileInfoVO.java
src/main/java/com/greatchn/collection/vo/CcFileInfoVO.java
+30
-0
application.properties
src/main/resources/application.properties
+20
-0
CollectionApplicationTests.java
...a/com/greatchn/collection/CollectionApplicationTests.java
+13
-0
No files found.
.gitignore
0 → 100644
View file @
817b21b7
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
.mvn/wrapper/maven-wrapper.jar
0 → 100644
View file @
817b21b7
File added
.mvn/wrapper/maven-wrapper.properties
0 → 100644
View file @
817b21b7
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl
=
https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
wrapperUrl
=
https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
mvnw
0 → 100644
View file @
817b21b7
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if
[
-z
"
$MAVEN_SKIP_RC
"
]
;
then
if
[
-f
/usr/local/etc/mavenrc
]
;
then
.
/usr/local/etc/mavenrc
fi
if
[
-f
/etc/mavenrc
]
;
then
.
/etc/mavenrc
fi
if
[
-f
"
$HOME
/.mavenrc"
]
;
then
.
"
$HOME
/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin
=
false
;
darwin
=
false
;
mingw
=
false
case
"
`
uname
`
"
in
CYGWIN
*
)
cygwin
=
true
;;
MINGW
*
)
mingw
=
true
;;
Darwin
*
)
darwin
=
true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if
[
-z
"
$JAVA_HOME
"
]
;
then
if
[
-x
"/usr/libexec/java_home"
]
;
then
export
JAVA_HOME
=
"
`
/usr/libexec/java_home
`
"
else
export
JAVA_HOME
=
"/Library/Java/Home"
fi
fi
;;
esac
if
[
-z
"
$JAVA_HOME
"
]
;
then
if
[
-r
/etc/gentoo-release
]
;
then
JAVA_HOME
=
`
java-config
--jre-home
`
fi
fi
if
[
-z
"
$M2_HOME
"
]
;
then
## resolve links - $0 may be a link to maven's home
PRG
=
"
$0
"
# need this for relative symlinks
while
[
-h
"
$PRG
"
]
;
do
ls
=
`
ls
-ld
"
$PRG
"
`
link
=
`
expr
"
$ls
"
:
'.*-> \(.*\)$'
`
if
expr
"
$link
"
:
'/.*'
>
/dev/null
;
then
PRG
=
"
$link
"
else
PRG
=
"
`
dirname
"
$PRG
"
`
/
$link
"
fi
done
saveddir
=
`
pwd
`
M2_HOME
=
`
dirname
"
$PRG
"
`
/..
# make it fully qualified
M2_HOME
=
`
cd
"
$M2_HOME
"
&&
pwd
`
cd
"
$saveddir
"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if
$cygwin
;
then
[
-n
"
$M2_HOME
"
]
&&
M2_HOME
=
`
cygpath
--unix
"
$M2_HOME
"
`
[
-n
"
$JAVA_HOME
"
]
&&
JAVA_HOME
=
`
cygpath
--unix
"
$JAVA_HOME
"
`
[
-n
"
$CLASSPATH
"
]
&&
CLASSPATH
=
`
cygpath
--path
--unix
"
$CLASSPATH
"
`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if
$mingw
;
then
[
-n
"
$M2_HOME
"
]
&&
M2_HOME
=
"
`
(
cd
"
$M2_HOME
"
;
pwd
)
`
"
[
-n
"
$JAVA_HOME
"
]
&&
JAVA_HOME
=
"
`
(
cd
"
$JAVA_HOME
"
;
pwd
)
`
"
fi
if
[
-z
"
$JAVA_HOME
"
]
;
then
javaExecutable
=
"
`
which javac
`
"
if
[
-n
"
$javaExecutable
"
]
&&
!
[
"
`
expr
\"
$javaExecutable
\"
:
'\([^ ]*\)'
`
"
=
"no"
]
;
then
# readlink(1) is not available as standard on Solaris 10.
readLink
=
`
which
readlink
`
if
[
!
`
expr
"
$readLink
"
:
'\([^ ]*\)'
`
=
"no"
]
;
then
if
$darwin
;
then
javaHome
=
"
`
dirname
\"
$javaExecutable
\"
`
"
javaExecutable
=
"
`
cd
\"
$javaHome
\"
&&
pwd
-P
`
/javac"
else
javaExecutable
=
"
`
readlink
-f
\"
$javaExecutable
\"
`
"
fi
javaHome
=
"
`
dirname
\"
$javaExecutable
\"
`
"
javaHome
=
`
expr
"
$javaHome
"
:
'\(.*\)/bin'
`
JAVA_HOME
=
"
$javaHome
"
export
JAVA_HOME
fi
fi
fi
if
[
-z
"
$JAVACMD
"
]
;
then
if
[
-n
"
$JAVA_HOME
"
]
;
then
if
[
-x
"
$JAVA_HOME
/jre/sh/java"
]
;
then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD
=
"
$JAVA_HOME
/jre/sh/java"
else
JAVACMD
=
"
$JAVA_HOME
/bin/java"
fi
else
JAVACMD
=
"
`
\\
unset
-f
command
;
\\
command
-v
java
`
"
fi
fi
if
[
!
-x
"
$JAVACMD
"
]
;
then
echo
"Error: JAVA_HOME is not defined correctly."
>
&2
echo
" We cannot execute
$JAVACMD
"
>
&2
exit
1
fi
if
[
-z
"
$JAVA_HOME
"
]
;
then
echo
"Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER
=
org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir
()
{
if
[
-z
"
$1
"
]
then
echo
"Path not specified to find_maven_basedir"
return
1
fi
basedir
=
"
$1
"
wdir
=
"
$1
"
while
[
"
$wdir
"
!=
'/'
]
;
do
if
[
-d
"
$wdir
"
/.mvn
]
;
then
basedir
=
$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if
[
-d
"
${
wdir
}
"
]
;
then
wdir
=
`
cd
"
$wdir
/.."
;
pwd
`
fi
# end of workaround
done
echo
"
${
basedir
}
"
}
# concatenates all lines of a file
concat_lines
()
{
if
[
-f
"
$1
"
]
;
then
echo
"
$(
tr
-s
'\n'
' '
<
"
$1
"
)
"
fi
}
BASE_DIR
=
`
find_maven_basedir
"
$(
pwd
)
"
`
if
[
-z
"
$BASE_DIR
"
]
;
then
exit
1
;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if
[
-r
"
$BASE_DIR
/.mvn/wrapper/maven-wrapper.jar"
]
;
then
if
[
"
$MVNW_VERBOSE
"
=
true
]
;
then
echo
"Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if
[
"
$MVNW_VERBOSE
"
=
true
]
;
then
echo
"Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if
[
-n
"
$MVNW_REPOURL
"
]
;
then
jarUrl
=
"
$MVNW_REPOURL
/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
else
jarUrl
=
"https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
fi
while
IFS
=
"="
read
key value
;
do
case
"
$key
"
in
(
wrapperUrl
)
jarUrl
=
"
$value
"
;
break
;;
esac
done
<
"
$BASE_DIR
/.mvn/wrapper/maven-wrapper.properties"
if
[
"
$MVNW_VERBOSE
"
=
true
]
;
then
echo
"Downloading from:
$jarUrl
"
fi
wrapperJarPath
=
"
$BASE_DIR
/.mvn/wrapper/maven-wrapper.jar"
if
$cygwin
;
then
wrapperJarPath
=
`
cygpath
--path
--windows
"
$wrapperJarPath
"
`
fi
if
command
-v
wget
>
/dev/null
;
then
if
[
"
$MVNW_VERBOSE
"
=
true
]
;
then
echo
"Found wget ... using wget"
fi
if
[
-z
"
$MVNW_USERNAME
"
]
||
[
-z
"
$MVNW_PASSWORD
"
]
;
then
wget
"
$jarUrl
"
-O
"
$wrapperJarPath
"
||
rm
-f
"
$wrapperJarPath
"
else
wget
--http-user
=
$MVNW_USERNAME
--http-password
=
$MVNW_PASSWORD
"
$jarUrl
"
-O
"
$wrapperJarPath
"
||
rm
-f
"
$wrapperJarPath
"
fi
elif
command
-v
curl
>
/dev/null
;
then
if
[
"
$MVNW_VERBOSE
"
=
true
]
;
then
echo
"Found curl ... using curl"
fi
if
[
-z
"
$MVNW_USERNAME
"
]
||
[
-z
"
$MVNW_PASSWORD
"
]
;
then
curl
-o
"
$wrapperJarPath
"
"
$jarUrl
"
-f
else
curl
--user
$MVNW_USERNAME
:
$MVNW_PASSWORD
-o
"
$wrapperJarPath
"
"
$jarUrl
"
-f
fi
else
if
[
"
$MVNW_VERBOSE
"
=
true
]
;
then
echo
"Falling back to using Java to download"
fi
javaClass
=
"
$BASE_DIR
/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if
$cygwin
;
then
javaClass
=
`
cygpath
--path
--windows
"
$javaClass
"
`
fi
if
[
-e
"
$javaClass
"
]
;
then
if
[
!
-e
"
$BASE_DIR
/.mvn/wrapper/MavenWrapperDownloader.class"
]
;
then
if
[
"
$MVNW_VERBOSE
"
=
true
]
;
then
echo
" - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
(
"
$JAVA_HOME
/bin/javac"
"
$javaClass
"
)
fi
if
[
-e
"
$BASE_DIR
/.mvn/wrapper/MavenWrapperDownloader.class"
]
;
then
# Running the downloader
if
[
"
$MVNW_VERBOSE
"
=
true
]
;
then
echo
" - Running MavenWrapperDownloader.java ..."
fi
(
"
$JAVA_HOME
/bin/java"
-cp
.mvn/wrapper MavenWrapperDownloader
"
$MAVEN_PROJECTBASEDIR
"
)
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export
MAVEN_PROJECTBASEDIR
=
${
MAVEN_BASEDIR
:-
"
$BASE_DIR
"
}
if
[
"
$MVNW_VERBOSE
"
=
true
]
;
then
echo
$MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS
=
"
$(
concat_lines
"
$MAVEN_PROJECTBASEDIR
/.mvn/jvm.config"
)
$MAVEN_OPTS
"
# For Cygwin, switch paths to Windows format before running java
if
$cygwin
;
then
[
-n
"
$M2_HOME
"
]
&&
M2_HOME
=
`
cygpath
--path
--windows
"
$M2_HOME
"
`
[
-n
"
$JAVA_HOME
"
]
&&
JAVA_HOME
=
`
cygpath
--path
--windows
"
$JAVA_HOME
"
`
[
-n
"
$CLASSPATH
"
]
&&
CLASSPATH
=
`
cygpath
--path
--windows
"
$CLASSPATH
"
`
[
-n
"
$MAVEN_PROJECTBASEDIR
"
]
&&
MAVEN_PROJECTBASEDIR
=
`
cygpath
--path
--windows
"
$MAVEN_PROJECTBASEDIR
"
`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS
=
"
$MAVEN_CONFIG
$@
"
export
MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER
=
org.apache.maven.wrapper.MavenWrapperMain
exec
"
$JAVACMD
"
\
$MAVEN_OPTS
\
$MAVEN_DEBUG_OPTS
\
-classpath
"
$MAVEN_PROJECTBASEDIR
/.mvn/wrapper/maven-wrapper.jar"
\
"-Dmaven.home=
${
M2_HOME
}
"
\
"-Dmaven.multiModuleProjectDirectory=
${
MAVEN_PROJECTBASEDIR
}
"
\
${
WRAPPER_LAUNCHER
}
$MAVEN_CONFIG
"
$@
"
mvnw.cmd
0 → 100644
View file @
817b21b7
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%
pom.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.7.5
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<groupId>
com.greatchn
</groupId>
<artifactId>
collection
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<name>
collection
</name>
<description>
collection
</description>
<properties>
<java.version>
1.8
</java.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
<spring.boot.framework.version>
2.5.2
</spring.boot.framework.version>
<poi.version>
3.15
</poi.version>
<bc.version>
1.68
</bc.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<version>
${spring.boot.framework.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-tomcat
</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-undertow -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
<version>
${spring.boot.framework.version}
</version>
<exclusions>
<exclusion>
<groupId>
io.undertow
</groupId>
<artifactId>
undertow-websockets-jsr
</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-configuration-processor -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-configuration-processor
</artifactId>
<version>
${spring.boot.framework.version}
</version>
<optional>
true
</optional>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-aop
</artifactId>
<version>
${spring.boot.framework.version}
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<version>
${spring.boot.framework.version}
</version>
<scope>
test
</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
1.18.22
</version>
<scope>
provided
</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
<version>
3.12.0
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-collections4
</artifactId>
<version>
4.4
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/eu.bitwalker/UserAgentUtils -->
<dependency>
<groupId>
eu.bitwalker
</groupId>
<artifactId>
UserAgentUtils
</artifactId>
<version>
1.21
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-all -->
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
5.7.22
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
2.8.0
</version>
</dependency>
<dependency>
<groupId>
commons-fileupload
</groupId>
<artifactId>
commons-fileupload
</artifactId>
<version>
1.3.3
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<scope>
runtime
</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
3.5.2
</version>
</dependency>
<dependency>
<groupId>
com.lowagie.text
</groupId>
<artifactId>
com.springsource.com.lowagie.text
</artifactId>
<version>
2.0.8
</version>
</dependency>
<dependency>
<groupId>
com.aspose
</groupId>
<artifactId>
aspose-pdf
</artifactId>
<version>
17.3.0
</version>
</dependency>
<dependency>
<groupId>
commons-codec
</groupId>
<artifactId>
commons-codec
</artifactId>
</dependency>
<dependency>
<groupId>
com.itextpdf
</groupId>
<artifactId>
itextpdf
</artifactId>
<version>
5.5.13
</version>
</dependency>
<dependency>
<groupId>
com.itextpdf
</groupId>
<artifactId>
itext-asian
</artifactId>
<version>
5.2.0
</version>
</dependency>
<dependency>
<groupId>
com.itextpdf.tool
</groupId>
<artifactId>
xmlworker
</artifactId>
<version>
5.4.1
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.2.2.RELEASE
</version>
<configuration>
<includeSystemScope>
true
</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-resources-plugin
</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>
ttf
</nonFilteredFileExtension>
<nonFilteredFileExtension>
woff
</nonFilteredFileExtension>
<nonFilteredFileExtension>
woff2
</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>
src/main/resources
</directory>
<includes>
<include>
**/*.*
</include>
</includes>
<filtering>
false
</filtering>
</resource>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*.xml
</include>
</includes>
<filtering>
false
</filtering>
</resource>
</resources>
</build>
</project>
src/main/java/com/greatchn/collection/CollectionApplication.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@ComponentScan
(
basePackages
=
{
"com.greatchn"
}
)
@EnableScheduling
@MapperScan
({
"com.greatchn.collection.entity"
})
@SpringBootApplication
public
class
CollectionApplication
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
CollectionApplication
.
class
);
public
CollectionApplication
()
{
}
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
CollectionApplication
.
class
,
args
);
}
}
src/main/java/com/greatchn/collection/controller/CollectController.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
controller
;
import
com.greatchn.collection.framework.annotation.AuthIgnore
;
import
com.greatchn.collection.framework.vo.ReturnMsgVO
;
import
com.greatchn.collection.service.CollectService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/collect"
)
@Slf4j
public
class
CollectController
{
@Autowired
CollectService
collectService
;
@AuthIgnore
@RequestMapping
(
"/upload"
)
@ResponseBody
public
ReturnMsgVO
collect
()
throws
Exception
{
// collectService.collect("YKJ", 3, "13");
collectService
.
startCollectJob
();
return
ReturnMsgVO
.
ok
().
setMsg
(
"收集成功"
);
}
}
src/main/java/com/greatchn/collection/entity/CcFileInfoMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.greatchn.collection.vo.CcFileInfoVO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
* 文件信息数据使用 Mapper 接口
* </p>
*
* @author zhaolechang
* @since 2022-08-20
*/
public
interface
CcFileInfoMapper
{
/**
* 动态表 插入数据
*
* @param type
* @param customSql
*/
void
addFileInfo
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"customSql"
)
String
customSql
);
/**
* 动态表 统计数量
*
* @param fileType
* @param selectSql
*/
long
count
(
@Param
(
"fileType"
)
Integer
fileType
,
@Param
(
"selectSql"
)
String
selectSql
);
/**
* 动态表 案卷统计数量
*
* @param fileType
* @param selectSql
*/
long
arcCount
(
@Param
(
"dh"
)
String
dh
,
@Param
(
"fileType"
)
Integer
fileType
,
@Param
(
"selectSql"
)
String
selectSql
,
@Param
(
"ch"
)
String
ch
);
/**
* 动态表 查询
*
* @param fileType
* @param pageNum
* @param pageSize
* @return
*/
List
<
Map
>
getList
(
@Param
(
"fileType"
)
Integer
fileType
,
@Param
(
"selectSql"
)
String
selectSql
,
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"pageSize"
)
Integer
pageSize
);
/**
* 动态表 案卷查询
*
* @param fileType
* @param pageNum
* @param pageSize
* @return
*/
List
<
Map
>
getArcList
(
@Param
(
"dh"
)
String
dh
,
@Param
(
"fileType"
)
Integer
fileType
,
@Param
(
"selectSql"
)
String
selectSql
,
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"pageSize"
)
Integer
pageSize
,
@Param
(
"ch"
)
String
ch
);
List
<
Map
>
getFile
(
@Param
(
"fileType"
)
Integer
fileType
,
@Param
(
"selectSql"
)
String
selectSql
);
/**
* 更新资料信息
*
* @return
* @author zhaolechang
* @creed: Talk is cheap,show me the code
* @date 2022/8/19 15:27
*/
int
upDateFile
(
@Param
(
"fileType"
)
Integer
fileType
,
@Param
(
"customSql"
)
String
customSql
,
@Param
(
"dzwjh"
)
String
dzwjh
);
/**
* 更新案卷信息
*
* @return
* @author zhaolechang
* @creed: Talk is cheap,show me the code
* @date 2022/8/22 8:42
*/
int
upDateArc
(
@Param
(
"customSql"
)
String
customSql
,
@Param
(
"dh"
)
String
dh
);
/**
* 获取文件url
*
* @param fileTypeId
* @param dzwjh
* @return
* @author zhaoding
* @date 2022/8/22
*/
Map
getUrl
(
@Param
(
"fileTypeId"
)
Integer
fileTypeId
,
@Param
(
"dzwjh"
)
String
dzwjh
);
/**
* 根据全宗名称、年、月与fileArr查询cc_file_info表
*
* @param fileType 类型id
* @param selectSql 查询条件
* @return
*/
List
<
CcFileInfoVO
>
findCcFileInfo
(
@Param
(
"fileType"
)
Integer
fileType
,
@Param
(
"selectSql"
)
String
selectSql
);
/**
* 根据全宗名称、时间范围查询cc_file_info表
*
* @param arr
* @param M050
* @param start
* @param end
* @return
*/
List
<
CcFileInfoVO
>
findCcFileInfoByDate
(
@Param
(
"arr"
)
Integer
arr
,
@Param
(
"M050"
)
String
M050
,
@Param
(
"start"
)
String
start
,
@Param
(
"end"
)
String
end
);
/**
* 根据arc_type、全宗名称与M066删除cc_file_info表中的数据
*
* @param arr 表名后缀
* @param arcType 是否立卷
* @param qzName 全宗名称 cc_file_info表中M005字段
* @param m066
*/
void
delete
(
@Param
(
"arr"
)
Integer
arr
,
@Param
(
"arcType"
)
String
arcType
,
@Param
(
"M005"
)
String
qzName
,
@Param
(
"M066"
)
String
m066
);
/**
* 获取要删除的主件电子文件号
*
* @param arr
* @param arcType
* @param qzName
* @param m066
* @return
*/
String
getDzwjh
(
@Param
(
"arr"
)
Integer
arr
,
@Param
(
"arcType"
)
String
arcType
,
@Param
(
"M005"
)
String
qzName
,
@Param
(
"M066"
)
String
m066
);
void
deleteFj
(
@Param
(
"arr"
)
Integer
arr
,
@Param
(
"dzwjh"
)
String
dzwjh
);
/**
* 查询未立卷文件数量
*
* @param fileTypeId 表名后缀
* @return
* @author zhangkun
* @date 2023/1/12 13:57
*/
long
getNotLiJuanCount
(
@Param
(
"fileTypeId"
)
Integer
fileTypeId
);
/**
* 获取案卷内的文件信息
* @param dh
* @param fileType
* @param textValue
* @param groupSql
* @return
*/
List
<
Map
>
getFileList
(
@Param
(
"dh"
)
String
dh
,
@Param
(
"fileType"
)
String
fileType
,
@Param
(
"textValue"
)
List
textValue
,
@Param
(
"groupSql"
)
String
groupSql
);
List
<
Map
>
getFileListOrder
(
@Param
(
"dh"
)
String
dh
,
@Param
(
"fileType"
)
String
fileType
);
}
src/main/java/com/greatchn/collection/entity/CcFileInfoMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.CcFileInfoMapper"
>
<insert
id=
"addFileInfo"
>
INSERT INTO cc_file_info_${type}
${customSql}
</insert>
<select
id=
"count"
resultType=
"long"
>
SELECT COUNT(*) FROM cc_file_info_${fileType}
<if
test=
"selectSql != null "
>
${selectSql}
</if>
</select>
<select
id=
"arcCount"
resultType=
"long"
>
SELECT
COUNT(*)
FROM
cc_file_info_${fileType} c
JOIN gx_arc_file a ON a.file_dzwjh=c.dzwjh AND a.arc_dh=#{dh}
<if
test=
"selectSql != null "
>
${selectSql}
</if>
</select>
<select
id=
"getList"
resultType=
"java.util.Map"
>
SELECT * FROM cc_file_info_${fileType}
<if
test=
"selectSql != null "
>
${selectSql}
</if>
ORDER BY M007
LIMIT #{pageNum}, #{pageSize}
</select>
<select
id=
"getArcList"
resultType=
"java.util.Map"
>
SELECT
c.*
FROM
cc_file_info_${fileType} c
JOIN gx_arc_file a ON a.file_dzwjh=c.dzwjh AND a.arc_dh=#{dh}
<if
test=
"selectSql != null "
>
${selectSql}
</if>
ORDER BY c.M007
LIMIT #{pageNum}, #{pageSize}
</select>
<select
id=
"getFile"
resultType=
"java.util.Map"
>
SELECT * FROM cc_file_info_${fileType}
<if
test=
"selectSql != null "
>
${selectSql}
</if>
</select>
<update
id=
"upDateFile"
>
UPDATE cc_file_info_${fileType}
SET ${customSql}
WHERE dzwjh = #{dzwjh}
</update>
<update
id=
"upDateArc"
>
UPDATE cc_arc_info
SET ${customSql}
WHERE dh = #{dh}
</update>
<select
id=
"getUrl"
resultType=
"java.util.Map"
>
SELECT M066
FROM cc_file_info_${fileTypeId}
WHERE dzwjh = #{dzwjh}
</select>
<!--根据全宗名称、年、月与fileArr查询cc_file_info表-->
<select
id=
"findCcFileInfo"
resultType=
"com.greatchn.collection.vo.CcFileInfoVO"
>
SELECT arc_type,M066,dzwjh,M007 FROM cc_file_info_${fileType}
<if
test=
"selectSql != null "
>
${selectSql}
</if>
</select>
<select
id=
"findCcFileInfoByDate"
resultType=
"com.greatchn.collection.vo.CcFileInfoVO"
>
SELECT arc_type, M066
FROM cc_file_info_${arr}
WHERE M050 = #{M050}
AND M033 BETWEEN #{start} AND #{end}
</select>
<!--根据arc_type、全宗名称与M066删除cc_file_info表中的数据-->
<delete
id=
"delete"
>
UPDATE cc_file_info_#{arr} SET state='N' WHERE arc_type = #{arcType} AND M066 = #{M066}
<if
test=
"M005 != null "
>
AND M005 = #{M005}
</if>
</delete>
<select
id=
"getDzwjh"
resultType=
"java.lang.String"
>
SELECT dzwjh FROM cc_file_info_#{arr} WHERE arc_type = #{arcType} AND M066 = #{M066}
<if
test=
"M005 != null "
>
AND M005 = #{M005}
</if>
</select>
<delete
id=
"deleteFj"
>
UPDATE cc_file_info_#{arr}
SET state='N'
WHERE dzwjh = #{dzwjh};
</delete>
<!--查询未立卷文件数量-->
<select
id=
"getNotLiJuanCount"
resultType=
"java.lang.Long"
>
SELECT COUNT(*)
FROM cc_file_info_#{fileTypeId}
WHERE arc_type = 'N'
AND state = 'Y';
</select>
<select
id=
"getFileList"
resultType=
"java.util.Map"
>
SELECT
c.* ,si.*
FROM
cc_file_info_${fileType} c
JOIN gx_arc_file a ON a.file_dzwjh=c.dzwjh AND a.arc_dh=#{dh}
LEFT JOIN cc_file_save_info si ON si.id = c.M066
<if
test=
"textValue != null"
>
WHERE si.`file_type` NOT IN
<foreach
collection=
"textValue"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"groupSql != null"
>
${groupSql}
</if>
ORDER BY c.`M007`
</select>
<select
id=
"getFileListOrder"
resultType=
"java.util.Map"
>
SELECT
c.*
FROM
cc_file_info_${fileType} c
JOIN gx_arc_file a ON a.file_dzwjh=c.dzwjh AND a.arc_dh=#{dh}
ORDER BY c.`M018`
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/CcFileSaveInfoMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.greatchn.collection.entity.CcFileSaveInfoPO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* <p>
* 文件存储信息表 Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-30
*/
public
interface
CcFileSaveInfoMapper
extends
BaseMapper
<
CcFileSaveInfoPO
>
{
}
src/main/java/com/greatchn/collection/entity/CcFileSaveInfoMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.CcFileSaveInfoMapper"
>
</mapper>
src/main/java/com/greatchn/collection/entity/CcFileSaveInfoPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
/**
* <p>
* 文件存储信息表
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-30
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"cc_file_save_info"
)
public
class
CcFileSaveInfoPO
extends
Model
<
CcFileSaveInfoPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 地址
*/
@TableField
(
"file_path"
)
private
String
filePath
;
/**
* 文件类型
*/
@TableField
(
"file_type"
)
private
String
fileType
;
/**
* 文件大小(KB)
*/
@TableField
(
"file_size"
)
private
Double
fileSize
;
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
FILE_PATH
=
"file_path"
;
public
static
final
String
FILE_TYPE
=
"file_type"
;
public
static
final
String
FILE_SIZE
=
"file_size"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/ErmsFileTypeMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
* 文件类型目录表(一个档案库仅执行一套文件类型标准) Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
public
interface
ErmsFileTypeMapper
extends
BaseMapper
<
ErmsFileTypePO
>
{
int
insertFileType
(
ErmsFileTypePO
ermsFileTypePO
);
List
<
Map
>
getDalxList
(
@Param
(
"qyId"
)
String
qyId
);
List
<
String
>
getfileTypeKey
(
@Param
(
"fileType"
)
String
fileType
);
}
src/main/java/com/greatchn/collection/entity/ErmsFileTypeMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.ErmsFileTypeMapper"
>
<insert
id=
"insertFileType"
parameterType=
"com.greatchn.collection.entity.ErmsFileTypePO"
useGeneratedKeys=
"true"
keyProperty=
"fileTypeId"
>
INSERT INTO erms_file_type (
file_type_name,qy_id,
file_type_role,
<if
test=
"fileTypePar != null "
>
file_type_par,
</if>
file_type_oder,
file_type_key,
insert_date,
state
)
SELECT "${fileTypeName}" AS file_type_name,"${qyId}" AS qy_id,
"${fileTypeRole}" AS file_type_role,
<if
test=
"fileTypePar != null "
>
"${fileTypePar}" AS file_type_par,
</if>
CASE
WHEN
MAX(file_type_oder) IS NULL
THEN
1
ELSE
MAX(file_type_oder) + 1
END AS file_type_oder,
"${fileTypeKey}" AS file_type_key,
#{insertDate} AS insert_date,
'Y' AS state
FROM erms_file_type
WHERE
state != 'D'
<if
test=
"fileTypePar != null "
>
AND file_type_par = #{fileTypePar}
</if>
<if
test=
"fileTypePar == null "
>
AND file_type_par IS NULL
</if>
</insert>
<select
id=
"getDalxList"
resultType=
"java.util.HashMap"
>
SELECT contents_id sKey,
contents_name sText
FROM pz_contents
WHERE state = 'Y' AND qy_id= #{qyId}
</select>
<select
id=
"getHaveMdId"
resultType=
"long"
>
SELECT COUNT(*)
FROM information_schema.columns
WHERE table_name = 'cc_file_info_${pzFileMd.fileTypeId}'
AND column_name = #{pzFileMd.mdId}
</select>
<update
id=
"addCCFile"
>
ALTER TABLE cc_file_info_${fileTypeId}
ADD COLUMN ${mdId} varchar(255) NULL DEFAULT "${ermsText}" AFTER `dzwjh`;
</update>
<select
id=
"getfileTypeKey"
resultType=
"java.lang.String"
>
SELECT t2.file_type_key
FROM
(
SELECT
@r AS _id,
(SELECT @r := file_type_par FROM erms_file_type WHERE file_type_id = _id) AS file_type_par,
@l := @l + 1 AS lvl
FROM
(SELECT @r := #{fileType}, @l := 0) vars, erms_file_type AS h
WHERE @r
<![CDATA[ <> ]]>
0
) t1
JOIN erms_file_type t2
ON t1._id = t2.file_type_id
ORDER BY t1._id
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/ErmsFileTypePO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
/**
* <p>
* 文件类型目录表(一个档案库仅执行一套文件类型标准)
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"erms_file_type"
)
public
class
ErmsFileTypePO
extends
Model
<
ErmsFileTypePO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"file_type_id"
,
type
=
IdType
.
AUTO
)
private
Integer
fileTypeId
;
@TableField
(
"file_type_name"
)
private
String
fileTypeName
;
@TableField
(
"qy_id"
)
private
Integer
qyId
;
@TableField
(
"file_type_role"
)
private
String
fileTypeRole
;
@TableField
(
"file_type_par"
)
private
Integer
fileTypePar
;
@TableField
(
"file_type_oder"
)
private
Integer
fileTypeOder
;
/**
* 档案类型键值(相同父级下键值不允许重复)
*/
@TableField
(
"file_type_key"
)
private
String
fileTypeKey
;
/**
* 插入时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
"insert_date"
)
private
LocalDateTime
insertDate
;
/**
* 有效标志
*/
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
FILE_TYPE_ID
=
"file_type_id"
;
public
static
final
String
FILE_TYPE_NAME
=
"file_type_name"
;
public
static
final
String
FILE_TYPE_ROLE
=
"file_type_role"
;
public
static
final
String
FILE_TYPE_PAR
=
"file_type_par"
;
public
static
final
String
FILE_TYPE_ODER
=
"file_type_oder"
;
public
static
final
String
FILE_TYPE_KEY
=
"file_type_key"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
fileTypeId
;
}
}
src/main/java/com/greatchn/collection/entity/ErmsOrganizationMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
* 全宗信息(存档机构信息)-字段未完全补充,预留关联关系 Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-11
*/
public
interface
ErmsOrganizationMapper
extends
BaseMapper
<
ErmsOrganizationPO
>
{
ErmsOrganizationPO
get
(
@Param
(
"cpCode"
)
String
cpCode
,
@Param
(
"xtId"
)
String
xtId
);
List
<
Map
>
getList
(
@Param
(
"organizationId"
)
Integer
organizationId
,
@Param
(
"qyId"
)
String
qyId
);
List
<
Map
>
getXtList
(
@Param
(
"organizationId"
)
Integer
organizationId
,
@Param
(
"qyId"
)
String
qyId
);
/**
* 根据主键id查询state=Y的ErmsQuanzong
*
* @param quanZongId 主键id
* @return
*/
ErmsOrganizationPO
findEnableById
(
@Param
(
"id"
)
String
quanZongId
);
}
src/main/java/com/greatchn/collection/entity/ErmsOrganizationMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.ErmsOrganizationMapper"
>
<select
id=
"get"
resultType=
"com.greatchn.collection.entity.ErmsOrganizationPO"
>
SELECT eq.*
FROM erms_organization eq
LEFT JOIN sj_xt_organization xq ON eq.id = xq.organization_id
WHERE xq.state = 'Y'
AND xq.cp_code = #{cpCode}
AND xq.xt_id = #{xtId}
</select>
<select
id=
"getList"
resultType=
"java.util.Map"
>
SELECT
eq.id AS organizationId,
eq.organization_no AS organizationNo,
eq.organization_name AS organizationName,
eq.user_id AS userId ,
IF(ui.name !='',ui.name,eu.user_name) AS userName,
DATE_FORMAT(eq.insert_date,'%Y-%m-%d %T') AS insertDate,
eq.remark,
pqo.qiye_id AS qyId,
qy.qy_name AS qyName
FROM erms_organization eq
LEFT JOIN erms_user eu ON eu.user_id = eq.user_id
LEFT JOIN erms_user_info ui ON ui.user_id = eu.user_id
LEFT JOIN pz_qiye_organization pqo ON pqo.organization_id = eq.id
LEFT JOIN erms_qiye qy ON pqo.qiye_id = qy.id
WHERE eq.state='Y' AND pqo.qiye_id = #{qyId}
<if
test=
"organizationId != null"
>
AND eq.id = #{organizationId}
</if>
</select>
<select
id=
"getXtList"
resultType=
"java.util.Map"
>
SELECT xi.xt_id AS xtId,
xi.xt_name AS xtName,
xi.xt_rem AS xtRem,
xq.id,
xq.organization_id AS organizationId,
xq.cp_code AS cpCode,
xq.state
FROM sj_xt_info xi
LEFT JOIN sj_xt_organization xq ON xi.xt_id = xq.xt_id AND xq.organization_id = #{organizationId}
WHERE xi.qy_id = #{qyId}
GROUP BY xi.xt_id
</select>
<!--根据主键id查询state=Y的ErmsQuanzong-->
<select
id=
"findEnableById"
resultType=
"com.greatchn.collection.entity.ErmsOrganizationPO"
>
select *
from erms_organization
where id = #{id}
and state = "Y";
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/ErmsOrganizationPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
/**
* <p>
* 全宗信息(存档机构信息)-字段未完全补充,预留关联关系
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-11
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"erms_organization"
)
public
class
ErmsOrganizationPO
extends
Model
<
ErmsOrganizationPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@TableField
(
"organization_no"
)
private
String
organizationNo
;
@TableField
(
"organization_name"
)
private
String
organizationName
;
/**
* 会计主管
*/
@TableField
(
"user_id"
)
private
String
userId
;
/**
* 插入时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
value
=
"insert_date"
,
fill
=
FieldFill
.
INSERT
)
private
LocalDateTime
insertDate
;
/**
* 更新时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
value
=
"update_date"
,
fill
=
FieldFill
.
UPDATE
)
private
LocalDateTime
updateDate
;
/**
* 插入人
*/
@TableField
(
value
=
"insert_user"
,
fill
=
FieldFill
.
INSERT
)
private
Integer
insertUser
;
/**
* 更新人
*/
@TableField
(
value
=
"update_user"
,
fill
=
FieldFill
.
UPDATE
)
private
Integer
updateUser
;
/**
* 备注
*/
@TableField
(
"remark"
)
private
String
remark
;
/**
* 有效标志
*/
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
ORGANIZATION_NO
=
"organization_no"
;
public
static
final
String
ORGANIZATION_NAME
=
"organization_name"
;
public
static
final
String
USER_ID
=
"user_id"
;
public
static
final
String
INSERT_USER
=
"insert_user"
;
public
static
final
String
UPDATE_USER
=
"update_user"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
UPDATE_DATE
=
"update_date"
;
public
static
final
String
REMARK
=
"remark"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/ErmsQiyeMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>
* 企业管理表,关联全宗号 Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-11-25
*/
public
interface
ErmsQiyeMapper
extends
BaseMapper
<
ErmsQiyePO
>
{
/**
* 根据主键id查询state=Y的QyQzPO
*
* @param id 主键id
* @return
*/
ErmsQiyePO
findEnableListById
(
@Param
(
"id"
)
Integer
id
);
ErmsQiyePO
getErmsQzCertPOByOgId
(
@Param
(
"organizationId"
)
Integer
organizationId
);
}
src/main/java/com/greatchn/collection/entity/ErmsQiyeMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.ErmsQiyeMapper"
>
<!--根据主键id查询state=Y的QyQzPO-->
<select
id=
"findEnableListById"
resultType=
"com.greatchn.collection.entity.ErmsQiyePO"
>
select * from erms_qiye where id = #{id};
</select>
<select
id=
"getErmsQzCertPOByOgId"
resultType=
"com.greatchn.collection.entity.ErmsQiyePO"
>
SELECT eq.* FROM erms_qiye eq
LEFT JOIN pz_qiye_organization qo ON qo.qiye_id=eq.`id`
LEFT JOIN erms_organization eo ON eo.id = qo.organization_id
WHERE eo.id=#{organizationId}
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/ErmsQiyePO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* <p>
* 企业管理表,关联全宗号
* </p>
*
* @author mybatis-plus-generator
* @since 2022-11-25
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"erms_qiye"
)
public
class
ErmsQiyePO
extends
Model
<
ErmsQiyePO
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id,企业id
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 企业名称
*/
@TableField
(
"qy_name"
)
private
String
qyName
;
/**
* +全宗号
*/
@TableField
(
"qz_no"
)
private
String
qzNo
;
/**
* 纳税人识别号
*/
@TableField
(
"ns_id"
)
private
String
nsId
;
/**
* 联系人
*/
@TableField
(
"user_name"
)
private
String
userName
;
/**
* 手机号
*/
@TableField
(
"phone"
)
private
String
phone
;
/**
* 邮箱
*/
@TableField
(
"email"
)
private
String
email
;
/**
* 公司地址
*/
@TableField
(
"address"
)
private
String
address
;
/**
* 备注
*/
@TableField
(
"remark"
)
private
String
remark
;
/**
* 插入时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
value
=
"insert_date"
,
fill
=
FieldFill
.
INSERT
)
private
LocalDateTime
insertDate
;
/**
* 更新时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
value
=
"update_date"
,
fill
=
FieldFill
.
UPDATE
)
private
LocalDateTime
updateDate
;
/**
* 插入人
*/
@TableField
(
value
=
"insert_user"
,
fill
=
FieldFill
.
INSERT
)
private
Integer
insertUser
;
/**
* 更新人
*/
@TableField
(
value
=
"update_user"
,
fill
=
FieldFill
.
UPDATE
)
private
Integer
updateUser
;
/**
* 有效标识 Y:启用 D:未启用
*/
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
QY_NAME
=
"qy_name"
;
public
static
final
String
NS_ID
=
"ns_id"
;
public
static
final
String
USER_NAME
=
"user_name"
;
public
static
final
String
PHONE
=
"phone"
;
public
static
final
String
EMAIL
=
"email"
;
public
static
final
String
ADDRESS
=
"address"
;
public
static
final
String
REMARK
=
"remark"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
UPDATE_DATE
=
"update_date"
;
public
static
final
String
INSERT_USER
=
"insert_user"
;
public
static
final
String
UPDATE_USER
=
"update_user"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/ErmsQzCertMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
ErmsQzCertMapper
extends
BaseMapper
<
ErmsQzCertPO
>
{
}
src/main/java/com/greatchn/collection/entity/ErmsQzCertMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.ErmsQzCertMapper"
>
</mapper>
src/main/java/com/greatchn/collection/entity/ErmsQzCertPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
/**
* <p>
*
* </p>
*
* @author mybatis-plus-generator
* @since 2022-09-13
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"erms_qz_cert"
)
public
class
ErmsQzCertPO
extends
Model
<
ErmsQzCertPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 组织机构no
*/
@TableField
(
"organization_no"
)
private
String
organizationNo
;
/**
* 系统id
*/
@TableField
(
"xt_id"
)
private
String
xtId
;
/**
* 证书文件
*/
@TableField
(
"cert_file"
)
private
String
certFile
;
/**
* 秘钥
*/
@TableField
(
"password"
)
private
String
password
;
/**
* 签章图片
*/
@TableField
(
"img"
)
private
String
img
;
/**
* 插入时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
value
=
"insert_date"
,
fill
=
FieldFill
.
INSERT
)
private
LocalDateTime
insertDate
;
/**
* 更新时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
value
=
"update_date"
,
fill
=
FieldFill
.
UPDATE
)
private
LocalDateTime
updateDate
;
/**
* 插入人
*/
@TableField
(
value
=
"insert_user"
,
fill
=
FieldFill
.
INSERT
)
private
Integer
insertUser
;
/**
* 更新人
*/
@TableField
(
value
=
"update_user"
,
fill
=
FieldFill
.
UPDATE
)
private
Integer
updateUser
;
/**
* 有效标志
*/
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
ORGANIZATION_NO
=
"organization_no"
;
public
static
final
String
XT_ID
=
"xt_id"
;
public
static
final
String
CERT_FILE
=
"cert_file"
;
public
static
final
String
PASSWORD
=
"password"
;
public
static
final
String
IMG
=
"img"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
UPDATE_DATE
=
"update_date"
;
public
static
final
String
INSERT_USER
=
"insert_user"
;
public
static
final
String
UPDATE_USER
=
"update_user"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/FileMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.greatchn.collection.entity.FilePO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
public
interface
FileMapper
extends
BaseMapper
<
FilePO
>
{
}
src/main/java/com/greatchn/collection/entity/FilePO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
@Data
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"file"
)
public
class
FilePO
{
/*** id*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
/*** 相对路径*/
@TableField
(
"path"
)
private
String
path
;
/*** 文件名*/
@TableField
(
"name"
)
private
String
name
;
/*** 后缀*/
@TableField
(
"suffix"
)
private
String
suffix
;
/*** 大小|字节B*/
@TableField
(
"size"
)
private
Integer
size
;
/*** 创建时间*/
@TableField
(
"created_at"
)
private
Long
createdAt
;
/*** 修改时间*/
@TableField
(
"updated_at"
)
private
Long
updatedAt
;
/*** 已上传分片*/
@TableField
(
"shard_index"
)
private
Integer
shardIndex
;
/*** 分片大小|B*/
@TableField
(
"shard_size"
)
private
Integer
shardSize
;
/*** 分片总数*/
@TableField
(
"shard_total"
)
private
Integer
shardTotal
;
/*** 文件标识*/
@TableField
(
"file_key"
)
private
String
fileKey
;
/**
* 有效标志
*/
@TableField
(
"state"
)
private
String
state
;
}
src/main/java/com/greatchn/collection/entity/GxFileAttMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.greatchn.collection.entity.GxFileAttPO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
* Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-15
*/
public
interface
GxFileAttMapper
extends
BaseMapper
<
GxFileAttPO
>
{
/**
* 获取附件文件类型列表
*
* @param djwjh
* @return
* @author zhaolechang
* @creed: Talk is cheap,show me the code
* @date 2022/8/17 16:01
*/
List
<
Integer
>
gerTypeList
(
@Param
(
"dzwjh"
)
String
djwjh
);
/**
* 获取文件数据
*
* @param djwjh
* @param fileType
* @return
* @author zhaolechang
* @creed: Talk is cheap,show me the code
* @date 2022/8/18 9:51
*/
List
<
Map
<
String
,
Object
>>
getFileInfo
(
@Param
(
"dzwjh"
)
String
djwjh
,
@Param
(
"fileType"
)
Integer
fileType
);
/**
* 通过M007拿数据
* @param M007
* @param fileType
* @return
*/
List
<
Map
<
String
,
Object
>>
getFileInfoBy007
(
@Param
(
"dzwjh"
)
String
M007
,
@Param
(
"fileType"
)
Integer
fileType
);
/**
* 获取指定册的文件和附件信息
*
* @param arcDh
* @return
* @author zhaoding 20221009
*/
List
<
GxFileAttPO
>
getArcAtt
(
@Param
(
"arcDh"
)
String
arcDh
);
}
src/main/java/com/greatchn/collection/entity/GxFileAttMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.GxFileAttMapper"
>
<select
id=
"gerTypeList"
resultType=
"java.lang.Integer"
>
SELECT att_type_id
FROM gx_file_att
WHERE file_dzwjh = #{dzwjh}
GROUP BY att_type_id
</select>
<select
id=
"getFileInfo"
resultType=
"java.util.Map"
>
SELECT *, #{fileType} fileTypeId FROM cc_file_info_${fileType}
WHERE dzwjh = #{dzwjh}
</select>
<select
id=
"getFileInfoBy007"
resultType=
"java.util.Map"
>
SELECT *, #{fileType} fileTypeId FROM cc_file_info_${fileType}
WHERE M007 = #{dzwjh}
</select>
<select
id=
"getArcAtt"
resultType=
"com.greatchn.collection.entity.GxFileAttPO"
>
SELECT * FROM gx_file_att
WHERE file_dzwjh IN
(SELECT file_dzwjh FROM gx_arc_file WHERE arc_dh=#{arcDh})
AND file_type_id IN
(SELECT file_type_id FROM gx_arc_file WHERE arc_dh=#{arcDh})
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/GxFileAttPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
/**
* <p>
*
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-15
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"gx_file_att"
)
public
class
GxFileAttPO
extends
Model
<
GxFileAttPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 文件电子文件号
*/
@TableField
(
"file_dzwjh"
)
private
String
fileDzwjh
;
/**
* 文件类型
*/
@TableField
(
"file_type_id"
)
private
Integer
fileTypeId
;
/**
* 附件电子文件号
*/
@TableField
(
"att_dzwjh"
)
private
String
attDzwjh
;
/**
* 附件类型
*/
@TableField
(
"att_type_id"
)
private
Integer
attTypeId
;
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
FILE_DZWJH
=
"file_dzwjh"
;
public
static
final
String
FILE_TYPE_ID
=
"file_type_id"
;
public
static
final
String
ATT_DZWJH
=
"att_dzwjh"
;
public
static
final
String
ATT_TYPE_ID
=
"att_type_id"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/PzFileSjMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>
* 文件收集重复数据判断标志 Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2023-01-04
*/
public
interface
PzFileSjMapper
extends
BaseMapper
<
PzFileSjPO
>
{
/**
* 获取重复元素组合 列转行
* @param fileTypeId
* @return
*/
String
getMds
(
@Param
(
"id"
)
Integer
fileTypeId
);
}
src/main/java/com/greatchn/collection/entity/PzFileSjMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.PzFileSjMapper"
>
<select
id=
"getMds"
resultType=
"java.lang.String"
>
SELECT GROUP_CONCAT(md_id) AS mds FROM pz_file_sj WHERE file_type_id =#{id} AND state='Y'
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/PzFileSjPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
/**
* <p>
* 文件收集重复数据判断标志
* </p>
*
* @author mybatis-plus-generator
* @since 2023-01-04
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"pz_file_sj"
)
public
class
PzFileSjPO
extends
Model
<
PzFileSjPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@TableField
(
"file_type_id"
)
private
Integer
fileTypeId
;
/**
* 重复数据判断标准
*/
@TableField
(
"md_id"
)
private
String
mdId
;
@TableField
(
value
=
"insert_date"
,
fill
=
FieldFill
.
INSERT
)
private
LocalDateTime
insertDate
;
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
FILE_TYPE_ID
=
"file_type_id"
;
public
static
final
String
MD_ID
=
"md_id"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/SjFileAttRelMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.greatchn.collection.entity.SjFileAttRelPO
;
/**
* <p>
* 收集主流程记录总表 Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
public
interface
SjFileAttRelMapper
extends
BaseMapper
<
SjFileAttRelPO
>
{
}
src/main/java/com/greatchn/collection/entity/SjFileAttRelPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* <p>
* 文件附件关系表
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-08
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"sj_file_att_rel"
)
public
class
SjFileAttRelPO
extends
Model
<
SjFileAttRelPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@TableField
(
"xt_id"
)
private
String
xtId
;
@TableField
(
"file_id"
)
private
Integer
fileId
;
@TableField
(
"att_id"
)
private
Integer
attId
;
/**
* 插入时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
"insert_date"
)
private
LocalDateTime
insertDate
;
/**
* 有效标志
*/
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
XT_ID
=
"xt_id"
;
public
static
final
String
FILE_ID
=
"file_id"
;
public
static
final
String
ATT_ID
=
"att_id"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/SjFileSaveParamMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.greatchn.collection.entity.SjFileSaveParamPO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
SjFileSaveParamMapper
extends
BaseMapper
<
SjFileSaveParamPO
>
{
List
<
SjFileSaveParamPO
>
getList
(
@Param
(
"fileTypeId"
)
Integer
fileTypeId
,
@Param
(
"xtId"
)
String
xtId
);
}
src/main/java/com/greatchn/collection/entity/SjFileSaveParamMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.SjFileSaveParamMapper"
>
<select
id=
"getList"
resultType=
"com.greatchn.collection.entity.SjFileSaveParamPO"
>
SELECT * FROM sj_file_save_param
WHERE file_type_id=#{fileTypeId} AND xt_id=#{xtId} AND state='Y'
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/SjFileSaveParamPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"sj_file_save_param"
)
public
class
SjFileSaveParamPO
extends
Model
<
SjFileSaveParamPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@TableField
(
"file_type_id"
)
private
Integer
fileTypeId
;
@TableField
(
"file_key"
)
private
String
fileKey
;
/**
* 取值方式(系统导入:F,默认值:M)
*/
@TableField
(
"vv_type"
)
private
String
vvType
;
/**
* 默认值
*/
@TableField
(
"vv_value"
)
private
String
vvValue
;
@TableField
(
"xt_id"
)
private
String
xtId
;
/**
* 插入时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
"insert_date"
)
private
LocalDateTime
insertDate
;
/**
* 有效标志
*/
@TableField
(
"state"
)
private
String
state
;
@TableField
(
"remark"
)
private
String
remark
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
FILE_TYPE_ID
=
"file_type_id"
;
public
static
final
String
FILE_KEY
=
"file_key"
;
public
static
final
String
VV_TYPE
=
"vv_type"
;
public
static
final
String
VV_VALUE
=
"vv_value"
;
public
static
final
String
XT_ID
=
"xt_id"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
STATE
=
"state"
;
public
static
final
String
REMARK
=
"remark"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/SjLogErrorMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* <p>
* Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-09-27
*/
public
interface
SjLogErrorMapper
extends
BaseMapper
<
SjLogErrorPO
>
{
}
src/main/java/com/greatchn/collection/entity/SjLogErrorPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
/**
* <p>
*
* </p>
*
* @author mybatis-plus-generator
* @since 2022-09-27
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"sj_log_error"
)
public
class
SjLogErrorPO
extends
Model
<
SjLogErrorPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@TableField
(
"sj_log_sub1_id"
)
private
Integer
sjLogSub1Id
;
@TableField
(
"sj_log_sub2_id"
)
private
Integer
sjLogSub2Id
;
@TableField
(
"error_msg"
)
private
String
errorMsg
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
SJ_LOG_SUB1_ID
=
"sj_log_sub1_id"
;
public
static
final
String
SJ_LOG_SUB2_ID
=
"sj_log_sub2_id"
;
public
static
final
String
ERROR_MSG
=
"error_msg"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/SjLogMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.greatchn.collection.entity.SjLogPO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>
* 收集主流程记录总表 Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
public
interface
SjLogMapper
extends
BaseMapper
<
SjLogPO
>
{
/**
* 收集进度日志 总数
*
* @param fileList
* @param selectSql
* @return
*/
long
count
(
@Param
(
"fileTypeIdList"
)
List
<
Integer
>
fileList
,
@Param
(
"selectSql"
)
String
selectSql
);
/**
* 收集进度列表查询接口
List<ProgressRespVO> list(@Param("fileTypeIdList") List<Integer> fileList, @Param("selectSql") String selectSql,
@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
*/
Integer
getNumber
(
@Param
(
"prefixName"
)
String
prefixName
);
/**
* 查询当前系统id接收文件总数量
*
* @param xtId 系统id
* @return
* @author zhangkun
* @date 2023/1/11 16:41
*/
Integer
getDocumentCount
(
@Param
(
"id"
)
String
xtId
,
@Param
(
"userId"
)
String
userId
,
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
);
}
src/main/java/com/greatchn/collection/entity/SjLogMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.SjLogMapper"
>
<select
id=
"count"
resultType=
"long"
>
SELECT COUNT(*) FROM (
SELECT
sl.*,sxi.xt_name,si.sj_name
FROM
sj_log sl
LEFT JOIN sj_info si ON si.sj_id = sl.sj_id
LEFT JOIN sj_xt_info sxi ON sxi.xt_id= si.xt_id
WHERE sl.state = 'Y'
AND (sl.sj_id IN (SELECT sji.sj_id FROM sj_info sji WHERE sji.file_type_id IN
<foreach
collection=
"fileTypeIdList"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
)
OR sl.`manual_file_type` IN
<foreach
collection=
"fileTypeIdList"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
)
<if
test=
"selectSql != null "
>
${selectSql}
</if>
) AS cc
</select>
<!--
<select id="list" resultType="com.greatchn.erms.manage.biz.collect.vo.ProgressRespVO">
SELECT
sl.*,IFNULL(sxi.xt_name,sxix.`xt_name`) AS xt_name,IFNULL(si.sj_name,'自定义收集') AS sj_name,
smi.start_date,smi.end_date,eft.`file_type_name`
FROM
sj_log sl
LEFT JOIN sj_info si ON si.sj_id = sl.sj_id
LEFT JOIN sj_xt_info sxi ON sxi.xt_id= si.xt_id
LEFT JOIN sj_manual_info smi ON smi.`id` = sl.`manual_id`
LEFT JOIN sj_xt_info sxix ON sxix.xt_id= smi.xt_id
LEFT JOIN erms_file_type eft ON eft.`file_type_id`=sl.`manual_file_type`
WHERE sl.state = 'Y'
AND sl.`manual_file_type` IN
<foreach collection="fileTypeIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="selectSql != null ">
${selectSql}
</if>
ORDER BY sl.insert_date DESC
LIMIT #{pageNum}, #{pageSize}
</select>
-->
<select
id=
"getNumber"
statementType=
"CALLABLE"
resultType=
"Integer"
>
CALL PROC_NEXT_SERIAL(#{prefixName,mode=IN,jdbcType=VARCHAR})
</select>
<select
id=
"getDocumentCount"
resultType=
"java.lang.Integer"
>
SELECT SUM(sj_suss)
FROM sj_log
WHERE xt_id = #{id}
<if
test=
"userId != null"
>
AND insert_user = #{userId}
</if>
<if
test=
"startTime != null"
>
AND insert_date BETWEEN #{startTime} AND #{endTime}
</if>
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/SjLogPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
/**
* <p>
* 收集主流程记录总表
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"sj_log"
)
public
class
SjLogPO
extends
Model
<
SjLogPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 无意义主键
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@TableField
(
"sj_id"
)
private
Integer
sjId
;
/**
* 收集记录id 生成规则 收集区间+启动时间+收集id 例:收集区间为年,触发时间一月一日(0101),收集id为1 当前为2022年 生成id为 202201010001
*/
@TableField
(
"sj_log_id"
)
private
String
sjLogId
;
/**
* 收集文件总数
*/
@TableField
(
"sj_cont"
)
private
Integer
sjCont
;
/**
* 收集成功数量
*/
@TableField
(
"sj_suss"
)
private
Integer
sjSuss
;
/**
* 记录结果 01:收集中 (进行中不允许操作该收集流程) 02:收集完成 03:预组卷中(进行中不允许操作该收集流程) 04:预组卷完成 92:收集中存在错误 93:预组卷失败
*/
@TableField
(
"sj_state"
)
private
String
sjState
;
/**
* 插入人
*/
@TableField
(
"insert_user"
)
private
String
insertUser
;
/**
* 插入时间
*/
@TableField
(
"insert_date"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
insertDate
;
/**
* 更新人
*/
@TableField
(
"update_user"
)
private
String
updateUser
;
/**
* 更新时间
*/
@TableField
(
"update_date"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
updateDate
;
/**
* 有效标志
*/
@TableField
(
"state"
)
private
String
state
;
/**
* 手动收集对应的文件类型id
*/
@TableField
(
"manual_file_type"
)
private
Integer
manualFileType
;
/**
* 手动收集id
*/
@TableField
(
"manual_id"
)
private
Integer
manualId
;
/**
* 系统id
*/
@TableField
(
"xt_id"
)
private
String
xtId
;
/**
* 系统id
*/
@TableField
(
"qiye_id"
)
private
Integer
qiyeId
;
/**
* 组织id
*/
@TableField
(
"organization_id"
)
private
Integer
organizationId
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
SJ_ID
=
"sj_id"
;
public
static
final
String
SJ_LOG_ID
=
"sj_log_id"
;
public
static
final
String
SJ_CONT
=
"sj_cont"
;
public
static
final
String
SJ_SUSS
=
"sj_suss"
;
public
static
final
String
SJ_STATE
=
"sj_state"
;
public
static
final
String
INSERT_USER
=
"insert_user"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
UPDATE_USER
=
"update_user"
;
public
static
final
String
UPDATE_DATE
=
"update_date"
;
public
static
final
String
STATE
=
"state"
;
public
static
final
String
MANUAL_FILE_TYPE
=
"manual_file_type"
;
public
static
final
String
MANUAL_ID
=
"manual_id"
;
public
static
final
String
XT_Id
=
"xt_id"
;
public
static
final
String
QIYE_Id
=
"qiye_id"
;
public
static
final
String
ORGANIZATUIN_ID
=
"organization_id"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/SjLogSub1InfoMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.greatchn.collection.entity.SjLogSub1InfoPO
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>
* 收集主流程记录总表 Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
public
interface
SjLogSub1InfoMapper
extends
BaseMapper
<
SjLogSub1InfoPO
>
{
int
updateState
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"state"
)
String
state
);
}
src/main/java/com/greatchn/collection/entity/SjLogSub1InfoMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.SjLogSub1InfoMapper"
>
<!-- 修改信息 -->
<update
id=
"updateState"
>
UPDATE sj_log_sub1_info
SET
state = #{state}
WHERE sj_log_sub1_id = #{id}
</update>
</mapper>
src/main/java/com/greatchn/collection/entity/SjLogSub1InfoPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* <p>
* 收集主流程记录总表
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"sj_log_sub1_info"
)
public
class
SjLogSub1InfoPO
extends
Model
<
SjLogSub1InfoPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 无意义主键
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 收集记录id 生成规则 收集区间+启动时间+收集id 例:收集区间为年,触发时间一月一日(0101),收集id为1 当前为2022年 生成id为 202201010001
*/
@TableField
(
"sj_log_sub1_id"
)
private
Integer
sjLogSub1Id
;
@TableField
(
"info_key"
)
private
String
infoKey
;
@TableField
(
"info_value"
)
private
String
infoValue
;
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
SJ_LOG_SUB1_ID
=
"sj_log_sub1_id"
;
public
static
final
String
INFO_KEY
=
"info_key"
;
public
static
final
String
INFO_VALUE
=
"info_value"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/SjLogSub1Mapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.greatchn.collection.entity.SjLogSub1PO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
* 收集记录附表1——单件收集记录 Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
public
interface
SjLogSub1Mapper
extends
BaseMapper
<
SjLogSub1PO
>
{
/**
* 修改信息
*
* @param sjLogId
*/
void
updateInfo
(
@Param
(
"sjLogId"
)
Integer
sjLogId
);
long
count
(
@Param
(
"sjLogId"
)
Integer
sjLogId
,
@Param
(
"fileTypeId"
)
Integer
fileTypeId
,
@Param
(
"selectSql"
)
String
selectSql
);
long
countSjState
(
@Param
(
"sjLogId"
)
Integer
sjLogId
,
@Param
(
"selectSql"
)
String
selectSql
);
List
<
Map
>
getSub1
(
@Param
(
"sjLogId"
)
Integer
sjLogId
,
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"pageSize"
)
Integer
pageSize
,
@Param
(
"fileTypeId"
)
Integer
fileTypeId
,
@Param
(
"selectSql"
)
String
selectSql
);
List
<
Map
>
getSub2
(
@Param
(
"sjSub1Id"
)
Integer
sjSub1Id
);
}
src/main/java/com/greatchn/collection/entity/SjLogSub1Mapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.SjLogSub1Mapper"
>
<!-- 修改信息 -->
<update
id=
"updateInfo"
>
UPDATE sj_log_sub1
SET
state = 'N'
WHERE sj_log_id = #{sjLogId}
</update>
<select
id=
"count"
resultType=
"long"
>
SELECT COUNT(*)
FROM sj_log_sub1 sb1
LEFT JOIN cc_file_info_${fileTypeId} cc ON cc.dzwjh=sb1.xt_uuid
WHERE sb1.sj_log_id=#{sjLogId} AND sb1.state='Y'
<if
test=
"selectSql != null "
>
${selectSql}
</if>
</select>
<select
id=
"countSjState"
resultType=
"long"
>
SELECT COUNT(*)
FROM sj_log_sub1 sb1
WHERE sb1.state='Y'
AND sb1.sj_log_id=#{sjLogId}
<if
test=
"selectSql != null "
>
${selectSql}
</if>
</select>
<select
id=
"getSub1"
resultType=
"java.util.Map"
>
SELECT sb1.id,sb1.sj_log_id,sb1.dzwjh,sb1.xt_uuid,sb1.sj_state,IFNULL(ui.name,ui.name) AS collect_user,
IF(sj_state=92,IFNULL(le.`error_msg`,'附件存在异常'),'')AS error, cc.*
FROM sj_log_sub1 sb1
LEFT JOIN erms_user eu ON eu.user_id = sb1.insert_user
LEFT JOIN erms_user_info ui ON ui.user_id=eu.user_id
LEFT JOIN sj_log_error le ON le.`sj_log_sub1_id`=sb1.`id` AND le.`sj_log_sub2_id` IS NULL
LEFT JOIN cc_file_info_${fileTypeId} cc ON cc.dzwjh=sb1.xt_uuid
WHERE sb1.sj_log_id=#{sjLogId} AND sb1.state='Y'
<if
test=
"selectSql != null "
>
${selectSql}
</if>
ORDER BY sb1.id
LIMIT #{pageNum}, #{pageSize}
</select>
<select
id=
"getSub2"
resultType=
"java.util.Map"
>
SELECT sb2.id,sb2.`dzwjh`,sb2.`fj_xh`,sb2.`xt_uuid`,sb2.`sj_state`,le.`error_msg`,ft.`file_type_name`
FROM sj_log_sub2 sb2
LEFT JOIN sj_log_error le ON le.`sj_log_sub2_id`=sb2.`id`
LEFT JOIN erms_file_type ft ON ft.`file_type_id`=sb2.`file_type_id`
WHERE sb2.`sj_sub1_id` = #{sjSub1Id}
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/SjLogSub1PO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
/**
* <p>
* 收集记录附表1——单件收集记录
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"sj_log_sub1"
)
public
class
SjLogSub1PO
extends
Model
<
SjLogSub1PO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@TableField
(
"sj_log_id"
)
private
Integer
sjLogId
;
/**
* 文件类型
*/
@TableField
(
"file_type_id"
)
private
Integer
fileTypeId
;
/**
* 全宗号-收集id-顺序号(七位,不够补0 / 来源系统资料唯一标志) 例:QZ001-202101010001-0000001
*/
@TableField
(
"dzwjh"
)
private
String
dzwjh
;
/**
* 对接系统对文件的唯一标识
*/
@TableField
(
"xt_uuid"
)
private
String
xtUuid
;
/**
* 收集状态
*/
@TableField
(
"sj_state"
)
private
String
sjState
;
/**
* 插入人
*/
@TableField
(
"insert_user"
)
private
String
insertUser
;
/**
* 插入时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
"insert_date"
)
private
LocalDateTime
insertDate
;
/**
* 更新人
*/
@TableField
(
"update_user"
)
private
String
updateUser
;
/**
* 更新时间
*/
@TableField
(
"update_date"
)
private
LocalDateTime
updateDate
;
/**
* 有效标志
*/
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
SJ_LOG_ID
=
"sj_log_id"
;
public
static
final
String
DZWJH
=
"dzwjh"
;
public
static
final
String
XT_UUID
=
"xt_uuid"
;
public
static
final
String
SJ_STATE
=
"sj_state"
;
public
static
final
String
INSERT_USER
=
"insert_user"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
UPDATE_USER
=
"update_user"
;
public
static
final
String
UPDATE_DATE
=
"update_date"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/SjLogSub2InfoMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.greatchn.collection.entity.SjLogSub2InfoPO
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>
* 收集主流程记录总表 Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
public
interface
SjLogSub2InfoMapper
extends
BaseMapper
<
SjLogSub2InfoPO
>
{
int
updateState
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"state"
)
String
state
);
}
src/main/java/com/greatchn/collection/entity/SjLogSub2InfoMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.SjLogSub2InfoMapper"
>
<!-- 修改信息 -->
<update
id=
"updateState"
>
UPDATE sj_log_sub2_info
SET
state = #{state}'
WHERE sj_log_sub2_id = #{id}
</update>
</mapper>
src/main/java/com/greatchn/collection/entity/SjLogSub2InfoPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* <p>
* 收集主流程记录总表
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"sj_log_sub2_info"
)
public
class
SjLogSub2InfoPO
extends
Model
<
SjLogSub2InfoPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 无意义主键
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 收集记录id 生成规则 收集区间+启动时间+收集id 例:收集区间为年,触发时间一月一日(0101),收集id为1 当前为2022年 生成id为 202201010001
*/
@TableField
(
"sj_log_sub2_id"
)
private
Integer
sjLogSub2Id
;
@TableField
(
"info_key"
)
private
String
infoKey
;
@TableField
(
"info_value"
)
private
String
infoValue
;
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
SJ_LOG_SUB2_ID
=
"sj_log_sub2_id"
;
public
static
final
String
INFO_KEY
=
"info_key"
;
public
static
final
String
INFO_VALUE
=
"info_value"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/SjLogSub2Mapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.greatchn.collection.entity.SjLogSub2PO
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>
* 收集记录附表2——附件收集记录 Mapper 接口
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
public
interface
SjLogSub2Mapper
extends
BaseMapper
<
SjLogSub2PO
>
{
/**
* 修改信息
* @param sjLogId
*/
void
updateInfo
(
@Param
(
"sjLogId"
)
Integer
sjLogId
);
long
countSjState
(
@Param
(
"sjLogSub1Id"
)
Integer
sjLogSub1Id
,
@Param
(
"selectSql"
)
String
selectSql
);
}
src/main/java/com/greatchn/collection/entity/SjLogSub2Mapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.SjLogSub2Mapper"
>
<!-- 修改信息 -->
<update
id=
"updateInfo"
>
UPDATE sj_log_sub2
SET
state = 'N'
WHERE sj_sub1_id IN (SELECT id FROM sj_log_sub1 WHERE sj_log_id = #{sjLogId} )
</update>
<select
id=
"countSjState"
resultType=
"long"
>
SELECT COUNT(*)
FROM sj_log_sub2 sb2
WHERE sb2.state='Y'
AND sb2.sj_sub1_id=#{sjLogSub1Id}
<if
test=
"selectSql != null "
>
${selectSql}
</if>
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/SjLogSub2PO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
/**
* <p>
* 收集记录附表2——附件收集记录
* </p>
*
* @author mybatis-plus-generator
* @since 2022-08-02
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"sj_log_sub2"
)
public
class
SjLogSub2PO
extends
Model
<
SjLogSub2PO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@TableField
(
"sj_sub1_id"
)
private
Integer
sjSub1Id
;
/**
* 文件类型
*/
@TableField
(
"file_type_id"
)
private
Integer
fileTypeId
;
@TableField
(
"dzwjh"
)
private
String
dzwjh
;
/**
* 全宗号-收集id-顺序号(七位,不够补0 / 来源系统资料唯一标志) 例:QZ001-202101010001-0000001
*/
@TableField
(
"fj_xh"
)
private
String
fjXh
;
/**
* 对接系统对文件的唯一标识
*/
@TableField
(
"xt_uuid"
)
private
String
xtUuid
;
/**
* 收集状态
*/
@TableField
(
"sj_state"
)
private
String
sjState
;
/**
* 插入人
*/
@TableField
(
"insert_user"
)
private
String
insertUser
;
/**
* 插入时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
"insert_date"
)
private
LocalDateTime
insertDate
;
/**
* 更新人
*/
@TableField
(
"update_user"
)
private
String
updateUser
;
/**
* 更新时间
*/
@TableField
(
"update_date"
)
private
LocalDateTime
updateDate
;
/**
* 有效标志
*/
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
SJ_SUB1_ID
=
"sj_sub1_id"
;
public
static
final
String
FILE_TYPE_ID
=
"file_type_id"
;
public
static
final
String
DZWJH
=
"dzwjh"
;
public
static
final
String
FJ_XH
=
"fj_xh"
;
public
static
final
String
XT_UUID
=
"xt_uuid"
;
public
static
final
String
SJ_STATE
=
"sj_state"
;
public
static
final
String
INSERT_USER
=
"insert_user"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
UPDATE_USER
=
"update_user"
;
public
static
final
String
UPDATE_DATE
=
"update_date"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/entity/SjMdXtMapper.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.greatchn.collection.entity.SjMdXtPO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
SjMdXtMapper
extends
BaseMapper
<
SjMdXtPO
>
{
SjMdXtPO
getOne
(
@Param
(
"xtId"
)
String
xtId
,
@Param
(
"fileTypeId"
)
int
fileTypeId
,
@Param
(
"mdId"
)
String
mdId
);
int
updateState
(
SjMdXtPO
sjMdXtPO
);
List
<
SjMdXtPO
>
getListByXtId
(
@Param
(
"xtId"
)
String
xtId
);
}
src/main/java/com/greatchn/collection/entity/SjMdXtMapper.xml
0 → 100644
View file @
817b21b7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.greatchn.collection.entity.SjMdXtMapper"
>
<select
id=
"getOne"
resultType=
"com.greatchn.collection.entity.SjMdXtPO"
>
SELECT * FROM sj_md_xt
WHERE xt_id=#{xtId} AND file_type_id =#{fileTypeId} AND md_id =#{mdId} AND state='Y'
</select>
<update
id=
"updateState"
parameterType=
"com.greatchn.collection.entity.SjMdXtPO"
>
UPDATE sj_md_xt
SET
`state` = #{state}
WHERE
state != #{state}
<if
test=
"fileTypeId != null "
>
AND file_type_id = #{fileTypeId}
</if>
<if
test=
"xtId != null "
>
AND xt_id = #{xtId}
</if>
</update>
<select
id=
"getListByXtId"
resultType=
"com.greatchn.collection.entity.SjMdXtPO"
>
SELECT * FROM sj_md_xt WHERE xt_id=#{xtId} AND state='Y' GROUP BY file_type_id
</select>
</mapper>
src/main/java/com/greatchn/collection/entity/SjMdXtPO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"sj_md_xt"
)
public
class
SjMdXtPO
extends
Model
<
SjMdXtPO
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 系统id
*/
@TableField
(
"xt_id"
)
private
String
xtId
;
/**
* 文件类型id
*/
@TableField
(
"file_type_id"
)
private
Integer
fileTypeId
;
/**
* 元数据id
*/
@TableField
(
"md_id"
)
private
String
mdId
;
/**
* 对接内容
*/
@TableField
(
"xt_value"
)
private
String
xtValue
;
/**
* 备注
*/
@TableField
(
"xt_rem"
)
private
String
xtRem
;
/**
* 对接标志 M:系统默认值或配置值 F:对接系统字段名(可手动修改) T:特殊处理字段(可手动修改) S:系统规则生成字段
*/
@TableField
(
"xt_state"
)
private
String
xtState
;
/**
* 插入时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
"insert_date"
)
private
LocalDateTime
insertDate
;
/**
* 有效标志
*/
@TableField
(
"state"
)
private
String
state
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
XT_ID
=
"xt_id"
;
public
static
final
String
FILE_TYPE_ID
=
"file_type_id"
;
public
static
final
String
MD_ID
=
"md_id"
;
public
static
final
String
XT_VALUE
=
"xt_value"
;
public
static
final
String
XT_REM
=
"xt_rem"
;
public
static
final
String
XT_STATE
=
"xt_state"
;
public
static
final
String
INSERT_DATE
=
"insert_date"
;
public
static
final
String
STATE
=
"state"
;
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/greatchn/collection/framework/annotation/AuthIgnore.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* 忽略token验证
*
* @author duhang on 2019/8/22 17:50
*/
@Target
(
ElementType
.
METHOD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
AuthIgnore
{
}
src/main/java/com/greatchn/collection/framework/config/DateConvert.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
config
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.core.convert.converter.Converter
;
import
org.springframework.stereotype.Component
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* 日期转换
*/
@Component
public
class
DateConvert
implements
Converter
<
String
,
Date
>
{
private
static
final
List
<
String
>
S_FORMARTS
=
new
ArrayList
<>(
4
);
static
{
S_FORMARTS
.
add
(
"yyyy-MM"
);
S_FORMARTS
.
add
(
"yyyy-MM-dd"
);
S_FORMARTS
.
add
(
"yyyy-MM-dd HH:mm"
);
S_FORMARTS
.
add
(
"yyyy-MM-dd HH:mm:ss"
);
}
/** (non-Javadoc)
* @see Converter#convert(Object)
*/
@Override
public
Date
convert
(
String
source
)
{
if
(
StringUtils
.
isNotBlank
(
null
==
source
?
null
:
source
.
trim
()))
{
String
t_val
=
source
.
trim
();
if
(
source
.
matches
(
"^\\d{4}-\\d{1,2}$"
))
{
return
parseDate
(
t_val
,
S_FORMARTS
.
get
(
0
));
}
else
if
(
source
.
matches
(
"^\\d{4}-\\d{1,2}-\\d{1,2}$"
))
{
return
parseDate
(
t_val
,
S_FORMARTS
.
get
(
1
));
}
else
if
(
source
.
matches
(
"^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$"
))
{
return
parseDate
(
t_val
,
S_FORMARTS
.
get
(
2
));
}
else
if
(
source
.
matches
(
"^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$"
))
{
return
parseDate
(
t_val
,
S_FORMARTS
.
get
(
3
));
}
else
{
throw
new
IllegalArgumentException
(
"Invalid boolean value '"
+
source
+
"'"
);
}
}
return
null
;
}
private
Date
parseDate
(
String
dateStr
,
String
format
)
{
Date
date
=
null
;
try
{
DateFormat
dateFormat
=
new
SimpleDateFormat
(
format
);
date
=
dateFormat
.
parse
(
dateStr
);
}
catch
(
Exception
e
)
{
}
return
date
;
}
}
src/main/java/com/greatchn/collection/framework/config/WebMvcConfig.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
config
;
import
com.greatchn.collection.framework.interceptor.AuthInterceptor
;
import
com.greatchn.collection.framework.interceptor.LogInterceptor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.format.FormatterRegistry
;
import
org.springframework.web.cors.CorsConfiguration
;
import
org.springframework.web.cors.UrlBasedCorsConfigurationSource
;
import
org.springframework.web.filter.CorsFilter
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
;
/**
* @Title: WebMvcConfig
* @Description: mvc 配置类
* @author: duhang
* @date: 2020-09-25
*/
@Configuration
public
class
WebMvcConfig
extends
WebMvcConfigurationSupport
{
@Autowired
private
DateConvert
dateConvert
;
@Autowired
private
LogInterceptor
logInterceptor
;
@Autowired
private
AuthInterceptor
authInterceptor
;
/**
* 处理接收参数
*/
@Override
public
void
addFormatters
(
FormatterRegistry
registry
)
{
registry
.
addConverter
(
dateConvert
);
}
/**
* 跨域过滤器
*/
@Bean
public
CorsFilter
corsFilter
()
{
CorsConfiguration
corsConfiguration
=
new
CorsConfiguration
();
corsConfiguration
.
setAllowCredentials
(
Boolean
.
TRUE
);
corsConfiguration
.
addAllowedOriginPattern
(
"*"
);
corsConfiguration
.
addAllowedHeader
(
"*"
);
corsConfiguration
.
addAllowedMethod
(
"*"
);
// 设置跨域缓存实践为30分钟
corsConfiguration
.
setMaxAge
(
1800L
);
UrlBasedCorsConfigurationSource
source
=
new
UrlBasedCorsConfigurationSource
();
source
.
registerCorsConfiguration
(
"/**"
,
corsConfiguration
);
return
new
CorsFilter
(
source
);
}
/**
* 拦截器配置
*
* @param registry
*/
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
this
.
logInterceptor
)
.
addPathPatterns
(
"/**"
);
registry
.
addInterceptor
(
this
.
authInterceptor
)
.
addPathPatterns
(
"/**"
);
}
}
src/main/java/com/greatchn/collection/framework/constant/AuthConstant.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
constant
;
import
java.nio.charset.StandardCharsets
;
/**
* 权限相关常量
*
* @author wanghaohui
* @date 2022/06/21
*/
public
final
class
AuthConstant
{
private
AuthConstant
()
{
}
/**
* jwt 加密key
*/
public
static
final
byte
[]
JWT_ENCRYPT_KEY
=
"*Jd5UNGCgTW$rejU7CLhZlUg$d11qOKq1xiexdjnFJjmJdSO%h1In7Aw&Wha7*eUgf$X3D9bANAGxOR3v@1SnJxf*e4YirvMFb2"
.
getBytes
(
StandardCharsets
.
UTF_8
);
/**
* jwt 企业id key
*/
public
static
final
String
JWT_CUSTOMER_ID_KEY
=
"customerId"
;
/**
* jwt 企业员工id key
*/
public
static
final
String
JWT_EMPLOYEE_ID_KEY
=
"employeeId"
;
/**
* jwt 企业账套id key
*/
public
static
final
String
JWT_ACCOUNT_ID_KEY
=
"accountId"
;
/**
* jwt 内部员工id key
*/
public
static
final
String
JWT_OPERATOR_ID_KEY
=
"operatorId"
;
/**
* jwt 创建时间 key
*/
public
static
final
String
JWT_EXPIRE
=
"expire"
;
/**
* 请求头中token key (运维人员登录)
*/
public
static
final
String
HEADERS_OPERATOR_TOKEN_KEY
=
"operatorToken"
;
/**
* 请求头中token key (企业员工登录)
*/
public
static
final
String
HEADERS_EMPLOYEE_TOKEN_KEY
=
"employeeToken"
;
/**
* 请求头中token key (企业登录)
*/
public
static
final
String
HEADERS_CUSTOMER_TOKEN_KEY
=
"customerToken"
;
/**
* 请求头中token key (对外接口)
*/
public
static
final
String
HEADERS_OUTSIDE_TOKEN_KEY
=
"outSideToken"
;
}
src/main/java/com/greatchn/collection/framework/constant/LogConstant.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
constant
;
/**
* @description 日志常量定义
* @author duhang
* @date 2021/7/11
*/
public
final
class
LogConstant
{
private
LogConstant
()
{}
/**
* 调用记录id
*/
public
static
final
String
TRACE_ID
=
"traceId"
;
/**
* 服务名称
*/
public
static
final
String
SERVER_NAME
=
"appName"
;
/**
* 服务版本
*/
public
static
final
String
SERVER_VERSION
=
"appVersion"
;
/**
* 用户id
*/
public
static
final
String
USER_ID
=
"userId"
;
/**
* 请求方式 http:post/http:get等等等等
*/
public
static
final
String
REQ_TYPE
=
"reqType"
;
/**
* 请求api方法名
*/
public
static
final
String
METHOD_NAME
=
"methodName"
;
/**
* 请求头
*/
public
static
final
String
REQ_HEADER
=
"reqHeader"
;
/**
* 请求参数-明文
*/
public
static
final
String
REQ_PARAM
=
"reqParam"
;
/**
* 请求参数-密文
*/
public
static
final
String
REQ_PARAM_ENCODE
=
"reqParamEncode"
;
/**
* 请求地址
*/
public
static
final
String
REQ_URL
=
"reqUrl"
;
/**
* 响应数据-明文
*/
public
static
final
String
RESP_BODY
=
"respBody"
;
/**
* 响应数据-加密后
*/
public
static
final
String
RESP_BODY_ENCODE
=
"respBodyEncode"
;
/**
* 异常消息
*/
public
static
final
String
ERR_MESSAGE
=
"errMessage"
;
/**
* 异常堆栈
*/
public
static
final
String
STACK
=
"stack"
;
/**
* 请求方ip
*/
public
static
final
String
CLIENT_IP
=
"clientIp"
;
/**
* 请求方客户端信息
*/
public
static
final
String
CLIENT_INFO
=
"clientInfo"
;
/**
* 请求方浏览器信息
*/
public
static
final
String
BROWSER_INFO
=
"browserInfo"
;
/**
* 请求方浏览器信息
*/
public
static
final
String
TEMP_PATH
=
"/temp"
;
}
src/main/java/com/greatchn/collection/framework/constant/ManageConstant.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
org.apache.commons.lang3.StringUtils
;
import
java.time.format.DateTimeFormatter
;
public
class
ManageConstant
{
//全宗号(获取当前全宗)
public
static
final
String
M009
=
"M009"
;
//机构代码(获取当前全宗)
public
static
final
String
M078
=
"M078"
;
//电子文件号(根据规则生成)
public
static
final
String
M007
=
"M007"
;
//文档序号(按顺序生成,主件为001)
public
static
final
String
M019
=
"M019"
;
//来源(对接系统id)
public
static
final
String
M050
=
"M050"
;
//当前位置(文件存储位置)
public
static
final
String
M066
=
"M066"
;
//年度(M033所在年度)
public
static
final
String
M011
=
"M011"
;
//file_type_id
public
static
final
String
M014
=
"M014"
;
//月度:取M033的月
public
static
final
String
MZ01
=
"MZ01"
;
//立档单位名称
public
static
final
String
M006
=
"M006"
;
// 全宗名称
public
static
final
String
M005
=
"M005"
;
//题名
public
static
final
String
M022
=
"M022"
;
//页数
public
static
final
String
M043
=
"M043"
;
//审批:同意
public
static
final
String
AGREE
=
"agree"
;
//审批:拒绝
public
static
final
String
REFUSE
=
"refuse"
;
// 文件类型权限
// 菜单
public
static
final
String
MENU_ROLE_M
=
"M"
;
// 文件
public
static
final
String
MENU_ROLE_F
=
"F"
;
// 附件
public
static
final
String
MENU_ROLE_A
=
"A"
;
//sp_pz_rw_info任务类型GD
public
static
final
String
GD_TYPE
=
"GD"
;
//sp_pz_rw_info任务类型JY
public
static
final
String
JY_TYPE
=
"JY"
;
public
static
final
DateTimeFormatter
DATE_FORMAT
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
public
static
final
String
FILED_ARC_SQL
=
" arc.dh,"
+
" arc.gd_state,"
+
" arc.M005,"
+
" arc.M009,"
+
" arc.M078,"
+
" arc.M010,"
+
" arc.M011,"
+
" arc.M012,"
+
" arc.M014,"
+
" arc.M016,"
+
" arc.M022,"
+
" arc.M032,"
+
" arc.M038,"
+
" arc.M039,"
+
" arc.M042,"
+
" arc.M043,"
+
" arc.MZ01,"
+
" arc.state,"
+
" arc.formal_dh,"
+
" arc.qy_id,"
+
" arc.organization_id,"
+
" DATE_FORMAT(arc.gd_time,'%Y-%m-%d') AS gd_time,"
+
" arc.gd_user,"
+
" DATE_FORMAT(arc.lj_time,'%Y-%m-%d') AS lj_time,"
+
" arc.lj_user"
;
/**
* 收集状态
*/
@Getter
@AllArgsConstructor
public
enum
CommonStateEnum
{
COLIN
(
"01"
,
"收集中"
),
COLEND
(
"02"
,
"收集完成"
),
PREIN
(
"03"
,
"预组卷中"
),
PREEND
(
"04"
,
"预组卷完成"
),
COLAIL
(
"92"
,
"收集中存在错误"
),
PREFAIL
(
"93"
,
"预组卷失败"
);
private
String
code
;
private
String
define
;
public
static
String
getDefineByCode
(
String
code
)
{
if
(
StringUtils
.
isNotBlank
(
code
))
{
for
(
ManageConstant
.
CommonStateEnum
c
:
ManageConstant
.
CommonStateEnum
.
values
())
{
if
(
c
.
getCode
().
equals
(
code
))
{
return
c
.
getDefine
();
}
}
}
return
null
;
}
}
/**
* 流程审批类型
*/
@Getter
@AllArgsConstructor
public
enum
LcTypeEnum
{
ONESELF
(
"0"
,
"本人"
),
INDEPENDENT
(
"1"
,
"独立审批"
),
UNION
(
"2"
,
"联合审批"
),
ANY
(
"3"
,
"任一审批"
);
private
String
code
;
private
String
define
;
public
static
String
getDefineByCode
(
String
code
)
{
if
(
StringUtils
.
isNotBlank
(
code
))
{
for
(
ManageConstant
.
LcTypeEnum
c
:
ManageConstant
.
LcTypeEnum
.
values
())
{
if
(
c
.
getCode
().
equals
(
code
))
{
return
c
.
getDefine
();
}
}
}
return
null
;
}
}
/**
* 任务类型
*/
@Getter
@AllArgsConstructor
public
enum
RwTypeEnum
{
JY
(
"JY"
,
"借阅"
),
GD
(
"GD"
,
"归档"
);
private
String
code
;
private
String
define
;
public
static
String
getDefineByCode
(
String
code
)
{
if
(
StringUtils
.
isNotBlank
(
code
))
{
for
(
ManageConstant
.
RwTypeEnum
c
:
ManageConstant
.
RwTypeEnum
.
values
())
{
if
(
c
.
getCode
().
equals
(
code
))
{
return
c
.
getDefine
();
}
}
}
return
null
;
}
}
}
src/main/java/com/greatchn/collection/framework/constant/ReturnMsgEnum.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
constant
;
import
lombok.Getter
;
import
lombok.experimental.Accessors
;
/**
* 通用响应报文状态枚举
* <p>
* Created by duhang on 2019/8/23 9:05
*/
@Getter
@Accessors
(
fluent
=
true
)
public
enum
ReturnMsgEnum
{
OK
(
200
,
"请求成功"
),
FAIL
(
400
,
"请求失败"
),
NOT_FOUND
(
404
,
"请求的资源不存在"
),
ERROR
(
500
,
"服务器异常"
),
SESSION_TIMEOUT
(-
1
,
"未授权或授权信息超时"
),
IDEMPOTENT
(-
2
,
"请勿重复操作"
),
API_DISABLE
(-
3
,
"接口维护中"
),
SIGN_FAIL
(-
4
,
"验签失败"
);
private
Integer
code
;
private
String
msg
;
private
ReturnMsgEnum
()
{}
private
ReturnMsgEnum
(
Integer
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
static
String
getMsg
(
Integer
code
)
{
if
(
null
!=
code
)
{
for
(
ReturnMsgEnum
r
:
ReturnMsgEnum
.
values
())
{
if
(
r
.
code
().
equals
(
code
))
{
return
r
.
msg
();
}
}
}
return
null
;
}
}
src/main/java/com/greatchn/collection/framework/constant/SignatureStateEnum.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
constant
;
import
lombok.Getter
;
import
lombok.experimental.Accessors
;
@Getter
@Accessors
(
fluent
=
true
)
public
enum
SignatureStateEnum
{
VALID
(
"00"
,
"有效"
),
INVALID
(
"99"
,
"无效"
),
NO_NAME
(
"01"
,
"无签名"
);
private
String
code
;
private
String
define
;
private
SignatureStateEnum
()
{}
private
SignatureStateEnum
(
String
code
,
String
define
)
{
this
.
code
=
code
;
this
.
define
=
define
;
}
}
src/main/java/com/greatchn/collection/framework/exception/AssertException.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
exception
;
import
lombok.Getter
;
/**
* 断言异常
*
* @author duhang
* @date 2022/4/4
*/
@Getter
public
class
AssertException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
-
4518190765300115697L
;
private
Integer
code
;
private
Object
data
;
public
AssertException
()
{}
public
AssertException
(
String
message
)
{
super
(
message
);
}
public
AssertException
(
Throwable
cause
)
{
super
(
cause
);
}
public
AssertException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
AssertException
(
String
message
,
Throwable
cause
,
boolean
enableSuppression
,
boolean
writableStackTrace
)
{
super
(
message
,
cause
,
enableSuppression
,
writableStackTrace
);
}
public
AssertException
(
Integer
code
)
{
this
.
code
=
code
;
}
public
AssertException
(
Integer
code
,
String
message
)
{
super
(
message
);
this
.
code
=
code
;
}
public
AssertException
(
Integer
code
,
Throwable
cause
)
{
super
(
cause
);
this
.
code
=
code
;
}
public
AssertException
(
Integer
code
,
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
this
.
code
=
code
;
}
public
AssertException
(
Integer
code
,
String
message
,
Throwable
cause
,
boolean
enableSuppression
,
boolean
writableStackTrace
)
{
super
(
message
,
cause
,
enableSuppression
,
writableStackTrace
);
this
.
code
=
code
;
}
/**
* 构造程序业务错误信息
*/
public
AssertException
(
Integer
code
,
String
message
,
Object
data
)
{
super
(
message
);
this
.
code
=
code
;
this
.
data
=
data
;
}
}
src/main/java/com/greatchn/collection/framework/interceptor/AuthInterceptor.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
interceptor
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.jwt.JWT
;
import
cn.hutool.jwt.JWTUtil
;
import
com.greatchn.collection.constant.AuthConstant
;
import
com.greatchn.collection.framework.util.AuthUtil
;
import
com.greatchn.collection.framework.annotation.AuthIgnore
;
import
com.greatchn.collection.framework.util.DateUtil
;
import
com.greatchn.collection.framework.util.HttpUtil
;
import
com.greatchn.collection.framework.vo.ReturnMsgVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
org.springframework.web.servlet.ModelAndView
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* @Title AuthInterceptor
* @Description: 权限拦截器
* @author: wanghaohui
* @date: 2022/6/21 8:59
*/
@Slf4j
@Component
public
class
AuthInterceptor
implements
HandlerInterceptor
{
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
if
(
request
.
getMethod
().
equalsIgnoreCase
(
"options"
))
{
return
Boolean
.
TRUE
;
}
// 获取request头信息中的访问标识符以及token信息
String
requestUrl
=
request
.
getRequestURL
().
toString
();
String
token
=
null
;
if
(
requestUrl
.
contains
(
"/operator"
))
{
// 运维端
token
=
request
.
getHeader
(
AuthConstant
.
HEADERS_OPERATOR_TOKEN_KEY
);
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getHeader
(
AuthConstant
.
HEADERS_OPERATOR_TOKEN_KEY
.
toLowerCase
());
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getParameter
(
AuthConstant
.
HEADERS_OPERATOR_TOKEN_KEY
);
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getParameter
(
AuthConstant
.
HEADERS_OPERATOR_TOKEN_KEY
.
toLowerCase
());
}
else
if
(
requestUrl
.
contains
(
"/customer"
))
{
// 企业端
token
=
request
.
getHeader
(
AuthConstant
.
HEADERS_CUSTOMER_TOKEN_KEY
);
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getHeader
(
AuthConstant
.
HEADERS_CUSTOMER_TOKEN_KEY
.
toLowerCase
());
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getParameter
(
AuthConstant
.
HEADERS_CUSTOMER_TOKEN_KEY
);
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getParameter
(
AuthConstant
.
HEADERS_CUSTOMER_TOKEN_KEY
.
toLowerCase
());
}
else
if
(
requestUrl
.
contains
(
"/bill/save"
))
{
// 对外接口
token
=
request
.
getHeader
(
AuthConstant
.
HEADERS_OUTSIDE_TOKEN_KEY
);
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getHeader
(
AuthConstant
.
HEADERS_OUTSIDE_TOKEN_KEY
.
toLowerCase
());
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getParameter
(
AuthConstant
.
HEADERS_OUTSIDE_TOKEN_KEY
);
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getParameter
(
AuthConstant
.
HEADERS_OUTSIDE_TOKEN_KEY
.
toLowerCase
());
}
else
{
// 员工端
token
=
request
.
getHeader
(
AuthConstant
.
HEADERS_EMPLOYEE_TOKEN_KEY
);
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getHeader
(
AuthConstant
.
HEADERS_EMPLOYEE_TOKEN_KEY
.
toLowerCase
());
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getParameter
(
AuthConstant
.
HEADERS_EMPLOYEE_TOKEN_KEY
);
token
=
StringUtils
.
isNotBlank
(
token
)
?
token
:
request
.
getParameter
(
AuthConstant
.
HEADERS_EMPLOYEE_TOKEN_KEY
.
toLowerCase
());
}
// 有AuthIgnore注解的不验证
if
(
handler
instanceof
HandlerMethod
)
{
AuthIgnore
authIgnore
=
((
HandlerMethod
)
handler
).
getMethodAnnotation
(
AuthIgnore
.
class
);
if
(
null
!=
authIgnore
)
{
return
Boolean
.
TRUE
;
}
}
return
this
.
verify
(
token
,
response
,
handler
,
requestUrl
);
}
/**
* 校验权限
*/
public
boolean
verify
(
String
token
,
HttpServletResponse
response
,
Object
handler
,
String
requestUrl
)
throws
IOException
{
// token不能为空
if
(
StringUtils
.
isBlank
(
token
))
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
sessionTimeout
());
return
false
;
}
try
{
// 解析token
JWT
jwt
=
JWTUtil
.
parseToken
(
token
);
jwt
.
setKey
(
AuthConstant
.
JWT_ENCRYPT_KEY
);
JSONObject
payload
=
jwt
.
getPayloads
();
if
(
null
==
payload
||
MapUtils
.
isEmpty
(
payload
))
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
sessionTimeout
());
return
false
;
}
// 过期时间
Long
expire
=
payload
.
getLong
(
AuthConstant
.
JWT_EXPIRE
);
if
(
null
==
expire
||
expire
<
DateUtil
.
getCurrentBeijing
().
getTime
())
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
sessionTimeout
());
return
false
;
}
if
(
requestUrl
.
contains
(
"/operator"
))
{
// 运维端登录验权限
return
this
.
operatorVerify
(
response
,
payload
);
}
else
if
(
requestUrl
.
contains
(
"/customer"
))
{
// 企业端登录验权限
return
this
.
customerVerify
(
response
,
payload
);
}
else
if
(
requestUrl
.
contains
(
"/bill/save"
))
{
// 对外接口登录权限
return
this
.
outSideVerify
(
response
,
payload
);
}
else
{
// 员工端登录验权限
return
this
.
employeeVerify
(
response
,
payload
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"校验权限失败, token={}, "
,
token
,
e
);
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
sessionTimeout
());
return
false
;
}
}
/**
* 运维端校验权限
*/
public
boolean
operatorVerify
(
HttpServletResponse
response
,
JSONObject
payload
)
throws
IOException
{
// 运维端员工id
Long
operatorId
=
payload
.
getLong
(
AuthConstant
.
JWT_OPERATOR_ID_KEY
);
if
(
null
==
operatorId
||
operatorId
<
0
)
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
sessionTimeout
());
return
false
;
}
// 将运维端员工id存入当前线程变量
AuthUtil
.
setEmployeeId
(
operatorId
);
return
true
;
}
/**
* 企业端校验权限
*/
public
boolean
customerVerify
(
HttpServletResponse
response
,
JSONObject
payload
)
throws
IOException
{
// 企业id
Long
customerId
=
payload
.
getLong
(
AuthConstant
.
JWT_CUSTOMER_ID_KEY
);
if
(
null
==
customerId
||
customerId
<
0
)
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
sessionTimeout
());
return
false
;
}
// 将信息存入当前线程变量
AuthUtil
.
setCustomerId
(
customerId
);
return
true
;
}
/**
* 员工端校验权限
*/
public
boolean
employeeVerify
(
HttpServletResponse
response
,
JSONObject
payload
)
throws
IOException
{
// 企业id
Long
customerId
=
payload
.
getLong
(
AuthConstant
.
JWT_CUSTOMER_ID_KEY
);
if
(
null
==
customerId
||
customerId
<
0
)
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
sessionTimeout
());
return
false
;
}
// 员工id
Long
employeeId
=
payload
.
getLong
(
AuthConstant
.
JWT_EMPLOYEE_ID_KEY
);
if
(
null
==
employeeId
||
employeeId
<
0
)
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
sessionTimeout
());
return
false
;
}
// 账套id
String
accountId
=
payload
.
getStr
(
AuthConstant
.
JWT_ACCOUNT_ID_KEY
);
if
(
StringUtils
.
isBlank
(
accountId
))
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
sessionTimeout
());
return
false
;
}
// 将信息存入当前线程变量
AuthUtil
.
setCustomerId
(
customerId
);
AuthUtil
.
setEmployeeId
(
employeeId
);
AuthUtil
.
setAccountId
(
accountId
);
return
true
;
}
/**
* 对外接口登录权限
*/
public
boolean
outSideVerify
(
HttpServletResponse
response
,
JSONObject
payload
)
throws
IOException
{
// 企业id
Long
customerId
=
payload
.
getLong
(
AuthConstant
.
JWT_CUSTOMER_ID_KEY
);
if
(
null
==
customerId
||
customerId
<
0
)
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
sessionTimeout
());
return
false
;
}
// 将信息存入当前线程变量
AuthUtil
.
setCustomerId
(
customerId
);
return
true
;
}
@Override
public
void
postHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
ModelAndView
modelAndView
)
throws
Exception
{
HandlerInterceptor
.
super
.
postHandle
(
request
,
response
,
handler
,
modelAndView
);
}
}
src/main/java/com/greatchn/collection/framework/interceptor/GlobalExceptionHandler.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
interceptor
;
import
com.greatchn.collection.framework.constant.LogConstant
;
import
com.greatchn.collection.framework.constant.ReturnMsgEnum
;
import
com.greatchn.collection.framework.exception.AssertException
;
import
com.greatchn.collection.framework.vo.ReturnMsgVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.slf4j.MDC
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
import
org.springframework.web.servlet.NoHandlerFoundException
;
import
java.util.Optional
;
/**
* 全局异常处理
* Created by duhang on 2019/8/16 15:49
*/
@Slf4j
@ControllerAdvice
(
basePackages
=
{
"com.greatchn"
})
public
class
GlobalExceptionHandler
{
/**
* 404
* @param e
* @return
*/
@ResponseStatus
(
HttpStatus
.
OK
)
@ResponseBody
@ExceptionHandler
(
value
=
{
NoHandlerFoundException
.
class
})
public
ReturnMsgVO
noHandlerFoundException
(
NoHandlerFoundException
e
)
{
log
.
warn
(
"404"
,
e
);
return
ReturnMsgVO
.
newInstance
().
setCode
(
ReturnMsgEnum
.
NOT_FOUND
.
code
()).
setMsg
(
ReturnMsgEnum
.
NOT_FOUND
.
msg
());
}
/**
* 处理断言异常
* @param e
* @return
*/
@ResponseStatus
(
HttpStatus
.
OK
)
@ResponseBody
@ExceptionHandler
(
value
=
AssertException
.
class
)
public
ReturnMsgVO
assertException
(
AssertException
e
)
{
log
.
warn
(
"处理断言异常, "
,
e
);
return
ReturnMsgVO
.
fail
().
setMsg
(
e
.
getMessage
()).
setCode
(
Optional
.
ofNullable
(
e
.
getCode
()).
orElse
(
ReturnMsgEnum
.
FAIL
.
code
()));
}
/**
* 处理服务器异常
* @param e
* @return
*/
@ResponseStatus
(
HttpStatus
.
OK
)
@ResponseBody
@ExceptionHandler
(
value
=
{
Exception
.
class
})
public
ReturnMsgVO
unknownException
(
Exception
e
)
{
log
.
error
(
"处理服务器异常, "
,
e
);
return
ReturnMsgVO
.
error
().
setMsg
(
"票盒服务发生异常,异常编号: "
+
MDC
.
get
(
LogConstant
.
TRACE_ID
));
}
}
src/main/java/com/greatchn/collection/framework/interceptor/LogInterceptor.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
interceptor
;
import
com.greatchn.collection.framework.constant.LogConstant
;
import
com.greatchn.collection.framework.util.HttpUtil
;
//import com.greatchn.orm.util.IdGenerator;
import
eu.bitwalker.useragentutils.Browser
;
import
eu.bitwalker.useragentutils.OperatingSystem
;
import
eu.bitwalker.useragentutils.UserAgent
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.MDC
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
org.springframework.web.servlet.ModelAndView
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
/**
* todo
*
* @author duhang
* @date 2022/4/7
*/
@Component
public
class
LogInterceptor
implements
HandlerInterceptor
{
@Value
(
"${app.name}"
)
private
String
appName
;
@Value
(
"${app.version}"
)
private
String
appVersion
;
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
if
(
"options"
.
equalsIgnoreCase
(
request
.
getMethod
()))
{
return
Boolean
.
TRUE
;
}
Method
method
=
((
HandlerMethod
)
handler
).
getMethod
();
String
reqParam
=
HttpUtil
.
getRestMsg
(
request
);
reqParam
=
StringUtils
.
isNotBlank
(
reqParam
)
?
reqParam
:
HttpUtil
.
getBodyMsg
(
request
);
// MDC.put(LogConstant.TRACE_ID, IdGenerator.newID());
MDC
.
put
(
LogConstant
.
SERVER_NAME
,
this
.
appName
);
MDC
.
put
(
LogConstant
.
SERVER_VERSION
,
this
.
appVersion
);
MDC
.
put
(
LogConstant
.
REQ_TYPE
,
"http:"
+
request
.
getMethod
().
toLowerCase
());
MDC
.
put
(
LogConstant
.
METHOD_NAME
,
method
.
getDeclaringClass
().
getSimpleName
()
+
"."
+
method
.
getName
());
MDC
.
put
(
LogConstant
.
REQ_HEADER
,
HttpUtil
.
getReqHeader
(
request
));
MDC
.
put
(
LogConstant
.
REQ_URL
,
request
.
getRequestURL
().
toString
());
MDC
.
put
(
LogConstant
.
REQ_PARAM
,
reqParam
);
String
clientIp
=
HttpUtil
.
getIpAddress
(
request
);
MDC
.
put
(
LogConstant
.
CLIENT_IP
,
clientIp
);
// 解析浏览器信息
String
userAgentStr
=
request
.
getHeader
(
HttpHeaders
.
USER_AGENT
);
if
(
StringUtils
.
isNotBlank
(
userAgentStr
))
{
UserAgent
userAgent
=
UserAgent
.
parseUserAgentString
(
userAgentStr
);
Browser
browser
=
userAgent
.
getBrowser
();
if
(
null
!=
browser
)
{
MDC
.
put
(
LogConstant
.
BROWSER_INFO
,
browser
.
getName
()
+
";"
+
browser
.
getBrowserType
());
}
OperatingSystem
system
=
userAgent
.
getOperatingSystem
();
if
(
null
!=
system
)
{
MDC
.
put
(
LogConstant
.
CLIENT_INFO
,
system
.
getName
()
+
";"
+
system
.
getDeviceType
());
}
}
return
Boolean
.
TRUE
;
}
@Override
public
void
postHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
ModelAndView
modelAndView
)
throws
Exception
{
if
(!
"options"
.
equalsIgnoreCase
(
request
.
getMethod
()))
{
MDC
.
clear
();
}
}
}
src/main/java/com/greatchn/collection/framework/util/AposePdfUtil.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
util
;
import
com.aspose.pdf.*
;
import
com.aspose.pdf.devices.PngDevice
;
import
com.aspose.pdf.devices.Resolution
;
import
com.aspose.pdf.facades.EncodingType
;
import
com.aspose.pdf.facades.FontStyle
;
import
com.aspose.pdf.facades.FormattedText
;
import
com.aspose.pdf.facades.PdfFileSignature
;
import
com.greatchn.collection.framework.constant.SignatureStateEnum
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.util.DigestUtils
;
import
java.io.*
;
import
java.util.Date
;
public
class
AposePdfUtil
{
public
static
boolean
insertTextWatermark
(
String
pdfFilePath
,
String
watermarkText
){
boolean
result
=
true
;
Document
doc
=
new
Document
(
pdfFilePath
);
// Create a formatted text
FormattedText
formattedText
=
new
FormattedText
(
watermarkText
,
java
.
awt
.
Color
.
RED
,
FontStyle
.
Courier
,
EncodingType
.
Identity_h
,
true
,
40.0
F
);
// Create watermark artifact and set its properties
WatermarkArtifact
artifact
=
new
WatermarkArtifact
();
artifact
.
setText
(
formattedText
);
artifact
.
setArtifactHorizontalAlignment
(
HorizontalAlignment
.
Center
);
artifact
.
setArtifactVerticalAlignment
(
VerticalAlignment
.
Center
);
artifact
.
setRotation
(
25
);
artifact
.
setOpacity
(
0.5
);
artifact
.
setBackground
(
false
);
for
(
int
i
=
1
;
i
<=
doc
.
getPages
().
size
();
i
++)
{
Page
page
=
doc
.
getPages
().
get_Item
(
i
);
// Add watermark to the first page of PDF
page
.
getArtifacts
().
add
(
artifact
);
}
// Save watermarked PDF document
doc
.
save
(
"watermark.pdf"
);
return
result
;
}
public
static
boolean
insertImageWatermark
(
String
pdfFilePath
,
String
watermarkImagePath
){
boolean
result
=
true
;
com
.
aspose
.
pdf
.
Document
doc
=
new
com
.
aspose
.
pdf
.
Document
(
pdfFilePath
);
// Create a background artifact
BackgroundArtifact
background
=
new
BackgroundArtifact
();
try
{
// Specify the image for background artifact object
background
.
setBackgroundImage
(
new
FileInputStream
(
watermarkImagePath
));
background
.
setOpacity
(
0.5
);
background
.
setArtifactHorizontalAlignment
(
HorizontalAlignment
.
Center
);
background
.
setArtifactVerticalAlignment
(
VerticalAlignment
.
Center
);
for
(
int
i
=
1
;
i
<=
doc
.
getPages
().
size
();
i
++)
{
Page
page
=
doc
.
getPages
().
get_Item
(
i
);
// Add watermark to the first page of PDF
doc
.
getPages
().
get_Item
(
1
).
getArtifacts
().
add
(
background
);
}
// Save watermarked PDF document
doc
.
save
(
pdfFilePath
);
}
catch
(
Exception
ex
){
result
=
false
;
ex
.
printStackTrace
();
}
return
result
;
}
public
static
boolean
insertSeal
(
String
pdfFilePath
,
String
imagePath
){
boolean
result
=
true
;
try
{
com
.
aspose
.
pdf
.
Document
document
=
new
com
.
aspose
.
pdf
.
Document
(
pdfFilePath
);
com
.
itextpdf
.
text
.
Image
imgPhoto
=
com
.
itextpdf
.
text
.
Image
.
getInstance
(
imagePath
);
for
(
int
i
=
1
;
i
<=
document
.
getPages
().
size
();
i
++)
{
Page
page
=
document
.
getPages
().
get_Item
(
i
);
double
Width
=
document
.
getPageInfo
().
getWidth
()
/
4
;
double
Height
=
document
.
getPageInfo
().
getHeight
()
/
4
;
com
.
aspose
.
pdf
.
ImageStamp
imageStamp
=
new
com
.
aspose
.
pdf
.
ImageStamp
(
imagePath
);
imageStamp
.
setQuality
(
100
);
imageStamp
.
setBackground
(
false
);
imageStamp
.
setXIndent
(
Width
);
imageStamp
.
setYIndent
(
Height
);
imageStamp
.
setHeight
(
imgPhoto
.
getHeight
()
*
0.5
);
// imageStamp.setWidth(50 * imgPhoto.getWidth() / imgPhoto.getHeight());
imageStamp
.
setWidth
(
imgPhoto
.
getWidth
()
*
0.5
);
// imageStamp.setRotate(Rotation.on270);
imageStamp
.
setOpacity
(
0.7
);
page
.
addStamp
(
imageStamp
);
}
document
.
save
(
pdfFilePath
);
}
catch
(
Exception
e
){
result
=
false
;
}
return
result
;
}
public
static
String
insertSignature
(
String
pdfFilePath
,
String
certFilePath
,
String
password
,
String
attribute
,
String
imagePath
){
boolean
result
=
true
;
try
{
com
.
itextpdf
.
text
.
Image
imgPhoto
=
com
.
itextpdf
.
text
.
Image
.
getInstance
(
imagePath
);
String
certPdfPath
=
pdfFilePath
.
replace
(
".pdf"
,
"_cert.pdf"
);
Document
doc
=
new
Document
(
pdfFilePath
);
PdfFileSignature
signature
=
new
PdfFileSignature
(
doc
);
PKCS7
pkcs
=
new
PKCS7
(
certFilePath
,
password
);
// Use PKCS7/PKCS7Detached objects
pkcs
.
setDate
(
new
Date
());
DocMDPSignature
docMdpSignature
=
new
DocMDPSignature
(
pkcs
,
DocMDPAccessPermissions
.
FillingInForms
);
pkcs
.
setShowProperties
(
false
);
java
.
awt
.
Rectangle
rect
=
new
java
.
awt
.
Rectangle
((
int
)(
doc
.
getPageInfo
().
getWidth
()
-
100
),
50
,(
int
)(
50
*
imgPhoto
.
getWidth
()/
imgPhoto
.
getHeight
()),
50
);
// Set signature appearance
signature
.
setSignatureAppearance
(
imagePath
);
// Create any of the three signature types
// signature.certify(1, "Signature Reason", "Contact", "Location", true, rect, docMdpSignature);
signature
.
sign
(
1
,
""
,
DigestUtils
.
md5DigestAsHex
((
password
+
" "
+
attribute
).
getBytes
()),
""
,
false
,
rect
,
docMdpSignature
.
getSignature
());
// Save digitally signed PDF file
signature
.
save
(
certPdfPath
);
signature
.
dispose
();
doc
.
dispose
();
return
certPdfPath
;
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
return
pdfFilePath
;
}
public
static
String
analysisSignature
(
String
pdfFilePath
,
String
password
,
String
attribute
){
password
=
DigestUtils
.
md5DigestAsHex
((
password
+
" "
+
attribute
).
getBytes
());
String
result
=
SignatureStateEnum
.
NO_NAME
.
code
();;
// Create PDF File Signature
PdfFileSignature
pdfSign
=
new
PdfFileSignature
();
// Bind PDF
pdfSign
.
bindPdf
(
pdfFilePath
);
// Verify signature using signature name
if
(
pdfSign
.
isCertified
()){
result
=
SignatureStateEnum
.
INVALID
.
code
();
if
(
pdfSign
.
verifySigned
(
"Signature1"
)){
if
(
pdfSign
.
getAccessPermissions
()
==
DocMDPAccessPermissions
.
FillingInForms
)
{
// Get access permission
String
pass
=
pdfSign
.
getContactInfo
(
"Signature1"
);
if
(
password
.
equals
(
pass
))
{
result
=
SignatureStateEnum
.
VALID
.
code
();
}
}
}
}
return
result
;
}
public
static
void
pdfToPng
(
String
pdfFilePath
,
String
imageFilePath
,
Integer
page
)
throws
FileNotFoundException
,
IOException
{
// Open document
Document
pdfDocument
=
new
Document
(
pdfFilePath
);
File
file
=
new
File
(
imageFilePath
);
// Create stream object to save the output image
OutputStream
imageStream
=
new
FileOutputStream
(
imageFilePath
);
// Create Resolution object
Resolution
resolution
=
new
Resolution
(
300
);
// Create PngDevice object with particular resolution
PngDevice
pngDevice
=
new
PngDevice
(
resolution
);
// Convert a particular page and save the image to stream
pngDevice
.
process
(
pdfDocument
.
getPages
().
get_Item
(
page
),
imageStream
);
// Close the stream
imageStream
.
close
();
}
}
src/main/java/com/greatchn/collection/framework/util/AssertUtil.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
util
;
import
com.greatchn.collection.framework.exception.AssertException
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.lang.Nullable
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.Collection
;
import
java.util.Map
;
import
java.util.function.Supplier
;
/**
* 断言工具
*
* @author duhang
* @date 2022/4/4
*/
public
final
class
AssertUtil
{
public
static
void
state
(
boolean
expression
,
String
message
)
{
if
(!
expression
)
{
throw
new
AssertException
(
message
);
}
}
public
static
void
state
(
boolean
expression
,
String
message
,
Integer
code
)
{
if
(!
expression
)
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
state
(
boolean
expression
,
Supplier
<
String
>
messageSupplier
)
{
if
(!
expression
)
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
state
(
boolean
expression
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(!
expression
)
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
/**
* 判定 expression 结果 为 true, 否则 抛出AssertException异常, 异常消息为message
* @param expression
* @param message
*/
public
static
void
isTrue
(
boolean
expression
,
String
message
)
{
if
(!
expression
)
{
throw
new
AssertException
(
message
);
}
}
/**
* 判定 expression 结果 为 true, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param expression
* @param message
* @param code
*/
public
static
void
isTrue
(
boolean
expression
,
String
message
,
Integer
code
)
{
if
(!
expression
)
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
isTrue
(
boolean
expression
,
Supplier
<
String
>
messageSupplier
)
{
if
(!
expression
)
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
isTrue
(
boolean
expression
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(!
expression
)
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
/**
* 判定 expression 结果 为 false, 否则 抛出AssertException异常, 异常消息为message
* @param expression
* @param message
*/
public
static
void
isFalse
(
boolean
expression
,
String
message
)
{
if
(
expression
)
{
throw
new
AssertException
(
message
);
}
}
/**
* 判定 expression 结果 为 false, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param expression
* @param message
* @param code
*/
public
static
void
isFalse
(
boolean
expression
,
String
message
,
Integer
code
)
{
if
(
expression
)
{
throw
new
AssertException
(
code
,
message
);
}
}
/**
* 判定 object 为 null, 否则 抛出AssertException异常, 异常消息为message
* @param object
* @param message
*/
public
static
void
isNull
(
@Nullable
Object
object
,
String
message
)
{
if
(
object
!=
null
)
{
throw
new
AssertException
(
message
);
}
}
/**
* 判定 object 为 null, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param object
* @param message
* @param code
*/
public
static
void
isNull
(
@Nullable
Object
object
,
String
message
,
Integer
code
)
{
if
(
object
!=
null
)
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
isNull
(
@Nullable
Object
object
,
Supplier
<
String
>
messageSupplier
)
{
if
(
object
!=
null
)
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
isNull
(
@Nullable
Object
object
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(
object
!=
null
)
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
/**
* 判定 object 不为 null, 否则 抛出AssertException异常, 异常消息为message
* @param object
* @param message
*/
public
static
void
notNull
(
@Nullable
Object
object
,
String
message
)
{
if
(
object
==
null
)
{
throw
new
AssertException
(
message
);
}
}
/**
* 判定 object 不为 null, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param object
* @param message
* @param code
*/
public
static
void
notNull
(
@Nullable
Object
object
,
String
message
,
Integer
code
)
{
if
(
object
==
null
)
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
notNull
(
@Nullable
Object
object
,
Supplier
<
String
>
messageSupplier
)
{
if
(
object
==
null
)
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
notNull
(
@Nullable
Object
object
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(
object
==
null
)
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
hasLength
(
@Nullable
String
text
,
String
message
)
{
if
(!
StringUtils
.
hasLength
(
text
))
{
throw
new
AssertException
(
message
);
}
}
public
static
void
hasLength
(
@Nullable
String
text
,
String
message
,
Integer
code
)
{
if
(!
StringUtils
.
hasLength
(
text
))
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
hasLength
(
@Nullable
String
text
,
Supplier
<
String
>
messageSupplier
)
{
if
(!
StringUtils
.
hasLength
(
text
))
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
hasLength
(
@Nullable
String
text
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(!
StringUtils
.
hasLength
(
text
))
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
/**
* 判定 text 不为null 且 不为空串, 否则 抛出AssertException异常, 异常消息为message
* @param text
* @param message
*/
public
static
void
hasText
(
@Nullable
String
text
,
String
message
)
{
if
(!
StringUtils
.
hasText
(
text
))
{
throw
new
AssertException
(
message
);
}
}
/**
* 判定 text 不为null 且 不为空串, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param text
* @param message
* @param code
*/
public
static
void
hasText
(
@Nullable
String
text
,
String
message
,
Integer
code
)
{
if
(!
StringUtils
.
hasText
(
text
))
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
hasText
(
@Nullable
String
text
,
Supplier
<
String
>
messageSupplier
)
{
if
(!
StringUtils
.
hasText
(
text
))
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
hasText
(
@Nullable
String
text
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(!
StringUtils
.
hasText
(
text
))
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
doesNotContain
(
@Nullable
String
textToSearch
,
String
substring
,
String
message
)
{
if
(
StringUtils
.
hasLength
(
textToSearch
)
&&
StringUtils
.
hasLength
(
substring
)
&&
textToSearch
.
contains
(
substring
))
{
throw
new
AssertException
(
message
);
}
}
public
static
void
doesNotContain
(
@Nullable
String
textToSearch
,
String
substring
,
String
message
,
Integer
code
)
{
if
(
StringUtils
.
hasLength
(
textToSearch
)
&&
StringUtils
.
hasLength
(
substring
)
&&
textToSearch
.
contains
(
substring
))
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
doesNotContain
(
@Nullable
String
textToSearch
,
String
substring
,
Supplier
<
String
>
messageSupplier
)
{
if
(
StringUtils
.
hasLength
(
textToSearch
)
&&
StringUtils
.
hasLength
(
substring
)
&&
textToSearch
.
contains
(
substring
))
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
doesNotContain
(
@Nullable
String
textToSearch
,
String
substring
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(
StringUtils
.
hasLength
(
textToSearch
)
&&
StringUtils
.
hasLength
(
substring
)
&&
textToSearch
.
contains
(
substring
))
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
/**
* 判定 array 不为null 且 length > 0, 否则 抛出AssertException异常, 异常消息为message
* @param array
* @param message
*/
public
static
void
notEmpty
(
@Nullable
Object
[]
array
,
String
message
)
{
if
(
ObjectUtils
.
isEmpty
(
array
))
{
throw
new
AssertException
(
message
);
}
}
/**
* 判定 array 不为null 且 length > 0, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param array
* @param message
* @param code
*/
public
static
void
notEmpty
(
@Nullable
Object
[]
array
,
String
message
,
Integer
code
)
{
if
(
ObjectUtils
.
isEmpty
(
array
))
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
notEmpty
(
@Nullable
Object
[]
array
,
Supplier
<
String
>
messageSupplier
)
{
if
(
ObjectUtils
.
isEmpty
(
array
))
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
notEmpty
(
@Nullable
Object
[]
array
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(
ObjectUtils
.
isEmpty
(
array
))
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
/**
* 判定 array 不为null 且 每个元素都不为null, 否则 抛出AssertException异常, 异常消息为message
* @param array
* @param message
*/
public
static
void
noNullElements
(
@Nullable
Object
[]
array
,
String
message
)
{
if
(
array
!=
null
)
{
Object
[]
var2
=
array
;
int
var3
=
array
.
length
;
for
(
int
var4
=
0
;
var4
<
var3
;
++
var4
)
{
Object
element
=
var2
[
var4
];
if
(
element
==
null
)
{
throw
new
AssertException
(
message
);
}
if
(
element
instanceof
String
&&
!
StringUtils
.
hasText
(
String
.
valueOf
(
element
)))
{
throw
new
AssertException
(
message
);
}
}
}
}
/**
* 判定 array 不为null 且 每个元素都不为null, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param array
* @param message
* @param code
*/
public
static
void
noNullElements
(
@Nullable
Object
[]
array
,
String
message
,
Integer
code
)
{
if
(
array
!=
null
)
{
Object
[]
var2
=
array
;
int
var3
=
array
.
length
;
for
(
int
var4
=
0
;
var4
<
var3
;
++
var4
)
{
Object
element
=
var2
[
var4
];
if
(
element
==
null
)
{
throw
new
AssertException
(
code
,
message
);
}
if
(
element
instanceof
String
&&
!
StringUtils
.
hasText
(
String
.
valueOf
(
element
)))
{
throw
new
AssertException
(
code
,
message
);
}
}
}
}
public
static
void
noNullElements
(
@Nullable
Object
[]
array
,
Supplier
<
String
>
messageSupplier
)
{
if
(
array
!=
null
)
{
Object
[]
var2
=
array
;
int
var3
=
array
.
length
;
for
(
int
var4
=
0
;
var4
<
var3
;
++
var4
)
{
Object
element
=
var2
[
var4
];
if
(
element
==
null
)
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
if
(
element
instanceof
String
&&
!
StringUtils
.
hasText
(
String
.
valueOf
(
element
)))
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
}
}
public
static
void
noNullElements
(
@Nullable
Object
[]
array
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(
array
!=
null
)
{
Object
[]
var2
=
array
;
int
var3
=
array
.
length
;
for
(
int
var4
=
0
;
var4
<
var3
;
++
var4
)
{
Object
element
=
var2
[
var4
];
if
(
element
==
null
)
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
if
(
element
instanceof
String
&&
!
StringUtils
.
hasText
(
String
.
valueOf
(
element
)))
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
}
}
/**
* 判定 collection 为 空, 否则 抛出AssertException异常, 异常消息为message
* @param collection
* @param message
*/
public
static
void
isEmpty
(
@Nullable
Collection
<?>
collection
,
String
message
)
{
if
(
CollectionUtils
.
isNotEmpty
(
collection
))
{
throw
new
AssertException
(
message
);
}
}
/**
* 判定 collection 为 空, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param collection
* @param message
* @param code
*/
public
static
void
isEmpty
(
@Nullable
Collection
<?>
collection
,
String
message
,
Integer
code
)
{
if
(
CollectionUtils
.
isNotEmpty
(
collection
))
{
throw
new
AssertException
(
code
,
message
);
}
}
/**
* 判定 collection 不为 空, 否则 抛出AssertException异常, 异常消息为message
* @param collection
* @param message
*/
public
static
void
notEmpty
(
@Nullable
Collection
<?>
collection
,
String
message
)
{
if
(
CollectionUtils
.
isEmpty
(
collection
))
{
throw
new
AssertException
(
message
);
}
}
/**
* 判定 collection 不为 空, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param collection
* @param message
* @param code
*/
public
static
void
notEmpty
(
@Nullable
Collection
<?>
collection
,
String
message
,
Integer
code
)
{
if
(
CollectionUtils
.
isEmpty
(
collection
))
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
notEmpty
(
@Nullable
Collection
<?>
collection
,
Supplier
<
String
>
messageSupplier
)
{
if
(
CollectionUtils
.
isEmpty
(
collection
))
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
notEmpty
(
@Nullable
Collection
<?>
collection
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(
CollectionUtils
.
isEmpty
(
collection
))
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
/**
* 判定 map 不为 空, 否则 抛出AssertException异常, 异常消息为message
* @param map
* @param message
*/
public
static
void
notEmpty
(
@Nullable
Map
<?,
?>
map
,
String
message
)
{
if
(
null
==
map
||
map
.
isEmpty
())
{
throw
new
AssertException
(
message
);
}
}
/**
* 判定 map 不为 空, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param map
* @param message
* @param code
*/
public
static
void
notEmpty
(
@Nullable
Map
<?,
?>
map
,
String
message
,
Integer
code
)
{
if
(
null
==
map
||
map
.
isEmpty
())
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
notEmpty
(
@Nullable
Map
<?,
?>
map
,
Supplier
<
String
>
messageSupplier
)
{
if
(
null
==
map
||
map
.
isEmpty
())
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
notEmpty
(
@Nullable
Map
<?,
?>
map
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(
null
==
map
||
map
.
isEmpty
())
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
/**
* 判定 map 为 空, 否则 抛出AssertException异常, 异常消息为message
* @param map
* @param message
*/
public
static
void
isEmpty
(
@Nullable
Map
<?,
?>
map
,
String
message
)
{
if
(
null
!=
map
&&
!
map
.
isEmpty
())
{
throw
new
AssertException
(
message
);
}
}
/**
* 判定 map 不为 空, 否则 抛出AssertException异常, 异常消息为message, 异常代码为code
* @param map
* @param message
* @param code
*/
public
static
void
isEmpty
(
@Nullable
Map
<?,
?>
map
,
String
message
,
Integer
code
)
{
if
(
null
!=
map
&&
!
map
.
isEmpty
())
{
throw
new
AssertException
(
code
,
message
);
}
}
public
static
void
isEmpty
(
@Nullable
Map
<?,
?>
map
,
Supplier
<
String
>
messageSupplier
)
{
if
(
null
!=
map
&&
!
map
.
isEmpty
())
{
throw
new
AssertException
(
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
isEmpty
(
@Nullable
Map
<?,
?>
map
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
if
(
null
!=
map
&&
!
map
.
isEmpty
())
{
throw
new
AssertException
(
code
,
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
isInstanceOf
(
Class
<?>
type
,
@Nullable
Object
obj
,
String
message
)
{
notNull
(
type
,
(
String
)
"Type to check against must not be null"
);
if
(!
type
.
isInstance
(
obj
))
{
instanceCheckFailed
(
type
,
obj
,
message
);
}
}
public
static
void
isInstanceOf
(
Class
<?>
type
,
@Nullable
Object
obj
,
String
message
,
Integer
code
)
{
notNull
(
type
,
(
String
)
"Type to check against must not be null"
);
if
(!
type
.
isInstance
(
obj
))
{
instanceCheckFailed
(
type
,
obj
,
message
,
code
);
}
}
public
static
void
isInstanceOf
(
Class
<?>
type
,
@Nullable
Object
obj
,
Supplier
<
String
>
messageSupplier
)
{
notNull
(
type
,
(
String
)
"Type to check against must not be null"
);
if
(!
type
.
isInstance
(
obj
))
{
instanceCheckFailed
(
type
,
obj
,
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
isInstanceOf
(
Class
<?>
type
,
@Nullable
Object
obj
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
notNull
(
type
,
(
String
)
"Type to check against must not be null"
);
if
(!
type
.
isInstance
(
obj
))
{
instanceCheckFailed
(
type
,
obj
,
nullSafeGet
(
messageSupplier
),
code
);
}
}
public
static
void
isInstanceOf
(
Class
<?>
type
,
@Nullable
Object
obj
)
{
isInstanceOf
(
type
,
obj
,
""
);
}
public
static
void
isInstanceOf
(
Class
<?>
type
,
@Nullable
Object
obj
,
Integer
code
)
{
isInstanceOf
(
type
,
obj
,
""
,
code
);
}
public
static
void
isAssignable
(
Class
<?>
superType
,
@Nullable
Class
<?>
subType
,
String
message
)
{
notNull
(
superType
,
(
String
)
"Super type to check against must not be null"
);
if
(
subType
==
null
||
!
superType
.
isAssignableFrom
(
subType
))
{
assignableCheckFailed
(
superType
,
subType
,
message
);
}
}
public
static
void
isAssignable
(
Class
<?>
superType
,
@Nullable
Class
<?>
subType
,
String
message
,
Integer
code
)
{
notNull
(
superType
,
(
String
)
"Super type to check against must not be null"
);
if
(
subType
==
null
||
!
superType
.
isAssignableFrom
(
subType
))
{
assignableCheckFailed
(
superType
,
subType
,
message
,
code
);
}
}
public
static
void
isAssignable
(
Class
<?>
superType
,
@Nullable
Class
<?>
subType
,
Supplier
<
String
>
messageSupplier
)
{
notNull
(
superType
,
(
String
)
"Super type to check against must not be null"
);
if
(
subType
==
null
||
!
superType
.
isAssignableFrom
(
subType
))
{
assignableCheckFailed
(
superType
,
subType
,
nullSafeGet
(
messageSupplier
));
}
}
public
static
void
isAssignable
(
Class
<?>
superType
,
@Nullable
Class
<?>
subType
,
Supplier
<
String
>
messageSupplier
,
Integer
code
)
{
notNull
(
superType
,
(
String
)
"Super type to check against must not be null"
);
if
(
subType
==
null
||
!
superType
.
isAssignableFrom
(
subType
))
{
assignableCheckFailed
(
superType
,
subType
,
nullSafeGet
(
messageSupplier
),
code
);
}
}
public
static
void
isAssignable
(
Class
<?>
superType
,
Class
<?>
subType
)
{
isAssignable
(
superType
,
subType
,
""
);
}
public
static
void
isAssignable
(
Class
<?>
superType
,
Class
<?>
subType
,
Integer
code
)
{
isAssignable
(
superType
,
subType
,
""
,
code
);
}
private
static
void
instanceCheckFailed
(
Class
<?>
type
,
@Nullable
Object
obj
,
@Nullable
String
msg
)
{
String
className
=
obj
!=
null
?
obj
.
getClass
().
getName
()
:
"null"
;
String
result
=
""
;
boolean
defaultMessage
=
true
;
if
(
StringUtils
.
hasLength
(
msg
))
{
if
(
endsWithSeparator
(
msg
))
{
result
=
msg
+
" "
;
}
else
{
result
=
messageWithTypeName
(
msg
,
className
);
defaultMessage
=
false
;
}
}
if
(
defaultMessage
)
{
result
=
result
+
"Object of class ["
+
className
+
"] must be an instance of "
+
type
;
}
throw
new
AssertException
(
result
);
}
private
static
void
instanceCheckFailed
(
Class
<?>
type
,
@Nullable
Object
obj
,
@Nullable
String
msg
,
@Nullable
Integer
code
)
{
String
className
=
obj
!=
null
?
obj
.
getClass
().
getName
()
:
"null"
;
String
result
=
""
;
boolean
defaultMessage
=
true
;
if
(
StringUtils
.
hasLength
(
msg
))
{
if
(
endsWithSeparator
(
msg
))
{
result
=
msg
+
" "
;
}
else
{
result
=
messageWithTypeName
(
msg
,
className
);
defaultMessage
=
false
;
}
}
if
(
defaultMessage
)
{
result
=
result
+
"Object of class ["
+
className
+
"] must be an instance of "
+
type
;
}
throw
new
AssertException
(
code
,
result
);
}
private
static
void
assignableCheckFailed
(
Class
<?>
superType
,
@Nullable
Class
<?>
subType
,
@Nullable
String
msg
)
{
String
result
=
""
;
boolean
defaultMessage
=
true
;
if
(
StringUtils
.
hasLength
(
msg
))
{
if
(
endsWithSeparator
(
msg
))
{
result
=
msg
+
" "
;
}
else
{
result
=
messageWithTypeName
(
msg
,
subType
);
defaultMessage
=
false
;
}
}
if
(
defaultMessage
)
{
result
=
result
+
subType
+
" is not assignable to "
+
superType
;
}
throw
new
AssertException
(
result
);
}
private
static
void
assignableCheckFailed
(
Class
<?>
superType
,
@Nullable
Class
<?>
subType
,
@Nullable
String
msg
,
@Nullable
Integer
code
)
{
String
result
=
""
;
boolean
defaultMessage
=
true
;
if
(
StringUtils
.
hasLength
(
msg
))
{
if
(
endsWithSeparator
(
msg
))
{
result
=
msg
+
" "
;
}
else
{
result
=
messageWithTypeName
(
msg
,
subType
);
defaultMessage
=
false
;
}
}
if
(
defaultMessage
)
{
result
=
result
+
subType
+
" is not assignable to "
+
superType
;
}
throw
new
AssertException
(
code
,
result
);
}
private
static
boolean
endsWithSeparator
(
String
msg
)
{
return
msg
.
endsWith
(
":"
)
||
msg
.
endsWith
(
";"
)
||
msg
.
endsWith
(
","
)
||
msg
.
endsWith
(
"."
);
}
private
static
String
messageWithTypeName
(
String
msg
,
@Nullable
Object
typeName
)
{
return
msg
+
(
msg
.
endsWith
(
" "
)
?
""
:
": "
)
+
typeName
;
}
@Nullable
private
static
String
nullSafeGet
(
@Nullable
Supplier
<
String
>
messageSupplier
)
{
return
messageSupplier
!=
null
?
messageSupplier
.
get
()
:
null
;
}
}
src/main/java/com/greatchn/collection/framework/util/AuthUtil.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
util
;
import
org.apache.commons.lang3.StringUtils
;
/**
* @description 权限信息工具类
* @author duhang
* @date 2021/7/11
*/
public
final
class
AuthUtil
{
private
static
ThreadLocal
<
Long
>
S_EMPLOYEE_ID
=
new
ThreadLocal
<>();
private
static
ThreadLocal
<
Long
>
S_CUSTOMER_ID
=
new
ThreadLocal
<>();
private
static
ThreadLocal
<
String
>
S_ACCOUNT_ID
=
new
ThreadLocal
<>();
private
AuthUtil
()
{}
/**
* 当前线程存入员工id
* @param employeeId
*/
public
static
void
setEmployeeId
(
Long
employeeId
)
{
if
(
null
!=
employeeId
)
{
S_EMPLOYEE_ID
.
set
(
employeeId
);
}
}
/**
* 当前线程获取员工id
* @return
*/
public
static
Long
getEmployeeId
()
{
return
S_EMPLOYEE_ID
.
get
();
}
/**
* 当前线程存入企业id
* @param customerId
*/
public
static
void
setCustomerId
(
Long
customerId
)
{
if
(
null
!=
customerId
)
{
S_CUSTOMER_ID
.
set
(
customerId
);
}
}
/**
* 当前线程获取企业id
* @return
*/
public
static
Long
getCustomerId
()
{
return
S_CUSTOMER_ID
.
get
();
}
/**
* 当前线程存入账套id
* @param accountId
*/
public
static
void
setAccountId
(
String
accountId
)
{
if
(
StringUtils
.
isNotBlank
(
accountId
))
{
S_ACCOUNT_ID
.
set
(
accountId
);
}
}
/**
* 当前线程获取账套id
* @return
*/
public
static
String
getAccountId
()
{
return
S_ACCOUNT_ID
.
get
();
}
/**
* 清空当前线程
*/
public
static
void
clear
()
{
S_CUSTOMER_ID
.
remove
();
S_EMPLOYEE_ID
.
remove
();
S_ACCOUNT_ID
.
remove
();
}
}
src/main/java/com/greatchn/collection/framework/util/CommonUtil.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
util
;
import
java.io.*
;
import
org.apache.commons.codec.binary.Base64
;
public
class
CommonUtil
{
public
static
String
getPdfFilePath
(
String
filePath
)
{
String
fileType
=
filePath
.
substring
(
filePath
.
lastIndexOf
(
"."
)
+
1
,
filePath
.
length
());
return
filePath
.
replace
(
fileType
,
"pdf"
);
}
/**
* @Description: 文件转为base64字符串。filePath:文件路径
* @Param: [filePath]
* @return: java.lang.String
*/
public
static
String
fileToBase64
(
String
filePath
)
{
File
file
=
new
File
(
filePath
);
FileInputStream
inputFile
=
null
;
byte
[]
buffer
=
null
;
try
{
inputFile
=
new
FileInputStream
(
file
);
buffer
=
new
byte
[(
int
)
file
.
length
()];
inputFile
.
read
(
buffer
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
null
!=
inputFile
)
{
try
{
inputFile
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
byte
[]
bs
=
Base64
.
encodeBase64
(
buffer
);
return
new
String
(
bs
);
}
/**
* base64字符串转文件
* @param base64Str
* @param targetFilePath
* @return
*/
public
static
void
base64ToFile
(
String
base64Str
,
String
targetFilePath
)
{
byte
[]
buffer
=
Base64
.
decodeBase64
(
base64Str
);
FileOutputStream
out
=
null
;
try
{
out
=
new
FileOutputStream
(
targetFilePath
);
out
.
write
(
buffer
);
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
null
!=
out
)
{
try
{
out
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
src/main/java/com/greatchn/collection/framework/util/DateUtil.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
util
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Locale
;
/**
* @author duhang
* @description hutool DateUtil扩展
* @date 2021/10/19
*/
public
final
class
DateUtil
extends
cn
.
hutool
.
core
.
date
.
DateUtil
{
public
static
final
String
YYYY
=
"yyyy"
;
public
static
final
String
YYYYMMDDHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
final
String
YYYYMM
=
"yyyyMM"
;
public
static
final
String
YYYYMMDD
=
"yyyyMMdd"
;
public
static
final
String
YYYYMMDD_HH_MM_SS
=
"yyyyMMdd HH:mm:ss"
;
public
static
final
String
YYMMDDHHMMSS
=
"yyMMddHHmmss"
;
public
static
final
String
YYYY_MM_DD_HH_MM_SS
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
YYYY_MM_DD
=
"yyyy-MM-dd"
;
public
static
final
String
YYYY_MM_DD_STR
=
"yyyy年MM月dd日"
;
public
static
final
String
HH_MM_SS
=
"HH:mm:ss"
;
public
static
final
String
ZONE
=
"Asia/Shanghai"
;
public
static
ZoneId
ZONE_ID
=
ZoneId
.
of
(
ZONE
);
private
DateUtil
()
{}
/**
* 获取上海时间
* @return
*/
public
static
LocalDateTime
getCurrentShanghai
()
{
return
LocalDateTime
.
now
(
ZONE_ID
);
}
/**
* 获取北京时间
*
* @return
*/
public
static
Date
getCurrentBeijing
()
{
Calendar
calendar
=
Calendar
.
getInstance
(
Locale
.
CHINA
);
return
calendar
.
getTime
();
}
/**
* 校验日期是否满足一定格式
*
* @author: ZBoHang
* @time: 2021/10/22 15:44
*/
public
static
boolean
checkDateFormat
(
String
dateStr
,
String
formatStr
)
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
formatStr
);
try
{
dateFormat
.
parse
(
dateStr
);
}
catch
(
ParseException
e
)
{
return
Boolean
.
FALSE
;
}
return
Boolean
.
TRUE
;
}
/**
* 返回这个日期前一个月的日期
*
* @param dateStr 日期字符串
* @param sourceFormat 原日期格式
* @param targetFormat 目标日期格式
* @return: java.util.Date
* @author: ZBoHang
* @time: 2021/11/15 15:26
*/
public
static
String
getOneMonthBefore
(
String
dateStr
,
String
sourceFormat
,
String
targetFormat
)
{
// 一个月(30天)的毫秒数
long
oneDayMs
=
1000
*
60
*
60
*
24
*
30L
;
long
sourceTimes
=
DateUtil
.
parse
(
dateStr
,
sourceFormat
).
getTime
();
Date
date
=
new
Date
(
sourceTimes
-
oneDayMs
);
return
DateUtil
.
format
(
date
,
targetFormat
);
}
/**
* 获取当前时间
*
*/
public
static
String
getNow
()
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
YYYY_MM_DD_STR
);
String
str
=
formatter
.
format
(
new
Date
());
return
str
;
}
/**
* 将Date类型时间转换是指定日期格式
* @param date
* @param format
*/
public
static
String
formatDate
(
Date
date
,
String
format
){
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
format
);
String
str
=
formatter
.
format
(
date
);
return
str
;
}
/**
* 将String类型时间转换格式Date类型时间
* @param dateStr
* @param format
*/
public
static
Date
StrToDate
(
String
dateStr
,
String
format
)
throws
Exception
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
format
);
Date
date
=
new
Date
();
try
{
date
=
formatter
.
parse
(
dateStr
);
}
catch
(
ParseException
e
)
{
throw
new
Exception
(
"时间字符串转换Date类型报错"
);
}
return
date
;
}
}
src/main/java/com/greatchn/collection/framework/util/HttpUtil.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
util
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.greatchn.collection.framework.vo.ReturnMsgVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.util.StreamUtils
;
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
java.io.*
;
import
java.net.HttpURLConnection
;
import
java.net.InetAddress
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* http工具类
* <p>
* Created by duhang on 2019/8/16 17:32
*/
@Slf4j
public
final
class
HttpUtil
{
/**
* 连接时间
*/
private
final
static
int
CONNECT_TIME
=
5
*
60
*
1000
;
/**
* 超时时间
*/
private
final
static
int
OUT_TIME
=
15
*
60
*
1000
;
private
HttpUtil
()
{
}
/**
* 取得request
*
* @return
*/
public
static
HttpServletRequest
getHttpServletRequest
()
{
return
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
}
/**
* 取得response
*
* @return
*/
public
static
HttpServletResponse
getHttpServletResponse
()
{
HttpServletResponse
response
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getResponse
();
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setContentType
(
"application/json; charset=utf-8"
);
response
.
setHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Methods"
,
"*"
);
response
.
setHeader
(
"Access-Control-Max-Age"
,
"0"
);
response
.
setHeader
(
"Access-Control-Allow-Headers"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
response
.
setHeader
(
"XDomainRequestAllowed"
,
"1"
);
return
response
;
}
/**
* 跨域响应
*
* @param response
* @param respObj
* @throws IOException
*/
public
static
void
outputResponseMsg
(
HttpServletResponse
response
,
ReturnMsgVO
respObj
)
throws
IOException
{
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setContentType
(
"application/json; charset=utf-8"
);
response
.
setHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Methods"
,
"*"
);
response
.
setHeader
(
"Access-Control-Max-Age"
,
"0"
);
response
.
setHeader
(
"Access-Control-Allow-Headers"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
response
.
setHeader
(
"XDomainRequestAllowed"
,
"1"
);
try
(
PrintWriter
out
=
response
.
getWriter
())
{
ObjectMapper
objectMapper
=
SpringContextHolder
.
getBean
(
ObjectMapper
.
class
);
out
.
print
(
objectMapper
.
writeValueAsString
(
respObj
));
out
.
flush
();
}
catch
(
IOException
e
)
{
throw
e
;
}
}
/**
* 获取请求头信息
*
* @param request
* @return
*/
public
static
String
getReqHeader
(
HttpServletRequest
request
)
{
List
<
String
>
headerList
=
new
ArrayList
<>();
for
(
Enumeration
<
String
>
enu
=
request
.
getHeaderNames
();
enu
.
hasMoreElements
();
)
{
String
name
=
enu
.
nextElement
();
headerList
.
add
(
name
+
" : "
+
request
.
getHeader
(
name
));
}
String
headers
=
String
.
join
(
"; "
,
headerList
);
return
headers
;
}
/**
* 获取rest参数
*
* @param request
* @return
*/
public
static
String
getRestMsg
(
HttpServletRequest
request
)
{
Map
<
String
,
Object
>
requestParam
=
new
HashMap
<>();
Enumeration
<
String
>
names
=
request
.
getParameterNames
();
while
(
names
.
hasMoreElements
())
{
String
paramName
=
names
.
nextElement
();
String
paramValue
=
request
.
getParameter
(
paramName
);
requestParam
.
put
(
paramName
,
paramValue
);
}
if
(!
requestParam
.
isEmpty
())
{
ObjectMapper
objectMapper
=
SpringContextHolder
.
getBean
(
ObjectMapper
.
class
);
try
{
return
objectMapper
.
writeValueAsString
(
requestParam
);
}
catch
(
JsonProcessingException
e
)
{
log
.
error
(
"json转换异常, "
,
e
);
}
}
return
null
;
}
/**
* 获取reqeustbody参数
*
* @param request
* @return
*/
public
static
String
getBodyMsg
(
HttpServletRequest
request
)
throws
IOException
{
return
StreamUtils
.
copyToString
(
request
.
getInputStream
(),
StandardCharsets
.
UTF_8
);
}
/**
* 获取客户端ip
*
* @param request
* @return
*/
public
static
String
getIpAddress
(
HttpServletRequest
request
)
{
String
ip
=
request
.
getHeader
(
"x-forwarded-for"
);
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getHeader
(
"Proxy-Client-IP"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getRemoteAddr
();
if
(
"127.0.0.1"
.
equals
(
ip
)
||
"localhost"
.
equals
(
ip
))
{
//根据网卡取本机配置的IP
InetAddress
inet
=
null
;
try
{
inet
=
InetAddress
.
getLocalHost
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
ip
=
inet
.
getHostAddress
();
}
}
// 多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
if
(
ip
!=
null
&&
ip
.
length
()
>
15
)
{
if
(
ip
.
indexOf
(
","
)
>
0
)
{
ip
=
ip
.
substring
(
0
,
ip
.
indexOf
(
","
));
}
}
return
ip
;
}
/**
* 预览pdf
*
* @param request
* @param response
* @param source
*/
public
static
void
viewPDF
(
HttpServletRequest
request
,
HttpServletResponse
response
,
File
source
)
{
String
browser
=
request
.
getHeader
(
HttpHeaders
.
USER_AGENT
);
Pattern
p
=
Pattern
.
compile
(
".*(MSIE|Edge|Trident).*?"
);
Matcher
m
=
p
.
matcher
(
browser
);
BufferedOutputStream
out
=
null
;
try
{
String
fileName
=
source
.
getName
();
byte
[]
bytes
=
FileUtils
.
readFileToByteArray
(
source
);
response
.
reset
();
String
userAgent
=
request
.
getHeader
(
"user-agent"
).
toLowerCase
();
if
(
m
.
matches
()
||
userAgent
.
contains
(
"like gecko"
))
{
response
.
setHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"inline;fileName="
+
URLEncoder
.
encode
(
fileName
,
StandardCharsets
.
UTF_8
.
name
()).
replace
(
"+"
,
""
));
}
else
{
response
.
setHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"inline;fileName="
+
new
String
(
fileName
.
getBytes
(
StandardCharsets
.
UTF_8
),
StandardCharsets
.
ISO_8859_1
).
replace
(
" "
,
""
));
}
response
.
setHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Methods"
,
"*"
);
response
.
setHeader
(
"Access-Control-Max-Age"
,
"0"
);
response
.
setHeader
(
"Access-Control-Allow-Headers"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
response
.
setHeader
(
"XDomainRequestAllowed"
,
"1"
);
response
.
setContentType
(
"application/pdf"
);
out
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
out
.
write
(
bytes
);
out
.
flush
();
}
catch
(
Exception
e
)
{
log
.
error
(
">>>>>>>>>>>>>>>>>>>>>>> 预览 PDF文件 出错, "
,
e
);
try
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
error
().
setMsg
(
e
.
getMessage
()));
}
catch
(
IOException
ioException
)
{
log
.
error
(
" error >>>>>>>>>>"
,
ioException
);
}
}
finally
{
if
(
null
!=
out
)
{
try
{
out
.
close
();
}
catch
(
IOException
ignored
)
{
}
}
}
}
/**
* 下载文件
*
* @param request
* @param response
* @param source
*/
public
static
void
download
(
HttpServletRequest
request
,
HttpServletResponse
response
,
File
source
)
{
String
browser
=
request
.
getHeader
(
HttpHeaders
.
USER_AGENT
);
Pattern
p
=
Pattern
.
compile
(
".*(MSIE|Edge|Trident).*?"
);
Matcher
m
=
p
.
matcher
(
browser
);
BufferedOutputStream
out
=
null
;
try
{
String
fileName
=
source
.
getName
();
byte
[]
bytes
=
FileUtils
.
readFileToByteArray
(
source
);
response
.
reset
();
String
userAgent
=
request
.
getHeader
(
"user-agent"
).
toLowerCase
();
if
(
m
.
matches
()
||
userAgent
.
contains
(
"like gecko"
))
{
response
.
setHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment;fileName="
+
URLEncoder
.
encode
(
fileName
,
StandardCharsets
.
UTF_8
.
name
()).
replace
(
"+"
,
""
));
}
else
{
response
.
setHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment;fileName="
+
new
String
(
fileName
.
getBytes
(
StandardCharsets
.
UTF_8
),
StandardCharsets
.
ISO_8859_1
).
replace
(
" "
,
""
));
}
// 设置文件名
response
.
setHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Methods"
,
"*"
);
response
.
setHeader
(
"Access-Control-Max-Age"
,
"0"
);
response
.
setHeader
(
"Access-Control-Allow-Headers"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
response
.
setHeader
(
"XDomainRequestAllowed"
,
"1"
);
response
.
setContentType
(
"application/x-download"
);
out
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
out
.
write
(
bytes
);
out
.
flush
();
}
catch
(
Exception
e
)
{
log
.
error
(
">>>>>>>>>>>>>>>>>>>>>>> 下载 文件 出错, "
,
e
);
try
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
error
().
setMsg
(
e
.
getMessage
()));
}
catch
(
IOException
ioException
)
{
log
.
error
(
" error >>>>>>>>>>"
,
ioException
);
}
}
finally
{
if
(
null
!=
out
)
{
try
{
out
.
close
();
}
catch
(
IOException
ignored
)
{
}
}
}
}
/**
* 下载文件
*
* @param request
* @param response
* @param bytes
* @param fileName
*/
public
static
void
download
(
HttpServletRequest
request
,
HttpServletResponse
response
,
byte
[]
bytes
,
String
fileName
)
{
String
browser
=
request
.
getHeader
(
HttpHeaders
.
USER_AGENT
);
Pattern
p
=
Pattern
.
compile
(
".*(MSIE|Edge|Trident).*?"
);
Matcher
m
=
p
.
matcher
(
browser
);
BufferedOutputStream
out
=
null
;
try
{
response
.
reset
();
String
userAgent
=
request
.
getHeader
(
"user-agent"
).
toLowerCase
();
if
(
m
.
matches
()
||
userAgent
.
contains
(
"like gecko"
))
{
response
.
setHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment;fileName="
+
URLEncoder
.
encode
(
fileName
,
StandardCharsets
.
UTF_8
.
name
()).
replace
(
"+"
,
""
));
}
else
{
response
.
setHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment;fileName="
+
new
String
(
fileName
.
getBytes
(
StandardCharsets
.
UTF_8
),
StandardCharsets
.
ISO_8859_1
).
replace
(
" "
,
""
));
}
// 设置文件名
response
.
setHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Methods"
,
"*"
);
response
.
setHeader
(
"Access-Control-Max-Age"
,
"0"
);
response
.
setHeader
(
"Access-Control-Allow-Headers"
,
"*"
);
response
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
response
.
setHeader
(
"XDomainRequestAllowed"
,
"1"
);
response
.
setContentType
(
"application/x-download"
);
out
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
out
.
write
(
bytes
);
out
.
flush
();
}
catch
(
Exception
e
)
{
log
.
error
(
">>>>>>>>>>>>>>>>>>>>>>> 下载 文件 出错, "
,
e
);
try
{
HttpUtil
.
outputResponseMsg
(
response
,
ReturnMsgVO
.
error
().
setMsg
(
e
.
getMessage
()));
}
catch
(
IOException
ioException
)
{
log
.
error
(
" error >>>>>>>>>>"
,
ioException
);
}
}
finally
{
if
(
null
!=
out
)
{
try
{
out
.
close
();
}
catch
(
IOException
ignored
)
{
}
}
}
}
/**
* 请求url携带json数据
*
* @param urlStr
* @param contents
* @return
* @throws Exception
* @author Fli 2017-4-24
*/
public
static
String
openHttpByPost
(
String
urlStr
,
String
contents
)
throws
Exception
{
URL
url
=
new
URL
(
urlStr
);
HttpURLConnection
con
=
(
HttpURLConnection
)
url
.
openConnection
();
con
.
setDoOutput
(
true
);
con
.
setReadTimeout
(
OUT_TIME
);
con
.
setConnectTimeout
(
CONNECT_TIME
);
con
.
setRequestMethod
(
"POST"
);
// con.setRequestProperty("Pragma:", "no-cache");
con
.
setRequestProperty
(
"Cache-Control"
,
"no-cache"
);
con
.
setRequestProperty
(
"Content-Type"
,
"application/json"
);
con
.
setDoInput
(
true
);
DataOutputStream
out
=
new
DataOutputStream
(
con
.
getOutputStream
());
out
.
write
(
contents
.
getBytes
());
out
.
flush
();
int
state
=
con
.
getResponseCode
();
if
(
state
!=
200
)
{
return
null
;
}
con
.
connect
();
String
line
=
IOUtils
.
toString
(
con
.
getInputStream
(),
"utf-8"
);
return
line
;
}
}
src/main/java/com/greatchn/collection/framework/util/SpringContextHolder.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
util
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
/**
* Created by duhang on 2019/8/28 10:46
*/
@Component
public
class
SpringContextHolder
implements
ApplicationContextAware
{
/**
* 上下文对象实例
*/
private
static
ApplicationContext
applicationContext
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
SpringContextHolder
.
applicationContext
=
applicationContext
;
}
/**
* 获取applicationContext
*
* @return
*/
public
static
ApplicationContext
getApplicationContext
()
{
return
applicationContext
;
}
/**
* 通过name获取 Bean.
*
* @param name
* @return
*/
public
static
Object
getBean
(
String
name
)
{
return
getApplicationContext
().
getBean
(
name
);
}
/**
* 通过class获取Bean.
*
* @param clazz
* @param <T>
* @return
*/
public
static
<
T
>
T
getBean
(
Class
<
T
>
clazz
)
{
return
getApplicationContext
().
getBean
(
clazz
);
}
/**
* 通过name,以及Clazz返回指定的Bean
*
* @param name
* @param clazz
* @param <T>
* @return
*/
public
static
<
T
>
T
getBean
(
String
name
,
Class
<
T
>
clazz
)
{
return
getApplicationContext
().
getBean
(
name
,
clazz
);
}
}
src/main/java/com/greatchn/collection/framework/vo/ReturnMsgVO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
framework
.
vo
;
import
com.fasterxml.jackson.annotation.JsonAutoDetect
;
import
com.greatchn.collection.framework.constant.LogConstant
;
import
com.greatchn.collection.framework.constant.ReturnMsgEnum
;
//import com.greatchn.orm.util.IdGenerator;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.MDC
;
import
java.io.Serializable
;
/**
* 响应报文vo
* <p>
* Created by duhang on 2019/8/16 15:51
*/
@Data
@Accessors
(
chain
=
true
)
@JsonAutoDetect
(
fieldVisibility
=
JsonAutoDetect
.
Visibility
.
ANY
,
getterVisibility
=
JsonAutoDetect
.
Visibility
.
NONE
)
public
class
ReturnMsgVO
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
6809182479486896964L
;
/**
* 响应代码
*/
private
Integer
code
;
/**
* 响应消息
*/
private
String
msg
;
/**
* 响应数据
*/
private
T
data
;
// private String traceId = StringUtils.isNotBlank(MDC.get(LogConstant.TRACE_ID)) ? MDC.get(LogConstant.TRACE_ID) : IdGenerator.newID();
private
ReturnMsgVO
()
{}
public
static
ReturnMsgVO
newInstance
()
{
return
new
ReturnMsgVO
();
}
public
static
ReturnMsgVO
ok
()
{
return
ReturnMsgVO
.
newInstance
().
setCode
(
ReturnMsgEnum
.
OK
.
code
()).
setMsg
(
ReturnMsgEnum
.
OK
.
msg
());
}
public
static
ReturnMsgVO
fail
()
{
return
ReturnMsgVO
.
newInstance
().
setCode
(
ReturnMsgEnum
.
FAIL
.
code
()).
setMsg
(
ReturnMsgEnum
.
FAIL
.
msg
());
}
public
static
ReturnMsgVO
error
()
{
return
ReturnMsgVO
.
newInstance
().
setCode
(
ReturnMsgEnum
.
ERROR
.
code
()).
setMsg
(
ReturnMsgEnum
.
ERROR
.
msg
());
}
public
static
ReturnMsgVO
sessionTimeout
()
{
return
ReturnMsgVO
.
newInstance
().
setCode
(
ReturnMsgEnum
.
SESSION_TIMEOUT
.
code
()).
setMsg
(
ReturnMsgEnum
.
SESSION_TIMEOUT
.
msg
());
}
public
static
ReturnMsgVO
idempotentRequired
()
{
return
ReturnMsgVO
.
newInstance
().
setCode
(
ReturnMsgEnum
.
IDEMPOTENT
.
code
()).
setMsg
(
ReturnMsgEnum
.
IDEMPOTENT
.
msg
());
}
}
src/main/java/com/greatchn/collection/job/CollectJob.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
job
;
import
com.greatchn.collection.service.CollectService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.Scheduled
;
@Slf4j
@Configuration
public
class
CollectJob
{
@Autowired
CollectService
collectService
;
/**
* 对账消息推送定时器
* 每一小时运行一次
*/
@Scheduled
(
cron
=
"0 0/1 * * * ? "
)
public
void
send
()
throws
Exception
{
log
.
info
(
"收集文件开始"
);
collectService
.
startCollectJob
();
log
.
info
(
"收集文件结束"
);
}
}
src/main/java/com/greatchn/collection/service/CollectService.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
service
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.greatchn.collection.framework.constant.ManageConstant
;
import
com.greatchn.collection.framework.exception.AssertException
;
import
com.greatchn.collection.framework.util.AposePdfUtil
;
import
com.greatchn.collection.framework.util.CommonUtil
;
import
com.greatchn.collection.framework.util.HttpUtil
;
import
com.greatchn.collection.entity.*
;
import
com.greatchn.collection.framework.util.AssertUtil
;
import
com.greatchn.collection.entity.*
;
import
com.greatchn.collection.vo.CcFileInfoVO
;
import
com.lowagie.text.pdf.PdfReader
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Base64Utils
;
import
java.io.*
;
import
java.math.BigDecimal
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
public
class
CollectService
{
// 设置图片上传路径
@Value
(
"${file.basepath}"
)
private
String
basePath
;
@Autowired
private
SjLogMapper
sjLogMapper
;
@Autowired
private
SjFileAttRelMapper
sjFileAttRelMapper
;
@Autowired
private
SjFileSaveParamMapper
sjFileSaveParamMapper
;
@Autowired
private
SjMdXtMapper
sjMdXtMapper
;
@Autowired
private
SjLogSub1Mapper
sjLogSub1Mapper
;
@Autowired
private
SjLogSub1InfoMapper
sjLogSub1InfoMapper
;
@Autowired
private
SjLogSub2Mapper
sjLogSub2Mapper
;
@Autowired
private
SjLogSub2InfoMapper
sjLogSub2InfoMapper
;
@Autowired
private
GxFileAttMapper
gxFileAttMapper
;
@Autowired
private
CcFileInfoMapper
ccFileInfoMapper
;
@Autowired
private
ErmsQiyeMapper
ermsQiyeMapper
;
@Autowired
private
ErmsOrganizationMapper
ermsOrganizationMapper
;
@Autowired
private
ErmsFileTypeMapper
ermsFileTypeMapper
;
@Autowired
private
CcFileSaveInfoMapper
ccFileSaveInfoMapper
;
@Autowired
private
SjLogErrorMapper
sjLogErrorMapper
;
@Autowired
ErmsQzCertMapper
ermsQzCertMapper
;
@Autowired
FileService
fileService
;
@Autowired
PzFileSjMapper
pzFileSjMapper
;
public
static
final
DateTimeFormatter
DATEFORMAT
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
);
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
collect
(
String
xtId
,
Integer
organizationId
,
Integer
fileTypeId
,
String
userId
)
throws
Exception
{
LocalDate
dd
=
LocalDate
.
now
();
String
startNumber
=
dd
.
format
(
DATEFORMAT
);
Integer
tt
=
sjLogMapper
.
getNumber
(
startNumber
);
String
sjLogVarId
=
xtId
+
startNumber
+
StringUtils
.
leftPad
(
tt
.
toString
(),
4
,
"0"
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
set
(
"xtId"
,
xtId
);
jsonObject
.
set
(
"fileTypeId"
,
fileTypeId
+
""
);
Map
mm
=
new
HashMap
();
mm
.
put
(
"ztdm"
,
"40281f8186a187500186c566f1b20023"
);
mm
.
put
(
"flag"
,
"month"
);
mm
.
put
(
"month"
,
"202303"
);
jsonObject
.
set
(
"param"
,
mm
);
List
<
Map
<
String
,
String
>>
demoList
=
this
.
getUrlFile
(
jsonObject
);
int
wjCount
=
demoList
.
size
();
SjLogPO
sjLogPO
=
new
SjLogPO
();
sjLogPO
.
setSjLogId
(
sjLogVarId
);
sjLogPO
.
setState
(
"Y"
);
sjLogPO
.
setSjCont
(
wjCount
);
sjLogPO
.
setInsertUser
(
userId
);
sjLogPO
.
setInsertDate
(
LocalDateTime
.
now
());
sjLogPO
.
setManualFileType
(
fileTypeId
);
sjLogPO
.
setManualId
(
1
);
sjLogPO
.
setXtId
(
xtId
);
sjLogPO
.
setOrganizationId
(
organizationId
);
sjLogPO
.
setSjSuss
(
0
);
sjLogPO
.
setSjState
(
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
());
sjLogMapper
.
insert
(
sjLogPO
);
List
<
SjLogSub1InfoPO
>
sjLogInfoPOList
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<=
wjCount
;
i
++)
{
Map
<
String
,
String
>
demo
=
demoList
.
get
(
i
);
SjLogSub1PO
sjLogSub1PO
=
new
SjLogSub1PO
();
sjLogSub1PO
.
setSjLogId
(
sjLogPO
.
getId
());
sjLogSub1PO
.
setFileTypeId
(
fileTypeId
);
//全宗号-收集id-顺序号(七位,不够补0 / 来源系统资料唯一标志) 例:QZ001-202101010001-0000001
sjLogSub1PO
.
setDzwjh
(
sjLogPO
.
getSjLogId
()
+
"_"
+
StringUtils
.
leftPad
(
String
.
valueOf
(
i
+
1
),
7
,
"0"
));
sjLogSub1PO
.
setXtUuid
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
));
sjLogSub1PO
.
setSjState
(
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
());
sjLogSub1PO
.
setInsertUser
(
userId
);
sjLogSub1PO
.
setInsertDate
(
LocalDateTime
.
now
());
sjLogSub1PO
.
setState
(
"Y"
);
sjLogSub1Mapper
.
insert
(
sjLogSub1PO
);
Integer
sjLogSub1Id
=
sjLogSub1PO
.
getId
();
for
(
Map
.
Entry
<
String
,
String
>
entry:
demo
.
entrySet
())
{
SjLogSub1InfoPO
sjLogSub1InfoPO
=
new
SjLogSub1InfoPO
();
sjLogSub1InfoPO
.
setSjLogSub1Id
(
sjLogSub1Id
);
sjLogSub1InfoPO
.
setInfoKey
(
entry
.
getKey
());
sjLogSub1InfoPO
.
setInfoValue
(
String
.
valueOf
(
entry
.
getValue
()));
sjLogSub1InfoPO
.
setState
(
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
());
sjLogSub1InfoMapper
.
insert
(
sjLogSub1InfoPO
);
}
// 获取附件类型列表
QueryWrapper
example
=
new
QueryWrapper
();
example
.
eq
(
"xt_id"
,
xtId
);
example
.
eq
(
"file_id"
,
fileTypeId
);
example
.
eq
(
"state"
,
"Y"
);
List
<
SjFileAttRelPO
>
sjFileAttRelPOList
=
sjFileAttRelMapper
.
selectList
(
example
);
int
fjXh
=
1
;
for
(
SjFileAttRelPO
rel
:
sjFileAttRelPOList
){
int
count
=
collectAtt
(
sjLogSub1PO
,
xtId
,
fileTypeId
,
rel
.
getAttId
(),
demo
,
fjXh
);
fjXh
=
fjXh
+
count
;
}
}
}
public
int
collectAtt
(
SjLogSub1PO
sjLogSub1PO
,
String
xtId
,
Integer
fileTypeId
,
Integer
attId
,
Map
<
String
,
String
>
demo
,
int
fjXh
)
throws
Exception
{
int
result
=
0
;
//得到数据
//调用外部接口 传递一些参数
JSONObject
wjObject
=
new
JSONObject
();
wjObject
.
set
(
"xtId"
,
xtId
);
wjObject
.
set
(
"fileTypeId"
,
attId
+
""
);
wjObject
.
set
(
"fileParTypeId"
,
fileTypeId
+
""
);
QueryWrapper
paramExam
=
new
QueryWrapper
();
paramExam
.
eq
(
"xt_id"
,
xtId
);
paramExam
.
eq
(
"file_type_id"
,
attId
);
paramExam
.
eq
(
"state"
,
"Y"
);
List
<
SjFileSaveParamPO
>
sjFileSaveParamPOs
=
sjFileSaveParamMapper
.
selectList
(
paramExam
);
Map
fjMap
=
new
HashMap
();
for
(
SjFileSaveParamPO
sjFileSaveParamPO
:
sjFileSaveParamPOs
)
{
fjMap
.
put
(
sjFileSaveParamPO
.
getFileKey
(),
demo
.
get
(
sjFileSaveParamPO
.
getFileKey
()));
}
wjObject
.
set
(
"param"
,
fjMap
);
//查询附件
List
<
Map
<
String
,
String
>>
qsFpInfoPODemoList
=
getUrlFile
(
wjObject
);
result
=
qsFpInfoPODemoList
.
size
();
for
(
int
k
=
0
;
k
<
result
;
k
++)
{
Map
<
String
,
String
>
fjDemo
=
qsFpInfoPODemoList
.
get
(
k
);
SjLogSub2PO
sjLogSub2PO
=
new
SjLogSub2PO
();
sjLogSub2PO
.
setSjSub1Id
(
sjLogSub1PO
.
getId
());
sjLogSub2PO
.
setFileTypeId
(
attId
);
sjLogSub2PO
.
setDzwjh
(
sjLogSub1PO
.
getDzwjh
()
+
"_"
+
StringUtils
.
leftPad
(
String
.
valueOf
(
fjXh
+
k
),
4
,
"0"
));
//附件电子文件号=主电子文件号+附件序号
sjLogSub2PO
.
setFjXh
(
fjXh
+
k
+
""
);
//如果存在附件 附件序号从2开始
sjLogSub2PO
.
setXtUuid
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
));
sjLogSub2PO
.
setSjState
(
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
());
sjLogSub2PO
.
setInsertUser
(
sjLogSub1PO
.
getInsertUser
());
sjLogSub2PO
.
setInsertDate
(
LocalDateTime
.
now
());
sjLogSub2PO
.
setState
(
"Y"
);
sjLogSub2Mapper
.
insert
(
sjLogSub2PO
);
Integer
sjLogSub2Id
=
sjLogSub2PO
.
getId
();
for
(
Map
.
Entry
<
String
,
String
>
entry:
fjDemo
.
entrySet
())
{
SjLogSub2InfoPO
sjLogSub2InfoPO
=
new
SjLogSub2InfoPO
();
sjLogSub2InfoPO
.
setSjLogSub2Id
(
sjLogSub2Id
);
sjLogSub2InfoPO
.
setInfoKey
(
entry
.
getKey
());
sjLogSub2InfoPO
.
setInfoValue
(
entry
.
getValue
());
sjLogSub2InfoPO
.
setState
(
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
());
sjLogSub2InfoMapper
.
insert
(
sjLogSub2InfoPO
);
}
//保存文件附件关系到表(gx_file_att)
GxFileAttPO
gxFileAttPO
=
new
GxFileAttPO
();
gxFileAttPO
.
setFileTypeId
(
fileTypeId
);
gxFileAttPO
.
setFileDzwjh
(
sjLogSub1PO
.
getXtUuid
());
gxFileAttPO
.
setAttDzwjh
(
sjLogSub2PO
.
getXtUuid
());
gxFileAttPO
.
setAttTypeId
(
attId
);
gxFileAttPO
.
setState
(
"Y"
);
gxFileAttMapper
.
insert
(
gxFileAttPO
);
}
return
result
;
}
public
List
getUrlFile
(
JSONObject
jsonObject
)
throws
Exception
{
//调用外部接口 传递一些参数
String
res
=
HttpUtil
.
openHttpByPost
(
"http://192.168.106.150:39091/"
+
"sjCollection/sjInfo"
,
jsonObject
.
toString
());
AssertUtil
.
hasText
(
res
,
"数据不存在"
);
JSONObject
jsonRes
=
JSONUtil
.
parseObj
(
res
);
Integer
status
=
(
Integer
)
jsonRes
.
get
(
"status"
);
AssertUtil
.
isTrue
(
200
==
status
,
"发生异常"
);
List
demoLists
=
jsonRes
.
get
(
"data"
,
List
.
class
);
return
demoLists
;
}
public
void
startCollectJob
(){
QueryWrapper
sjLogExam
=
new
QueryWrapper
();
sjLogExam
.
eq
(
"sj_state"
,
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
());
List
<
SjLogPO
>
logList
=
sjLogMapper
.
selectList
(
sjLogExam
);
for
(
SjLogPO
sjLog
:
logList
)
{
Integer
sjLogId
=
sjLog
.
getId
();
QueryWrapper
sjLogSub1Exam
=
new
QueryWrapper
();
sjLogSub1Exam
.
ne
(
"sj_state"
,
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
());
sjLogSub1Exam
.
eq
(
"state"
,
"Y"
);
sjLogSub1Exam
.
eq
(
"sj_log_id"
,
sjLogId
);
List
<
SjLogSub1PO
>
logSub1List
=
sjLogSub1Mapper
.
selectList
(
sjLogSub1Exam
);
ErmsOrganizationPO
ermsOrganizationPO
=
ermsOrganizationMapper
.
selectById
(
sjLog
.
getOrganizationId
());
ErmsQiyePO
ermsQiyePO
=
ermsQiyeMapper
.
getErmsQzCertPOByOgId
(
sjLog
.
getOrganizationId
());
int
xh
=
0
;
for
(
SjLogSub1PO
sjLogSub1
:
logSub1List
)
{
Integer
sub1Id
=
sjLogSub1
.
getId
();
QueryWrapper
sub1InfoExam
=
new
QueryWrapper
();
sub1InfoExam
.
eq
(
"state"
,
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
());
sub1InfoExam
.
eq
(
"sj_log_sub1_id"
,
sub1Id
);
List
<
SjLogSub1InfoPO
>
sjLogInfoPOList
=
sjLogSub1InfoMapper
.
selectList
(
sub1InfoExam
);
List
<
Integer
>
lineList
=
sjLogInfoPOList
.
stream
().
map
(
e
->
e
.
getSjLogSub1Id
()).
distinct
().
collect
(
Collectors
.
toList
());
xh
++;
Integer
sjLogSub1Id
=
sjLogSub1
.
getId
();
collectbySub1ById
(
sjLogSub1
,
ermsQiyePO
,
ermsOrganizationPO
,
sjLogInfoPOList
,
xh
,
sjLog
.
getXtId
());
if
(
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
().
equals
(
sjLogSub1
.
getSjState
())){
sjLogSub1InfoMapper
.
updateState
(
sub1Id
,
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
());
}
}
long
successCount
=
sjLogSub1Mapper
.
countSjState
(
sjLogId
,
" and sj_state = '"
+
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
()
+
"'"
);
sjLog
.
setSjSuss
((
int
)
successCount
);
if
(
0
==
sjLogSub1Mapper
.
countSjState
(
sjLogId
,
" and sj_state != '"
+
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
()
+
"'"
))
{
sjLog
.
setSjState
(
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
());
}
sjLogMapper
.
updateById
(
sjLog
);
}
}
/*
* 采集sjLogSub1
* */
public
void
collectbySub1ById
(
SjLogSub1PO
sjLogSub1
,
ErmsQiyePO
ermsQiyePO
,
ErmsOrganizationPO
ermsOrganizationPO
,
List
<
SjLogSub1InfoPO
>
sjLogInfoPOList
,
Integer
xh
,
String
xtId
){
Integer
sub1Id
=
sjLogSub1
.
getId
();
Integer
fileTypeId
=
sjLogSub1
.
getFileTypeId
();
Map
<
String
,
String
>
map
=
sjLogInfoPOList
.
stream
().
collect
(
Collectors
.
toMap
(
SjLogSub1InfoPO:
:
getInfoKey
,
SjLogSub1InfoPO:
:
getInfoValue
));
saveCcFileInfo
(
xtId
,
fileTypeId
,
ermsQiyePO
,
ermsOrganizationPO
,
map
,
xh
,
sjLogSub1
,
null
);
QueryWrapper
sub2Exam
=
new
QueryWrapper
();
sub2Exam
.
eq
(
"sj_sub1_id"
,
sub1Id
);
sub2Exam
.
eq
(
"sj_state"
,
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
());
List
<
SjLogSub2PO
>
sjLogSub2List
=
sjLogSub2Mapper
.
selectList
(
sub2Exam
);
int
fjxh
=
0
;
for
(
SjLogSub2PO
sub2Po:
sjLogSub2List
){
fjxh
++;
Integer
sub2Id
=
sub2Po
.
getId
();
QueryWrapper
sub2InfoExam
=
new
QueryWrapper
();
sub2InfoExam
.
eq
(
"sj_sub2_id"
,
sub2Id
);
sub2InfoExam
.
eq
(
"state"
,
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
());
List
<
SjLogSub2InfoPO
>
sjLogSub2InfoPOList
=
sjLogSub2InfoMapper
.
selectList
(
sub2InfoExam
);
collectbySub2ById
(
xtId
,
ermsQiyePO
,
ermsOrganizationPO
,
sjLogSub2InfoPOList
,
fjxh
,
sjLogSub1
);
}
if
(
0
==
sjLogSub2Mapper
.
countSjState
(
sub1Id
,
" and sj_state != '"
+
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
()+
"'"
)){
sjLogSub1
.
setSjState
(
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
());
sjLogSub1Mapper
.
updateById
(
sjLogSub1
);
}
}
/*
* 采集sjLogSub2
* */
public
void
collectbySub2ById
(
String
xtId
,
ErmsQiyePO
ermsQiyePO
,
ErmsOrganizationPO
ermsOrganizationPO
,
List
<
SjLogSub2InfoPO
>
sjLogInfoPOList
,
Integer
xh
,
SjLogSub1PO
sjLogSub1
){
Integer
sub2Id
=
sjLogInfoPOList
.
get
(
0
).
getSjLogSub2Id
();
SjLogSub2PO
sjLogSub2
=
sjLogSub2Mapper
.
selectById
(
sub2Id
);
Integer
fileTypeId
=
sjLogSub2
.
getFileTypeId
();
Map
<
String
,
String
>
map
=
sjLogInfoPOList
.
stream
().
collect
(
Collectors
.
toMap
(
SjLogSub2InfoPO:
:
getInfoKey
,
SjLogSub2InfoPO:
:
getInfoValue
));
saveCcFileInfo
(
xtId
,
fileTypeId
,
ermsQiyePO
,
ermsOrganizationPO
,
map
,
xh
,
sjLogSub1
,
sjLogSub2
);
}
/*
* 保存文件信息
* */
public
void
saveCcFileInfo
(
String
xtId
,
Integer
fileTypeId
,
ErmsQiyePO
ermsQiyePO
,
ErmsOrganizationPO
ermsOrganizationPO
,
Map
<
String
,
String
>
map
,
Integer
xh
,
SjLogSub1PO
sjLogSub1PO
,
SjLogSub2PO
sjLogSub2PO
){
String
uuid
=
""
;
String
dzwjh
=
""
;
if
(
sjLogSub2PO
==
null
){
uuid
=
sjLogSub1PO
.
getXtUuid
();
dzwjh
=
sjLogSub1PO
.
getDzwjh
();
}
else
{
uuid
=
sjLogSub2PO
.
getXtUuid
();
dzwjh
=
sjLogSub2PO
.
getDzwjh
();
}
long
count
=
ccFileInfoMapper
.
count
(
fileTypeId
,
" where dzwjh = '"
+
uuid
+
"'"
);
String
checkSql
=
""
;
QueryWrapper
exam
=
new
QueryWrapper
();
exam
.
eq
(
"xt_id"
,
xtId
);
exam
.
eq
(
"file_type_id"
,
fileTypeId
);
exam
.
eq
(
"state"
,
"Y"
);
//元数据类别
List
<
SjMdXtPO
>
mdXtPOList
=
sjMdXtMapper
.
selectList
(
exam
);
if
(
count
==
0
)
{
List
<
PzFileSjPO
>
pzFileSjList
=
pzFileSjMapper
.
selectList
(
new
QueryWrapper
<
PzFileSjPO
>().
eq
(
"file_type_id"
,
fileTypeId
).
eq
(
"state"
,
"Y"
));
StringBuilder
sqlFjOne
=
new
StringBuilder
();
StringBuilder
sqlFjTwo
=
new
StringBuilder
();
sqlFjOne
.
append
(
"(dzwjh"
);
sqlFjTwo
.
append
(
"('"
+
uuid
+
"'"
);
String
temp
=
""
;
// 处理附件元数据
if
(
CollectionUtils
.
isNotEmpty
(
mdXtPOList
))
{
for
(
SjMdXtPO
mdXtPO
:
mdXtPOList
)
{
String
xtState
=
mdXtPO
.
getXtState
();
if
(
"M"
.
equals
(
xtState
))
{
//M:系统默认值或配置值
sqlFjOne
.
append
(
","
+
mdXtPO
.
getMdId
());
sqlFjTwo
.
append
(
",'"
+
mdXtPO
.
getXtValue
()
+
"'"
);
}
else
if
(
"F"
.
equals
(
xtState
))
{
// F:对接系统字段名(可手动修改)
sqlFjOne
.
append
(
","
+
mdXtPO
.
getMdId
());
String
xtValue
=
mdXtPO
.
getXtValue
();
sqlFjTwo
.
append
(
",'"
+
map
.
get
(
xtValue
)
+
"'"
);
}
else
{
// 其他标志一律按照特殊操作处理
if
(!
ManageConstant
.
M043
.
equals
(
mdXtPO
.
getMdId
())
||
!
ManageConstant
.
M043
.
equals
(
mdXtPO
.
getMdId
()))
{
sqlFjOne
.
append
(
","
+
mdXtPO
.
getMdId
());
}
if
(
ManageConstant
.
M006
.
equals
(
mdXtPO
.
getMdId
())
||
ManageConstant
.
M005
.
equals
(
mdXtPO
.
getMdId
()))
{
temp
=
ermsOrganizationPO
.
getOrganizationName
()
;
}
else
if
(
ManageConstant
.
M007
.
equals
(
mdXtPO
.
getMdId
()))
{
temp
=
dzwjh
;
//附件的M007存主键的dzwjh
}
else
if
(
ManageConstant
.
M009
.
equals
(
mdXtPO
.
getMdId
()))
{
temp
=
ermsQiyePO
.
getQzNo
()
;
}
else
if
(
ManageConstant
.
M011
.
equals
(
mdXtPO
.
getMdId
()))
{
SjMdXtPO
sjmdDemo
=
sjMdXtMapper
.
getOne
(
xtId
,
fileTypeId
,
"M033"
);
temp
=
map
.
get
(
sjmdDemo
.
getXtValue
()).
toString
().
substring
(
0
,
4
)
;
}
else
if
(
ManageConstant
.
M014
.
equals
(
mdXtPO
.
getMdId
()))
{
temp
=
fileTypeId
+
""
;
}
else
if
(
ManageConstant
.
MZ01
.
equals
(
mdXtPO
.
getMdId
()))
{
SjMdXtPO
sjmdDemo
=
sjMdXtMapper
.
getOne
(
xtId
,
fileTypeId
,
"M033"
);
String
date
=
map
.
get
(
sjmdDemo
.
getXtValue
()).
toString
();
if
(
date
.
length
()
==
8
||
date
.
length
()
==
6
)
{
//20220101 222201
temp
=
date
.
substring
(
4
,
6
)
;
}
else
if
(
date
.
length
()
==
4
)
{
//2022
temp
=
""
;
}
else
{
//2022-01-01
temp
=
date
.
substring
(
5
,
7
);
}
}
else
if
(
ManageConstant
.
M019
.
equals
(
mdXtPO
.
getMdId
()))
{
temp
=
xh
+
""
;
}
else
if
(
ManageConstant
.
M050
.
equals
(
mdXtPO
.
getMdId
()))
{
temp
=
xtId
;
}
else
if
(
ManageConstant
.
M022
.
equals
(
mdXtPO
.
getMdId
()))
{
ErmsFileTypePO
ermsFileTypePO
=
ermsFileTypeMapper
.
selectById
(
mdXtPO
.
getFileTypeId
());
temp
=
ermsFileTypePO
.
getFileTypeName
()
;
}
else
if
(
ManageConstant
.
M078
.
equals
(
mdXtPO
.
getMdId
()))
{
temp
=
ermsOrganizationPO
.
getOrganizationNo
();
}
else
{
if
(!
ManageConstant
.
M043
.
equals
(
mdXtPO
.
getMdId
()))
{
String
xtValue
=
""
;
// 特殊方法
temp
=
xtValue
;
}
}
}
sqlFjTwo
.
append
(
",'"
+
temp
+
"'"
);
long
ifHave
=
pzFileSjList
.
stream
().
filter
(
item
->
mdXtPO
.
getMdId
().
equals
(
item
.
getMdId
())).
count
();
if
(
ifHave
!=
0
)
{
checkSql
+=
" AND "
+
mdXtPO
.
getMdId
()
+
"='"
+
temp
+
"'"
;
}
}
}
//保存前先判断重复文件数据
if
(
CollectionUtils
.
isNotEmpty
(
pzFileSjList
))
{
List
<
CcFileInfoVO
>
list
=
ccFileInfoMapper
.
findCcFileInfo
(
fileTypeId
,
"WHERE state='Y' AND M007 NOT LIKE '%"
+
sjLogSub1PO
.
getDzwjh
().
substring
(
0
,
16
)
+
"%'"
+
checkSql
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
if
(
list
.
size
()
>
1
)
{
throw
new
AssertException
(
"重复数据判断异常"
);
}
String
arcType
=
list
.
get
(
0
).
getArcType
();
if
(
"Y"
.
equals
(
arcType
))
{
//已立卷,该数据不再下载
SjLogErrorPO
sjLogErrorPO
=
new
SjLogErrorPO
();
sjLogErrorPO
.
setSjLogSub1Id
(
sjLogSub1PO
!=
null
?
sjLogSub1PO
.
getId
()
:
null
);
sjLogErrorPO
.
setSjLogSub2Id
(
null
);
sjLogErrorPO
.
setErrorMsg
(
"该文件已收集且已立卷,不再重复收集,对应已立卷电子文件号"
+
list
.
get
(
0
).
getM007
());
sjLogErrorMapper
.
insert
(
sjLogErrorPO
);
sjLogSub1PO
.
setSjState
(
ManageConstant
.
CommonStateEnum
.
COLAIL
.
getCode
());
sjLogSub1Mapper
.
updateById
(
sjLogSub1PO
);
throw
new
AssertException
(
fileTypeId
+
"该批次文件已收集且已立卷,不再重复收集"
);
}
else
{
//未立卷,逻辑删除旧数据
handleRepeat
(
list
,
fileTypeId
,
ermsOrganizationPO
);
}
}
}
//补充新增的字段数据
sqlFjOne
.
append
(
",qy_id,organization_id"
);
sqlFjTwo
.
append
(
",'"
+
ermsQiyePO
.
getId
()
+
"'"
);
sqlFjTwo
.
append
(
",'"
+
ermsOrganizationPO
.
getId
()
+
"'"
);
String
customFjSql
=
sqlFjOne
.
append
(
" )"
).
toString
()
+
" VALUES "
+
sqlFjTwo
.
append
(
" )"
).
toString
();
//保存元数据信息
ccFileInfoMapper
.
addFileInfo
(
fileTypeId
,
customFjSql
);
}
List
<
SjMdXtPO
>
sjmd
=
mdXtPOList
.
stream
().
filter
(
item
->
ManageConstant
.
M066
.
equals
(
item
.
getMdId
())).
collect
(
Collectors
.
toList
());
if
(
sjmd
.
size
()>
0
){
this
.
M066Operate
(
xtId
,
fileTypeId
,
uuid
,
dzwjh
,
map
,
sjLogSub1PO
,
sjLogSub2PO
,
ermsOrganizationPO
);
}
}
/*
* 保存文件
* */
private
void
M066Operate
(
String
xtId
,
Integer
fileTypeId
,
String
uuid
,
String
dzwjh
,
Map
<
String
,
String
>
map
,
SjLogSub1PO
sjLogSub1PO
,
SjLogSub2PO
sjLogSub2PO
,
ErmsOrganizationPO
ermsOrganizationPO
){
String
updateSql
=
" "
;
//下载文件
int
pagenumber
=
0
;
JSONObject
fjObject
=
new
JSONObject
();
fjObject
.
set
(
"xtId"
,
xtId
);
fjObject
.
set
(
"fileTypeId"
,
fileTypeId
+
""
);
List
<
SjFileSaveParamPO
>
sjFileSaveParamPOs
=
sjFileSaveParamMapper
.
getList
(
fileTypeId
,
xtId
);
Map
fjMap
=
new
HashMap
();
for
(
SjFileSaveParamPO
sjFileSaveParamPO
:
sjFileSaveParamPOs
)
{
String
value
=
map
.
get
(
sjFileSaveParamPO
.
getFileKey
());
if
(
value
==
null
){
}
else
if
(
value
.
startsWith
(
"{"
)){
fjMap
.
put
(
sjFileSaveParamPO
.
getFileKey
(),
JSONUtil
.
toBean
(
value
,
Map
.
class
));
}
else
if
(
value
.
startsWith
(
"["
)){
JSONArray
objects
=
JSONUtil
.
parseArray
(
value
);
fjMap
.
put
(
sjFileSaveParamPO
.
getFileKey
(),
JSONUtil
.
toList
(
objects
,
Map
.
class
));
}
else
{
fjMap
.
put
(
sjFileSaveParamPO
.
getFileKey
(),
value
);
}
}
fjObject
.
set
(
"param"
,
fjMap
);
String
errMsg
=
null
;
String
status
=
""
;
try
{
String
res
=
HttpUtil
.
openHttpByPost
(
"http://192.168.106.150:39091/"
+
"sjCollection/sjFile"
,
fjObject
.
toString
());
JSONObject
jsonRes
=
JSONUtil
.
parseObj
(
res
);
status
=
jsonRes
.
getStr
(
"status"
);
if
(
StringUtils
.
equals
(
"200"
,
status
))
{
Map
data
=
jsonRes
.
get
(
"data"
,
Map
.
class
);
String
fileData
=
(
String
)
data
.
get
(
"fileData"
);
String
format
=
(
String
)
data
.
get
(
"fileType"
);
BigDecimal
fileSize
=
(
BigDecimal
)
data
.
get
(
"fileSize"
);
String
targetPath
=
basePath
+
File
.
separator
+
fileTypeId
;
String
targetName
=
dzwjh
+
"."
+
format
;
String
fileName
=
targetPath
+
File
.
separator
+
targetName
;
InputStream
stream
=
new
ByteArrayInputStream
(
Base64Utils
.
decode
(
fileData
.
getBytes
(
StandardCharsets
.
UTF_8
)));
FilePO
filePO
=
fileService
.
save
(
stream
,
targetPath
,
targetName
);
File
file
=
new
File
(
fileName
);
if
(
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
().
equals
(
filePO
.
getState
()))
{
if
(
format
.
equals
(
"pdf"
))
{
FileInputStream
inputStream
=
new
FileInputStream
(
file
);
PdfReader
pdfReader
=
new
PdfReader
(
inputStream
);
pagenumber
=
pdfReader
.
getNumberOfPages
();
pdfReader
.
close
();
inputStream
.
close
();
//获取证书
QueryWrapper
example
=
new
QueryWrapper
<
ErmsQzCertPO
>();
example
.
eq
(
ErmsQzCertPO
.
ORGANIZATION_NO
,
ermsOrganizationPO
.
getOrganizationNo
());
example
.
eq
(
ErmsQzCertPO
.
XT_ID
,
xtId
);
example
.
eq
(
ErmsQzCertPO
.
STATE
,
"Y"
);
ErmsQzCertPO
cert
=
ermsQzCertMapper
.
selectOne
(
example
);
//todo 下载文件 加密 盖章
if
(
cert
!=
null
)
{
CommonUtil
.
base64ToFile
(
cert
.
getCertFile
(),
"cert.pfx"
);
CommonUtil
.
base64ToFile
(
cert
.
getImg
().
replaceFirst
(
"data:image/png;base64,"
,
""
),
"image.png"
);
fileName
=
AposePdfUtil
.
insertSignature
(
fileName
,
"cert.pfx"
,
cert
.
getPassword
(),
cert
.
getOrganizationNo
()
+
"_"
+
cert
.
getXtId
(),
"image.png"
);
File
certFile
=
new
File
(
fileName
);
long
size
=
FileUtils
.
sizeOf
(
certFile
);
fileSize
=
new
BigDecimal
(
String
.
valueOf
(
size
));
fileSize
=
fileSize
.
divide
(
new
BigDecimal
((
String
.
valueOf
(
"1024"
))));
}
}
else
{
//其他类型的文件默认页数是1
pagenumber
=
1
;
}
CcFileSaveInfoPO
ccFileSaveInfoPO
=
new
CcFileSaveInfoPO
();
ccFileSaveInfoPO
.
setFileSize
(
fileSize
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
ccFileSaveInfoPO
.
setFilePath
(
fileName
);
ccFileSaveInfoPO
.
setFileType
(
format
);
ccFileSaveInfoMapper
.
insert
(
ccFileSaveInfoPO
);
Integer
ccFileSaveInfoId
=
ccFileSaveInfoPO
.
getId
();
updateSql
+=
ManageConstant
.
M066
+
" = "
+
ccFileSaveInfoId
+
", "
+
ManageConstant
.
M043
+
" = "
+
pagenumber
;
}
}
else
{
//获取文件不存在
errMsg
=
jsonRes
.
getStr
(
"msg"
);
throw
new
Exception
(
errMsg
);
}
}
catch
(
Exception
e
)
{
errMsg
=
e
.
getMessage
();
}
finally
{
if
(
errMsg
!=
null
)
{
SjLogErrorPO
sjLogErrorPO
=
new
SjLogErrorPO
();
sjLogErrorPO
.
setSjLogSub1Id
(
sjLogSub1PO
!=
null
?
sjLogSub1PO
.
getId
()
:
null
);
sjLogErrorPO
.
setSjLogSub2Id
(
sjLogSub2PO
!=
null
?
sjLogSub2PO
.
getId
()
:
null
);
sjLogErrorPO
.
setErrorMsg
(
errMsg
);
sjLogErrorMapper
.
insert
(
sjLogErrorPO
);
if
(
sjLogSub2PO
!=
null
)
{
sjLogSub2PO
.
setSjState
(
ManageConstant
.
CommonStateEnum
.
COLAIL
.
getCode
());
sjLogSub2Mapper
.
updateById
(
sjLogSub2PO
);
}
sjLogSub1PO
.
setSjState
(
ManageConstant
.
CommonStateEnum
.
COLAIL
.
getCode
());
sjLogSub1Mapper
.
updateById
(
sjLogSub1PO
);
}
else
{
if
(
StringUtils
.
equals
(
"200"
,
status
))
{
ccFileInfoMapper
.
upDateFile
(
fileTypeId
,
updateSql
,
uuid
);
if
(
sjLogSub2PO
!=
null
)
{
sjLogSub2PO
.
setSjState
(
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
());
sjLogSub2Mapper
.
updateById
(
sjLogSub2PO
);
sjLogSub2InfoMapper
.
updateState
(
sjLogSub2PO
.
getId
(),
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
());
}
else
{
sjLogSub1InfoMapper
.
updateState
(
sjLogSub1PO
.
getId
(),
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
());
}
}
}
}
}
/**
* 已收集未立卷重复文件处理
*
* @param list
* @param fileTypeId
* @param ermsOrganizationPO
*/
public
void
handleRepeat
(
List
<
CcFileInfoVO
>
list
,
Integer
fileTypeId
,
ErmsOrganizationPO
ermsOrganizationPO
)
{
//如果list不为空
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
//遍历
for
(
CcFileInfoVO
ccFileInfo
:
list
)
{
//如果是未立卷
if
(
StringUtils
.
equals
(
ccFileInfo
.
getArcType
(),
"N"
))
{
//根据cc_file_info表中的主键id查询路径
CcFileSaveInfoPO
ccFileSaveInfo
=
ccFileSaveInfoMapper
.
selectById
(
ccFileInfo
.
getM066
());
if
(
ccFileSaveInfo
!=
null
)
{
//根据路径删除文件--》移动到删除文件夹
File
oldFile
=
new
File
(
ccFileSaveInfo
.
getFilePath
());
String
newPath
=
basePath
+
File
.
separator
+
"deleteFile"
+
File
.
separator
+
+
fileTypeId
+
File
.
separator
;
File
fnewpath
=
new
File
(
newPath
);
if
(!
fnewpath
.
exists
())
{
fnewpath
.
mkdirs
();
}
File
fnew
=
new
File
(
newPath
+
oldFile
.
getName
());
oldFile
.
renameTo
(
fnew
);
oldFile
.
delete
();
}
//根据cc_file_info表中的主键id逻辑删除cc_file_save_info表中的数据
CcFileSaveInfoPO
ccFileSaveInfoPO
=
ccFileSaveInfoMapper
.
selectById
(
ccFileInfo
.
getM066
());
ccFileSaveInfoPO
.
setState
(
"N"
);
ccFileSaveInfoMapper
.
updateById
(
ccFileSaveInfoPO
);
String
zjDzwjh
=
ccFileInfoMapper
.
getDzwjh
(
fileTypeId
,
ccFileInfo
.
getArcType
(),
ermsOrganizationPO
==
null
?
null
:
ermsOrganizationPO
.
getOrganizationName
(),
ccFileInfo
.
getM066
());
//根据arc_type、全宗名称与M066逻辑删除cc_file_info表中的数据
ccFileInfoMapper
.
delete
(
fileTypeId
,
ccFileInfo
.
getArcType
(),
ermsOrganizationPO
==
null
?
null
:
ermsOrganizationPO
.
getOrganizationName
(),
ccFileInfo
.
getM066
());
// 获取附件类型列表
QueryWrapper
example
=
new
QueryWrapper
();
example
.
eq
(
"file_dzwjh"
,
zjDzwjh
);
example
.
eq
(
"file_type_id"
,
fileTypeId
);
List
<
GxFileAttPO
>
gxFileAttPOListxFileAttPO
=
gxFileAttMapper
.
selectList
(
example
);
// 附件类型列表
for
(
GxFileAttPO
gxFileAttPO
:
gxFileAttPOListxFileAttPO
)
{
Map
fjMap
=
ccFileInfoMapper
.
getUrl
(
gxFileAttPO
.
getAttTypeId
(),
gxFileAttPO
.
getAttDzwjh
());
if
(
fjMap
!=
null
)
{
String
fjM066Id
=
(
String
)
fjMap
.
get
(
"M066"
);
CcFileSaveInfoPO
fjccFileSaveInfo
=
ccFileSaveInfoMapper
.
selectById
(
fjM066Id
);
if
(
fjccFileSaveInfo
!=
null
)
{
//根据路径删除附件 todo 未测试
new
File
(
fjccFileSaveInfo
.
getFilePath
()).
delete
();
}
//根据cc_file_info表中的主键id逻辑删除cc_file_save_info表中的数据
CcFileSaveInfoPO
fjCcFileSaveInfo
=
ccFileSaveInfoMapper
.
selectById
(
fjM066Id
);
fjCcFileSaveInfo
.
setState
(
"N"
);
ccFileSaveInfoMapper
.
updateById
(
fjCcFileSaveInfo
);
//根据arc_type、全宗名称与M066逻辑删除cc_file_info表中的数据
ccFileInfoMapper
.
deleteFj
(
gxFileAttPO
.
getAttTypeId
(),
gxFileAttPO
.
getAttDzwjh
());
gxFileAttPO
.
setState
(
"N"
);
gxFileAttMapper
.
updateById
(
gxFileAttPO
);
}
}
}
else
{
//抛出自定义异常
throw
new
AssertException
(
fileTypeId
+
"文件存在已立卷数据,请勿重复收集"
);
}
}
}
}
}
src/main/java/com/greatchn/collection/service/FileService.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.greatchn.collection.entity.FilePO
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.greatchn.collection.entity.FileMapper
;
import
com.greatchn.collection.framework.constant.ManageConstant
;
import
com.greatchn.collection.framework.exception.AssertException
;
import
org.apache.commons.io.FilenameUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
java.io.*
;
import
java.util.List
;
@Service
public
class
FileService
{
@Autowired
private
FileMapper
fileMapper
;
public
FilePO
save
(
InputStream
inputStream
,
String
targetFilePath
,
String
targetFileName
){
// 获取文件的扩展名
String
ext
=
FilenameUtils
.
getExtension
(
targetFileName
);
inputStream
.
mark
(
0
);
String
md5
=
""
;
OutputStream
os
=
null
;
File
outFile
=
new
File
(
targetFilePath
+
File
.
separator
+
targetFileName
+
".temp"
);
try
{
md5
=
DigestUtils
.
md5Hex
(
inputStream
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
FilePO
vo
=
this
.
check
(
targetFileName
,
md5
);
// 1K的数据缓冲
byte
[]
bs
=
new
byte
[
1024
];
// 读取到的数据长度
int
len
;
if
(
vo
==
null
)
{
//数据库持久化这个数据
FilePO
file1
=
new
FilePO
();
file1
.
setPath
(
targetFilePath
+
File
.
separator
+
targetFileName
);
file1
.
setName
(
targetFileName
);
file1
.
setSuffix
(
ext
);
file1
.
setFileKey
(
md5
);
file1
.
setState
(
ManageConstant
.
CommonStateEnum
.
COLIN
.
getCode
());
this
.
save
(
file1
);
try
{
// 2、保存到临时文件
// 输出的文件流保存到本地文件
File
tempFile
=
new
File
(
targetFilePath
);
if
(!
tempFile
.
exists
())
{
tempFile
.
mkdirs
();
}
os
=
new
FileOutputStream
(
outFile
);
inputStream
.
reset
();
int
i
=
0
;
// 开始读取
while
((
len
=
inputStream
.
read
(
bs
))
!=
-
1
)
{
os
.
write
(
bs
,
0
,
len
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
// 完毕,关闭所有链接
try
{
os
.
close
();
inputStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
outFile
.
renameTo
(
new
File
(
targetFilePath
+
File
.
separator
+
targetFileName
));
file1
.
setState
(
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
());
this
.
save
(
file1
);
}
return
file1
;
}
else
{
if
(!
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
().
equals
(
vo
.
getState
()))
{
try
{
inputStream
.
reset
();
int
position
=
(
int
)
outFile
.
length
();
os
=
new
FileOutputStream
(
outFile
,
true
);
BufferedInputStream
bis
=
new
BufferedInputStream
(
inputStream
);
bis
.
skip
(
position
);
if
(
bis
.
markSupported
())
{
// bis.reset();
// 开始读取
while
((
len
=
bis
.
read
(
bs
))
!=
-
1
)
{
os
.
write
(
bs
,
0
,
len
);
}
}
else
{
System
.
out
.
print
(
"InputStream不支持reset()"
);
}
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
finally
{
// 完毕,关闭所有链接
try
{
os
.
close
();
inputStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
outFile
.
renameTo
(
new
File
(
targetFileName
));
vo
.
setState
(
ManageConstant
.
CommonStateEnum
.
COLEND
.
getCode
());
this
.
save
(
vo
);
}
}
return
vo
;
}
}
//保存文件
public
void
save
(
FilePO
file1
){
//根据 数据库的 文件标识来查询 当前文件 是否存在
LambdaQueryWrapper
<
FilePO
>
lambda
=
new
QueryWrapper
<
FilePO
>().
lambda
();
lambda
.
eq
(
FilePO:
:
getFileKey
,
file1
.
getFileKey
());
List
<
FilePO
>
fileDTOS
=
fileMapper
.
selectList
(
lambda
);
//如果存在就修改
if
(
fileDTOS
.
size
()!=
0
){
//根据key来修改
LambdaQueryWrapper
<
FilePO
>
lambda1
=
new
QueryWrapper
<
FilePO
>().
lambda
();
lambda1
.
eq
(
FilePO:
:
getFileKey
,
file1
.
getFileKey
());
fileMapper
.
update
(
file1
,
lambda1
);
}
else
{
//不存在就添加
fileMapper
.
insert
(
file1
);
}
}
//检查文件
public
FilePO
check
(
String
name
,
String
key
)
{
LambdaQueryWrapper
<
FilePO
>
lambda
=
new
QueryWrapper
<
FilePO
>().
lambda
();
lambda
.
eq
(
FilePO:
:
getName
,
name
);
FilePO
dto
=
fileMapper
.
selectOne
(
lambda
);
if
(
dto
!=
null
&&
!
key
.
equals
(
dto
.
getFileKey
())){
fileMapper
.
deleteById
(
dto
);
dto
=
null
;
}
return
dto
;
}
//检查文件
public
List
<
FilePO
>
check
(
String
key
)
{
LambdaQueryWrapper
<
FilePO
>
lambda
=
new
QueryWrapper
<
FilePO
>().
lambda
();
lambda
.
eq
(
FilePO:
:
getFileKey
,
key
);
List
<
FilePO
>
dtos
=
fileMapper
.
selectList
(
lambda
);
return
dtos
;
}
}
src/main/java/com/greatchn/collection/vo/CcFileInfoVO.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
.
vo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* 手动收集数据 findCcFileInfo
*
* @author zhangkun
* @create 2022-08-02
*/
@Data
@Accessors
(
chain
=
true
)
public
class
CcFileInfoVO
implements
Serializable
{
/**
* 是否组卷 Y:已组卷 N:未组卷
*/
private
String
arcType
;
/**
* cc_file_save_info表中的id
*/
private
String
M066
;
private
String
dzwjh
;
private
String
M007
;
}
src/main/resources/application.properties
0 → 100644
View file @
817b21b7
server.port
=
8088
spring.mvc.servlet.load-on-startup
=
1
#?????????
file.basepath
=
D:/BaiduNetdiskDownload/
# ????????
spring.servlet.multipart.max-file-size
=
50MB
# ????????????
spring.servlet.multipart.max-request-size
=
50MB
#??????mysql???
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.datasource.url
=
jdbc:mysql://localhost:3306/test?characterEncoding=utf8&autoReconnect=true&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.username
=
root
spring.datasource.password
=
root
app.name
=
FileFactory
app.version
=
2022.11.08
tempPath
=
/temp
mybatis-plus.global-config.banner
=
false
src/test/java/com/greatchn/collection/CollectionApplicationTests.java
0 → 100644
View file @
817b21b7
package
com
.
greatchn
.
collection
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
@SpringBootTest
class
CollectionApplicationTests
{
@Test
void
contextLoads
()
{
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment