Browse Source

错误记录 导入报错不提示问题修改 线上环境配置文件

liuchanglan 4 years ago
parent
commit
e828536433

+ 40 - 15
README.md

@@ -7,29 +7,51 @@
 
 ## 2.服务器信息
 
-+ ### Mysql服务器
-    #### 16h32g 500g Centos7.8
-    * ip `66.1.21.157`
-    * 用户名 `root`
-    * 密码 ` Jda!2t456`
-
-+ ### 应用服务器+
-  #### 16h32g 1000g Centos7.8
-    * ip `66.1.21.158`
-    * 用户名 `root`
-    * 密码 ` Jda!2t456`
+ ### Mysql服务器
+   #### 配置:16h32g 500g Centos7.8
+   > ip: `66.1.21.157` \
+   > 用户名: `root` \
+   > 密码: ` Jda!2t456`
+   #### mysql部署说明:
+   > 数据库密码:`0>F8sU*6D` 
+   
+   > 位置: `/data/mysql5.7/` \
+   > 数据库服务命令:`/etc/init.d/mysql restart|start|stop`
+   > 配置文件位置:`/etc/my.cnf` \
 
+   > 备份脚本位置:`vim /data/shell/db_backup.sh` \
+   > 数据库备份:`/data/backup` \
+   > 定时运行脚本:[shell之定时周期性执行脚本](https://blog.csdn.net/zhizhengguan/article/details/88552501)
+   
+   #### redis部署说明:
+   > 密码:`m1At<L=i`
+   
+   > 位置:`/data/redis` \
+   > 配置文件:`/data/redis-5.0.0/redis.conf`
+ ### 应用服务器
+  #### 配置:16h32g 1000g Centos7.8
+   * ip `66.1.21.158`
+   * 用户名 `root`
+   * 密码 ` Jda!2t456`
 
+  #### JAVA8
+  > 位置:`/data/jdk1.8.0_231` \
+  > 项目存放位置:`/data/project` \
+  > 档案文件存放目录:`/data/file/archive_file` \
+  > 其他文件存放目录:`/data/file`
+  
+  > 运行命令 \
+  > `nohup java -jar XXX.jar > out.log 2>&1 &` \
+  > 日志目录:`/data/logs`
 ## 3.配置文件
 ```yaml
 upload-file: #上传文件配置
   server-file-url-prefix: http://127.0.0.1:${server.port} #文件下载地址(一般为本机ip)
-  file-root-directory: E:\cache # 文件存储根目录
+  file-root-directory: E:\cache # 其他文件存储根目录
   archive-file-root-directory: E:\cache\archive # 档案文件根目录
 ```
 
 ## 4.部署命令:
-
 #### docker镜像:
 ```shell
 # 打包
@@ -41,5 +63,8 @@ docker run -d --name guihua_archive \
 -v /home/file:/home/file \
 registry.cn-hangzhou.aliyuncs.com/8473136_guozhi/guihua_archive:20210314  
 ```
-#### 其他
-  
+
+## 5.问题记录
+### 数据导入问题记录(形成日期为空,先填写20190101)后面找到再补
+> 附件:南京NO.2018G46地块(奥特佳项目)规划设计方案 \
+> 关于对建邺区江东中路377号南京金融城一期项目地下室进行确认的复函 

+ 4 - 0
src/main/java/com/gz/GuihuaArchivesApplication.java

@@ -2,7 +2,11 @@ package com.gz;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
+@EnableAsync
+@EnableScheduling
 @SpringBootApplication
 public class GuihuaArchivesApplication {
 

+ 2 - 0
src/main/java/com/gz/common/DataGlobalVariable.java

@@ -34,6 +34,8 @@ public class DataGlobalVariable {
     /** 会计档案 生成档号 FOMAT 全宗号-(目录号)-档案门类代码年度--核算单位代号-(保管期限)-案卷号*/
     public static final String KU_DH_FOMAT = "%s-(%s)-KU%s-%s-(%s)-%s";
 
+
+
     /** 科技档案 生成档号 FOMAT 全宗号-目录号-档案门类代码·属类代码-保管期限-项目代号/设备代号--案卷号*/
     public static final String KJ_DH_FOMAT = "%s-%s-KJ·%s-%s-%s-%s";
 

+ 1 - 0
src/main/java/com/gz/config/MapperScanConfig.java

@@ -5,6 +5,7 @@ import tk.mybatis.spring.annotation.MapperScan;
 
 /**
  * mapper扫描
+ *
  * @author LiuchangLan
  * @date 2020/7/12 19:42
  */

+ 29 - 0
src/main/java/com/gz/config/MountArchiveFileConfig.java

@@ -0,0 +1,29 @@
+package com.gz.config;
+
+import org.springframework.context.annotation.Configuration;
+
+import java.io.File;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * 挂载文件Config
+ * @author LiuchangLan
+ * @date 2021/3/16 13:21
+ */
+@Configuration
+public class MountArchiveFileConfig {
+    // 扫描根目录
+    public static final String scanBasePath = "E:\\cache";
+    // pdf队列
+    public static final LinkedBlockingQueue<File> PDFQueue = new LinkedBlockingQueue<>();
+    // tif队列
+    public static final LinkedBlockingQueue<File> TIFQueue = new LinkedBlockingQueue<>();
+    // 移动文件耗时小 选择newCachedThreadPool线程池
+    public static final ExecutorService executorService = Executors.newCachedThreadPool();
+    // PDF 文件夹包含Key
+    public static final String PDFFolderKey = "PDF";
+    // TIF 文件夹包含Key
+    public static final String TIFFolderKey = "TIF";
+}

+ 41 - 0
src/main/java/com/gz/job/MountArchiveFileJob.java

@@ -0,0 +1,41 @@
+package com.gz.job;
+
+import com.gz.config.MountArchiveFileConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.io.File;
+
+/**
+ * 挂挡文件
+ *
+ * @author LiuchangLan
+ * @date 2021/3/16 13:30
+ */
+@Slf4j
+@Component
+public class MountArchiveFileJob {
+
+    @PostConstruct
+    public void HandelePDFJob() {
+        MyThread thread = new MyThread();
+        thread.start();
+    }
+
+    public class MyThread extends Thread{
+        @Override
+        public void run() {
+            try {
+                final File pdfFolder = MountArchiveFileConfig.PDFQueue.take();
+                MountArchiveFileConfig.executorService.execute(() -> {
+                    System.out.println(pdfFolder.getName());
+                });
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+
+}

+ 41 - 0
src/main/java/com/gz/scheduled/ScanArchiveFileScheduled.java

@@ -0,0 +1,41 @@
+package com.gz.scheduled;
+
+import com.gz.config.MountArchiveFileConfig;
+import com.gz.core.exception.BusinessException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+
+/**
+ * 扫描档案文件定时任务
+ *
+ * @author LiuchangLan
+ * @date 2021/3/16 13:36
+ */
+@Slf4j
+@Component
+public class ScanArchiveFileScheduled {
+
+    @Scheduled(cron = "0/5 * * * * ?")
+    public void startScan() throws InterruptedException {
+        log.debug("开始扫描");
+        File file = new File(MountArchiveFileConfig.scanBasePath);
+        if (!file.exists()) {
+            throw new BusinessException(500, "档案根目录不存在,无法扫描");
+        }
+        for (File yearDirectory : file.listFiles()) {
+            for (File archiveDirectory : yearDirectory.listFiles()) {
+                if (archiveDirectory.getName().contains(MountArchiveFileConfig.PDFFolderKey)) {
+                    MountArchiveFileConfig.PDFQueue.put(archiveDirectory);
+                    log.debug("扫描到PDF文件夹:{},现在队列共有{}", archiveDirectory.getName(), MountArchiveFileConfig.PDFQueue.size());
+                } else if (archiveDirectory.getName().contains(MountArchiveFileConfig.TIFFolderKey)) {
+                    log.debug("扫描到TIF文件夹:{},现在队列共有{}", archiveDirectory.getName(), MountArchiveFileConfig.TIFQueue.size());
+                    MountArchiveFileConfig.TIFQueue.put(archiveDirectory);
+                }
+            }
+
+        }
+    }
+}

+ 5 - 1
src/main/java/com/gz/service/archive/impl/ArchiveServiceImpl.java

@@ -38,6 +38,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.multipart.MultipartFile;
+import sun.plugin2.applet.context.InitialJNLPExecutionContext;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
@@ -257,6 +258,9 @@ public class ArchiveServiceImpl implements ArchiveService {
         List<List<Object>> rows = reader.read();
         List<ArchiveDTO> result = new ArrayList<>();
         for (int i = 1; i < rows.size(); i++) {
+            if (i == 1123){
+                System.out.println(1);
+            }
             try {
                 List<Object> row = rows.get(i);
                 ArchiveDTO dto = new ArchiveDTO();
@@ -304,7 +308,7 @@ public class ArchiveServiceImpl implements ArchiveService {
                 dto.setMj("NABU");
                 result.add(dto);
             } catch (Exception e) {
-                new BusinessException(500, String.format("导入出错,错误位置:{}行,错误原因{}", (i + 1), e.getMessage()));
+                throw new BusinessException(500, String.format("导入出错,错误位置:%s行,错误原因:%s", (i + 1), e.getMessage()));
             }
         }
         stringRedisTemplate.opsForValue().set(request.getSession().getId(), JSONObject.toJSONString(result), 1L, TimeUnit.HOURS);

+ 1 - 0
src/main/java/com/gz/service/system/impl/AuthServiceImpl.java

@@ -199,6 +199,7 @@ public class AuthServiceImpl implements AuthService {
                     tree.setName(treeNode.getTitle());
                     tree.putExtra("href", treeNode.getHref());
                     tree.putExtra("icon", treeNode.getIcon());
+                    tree.putExtra("img", treeNode.getIcon());
                 });
         initialHomeRVO.setMenuInfo(treeNodes);
 

+ 9 - 2
src/main/java/com/gz/utils/ExcelUtils.java

@@ -1,5 +1,7 @@
 package com.gz.utils;
 
+import cn.hutool.core.util.StrUtil;
+
 import java.util.List;
 
 /**
@@ -19,7 +21,7 @@ public class ExcelUtils {
         if (index >= row.size()) {
             return null;
         }
-        return String.valueOf(row.get(index));
+        return String.valueOf(row.get(index)).trim();
     }
 
     /**
@@ -29,7 +31,12 @@ public class ExcelUtils {
      * @since 2021/3/4 14:46
      */
     public static Integer getExcelCellIntegerValue(List<Object> row, int index) {
-        return Integer.valueOf(getExcelCellStringValue(row, index));
+        String str = getExcelCellStringValue(row, index);
+        if (StrUtil.isEmpty(str) || "null".equals(str)){
+            return 0;
+        }else {
+            return Integer.valueOf(getExcelCellStringValue(row, index));
+        }
     }
 
 }

+ 3 - 0
src/main/resources/application-dev.yml

@@ -94,3 +94,6 @@ upload-file:
   server-file-url-prefix: http://127.0.0.1:${server.port}
   file-root-directory: E:\cache
   archive-file-root-directory: E:\cache\archive
+logging:
+  file:
+    path: D:\logs\guihua_archive

+ 99 - 0
src/main/resources/application-prod.yml

@@ -0,0 +1,99 @@
+server:
+  port: 9091
+spring:
+  resources:
+    static-locations: classpath:/static,classpath:/public,classpath:/resources,classpath:/META-INF/resources,file:${upload-file.file-root-directory},file:${upload-file.archive-file-root-directory}
+  # 数据源配置
+  datasource:
+    # 连接池类型
+    type: com.alibaba.druid.pool.DruidDataSource
+    # MYSQL 5 驱动:com.mysql.jdbc.Driver,MYSQL 6+ 驱动:com.mysql.cj.jdbc.Driver
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://66.1.21.157:3306/guihua_archives?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+    username: root
+    password: 0>F8sU*6D
+    # 连接池配置
+    druid:
+      # 初始化大小,最小,最大
+      initial-size: 5
+      min-idle: 5
+      max-active: 20
+      # 配置获取连接等待超时的时间
+      max-wait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位毫秒
+      time-between-eviction-runs-millis: 60000
+      # 配置一个连接在池中最小生存时间
+      min-evictable-idle-time-millis: 300000
+      validation-query: SELECT 1
+      test-while-idle: true
+      test-on-borrow: false
+      test-on-return: false
+      # 打开 PSCache,并且指定每个连接上 PSCache 的大小
+      pool-prepared-statements: true
+      max-pool-prepared-statement-per-connection-size: 20
+      # 配置监控统计拦截的 Filter,去掉后监控界面 SQL 无法统计,wall 用于防火墙
+      filters: stat,wall,log4j
+      # 通过 connection-properties 属性打开 mergeSql 功能;慢 SQL 记录
+      connection-properties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      # 配置 DruidStatFilter
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: .js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*
+      # 配置 DruidStatViewServlet
+      stat-view-servlet:
+        # 开启监控页面
+        enabled: false
+        # 页面地址
+        url-pattern: /druid/*
+        # IP 白名单,没有配置或者为空,则允许所有访问
+        allow: 127.0.0.1
+        # IP 黑名单,若白名单也存在,则优先使用
+        deny: 192.168.31.253
+        # 禁用 HTML 中 Reset All 按钮
+        reset-enable: false
+        # 登录用户名/密码
+        # login-username: admin
+        # login-password: 123456
+  # redis配置
+  redis:
+    # redis地址
+    host: 66.1.21.157
+    # redis端口
+    port: 6379
+    # redis库
+    database: 0
+    jedis:
+      pool:
+        # 连接池最大连接数(使用负值表示没有限制,对应maxTotal)
+        max-active: 50
+        # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: 3000
+        # 连接池中的最大空闲连接
+        max-idle: 20
+        # 连接池中的最小空闲连接
+        min-idle: 2
+    # 密码
+    password: m1At<L=i
+    # 连接超时时间(毫秒)
+    timeout: 30000
+  rabbitmq:
+    host: 47.97.217.112
+    port: 5672
+    username: admin
+    password: admin
+    listener:
+      simple:
+        acknowledge-mode: manual
+        default-requeue-rejected: false #意思是,消息被拒后(即未消费),重新(true)放入队列
+        retry:
+          enabled: true # 是否开启消费者重试(为false时关闭消费者重试,这时消费端代码异常会一直重复收到消息)
+          max-attempts: 5 # 重试次数
+          initial-interval: 5000
+upload-file:
+  server-file-url-prefix: http://66.1.21.158:${server.port}
+  file-root-directory: /data/file/archive_file
+  archive-file-root-directory: /data/file
+logging:
+  file:
+    path: /data/logs

+ 3 - 0
src/main/resources/application-test.yml

@@ -94,3 +94,6 @@ upload-file:
   server-file-url-prefix: http://175.24.29.29:${server.port}
   file-root-directory: /home/archive-file
   archive-file-root-directory: /home/file
+logging:
+  file:
+    path: /data/logs

+ 3 - 1
src/main/resources/application.yml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: dev
+    active: prod
   servlet:
     multipart:
       max-file-size: 5120MB
@@ -34,3 +34,5 @@ rabbitmq:
     queue-message-ttl: -1 #消息存活时间 单位秒 -1 不指定时间
     dlx-queue: DLX_ARCHIVE_OCR_QUEUE
     dlx-queue-binding-key: DLX_ARCHIVE_OCR
+logging:
+  config: classpath:logback-spring.xml

+ 244 - 0
src/main/resources/logback-spring.xml

@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
+<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true -->
+<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
+<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
+<configuration scan="true" scanPeriod="10 seconds">
+
+    <!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
+
+    <contextName>logback</contextName>
+    <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 打包后在项目的更目录生成日志文件-->
+<!--    <property name="log.path" value="${catalina.base}/webapps/ZoomSealEnt/logs"/>-->
+    <springProperty scope="context" name="log.path" source="logging.file.path"/>
+
+    <!-- 彩色日志 -->
+    <!-- 彩色日志依赖的渲染类 -->
+    <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
+    <conversionRule conversionWord="wex"
+                    converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
+    <conversionRule conversionWord="wEx"
+                    converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
+    <!-- 彩色日志格式   [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n  -->
+
+    <property name="CONSOLE_LOG_PATTERN"
+              value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
+
+
+    <!--输出到控制台-->
+    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+        <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>DEBUG</level>
+        </filter>
+        <encoder>
+            <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
+            <!-- 设置字符集 -->
+            <charset>UTF-8</charset>
+        </encoder>
+    </appender>
+
+
+    <!--输出到文件-->
+    <!-- 时间滚动输出 level为 DEBUG 日志 -->
+    <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 正在记录的日志文件的路径及文件名 -->
+        <!--先将今天的日志保存在这个文件中-->
+        <file>${log.path}/log_debug.log</file>
+        <!--日志文件输出格式   %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] - [ %p ]  %m%n
+            %d{HH: mm:ss.SSS}——日志输出时间
+            %thread——输出日志的进程名字,这在Web应用以及异步任务处理中很有用
+            %-5level——日志级别,并且使用5个字符靠左对齐
+            %logger{36}——日志输出者的名字
+            %msg——日志消息
+            %n——平台的换行符
+           -->
+        <encoder>
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+            <charset>UTF-8</charset> <!-- 设置字符集 -->
+        </encoder>
+        <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <!-- rollover daily -->
+            <!--如果第二天输出日志,会将当天的日志记录在<file>${log.path}/log_debug.log</file>,然后将昨天的日志归档到下面的文件中-->
+            <!--以分钟切分  %d{yyyy-MM-dd_HH-mm}-->
+            <fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd_HH-mm}.%i.log</fileNamePattern>
+            <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
+            <!--单个日志文件最大100M,到了这个值,就会再创建一个日志文件,日志文件的名字最后+1-->
+            <maxFileSize>100MB</maxFileSize>
+            <!--日志文件保留天数-->
+            <maxHistory>30</maxHistory>
+            <!--所有的日志文件最大20G,超过就会删除旧的日志-->
+            <totalSizeCap>20GB</totalSizeCap>
+        </rollingPolicy>
+        <!--
+            此日志文件只记录debug级别的
+            onMatch和onMismatch都有三个属性值,分别为Accept、DENY和NEUTRAL
+            onMatch="ACCEPT" 表示匹配该级别及以上
+            onMatch="DENY" 表示不匹配该级别及以上
+            onMatch="NEUTRAL" 表示该级别及以上的,由下一个filter处理,如果当前是最后一个,则表        示匹配该级别及以上
+            onMismatch="ACCEPT" 表示匹配该级别以下
+            onMismatch="NEUTRAL" 表示该级别及以下的,由下一个filter处理,如果当前是最后一个,则不匹配该级别以下的
+            onMismatch="DENY" 表示不匹配该级别以下的
+        -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>debug</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!-- 时间滚动输出 level为 INFO 日志 -->
+    <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 正在记录的日志文件的路径及文件名 -->
+        <file>${log.path}/log_info.log</file>
+        <!--日志文件输出格式-->
+        <encoder>
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <!-- rollover daily -->
+            <!--如果第二天输出日志,会将当天的日志记录在<file>${log.path}/log_debug.log</file>,然后将昨天的日志归档到下面的文件中-->
+            <!--以分钟切分  %d{yyyy-MM-dd_HH-mm}-->
+            <fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
+            <!--单个日志文件最大100M,到了这个值,就会再创建一个日志文件,日志文件的名字最后+1-->
+            <maxFileSize>100MB</maxFileSize>
+            <!--日志文件保留天数-->
+            <maxHistory>30</maxHistory>
+            <!--所有的日志文件最大20G,超过就会删除旧的日志-->
+            <totalSizeCap>20GB</totalSizeCap>
+        </rollingPolicy>
+        <!--SizeAndTimeBasedRollingPolicy配置更灵活,所以改用SizeAndTimeBasedRollingPolicy-->
+        <!--<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            &lt;!&ndash; 每天日志归档路径以及格式 &ndash;&gt;
+            <fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>100MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+            &lt;!&ndash;日志文件保留天数&ndash;&gt;
+            <maxHistory>15</maxHistory>
+        </rollingPolicy>-->
+        <!-- 此日志文件只记录info级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!-- 时间滚动输出 level为 WARN 日志 -->
+    <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 正在记录的日志文件的路径及文件名 -->
+        <file>${log.path}/log_warn.log</file>
+        <!--日志文件输出格式-->
+        <encoder>
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+            <charset>UTF-8</charset> <!-- 此处设置字符集 -->
+        </encoder>
+        <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <!-- rollover daily -->
+            <!--如果第二天输出日志,会将当天的日志记录在<file>${log.path}/log_debug.log</file>,然后将昨天的日志归档到下面的文件中-->
+            <!--以分钟切分  %d{yyyy-MM-dd_HH-mm}-->
+            <fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
+            <!--单个日志文件最大100M,到了这个值,就会再创建一个日志文件,日志文件的名字最后+1-->
+            <maxFileSize>100MB</maxFileSize>
+            <!--日志文件保留天数-->
+            <maxHistory>30</maxHistory>
+            <!--所有的日志文件最大20G,超过就会删除旧的日志-->
+            <totalSizeCap>20GB</totalSizeCap>
+        </rollingPolicy>
+        <!-- 此日志文件只记录warn级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>warn</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+
+    <!-- 时间滚动输出 level为 ERROR 日志 -->
+    <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 正在记录的日志文件的路径及文件名 -->
+        <file>${log.path}/log_error.log</file>
+        <!--日志文件输出格式-->
+        <encoder>
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+            <charset>UTF-8</charset> <!-- 此处设置字符集 -->
+        </encoder>
+        <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <!-- rollover daily -->
+            <!--如果第二天输出日志,会将当天的日志记录在<file>${log.path}/log_debug.log</file>,然后将昨天的日志归档到下面的文件中-->
+            <!--以分钟切分  %d{yyyy-MM-dd_HH-mm}-->
+            <fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
+            <!--单个日志文件最大100M,到了这个值,就会再创建一个日志文件,日志文件的名字最后+1-->
+            <maxFileSize>100MB</maxFileSize>
+            <!--日志文件保留天数-->
+            <maxHistory>30</maxHistory>
+            <!--所有的日志文件最大20G,超过就会删除旧的日志-->
+            <totalSizeCap>20GB</totalSizeCap>
+        </rollingPolicy>
+        <!-- 此日志文件只记录ERROR级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>ERROR</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!--root配置必须在appender下边-->
+    <!--root节点是对所有appender的管理,添加哪个appender就会打印哪个appender的日志-->
+    <!--root节点的level是总的日志级别控制,如果appender的日志级别设定比root的高,会按照appender的日志级别打印日志,-->
+    <!--如果appender的日志级别比root的低,会按照root设定的日志级别进行打印日志-->
+    <!--也就是说root设定的日志级别是最低限制,如果root设定级别为最高ERROR,那么所有appender只能打印最高级别的日志-->
+    <root level="DEBUG">
+        <appender-ref ref="CONSOLE"/>
+        <appender-ref ref="DEBUG_FILE"/>
+        <appender-ref ref="INFO_FILE"/>
+        <appender-ref ref="WARN_FILE"/>
+        <appender-ref ref="ERROR_FILE"/>
+    </root>
+
+    <!--
+    name:用来指定受此loger约束的某一个包或者具体的某一个类。
+    addtivity:是否向上级loger传递打印信息。默认是true。
+    因为mybatis打印的sql日志是debug级别的,如果将所有的debug都打印出来会特别乱,
+    所以特意指定mybatis的日志为debug,其他的为info
+-->
+    <logger name="com.gz.mapper" level="debug" additivity="false">
+        <appender-ref ref="CONSOLE"/>
+    </logger>
+
+    <!--配置多环境日志输出  可以在application.properties中配置选择哪个profiles : spring.profiles.active=dev-->
+    <!--生产环境:输出到文件-->
+    <springProfile name="test">
+        <root level="info">
+            <appender-ref ref="DEBUG_FILE" />
+            <appender-ref ref="INFO_FILE" />
+            <appender-ref ref="ERROR_FILE" />
+            <appender-ref ref="WARN_FILE" />
+        </root>
+    </springProfile>
+    <springProfile name="prod">
+        <root level="info">
+            <appender-ref ref="DEBUG_FILE" />
+            <appender-ref ref="INFO_FILE" />
+            <appender-ref ref="ERROR_FILE" />
+            <appender-ref ref="WARN_FILE" />
+        </root>
+    </springProfile>
+    <!--开发环境:打印控制台-->
+    <springProfile name="dev">
+        <root level="debug">
+            <appender-ref ref="CONSOLE" />
+        </root>
+    </springProfile>
+
+</configuration>

+ 2 - 2
src/main/resources/static/js/lay-module/request/http.js

@@ -3,8 +3,8 @@ layui.define(['jquery', 'layer'], function (exports) {
         layer = layui.layer,
         /** war包 如果有项目名后面填写项目名 没有项目名就去除(没有项目名需要保留斜杠)*/
             // requestUrl = window.location.origin + '/archives/';
-        // host = window.location.host,
-        host = '192.168.0.114:9091',
+        host = window.location.host,
+        // host = '192.168.0.114:9091',
         requestUrl = 'http://' + host + '/';
 
     let ajax = function (method, type, data, async, callback) {

+ 3 - 3
src/main/resources/static/login.html

@@ -127,17 +127,17 @@
                 <div class="layui-form-item">
                     <label class="layui-icon layui-icon-username"></label>
                     <input type="text" name="account" lay-verify="required|account" placeholder="用户名或者邮箱"
-                           autocomplete="off" class="layui-input" value="liuchanglan">
+                           autocomplete="off" class="layui-input" value="">
                 </div>
                 <div class="layui-form-item">
                     <label class="layui-icon layui-icon-password"></label>
                     <input type="password" name="password" lay-verify="required|password" placeholder="密码"
-                           autocomplete="off" class="layui-input" value="123456">
+                           autocomplete="off" class="layui-input" value="">
                 </div>
                 <div class="layui-form-item">
                     <label class="layui-icon layui-icon-vercode"></label>
                     <input type="text" name="captcha" lay-verify="required|captcha" placeholder="图形验证码"
-                           autocomplete="off" class="layui-input verification captcha" value="a">
+                           autocomplete="off" class="layui-input verification captcha" value="">
                     <div class="captcha-img" style="cursor:pointer">
                         <img id="captchaPic">
                     </div>

+ 2 - 0
src/main/resources/static/page/archive/import.html

@@ -150,6 +150,8 @@
                                 , {field: 'zrz', title: '责任者', width: 120}
                             ]]
                         });
+                    }else {
+                        layer.msg(res.msg)
                     }
                 }
             });

+ 75 - 0
src/test/java/com/gz/CopyFIle.java

@@ -0,0 +1,75 @@
+package com.gz;
+
+import com.gz.core.exception.BusinessException;
+import lombok.extern.slf4j.Slf4j;
+import sun.java2d.opengl.OGLContext;
+
+import java.io.File;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * @author LiuchangLan
+ * @date 2021/3/15 16:24
+ */
+@Slf4j
+public class CopyFIle {
+
+    public static final LinkedBlockingQueue<File> PDFQueue = new LinkedBlockingQueue<>();
+    public static final LinkedBlockingQueue<File> TIFQueue = new LinkedBlockingQueue<>();
+
+
+    public static final ExecutorService executorService = Executors.newCachedThreadPool();
+
+    private final static String basePath = "E:\\cache";
+
+    private final static String TIF_TYPE = "TIF";
+
+    private final static String PDF_TYPE = "PDF";
+
+    public static void main(String[] args) throws InterruptedException {
+        init();
+        handlePDF();
+        handleTIF();
+    }
+
+    private static void init() throws InterruptedException {
+        File file = new File(basePath);
+        if (!file.exists()) {
+            throw new BusinessException(500, "目录文件不存在");
+        }
+        for (File yearDirectory : file.listFiles()) {
+            for (File archiveDirectory : yearDirectory.listFiles()) {
+                if (archiveDirectory.getName().contains(PDF_TYPE)){
+                    PDFQueue.put(archiveDirectory);
+                }else if (archiveDirectory.getName().contains(TIF_TYPE)){
+                    TIFQueue.put(archiveDirectory);
+                }
+            }
+        }
+    }
+
+    private static void handlePDF(){
+        executorService.execute(() -> {
+            try {
+                System.out.println(TIFQueue.take().getName());
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        });
+    }
+
+    private static void handleTIF(){
+        executorService.execute(() -> {
+            try {
+                System.out.println(PDFQueue.take().getName());
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        });
+    }
+
+
+
+}