package com.its.cctv.api.controller; import com.its.cctv.api.dto.*; import com.its.cctv.api.service.CctvControlService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @Slf4j @Api(tags = "1.CCTV-0.제어") @Validated @RestController @RequiredArgsConstructor @RequestMapping("/api/cctv/control") public class CctvControlController { private final CctvControlService service; // @ApiOperation(value = "TEST", response = CctvStatusDto.CctvStatusNotifyDtoRes.class) // @GetMapping(value = "/status/notify/{id}", produces = {"application/json; charset=utf8"}) // public CctvStatusDto.CctvStatusNotifyDtoRes notifyStatus( // @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true) // @PathVariable("id") Long id) { // return this.service.notifyStatus(id); // } @ApiOperation(value = "CCTV 환경 파라미터 조회", response = CctvParamControlDto.CctvParamValueRes.class) @GetMapping(value = "/param-qry/{id}", produces = {"application/json; charset=utf8"}) public CctvParamControlDto.CctvParamValueRes requestParam( @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true) @PathVariable("id") Long id) { return this.service.requestParam(id); } @ApiOperation(value = "CCTV 환경 파라미터 설정", response = CctvParamControlDto.CctvParamControlRes.class) @PostMapping(value = "/param-set/{id}", produces = {"application/json; charset=utf8"}) public CctvParamControlDto.CctvParamControlRes controlParam( @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true) @PathVariable("id") Long id, @ApiParam(name = "req", value = "CCTV PARAMETER 설정 정보", example = "[ADMIN]", required = true) @RequestBody @Valid final CctvParamControlDto.CctvParamControlReq req) { return this.service.controlParam(id, req); } @ApiOperation(value = "CCTV 상태 조회", response = CctvStatusDto.CctvStatusDtoRes.class) @GetMapping(value = "/status/{id}", produces = {"application/json; charset=utf8"}) public CctvStatusDto.CctvStatusDtoRes requestStatus( @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true) @PathVariable("id") Long id) { return this.service.requestStatus(id); } @ApiOperation(value = "CCTV 현재위치정보 조회", response = CctvPresetControlDto.CctvPresetValueRes.class) @GetMapping(value = "/preset-value/{id}", produces = {"application/json; charset=utf8"}) public CctvPresetControlDto.CctvPresetValueRes requestPresetValue( @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true) @PathVariable("id") Long id) { return this.service.requestPresetValue(id); } @ApiOperation(value = "CCTV PTZ 제어", response = CctvPtzControlDto.CctvPtzControlRes.class) @PostMapping(value = "/ptz/{id}", produces = {"application/json; charset=utf8"}) public CctvPtzControlDto.CctvPtzControlRes controlPtz( @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true) @PathVariable("id") Long id, @ApiParam(name = "req", value = "CCTV PTZ 제어 정보", example = "[tilt-up, start, 20, ADMIN]", required = true) @RequestBody @Valid final CctvPtzControlDto.CctvControlPtzReq req) { return this.service.controlPtz(id, req); } @ApiOperation(value = "CCTV Preset 제어", response = CctvPresetControlDto.CctvPresetControlRes.class) @PostMapping(value = "/preset/{id}", produces = {"application/json; charset=utf8"}) public CctvPresetControlDto.CctvPresetControlRes controlPreset( @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true) @PathVariable("id") Long id, @ApiParam(name = "req", value = "CCTV Preset 제어 정보", example = "[preset, call, 1, 0, 0, ADMIN]", required = true) @RequestBody @Valid final CctvPresetControlDto.CctvPresetControlReq req) { return this.service.controlPreset(id, req); } @ApiOperation(value = "CCTV 가변 문자 설정", response = CctvVarCharControlDto.CctvVarCharControlRes.class) @PostMapping(value = "/var-char-set/{id}", produces = {"application/json; charset=utf8"}) public CctvVarCharControlDto.CctvVarCharControlRes controlVarCharSet( @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true) @PathVariable("id") Long id, @ApiParam(name = "req", value = "CCTV 가변문자 설정 정보", example = "[preset, call, 1, 0, 0, ADMIN]", required = true) @RequestBody @Valid final CctvVarCharControlDto.CctvVarCharControlSetReq req) { return this.service.controlVarCharSet(id, req); } @ApiOperation(value = "CCTV 가변 문자 삭제", response = CctvVarCharControlDto.CctvVarCharControlRes.class) @PostMapping(value = "/var-char-del/{id}", produces = {"application/json; charset=utf8"}) public CctvVarCharControlDto.CctvVarCharControlRes controlVarCharDel( @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true) @PathVariable("id") Long id, @ApiParam(name = "req", value = "CCTV 가변문자 삭제 정보", example = "[preset, call, 1, 0, 0, ADMIN]", required = true) @RequestBody @Valid final CctvVarCharControlDto.CctvVarCharControlDelReq req) { return this.service.controlVarCharDel(id, req); } @ApiOperation(value = "CCTV RESET", response = CctvControlDto.CctvControlResetRes.class) @PostMapping(value = "/reset/{id}", produces = {"application/json; charset=utf8"}) public CctvControlDto.CctvControlResetRes controlReset( @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true) @PathVariable("id") Long id, @ApiParam(name = "req", value = "CCTV 제어기 리셋", example = "[0/1, ADMIN]", required = true) @RequestBody @Valid final CctvControlDto.CctvControlResetReq req) { return this.service.controlReset(id, req); } }