|
@@ -1,5 +1,6 @@
|
|
|
package com.fdkankan.download.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.ConcurrentHashSet;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
@@ -17,12 +18,8 @@ import com.fdkankan.common.constant.*;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.download.bean.*;
|
|
|
-import com.fdkankan.download.entity.ScenePlus;
|
|
|
-import com.fdkankan.download.entity.ScenePlusExt;
|
|
|
-import com.fdkankan.download.entity.ScenePro;
|
|
|
-import com.fdkankan.download.service.IScenePlusExtService;
|
|
|
-import com.fdkankan.download.service.IScenePlusService;
|
|
|
-import com.fdkankan.download.service.ISceneProService;
|
|
|
+import com.fdkankan.download.entity.*;
|
|
|
+import com.fdkankan.download.service.*;
|
|
|
import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
@@ -249,6 +246,8 @@ public class SceneDownloadHandlerServiceImpl {
|
|
|
this.zipOssFiles(ossFilePaths, num, count, total, resolution, imagesVersion, cacheKeys, "v4");
|
|
|
log.info("打包oss文件耗时, num:{}, time:{}", num, timer.intervalRestart());
|
|
|
|
|
|
+ this.downloadDbAndRedisData(num);
|
|
|
+
|
|
|
//重新写入scene.json(去掉密码访问设置)
|
|
|
this.zipSceneJson(num, sceneViewInfo);
|
|
|
|
|
@@ -498,6 +497,167 @@ public class SceneDownloadHandlerServiceImpl {
|
|
|
FileUtil.writeUtf8String(num, String.format(sourceLocal, num, "code.txt"));
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISceneEditInfoService sceneEditInfoService;
|
|
|
+ @Autowired
|
|
|
+ private ISceneEditInfoExtService sceneEditInfoExtService;
|
|
|
+ @Autowired
|
|
|
+ private ISceneEditControlsService sceneEditControlsService;
|
|
|
+
|
|
|
+ private void downloadDbAndRedisData(String num) throws Exception{
|
|
|
+
|
|
|
+ String cachePath = String.format(this.sourceLocal, num, this.wwwroot) + String.format(UploadFilePath.VIEW_PATH, num) + "cache/";
|
|
|
+ try {
|
|
|
+ //db t_scene_plus、t_scene_plus_ext、t_scene_edit_info、t_scene_edit_info_ext、t_scene_edit_controls
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
+ FileUtil.writeUtf8String(JSON.toJSONString(scenePlus), cachePath + "t_scene_plus.txt");
|
|
|
+
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getByScenePlusId(scenePlus.getId());
|
|
|
+ FileUtil.writeUtf8String(JSON.toJSONString(scenePlusExt), cachePath + "t_scene_plus_ext.txt");
|
|
|
+
|
|
|
+ SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
+ sceneEditInfo.setFloorLogo("0");
|
|
|
+ sceneEditInfo.setFloorLogoSize(null);
|
|
|
+ sceneEditInfo.setFloorLogoFile(null);
|
|
|
+ sceneEditInfo.setMusic(null);
|
|
|
+ sceneEditInfo.setMusicFile(null);
|
|
|
+ sceneEditInfo.setFloorPlanUser((byte)0);
|
|
|
+ sceneEditInfo.setTags((byte)0);
|
|
|
+ sceneEditInfo.setVersion(0);
|
|
|
+ sceneEditInfo.setImgVersion(0);
|
|
|
+ sceneEditInfo.setLinkVersion(0);
|
|
|
+ sceneEditInfo.setIsUploadObj((byte)0);
|
|
|
+ sceneEditInfo.setFloorEditVer(0);
|
|
|
+ sceneEditInfo.setFloorPublishVer(0);
|
|
|
+ sceneEditInfo.setBoxVideos(null);
|
|
|
+ sceneEditInfo.setBoxPhotos(null);
|
|
|
+ sceneEditInfo.setBoxModels(null);
|
|
|
+ sceneEditInfo.setEntry(null);
|
|
|
+ sceneEditInfo.setLoadingLogo(null);
|
|
|
+ sceneEditInfo.setFloorLogoFile(null);
|
|
|
+ sceneEditInfo.setFloorPlanUpload(null);
|
|
|
+ FileUtil.writeUtf8String(JSON.toJSONString(sceneEditInfo), cachePath + "t_scene_edit_info.txt");
|
|
|
+
|
|
|
+ SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
+ sceneEditInfoExt.setFloorPlanAngle(0f);
|
|
|
+ sceneEditInfoExt.setFloorPlanCompass(0f);
|
|
|
+ sceneEditInfoExt.setTours(0);
|
|
|
+ sceneEditInfoExt.setMosaic(null);
|
|
|
+ sceneEditInfoExt.setWaterMark(null);
|
|
|
+ sceneEditInfoExt.setLinks(0);
|
|
|
+ sceneEditInfoExt.setFilters(0);
|
|
|
+ sceneEditInfoExt.setSurveillances(0);
|
|
|
+ sceneEditInfoExt.setShareLogoImg(null);
|
|
|
+ sceneEditInfoExt.setBillboards(0);
|
|
|
+ sceneEditInfoExt.setCutModel(0);
|
|
|
+ sceneEditInfoExt.setSnsInfo(null);
|
|
|
+ sceneEditInfoExt.setStarted(null);
|
|
|
+ sceneEditInfoExt.setSceneDraw(0);
|
|
|
+ FileUtil.writeUtf8String(JSON.toJSONString(sceneEditInfoExt), cachePath + "t_scene_edit_info_ext.txt");
|
|
|
+
|
|
|
+ SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
+ sceneEditControls.setShowLock(0);
|
|
|
+ sceneEditControls.setShowScale(0);
|
|
|
+ sceneEditControls.setShowCameraTitle(0);
|
|
|
+ sceneEditControls.setShowLinkTitle(0);
|
|
|
+ sceneEditControls.setShowAllModel(0);
|
|
|
+ FileUtil.writeUtf8String(JSON.toJSONString(sceneEditControls), cachePath + "t_scene_edit_controls.txt");
|
|
|
+
|
|
|
+ //生成sceneJson
|
|
|
+ SceneViewInfo sceneJson = new SceneViewInfo();
|
|
|
+ BeanUtil.copyProperties(sceneEditInfoExt, sceneJson);
|
|
|
+ BeanUtil.copyProperties(sceneEditInfo, sceneJson);
|
|
|
+ SceneEditControlsVO sceneEditControlsVO = BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class);
|
|
|
+ sceneJson.setControls(sceneEditControlsVO);
|
|
|
+ sceneJson.setNum(num);
|
|
|
+ sceneJson.setCreateTime(scenePlus.getCreateTime());
|
|
|
+
|
|
|
+ sceneJson.setSceneResolution(scenePlusExt.getSceneResolution());
|
|
|
+ sceneJson.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
|
+ sceneJson.setSceneKind(scenePlusExt.getSceneKind());
|
|
|
+ if(StrUtil.isNotEmpty(scenePlusExt.getVideos())){
|
|
|
+ sceneJson.setVideos(scenePlusExt.getVideos());
|
|
|
+ }
|
|
|
+ sceneJson.setModelKind(scenePlusExt.getModelKind());
|
|
|
+ FileUtil.writeUtf8String(JSON.toJSONString(sceneJson), cachePath + "scene.json");
|
|
|
+
|
|
|
+
|
|
|
+ //redis
|
|
|
+// Map<String, String> hotdataStr = redisUtil.hmget(String.format(RedisKey.SCENE_HOT_DATA, num));
|
|
|
+// if(CollUtil.isNotEmpty(hotdataStr)){
|
|
|
+// Map<String, JSONObject> hotdata = hotdataStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
|
|
|
+// FileUtil.writeUtf8String(JSON.toJSONString(hotdata), cachePath + "hotdata.json");
|
|
|
+// }
|
|
|
+//
|
|
|
+// Set<String> hoticons = redisUtil.sGet(String.format(RedisKey.SCENE_HOT_ICONS, num));
|
|
|
+// if(CollUtil.isNotEmpty(hoticons)){
|
|
|
+// FileUtil.writeUtf8String(JSON.toJSONString(hoticons), cachePath + "hoticons.json");
|
|
|
+// }
|
|
|
+//
|
|
|
+// Map<String, String> LinkPanStr = redisUtil.hmget(String.format(RedisKey.SCENE_LINKPAN_DATA, num));
|
|
|
+// if(CollUtil.isNotEmpty(LinkPanStr)){
|
|
|
+// Map<String, JSONObject> linkPan = LinkPanStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
|
|
|
+// FileUtil.writeUtf8String(JSON.toJSONString(linkPan), cachePath + "linkPan.json");
|
|
|
+// }
|
|
|
+//
|
|
|
+// Map<String, String> LinkPanStylesStr = redisUtil.hmget(String.format(RedisKey.SCENE_LINKPAN_STYLES, num));
|
|
|
+// if(CollUtil.isNotEmpty(LinkPanStylesStr)){
|
|
|
+// Map<String, JSONObject> LinkPanStyles = LinkPanStylesStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
|
|
|
+// FileUtil.writeUtf8String(JSON.toJSONString(LinkPanStyles), cachePath + "LinkPanStyles.json");
|
|
|
+// }
|
|
|
+//
|
|
|
+// Map<String, String> billboardsStr = redisUtil.hmget(String.format(RedisKey.SCENE_BILLBOARDS, num));
|
|
|
+// if(CollUtil.isNotEmpty(billboardsStr)){
|
|
|
+// Map<String, JSONObject> billboards = billboardsStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
|
|
|
+// FileUtil.writeUtf8String(JSON.toJSONString(billboards), cachePath + "billboards.json");
|
|
|
+// }
|
|
|
+//
|
|
|
+// Map<String, String> billboardsStylesStr = redisUtil.hmget(String.format(RedisKey.SCENE_BILLBOARDS_STYLES, num));
|
|
|
+// if(CollUtil.isNotEmpty(billboardsStylesStr)){
|
|
|
+// Map<String, JSONObject> billboardsStyles = billboardsStylesStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
|
|
|
+// FileUtil.writeUtf8String(JSON.toJSONString(billboardsStyles), cachePath + "billboardsStyles.json");
|
|
|
+// }
|
|
|
+//
|
|
|
+// Map<String, String> cutModelStr = redisUtil.hmget(String.format(RedisKey.SCENE_CUT_MODEL, num));
|
|
|
+// if(CollUtil.isNotEmpty(cutModelStr)){
|
|
|
+// Map<String, JSONObject> cutModel = cutModelStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
|
|
|
+// FileUtil.writeUtf8String(JSON.toJSONString(cutModel), cachePath + "cutModel.json");
|
|
|
+// }
|
|
|
+//
|
|
|
+// Map<String, String> mosaicStr = redisUtil.hmget(String.format(RedisKey.SCENE_MOSAIC_DATA, num));
|
|
|
+// if(CollUtil.isNotEmpty(mosaicStr)){
|
|
|
+// Map<String, JSONObject> mosaic = mosaicStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
|
|
|
+// FileUtil.writeUtf8String(JSON.toJSONString(mosaic), cachePath + "mosaic.json");
|
|
|
+// }
|
|
|
+//
|
|
|
+// List<String> filterStr = redisUtil.lGet(String.format(RedisKey.SCENE_filter_DATA, num), 0, -1);
|
|
|
+// if(CollUtil.isNotEmpty(filterStr)){
|
|
|
+// List<JSONObject> filter = filterStr.stream().map(v -> JSONUtil.parseObj(v)).collect(Collectors.toList());
|
|
|
+// FileUtil.writeUtf8String(JSON.toJSONString(filter), cachePath + "filter.json");
|
|
|
+// }
|
|
|
+//
|
|
|
+// Map<String, String> drawStr = redisUtil.hmget(String.format(RedisKey.SCENE_DRAW, num));
|
|
|
+// if(CollUtil.isNotEmpty(drawStr)){
|
|
|
+// Map<String, JSONObject> draw = drawStr.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> JSONUtil.parseObj(entry.getValue())));
|
|
|
+// FileUtil.writeUtf8String(JSON.toJSONString(draw), cachePath + "draw.json");
|
|
|
+// }
|
|
|
+
|
|
|
+ //下载计算资源
|
|
|
+ if(fYunFileService.fileExist(String.format(UploadFilePath.scene_result_data_path, num) + "data.json")){
|
|
|
+ fYunFileService.downloadFile(String.format(UploadFilePath.scene_result_data_path, num) + "data.json", cachePath + "data.json");
|
|
|
+ }else{
|
|
|
+ FileUtil.writeUtf8String("", cachePath + "data.json");
|
|
|
+ }
|
|
|
+ if(fYunFileService.fileExist(String.format(UploadFilePath.scene_result_data_path, num) + "project.json")){
|
|
|
+ fYunFileService.downloadFile(String.format(UploadFilePath.scene_result_data_path, num) + "project.json", cachePath + "project.json");
|
|
|
+ }else{
|
|
|
+ FileUtil.writeUtf8String("", cachePath + "project.json");
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("下载缓存数据出错,", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void zipBat(String num, String version) throws Exception{
|
|
|
String batContent = String.format(this.exeContent, num);
|
|
|
if("v3".equals(version)){
|