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(