|
@@ -3,6 +3,7 @@ package com.fdkankan.fusion.mq.consumer;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.fusion.common.FilePath;
|
|
|
+import com.fdkankan.fusion.common.ResultCode;
|
|
|
import com.fdkankan.fusion.common.util.*;
|
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
|
import com.fdkankan.fusion.service.ICommonUploadService;
|
|
@@ -43,6 +44,7 @@ public class OsgbToB3dmConsumer {
|
|
|
,concurrency = "1"
|
|
|
)
|
|
|
public void consumerQueue(Channel channel, Message message) {
|
|
|
+ String localPath = null;
|
|
|
try {
|
|
|
String messageId = message.getMessageProperties().getMessageId();
|
|
|
String msg = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
@@ -50,21 +52,22 @@ public class OsgbToB3dmConsumer {
|
|
|
|
|
|
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(msg);
|
|
|
- String localPath = jsonObject.getString("path");
|
|
|
+ localPath = jsonObject.getString("path");
|
|
|
|
|
|
File file = new File(localPath);
|
|
|
if(!file.exists()){
|
|
|
log.info("osgbToB3dm-mq--messageId:{},msg:{},文件不存在",messageId,localPath);
|
|
|
return;
|
|
|
}
|
|
|
+ commonUploadService.updateStatus(localPath,0);
|
|
|
///mnt/manage/media-library/result/ea041f3237df46568f4e83e723e743d4
|
|
|
String sourcePath = file.getParentFile().getPath() +"/"+UUID.randomUUID().toString().replace("-","");
|
|
|
|
|
|
OBJToGLBUtil.OsgbToB3dm(localPath,sourcePath);
|
|
|
String b3dmJsonPath = FileWriterUtil.checkB3dmTileset(new File(sourcePath));
|
|
|
if(b3dmJsonPath == null){
|
|
|
- log.info("osgbToB3dm-mq--messageId:{},msg:{},转化失败tileset.json文件",messageId,localPath);
|
|
|
- return;
|
|
|
+ log.info("osgbToB3dm-mq--messageId:{},msg:{},转化失败tileset.json不存在",messageId,localPath);
|
|
|
+ throw new BusinessException(-1,"转化失败tileset.json不存在");
|
|
|
}
|
|
|
String ossPath = sourcePath.replace("/mnt/","");
|
|
|
ShellUtil.yunUpload(sourcePath,ossPath);
|
|
@@ -79,6 +82,9 @@ public class OsgbToB3dmConsumer {
|
|
|
FileUtil.del(sourcePath);
|
|
|
}catch (Exception e){
|
|
|
log.info("osgbToB3dm-status----消费失败",e);
|
|
|
+ if(localPath != null){
|
|
|
+ commonUploadService.updateStatus(localPath,-1);
|
|
|
+ }
|
|
|
}finally {
|
|
|
|
|
|
}
|