| | |
| | | package com.ard.web.controller.sample; |
| | | |
| | | import com.ard.common.core.controller.BaseController; |
| | | import com.ard.common.core.page.TableDataInfo; |
| | | import com.ard.device.camera.domain.ArdCamera; |
| | | import com.ard.sample.common.error.CommonErrorEnum; |
| | | import com.ard.sample.common.model.PaginationData; |
| | | import com.ard.sample.common.model.ResponseResult; |
| | |
| | | import com.ard.sample.component.mqtt.model.CommonTopicResponse; |
| | | import com.ard.sample.manage.model.dto.DeviceDTO; |
| | | import com.ard.sample.manage.model.dto.DeviceFirmwareUpgradeDTO; |
| | | import com.ard.sample.manage.model.entity.DeviceEntity; |
| | | import com.ard.sample.manage.model.enums.DeviceFirmwareStatusEnum; |
| | | import com.ard.sample.manage.model.enums.DeviceSetPropertyEnum; |
| | | import com.ard.sample.manage.model.receiver.StatusGatewayReceiver; |
| | | import com.ard.sample.manage.service.IDeviceService; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.integration.annotation.ServiceActivator; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.ZoneId; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | import static com.ard.common.utils.PageUtils.startPage; |
| | | |
| | | /** |
| | | * @author sean.zhou |
| | |
| | | @RestController |
| | | @Slf4j |
| | | @RequestMapping("/dock/device") |
| | | public class DeviceController { |
| | | public class DeviceController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IDeviceService deviceService; |
| | |
| | | deviceService.devicePropertySet(dockSn, propertyEnumOpt.get(), param.get(property)); |
| | | 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); |
| | | } |
| | | |
| | | private DeviceEntity deviceDTO2Entity(DeviceDTO dto) { |
| | | DeviceEntity.DeviceEntityBuilder builder = DeviceEntity.builder(); |
| | | if (dto == null) { |
| | | return builder.build(); |
| | | } |
| | | |
| | | return builder.deviceSn(dto.getDeviceSn()) |
| | | .userId(dto.getUserId()) |
| | | .nickname(dto.getNickname()) |
| | | .boundStatus(dto.getBoundStatus()) |
| | | .loginTime(dto.getLoginTime() != null ? |
| | | dto.getLoginTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() : null) |
| | | .boundTime(dto.getBoundTime() != null ? |
| | | dto.getBoundTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() : null) |
| | | .childSn(dto.getChildDeviceSn()) |
| | | .domain(dto.getDomain()) |
| | | .firmwareVersion(dto.getFirmwareVersion()) |
| | | .workType(dto.getWorkType()) |
| | | .compatibleStatus(dto.getFirmwareStatus() == null ? null : |
| | | DeviceFirmwareStatusEnum.CONSISTENT_UPGRADE != DeviceFirmwareStatusEnum.find(dto.getFirmwareStatus())) |
| | | .build(); |
| | | } |
| | | } |