diff --git a/http/server/server.http b/http/server/server.http index e3815acb..8cdda751 100644 --- a/http/server/server.http +++ b/http/server/server.http @@ -26,7 +26,23 @@ Content-Type: application/json client.global.set("accessToken", accessToken) %} -### login dev - dos gmp + +### login sample +POST {{appHost}}/api/acnt/jwt/login +Content-Type: application/json + +{ + "userId": "gmp-admin", + "userPswd": "palnet5909!" +} + +> {% + const accessToken = 'palnet ' + response.body.data.accessToken + client.global.set("accessToken", accessToken) +%} + + +### login dev - dos gmp - 운항과 POST {{appHost}}/api/acnt/jwt/login Content-Type: application/json @@ -40,6 +56,20 @@ Content-Type: application/json client.global.set("accessToken", accessToken) %} +### login dev - dos gmp - 관제과 +POST {{appHost}}/api/acnt/jwt/login +Content-Type: application/json + +{ + "userId": "GMPATC2", + "userPswd": "GMPATC12!@" +} + +> {% + const accessToken = 'palnet ' + response.body.data.accessToken + client.global.set("accessToken", accessToken) +%} + ### profile < {% request.variables.set("cstmrSno", "37") @@ -200,4 +230,8 @@ Content-Type: application/json 43 ], "reviewedType": "R" -} \ No newline at end of file +} + +### 계정정보로 부서 바운더리 가져오기 +GET http://localhost:8080/api/comn/coordinate/boundary +Authorization: {{accessToken}} \ No newline at end of file diff --git a/pav-server/src/main/java/com/palnet/biz/api/bas/dos/service/BasDosService.java b/pav-server/src/main/java/com/palnet/biz/api/bas/dos/service/BasDosService.java index ce33a08f..7b53b89c 100644 --- a/pav-server/src/main/java/com/palnet/biz/api/bas/dos/service/BasDosService.java +++ b/pav-server/src/main/java/com/palnet/biz/api/bas/dos/service/BasDosService.java @@ -6,7 +6,11 @@ import com.itextpdf.io.font.PdfEncodings; import com.itextpdf.kernel.pdf.PdfDocument; import com.itextpdf.kernel.pdf.PdfWriter; import com.itextpdf.layout.font.FontProvider; +import com.palnet.biz.api.acnt.jwt.utils.JwtTokenUtil; import com.palnet.biz.api.bas.dos.model.*; +import com.palnet.biz.api.comn.coordinate.model.BoundaryModel; +import com.palnet.biz.api.comn.coordinate.model.SearchDepartmentBoundaryRS; +import com.palnet.biz.api.comn.coordinate.service.ComnCoordinateService; import com.palnet.biz.api.comn.file.model.ValidPdfModel; import com.palnet.biz.api.external.model.ApprovalCd; import com.palnet.biz.api.external.model.DosApprovalResult; @@ -18,10 +22,7 @@ import com.palnet.biz.jpa.entity.type.ReviewedType; import com.palnet.biz.jpa.repository.dos.*; import com.palnet.comn.code.ErrorCode; import com.palnet.comn.exception.CustomException; -import com.palnet.comn.utils.AirspaceUtils; -import com.palnet.comn.utils.AreaUtils; -import com.palnet.comn.utils.HttpUtils; -import com.palnet.comn.utils.PdfUtils; +import com.palnet.comn.utils.*; import kr.dogfoot.hwpxlib.object.HWPXFile; import kr.dogfoot.hwpxlib.object.content.section_xml.SectionXMLFile; import kr.dogfoot.hwpxlib.object.content.section_xml.paragraph.Run; @@ -40,6 +41,9 @@ import org.apache.poi.xssf.usermodel.XSSFFont; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.geom.Point; +import org.springframework.cache.annotation.Cacheable; import org.springframework.core.io.ClassPathResource; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; @@ -69,8 +73,10 @@ public class BasDosService { private final DosFltPlanDroneRepository dosFltPlanDroneRepository; private final DosFltPlanPilotRepository dosFltPlanPilotRepository; private final DronOneStopService dronOneStopService; + private final ComnCoordinateService comnCoordinateService; private final AreaUtils areaUtils; private final PdfUtils pdfUtils; + private final JwtTokenUtil jwtTokenUtil; /** * 드론원스톱 비행계획 조회 @@ -94,6 +100,7 @@ public class BasDosService { List resultList = dosFltPlanResultRepository.findByPlanSnoIn(planSnoList); List rs = new ArrayList<>(); + List boundary = null; for (DosFltPlanBas bas : planBasList) { Long planSno = bas.getPlanSno(); @@ -139,6 +146,34 @@ public class BasDosService { continue; } + // 사용자 부서에 따른 필터 관제과(DF0002), 운항과(DF0002-1) + String cptAuthCode = jwtTokenUtil.getCptAuthCodeByToken(); + if (cptAuthCode != null) { + Coordinate centerPoint = new Coordinate(area.getLon(), area.getLat()); + if("DF0002".equals(cptAuthCode)) { + // 관제과(9.3km) + AirspaceUtils airspaceUtils = AirspaceUtils.getInstance(); + List airspaces = airspaceUtils.getAirspaces(AirspaceUtils.AirspaceType.GIMPO); + GeometryFactory geometryFactory = new GeometryFactory(); + Point point = geometryFactory.createPoint(centerPoint); + boolean isContain = airspaces.stream().anyMatch(airspace -> { + Geometry airspaceGeometry = airspace.getGeometry(); + return airspaceGeometry.contains(point); + }); + if(!isContain) continue; + }else if("DF0002-1".equals(cptAuthCode)) { + // TODO 운항과(김항소 관리 전역) +// if(boundary == null) { +// boundary = comnCoordinateService.getDeptGeometry("F0002"); +// } +//// log.info("boundary : {}", boundary); +// GeometryFactory geometryFactory = new GeometryFactory(); +// Point point = geometryFactory.createPoint(centerPoint); +// boolean isContain = boundary.stream().anyMatch(geometry -> geometry.contains(point)); +// if(!isContain) continue; + + } + } List> bufferCoordList = null; if (type == PlanSelectType.LIST) { @@ -839,4 +874,5 @@ public class BasDosService { return null; } } + } diff --git a/pav-server/src/main/java/com/palnet/biz/api/comn/coordinate/service/ComnCoordinateService.java b/pav-server/src/main/java/com/palnet/biz/api/comn/coordinate/service/ComnCoordinateService.java index c714d19f..adde2210 100644 --- a/pav-server/src/main/java/com/palnet/biz/api/comn/coordinate/service/ComnCoordinateService.java +++ b/pav-server/src/main/java/com/palnet/biz/api/comn/coordinate/service/ComnCoordinateService.java @@ -19,6 +19,9 @@ import lombok.extern.slf4j.Slf4j; import org.json.simple.JSONObject; import org.json.simple.parser.ParseException; import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.geom.GeometryFactory; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import com.palnet.biz.jpa.entity.FltCptAuthBas; @@ -235,4 +238,24 @@ public class ComnCoordinateService { return Pattern.matches("^[^ ]+도 [^ ]+시$", address); } + + + @Cacheable(value = "getDeptGeometry", key = "#cptAuthCode") + public List getDeptGeometry(String cptAuthCode) { + List boundary = getDepartmentBoundary(cptAuthCode); + List geometryList = new ArrayList<>(); + GeometryFactory geometryFactory = new GeometryFactory(); + for (BoundaryModel boundaryModel : boundary) { +// List coordinates = boundaryModel.getCoordinates(); + List coordinates = boundaryModel.getCoordinates(); + for(CoordUtils.LocationCoordinateModel coordinate : coordinates) { + log.info("coordinate : {}", coordinate); + List coordinateList = coordinate.getCoordinateList(); + Geometry geometry = geometryFactory.createPolygon(coordinateList.toArray(new Coordinate[0])); + geometryList.add(geometry); + } + } + return geometryList; + } + } diff --git a/pav-server/src/main/resources/application.yml b/pav-server/src/main/resources/application.yml index ca13db4e..1eede46c 100644 --- a/pav-server/src/main/resources/application.yml +++ b/pav-server/src/main/resources/application.yml @@ -5,7 +5,9 @@ spring: - swagger jackson: time-zone: Asia/Seoul - + cache: + type: simple + logging: config: classpath:config/log/logback-spring.xml