Ver código fonte

合并恩之和慧娟的代码

zhangenzhi 1 ano atrás
pai
commit
02d8b852ec

+ 3 - 1
src/main/java/com/pavis/backend/slim/common/constant/Constant.java

@@ -72,11 +72,13 @@ public class Constant {
     /**
      * 小文件最大大小: 5MB = 1024 * 1024 * 5
      */
-    public static final long FILE_MAX_SIZE = 5242880L;
+    // public static final long FILE_MAX_SIZE = 5242880L;
 
     /**
      * 海阳项目使用
      * 小文件最大大小: 50MB = 1024 * 1024 * 50
      */
     public static final long FILE_ZERO_MAX_SIZE = 52428800L;
+    // public static final long FILE_MAX_SIZE = 5242880L;
+    public static final long FILE_MAX_SIZE = 209715200L;
 }

+ 31 - 0
src/main/java/com/pavis/backend/slim/framework/minio/MinioStorage.java

@@ -13,6 +13,7 @@ import io.minio.errors.MinioException;
 import io.minio.errors.ServerException;
 import io.minio.errors.XmlParserException;
 import io.minio.http.Method;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
 
@@ -30,6 +32,7 @@ import java.security.NoSuchAlgorithmException;
  * @create 2023-04-22 14:28
  */
 @Component
+@Slf4j
 public class MinioStorage {
 
     @Autowired
@@ -148,10 +151,13 @@ public class MinioStorage {
      * @return 文件key值
      */
     public String genKeyWithPath(Long userId, String filename, String path) {
+        log.info("userId:{},filename:{},path:{}",userId,filename,path);
         StringBuilder builder = StrUtil.builder();
         if (StringUtils.equals(path, Constant.DIR_SEP)) {
+            log.info("path is /");
             return genKey(userId, filename);
         } else {
+            log.info("path is not /");
             return builder.append(userId)
                     .append(path)
                     .append(filename)
@@ -196,4 +202,29 @@ public class MinioStorage {
             throw new UtilException(e.getMessage());
         }
     }
+
+    /**
+     * 上传文件至指定bucket或指定文件夹. InputStream.
+     * @param key
+     * @param inputStream
+     * @param fileSize
+     * @throws IOException
+     * @throws NoSuchAlgorithmException
+     * @throws InvalidKeyException
+     */
+    public void putMinioByStream(String key, InputStream inputStream,Long fileSize) throws IOException, NoSuchAlgorithmException, InvalidKeyException {
+        try {
+            // InputStream inputStream = file.getInputStream();
+            // 1. 创建bucket
+            createBucket(bucketName);
+            // 2. 存储文件
+            log.info("minio 存储文件key:{},fileSize:{}",key,fileSize);
+            if (null != inputStream){
+                log.info("fileSize is not null...");
+            }
+            client.putObject(PutObjectArgs.builder().bucket(bucketName).object(key).stream(inputStream, fileSize, -1).build());
+        } catch (MinioException e) {
+            throw new UtilException(e.getMessage());
+        }
+    }
 }

+ 27 - 0
src/main/java/com/pavis/backend/slim/framework/web/domain/BaseEntity.java

@@ -53,6 +53,17 @@ public class BaseEntity implements Serializable {
      */
     private String remark;
 
+    /**
+     * onlyoffice中唯一表示key。
+     */
+    @TableField(exist = false)
+    private String fileKey;
+    /**
+     * 完整minio的链接。
+     */
+    @TableField(exist = false)
+    private String totalUrl;
+
     /**
      * 请求参数
      */
@@ -109,6 +120,22 @@ public class BaseEntity implements Serializable {
         this.remark = remark;
     }
 
+    public String getFileKey() {
+        return fileKey;
+    }
+
+    public void setFileKey(String fileKey) {
+        this.fileKey = fileKey;
+    }
+
+    public String getTotalUrl() {
+        return totalUrl;
+    }
+
+    public void setTotalUrl(String totalUrl) {
+        this.totalUrl = totalUrl;
+    }
+
     public Map<String, Object> getParams() {
         if (params == null) {
             params = new HashMap<>();

+ 71 - 62
src/main/java/com/pavis/backend/slim/project/system/controller/EditorController.java

@@ -3,11 +3,16 @@ package com.pavis.backend.slim.project.system.controller;
 
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
+import com.pavis.backend.slim.project.system.service.SysFileService;
 import io.minio.DownloadObjectArgs;
 import io.minio.MinioClient;
 import io.minio.errors.MinioException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
+import org.springframework.ui.Model;
+import org.springframework.ui.ModelMap;
 import org.springframework.util.StreamUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
@@ -20,13 +25,17 @@ import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
+import java.text.SimpleDateFormat;
 
 
 @Controller
 @ResponseBody
 @RequestMapping("/office")
+@Slf4j
 public class EditorController {
 
+    @Autowired
+    private SysFileService fileService;
 
     @GetMapping("/online")
     public void online(HttpServletResponse response, HttpServletRequest request) {
@@ -51,70 +60,70 @@ public class EditorController {
 
 
     @PostMapping(path = "/save")
-    public void save(HttpServletResponse response, HttpServletRequest request) {
+    public void save(@RequestParam("fileId") String fileId, @RequestParam("path") String path, HttpServletResponse response, HttpServletRequest request) {
+        log.info("/office/save comming...");
+        log.info("fileId:{},path:{}", fileId, path);
+        fileService.onlyOfficeToMinio(fileId,path, response, request);
+    }
 
-        try {
-            // 获得response信息
-            PrintWriter writer = response.getWriter();
-
-            // 获取数据文件信息
-            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-            StreamUtils.copy(request.getInputStream(), byteArrayOutputStream);
-            String fileInfoStr = byteArrayOutputStream.toString();
-            byteArrayOutputStream.close();
-
-            if (fileInfoStr.isEmpty()) {
-                writer.write("request的输入流为空");
-                return;
-            }
-
-            System.out.println(fileInfoStr);
-
-            // 转化字符串对象转化为JSON对象
-            JSONObject fileInfoObj = JSON.parseObject(fileInfoStr);
-
-            // 获取编辑文件的状态
-
-            int status = (Integer) fileInfoObj.get("status");
-            int saved = 0;
-
-            // 关闭正在编辑的文档10秒钟后,会收到该消息
-            if(status == 2 || status == 3) {
-                // 获取文件数据
-                try {
-                    URL url = new URL((String) fileInfoObj.get("url"));
-                    java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
-                    InputStream inputStream = connection.getInputStream();
-
-                    if (inputStream == null){
-                        throw new Exception("Stream is null");
-                    }
-
-                    // 保存编辑后的数据
-                    String path = "D:\\test.docx";
-                    File file = new File(path);
-
-                    // 复制数据流
-                    FileOutputStream outputStream = new FileOutputStream(file);
-                    StreamUtils.copy(inputStream, outputStream);
-
-                    // 关闭数据资源
-                    outputStream.close();
-                    inputStream.close();
-                    connection.disconnect();
-                } catch (Exception ex) {
-                    saved = 1;
-                    ex.printStackTrace();
-                }
-                System.out.println("保存文件成功");
-            }
-
-
-            writer.write("{\"error\":" + saved + "}");
-        } catch (IOException e) {
-            e.printStackTrace();
+    @RequestMapping("/EditorServlet")
+    public ModelAndView index(HttpServletRequest request, HttpServletResponse response, Model model, ModelMap modelMap) throws Exception {
+        log.info("---EditorServlet---->:{}", request.getParameterMap().toString());
+        String fileName = "";
+        if (request.getParameterMap().containsKey("fileName")) {
+            fileName = request.getParameter("fileName");
+        }
+
+        String fileExt = null;
+        if (request.getParameterMap().containsKey("fileExt")) {
+            fileExt = request.getParameter("fileExt");
         }
-    }
 
+        // if (fileExt != null) {
+        //     try {
+        //         DocumentManager.Init(request, response);
+        //         fileName = DocumentManager.CreateDemo(fileExt);
+        //     } catch (Exception ex) {
+        //         return new ModelAndView(new FastJsonJsonView(),"Error: " + ex.getMessage(), ex) ;
+        //     }
+        // }
+
+        // String mode = "";
+        // if (request.getParameterMap().containsKey("mode"))
+        // {
+        //     mode = request.getParameter("mode");
+        // }
+        // Boolean desktopMode = !"embedded".equals(mode);
+        //
+        // FileModel file = new FileModel();
+        // file.SetTypeDesktop(desktopMode);
+        // file.SetFileName(fileName);
+        //
+        // System.out.println("==========EditorController==========");
+        // DocumentManager.Init(request, response);
+        // //要编辑的文件名
+        // model.addAttribute("fileName", fileName) ;
+        // //要编辑的文件类型
+        // model.addAttribute("fileType", FileUtility.GetFileExtension(fileName).replace(".", "")) ;
+        // //要编辑的文档类型
+        // model.addAttribute("documentType",FileUtility.GetFileType(fileName).toString().toLowerCase()) ;
+        // //要编辑的文档访问url
+        // model.addAttribute("fileUri",DocumentManager.GetFileUri(fileName)) ;
+        // model.addAttribute("fileKey",ServiceConverter.GenerateRevisionId(DocumentManager.CurUserHostAddress(null) + "/" + fileName)) ;
+        // model.addAttribute("callbackUrl", DocumentManager.GetCallback(fileName)) ;
+        // model.addAttribute("serverUrl", DocumentManager.GetServerUrl()) ;
+        // model.addAttribute("editorMode", DocumentManager.GetEditedExts().contains(FileUtility.GetFileExtension(fileName)) && !"view".equals(request.getAttribute("mode")) ? "edit" : "view") ;
+        // model.addAttribute("editorUserId",DocumentManager.CurUserHostAddress(null)) ;
+        //
+        // model.addAttribute("type", desktopMode ? "desktop" : "embedded");
+        // model.addAttribute("docserviceApiUrl", ConfigManager.GetProperty("files.docservice.url.api"));
+        // model.addAttribute("docServiceUrlPreloader", ConfigManager.GetProperty("files.docservice.url.preloader")) ;
+        // model.addAttribute("currentYear", "2018") ;
+        // model.addAttribute("convertExts", String.join(",", DocumentManager.GetConvertExts())) ;
+        // model.addAttribute("editedExts", String.join(",", DocumentManager.GetEditedExts())) ;
+        // model.addAttribute("documentCreated", new SimpleDateFormat("MM/dd/yyyy").format(new Date())) ;
+        // model.addAttribute("permissionsEdit", Boolean.toString(DocumentManager.GetEditedExts().contains(FileUtility.GetFileExtension(fileName))).toLowerCase()) ;
+        return new ModelAndView("editor");
+    }
 }
 

+ 2 - 0
src/main/java/com/pavis/backend/slim/project/system/domain/SysFile.java

@@ -202,4 +202,6 @@ public class SysFile extends BaseEntity {
     public void setDir(Boolean dir) {
         isDir = dir;
     }
+
+
 }

+ 12 - 1
src/main/java/com/pavis/backend/slim/project/system/service/SysFileService.java

@@ -5,6 +5,8 @@ import com.pavis.backend.slim.project.system.domain.SysFile;
 import com.pavis.backend.slim.project.system.domain.vo.TreeFile;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -73,6 +75,7 @@ public interface SysFileService extends IService<SysFile> {
 
     /**
      * 修改文件名称
+     *
      * @param file 文件详情
      * @return 修改后的文件详情
      */
@@ -80,8 +83,16 @@ public interface SysFileService extends IService<SysFile> {
 
     /**
      * 删除本地单个文件
-     * @param   sPath    被删除文件的文件名
+     *
+     * @param sPath 被删除文件的文件名
      * @return 单个文件删除成功返回true,否则返回false
      */
     boolean deleteFile(String sPath);
+
+    /**
+     * 获取最新编辑的onlyoffice文件,并上传至minio中,同时更新文件路径。
+     *
+     * @param fileId
+     */
+    void onlyOfficeToMinio(String fileId, String path, HttpServletResponse response, HttpServletRequest request);
 }

+ 157 - 0
src/main/java/com/pavis/backend/slim/project/system/service/impl/SysFileServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.crypto.digest.MD5;
 import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.pavis.backend.slim.common.constant.Constant;
 import com.pavis.backend.slim.common.exception.ServiceException;
@@ -16,12 +17,31 @@ import com.pavis.backend.slim.project.system.mapper.SysFileMapper;
 import com.pavis.backend.slim.project.system.service.SysFileService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.compress.utils.IOUtils;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.disk.DiskFileItem;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StreamUtils;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.URL;
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
 import java.util.*;
@@ -32,6 +52,7 @@ import java.util.stream.Collectors;
  * @create 2023-04-24 14:08
  */
 @Service
+@Slf4j
 public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> implements SysFileService {
 
     @Autowired
@@ -47,6 +68,8 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
     @Override
     public SysFile uploadFile(MultipartFile file, String icon, String path, boolean isDir) {
         System.out.println("icon:" + icon);
+        log.info("Constant.DIR_SEP:{}", Constant.DIR_SEP);
+        System.out.println("path:" + path);
         SysFile sysFile = new SysFile();
         // 获取上传文件的用户id
         sysFile.setUserId(SecurityUtils.getUserId());
@@ -175,6 +198,15 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
     public List<TreeFile> getTreeFiles(List<SysFile> sysFileList) {
         List<TreeFile> treeFiles = new ArrayList<>();
         for (SysFile sysFile : sysFileList) {
+            log.info("ghj file:{}", sysFile.getObjectKey());
+            if (null != sysFile.getObjectKey()) {
+                // 获取完整minio链接,在onlyoffice预览文件。
+                String preview = storage.preview(sysFile.getObjectKey());
+                sysFile.setTotalUrl(preview);
+                // 文件key需要唯一,todo 后期此处仍需再修改,虽目前已可以预览文件。
+                sysFile.setFileKey(MD5.create().digestHex16(String.valueOf(System.currentTimeMillis())));
+                log.info("to preview:{}", preview);
+            }
             treeFiles.add(getTreeFile(sysFile, sysFileList));
         }
         System.out.println("1-tree-files:" + JSON.toJSONString(treeFiles));
@@ -239,4 +271,129 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
         return flag;
     }
 
+    @Override
+    public void onlyOfficeToMinio(String fileId, String path, HttpServletResponse response, HttpServletRequest request) {
+        if (null != fileId && StringUtils.isNotEmpty(fileId)) {
+            SysFile selSysFile = baseMapper.selectById(fileId);
+            if (null != selSysFile) {
+                uploadToMinio(path, selSysFile, response, request);
+            } else {
+                throw new ServiceException("文件不存在!");
+            }
+        } else {
+            throw new ServiceException("文件id不能为空!");
+        }
+    }
+
+    /**
+     * 用户编辑的文件上传至minio中。
+     * @param path
+     * @param selSysFile
+     * @param response
+     * @param request
+     */
+    public void uploadToMinio(String path, SysFile selSysFile, HttpServletResponse response, HttpServletRequest request) {
+        try {
+            // 获得response信息
+            PrintWriter writer = response.getWriter();
+            // 获取数据文件信息
+            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+            StreamUtils.copy(request.getInputStream(), byteArrayOutputStream);
+            String fileInfoStr = byteArrayOutputStream.toString();
+            byteArrayOutputStream.close();
+
+            if (fileInfoStr.isEmpty()) {
+                writer.write("输入流为空");
+                log.info("输入流为空");
+                return;
+            }
+            log.info("get onlyOffice fileInfoStr:{}", fileInfoStr);
+
+            // 转化字符串对象转化为JSON对象
+            JSONObject fileInfoObj = JSON.parseObject(fileInfoStr);
+            // 获取编辑文件的状态
+            int status = (Integer) fileInfoObj.get("status");
+            int saved = 0;
+
+            // 关闭正在编辑的文档10秒钟后,会收到该消息。
+            if (status == 2 || status == 3) {
+                // 获取文件数据
+                try {
+                    URL url = new URL((String) fileInfoObj.get("url"));
+                    java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
+                    InputStream inputStream = connection.getInputStream();
+
+                    if (inputStream == null) {
+                        throw new ServiceException("Stream is null");
+                    }
+
+                    // 文件名:
+                    String key = fileInfoObj.get("key").toString();
+                    String filetype = fileInfoObj.get("filetype").toString();
+                    String fileName = FileUtils.genFileName(key) + "-" + key + "." + filetype;
+                    // 本地先保存编辑后的数据
+                    String filePath = "E:\\pvs\\" + fileName;
+                    File file = new File(filePath);
+
+                    // 复制数据流
+                    FileOutputStream outputStream = new FileOutputStream(file);
+                    StreamUtils.copy(inputStream, outputStream);
+                    // 关闭数据资源
+                    outputStream.close();
+                    inputStream.close();
+                    connection.disconnect();
+                    log.info("file size:{}", file.length());
+
+                    // 更新sysFile值。
+                    selSysFile.setName(fileName);
+                    log.info("fileName:{},key:{}",fileName,selSysFile.getName());
+                    // 生成新的key。http://192.168.1.141:8989/cache/files/data/181ba63c8d60452c_2481/output.docx/output.docx?md5=z3NfV5Oj4OhFo6Yo6mk2jw&expires=1692692984&filename=output.docx
+                    String objKey = storage.genKeyWithPath(selSysFile.getUserId(), selSysFile.getName(), path);
+                    selSysFile.setObjectKey(objKey);
+                    // 根据文件key值生成文件url
+                    selSysFile.setUrl(storage.getObjectUrl(objKey));
+                    // 设置文件所属路径。
+                    selSysFile.setPath(path + selSysFile.getName());// 保存编辑后的数据
+                    // 获取文件大小
+                    selSysFile.setSize(file.length());
+                    // 获取文件后缀
+                    selSysFile.setSuffix(StringUtils.substringAfterLast(selSysFile.getOriginalName(), "."));
+                    // 获取文件类型
+                    selSysFile.setType(FileUtils.getFileType(selSysFile.getSuffix()));
+
+                    // 存储到minio
+                    try {
+                        InputStream ins = new FileInputStream(file);
+                        selSysFile.setIdentifier(MD5.create().digestHex16(file));
+                        storage.putMinioByStream(selSysFile.getObjectKey(), ins, file.length());
+                        log.info("---->selSysFile:{}", JSON.toJSONString(selSysFile));
+                        baseMapper.updateById(selSysFile);
+                        if (file.exists()) {
+                            boolean deleteFlag = deleteFile(file.getPath());
+                            log.info("file del path:{},deleteFlag:{}",file.getPath(),deleteFlag);
+                            boolean delete = file.delete();
+                            log.info("delete res:{}",delete);
+                            if (delete) {
+                                log.info("本地临时写入的文件已删除:{}", filePath);
+                            }
+                            log.info("本地临时写入的文件删除失败");
+                        }
+                    } catch (IOException | NoSuchAlgorithmException e) {
+                        log.info("上传至minio ex:{}", e);
+                        throw new ServiceException(e.getMessage());
+                    } catch (InvalidKeyException e) {
+                        log.info("上传至minio key无效:{}", e);
+                        throw new ServiceException("文件的key无效!");
+                    }
+                } catch (Exception ex) {
+                    saved = 1;
+                    ex.printStackTrace();
+                }
+                log.info("文件编辑成功");
+            }
+            writer.write("{\"error\":" + saved + "}");
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
 }

+ 88 - 0
src/main/resources/application-ghj.yml

@@ -0,0 +1,88 @@
+server:
+  port: 8068
+# 通用配置
+pavis:
+  # 需要换成自己开发环境本地的地址
+  profile: F:\ghj\spic\upload\
+#minio配置
+minio:
+#  #对象存储服务的URL
+#  url: http://localhost:9000/
+#  #Access key账户
+#  accessKey: minioadmin
+#  #Secret key密码
+#  secretKey: minioadmin
+#  bucketName: default
+#  #Access key账户
+#  accessKey: 2TlzVcrX1jH2oWhz
+#  #Secret key密码
+#  secretKey: ZfmZgtZO4g1L8iMmVB8DeARCSdyxzI8G
+
+  url: http://192.168.1.141:9000/
+#  #Access key账户
+#  accessKey: upHc9rOpkgBknGOmR9jt
+#  #Secret key密码
+#  secretKey: UAlOMz7KeihAStEimUoFo8h13xmO9ITXFqWDEXFn
+  #Access key账户
+  accessKey: yKE3hqPt6lDF84aoZNZn
+  #Secret key密码
+  secretKey: YUMmEURKm1TsmUeJ9XpOpjS4zpCOFUTUt16uqUuH
+  bucketName: default
+spring:
+  datasource:
+    dynamic:
+      primary: master #设置默认的数据源或者数据源组,默认值即为master
+      strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
+      datasource:
+#        master:
+#          url: jdbc:mysql://192.168.1.166:3306/slim
+#          username: root
+#          password: 123456
+#          driver-class-name: com.mysql.cj.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
+        master:
+          url: jdbc:mysql://192.168.1.141:3310/slim
+          username: root
+          password: Gky.i3g8,
+          driver-class-name: com.mysql.cj.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
+        slave_1:
+          url: jdbc:mysql://192.168.1.141:3311/slim
+          username: root
+          password: Gky.i3g8,
+          driver-class-name: com.mysql.cj.jdbc.Driver
+        slave_2:
+          url: jdbc:mysql://192.168.1.141:3312/slim
+          username: root
+          password: Gky.i3g8,
+          driver-class-name: com.mysql.cj.jdbc.Driver
+  # redis 配置
+  redis:
+#    # 地址
+    host: 192.168.1.141
+#    # 端口,默认为6379
+    port: 6379
+# feign 配置
+feign:
+  client:
+    config:
+      default:
+        logger-level: full
+  httpclient:
+    # 开启feign对httpclient的支持
+    enabled: true
+    # 最大连接数
+    max-connections: 200
+    # 每个路径的最大连接数
+    max-connections-per-route: 50
+
+#调用算法接口
+algorithm:
+  creat:
+    # 将所需要生成图谱的文件,传给算法的接口
+    url: http://192.168.1.150:8900/data_access
+
+#PageHelper 分页插件配置
+pagehelper:
+  helperDialect: mysql
+  reasonable: true
+  supportMethodsArguments: true
+  params: count=countSql

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

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: local
+    active: ghj
   # 国际化资源文件路径
   messages:
     basename: i18n/messages
@@ -35,6 +35,8 @@ knife4j:
         api-rule: package
         api-rule-resources:
           - com.pavis.backend.slim.project.system.controller
+  setting:
+    enable-dynamic-parameter: true
 # mybatis-plus 配置
 mybatis-plus:
   type-aliases-package: com.pavis.backend.slim.project.**.domain