|
|
@@ -1,6 +1,9 @@
|
|
|
package com.doc.biz.controller;
|
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
+import com.doc.biz.domain.DocInfo;
|
|
|
+import com.doc.biz.domain.DocRecent;
|
|
|
+import com.doc.biz.service.IDocInfoService;
|
|
|
import com.doc.biz.service.IDocRecentService;
|
|
|
import com.doc.biz.service.IMongoService;
|
|
|
import com.doc.biz.vo.DocumentVO;
|
|
|
@@ -42,19 +45,26 @@ public class ApiController extends BaseController {
|
|
|
private ISysConfigService configService;
|
|
|
@Resource
|
|
|
private IDocRecentService recentService;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private IDocInfoService docInfoService;
|
|
|
|
|
|
/**
|
|
|
* 文件下载
|
|
|
*
|
|
|
- * @param fileId fileId
|
|
|
+ * @param docId docId
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("文件预览")
|
|
|
- @GetMapping("/access/{fileId}")
|
|
|
- public ResponseEntity<Object> access(@PathVariable(name = "fileId") String fileId, @RequestParam Long uid) {
|
|
|
- recentService.insertDocRecent(uid, fileId);
|
|
|
- return mongoService.download(fileId, false);
|
|
|
+ @GetMapping("/access/{docId}")
|
|
|
+ public ResponseEntity<Object> access(@PathVariable(name = "docId") Long docId, @RequestParam Long uid) {
|
|
|
+ DocInfo info = docInfoService.selectDocInfoByDocId(docId);
|
|
|
+ //插入最近文件
|
|
|
+ DocRecent recent = new DocRecent();
|
|
|
+ recent.setIsFolder("N");
|
|
|
+ recent.setOwner(uid);
|
|
|
+ recent.setRelaId(info.getDocId());
|
|
|
+ recentService.insertDocRecent(recent);
|
|
|
+ return mongoService.download(info.getFileId(), false);
|
|
|
}
|
|
|
|
|
|
/**
|