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