wrapper = new QueryWrapper<>();
+ wrapper.eq(StrUtil.isNotBlank(id), "id", id);
+
+ return wrapper;
+ }
+
+
+}
\ No newline at end of file
diff --git a/flx-ai/src/main/java/com/pjilisense/flxai/utils/FileUtil.java b/flx-ai/src/main/java/com/pjilisense/flxai/utils/FileUtil.java
new file mode 100644
index 0000000..da2d5fc
--- /dev/null
+++ b/flx-ai/src/main/java/com/pjilisense/flxai/utils/FileUtil.java
@@ -0,0 +1,146 @@
+package com.pjilisense.flxai.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Repository
+public class FileUtil {
+
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ @Value("${file.common.uploadWindow}")
+ private String diskPath;
+ @Value("${file.common.uploadLinux}")
+ private String uploadLinux;
+
+ @Value("${file.common.uploadUrl}")
+ private String uploadUrl;
+
+ public String uploadFile(MultipartFile multipartFile){
+ String relPath="uploads/";
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
+ relPath = relPath+sdf.format(new Date()).substring(0,6)+"/";
+ //⽂件的完整名称,如spring.jpeg
+ String filename = multipartFile.getOriginalFilename();
+ //⽂件后缀,如.jpeg
+ assert filename != null;
+ String suffix = filename.substring(filename.lastIndexOf("."));
+ relPath =relPath+"/"+UUID.randomUUID().toString().replace("-","")+"."+suffix;
+ //⽬标⽂件
+ File descFile = new File(getFilepath(relPath));
+ //判断⽬标⽂件所在的⽬录是否存在
+ if (!descFile.getParentFile().exists()) {
+ descFile.getParentFile().mkdirs();
+ }
+ try (InputStream is = multipartFile.getInputStream();
+ BufferedInputStream bis = new BufferedInputStream(is);
+ BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(descFile))) {
+ int num = 0;
+ while ((num = bis.read()) != -1) {
+ bos.write(num);
+ }
+ } catch (Exception e) {
+ //log.error(e.getMessage());
+ throw new RuntimeException("文件上传错误,请联系管理员");
+ }
+ return relPath;
+ }
+
+ /**
+ *
+ * @return int 删除结果 1 已删除 0 未删除
+ */
+ public int delFile(String filepath, String fileName) {
+ String rootPath = getFilepath (filepath);
+ File file = new File(rootPath);
+ if (file.exists()) {
+ if(file.isDirectory()) {
+ File filex = new File(rootPath+"/"+fileName);
+ if(filex.exists()) {
+ filex.delete();
+ }
+ return 1;
+ } else {
+ file.delete();
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+ public void downLoadFile(String filepath, String filename, HttpServletResponse response){
+ String rootPath = getFilepath (filepath);
+ File file = new File(rootPath);
+ if(file.exists()){
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ try {
+ // 读到流中
+ if(file.isDirectory()) {
+ inputStream = new FileInputStream(filepath +"/"+ filename);// 文件的存放路径
+ } else {
+ inputStream = new FileInputStream(filepath);//filepath可能包含文件名
+ }
+ response.reset();
+ response.setContentType("application/octet-stream");
+ response.addHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(filename, "UTF-8"));
+ outputStream = response.getOutputStream();
+ byte[] b = new byte[1024];
+ int len;
+ //从输入流中读取一定数量的字节,并将其存储在缓冲区字节数组中,读到末尾返回-1
+ while ((len = inputStream.read(b)) > 0) {
+ outputStream.write(b, 0, len);
+ }
+ } catch (IOException e) {
+ //log.error(e.getMessage(), e);
+ }finally {
+ try {
+ inputStream.close();
+ inputStream.close();
+ } catch (IOException e) {
+ //log.error(e.getMessage(), e);
+ }
+ }
+ }
+ }
+
+ public String getFilepath (final String filepath) {//filepath可能包含文件名
+ String rootPath = getRootpath();
+ rootPath = rootPath +"/"+ filepath;
+ rootPath =rootPath.replace("//","/");
+ if(rootPath.endsWith("/")){
+ rootPath=rootPath.substring(0,rootPath.length()-1);
+ }
+ return rootPath;
+ }
+
+ public String getRootpath () {//filepath可能包含文件名
+ String rootPath = null;
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ rootPath = diskPath;
+ } else if (System.getProperty("os.name").startsWith("Linux")) {
+ rootPath = uploadLinux;
+ }
+ rootPath =rootPath.replace("//","/");
+ if(rootPath.endsWith("/")){
+ rootPath=rootPath.substring(0,rootPath.length()-1);
+ }
+ return rootPath;
+ }
+
+
+}
diff --git a/flx-ai/src/main/resources/application.yml b/flx-ai/src/main/resources/application.yml
index 26f77d5..b263511 100644
--- a/flx-ai/src/main/resources/application.yml
+++ b/flx-ai/src/main/resources/application.yml
@@ -60,4 +60,11 @@ mybatis-plus:
configuration-properties:
prefix:
blobType: BLOB
- boolValue: TRUE
\ No newline at end of file
+ boolValue: TRUE
+file:
+ common:
+ ## windows系统下访问路径
+ uploadWindow: d:/ceshi/sysfile
+ ## Linux系统下访问路径
+ uploadLinux: /user/img/
+ uploadUrl: /upload/
diff --git a/flx-ai/src/main/resources/mapper/postgres/ChunksDao.xml b/flx-ai/src/main/resources/mapper/postgres/ChunksDao.xml
new file mode 100644
index 0000000..d7a1147
--- /dev/null
+++ b/flx-ai/src/main/resources/mapper/postgres/ChunksDao.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/flx-ai/src/main/resources/mapper/postgres/DigitalImgDao.xml b/flx-ai/src/main/resources/mapper/postgres/DigitalImgDao.xml
new file mode 100644
index 0000000..f9a06ed
--- /dev/null
+++ b/flx-ai/src/main/resources/mapper/postgres/DigitalImgDao.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/flx-ai/src/main/resources/mapper/postgres/FileChunksDao.xml b/flx-ai/src/main/resources/mapper/postgres/FileChunksDao.xml
new file mode 100644
index 0000000..9bb9c12
--- /dev/null
+++ b/flx-ai/src/main/resources/mapper/postgres/FileChunksDao.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/flx-ai/src/main/resources/mapper/postgres/GlobalFilesDao.xml b/flx-ai/src/main/resources/mapper/postgres/GlobalFilesDao.xml
new file mode 100644
index 0000000..4078694
--- /dev/null
+++ b/flx-ai/src/main/resources/mapper/postgres/GlobalFilesDao.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/flx-ai/src/main/resources/mapper/postgres/MyDigitalHumanDao.xml b/flx-ai/src/main/resources/mapper/postgres/MyDigitalHumanDao.xml
new file mode 100644
index 0000000..2640ae2
--- /dev/null
+++ b/flx-ai/src/main/resources/mapper/postgres/MyDigitalHumanDao.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/flx-ai/src/test/java/test/com/pjilisense/flxai/controller/ChunksControllerTest.java b/flx-ai/src/test/java/test/com/pjilisense/flxai/controller/ChunksControllerTest.java
new file mode 100644
index 0000000..ca27605
--- /dev/null
+++ b/flx-ai/src/test/java/test/com/pjilisense/flxai/controller/ChunksControllerTest.java
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package test.com.pjilisense.flxai.controller;
+
+import com.alibaba.fastjson.JSON;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import test.com.pjilisense.flxai.TestUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ChunksControllerTest {
+ @BeforeEach
+ public void setUpTestDataWithinTransaction() {
+ // set up test data within the transaction
+ }
+ @AfterEach
+ public void tearDownWithinTransaction() {
+ // execute "tear down" logic within the transaction
+ }
+
+ @Test
+ public void testGetAllAiTools() {
+ String url = TestUtils.WebconnectURL+"/api/robot/chunks/search";
+ String charset = TestUtils.UTF8;
+ try {
+ Map params = new HashMap();
+ params.put("text","开源项目");
+ params.put("userId","2f3c5337-cf1a-40ce-bbe3-ec45455d82f1");
+ String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
+ System.out.println(body);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
\ No newline at end of file