package cn.flightfeather.supervision.lightshare.web
|
|
import cn.flightfeather.supervision.domain.ds1.entity.Scense
|
import cn.flightfeather.supervision.domain.ds1.entity.Task
|
import cn.flightfeather.supervision.lightshare.service.ScenseService
|
import cn.flightfeather.supervision.lightshare.vo.AreaVo
|
import cn.flightfeather.supervision.lightshare.vo.BaseResponse
|
import cn.flightfeather.supervision.lightshare.vo.SceneDetailStr
|
import io.swagger.annotations.Api
|
import io.swagger.annotations.ApiImplicitParam
|
import io.swagger.annotations.ApiOperation
|
import org.springframework.web.bind.annotation.*
|
|
@Api(tags = ["ScenseController"], description = "监管场景API接口")
|
@RestController
|
@RequestMapping("/scense")
|
class ScenseController(val scenseService: ScenseService) {
|
@GetMapping
|
fun getAll() = scenseService.findAll()
|
|
@PutMapping
|
fun add(@RequestBody scense: Scense) = scenseService.save(scense)
|
|
@PostMapping
|
fun update(@RequestBody scense: Scense) = scenseService.update(scense)
|
|
@PostMapping("/update/list")
|
fun updateList(@RequestBody sceneList: MutableList<Scense>) = scenseService.updateList(sceneList)
|
|
@PostMapping("/search")
|
fun find(@RequestBody scense: Scense) = scenseService.search(scense)
|
|
@GetMapping("/{id}")
|
fun getById(@PathVariable id: String) = scenseService.findOne(id)
|
|
@DeleteMapping("/{id}")
|
fun delete(@PathVariable id: String) = scenseService.delete(id)
|
|
@GetMapping("/alltype")
|
fun getSceneType() = scenseService.getSceneType()
|
|
/**
|
*
|
* @param task 总任务
|
* @param mode 0:只会获取总任务对应的监管版本中存在的场景;1:除了监管版本中存在的场景,还会获取剩余的可用场景
|
* @return 场景列表
|
*/
|
@PostMapping("/getByTask")
|
fun getByTaskId(@RequestBody task: Task, @RequestParam(value = "mode") mode: Int) = scenseService.getByTaskId(task, mode)
|
|
@GetMapping("/getByToken")
|
fun getSceneByToken(
|
@RequestParam("token") token: String,
|
@RequestParam("page", required = false) page: Int?,
|
@RequestParam("per_page", required = false) perPage: Int?
|
) = scenseService.getSceneByToken(token, page, perPage)
|
|
@ApiOperation(value = "查询场景特有信息", notes = "查询场景特有信息", produces = "application/json", httpMethod = "GET", response = BaseResponse::class)
|
@ApiImplicitParam(name = "sceneId", value = "场景主键id", paramType = "query", required = true, dataType = "String", defaultValue = "")
|
@GetMapping("/detail")
|
fun getSceneDetail(
|
@RequestParam("sceneId") sceneId: String
|
) = scenseService.getSceneDetail(sceneId)
|
|
|
@ApiOperation(value = "更新场景详情")
|
// @ApiImplicitParams(
|
// ApiImplicitParam(name = "sceneTypeId", value = "场景类型id", paramType = "query", required = true, dataType = "Long", defaultValue = "1"),
|
// ApiImplicitParam(name = "sceneDetailStr", value = "场景详情", paramType = "body", required = true, dataTypeClass = SceneDetailStr::class)
|
// )
|
@PostMapping("/detail/update")
|
fun updateSceneDetail(
|
@RequestParam("sceneTypeId") typeId: Int,
|
@RequestBody sceneDetailStr: SceneDetailStr
|
) = scenseService.updateSceneDetail(typeId, sceneDetailStr)
|
|
@PostMapping("/find")
|
fun searchScene(
|
@RequestBody areaVo: AreaVo,
|
@RequestParam("page", required = false) page: Int?,
|
@RequestParam("per_page", required = false) perPage: Int?
|
) = scenseService.searchScene(areaVo, page, perPage)
|
|
@ApiOperation(value = "根据圆心和半径找到范围内的场景")
|
@PostMapping("/find/coor")
|
fun searchByCoordinate(
|
@RequestParam("lng") lng: Double,
|
@RequestParam("lat") lat: Double,
|
@RequestParam("radius") radius: Double,
|
) = resPack { scenseService.searchByCoordinate(lng, lat, radius) }
|
}
|