Browse Source

feat: 드론원스톱 목록 조회시 부서별 필터링

feature/change-airspace
지대한 2 months ago
parent
commit
edfa58f076
  1. 36
      http/server/server.http
  2. 44
      pav-server/src/main/java/com/palnet/biz/api/bas/dos/service/BasDosService.java
  3. 23
      pav-server/src/main/java/com/palnet/biz/api/comn/coordinate/service/ComnCoordinateService.java
  4. 2
      pav-server/src/main/resources/application.yml

36
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")
@ -201,3 +231,7 @@ Content-Type: application/json
],
"reviewedType": "R"
}
### 계정정보로 부서 바운더리 가져오기
GET http://localhost:8080/api/comn/coordinate/boundary
Authorization: {{accessToken}}

44
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<DosFltPlanResult> resultList = dosFltPlanResultRepository.findByPlanSnoIn(planSnoList);
List<BasDosPlanRs> rs = new ArrayList<>();
List<Geometry> 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<AirspaceUtils.FeatureInfo> 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<Map<String, Double>> bufferCoordList = null;
if (type == PlanSelectType.LIST) {
@ -839,4 +874,5 @@ public class BasDosService {
return null;
}
}
}

23
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<Geometry> getDeptGeometry(String cptAuthCode) {
List<BoundaryModel> boundary = getDepartmentBoundary(cptAuthCode);
List<Geometry> geometryList = new ArrayList<>();
GeometryFactory geometryFactory = new GeometryFactory();
for (BoundaryModel boundaryModel : boundary) {
// List<Coordinate> coordinates = boundaryModel.getCoordinates();
List<CoordUtils.LocationCoordinateModel> coordinates = boundaryModel.getCoordinates();
for(CoordUtils.LocationCoordinateModel coordinate : coordinates) {
log.info("coordinate : {}", coordinate);
List<Coordinate> coordinateList = coordinate.getCoordinateList();
Geometry geometry = geometryFactory.createPolygon(coordinateList.toArray(new Coordinate[0]));
geometryList.add(geometry);
}
}
return geometryList;
}
}

2
pav-server/src/main/resources/application.yml

@ -5,6 +5,8 @@ spring:
- swagger
jackson:
time-zone: Asia/Seoul
cache:
type: simple
logging:
config: classpath:config/log/logback-spring.xml

Loading…
Cancel
Save