Forráskód Böngészése

文件绝对路径

lyhzzz 5 hónapja
szülő
commit
d9e049325d

+ 12 - 1
src/main/java/com/fdkankan/fusion/common/util/LocalToOssUtil.java

@@ -37,7 +37,7 @@ public class LocalToOssUtil {
     }
 
 
-    public boolean downFormAli(String objectName, String localPath) {
+    public boolean downFormRel(String objectName, String localPath) {
         try {
             FileUtil.copyContent(new File(getOssPath(bucket, objectName)), new File(localPath), true);
         }catch (Exception e){
@@ -48,6 +48,17 @@ public class LocalToOssUtil {
         return true;
     }
 
+    public boolean downFormAbs(String objectName, String localPath) {
+        try {
+            FileUtil.copyContent(new File( objectName), new File(localPath), true);
+        }catch (Exception e){
+            log.info("下载文件失败,remoteFilePath:{},localPath:{}", objectName, localPath);
+            log.info("下载文件失败", e);
+            return false;
+        }
+        return true;
+    }
+
     public String uploadFile(String bucket, String filePath, String remoteFilePath, Map<String, String> headers) {
         try {
             if (!new File(filePath).exists()) {

+ 2 - 3
src/main/java/com/fdkankan/fusion/down/CaseDownService.java

@@ -470,11 +470,10 @@ public class CaseDownService {
         for (Object object : jsonArray) {
             String res = (String) object;
             log.info("下载模型:{}",res);
-            res = res.replace(queryPath, "");
             if(res.contains(".json") || res.contains(".shp")){
                 res = new File(res).getParentFile().getPath();
             }
-            localToOssUtil.downFormAli(res,path+queryPath+res);
+            localToOssUtil.downFormAbs(res,path+queryPath+res);
 
         }
     }
@@ -497,7 +496,7 @@ public class CaseDownService {
             return;
         }
         String path = offPath + FilePath.OFFLINE_OSS_PATH;
-        localToOssUtil.downFormAli(url,path+queryPath+url);
+        localToOssUtil.downFormAbs(url,path+queryPath+url);
     }
 
     public void downWordByTemplate(Integer caseId,XWPFTemplate template,String name,String offPath){

+ 0 - 27
src/main/java/com/fdkankan/fusion/service/impl/CaseServiceImpl.java

@@ -61,18 +61,10 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
         if(StringUtils.isNotBlank(param.getCaseTitle())){
             wrapper.like(CaseEntity::getCaseTitle,param.getCaseTitle());
         }
-        List<String> deptIds = tmDepartmentService.getDeptIds();
-        if(deptIds.size() <=0){
-            return PageInfo.PageInfo(new Page<>(param.getPageNum(),param.getPageSize()));
-        }
-        List<String> deptIds2 = tmDepartmentService.getSonByDeptIdAndDeptIds(deptIds, param.getDeptId());
-        wrapper.in(CaseEntity::getDeptId,deptIds2);
-        //wrapper.eq(CaseEntity::getUserName,userName);
         wrapper.eq(CaseEntity::getType,0);
         wrapper.orderByDesc(CaseEntity::getCreateTime);
         Page<CaseEntity> page = this.page( new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
 
-
         Set<String> tmProIds = page.getRecords().stream().filter(entity -> StringUtils.isNotBlank(entity.getTmProjectId()))
                 .map(CaseEntity::getTmProjectId).collect(Collectors.toSet());
         HashMap<String, TmProject> proMap =  tmProjectService.getMapByIds(tmProIds);
@@ -86,16 +78,6 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
             }
         }
 
-        Set<String> deptIds1 = page.getRecords().stream().filter(entity -> StringUtils.isNotBlank(entity.getDeptId()))
-                .map(CaseEntity::getDeptId).collect(Collectors.toSet());
-        HashMap<String, TmDepartment> mapByDeptIds = tmDepartmentService.getMapByDeptIds(deptIds1);
-
-        for (CaseEntity record : page.getRecords()) {
-            TmDepartment department = mapByDeptIds.get(record.getDeptId());
-            if(department != null){
-                record.setDeptName(department.getName());
-            }
-        }
         return PageInfo.PageInfo(page);
     }
 
@@ -194,18 +176,9 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
             }
         }
 
-        Set<String> deptIdset = listAll.stream().filter(entity ->StringUtils.isNotBlank(entity.getDeptId())&& StringUtils.isBlank(entity.getDeptName()))
-                .map(SceneVo::getDeptId).collect(Collectors.toSet());
-        HashMap<String, TmDepartment> mapByDept = tmDepartmentService.getMapByDeptIds(deptIdset);
         HashMap<Integer,FusionNum> fusionNumHashMap = fusionNumService.getByCaseId(param.getCaseId());
 
         for (SceneVo sceneVo : listAll) {
-            if(StringUtils.isNotBlank(sceneVo.getDeptId())){
-                TmDepartment tmDepartment = mapByDept.get(sceneVo.getDeptId());
-                if(tmDepartment != null){
-                    sceneVo.setDeptName(tmDepartment.getName());
-                }
-            }
             if(sceneVo.getModelId() != null && fusionNumHashMap.get(sceneVo.getModelId()) != null){
                 sceneVo.setInFusion(true);
             }

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

@@ -123,7 +123,7 @@ public class CaseVideoServiceImpl extends ServiceImpl<ICaseVideoMapper, CaseVide
                     String mergeVideoUrl = null;
                     if (StringUtils.isNotBlank(videoFolder.getVideoMergeUrl())) {
                         mergeVideoUrl = videoFolder.getVideoMergeUrl().replace(queryPath, "/home/");
-                        localToOssUtil.downFormAli(videoFolder.getVideoMergeUrl().replace(queryPath, ""), mergeVideoUrl);
+                        localToOssUtil.downFormAbs(videoFolder.getVideoMergeUrl().replace(queryPath, ""), mergeVideoUrl);
                         ossDelList.add(videoFolder.getVideoMergeUrl());
                     }
                     caseVideoService.deleteByFolderId(videoFolder.getVideoFolderId());

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

@@ -79,7 +79,8 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
                 return uploadModelZip(name.replace(extName, ""),tempFile,dictId);
             }
             //localToOssUtil.uploadOss(tempFile.getPath(), ossPath);
-            String url = this.ossUrlPrefix + ossPath;
+            //String url = this.ossUrlPrefix + ossPath;
+            String url = tempFile.getPath();
 
             FileTypeEnum fileTypeEnum = FileTypeEnum.getByType(extName.replace(".", ""));
             if(fileTypeEnum == null){
@@ -133,14 +134,14 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
         String resultFormat = modelFileFormat;
         switch (modelFileFormat){
             case "obj" :  resultFormat = "glb";
-                url = uploadObjOss(ossZipPath,modelFile);break;
-            case "laz" :    url = uploadLazOss(ossZipPath,modelFile); break;
-            case "shp" :   url = uploadOss(ossZipPath,modelFile); break;
-            case "b3dm" :  url = uploadB3dm(ossZipPath,modelFile); break;
+                url = uploadObjOss(unZipFile.getPath(),modelFile);break;
+            case "laz" :    url = uploadLazOss(unZipFile.getPath(),modelFile); break;
+            case "shp" :   url = uploadOss(unZipFile.getPath(),modelFile); break;
+            case "b3dm" :  url = uploadB3dm(unZipFile.getPath(),modelFile); break;
             case "las" :
-            case "ply" :  url = uploadLasOrPly(ossZipPath,modelFile);break;
+            case "ply" :  url = uploadLasOrPly(unZipFile.getPath(),modelFile);break;
             case "osgb":  resultFormat = "b3dm";
-                    uploadOsgb(ossZipPath,modelFile) ;break;
+                    uploadOsgb(unZipFile.getPath(),modelFile) ;break;
             default: break;
         }
         FileTypeEnum fileTypeEnum = FileTypeEnum.getByType(modelFileFormat);
@@ -186,21 +187,24 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
     OsgbToB3dmConsumer osgbToB3dmConsumer;
 
     private void uploadOsgb(String unzipPath, File modelFile) {
-         osgbToB3dmConsumer.consumerQueue(CacheUtil.basePath + unzipPath);
+         //osgbToB3dmConsumer.consumerQueue(CacheUtil.basePath + unzipPath);
+         osgbToB3dmConsumer.consumerQueue(unzipPath);
     }
 
     private String uploadLazOss(String unzipPath,File modelFile) {
         if(!modelFile.exists()){
             throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
         }
-        return  ossUrlPrefix +unzipPath +File.separator +modelFile.getParentFile().getName();
+       // return  ossUrlPrefix +unzipPath +File.separator +modelFile.getParentFile().getName();
+        return  modelFile.getParentFile().getPath();
     }
 
     private String uploadOss(String unzipPath,File modelFile) {
         if(!modelFile.exists()){
             throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
         }
-        return  ossUrlPrefix + unzipPath+File.separator +modelFile.getName();
+       // return  ossUrlPrefix + unzipPath+File.separator +modelFile.getName();
+        return  modelFile.getPath();
     }
 
     private String uploadLasOrPly(String unzipPath ,File modelFile) {
@@ -209,7 +213,8 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
         if(!file.exists()){
             throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
         }
-        return  ossUrlPrefix +unzipPath+File.separator +mntFile.getName() + File.separator +"webcloud";
+       // return  ossUrlPrefix +unzipPath+File.separator +mntFile.getName() + File.separator +"webcloud";
+        return  mntFile.getPath()+ File.separator +"webcloud";
 
     }