lyhzzz 3 kuukautta sitten
vanhempi
commit
e8e00186b2

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

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

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

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