main
MonHun 2024-06-05 18:04:12 +09:00
parent b8f1d00a87
commit 8fc70e4499
12 changed files with 135 additions and 23 deletions

View File

@ -3,9 +3,11 @@ package kr.gmtc.gw.comp.rest.vo;
import kr.gmtc.gw.standstatus.vo.AiAnalyzeStandSttus;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class RestServiceData {
private String cctv_id;

View File

@ -4,20 +4,16 @@ 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;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import kr.gmt.so.state.StateManager;
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;
@ -25,7 +21,6 @@ import kr.gmtc.gw.standstatus.database.dto.DataLoadDTO;
import kr.gmtc.gw.standstatus.database.dto.DataLoadHashMap;
import kr.gmtc.gw.standstatus.kafka.vo.AiVideoMetaData;
import kr.gmtc.gw.standstatus.vo.AiAnalyzeStandSttus;
import kr.gmtc.gw.standstatus.vo.AlarmMsgVO;
public class AnalysisStandStatus {
@ -133,18 +128,20 @@ public class AnalysisStandStatus {
AiAnalyzeStandSttus aiStandSttus;
int queSize = qRecvVideo.size();
int imapCnt = 0;
for(int idx = 0; idx<queSize; idx++){
//AiVideoMetaData lcData = qRecvVideo.poll();
//AiVideoMetaData lcData = qRecvVideo.take();
imapCnt = 0;
List<AiVideoMetaData> lcDataList = qRecvVideo.take();
for( AiVideoMetaData lcData : lcDataList ){
if(lcData.getCc_id().equals("123")){
String adsf = "adf";
}
// if(lcData.getCc_id().equals("123")){
// String adsf = "adf";
// }
imapCnt++;
aiStandSttus = new AiAnalyzeStandSttus();
@ -158,6 +155,8 @@ public class AnalysisStandStatus {
}
logger.info("AI메타정보 주기장 매핑 :" + imapCnt + " 건");
// 주기장 항공기 상태 초기화
//map_stand_sttus.get(lcData.getCc_id()).setAircraft_sttus_ty("0");
@ -187,6 +186,9 @@ public class AnalysisStandStatus {
// 서비스큐 데이터 적재
store_Service_Data();
Thread.sleep(300);
}
@ -305,9 +307,9 @@ public class AnalysisStandStatus {
continue;
}
if(sCctv.equals("107")){
String asdf = "asdfasdf";
}
// if(sCctv.equals("107")){
// String asdf = "asdfasdf";
// }
String sRecvTime = _mfltdep.getItemString("EXP_STAND_OFF_DT");
sRecvTime = sRecvTime.concat("00.000");
@ -359,7 +361,7 @@ public class AnalysisStandStatus {
}
// if(idx > 0 ) logger.info("출발 주기장 :" + (idx +1) + "건 갱신" );
if(idx > 0 ) logger.info("푸시백 준비 현황 :" + (idx +1) + "건 갱신" );
return idx;
}
@ -377,6 +379,8 @@ public class AnalysisStandStatus {
// serviceList.get(qi).addAll(valueList);
// }
//logger.info("푸시백 준비 현황 :" + valueList.toString() );
serviceList.clear();
serviceList.addAll(valueList);

View File

@ -0,0 +1,52 @@
package kr.gmtc.gw.standstatus.config;
import java.util.HashMap;
import java.util.LinkedHashMap;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import kr.gmtc.gw.standstatus.database.dto.DataLoadDTO;
@Configuration("appConfig")
public class AppConfig {
@Value("${spring.profiles.group.default}")
private String gsProfile;
@Value("${kafka.consumer.group-id}")
private String gskafkaConsumeGroup;
@Value("${kafka.message.topic.recv.video}")
private String gskafkaTopicRecvVideo;
@Value("${kafka.message.topic.send.sttus}")
private String gskafkaTopicSendSttus;
@Value("${kafka.message.topic.send.alarm}")
private String gskafkaTopicSendAlarm;
@Bean(name = "dataLoadDTO")
public DataLoadDTO dataLoadDTO(){
return new DataLoadDTO();
}
@Bean(name = "queueManageBean")
public QueueManageBean queueManageBean(){
return new QueueManageBean();
}
@Bean(name = "testStandStsMap")
public HashMap<String, String> testStandStsMap(){
return new LinkedHashMap<String, String>();
}
@Bean(name = "testStandStsMapAI")
public HashMap<String, String[]> testStandStsMapAI(){
return new LinkedHashMap<String, String[]>();
}
}

View File

@ -42,10 +42,12 @@ public class KafkaMessageListener {
if(stateMgr.isActive()){
KafkaRequestVo vo = null;
try {
if (message != null) {
KafkaRequestVo vo = objMapper.readValue(message, KafkaRequestVo.class);
vo = objMapper.readValue(message, KafkaRequestVo.class);
//recvVideoQ.add(vo.getData());
queMB.getQRecvVideo().offer((ArrayList<AiVideoMetaData>) vo.getData());
@ -53,6 +55,8 @@ public class KafkaMessageListener {
} catch(Exception e) {
logger.error(e.getMessage());
}
logger.info("AI영상메타정보 수신 1건" );
}

View File

@ -1,6 +1,8 @@
package kr.gmtc.gw.standstatus.kafka.producer;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@ -73,7 +75,7 @@ public class KafkaProduceStandSttus {
if(stateMgr.isActive()){
logger.info("************************** serviceList Count : " + queMB.getServiceList().size());
//logger.info("************************** serviceList Count : " + queMB.getServiceList().size());
if(queMB.getServiceList().size() > 0){
sRetJsonData = makeServiceData(queMB.getServiceList());
@ -114,6 +116,12 @@ public class KafkaProduceStandSttus {
jsonHeader.setResult_code(sendCode);
jsonHeader.setResult_msg(sendMsg);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date now = new Date();
jsonHeader.setSend_tm(sdf.format(now));
kafkaServiceVO.setHeader(jsonHeader);
if (sendCode.equals("200")) {
@ -131,6 +139,8 @@ public class KafkaProduceStandSttus {
logger.error("makeServiceData-JsonProcessingException : " + e);
}
logger.info("주기장 내 현황 분석 결과 전송:" + kafkaServiceVO.getData().size() + "건 / Kafka 전송 Header : " + kafkaServiceVO.toHeaderString());
return sRetJsonData;
}

View File

@ -8,9 +8,11 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
@JsonPropertyOrder({ "result_code", "result_msg" })
public class KafkaRequestVo {

View File

@ -11,4 +11,10 @@ public class KafkaServiceVO {
private ResponsHeader header;
private List<KafkaServiceData> data;
public String toHeaderString() {
return header.toString();
}
}

View File

@ -54,6 +54,12 @@ public class ResponsHeader implements Serializable {
this.send_tm = send_tm;
}
@Override
public String toString() {
return "[result_code=" + result_code + ", result_msg=" + result_msg + ", send_tm=" + send_tm
+ "]";
}
}

View File

@ -83,7 +83,7 @@ public class DataLoadService {
logger.error("cctv load fail");
}else{
dataLoadDTO.setDb_CctvList(db_CctvList);
logger.info("cctv load Count:" + db_CctvList.size());
logger.info("주기장(CCTV설치) 조회:" + db_CctvList.size() + "건");
}
// Thread.sleep(600000);
@ -95,7 +95,8 @@ public class DataLoadService {
dataLoadDTO.setDb_FltDep(icSelectDao.select_flt_dep());
dataLoadDTO.setDb_FltArr(icSelectDao.select_flt_arr());
//Thread.sleep(30000);
logger.info("항공기 스케줄 조회: 도착 " + dataLoadDTO.getDb_FltArr().size() + "건 / "+ "출발 " + dataLoadDTO.getDb_FltDep().size() + "건");
}
public IcSelectDao getIcSelectDao() {

View File

@ -0,0 +1,25 @@
package kr.gmtc.gw.standstatus.vo;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Delete_StandSttusVO {
private String cctv_id;
private String stand_no;
private AiAnalyzeStandSttus aiStandSttus;
private String stand_sttus_ty;
public Delete_StandSttusVO(){
this.aiStandSttus = new AiAnalyzeStandSttus();
}
public Delete_StandSttusVO(String stand_no, String cctv_id){
this.stand_no = stand_no;
this.cctv_id = cctv_id;
this.aiStandSttus = new AiAnalyzeStandSttus();
}
}

View File

@ -46,8 +46,8 @@ kafka:
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
---
spring: