Browse Source

v4.3.0代码同步

dengsixing 2 years ago
parent
commit
7ae2c240f3

+ 17 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -61,6 +61,7 @@ import com.fdkankan.scene.service.IScenePlusExtService;
 import com.fdkankan.scene.service.IScenePlusService;
 import com.fdkankan.scene.service.ISceneProService;
 import com.fdkankan.scene.service.ISceneUploadService;
+import com.fdkankan.scene.service.ISurveillanceService;
 import com.fdkankan.scene.vo.BallScreenVideoParamVO;
 import com.fdkankan.scene.vo.BaseDataParamVO;
 import com.fdkankan.scene.vo.BaseFileParamVO;
@@ -81,6 +82,7 @@ import com.fdkankan.scene.vo.SceneEditInfoParamVO;
 import com.fdkankan.scene.vo.SceneEditInfoVO;
 import com.fdkankan.scene.vo.SceneInfoParamVO;
 import com.fdkankan.scene.vo.SceneInfoVO;
+import com.fdkankan.scene.vo.SurveillanceVO;
 import com.fdkankan.scene.vo.UploadPanoramaVO;
 import com.fdkankan.web.response.ResultData;
 import com.google.common.collect.Lists;
@@ -158,6 +160,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
     private ICameraDetailService cameraDetailService;
     @Autowired
     private ICompanyService companyService;
+    @Autowired
+    private ISurveillanceService surveillanceService;
 
     @Transactional
     @Override
@@ -283,6 +287,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //发布滤镜数据
         this.publicFilterData(num, sceneEditInfoExt.getFilters(), bucket);
 
+        //发布摄像头数据
+        this.publicSurveillance(num, sceneEditInfoExt.getSurveillances(), bucket);
+
         //本地写sceneJson文件
         String localSceneJsonPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + "scene.json";
         FileUtils.writeFile(localSceneJsonPath, JSON.toJSONString(sceneJson));
@@ -320,6 +327,16 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         return ResultData.ok();
     }
 
+    private void publicSurveillance(String num, Integer surveillances, String bucket) throws IOException {
+        String surveillanceJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "surveillance.json";
+        if(surveillances == CommonStatus.NO.code().intValue()){
+            fYunFileService.deleteFile(bucket, surveillanceJsonPath);
+            return;
+        }
+        List<SurveillanceVO> surveillanceList = surveillanceService.listSurveillance(num);
+        fYunFileService.uploadFile(bucket, JSON.toJSONString(surveillanceList).getBytes(StandardCharsets.UTF_8), surveillanceJsonPath);
+    }
+
     private void publicFilterData(String num, int filters, String bucket) throws IOException {
 
         String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);