|
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.gis.constant.CmdConstant;
|
|
import com.gis.constant.CmdConstant;
|
|
import com.gis.constant.ConfigConstant;
|
|
import com.gis.constant.ConfigConstant;
|
|
|
|
+import com.gis.entity.FodderEntity;
|
|
import com.gis.entity.ScenePanoEntity;
|
|
import com.gis.entity.ScenePanoEntity;
|
|
import com.gis.entity.SceneQueueDTO;
|
|
import com.gis.entity.SceneQueueDTO;
|
|
import com.gis.entity.WorkEntity;
|
|
import com.gis.entity.WorkEntity;
|
|
@@ -120,8 +121,17 @@ public class SceneListener {
|
|
Map<String,Object> scene=new HashMap<>();
|
|
Map<String,Object> scene=new HashMap<>();
|
|
|
|
|
|
ScenePanoEntity scenePanoEntity = this.doSlice(traceId ,item, param.getSceneCode(), workEntity.getId(),index+".jpg");
|
|
ScenePanoEntity scenePanoEntity = this.doSlice(traceId ,item, param.getSceneCode(), workEntity.getId(),index+".jpg");
|
|
- scenePanoEntities.add(scenePanoEntity);
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ scenePanoEntities.add(scenePanoEntity);
|
|
// "icon": "https://ossxiaoan.4dage.com/720yun_fd_manage/fd720_8nRkFlzpp/vtour/panos/fd720_8nRkFlzpp.tiles/thumb.jpg",
|
|
// "icon": "https://ossxiaoan.4dage.com/720yun_fd_manage/fd720_8nRkFlzpp/vtour/panos/fd720_8nRkFlzpp.tiles/thumb.jpg",
|
|
// "sceneCode": "fd720_8nRkFlzpp",
|
|
// "sceneCode": "fd720_8nRkFlzpp",
|
|
// "sceneTitle": "0",
|
|
// "sceneTitle": "0",
|
|
@@ -142,8 +152,11 @@ public class SceneListener {
|
|
|
|
|
|
log.info("场景切图完成组装json");
|
|
log.info("场景切图完成组装json");
|
|
//3,修改json文件,并创建work作品表数据,增加作品类型为相机拍摄全景图
|
|
//3,修改json文件,并创建work作品表数据,增加作品类型为相机拍摄全景图
|
|
- this.editSomeData(workEntity.getId(),scenes);
|
|
|
|
|
|
+ JSONObject someDataToJson= this.editSomeData(workEntity.getId(),scenes);
|
|
|
|
+
|
|
|
|
|
|
|
|
+ // 更新跟目录tour.xml 2022-09-15
|
|
|
|
+ this.updateTour(someDataToJson, workEntity.getId());
|
|
|
|
|
|
channel.basicAck(deliveryTag, false);
|
|
channel.basicAck(deliveryTag, false);
|
|
}
|
|
}
|
|
@@ -245,6 +258,7 @@ public class SceneListener {
|
|
log.info("切图预览图ossUrl: {}",ossUrl);
|
|
log.info("切图预览图ossUrl: {}",ossUrl);
|
|
entity.setIcon(ossUrl);
|
|
entity.setIcon(ossUrl);
|
|
log.info("任务成功返回: " + obj);
|
|
log.info("任务成功返回: " + obj);
|
|
|
|
+
|
|
} catch (InterruptedException e) {
|
|
} catch (InterruptedException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
entity.setStatus(2);
|
|
entity.setStatus(2);
|
|
@@ -275,6 +289,47 @@ public class SceneListener {
|
|
log.info("切图流程结束 : ");
|
|
log.info("切图流程结束 : ");
|
|
return entity;
|
|
return entity;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 更新 tour.xml
|
|
|
|
+ * @param someDataToJson
|
|
|
|
+ * @param id
|
|
|
|
+ */
|
|
|
|
+ private void updateTour(JSONObject someDataToJson, String id) {
|
|
|
|
+ long startTime = System.currentTimeMillis();
|
|
|
|
+ String scenes = someDataToJson.getString("scenes");
|
|
|
|
+ BaseRuntimeException.isBlank(scenes, null, "someData的场景码参数未空");
|
|
|
|
+ List<ScenePanoEntity> list = scenePanoService.findByWorkId(id);
|
|
|
|
+
|
|
|
|
+ // 读取tour.xml模板
|
|
|
|
+ String baseTour = getBaseTour();
|
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
|
+ builder.append(baseTour).append("\r\n");
|
|
|
|
+ for (ScenePanoEntity entity : list) {
|
|
|
|
+ String tour = entity.getTour();
|
|
|
|
+ builder.append(tour).append("\r\n");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 添加结束标签
|
|
|
|
+ builder.append("</krpano>");
|
|
|
|
+
|
|
|
|
+ String tourPath = configConstant.serverBasePath + id + "/tour.xml";
|
|
|
|
+ FileUtil.writeUtf8String(builder.toString(), tourPath);
|
|
|
|
+ log.info("作品tour.xml写入完成");
|
|
|
|
+
|
|
|
|
+ String ossKeyPath = configConstant.ossBasePath + id + "/tour.xml";
|
|
|
|
+ fileAndOssUtil.upload(tourPath, ossKeyPath);
|
|
|
|
+ log.info("tour.xml上传完成 : {}", ossKeyPath);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String getBaseTour(){
|
|
|
|
+ String baseTourPath = configConstant.serverBasePath + "baseData/tour.xml";
|
|
|
|
+ String s = FileUtil.readString(baseTourPath, "utf-8");
|
|
|
|
+ // 结束标签置空, 方便操作
|
|
|
|
+ s = s.replace("</krpano>", "");
|
|
|
|
+ return s;
|
|
|
|
+ }
|
|
|
|
+
|
|
// 获取切图后的tour.xml
|
|
// 获取切图后的tour.xml
|
|
private String getTourXmlScene(String code) {
|
|
private String getTourXmlScene(String code) {
|
|
log.info("处理tour.xml");
|
|
log.info("处理tour.xml");
|
|
@@ -305,7 +360,7 @@ public class SceneListener {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private void editSomeData(String id, List<Map<String, Object>> scenes){
|
|
|
|
|
|
+ private JSONObject editSomeData(String id, List<Map<String, Object>> scenes){
|
|
// 如基someData作出修改,记得把代码里的someData 跟服务器里的someData都修改
|
|
// 如基someData作出修改,记得把代码里的someData 跟服务器里的someData都修改
|
|
String baseSomeDataPath = configConstant.serverBasePath + "baseData/someData.json";
|
|
String baseSomeDataPath = configConstant.serverBasePath + "baseData/someData.json";
|
|
String baseSomeDataSceneDataPath = configConstant.serverBasePath + "baseData/someDataSceneData.json";
|
|
String baseSomeDataSceneDataPath = configConstant.serverBasePath + "baseData/someDataSceneData.json";
|
|
@@ -365,6 +420,7 @@ public class SceneListener {
|
|
}
|
|
}
|
|
String ossUrl = configConstant.ossDomain + ossKeyPath;
|
|
String ossUrl = configConstant.ossDomain + ossKeyPath;
|
|
log.info("ossSomeData:{}", ossUrl);
|
|
log.info("ossSomeData:{}", ossUrl);
|
|
|
|
+ return jsonObject;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|