|
@@ -3,12 +3,13 @@ package com.gis.listener;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
+import cn.hutool.http.HttpResponse;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.gis.constant.CmdConstant;
|
|
|
import com.gis.constant.ConfigConstant;
|
|
|
-import com.gis.entity.FodderEntity;
|
|
|
import com.gis.entity.ScenePanoEntity;
|
|
|
import com.gis.entity.SceneQueueDTO;
|
|
|
import com.gis.entity.WorkEntity;
|
|
@@ -92,47 +93,47 @@ public class SceneListener {
|
|
|
log.error("参数列表错误(缺少),格式不匹配,{}",param);
|
|
|
channel.basicAck(deliveryTag, false);
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(param.getSceneCode())&¶m.getStatus()==0){
|
|
|
+ WorkEntity workEntity=workService.findByNum(param.getSceneCode());
|
|
|
+ if (ObjectUtil.isEmpty(workEntity)&¶m.getStatus()==0){
|
|
|
//初始化创建work表数据
|
|
|
- workService.entityAdd(param.getPhoneNum(),param.getSceneCode(),param.getStatus(),param.getSceneName(),param.getSnCode());
|
|
|
+ workService.entityAdd(param);
|
|
|
+ channel.basicAck(deliveryTag, false);
|
|
|
+ }if (ObjectUtil.isNotEmpty(workEntity)&¶m.getStatus()==0){
|
|
|
+ //修改状态
|
|
|
+ workEntity.setCalcStatus(0);
|
|
|
+ workService.update(workEntity);
|
|
|
channel.basicAck(deliveryTag, false);
|
|
|
}else if (ObjectUtil.isNotEmpty(param.getSceneCode())&¶m.getStatus()==1){
|
|
|
//计算完成处理
|
|
|
- WorkEntity workEntity=workService.findByNum(param.getSceneCode());
|
|
|
- //处理业务
|
|
|
//1,下载场景的全景图 默认 。scene_view_data/panorama/目录下的全景图图片
|
|
|
- String ossPath = "scene_view_data/"+param.getSceneCode()+"/panorama";
|
|
|
- List<String> list=aliyunOssUtil.getFileFolder("4dkankan",ossPath);
|
|
|
-// workEntity.setIcon(someDataJson.getString("icon"));
|
|
|
-// workEntity.setShare(someDataJson.getString("share"));
|
|
|
-// workEntity.setQrCode(someDataJson.getString("qrCode"));
|
|
|
+ workEntity.setAlgorithmTime(param.getAlgorithmTime());
|
|
|
+ workEntity.setCalcStatus(0);
|
|
|
+ workService.update(workEntity);
|
|
|
+
|
|
|
+
|
|
|
+ String visionUrl = "http://4dkk.4dage.com/scene_view_data/"+param.getSceneCode()+"/images/vision.txt";
|
|
|
+ HttpResponse execute = HttpRequest.get(visionUrl+"?m="+System.currentTimeMillis()).execute();
|
|
|
+ List<String> uuidList=new LinkedList<>();
|
|
|
+ if (execute.getStatus()==200){
|
|
|
+ log.info("vision.txt存在: {}");
|
|
|
+ JSONObject visJson = JSONObject.parseObject(execute.body());
|
|
|
+ if(visJson.containsKey("sweepLocations")){
|
|
|
+ JSONArray sweepLocations = visJson.getJSONArray("sweepLocations");
|
|
|
+ for (Object sweepLocation : sweepLocations) {
|
|
|
+ JSONObject sweepLocationJson = (JSONObject) sweepLocation;
|
|
|
+ String uuid = sweepLocationJson.getString("uuid");
|
|
|
+ uuidList.add(uuid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//2,使用krpano工具生成全景图数据
|
|
|
- List<ScenePanoEntity> scenePanoEntities=new ArrayList<>();
|
|
|
List<Map<String,Object>> scenes=new ArrayList<>();
|
|
|
- int index = 0;
|
|
|
- for (String item : list) {
|
|
|
- if (item.endsWith(".jpg")) {
|
|
|
- log.info("key:{}",item);
|
|
|
- if (index % 2 != 0) {
|
|
|
- index++;
|
|
|
- continue; // 跳过不是偶数位置的元素
|
|
|
- }
|
|
|
- index++;
|
|
|
+ for (int i = 0; i < uuidList.size(); i++) {
|
|
|
+ String item = uuidList.get(i);
|
|
|
+ String ossKey="scene_view_data/"+param.getSceneCode()+"/images/panoramas/"+item+".jpg";
|
|
|
Map<String,Object> scene=new HashMap<>();
|
|
|
-
|
|
|
- ScenePanoEntity scenePanoEntity = this.doSlice(traceId ,item, param.getSceneCode(), workEntity.getId(),index+".jpg");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- scenePanoEntities.add(scenePanoEntity);
|
|
|
+ ScenePanoEntity scenePanoEntity = this.doSlice(traceId ,ossKey, param.getSceneCode(), workEntity.getId(),item+".jpg");
|
|
|
// "icon": "https://ossxiaoan.4dage.com/720yun_fd_manage/fd720_8nRkFlzpp/vtour/panos/fd720_8nRkFlzpp.tiles/thumb.jpg",
|
|
|
// "sceneCode": "fd720_8nRkFlzpp",
|
|
|
// "sceneTitle": "0",
|
|
@@ -148,17 +149,24 @@ public class SceneListener {
|
|
|
String customId = generateCustomId();
|
|
|
scene.put("id", customId);
|
|
|
scenes.add(scene);
|
|
|
+ if (i==0){
|
|
|
+ workEntity.setIcon(scenePanoEntity.getIcon());
|
|
|
+ workService.update(workEntity);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
log.info("场景切图完成组装json");
|
|
|
//3,修改json文件,并创建work作品表数据,增加作品类型为相机拍摄全景图
|
|
|
- JSONObject someDataToJson= this.editSomeData(workEntity.getId(),scenes);
|
|
|
+ JSONObject someDataToJson= this.editSomeData(workEntity,scenes);
|
|
|
|
|
|
|
|
|
// 更新跟目录tour.xml 2022-09-15
|
|
|
this.updateTour(someDataToJson, workEntity.getId());
|
|
|
|
|
|
+ workEntity.setCalcStatus(1);
|
|
|
+ workService.update(workEntity);
|
|
|
+
|
|
|
channel.basicAck(deliveryTag, false);
|
|
|
}
|
|
|
|
|
@@ -367,7 +375,7 @@ public class SceneListener {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private JSONObject editSomeData(String id, List<Map<String, Object>> scenes){
|
|
|
+ private JSONObject editSomeData(WorkEntity workEntity, List<Map<String, Object>> scenes){
|
|
|
// 如基someData作出修改,记得把代码里的someData 跟服务器里的someData都修改
|
|
|
String baseSomeDataPath = configConstant.serverBasePath + "baseData/someData.json";
|
|
|
String baseSomeDataSceneDataPath = configConstant.serverBasePath + "baseData/someDataSceneData.json";
|
|
@@ -396,18 +404,19 @@ public class SceneListener {
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
- jsonObject.put("id", id + "");
|
|
|
+ jsonObject.put("id", workEntity.getId() + "");
|
|
|
|
|
|
|
|
|
// 创建二维码、二维码url
|
|
|
- String shareUrl = configConstant.domain4dKK + "/panorama/showMobile.html?id=" + id;
|
|
|
- String qrCode = qrCodeUtils.generateLogoQrCode(shareUrl, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain, id);
|
|
|
+ String shareUrl = configConstant.domain4dKK + "/panorama/showMobile.html?id=" + workEntity.getId();
|
|
|
+ String qrCode = qrCodeUtils.generateLogoQrCode(shareUrl, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain, workEntity);
|
|
|
jsonObject.put("share", shareUrl);
|
|
|
jsonObject.put("qrCode", qrCode);
|
|
|
-
|
|
|
- String ossKeyPath = configConstant.ossBasePath + id + "/someData.json";
|
|
|
-
|
|
|
-
|
|
|
+ jsonObject.put("icon",workEntity.getIcon());
|
|
|
+ String ossKeyPath = configConstant.ossBasePath + workEntity.getId() + "/someData.json";
|
|
|
+ workEntity.setQrCode(qrCode);
|
|
|
+ workEntity.setShare(shareUrl);
|
|
|
+ workService.update(workEntity);
|
|
|
|
|
|
JSONArray scenesJson = new JSONArray();
|
|
|
for (Map<String, Object> scene : scenes) {
|