2 Commits ced030f9ce ... 6e257b11f8

Author SHA1 Message Date
  liuchanglan 6e257b11f8 高级查询新增 大于等于 和 小于等于两个判断条件 4 years ago
  liuchanglan 1b091f6b1d 修改消息队列 发送 4 years ago
29 changed files with 560 additions and 172 deletions
  1. 2 1
      README.md
  2. BIN
      jdk-8u231-linux-x64.tar.gz
  3. 12 0
      pom.xml
  4. 1 0
      src/main/java/com/gz/GuihuaArchivesApplication.java
  5. 12 0
      src/main/java/com/gz/common/DataGlobalVariable.java
  6. 35 35
      src/main/java/com/gz/consumer/OcrConsumer.java
  7. 3 0
      src/main/java/com/gz/dto/archive/ArchiveDTO.java
  8. 64 11
      src/main/java/com/gz/job/MountArchiveFileJob.java
  9. 4 0
      src/main/java/com/gz/mapper/archive/ArchiveMapper.java
  10. 8 0
      src/main/java/com/gz/mapper/statistics/SelectStatisticsMapper.java
  11. 1 1
      src/main/java/com/gz/scheduled/ScanArchiveFileScheduled.java
  12. 2 1
      src/main/java/com/gz/service/archive/impl/ArchiveFileServiceImpl.java
  13. 65 47
      src/main/java/com/gz/service/archive/impl/ArchiveServiceImpl.java
  14. 66 45
      src/main/java/com/gz/service/statistics/impl/SelectStatisticsServiceImpl.java
  15. 15 3
      src/main/java/com/gz/service/system/impl/AdminServiceImpl.java
  16. 3 2
      src/main/java/com/gz/vo/archive/SearchArchiveVO.java
  17. 2 1
      src/main/java/com/gz/vo/rabbitmq/OcrEtlVO.java
  18. 32 5
      src/main/resources/application-dev.yml
  19. 29 2
      src/main/resources/application-prod.yml
  20. 1 3
      src/main/resources/application.yml
  21. 16 0
      src/main/resources/elasticsearch/archive.xml
  22. 29 0
      src/main/resources/mapper/archiveMapper.xml
  23. 0 1
      src/main/resources/static/index.html
  24. 12 4
      src/main/resources/static/page/archive/advancedSearch.html
  25. 3 2
      src/main/resources/static/page/archive/edit.html
  26. 11 5
      src/main/resources/static/page/archive/list.html
  27. 3 3
      src/main/resources/static/page/borrow/list.html
  28. 34 0
      src/test/java/com/gz/ESTest.java
  29. 95 0
      src/test/java/com/gz/OcrTest.java

+ 2 - 1
README.md

@@ -51,7 +51,8 @@ ______
 > * 日志目录:`/data/logs`
 > 
 > #### RabbitMQ
-> * 
+> * 使用docker安装
+> *
 
 ______
 

BIN
jdk-8u231-linux-x64.tar.gz


+ 12 - 0
pom.xml

@@ -30,6 +30,7 @@
         <aliyun.sdk.version>4.5.3</aliyun.sdk.version>
         <aliyun.oss.sdk.version>3.10.2</aliyun.oss.sdk.version>
         <poi.version>4.1.2</poi.version>
+        <bboss.elasticsearch.version>6.2.2</bboss.elasticsearch.version>
         <!-- 跳过打包测试 -->
         <skipTests>true</skipTests>
     </properties>
@@ -137,6 +138,17 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        <!--        bboss-->
+        <dependency>
+            <groupId>com.bbossgroups.plugins</groupId>
+            <artifactId>bboss-elasticsearch-rest-jdbc</artifactId>
+            <version>${bboss.elasticsearch.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.bbossgroups.plugins</groupId>
+            <artifactId>bboss-elasticsearch-spring-boot-starter</artifactId>
+            <version>${bboss.elasticsearch.version}</version>
+        </dependency>
     </dependencies>
 
     <build>

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

@@ -2,6 +2,7 @@ package com.gz;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 

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

@@ -1,5 +1,7 @@
 package com.gz.common;
 
+import java.util.concurrent.TimeUnit;
+
 /**
  * 全局常量
  * @author LiuchangLan
@@ -81,4 +83,14 @@ public class DataGlobalVariable {
 
     /** ---------------------统计相关 ------------------------*/
     public static final String STATISTICS_ML_CODE_KEY_FOMAT = "STATISTICS_CODE_%s";
+    /** 统计缓存时间*/
+    public static final Long CACHE_EXPIRES = 30L;
+
+    /** 缓存时间单位*/
+    public static final TimeUnit TIME_UNIT = TimeUnit.MINUTES;
+
+    /** 缓存key 类名:方法名:参数*/
+    public static final String CACHE_KEY_FOMAT = "%s:%s:%s";
+
+
 }

+ 35 - 35
src/main/java/com/gz/consumer/OcrConsumer.java

@@ -1,35 +1,35 @@
-package com.gz.consumer;
-
-import com.rabbitmq.client.Channel;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.rabbit.annotation.RabbitHandler;
-import org.springframework.amqp.rabbit.annotation.RabbitListener;
-import org.springframework.amqp.support.AmqpHeaders;
-import org.springframework.messaging.handler.annotation.Header;
-import org.springframework.stereotype.Component;
-
-import java.io.IOException;
-
-/**
- * 消费者监听
- * @author LiuchangLan
- * @date 2021/3/9 9:37
- */
-//@Component
-@Slf4j
-@RabbitListener(queues = "${rabbitmq.ocr.queue}")
-public class OcrConsumer {
-
-    @RabbitHandler
-    public void process(String message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws IOException {
-        try {
-            System.out.println(message);
-            // 确认消费
-            channel.basicAck(tag, false);
-        } catch (Exception e) {
-            e.printStackTrace();
-            // 拒绝消费
-            channel.basicReject(tag, false);
-        }
-    }
-}
+//package com.gz.consumer;
+//
+//import com.rabbitmq.client.Channel;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
+//import org.springframework.amqp.rabbit.annotation.RabbitListener;
+//import org.springframework.amqp.support.AmqpHeaders;
+//import org.springframework.messaging.handler.annotation.Header;
+//import org.springframework.stereotype.Component;
+//
+//import java.io.IOException;
+//
+///**
+// * 消费者监听
+// * @author LiuchangLan
+// * @date 2021/3/9 9:37
+// */
+////@Component
+//@Slf4j
+//@RabbitListener(queues = "${rabbitmq.ocr.queue}")
+//public class OcrConsumer {
+//
+//    @RabbitHandler
+//    public void process(String message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws IOException {
+//        try {
+//            System.out.println(message);
+//            // 确认消费
+//            channel.basicAck(tag, false);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//            // 拒绝消费
+//            channel.basicReject(tag, false);
+//        }
+//    }
+//}

+ 3 - 0
src/main/java/com/gz/dto/archive/ArchiveDTO.java

@@ -113,4 +113,7 @@ public class ArchiveDTO extends BaseDTO {
 
     // 全文标识
     private String qwbs;
+
+    // 现地籍号
+    private String xdjh;
 }

+ 64 - 11
src/main/java/com/gz/job/MountArchiveFileJob.java

@@ -1,9 +1,11 @@
 package com.gz.job;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.ReUtil;
+import com.alibaba.fastjson.JSON;
 import com.gz.config.FileUploadConfig;
 import com.gz.config.MountArchiveFileConfig;
 import com.gz.core.exception.BusinessException;
@@ -16,13 +18,20 @@ import com.gz.mapper.archive.ArchiveFileMapper;
 import com.gz.mapper.archive.ArchiveMapper;
 import com.gz.mapper.archive.SecondaryArchiveMapper;
 import com.gz.mapper.system.ArchivesTreeMapper;
+import com.gz.rvo.archive.ArchiveRVO;
+import com.gz.vo.rabbitmq.OcrEtlVO;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
+import tk.mybatis.mapper.entity.Example;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.io.File;
+import java.util.List;
 
 /**
  * 挂挡文件
@@ -49,6 +58,18 @@ public class MountArchiveFileJob {
     @Resource
     private StringRedisTemplate stringRedisTemplate;
 
+    @Value("${upload-file.server-file-url-prefix}")
+    private String serverFileUrlPrefix;
+
+    @Value("${rabbitmq.data-exchange}")
+    private String dataExchangeName;
+
+    @Value("${rabbitmq.ocr.queue-binding-key}")
+    private String ocrBindingKey;
+
+    @Autowired
+    private RabbitTemplate rabbitTemplate;
+
     @PostConstruct
     public void handelPDFJob() {
         log.info("[归档任务]初始化PDF文件归档任务线程");
@@ -69,31 +90,34 @@ public class MountArchiveFileJob {
                             key = String.format(MountArchiveFileConfig.ARCHIVE_FILE_MOUNT_ERROR_FOMAT, pdf.getName());
                             // 判断是否在错误队列 错误队列跳过
                             if (!stringRedisTemplate.hasKey(key)) {
-                                ArchiveDTO archiveDTO = new ArchiveDTO();
+                                // 案卷dto
+                                ArchiveRVO archiveRVO = new ArchiveRVO();
+                                // 卷内目录dto
                                 SecondaryArchiveDTO secondaryArchiveDTO = new SecondaryArchiveDTO();
                                 // 专业档案卷内目录 档号正则
                                 if (ReUtil.isMatch(MountArchiveFileConfig.ZY_DH_RE, dh)) {
                                     secondaryArchiveDTO.setDh(dh);
                                     secondaryArchiveDTO = secondaryArchiveMapper.selectOne(secondaryArchiveDTO);
-                                    archiveDTO = archiveMapper.selectByPrimaryKey(secondaryArchiveDTO.getArchiveId());
+                                    archiveRVO = archiveMapper.selectByPk(secondaryArchiveDTO.getArchiveId());
                                 } else {
-                                    archiveDTO.setDh(dh);
-                                    archiveDTO = archiveMapper.selectOne(archiveDTO);
+                                    archiveRVO.setDh(dh);
+                                    archiveRVO = archiveMapper.selectByDh(archiveRVO.getDh());
+
                                 }
-                                if (archiveDTO == null) {
+                                if (archiveRVO == null) {
                                     throw new BusinessException(CustomExceptionEnum.ARCHIVE_DATA_NOT_EXISTS);
                                 }
-                                ArchivesTreeDTO parentMl = archivesTreeMapper.selectParentByCode(archiveDTO.getMl());
-                                String mlDirectory = (parentMl == null) ? archiveDTO.getMl() : parentMl.getCode() + "/" + archiveDTO.getMl();
-                                String finallyPath = "/" + archiveDTO.getQzh() + "/" + archiveDTO.getGdnd() + "/" + mlDirectory + "/" + archiveDTO.getBgqx() + "/" + archiveDTO.getDh() + "/pdf/";
-                                FileUtil.copy(pdf, new File(FileUploadConfig.ARCHIVE_FILE_ROOT_DIRECTORY + finallyPath + name), false);
+                                ArchivesTreeDTO parentMl = archivesTreeMapper.selectParentByCode(archiveRVO.getMl());
+                                String mlDirectory = (parentMl == null) ? archiveRVO.getMl() : parentMl.getCode() + "/" + archiveRVO.getMl();
+                                String finallyPath = "/" + archiveRVO.getQzh() + "/" + archiveRVO.getGdnd() + "/" + mlDirectory + "/" + archiveRVO.getBgqx() + "/" + archiveRVO.getDh() + "/pdf/";
+                                FileUtil.copy(pdf, new File(FileUploadConfig.ARCHIVE_FILE_ROOT_DIRECTORY + finallyPath + name), true);
                                 log.debug("复制文件:[{}]成功", name);
                                 // 删除扫描成功文件
                                 if (!FileUtil.del(pdf)) {
                                     throw new BusinessException(CustomExceptionEnum.DEL_ORIGINAL_FILE_ERROR);
                                 }
                                 ArchiveFileDTO archiveFileDTO = new ArchiveFileDTO();
-                                archiveFileDTO.setArchiveId(archiveDTO.getId());
+                                archiveFileDTO.setArchiveId(archiveRVO.getId());
                                 if (ObjectUtil.isNotNull(secondaryArchiveDTO)) {
                                     archiveFileDTO.setSecondaryArchiveId(secondaryArchiveDTO.getId());
                                 }
@@ -102,8 +126,19 @@ public class MountArchiveFileJob {
                                 archiveFileDTO.setFileSize(FileUtil.size(pdf));
                                 archiveFileDTO.setFilePath(finallyPath);
                                 archiveFileDTO.setFileType(0);
-                                archiveFileMapper.insertSelective(archiveFileDTO);
+                                if (archiveFileMapper.selectOne(archiveFileDTO) == null) {
+                                    archiveFileMapper.insertSelective(archiveFileDTO);
+                                } else {
+                                    log.info("有文件记录跳过");
+                                }
                                 // TODO: 2021/3/17 发送rabbitmq 队列消息
+                                if (ObjectUtil.isNotNull(archiveRVO)) {
+                                    OcrEtlVO ocrBean = BeanUtil.copyProperties(archiveRVO, OcrEtlVO.class);
+                                    ocrBean.setFileUrl(serverFileUrlPrefix + archiveFileDTO.getFilePath() + "/" + archiveFileDTO.getFileName());
+                                    ocrBean.setSecondaryArchiveId(secondaryArchiveDTO.getId());
+                                    log.info("【ocr识别】发起识别队列,参数[{}]", JSON.toJSONString(ocrBean));
+                                    rabbitTemplate.convertAndSend(dataExchangeName, ocrBindingKey, JSON.toJSONString(ocrBean));
+                                }
                             }
                         } catch (Exception e) {
                             log.error("挂载出现错误:", e);
@@ -119,4 +154,22 @@ public class MountArchiveFileJob {
             }
         }).start();
     }
+
+//    @PostConstruct
+    public void testOcr(){
+        // TODO: 2021/5/7 提交已经归档但是未ocr识别的历史数据进行ocr识别
+        Example example = new Example(ArchiveFileDTO.class);
+        example.setOrderByClause("id ASC");
+        List<ArchiveFileDTO> archiveFileDTOS = archiveFileMapper.selectByExample(example);
+        for (int i = 0; i < archiveFileDTOS.size(); i++) {
+            ArchiveFileDTO archiveFileDTO = archiveFileDTOS.get(i);
+            ArchiveRVO archiveRVO = archiveMapper.selectByPk(archiveFileDTO.getArchiveId());
+            OcrEtlVO ocrBean = BeanUtil.copyProperties(archiveRVO, OcrEtlVO.class);
+            ocrBean.setSecondaryArchiveId(archiveFileDTO.getSecondaryArchiveId());
+            ocrBean.setFileUrl(serverFileUrlPrefix + archiveFileDTO.getFilePath() + "/" + archiveFileDTO.getFileName());
+            log.info("【ocr识别】发起识别队列,参数[{}]", JSON.toJSONString(ocrBean));
+            rabbitTemplate.convertAndSend(dataExchangeName, ocrBindingKey, JSON.toJSONString(ocrBean));
+        }
+        log.info("发送完成");
+    }
 }

+ 4 - 0
src/main/java/com/gz/mapper/archive/ArchiveMapper.java

@@ -22,6 +22,10 @@ public interface ArchiveMapper extends Mapper<ArchiveDTO> {
 
     List<ArchiveRVO> againSearchList(AgainSearchVO vo);
 
+    ArchiveRVO selectByPk(Integer id);
+
+    ArchiveRVO selectByDh(String dh);
+
     /**
      * @description 查询当前件号
      * @author LiuChangLan

+ 8 - 0
src/main/java/com/gz/mapper/statistics/SelectStatisticsMapper.java

@@ -5,16 +5,24 @@ import com.gz.rvo.statistics.ArchiveStatisticsRVO;
 import com.gz.rvo.statistics.ArchiveYearStatisticsRVO;
 import com.gz.rvo.statistics.BorrowStatisticsRVO;
 import com.gz.vo.statistics.StatisticsVO;
+import org.apache.ibatis.annotations.CacheNamespace;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.springframework.cache.annotation.CacheConfig;
+import org.springframework.cache.annotation.Cacheable;
 
 import java.util.List;
 
+@CacheConfig(cacheNames = "SelectStatisticsMapper")
+@CacheNamespace
 public interface SelectStatisticsMapper{
 
+    @Cacheable(key ="#p0")
     List<ArchiveStatisticsRVO> selectArchiveStatistics(StatisticsVO vo);
 
+    @Cacheable(key ="#p0")
     List<ArchiveYearStatisticsRVO> selectArchiveYearStatistics(StatisticsVO vo);
 
+    @Cacheable(key ="#p0")
     List<BorrowStatisticsRVO> selectBorrowStatistics(StatisticsVO vo);
 }

+ 1 - 1
src/main/java/com/gz/scheduled/ScanArchiveFileScheduled.java

@@ -5,10 +5,10 @@ import cn.hutool.core.util.StrUtil;
 import com.gz.config.MountArchiveFileConfig;
 import com.gz.core.exception.BusinessException;
 import lombok.extern.slf4j.Slf4j;
+import org.frameworkset.spi.annotations.Component;
 import org.springframework.context.annotation.Profile;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
 import java.io.File;

+ 2 - 1
src/main/java/com/gz/service/archive/impl/ArchiveFileServiceImpl.java

@@ -16,6 +16,7 @@ import com.gz.mapper.archive.ArchiveFileMapper;
 import com.gz.mapper.archive.ArchiveMapper;
 import com.gz.mapper.system.MenuRoleMapper;
 import com.gz.rvo.archive.ArchiveFileRVO;
+import com.gz.rvo.archive.ArchiveRVO;
 import com.gz.service.archive.ArchiveFileService;
 import com.gz.utils.JwtUtils;
 import com.gz.vo.archive.SearchArchiveFileVO;
@@ -134,7 +135,7 @@ public class ArchiveFileServiceImpl implements ArchiveFileService {
 
 
         if (fileType == 0) {
-            ArchiveDTO d = archiveMapper.selectByPrimaryKey(archiveFileDTO.getArchiveId());
+            ArchiveRVO d = archiveMapper.selectByPk(archiveFileDTO.getArchiveId());
             OcrEtlVO ocrEtlVO = BeanUtil.copyProperties(d, OcrEtlVO.class);
             ocrEtlVO.setSecondaryArchiveId(secondaryArchiveId);
             ocrEtlVO.setFileUrl(serverFileUrlPrefix + archiveFileDTO.getFilePath() + "/" + archiveFileDTO.getFileName());

+ 65 - 47
src/main/java/com/gz/service/archive/impl/ArchiveServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.exceptions.ExceptionUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.poi.excel.ExcelReader;
 import cn.hutool.poi.excel.ExcelUtil;
@@ -37,6 +38,10 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.ibatis.mapping.BoundSql;
 import org.apache.ibatis.mapping.ParameterMapping;
 import org.apache.ibatis.session.SqlSessionFactory;
+import org.frameworkset.elasticsearch.ElasticSearchHelper;
+import org.frameworkset.elasticsearch.boot.BBossESStarter;
+import org.frameworkset.elasticsearch.client.ClientInterface;
+import org.frameworkset.elasticsearch.entity.ESDatas;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
@@ -105,60 +110,68 @@ public class ArchiveServiceImpl implements ArchiveService {
         return mapper.selectRoleAll(JwtUtils.getCurrentUserJwtPayload().getRoleId());
     }
 
+    @Resource
+    private BBossESStarter bbossESStarter;
+
     @Override
     public PageInfo<ArchiveRVO> selectByPage(SearchArchiveVO vo) {
-        PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
-        vo.setRoleId(JwtUtils.getCurrentUserJwtPayload().getRoleId());
-        Map<String, Object> params = vo.getParams();
-        String sql = "";
-        if (params != null) {
-            if (StrUtil.isNotEmpty(String.valueOf(params.get("time")))) {
-                String[] times = String.valueOf(params.get("time")).split(" - ");
-                sql += "AND (a.create_time BETWEEN '" + times[0] + "'" + " AND '" + times[1] + "')";
-            }
-            for (int i = 1; i <= 10; i++) {
-                if (params.get("field_" + i) == null) {
-                    continue;
-                }
-                if (i == 1) {
-                    sql += "and ";
-                } else {
-                    sql += params.get("join_" + i) + " ";
+        PageInfo<ArchiveRVO> result = new PageInfo<>();
+        if (StrUtil.isNotEmpty(vo.getAllDocument()) && "on".equals(vo.getAllDocument())) {
+            ClientInterface restClient = ElasticSearchHelper.getConfigRestClientUtil("elasticsearch/archive.xml");
+            ESDatas<ArchiveRVO> mapESDatas = restClient.searchList("/hp_es/_doc/_search", "query", vo, ArchiveRVO.class);
+            result = new PageInfo<>(mapESDatas.getDatas());
+            result.setTotal(mapESDatas.getTotalSize());
+        } else {
+            PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
+            vo.setRoleId(JwtUtils.getCurrentUserJwtPayload().getRoleId());
+            Map<String, Object> params = vo.getParams();
+            String sql = "";
+            if (params != null) {
+                if (StrUtil.isNotEmpty(String.valueOf(params.get("time")))) {
+                    String[] times = String.valueOf(params.get("time")).split(" - ");
+                    sql += "AND (a.create_time BETWEEN '" + times[0] + "'" + " AND '" + times[1] + "')";
                 }
-                sql += params.get("field_" + i);
-                if ("like".equals(params.get("condition_" + i))) {
-                    sql += " like" + " '%" + params.get("variable_" + i) + "%'";
-                } else {
-                    sql += "" + params.get("condition_" + i) + " '" + params.get("variable_" + i) + "' ";
+                for (int i = 1; i <= 10; i++) {
+                    if (params.get("field_" + i) == null) {
+                        continue;
+                    }
+                    if (i == 1) {
+                        sql += "and ";
+                    } else {
+                        sql += params.get("join_" + i) + " ";
+                    }
+                    sql += params.get("field_" + i);
+                    if ("like".equals(params.get("condition_" + i))) {
+                        sql += " like" + " '%" + params.get("variable_" + i) + "%'";
+                    } else {
+                        sql += "" + params.get("condition_" + i) + " '" + params.get("variable_" + i) + "' ";
+                    }
                 }
             }
+            HttpSession session = request.getSession();
+            vo.setSql(sql);
+            String searchSql = null;
+            if (vo.isAgain()) {
+                // 读取上一次执行的sql
+                String searchArchiveSql = String.valueOf(session.getAttribute(DataGlobalVariable.SEARCH_SQL_KEY));
+                // 封装二次搜索条件
+                AgainSearchVO againSearchVO = BeanUtil.copyProperties(vo, AgainSearchVO.class);
+                // 存入条件
+                againSearchVO.setSearchSql(searchArchiveSql);
+                result = new PageInfo<>(mapper.againSearchList(againSearchVO));
+                // 结果中检索
+                searchSql = getSql("com.gz.mapper.archive.ArchiveMapper.againSearchList", againSearchVO);
+            } else {
+                // 正常检索
+                searchSql = getSql("com.gz.mapper.archive.ArchiveMapper.searchList", vo);
+                result = new PageInfo<>(mapper.searchList(vo));
+            }
+            log.debug("本次检索sql:{}", searchSql);
+            // 缓存本次执行的sql
+            session.setAttribute(DataGlobalVariable.SEARCH_SQL_KEY, searchSql);
         }
-        HttpSession session = request.getSession();
-        vo.setSql(sql);
-        PageInfo<ArchiveRVO> result = new PageInfo<>();
-        String searchSql = null;
-        if (vo.isAgain()) {
-            // 读取上一次执行的sql
-            String searchArchiveSql = String.valueOf(session.getAttribute(DataGlobalVariable.SEARCH_SQL_KEY));
-            // 封装二次搜索条件
-            AgainSearchVO againSearchVO = BeanUtil.copyProperties(vo, AgainSearchVO.class);
-            // 存入条件
-            againSearchVO.setSearchSql(searchArchiveSql);
-            result = new PageInfo<>(mapper.againSearchList(againSearchVO));
-            // 结果中检索
-            searchSql = getSql("com.gz.mapper.archive.ArchiveMapper.againSearchList", againSearchVO);
-        } else {
-            // 正常检索
-            searchSql = getSql("com.gz.mapper.archive.ArchiveMapper.searchList", vo);
-            result = new PageInfo<>(mapper.searchList(vo));
-        }
-        log.debug("本次检索sql:{}", searchSql);
-        // 缓存本次执行的sql
-        session.setAttribute(DataGlobalVariable.SEARCH_SQL_KEY, searchSql);
         return result;
-
     }
-
     private String getSql(String javaMethodAddress, Object param) {
         Map<String, Object> stringObjectMap = ObjectUtils.objToMap(param);
         BoundSql boundSql = sqlSessionFactory.getConfiguration()
@@ -336,6 +349,8 @@ public class ArchiveServiceImpl implements ArchiveService {
                 dto.setZtc(ExcelUtils.getExcelCellStringValue(row, 26));
                 dto.setQwbs(ExcelUtils.getExcelCellStringValue(row, 27));
                 dto.setMlh(ExcelUtils.getExcelCellStringValue(row, 28));
+                dto.setYs(ExcelUtils.getExcelCellIntegerValue(row, 31));
+                dto.setXdjh(ExcelUtils.getExcelCellStringValue(row, 32));
 //                dto.setMj("NABU");
                 result.add(dto);
             } catch (Exception e) {
@@ -374,7 +389,10 @@ public class ArchiveServiceImpl implements ArchiveService {
                 // 日期
                 if (StrUtil.isEmpty(ExcelUtils.getExcelCellStringValue(row, 5))) {
                     dto.setRq("");
-                } else {
+                } else if (ExcelUtils.getExcelCellStringValue(row, 5).length() == 6) {
+                    DateTime rq = DateUtil.parse(ExcelUtils.getExcelCellStringValue(row, 5), "yyyyMM");
+                    dto.setRq(DateUtil.formatDate(rq));
+                } else if (ExcelUtils.getExcelCellStringValue(row, 5).length() == 8) {
                     DateTime rq = DateUtil.parse(ExcelUtils.getExcelCellStringValue(row, 5), "yyyyMMdd");
                     dto.setRq(DateUtil.formatDate(rq));
                 }

+ 66 - 45
src/main/java/com/gz/service/statistics/impl/SelectStatisticsServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.lang.tree.Tree;
 import cn.hutool.core.lang.tree.TreeNodeConfig;
 import cn.hutool.core.lang.tree.TreeUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.gz.common.DataGlobalVariable;
 import com.gz.dto.borrow.ArchiveBorrowDTO;
@@ -60,54 +61,74 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
 
     @Override
     public List<ArchiveStatisticsRVO> selectStatisticsByType(StatisticsVO vo) {
-        if (vo.getMl() != null) {
-            vo.setMlCodes(getMl(vo.getMl()));
-        }
-        if (!StringUtils.isEmpty(vo.getTime())) {
-            vo.setStartTime(vo.getTime().split(" - ")[0]);
-            vo.setEndTime(vo.getTime().split(" - ")[1]);
-        }
-        // 统计结果
-        List<ArchiveStatisticsRVO> tree = selectStatisticsMapper.selectArchiveStatistics(vo);
-        tree.forEach(e -> {
-            if (e.getParentId() == -1) {
-                for (ArchiveStatisticsRVO node : tree) {
-                    Integer archiveCount = 0;
-                    Integer fileCount = 0;
-                    if (e.getId().equals(node.getParentId())) {
-                        archiveCount += node.getArchiveCount();
-                        fileCount += node.getFileCount();
+        String key = String.format(DataGlobalVariable.CACHE_KEY_FOMAT, this.getClass().getName(), Thread.currentThread().getStackTrace()[1].getMethodName(), JSONObject.toJSONString(vo));
+        if (stringRedisTemplate.hasKey(key)) {
+            return JSONArray.parseArray(stringRedisTemplate.opsForValue().get(key), ArchiveStatisticsRVO.class);
+        } else {
+            if (vo.getMl() != null) {
+                vo.setMlCodes(getMl(vo.getMl()));
+            }
+            if (!StringUtils.isEmpty(vo.getTime())) {
+                vo.setStartTime(vo.getTime().split(" - ")[0]);
+                vo.setEndTime(vo.getTime().split(" - ")[1]);
+            }
+            // 统计结果
+            List<ArchiveStatisticsRVO> tree = selectStatisticsMapper.selectArchiveStatistics(vo);
+            tree.forEach(e -> {
+                if (e.getParentId() == -1) {
+                    for (ArchiveStatisticsRVO node : tree) {
+                        Integer archiveCount = 0;
+                        Integer fileCount = 0;
+                        if (e.getId().equals(node.getParentId())) {
+                            archiveCount += node.getArchiveCount();
+                            fileCount += node.getFileCount();
+                        }
+                        e.setArchiveCount(e.getArchiveCount() + archiveCount);
+                        e.setFileCount(e.getFileCount() + fileCount);
                     }
-                    e.setArchiveCount(e.getArchiveCount() + archiveCount);
-                    e.setFileCount(e.getFileCount() + fileCount);
                 }
-            }
-        });
-        return tree;
+            });
+            stringRedisTemplate.opsForValue().set(key, JSONObject.toJSONString(tree), DataGlobalVariable.CACHE_EXPIRES, DataGlobalVariable.TIME_UNIT);
+            return tree;
+        }
     }
 
     @Override
     public List<ArchiveYearStatisticsRVO> selectArchiveYearStatistics(StatisticsVO vo) {
-        if (vo.getMl() != null) {
-            vo.setMlCodes(getMl(vo.getMl()));
-        }
-        if (!StringUtils.isEmpty(vo.getTime())) {
-            vo.setStartTime(vo.getTime().split(" - ")[0]);
-            vo.setEndTime(vo.getTime().split(" - ")[1]);
+        String key = String.format(DataGlobalVariable.CACHE_KEY_FOMAT, this.getClass().getName(), Thread.currentThread().getStackTrace()[1].getMethodName(), JSONObject.toJSONString(vo));
+        if (stringRedisTemplate.hasKey(key)) {
+            return JSONArray.parseArray(stringRedisTemplate.opsForValue().get(key), ArchiveYearStatisticsRVO.class);
+        } else {
+            if (vo.getMl() != null) {
+                vo.setMlCodes(getMl(vo.getMl()));
+            }
+            if (!StringUtils.isEmpty(vo.getTime())) {
+                vo.setStartTime(vo.getTime().split(" - ")[0]);
+                vo.setEndTime(vo.getTime().split(" - ")[1]);
+            }
+            List<ArchiveYearStatisticsRVO> archiveYearStatisticsRVOS = selectStatisticsMapper.selectArchiveYearStatistics(vo);
+            stringRedisTemplate.opsForValue().set(key, JSONObject.toJSONString(archiveYearStatisticsRVOS), DataGlobalVariable.CACHE_EXPIRES, DataGlobalVariable.TIME_UNIT);
+            return archiveYearStatisticsRVOS;
         }
-        return selectStatisticsMapper.selectArchiveYearStatistics(vo);
     }
 
     @Override
     public List<BorrowStatisticsRVO> selectBorrowStatistics(StatisticsVO vo) {
-        if (vo.getMl() != null) {
-            vo.setMlCodes(getMl(vo.getMl()));
-        }
-        if (!StringUtils.isEmpty(vo.getTime())) {
-            vo.setStartTime(vo.getTime().split(" - ")[0]);
-            vo.setEndTime(vo.getTime().split(" - ")[1]);
+        String key = String.format(DataGlobalVariable.CACHE_KEY_FOMAT, this.getClass().getName(), Thread.currentThread().getStackTrace()[1].getMethodName(), JSONObject.toJSONString(vo));
+        if (stringRedisTemplate.hasKey(key)) {
+            return JSONArray.parseArray(stringRedisTemplate.opsForValue().get(key), BorrowStatisticsRVO.class);
+        } else {
+            if (vo.getMl() != null) {
+                vo.setMlCodes(getMl(vo.getMl()));
+            }
+            if (!StringUtils.isEmpty(vo.getTime())) {
+                vo.setStartTime(vo.getTime().split(" - ")[0]);
+                vo.setEndTime(vo.getTime().split(" - ")[1]);
+            }
+            List<BorrowStatisticsRVO> borrowStatisticsRVOS = selectStatisticsMapper.selectBorrowStatistics(vo);
+            stringRedisTemplate.opsForValue().set(key, JSONObject.toJSONString(borrowStatisticsRVOS), DataGlobalVariable.CACHE_EXPIRES, DataGlobalVariable.TIME_UNIT);
+            return borrowStatisticsRVOS;
         }
-        return selectStatisticsMapper.selectBorrowStatistics(vo);
     }
 
     private List<String> getMl(Integer id) {
@@ -130,7 +151,7 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
 
 
     @Override
-    public Map<String,Integer> selectUserBorrowCountStatistics() {
+    public Map<String, Integer> selectUserBorrowCountStatistics() {
         ArchiveBorrowDTO param = new ArchiveBorrowDTO();
         param.setAdminId(JwtUtils.getCurrentUserJwtPayload().getId());
         List<ArchiveBorrowDTO> selectResult = archiveBorrowMapper.select(param);
@@ -145,22 +166,22 @@ public class SelectStatisticsServiceImpl implements SelectStatisticsService {
             // 预计归还时间
             DateTime estimateReturnTime = DateUtil.parseDate(item.getEstimateReturnTime());
             // 已经过期 未归还 原件借阅 借阅审核已通过
-            if (now.before(estimateReturnTime) && item.getReturnStatus() == 0 && item.getBorrowType() == 1 && item.getAuditStatus() == 2){
-                dqwgh ++;
+            if (now.before(estimateReturnTime) && item.getReturnStatus() == 0 && item.getBorrowType() == 1 && item.getAuditStatus() == 2) {
+                dqwgh++;
             }
             // 剩余3天为即将到期
-            if (DateUtil.between(now,estimateReturnTime, DateUnit.DAY) == 3){
-                jjdq ++;
+            if (DateUtil.between(now, estimateReturnTime, DateUnit.DAY) == 3) {
+                jjdq++;
             }
-            if (item.getBorrowType() == 1 && item.getAuditStatus() == 0){
-                sqwcl ++;
+            if (item.getBorrowType() == 1 && item.getAuditStatus() == 0) {
+                sqwcl++;
             }
         }
-        Map<String,Integer> result = new HashMap<>();
+        Map<String, Integer> result = new HashMap<>();
         result.put("dqwgh", dqwgh);
         result.put("jjdq", jjdq);
         result.put("sqwcl", sqwcl);
-        result.put("lsjyw",lsjyw);
+        result.put("lsjyw", lsjyw);
         return result;
     }
 }

+ 15 - 3
src/main/java/com/gz/service/system/impl/AdminServiceImpl.java

@@ -10,6 +10,7 @@ import com.gz.common.DataGlobalVariable;
 import com.gz.dto.system.AdminDTO;
 import com.gz.dto.system.DeptDTO;
 import com.gz.mapper.system.AdminMapper;
+import com.gz.mapper.system.DeptMapper;
 import com.gz.rvo.system.AdminRVO;
 import com.gz.service.system.AdminService;
 import com.gz.utils.JwtUtils;
@@ -32,6 +33,9 @@ public class AdminServiceImpl implements AdminService {
     @Resource
     private AdminMapper adminMapper;
 
+    @Resource
+    private DeptMapper deptMapper;
+
     @Override
     public Integer insert(AdminDTO adminDTO) {
         // 盐
@@ -71,9 +75,17 @@ public class AdminServiceImpl implements AdminService {
 
     @Override
     public AdminDTO selectByPrimaryKey(String id) {
-        AdminDTO adminDTO = new AdminDTO();
-        adminDTO.setId(id);
-        return adminMapper.selectOne(adminDTO);
+        AdminDTO adminDTO = adminMapper.selectByPrimaryKey(id);
+        if (adminDTO.getRoleId() == null) {
+            DeptDTO deptDTO = null;
+            // 循环查找部门权限 没有就向上找 知道找到为止
+            deptDTO = deptMapper.selectByPrimaryKey(adminDTO.getDeptId());
+            while (deptDTO != null && null == deptDTO.getRoleId()) {
+                deptDTO = deptMapper.selectByPrimaryKey(deptDTO.getParentId());
+            }
+            adminDTO.setRoleId(deptDTO.getRoleId());
+        }
+        return adminDTO;
     }
 
     @Override

+ 3 - 2
src/main/java/com/gz/vo/archive/SearchArchiveVO.java

@@ -34,8 +34,6 @@ public class SearchArchiveVO extends PageVO {
     // 关键字
     private String ztc;
 
-
-
     // 高级搜索参数
     private Map<String, Object> params;
 
@@ -55,6 +53,9 @@ public class SearchArchiveVO extends PageVO {
     // 排序方式
     private String order;
 
+    // 全文检索
+    private String allDocument;
+
     public boolean getAgain(){
         return this.again;
     }

+ 2 - 1
src/main/java/com/gz/vo/rabbitmq/OcrEtlVO.java

@@ -1,6 +1,7 @@
 package com.gz.vo.rabbitmq;
 
 import com.gz.dto.archive.ArchiveDTO;
+import com.gz.rvo.archive.ArchiveRVO;
 import lombok.Data;
 
 /**
@@ -8,7 +9,7 @@ import lombok.Data;
  * @date 2021/3/9 9:45
  */
 @Data
-public class OcrEtlVO extends ArchiveDTO {
+public class OcrEtlVO extends ArchiveRVO {
     // 文件路径
     private String fileUrl;
 

+ 32 - 5
src/main/resources/application-dev.yml

@@ -58,11 +58,11 @@ spring:
   # redis配置
   redis:
     # redis地址
-    host: 47.97.217.112
+    host: 127.0.0.1
     # redis端口
-    port: 8989
+    port: 6379
     # redis库
-    database: 0
+    database: 1
     jedis:
       pool:
         # 连接池最大连接数(使用负值表示没有限制,对应maxTotal)
@@ -74,7 +74,7 @@ spring:
         # 连接池中的最小空闲连接
         min-idle: 2
     # 密码
-    password: qwer1234
+    password: 123456
     # 连接超时时间(毫秒)
     timeout: 30000
   rabbitmq:
@@ -90,6 +90,33 @@ spring:
           enabled: true # 是否开启消费者重试(为false时关闭消费者重试,这时消费端代码异常会一直重复收到消息)
           max-attempts: 5 # 重试次数
           initial-interval: 5000
+  elasticsearch:
+    bboss:
+      elasticsearch:
+        rest:
+          hostNames: 66.1.21.159:9200
+        dateFormat: yyyy.MM.dd
+        timeZone: Asia/Shanghai
+        showTemplate: true
+        discoverHost: false
+      dslfile:
+        refreshInterval: -1
+      http:
+        timeoutConnection: 5000
+        timeoutSocket: 5000
+        connectionRequestTimeout: 5000
+        retryTime: 1
+        maxLineLength: -1
+        maxHeaderCount: 200
+        maxTotal: 400
+        defaultMaxPerRoute: 200
+        soReuseAddress: false
+        soKeepAlive: false
+        timeToLive: 3600000
+        keepAlive: 3600000
+        keystore:
+        keyPassword:
+        hostnameVerifier:
 upload-file:
   server-file-url-prefix: http://examdasfda.cn.utools.club
   file-root-directory: E:\cache
@@ -98,4 +125,4 @@ logging:
   file:
     path: D:\logs\guihua_archive
 mount-archive:
-  scan-base-path: C:\Users\84731\Desktop\资料 (1)
+  scan-base-path: E:\cache\扫描

+ 29 - 2
src/main/resources/application-prod.yml

@@ -78,7 +78,7 @@ spring:
     # 连接超时时间(毫秒)
     timeout: 30000
   rabbitmq:
-    host: 127.0.0.1
+    host: 66.1.21.158
     port: 5672
     username: admin
     password: MjmaAH4lg5o84XXj
@@ -90,8 +90,35 @@ spring:
           enabled: true # 是否开启消费者重试(为false时关闭消费者重试,这时消费端代码异常会一直重复收到消息)
           max-attempts: 5 # 重试次数
           initial-interval: 5000
+  elasticsearch:
+    bboss:
+      elasticsearch:
+        rest:
+          hostNames: 66.1.21.159:9200
+        dateFormat: yyyy.MM.dd
+        timeZone: Asia/Shanghai
+        showTemplate: true
+        discoverHost: false
+      dslfile:
+        refreshInterval: -1
+      http:
+        timeoutConnection: 5000
+        timeoutSocket: 5000
+        connectionRequestTimeout: 5000
+        retryTime: 1
+        maxLineLength: -1
+        maxHeaderCount: 200
+        maxTotal: 400
+        defaultMaxPerRoute: 200
+        soReuseAddress: false
+        soKeepAlive: false
+        timeToLive: 3600000
+        keepAlive: 3600000
+        keystore:
+        keyPassword:
+        hostnameVerifier:
 upload-file:
-  server-file-url-prefix: http://66.1.21.158:${server.port}
+  server-file-url-prefix: http://66.1.21.158:9091
   file-root-directory: /data/file
   archive-file-root-directory: /data/file/archive_file
 logging:

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

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: dev
+    active: prod
   servlet:
     multipart:
       max-file-size: 5120MB
@@ -34,5 +34,3 @@ 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

+ 16 - 0
src/main/resources/elasticsearch/archive.xml

@@ -0,0 +1,16 @@
+<properties>
+    <property name="query">
+        <![CDATA[
+         {
+              "query": {
+                "multi_match": {
+                  "query": #[ztc],
+                  "fields": ["fileContent","tm"]
+                }
+              },
+              "from": #[pageNum],
+              "size": #[pageSize]
+          }
+        ]]>
+    </property>
+</properties>

+ 29 - 0
src/main/resources/mapper/archiveMapper.xml

@@ -198,4 +198,33 @@
           and atr.deleted = 0
           and a.id = #{id}
     </select>
+
+    <select id="selectByPk" resultType="com.gz.rvo.archive.ArchiveRVO" parameterType="int">
+        SELECT
+            d.dict_name mj_text,
+            d1.dict_name bgqx_text,
+            d2.title ml_Text,
+            a.*
+        FROM `tab_archives` a
+         LEFT JOIN tab_dict d ON a.mj = d.dict_code
+         LEFT JOIN tab_dict d1 ON a.bgqx = d1.dict_code
+         LEFT JOIN tab_archives_tree d2 ON a.ml = d2.code
+        where a.deleted = 0
+        and a.id = #{id}
+    </select>
+
+
+    <select id="selectByDh"  resultType="com.gz.rvo.archive.ArchiveRVO" parameterType="string">
+        SELECT
+            d.dict_name mj_text,
+            d1.dict_name bgqx_text,
+            d2.title ml_Text,
+            a.*
+        FROM `tab_archives` a
+                 LEFT JOIN tab_dict d ON a.mj = d.dict_code
+                 LEFT JOIN tab_dict d1 ON a.bgqx = d1.dict_code
+                 LEFT JOIN tab_archives_tree d2 ON a.ml = d2.code
+        where a.deleted = 0
+          and a.dh = #{dh}
+    </select>
 </mapper>

+ 0 - 1
src/main/resources/static/index.html

@@ -209,7 +209,6 @@
 
 
         let loginByBase64 = function (){
-            debugger
             let base64 = getParams('loginName')
             if (base64){
                 http.loginByBase64(base64)

+ 12 - 4
src/main/resources/static/page/archive/advancedSearch.html

@@ -25,7 +25,7 @@
 <body>
 <div class="layui-form layuimini-form" lay-filter="addDict" id="add" style="text-aglin:center">
     <div class="layui-form-item" id="1">
-<!--        <label class="layui-form-label required">条件1:</label>-->
+        <!--        <label class="layui-form-label required">条件1:</label>-->
         <div class="layui-input-inline" style="width: 75px;height: 38px"></div>
         <div class="layui-input-inline" style="width: 135px;">
             <select class="layui-select" name="field_1" id="field_1" lay-verify="required" lay-reqtext="条件1字段不能未空">
@@ -47,6 +47,8 @@
                     lay-reqtext="条件1条件不能未空">
                 <option value="=">精确</option>
                 <option value="like">模糊</option>
+                <option value="<="> <=</option>
+                <option value=">="> >=</option>
             </select>
         </div>
         <div class="layui-input-inline" style="width: 275px;">
@@ -59,7 +61,7 @@
         </div>
     </div>
     <div class="layui-form-item" id="2">
-<!--        <label class="layui-form-label required">条件2:</label>-->
+        <!--        <label class="layui-form-label required">条件2:</label>-->
         <div class="layui-input-inline" style="width: 75px;">
             <!--            <input type="radio" name="join2" class="layui-input" value="OR" title="OR">-->
             <!--            <input type="radio" name="join2" class="layui-input" value="AND" title="AND">-->
@@ -89,6 +91,8 @@
                     lay-reqtext="条件2条件不能未空">
                 <option value="=">精确</option>
                 <option value="like">模糊</option>
+                <option value="<="> <=</option>
+                <option value=">="> >=</option>
             </select>
         </div>
         <div class="layui-input-inline" style="width: 275px;">
@@ -101,7 +105,7 @@
         </div>
     </div>
     <div class="layui-form-item" id="3">
-<!--        <label class="layui-form-label required">条件3:</label>-->
+        <!--        <label class="layui-form-label required">条件3:</label>-->
         <div class="layui-input-inline" style="width: 75px;">
             <select name="join_3" class="layui-select" id="join_3">
                 <option value="AND">AND</option>
@@ -128,6 +132,8 @@
                     lay-reqtext="条件3条件不能未空">
                 <option value="=">精确</option>
                 <option value="like">模糊</option>
+                <option value="<="> <=</option>
+                <option value=">="> >= </option>
             </select>
         </div>
         <div class="layui-input-inline" style="width: 275px;">
@@ -141,7 +147,7 @@
     </div>
 
     <div class="layui-form-item" style="width: 671px" id="time_item">
-<!--        <label class="layui-form-label required">存档时间:</label>-->
+        <!--        <label class="layui-form-label required">存档时间:</label>-->
         <div class="layui-input-inline" style="width: 75px;height: 38px"></div>
         <div class="layui-input-inline" style="width: 503px;">
             <input class="layui-input" name="time" id="time" placeholder="日期范围" readonly>
@@ -215,6 +221,8 @@
                 '                <select class="layui-select" name="condition_' + index + '" id="condition_' + index + '" lay-verify="required" lay-reqtext="条件' + index + '条件不能未空">\n' +
                 '                    <option value="=">精确</option>\n' +
                 '                    <option value="like">模糊</option>\n' +
+                '                <option value="<="> <= </option>\n' +
+                '                <option value=">="> >= </option>' +
                 '                </select>\n' +
                 '            </div>\n' +
                 '            <div class="layui-input-inline" style="width: 275px;">\n' +

+ 3 - 2
src/main/resources/static/page/archive/edit.html

@@ -73,11 +73,12 @@
                                 <option value="">请选择全宗号</option>
                             </select>
                         </div>
-                        <label class="layui-form-label required">目录号:</label>
+                        <label class="layui-form-label">目录号:</label>
+<!--                        lay-verify="required"-->
                         <div class="layui-input-inline">
                             <input type="number" class="layui-input" placeholder="请输入目录号" name="mlh" id="mlh"
                                    lay-filter="mlh"
-                                   lay-verify="required" lay-reqtext="目录号不能为空">
+                                   lay-reqtext="目录号不能为空">
                         </div>
 
                     </div>

+ 11 - 5
src/main/resources/static/page/archive/list.html

@@ -46,7 +46,7 @@
                         </select>
                     </div>
                     <div class="layui-inline">
-                        <input type="checkbox" name="all" lay-skin="primary" title="全文检索">
+                        <input type="checkbox" name="allDocument" lay-skin="primary" title="全文检索">
                         <div class="layui-unselect layui-form-checkbox layui-form-checked" lay-skin="primary">
                             <span>全文检索</span>
                             <i class="layui-icon layui-icon-ok"></i>
@@ -250,7 +250,7 @@
                 elem: '#user-table',
                 url: 'archive/archive/selectByPage',
                 toolbar: '#toolbar', //开启头部工具栏,并为其绑定左侧模板
-                defaultToolbar: ['filter', 'exports', 'print'],
+                defaultToolbar: ['filter', 'print'],
                 title: '用户数据表',
                 limit: 15,
                 limits: [15, 30, 45, 60],
@@ -292,8 +292,8 @@
                     {field: 'gdnd', title: '归档年度', width: 120, sort: true},
                     {field: 'zrz', title: '责任者', width: 120},
                     {field: 'mjText', title: '密级', width: 80},
-                    {field: 'wjxcsj', title: '文件形成时间', width: 120},
-                    {field: 'wjdqsj', title: '文件到期时间', width: 120},
+                    {field: 'wjxcsj', title: '文件形成时间', width: 120, sort: true},
+                    {field: 'wjdqsj', title: '文件到期时间', width: 120, sort: true},
                     {templet: '#operating', width: 250, align: 'center', title: '操作', fixed: 'right'}
                 ]]
             });
@@ -636,6 +636,7 @@
         })
 
         form.on('submit(search)', function (data) {
+            console.log(data)
             searchParam.dh = data.field.dh
             searchParam.mlh = data.field.mlh
             searchParam.bgqx = data.field.bgqx
@@ -643,8 +644,13 @@
             searchParam.mj = data.field.mj
             searchParam.ztc = data.field.ztc
             searchParam.wjbh = data.field.wjbh
+            searchParam.allDocument = data.field.allDocument
             searchParam.again = false
-            $("#resultSearch").show()
+            if (searchParam.allDocument !== "on"){
+                $("#resultSearch").show()
+            }else {
+                $("#resultSearch").hide()
+            }
             renderTable()
         })
 

+ 3 - 3
src/main/resources/static/page/borrow/list.html

@@ -247,7 +247,7 @@
                 elem: '#user-table',
                 url: 'archive/archive/selectByPage',
                 toolbar: '#toolbar', //开启头部工具栏,并为其绑定左侧模板
-                defaultToolbar: ['filter', 'exports', 'print'],
+                defaultToolbar: ['filter', 'print'],
                 title: '用户数据表',
                 limit: 15,
                 limits: [15, 30, 45, 60],
@@ -288,8 +288,8 @@
                     {field: 'gdnd', title: '归档年度', width: 120, sort: true},
                     {field: 'zrz', title: '责任者', width: 120},
                     {field: 'mjText', title: '密级', width: 80},
-                    {field: 'wjxcsj', title: '文件形成时间', width: 120},
-                    {field: 'wjdqsj', title: '文件到期时间', width: 120},
+                    {field: 'wjxcsj', title: '文件形成时间', width: 120, sort: true},
+                    {field: 'wjdqsj', title: '文件到期时间', width: 120, sort: true},
                     {templet: '#operating', width: 100, align: 'center', title: '操作', fixed: 'right'}
                 ]]
             });

+ 34 - 0
src/test/java/com/gz/ESTest.java

@@ -0,0 +1,34 @@
+package com.gz;
+
+import com.alibaba.fastjson.JSON;
+import org.frameworkset.elasticsearch.ElasticSearchHelper;
+import org.frameworkset.elasticsearch.boot.BBossESStarter;
+import org.frameworkset.elasticsearch.client.ClientInterface;
+import org.frameworkset.elasticsearch.entity.ESDatas;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author LiuchangLan
+ * @date 2021/4/26 19:49
+ */
+@SpringBootTest
+public class ESTest {
+
+    @Resource
+    private BBossESStarter bbossESStarter;
+
+    @Test
+    void test(){
+        ClientInterface restClient = ElasticSearchHelper.getConfigRestClientUtil("elasticsearch/archive.xml");
+        Map<String,Object> params = new HashMap<>();
+        params.put("pageIndex",1);
+        params.put("pageSize",10);
+        ESDatas<Map> mapESDatas = restClient.searchList("/hp_es/_doc/_search", "query", params, Map.class);
+        System.out.println(JSON.toJSONString(mapESDatas));
+    }
+}

+ 95 - 0
src/test/java/com/gz/OcrTest.java

@@ -0,0 +1,95 @@
+package com.gz;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.gz.dto.archive.ArchiveDTO;
+import com.gz.dto.archive.SecondaryArchiveDTO;
+import com.gz.dto.system.ArchiveFileDTO;
+import com.gz.dto.system.ArchivesTreeDTO;
+import com.gz.mapper.archive.ArchiveFileMapper;
+import com.gz.mapper.archive.ArchiveMapper;
+import com.gz.mapper.archive.SecondaryArchiveMapper;
+import com.gz.rvo.archive.ArchiveRVO;
+import com.gz.vo.rabbitmq.OcrEtlVO;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import tk.mybatis.mapper.entity.Example;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author LiuchangLan
+ * @date 2021/4/26 18:50
+ */
+@Slf4j
+@SpringBootTest
+public class OcrTest {
+
+    @Resource
+    private ArchiveMapper archiveMapper;
+
+    @Resource
+    private SecondaryArchiveMapper secondaryArchiveMapper;
+
+    @Resource
+    private StringRedisTemplate stringRedisTemplate;
+
+    @Value("${upload-file.server-file-url-prefix}")
+    private String serverFileUrlPrefix;
+
+    @Value("${rabbitmq.data-exchange}")
+    private String dataExchangeName;
+
+    @Autowired
+    private RabbitTemplate rabbitTemplate;
+
+    @Resource
+    private ArchiveFileMapper archiveFileMapper;
+
+    @Value("${rabbitmq.ocr.queue-binding-key}")
+    private String ocrBindingKey;
+
+
+    @Test
+    public void test(){
+        Example example = new Example(ArchiveFileDTO.class);
+        example.setOrderByClause("id ASC");
+        List<ArchiveFileDTO> archiveFileDTOS = archiveFileMapper.selectByExample(example);
+        for (int i = 0; i < archiveFileDTOS.size(); i++) {
+            ArchiveFileDTO archiveFileDTO = archiveFileDTOS.get(i);
+            ArchiveRVO archiveRVO = archiveMapper.selectByPk(archiveFileDTO.getArchiveId());
+            OcrEtlVO ocrBean = BeanUtil.copyProperties(archiveRVO, OcrEtlVO.class);
+            ocrBean.setSecondaryArchiveId(archiveFileDTO.getSecondaryArchiveId());
+            ocrBean.setFileUrl(serverFileUrlPrefix + archiveFileDTO.getFilePath() + "/" + archiveFileDTO.getFileName());
+            log.info("【ocr识别】发起识别队列,参数[{}]", JSON.toJSONString(ocrBean));
+            rabbitTemplate.convertAndSend(dataExchangeName, ocrBindingKey, JSON.toJSONString(ocrBean));
+        }
+//        Integer i = Integer.valueOf(stringRedisTemplate.opsForValue().get("sdfsdf"));
+//        ArchiveFileDTO archiveFileDTO = archiveFileDTOS.get(0);
+//        ArchiveRVO archiveRVO = archiveMapper.selectByPk(archiveFileDTO.getArchiveId());
+//        OcrEtlVO ocrBean = BeanUtil.copyProperties(archiveRVO, OcrEtlVO.class);
+//        ocrBean.setSecondaryArchiveId(archiveFileDTO.getSecondaryArchiveId());
+//        ocrBean.setFileUrl(serverFileUrlPrefix + archiveFileDTO.getFilePath() + "/" + archiveFileDTO.getFileName());
+//        log.info("【ocr识别】发起识别队列,参数[{}]", JSON.toJSONString(ocrBean));
+//        rabbitTemplate.convertAndSend(dataExchangeName, ocrBindingKey, JSON.toJSONString(ocrBean));
+//        while (i < archiveFileDTOS.size()){
+//            ArchiveFileDTO archiveFileDTO = archiveFileDTOS.get(i);
+//            ArchiveRVO archiveRVO = archiveMapper.selectByPk(archiveFileDTO.getArchiveId());
+//            OcrEtlVO ocrBean = BeanUtil.copyProperties(archiveRVO, OcrEtlVO.class);
+//            ocrBean.setSecondaryArchiveId(archiveFileDTO.getSecondaryArchiveId());
+//            ocrBean.setFileUrl(serverFileUrlPrefix + archiveFileDTO.getFilePath() + "/" + archiveFileDTO.getFileName());
+//            log.info("【ocr识别】发起识别队列,参数[{}]", JSON.toJSONString(ocrBean));
+//            rabbitTemplate.convertAndSend(dataExchangeName, ocrBindingKey, JSON.toJSONString(ocrBean));
+//            i ++;
+//            stringRedisTemplate.opsForValue().set("sdfsdf",i.toString());
+//            return;
+//        }
+    }
+}