|
@@ -135,7 +135,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
sceneEditInfoService.saveTagsToSceneEditInfo(param.getNum(), sceneEditInfo);
|
|
|
sceneEditInfoService.updateById(sceneEditInfo);
|
|
|
|
|
|
- this.publicHotData(param.getNum());
|
|
|
+ this.publicHotData(param.getNum(), param.getSubgroup());
|
|
|
|
|
|
return ResultData.ok();
|
|
|
}
|
|
@@ -167,17 +167,17 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
@Override
|
|
|
public ResultData deleteTag(DeleteHotParamVO param) throws Exception {
|
|
|
|
|
|
- Scene scenePlus = scenePlusService.getByNum(param.getNum());
|
|
|
+ Scene scenePlus = scenePlusService.getByNum(param.getNum(), param.getSubgroup());
|
|
|
if (scenePlus == null)
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
|
|
List<String> deleteSidList = param.getSidList();
|
|
|
|
|
|
//处理删除状态数据
|
|
|
- this.deleteHotData(param.getNum(), deleteSidList);
|
|
|
+ this.deleteHotData(param.getNum(), param.getSubgroup(), deleteSidList);
|
|
|
|
|
|
//删除导览中的热点数据
|
|
|
- this.deleteHotDataFromTourJson(param.getNum(), param.getSidList());
|
|
|
+ this.deleteHotDataFromTourJson(param.getNum(), param.getSubgroup(), param.getSidList());
|
|
|
|
|
|
// //写入本地文件,作为备份
|
|
|
// this.writeHotJson(param.getNum());
|
|
@@ -187,14 +187,14 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
sceneEditInfoService.saveTagsToSceneEditInfo(param.getNum(), sceneEditInfo);
|
|
|
sceneEditInfoService.updateById(sceneEditInfo);
|
|
|
|
|
|
- this.publicHotData(param.getNum());
|
|
|
+ this.publicHotData(param.getNum(), param.getSubgroup());
|
|
|
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|
|
|
- private void deleteHotDataFromTourJson(String num, List<String> sidList) throws IOException {
|
|
|
+ private void deleteHotDataFromTourJson(String num, Integer subgroup, List<String> sidList) throws IOException {
|
|
|
String key = String.format(UploadFilePath.USER_VIEW_PATH, num) + "tour.json";
|
|
|
- String tourJson = fYunFileService.getFileContent(key);
|
|
|
+ String tourJson = fYunFileService.getFileContent(key, subgroup);
|
|
|
if(StrUtil.isEmpty(tourJson)){
|
|
|
return;
|
|
|
}
|
|
@@ -213,13 +213,13 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- fYunFileService.uploadFile(num, jsonArray.toJSONString().getBytes(StandardCharsets.UTF_8), key);
|
|
|
+ fYunFileService.uploadFile(num, subgroup, jsonArray.toJSONString().getBytes(StandardCharsets.UTF_8), key);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ResultData deleteIcons(DeleteHotIconParamVO param) throws Exception {
|
|
|
|
|
|
- Scene scenePlus = scenePlusService.getByNum(param.getNum());
|
|
|
+ Scene scenePlus = scenePlusService.getByNum(param.getNum(), param.getSubgroup());
|
|
|
if (scenePlus == null)
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
|
@@ -227,7 +227,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
|
|
|
// this.syncIconsFromFileToRedis(param.getNum());
|
|
|
|
|
|
- String key = String.format(RedisKey.SCENE_HOT_ICONS, param.getNum());
|
|
|
+ String key = String.format(RedisKey.SCENE_HOT_ICONS, RedisKey.getNumStr(param.getNum(), param.getSubgroup()));
|
|
|
redisClient.setRemove(key, new HashSet<>(fileNameList));
|
|
|
|
|
|
//写入本地文件,作为备份
|
|
@@ -237,7 +237,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData listTags(String num) throws Exception{
|
|
|
+ public ResultData listTags(String num, Integer subgroup) throws Exception{
|
|
|
|
|
|
//保证热点数据安全性,当redis宕机导致热点数据丢失时,可以从文件中读取,恢复到redis
|
|
|
// this.syncHotFromFileToRedis(num);
|
|
@@ -248,7 +248,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
//查询缓存是否包含热点数据
|
|
|
- String key = String.format(RedisKey.SCENE_HOT_DATA, num);
|
|
|
+ String key = String.format(RedisKey.SCENE_HOT_DATA, RedisKey.getNumStr(num, subgroup));
|
|
|
Map<String, String> allTagsMap = redisClient.hmget(key);
|
|
|
List<JSONObject> tags = Lists.newArrayList();
|
|
|
List<TagBean> tagBeanList = new ArrayList<>();
|
|
@@ -273,7 +273,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
result.put("tags", tags);
|
|
|
|
|
|
//查询缓存是否包含icons
|
|
|
- key = String.format(RedisKey.SCENE_HOT_ICONS, num);
|
|
|
+ key = String.format(RedisKey.SCENE_HOT_ICONS, RedisKey.getNumStr(num, subgroup));
|
|
|
Set<String> icons = redisClient.sGet(key);
|
|
|
if(icons == null){
|
|
|
icons = Sets.newHashSet();
|
|
@@ -331,7 +331,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
}
|
|
|
|
|
|
String hotJsonPath = String.format(UploadFilePath.USER_VIEW_PATH, sceneNum) + "hot.json";
|
|
|
- fYunFileService.uploadFile(sceneNum, tags.toString().getBytes(StandardCharsets.UTF_8), hotJsonPath);
|
|
|
+ fYunFileService.uploadFile(sceneNum, subgroup, tags.toString().getBytes(StandardCharsets.UTF_8), hotJsonPath);
|
|
|
}
|
|
|
//
|
|
|
// /**
|
|
@@ -486,7 +486,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void deleteHotData(String num, List<String> deleteSidList) throws Exception {
|
|
|
+ private void deleteHotData(String num, Integer subgroup, List<String> deleteSidList) throws Exception {
|
|
|
|
|
|
// this.syncHotFromFileToRedis(num);
|
|
|
|
|
@@ -495,7 +495,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
}
|
|
|
|
|
|
//从redis中加载热点数据
|
|
|
- String key = String.format(RedisKey.SCENE_HOT_DATA, num);
|
|
|
+ String key = String.format(RedisKey.SCENE_HOT_DATA, RedisKey.getNumStr(num, subgroup));
|
|
|
|
|
|
//从redis中移除热点数据
|
|
|
redisClient.hdel(key, deleteSidList);
|
|
@@ -504,7 +504,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
@Override
|
|
|
public ResultData saveTagsVisible(SaveTagsVisibleParamVO param) throws Exception {
|
|
|
|
|
|
- Scene scenePlus = scenePlusService.getByNum(param.getNum());
|
|
|
+ Scene scenePlus = scenePlusService.getByNum(param.getNum(), param.getSubgroup());
|
|
|
if (scenePlus == null ) {
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
@@ -514,7 +514,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
// this.syncHotFromFileToRedis(param.getNum());
|
|
|
|
|
|
//从缓存中获取热点数据,如果为空,抛出异常
|
|
|
- String key = String.format(RedisKey.SCENE_HOT_DATA, param.getNum());
|
|
|
+ String key = String.format(RedisKey.SCENE_HOT_DATA, RedisKey.getNumStr(param.getNum(), param.getSubgroup()));
|
|
|
Map<String, String> map = redisClient.hmget(key);
|
|
|
if (CollUtil.isEmpty(map)) {
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_7005);
|
|
@@ -555,7 +555,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
//写入本地文件,作为备份,以防redis数据丢失
|
|
|
// this.writeHotJson(param.getNum());
|
|
|
|
|
|
- this.publicHotData(param.getNum());
|
|
|
+ this.publicHotData(param.getNum(), param.getSubgroup());
|
|
|
|
|
|
return ResultData.ok();
|
|
|
}
|
|
@@ -563,14 +563,14 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
@Override
|
|
|
public ResultData saveRoam(BaseDataParamVO param) throws Exception {
|
|
|
|
|
|
- Scene scenePlus = scenePlusService.getByNum(param.getNum());
|
|
|
+ Scene scenePlus = scenePlusService.getByNum(param.getNum(), param.getSubgroup());
|
|
|
if (scenePlus == null ) {
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
|
|
|
JSONArray inputData = JSONObject.parseArray(param.getData());
|
|
|
|
|
|
- String localDataPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, param.getNum());
|
|
|
+ String localDataPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, RedisKey.getNumStr(param.getNum(), param.getSubgroup()));
|
|
|
File directory = new File(localDataPath);
|
|
|
if (!directory.exists()) {
|
|
|
directory.mkdirs();
|
|
@@ -590,7 +590,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
|
|
|
// String str = FileUtils.readFile(localDataPath + "vision.json");
|
|
|
|
|
|
- String str = fYunFileService.getFileContent(viewImagesPath + "vision.txt");
|
|
|
+ String str = fYunFileService.getFileContent(viewImagesPath + "vision.txt", param.getSubgroup());
|
|
|
JSONObject json = JSONObject.parseObject(str);
|
|
|
JSONArray panos = json.getJSONArray("sweepLocations");
|
|
|
for (int i = 0; i < panos.size(); ++i) {
|
|
@@ -611,7 +611,7 @@ public class SceneProServiceImpl implements ISceneProService {
|
|
|
// FileUtils.writeFile(localDataPath + "vision.json", json.toString());
|
|
|
FileUtil.writeUtf8String(json.toString(), localDataPath + "vision.json");
|
|
|
ConvertUtils.convertTxtToVisionModelData(localDataPath + "vision.json", localDataPath + "vision.modeldata");
|
|
|
- fYunFileService.uploadFile(param.getNum(), localDataPath + "vision.modeldata", viewImagesPath + "vision.modeldata");
|
|
|
+ fYunFileService.uploadFile(param.getNum(), param.getSubgroup(), localDataPath + "vision.modeldata", viewImagesPath + "vision.modeldata");
|
|
|
FileUtil.del(localDataPath + "vision.json");
|
|
|
FileUtil.del(localDataPath + "vision.modeldata");
|
|
|
|