lwhhszx 1 년 전
부모
커밋
ed17c34d59
36개의 변경된 파일922개의 추가작업 그리고 2135개의 파일을 삭제
  1. 26 5
      pom.xml
  2. 46 0
      src/main/java/cn/cslg/pas/common/config/ElasticSearchClientConfig.java
  3. 53 53
      src/main/java/cn/cslg/pas/common/core/CreateTaskThread.java
  4. 0 116
      src/main/java/cn/cslg/pas/common/core/base/RequestHolder.java
  5. 0 1
      src/main/java/cn/cslg/pas/common/dto/PatentStarImportDTO.java
  6. 10 0
      src/main/java/cn/cslg/pas/common/model/common/QueryCondition.java
  7. 14 0
      src/main/java/cn/cslg/pas/common/model/request/MapRequest.java
  8. 14 0
      src/main/java/cn/cslg/pas/common/model/request/QueryRequest.java
  9. 11 0
      src/main/java/cn/cslg/pas/common/model/request/StringRequest.java
  10. 0 144
      src/main/java/cn/cslg/pas/common/utils/BackupUtils.java
  11. 159 159
      src/main/java/cn/cslg/pas/common/utils/ExcelUtils.java
  12. 0 34
      src/main/java/cn/cslg/pas/common/utils/FileToMultipartFileUtiles.java
  13. 0 242
      src/main/java/cn/cslg/pas/common/utils/FileUtils.java
  14. 3 2
      src/main/java/cn/cslg/pas/common/utils/LoginUtils.java
  15. 196 196
      src/main/java/cn/cslg/pas/common/utils/ReadExcelUtils.java
  16. 0 40
      src/main/java/cn/cslg/pas/common/utils/SecurityUtils/LoginUtils.java
  17. 0 41
      src/main/java/cn/cslg/pas/common/utils/SecurityUtils/SecurityUtils.java
  18. 0 117
      src/main/java/cn/cslg/pas/common/utils/ServletUtils.java
  19. 0 729
      src/main/java/cn/cslg/pas/common/utils/SoMap.java
  20. 20 0
      src/main/java/cn/cslg/pas/controller/CommonController.java
  21. 13 3
      src/main/java/cn/cslg/pas/controller/EventController.java
  22. 14 15
      src/main/java/cn/cslg/pas/controller/ProjectImportController.java
  23. 8 0
      src/main/java/cn/cslg/pas/domain/School.java
  24. 7 0
      src/main/java/cn/cslg/pas/service/Business.java
  25. 13 0
      src/main/java/cn/cslg/pas/service/BusinessFactory.java
  26. 27 0
      src/main/java/cn/cslg/pas/service/EsService.java
  27. 95 95
      src/main/java/cn/cslg/pas/service/FileManagerService.java
  28. 34 0
      src/main/java/cn/cslg/pas/service/business/CommonService.java
  29. 11 12
      src/main/java/cn/cslg/pas/service/business/EventService.java
  30. 54 54
      src/main/java/cn/cslg/pas/service/importPatent/ImportPatentPatentStar.java
  31. 2 2
      src/main/java/cn/cslg/pas/service/importPatent/PatentQueueService.java
  32. 63 63
      src/main/java/cn/cslg/pas/service/importPatent/ProjectImportService.java
  33. 22 0
      src/main/java/cn/cslg/pas/service/query/BusinessFactory.java
  34. 5 1
      src/main/java/cn/cslg/pas/service/query/QueryService.java
  35. 0 9
      src/main/java/cn/cslg/pas/service/query/QueryFactory.java
  36. 2 2
      src/main/resources/application-dev.yml

+ 26 - 5
pom.xml

@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.5.9</version>
+        <version>3.1.3</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
@@ -16,10 +16,10 @@
     <description>常熟理工学院 专利分析系统</description>
 
     <properties>
-        <java.version>1.8</java.version>
+        <java.version>8</java.version>
         <jwt.version>0.9.0</jwt.version>
         <commons.io.version>2.5</commons.io.version>
-        <mybatisplus.version>3.4.3.4</mybatisplus.version>
+        <mybatisplus.version>3.5.3.1</mybatisplus.version>
         <google.code.gson.version>2.7</google.code.gson.version>
         <hutool.version>5.6.5</hutool.version>
         <okhttps.version>3.1.1</okhttps.version>
@@ -29,6 +29,7 @@
         <fastjson.version>2.0.12</fastjson.version>
         <sa-token.version>1.29.0</sa-token.version>
         <springdoc.version>1.6.6</springdoc.version>
+        <elasticsearch.version>8.6.1</elasticsearch.version>
     </properties>
 
     <dependencies>
@@ -122,8 +123,8 @@
             <artifactId>commons-pool2</artifactId>
         </dependency>
         <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
+            <groupId>com.mysql</groupId>
+            <artifactId>mysql-connector-j</artifactId>
             <scope>runtime</scope>
         </dependency>
         <dependency>
@@ -204,6 +205,10 @@
             <artifactId>pdfbox</artifactId>
             <version>2.0.16</version>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
+        </dependency>
     </dependencies>
 
 
@@ -233,6 +238,22 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>16</source>
+                    <target>16</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>17</source>
+                    <target>17</target>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 

+ 46 - 0
src/main/java/cn/cslg/pas/common/config/ElasticSearchClientConfig.java

@@ -0,0 +1,46 @@
+package cn.cslg.pas.common.config;
+
+import co.elastic.clients.elasticsearch.ElasticsearchClient;
+import co.elastic.clients.json.jackson.JacksonJsonpMapper;
+import co.elastic.clients.transport.ElasticsearchTransport;
+import co.elastic.clients.transport.rest_client.RestClientTransport;
+import org.apache.http.HttpHost;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.elasticsearch.client.RestClient;
+import org.elasticsearch.client.RestClientBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.net.ssl.SSLContext;
+
+
+@Configuration
+public class ElasticSearchClientConfig {
+    //配置RestHighLevelClient依赖到spring容器中待用
+
+    @Configuration
+    public class ElasticSearchConfig {
+
+        //注入IOC容器
+        @Bean
+        public ElasticsearchClient elasticsearchClient() throws Exception {
+            RestClientBuilder builder = RestClient.builder(new HttpHost("192.168.1.24", 9200, "https"));
+            CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
+            credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "xiaoshi221101"));
+            SSLContext sslContext = SSLContextBuilder.create()
+                    .loadTrustMaterial(new TrustSelfSignedStrategy())
+                    .build();
+            builder.setHttpClientConfigCallback(f -> f.setDefaultCredentialsProvider(credentialsProvider).setSSLContext(sslContext).setSSLHostnameVerifier(new NoopHostnameVerifier()));
+            RestClient client =builder.build();
+            ElasticsearchTransport transport = new RestClientTransport(client,new JacksonJsonpMapper());
+            return new ElasticsearchClient(transport);
+        }
+
+    }
+}

+ 53 - 53
src/main/java/cn/cslg/pas/common/core/CreateTaskThread.java

@@ -1,53 +1,53 @@
-package cn.cslg.pas.common.core;
-
-import cn.cslg.pas.entity.ImportTask;
-import cn.cslg.pas.service.ImportTaskService;
-import cn.cslg.pas.service.importPatent.PatentQueueService;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * 项目启动时初始化任务列表队列
- *
- * @author chenyu
- * @date 2023/10/20
- */
-@Component
-@RequiredArgsConstructor(onConstructor_ = {@Lazy})
-public class CreateTaskThread implements InitializingBean {
-    private final ImportTaskService importTaskService;
-    private final PatentQueueService patentQueueService;
-
-
-    @Override
-    public void afterPropertiesSet() throws Exception {
-        //查找任务状态为0(等待中)和1(进行中)的任务
-        ArrayList<Integer> stateList = new ArrayList<>();
-        stateList.add(0);
-        stateList.add(1);
-        List<ImportTask> importTasks = importTaskService.list(new LambdaQueryWrapper<ImportTask>().in(ImportTask::getState, stateList));
-        if (importTasks.size() > 0) {
-            //先把0(进行中)的任务存入队列
-            List<Integer> doingTaskIds = importTasks.stream().filter(importTask -> importTask.getState() == 1).map(ImportTask::getId).collect(Collectors.toList());
-            if (doingTaskIds.size() > 0) {
-                patentQueueService.addImportTasksToQueue(doingTaskIds);
-            }
-            //再把1(等待中)的任务存入队列
-            List<Integer> waitingTaskIds = importTasks.stream().filter(importTask -> importTask.getState() == 0).map(ImportTask::getId).collect(Collectors.toList());
-            if (waitingTaskIds.size() > 0) {
-                patentQueueService.addImportTasksToQueue(waitingTaskIds);
-            }
-        }
-
-        //唤醒所有线程...
-
-    }
-
-}
+//package cn.cslg.pas.common.core;
+//
+//import cn.cslg.pas.entity.ImportTask;
+//import cn.cslg.pas.service.ImportTaskService;
+//import cn.cslg.pas.service.importPatent.PatentQueueService;
+//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+//import lombok.RequiredArgsConstructor;
+//import org.springframework.beans.factory.InitializingBean;
+//import org.springframework.context.annotation.Lazy;
+//import org.springframework.stereotype.Component;
+//
+//import java.util.ArrayList;
+//import java.util.List;
+//import java.util.stream.Collectors;
+//
+///**
+// * 项目启动时初始化任务列表队列
+// *
+// * @author chenyu
+// * @date 2023/10/20
+// */
+//@Component
+//@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+//public class CreateTaskThread implements InitializingBean {
+//    private final ImportTaskService importTaskService;
+//    private final PatentQueueService patentQueueService;
+//
+//
+//    @Override
+//    public void afterPropertiesSet() throws Exception {
+//        //查找任务状态为0(等待中)和1(进行中)的任务
+//        ArrayList<Integer> stateList = new ArrayList<>();
+//        stateList.add(0);
+//        stateList.add(1);
+//        List<ImportTask> importTasks = importTaskService.list(new LambdaQueryWrapper<ImportTask>().in(ImportTask::getState, stateList));
+//        if (importTasks.size() > 0) {
+//            //先把0(进行中)的任务存入队列
+//            List<Integer> doingTaskIds = importTasks.stream().filter(importTask -> importTask.getState() == 1).map(ImportTask::getId).collect(Collectors.toList());
+//            if (doingTaskIds.size() > 0) {
+//                patentQueueService.addImportTasksToQueue(doingTaskIds);
+//            }
+//            //再把1(等待中)的任务存入队列
+//            List<Integer> waitingTaskIds = importTasks.stream().filter(importTask -> importTask.getState() == 0).map(ImportTask::getId).collect(Collectors.toList());
+//            if (waitingTaskIds.size() > 0) {
+//                patentQueueService.addImportTasksToQueue(waitingTaskIds);
+//            }
+//        }
+//
+//        //唤醒所有线程...
+//
+//    }
+//
+//}

+ 0 - 116
src/main/java/cn/cslg/pas/common/core/base/RequestHolder.java

@@ -1,116 +0,0 @@
-package cn.cslg.pas.common.core.base;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-@Slf4j
-public class RequestHolder {
-
-    /**
-     * 获取request
-     *
-     * @return HttpServletRequest
-     */
-    public static HttpServletRequest getRequest() {
-        log.debug("getRequest -- Thread id :{}, name : {}", Thread.currentThread().getId(), Thread.currentThread().getName());
-        ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
-        if (null == servletRequestAttributes) {
-            return null;
-        }
-        return servletRequestAttributes.getRequest();
-    }
-
-    /**
-     * 获取Response
-     *
-     * @return HttpServletRequest
-     */
-    public static HttpServletResponse getResponse() {
-        log.debug("getResponse -- Thread id :{}, name : {}", Thread.currentThread().getId(), Thread.currentThread().getName());
-        ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
-        if (null == servletRequestAttributes) {
-            return null;
-        }
-        return servletRequestAttributes.getResponse();
-    }
-
-    /**
-     * 获取session
-     *
-     * @return HttpSession
-     */
-    public static HttpSession getSession() {
-        log.debug("getSession -- Thread id :{}, name : {}", Thread.currentThread().getId(), Thread.currentThread().getName());
-        HttpServletRequest request;
-        if (null == (request = getRequest())) {
-            return null;
-        }
-        return request.getSession();
-    }
-
-    /**
-     * 获取session的Attribute
-     *
-     * @param name session的key
-     * @return Object
-     */
-    public static Object getSession(String name) {
-        log.debug("getSession -- Thread id :{}, name : {}", Thread.currentThread().getId(), Thread.currentThread().getName());
-        ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
-        if (null == servletRequestAttributes) {
-            return null;
-        }
-        return servletRequestAttributes.getAttribute(name, RequestAttributes.SCOPE_SESSION);
-    }
-
-    /**
-     * 添加session
-     *
-     * @param name
-     * @param value
-     */
-    public static void setSession(String name, Object value) {
-        log.debug("setSession -- Thread id :{}, name : {}", Thread.currentThread().getId(), Thread.currentThread().getName());
-        ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
-        if (null == servletRequestAttributes) {
-            return;
-        }
-        servletRequestAttributes.setAttribute(name, value, RequestAttributes.SCOPE_SESSION);
-    }
-
-    /**
-     * 清除指定session
-     *
-     * @param name
-     * @return void
-     */
-    public static void removeSession(String name) {
-        log.debug("removeSession -- Thread id :{}, name : {}", Thread.currentThread().getId(), Thread.currentThread().getName());
-        ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
-        if (null == servletRequestAttributes) {
-            return;
-        }
-        servletRequestAttributes.removeAttribute(name, RequestAttributes.SCOPE_SESSION);
-    }
-
-    /**
-     * 获取所有session key
-     *
-     * @return String[]
-     */
-    public static String[] getSessionKeys() {
-        log.debug("getSessionKeys -- Thread id :{}, name : {}", Thread.currentThread().getId(), Thread.currentThread().getName());
-        ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
-        if (null == servletRequestAttributes) {
-            return null;
-        }
-        return servletRequestAttributes.getAttributeNames(RequestAttributes.SCOPE_SESSION);
-    }
-
-}

+ 0 - 1
src/main/java/cn/cslg/pas/common/dto/PatentStarImportDTO.java

@@ -7,6 +7,5 @@ package cn.cslg.pas.common.dto;
  * @date 2023/10/23
  */
 public class PatentStarImportDTO {
-    private
 
 }

+ 10 - 0
src/main/java/cn/cslg/pas/common/model/common/QueryCondition.java

@@ -0,0 +1,10 @@
+package cn.cslg.pas.common.model.common;
+
+import lombok.Data;
+
+@Data
+public class QueryCondition {
+    private String key;
+    private String value;
+    private String type;
+}

+ 14 - 0
src/main/java/cn/cslg/pas/common/model/request/MapRequest.java

@@ -0,0 +1,14 @@
+package cn.cslg.pas.common.model.request;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+import java.util.Map;
+
+@Data
+@Accessors(chain = true)
+public class MapRequest extends QueryRequest{
+  private List<Map<String,Object>> searchQuery;
+
+}

+ 14 - 0
src/main/java/cn/cslg/pas/common/model/request/QueryRequest.java

@@ -0,0 +1,14 @@
+package cn.cslg.pas.common.model.request;
+
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+public class QueryRequest {
+
+    private Long current;
+    private Long size;
+
+}

+ 11 - 0
src/main/java/cn/cslg/pas/common/model/request/StringRequest.java

@@ -0,0 +1,11 @@
+package cn.cslg.pas.common.model.request;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+public class StringRequest extends QueryRequest{
+  private   String searchQuery;
+
+}

+ 0 - 144
src/main/java/cn/cslg/pas/common/utils/BackupUtils.java

@@ -1,144 +0,0 @@
-package cn.cslg.pas.common.utils;
-
-import cn.hutool.core.io.FileUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.system.ApplicationHome;
-import org.yaml.snakeyaml.Yaml;
-
-import java.io.File;
-import java.io.InputStream;
-
-@Slf4j
-public class BackupUtils {
-
-    private final static String BACKUP_CONFIG = "backup-config.yml";
-
-    private static Backup getBackupConfig() {
-        try {
-            ApplicationHome ah = new ApplicationHome(BackupUtils.class);
-            File file = ah.getSource();
-            String rootPath = file.getParentFile().toString() + FileUtils.FILE_SEPARATOR + BACKUP_CONFIG;
-            Yaml yaml = new Yaml();
-            InputStream in = FileUtil.getInputStream(rootPath);
-            Backup backup = yaml.loadAs(in, Backup.class);
-            if (in != null) {
-                in.close();
-            }
-            return backup;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    public static void main(String[] args) {
-        System.out.println(getBackupConfig());
-    }
-
-    public void run() {
-        Backup backup = getBackupConfig();
-        if (backup == null) {
-            log.info("数据库备份配置文件不存在");
-            return;
-        }
-        log.info("数据库备份配置文件:{}", backup);
-        if (backup.isEnable()) {
-            String path = FileUtils.getStaticPath(FileUtils.BACKUP_FILE);
-            String fileName = DateUtils.getNowTimeFormat(DateUtils.YYYYMMDDHHMMSS) + ".sql";
-            try {
-                String cmd = String.format("mysqldump --skip-opt -h%s -P%s -u%s -p%s %s > %s", backup.getHost(), backup.getPort(), backup.getUsername(), backup.getPassword(), backup.getDb(), path + FileUtils.FILE_SEPARATOR + fileName);
-                String[] command;
-                if (backup.getOs() == 0) {
-                    command = new String[]{"cmd", "/c", String.valueOf(cmd)};
-                } else {
-                    command = new String[]{"/bin/sh", "-c", String.valueOf(cmd)};
-                }
-                Runtime.getRuntime().exec(command);
-                log.info("备份数据库成功");
-            } catch (Exception e) {
-                e.printStackTrace();
-                log.error("备份数据库失败");
-            }
-        }
-    }
-
-    public static class Backup {
-        private String host;
-        private String port;
-        private String db;
-        private String username;
-        private String password;
-        private int os;
-        private boolean enable;
-
-        @Override
-        public String toString() {
-            return "Backup{" +
-                    "host='" + host + '\'' +
-                    ", port='" + port + '\'' +
-                    ", db='" + db + '\'' +
-                    ", username='" + username + '\'' +
-                    ", password='" + password + '\'' +
-                    ", os=" + os +
-                    ", enable=" + enable +
-                    '}';
-        }
-
-        public boolean isEnable() {
-            return enable;
-        }
-
-        public void setEnable(boolean enable) {
-            this.enable = enable;
-        }
-
-        public String getHost() {
-            return host;
-        }
-
-        public void setHost(String host) {
-            this.host = host;
-        }
-
-        public String getPort() {
-            return port;
-        }
-
-        public void setPort(String port) {
-            this.port = port;
-        }
-
-        public String getDb() {
-            return db;
-        }
-
-        public void setDb(String db) {
-            this.db = db;
-        }
-
-        public String getUsername() {
-            return username;
-        }
-
-        public void setUsername(String username) {
-            this.username = username;
-        }
-
-        public String getPassword() {
-            return password;
-        }
-
-        public void setPassword(String password) {
-            this.password = password;
-        }
-
-        public int getOs() {
-            return os;
-        }
-
-        public void setOs(int os) {
-            this.os = os;
-        }
-    }
-
-}

+ 159 - 159
src/main/java/cn/cslg/pas/common/utils/ExcelUtils.java

@@ -20,164 +20,164 @@ import java.util.Map;
 
 public class ExcelUtils {
 
-    public static Map<String, PictureData> getDataFromExcel(String filePath) throws IOException {
-        //判断是否为excel类型文件
-        if (!filePath.endsWith(".xls") && !filePath.endsWith(".xlsx") && !filePath.endsWith(".XLS") && !filePath.endsWith(".XLSX")) {
-            System.out.println("文件不是excel类型");
-        }
-
-        FileInputStream fis = null;
-        Workbook wookbook = null;
-        Sheet sheet = null;
-        try {
-            //获取一个绝对地址的流
-            fis = new FileInputStream(filePath);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        try {
-            //2003版本的excel,用.xls结尾
-            wookbook = new HSSFWorkbook(fis);//得到工作簿
-        } catch (Exception ex) {
-            //ex.printStackTrace();
-            try {
-                //2007版本的excel,用.xlsx结尾
-                fis = new FileInputStream(filePath);
-                wookbook = new XSSFWorkbook(fis);//得到工作簿
-            } catch (IOException e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-            }
-        }
-        Map<String, PictureData> maplist = null;
-        //拿到excel表格的第一个sheet工作簿
-        sheet = wookbook.getSheetAt(0);
-        // 判断用07还是03的方法获取图片
-        if (filePath.endsWith(".xls") || filePath.endsWith(".XLS")) {
-            maplist = getPictures1((HSSFSheet) sheet);
-        } else if (filePath.endsWith(".xlsx") || filePath.endsWith(".XLSX")) {
-            maplist = getPictures2((XSSFSheet) sheet);
-        }
-        wookbook.close();
-        return maplist;
-    }
-
-    /**
-     * 获取图片和位置 (xls)
-     *
-     * @param sheet
-     * @return
-     * @throws IOException
-     */
-    public static Map<String, PictureData> getPictures1(HSSFSheet sheet) throws IOException {
-        Map<String, PictureData> map = new HashMap();
-        if (sheet.getDrawingPatriarch() != null) {
-            List<HSSFShape> list = sheet.getDrawingPatriarch().getChildren();
-            for (HSSFShape shape : list) {
-                if (shape instanceof HSSFPicture) {
-                    HSSFPicture picture = (HSSFPicture) shape;
-                    HSSFClientAnchor cAnchor = (HSSFClientAnchor) picture.getAnchor();
-                    PictureData pdata = picture.getPictureData();
-                    String key = String.valueOf(cAnchor.getRow1());
-                    map.put(key, pdata);
-                }
-            }
-        }
-        return map;
-    }
-
-    /**
-     * 获取图片和位置 (xlsx)
-     *
-     * @param sheet
-     * @return
-     * @throws IOException
-     */
-    public static Map<String, PictureData> getPictures2(XSSFSheet sheet) throws IOException {
-        Map<String, PictureData> map = new HashMap();
-        List<POIXMLDocumentPart> list = sheet.getRelations();
-        for (POIXMLDocumentPart part : list) {
-            if (part instanceof XSSFDrawing) {
-                XSSFDrawing drawing = (XSSFDrawing) part;
-                List<XSSFShape> shapes = drawing.getShapes();
-                for (XSSFShape shape : shapes) {
-                    XSSFPicture picture = (XSSFPicture) shape;
-                    Dimension d = picture.getImageDimension();
-                    //解决图片空指针报错问题 lig  2021-06-03
-                    XSSFClientAnchor anchor = (XSSFClientAnchor) shape.getAnchor();
-                    //XSSFClientAnchor anchor = picture.getPreferredSize();
-                    CTMarker marker = anchor.getFrom();
-                    String key = String.valueOf(marker.getRow());
-                    map.put(key, picture.getPictureData());
-                }
-            }
-        }
-        return map;
-    }
-
-    /**
-     * @param pictureData 图片
-     * @return 返回图片的文件路径和文件名称
-     */
-    public static Map<String, String> savePicture(PictureData pictureData) throws IOException {
-        FileUtils fileUtils = SpringUtils.getBean(FileUtils.class);
-        Map<String, String> result = new HashMap<>();
-        String ext = pictureData.suggestFileExtension();
-        byte[] data = pictureData.getData();
-        String picName = IdUtil.simpleUUID() + "." + ext;
-        String date = DateUtils.getNowTimeFormat("yyyyMMdd");
-        String folderPath = fileUtils.getSavePath(date);
-        String filePath = FileUtils.FILE_SEPARATOR + date + FileUtils.FILE_SEPARATOR + picName;
-        File directory = new File(folderPath);
-        if (!directory.exists()) {
-            directory.mkdir();
-        }
-        FileOutputStream out = new FileOutputStream(folderPath + picName);
-        out.write(data);
-        out.close();
-        result.put("path", filePath);
-        result.put("name", picName);
-        return result;
-    }
-
-    /**
-     * @param
-     * @param x           单元格x轴坐标
-     * @param y           单元格y轴坐标
-     * @param pictureData 图片二进制数据
-     * @param picType     图片格式
-     */
-    public static void writePicture(Sheet sheet, int x, int y, byte[] pictureData, int picType) {
-        Drawing drawingPatriarch = sheet.createDrawingPatriarch();
-        //设置图片单元格位置
-        ClientAnchor anchor = drawingPatriarch.createAnchor(0, 0, 0, 0, x, y, x + 1, y + 1);
-        //随单元格改变位置和大小
-        anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
-        //添加图片
-        int pictureIndex = sheet.getWorkbook().addPicture(pictureData, picType);
-        drawingPatriarch.createPicture(anchor, pictureIndex);
-    }
-
-    public static void setExcelCellStyle(HSSFCellStyle cellStyle) {
-        cellStyle.setBorderBottom(BorderStyle.THIN);
-        cellStyle.setBorderLeft(BorderStyle.THIN);
-        cellStyle.setBorderRight(BorderStyle.THIN);
-        cellStyle.setBorderTop(BorderStyle.THIN);
-    }
-
-    public static String getValue(Cell cell) {
-        if (cell != null) {
-            if (cell.getCellType() == CellType.NUMERIC && HSSFDateUtil.isCellDateFormatted(cell)) {
-                Date date = cell.getDateCellValue();
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                String dateString = dateFormat.format(date);
-                return dateString;
-            } else {
-                return cell.toString();
-            }
-        }
-        return "";
-    }
-
+//    public static Map<String, PictureData> getDataFromExcel(String filePath) throws IOException {
+//        //判断是否为excel类型文件
+//        if (!filePath.endsWith(".xls") && !filePath.endsWith(".xlsx") && !filePath.endsWith(".XLS") && !filePath.endsWith(".XLSX")) {
+//            System.out.println("文件不是excel类型");
+//        }
+//
+//        FileInputStream fis = null;
+//        Workbook wookbook = null;
+//        Sheet sheet = null;
+//        try {
+//            //获取一个绝对地址的流
+//            fis = new FileInputStream(filePath);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        try {
+//            //2003版本的excel,用.xls结尾
+//            wookbook = new HSSFWorkbook(fis);//得到工作簿
+//        } catch (Exception ex) {
+//            //ex.printStackTrace();
+//            try {
+//                //2007版本的excel,用.xlsx结尾
+//                fis = new FileInputStream(filePath);
+//                wookbook = new XSSFWorkbook(fis);//得到工作簿
+//            } catch (IOException e) {
+//                // TODO Auto-generated catch block
+//                e.printStackTrace();
+//            }
+//        }
+//        Map<String, PictureData> maplist = null;
+//        //拿到excel表格的第一个sheet工作簿
+//        sheet = wookbook.getSheetAt(0);
+//        // 判断用07还是03的方法获取图片
+//        if (filePath.endsWith(".xls") || filePath.endsWith(".XLS")) {
+//            maplist = getPictures1((HSSFSheet) sheet);
+//        } else if (filePath.endsWith(".xlsx") || filePath.endsWith(".XLSX")) {
+//            maplist = getPictures2((XSSFSheet) sheet);
+//        }
+//        wookbook.close();
+//        return maplist;
+//    }
+//
+//    /**
+//     * 获取图片和位置 (xls)
+//     *
+//     * @param sheet
+//     * @return
+//     * @throws IOException
+//     */
+//    public static Map<String, PictureData> getPictures1(HSSFSheet sheet) throws IOException {
+//        Map<String, PictureData> map = new HashMap();
+//        if (sheet.getDrawingPatriarch() != null) {
+//            List<HSSFShape> list = sheet.getDrawingPatriarch().getChildren();
+//            for (HSSFShape shape : list) {
+//                if (shape instanceof HSSFPicture) {
+//                    HSSFPicture picture = (HSSFPicture) shape;
+//                    HSSFClientAnchor cAnchor = (HSSFClientAnchor) picture.getAnchor();
+//                    PictureData pdata = picture.getPictureData();
+//                    String key = String.valueOf(cAnchor.getRow1());
+//                    map.put(key, pdata);
+//                }
+//            }
+//        }
+//        return map;
+//    }
+//
+//    /**
+//     * 获取图片和位置 (xlsx)
+//     *
+//     * @param sheet
+//     * @return
+//     * @throws IOException
+//     */
+//    public static Map<String, PictureData> getPictures2(XSSFSheet sheet) throws IOException {
+//        Map<String, PictureData> map = new HashMap();
+//        List<POIXMLDocumentPart> list = sheet.getRelations();
+//        for (POIXMLDocumentPart part : list) {
+//            if (part instanceof XSSFDrawing) {
+//                XSSFDrawing drawing = (XSSFDrawing) part;
+//                List<XSSFShape> shapes = drawing.getShapes();
+//                for (XSSFShape shape : shapes) {
+//                    XSSFPicture picture = (XSSFPicture) shape;
+//                    Dimension d = picture.getImageDimension();
+//                    //解决图片空指针报错问题 lig  2021-06-03
+//                    XSSFClientAnchor anchor = (XSSFClientAnchor) shape.getAnchor();
+//                    //XSSFClientAnchor anchor = picture.getPreferredSize();
+//                    CTMarker marker = anchor.getFrom();
+//                    String key = String.valueOf(marker.getRow());
+//                    map.put(key, picture.getPictureData());
+//                }
+//            }
+//        }
+//        return map;
+//    }
+//
+//    /**
+//     * @param pictureData 图片
+//     * @return 返回图片的文件路径和文件名称
+//     */
+//    public static Map<String, String> savePicture(PictureData pictureData) throws IOException {
+//        FileUtils fileUtils = SpringUtils.getBean(FileUtils.class);
+//        Map<String, String> result = new HashMap<>();
+//        String ext = pictureData.suggestFileExtension();
+//        byte[] data = pictureData.getData();
+//        String picName = IdUtil.simpleUUID() + "." + ext;
+//        String date = DateUtils.getNowTimeFormat("yyyyMMdd");
+//        String folderPath = fileUtils.getSavePath(date);
+//        String filePath = FileUtils.FILE_SEPARATOR + date + FileUtils.FILE_SEPARATOR + picName;
+//        File directory = new File(folderPath);
+//        if (!directory.exists()) {
+//            directory.mkdir();
+//        }
+//        FileOutputStream out = new FileOutputStream(folderPath + picName);
+//        out.write(data);
+//        out.close();
+//        result.put("path", filePath);
+//        result.put("name", picName);
+//        return result;
+//    }
+//
+//    /**
+//     * @param
+//     * @param x           单元格x轴坐标
+//     * @param y           单元格y轴坐标
+//     * @param pictureData 图片二进制数据
+//     * @param picType     图片格式
+//     */
+//    public static void writePicture(Sheet sheet, int x, int y, byte[] pictureData, int picType) {
+//        Drawing drawingPatriarch = sheet.createDrawingPatriarch();
+//        //设置图片单元格位置
+//        ClientAnchor anchor = drawingPatriarch.createAnchor(0, 0, 0, 0, x, y, x + 1, y + 1);
+//        //随单元格改变位置和大小
+//        anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
+//        //添加图片
+//        int pictureIndex = sheet.getWorkbook().addPicture(pictureData, picType);
+//        drawingPatriarch.createPicture(anchor, pictureIndex);
+//    }
+//
+//    public static void setExcelCellStyle(HSSFCellStyle cellStyle) {
+//        cellStyle.setBorderBottom(BorderStyle.THIN);
+//        cellStyle.setBorderLeft(BorderStyle.THIN);
+//        cellStyle.setBorderRight(BorderStyle.THIN);
+//        cellStyle.setBorderTop(BorderStyle.THIN);
+//    }
+//
+//    public static String getValue(Cell cell) {
+//        if (cell != null) {
+//            if (cell.getCellType() == CellType.NUMERIC && HSSFDateUtil.isCellDateFormatted(cell)) {
+//                Date date = cell.getDateCellValue();
+//                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+//                String dateString = dateFormat.format(date);
+//                return dateString;
+//            } else {
+//                return cell.toString();
+//            }
+//        }
+//        return "";
+//    }
+//
 
 }

+ 0 - 34
src/main/java/cn/cslg/pas/common/utils/FileToMultipartFileUtiles.java

@@ -1,34 +0,0 @@
-package cn.cslg.pas.common.utils;
-
-import org.apache.commons.compress.utils.IOUtils;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.springframework.http.MediaType;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.commons.CommonsMultipartFile;
-
-import java.io.*;
-
-/**
- * @author chenyu
- * @date 2023/9/8
- */
-public class FileToMultipartFileUtiles implements Serializable {
-
-    public static MultipartFile fileToMultipartFile(String filePath) {
-        File file = new File(filePath);
-        FileItem item = new DiskFileItemFactory().createItem("file"
-                , MediaType.MULTIPART_FORM_DATA_VALUE
-                , true
-                , file.getName());
-        try (InputStream input = new FileInputStream(file);
-             OutputStream os = item.getOutputStream()) {
-            // 流转移
-            IOUtils.copy(input, os);
-        } catch (Exception e) {
-            throw new IllegalArgumentException("Invalid file: " + e, e);
-        }
-        return new CommonsMultipartFile(item);
-    }
-
-}

+ 0 - 242
src/main/java/cn/cslg/pas/common/utils/FileUtils.java

@@ -1,242 +0,0 @@
-package cn.cslg.pas.common.utils;
-
-import cn.cslg.pas.common.dto.UploadFileDTO;
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.util.IdUtil;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.springframework.boot.system.ApplicationHome;
-import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.commons.CommonsMultipartFile;
-
-import java.io.*;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-
-@Service
-public class FileUtils {
-
-    public static final String FILE_SEPARATOR = System.getProperty("file.separator");
-    public static final String COMMON_FILE = "file";
-    public static final String BACKUP_FILE = "backup";
-
-    public static String getStaticPath(String fileName) {
-        //ApplicationHome类 返回target目录层级
-        ApplicationHome ah = new ApplicationHome(FileUtils.class);
-        //获取 applicationHome 内的路径 ...\target\classes 到这一层级下
-        File file = ah.getSource();
-        //获取 file的parentFile 即最后一级之前的所有层级路径(包括盘符) 这里能获得到的最终层级为  ...\target 后续用FILE_SEPARATOR(系统路径分割通配符 即 "\") 以及fileName拼接生成存放文件的目录层级 即为根目录 root
-        String rootPath = file.getParentFile().toString() + FILE_SEPARATOR + fileName;
-        //根据上方生成的根目录路径 生成对应文件夹 没有就新建
-        File root = new File(rootPath);
-        if (!root.exists()) {
-            root.mkdir();
-        }
-        //返回的最终形式为 盘符:\项目层级\target\file
-        return rootPath;
-    }
-
-    public UploadFileDTO uploadFile(MultipartFile file) {
-        UploadFileDTO fileDTO = new UploadFileDTO();
-        //以下操作为 先取得传入文件的完整文件名 (文件名 + 后缀) 然后用FileUtil分别取出 文件名 和 不带 "." 的后缀 然后将这些内容装配进 实体中
-        //file.getOriginFilename 获取源文件
-        //FileUtil.getPrefix 返回主文件名
-        fileDTO.setName(FileUtil.getPrefix(file.getOriginalFilename()));
-        //FileUtil.extName 获取文件的扩展名(后缀名),扩展名不带 "."
-        fileDTO.setExtName(FileUtil.extName(file.getOriginalFilename()));
-        //获取目录名 用时间作为目录名称
-        String directoryName = this.getDirectoryName();
-        //用IdUtil生成的UUID 与实体中的 extName(后缀名) 拼接后作为文件名 simpleUUID与randomUUID的区别是 simpleUUID 没有 "-"
-        String fileName = IdUtil.simpleUUID() + "." + fileDTO.getExtName();
-        //将完整文件名进行装配
-        fileDTO.setFileName(fileName);
-        //生成存储文件的路径
-        String savePath = this.getSavePath(directoryName);
-        //根据生成存储文件的路径 生成对应文件夹 没有就新建
-        File directory = new File(savePath);
-        if (!directory.exists()) {
-            directory.mkdir();
-        }
-        this.saveFile(file, savePath + fileName);
-        fileDTO.setPath(FILE_SEPARATOR + directoryName + FILE_SEPARATOR + fileName);
-        fileDTO.setFileSize(file.getSize());
-        return fileDTO;
-    }
-
-    public String createDirectory() {
-        String directoryName = this.getDirectoryName();
-        String savePath = this.getSavePath(directoryName);
-        File directory = new File(savePath);
-        if (!directory.exists()) {
-            directory.mkdir();
-        }
-        return directoryName;
-    }
-
-    public void saveFile(MultipartFile file, String path) {
-        try {
-            file.transferTo(new File(path));
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public String getTempPath(String fileName) {
-        String tempPath = getStaticPath(COMMON_FILE) + FILE_SEPARATOR + "temp";
-        File file = new File(tempPath);
-        if (!file.exists()) {
-            file.mkdir();
-        }
-        return tempPath + FILE_SEPARATOR + fileName;
-    }
-
-    public String getSavePath(String directoryName) {
-        return getStaticPath(COMMON_FILE) + FILE_SEPARATOR + directoryName + FILE_SEPARATOR;
-    }
-
-    public String getDirectory(String fileName) {
-        return FILE_SEPARATOR + this.createDirectory() + FILE_SEPARATOR + fileName;
-    }
-
-    public String getDirectory2(String directoryName) {
-        return FILE_SEPARATOR + directoryName + FILE_SEPARATOR;
-    }
-
-    public String getSystemPath(String url) {
-        return getStaticPath(COMMON_FILE) + FILE_SEPARATOR + url;
-    }
-
-    public String getSystemPath() {
-        return getStaticPath(COMMON_FILE);
-    }
-
-    public String getDirectoryName() {
-        return DateUtils.getNowTimeFormat("yyyyMMdd");
-    }
-
-    public String getPath(String url) {
-        return getStaticPath(COMMON_FILE) + url;
-    }
-
-    public String analysisJsonFile() {
-        ApplicationHome ah = new ApplicationHome(BackupUtils.class);
-        File file = ah.getSource();
-        String settingFilePath = file.getParentFile().toString() + FileUtils.FILE_SEPARATOR + "uploadSetting.json";
-        BufferedReader reader = null;
-        StringBuilder last = new StringBuilder();
-        InputStreamReader inputStreamReader;
-        try (FileInputStream fileInputStream = new FileInputStream(settingFilePath)) {
-            inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
-
-            reader = new BufferedReader(inputStreamReader);
-            String tempString;
-            while ((tempString = reader.readLine()) != null) {
-                last.append(tempString);
-            }
-            reader.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            if (reader != null) {
-                try {
-                    reader.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return last.toString();
-    }
-    public String analysisJsonFile(String fileName) {
-        ApplicationHome ah = new ApplicationHome(BackupUtils.class);
-        File file = ah.getSource();
-        String settingFilePath = file.getParentFile().toString() + FileUtils.FILE_SEPARATOR + "uploadSetting.json";
-        BufferedReader reader = null;
-        StringBuilder last = new StringBuilder();
-        InputStreamReader inputStreamReader;
-        try (FileInputStream fileInputStream = new FileInputStream(settingFilePath)) {
-            inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
-
-            reader = new BufferedReader(inputStreamReader);
-            String tempString;
-            while ((tempString = reader.readLine()) != null) {
-                last.append(tempString);
-            }
-            reader.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            if (reader != null) {
-                try {
-                    reader.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return last.toString();
-    }
-
-    public static MultipartFile fileToMultipartFile(File file) {
-        DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(16, null);
-        FileItem item = diskFileItemFactory.createItem(file.getName(), "text/plain", true, file.getName());
-        int bytesRead = 0;
-        byte[] buffer = new byte[8192];
-        try {
-            FileInputStream fis = new FileInputStream(file);
-            OutputStream os = item.getOutputStream();
-            int len = 8192;
-            while ((bytesRead = fis.read(buffer, 0, len)) != -1) {
-                os.write(buffer, 0, bytesRead);
-            }
-            os.close();
-            fis.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return (MultipartFile) new CommonsMultipartFile(item);
-    }
-
-    public static File getFile(String url) throws Exception {
-        //读取图片类型
-        String fileName = url.substring(url.lastIndexOf("."), url.length());
-        File file = null;
-
-        URL urlfile;
-        InputStream inStream = null;
-        OutputStream os = null;
-        try {
-            file = File.createTempFile("new_url", ".jpg");
-            //获取文件
-            urlfile = new URL(url);
-            inStream = urlfile.openStream();
-            os = new FileOutputStream(file);
-
-            int bytesRead = 0;
-            byte[] buffer = new byte[8192];
-            while ((bytesRead = inStream.read(buffer, 0, 8192)) != -1) {
-                os.write(buffer, 0, bytesRead);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (null != os) {
-                    os.close();
-                }
-                if (null != inStream) {
-                    inStream.close();
-                }
-
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-
-        return file;
-    }
-
-
-}
-

+ 3 - 2
src/main/java/cn/cslg/pas/common/utils/LoginUtils.java

@@ -1,12 +1,13 @@
 package cn.cslg.pas.common.utils;
 
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletRequest;
 import org.springframework.stereotype.Component;
 import org.springframework.web.context.request.RequestAttributes;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
+
 import java.util.List;
 
 @Component

+ 196 - 196
src/main/java/cn/cslg/pas/common/utils/ReadExcelUtils.java

@@ -22,201 +22,201 @@ import java.util.Map;
  */
 @Service
 public class ReadExcelUtils {
-    /**
-     * 检测Excel文件合法性
-     *
-     * @param tempFile 临时文件
-     * @return 返回文件总行数
-     */
-    public static Integer textExcel(File tempFile, String sourceId) throws IOException {
-        //判断文件是否存在
-        if (!tempFile.exists() || tempFile.getPath().trim().equals("")) {
-            ThrowException.throwXiaoShiException("文件上传失败,服务器忙请稍后再试!");
-        }
-
-        // 检测是否为excel文件
-        String suffix = tempFile.getPath().substring(tempFile.getPath().lastIndexOf("."));
-        if (!suffix.equals(".xls") && !suffix.equals(".xlsx") && !suffix.equals(".XLS") && !suffix.equals(".XLSX")) {
-            //删除临时文件tempFile
-            new File(tempFile.getPath()).delete();
-            ThrowException.throwXiaoShiException("文件格式错误,请上传Excel文件!");
-        }
-
-        InputStream fis = new FileInputStream(tempFile);
-        //使用poi框架解析处理Excel文件
-        Workbook workbook = null;
-        //区分不同版本Excel,使用各自对应的工具类
-        if (suffix.equals(".xls") || suffix.equals(".XLS")) {
-            workbook = new HSSFWorkbook(fis);
-        } else if (suffix.equals(".xlsx") || suffix.equals(".XLSX")) {
-            workbook = new XSSFWorkbook(fis);
-        }
-        //读取第几个sheet
-        Sheet sheet = workbook.getSheetAt(0);
-        //读取总行数
-        int rows = sheet.getPhysicalNumberOfRows();
-        if (rows <= 1) {
-            //删除临时文件tempFile
-            fis.close();
-            new File(tempFile.getPath()).delete();
-            ThrowException.throwXiaoShiException("文件内容格式不正确,请检查总行数是否有专利内容");
-        }
-
-        //获取第一行抬头
-        Row firstRow = sheet.getRow(0);
-        boolean flag1 = false;  //是否有 "公开(公告)号"
-        boolean flag2 = false;  //是否有 "申请号"
-        //遍历第一行单元格抬头,检查合法性
-        String title = "", source = "";
-        if (sourceId.equals("1")) {
-            source = "智慧芽";
-            title = "公开(公告)号";
-        } else if (sourceId.equals("2")) {
-            source = "合享";
-            title = "公开(公告)号";
-        } else {
-            source = "Patentics";
-            title = "公开号";
-        }
-        for (Cell cell : firstRow) {
-            if (cell.getStringCellValue().equals(title)) {
-                flag1 = true;
-            }
-            if (cell.getStringCellValue().equals("申请号")) {
-                flag2 = true;
-            }
-        }
-        if (!flag1 || !flag2) {
-            //删除临时文件tempFile
-            fis.close();
-            new File(tempFile.getPath()).delete();
-            ThrowException.throwXiaoShiException("文件内容格式不正确,您选择【" + source + "】来源,Excel第一行抬头必须有【" + title + "】和【申请号】");
-        }
-
-        //关闭流
-        fis.close();
-
-        //返回文件总行数-1(即专利总数量)
-        return rows - 1;
-    }
-
-    /**
-     * 获取一行专利的全部数据(专利内容数据 + 摘要附图)
-     *
-     * @param tempFile Excel临时文件
-     * @param row      行数
-     * @return 返回装载专利数据(专利内容数据 + 摘要附图)的对象
-     */
-    public static PatentData readExcelOneRow(File tempFile, Sheet sheet, int row) throws IOException {
-        //创建返回最终结果的对象 patentData
-        PatentData patentData = new PatentData();
-        //装载专利数据(除了摘要附图)的map:(key:表头如 "公开(公告)号"  value:表头对应内容如 "CN1307082B")
-        Map<Object, Object> map = new HashMap<>();
-        //装载摘要附图的对象
-        PictureData pictureData = null;
-
-        //开始装载专利数据
-        Row firstRow = sheet.getRow(0);
-        Row needRow = sheet.getRow(row);
-        //获得总列数
-        int columns = firstRow.getLastCellNum();
-        for (int i = 0; i < columns; i++) {
-            map.put(firstRow.getCell(i) + "", ExcelUtils.getValue(needRow.getCell(i)) + "");
-        }
-
-        //开始装载专利摘要附图(判断用07还是03的方法获取图片)
-        String suffix = tempFile.getName().substring(tempFile.getName().lastIndexOf("."));
-        if (suffix.equals(".xls") || suffix.equals(".XLS")) {
-            pictureData = getPictures1((HSSFSheet) sheet, row);
-        } else if (suffix.equals(".xlsx") || suffix.equals(".XLSX")) {
-            pictureData = getPictures2((XSSFSheet) sheet, row);
-        }
-
-        //返回结果对象装载结果
-        patentData.setMap(map);
-        patentData.setPictureData(pictureData);
-
-        return patentData;
-    }
-
-    public static Sheet readExcel(File tempFile) {
-        Sheet sheet = null;
-
-        try {
-            InputStream inputStream = new FileInputStream(tempFile);
-            //POI可以处理Excel文件
-            Workbook workbook = null;
-            //当文件以.xls结尾时
-            String suffix = tempFile.getName().substring(tempFile.getName().lastIndexOf("."));
-            if (suffix.equals(".xls") || suffix.equals(".XLS")) {
-                workbook = new HSSFWorkbook(inputStream);
-            } else if (suffix.equals(".xlsx") || suffix.equals(".XLSX")) {
-                workbook = new XSSFWorkbook(inputStream);
-            }
-
-            //读取第几个sheet
-            sheet = workbook.getSheetAt(0);
-
-            //关闭流
-            inputStream.close();
-
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        return sheet;
-    }
-
-    /**
-     * 03版本Excel取附图
-     *
-     * @param sheet Excel工作簿
-     * @return 返回附图map
-     */
-    public static PictureData getPictures1(HSSFSheet sheet, Integer row) throws IOException {
-        if (sheet.getDrawingPatriarch() != null) {
-            List<HSSFShape> list = sheet.getDrawingPatriarch().getChildren();
-            for (HSSFShape shape : list) {
-                if (shape instanceof HSSFPicture) {
-                    HSSFPicture picture = (HSSFPicture) shape;
-                    HSSFClientAnchor cAnchor = (HSSFClientAnchor) picture.getAnchor();
-                    int row1 = cAnchor.getRow1();
-                    if (row1 == row) {
-                        return picture.getPictureData();
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * 07版本Excel取附图
-     *
-     * @param sheet Excel工作簿
-     * @return 返回附图map
-     */
-    public static PictureData getPictures2(XSSFSheet sheet, Integer row) throws IOException {
-        List<POIXMLDocumentPart> list = sheet.getRelations();
-        for (POIXMLDocumentPart part : list) {
-            if (part instanceof XSSFDrawing) {
-                XSSFDrawing drawing = (XSSFDrawing) part;
-                List<XSSFShape> shapes = drawing.getShapes();
-                for (XSSFShape shape : shapes) {
-                    //解决图片空指针报错问题 lig  2021-06-03
-                    XSSFClientAnchor anchor = (XSSFClientAnchor) shape.getAnchor();
-                    //XSSFClientAnchor anchor = picture.getPreferredSize();
-                    CTMarker marker = anchor.getFrom();
-                    int excelRow = marker.getRow();
-                    if (excelRow == row) {
-                        XSSFPicture picture = (XSSFPicture) shape;
-                        return picture.getPictureData();
-                    }
-                }
-            }
-        }
-
-        return null;
-    }
+//    /**
+//     * 检测Excel文件合法性
+//     *
+//     * @param tempFile 临时文件
+//     * @return 返回文件总行数
+//     */
+//    public static Integer textExcel(File tempFile, String sourceId) throws IOException {
+//        //判断文件是否存在
+//        if (!tempFile.exists() || tempFile.getPath().trim().equals("")) {
+//            ThrowException.throwXiaoShiException("文件上传失败,服务器忙请稍后再试!");
+//        }
+//
+//        // 检测是否为excel文件
+//        String suffix = tempFile.getPath().substring(tempFile.getPath().lastIndexOf("."));
+//        if (!suffix.equals(".xls") && !suffix.equals(".xlsx") && !suffix.equals(".XLS") && !suffix.equals(".XLSX")) {
+//            //删除临时文件tempFile
+//            new File(tempFile.getPath()).delete();
+//            ThrowException.throwXiaoShiException("文件格式错误,请上传Excel文件!");
+//        }
+//
+//        InputStream fis = new FileInputStream(tempFile);
+//        //使用poi框架解析处理Excel文件
+//        Workbook workbook = null;
+//        //区分不同版本Excel,使用各自对应的工具类
+//        if (suffix.equals(".xls") || suffix.equals(".XLS")) {
+//            workbook = new HSSFWorkbook(fis);
+//        } else if (suffix.equals(".xlsx") || suffix.equals(".XLSX")) {
+//            workbook = new XSSFWorkbook(fis);
+//        }
+//        //读取第几个sheet
+//        Sheet sheet = workbook.getSheetAt(0);
+//        //读取总行数
+//        int rows = sheet.getPhysicalNumberOfRows();
+//        if (rows <= 1) {
+//            //删除临时文件tempFile
+//            fis.close();
+//            new File(tempFile.getPath()).delete();
+//            ThrowException.throwXiaoShiException("文件内容格式不正确,请检查总行数是否有专利内容");
+//        }
+//
+//        //获取第一行抬头
+//        Row firstRow = sheet.getRow(0);
+//        boolean flag1 = false;  //是否有 "公开(公告)号"
+//        boolean flag2 = false;  //是否有 "申请号"
+//        //遍历第一行单元格抬头,检查合法性
+//        String title = "", source = "";
+//        if (sourceId.equals("1")) {
+//            source = "智慧芽";
+//            title = "公开(公告)号";
+//        } else if (sourceId.equals("2")) {
+//            source = "合享";
+//            title = "公开(公告)号";
+//        } else {
+//            source = "Patentics";
+//            title = "公开号";
+//        }
+//        for (Cell cell : firstRow) {
+//            if (cell.getStringCellValue().equals(title)) {
+//                flag1 = true;
+//            }
+//            if (cell.getStringCellValue().equals("申请号")) {
+//                flag2 = true;
+//            }
+//        }
+//        if (!flag1 || !flag2) {
+//            //删除临时文件tempFile
+//            fis.close();
+//            new File(tempFile.getPath()).delete();
+//            ThrowException.throwXiaoShiException("文件内容格式不正确,您选择【" + source + "】来源,Excel第一行抬头必须有【" + title + "】和【申请号】");
+//        }
+//
+//        //关闭流
+//        fis.close();
+//
+//        //返回文件总行数-1(即专利总数量)
+//        return rows - 1;
+//    }
+//
+//    /**
+//     * 获取一行专利的全部数据(专利内容数据 + 摘要附图)
+//     *
+//     * @param tempFile Excel临时文件
+//     * @param row      行数
+//     * @return 返回装载专利数据(专利内容数据 + 摘要附图)的对象
+//     */
+//    public static PatentData readExcelOneRow(File tempFile, Sheet sheet, int row) throws IOException {
+//        //创建返回最终结果的对象 patentData
+//        PatentData patentData = new PatentData();
+//        //装载专利数据(除了摘要附图)的map:(key:表头如 "公开(公告)号"  value:表头对应内容如 "CN1307082B")
+//        Map<Object, Object> map = new HashMap<>();
+//        //装载摘要附图的对象
+//        PictureData pictureData = null;
+//
+//        //开始装载专利数据
+//        Row firstRow = sheet.getRow(0);
+//        Row needRow = sheet.getRow(row);
+//        //获得总列数
+//        int columns = firstRow.getLastCellNum();
+//        for (int i = 0; i < columns; i++) {
+//            map.put(firstRow.getCell(i) + "", ExcelUtils.getValue(needRow.getCell(i)) + "");
+//        }
+//
+//        //开始装载专利摘要附图(判断用07还是03的方法获取图片)
+//        String suffix = tempFile.getName().substring(tempFile.getName().lastIndexOf("."));
+//        if (suffix.equals(".xls") || suffix.equals(".XLS")) {
+//            pictureData = getPictures1((HSSFSheet) sheet, row);
+//        } else if (suffix.equals(".xlsx") || suffix.equals(".XLSX")) {
+//            pictureData = getPictures2((XSSFSheet) sheet, row);
+//        }
+//
+//        //返回结果对象装载结果
+//        patentData.setMap(map);
+//        patentData.setPictureData(pictureData);
+//
+//        return patentData;
+//    }
+//
+//    public static Sheet readExcel(File tempFile) {
+//        Sheet sheet = null;
+//
+//        try {
+//            InputStream inputStream = new FileInputStream(tempFile);
+//            //POI可以处理Excel文件
+//            Workbook workbook = null;
+//            //当文件以.xls结尾时
+//            String suffix = tempFile.getName().substring(tempFile.getName().lastIndexOf("."));
+//            if (suffix.equals(".xls") || suffix.equals(".XLS")) {
+//                workbook = new HSSFWorkbook(inputStream);
+//            } else if (suffix.equals(".xlsx") || suffix.equals(".XLSX")) {
+//                workbook = new XSSFWorkbook(inputStream);
+//            }
+//
+//            //读取第几个sheet
+//            sheet = workbook.getSheetAt(0);
+//
+//            //关闭流
+//            inputStream.close();
+//
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//        }
+//
+//        return sheet;
+//    }
+//
+//    /**
+//     * 03版本Excel取附图
+//     *
+//     * @param sheet Excel工作簿
+//     * @return 返回附图map
+//     */
+//    public static PictureData getPictures1(HSSFSheet sheet, Integer row) throws IOException {
+//        if (sheet.getDrawingPatriarch() != null) {
+//            List<HSSFShape> list = sheet.getDrawingPatriarch().getChildren();
+//            for (HSSFShape shape : list) {
+//                if (shape instanceof HSSFPicture) {
+//                    HSSFPicture picture = (HSSFPicture) shape;
+//                    HSSFClientAnchor cAnchor = (HSSFClientAnchor) picture.getAnchor();
+//                    int row1 = cAnchor.getRow1();
+//                    if (row1 == row) {
+//                        return picture.getPictureData();
+//                    }
+//                }
+//            }
+//        }
+//        return null;
+//    }
+//
+//    /**
+//     * 07版本Excel取附图
+//     *
+//     * @param sheet Excel工作簿
+//     * @return 返回附图map
+//     */
+//    public static PictureData getPictures2(XSSFSheet sheet, Integer row) throws IOException {
+//        List<POIXMLDocumentPart> list = sheet.getRelations();
+//        for (POIXMLDocumentPart part : list) {
+//            if (part instanceof XSSFDrawing) {
+//                XSSFDrawing drawing = (XSSFDrawing) part;
+//                List<XSSFShape> shapes = drawing.getShapes();
+//                for (XSSFShape shape : shapes) {
+//                    //解决图片空指针报错问题 lig  2021-06-03
+//                    XSSFClientAnchor anchor = (XSSFClientAnchor) shape.getAnchor();
+//                    //XSSFClientAnchor anchor = picture.getPreferredSize();
+//                    CTMarker marker = anchor.getFrom();
+//                    int excelRow = marker.getRow();
+//                    if (excelRow == row) {
+//                        XSSFPicture picture = (XSSFPicture) shape;
+//                        return picture.getPictureData();
+//                    }
+//                }
+//            }
+//        }
+//
+//        return null;
+//    }
 
 }

+ 0 - 40
src/main/java/cn/cslg/pas/common/utils/SecurityUtils/LoginUtils.java

@@ -1,40 +0,0 @@
-package cn.cslg.pas.common.utils.SecurityUtils;
-
-import cn.cslg.pas.common.utils.RedisUtil;
-import cn.cslg.pas.common.utils.StringUtils;
-import org.springframework.stereotype.Component;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-@Component
-public class LoginUtils {
-    @Resource
-    private RedisUtil redisUtil;
-
-    public static String getToken() {
-        RequestAttributes ra = RequestContextHolder.getRequestAttributes();
-        ServletRequestAttributes sra = (ServletRequestAttributes) ra;
-        HttpServletRequest httpRequest = sra.getRequest();
-        String tem = httpRequest.getHeader("Cookie");
-        List<String> lst = StringUtils.changeStringToString(tem, ";");
-        final String[] token = {null};
-        lst.forEach(item -> {
-            if (item.contains("token")) {
-                token[0] = item;
-            }
-        });
-        return token[0].replaceAll(" ", "");
-    }
-
-    public Integer getId() {
-        String oriToken = LoginUtils.getToken();
-        String q = "token:login:" + oriToken.replace("=", ":");
-        String IdS = redisUtil.get(q);
-        return Integer.parseInt(IdS);
-    }
-}

+ 0 - 41
src/main/java/cn/cslg/pas/common/utils/SecurityUtils/SecurityUtils.java

@@ -1,41 +0,0 @@
-package cn.cslg.pas.common.utils.SecurityUtils;
-
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.Map;
-
-@Component
-public class SecurityUtils {
-    @Resource
-    private LoginUtils loginUtils;
-    protected static final ThreadLocal<Map<String, Object>> threadLocal = new ThreadLocal<>();
-
-    /**
-     * 设置权限标识
-     */
-    public void startDataScope(String Function) {
-        Map<String, Object> m = new HashMap<>();
-        m.put("token", LoginUtils.getToken());
-        m.put("loginId", loginUtils.getId());
-        m.put("functionId", Function);
-        threadLocal.set(m);
-    }
-
-    /**
-     * 获取权限标识
-     */
-    public static Map<String, Object> getDataScope() {
-        return threadLocal.get();
-    }
-
-    /**
-     * 清除权限标识
-     */
-    public static void cleanDataScope() {
-        threadLocal.remove();
-    }
-
-
-}

+ 0 - 117
src/main/java/cn/cslg/pas/common/utils/ServletUtils.java

@@ -1,117 +0,0 @@
-package cn.cslg.pas.common.utils;
-
-import cn.cslg.pas.common.core.Convert;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.IOException;
-
-/**
- * 客户端工具类
- */
-public class ServletUtils {
-    /**
-     * 获取String参数
-     */
-    public static String getParameter(String name) {
-        return getRequest().getParameter(name);
-    }
-
-    /**
-     * 获取String参数
-     */
-    public static String getParameter(String name, String defaultValue) {
-        return Convert.toStr(getRequest().getParameter(name), defaultValue);
-    }
-
-    /**
-     * 获取Integer参数
-     */
-    public static Integer getParameterToInt(String name) {
-        return Convert.toInt(getRequest().getParameter(name));
-    }
-
-    /**
-     * 获取Integer参数
-     */
-    public static Integer getParameterToInt(String name, Integer defaultValue) {
-        return Convert.toInt(getRequest().getParameter(name), defaultValue);
-    }
-
-    /**
-     * 获取request
-     */
-    public static HttpServletRequest getRequest() {
-        return getRequestAttributes().getRequest();
-    }
-
-    /**
-     * 获取response
-     */
-    public static HttpServletResponse getResponse() {
-        return getRequestAttributes().getResponse();
-    }
-
-    /**
-     * 获取session
-     */
-    public static HttpSession getSession() {
-        return getRequest().getSession();
-    }
-
-    public static ServletRequestAttributes getRequestAttributes() {
-        RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
-        return (ServletRequestAttributes) attributes;
-    }
-
-    /**
-     * 将字符串渲染到客户端
-     *
-     * @param response 渲染对象
-     * @param string   待渲染的字符串
-     * @return null
-     */
-    public static String renderString(HttpServletResponse response, String string) {
-        try {
-            response.setStatus(200);
-            response.setContentType("application/json");
-            response.setCharacterEncoding("utf-8");
-            response.getWriter().print(string);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    /**
-     * 是否是Ajax异步请求
-     *
-     * @param request
-     */
-//    public static boolean isAjaxRequest(HttpServletRequest request) {
-//        String accept = request.getHeader("accept");
-//        if (accept != null && accept.indexOf("application/json") != -1) {
-//            return true;
-//        }
-//
-//        String xRequestedWith = request.getHeader("X-Requested-With");
-//        if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) {
-//            return true;
-//        }
-//
-//        String uri = request.getRequestURI();
-//        if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) {
-//            return true;
-//        }
-//
-//        String ajax = request.getParameter("__ajax");
-//        if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) {
-//            return true;
-//        }
-//        return false;
-//    }
-}

+ 0 - 729
src/main/java/cn/cslg/pas/common/utils/SoMap.java

@@ -1,729 +0,0 @@
-package cn.cslg.pas.common.utils;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.regex.Pattern;
-
-/**
- * Map< String, Object> 是最常用的一种Map类型,但是它写着麻烦 
- * <p>所以特封装此类,继承Map,进行一些扩展,可以让Map更灵活使用 
- * <p>最新:2020-12-10 新增部分构造方法
- * @author kong
- */
-public class SoMap extends LinkedHashMap<String, Object> {
-
-	private static final long serialVersionUID = 1L;
-
-	public SoMap() {
-	}
-	
-	/** 以下元素会在isNull函数中被判定为Null, */
-	public static final Object[] NULL_ELEMENT_ARRAY = {null, ""};
-	public static final List<Object> NULL_ELEMENT_LIST;
-
-	static {
-		NULL_ELEMENT_LIST = Arrays.asList(NULL_ELEMENT_ARRAY);
-	}
-
-	// ============================= 读值 =============================
-
-	/** 获取一个值 */
-	@Override
-	public Object get(Object key) {
-		if("this".equals(key)) {
-			return this;
-		}
-		return super.get(key);
-	}
-
-	/** 如果为空,则返回默认值 */
-	public Object get(Object key, Object defaultValue) {
-		Object value = get(key);
-		if(valueIsNull(value)) {
-			return defaultValue;
-		}
-		return value;
-	}
-	
-	/** 转为String并返回 */
-	public String getString(String key) {
-		Object value = get(key);
-		if(value == null) {
-			return null;
-		}
-		return String.valueOf(value);
-	}
-
-	/** 如果为空,则返回默认值 */
-	public String getString(String key, String defaultValue) {
-		Object value = get(key);
-		if(valueIsNull(value)) {
-			return defaultValue;
-		}
-		return String.valueOf(value);
-	}
-
-	/** 转为int并返回 */
-	public int getInt(String key) {
-		Object value = get(key);
-		if(valueIsNull(value)) {
-			return 0;
-		}
-		return Integer.valueOf(String.valueOf(value));
-	}
-	/** 转为int并返回,同时指定默认值 */
-	public int getInt(String key, int defaultValue) {
-		Object value = get(key);
-		if(valueIsNull(value)) {
-			return defaultValue;
-		}
-		return Integer.valueOf(String.valueOf(value));
-	}
-
-	/** 转为long并返回 */
-	public long getLong(String key) {
-		Object value = get(key);
-		if(valueIsNull(value)) {
-			return 0;
-		}
-		return Long.valueOf(String.valueOf(value));
-	}
-
-	/** 转为double并返回 */
-	public double getDouble(String key) {
-		Object value = get(key);
-		if(valueIsNull(value)) {
-			return 0.0;
-		}
-		return Double.valueOf(String.valueOf(value));
-	}
-
-	/** 转为boolean并返回 */
-	public boolean getBoolean(String key) {
-		Object value = get(key);
-		if(valueIsNull(value)) {
-			return false;
-		}
-		return Boolean.valueOf(String.valueOf(value));
-	}
-
-	/** 转为Date并返回,根据自定义格式 */
-	public Date getDateByFormat(String key, String format) {
-		try {
-			return new SimpleDateFormat(format).parse(getString(key));
-		} catch (Exception e) {
-			throw new RuntimeException(e);
-		}
-	}
-
-	/** 转为Date并返回,根据格式: yyyy-MM-dd */
-	public Date getDate(String key) {
-		return getDateByFormat(key, "yyyy-MM-dd");
-	}
-
-	/** 转为Date并返回,根据格式: yyyy-MM-dd HH:mm:ss */
-	public Date getDateTime(String key) {
-		return getDateByFormat(key, "yyyy-MM-dd HH:mm:ss");
-	}
-
-	/** 转为Map并返回 */
-	@SuppressWarnings({ "unchecked", "rawtypes" })
-	public SoMap getMap(String key) {
-		Object value = get(key);
-		if(value == null) {
-			return SoMap.getSoMap();
-		}
-		if(value instanceof Map) {
-			return SoMap.getSoMap((Map)value);
-		}
-		if(value instanceof String) {
-			return SoMap.getSoMap().setJsonString((String)value);
-		}
-		throw new RuntimeException("值无法转化为SoMap: " + value);
-	}
-
-	/** 获取集合(必须原先就是个集合,否则会创建个新集合并返回) */
-	@SuppressWarnings("unchecked")
-	public List<Object> getList(String key) {
-		Object value = get(key);
-		List<Object> list = null;
-		if(value == null || value.equals("")) {
-			list = new ArrayList<Object>();
-		}
-		else if(value instanceof List) {
-			list = (List<Object>)value;
-		} else {
-			list = new ArrayList<Object>();
-			list.add(value);
-		}
-		return list;
-	}
-
-	/** 获取集合 (指定泛型类型) */
-	public <T> List<T> getList(String key, Class<T> cs) {
-		List<Object> list = getList(key);
-		List<T> list2 = new ArrayList<T>();
-		for (Object obj : list) {
-			T objC = getValueByClass(obj, cs);
-			list2.add(objC);
-		}
-		return list2;
-	}
-
-	/** 获取集合(逗号分隔式),(指定类型) */
-	public <T> List<T> getListByComma(String key, Class<T> cs) {
-		String listStr = getString(key);
-		if(listStr == null || listStr.equals("")) {
-			return new ArrayList<>();
-		}
-		// 开始转化
-		String [] arr = listStr.split(",");
-		List<T> list = new ArrayList<T>();
-		for (String str : arr) {
-			if(cs == int.class || cs == Integer.class || cs == long.class || cs == Long.class) {
-				str = str.trim();
-			}
-			T objC = getValueByClass(str, cs);
-			list.add(objC);
-		}
-		return list;
-	}
-
-
-	/** 根据指定类型从map中取值,返回实体对象 */
-	public <T> T getModel(Class<T> cs) {
-		try {
-			return getModelByObject(cs.newInstance());
-		} catch (Exception e) {
-			throw new RuntimeException(e);
-		}
-	}
-	
-	/** 从map中取值,塞到一个对象中 */
-	public <T> T getModelByObject(T obj) {
-		// 获取类型 
-		Class<?> cs = obj.getClass();
-		// 循环复制  
-		for (Field field : cs.getDeclaredFields()) {
-			try {
-				// 获取对象 
-				Object value = this.get(field.getName());	
-				if(value == null) {
-					continue;
-				}
-				field.setAccessible(true);	
-				Object valueConvert = getValueByClass(value, field.getType());
-				field.set(obj, valueConvert);
-			} catch (IllegalArgumentException | IllegalAccessException e) {
-				throw new RuntimeException("属性取值出错:" + field.getName(), e);
-			}
-		}
-		return obj;
-	}
-
-	
-
-	/**
-	 * 将指定值转化为指定类型并返回
-	 * @param obj
-	 * @param cs
-	 * @param <T>
-	 * @return
-	 */
-	@SuppressWarnings("unchecked")
-	public static <T> T getValueByClass(Object obj, Class<T> cs) {
-		String obj2 = String.valueOf(obj);
-		Object obj3 = null;
-		if (cs.equals(String.class)) {
-			obj3 = obj2;
-		} else if (cs.equals(int.class) || cs.equals(Integer.class)) {
-			obj3 = Integer.valueOf(obj2);
-		} else if (cs.equals(long.class) || cs.equals(Long.class)) {
-			obj3 = Long.valueOf(obj2);
-		} else if (cs.equals(short.class) || cs.equals(Short.class)) {
-			obj3 = Short.valueOf(obj2);
-		} else if (cs.equals(byte.class) || cs.equals(Byte.class)) {
-			obj3 = Byte.valueOf(obj2);
-		} else if (cs.equals(float.class) || cs.equals(Float.class)) {
-			obj3 = Float.valueOf(obj2);
-		} else if (cs.equals(double.class) || cs.equals(Double.class)) {
-			obj3 = Double.valueOf(obj2);
-		} else if (cs.equals(boolean.class) || cs.equals(Boolean.class)) {
-			obj3 = Boolean.valueOf(obj2);
-		} else {
-			obj3 = (T)obj;
-		}
-		return (T)obj3;
-	}
-
-	
-	// ============================= 写值 =============================
-
-	/**
-	 * 给指定key添加一个默认值(只有在这个key原来无值的情况先才会set进去)
-	 */
-	public void setDefaultValue(String key, Object defaultValue) {
-		if(isNull(key)) {
-			set(key, defaultValue);
-		}
-	}
-
-	/** set一个值,连缀风格 */
-	public SoMap set(String key, Object value) {
-		// 防止敏感key 
-		if(key.toLowerCase().equals("this")) {		
-			return this;
-		}
-		put(key, value);
-		return this;
-	}
-
-	/** 将一个Map塞进SoMap */
-	public SoMap setMap(Map<String, ?> map) {
-		if(map != null) {
-			for (String key : map.keySet()) {
-				this.set(key, map.get(key));
-			}
-		}
-		return this;
-	}
-
-	/** 将一个对象解析塞进SoMap */
-	public SoMap setModel(Object model) {
-		if(model == null) {
-			return this;
-		}
-		Field[] fields = model.getClass().getDeclaredFields();
-	    for (Field field : fields) {
-	        try{
-	            field.setAccessible(true);
-	            boolean isStatic = Modifier.isStatic(field.getModifiers());
-	            if(!isStatic) {
-		            this.set(field.getName(), field.get(model));
-	            }
-	        }catch (Exception e){
-	        	throw new RuntimeException(e);
-	        }
-	    }
-		return this;
-	}
-
-	/** 将json字符串解析后塞进SoMap */
-	public SoMap setJsonString(String jsonString) {
-		try {
-			@SuppressWarnings("unchecked")
-			Map<String, Object> map = new ObjectMapper().readValue(jsonString, Map.class);
-			return this.setMap(map);
-		} catch (JsonProcessingException e) {
-			throw new RuntimeException(e);
-		}
-	}
-
-	
-	// ============================= 删值 =============================
-
-	/** delete一个值,连缀风格 */
-	public SoMap delete(String key) {
-		remove(key);
-		return this;
-	}
-
-	/** 清理所有value为null的字段 */
-	public SoMap clearNull() {
-		Iterator<String> iterator = this.keySet().iterator();
-		while(iterator.hasNext()) {
-			String key = iterator.next();
-			if(this.isNull(key)) {
-				iterator.remove();
-				this.remove(key);
-			}
-
-		}
-		return this;
-	}
-	/** 清理指定key */
-	public SoMap clearIn(String ...keys) {
-		List<String> keys2 = Arrays.asList(keys);
-		Iterator<String> iterator = this.keySet().iterator();
-		while(iterator.hasNext()) {
-			String key = iterator.next();
-			if(keys2.contains(key) == true) {
-				iterator.remove();
-				this.remove(key);
-			}
-		}
-		return this;
-	}
-	/** 清理掉不在列表中的key */
-	public SoMap clearNotIn(String ...keys) {
-		List<String> keys2 = Arrays.asList(keys);
-		Iterator<String> iterator = this.keySet().iterator();
-		while(iterator.hasNext()) {
-			String key = iterator.next();
-			if(keys2.contains(key) == false) {
-				iterator.remove();
-				this.remove(key);
-			}
-
-		}
-		return this;
-	}
-	/** 清理掉所有key */
-	public SoMap clearAll() {
-		clear();
-		return this;
-	}
-	
-
-	// ============================= 快速构建 ============================= 
-
-	/** 构建一个SoMap并返回 */
-	public static SoMap getSoMap() {
-		return new SoMap();
-	}
-	/** 构建一个SoMap并返回 */
-	public static SoMap getSoMap(String key, Object value) {
-		return new SoMap().set(key, value);
-	}
-	/** 构建一个SoMap并返回 */
-	public static SoMap getSoMap(Map<String, ?> map) {
-		return new SoMap().setMap(map);
-	}
-
-	/** 将一个对象集合解析成为SoMap */
-	public static SoMap getSoMapByModel(Object model) {
-		return SoMap.getSoMap().setModel(model);
-	}
-	
-	/** 将一个对象集合解析成为SoMap集合 */
-	public static List<SoMap> getSoMapByList(List<?> list) {
-		List<SoMap> listMap = new ArrayList<SoMap>();
-		for (Object model : list) {
-			listMap.add(getSoMapByModel(model));
-		}
-		return listMap;
-	}
-	
-	/** 克隆指定key,返回一个新的SoMap */
-	public SoMap cloneKeys(String... keys) {
-		SoMap so = new SoMap();
-		for (String key : keys) {
-			so.set(key, this.get(key));
-		}
-		return so;
-	}
-	/** 克隆所有key,返回一个新的SoMap */
-	public SoMap cloneSoMap() {
-		SoMap so = new SoMap();
-		for (String key : this.keySet()) {
-			so.set(key, this.get(key));
-		}
-		return so;
-	}
-
-	/** 将所有key转为大写 */
-	public SoMap toUpperCase() {
-		SoMap so = new SoMap();
-		for (String key : this.keySet()) {
-			so.set(key.toUpperCase(), this.get(key));
-		}
-		this.clearAll().setMap(so);
-		return this;
-	}
-	/** 将所有key转为小写 */
-	public SoMap toLowerCase() {
-		SoMap so = new SoMap();
-		for (String key : this.keySet()) {
-			so.set(key.toLowerCase(), this.get(key));
-		}
-		this.clearAll().setMap(so);
-		return this;
-	}
-	/** 将所有key中下划线转为中划线模式 (kebab-case风格) */
-	public SoMap toKebabCase() {
-		SoMap so = new SoMap();
-		for (String key : this.keySet()) {
-			so.set(wordEachKebabCase(key), this.get(key));
-		}
-		this.clearAll().setMap(so);
-		return this;
-	}
-	/** 将所有key中下划线转为小驼峰模式 */
-	public SoMap toHumpCase() {
-		SoMap so = new SoMap();
-		for (String key : this.keySet()) {
-			so.set(wordEachBigFs(key), this.get(key));
-		}
-		this.clearAll().setMap(so);
-		return this;
-	}
-	/** 将所有key中小驼峰转为下划线模式 */
-	public SoMap humpToLineCase() {
-		SoMap so = new SoMap();
-		for (String key : this.keySet()) {
-			so.set(wordHumpToLine(key), this.get(key));
-		}
-		this.clearAll().setMap(so);
-		return this;
-	}
-	
-	
-	
-	
-	// ============================= 辅助方法 =============================
-
-
-	/** 指定key是否为null,判定标准为 NULL_ELEMENT_ARRAY 中的元素  */
-	public boolean isNull(String key) {
-		return valueIsNull(get(key));
-	}
-
-	/** 指定key列表中是否包含value为null的元素,只要有一个为null,就会返回true */
-	public boolean isContainNull(String ...keys) {
-		for (String key : keys) {
-			if(this.isNull(key)) {
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	/** 与isNull()相反 */
-	public boolean isNotNull(String key) {
-		return !isNull(key);
-	}
-	/** 指定key的value是否为null,作用同isNotNull() */
-	public boolean has(String key) {
-		return !isNull(key);
-	}
-	
-	/** 指定value在此SoMap的判断标准中是否为null */
-	public boolean valueIsNull(Object value) {
-		return NULL_ELEMENT_LIST.contains(value);
-	}
-	
-	/** 验证指定key不为空,为空则抛出异常 */
-	public SoMap checkNull(String ...keys) {
-		for (String key : keys) {
-			if(this.isNull(key)) {
-				throw new RuntimeException("参数" + key + "不能为空");
-			}
-		}
-		return this;
-	}
-
-	static Pattern patternNumber = Pattern.compile("[0-9]*");
-	/** 指定key是否为数字 */
-	public boolean isNumber(String key) {
-		String value = getString(key);
-		if(value == null) {
-			return false;
-		}
-	    return patternNumber.matcher(value).matches();   
-	}
-
-	
-	
-	
-	/**
-	 * 转为JSON字符串
-	 */
-	public String toJsonString() {
-		try {
-//			SoMap so = SoMap.getSoMap(this);
-			return new ObjectMapper().writeValueAsString(this);
-		} catch (Exception e) {
-			throw new RuntimeException(e);
-		}
-	}
-
-//	/**
-//	 * 转为JSON字符串, 带格式的 
-//	 */
-//	public String toJsonFormatString() {
-//		try {
-//			return JSON.toJSONString(this, true); 
-//		} catch (Exception e) {
-//			throw new RuntimeException(e);
-//		}
-//	}
-
-	// ============================= web辅助 =============================
-
-
-	/**
-	 * 返回当前request请求的的所有参数 
-	 * @return
-	 */
-	public static SoMap getRequestSoMap() {
-		// 大善人SpringMVC提供的封装 
-		ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
-		if(servletRequestAttributes == null) {
-			throw new RuntimeException("当前线程非JavaWeb环境");
-		}
-		// 当前request
-		HttpServletRequest request = servletRequestAttributes.getRequest(); 
-		if (request.getAttribute("currentSoMap") == null || request.getAttribute("currentSoMap") instanceof SoMap == false ) {
-			initRequestSoMap(request);
-		}
-		return (SoMap)request.getAttribute("currentSoMap");
-	}
-
-	/** 初始化当前request的 SoMap */
-	private static void initRequestSoMap(HttpServletRequest request) {
-		SoMap soMap = new SoMap();
-		Map<String, String[]> parameterMap = request.getParameterMap();	// 获取所有参数 
-		for (String key : parameterMap.keySet()) {
-			try {
-				String[] values = parameterMap.get(key); // 获得values 
-				if(values.length == 1) {
-					soMap.set(key, values[0]);
-				} else {
-					List<String> list = new ArrayList<String>();
-					for (String v : values) {
-						list.add(v);
-					}
-					soMap.set(key, list);
-				}
-			} catch (Exception e) {
-				throw new RuntimeException(e);
-			}
-		}
-		request.setAttribute("currentSoMap", soMap);
-	}
-	
-	/**
-	 * 验证返回当前线程是否为JavaWeb环境 
-	 * @return
-	 */
-	public static boolean isJavaWeb() {
-		ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();// 大善人SpringMVC提供的封装 
-		if(servletRequestAttributes == null) {
-			return false;
-		}
-		return true;
-	}
-	
-
-
-	// ============================= 常见key (以下key经常用,所以封装以下,方便写代码) =============================
-
-	/** get 当前页  */
-	public int getKeyPageNo() {
-		int pageNo = getInt("pageNo", 1);
-		if(pageNo <= 0) {
-			pageNo = 1;
-		}
-		return pageNo;
-	}
-	/** get 页大小  */
-	public int getKeyPageSize() {
-		int pageSize = getInt("pageSize", 10);
-		if(pageSize <= 0 || pageSize > 1000) {
-			pageSize = 10;
-		}
-		return pageSize;
-	}
-
-	/** get 排序方式 */
-	public int getKeySortType() {
-		return getInt("sortType");
-	}
-
-
-
-
-	
-
-	// ============================= 工具方法 =============================
-	
-
-	/**
-	 * 将一个一维集合转换为树形集合 
-	 * @param list         集合
-	 * @param idKey        id标识key
-	 * @param parentIdKey  父id标识key
-	 * @param childListKey 子节点标识key
-	 * @return 转换后的tree集合 
-	 */
-	public static List<SoMap> listToTree(List<SoMap> list, String idKey, String parentIdKey, String childListKey) {
-		// 声明新的集合,存储tree形数据 
-		List<SoMap> newTreeList = new ArrayList<SoMap>();
-		// 声明hash-Map,方便查找数据 
-		SoMap hash = new SoMap();
-		// 将数组转为Object的形式,key为数组中的id 
-		for (int i = 0; i < list.size(); i++) {
-			SoMap json = (SoMap) list.get(i);
-			hash.put(json.getString(idKey), json);
-		}
-		// 遍历结果集
-		for (int j = 0; j < list.size(); j++) {
-			// 单条记录
-			SoMap aVal = (SoMap) list.get(j);
-			// 在hash中取出key为单条记录中pid的值
-			SoMap hashVp = (SoMap) hash.get(aVal.get(parentIdKey, "").toString());
-			// 如果记录的pid存在,则说明它有父节点,将她添加到孩子节点的集合中
-			if (hashVp != null) {
-				// 检查是否有child属性,有则添加,没有则新建 
-				if (hashVp.get(childListKey) != null) {
-					@SuppressWarnings("unchecked")
-					List<SoMap> ch = (List<SoMap>) hashVp.get(childListKey);
-					ch.add(aVal);
-					hashVp.put(childListKey, ch);
-				} else {
-					List<SoMap> ch = new ArrayList<SoMap>();
-					ch.add(aVal);
-					hashVp.put(childListKey, ch);
-				}
-			} else {
-				newTreeList.add(aVal);
-			}
-		}
-		return newTreeList;
-	}
-	
-	
-
-	/** 指定字符串的字符串下划线转大写模式 */
-	private static String wordEachBig(String str){
-		String newStr = "";
-		for (String s : str.split("_")) {
-			newStr += wordFirstBig(s);
-		}
-		return newStr;
-	}
-	/** 返回下划线转小驼峰形式 */
-	private static String wordEachBigFs(String str){
-		return wordFirstSmall(wordEachBig(str));
-	}
-
-	/** 将指定单词首字母大写 */
-	private static String wordFirstBig(String str) {
-		return str.substring(0, 1).toUpperCase() + str.substring(1, str.length());
-	}
-
-	/** 将指定单词首字母小写 */
-	private static String wordFirstSmall(String str) {
-		return str.substring(0, 1).toLowerCase() + str.substring(1, str.length());
-	}
-
-	/** 下划线转中划线 */
-	private static String wordEachKebabCase(String str) {
-		return str.replaceAll("_", "-");
-	}
-
-	/** 驼峰转下划线  */
-	private static String wordHumpToLine(String str) {
-		return str.replaceAll("[A-Z]", "_$0").toLowerCase();
-	}
-	
-
-}

+ 20 - 0
src/main/java/cn/cslg/pas/controller/CommonController.java

@@ -0,0 +1,20 @@
+package cn.cslg.pas.controller;
+
+
+import cn.cslg.pas.common.core.base.Constants;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@RequestMapping(Constants.API_XiaoSHI + "/common")
+@RestController
+public class CommonController {
+    private String getQueryConditions(){
+
+
+        return "";
+    }
+
+
+}

+ 13 - 3
src/main/java/cn/cslg/pas/controller/EventController.java

@@ -1,8 +1,15 @@
 package cn.cslg.pas.controller;
 
 import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.request.QueryRequest;
+import cn.cslg.pas.common.model.request.StringRequest;
 import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.service.Business;
+import cn.cslg.pas.service.business.EventService;
+import cn.cslg.pas.service.query.BusinessFactory;
+import io.swagger.v3.oas.annotations.Operation;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -14,9 +21,12 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping(Constants.API_XiaoSHI + "/event")
 @RestController
 public class EventController {
-
-    public String add() {
-        return Response.success();
+    @Operation(summary = "查询事件")
+    @PostMapping("/queryEvent")
+    public String  queryEvent( StringRequest stringRequest){
+  EventService business =  (EventService)BusinessFactory.getClass(EventService.class);
+  business.queryMessage(stringRequest);
+ return "";
     }
 
 }

+ 14 - 15
src/main/java/cn/cslg/pas/controller/ProjectImportController.java

@@ -23,21 +23,20 @@ import java.io.IOException;
 @RequestMapping(Constants.API_XiaoSHI + "/import")
 @RestController
 public class ProjectImportController {
-    private final ProjectImportService projectImportService;
-
-    @Operation(summary = "Excel导入专利任务")
-    @PostMapping("/excelImport")
-    public String excelImport(MultipartFile file, ExcelImportDTO excelImportDTO) throws IOException {
-        projectImportService.addExcelImportTask(file, excelImportDTO);
-        return Response.success();
-    }
-
-    @Operation(summary = "检索导入专利任务")
-    @PostMapping("/patentStarImport")
-    public String patentStarImport(ExcelImportDTO excelImportDTO) throws IOException {
-        projectImportService
-        return Response.success();
-    }
+//    private final ProjectImportService projectImportService;
+//
+//    @Operation(summary = "Excel导入专利任务")
+//    @PostMapping("/excelImport")
+//    public String excelImport(MultipartFile file, ExcelImportDTO excelImportDTO) throws IOException {
+//        projectImportService.addExcelImportTask(file, excelImportDTO);
+//        return Response.success();
+//    }
+//
+//    @Operation(summary = "检索导入专利任务")
+//    @PostMapping("/patentStarImport")
+//    public String patentStarImport(ExcelImportDTO excelImportDTO) throws IOException {
+//        return Response.success();
+//    }
 
 
 }

+ 8 - 0
src/main/java/cn/cslg/pas/domain/School.java

@@ -0,0 +1,8 @@
+package cn.cslg.pas.domain;
+
+import lombok.Data;
+
+@Data
+public class School {
+    private String name;
+}

+ 7 - 0
src/main/java/cn/cslg/pas/service/Business.java

@@ -0,0 +1,7 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.common.model.request.QueryRequest;
+
+public interface Business {
+    public Object queryMessage(QueryRequest queryRequest);
+}

+ 13 - 0
src/main/java/cn/cslg/pas/service/BusinessFactory.java

@@ -0,0 +1,13 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.service.business.EventService;
+import cn.cslg.pas.service.query.EsQuery;
+import cn.cslg.pas.service.query.Query;
+
+public class BusinessFactory {
+
+    private Business createObject(){
+        return new EventService();
+
+    }
+}

+ 27 - 0
src/main/java/cn/cslg/pas/service/EsService.java

@@ -0,0 +1,27 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.domain.School;
+import co.elastic.clients.elasticsearch.ElasticsearchClient;
+import co.elastic.clients.elasticsearch.core.IndexResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class EsService {
+ private final ElasticsearchClient client;
+    public void addDoc() throws Exception {
+        School user = new School();
+        user.setName("广西");
+        IndexResponse indexResponse = client.index(i -> i
+                .index("school")
+                //设置id
+                .id("1")
+                //传入user对象
+                .document(user));
+
+
+    }
+}

+ 95 - 95
src/main/java/cn/cslg/pas/service/FileManagerService.java

@@ -40,100 +40,100 @@ public class FileManagerService {
      *
      * @param multipartFiles 文件
      */
-    public String uploadFile(List<MultipartFile> multipartFiles) throws IOException {
-        List<File> files = new ArrayList<>();
-        for (MultipartFile multipartFile : multipartFiles) {
-            File file = new File(multipartFile.getOriginalFilename());
-            FileCopyUtils.copy(multipartFile.getBytes(), file);
-            files.add(file);
-        }
-        MultipartBody.Builder multipartBodyBuilder = new MultipartBody.Builder()
-                .setType(MultipartBody.FORM);
-        for (File file : files) {
-            //根据文件名获取文件的MIME类型
-            String mimeType = getMimeType(file.getPath());
-            multipartBodyBuilder.addFormDataPart("files", file.getName(), RequestBody.create(MediaType.parse(mimeType), file));
-        }
-        RequestBody requestBody = multipartBodyBuilder
-                .addFormDataPart("sourceId", String.valueOf(FileSource))
-                .build();
-        OkHttpClient okHttpClient = new OkHttpClient.Builder()
-                .connectTimeout(60, TimeUnit.SECONDS)
-                .writeTimeout(60, TimeUnit.SECONDS)
-                .readTimeout(60, TimeUnit.SECONDS)
-                .build();
-        Request request = new Request.Builder()
-                .url(FMSUrl + "/fileManager/uploadSystemFile")
-                .post(requestBody)
-                .build();
-        Response response = null;
-        response = okHttpClient.newCall(request).execute();
-        // 最后记得删除临时文件
-        for (File file : files) {
-            FileUtils.deleteQuietly(file);
-        }
-        return Objects.requireNonNull(response.body()).string();
-    }
-
-    /**
-     * 调用文件系统取出文件接口(获得文件流)
-     *
-     * @param fieldId 文件id
-     */
-    public byte[] downloadSystemFileFromFMS(Integer fieldId) throws IOException {
-        OkHttpClient okHttpClient = new OkHttpClient.Builder()
-                .connectTimeout(60, TimeUnit.SECONDS)
-                .writeTimeout(60, TimeUnit.SECONDS)
-                .readTimeout(60, TimeUnit.SECONDS)
-                .build();
-        Request request = new Request.Builder()
-                .url(FMSUrl + "/fileManager/downloadSystemFile?fileId=" + fieldId)
-                .get()
-                .build();
-        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).bytes();
-    }
-
-    /**
-     * 调用文件系统获取文件信息接口
-     *
-     * @param fileIds 文件ids
-     */
-    public String getSystemFileFromFMS(List<Integer> fileIds) throws IOException {
-        String param = new Gson().toJson(fileIds);
-        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
-        OkHttpClient okHttpClient = new OkHttpClient.Builder()
-                .connectTimeout(60, TimeUnit.SECONDS)
-                .writeTimeout(60, TimeUnit.SECONDS)
-                .readTimeout(60, TimeUnit.SECONDS)
-                .build();
-        Request request = new Request.Builder()
-                .url(FMSUrl + "/fileManager/getFileData")
-                .post(requestBody)
-                .build();
-        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
-    }
-
-    /**
-     * 调用文件系统删除文件接口
-     *
-     * @param ids 需要删除的文件ids
-     */
-    public String deleteFileFromFMS(List<Integer> ids) throws IOException {
-        FMSDeleteFileDTO fmsDeleteFileDTO = new FMSDeleteFileDTO();
-        fmsDeleteFileDTO.setIds(ids);
-        fmsDeleteFileDTO.setType(2);
-        String param = new Gson().toJson(fmsDeleteFileDTO);
-        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
-        OkHttpClient okHttpClient = new OkHttpClient.Builder()
-                .connectTimeout(60, TimeUnit.SECONDS)
-                .writeTimeout(60, TimeUnit.SECONDS)
-                .readTimeout(60, TimeUnit.SECONDS)
-                .build();
-        Request request = new Request.Builder()
-                .url(FMSUrl + "/fileManager/deleteSystemFile")
-                .post(requestBody)
-                .build();
-        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
-    }
+//    public String uploadFile(List<MultipartFile> multipartFiles) throws IOException {
+//        List<File> files = new ArrayList<>();
+//        for (MultipartFile multipartFile : multipartFiles) {
+//            File file = new File(multipartFile.getOriginalFilename());
+//            FileCopyUtils.copy(multipartFile.getBytes(), file);
+//            files.add(file);
+//        }
+//        MultipartBody.Builder multipartBodyBuilder = new MultipartBody.Builder()
+//                .setType(MultipartBody.FORM);
+//        for (File file : files) {
+//            //根据文件名获取文件的MIME类型
+//            String mimeType = getMimeType(file.getPath());
+//            multipartBodyBuilder.addFormDataPart("files", file.getName(), RequestBody.create(MediaType.parse(mimeType), file));
+//        }
+//        RequestBody requestBody = multipartBodyBuilder
+//                .addFormDataPart("sourceId", String.valueOf(FileSource))
+//                .build();
+//        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+//                .connectTimeout(60, TimeUnit.SECONDS)
+//                .writeTimeout(60, TimeUnit.SECONDS)
+//                .readTimeout(60, TimeUnit.SECONDS)
+//                .build();
+//        Request request = new Request.Builder()
+//                .url(FMSUrl + "/fileManager/uploadSystemFile")
+//                .post(requestBody)
+//                .build();
+//        Response response = null;
+//        response = okHttpClient.newCall(request).execute();
+//        // 最后记得删除临时文件
+//        for (File file : files) {
+//            FileUtils.deleteQuietly(file);
+//        }
+//        return Objects.requireNonNull(response.body()).string();
+//    }
+//
+//    /**
+//     * 调用文件系统取出文件接口(获得文件流)
+//     *
+//     * @param fieldId 文件id
+//     */
+//    public byte[] downloadSystemFileFromFMS(Integer fieldId) throws IOException {
+//        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+//                .connectTimeout(60, TimeUnit.SECONDS)
+//                .writeTimeout(60, TimeUnit.SECONDS)
+//                .readTimeout(60, TimeUnit.SECONDS)
+//                .build();
+//        Request request = new Request.Builder()
+//                .url(FMSUrl + "/fileManager/downloadSystemFile?fileId=" + fieldId)
+//                .get()
+//                .build();
+//        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).bytes();
+//    }
+//
+//    /**
+//     * 调用文件系统获取文件信息接口
+//     *
+//     * @param fileIds 文件ids
+//     */
+//    public String getSystemFileFromFMS(List<Integer> fileIds) throws IOException {
+//        String param = new Gson().toJson(fileIds);
+//        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
+//        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+//                .connectTimeout(60, TimeUnit.SECONDS)
+//                .writeTimeout(60, TimeUnit.SECONDS)
+//                .readTimeout(60, TimeUnit.SECONDS)
+//                .build();
+//        Request request = new Request.Builder()
+//                .url(FMSUrl + "/fileManager/getFileData")
+//                .post(requestBody)
+//                .build();
+//        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+//    }
+//
+//    /**
+//     * 调用文件系统删除文件接口
+//     *
+//     * @param ids 需要删除的文件ids
+//     */
+//    public String deleteFileFromFMS(List<Integer> ids) throws IOException {
+//        FMSDeleteFileDTO fmsDeleteFileDTO = new FMSDeleteFileDTO();
+//        fmsDeleteFileDTO.setIds(ids);
+//        fmsDeleteFileDTO.setType(2);
+//        String param = new Gson().toJson(fmsDeleteFileDTO);
+//        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
+//        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+//                .connectTimeout(60, TimeUnit.SECONDS)
+//                .writeTimeout(60, TimeUnit.SECONDS)
+//                .readTimeout(60, TimeUnit.SECONDS)
+//                .build();
+//        Request request = new Request.Builder()
+//                .url(FMSUrl + "/fileManager/deleteSystemFile")
+//                .post(requestBody)
+//                .build();
+//        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+//    }
 
 }

+ 34 - 0
src/main/java/cn/cslg/pas/service/business/CommonService.java

@@ -0,0 +1,34 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.model.common.QueryCondition;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import java.io.*;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@Slf4j
+public class CommonService{
+    public static List<QueryCondition> readJsonFile(String fileName) {
+        Gson gson = new Gson();
+        String json = "";
+        try {
+            File file = new File("target/file/event.json");
+            Reader reader = new InputStreamReader(new FileInputStream(file), "utf-8");
+            int ch = 0;
+            StringBuffer buffer = new StringBuffer();
+            while ((ch = reader.read()) != -1) {
+                buffer.append((char) ch);
+            }
+            reader.close();
+            json = buffer.toString();
+            return gson.fromJson(json, List.class);
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+}

+ 11 - 12
src/main/java/cn/cslg/pas/service/business/EventService.java

@@ -1,26 +1,25 @@
 package cn.cslg.pas.service.business;
 
-
+import cn.cslg.pas.common.model.request.QueryRequest;
 import cn.cslg.pas.domain.Event;
 import cn.cslg.pas.mapper.EventMapper;
+import cn.cslg.pas.service.Business;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Lazy;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
-
-
 @Service
 @Slf4j
-@RequiredArgsConstructor(onConstructor_ = {@Lazy})
-public class EventService extends ServiceImpl<EventMapper, Event> {
-    private final EventMapper eventMapper;
-    public String getEvent(){
-        eventMapper.getEvent("create_id =1");
+public class EventService  extends ServiceImpl<EventMapper, Event> implements Business{
+    @Autowired
+    private  EventMapper eventMapper;
+    public String getEvent(String sql){
+        eventMapper.getEvent(sql);
         return  "";
     }
-
+    public Object queryMessage(QueryRequest queryRequest){
+        return "";
+    };
 
 }

+ 54 - 54
src/main/java/cn/cslg/pas/service/importPatent/ImportPatentPatentStar.java

@@ -1,54 +1,54 @@
-package cn.cslg.pas.service.importPatent;
-
-import cn.cslg.pas.entity.ImportTask;
-import lombok.RequiredArgsConstructor;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.stereotype.Service;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 检索导入专利工厂类
- *
- * @author chenyu
- * @date 2023/10/20
- */
-@Service
-@RequiredArgsConstructor
-public class ImportPatentPatentStar implements IImportPatentFactory {
-
-    @Override
-    public void startImport(ImportTask importTask) {
-        //若本次下载任务是超过一万条专利的全部下载任务
-        Integer allNum = importTask.getAllNum();
-        if (allNum <= 10000) {  //导入不超过一万件专利
-            importLessThan10000(importTask);
-        } else {  //导入超过一万件专利
-            //importMoreThan10000(importTask);
-        }
-
-    }
-
-    private void importLessThan10000(ImportTask importTask) {
-        try {
-            Integer successNum = importTask.getSuccessNum();
-
-            //下载 isAdd中的专利
-            if (isAddPatentNos != null && isAddPatentNos.size() > 0) {
-                String patentNoCondition = StringUtils.join(isAddPatentNos, " OR ");
-                conditions = "AN=(" + patentNoCondition + ")";
-                downLoadIsAddPatentNos(isAddPatentNos, task, orderBy, orderByType, dbType, cells, conditions);
-            }
-
-        } catch (IOException e) {
-            e.printStackTrace();
-            //生产消费到一半时,发生错误异常,将任务状态置为完成
-            task = taskService.getById(task.getId());
-            task.setStatus(2);
-            taskService.updateById(task);
-        }
-    }
-
-}
+//package cn.cslg.pas.service.importPatent;
+//
+//import cn.cslg.pas.entity.ImportTask;
+//import lombok.RequiredArgsConstructor;
+//import org.apache.commons.lang3.StringUtils;
+//import org.springframework.stereotype.Service;
+//
+//import java.io.IOException;
+//import java.util.List;
+//import java.util.Map;
+//
+///**
+// * 检索导入专利工厂类
+// *
+// * @author chenyu
+// * @date 2023/10/20
+// */
+//@Service
+//@RequiredArgsConstructor
+//public class ImportPatentPatentStar implements IImportPatentFactory {
+//
+////    @Override
+////    public void startImport(ImportTask importTask) {
+////        //若本次下载任务是超过一万条专利的全部下载任务
+////        Integer allNum = importTask.getAllNum();
+////        if (allNum <= 10000) {  //导入不超过一万件专利
+////            importLessThan10000(importTask);
+////        } else {  //导入超过一万件专利
+////            //importMoreThan10000(importTask);
+////        }
+////
+////    }
+//
+////    private void importLessThan10000(ImportTask importTask) {
+////        try {
+////            Integer successNum = importTask.getSuccessNum();
+////
+////            //下载 isAdd中的专利
+////            if (isAddPatentNos != null && isAddPatentNos.size() > 0) {
+////                String patentNoCondition = StringUtils.join(isAddPatentNos, " OR ");
+////                conditions = "AN=(" + patentNoCondition + ")";
+////                downLoadIsAddPatentNos(isAddPatentNos, task, orderBy, orderByType, dbType, cells, conditions);
+////            }
+////
+////        } catch (IOException e) {
+////            e.printStackTrace();
+////            //生产消费到一半时,发生错误异常,将任务状态置为完成
+////            task = taskService.getById(task.getId());
+////            task.setStatus(2);
+////            taskService.updateById(task);
+////        }
+////    }
+//
+//}

+ 2 - 2
src/main/java/cn/cslg/pas/service/importPatent/PatentQueueService.java

@@ -25,7 +25,7 @@ public class PatentQueueService {
     private final ImportTaskService importTaskService;
     private final ImportPatentExcel importPatentExcel;
     private final ImportPatentPatentNo importPatentPatentNo;
-    private final ImportPatentPatentStar importPatentPatentStar;
+//    private final ImportPatentPatentStar importPatentPatentStar;
     private final List<Integer> importTaskQueue = new ArrayList<>();
     private final Lock importTaskLock = new ReentrantLock();
     private final Condition importTaskCondition = importTaskLock.newCondition();
@@ -83,7 +83,7 @@ public class PatentQueueService {
             case 2:
                 return importPatentPatentNo;
             case 4:
-                return importPatentPatentStar;
+//                return importPatentPatentStar;
             default:
                 return null;
         }

+ 63 - 63
src/main/java/cn/cslg/pas/service/importPatent/ProjectImportService.java

@@ -34,68 +34,68 @@ import java.util.List;
 @RequiredArgsConstructor
 @Service
 public class ProjectImportService {
-    private final FileManagerService fileManagerService;
-    private final PatentQueueService patentQueueService;
-    private final ImportTaskService importTaskService;
-    private final ImportTaskConditionService importTaskConditionService;
-    private final AssoTaskFieldService assoTaskFieldService;
-    private final LoginUtils loginUtils;
-
-    /**
-     * 新增Excel导入任务
-     *
-     * @param file           Excel文件
-     * @param excelImportDTO Excel导入专利DTO类对象
-     */
-    public void addExcelImportTask(MultipartFile file, ExcelImportDTO excelImportDTO) throws IOException {
-        //获得文件类型后缀
-        String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
-
-        //创建临时文件 tempFile,并将 file读取到 tempFile
-        File tempFile = File.createTempFile("temp", suffix);
-        try (
-                InputStream inputStream = file.getInputStream();
-                FileOutputStream outputStream = new FileOutputStream(tempFile)
-        ) {
-            IOUtils.copy(inputStream, outputStream);
-        }
-
-        //检查临时文件 tempFile合法性并获取专利总数量 total
-        Integer total = ReadExcelUtils.textExcel(tempFile, excelImportDTO.getSourceId());
-
-        //删除临时文件tempFile
-        new File(tempFile.getPath()).delete();
-
-        //TODO 将文件file上传至服务器,并返回文件guid
-
-
-        //导入任务条件表新增数据
-        ImportTaskCondition importTaskCondition = new ImportTaskCondition()
-                .setProjectId(excelImportDTO.getProjectId())
-                .setProjectType(excelImportDTO.getProjectType())
-                .setType(1)
-                //.setFileGuid() 等谢翔文件系统
-                .setSourceId(Integer.valueOf(excelImportDTO.getSourceId()))
-                .setCreateId(loginUtils.getId());
-        log.info("导入任务条件表新增数据");
-        importTaskConditionService.save(importTaskCondition);
-
-        //导入任务表新增数据
-        ImportTask importTask = new ImportTask()
-                .setAllNum(total)
-                .setProgress(0D)
-                .setSuccessNum(0)
-                .setDefaultNum(0)
-                .setImportTaskConditionId(importTaskCondition.getId())
-                .setType(1)
-                .setState(0)
-                .setCreateId(loginUtils.getId());
-        log.info("导入任务表新增数据");
-        importTaskService.save(importTask);
-
-        //任务存入生产者任务队列并唤醒生产者线程
-        patentQueueService.addImportTasksToQueue(Arrays.asList(importTask.getId()));
-        patentQueueService.awakeTasktch();
-    }
+//    private final FileManagerService fileManagerService;
+//    private final PatentQueueService patentQueueService;
+//    private final ImportTaskService importTaskService;
+//    private final ImportTaskConditionService importTaskConditionService;
+//    private final AssoTaskFieldService assoTaskFieldService;
+//    private final LoginUtils loginUtils;
+//
+//    /**
+//     * 新增Excel导入任务
+//     *
+//     * @param file           Excel文件
+//     * @param excelImportDTO Excel导入专利DTO类对象
+//     */
+//    public void addExcelImportTask(MultipartFile file, ExcelImportDTO excelImportDTO) throws IOException {
+//        //获得文件类型后缀
+//        String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
+//
+//        //创建临时文件 tempFile,并将 file读取到 tempFile
+//        File tempFile = File.createTempFile("temp", suffix);
+//        try (
+//                InputStream inputStream = file.getInputStream();
+//                FileOutputStream outputStream = new FileOutputStream(tempFile)
+//        ) {
+//            IOUtils.copy(inputStream, outputStream);
+//        }
+//
+//        //检查临时文件 tempFile合法性并获取专利总数量 total
+//        Integer total = ReadExcelUtils.textExcel(tempFile, excelImportDTO.getSourceId());
+//
+//        //删除临时文件tempFile
+//        new File(tempFile.getPath()).delete();
+//
+//        //TODO 将文件file上传至服务器,并返回文件guid
+//
+//
+//        //导入任务条件表新增数据
+//        ImportTaskCondition importTaskCondition = new ImportTaskCondition()
+//                .setProjectId(excelImportDTO.getProjectId())
+//                .setProjectType(excelImportDTO.getProjectType())
+//                .setType(1)
+//                //.setFileGuid() 等谢翔文件系统
+//                .setSourceId(Integer.valueOf(excelImportDTO.getSourceId()))
+//                .setCreateId(loginUtils.getId());
+//        log.info("导入任务条件表新增数据");
+//        importTaskConditionService.save(importTaskCondition);
+//
+//        //导入任务表新增数据
+//        ImportTask importTask = new ImportTask()
+//                .setAllNum(total)
+//                .setProgress(0D)
+//                .setSuccessNum(0)
+//                .setDefaultNum(0)
+//                .setImportTaskConditionId(importTaskCondition.getId())
+//                .setType(1)
+//                .setState(0)
+//                .setCreateId(loginUtils.getId());
+//        log.info("导入任务表新增数据");
+//        importTaskService.save(importTask);
+//
+//        //任务存入生产者任务队列并唤醒生产者线程
+//        patentQueueService.addImportTasksToQueue(Arrays.asList(importTask.getId()));
+//        patentQueueService.awakeTasktch();
+//    }
 
 }

+ 22 - 0
src/main/java/cn/cslg/pas/service/query/BusinessFactory.java

@@ -0,0 +1,22 @@
+package cn.cslg.pas.service.query;
+
+import cn.cslg.pas.service.Business;
+
+public class BusinessFactory {
+
+    public static Object getClass(Class<? extends Business> clazz) {
+        Object obj = null;
+
+        try {
+            obj = Class.forName(clazz.getName()).newInstance();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        }
+        return obj;
+    }
+
+}

+ 5 - 1
src/main/java/cn/cslg/pas/service/query/QueryService.java

@@ -10,10 +10,14 @@ import org.springframework.stereotype.Service;
 import java.io.*;
 import java.util.*;
 
+/**
+ * 格式化检索式类
+ */
+
 @Service
 @Slf4j
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
-public class QueryService {
+public class FormatQueryService {
     public String getText(String text) throws Exception {
         treeNode tree = expressManager.getInstance().Parse(text, false);
         String a = this.get(tree);

+ 0 - 9
src/main/java/cn/cslg/pas/service/query/QueryFactory.java

@@ -1,9 +0,0 @@
-package cn.cslg.pas.service.query;
-
-public class QueryFactory {
-
-    private Query createObject(){
-        return new EsQuery();
-
-    }
-}

+ 2 - 2
src/main/resources/application-dev.yml

@@ -12,9 +12,9 @@ spring:
         max-wait: -1ms
     timeout: 2000ms
   datasource:
-    url: jdbc:mysql://127.0.0.1:3306/pas_prod2?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+    url: jdbc:mysql://192.168.1.24:3306/pas_prod2?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
     username: root
-    password: root
+    password: rrzTwWAYX8Gxh5JH
     driver-class-name: com.mysql.cj.jdbc.Driver
     type: com.alibaba.druid.pool.DruidDataSource
     druid: