From 6c7f45871b93ef26d353a5a3596701ac2f39ed9c Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 10 九月 2024 17:48:27 +0800
Subject: [PATCH] 1. 新增问题更新接口

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt |   39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 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 69d5aa6..103e7a1 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt
@@ -1,17 +1,22 @@
 package cn.flightfeather.supervision.lightshare.web
 
+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.domain.ds1.entity.Subtask
 import cn.flightfeather.supervision.lightshare.service.SubtaskService
 import cn.flightfeather.supervision.lightshare.vo.AreaVo
 import cn.flightfeather.supervision.lightshare.vo.TaskVo
 import io.swagger.annotations.Api
 import io.swagger.annotations.ApiOperation
+import org.springframework.format.annotation.DateTimeFormat
 import org.springframework.web.bind.annotation.*
+import java.time.LocalDateTime
 
 @Api(tags = ["SubtaskController"], description = "宸℃煡瀛愪换鍔PI鎺ュ彛")
 @RestController
 @RequestMapping("/subtask")
-class SubtaskController(val subtaskService: SubtaskService) {
+class SubtaskController(val subtaskService: SubtaskService, private val bizLog: BizLog) {
     @GetMapping
     fun getAll() = subtaskService.findAll()
 
@@ -22,7 +27,17 @@
     fun addList(@RequestBody subtasklist: List<Subtask>) = subtaskService.saveList(subtasklist)
 
     @PostMapping
-    fun update(@RequestBody subtask: Subtask) = subtaskService.update(subtask)
+    fun update(@RequestBody subtask: Subtask): Int {
+        val res = subtaskService.update(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) {
+            val event = "鍦�${subtask.scensename}寮�濮嬪贰鏌�"
+            bizLog.info(WorkStreamLogInfo(subtask.executorguids, subtask.executorrealtimes, event))
+        }
+        return res
+    }
 
     @GetMapping("/{id}")
     fun getById(@PathVariable id: String) = subtaskService.findByID(id)
@@ -70,4 +85,24 @@
         @RequestParam("topTaskId") topTaskId: String,
         @RequestParam(value = "sceneTypeId", required = false) sceneTypeId: Int?
     ) = subtaskService.getSummary(topTaskId, sceneTypeId)
+
+    @ApiOperation("鑾峰彇鏌愮被鍦烘櫙鐨勫贰鏌ヤ换鍔$粺璁′俊鎭�")
+    @PostMapping("/summary/area")
+    fun getTaskProgressByArea(
+        @RequestBody areaVo: AreaVo,
+    ) = subtaskService.getTaskProgressByArea(areaVo)
+
+    @ApiOperation("鑾峰彇鏌愪釜鍦烘櫙鐨勫贰鏌ヤ换鍔�")
+    @GetMapping("/byScene")
+    fun getByScene(
+        @RequestParam sceneId: String,
+        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") startTime: LocalDateTime?,
+        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") endTime: LocalDateTime?,
+    ) = subtaskService.getByScene(sceneId, startTime, endTime)
+
+    @ApiOperation("鑾峰彇鏌愮被鍦烘櫙鐨勫贰鏌ヤ换鍔$粺璁′俊鎭�")
+    @PostMapping("/summary/area/problem")
+    fun getSummaryByArea(
+        @RequestBody areaVo: AreaVo,
+    ) = resPack { subtaskService.getSummaryByArea(areaVo) }
 }
\ No newline at end of file

--
Gitblit v1.9.3