From a3cc1d220f8a1de11874bebceba0130d32157ff1 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期二, 30 九月 2025 09:26:32 +0800 Subject: [PATCH] 2025.9.30 1. 联合前端调试数据产品接口(待完成) --- src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt | 43 ++++++++++++++++++++++++++++++------------- 1 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt index 1100ee4..464cb58 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt @@ -1,7 +1,10 @@ package cn.flightfeather.supervision.lightshare.web +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.domain.ds1.entity.Inspection import cn.flightfeather.supervision.lightshare.service.InspectionService +import cn.flightfeather.supervision.lightshare.vo.AreaVo +import cn.flightfeather.supervision.lightshare.vo.BaseResponse import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam @@ -10,7 +13,7 @@ @Api(tags = ["InspectionController"], description = "宸℃煡淇℃伅API鎺ュ彛") @RestController @RequestMapping("/inspection") -class InspectionController (val inspectionService: InspectionService){ +class InspectionController(val inspectionService: InspectionService) { @GetMapping fun getAll() = inspectionService.findAll() @@ -21,31 +24,45 @@ fun update(@RequestBody inspection: Inspection) = inspectionService.update(inspection) @GetMapping("/{id}") - fun getById(@PathVariable id:String) = inspectionService.findByID(id) + fun getById(@PathVariable id: String) = inspectionService.findByID(id) @GetMapping("/{id}/problemlist") - fun findProblemListById(@PathVariable id:String) = inspectionService.findProblemListById(id) + fun findProblemListById(@PathVariable id: String) = inspectionService.findProblemListById(id) @GetMapping("/{id}/gitlist") - fun findGitListById(@PathVariable id:String) = inspectionService.findGitListById(id) + fun findGitListById(@PathVariable id: String) = inspectionService.findGitListById(id) @GetMapping("/{id}/{date}/lastproblemlist") - fun findLastProblemListById(@PathVariable id:String,@PathVariable date:String) = inspectionService.findLastProblemListBySenceId(id,date) + fun findLastProblemListById(@PathVariable id: String, @PathVariable date: String) = + inspectionService.findLastProblemListBySenceId(id, date) @GetMapping("/find/{id}") - fun findBySubTaskID(@PathVariable id:String) = inspectionService.findBySubTaskID(id) + fun findBySubTaskID(@PathVariable id: String) = inspectionService.findBySubTaskID(id) @DeleteMapping("/{id}") - fun delete (@PathVariable id: String) = inspectionService.delete(id) + fun delete(@PathVariable id: String) = inspectionService.delete(id) @GetMapping("/getInspectionInfoByScene") - fun getInspectionInfoByScene(@RequestParam(value = "sceneId", required = true)sceneId:String, @RequestParam(value = "topTaskId", required = true)topTaskId:String) - = inspectionService.getInspectionInfoByScene(sceneId, topTaskId) + fun getInspectionInfoByScene( + @RequestParam(value = "sceneId", required = true) sceneId: String, + @RequestParam(value = "topTaskId", required = true) topTaskId: String, + ) = inspectionService.getInspectionInfoByScene(sceneId, topTaskId) @ApiOperation(value = "鑾峰彇鏌愪釜鎬讳换鍔′笅鏌愬満鏅殑缁熻淇℃伅", notes = "鍖呮嫭鍦烘櫙鍩烘湰淇℃伅銆佽瘎鍒嗐�佸叿浣撻棶棰樼瓑") - @GetMapping("/statistic") + @PostMapping("/statistic") fun getStatistic( - @ApiParam("鎬讳换鍔d") @RequestParam("topTaskId") topTaskId: String, - @ApiParam("鍦烘櫙绫诲瀷id") @RequestParam("sceneTypeId") sceneTypeId: String - ) = inspectionService.getStatistic(topTaskId, sceneTypeId) + @ApiParam("鎬讳换鍔d") @RequestParam(required = false) topTaskId: String?, + @ApiParam("鍦烘櫙绫诲瀷id") @RequestParam(required = false) sceneTypeId: String?, + @ApiParam("鍖哄煙鏉′欢") @RequestBody(required = false) areaVo: AreaVo?, + ): BaseResponse<Any> { + return resPack { + if (topTaskId != null && sceneTypeId != null) { + inspectionService.getStatistic(topTaskId, sceneTypeId) + } else if (areaVo != null) { + inspectionService.getStatistic(areaVo) + } else { + throw BizException("缂哄け鎬讳换鍔d鍜屽尯鍩熸潯浠讹紝璇烽�夋嫨浼犺緭鍏朵腑涓�绉嶅弬鏁�") + } + } + } } \ No newline at end of file -- Gitblit v1.9.3