|
@@ -165,124 +165,69 @@ public class RabbitMqListener {
|
|
|
}
|
|
|
|
|
|
private ModelingBuildStatus buildScene(Map<String,Object> buildContext,BuildSceneCallMessage message, BuildSceneResultBean buildSceneResult,BuildLog logRecord) throws Exception{
|
|
|
- Long computeTime = null;//计算耗时
|
|
|
- String num = null;
|
|
|
//如果mq生产者在消息体中设置了结算结果mq队列名,就发到这个队列,否则就发送到默认队列
|
|
|
String resultQueueName = StrUtil.isNotBlank(message.getResultReceiverMqName()) ?
|
|
|
- message.getResultReceiverMqName() : queueModelingPost;
|
|
|
- //支付状态
|
|
|
- int payStatus = 0;
|
|
|
+ message.getResultReceiverMqName() : queueModelingPost;
|
|
|
String path = message.getDataSource();
|
|
|
- String prefix = message.getPrefix();
|
|
|
- num = message.getSceneNum();
|
|
|
+ String num = message.getSceneNum();
|
|
|
//不同的相机不同的方法
|
|
|
String cameraType = message.getCameraType();
|
|
|
String algorithm = message.getAlgorithm();
|
|
|
- String fileId = message.getFileId();
|
|
|
//0表示有4k图,1表示没有
|
|
|
String resolution = message.getResolution();
|
|
|
//判断调用V2还是V3版本的算法
|
|
|
String buildType = ObjectUtils.isEmpty(message.getBuildType()) ? "V2" : message.getBuildType();
|
|
|
|
|
|
- Integer pushChannel = null;
|
|
|
- String pushToken = null;
|
|
|
-
|
|
|
buildSceneResult.setResultQueueName(resultQueueName);
|
|
|
buildSceneResult.setCameraType(cameraType);
|
|
|
buildSceneResult.setNum(num);
|
|
|
- buildSceneResult.setPath(message.getPath());
|
|
|
-
|
|
|
- log.info("用的算法是:"+algorithm);
|
|
|
- log.info("用的相机是:"+ (Integer.parseInt(cameraType) < 4 ? "单球目" : "双球目(八目)"));
|
|
|
-
|
|
|
- //4表示硬件部研发的双球目相机,其余为旧版本相机
|
|
|
- if(Integer.parseInt(cameraType) < 3){
|
|
|
-
|
|
|
- String data = FileUtils.readFile(path + File.separator + "capture" +File.separator+"data.fdage");
|
|
|
- Map<String, String> dataMap = ComputerUtil.getTypeString(cameraType, algorithm, resolution,null);
|
|
|
- String splitType = dataMap.get("splitType");
|
|
|
- String skyboxType = dataMap.get("skyboxType");
|
|
|
- String dataDescribe = dataMap.get("dataDescribe");
|
|
|
- JSONObject dataJson = new JSONObject();
|
|
|
- if(data!=null){
|
|
|
- dataJson = JSONObject.parseObject(data);
|
|
|
- if(dataJson.containsKey("imgs")){
|
|
|
- splitType = "SPLIT_V4";
|
|
|
- }
|
|
|
- }
|
|
|
- //生成project.json和data.json供算法部使用
|
|
|
- ComputerUtil.createJson(path, splitType, skyboxType, dataDescribe, num, path);
|
|
|
- //计算模型并返回需要上传oss的文件集合
|
|
|
- ComputerUtil.computer(num, path, buildType);
|
|
|
|
|
|
- } else {
|
|
|
- String dataFdagePath = path + File.separator + "capture" +File.separator+"data.fdage";
|
|
|
- log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
|
|
|
- String data = FileUtils.readFile(dataFdagePath);
|
|
|
- //获取data.fdage的内容
|
|
|
- JSONObject dataJson = new JSONObject();
|
|
|
- if(data!=null){
|
|
|
- dataJson = JSONObject.parseObject(data);
|
|
|
- }
|
|
|
+ log.info("用的算法是:" + algorithm);
|
|
|
|
|
|
+ String dataFdagePath = path + File.separator + "capture" +File.separator+"data.fdage";
|
|
|
+ log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
|
|
|
+ String data = FileUtils.readFile(dataFdagePath);
|
|
|
+ //获取data.fdage的内容
|
|
|
+ JSONObject dataJson = new JSONObject();
|
|
|
+ if(data!=null){
|
|
|
+ dataJson = JSONObject.parseObject(data);
|
|
|
+ }
|
|
|
|
|
|
- if (dataJson.containsKey("OnlyExportMeshObj")) {
|
|
|
- logRecord.setBuildType(2);
|
|
|
- Map<String, String> context = new HashMap<>();
|
|
|
- context.put("path", message.getDataSource());
|
|
|
- context.put("cameraType", cameraType);
|
|
|
- context.put("algorithm", algorithm);
|
|
|
- context.put("resolution", resolution);
|
|
|
- context.put("projectNum", num);
|
|
|
- context.put("buildType", buildType);
|
|
|
- context.put("dataJson", data);
|
|
|
- try {
|
|
|
- laserSceneObjGenerateHandler.handle(context);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return ModelingBuildStatus.SUCCESS;
|
|
|
+ if (dataJson.containsKey("OnlyExportMeshObj")) {
|
|
|
+ logRecord.setBuildType(2);
|
|
|
+ Map<String, String> context = new HashMap<>();
|
|
|
+ context.put("path", path);
|
|
|
+ context.put("cameraType", cameraType);
|
|
|
+ context.put("algorithm", algorithm);
|
|
|
+ context.put("resolution", resolution);
|
|
|
+ context.put("projectNum", num);
|
|
|
+ context.put("dataJson", data);
|
|
|
+ try {
|
|
|
+ laserSceneObjGenerateHandler.handle(context);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
+ return ModelingBuildStatus.SUCCESS;
|
|
|
+ }
|
|
|
|
|
|
+ /*
|
|
|
+ 1、判断是否计算过资源,若计算过删除缓存, 如果caches中存在_images文件或者目录,就删除掉,否则就删除除了images以外的所有文件和目录
|
|
|
+ 2、删除上一次计算出来的result目录
|
|
|
+ */
|
|
|
+ this.deleteCachesAndResult(path);
|
|
|
|
|
|
- pushChannel = dataJson.getInteger("pushChannel");
|
|
|
- pushToken = dataJson.getString("pushToken");
|
|
|
-
|
|
|
- /*
|
|
|
- 1、判断是否计算过资源,若计算过删除缓存, 如果caches中存在_images文件或者目录,就删除掉,否则就删除除了images以外的所有文件和目录
|
|
|
- 2、删除上一次计算出来的result目录
|
|
|
- */
|
|
|
- this.deleteCachesAndResult(path);
|
|
|
-
|
|
|
- Map<String, String> dataMap = ComputerUtil.getTypeString(cameraType, algorithm, resolution,dataJson);
|
|
|
-
|
|
|
- String splitType = dataMap.get("splitType");
|
|
|
- String skyboxType = dataMap.get("skyboxType");
|
|
|
- String dataDescribe = dataMap.get("dataDescribe");
|
|
|
-
|
|
|
- //v2版本使用4k算法
|
|
|
- if (!ObjectUtils.isEmpty(dataJson.getInteger("videoVersion")) && dataJson.getIntValue("videoVersion") < 4) {
|
|
|
- skyboxType = "SKYBOX_V6";
|
|
|
- }
|
|
|
+ Map<String, String> dataMap = ComputerUtil.getTypeString(cameraType, algorithm, resolution,dataJson);
|
|
|
|
|
|
- ComputerUtil.createJson(path, splitType, skyboxType, dataDescribe, num, path);
|
|
|
- //计算模型并返回需要上传oss的文件集合
|
|
|
- ComputerUtil.computer(num, path, buildType);
|
|
|
- //计算完成时间
|
|
|
- log.info("计算完成耗时:{}",computeTime);
|
|
|
+ String splitType = dataMap.get("splitType");
|
|
|
+ String skyboxType = dataMap.get("skyboxType");
|
|
|
|
|
|
- //计算已使用容量
|
|
|
- payStatus = 1;
|
|
|
+ ComputerUtil.createProjectAndDataFile(path,num, splitType, skyboxType,null,null);
|
|
|
+ //计算模型并返回需要上传oss的文件集合
|
|
|
+ ComputerUtil.computer(num, path, buildType);
|
|
|
|
|
|
- log.info("八目上完oss结束修改数据:"+num);
|
|
|
- }
|
|
|
+ log.info("八目上完oss结束修改数据:"+num);
|
|
|
|
|
|
- buildSceneResult.setFileId(fileId);
|
|
|
- buildSceneResult.setPayStatus(payStatus);
|
|
|
buildSceneResult.setPath(path);
|
|
|
- buildSceneResult.setPushChannel(pushChannel);
|
|
|
- buildSceneResult.setPushToken(pushToken);
|
|
|
- buildSceneResult.setPrefix(prefix);
|
|
|
|
|
|
return ModelingBuildStatus.SUCCESS;
|
|
|
}
|
|
@@ -341,20 +286,13 @@ public class RabbitMqListener {
|
|
|
if(buildStatus.equals(ModelingBuildStatus.REPEAT)){
|
|
|
return;
|
|
|
}
|
|
|
- rabbitMqProducer.sendByWorkQueue(ObjectUtils.isEmpty(message.getResultReceiverMqName()) ? queueModelingPost : message.getResultReceiverMqName(),
|
|
|
+ rabbitMqProducer.sendByWorkQueue(buildSceneResult.getResultQueueName(),
|
|
|
BuildSceneResultMqMessage.builder()
|
|
|
.buildSuccess(buildStatus.equals(ModelingBuildStatus.SUCCESS))
|
|
|
.cameraType(buildSceneResult.getCameraType())
|
|
|
.computeTime(buildSceneResult.getDuration())
|
|
|
- .fileId(buildSceneResult.getFileId())
|
|
|
- .payStatus(buildSceneResult.getPayStatus())
|
|
|
.sceneCode(message.getSceneNum())
|
|
|
- .uploadFiles(buildSceneResult.getUploadMap())
|
|
|
.path(buildSceneResult.getPath())
|
|
|
- .pushChannel(buildSceneResult.getPushChannel())
|
|
|
- .pushToken(buildSceneResult.getPushToken())
|
|
|
- .prefix(buildSceneResult.getPrefix())
|
|
|
- .videoVersion(buildSceneResult.getVideoVersion())
|
|
|
.build());
|
|
|
}
|
|
|
|