main
MonHun 2024-04-30 18:20:34 +09:00
parent 8eaef92801
commit b3c9c1d35f
7 changed files with 268 additions and 55 deletions

View File

@ -1,4 +1,4 @@
package kr.gmtc.gw.elastic.parser;
package kr.gmtc.gw.elastic.parser.logingIndex;
import java.util.ArrayList;
import java.util.List;
@ -9,11 +9,11 @@ import kr.gmtc.gw.elastic.utils.LogMsgParserUtile;
import kr.gmtc.gw.elastic.vo.ElasticMsgHeader;
import kr.gmtc.gw.elastic.vo.ElasticResultMsgVO;
import kr.gmtc.gw.elastic.vo.LogMsgParserVO;
import kr.gmtc.gw.elastic.vo.ReplayLog.AiLocationVO;
import kr.gmtc.gw.elastic.vo.ReplayLog.AsdeVO;
import kr.gmtc.gw.elastic.vo.ReplayLog.StandRouteVO;
import kr.gmtc.gw.elastic.vo.ReplayLog.StandRouteVO.RoutePoints;
public class ReplayLogParser_AILocation {
public class ParserAade {
private List<ElasticResultMsgVO> logMsgs;
@ -21,7 +21,7 @@ public class ReplayLogParser_AILocation {
LogMsgParserUtile pUtile;
public ReplayLogParser_AILocation(){
public ParserAade(){
pUtile = new LogMsgParserUtile();
@ -31,13 +31,8 @@ public class ReplayLogParser_AILocation {
this.logMsgs = recvMsgs;
List<AiLocationVO> parserList = new ArrayList<AiLocationVO>();
AiLocationVO parserVO;
String[] arr_bb_brp;
String[] arr_bb_tlp;
String[] arr_cc_id;
String[] arr_crd_frm;
String[] arr_crd_glbl;
List<AsdeVO> parserList = new ArrayList<AsdeVO>();
AsdeVO parserVO;
LogMsgParserVO logVO;
ElasticMsgHeader logHeader;
@ -48,6 +43,7 @@ public class ReplayLogParser_AILocation {
logVO = new LogMsgParserVO();
/*** 메시지 Pipe(|) 구분 ***/
String[] split_Div = pUtile.splitString(sMsg, pUtile.DIV_PIPE);
/*** 메시지 Header 변환 START ***/
@ -67,7 +63,7 @@ public class ReplayLogParser_AILocation {
String[] split_Data = null;
//Data부 여러줄 인지 확인
//Data부 여러줄 인지 확인(^)
int iDivCnt_Datas = pUtile.countDivInMsg(sDatas, pUtile.DIV_CARET);
// Data부 여러줄인경우 분리(^)
@ -81,34 +77,24 @@ public class ReplayLogParser_AILocation {
/**** Data부 한줄씩 처리 START ****/
for(String loop1Data : split_Data){
parserVO = new AiLocationVO();
parserVO = new AsdeVO();
// 일반 필드 분리(,)
String[] split_Field = pUtile.splitString(loop1Data, pUtile.DIV_COMMA);
// routeVO.setMv_id(split_Field[0]);
// routeVO.setTrgt_id(split_Field[1]);
// routeVO.setMv_type(split_Field[2]);
// routeVO.setDep_arr_ty(split_Field[3]);
// routeVO.setMv_point(new ArrayList<RoutePoints>());
String[] split_List = pUtile.splitString(split_Field[4], pUtile.DIV_DOLLAR);
for(String loopList : split_List){
// routePoints = new RoutePoints();
String[] split_Array = pUtile.splitString(loopList, pUtile.DIV_AT);
// routePoints.setSpot_sn(split_Array[0]);
// routePoints.setLat(split_Array[1]);
// routePoints.setLon(split_Array[2]);
// routeVO.getMv_point().add(routePoints);
}
parserVO.setTrgt_id(split_Field[0]);
parserVO.setMode_s_cd(split_Field[1]);
parserVO.setSsr_cd(split_Field[2]);
parserVO.setClsgn(split_Field[3]);
parserVO.setTail_no(split_Field[4]);
parserVO.setTrack_no(split_Field[5]);
parserVO.setRecptn_dt(split_Field[6]);
parserVO.setCat_ty(split_Field[7]);
parserVO.setLat(split_Field[8]);
parserVO.setLon(split_Field[9]);
parserVO.setSpd(split_Field[10]);
parserVO.setCos(split_Field[11]);
parserVO.setTrgt_ty(split_Field[12]); // 객체 이동 속력(km/h)
parserList.add(parserVO);
}

View File

@ -0,0 +1,121 @@
package kr.gmtc.gw.elastic.parser.replayLog;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
import kr.gmtc.gw.elastic.utils.LogMsgParserUtile;
import kr.gmtc.gw.elastic.vo.ElasticMsgHeader;
import kr.gmtc.gw.elastic.vo.ElasticResultMsgVO;
import kr.gmtc.gw.elastic.vo.LogMsgParserVO;
import kr.gmtc.gw.elastic.vo.ReplayLog.AiLocationVO;
import kr.gmtc.gw.elastic.vo.ReplayLog.StandRouteVO;
import kr.gmtc.gw.elastic.vo.ReplayLog.StandRouteVO.RoutePoints;
public class ParserAILocation {
private List<ElasticResultMsgVO> logMsgs;
Queue<LogMsgParserVO> parserAiLocQ = new LinkedBlockingQueue<LogMsgParserVO>();
LogMsgParserUtile pUtile;
public ParserAILocation(){
pUtile = new LogMsgParserUtile();
}
public void logParser(List<ElasticResultMsgVO> recvMsgs){
this.logMsgs = recvMsgs;
List<AiLocationVO> parserList = new ArrayList<AiLocationVO>();
AiLocationVO parserVO;
LogMsgParserVO logVO;
ElasticMsgHeader logHeader;
for( ElasticResultMsgVO mv : logMsgs){
String sMsg = mv.getMessage();
logVO = new LogMsgParserVO();
/*** 메시지 Pipe(|) 구분 ***/
String[] split_Div = pUtile.splitString(sMsg, pUtile.DIV_PIPE);
/*** 메시지 Header 변환 START ***/
String[] split_Header = pUtile.splitString(split_Div[0], pUtile.DIV_COMMA);
logHeader = new ElasticMsgHeader();
logHeader.setLog_dt(split_Header[0]);
logHeader.setLog_se(split_Header[1]);
logHeader.setSw_se(split_Header[2]);
logHeader.setServer_se(split_Header[3]);
logVO.setHeader(logHeader);
/*** 메시지 Header 변환 END ***/
/*** 메시지 data(body) 변환 START ***/
String sDatas = split_Div[1];
String[] split_Data = null;
//Data부 여러줄 인지 확인(^)
int iDivCnt_Datas = pUtile.countDivInMsg(sDatas, pUtile.DIV_CARET);
// Data부 여러줄인경우 분리(^)
if(iDivCnt_Datas > 0){
split_Data = pUtile.splitString(sDatas, pUtile.DIV_CARET);
}else{
split_Data = new String[1];
split_Data[0] = sDatas;
}
/**** Data부 한줄씩 처리 START ****/
for(String loop1Data : split_Data){
parserVO = new AiLocationVO();
// 일반 필드 분리(,)
String[] split_Field = pUtile.splitString(loop1Data, pUtile.DIV_COMMA);
parserVO.setDtct_tm(split_Field[0]); // 객체 탐지 시간
parserVO.setDtct_cls(split_Field[1]); // 객체 탐지 결과
parserVO.setMta_tm(split_Field[2]); //
parserVO.setRw_tm(split_Field[3]); //
parserVO.setCc_id(pUtile.splitString(split_Field[4], pUtile.DIV_AT)); // 해당 영상 스트림을 전송한 CCTV 정보
parserVO.setZn_id(split_Field[5]); // 주기장 CCTV 담당 구역 정보
parserVO.setArcrft_tp(split_Field[6]); // 항공기 기종
parserVO.setArln(split_Field[7]); // 항공사
parserVO.setTrck_id(split_Field[8] + ',' + split_Field[9] + ',' + split_Field[10]); // 객체 추적 ID
parserVO.setBb_tlp(pUtile.splitString(split_Field[11], pUtile.DIV_AT)); // 영상 내 객체 탐지 Bounding Box 좌상단점 좌표(2차원 Pixels // 단위 좌표)
parserVO.setBb_brp(pUtile.splitString(split_Field[12], pUtile.DIV_AT)); // 영상 내 객체 탐지 Bounding Box 우하단점 좌표(2차원 Pixels // 단위 좌표)
parserVO.setCrd_frm(pUtile.splitString(split_Field[13], pUtile.DIV_AT)); // 영상 내 객체 위치 좌표(2차원 Pixels 단위 좌표)
parserVO.setCrd_glbl(pUtile.splitString(split_Field[14], pUtile.DIV_AT)); // 객체 글로벌 좌표(위도, 경도)
parserVO.setDrctn(split_Field[15]); // 객체 이동 방향(degree)
parserVO.setArcrft_stnd(split_Field[16]); // 글로벌 좌표 상에서 주기장(aircraft stand) 영역 내 위치 여부
parserVO.setSpd(split_Field[17]); // 객체 이동 속력(km/h)
parserList.add(parserVO);
}
/**** Data부 한줄씩 처리 END ****/
logVO.setData(parserList);
/*** 메시지 data(body) 변환 END ***/
// Que에 파싱 데이터 담기
parserAiLocQ.offer(logVO) ;
} // for( ElasticResultMsgVO mv : logMsgs){... END
}
}

View File

@ -1,4 +1,4 @@
package kr.gmtc.gw.elastic.parser;
package kr.gmtc.gw.elastic.parser.replayLog;
import java.util.ArrayList;
import java.util.List;
@ -9,10 +9,10 @@ import kr.gmtc.gw.elastic.utils.LogMsgParserUtile;
import kr.gmtc.gw.elastic.vo.ElasticMsgHeader;
import kr.gmtc.gw.elastic.vo.ElasticResultMsgVO;
import kr.gmtc.gw.elastic.vo.LogMsgParserVO;
import kr.gmtc.gw.elastic.vo.ReplayLog.SacpStandRouteVO;
import kr.gmtc.gw.elastic.vo.ReplayLog.SacpStandRouteVO.RoutePoints;
import kr.gmtc.gw.elastic.vo.ReplayLog.StandRouteVO;
import kr.gmtc.gw.elastic.vo.ReplayLog.StandRouteVO.RoutePoints;
public class ReplayLogParser_Route {
public class ParserRoute {
private List<ElasticResultMsgVO> logMsgs;
@ -20,7 +20,7 @@ public class ReplayLogParser_Route {
LogMsgParserUtile pUtile;
public ReplayLogParser_Route(){
public ParserRoute(){
pUtile = new LogMsgParserUtile();
@ -30,10 +30,10 @@ public class ReplayLogParser_Route {
this.logMsgs = recvMsgs;
SacpStandRouteVO routeVO;
StandRouteVO routeVO;
RoutePoints routePoints;
List<SacpStandRouteVO> routeList = new ArrayList<SacpStandRouteVO>();
List<StandRouteVO> routeList = new ArrayList<StandRouteVO>();
LogMsgParserVO logVO;
ElasticMsgHeader logHeader;
@ -77,7 +77,7 @@ public class ReplayLogParser_Route {
/**** Data부 한줄씩 처리 START ****/
for(String loop1Data : split_Data){
routeVO = new SacpStandRouteVO();
routeVO = new StandRouteVO();
// 일반 필드 분리(,)
String[] split_Field = pUtile.splitString(loop1Data, pUtile.DIV_COMMA);

View File

@ -16,7 +16,9 @@ import org.springframework.data.elasticsearch.core.query.Query;
import org.springframework.data.elasticsearch.core.query.StringQuery;
import org.springframework.stereotype.Service;
import kr.gmtc.gw.elastic.parser.ReplayLogParser_Route;
import kr.gmtc.gw.elastic.parser.logingIndex.ParserAade;
import kr.gmtc.gw.elastic.parser.replayLog.ParserAILocation;
import kr.gmtc.gw.elastic.parser.replayLog.ParserRoute;
import kr.gmtc.gw.elastic.vo.ElasticResultMsgVO;
@Service
@ -30,14 +32,14 @@ public class ElkSearchService {
private List<ElasticResultMsgVO> logMsgMatches;
private ReplayLogParser_Route logParser;
private ParserAade logParser;
public ElkSearchService(ElasticsearchOperations elasticsearchOperations){
this.elasticsearchOperations = elasticsearchOperations;
logMsgMatches = new ArrayList<ElasticResultMsgVO>();
logParser = new ReplayLogParser_Route();
//logParser = new ReplayLogParser_Route();
logParser = new ParserAade();
}
public String elkSearch_replay_log(String sLogType, String sStartDt, String sEndDt) {

View File

@ -23,7 +23,7 @@ public class SearchController {
this.elkSearchService = elkSearchService;
}
// http://localhost:8080/replay?idx=10&s=20240416090000.000&e=20240416103059.999
// http://localhost:8080/replay?idx=2&s=20240429145000.000&e=20240429145500.999
@GetMapping("/replay")
@ResponseBody
public String processSearch_replay_loop(@RequestParam(value = "idx", required = false) String sIndex,

View File

@ -10,11 +10,11 @@ public class AiLocationVO {
private String arcrft_stnd;
private String arcrft_tp;
private String arln;
private String[] arr_bb_brp;
private String[] arr_bb_tlp;
private String[] arr_cc_id;
private String[] arr_crd_frm;
private String[] arr_crd_glbl;
private String[] bb_brp;
private String[] bb_tlp;
private String[] cc_id;
private String[] crd_frm;
private String[] crd_glbl;
private String drctn;
private String dtct_cls;
private String dtct_tm;

View File

@ -0,0 +1,104 @@
package kr.gmtc.gw.elastic.vo.ReplayLog;
public class AsdeVO {
private String trgt_id;
private String mode_s_cd;
private String ssr_cd;
private String clsgn;
private String tail_no;
private String track_no;
private String recptn_dt;
private String cat_ty;
private String lat;
private String lon;
private String spd;
private String cos;
private String trgt_ty;
public String getTrgt_id() {
return trgt_id;
}
public void setTrgt_id(String trgt_id) {
this.trgt_id = trgt_id;
}
public String getMode_s_cd() {
return mode_s_cd;
}
public void setMode_s_cd(String mode_s_cd) {
this.mode_s_cd = mode_s_cd;
}
public String getSsr_cd() {
return ssr_cd;
}
public void setSsr_cd(String ssr_cd) {
this.ssr_cd = ssr_cd;
}
public String getClsgn() {
return clsgn;
}
public void setClsgn(String clsgn) {
this.clsgn = clsgn;
}
public String getTail_no() {
return tail_no;
}
public void setTail_no(String tail_no) {
this.tail_no = tail_no;
}
public String getTrack_no() {
return track_no;
}
public void setTrack_no(String track_no) {
this.track_no = track_no;
}
public String getRecptn_dt() {
return recptn_dt;
}
public void setRecptn_dt(String recptn_dt) {
this.recptn_dt = recptn_dt;
}
public String getCat_ty() {
return cat_ty;
}
public void setCat_ty(String cat_ty) {
this.cat_ty = cat_ty;
}
public String getLat() {
return lat;
}
public void setLat(String lat) {
this.lat = lat;
}
public String getLon() {
return lon;
}
public void setLon(String lon) {
this.lon = lon;
}
public String getSpd() {
return spd;
}
public void setSpd(String spd) {
this.spd = spd;
}
public String getCos() {
return cos;
}
public void setCos(String cos) {
this.cos = cos;
}
public String getTrgt_ty() {
return trgt_ty;
}
public void setTrgt_ty(String trgt_ty) {
this.trgt_ty = trgt_ty;
}
}