|
@@ -1,13 +1,9 @@
|
|
|
package com.doc.biz.controller;
|
|
|
|
|
|
-import com.doc.biz.domain.DocDir;
|
|
|
-import com.doc.biz.domain.DocInfo;
|
|
|
-import com.doc.biz.domain.DocRecent;
|
|
|
-import com.doc.biz.domain.DocSpace;
|
|
|
+import com.doc.biz.domain.*;
|
|
|
import com.doc.biz.service.*;
|
|
|
import com.doc.biz.vo.DocumentVO;
|
|
|
import com.doc.common.annotation.Log;
|
|
|
-import com.doc.common.config.EsConfig;
|
|
|
import com.doc.common.constant.Constants;
|
|
|
import com.doc.common.core.controller.BaseController;
|
|
|
import com.doc.common.core.domain.AjaxResult;
|
|
@@ -21,7 +17,6 @@ import com.doc.common.utils.file.FileUtils;
|
|
|
import com.doc.common.utils.poi.ExcelUtil;
|
|
|
import io.swagger.annotations.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.data.elasticsearch.NoSuchIndexException;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -49,13 +44,11 @@ public class DocInfoController extends BaseController {
|
|
|
@Resource
|
|
|
private IDocDirService dirService;
|
|
|
@Resource
|
|
|
- private EsConfig esConfig;
|
|
|
- @Resource
|
|
|
- private IEsDocInfoService esDocInfoService;
|
|
|
- @Resource
|
|
|
private IDocFavoriteService favoriteService;
|
|
|
@Resource
|
|
|
private IDocRecentService recentService;
|
|
|
+ @Resource
|
|
|
+ private IElasticSearchService elasticSearchService;
|
|
|
|
|
|
/**
|
|
|
* 文件上传
|
|
@@ -224,6 +217,22 @@ public class DocInfoController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 查询所有已失效的文件,就是mysql中有,mongo中没有的
|
|
|
+ */
|
|
|
+ @GetMapping("/lose")
|
|
|
+ public AjaxResult list() {
|
|
|
+ List<DocInfo> docInfoList = docInfoService.selectLoseList();
|
|
|
+ return AjaxResult.success(docInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/content/{docId}")
|
|
|
+ @ApiOperation("根据ID查询文本内容")
|
|
|
+ public AjaxResult content(@ApiParam(value = "文件ID", required = true) @PathVariable Long docId) {
|
|
|
+ EsDocInfo info = elasticSearchService.getEsDocInfo(docId);
|
|
|
+ return AjaxResult.success(info);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 文件搜索
|
|
|
*/
|
|
|
@ApiOperation("文件搜索")
|
|
@@ -334,14 +343,7 @@ public class DocInfoController extends BaseController {
|
|
|
//删除mongo记录
|
|
|
mongoService.removeFile(info.getFileId());
|
|
|
|
|
|
- //删除ES记录
|
|
|
- try {
|
|
|
- String indexName = "docs_" + info.getSpaceId();
|
|
|
- esConfig.setIndexName(indexName);
|
|
|
- esDocInfoService.deleteById(docId);
|
|
|
- } catch (NoSuchIndexException e) {
|
|
|
- //不用管,表示没这个索引
|
|
|
- }
|
|
|
+ elasticSearchService.delete(docId);
|
|
|
//删除收藏记录
|
|
|
favoriteService.delete("N", docId);
|
|
|
}
|