|
@@ -3,9 +3,12 @@ package com.fdkankan.scene.service.impl;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.fdkankan.common.constant.CommonStatus;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
|
+import com.fdkankan.common.constant.SceneInfoReqType;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.scene.entity.Scene;
|
|
import com.fdkankan.scene.entity.Scene;
|
|
import com.fdkankan.scene.entity.SceneEditControls;
|
|
import com.fdkankan.scene.entity.SceneEditControls;
|
|
@@ -16,13 +19,14 @@ import com.fdkankan.scene.service.SceneEditControlsService;
|
|
import com.fdkankan.scene.service.SceneEditInfoExtService;
|
|
import com.fdkankan.scene.service.SceneEditInfoExtService;
|
|
import com.fdkankan.scene.service.SceneEditInfoService;
|
|
import com.fdkankan.scene.service.SceneEditInfoService;
|
|
import com.fdkankan.scene.service.SceneService;
|
|
import com.fdkankan.scene.service.SceneService;
|
|
-import com.fdkankan.scene.vo.SceneEditInfoParamVO;
|
|
|
|
-import com.fdkankan.scene.vo.SceneEditInfoVO;
|
|
|
|
|
|
+import com.fdkankan.scene.vo.*;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -109,6 +113,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
this.updateById(sceneEditInfo);
|
|
this.updateById(sceneEditInfo);
|
|
}
|
|
}
|
|
SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
|
+ if(Objects.isNull(sceneEditInfoExt)){
|
|
|
|
+ sceneEditInfoExt = new SceneEditInfoExt();
|
|
|
|
+ sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
|
|
|
|
+ sceneEditInfoExt.setScenePlusId(scenePlus.getId());
|
|
|
|
+ }
|
|
if(Objects.nonNull(param.getSns())){
|
|
if(Objects.nonNull(param.getSns())){
|
|
sceneEditInfoExt.setSnsInfo(JSON.toJSONString(param.getSns()));
|
|
sceneEditInfoExt.setSnsInfo(JSON.toJSONString(param.getSns()));
|
|
}
|
|
}
|
|
@@ -118,7 +127,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
// else{
|
|
// else{
|
|
// sceneEditInfoExt.setStarted("");
|
|
// sceneEditInfoExt.setStarted("");
|
|
// }
|
|
// }
|
|
- sceneEditInfoExtService.updateById(sceneEditInfoExt);
|
|
|
|
|
|
+ sceneEditInfoExtService.saveOrUpdate(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);
|
|
@@ -131,6 +140,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ scenePlus.setTitle(param.getTitle());
|
|
|
|
+ scenePlus.setDescription(param.getDescription());
|
|
|
|
+ sceneService.updateById(scenePlus);
|
|
|
|
+
|
|
SceneEditInfoVO result = BeanUtil.copyProperties(param, SceneEditInfoVO.class);
|
|
SceneEditInfoVO result = BeanUtil.copyProperties(param, SceneEditInfoVO.class);
|
|
result.setCreateTime(sceneEditInfo.getCreateTime());
|
|
result.setCreateTime(sceneEditInfo.getCreateTime());
|
|
|
|
|
|
@@ -394,78 +407,70 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
// fYunFileService.uploadFile(bucket, JSON.toJSONString(collect).getBytes(), userEditPath);
|
|
// fYunFileService.uploadFile(bucket, JSON.toJSONString(collect).getBytes(), userEditPath);
|
|
// }
|
|
// }
|
|
//
|
|
//
|
|
-// @Override
|
|
|
|
-// public SceneInfoVO getSceneInfo(@Var SceneInfoParamVO param) throws Exception{
|
|
|
|
-// SceneInfoReqType sceneInfoReqType = SceneInfoReqType.get(param.getReqType());
|
|
|
|
-// switch (sceneInfoReqType){
|
|
|
|
-// //如果是编辑页面请求,查数据库
|
|
|
|
-// case EDIT:
|
|
|
|
-// return this.getSceneInfo4Edit(param.getNum());
|
|
|
|
-// //如果是查看页面请求,查redis
|
|
|
|
-// case VIEW:
|
|
|
|
-// return this.getSceneInfo4View(param.getNum());
|
|
|
|
-// }
|
|
|
|
-// return null;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// /**
|
|
|
|
-// * <p>
|
|
|
|
-// 编辑页面获取场景详情信息
|
|
|
|
-// * </p>
|
|
|
|
-// * @author dengsixing
|
|
|
|
-// * @date 2022/1/21
|
|
|
|
-// * @param num
|
|
|
|
-// * @return com.fdkankan.scene.vo.SceneInfoVO
|
|
|
|
-// **/
|
|
|
|
-// private SceneInfoVO getSceneInfo4Edit(String num) throws Exception{
|
|
|
|
-//
|
|
|
|
-// ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
|
-// if(Objects.isNull(scenePlus)){
|
|
|
|
-// throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
-// }
|
|
|
|
-// ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
|
-//
|
|
|
|
-// SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
|
|
|
|
-// if(Objects.isNull(sceneEditInfo)){
|
|
|
|
-// throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
-// }
|
|
|
|
-// SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
|
-// SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
|
-// SceneInfoVO sceneInfoVO = new SceneInfoVO();
|
|
|
|
-// BeanUtil.copyProperties(sceneEditInfoExt, sceneInfoVO, "started");
|
|
|
|
-// BeanUtil.copyProperties(sceneEditInfo, sceneInfoVO);
|
|
|
|
-// sceneInfoVO.setFloorPlanUpload(JSON.parseArray(sceneEditInfo.getFloorPlanUpload()));
|
|
|
|
-// if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
|
|
-// sceneInfoVO.setFloorPlanAngle(0f);
|
|
|
|
-// }
|
|
|
|
-// if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
|
|
|
|
-// sceneInfoVO.setFloorPlanCompass(0f);
|
|
|
|
-// }
|
|
|
|
-// sceneInfoVO.setControls(BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class));
|
|
|
|
-// sceneInfoVO.setNum(num);
|
|
|
|
-// sceneInfoVO.setCreateTime(scenePlusExt.getAlgorithmTime());
|
|
|
|
-//
|
|
|
|
-// sceneInfoVO.setSceneResolution(scenePlusExt.getSceneResolution());
|
|
|
|
-// sceneInfoVO.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
|
|
-// sceneInfoVO.setSceneKind(scenePlusExt.getSceneKind());
|
|
|
|
-// sceneInfoVO.setModelKind(scenePlusExt.getModelKind());
|
|
|
|
-// sceneInfoVO.setVideos(scenePlusExt.getVideos());
|
|
|
|
-// if(CommonStatus.YES.code().intValue() == sceneEditInfoExt.getMosaic()){
|
|
|
|
-// sceneInfoVO.setMosaicList(this.getMosaicList(num));
|
|
|
|
-// }
|
|
|
|
-// sceneInfoVO.setSpace(FileSizeUtil.convert(scenePlusExt.getSpace(), FileSizeUnitType.MB.code()));
|
|
|
|
-// sceneInfoVO.setSns(JSON.parseObject(sceneEditInfoExt.getSnsInfo()));
|
|
|
|
-// sceneInfoVO.setStarted(JSON.parseObject(sceneEditInfoExt.getStarted()));
|
|
|
|
-//
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public SceneInfoVO getSceneInfo(SceneInfoParamVO param) throws Exception{
|
|
|
|
+ SceneInfoReqType sceneInfoReqType = SceneInfoReqType.get(param.getReqType());
|
|
|
|
+ switch (sceneInfoReqType){
|
|
|
|
+ //如果是编辑页面请求,查数据库
|
|
|
|
+ case EDIT:
|
|
|
|
+ return this.getSceneInfo4Edit(param.getNum());
|
|
|
|
+ //如果是查看页面请求,查redis
|
|
|
|
+ case VIEW:
|
|
|
|
+ return this.getSceneInfo4View(param.getNum());
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * <p>
|
|
|
|
+ 编辑页面获取场景详情信息
|
|
|
|
+ * </p>
|
|
|
|
+ * @author dengsixing
|
|
|
|
+ * @date 2022/1/21
|
|
|
|
+ * @param num
|
|
|
|
+ * @return com.fdkankan.scene.vo.SceneInfoVO
|
|
|
|
+ **/
|
|
|
|
+ private SceneInfoVO getSceneInfo4Edit(String num) throws Exception{
|
|
|
|
+
|
|
|
|
+ Scene scenePlus = sceneService.getByNum(num);
|
|
|
|
+ if(Objects.isNull(scenePlus)){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
|
|
|
|
+ if(Objects.isNull(sceneEditInfo)){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
+ }
|
|
|
|
+ SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
|
+ SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
|
+ SceneInfoVO sceneInfoVO = new SceneInfoVO();
|
|
|
|
+ BeanUtil.copyProperties(sceneEditInfoExt, sceneInfoVO, "started");
|
|
|
|
+ BeanUtil.copyProperties(sceneEditInfo, sceneInfoVO);
|
|
|
|
+ sceneInfoVO.setFloorPlanUpload(JSON.parseArray(sceneEditInfo.getFloorPlanUpload()));
|
|
|
|
+ if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
|
|
+ sceneInfoVO.setFloorPlanAngle(0f);
|
|
|
|
+ }
|
|
|
|
+ if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
|
|
|
|
+ sceneInfoVO.setFloorPlanCompass(0f);
|
|
|
|
+ }
|
|
|
|
+ sceneInfoVO.setControls(BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class));
|
|
|
|
+ sceneInfoVO.setNum(num);
|
|
|
|
+
|
|
|
|
+ sceneInfoVO.setSceneResolution(scenePlus.getSceneresolution());
|
|
|
|
+ sceneInfoVO.setSceneFrom(scenePlus.getScenefrom());
|
|
|
|
+ sceneInfoVO.setSceneKind(scenePlus.getScenekind());
|
|
|
|
+ sceneInfoVO.setModelKind(scenePlus.getModelkind());
|
|
|
|
+ if(CommonStatus.YES.code().intValue() == sceneEditInfoExt.getMosaic()){
|
|
|
|
+ sceneInfoVO.setMosaicList(this.getMosaicList(num));
|
|
|
|
+ }
|
|
|
|
+ sceneInfoVO.setSns(JSON.parseObject(sceneEditInfoExt.getSnsInfo()));
|
|
|
|
+ sceneInfoVO.setStarted(JSON.parseObject(sceneEditInfoExt.getStarted()));
|
|
|
|
+
|
|
// this.SortBoxVideos(sceneInfoVO);
|
|
// this.SortBoxVideos(sceneInfoVO);
|
|
-//
|
|
|
|
-// this.setExtData(sceneInfoVO, scenePlus.getCameraId());
|
|
|
|
-//
|
|
|
|
-// sceneInfoVO.setDynamicPanel(sceneDynamicPanelService.checkDynamicPanel(num));
|
|
|
|
-//
|
|
|
|
-// return sceneInfoVO;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
|
|
+
|
|
|
|
+ return sceneInfoVO;
|
|
|
|
+ }
|
|
|
|
+
|
|
// public static void main(String[] args) {
|
|
// public static void main(String[] args) {
|
|
// String test = "";
|
|
// String test = "";
|
|
//// JSONObject jsonObject = JSON.parseObject(test);
|
|
//// JSONObject jsonObject = JSON.parseObject(test);
|
|
@@ -2705,12 +2710,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
// return ResultData.ok();
|
|
// return ResultData.ok();
|
|
// }
|
|
// }
|
|
//
|
|
//
|
|
-// @Override
|
|
|
|
-// public List<JSONObject> getMosaicList(String num) throws Exception {
|
|
|
|
-//
|
|
|
|
-// //如果redis数据丢失,从本地文件中同步马赛克数据到redis
|
|
|
|
-// this.syncMosaicFromFileToRedis(num);
|
|
|
|
-//
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<JSONObject> getMosaicList(String num) throws Exception {
|
|
|
|
+
|
|
// String key = String.format(RedisKey.SCENE_MOSAIC_DATA, num);
|
|
// String key = String.format(RedisKey.SCENE_MOSAIC_DATA, num);
|
|
// Map<String, String> map = redisUtil.hmget(key);
|
|
// Map<String, String> map = redisUtil.hmget(key);
|
|
// if(CollUtil.isEmpty(map)){
|
|
// if(CollUtil.isEmpty(map)){
|
|
@@ -2719,9 +2721,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
// return map.values().stream()
|
|
// return map.values().stream()
|
|
// .map(mosaic-> JSON.parseObject(mosaic))
|
|
// .map(mosaic-> JSON.parseObject(mosaic))
|
|
// .collect(Collectors.toList());
|
|
// .collect(Collectors.toList());
|
|
-//
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
|
|
+ return null;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
// @Override
|
|
// @Override
|
|
// public ResultData addWaterMark(BaseFileParamVO param) throws Exception {
|
|
// public ResultData addWaterMark(BaseFileParamVO param) throws Exception {
|
|
// ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
// ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|