package cn.flightfeather.supervision.lightshare.web
|
|
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 org.springframework.web.bind.annotation.*
|
|
@Api(tags = ["SubtaskController"], description = "巡查子任务API接口")
|
@RestController
|
@RequestMapping("/subtask")
|
class SubtaskController(val subtaskService: SubtaskService) {
|
@GetMapping
|
fun getAll() = subtaskService.findAll()
|
|
@PutMapping
|
fun add(@RequestBody subtask: Subtask) = subtaskService.save(subtask)
|
|
@PutMapping("/addlist")
|
fun addList(@RequestBody subtasklist: List<Subtask>) = subtaskService.saveList(subtasklist)
|
|
@PostMapping
|
fun update(@RequestBody subtask: Subtask) = subtaskService.update(subtask)
|
|
@GetMapping("/{id}")
|
fun getById(@PathVariable id: String) = subtaskService.findByID(id)
|
|
@DeleteMapping("/{id}")
|
fun delete(@PathVariable id: String) = subtaskService.delete(id)
|
|
@GetMapping("/{date}/{guid}/{type}")
|
fun getTaskPackList(@PathVariable date: String, @PathVariable guid: String, @PathVariable type: String) = subtaskService.getTaskPackList(date, guid, type)
|
|
//临时添加用户类型作为筛选条件
|
@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)
|
|
@GetMapping("/{date}/{guid}")
|
fun getTaskPack(@PathVariable date: String, @PathVariable guid: String) = subtaskService.getTaskPack(date, guid)
|
|
@PostMapping("/subtaskprogress")
|
fun getTaskProgress(@RequestBody areaVo: AreaVo, @RequestParam(value = "userguid", required = true) userGuid: String): TaskVo = subtaskService.getTaskProgress(areaVo, userGuid)
|
|
@GetMapping("/byDayTaskId")
|
fun findByDayTaskID(
|
@RequestParam("dayTaskId") dayTaskId: String,
|
@RequestParam("userId") userId: String,
|
@RequestParam("userType") userType: String
|
) = subtaskService.findByDayTaskID(dayTaskId, userId, userType)
|
|
@GetMapping("/byDate")
|
fun findByDate(
|
@RequestParam("date") date: String,
|
@RequestParam("userId") userId: String
|
) = subtaskService.findByDate(date, userId)
|
|
@GetMapping("/getSubTask")
|
fun getByTopTaskAndDate(
|
@RequestParam("topTaskId") topTaskId: String,
|
@RequestParam("startTime") startTime: String,
|
@RequestParam("endTime") endTime: String,
|
@RequestParam(value = "sceneTypeId", required = false) sceneTypeId: Int?
|
) = subtaskService.getByTopTaskAndDate(topTaskId, startTime, endTime, sceneTypeId)
|
}
|