From aed297a5fbc8df9dab01b28da21f872ee546b43c Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 13 十月 2025 16:15:11 +0800
Subject: [PATCH] 2025.10.13 1. 统一调整controller层的返回类型,通过添加全局响应增强器GlobalResponseAdvice来管理返回结果; 2. 新增mybatis-generator自定义插件,实现给数据库实体entity自动添加swagger注解@ApiModel和@ApiModelProperty

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt |   54 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt
index 46d2217..9f35c54 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt
@@ -3,6 +3,7 @@
 import cn.flightfeather.supervision.common.log.BizLog
 import cn.flightfeather.supervision.common.log.WorkStreamLogInfo
 import cn.flightfeather.supervision.common.utils.Constant
+import cn.flightfeather.supervision.config.IgnoreResponseAdvice
 import cn.flightfeather.supervision.domain.ds1.entity.Subtask
 import cn.flightfeather.supervision.lightshare.service.SubtaskService
 import cn.flightfeather.supervision.lightshare.vo.AreaVo
@@ -17,22 +18,26 @@
 @RestController
 @RequestMapping("/subtask")
 class SubtaskController(val subtaskService: SubtaskService, private val bizLog: BizLog) {
+    @IgnoreResponseAdvice
     @GetMapping
     fun getAll() = subtaskService.findAll()
 
+    @IgnoreResponseAdvice
     @PutMapping
     fun add(@RequestBody subtask: Subtask) = subtaskService.save(subtask)
 
+    @IgnoreResponseAdvice
     @PutMapping("/addlist")
     fun addList(@RequestBody subtasklist: List<Subtask>) = subtaskService.saveList(subtasklist)
 
+    @IgnoreResponseAdvice
     @PostMapping
     fun update(@RequestBody subtask: Subtask): Int {
         val res = subtaskService.changeStatus(subtask)
         if (subtask.status == Constant.TaskProgress.RUNINGSTATUS3.text) {
             val event = "鍦�${subtask.scensename}缁撴潫宸℃煡"
             bizLog.info(WorkStreamLogInfo(subtask.executorguids, subtask.executorrealtimes, event))
-        }else if (subtask.status == Constant.TaskProgress.RUNINGSTATUS2.text) {
+        } else if (subtask.status == Constant.TaskProgress.RUNINGSTATUS2.text) {
             val event = "鍦�${subtask.scensename}寮�濮嬪贰鏌�"
             bizLog.info(WorkStreamLogInfo(subtask.executorguids, subtask.executorrealtimes, event))
         }
@@ -43,59 +48,80 @@
     @PostMapping("/adjust")
     fun adjust(@RequestBody subtask: Subtask) = resPack { subtaskService.update(subtask) }
 
+    @IgnoreResponseAdvice
     @GetMapping("/{id}")
     fun getById(@PathVariable id: String) = subtaskService.findByID(id)
 
+    @IgnoreResponseAdvice
     @DeleteMapping("/{id}")
     fun delete(@PathVariable id: String) = subtaskService.delete(id)
 
+    @IgnoreResponseAdvice
     @GetMapping("/{date}/{guid}/{type}")
-    fun getTaskPackList(@PathVariable date: String, @PathVariable guid: String, @PathVariable type: String) = subtaskService.getTaskPackList(date, guid, type)
+    fun getTaskPackList(@PathVariable date: String, @PathVariable guid: String, @PathVariable type: String) =
+        subtaskService.getTaskPackList(date, guid, type)
 
     //涓存椂娣诲姞鐢ㄦ埛绫诲瀷浣滀负绛涢�夋潯浠�
+    @IgnoreResponseAdvice
     @GetMapping("/{date}/{guid}/{type}/{userType}")
-    fun getTaskPackList(@PathVariable date: String, @PathVariable guid: String, @PathVariable type: String, @PathVariable userType: String) = subtaskService.getTaskPackList(date, guid, type, userType)
+    fun getTaskPackList(
+        @PathVariable date: String,
+        @PathVariable guid: String,
+        @PathVariable type: String,
+        @PathVariable userType: String,
+    ) = subtaskService.getTaskPackList(date, guid, type, userType)
 
+    @IgnoreResponseAdvice
     @GetMapping("/{date}/{guid}")
     fun getTaskPack(@PathVariable date: String, @PathVariable guid: String) = subtaskService.getTaskPack(date, guid)
 
+    @IgnoreResponseAdvice
     @PostMapping("/subtaskprogress")
-    fun getTaskProgress(@RequestBody areaVo: AreaVo, @RequestParam(value = "userguid", required = true) userGuid: String): TaskVo = subtaskService.getTaskProgress(areaVo, userGuid)
+    fun getTaskProgress(
+        @RequestBody areaVo: AreaVo,
+        @RequestParam(value = "userguid", required = true) userGuid: String,
+    ) = subtaskService.getTaskProgress(areaVo, userGuid)
 
+    @IgnoreResponseAdvice
     @GetMapping("/byDayTaskId")
     fun findByDayTaskID(
-            @RequestParam("dayTaskId") dayTaskId: String,
-            @RequestParam("userId") userId: String,
-            @RequestParam("userType") userType: String
+        @RequestParam("dayTaskId") dayTaskId: String,
+        @RequestParam("userId") userId: String,
+        @RequestParam("userType") userType: String,
     ) = subtaskService.findByDayTaskID(dayTaskId, userId, userType)
 
+    @IgnoreResponseAdvice
     @GetMapping("/byDate")
     fun findByDate(
-            @RequestParam("date") date: String,
-            @RequestParam("userId") userId: String
+        @RequestParam("date") date: String,
+        @RequestParam("userId") userId: String,
     ) = subtaskService.findByDate(date, userId)
 
+    @IgnoreResponseAdvice
     @GetMapping("/getSubTask")
     fun getByTopTaskAndDate(
-            @RequestParam("topTaskId") topTaskId: String,
-            @RequestParam(value = "startTime", required = false) startTime: String?,
-            @RequestParam(value = "endTime", required = false) endTime: String?,
-            @RequestParam(value = "sceneTypeId", required = false) sceneTypeId: Int?
+        @RequestParam("topTaskId") topTaskId: String,
+        @RequestParam(value = "startTime", required = false) startTime: String?,
+        @RequestParam(value = "endTime", required = false) endTime: String?,
+        @RequestParam(value = "sceneTypeId", required = false) sceneTypeId: Int?,
     ) = subtaskService.getByTopTaskAndDate(topTaskId, startTime, endTime, sceneTypeId)
 
+    @IgnoreResponseAdvice
     @ApiOperation("鑾峰彇鏌愮被鍦烘櫙鐨勫贰鏌ヤ换鍔$粺璁′俊鎭�")
     @GetMapping("/summary")
     fun getByTopTaskAndDate(
         @RequestParam("topTaskId") topTaskId: String,
-        @RequestParam(value = "sceneTypeId", required = false) sceneTypeId: Int?
+        @RequestParam(value = "sceneTypeId", required = false) sceneTypeId: Int?,
     ) = subtaskService.getSummary(topTaskId, sceneTypeId)
 
+    @IgnoreResponseAdvice
     @ApiOperation("鑾峰彇鏌愮被鍦烘櫙鐨勫贰鏌ヤ换鍔$粺璁′俊鎭�")
     @PostMapping("/summary/area")
     fun getTaskProgressByArea(
         @RequestBody areaVo: AreaVo,
     ) = subtaskService.getTaskProgressByArea(areaVo)
 
+    @IgnoreResponseAdvice
     @ApiOperation("鑾峰彇鏌愪釜鍦烘櫙鐨勫贰鏌ヤ换鍔�")
     @GetMapping("/byScene")
     fun getByScene(

--
Gitblit v1.9.3