lyhzzz 7 月之前
父节点
当前提交
bc06ef0da9

+ 10 - 0
src/main/java/com/fdkankan/fusion/controller/UploadController.java

@@ -1,6 +1,7 @@
 package com.fdkankan.fusion.controller;
 
 import cn.dev33.satoken.stp.StpUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.fusion.common.FilePath;
 import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.common.util.MinIoChunkUtils;
@@ -12,6 +13,7 @@ import com.fdkankan.fusion.response.UploadChunkVo;
 import com.fdkankan.fusion.service.IUploadChunkService;
 import com.fdkankan.fusion.service.IUploadSceneService;
 import com.fdkankan.fusion.service.impl.UploadService;
+import com.fdkankan.redis.util.RedisUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,6 +44,8 @@ public class UploadController extends BaseController{
 
     @Autowired
     IUploadChunkService uploadChunkService;
+    @Autowired
+    RedisUtil redisUtil;
 
     @PostMapping("/init-chunk-upload")
     public ResultData initChunkUpload(@RequestBody UploadChunk uploadDto){
@@ -49,6 +53,10 @@ public class UploadController extends BaseController{
                 || StringUtils.isBlank(uploadDto.getFileName()) || uploadDto.getFileSize() ==null){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
+        String redisKey = "fusion:upload-chunk:"+uploadDto.getFileMd5();
+        if(redisUtil.hasKey(redisKey)){
+            return ResultData.ok(redisUtil.get(redisKey));
+        }
         uploadDto.setDeptId(getDeptId());
         uploadDto.setUserName(getUserName());
         String suffix = uploadDto.getFileName().substring(uploadDto.getFileName().lastIndexOf("."));
@@ -91,6 +99,8 @@ public class UploadController extends BaseController{
         UploadChunkVo vo = new UploadChunkVo();
         BeanUtils.copyProperties(uploadDto,vo);
         vo.setUploadChunkVos(uploadChunkVos);
+
+        redisUtil.set(redisKey, JSONObject.toJSONString(vo),5);
         return ResultData.ok(vo);
     }
 

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/impl/ModelServiceImpl.java

@@ -345,7 +345,7 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
     public Model getByUploadSuccess(String fileMd5) {
         LambdaQueryWrapper<Model> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(Model::getFileMd5,fileMd5);
-        wrapper.eq(Model::getCreateStatus,1);
+       // wrapper.eq(Model::getCreateStatus,1);
         List<Model> list = this.list(wrapper);
         if(list.isEmpty()){
             return null;

+ 1 - 1
src/main/resources/application.yaml

@@ -125,6 +125,6 @@ minio:
   accessKey: 2dn1SibXOo1VrKWERTrE                         # 用户名
   secretKey: RrKrSifN6BwFpqMKp8g1xg4xoN0u8wUSuDEWkpMK      # 密码
   bucketChunk: fusion-chunk
-  chunkSize: 10485760
+  chunkSize: 104857600