|
@@ -1,12 +1,8 @@
|
|
|
package com.fdkankan.scene.service.impl;
|
|
package com.fdkankan.scene.service.impl;
|
|
|
-import cn.hutool.core.net.multipart.UploadFile;
|
|
|
|
|
import cn.hutool.core.util.CharsetUtil;
|
|
import cn.hutool.core.util.CharsetUtil;
|
|
|
import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.constant.*;
|
|
|
import com.fdkankan.common.util.FileSizeUtil;
|
|
import com.fdkankan.common.util.FileSizeUtil;
|
|
|
-import com.fdkankan.common.util.MD5;
|
|
|
|
|
import com.fdkankan.scene.vo.SaveFiltersParamVO;
|
|
import com.fdkankan.scene.vo.SaveFiltersParamVO;
|
|
|
-import io.opencensus.metrics.LongGauge;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
@@ -23,7 +19,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.util.FileMd5Util;
|
|
import com.fdkankan.common.util.FileMd5Util;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
-import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
@@ -71,7 +66,7 @@ import com.fdkankan.scene.vo.BaseFileParamVO;
|
|
|
import com.fdkankan.scene.vo.BaseSceneParamVO;
|
|
import com.fdkankan.scene.vo.BaseSceneParamVO;
|
|
|
import com.fdkankan.scene.vo.DeleteFileParamVO;
|
|
import com.fdkankan.scene.vo.DeleteFileParamVO;
|
|
|
import com.fdkankan.scene.vo.DeleteLinkPanParamVO;
|
|
import com.fdkankan.scene.vo.DeleteLinkPanParamVO;
|
|
|
-import com.fdkankan.scene.vo.DeleteLinkSceneStylesParamVO;
|
|
|
|
|
|
|
+import com.fdkankan.scene.vo.DeleteStylesParamVO;
|
|
|
import com.fdkankan.scene.vo.DeleteMosaicParamVO;
|
|
import com.fdkankan.scene.vo.DeleteMosaicParamVO;
|
|
|
import com.fdkankan.scene.vo.DeleteSidParamVO;
|
|
import com.fdkankan.scene.vo.DeleteSidParamVO;
|
|
|
import com.fdkankan.scene.vo.DownloadVO;
|
|
import com.fdkankan.scene.vo.DownloadVO;
|
|
@@ -195,6 +190,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
sceneEditInfo.setVersion(sceneEditInfoDb.getVersion() + 1);
|
|
sceneEditInfo.setVersion(sceneEditInfoDb.getVersion() + 1);
|
|
|
this.updateById(sceneEditInfo);
|
|
this.updateById(sceneEditInfo);
|
|
|
}
|
|
}
|
|
|
|
|
+ SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
|
|
+ if(Objects.nonNull(param.getSns())){
|
|
|
|
|
+ sceneEditInfoExt.setSnsInfo(JSON.toJSONString(param.getSns()));
|
|
|
|
|
+ }
|
|
|
|
|
+ sceneEditInfoExtService.updateById(sceneEditInfoExt);
|
|
|
|
|
|
|
|
if(Objects.nonNull(param.getControls())){
|
|
if(Objects.nonNull(param.getControls())){
|
|
|
SceneEditControls sceneEditControls = BeanUtil.copyProperties(param.getControls(), SceneEditControls.class);
|
|
SceneEditControls sceneEditControls = BeanUtil.copyProperties(param.getControls(), SceneEditControls.class);
|
|
@@ -286,8 +286,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
//发布马赛克列表
|
|
//发布马赛克列表
|
|
|
sceneJson.setMosaicList(this.getMosaicList(num));
|
|
sceneJson.setMosaicList(this.getMosaicList(num));
|
|
|
|
|
|
|
|
|
|
+ //发布分享配置
|
|
|
|
|
+ sceneJson.setSns(JSON.parseObject(sceneEditInfoExt.getSnsInfo()));
|
|
|
|
|
+
|
|
|
//处理热点数据,生成hot.json
|
|
//处理热点数据,生成hot.json
|
|
|
- this.publicHotData(num, sceneEditInfo, bucket);
|
|
|
|
|
|
|
+ this.publicHotData(num, bucket);
|
|
|
|
|
|
|
|
//发布场景关联相关数据
|
|
//发布场景关联相关数据
|
|
|
this.publicLinkSceneData(num, bucket);
|
|
this.publicLinkSceneData(num, bucket);
|
|
@@ -298,6 +301,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
//发布摄像头数据
|
|
//发布摄像头数据
|
|
|
this.publicSurveillance(num, sceneEditInfoExt.getSurveillances(), bucket);
|
|
this.publicSurveillance(num, sceneEditInfoExt.getSurveillances(), bucket);
|
|
|
|
|
|
|
|
|
|
+ //发布指示牌数据
|
|
|
|
|
+ this.publicBillboardData(num, bucket);
|
|
|
|
|
+
|
|
|
//本地写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";
|
|
|
FileUtils.writeFile(localSceneJsonPath, JSON.toJSONString(sceneJson));
|
|
FileUtils.writeFile(localSceneJsonPath, JSON.toJSONString(sceneJson));
|
|
@@ -305,10 +311,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", num);
|
|
String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", num);
|
|
|
fYunFileService.uploadFile(bucket, JSON.toJSONBytes(sceneJson), sceneJsonPath);
|
|
fYunFileService.uploadFile(bucket, JSON.toJSONBytes(sceneJson), sceneJsonPath);
|
|
|
|
|
|
|
|
- //sceneJson放入缓存
|
|
|
|
|
- String key = String.format(RedisKey.SCENE_JSON, num);
|
|
|
|
|
- redisUtil.set(key, JSON.toJSONString(sceneJson));
|
|
|
|
|
-
|
|
|
|
|
//删除发布数据中的user目录
|
|
//删除发布数据中的user目录
|
|
|
String publicUserPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
|
|
String publicUserPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
|
|
|
List<String> userViewFileList = fYunFileService.listRemoteFiles(bucket, publicUserPath);
|
|
List<String> userViewFileList = fYunFileService.listRemoteFiles(bucket, publicUserPath);
|
|
@@ -321,6 +323,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String viewPath = String.format(UploadFilePath.USER_VIEW_PATH, param.getNum());
|
|
String viewPath = String.format(UploadFilePath.USER_VIEW_PATH, param.getNum());
|
|
|
fYunFileService.copyFileBetweenBucket(bucket, editPath, bucket, viewPath);
|
|
fYunFileService.copyFileBetweenBucket(bucket, editPath, bucket, viewPath);
|
|
|
|
|
|
|
|
|
|
+ //sceneJson放入缓存
|
|
|
|
|
+ String key = String.format(RedisKey.SCENE_JSON, num);
|
|
|
|
|
+ redisUtil.set(key, JSON.toJSONString(sceneJson));
|
|
|
|
|
+
|
|
|
//入库
|
|
//入库
|
|
|
if(sceneEditInfo.getId() == null){
|
|
if(sceneEditInfo.getId() == null){
|
|
|
this.save(sceneEditInfo);
|
|
this.save(sceneEditInfo);
|
|
@@ -398,7 +404,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void publicHotData(String sceneNum, SceneEditInfo sceneEditInfo, String bucket) throws IOException {
|
|
|
|
|
|
|
+ private void publicHotData(String sceneNum, String bucket) throws IOException {
|
|
|
String hotDataKey = String.format(RedisKey.SCENE_HOT_DATA, sceneNum);
|
|
String hotDataKey = String.format(RedisKey.SCENE_HOT_DATA, sceneNum);
|
|
|
Map<String, String> hotMap = redisUtil.hmget(hotDataKey);
|
|
Map<String, String> hotMap = redisUtil.hmget(hotDataKey);
|
|
|
|
|
|
|
@@ -425,6 +431,18 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void publicBillboardData(String sceneNum, String bucket) throws IOException {
|
|
|
|
|
+ String Key = String.format(RedisKey.SCENE_BILLBOARDS, sceneNum);
|
|
|
|
|
+ String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, sceneNum) + "billboards.json";
|
|
|
|
|
+ List<String> list = redisUtil.hgetValues(Key);
|
|
|
|
|
+ if(CollUtil.isEmpty(list)){
|
|
|
|
|
+ fYunFileService.deleteFile(bucket, userEditPath);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<JSONObject> collect = list.stream().map(str -> JSON.parseObject(str)).collect(Collectors.toList());
|
|
|
|
|
+ fYunFileService.uploadFile(bucket, JSON.toJSONString(collect).getBytes(), userEditPath);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public SceneInfoVO getSceneInfo(@Var SceneInfoParamVO param) throws Exception{
|
|
public SceneInfoVO getSceneInfo(@Var SceneInfoParamVO param) throws Exception{
|
|
|
SceneInfoReqType sceneInfoReqType = SceneInfoReqType.get(param.getReqType());
|
|
SceneInfoReqType sceneInfoReqType = SceneInfoReqType.get(param.getReqType());
|
|
@@ -474,7 +492,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
}
|
|
|
sceneInfoVO.setControls(BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class));
|
|
sceneInfoVO.setControls(BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class));
|
|
|
sceneInfoVO.setNum(num);
|
|
sceneInfoVO.setNum(num);
|
|
|
- sceneInfoVO.setCreateTime(scenePlus.getCreateTime());
|
|
|
|
|
|
|
+ sceneInfoVO.setCreateTime(scenePlusExt.getAlgorithmTime());
|
|
|
|
|
|
|
|
sceneInfoVO.setSceneResolution(scenePlusExt.getSceneResolution());
|
|
sceneInfoVO.setSceneResolution(scenePlusExt.getSceneResolution());
|
|
|
sceneInfoVO.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
sceneInfoVO.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
@@ -485,6 +503,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
sceneInfoVO.setMosaicList(this.getMosaicList(num));
|
|
sceneInfoVO.setMosaicList(this.getMosaicList(num));
|
|
|
}
|
|
}
|
|
|
sceneInfoVO.setSpace(FileSizeUtil.convert(scenePlusExt.getSpace(), FileSizeUnitType.MB.code()));
|
|
sceneInfoVO.setSpace(FileSizeUtil.convert(scenePlusExt.getSpace(), FileSizeUnitType.MB.code()));
|
|
|
|
|
+ sceneInfoVO.setSns(JSON.parseObject(sceneEditInfoExt.getSnsInfo()));
|
|
|
|
|
|
|
|
this.SortBoxVideos(sceneInfoVO);
|
|
this.SortBoxVideos(sceneInfoVO);
|
|
|
|
|
|
|
@@ -493,6 +512,12 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
return sceneInfoVO;
|
|
return sceneInfoVO;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
|
+ String test = "";
|
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(test);
|
|
|
|
|
+ System.out.println(jsonObject);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void SortBoxVideos(SceneInfoVO sceneInfoVO){
|
|
private void SortBoxVideos(SceneInfoVO sceneInfoVO){
|
|
|
String boxVideos = sceneInfoVO.getBoxVideos();
|
|
String boxVideos = sceneInfoVO.getBoxVideos();
|
|
|
if(StrUtil.isEmpty(boxVideos)){
|
|
if(StrUtil.isEmpty(boxVideos)){
|
|
@@ -571,33 +596,29 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String sceneJson = redisUtil.get(key);
|
|
String sceneJson = redisUtil.get(key);
|
|
|
SceneInfoVO sceneInfoVO = null;
|
|
SceneInfoVO sceneInfoVO = null;
|
|
|
//先查询redis
|
|
//先查询redis
|
|
|
- if(StrUtil.isNotEmpty(sceneJson)) {
|
|
|
|
|
- sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoVO.class);
|
|
|
|
|
- sceneInfoVO.setScenePassword(null);
|
|
|
|
|
- if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
|
|
|
- sceneInfoVO.setFloorPlanAngle(0f);
|
|
|
|
|
- }
|
|
|
|
|
- if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
|
|
|
|
|
- sceneInfoVO.setFloorPlanCompass(0f);
|
|
|
|
|
- }
|
|
|
|
|
- return sceneInfoVO;
|
|
|
|
|
|
|
+ if(StrUtil.isEmpty(sceneJson)) {
|
|
|
|
|
+ String objectName = String.format(ConstantFilePath.SCENE_VIEW_DATA_DATA_SCENEJSON, num);
|
|
|
|
|
+ sceneJson = fYunFileService.getFileContent(scenePlusExt.getYunFileBucket(), objectName);
|
|
|
|
|
+ redisUtil.set(key, sceneJson);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //如果redis没找到,从scene.json中获取
|
|
|
|
|
- String objectName = String.format(ConstantFilePath.SCENE_VIEW_DATA_DATA_SCENEJSON, num);
|
|
|
|
|
- String objectContent = fYunFileService.getFileContent(scenePlusExt.getYunFileBucket(), objectName);
|
|
|
|
|
- log.info("获取scene.json内容,path:{}, content:{}", objectName, objectContent);
|
|
|
|
|
- if(StrUtil.isEmpty(objectContent))
|
|
|
|
|
- return null;
|
|
|
|
|
- sceneInfoVO = JSON.parseObject(objectContent, SceneInfoVO.class);
|
|
|
|
|
|
|
+ sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoVO.class);
|
|
|
|
|
+ sceneInfoVO.setScenePassword(null);
|
|
|
if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
|
sceneInfoVO.setFloorPlanAngle(0f);
|
|
sceneInfoVO.setFloorPlanAngle(0f);
|
|
|
}
|
|
}
|
|
|
if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
|
|
if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
|
|
|
sceneInfoVO.setFloorPlanCompass(0f);
|
|
sceneInfoVO.setFloorPlanCompass(0f);
|
|
|
}
|
|
}
|
|
|
- redisUtil.set(key, JSON.toJSONString(sceneInfoVO));
|
|
|
|
|
- sceneInfoVO.setScenePassword(null);
|
|
|
|
|
|
|
+ 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;
|
|
return sceneInfoVO;
|
|
|
}
|
|
}
|
|
@@ -686,10 +707,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String bucket = scenePlusExt.getYunFileBucket();
|
|
String bucket = scenePlusExt.getYunFileBucket();
|
|
|
String path = scenePlusExt.getDataSource();
|
|
String path = scenePlusExt.getDataSource();
|
|
|
|
|
|
|
|
- //户型图上传
|
|
|
|
|
- String ossResultPath = String.format(UploadFilePath.scene_result_data_path, num);
|
|
|
|
|
- String floorplanCadPath = ossResultPath + "floorplan_cad/";
|
|
|
|
|
- fYunFileService.copyFileBetweenBucket(bucket, floorplanCadPath, bucket, String.format(UploadFilePath.USER_EDIT_PATH, num));
|
|
|
|
|
|
|
+ //户型图上传 恢复默认并发布同时点击刷新查看页面,平面图会变形,所以这里先注释掉 bug-36281 2023-05-04
|
|
|
|
|
+// String ossResultPath = String.format(UploadFilePath.scene_result_data_path, num);
|
|
|
|
|
+// String floorplanCadPath = ossResultPath + "floorplan_cad/";
|
|
|
|
|
+// fYunFileService.copyFileBetweenBucket(bucket, floorplanCadPath, bucket, String.format(UploadFilePath.USER_EDIT_PATH, num));
|
|
|
|
|
|
|
|
// String userEditPath = UploadFilePath.USER_EDIT_PATH + "floor-cad-%s.%s";
|
|
// String userEditPath = UploadFilePath.USER_EDIT_PATH + "floor-cad-%s.%s";
|
|
|
// String floorCadPath = path + "/results/floorplan_cad";
|
|
// String floorCadPath = path + "/results/floorplan_cad";
|
|
@@ -855,16 +876,16 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
String bucket = scenePlusExt.getYunFileBucket();
|
|
String bucket = scenePlusExt.getYunFileBucket();
|
|
|
|
|
|
|
|
- String key = String.format(UploadFilePath.DATA_VIEW_PATH, param.getNum()) + "floorplan_cad.json";
|
|
|
|
|
- String floorplanCadJson = fYunFileService.getFileContent(bucket, key);
|
|
|
|
|
- if(StrUtil.isEmpty(floorplanCadJson)){
|
|
|
|
|
|
|
+ String key = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "floorplan.json";
|
|
|
|
|
+ String floorplanJson = fYunFileService.getFileContent(bucket, key);
|
|
|
|
|
+ if(StrUtil.isEmpty(floorplanJson)){
|
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
|
}
|
|
}
|
|
|
Map<Integer, String> renameMap = new HashMap<>();
|
|
Map<Integer, String> renameMap = new HashMap<>();
|
|
|
param.getFloors().stream().forEach(floor->{
|
|
param.getFloors().stream().forEach(floor->{
|
|
|
renameMap.put(floor.getSubgroup(), floor.getName());
|
|
renameMap.put(floor.getSubgroup(), floor.getName());
|
|
|
});
|
|
});
|
|
|
- JSONObject jsonObject = JSON.parseObject(floorplanCadJson);
|
|
|
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(floorplanJson);
|
|
|
if(Objects.isNull(jsonObject)){
|
|
if(Objects.isNull(jsonObject)){
|
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
|
}
|
|
}
|
|
@@ -2079,7 +2100,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public ResultData deleteStyles(DeleteLinkSceneStylesParamVO param) throws Exception {
|
|
|
|
|
|
|
+ public ResultData deleteStyles(DeleteStylesParamVO param) throws Exception {
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
if (scenePlus == null)
|
|
if (scenePlus == null)
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|