Esempio n. 1
0
  @Logon
  public Object listCameraStatusJson(HttpServletRequest request) {
    SimpleRequestReader reader = new SimpleRequestReader(request);
    Long userId = reader.getUserId();

    User user = userManager.getUser(userId);
    // 获取虚拟机构摄像头列表
    List<VirtualOrgan> listCamera = organManager.listUgAllCamera(user.getUserGroupId());
    // 获取当前在线摄像头列表
    Map<Long, OnlineReal> onlineMap = onlineManager.mapOnlineCamera();
    ListDeviceStatusDTO dto = new ListDeviceStatusDTO();
    List<ListDeviceStatusDTO.DeviceStatusVO> list =
        new ArrayList<ListDeviceStatusDTO.DeviceStatusVO>();
    for (VirtualOrgan camera : listCamera) {
      ListDeviceStatusDTO.DeviceStatusVO vo = dto.new DeviceStatusVO();
      vo.setId(camera.getId() + "");
      if (null == onlineMap.get(camera.getDeviceId())) {
        vo.setOnline(false);
      } else {
        vo.setOnline(true);
      }
      list.add(vo);
    }
    dto.setMethod(request.getHeader(Header.METHOD));
    dto.setListStatus(list);
    return dto;
  }
Esempio n. 2
0
  @Logon
  public Object listDeviceStatusJson(HttpServletRequest request) {
    SimpleRequestReader reader = new SimpleRequestReader(request);
    Long userId = reader.getUserId();

    User user = userManager.getUser(userId);
    // 根据用户组获取设备列表
    List<VirtualOrgan> devices = organManager.listUgDevice(user.getUserGroupId());
    // 获取当前在线设备列表
    Map<Long, OnlineReal> map = onlineManager.mapOnlineAllDevice();

    ListDeviceStatusDTO dto = new ListDeviceStatusDTO();
    List<ListDeviceStatusDTO.DeviceStatusVO> list =
        new ArrayList<ListDeviceStatusDTO.DeviceStatusVO>();
    for (VirtualOrgan device : devices) {
      ListDeviceStatusDTO.DeviceStatusVO vo = dto.new DeviceStatusVO();
      vo.setId(device.getId() + "");
      if (null == map.get(device.getDeviceId())) {
        vo.setOnline(false);
      } else {
        vo.setOnline(true);
      }
      list.add(vo);
    }
    dto.setMethod(request.getHeader(Header.METHOD));
    dto.setListStatus(list);
    return dto;
  }