lyhzzz 2 هفته پیش
والد
کامیت
f71b910d16

+ 2 - 30
src/main/java/com/fdkankan/fusion/controller/DictFileController.java

@@ -89,42 +89,14 @@ public class DictFileController extends BaseController{
         if(dictFile == null){
             throw new BusinessException(ResultCode.FILE_NOT_EXIST);
         }
-        if(StringUtils.isNotBlank(dictFile.getDownUrl())){
-            return ResultData.ok(dictFile.getDownUrl());
-        }
         CommonUpload commonUpload = commonUploadService.getById(dictFile.getUploadId());
         if(commonUpload == null){
             throw new BusinessException(ResultCode.FILE_NOT_EXIST);
         }
-
-        if(StringUtils.isBlank(commonUpload.getFileUrl())){
+        if(StringUtils.isBlank(commonUpload.getSourceFile())){
             throw new BusinessException(ResultCode.FILE_NOT_EXIST);
         }
-        String sceneObjPath = commonUpload.getFileUrl().replace(queryPath,"");
-        String foName =  new File(sceneObjPath).getName();
-
-        if(!"las".equals(commonUpload.getFileFormat()) && !"laz".equals(commonUpload.getFileFormat()) && !"ply".equals(commonUpload.getFileFormat())
-        && !"obj".equals(commonUpload.getFileFormat()) && !"osgb".equals(commonUpload.getFileFormat()) && !"b3dm".equals(commonUpload.getFileFormat())){
-            dictFileService.setDownUrl(dictFileId,commonUpload.getFileUrl(),0);
-            return ResultData.ok(commonUpload.getFileUrl());
-        }
-        if("obj".equals(commonUpload.getFileFormat()) || "osgb".equals(commonUpload.getFileFormat()) || "b3dm".equals(commonUpload.getFileFormat())){
-            File parentFile = new File(sceneObjPath).getParentFile();
-            sceneObjPath = parentFile.getPath();
-            foName =  parentFile.getName();
-        }
-
-        String filePath = String.format(CacheUtil.basePath+OssPath.MANAGE_FILE_DOWN_PATH ,dictFileId) ;
-        String ossPath = String.format(OssPath.MANAGE_FILE_DOWN_PATH ,dictFileId +"/"+dictFileId +".zip") ;
-        ShellUtil.yunDownload(sceneObjPath,filePath);
-        ShellUtil.zip(dictFileId+".zip",filePath+"/"+foName);
-        ShellUtil.yunUpload(filePath +"/"+foName +"/"+dictFileId +".zip",ossPath);
-        FileUtil.del(filePath);
-
-        String downUrl = queryPath + ossPath;
-        dictFileService.setDownUrl(dictFileId,downUrl,0);
-
-        return ResultData.ok(downUrl);
+        return ResultData.ok(commonUpload.getSourceFile());
     }
 
     @GetMapping("/downHash")

+ 2 - 0
src/main/java/com/fdkankan/fusion/response/DictFileVo.java

@@ -24,4 +24,6 @@ public class DictFileVo extends DictFile {
     private String unzipPath;
 
     private String dictName;
+
+    private String sourceFile;
 }

+ 2 - 2
src/main/java/com/fdkankan/fusion/service/impl/CommonUploadServiceImpl.java

@@ -101,7 +101,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
                 throw new BusinessException(ResultCode.FILE_TYPE_ERROR2);
             }
             String format = extName.replace(".", "");
-            CommonUpload commonUpload = commonUploadService.add(originalFilename.replace(extName, ""), url, String.valueOf(file.getSize()), uuid, fileTypeEnum, format,format,1,null,dictId,null);
+            CommonUpload commonUpload = commonUploadService.add(originalFilename.replace(extName, ""), url, String.valueOf(file.getSize()), uuid, fileTypeEnum, format,format,1,null,dictId,url);
             return ResultData.ok(commonUpload);
         }catch ( BusinessException e){
             log.info("upload-file-error:{}",e);
@@ -121,7 +121,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
         try {
             Long fileSize = file.length();
             String ossZipPath = String.format(OssPath.MANAGE_MODEL_FILE_PATH, UUID.randomUUID().toString().replace("-", ""));
-            String sourcePath = String.format(OssPath.MANAGE_SOURCE_FILE_PATH, UUID.randomUUID().toString().replace("-", ""));
+            String sourcePath = String.format(OssPath.MANAGE_SOURCE_FILE_PATH, UUID.randomUUID().toString().replace("-", ""))+".zip";
             String unzipPath = CacheUtil.basePath  + ossZipPath;
             ShellUtil.yunUpload(file.getPath(),sourcePath);
 

+ 3 - 0
src/main/java/com/fdkankan/fusion/service/impl/DictFileServiceImpl.java

@@ -46,6 +46,9 @@ public class DictFileServiceImpl extends ServiceImpl<IDictFileMapper, DictFile>
             param.setDeptId(deptId);
         }
         Page<DictFileVo> pageVo = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
+        for (DictFileVo record : pageVo.getRecords()) {
+            record.setDownUrl(record.getSourceFile());
+        }
         return PageInfo.PageInfo(pageVo);
     }