() { });
+ }
+ bufferedReader.close();
+ }
+
+ return dto;
+ }
+ catch (Exception ex){
+ ex.printStackTrace();
+ return null;
+ }
+ }
+ /**
+ * 取得当前jar路径
+ * @return
+ */
+ public static String CurrentPath(){
+ File dir = new File(".");
+ String currentpath ="";
+ try {
+ currentpath = dir.getCanonicalPath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return currentpath;
+ }
+
+ /**
+ * 取得当前jar路径
+ * @return
+ */
+ public static String currentPath(String dir){
+ String path = CurrentPath() + File.separator + dir;
+ File file = new File(path);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ return path;
+ }
+
+
+
+ /**
+ * 读取文件内容
+ * @param path
+ * @param fileName
+ * @return
+ */
+ public String ReadContent(String path,String fileName){
+ String currentPath=CurrentPath();
+ path = currentPath+"\\"+path;
+ StringBuilder sb = new StringBuilder();
+ File file = new File(path+"\\"+fileName);
+ try {
+ if (!file.getParentFile().exists()) {
+ file.getParentFile().mkdirs();
+ }
+ if (!file.exists()) {
+ try {
+ file.createNewFile();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ } else {
+ BufferedReader bufferedReader = null;
+ bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
+ String line;
+ while (!StringUtils.isEmpty(line = bufferedReader.readLine())) {
+ sb.append(line);
+ }
+
+ bufferedReader.close();
+ }
+
+ return sb.toString();
+ }
+ catch (Exception ex){
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * 保存json至文件
+ * @param path 路径后缀
+ * @param fileName 文件名称
+ * @param data json信息
+ * @return
+ */
+ public void Save(String path,String fileName,String data){
+ String currentPath=CurrentPath();
+ path = currentPath+"\\"+path;
+ FileWriter fwriter = null;
+ try {
+ File file = new File(path);
+ if (!file.getParentFile().exists()) {
+ file.getParentFile().mkdirs();
+ }
+ fwriter = new FileWriter(path+"\\"+fileName);
+ fwriter.write(data);
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ } finally {
+ try {
+ fwriter.flush();
+ fwriter.close();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/com/docus/server/reportmanager/util/XmlUtil.java b/src/main/java/com/docus/server/reportmanager/util/XmlUtil.java
new file mode 100644
index 0000000..96c9a89
--- /dev/null
+++ b/src/main/java/com/docus/server/reportmanager/util/XmlUtil.java
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2018-2028, DreamLu All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: DreamLu 卢春梦 (596392912@qq.com)
+ */
+package com.docus.server.reportmanager.util;
+
+import com.docus.core.util.Exceptions;
+import com.docus.core.util.IoUtil;
+import com.docus.core.util.StringUtil;
+import org.springframework.lang.Nullable;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * xpath解析xml
+ *
+ *
+ * 文档地址:
+ * http://www.w3school.com.cn/xpath/index.asp
+ *
+ *
+ * @author L.cm
+ */
+public class XmlUtil {
+ private final XPath path;
+ private final Document doc;
+
+ private XmlUtil(InputSource inputSource) throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory dbf = getDocumentBuilderFactory();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ doc = db.parse(inputSource);
+ path = getXPathFactory().newXPath();
+ }
+
+ /**
+ * 创建工具类
+ *
+ * @param inputSource inputSource
+ * @return XmlUtil
+ */
+ private static XmlUtil create(InputSource inputSource) {
+ try {
+ return new XmlUtil(inputSource);
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ throw Exceptions.unchecked(e);
+ }
+ }
+
+ /**
+ * 转换工具类
+ *
+ * @param inputStream inputStream
+ * @return XmlUtil
+ */
+ public static XmlUtil of(InputStream inputStream) {
+ InputSource inputSource = new InputSource(inputStream);
+ return create(inputSource);
+ }
+
+ /**
+ * xml遇到的特殊字符替换
+ */
+ public static String specialCharacterSubstitution(String str){
+ str = StringUtil.replace(str, "\u00A0", " ");
+ return str;
+ }
+
+ /**
+ * 转换工具类
+ *
+ * @param xmlStr xmlStr
+ * @return XmlUtil
+ */
+ public static XmlUtil of(String xmlStr) {
+ xmlStr=specialCharacterSubstitution(xmlStr);
+ StringReader sr = new StringReader(xmlStr.trim());
+ InputSource inputSource = new InputSource(sr);
+ XmlUtil xmlUtil = create(inputSource);
+ IoUtil.closeQuietly(sr);
+ return xmlUtil;
+ }
+
+ /**
+ * 转换路径
+ *
+ * @param expression 表达式
+ * @param item 实体
+ * @param returnType 返回类型
+ * @return Object
+ */
+ private Object evalXPath(String expression, @Nullable Object item, QName returnType) {
+ item = null == item ? doc : item;
+ try {
+ return path.evaluate(expression, item, returnType);
+ } catch (XPathExpressionException e) {
+ throw Exceptions.unchecked(e);
+ }
+ }
+
+ /**
+ * 获取String
+ *
+ * @param expression 路径
+ * @return {String}
+ */
+ public String getString(String expression) {
+ return (String) evalXPath(expression, null, XPathConstants.STRING);
+ }
+
+ /**
+ * 获取Boolean
+ *
+ * @param expression 路径
+ * @return {String}
+ */
+ public Boolean getBoolean(String expression) {
+ return (Boolean) evalXPath(expression, null, XPathConstants.BOOLEAN);
+ }
+
+ /**
+ * 获取Number
+ *
+ * @param expression 路径
+ * @return {Number}
+ */
+ public Number getNumber(String expression) {
+ return (Number) evalXPath(expression, null, XPathConstants.NUMBER);
+ }
+
+ /**
+ * 获取某个节点
+ *
+ * @param expression 路径
+ * @return {Node}
+ */
+ public Node getNode(String expression) {
+ return (Node) evalXPath(expression, null, XPathConstants.NODE);
+ }
+
+ /**
+ * 获取子节点
+ *
+ * @param expression 路径
+ * @return NodeList
+ */
+ public NodeList getNodeList(String expression) {
+ return (NodeList) evalXPath(expression, null, XPathConstants.NODESET);
+ }
+
+
+ /**
+ * 获取String
+ *
+ * @param node 节点
+ * @param expression 相对于node的路径
+ * @return {String}
+ */
+ public String getString(Object node, String expression) {
+ return (String) evalXPath(expression, node, XPathConstants.STRING);
+ }
+
+ /**
+ * 获取
+ *
+ * @param node 节点
+ * @param expression 相对于node的路径
+ * @return {String}
+ */
+ public Boolean getBoolean(Object node, String expression) {
+ return (Boolean) evalXPath(expression, node, XPathConstants.BOOLEAN);
+ }
+
+ /**
+ * 获取
+ *
+ * @param node 节点
+ * @param expression 相对于node的路径
+ * @return {Number}
+ */
+ public Number getNumber(Object node, String expression) {
+ return (Number) evalXPath(expression, node, XPathConstants.NUMBER);
+ }
+
+ /**
+ * 获取某个节点
+ *
+ * @param node 节点
+ * @param expression 路径
+ * @return {Node}
+ */
+ public Node getNode(Object node, String expression) {
+ return (Node) evalXPath(expression, node, XPathConstants.NODE);
+ }
+
+ /**
+ * 获取子节点
+ *
+ * @param node 节点
+ * @param expression 相对于node的路径
+ * @return NodeList
+ */
+ public NodeList getNodeList(Object node, String expression) {
+ return (NodeList) evalXPath(expression, node, XPathConstants.NODESET);
+ }
+
+ /**
+ * 针对没有嵌套节点的简单处理
+ *
+ * @return map集合
+ */
+ public Map toMap() {
+ Element root = doc.getDocumentElement();
+ Map params = new HashMap<>(16);
+
+ // 将节点封装成map形式
+ NodeList list = root.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+ if (node instanceof Element) {
+ params.put(node.getNodeName(), node.getTextContent());
+ }
+ }
+ return params;
+ }
+
+ private static volatile boolean preventedXXE = false;
+
+ private static DocumentBuilderFactory getDocumentBuilderFactory() throws ParserConfigurationException {
+ DocumentBuilderFactory dbf = XmlHelperHolder.documentBuilderFactory;
+ if (!preventedXXE) {
+ synchronized (XmlUtil.class) {
+ if (!preventedXXE) {
+ preventXXE(dbf);
+ }
+ }
+ }
+ return dbf;
+ }
+
+ /**
+ * preventXXE
+ *
+ * @param dbf
+ * @throws ParserConfigurationException
+ */
+ private static void preventXXE(DocumentBuilderFactory dbf) throws ParserConfigurationException {
+ // This is the PRIMARY defense. If DTDs (doctypes) are disallowed, almost all XML entity attacks are prevented
+ // Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl
+ dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+
+ // If you can't completely disable DTDs, then at least do the following:
+ // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities
+ // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities
+
+ // JDK7+ - http://xml.org/sax/features/external-general-entities
+ dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
+
+ // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-parameter-entities
+ // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities
+
+ // JDK7+ - http://xml.org/sax/features/external-parameter-entities
+ dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+
+ // Disable external DTDs as well
+ dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+
+ // and these as well, per Timothy Morgan's 2014 paper: "XML Schema, DTD, and Entity Attacks"
+ dbf.setXIncludeAware(false);
+ dbf.setExpandEntityReferences(false);
+ preventedXXE = true;
+ }
+
+ private static XPathFactory getXPathFactory() {
+ return XmlHelperHolder.xPathFactory;
+ }
+
+ /**
+ * 内部类单例
+ */
+ private static class XmlHelperHolder {
+ private static DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ private static XPathFactory xPathFactory = XPathFactory.newInstance();
+ }
+
+}
diff --git a/src/main/resources/bin/install.bat b/src/main/resources/bin/install.bat
new file mode 100644
index 0000000..7a651bc
--- /dev/null
+++ b/src/main/resources/bin/install.bat
@@ -0,0 +1,33 @@
+@echo off
+
+for /f "delims=" %%t in ('winsw.exe status') do set str=%%t
+echo %str%
+
+
+
+if %str%==Started (
+echo "restart....."
+winsw stop
+PING 127.0.0.1 -n 10 -w 30000 >NUL
+winsw start
+)
+
+
+
+if %str%==Stopped (
+echo "start....."
+winsw start
+)
+
+
+if %str%==NonExistent (
+echo "deploy and start....."
+winsw install
+winsw start
+echo c
+)
+
+
+
+
+
diff --git a/src/main/resources/bin/start.bat b/src/main/resources/bin/start.bat
new file mode 100644
index 0000000..58c25cb
--- /dev/null
+++ b/src/main/resources/bin/start.bat
@@ -0,0 +1,21 @@
+set java_opts=-Xms512m -Xmx512m
+set key="java_opts"
+
+
+rem 文件不存在,就跳过
+if not exist java-ops.ini goto end
+
+for /f "tokens=1,2 delims==" %%i in (java-ops.ini) do (
+ if "%%i"==%key% set java_opts=%%j)
+echo java_opts is : %java_opts%
+
+:end
+
+rem 启动java
+
+java %java_opts% -Dfile.encoding=utf-8 -jar -Dspring.profiles.active=@profile.name@ -Dloader.path=config,lib @project.build.finalName@.jar
+
+
+
+
+
diff --git a/src/main/resources/bin/stop.bat b/src/main/resources/bin/stop.bat
new file mode 100644
index 0000000..98468a0
--- /dev/null
+++ b/src/main/resources/bin/stop.bat
@@ -0,0 +1,13 @@
+@echo off
+
+for /f "delims=" %%t in ('winsw.exe status') do set str=%%t
+echo %str%
+
+
+
+if %str%==Started (
+winsw stop
+@echo wait program stop .....
+PING 127.0.0.1 -n 30 -w 10000 >NUL
+)
+
diff --git a/src/main/resources/bin/update.bat b/src/main/resources/bin/update.bat
new file mode 100644
index 0000000..8c9b881
--- /dev/null
+++ b/src/main/resources/bin/update.bat
@@ -0,0 +1,19 @@
+@echo off
+
+set deployDir=%1\docus-report-manager
+if %deployDir%=="" set deployDir=d:\webroot\docus-report-manager
+
+set curr_file=%cd%
+cd /d %deployDir%
+call stop.bat
+cd %curr_file%
+sc query docus-backup-sys |Find "RUNNING" && ping 127.0.0.1 -n 10 >nul
+rd/s/q %deployDir%\lib
+rd/s/q %deployDir%\dataConfig
+rd/s/q %deployDir%\config
+del /s/q %deployDir%\*.jar
+xcopy /Y/E/I * %deployDir%
+
+cd /d %deployDir%
+call install.bat
+
diff --git a/src/main/resources/bin/winsw.xml b/src/main/resources/bin/winsw.xml
new file mode 100644
index 0000000..d7fe58a
--- /dev/null
+++ b/src/main/resources/bin/winsw.xml
@@ -0,0 +1,8 @@
+
+ docus-report-manager
+ 生产-嘉时-报告管理服务
+ 生产-嘉时-报告管理服务
+ Automatic
+ %BASE%\start.bat
+
+
\ No newline at end of file
diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..2861362
--- /dev/null
+++ b/src/main/resources/bootstrap.yml
@@ -0,0 +1,77 @@
+server:
+ port: 9444
+
+spring:
+ application:
+ name: @artifactId@
+ profiles:
+ active: test
+ datasource:
+ dynamic:
+ primary: master #设置默认的数据源,默认值为master
+ strict: false #是否用严格模式,如果启用在味匹配到指定数据源时抛出异常
+ datasource:
+ master:
+ url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_archivefile?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
+ username: docus
+ password: docus702
+ driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
+ type: com.alibaba.druid.pool.DruidDataSource
+ # 初始化配置
+ initial-size: 3
+ # 最小连接数
+ min-idle: 3
+ # 最大连接数
+ max-active: 15
+ # 获取连接超 时时间
+ max-wait: 5000
+ # 连接有效性检测时间
+ time-between-eviction-runs-millis: 90000
+ # 最大空闲时间
+ min-evictable-idle-time-millis: 1800000
+ test-while-idle: true
+ test-on-borrow: false
+ test-on-return: false
+ validation-query: select 1
+ redis:
+ host: redis.docus.cn
+ password: JSdocus@702
+ cloud:
+ nacos:
+ discovery:
+ server-addr: nacos.docus.cn
+ namespace: 34acdf7a-9fc6-4bbd-8aea-9a47c8007ad5
+ config:
+ server-addr: ${spring.cloud.nacos.discovery.server-addr}
+ namespace: 34acdf7a-9fc6-4bbd-8aea-9a47c8007ad5
+ file-extension: yml
+ shared-configs:
+ - comm.${spring.cloud.nacos.config.file-extension}
+
+
+docus:
+ dbtype: mysql
+
+mybatis-plus:
+ configuration:
+ map-underscore-to-camel-case: true
+ call-setters-on-nulls: true
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+ global-config:
+ db-config:
+ field-strategy: NOT_EMPTY
+ db-type: MYSQL
+xxl:
+ job:
+ accessToken:
+ admin:
+ addresses: http://job.docus.cn:8180/xxl-job-admin
+ executor:
+ appname: docus-report-manager
+ address:
+ ip:
+ port: 19444
+ logretentiondays: 30
+ logpath: D:/xxl-job/docus-report-manager
+
+
diff --git a/src/main/resources/log4jdbc.log4j2.properties b/src/main/resources/log4jdbc.log4j2.properties
new file mode 100644
index 0000000..5cb6f99
--- /dev/null
+++ b/src/main/resources/log4jdbc.log4j2.properties
@@ -0,0 +1,2 @@
+# If you use SLF4J. First, you need to tell log4jdbc-log4j2 that you want to use the SLF4J logger
+log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
\ No newline at end of file
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
new file mode 100644
index 0000000..337c3c2
--- /dev/null
+++ b/src/main/resources/logback.xml
@@ -0,0 +1,76 @@
+
+
+ docus-report-manager
+
+
+
+
+ [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%contextName] [%thread] [%X{traceId}] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+ [%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%X{traceId}] [%L] [%-5p] %m%n
+ utf-8
+
+
+
+
+ ${log.path}%d.%i.log
+
+ 500MB
+
+ 60
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/mapper/CollectTaskMapper.xml b/src/main/resources/mapper/CollectTaskMapper.xml
new file mode 100644
index 0000000..bcb4956
--- /dev/null
+++ b/src/main/resources/mapper/CollectTaskMapper.xml
@@ -0,0 +1,33 @@
+
+
+
+
+ UPDATE `docus_archivefile`.`af_collect_task`
+ SET `state` = '4'
+ WHERE `id` in
+
+ #{id}
+
+
+
+
+
diff --git a/src/main/resources/mapper/ScanAssortMapper.xml b/src/main/resources/mapper/ScanAssortMapper.xml
new file mode 100644
index 0000000..e505cf2
--- /dev/null
+++ b/src/main/resources/mapper/ScanAssortMapper.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+ UPDATE `docus_archivefile`.`t_scan_assort`
+ SET `is_del` = 1
+ WHERE `id` in
+
+ #{id}
+
+
+
+
diff --git a/winsw.exe b/winsw.exe
new file mode 100644
index 0000000..ba27e3f
Binary files /dev/null and b/winsw.exe differ