|
@@ -57,6 +57,8 @@ public class AppSceneService {
|
|
|
IScenePlusMapper scenePlusMapper;
|
|
|
@Autowired
|
|
|
IUserRoleService userRoleService;
|
|
|
+ @Autowired
|
|
|
+ ITmColdStorageService tmColdStorageService;
|
|
|
|
|
|
@Value("${fyun.host}")
|
|
|
private String ossHost;
|
|
@@ -99,60 +101,39 @@ public class AppSceneService {
|
|
|
|
|
|
Page<AppSceneVo> page = scenePlusMapper.pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
|
|
|
|
|
|
- Set<Long> cameraIdSet = page.getRecords().stream().map(AppSceneVo::getCameraId).collect(Collectors.toSet());
|
|
|
- List<Long> cameraIds = new ArrayList<>(cameraIdSet);
|
|
|
- HashMap<Long, Camera> cameraHashMap = cameraService.getByIds(cameraIds);
|
|
|
- HashMap<Long, CameraDetail> detailHashMap = cameraDetailService.getByCameraIds(cameraIds);
|
|
|
+ List<String> numList = page.getRecords().stream().map(AppSceneVo::getNum).collect(Collectors.toList());
|
|
|
+ HashMap<String,Boolean> coldMap = tmColdStorageService.getByNumList(numList);
|
|
|
+
|
|
|
+// Set<Long> cameraIdSet = page.getRecords().stream().map(AppSceneVo::getCameraId).collect(Collectors.toSet());
|
|
|
+// List<Long> cameraIds = new ArrayList<>(cameraIdSet);
|
|
|
+// HashMap<Long, Camera> cameraHashMap = cameraService.getByIds(cameraIds);
|
|
|
+// HashMap<Long, CameraDetail> detailHashMap = cameraDetailService.getByCameraIds(cameraIds);
|
|
|
+ //账号密码登录 sceneSourceType 取值 1用户场景,2协作场景
|
|
|
+ //相机登录 sceneSourceType 取值皆为0
|
|
|
|
|
|
- /**
|
|
|
- * sceneSourceType 0 相机场景,1用户场景 2 协作场景
|
|
|
- */
|
|
|
for (AppSceneVo record : page.getRecords()) {
|
|
|
- record.setChildName(record.getSnCode());
|
|
|
+ if(coldMap.get(record.getNum()) != null ){
|
|
|
+ record.setColdStorage(coldMap.get(record.getNum()));
|
|
|
+ }
|
|
|
if (record.getStatus() == -1) {
|
|
|
record.setStatus(0);
|
|
|
} else if (record.getStatus() == 500) {
|
|
|
record.setStatus(-1);
|
|
|
}
|
|
|
- if(record.getCameraId() == null){
|
|
|
- record.setSceneSourceType(record.getUserId().longValue() == param.getUserId() ? 1 : 2);
|
|
|
- }else {
|
|
|
- record.setSceneSourceType(1);
|
|
|
- Camera camera = cameraHashMap.get(record.getCameraId());
|
|
|
- if(camera == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- CameraDetail cameraDetail = detailHashMap.get(camera.getId());
|
|
|
- if(cameraDetail == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- record.setChildName(camera.getChildName());
|
|
|
- record.setSnCode(camera.getSnCode());
|
|
|
- if(cooperationNumList.contains(record.getNum())){
|
|
|
- record.setSceneSourceType(2);
|
|
|
- continue ;
|
|
|
- }
|
|
|
- //相机的userId为空,表示相机的场景
|
|
|
- if (cameraDetail.getUserId() == null || param.getUserId() == null ) {
|
|
|
- record.setSceneSourceType(1);
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (cameraDetail.getUserId().equals(param.getUserId())) {
|
|
|
- //相机用户id等于该用户id,既为用户的场景
|
|
|
- record.setSceneSourceType(1);
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (param.getCameraId()!=null && cameraDetail.getCameraId().equals(param.getCameraId())) {
|
|
|
- if (cameraDetail.getCooperationUser() == null) {
|
|
|
- //场景相机id等于该相机id
|
|
|
- record.setSceneSourceType(1);
|
|
|
- } else if (cameraDetail.getCooperationUser().equals(param.getUserId())) {
|
|
|
- record.setSceneSourceType(2);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ //虚拟场景
|
|
|
+ if(record.getCameraId() == null && param.getUserId() != null){
|
|
|
+ record.setSceneSourceType(record.getUserId().equals(param.getUserId()) ? 1 :2);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //相机场景
|
|
|
+ if(param.getCameraId() !=null && record.getCameraId().equals(param.getCameraId())){
|
|
|
+ record.setSceneSourceType(0);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //用户场景
|
|
|
+ if(param.getUserId() != null && record.getUserId() != null){
|
|
|
+ record.setSceneSourceType(record.getUserId().equals(param.getUserId()) ? 1 :2);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
return PageInfo.PageInfo(page);
|
|
|
}
|