Bläddra i källkod

处理失效文件相关

wukai 2 år sedan
förälder
incheckning
6b4a421009

+ 6 - 0
doc-biz/src/main/java/com/doc/biz/controller/DocInfoController.java

@@ -171,6 +171,9 @@ public class DocInfoController extends BaseController {
     @ApiImplicitParams({@ApiImplicitParam(name = "docId", value = "文件ID", required = true), @ApiImplicitParam(name = "spaceId", value = "空间ID"), @ApiImplicitParam(name = "dirId", value = "新目录ID", required = true)})
     public AjaxResult move(Long docId, Long dirId) {
         DocInfo info = docInfoService.selectDocInfoByDocId(docId);
+        if (info == null) {
+            return error("该文件已失效!");
+        }
         info.setDirId(dirId);
 
         info.setUpdateBy(SecurityUtils.getUsername());
@@ -187,6 +190,9 @@ public class DocInfoController extends BaseController {
     @ApiImplicitParams({@ApiImplicitParam(name = "docId", value = "文件ID", required = true), @ApiImplicitParam(name = "spaceId", value = "空间ID"), @ApiImplicitParam(name = "dirId", value = "新目录ID", required = true)})
     public AjaxResult copy(Long docId, Long spaceId, Long dirId) {
         DocInfo info = docInfoService.selectDocInfoByDocId(docId);
+        if (info == null) {
+            return error("该文件已失效!");
+        }
         String ext = info.getFileType();
         //因为数据库存的是带 . 的,所以要先截取掉这个 .
         ext = ext.substring(1);

+ 7 - 1
doc-biz/src/main/java/com/doc/chat/service/impl/ChatMsgServiceImpl.java

@@ -1,6 +1,7 @@
 package com.doc.chat.service.impl;
 
 import com.alibaba.fastjson2.JSON;
+import com.doc.biz.domain.DocInfo;
 import com.doc.biz.service.IDocInfoService;
 import com.doc.chat.domain.ChatMsg;
 import com.doc.chat.domain.ChatMsgRecord;
@@ -217,7 +218,12 @@ public class ChatMsgServiceImpl implements IChatMsgService {
             if (type.equals(msg.getMsgType())) {
                 if (StringUtils.isNotEmpty(msg.getContent())) {
                     Long docId = new Long(msg.getContent());
-                    msg.setFile(docInfoService.selectDocInfoByDocId(docId));
+                    DocInfo file = docInfoService.selectDocInfoByDocId(docId);
+                    if (file == null) {
+                        msg.setMsgType("2");
+                        msg.setContent("该文件已失效!");
+                    }
+                    msg.setFile(file);
                 }
             }
             SysUser fromUser = userMap.get(msg.getFromId());