|
@@ -11,19 +11,11 @@ import cn.hutool.core.util.ZipUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
-import com.fdkankan.common.constant.ErrorCode;
|
|
|
-import com.fdkankan.common.constant.SceneDownloadProgressStatus;
|
|
|
-import com.fdkankan.common.constant.SceneFrom;
|
|
|
-import com.fdkankan.common.constant.SceneKind;
|
|
|
-import com.fdkankan.common.constant.SceneResolution;
|
|
|
-import com.fdkankan.common.constant.ServerCode;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.fdkankan.common.constant.*;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
-import com.fdkankan.download.bean.CurrentDownloadNumUtil;
|
|
|
-import com.fdkankan.download.bean.DownLoadProgressBean;
|
|
|
-import com.fdkankan.download.bean.DownLoadTaskBean;
|
|
|
-import com.fdkankan.download.bean.ImageType;
|
|
|
-import com.fdkankan.download.bean.ImageTypeDetail;
|
|
|
+import com.fdkankan.download.bean.*;
|
|
|
import com.fdkankan.download.entity.ScenePlus;
|
|
|
import com.fdkankan.download.entity.ScenePlusExt;
|
|
|
import com.fdkankan.download.entity.ScenePro;
|
|
@@ -235,20 +227,15 @@ public class SceneDownloadHandlerServiceImpl {
|
|
|
zipFile.getParentFile().mkdirs();
|
|
|
}
|
|
|
|
|
|
-// String sceneJsonData = fYunFileService.getFileContent(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json");
|
|
|
- String sceneJsonData = redisUtil.get(String.format(RedisKey.SCENE_JSON, num));
|
|
|
- if(StrUtil.isEmpty(sceneJsonData)){
|
|
|
- sceneJsonData = fYunFileService.getFileContent(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json");
|
|
|
- }
|
|
|
- JSONObject sceneJson = JSONUtil.parseObj(sceneJsonData);
|
|
|
- String resolution = sceneJson.getStr("sceneResolution");
|
|
|
+ SceneViewInfo sceneViewInfo = this.getSceneJson(num);
|
|
|
+ String resolution = sceneViewInfo.getSceneResolution();
|
|
|
//国际版存在已经切好图的情况,下载时不需要再切图,只需要把文件直接下载下来打包就可以了
|
|
|
- if(SceneKind.FACE.code().equals(sceneJson.getStr("sceneKind"))){
|
|
|
+ if(SceneKind.FACE.code().equals(sceneViewInfo.getSceneKind())){
|
|
|
resolution = "notNeadCut";
|
|
|
}
|
|
|
|
|
|
int imagesVersion = -1;
|
|
|
- Integer version = sceneJson.getInt("version");
|
|
|
+ Integer version = sceneViewInfo.getVersion();
|
|
|
if(Objects.nonNull(version)){
|
|
|
imagesVersion = version;
|
|
|
}
|
|
@@ -262,7 +249,7 @@ public class SceneDownloadHandlerServiceImpl {
|
|
|
log.info("打包oss文件耗时, num:{}, time:{}", num, timer.intervalRestart());
|
|
|
|
|
|
//重新写入scene.json(去掉密码访问设置)
|
|
|
- this.zipSceneJson(num, sceneJson);
|
|
|
+ this.zipSceneJson(num, sceneViewInfo);
|
|
|
|
|
|
//写入启动命令
|
|
|
this.zipBat(num, "v4");
|
|
@@ -288,6 +275,34 @@ public class SceneDownloadHandlerServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private SceneViewInfo getSceneJson(String num){
|
|
|
+ String sceneJsonData = redisUtil.get(String.format(RedisKey.SCENE_JSON, num));
|
|
|
+ if(StrUtil.isEmpty(sceneJsonData)){
|
|
|
+ sceneJsonData = fYunFileService.getFileContent(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json");
|
|
|
+ }
|
|
|
+ sceneJsonData = sceneJsonData.replace(this.publicUrl, "");
|
|
|
+ SceneViewInfo sceneInfoVO = JSON.parseObject(sceneJsonData, SceneViewInfo.class);
|
|
|
+ sceneInfoVO.setScenePassword(null);
|
|
|
+ if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
|
+ sceneInfoVO.setFloorPlanAngle(0f);
|
|
|
+ }
|
|
|
+ if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
|
|
|
+ sceneInfoVO.setFloorPlanCompass(0f);
|
|
|
+ }
|
|
|
+ SceneEditControlsVO controls = sceneInfoVO.getControls();
|
|
|
+ if(Objects.isNull(controls.getShowShare())){
|
|
|
+ controls.setShowShare(CommonStatus.YES.code().intValue());
|
|
|
+ }
|
|
|
+ if(Objects.isNull(controls.getShowCapture())){
|
|
|
+ controls.setShowCapture(CommonStatus.YES.code().intValue());
|
|
|
+ }
|
|
|
+ if(Objects.isNull(controls.getShowBillboardTitle())){
|
|
|
+ controls.setShowBillboardTitle(CommonStatus.YES.code().intValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ return sceneInfoVO;
|
|
|
+ }
|
|
|
+
|
|
|
public void downloadHandlerV3(DownLoadTaskBean downLoadTaskBean) throws Exception{
|
|
|
|
|
|
String num = downLoadTaskBean.getSceneNum();
|
|
@@ -553,13 +568,12 @@ public class SceneDownloadHandlerServiceImpl {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
- private void zipSceneJson(String num, JSONObject sceneJson) throws Exception{
|
|
|
+ private void zipSceneJson(String num, SceneViewInfo sceneViewInfo) throws Exception{
|
|
|
//访问密码置0
|
|
|
- JSONObject controls = sceneJson.getJSONObject("controls");
|
|
|
- controls.set("showLock", 0);
|
|
|
+ SceneEditControlsVO controls = sceneViewInfo.getControls();
|
|
|
+ controls.setShowLock(CommonStatus.NO.code().intValue());
|
|
|
String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
|
|
|
- String sceneJsonStr = sceneJson.toString().replace(this.publicUrl, "");
|
|
|
- FileUtil.writeUtf8String(sceneJsonStr, String.format(this.sourceLocal, num, this.wwwroot + sceneJsonPath));
|
|
|
+ FileUtil.writeUtf8String(JSON.toJSONString(sceneViewInfo), String.format(this.sourceLocal, num, this.wwwroot + sceneJsonPath));
|
|
|
}
|
|
|
|
|
|
private void zipGetInfoJson(String num, JSONObject getInfo) throws Exception{
|