|
@@ -236,7 +236,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
// this.buildVideo(sceneEditInfo, sceneProExt.getDataSource(), sceneNum);
|
|
// this.buildVideo(sceneEditInfo, sceneProExt.getDataSource(), sceneNum);
|
|
|
|
|
|
//本地写sceneJson文件
|
|
//本地写sceneJson文件
|
|
- String localSceneJsonPath = String.format(ConstantFilePath.SCENE_PATH_FORMAT, num);
|
|
|
|
|
|
+ String localSceneJsonPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + "scene.json";
|
|
FileUtils.writeFile(localSceneJsonPath, JSON.toJSONString(sceneJson));
|
|
FileUtils.writeFile(localSceneJsonPath, JSON.toJSONString(sceneJson));
|
|
//上传sceneJson文件
|
|
//上传sceneJson文件
|
|
String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", num);
|
|
String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", num);
|
|
@@ -408,7 +408,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
sceneInfoVO.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
sceneInfoVO.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
sceneInfoVO.setVideos(scenePlusExt.getVideos());
|
|
sceneInfoVO.setVideos(scenePlusExt.getVideos());
|
|
|
|
|
|
- this.setExtData(sceneInfoVO, scenePlus.getCameraId());
|
|
|
|
|
|
+ // TODO: 2022/4/24 v3版本停机要切换---------------------------start
|
|
|
|
+// this.setExtData(sceneInfoVO, scenePlus.getCameraId());
|
|
|
|
+ this.setExtDataFromV3(sceneInfoVO, scenePlus.getCameraId());
|
|
|
|
+ // TODO: 2022/4/24 v3版本停机要切换---------------------------end
|
|
|
|
|
|
return sceneInfoVO;
|
|
return sceneInfoVO;
|
|
}
|
|
}
|
|
@@ -421,7 +424,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
* @date 2022/3/9
|
|
* @date 2022/3/9
|
|
**/
|
|
**/
|
|
private void setExtDataFromV3(SceneInfoVO sceneInfoVO, Long cameraId) throws Exception{
|
|
private void setExtDataFromV3(SceneInfoVO sceneInfoVO, Long cameraId) throws Exception{
|
|
- sceneInfoVO.setDataSync(fdkankanMiniClient.getDataSyncType(mainUrl));
|
|
|
|
|
|
+ if(Objects.isNull(cameraId)){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ String url = mainUrl + "/api/user/camera/getDataSyncByCameraId?cameraId=" + cameraId;
|
|
|
|
+ sceneInfoVO.setDataSync(fdkankanMiniClient.getDataSyncType(url));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -475,7 +482,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
//先查询redis
|
|
//先查询redis
|
|
if(StrUtil.isNotEmpty(sceneJson)) {
|
|
if(StrUtil.isNotEmpty(sceneJson)) {
|
|
sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoVO.class);
|
|
sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoVO.class);
|
|
- this.setExtData(sceneInfoVO, scenePlus.getCameraId());
|
|
|
|
|
|
+ // TODO: 2022/4/24 v3版本停机要切换---------------------------start
|
|
|
|
+// this.setExtData(sceneInfoVO, scenePlus.getCameraId());
|
|
|
|
+ this.setExtDataFromV3(sceneInfoVO, scenePlus.getCameraId());
|
|
|
|
+ // TODO: 2022/4/24 v3版本停机要切换---------------------------end
|
|
sceneInfoVO.setScenePassword(null);
|
|
sceneInfoVO.setScenePassword(null);
|
|
if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
sceneInfoVO.setFloorPlanAngle(0f);
|
|
sceneInfoVO.setFloorPlanAngle(0f);
|
|
@@ -492,7 +502,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
if(StrUtil.isEmpty(objectContent))
|
|
if(StrUtil.isEmpty(objectContent))
|
|
return null;
|
|
return null;
|
|
sceneInfoVO = JSON.parseObject(objectContent, SceneInfoVO.class);
|
|
sceneInfoVO = JSON.parseObject(objectContent, SceneInfoVO.class);
|
|
- this.setExtData(sceneInfoVO, scenePlus.getCameraId());
|
|
|
|
|
|
+ // TODO: 2022/4/24 v3版本停机要切换---------------------------start
|
|
|
|
+// this.setExtData(sceneInfoVO, scenePlus.getCameraId());
|
|
|
|
+ this.setExtDataFromV3(sceneInfoVO, scenePlus.getCameraId());
|
|
|
|
+ // TODO: 2022/4/24 v3版本停机要切换---------------------------end
|
|
sceneInfoVO.setScenePassword(null);
|
|
sceneInfoVO.setScenePassword(null);
|
|
if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
sceneInfoVO.setFloorPlanAngle(0f);
|
|
sceneInfoVO.setFloorPlanAngle(0f);
|
|
@@ -537,98 +550,34 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
if(Objects.isNull(scenePlus))
|
|
if(Objects.isNull(scenePlus))
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
|
|
- String editDataPath = String.format(UploadFilePath.DATA_EDIT_PATH, num);
|
|
|
|
String editUserPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
String editUserPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
- String localDataPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, num);
|
|
|
|
- String floorCadUrl = ossUrlPrefix + editDataPath + "floorplan_cad.json?t=" + System.currentTimeMillis();
|
|
|
|
- String floorUserUrl = ossUrlPrefix + editUserPath + "floorplan_user.json?t=" + System.currentTimeMillis();
|
|
|
|
|
|
+ String localDataPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num);
|
|
|
|
|
|
JSONObject fileInfoJson = JSON.parseObject(param.getData());
|
|
JSONObject fileInfoJson = JSON.parseObject(param.getData());
|
|
- String filePathStr = null;
|
|
|
|
-
|
|
|
|
- String floors = fileInfoJson.getString("floors");
|
|
|
|
- String cadInfo = null;
|
|
|
|
Float angel = null;
|
|
Float angel = null;
|
|
Float compass = null;
|
|
Float compass = null;
|
|
String floorJsonData = fileInfoJson.getString("floorJsonData");
|
|
String floorJsonData = fileInfoJson.getString("floorJsonData");
|
|
if(StrUtil.isNotBlank(floorJsonData)){
|
|
if(StrUtil.isNotBlank(floorJsonData)){
|
|
JSONObject jsonObject = JSON.parseObject(floorJsonData);
|
|
JSONObject jsonObject = JSON.parseObject(floorJsonData);
|
|
- cadInfo = jsonObject.getString("cadInfo");
|
|
|
|
angel = jsonObject.getFloat("angle");
|
|
angel = jsonObject.getFloat("angle");
|
|
compass = jsonObject.getFloat("compass");
|
|
compass = jsonObject.getFloat("compass");
|
|
}
|
|
}
|
|
-// String filePaths = fileInfoJson.getString("filePaths");
|
|
|
|
-// Byte reSet = fileInfoJson.getByte("reset");
|
|
|
|
-
|
|
|
|
- //户型图文件路径
|
|
|
|
-// if(StrUtil.isNotEmpty(filePaths)){
|
|
|
|
-// cn.hutool.json.JSONArray filePathsArrs = JSONUtil.parseArray(filePaths);
|
|
|
|
-// List<String> filePathsList = filePathsArrs.toList(String.class);
|
|
|
|
-// StringBuilder filePathBuilder = new StringBuilder();
|
|
|
|
-// filePathsList.parallelStream().forEach(path -> {
|
|
|
|
-// filePathBuilder.append(",").append(path);
|
|
|
|
-// });
|
|
|
|
-// filePathStr = filePathBuilder.substring(1);
|
|
|
|
-// }
|
|
|
|
|
|
|
|
//处理户型图数据
|
|
//处理户型图数据
|
|
- JSONObject floorUserJson = null;
|
|
|
|
- if(StrUtil.isNotEmpty(floors)) {
|
|
|
|
- //如果入参是空,则加载服务器的
|
|
|
|
- if(StrUtil.isEmpty(floorJsonData)){
|
|
|
|
-
|
|
|
|
- if (!StorageType.LOCAL.code().equals(this.type)) {// TODO: 2022/2/15 这里有可能有问题,可能还需要考虑本地部署的情况
|
|
|
|
- FileUtils.downLoadFromUrl(floorUserUrl, "floorplan_user.json", localDataPath);
|
|
|
|
- }
|
|
|
|
- floorJsonData = FileUtils.readFile(localDataPath + "floorplan_user.json");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //如果floors不为空,需要根据对应楼层id修改楼层名称
|
|
|
|
- if (StrUtil.isNotEmpty(floorJsonData)) {
|
|
|
|
- floorUserJson = this.updateFloorName(floors, floorJsonData);
|
|
|
|
- floorJsonData = floorUserJson.toJSONString();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
//上传floorplan_user.json文件
|
|
//上传floorplan_user.json文件
|
|
FileUtils.writeFile(localDataPath + "floorplan_user.json", floorJsonData);
|
|
FileUtils.writeFile(localDataPath + "floorplan_user.json", floorJsonData);
|
|
uploadToOssUtil.upload(localDataPath + "floorplan_user.json", editUserPath + "floorplan_user.json");
|
|
uploadToOssUtil.upload(localDataPath + "floorplan_user.json", editUserPath + "floorplan_user.json");
|
|
|
|
|
|
- //如果floors不为空,需要根据对应楼层id修改楼层名称
|
|
|
|
- if(StrUtil.isNotEmpty(floors)) {
|
|
|
|
-
|
|
|
|
- if (!StorageType.LOCAL.code().equals(this.type)) {// TODO: 2022/2/15 这里有可能有问题,可能还需要考虑本地部署的情况
|
|
|
|
- FileUtils.downLoadFromUrl(floorCadUrl, "floorplan_cad.json", localDataPath);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- String floorCadStr = FileUtils.readFile(localDataPath + "floorplan_cad.json");
|
|
|
|
- if (StrUtil.isNotEmpty(floorCadStr)) {
|
|
|
|
- JSONObject floorCadJson = this.updateFloorName(floors, floorCadStr);
|
|
|
|
- FileUtils.writeFile(localDataPath + "floorplan_cad.json", floorCadJson.toString());
|
|
|
|
- uploadToOssUtil.upload(localDataPath + "floorplan_cad.json",editDataPath + "floorplan_cad.json");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//写入数据库
|
|
//写入数据库
|
|
Byte floorPlanUser = null;
|
|
Byte floorPlanUser = null;
|
|
if(StrUtil.isNotEmpty(floorJsonData)){
|
|
if(StrUtil.isNotEmpty(floorJsonData)){
|
|
floorPlanUser = CommonStatus.YES.code();
|
|
floorPlanUser = CommonStatus.YES.code();
|
|
}
|
|
}
|
|
-// if(CommonStatus.YES.code().equals(reSet)){
|
|
|
|
-// floorPlanUser = CommonStatus.NO.code();
|
|
|
|
-// }
|
|
|
|
SceneEditInfo sceneEditInfoDb = this.getByScenePlusId(scenePlus.getId());
|
|
SceneEditInfo sceneEditInfoDb = this.getByScenePlusId(scenePlus.getId());
|
|
if(Objects.nonNull(sceneEditInfoDb)){
|
|
if(Objects.nonNull(sceneEditInfoDb)){
|
|
LambdaUpdateWrapper<SceneEditInfo> updateWrapper = new LambdaUpdateWrapper<SceneEditInfo>()
|
|
LambdaUpdateWrapper<SceneEditInfo> updateWrapper = new LambdaUpdateWrapper<SceneEditInfo>()
|
|
.setSql("version=version+" + 1)
|
|
.setSql("version=version+" + 1)
|
|
.eq(SceneEditInfo::getId, sceneEditInfoDb.getId());
|
|
.eq(SceneEditInfo::getId, sceneEditInfoDb.getId());
|
|
-// if(StrUtil.isNotEmpty(filePathStr)){
|
|
|
|
-// updateWrapper.set(SceneEditInfo::getFloorPlanPath, filePathStr);
|
|
|
|
-// }
|
|
|
|
-// if(StrUtil.isNotEmpty(cadInfo)){
|
|
|
|
-// updateWrapper.set(SceneEditInfo::getCadInfo, cadInfo);
|
|
|
|
-// }
|
|
|
|
if(floorPlanUser != null){
|
|
if(floorPlanUser != null){
|
|
updateWrapper.set(SceneEditInfo::getFloorPlanUser, floorPlanUser);
|
|
updateWrapper.set(SceneEditInfo::getFloorPlanUser, floorPlanUser);
|
|
}
|
|
}
|
|
@@ -636,8 +585,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
}else{
|
|
}else{
|
|
sceneEditInfoDb = new SceneEditInfo();
|
|
sceneEditInfoDb = new SceneEditInfo();
|
|
sceneEditInfoDb.setScenePlusId(scenePlus.getId());
|
|
sceneEditInfoDb.setScenePlusId(scenePlus.getId());
|
|
-// sceneEditInfoDb.setFloorPlanPath(filePathStr);
|
|
|
|
-// sceneEditInfoDb.setCadInfo(cadInfo);
|
|
|
|
sceneEditInfoDb.setFloorPlanUser(floorPlanUser);
|
|
sceneEditInfoDb.setFloorPlanUser(floorPlanUser);
|
|
this.save(sceneEditInfoDb);
|
|
this.save(sceneEditInfoDb);
|
|
}
|
|
}
|
|
@@ -1413,9 +1360,12 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResultData checkKey(SceneCheckKeyParamVO param) throws Exception {
|
|
public ResultData checkKey(SceneCheckKeyParamVO param) throws Exception {
|
|
-
|
|
|
|
|
|
+ SceneJsonBean sceneJsonBean = null;
|
|
String sceneJson = redisUtil.get(String.format(RedisKey.SCENE_JSON, param.getNum()));
|
|
String sceneJson = redisUtil.get(String.format(RedisKey.SCENE_JSON, param.getNum()));
|
|
- SceneJsonBean sceneJsonBean = JSON.parseObject(sceneJson, SceneJsonBean.class);
|
|
|
|
|
|
+ if(StrUtil.isEmpty(sceneJson)){
|
|
|
|
+ sceneJson = uploadToOssUtil.getObjectContent(bucket, String.format(UploadFilePath.DATA_VIEW_PATH + "scene.json"));
|
|
|
|
+ }
|
|
|
|
+ sceneJsonBean = JSON.parseObject(sceneJson, SceneJsonBean.class);
|
|
|
|
|
|
if(!param.getPassword().equals(sceneJsonBean.getScenePassword())){
|
|
if(!param.getPassword().equals(sceneJsonBean.getScenePassword())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5021);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5021);
|
|
@@ -1549,7 +1499,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
private void transferToFlv(String num, String fileName) throws Exception {
|
|
private void transferToFlv(String num, String fileName) throws Exception {
|
|
|
|
|
|
String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
- String localImagesPath = String.format(ConstantFilePath.IMAGESBUFFER_FORMAT, num);
|
|
|
|
|
|
+ String localImagesPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num);
|
|
String localFilePath = localImagesPath + fileName;
|
|
String localFilePath = localImagesPath + fileName;
|
|
|
|
|
|
File targetFile = new File(localImagesPath);
|
|
File targetFile = new File(localImagesPath);
|