| | |
| | | package cn.flightfeather.supervision.lightshare.web |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.DeviceInfo |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.domain.ds1.entity.MonitorDeviceInfo |
| | | import cn.flightfeather.supervision.lightshare.service.DeviceService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | |
| | | @ApiOperation("获取场景设备信息") |
| | | @GetMapping |
| | | fun fetchDevice( |
| | | @ApiParam("场景id") sceneId: String, |
| | | ) = resPack { deviceService.findDevices(sceneId) } |
| | | @ApiParam("场景id") @RequestParam sceneId: String, |
| | | @ApiParam("设备类型id") @RequestParam deviceTypeId: Byte, |
| | | ) = resPack { deviceService.findDevices(sceneId, Constant.DeviceType.fromValue(deviceTypeId)) } |
| | | |
| | | @ApiOperation("新增场景设备信息") |
| | | @PutMapping("/upload") |
| | | fun uploadDevice( |
| | | @ApiParam("设备信息") deviceInfo: DeviceInfo, |
| | | ) = resPack { deviceService.insertDevice(deviceInfo) } |
| | | @ApiParam("设备信息") @RequestBody deviceInfo: String, |
| | | @ApiParam("设备类型id") @RequestParam deviceTypeId: Byte, |
| | | ) = resPack { deviceService.insertDevice(deviceInfo, Constant.DeviceType.fromValue(deviceTypeId)) } |
| | | |
| | | @ApiOperation("更新场景设备信息") |
| | | @PostMapping("/update") |
| | | fun updateDevice( |
| | | @ApiParam("设备信息") deviceInfo: DeviceInfo, |
| | | ) = resPack { deviceService.updateDevice(deviceInfo) } |
| | | @ApiParam("设备信息") @RequestBody deviceInfo: String, |
| | | @ApiParam("设备类型id") @RequestParam deviceTypeId: Byte, |
| | | ) = resPack { deviceService.updateDevice(deviceInfo, Constant.DeviceType.fromValue(deviceTypeId)) } |
| | | |
| | | @ApiOperation("获取场景设备位置变更信息") |
| | | @GetMapping("/status") |
| | | fun fetchDeviceLocation( |
| | | @ApiParam("场景id") @RequestParam(required = false) sceneId: String?, |
| | | @ApiParam("设备id") @RequestParam deviceId: Int, |
| | | @ApiParam("设备类型id") @RequestParam deviceTypeId: Byte, |
| | | ) = resPack { deviceService.findDeviceLocations(sceneId, deviceId, Constant.DeviceType.fromValue(deviceTypeId)) } |
| | | |
| | | @ApiOperation("新增场景设备位置变更信息") |
| | | @PutMapping("/location/upload") |
| | | @PutMapping("/status/upload") |
| | | fun uploadDeviceLocation( |
| | | @ApiParam("设备位置信息json") @RequestParam("location") location: String, |
| | | @ApiParam("设备位置信息json") @RequestParam("status") status: String, |
| | | @ApiParam("设备图片") @RequestPart("images") images: Array<MultipartFile>, |
| | | ) = resPack { deviceService.insertDeviceLocation(location, images) } |
| | | ) = resPack { deviceService.insertDeviceLocation(status, images) } |
| | | |
| | | @ApiOperation("更新场景设备位置变更信息") |
| | | @PutMapping("/location/update") |
| | | @PutMapping("/status/update") |
| | | fun updateDeviceLocation( |
| | | @ApiParam("设备位置信息json") @RequestParam("location") location: String, |
| | | @ApiParam("删除的设备图片路径") @RequestPart("deleteImg") deleteImg: List<String>, |
| | | @ApiParam("设备位置信息json") @RequestParam("status") status: String, |
| | | @ApiParam("删除的设备图片路径") @RequestParam("deleteImg") deleteImg: List<String>, |
| | | @ApiParam("设备图片") @RequestPart("images") images: Array<MultipartFile>, |
| | | ) = resPack { deviceService.updateDeviceLocation(location, deleteImg, images) } |
| | | ) = resPack { deviceService.updateDeviceLocation(status, deleteImg, images) } |
| | | } |