Commit 817b21b7 authored by lihuiling's avatar lihuiling

collectionDemo项目初始化

parents
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/
# 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
This diff is collapsed.
@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%
<?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>
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);
}
}
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("收集成功");
}
}
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);
}
<?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>
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> {
}
<?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>
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;
}
}
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);
}
<?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>
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;
}
}
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);
}
<?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>
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;
}
}
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);
}
<?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>
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;
}
}
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> {
}
<?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>
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;
}
}
package com.greatchn.collection.entity;
import com.greatchn.collection.entity.FilePO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface FileMapper extends BaseMapper<FilePO> {
}
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;
}
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);
}
<?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>
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;
}
}
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);
}
<?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>
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;
}
}
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> {
}
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;
}
}
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);
}
<?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>
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;
}
}
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> {
}
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;
}
}
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);
}
<?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>
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;
}
}
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);
}
<?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>
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;
}
}
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);
}
<?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>
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;
}
}
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);
}
<?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>
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;
}
}
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);
}
<?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>
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;
}
}
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);
}
<?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>
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;
}
}
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 {
}
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;
}
}
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("/**");
}
}
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";
}
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";
}
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;
}
}
}
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;
}
}
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;
}
}
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;
}
}
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);
}
}
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));
}
}
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();
}
}
}
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.0F);
// 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();
}
}
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();
}
}
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();
}
}
}
}
}
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;
}
}
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("收集文件结束");
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment