package cn.flightfeather.supervision.lightshare.web
|
|
import cn.flightfeather.supervision.domain.ds1.entity.DeviceInfo
|
import cn.flightfeather.supervision.lightshare.service.DeviceService
|
import io.swagger.annotations.Api
|
import io.swagger.annotations.ApiOperation
|
import io.swagger.annotations.ApiParam
|
import org.springframework.web.bind.annotation.*
|
import org.springframework.web.multipart.MultipartFile
|
|
@Api(tags = ["DeviceController"], description = "监管场景相关设备API接口")
|
@RestController
|
@RequestMapping("/device")
|
class DeviceController(private val deviceService: DeviceService) {
|
|
@ApiOperation("获取场景设备信息")
|
@GetMapping
|
fun fetchDevice(
|
@ApiParam("场景id") sceneId: String,
|
) = resPack { deviceService.findDevices(sceneId) }
|
|
@ApiOperation("新增场景设备信息")
|
@PutMapping("/upload")
|
fun uploadDevice(
|
@ApiParam("设备信息") deviceInfo: DeviceInfo,
|
) = resPack { deviceService.insertDevice(deviceInfo) }
|
|
@ApiOperation("更新场景设备信息")
|
@PostMapping("/update")
|
fun updateDevice(
|
@ApiParam("设备信息") deviceInfo: DeviceInfo,
|
) = resPack { deviceService.updateDevice(deviceInfo) }
|
|
@ApiOperation("新增场景设备位置变更信息")
|
@PutMapping("/location/upload")
|
fun uploadDeviceLocation(
|
@ApiParam("设备位置信息json") @RequestParam("location") location: String,
|
@ApiParam("设备图片") @RequestPart("images") images: Array<MultipartFile>,
|
) = resPack { deviceService.insertDeviceLocation(location, images) }
|
|
@ApiOperation("更新场景设备位置变更信息")
|
@PutMapping("/location/update")
|
fun updateDeviceLocation(
|
@ApiParam("设备位置信息json") @RequestParam("location") location: String,
|
@ApiParam("删除的设备图片路径") @RequestPart("deleteImg") deleteImg: List<String>,
|
@ApiParam("设备图片") @RequestPart("images") images: Array<MultipartFile>,
|
) = resPack { deviceService.updateDeviceLocation(location, deleteImg, images) }
|
}
|