zhaowenyu
2026-02-04 9c3c085032bddf6bb5e8b730067292e7f1520328
ard-admin/src/main/java/com/ard/web/controller/sample/DeviceController.java
@@ -95,11 +95,25 @@
     * @return
     */
    @ApiOperation("设备列表")
    @PreAuthorize("@ss.hasPermi('device:dock:list')")
    @GetMapping("/list")
    public ResponseResult<List<DeviceDTO>> getDevices() {
        List<DeviceDTO> devicesList = deviceService.getDevicesTopoForWeb();
    public ResponseResult<List<DeviceDTO>> getDevices(@RequestParam(required = false) String nickname) {
//        List<DeviceDTO> devicesList = deviceService.getDevicesTopoForWeb();
        List<DeviceDTO> devicesList = deviceService.getDockList(nickname);
        return ResponseResult.success(devicesList);
    }
//    /**
//     * 获取按nickname筛选在线设备列表
//     *
//     * @return
//     */
//    @ApiOperation("设备列表-按nickname筛选")
//    @GetMapping("/cameralist")
//    public ResponseResult<List<DeviceDTO>> getCameraDevices(@RequestParam(required = false) String nickname) {
//        List<DeviceDTO> devicesList = deviceService.getDockCameraList(nickname);
//        return ResponseResult.success(devicesList);
//    }
    /**
     * 绑定设备
@@ -140,6 +154,7 @@
     */
    @ApiOperation("绑定设备列表")
    @GetMapping("/list/bound")
    @PreAuthorize("@ss.hasPermi('device:dock:list')")
    public ResponseResult<PaginationData<DeviceDTO>> getBoundDevicesWithDomain(Integer domain,
                                                                               @RequestParam(defaultValue = "1") Long page,
                                                                               @RequestParam(value = "page_size",
@@ -203,30 +218,34 @@
    public ResponseResult devicePropertySet(@PathVariable("device_sn") String dockSn,
                                            @RequestBody JsonNode param) {
        if (param.size() != 1) {
            return ResponseResult.error(CommonErrorEnum.ILLEGAL_ARGUMENT);
            //return ResponseResult.error(CommonErrorEnum.ILLEGAL_ARGUMENT);
            return ResponseResult.error(999,"参数不合法");
        }
        String property = param.fieldNames().next();
        Optional<DeviceSetPropertyEnum> propertyEnumOpt = DeviceSetPropertyEnum.find(property);
        if (propertyEnumOpt.isEmpty()) {
            return ResponseResult.error(CommonErrorEnum.ILLEGAL_ARGUMENT);
            //return ResponseResult.error(CommonErrorEnum.ILLEGAL_ARGUMENT);
            return ResponseResult.error(999,"参数无效");
        }
        deviceService.devicePropertySet(dockSn, propertyEnumOpt.get(), param.get(property));
        return ResponseResult.success();
        return deviceService.devicePropertySet(dockSn, propertyEnumOpt.get(), param);
//        return ResponseResult.success();
    }
    /**
     * 查询机场设备列表
     */
    @PreAuthorize("@ss.hasPermi('device:camera:list')")
    @GetMapping("/test/list")
    @ApiOperation("查询机场设备列表")
    public TableDataInfo list(DeviceDTO device) {
        startPage();
        DeviceEntity deviceEntity = deviceDTO2Entity(device);
        QueryWrapper<DeviceEntity> queryWrapper=new QueryWrapper<>(deviceEntity);
        List<DeviceEntity> list = deviceService.selectList(queryWrapper);
        return getDataTable(list);
    }
    //.get(property)
//    /**
//     * 查询机场设备列表
//     */
//    @PreAuthorize("@ss.hasPermi('device:camera:list')")
//    @GetMapping("/test/list")
//    @ApiOperation("查询机场设备列表")
//    public TableDataInfo list(DeviceDTO device) {
//        startPage();
//        DeviceEntity deviceEntity = deviceDTO2Entity(device);
//        QueryWrapper<DeviceEntity> queryWrapper=new QueryWrapper<>(deviceEntity);
//        List<DeviceEntity> list = deviceService.selectList(queryWrapper);
//        return getDataTable(list);
//    }
    private DeviceEntity deviceDTO2Entity(DeviceDTO dto) {
        DeviceEntity.DeviceEntityBuilder builder = DeviceEntity.builder();
@@ -246,6 +265,9 @@
                .domain(dto.getDomain())
                .firmwareVersion(dto.getFirmwareVersion())
                .workType(dto.getWorkType())
                .webrtcUrl(dto.getWebrtcUrl())
                .cameraWebrtcUrl(dto.getCameraWebrtcUrl())
                .cameraState(dto.getCameraState())
                .compatibleStatus(dto.getFirmwareStatus() == null ? null :
                        DeviceFirmwareStatusEnum.CONSISTENT_UPGRADE != DeviceFirmwareStatusEnum.find(dto.getFirmwareStatus()))
                .build();