Browse Source

test controller(임시)

pull/12/head
박재우 11 months ago
parent
commit
c15853e6a1
  1. 90
      pav-server/src/main/java/com/palnet/biz/api/bas/flight/controller/BasFlightController.java

90
pav-server/src/main/java/com/palnet/biz/api/bas/flight/controller/BasFlightController.java

@ -1,6 +1,51 @@
package com.palnet.biz.api.bas.flight.controller; package com.palnet.biz.api.bas.flight.controller;
import com.palnet.biz.api.bas.flight.model.*; import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.simple.JSONArray;
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.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.MultiPoint;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
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.BasFlightPlanArcrftModel;
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.BasFlightPlanModel;
import com.palnet.biz.api.bas.flight.model.BasFlightPlanPilotModel;
import com.palnet.biz.api.bas.flight.model.BasFlightScheduleRs;
import com.palnet.biz.api.bas.flight.model.BasFlightWeatherModel;
import com.palnet.biz.api.bas.flight.service.BasFlightService; import com.palnet.biz.api.bas.flight.service.BasFlightService;
import com.palnet.biz.api.comn.file.service.ComnFileService; import com.palnet.biz.api.comn.file.service.ComnFileService;
import com.palnet.biz.api.comn.model.ComnPagingRs; import com.palnet.biz.api.comn.model.ComnPagingRs;
@ -10,29 +55,14 @@ import com.palnet.biz.api.comn.response.SuccessResponse;
import com.palnet.biz.scheduler.ctr.service.CtrTrnsLctnService; import com.palnet.biz.scheduler.ctr.service.CtrTrnsLctnService;
import com.palnet.comn.exception.CustomException; import com.palnet.comn.exception.CustomException;
import com.palnet.comn.utils.AreaUtils; import com.palnet.comn.utils.AreaUtils;
import com.palnet.comn.utils.FlightUtils;
import com.palnet.comn.utils.PdfUtils; import com.palnet.comn.utils.PdfUtils;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.io.*;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j @Slf4j
@RequiredArgsConstructor @RequiredArgsConstructor
@ -47,7 +77,7 @@ public class BasFlightController {
private final AreaUtils utils; private final AreaUtils utils;
private final ComnFileService comnFileService; private final ComnFileService comnFileService;
private final PdfUtils pdfUtils; private final PdfUtils pdfUtils;
@GetMapping("/area") @GetMapping("/area")
@Tag(name = "비행계획서", description = "비행계획서 관련 API") @Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<Object> findAirSpace() throws IOException, ParseException { public ResponseEntity<Object> findAirSpace() throws IOException, ParseException {
@ -361,20 +391,10 @@ public class BasFlightController {
return ResponseEntity.ok().body(new SuccessResponse<List>(response)); return ResponseEntity.ok().body(new SuccessResponse<List>(response));
} }
//test @PostMapping("/coord")
@GetMapping("/test") public JSONObject coordTest(@RequestBody Coordinate coordinate) throws IOException, ParseException {
public void createCircleTest(@RequestParam double getX, @RequestParam double getY, @RequestParam double buffer) {
return FlightUtils.getCoordinateGis(coordinate);
Coordinate circleCoord = new Coordinate(getY, getX);
List<Coordinate> coordList = utils.createCircle(circleCoord, buffer);
for (Coordinate a : coordList) {
System.out.println("[" + a.getX() + ", " + a.getY() + "],");
}
} }
}
}
Loading…
Cancel
Save