|
@@ -20,6 +20,11 @@ import com.fdkankan.common.util.FileUtil;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.fyun.constant.StorageType;
|
|
|
import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
|
+import com.fdkankan.platform.api.feign.PlatformGoodsClient;
|
|
|
+import com.fdkankan.platform.api.feign.PlatformUserClient;
|
|
|
+import com.fdkankan.platform.api.vo.Camera;
|
|
|
+import com.fdkankan.platform.api.vo.CameraDetail;
|
|
|
+import com.fdkankan.platform.api.vo.Company;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.constant.RedisLockKey;
|
|
|
import com.fdkankan.redis.util.RedisLockUtil;
|
|
@@ -96,6 +101,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
private RedisLockUtil redisLockUtil;
|
|
|
@Autowired
|
|
|
ISceneDataDownloadService sceneDataDownloadService;
|
|
|
+ @Autowired
|
|
|
+ PlatformGoodsClient platformGoodsClient;
|
|
|
+ @Autowired
|
|
|
+ PlatformUserClient platformUserClient;
|
|
|
|
|
|
|
|
|
@Transactional
|
|
@@ -289,7 +298,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public SceneInfoVO getSceneInfo(@Var SceneInfoParamVO param) {
|
|
|
+ public SceneInfoVO getSceneInfo(@Var SceneInfoParamVO param) throws Exception{
|
|
|
SceneInfoReqType sceneInfoReqType = SceneInfoReqType.get(param.getReqType());
|
|
|
switch (sceneInfoReqType){
|
|
|
//如果是编辑页面请求,查数据库
|
|
@@ -311,7 +320,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
* @param num
|
|
|
* @return com.fdkankan.scene.vo.SceneInfoVO
|
|
|
**/
|
|
|
- private SceneInfoVO getSceneInfo4Edit(String num){
|
|
|
+ private SceneInfoVO getSceneInfo4Edit(String num) throws Exception{
|
|
|
ScenePro scenePro = sceneProService.findBySceneNum(num);
|
|
|
if(Objects.isNull(scenePro)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
@@ -333,11 +342,44 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
sceneInfoVO.setSceneFrom(sceneProExt.getSceneFrom());
|
|
|
sceneInfoVO.setVideos(scenePro.getVideos());
|
|
|
|
|
|
+ this.setExtData(sceneInfoVO, scenePro.getCameraId());
|
|
|
+
|
|
|
return sceneInfoVO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
+ getInfo接口返回字段扩展
|
|
|
+ * </p>
|
|
|
+ * @author dengsixing
|
|
|
+ * @date 2022/3/9
|
|
|
+ **/
|
|
|
+ private void setExtData(SceneInfoVO sceneInfoVO, Long cameraId) throws Exception{
|
|
|
+
|
|
|
+ ResultData<CameraDetail> cameraResultData = platformGoodsClient.getCameraDetailByCameraId(cameraId);
|
|
|
+ if(!cameraResultData.getSuccess()){
|
|
|
+ throw new Exception(ServerCode.FEIGN_REQUEST_FAILD.message());
|
|
|
+ }
|
|
|
+ CameraDetail camera = cameraResultData.getData();
|
|
|
+ if(Objects.isNull(camera)){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_7010);
|
|
|
+ }
|
|
|
+ if(Objects.isNull(camera.getCompanyId())){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ResultData<Company> companyResultData = platformUserClient.getCompanyById(camera.getCompanyId());
|
|
|
+ if(!companyResultData.getSuccess()){
|
|
|
+ throw new Exception(ServerCode.FEIGN_REQUEST_FAILD.message());
|
|
|
+ }
|
|
|
+ Company company = companyResultData.getData();
|
|
|
+ if(Objects.isNull(company)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ sceneInfoVO.setDataSync(company.getDataSync());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * <p>
|
|
|
查看页面获取场景详情信息
|
|
|
* </p>
|
|
|
* @author dengsixing
|
|
@@ -345,7 +387,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
* @param num
|
|
|
* @return com.fdkankan.scene.vo.SceneInfoVO
|
|
|
**/
|
|
|
- private SceneInfoVO getSceneInfo4View(String num){
|
|
|
+ private SceneInfoVO getSceneInfo4View(String num) throws Exception{
|
|
|
+
|
|
|
+ ScenePro scenePro = sceneProService.findBySceneNum(num);
|
|
|
+
|
|
|
String sceneJson = redisUtil.get(String.format(RedisKey.SCENE_JSON, num));
|
|
|
SceneInfoVO sceneInfoVO = null;
|
|
|
//先查询redis
|
|
@@ -361,6 +406,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
return null;
|
|
|
sceneInfoVO = JSON.parseObject(objectContent, SceneInfoVO.class);
|
|
|
|
|
|
+ this.setExtData(sceneInfoVO, scenePro.getCameraId());
|
|
|
+
|
|
|
return sceneInfoVO;
|
|
|
}
|
|
|
|