win 0427
parent
d9d9fe10af
commit
b8f1d00a87
|
@ -1,22 +1,35 @@
|
|||
package kr.gmtc.gw.comp.rest.vo;
|
||||
|
||||
import kr.gmtc.gw.standstatus.vo.StandSttusVO;
|
||||
import kr.gmtc.gw.standstatus.vo.AiAnalyzeStandSttus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class RestServiceData extends StandSttusVO {
|
||||
public class RestServiceData {
|
||||
|
||||
private String cctv_id;
|
||||
private String stand_no;
|
||||
|
||||
private String clsgn;
|
||||
private String schdul_id;
|
||||
private String ac_reg_no;
|
||||
private String aircraft_sttus_ty;
|
||||
|
||||
private AiAnalyzeStandSttus aiStandSttus;
|
||||
|
||||
private String cctv_ip;
|
||||
private String clsgn;
|
||||
|
||||
RestServiceData(){}
|
||||
RestServiceData(){
|
||||
this.aiStandSttus = new AiAnalyzeStandSttus();
|
||||
}
|
||||
|
||||
public RestServiceData(String stand_no, String cctv_id){
|
||||
this.setStand_no(stand_no);
|
||||
this.setCctv_id(cctv_id);
|
||||
this.setStand_sttus_ty("0");
|
||||
this.setAircraft_sttus_ty("0");
|
||||
|
||||
this.aiStandSttus = new AiAnalyzeStandSttus();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class CustomThread extends Thread{
|
|||
this.repeatMiliSec = repeatMiliSec > 0 ? repeatMiliSec : 0;
|
||||
this.logger = LoggerFactory.getLogger(CustomThread.class);
|
||||
this.running = false;
|
||||
|
||||
|
||||
setName(threadName);
|
||||
setDaemon(true);
|
||||
if (autoStart) {
|
||||
|
@ -103,6 +103,12 @@ public class CustomThread extends Thread{
|
|||
this.running = true;
|
||||
super.start();
|
||||
}
|
||||
|
||||
public synchronized void start(int priority) {
|
||||
setPriority(priority);
|
||||
|
||||
this.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 스레드 정상종료, 진행중인 작업 완료 후 종료됨.
|
||||
|
|
|
@ -6,67 +6,78 @@ import java.util.Date;
|
|||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.gw.comp.rest.vo.RestServiceData;
|
||||
import kr.gmtc.gw.comp.thread.CustomThread;
|
||||
import kr.gmtc.gw.standstatus.config.QueueManageBean;
|
||||
import kr.gmtc.gw.standstatus.database.datasource2.IcSelectDao;
|
||||
import kr.gmtc.gw.standstatus.database.dto.DataLoadDTO;
|
||||
import kr.gmtc.gw.standstatus.database.dto.DataLoadHashMap;
|
||||
import kr.gmtc.gw.standstatus.service.DataLoadService;
|
||||
import kr.gmtc.gw.standstatus.vo.AiAnalyzeStandSttus;
|
||||
import kr.gmtc.gw.standstatus.vo.AlarmMsgVO;
|
||||
import kr.gmtc.gw.standstatus.vo.AlarmTargetVO;
|
||||
import kr.gmtc.gw.standstatus.vo.AlarmVO;
|
||||
import kr.gmtc.gw.standstatus.vo.AreaVO;
|
||||
|
||||
@Component
|
||||
@DependsOn(value = {"serviceList"})
|
||||
// @Component
|
||||
// @DependsOn(value = {"serviceList"})
|
||||
public class AnalysisAlarmStatus {
|
||||
|
||||
private Logger logger;
|
||||
|
||||
Queue<AlarmMsgVO> alamMsgQ;
|
||||
LinkedList<AlarmMsgVO> alamEndChkList;
|
||||
|
||||
@Autowired
|
||||
private IcSelectDao icSelectDao;
|
||||
|
||||
|
||||
private final ObjectMapper objMapper = new ObjectMapper();
|
||||
|
||||
@Resource(name = "dataLoadDTO")
|
||||
private DataLoadDTO dto;
|
||||
private QueueManageBean queMB;
|
||||
|
||||
@Resource(name = "serviceList")
|
||||
private Map<Integer, LinkedList<RestServiceData>> serviceList;
|
||||
// Queue<AlarmMsgVO> qAlamMsg;
|
||||
// LinkedList<AlarmMsgVO> alamEndChkList;
|
||||
|
||||
private LinkedBlockingQueue<AlarmMsgVO> qAlamMsg;
|
||||
private LinkedList<RestServiceData> serviceList;
|
||||
|
||||
private LinkedList<AlarmMsgVO> alamEndChkList;
|
||||
private LinkedList<RestServiceData> standSttusList;
|
||||
|
||||
private DataLoadService ds;
|
||||
|
||||
|
||||
// private Map<Integer, LinkedList<RestServiceData>> serviceList;
|
||||
|
||||
|
||||
private CustomThread cThread_Analyze_Alarm_Start;
|
||||
private CustomThread cThread_Analyze_Alarm_End;
|
||||
|
||||
|
||||
public AnalysisAlarmStatus(Queue<AlarmMsgVO> alamMsgQ, LinkedList<AlarmMsgVO> alamEndChkList){
|
||||
public AnalysisAlarmStatus(){}
|
||||
|
||||
public AnalysisAlarmStatus(DataLoadDTO dataLoadDTO, QueueManageBean queMB, DataLoadService ds){
|
||||
logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
this.alamMsgQ = alamMsgQ;
|
||||
this.alamEndChkList = alamEndChkList;
|
||||
this.dto = dataLoadDTO;
|
||||
this.queMB = queMB;
|
||||
this.qAlamMsg = queMB.getQAlamMsg();
|
||||
this.serviceList = queMB.getServiceList();
|
||||
this.ds = ds;
|
||||
|
||||
alamEndChkList = new LinkedList<AlarmMsgVO>();
|
||||
|
||||
cThread_Analyze_Alarm_Start = new CustomThread("analysisAlarmStart", this, CustomThread.NO_SLEEP, this::analysis_Stand_sttus_alarm_start, null, false);
|
||||
cThread_Analyze_Alarm_End = new CustomThread("analysisAlarmEnd", this, CustomThread.NO_SLEEP, this::analysis_Stand_sttus_alarm_end, null, false);
|
||||
|
||||
start();
|
||||
}
|
||||
|
||||
private void start(){
|
||||
public void start(){
|
||||
|
||||
cThread_Analyze_Alarm_Start.start();
|
||||
cThread_Analyze_Alarm_End.start();
|
||||
|
@ -77,11 +88,11 @@ public class AnalysisAlarmStatus {
|
|||
// 주기장 알림 상황 분석(상황시작)
|
||||
public void analysis_Stand_sttus_alarm_start() throws InterruptedException{
|
||||
|
||||
if(serviceList == null || serviceList.size() == 0 || dto == null || dto.getDb_FltDep().size() == 0 ) {
|
||||
if(serviceList.size() == 0 || dto.getDb_FltDep().size() == 0 ) {
|
||||
|
||||
Thread.sleep(1000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for( DataLoadHashMap mapDep : dto.getDb_FltDep()){
|
||||
|
@ -100,7 +111,7 @@ public class AnalysisAlarmStatus {
|
|||
|
||||
}
|
||||
|
||||
standSttusList = serviceList.get(0);
|
||||
standSttusList = serviceList;
|
||||
|
||||
for(int idx=0; idx<standSttusList.size(); idx++ ){
|
||||
AiAnalyzeStandSttus aiss = standSttusList.get(idx).getAiStandSttus();
|
||||
|
@ -108,7 +119,7 @@ public class AnalysisAlarmStatus {
|
|||
String sStandNo = standSttusList.get(idx).getStand_no();
|
||||
String sClsgn = standSttusList.get(idx).getClsgn();
|
||||
|
||||
if(aiss.getPad_clear().equals("N") && standSttusList.get(idx).getStand_sttus_ty().equals("5") ){
|
||||
if(aiss.getPad_clear().equals("N") && standSttusList.get(idx).getAircraft_sttus_ty().equals("5") ){
|
||||
|
||||
setAlarmMsg(sStandNo, sClsgn, "2", "Red-Zone내에 다른 차량 또는 사물이 있습니다.");
|
||||
|
||||
|
@ -142,7 +153,7 @@ public class AnalysisAlarmStatus {
|
|||
alarmMsg.setTrgt_id1(sClsgn);
|
||||
alarmMsg.setAnals_msg(sAlarmMsg);
|
||||
alarmMsg.setStart_end("Start");
|
||||
alamMsgQ.offer(alarmMsg);
|
||||
qAlamMsg.offer(alarmMsg);
|
||||
|
||||
}
|
||||
|
||||
|
@ -181,7 +192,7 @@ public class AnalysisAlarmStatus {
|
|||
ChkCnt++;
|
||||
if(!mapDep.get("PDC_ISUE_TM").equals("")){
|
||||
chkAlarm.setStart_end("End");
|
||||
alamMsgQ.offer(chkAlarm);
|
||||
qAlamMsg.offer(chkAlarm);
|
||||
alamEndChkList.remove(idx);
|
||||
}
|
||||
|
||||
|
@ -200,7 +211,7 @@ public class AnalysisAlarmStatus {
|
|||
ChkCnt++;
|
||||
if(aiss.getPad_clear().equals("Y")){
|
||||
chkAlarm.setStart_end("End");
|
||||
alamMsgQ.offer(chkAlarm);
|
||||
qAlamMsg.offer(chkAlarm);
|
||||
alamEndChkList.remove(idx);
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +224,7 @@ public class AnalysisAlarmStatus {
|
|||
if(ChkCnt == 0){
|
||||
|
||||
chkAlarm.setStart_end("End");
|
||||
alamMsgQ.offer(chkAlarm);
|
||||
qAlamMsg.offer(chkAlarm);
|
||||
alamEndChkList.remove(idx);
|
||||
|
||||
}
|
||||
|
@ -250,13 +261,13 @@ public class AnalysisAlarmStatus {
|
|||
|
||||
try {
|
||||
|
||||
for (int idx=0; idx<alamMsgQ.size();idx++){
|
||||
for (int idx=0; idx<qAlamMsg.size();idx++){
|
||||
|
||||
AlarmMsgVO alarmMsg = alamMsgQ.poll();
|
||||
AlarmMsgVO alarmMsg = qAlamMsg.poll();
|
||||
|
||||
AlarmVO aVo = new AlarmVO();
|
||||
|
||||
aVo.setAnals_id(MakeAnalsId());
|
||||
aVo.setAnals_id(ds.MakeAnalsId());
|
||||
aVo.setAnals_dt(sdf.format(now));
|
||||
aVo.setAnals_ty(alarmMsg.getAnals_ty());
|
||||
aVo.setStart_end(alarmMsg.getStart_end());
|
||||
|
@ -296,17 +307,7 @@ public class AnalysisAlarmStatus {
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
년(yyyy)+월(mm)+일(dd)+시(hh24)+분(mi)+초(ss)+밀리초(잘자)+SEQ(000~999)
|
||||
예시)20230607153520123001
|
||||
*/
|
||||
public String MakeAnalsId() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||
Date now = new Date();
|
||||
int seq = icSelectDao.getAnalsIdSeq();
|
||||
String nSeq = String.format("%03d", seq);
|
||||
return sdf.format(now) + nSeq;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package kr.gmtc.gw.standstatus.component;
|
|||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
|
@ -19,6 +20,7 @@ import org.slf4j.LoggerFactory;
|
|||
import kr.gmt.so.state.StateManager;
|
||||
import kr.gmtc.gw.comp.rest.vo.RestServiceData;
|
||||
import kr.gmtc.gw.comp.thread.CustomThread;
|
||||
import kr.gmtc.gw.standstatus.config.QueueManageBean;
|
||||
import kr.gmtc.gw.standstatus.database.dto.DataLoadDTO;
|
||||
import kr.gmtc.gw.standstatus.database.dto.DataLoadHashMap;
|
||||
import kr.gmtc.gw.standstatus.kafka.vo.AiVideoMetaData;
|
||||
|
@ -29,7 +31,7 @@ public class AnalysisStandStatus {
|
|||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private CustomThread cThread_Make_Map_StandSttus;
|
||||
private CustomThread cThread_Analyze_VideoMeta;
|
||||
private CustomThread cThread_Analyze_StandSttus;
|
||||
private CustomThread cThread_Maping_CctvIDStandNo;
|
||||
|
||||
|
@ -39,40 +41,32 @@ public class AnalysisStandStatus {
|
|||
|
||||
LocalDateTime dt;
|
||||
|
||||
LinkedBlockingQueue<AiVideoMetaData> recvVideoQ;
|
||||
private DataLoadDTO dto;
|
||||
Map<Integer, LinkedList<RestServiceData>> serviceList;
|
||||
private QueueManageBean queMB;
|
||||
|
||||
private LinkedBlockingQueue<ArrayList<AiVideoMetaData>> qRecvVideo;
|
||||
private LinkedList<RestServiceData> serviceList;
|
||||
|
||||
private Integer scvQcount;
|
||||
Queue<AlarmMsgVO> alamMsgQ;
|
||||
|
||||
HashMap<String, String> testStandStsMap;
|
||||
|
||||
HashMap<String, String[]> testStandStsMapAI;
|
||||
|
||||
public AnalysisStandStatus(LinkedBlockingQueue<AiVideoMetaData> recvVideoQ, DataLoadDTO dataLoadDTO, Map<Integer,
|
||||
LinkedList<RestServiceData>> serviceList, Queue<AlarmMsgVO> alamMsgQ,
|
||||
HashMap<String, String> testStandStsMap,
|
||||
HashMap<String, String[]> testStandStsMapAI
|
||||
){
|
||||
this.recvVideoQ =recvVideoQ;
|
||||
public AnalysisStandStatus(DataLoadDTO dataLoadDTO, QueueManageBean queMB){
|
||||
this.dto = dataLoadDTO;
|
||||
this.serviceList = serviceList;
|
||||
this.alamMsgQ = alamMsgQ;
|
||||
this.testStandStsMap = testStandStsMap;
|
||||
this.testStandStsMapAI = testStandStsMapAI;
|
||||
|
||||
this.queMB = queMB;
|
||||
initialize();
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
|
||||
|
||||
qRecvVideo = queMB.getQRecvVideo();
|
||||
serviceList = queMB.getServiceList();
|
||||
|
||||
map_stand_sttus = new LinkedHashMap<String, RestServiceData>();
|
||||
|
||||
try {
|
||||
|
||||
cThread_Maping_CctvIDStandNo = new CustomThread("mapingCctvStand", this, CustomThread.NO_SLEEP, this::init_map_stand_sttus, null, false);
|
||||
cThread_Make_Map_StandSttus = new CustomThread("makeMapStandSttus", this, CustomThread.NO_SLEEP, this::analysis_Ai_Video_Meta, null, false);
|
||||
cThread_Analyze_StandSttus = new CustomThread("analysisStandSttus", this, CustomThread.NO_SLEEP, this::analysis_Stand_Sttus, null, false);
|
||||
|
||||
map_stand_sttus = new LinkedHashMap<String, RestServiceData>();
|
||||
cThread_Analyze_VideoMeta = new CustomThread("makeMapStandSttus", this, CustomThread.NO_SLEEP, this::analysis_Ai_Video_Meta, null, false);
|
||||
cThread_Analyze_StandSttus = new CustomThread("analysisStandSttus", this, CustomThread.NO_SLEEP, this::analysis_Stand_Sttus, null, false);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Start Fail: "+ e.toString());
|
||||
|
@ -82,10 +76,9 @@ public class AnalysisStandStatus {
|
|||
public void start() {
|
||||
try {
|
||||
|
||||
cThread_Maping_CctvIDStandNo.start();
|
||||
//cThread_Make_Map_StandSttus.start();
|
||||
cThread_Analyze_StandSttus.start();
|
||||
|
||||
cThread_Maping_CctvIDStandNo.start(Thread.MAX_PRIORITY);
|
||||
cThread_Analyze_VideoMeta.start(Thread.NORM_PRIORITY);
|
||||
cThread_Analyze_StandSttus.start(Thread.MIN_PRIORITY);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Start Fail: "+ e);
|
||||
|
@ -93,57 +86,16 @@ public class AnalysisStandStatus {
|
|||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* Kafka를 통해 수신받은 AI Video Meta(주기장상황분석정보) 데이터 분석
|
||||
* Param : cctv List, AI Meta Data
|
||||
* Return : LinkedHashMap Map_Stand_sttus
|
||||
*/
|
||||
private void analysis_Ai_Video_Meta() throws InterruptedException{
|
||||
|
||||
if(dto.getDb_CctvList().size() == 0 || recvVideoQ.size() == 0 || map_stand_sttus == null ||map_stand_sttus.size() == 0) {
|
||||
|
||||
Thread.sleep(3000);
|
||||
return ;
|
||||
}
|
||||
|
||||
AiAnalyzeStandSttus aiStandSttus;
|
||||
|
||||
int queSize = recvVideoQ.size();
|
||||
|
||||
for(int idx = 0; idx<queSize; idx++){
|
||||
|
||||
AiVideoMetaData lcData = recvVideoQ.poll();
|
||||
|
||||
aiStandSttus = new AiAnalyzeStandSttus();
|
||||
|
||||
aiStandSttus.setArcft_stand(lcData.getArcrft_yn());
|
||||
aiStandSttus.setBrdg_cnnctd(lcData.getBrdg_cnnctd());
|
||||
aiStandSttus.setCrg_dr_opnd(lcData.getCrg_dr_opnd());
|
||||
aiStandSttus.setPad_clear(lcData.getPad_clear());
|
||||
aiStandSttus.setTwng_cr_cnnctd(lcData.getTwng_cr_cnnctd());
|
||||
|
||||
map_stand_sttus.get(lcData.getCc_id()).setAiStandSttus(aiStandSttus);
|
||||
|
||||
// 주기장 항공기 상태 초기화
|
||||
map_stand_sttus.get(lcData.getCc_id()).setStand_sttus_ty("0");
|
||||
|
||||
}
|
||||
|
||||
// Thread.sleep(300);
|
||||
|
||||
}
|
||||
|
||||
private void init_map_stand_sttus() throws InterruptedException{
|
||||
|
||||
if(dto.getDb_CctvList() == null ) {
|
||||
if(dto.getDb_CctvList() == null || dto.getDb_CctvList().size() <= 0 ) {
|
||||
Thread.sleep(3000);
|
||||
return ;
|
||||
}
|
||||
|
||||
String sCctv, sStandNo;
|
||||
|
||||
//map_stand_sttus = new LinkedHashMap<String, RestServiceData>();
|
||||
|
||||
for(DataLoadHashMap cctv : dto.getDb_CctvList()){
|
||||
|
||||
sStandNo = cctv.getItemString("STAND_NO");
|
||||
|
@ -153,7 +105,7 @@ public class AnalysisStandStatus {
|
|||
map_stand_sttus.put(sCctv, new RestServiceData(sStandNo, sCctv));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(map_stand_sttus.size() != 0){
|
||||
logger.info("Stand Sttus HashMap 생성.");
|
||||
}else{
|
||||
|
@ -163,6 +115,81 @@ public class AnalysisStandStatus {
|
|||
Thread.sleep(1000 * (60 * 10)); // 10분
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Kafka를 통해 수신받은 AI Video Meta(주기장상황분석정보) 데이터 분석
|
||||
* Param : cctv List, AI Meta Data
|
||||
* Return : LinkedHashMap Map_Stand_sttus
|
||||
*/
|
||||
private void analysis_Ai_Video_Meta() throws InterruptedException{
|
||||
|
||||
if(dto.getDb_CctvList().size() == 0 || qRecvVideo.size() == 0 || map_stand_sttus.size() == 0) {
|
||||
|
||||
Thread.sleep(3000);
|
||||
return ;
|
||||
}
|
||||
|
||||
AiAnalyzeStandSttus aiStandSttus;
|
||||
|
||||
int queSize = qRecvVideo.size();
|
||||
|
||||
for(int idx = 0; idx<queSize; idx++){
|
||||
|
||||
//AiVideoMetaData lcData = qRecvVideo.poll();
|
||||
//AiVideoMetaData lcData = qRecvVideo.take();
|
||||
|
||||
List<AiVideoMetaData> lcDataList = qRecvVideo.take();
|
||||
for( AiVideoMetaData lcData : lcDataList ){
|
||||
|
||||
if(lcData.getCc_id().equals("123")){
|
||||
String adsf = "adf";
|
||||
}
|
||||
|
||||
aiStandSttus = new AiAnalyzeStandSttus();
|
||||
|
||||
aiStandSttus.setArcft_stand(lcData.getArcrft_yn());
|
||||
aiStandSttus.setBrdg_cnnctd(lcData.getBrdg_cnnctd());
|
||||
aiStandSttus.setCrg_dr_opnd(lcData.getCrg_dr_opnd());
|
||||
aiStandSttus.setPad_clear(lcData.getPad_clear());
|
||||
aiStandSttus.setTwng_cr_cnnctd(lcData.getTwng_cr_cnnctd());
|
||||
|
||||
map_stand_sttus.get(lcData.getCc_id()).setAiStandSttus(aiStandSttus);
|
||||
|
||||
}
|
||||
|
||||
// 주기장 항공기 상태 초기화
|
||||
//map_stand_sttus.get(lcData.getCc_id()).setAircraft_sttus_ty("0");
|
||||
|
||||
}
|
||||
|
||||
Thread.sleep(300);
|
||||
|
||||
}
|
||||
|
||||
private void analysis_Stand_Sttus() throws InterruptedException {
|
||||
|
||||
if(qRecvVideo.size() == 0){
|
||||
// logger.info("AI Video Mata Data(Kafka) 수신 대기");
|
||||
Thread.sleep(3000);
|
||||
return ;
|
||||
}
|
||||
|
||||
// AI 주기장 상황 분석 매핑
|
||||
//analysis_Ai_Video_Meta();
|
||||
|
||||
// 항공기 운항 상태 체크 - 도착 스케줄
|
||||
analysis_Stand_Sttus_Arr();
|
||||
|
||||
// 항공기 운항 상태 체크 - 출발 스케줄
|
||||
analysis_Stand_Sttus_Dep();
|
||||
|
||||
// 서비스큐 데이터 적재
|
||||
store_Service_Data();
|
||||
|
||||
Thread.sleep(300);
|
||||
}
|
||||
|
||||
private int analysis_Stand_Sttus_Arr() {
|
||||
|
||||
if(map_stand_sttus.size() == 0 || dto.getDb_FltArr().size() == 0) return 0;
|
||||
|
@ -208,7 +235,10 @@ public class AnalysisStandStatus {
|
|||
}
|
||||
|
||||
map_stand_sttus.get(sCctv).setClsgn(_mfltarr.getItemString("CLSGN"));
|
||||
map_stand_sttus.get(sCctv).setStand_sttus_ty(sSttusCD);
|
||||
map_stand_sttus.get(sCctv).setAircraft_sttus_ty(sSttusCD);
|
||||
|
||||
map_stand_sttus.get(sCctv).setSchdul_id(_mfltarr.getItemString("SCHDUL_ID"));
|
||||
map_stand_sttus.get(sCctv).setAc_reg_no(_mfltarr.getItemString("AC_REG_NO"));
|
||||
|
||||
// logger.info("ARR --- StandNo:"+sStandNo + "|" + "cctv:" +sCctv + "|" + "CallSign:"+fltarr.get("CLSGN") + " ["+fltarr.toString()+"]");
|
||||
}
|
||||
|
@ -254,7 +284,7 @@ public class AnalysisStandStatus {
|
|||
* - 출발 승인 대기 시각이 있음(ACTL_CLR_WAIT_DT)
|
||||
*/
|
||||
|
||||
/* [5]PUSH-BACK 진행
|
||||
/* [5]PUSH-BACK 진행
|
||||
* - 실제 주기장 출발 시간이 있음
|
||||
* - A-CDM 상태코드 'TAX' 미수신
|
||||
*/
|
||||
|
@ -275,6 +305,10 @@ public class AnalysisStandStatus {
|
|||
continue;
|
||||
}
|
||||
|
||||
if(sCctv.equals("107")){
|
||||
String asdf = "asdfasdf";
|
||||
}
|
||||
|
||||
String sRecvTime = _mfltdep.getItemString("EXP_STAND_OFF_DT");
|
||||
sRecvTime = sRecvTime.concat("00.000");
|
||||
dt = LocalDateTime.parse(sRecvTime, df_Pattern);
|
||||
|
@ -316,7 +350,10 @@ public class AnalysisStandStatus {
|
|||
// }
|
||||
|
||||
map_stand_sttus.get(sCctv).setClsgn(_mfltdep.getItemString("CLSGN"));
|
||||
map_stand_sttus.get(sCctv).setStand_sttus_ty(sSttusCD);
|
||||
map_stand_sttus.get(sCctv).setAircraft_sttus_ty(sSttusCD);
|
||||
|
||||
map_stand_sttus.get(sCctv).setSchdul_id(_mfltdep.getItemString("SCHDUL_ID"));
|
||||
map_stand_sttus.get(sCctv).setAc_reg_no(_mfltdep.getItemString("AC_REG_NO"));
|
||||
|
||||
// logger.info("DEP --- StandNo:"+sStandNo + "|" + "cctv:" +sCctv + "|" + "CallSign:"+fltdep.get("CLSGN") + " ["+fltdep.toString()+"]");
|
||||
}
|
||||
|
@ -327,77 +364,7 @@ public class AnalysisStandStatus {
|
|||
return idx;
|
||||
}
|
||||
|
||||
private void analysis_Stand_Sttus() throws InterruptedException {
|
||||
|
||||
if(recvVideoQ.size() == 0){
|
||||
// logger.info("AI Video Mata Data(Kafka) 수신 대기");
|
||||
Thread.sleep(3000);
|
||||
return ;
|
||||
}
|
||||
|
||||
analysis_Ai_Video_Meta();
|
||||
|
||||
|
||||
|
||||
int anaCnt;
|
||||
|
||||
analysis_Stand_Sttus_Arr();
|
||||
|
||||
analysis_Stand_Sttus_Dep();
|
||||
|
||||
|
||||
|
||||
// test Map의 주기장 번호가 있을때
|
||||
if(testStandStsMap.size() > 0){
|
||||
|
||||
for( String testStand : testStandStsMap.keySet()){
|
||||
|
||||
String sCctvID = findCctvID(testStand);
|
||||
|
||||
if(!sCctvID.equals("")){
|
||||
map_stand_sttus.get(sCctvID).setStand_sttus_ty("1");
|
||||
map_stand_sttus.get(sCctvID).setStand_sttus_ty(testStandStsMap.get(testStand));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(testStandStsMapAI.size() > 0){
|
||||
|
||||
for( String testStand : testStandStsMapAI.keySet()){
|
||||
|
||||
String sCctvID = findCctvID(testStand);
|
||||
|
||||
if(!sCctvID.equals("")){
|
||||
|
||||
AiAnalyzeStandSttus aists = new AiAnalyzeStandSttus();
|
||||
String[] arrTestSts = testStandStsMapAI.get(testStand);
|
||||
|
||||
|
||||
aists.setArcft_stand(arrTestSts[0]);
|
||||
aists.setBrdg_cnnctd(arrTestSts[1]);
|
||||
aists.setCrg_dr_opnd(arrTestSts[2]);
|
||||
aists.setPad_clear(arrTestSts[3]);
|
||||
aists.setTwng_cr_cnnctd(arrTestSts[4]);
|
||||
|
||||
map_stand_sttus.get(sCctvID).setAiStandSttus(aists);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 서비스큐 데이터 적재
|
||||
store_Service_Data();
|
||||
|
||||
Thread.sleep(300);
|
||||
}
|
||||
|
||||
|
||||
private void store_Service_Data(){
|
||||
|
||||
|
@ -405,10 +372,13 @@ public class AnalysisStandStatus {
|
|||
|
||||
LinkedList<RestServiceData> valueList = new LinkedList<RestServiceData>(map_stand_sttus.values());
|
||||
|
||||
for(int qi=0; qi<scvQcount; qi++) {
|
||||
serviceList.get(qi).clear();
|
||||
serviceList.get(qi).addAll(valueList);
|
||||
}
|
||||
// for(int qi=0; qi<scvQcount; qi++) {
|
||||
// serviceList.get(qi).clear();
|
||||
// serviceList.get(qi).addAll(valueList);
|
||||
// }
|
||||
|
||||
serviceList.clear();
|
||||
serviceList.addAll(valueList);
|
||||
|
||||
}
|
||||
|
||||
|
@ -429,8 +399,4 @@ public class AnalysisStandStatus {
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void setScvQcount(Integer scvQcount){
|
||||
this.scvQcount = scvQcount;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +1,32 @@
|
|||
package kr.gmtc.gw.standstatus.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import kr.gmtc.gw.comp.rest.vo.RestServiceData;
|
||||
import kr.gmtc.gw.standstatus.kafka.vo.AiVideoMetaData;
|
||||
import kr.gmtc.gw.standstatus.vo.AlarmMsgVO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public class QueueManageBean {
|
||||
|
||||
private LinkedBlockingQueue<AiVideoMetaData> recvVideoQ;
|
||||
private Queue<AlarmMsgVO> alamMsgQ;
|
||||
private Map<Integer, LinkedList<RestServiceData>> serviceList;
|
||||
private boolean serviceRunnig;
|
||||
private LinkedBlockingQueue<ArrayList<AiVideoMetaData>> qRecvVideo;
|
||||
private LinkedBlockingQueue<AlarmMsgVO> qAlamMsg;
|
||||
//private Map<Integer, LinkedList<RestServiceData>> mapServiceLists;
|
||||
private LinkedList<RestServiceData> serviceList;
|
||||
private boolean bThredRunnig;
|
||||
|
||||
public QueueManageBean(){
|
||||
this.recvVideoQ = new LinkedBlockingQueue<AiVideoMetaData>();
|
||||
this.alamMsgQ = new LinkedBlockingQueue<AlarmMsgVO>();
|
||||
this.serviceList = new HashMap<Integer, LinkedList<RestServiceData>>();
|
||||
this.serviceRunnig = false;
|
||||
this.qRecvVideo = new LinkedBlockingQueue<ArrayList<AiVideoMetaData>>(100000);
|
||||
this.qAlamMsg = new LinkedBlockingQueue<AlarmMsgVO>(100000);
|
||||
this.serviceList = new LinkedList<RestServiceData>();
|
||||
this.bThredRunnig = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.util.Map;
|
|||
import java.util.Queue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
@Configuration("ServiceConfig")
|
||||
//@Configuration("ServiceConfig")
|
||||
public class ServiceConfig {
|
||||
|
||||
@Value("${root}")
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package kr.gmtc.gw.standstatus.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
@ -13,7 +10,6 @@ import org.slf4j.LoggerFactory;
|
|||
import org.slf4j.Marker;
|
||||
import org.slf4j.MarkerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
|
@ -21,18 +17,15 @@ import org.springframework.context.event.EventListener;
|
|||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import kr.gmt.so.state.StateManager;
|
||||
import kr.gmtc.gw.comp.rest.ServiceQueManager;
|
||||
import kr.gmtc.gw.comp.rest.vo.RestServiceData;
|
||||
import kr.gmtc.gw.comp.thread.CustomThread;
|
||||
import kr.gmtc.gw.standstatus.component.AnalysisAlarmStatus;
|
||||
import kr.gmtc.gw.standstatus.component.AnalysisStandStatus;
|
||||
import kr.gmtc.gw.standstatus.config.QueueManageBean;
|
||||
import kr.gmtc.gw.standstatus.database.datasource1.CmSelectDao;
|
||||
import kr.gmtc.gw.standstatus.database.datasource2.IcSelectDao;
|
||||
import kr.gmtc.gw.standstatus.database.dto.DataLoadDTO;
|
||||
import kr.gmtc.gw.standstatus.kafka.vo.AiVideoMetaData;
|
||||
import kr.gmtc.gw.standstatus.service.DataLoadService;
|
||||
import kr.gmtc.gw.standstatus.vo.AlarmMsgVO;
|
||||
|
||||
@Component("controller")
|
||||
public class MainController implements ApplicationListener<ContextClosedEvent> {
|
||||
|
@ -41,53 +34,62 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
|
|||
|
||||
private ServiceQueManager serviceQueManager;
|
||||
|
||||
private List<CustomThread> listCustomThreads;
|
||||
|
||||
@Resource(name = "cmSelectDao")
|
||||
//@Resource(name = "cmSelectDao")
|
||||
@Autowired
|
||||
private CmSelectDao cmSelectDao;
|
||||
|
||||
@Resource(name = "icSelectDao")
|
||||
|
||||
|
||||
@Autowired
|
||||
private IcSelectDao icSelectDao;
|
||||
|
||||
@Resource(name = "dataLoadDTO")
|
||||
@Autowired
|
||||
private DataLoadDTO dataLoadDTO;
|
||||
|
||||
// @Resource(name = "queueManageBean")
|
||||
// private QueueManageBean queBean;
|
||||
|
||||
@Resource(name = "recvVideoQ")
|
||||
LinkedBlockingQueue<AiVideoMetaData> recvVideoQ;
|
||||
|
||||
@Resource(name = "serviceList")
|
||||
Map<Integer, LinkedList<RestServiceData>> serviceList;
|
||||
|
||||
@Resource(name = "alamMsgQ")
|
||||
Queue<AlarmMsgVO> alamMsgQ;
|
||||
|
||||
@Resource(name = "serviceRunnig")
|
||||
private boolean serviceRunnig = false;
|
||||
@Autowired
|
||||
private QueueManageBean queMB;
|
||||
|
||||
|
||||
@Value("${rest.service.queueCount}")
|
||||
private Integer scvQcount;
|
||||
// @Resource(name = "recvVideoQ")
|
||||
// LinkedBlockingQueue<AiVideoMetaData> recvVideoQ;
|
||||
|
||||
@Value("${rest.service.clearQ.maxCount}")
|
||||
private Integer scvQmaxCount;
|
||||
// @Resource(name = "serviceList")
|
||||
// Map<Integer, LinkedList<RestServiceData>> serviceList;
|
||||
|
||||
@Value("${rest.service.clearQ.diffTime}")
|
||||
private Integer scvQdiffTime;
|
||||
// @Resource(name = "alamMsgQ")
|
||||
// Queue<AlarmMsgVO> alamMsgQ;
|
||||
|
||||
@Value("${rest.service.clearQ.clearTime}")
|
||||
private Integer scvQclearTime;
|
||||
// @Resource(name = "serviceRunnig")
|
||||
// private boolean serviceRunnig = false;
|
||||
|
||||
@Resource(name = "testStandStsMap")
|
||||
HashMap<String, String> testStandStsMap;
|
||||
// @Resource(name = "alamEndChkList")
|
||||
// LinkedList<AlarmMsgVO> alamEndChkList;
|
||||
|
||||
@Resource(name = "testStandStsMapAI")
|
||||
HashMap<String, String[]> testStandStsMapAI;
|
||||
// @Value("${rest.service.queueCount}")
|
||||
// private Integer scvQcount;
|
||||
|
||||
// @Value("${rest.service.clearQ.maxCount}")
|
||||
// private Integer scvQmaxCount;
|
||||
|
||||
// @Value("${rest.service.clearQ.diffTime}")
|
||||
// private Integer scvQdiffTime;
|
||||
|
||||
// @Value("${rest.service.clearQ.clearTime}")
|
||||
// private Integer scvQclearTime;
|
||||
|
||||
// @Resource(name = "testStandStsMap")
|
||||
// HashMap<String, String> testStandStsMap;
|
||||
|
||||
// @Resource(name = "testStandStsMapAI")
|
||||
// HashMap<String, String[]> testStandStsMapAI;
|
||||
|
||||
|
||||
private DataLoadService dataLoadService;
|
||||
private AnalysisStandStatus analysisStatusService;
|
||||
private AnalysisAlarmStatus analysisAlarmStatus;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -101,35 +103,43 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
|
|||
|
||||
logger.info(interesting, "MarkerTest");
|
||||
|
||||
serviceQueManager = new ServiceQueManager(serviceList, serviceRunnig);
|
||||
serviceQueManager.setScvQclearTime(scvQclearTime);
|
||||
serviceQueManager.setScvQcount(scvQcount);
|
||||
serviceQueManager.setScvQdiffTime(scvQdiffTime);
|
||||
serviceQueManager.setScvQmaxCount(scvQmaxCount);
|
||||
// serviceQueManager = new ServiceQueManager(serviceList, serviceRunnig);
|
||||
// serviceQueManager.setScvQclearTime(scvQclearTime);
|
||||
// serviceQueManager.setScvQcount(scvQcount);
|
||||
// serviceQueManager.setScvQdiffTime(scvQdiffTime);
|
||||
// serviceQueManager.setScvQmaxCount(scvQmaxCount);
|
||||
|
||||
dataLoadService = new DataLoadService(dataLoadDTO, cmSelectDao, icSelectDao);
|
||||
dataLoadService.start();
|
||||
|
||||
analysisStatusService = new AnalysisStandStatus(dataLoadDTO, queMB);
|
||||
|
||||
analysisAlarmStatus = new AnalysisAlarmStatus(dataLoadDTO, queMB, dataLoadService);
|
||||
|
||||
analysisStatusService = new AnalysisStandStatus(recvVideoQ, dataLoadDTO, serviceList, alamMsgQ, testStandStsMap, testStandStsMapAI);
|
||||
analysisStatusService.setScvQcount(scvQcount);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Start Fail: "+ e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Order(4)
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void start() {
|
||||
try {
|
||||
|
||||
serviceQueManager.start();
|
||||
// serviceQueManager.start();
|
||||
// serviceQueManager.join();
|
||||
|
||||
dataLoadService.start();
|
||||
|
||||
Thread.sleep(2000);
|
||||
|
||||
// Thread.sleep(2000);
|
||||
analysisStatusService.start();
|
||||
|
||||
// Thread.sleep(2000);
|
||||
analysisAlarmStatus.start();
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Start Fail: "+ e);
|
||||
}
|
||||
|
@ -145,11 +155,19 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void logging_Que() {
|
||||
|
||||
// logger.info("Que size:" + recvVideoQ.size());
|
||||
|
||||
// recvVideoQ.clear();
|
||||
public void setDataLoadDTO(DataLoadDTO dataLoadDTO) {
|
||||
this.dataLoadDTO = dataLoadDTO;
|
||||
}
|
||||
|
||||
public void setCmSelectDao(CmSelectDao cmSelectDao) {
|
||||
this.cmSelectDao = cmSelectDao;
|
||||
}
|
||||
|
||||
public void setIcSelectDao(IcSelectDao icSelectDao) {
|
||||
this.icSelectDao = icSelectDao;
|
||||
}
|
||||
|
||||
public void setQueMB(QueueManageBean queMB) {
|
||||
this.queMB = queMB;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,227 +0,0 @@
|
|||
package kr.gmtc.gw.standstatus.controller;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.gw.comp.rest.vo.RestServiceHeader;
|
||||
import kr.gmtc.gw.comp.rest.vo.RestServiceVO;
|
||||
import kr.gmtc.gw.comp.rest.vo.RestServiceData;
|
||||
import kr.gmtc.gw.standstatus.utils.CmmnUtil;
|
||||
|
||||
@RestController
|
||||
public class StandSttusServiceController {
|
||||
|
||||
protected Logger logger;
|
||||
protected ObjectMapper mapper;
|
||||
|
||||
@Resource(name = "serviceList")
|
||||
public Map<Integer, LinkedList<RestServiceData>> serviceList;
|
||||
|
||||
@Resource(name = "serviceRunnig")
|
||||
private boolean serviceRunnig = false;
|
||||
|
||||
@Value("${rest.service.queueCount}")
|
||||
private Integer scvQcount;
|
||||
|
||||
@Value("${rest.service.serviceCount}")
|
||||
private Integer scvDatacount;
|
||||
|
||||
@Resource(name = "testStandStsMap")
|
||||
HashMap<String, String> testStandStsMap;
|
||||
|
||||
@Resource(name = "testStandStsMapAI")
|
||||
HashMap<String, String[]> testStandStsMapAI;
|
||||
|
||||
private RestServiceVO restServiceVO;
|
||||
|
||||
DateTimeFormatter dfPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
|
||||
public StandSttusServiceController(){
|
||||
logger = LoggerFactory.getLogger(this.getClass());
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getStandStatus/{qid}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> getASDE( @PathVariable Integer qid) {
|
||||
|
||||
int qidx = qid -1;
|
||||
String sRetJsonData = "";
|
||||
|
||||
synchronized(serviceList.get(qidx)){
|
||||
sRetJsonData = makeServiceData(qidx, serviceList.get(qidx));
|
||||
}
|
||||
|
||||
|
||||
return ResponseEntity.ok(sRetJsonData);
|
||||
}
|
||||
|
||||
|
||||
private String makeServiceData(int queIdx, Queue<RestServiceData> procQue){
|
||||
|
||||
String sendCode, sendMsg ;
|
||||
RestServiceHeader jsonHeader = new RestServiceHeader();
|
||||
List<RestServiceData> jsonData = new ArrayList<RestServiceData>();
|
||||
|
||||
sendCode = "200";
|
||||
sendMsg = "----------------------------------------------------------------------------------------------------";
|
||||
|
||||
restServiceVO = new RestServiceVO();
|
||||
|
||||
int qTotalSize = procQue.size();
|
||||
int qSize = qTotalSize;
|
||||
|
||||
if(qSize > scvDatacount) qSize = scvDatacount;
|
||||
|
||||
if(queIdx > scvQcount -1 || queIdx < 0) {
|
||||
sendCode = "Err-01";
|
||||
sendMsg = "할당되지 않은 큐를 지정했습니다.";
|
||||
logger.error(sendMsg);
|
||||
}else {
|
||||
//if(procQue.peek() == null) {
|
||||
if(qSize <= 0) {
|
||||
sendCode = "200";
|
||||
sendMsg = "전송할 데이터 없음.";
|
||||
// logger.error("procQue size" + " / " + procQue.size());
|
||||
}else{
|
||||
|
||||
serviceRunnig = true;
|
||||
|
||||
while (qSize > 0 ) {
|
||||
|
||||
RestServiceData data = procQue.poll();
|
||||
|
||||
if( data != null){
|
||||
jsonData.add(data);
|
||||
}
|
||||
|
||||
qSize--;
|
||||
}
|
||||
|
||||
serviceRunnig = false ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
jsonHeader.setResult_code(sendCode);
|
||||
jsonHeader.setResult_msg(sendMsg);
|
||||
|
||||
restServiceVO.setHeader(jsonHeader);
|
||||
|
||||
if (sendCode.equals("200")) {
|
||||
|
||||
restServiceVO.setData(jsonData);
|
||||
|
||||
logger.info("Que["+(queIdx + 1)+"] service count :" + jsonData.size() + "/" + qTotalSize);
|
||||
}
|
||||
|
||||
String sRetJsonData = "";
|
||||
|
||||
try {
|
||||
sRetJsonData = mapper.writeValueAsString(restServiceVO);
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.error("[AsdeServiceController] makeServiceData-JsonProcessingException : " + CmmnUtil.getStatckTrace(e));
|
||||
}
|
||||
|
||||
return sRetJsonData;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value={"setStandSts/{stadNo}/{sid}"}, method=RequestMethod.GET)
|
||||
public String setStandSts(@PathVariable String stadNo, @PathVariable String sid) throws Exception {
|
||||
|
||||
String sStandNo, sSID ;
|
||||
String retValue = "";
|
||||
|
||||
sStandNo = stadNo;
|
||||
sSID = sid;
|
||||
|
||||
if(Integer.parseInt(sSID) < 1 || Integer.parseInt(sSID) > 8) {
|
||||
retValue = "Err: 주기장 상태의 범위는 1 ~ 6까지 입니다." ;
|
||||
return retValue;
|
||||
}
|
||||
|
||||
testStandStsMap.put(sStandNo, sSID);
|
||||
|
||||
for ( String stand : testStandStsMap.keySet() ) {
|
||||
retValue = retValue + "StandNO : " + stand +", Status : " + testStandStsMap.get(stand) + " <br>" ;
|
||||
}
|
||||
|
||||
//gateStatusService.gateStatusSchedule();
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@RequestMapping(value={"setStandStsAI/{stadNo}/{sid}/{sAiSts}"}, method=RequestMethod.GET)
|
||||
public String setStandStsAI(@PathVariable String stadNo, @PathVariable String sid, @PathVariable String[] sAiSts) throws Exception {
|
||||
|
||||
String sStandNo, sSID ;
|
||||
String retValue = "";
|
||||
String[] arrAiSts = {"N", "N", "N", "Y", "N"};
|
||||
|
||||
sStandNo = stadNo;
|
||||
sSID = sid;
|
||||
|
||||
if(sid.equals("0")){
|
||||
|
||||
}else{
|
||||
if(Integer.parseInt(sSID) < 1 || Integer.parseInt(sSID) > 8) {
|
||||
retValue = "Err: 주기장 상태의 범위는 1 ~ 6까지 입니다." ;
|
||||
return retValue;
|
||||
}
|
||||
|
||||
testStandStsMap.put(sStandNo, sSID);
|
||||
|
||||
for ( String stand : testStandStsMap.keySet() ) {
|
||||
retValue = retValue + "StandNO : " + stand +", Status : " + testStandStsMap.get(stand) + " <br>" ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(sAiSts == null ) sAiSts = arrAiSts;
|
||||
|
||||
testStandStsMapAI.put(sStandNo, sAiSts);
|
||||
|
||||
for ( String stand : testStandStsMapAI.keySet() ) {
|
||||
retValue = retValue + "AI Status StandNO : " + stand +", Status : " + Arrays.deepToString( testStandStsMapAI.get(stand)) + " <br>" ;
|
||||
}
|
||||
|
||||
//gateStatusService.gateStatusSchedule();
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@GetMapping("/setTestClear")
|
||||
public String getStandStatus() throws Exception {
|
||||
|
||||
testStandStsMap.clear();
|
||||
testStandStsMapAI.clear();
|
||||
//gateStatusService.gateStatusSchedule();
|
||||
|
||||
return "Test Map Clear.";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package kr.gmtc.gw.standstatus.database.dto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
|
@ -15,4 +16,13 @@ public class DataLoadDTO {
|
|||
private List<DataLoadHashMap> db_CMMN_CT019;
|
||||
private List<DataLoadHashMap> db_CMMN_CT038;
|
||||
|
||||
public DataLoadDTO() {
|
||||
|
||||
this.db_CctvList = new ArrayList<DataLoadHashMap>();
|
||||
this.db_FltDep = new ArrayList<DataLoadHashMap>();
|
||||
this.db_FltArr = new ArrayList<DataLoadHashMap>();
|
||||
this.db_CMMN_CT019 = new ArrayList<DataLoadHashMap>();
|
||||
this.db_CMMN_CT038 = new ArrayList<DataLoadHashMap>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package kr.gmtc.gw.standstatus.kafka.consummer;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -16,6 +17,7 @@ import org.springframework.stereotype.Service;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmt.so.state.StateManager;
|
||||
import kr.gmtc.gw.standstatus.config.QueueManageBean;
|
||||
import kr.gmtc.gw.standstatus.kafka.vo.AiVideoMetaData;
|
||||
import kr.gmtc.gw.standstatus.kafka.vo.KafkaRequestVo;
|
||||
|
||||
|
@ -25,8 +27,12 @@ public class KafkaMessageListener {
|
|||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private final ObjectMapper objMapper = new ObjectMapper();
|
||||
|
||||
@Resource(name = "recvVideoQ")
|
||||
LinkedBlockingQueue<AiVideoMetaData> recvVideoQ;
|
||||
// @Resource(name = "recvVideoQ")
|
||||
// LinkedBlockingQueue<AiVideoMetaData> recvVideoQ;
|
||||
|
||||
@Resource(name = "queueManageBean")
|
||||
private QueueManageBean queMB;
|
||||
|
||||
|
||||
@Autowired
|
||||
private StateManager stateMgr;
|
||||
|
@ -40,7 +46,8 @@ public class KafkaMessageListener {
|
|||
if (message != null) {
|
||||
|
||||
KafkaRequestVo vo = objMapper.readValue(message, KafkaRequestVo.class);
|
||||
recvVideoQ.add(vo.getData());
|
||||
//recvVideoQ.add(vo.getData());
|
||||
queMB.getQRecvVideo().offer((ArrayList<AiVideoMetaData>) vo.getData());
|
||||
|
||||
}
|
||||
} catch(Exception e) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
|
||||
import kr.gmt.so.state.StateManager;
|
||||
import kr.gmtc.gw.comp.rest.vo.RestServiceData;
|
||||
import kr.gmtc.gw.standstatus.config.QueueManageBean;
|
||||
import kr.gmtc.gw.standstatus.kafka.vo.KafkaServiceData;
|
||||
import kr.gmtc.gw.standstatus.kafka.vo.KafkaServiceVO;
|
||||
import kr.gmtc.gw.standstatus.kafka.vo.ResponsHeader;
|
||||
|
@ -29,11 +30,25 @@ public class KafkaProduceStandSttus {
|
|||
|
||||
protected Logger logger;
|
||||
|
||||
@Autowired
|
||||
@Autowired
|
||||
private KafkaTemplate<String, String> kafkaTemplateString;
|
||||
|
||||
@Resource(name = "serviceList")
|
||||
public Map<Integer, LinkedList<RestServiceData>> serviceList;
|
||||
// @Resource(name = "serviceList")
|
||||
// public Map<Integer, LinkedList<RestServiceData>> serviceList;
|
||||
|
||||
@Resource(name = "queueManageBean")
|
||||
private QueueManageBean queMB;
|
||||
|
||||
|
||||
private boolean sendRunnig = false;
|
||||
|
||||
public boolean isSendRunnig() {
|
||||
return sendRunnig;
|
||||
}
|
||||
|
||||
public void setSendRunnig(boolean sendRunnig) {
|
||||
this.sendRunnig = sendRunnig;
|
||||
}
|
||||
|
||||
@Value("${kafka.message.topic.send.sttus}")
|
||||
private String topicStandSttus;
|
||||
|
@ -58,10 +73,10 @@ public class KafkaProduceStandSttus {
|
|||
|
||||
if(stateMgr.isActive()){
|
||||
|
||||
logger.info("************************** serviceList Count : " + serviceList.get(2).size());
|
||||
logger.info("************************** serviceList Count : " + queMB.getServiceList().size());
|
||||
|
||||
if(serviceList.get(2).size() > 0){
|
||||
sRetJsonData = makeServiceData(serviceList.get(2));
|
||||
if(queMB.getServiceList().size() > 0){
|
||||
sRetJsonData = makeServiceData(queMB.getServiceList());
|
||||
}
|
||||
|
||||
if(sRetJsonData != null && !sRetJsonData.equals("")){
|
||||
|
@ -82,14 +97,16 @@ public class KafkaProduceStandSttus {
|
|||
sendMsg = "";
|
||||
|
||||
kafkaServiceVO = new KafkaServiceVO();
|
||||
|
||||
|
||||
for( RestServiceData data : procQue ){
|
||||
|
||||
KafkaServiceData cnvData = new KafkaServiceData();
|
||||
cnvData.setStand_no(data.getStand_no());
|
||||
cnvData.setClsgn(data.getClsgn());
|
||||
cnvData.setSchdul_id(data.getSchdul_id());
|
||||
cnvData.setAc_reg_no(data.getAc_reg_no());
|
||||
cnvData.setStand_sttus_ty(data.getAiStandSttus());
|
||||
cnvData.setAircraft_sttus_ty(data.getStand_sttus_ty());
|
||||
cnvData.setAircraft_sttus_ty(data.getAircraft_sttus_ty());
|
||||
|
||||
jsonData.add(cnvData);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import kr.gmtc.gw.standstatus.component.AnalysisAlarmStatus;
|
|||
import kr.gmtc.gw.standstatus.vo.AlarmMsgVO;
|
||||
|
||||
|
||||
@Component
|
||||
//@Component
|
||||
public class KafkaProduceSttusAlaram {
|
||||
protected Logger logger;
|
||||
|
||||
|
@ -34,9 +34,6 @@ public class KafkaProduceSttusAlaram {
|
|||
@Autowired
|
||||
private AnalysisAlarmStatus makeAlamMsgService;
|
||||
|
||||
@Resource(name = "serviceList")
|
||||
public Map<Integer, LinkedList<RestServiceData>> serviceList;
|
||||
|
||||
@Value("${kafka.message.topic.send.alarm}")
|
||||
private String topicStandSttus;
|
||||
|
||||
|
@ -52,11 +49,14 @@ public class KafkaProduceSttusAlaram {
|
|||
//private KafkaServiceVO kafkaServiceVO;
|
||||
@Resource(name = "alamMsgQ")
|
||||
Queue<AlarmMsgVO> alamMsgQ;
|
||||
|
||||
@Resource(name = "serviceRunnig")
|
||||
private boolean serviceRunnig = false;
|
||||
|
||||
@Scheduled(fixedDelay = 1000, initialDelay = 1000)
|
||||
public void sendMessage() {
|
||||
|
||||
if(stateMgr.isActive()){
|
||||
if(stateMgr.isActive() && serviceRunnig){
|
||||
|
||||
logger.info("************************** alamMsgQ Count : " + alamMsgQ.size());
|
||||
|
||||
|
@ -71,5 +71,22 @@ public class KafkaProduceSttusAlaram {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Queue<AlarmMsgVO> getAlamMsgQ() {
|
||||
return alamMsgQ;
|
||||
}
|
||||
|
||||
public void setAlamMsgQ(Queue<AlarmMsgVO> alamMsgQ) {
|
||||
this.alamMsgQ = alamMsgQ;
|
||||
}
|
||||
|
||||
public boolean isServiceRunnig() {
|
||||
return serviceRunnig;
|
||||
}
|
||||
|
||||
public void setServiceRunnig(boolean serviceRunnig) {
|
||||
this.serviceRunnig = serviceRunnig;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package kr.gmtc.gw.standstatus.kafka.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
|
@ -15,6 +18,10 @@ public class KafkaRequestVo {
|
|||
private ResponsHeader header;
|
||||
|
||||
@JsonProperty("data")
|
||||
private AiVideoMetaData data;
|
||||
private List<AiVideoMetaData> data;
|
||||
|
||||
public KafkaRequestVo(){
|
||||
this.data = new ArrayList<AiVideoMetaData>();
|
||||
}
|
||||
|
||||
}
|
|
@ -11,7 +11,9 @@ public class KafkaServiceData {
|
|||
|
||||
private String stand_no;
|
||||
private String clsgn;
|
||||
private AiAnalyzeStandSttus stand_sttus_ty;
|
||||
private String schdul_id;
|
||||
private String ac_reg_no;
|
||||
private String aircraft_sttus_ty;
|
||||
private AiAnalyzeStandSttus stand_sttus_ty;
|
||||
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
package kr.gmtc.gw.standstatus.service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
@ -24,6 +27,9 @@ public class DataLoadService {
|
|||
// @Resource(name = "icSelectDao")
|
||||
private IcSelectDao icSelectDao;
|
||||
|
||||
|
||||
|
||||
|
||||
private CustomThread threadLoadCctvList;
|
||||
private CustomThread threadLoadFlt;
|
||||
|
||||
|
@ -40,11 +46,13 @@ public class DataLoadService {
|
|||
}
|
||||
|
||||
public void initialize() {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
threadLoadCctvList = new CustomThread("loadCctvList", this, CustomThread.NO_SLEEP, this::loadCctvList, null, false);
|
||||
threadLoadCctvList = new CustomThread("loadCctvList", this, 600000, this::loadCctvList, null, false);
|
||||
|
||||
threadLoadFlt = new CustomThread("loadArcftFlt", this, CustomThread.NO_SLEEP, this::loadArcftFltSchedule, null, false);
|
||||
threadLoadFlt = new CustomThread("loadArcftFlt", this, 30000, this::loadArcftFltSchedule, null, false);
|
||||
|
||||
} catch (Exception e) {
|
||||
// logger.writeLevelLog("[MainController] Prepare Fail " + e.getMessage(), LogLevelType.LOG_ERROR, "AllLog");
|
||||
|
@ -67,7 +75,7 @@ public class DataLoadService {
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void loadCctvList() throws InterruptedException{
|
||||
private void loadCctvList(){
|
||||
|
||||
List<DataLoadHashMap> db_CctvList = cmSelectDao.selectCctv_List();
|
||||
|
||||
|
@ -78,7 +86,7 @@ public class DataLoadService {
|
|||
logger.info("cctv load Count:" + db_CctvList.size());
|
||||
}
|
||||
|
||||
Thread.sleep(600000);
|
||||
// Thread.sleep(600000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,7 +95,23 @@ public class DataLoadService {
|
|||
dataLoadDTO.setDb_FltDep(icSelectDao.select_flt_dep());
|
||||
dataLoadDTO.setDb_FltArr(icSelectDao.select_flt_arr());
|
||||
|
||||
Thread.sleep(30000);
|
||||
//Thread.sleep(30000);
|
||||
}
|
||||
|
||||
public IcSelectDao getIcSelectDao() {
|
||||
return icSelectDao;
|
||||
}
|
||||
|
||||
/*
|
||||
년(yyyy)+월(mm)+일(dd)+시(hh24)+분(mi)+초(ss)+밀리초(잘자)+SEQ(000~999)
|
||||
예시)20230607153520123001
|
||||
*/
|
||||
public String MakeAnalsId() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||
Date now = new Date();
|
||||
int seq = icSelectDao.getAnalsIdSeq();
|
||||
String nSeq = String.format("%03d", seq);
|
||||
return sdf.format(now) + nSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package kr.gmtc.gw.standstatus.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class StandSttusVO {
|
||||
|
||||
private String cctv_id;
|
||||
private String stand_no;
|
||||
private AiAnalyzeStandSttus aiStandSttus;
|
||||
private String stand_sttus_ty;
|
||||
|
||||
public StandSttusVO(){
|
||||
this.aiStandSttus = new AiAnalyzeStandSttus();
|
||||
}
|
||||
|
||||
public StandSttusVO(String stand_no, String cctv_id){
|
||||
this.stand_no = stand_no;
|
||||
this.cctv_id = cctv_id;
|
||||
this.aiStandSttus = new AiAnalyzeStandSttus();
|
||||
}
|
||||
|
||||
}
|
|
@ -2,8 +2,7 @@ spring:
|
|||
profiles:
|
||||
active: default
|
||||
group:
|
||||
default:
|
||||
- winTest
|
||||
default: winTest
|
||||
|
||||
---
|
||||
spring:
|
||||
|
@ -14,43 +13,6 @@ spring:
|
|||
server:
|
||||
port: 18083
|
||||
|
||||
rest:
|
||||
service:
|
||||
queueCount: 3
|
||||
serviceCount: 5000
|
||||
clearQ:
|
||||
maxCount: 20000 # 1만건
|
||||
diffTime: 10000 # 10 sec
|
||||
clearTime: 60000 # milli-Sec, 1분
|
||||
|
||||
state:
|
||||
# 공통코드 CT001의 코드 6자리
|
||||
id: IC0302 # 주기장 상태 분석
|
||||
# 1:Primary, 2:Secondary
|
||||
type: Primary
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: real
|
||||
|
||||
root: /home/gmt/app/EyeGW_AsdeRecv
|
||||
|
||||
state:
|
||||
# 공통코드 CT001의 코드 6자리
|
||||
id: IC0302 # 주기장 상태 분석
|
||||
# 1:Primary, 2:Secondary
|
||||
type: Primary
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: winTest
|
||||
|
||||
root: D:\Workspace\Odroid_repository\EyeGW_Dev
|
||||
|
||||
state:
|
||||
# 공통코드 CT001의 코드 6자리
|
||||
id: IC0302 # 주기장 상태 분석
|
||||
|
@ -86,40 +48,38 @@ kafka:
|
|||
send:
|
||||
sttus: ic.analyze.stand.status
|
||||
alarm: ic.analyze.alarm
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: devServer
|
||||
on-profile: real
|
||||
|
||||
root: D:\Workspace\Odroid_repository\EyeGW_Dev
|
||||
state:
|
||||
# 공통코드 CT001의 코드 6자리
|
||||
id: IC0302 # 주기장 상태 분석
|
||||
# 1:Primary, 2:Secondary
|
||||
type: Primary
|
||||
|
||||
database:
|
||||
db1:
|
||||
datasource:
|
||||
driver-class-name: com.tmax.tibero.jdbc.TbDriver
|
||||
jdbcUrl: jdbc:tibero:thin:@118.220.143.174:18629:SACP_T_DB
|
||||
username: ucm
|
||||
password: ucm
|
||||
db2:
|
||||
datasource:
|
||||
driver-class-name: com.tmax.tibero.jdbc.TbDriver
|
||||
jdbcUrl: jdbc:tibero:thin:@118.220.143.174:18629:SACP_T_DB
|
||||
username: uic
|
||||
password: uic
|
||||
# on-profile: real... END
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: winTest
|
||||
|
||||
state:
|
||||
# 공통코드 CT001의 코드 6자리
|
||||
id: TEST01 # 주기장 상태 분석
|
||||
# 1:Primary, 2:Secondary
|
||||
type: Primary
|
||||
|
||||
kafka:
|
||||
settings:
|
||||
bootstrapAddress: 118.220.143.175:9091,118.220.143.176:9091,118.220.143.176:9092
|
||||
consumer:
|
||||
group-id: EyeANA_StandStatus
|
||||
producer:
|
||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
|
||||
message:
|
||||
topic:
|
||||
recv:
|
||||
video: ai.analyze.video
|
||||
send:
|
||||
sttus: ic.analyze.stand.status
|
||||
alarm: ic.analyze.alarm
|
||||
sttus: ic.analyze.stand.status_test
|
||||
alarm: ic.analyze.alarm_test
|
||||
# on-profile: winTest... END
|
|
@ -90,10 +90,10 @@
|
|||
<appender-ref ref="FILE"/>
|
||||
</logger>
|
||||
|
||||
<logger name="kr.gmt.so" level="INFO">
|
||||
<!-- <logger name="kr.gmt.so" level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</logger>
|
||||
</logger> -->
|
||||
|
||||
<!-- <logger name="kr.gmtc.comp.status" level="TRACE">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
|
|
Loading…
Reference in New Issue