From b8cc591541b88dd2bb93f111f8e8075842dce7ca Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期二, 13 八月 2024 17:21:06 +0800 Subject: [PATCH] 1. 新增设备信息相关功能 2. 修正自评估中数据自动评分的部分逻辑 --- src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt | 40 ++++++++++++++++++++++++++-------------- 1 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt index 7ee606f..6080ea0 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt @@ -1,6 +1,7 @@ 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 @@ -16,33 +17,44 @@ @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) } } \ No newline at end of file -- Gitblit v1.9.3