|
@@ -1,20 +1,28 @@
|
|
package com.fdkankan.scene.feign;
|
|
package com.fdkankan.scene.feign;
|
|
|
|
|
|
|
|
+import com.aliyuncs.utils.StringUtils;
|
|
import com.fdkankan.common.response.ResultData;
|
|
import com.fdkankan.common.response.ResultData;
|
|
import com.fdkankan.scene.api.dto.SceneCntDTO;
|
|
import com.fdkankan.scene.api.dto.SceneCntDTO;
|
|
import com.fdkankan.scene.api.dto.SceneInfoDTO;
|
|
import com.fdkankan.scene.api.dto.SceneInfoDTO;
|
|
import com.fdkankan.scene.api.dto.ScenePODTO;
|
|
import com.fdkankan.scene.api.dto.ScenePODTO;
|
|
import com.fdkankan.scene.api.dto.SceneProDTO;
|
|
import com.fdkankan.scene.api.dto.SceneProDTO;
|
|
|
|
+import com.fdkankan.scene.entity.SceneCooperation;
|
|
import com.fdkankan.scene.entity.ScenePO;
|
|
import com.fdkankan.scene.entity.ScenePO;
|
|
|
|
+import com.fdkankan.scene.entity.SceneProPO;
|
|
import com.fdkankan.scene.service.*;
|
|
import com.fdkankan.scene.service.*;
|
|
import com.fdkankan.scene.vo.SceneInfoParamVO;
|
|
import com.fdkankan.scene.vo.SceneInfoParamVO;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 提供计算调用
|
|
* 提供计算调用
|
|
@@ -34,6 +42,14 @@ public class UserSceenFeign {
|
|
ISceneService sceneService;
|
|
ISceneService sceneService;
|
|
@Autowired
|
|
@Autowired
|
|
ISceneProService sceneProService;
|
|
ISceneProService sceneProService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ISceneResourceCameraService sceneResourceCameraService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ISceneResourceCooperationService sceneResourceCooperationService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ISceneCooperationService sceneCooperationService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IFdkkLaserService fdkkLaserService;
|
|
|
|
|
|
@PostMapping("/getSceneCnt")
|
|
@PostMapping("/getSceneCnt")
|
|
ResultData<SceneCntDTO> getSceneCnt(@RequestParam(value = "userId") Long userId, Long cameraId){
|
|
ResultData<SceneCntDTO> getSceneCnt(@RequestParam(value = "userId") Long userId, Long cameraId){
|
|
@@ -111,8 +127,63 @@ public class UserSceenFeign {
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/getSceneCount")
|
|
@PostMapping("/getSceneCount")
|
|
- ResultData getSceneCount(@RequestParam(value = "cameraId")Long cameraId) throws Exception{
|
|
|
|
- return ResultData.ok(sceneProService.getSceneCount(cameraId));
|
|
|
|
|
|
+ ResultData getSceneCount(@RequestParam(value = "cameraId")Long cameraId,
|
|
|
|
+ @RequestParam(value = "userId")Long userId ,
|
|
|
|
+ @RequestParam(value = "cameraType")Integer cameraType ) throws Exception{
|
|
|
|
+ if(cameraId!=null){
|
|
|
|
+ return ResultData.ok(sceneProService.getSceneCount(cameraId,null));
|
|
|
|
+ }
|
|
|
|
+ if(cameraType == null || cameraType != 4){
|
|
|
|
+ return ResultData.ok(sceneService.getSceneCount(null,userId));
|
|
|
|
+ }
|
|
|
|
+ return ResultData.ok(sceneProService.getSceneCount(null,userId));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @PostMapping("/disableCooperation")
|
|
|
|
+ ResultData disableCooperation(@RequestParam(value = "cameraId")Long cameraId,
|
|
|
|
+ @RequestParam(value = "snCode")String snCode,
|
|
|
|
+ @RequestParam(value = "cooperationUserName")String cooperationUserName){
|
|
|
|
+
|
|
|
|
+ sceneResourceCameraService.deleteByCameraId(cameraId);
|
|
|
|
+ deleteCooperation(cameraId);
|
|
|
|
+ if(StringUtils.isEmpty(snCode)){
|
|
|
|
+ fdkkLaserService.disableCooperation(snCode,cooperationUserName);
|
|
|
|
+ }
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @PostMapping("/saveCooperation")
|
|
|
|
+ ResultData saveCooperation(@RequestParam(value = "cameraId") Long cameraId,
|
|
|
|
+ @RequestParam(value = "resourceIds") String resourceIds,
|
|
|
|
+ @RequestParam(value = "userId") Long userId,
|
|
|
|
+ @RequestParam(value = "snCode")String snCode,
|
|
|
|
+ @RequestParam(value = "cooperationUserName")String cooperationUserName){
|
|
|
|
+ sceneResourceCameraService.saveByResourceIds(cameraId,resourceIds);
|
|
|
|
+ List<SceneProPO> sceneProPOS = deleteCooperation(cameraId);
|
|
|
|
+ sceneCooperationService.saveByResourceIds(sceneProPOS,cameraId,resourceIds,userId);
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isEmpty(snCode)){
|
|
|
|
+ fdkkLaserService.disableCooperation(snCode,cooperationUserName);
|
|
|
|
+ fdkkLaserService.enableCameraCooperation(snCode,cooperationUserName);
|
|
|
|
+ }
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<SceneProPO> deleteCooperation(Long cameraId){
|
|
|
|
+ List<SceneProPO> sceneProList = sceneProService.findByCameraIdPro(cameraId);
|
|
|
|
+ if(!CollectionUtils.isEmpty(sceneProList)) {
|
|
|
|
+ List<String> numList = sceneProList.stream().map(SceneProPO::getNum).collect(Collectors.toList());
|
|
|
|
+ List<SceneCooperation> list = sceneCooperationService.getListByNums(numList);
|
|
|
|
+ List<Long> cooIds = list.parallelStream().map(SceneCooperation::getId).collect(Collectors.toList());
|
|
|
|
+ if(cooIds.size() >0){
|
|
|
|
+ //删除相机下每个场景的关联关系
|
|
|
|
+ sceneResourceCooperationService.deleteByCooperationIds(cooIds);
|
|
|
|
+ sceneCooperationService.updateRecStatusList(cooIds);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return sceneProList;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|