|
@@ -244,10 +244,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
sceneEditInfoExt.setFloorPlanCompass(0f);
|
|
sceneEditInfoExt.setFloorPlanCompass(0f);
|
|
}
|
|
}
|
|
|
|
|
|
-// if(sceneEditControls == null){
|
|
|
|
-// sceneEditControls = new SceneEditControls();
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
//生成sceneJson
|
|
//生成sceneJson
|
|
SceneJsonBean sceneJson = new SceneJsonBean();
|
|
SceneJsonBean sceneJson = new SceneJsonBean();
|
|
BeanUtil.copyProperties(sceneEditInfoExt, sceneJson);
|
|
BeanUtil.copyProperties(sceneEditInfoExt, sceneJson);
|
|
@@ -255,9 +251,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
SceneEditControlsVO sceneEditControlsVO = BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class);
|
|
SceneEditControlsVO sceneEditControlsVO = BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class);
|
|
sceneJson.setControls(sceneEditControlsVO);
|
|
sceneJson.setControls(sceneEditControlsVO);
|
|
sceneJson.setNum(num);
|
|
sceneJson.setNum(num);
|
|
-// if(StrUtil.isNotEmpty(sceneEditInfo.getFloorPlanPath())){
|
|
|
|
-// sceneJson.setFloorPlanPaths(sceneEditInfo.getFloorPlanPath().split(","));
|
|
|
|
-// }
|
|
|
|
sceneJson.setCreateTime(scenePlus.getCreateTime());
|
|
sceneJson.setCreateTime(scenePlus.getCreateTime());
|
|
|
|
|
|
sceneJson.setSceneResolution(scenePlusExt.getSceneResolution());
|
|
sceneJson.setSceneResolution(scenePlusExt.getSceneResolution());
|
|
@@ -269,9 +262,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
//处理热点数据,生成hot.json
|
|
//处理热点数据,生成hot.json
|
|
this.publicHotData(num, sceneEditInfo);
|
|
this.publicHotData(num, sceneEditInfo);
|
|
|
|
|
|
- // TODO: 2022/3/2 这里的逻辑放在上传球幕视频接口中做了,这里先暂时注释掉,以后要删除
|
|
|
|
- //处理球幕视频
|
|
|
|
-// this.buildVideo(sceneEditInfo, sceneProExt.getDataSource(), sceneNum);
|
|
|
|
|
|
+ //发布场景关联相关数据
|
|
|
|
+ this.publicLinkSceneData(num);
|
|
|
|
|
|
//本地写sceneJson文件
|
|
//本地写sceneJson文件
|
|
String localSceneJsonPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + "scene.json";
|
|
String localSceneJsonPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + "scene.json";
|
|
@@ -305,13 +297,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
|
|
sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
|
|
sceneEditInfoExtService.saveOrUpdate(sceneEditInfoExt);
|
|
sceneEditInfoExtService.saveOrUpdate(sceneEditInfoExt);
|
|
|
|
|
|
-// sceneEditControls.setEditInfoId(sceneEditInfo.getId());
|
|
|
|
-// if(sceneEditControls.getId() == null){
|
|
|
|
-// sceneEditControlsService.save(sceneEditControls);
|
|
|
|
-// }else{
|
|
|
|
-// sceneEditControlsService.updateById(sceneEditControls);
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
// todo 调用v3接口同步场景缩略图url---------------------------------start
|
|
// todo 调用v3接口同步场景缩略图url---------------------------------start
|
|
String url = fkankanMiniHost + URL_UPGRADE_TO_V4_RESULT_SYNC;
|
|
String url = fkankanMiniHost + URL_UPGRADE_TO_V4_RESULT_SYNC;
|
|
fdkankanMiniClient.upgradeToV4ResultSync(url,
|
|
fdkankanMiniClient.upgradeToV4ResultSync(url,
|
|
@@ -323,6 +308,32 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void publicLinkSceneData(String num) throws IOException {
|
|
|
|
+
|
|
|
|
+ String imgEditPath = String.format(UploadFilePath.IMG_EDIT_PATH, num);
|
|
|
|
+ String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
|
|
+ String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
|
|
|
|
+
|
|
|
|
+ //生成link-scene.json并上传到发布目录
|
|
|
|
+ String linkPanKey = String.format(RedisKey.SCENE_LINKPAN_DATA, num);
|
|
|
|
+ Map<String, String> linkPanMap = redisUtil.hmget(linkPanKey);
|
|
|
|
+ if(CollUtil.isEmpty(linkPanMap)){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ JSONArray linkPanArr = new JSONArray();
|
|
|
|
+ linkPanMap.values().stream().forEach(linkPan->{
|
|
|
|
+ linkPanArr.add(JSON.parseObject(linkPan));
|
|
|
|
+ });
|
|
|
|
+ String linkScenePath = dataViewPath + "link-scene.json";
|
|
|
|
+ uploadToOssUtil.upload(linkPanArr.toString().getBytes(), linkScenePath);
|
|
|
|
+
|
|
|
|
+ //删除发布目录中的场景关联切图目录
|
|
|
|
+ uploadToOssUtil.deleteFile(imgViewPath + "panorama_edit");
|
|
|
|
+ //拷贝编辑目录到发布目录
|
|
|
|
+ uploadToOssUtil.copyFiles(imgEditPath + "panorama_edit",imgViewPath + "panorama_edit");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
private void buildVideo(SceneEditInfo sceneEditInfo, String path, String num) throws Exception{
|
|
private void buildVideo(SceneEditInfo sceneEditInfo, String path, String num) throws Exception{
|
|
if(CommonStatus.NO.equals(sceneEditInfo.getBuildVideoStatus())){
|
|
if(CommonStatus.NO.equals(sceneEditInfo.getBuildVideoStatus())){
|
|
return;
|
|
return;
|
|
@@ -1838,6 +1849,25 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public ResultData deleteStyles(DeleteLinkSceneStylesParamVO param) throws Exception {
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
|
+ if (scenePlus == null)
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
+
|
|
|
|
+ List<String> idList = param.getIdList();
|
|
|
|
+
|
|
|
|
+ this.syncLinkPanStylesFromFileToRedis(param.getNum());
|
|
|
|
+
|
|
|
|
+ String key = String.format(RedisKey.SCENE_LINKPAN_STYLES, param.getNum());
|
|
|
|
+ redisUtil.hdel(key, idList.toArray());
|
|
|
|
+
|
|
|
|
+ //写入本地文件,作为备份
|
|
|
|
+ this.writeLinkScene(param.getNum());
|
|
|
|
+
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
public ResultData deleteLinkPan(DeleteLinkPanParamVO param) throws Exception {
|
|
public ResultData deleteLinkPan(DeleteLinkPanParamVO param) throws Exception {
|
|
|
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
@@ -1917,13 +1947,15 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
}
|
|
}
|
|
result.put("tags", tags);
|
|
result.put("tags", tags);
|
|
|
|
|
|
- //查询缓存是否包含icons
|
|
|
|
|
|
+ //封装styles数据
|
|
|
|
+ List<JSONObject> styles = Lists.newArrayList();
|
|
key = String.format(RedisKey.SCENE_LINKPAN_STYLES, num);
|
|
key = String.format(RedisKey.SCENE_LINKPAN_STYLES, num);
|
|
- Set<String> styles = redisUtil.sGet(key);
|
|
|
|
- if(CollUtil.isEmpty(styles)){
|
|
|
|
- styles = Sets.newHashSet();
|
|
|
|
|
|
+ Map<String, String> styleMap = redisUtil.hmget(key);
|
|
|
|
+ if(CollUtil.isNotEmpty(styleMap)){
|
|
|
|
+ styleMap.values().stream().forEach(style->{
|
|
|
|
+ styles.add(JSON.parseObject(style));
|
|
|
|
+ });
|
|
}
|
|
}
|
|
-// List<String> styleList = this.sortStyles(tags, styles);
|
|
|
|
result.put("styles", styles);
|
|
result.put("styles", styles);
|
|
|
|
|
|
return ResultData.ok(result);
|
|
return ResultData.ok(result);
|
|
@@ -2008,8 +2040,14 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
jsonObject.put("tags", tagJsonArr);
|
|
jsonObject.put("tags", tagJsonArr);
|
|
|
|
|
|
String stylesKey = String.format(RedisKey.SCENE_LINKPAN_STYLES, num);
|
|
String stylesKey = String.format(RedisKey.SCENE_LINKPAN_STYLES, num);
|
|
- Set<String> stylesList = redisUtil.sGet(stylesKey);
|
|
|
|
- jsonObject.put("styles", stylesList);
|
|
|
|
|
|
+ Map<String, String> styleMap = redisUtil.hmget(stylesKey);
|
|
|
|
+ List<JSONObject> styleList = Lists.newArrayList();
|
|
|
|
+ if(CollUtil.isNotEmpty(styleMap)){
|
|
|
|
+ styleMap.values().stream().forEach(style->{
|
|
|
|
+ styleList.add(JSONObject.parseObject(style));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ jsonObject.put("styles", styleList);
|
|
|
|
|
|
String linkScenePath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + "link-scene.json";
|
|
String linkScenePath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + "link-scene.json";
|
|
String lockKey = String.format(RedisLockKey.LOCK_LINK_SCENE_JSON, num);
|
|
String lockKey = String.format(RedisLockKey.LOCK_LINK_SCENE_JSON, num);
|
|
@@ -2018,7 +2056,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
try{
|
|
try{
|
|
- FileUtils.writeFile(linkScenePath, jsonObject.toJSONString());
|
|
|
|
|
|
+ cn.hutool.core.io.FileUtil.writeUtf8String(jsonObject.toJSONString(), linkScenePath);
|
|
}finally {
|
|
}finally {
|
|
redisLockUtil.unlockLua(lockKey);
|
|
redisLockUtil.unlockLua(lockKey);
|
|
}
|
|
}
|
|
@@ -2033,17 +2071,15 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- String key = String.format(RedisKey.SCENE_LINKPAN_STYLES, num);
|
|
|
|
- redisUtil.sSet(key, styles.toArray());
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-// Map<String, String> addOrUpdateMap = new HashMap<>();
|
|
|
|
-// hotDataList.stream().forEach(hotData -> {
|
|
|
|
-// addOrUpdateMap.put(hotData.getSid(), hotData.getHotData());
|
|
|
|
-// });
|
|
|
|
|
|
+ Map<String, String> styleMap = new HashMap<>();
|
|
|
|
+ styles.stream().forEach(style->{
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(style);
|
|
|
|
+ String id = jsonObject.getString("id");
|
|
|
|
+ styleMap.put(id, style);
|
|
|
|
+ });
|
|
|
|
|
|
- //处理新增和修改数据
|
|
|
|
-// this.addOrUpdateHotData(num, addOrUpdateMap);
|
|
|
|
|
|
+ String key = String.format(RedisKey.SCENE_LINKPAN_STYLES, num);
|
|
|
|
+ redisUtil.hmset(key, styleMap);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2080,7 +2116,13 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
if(CollUtil.isEmpty(stylesArr)){
|
|
if(CollUtil.isEmpty(stylesArr)){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- redisUtil.sSet(key, stylesArr.toJavaList(String.class).toArray());
|
|
|
|
|
|
+ Map<String, String> styleMap = new HashMap<>();
|
|
|
|
+ for (Object style : stylesArr) {
|
|
|
|
+ JSONObject styleObj = (JSONObject)style;
|
|
|
|
+ String id = styleObj.getString("id");
|
|
|
|
+ styleMap.put(id, styleObj.toJSONString());
|
|
|
|
+ }
|
|
|
|
+ redisUtil.hmset(key, styleMap);
|
|
}finally {
|
|
}finally {
|
|
redisLockUtil.unlockLua(lockKey);
|
|
redisLockUtil.unlockLua(lockKey);
|
|
}
|
|
}
|