diff --git a/src/main/java/com/palnet/biz/api/bas/flight/controller/BasFlightController.java b/src/main/java/com/palnet/biz/api/bas/flight/controller/BasFlightController.java index 455a51a..fd3190e 100644 --- a/src/main/java/com/palnet/biz/api/bas/flight/controller/BasFlightController.java +++ b/src/main/java/com/palnet/biz/api/bas/flight/controller/BasFlightController.java @@ -6,19 +6,14 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.nio.charset.MalformedInputException; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import io.swagger.annotations.Api; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import org.locationtech.jts.geom.Coordinate; -import org.locationtech.proj4j.CRSFactory; -import org.locationtech.proj4j.CoordinateReferenceSystem; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.core.io.ClassPathResource; @@ -37,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.palnet.biz.api.bas.flight.model.BasFlightAprovRq; +import com.palnet.biz.api.bas.flight.model.BasFlightCoordModel; import com.palnet.biz.api.bas.flight.model.BasFlightPlanArcrftModel; import com.palnet.biz.api.bas.flight.model.BasFlightPlanAreaModel; import com.palnet.biz.api.bas.flight.model.BasFlightPlanListRq; @@ -61,7 +57,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j @RestController @RequestMapping(value = "/api/bas/flight", produces = {MediaType.APPLICATION_JSON_VALUE}) -@Api(value = "BasFlightController",tags = {"Flight Plan API"}) +@Tag(name = "비행계획서", description = "비행계획서 관련 API") public class BasFlightController { private final BasFlightService basFlightService; @@ -78,6 +74,7 @@ public class BasFlightController { } @GetMapping("/area") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") public ResponseEntity findAirSpace() throws IOException, ParseException { // 1. file read Resource resource = new ClassPathResource("air/airgeo.json"); @@ -102,7 +99,8 @@ public class BasFlightController { // 비행계획서 조회 @GetMapping(value = "/plan/list") - @ApiOperation(value = "Flight Plan List") + @ApiOperation(value = "비행계획서 조회") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") public ResponseEntity findPlanList(BasFlightPlanListRq rq) { ComnPagingRs result = null; // System.out.println(rq); @@ -119,8 +117,9 @@ public class BasFlightController { // 비행계획서 상세 조회 @GetMapping(value = "/plan/detail/{planSno}") - @ApiOperation(value = "Flight Plan Detail") - @ApiImplicitParam(name = "planSno",value = "planSno", dataTypeClass = Integer.class) + @ApiOperation(value = "비행계획서 상세 조회") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") + @ApiImplicitParam(name = "planSno",value = "비행계획서일련번호", dataTypeClass = Integer.class) public ResponseEntity detailPlan(@PathVariable("planSno") Integer planSno) { BasFlightPlanModel result = null; try { @@ -136,7 +135,8 @@ public class BasFlightController { // 비행계획서 등록 @PostMapping(value = "/plan/create") - @ApiOperation(value = "Create Flight Plan") + @ApiOperation(value = "비행계획서 등록") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") public ResponseEntity createPlan(@RequestBody BasFlightPlanModel rq) { Map resultMap = new HashMap(); try { @@ -162,7 +162,8 @@ public class BasFlightController { // 비행계획서 수정 @PutMapping(value = "/plan/update") - @ApiOperation(value = "Update Flight Plan") + @ApiOperation(value = "비행계획서 수정") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") public ResponseEntity updatePlan(@RequestBody BasFlightPlanModel rq) { Map resultMap = new HashMap(); try { @@ -186,8 +187,9 @@ public class BasFlightController { // 비행계획서 삭제 @DeleteMapping(value = "/plan/delete/{planSno}") - @ApiOperation(value = "Delete Flight Plan") - @ApiImplicitParam(name = "planSno",value = "planSno", dataTypeClass = Integer.class) + @ApiOperation(value = "비행계획서 삭제") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") + @ApiImplicitParam(name = "planSno",value = "비행계획서일련번호", dataTypeClass = Integer.class) public ResponseEntity deletePlan(@PathVariable("planSno") Integer planSno) { Map resultMap = new HashMap(); try { @@ -210,8 +212,9 @@ public class BasFlightController { // 그룹 조종사 조회 @GetMapping(value = "/plan/pilot/{groupId}") - @ApiOperation(value = "Group Pilot List") - @ApiImplicitParam(name = "groupId",value = "groupId", dataTypeClass = String.class) + @ApiOperation(value = "그룹의 조종사 조회") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") + @ApiImplicitParam(name = "groupId",value = "그룹ID", dataTypeClass = String.class) public ResponseEntity findPilot(@PathVariable("groupId") String groupId) { List result = null; try { @@ -228,8 +231,9 @@ public class BasFlightController { } // 그룹 기체 조회 @GetMapping(value = "/plan/arcrft/{groupId}") - @ApiOperation(value = "Group Arcrft") - @ApiImplicitParam(name = "groupId",value = "groupId", dataTypeClass = String.class) + @ApiOperation(value = "그룹의 기체 조회") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") + @ApiImplicitParam(name = "groupId",value = "그룹ID", dataTypeClass = String.class) public ResponseEntity findArcrft(@PathVariable("groupId") String groupId) { List result = null; try { @@ -246,7 +250,8 @@ public class BasFlightController { // 비행 구역 버퍼 존 생성 @PostMapping("/plan/area/buffer") - @ApiOperation(value = "Flight area buffer Create") + @ApiOperation(value = "비행 구역 버퍼 존 생성") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") public ResponseEntity findBuffer(@RequestBody List rq) { List rs = null; try { @@ -261,7 +266,8 @@ public class BasFlightController { } @GetMapping("/plan/api/weather") - @ApiOperation(value = "Flight Plan Weather") + @ApiOperation(value = "비행계획서 날씨") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") public ResponseEntity restApiGetWeather(BasFlightWeatherModel rq){ JSONObject jsonObject = null; @@ -278,7 +284,8 @@ public class BasFlightController { } // 비행계획서 리스트(승인) @GetMapping(value = "/aprv/list") - @ApiOperation(value = "Flight Plan Aprv List") + @ApiOperation(value = "비행계획서 리스트(승인)") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") public ResponseEntity findAprvList(BasFlightPlanListRq rq) { ComnPagingRs result = null; try { @@ -293,7 +300,8 @@ public class BasFlightController { } // 비행계획서 승인/미승인 @PutMapping(value = "/aprv/proc") - @ApiOperation(value = "Flight Plan aprv/proc") + @ApiOperation(value = "비행 계획서 승인/미승인") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") public ResponseEntity updateAprvProc(@RequestBody BasFlightAprovRq rq) { Map resultMap = new HashMap(); try { @@ -316,6 +324,7 @@ public class BasFlightController { } @PostMapping("/airspace/contains") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") public ResponseEntity checkAirspaceContains(@RequestBody List rq) { Map resultMap = new HashMap(); try { @@ -334,13 +343,14 @@ public class BasFlightController { //지역 검색 @GetMapping("/plan/area/search") - @ApiOperation(value = "Search area") - public ResponseEntity searchArea(String query) throws ParseException{ + @ApiOperation(value = "지역 검색") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") + public ResponseEntity searchArea(String query) throws ParseException { String text = null; try { text = URLEncoder.encode(query, "UTF-8"); } catch (UnsupportedEncodingException e) { - throw new RuntimeException("Search Encoding Fail", e); + throw new RuntimeException("검색어 인코딩 실패", e); } String apiURL = env.getProperty("api.naver.search-url") + "?query=" + text + "&display=5"; @@ -356,6 +366,7 @@ public class BasFlightController { } @GetMapping("/schedule") + @Tag(name = "비행계획서", description = "비행계획서 관련 API") public ResponseEntity findSchedule(@RequestParam("searchDate") String searchDate) { List response; @@ -373,15 +384,20 @@ public class BasFlightController { } //test - @GetMapping("/test") - public void createCircleTest(@RequestParam double getX, @RequestParam double getY, @RequestParam double buffer) { - + @PostMapping("/adex/buffer") + public List adexBuffer(@RequestBody BasFlightCoordModel model) { - Coordinate circleCoord = new Coordinate(getY, getX); + List transCoordList = utils.transform(model.getCoordinates(), "EPSG:4326", "EPSG:5181"); + + List bufferList = utils.buffer(transCoordList, model.getBuffer()); // buffer 영역 생성 - List coordList = utils.createCircle(circleCoord, buffer); - for(Coordinate a : coordList) { - System.out.println("["+a.getX() + ", " + a.getY()+"],"); - } + List transBufferList = utils.transform(bufferList, "EPSG:5181", "EPSG:4326"); // buffer 영역 좌표계 변환 + + return transBufferList; } + + public void test3d(@RequestBody Coordinate coord, @RequestParam double buffer) { + + } + } diff --git a/src/main/java/com/palnet/biz/api/bas/flight/model/BasFlightCoordModel.java b/src/main/java/com/palnet/biz/api/bas/flight/model/BasFlightCoordModel.java new file mode 100644 index 0000000..7079caa --- /dev/null +++ b/src/main/java/com/palnet/biz/api/bas/flight/model/BasFlightCoordModel.java @@ -0,0 +1,15 @@ +package com.palnet.biz.api.bas.flight.model; + +import java.util.List; + +import org.locationtech.jts.geom.Coordinate; + +import lombok.Data; + +@Data +public class BasFlightCoordModel { + + private List coordinates; + + private Double buffer; +}