lyhzzz 3 달 전
부모
커밋
1744fc6531

+ 5 - 7
src/main/java/com/fdkankan/fusion/mq/consumer/OsgbToB3dmConsumer.java

@@ -41,8 +41,8 @@ public class OsgbToB3dmConsumer {
     @Autowired
     @Autowired
     LocalToOssUtil localToOssUtil;
     LocalToOssUtil localToOssUtil;
 
 
-    //@Async
-    public Integer consumerQueue(Integer uploadId)  {
+    @Async
+    public void consumerQueue(Integer uploadId)  {
         String sourcePath = null;
         String sourcePath = null;
         String localPath = null;
         String localPath = null;
         try {
         try {
@@ -51,7 +51,7 @@ public class OsgbToB3dmConsumer {
             File file = new File(localPath);
             File file = new File(localPath);
             if(!file.exists()){
             if(!file.exists()){
                 log.info("osgbToB3dm-mq--,msg:{},文件不存在",localPath);
                 log.info("osgbToB3dm-mq--,msg:{},文件不存在",localPath);
-                return -1;
+                throw new BusinessException(-1,"转化失败tileset.json不存在");
             }
             }
             //commonUploadService.updateStatus(uploadId,0);
             //commonUploadService.updateStatus(uploadId,0);
             ///mnt/manage/media-library/result/ea041f3237df46568f4e83e723e743d4
             ///mnt/manage/media-library/result/ea041f3237df46568f4e83e723e743d4
@@ -62,12 +62,12 @@ public class OsgbToB3dmConsumer {
             String b3dmJsonPath =  FileWriterUtil.checkB3dmTileset(new File(sourcePath));
             String b3dmJsonPath =  FileWriterUtil.checkB3dmTileset(new File(sourcePath));
             if(b3dmJsonPath == null){
             if(b3dmJsonPath == null){
                 log.info("osgbToB3dm-mq,msg:{},转化失败tileset.json不存在",localPath);
                 log.info("osgbToB3dm-mq,msg:{},转化失败tileset.json不存在",localPath);
-                return -1;
+                throw new BusinessException(-1,"转化失败tileset.json不存在");
             }
             }
             File jsonFile = new File(b3dmJsonPath);
             File jsonFile = new File(b3dmJsonPath);
             if(!jsonFile.exists()){
             if(!jsonFile.exists()){
                 log.info("osgbToB3dm-mq,msg:{},转化失败tileset.json不存在",localPath);
                 log.info("osgbToB3dm-mq,msg:{},转化失败tileset.json不存在",localPath);
-                return -1;
+                throw new BusinessException(-1,"转化失败tileset.json不存在");
             }
             }
             //String ossPath = sourcePath.replace(CacheUtil.basePath,"");
             //String ossPath = sourcePath.replace(CacheUtil.basePath,"");
             //localToOssUtil.uploadOss(sourcePath,ossPath);
             //localToOssUtil.uploadOss(sourcePath,ossPath);
@@ -78,13 +78,11 @@ public class OsgbToB3dmConsumer {
             }else {
             }else {
                 commonUploadService.updateByPath(uploadId,url);
                 commonUploadService.updateByPath(uploadId,url);
             }
             }
-            return 1;
         }catch (Exception e){
         }catch (Exception e){
             log.info("osgbToB3dm-status----消费失败",e);
             log.info("osgbToB3dm-status----消费失败",e);
             if(localPath != null){
             if(localPath != null){
                 commonUploadService.updateStatus(uploadId,-1);
                 commonUploadService.updateStatus(uploadId,-1);
             }
             }
-            return -1;
         }finally {
         }finally {
             try {
             try {
                 FileUtil.del(localPath);
                 FileUtil.del(localPath);

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

@@ -154,9 +154,8 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
         CommonUpload commonUpload = commonUploadService.add(oldName,url, String.valueOf(getDirectorySize(unZipFile)),
         CommonUpload commonUpload = commonUploadService.add(oldName,url, String.valueOf(getDirectorySize(unZipFile)),
                 null, fileTypeEnum, modelFileFormat,resultFormat,status,unZipFile.getPath(),dictId);
                 null, fileTypeEnum, modelFileFormat,resultFormat,status,unZipFile.getPath(),dictId);
         if("osgb".equals(modelFileFormat)){
         if("osgb".equals(modelFileFormat)){
-            //commonUploadService.updateStatus(commonUpload.getId(),0);
+            commonUploadService.updateStatus(commonUpload.getId(),0);
             uploadOsgb(commonUpload.getId()) ;
             uploadOsgb(commonUpload.getId()) ;
-            commonUpload.setStatus(uploadOsgb(commonUpload.getId()));
         }
         }
         return ResultData.ok(commonUpload);
         return ResultData.ok(commonUpload);
     }
     }
@@ -188,9 +187,9 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
     @Autowired
     @Autowired
     OsgbToB3dmConsumer osgbToB3dmConsumer;
     OsgbToB3dmConsumer osgbToB3dmConsumer;
 
 
-    private Integer uploadOsgb(Integer uploadId) {
+    private void uploadOsgb(Integer uploadId) {
          //osgbToB3dmConsumer.consumerQueue(CacheUtil.basePath + unzipPath);
          //osgbToB3dmConsumer.consumerQueue(CacheUtil.basePath + unzipPath);
-        return osgbToB3dmConsumer.consumerQueue(uploadId);
+         osgbToB3dmConsumer.consumerQueue(uploadId);
     }
     }
 
 
     private String uploadLazOss(String unzipPath,File modelFile) {
     private String uploadLazOss(String unzipPath,File modelFile) {