win 0628
parent
dfeb99b2de
commit
8d592a310c
Binary file not shown.
Binary file not shown.
|
@ -12,7 +12,7 @@
|
|||
<artifactId>tss</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>TSS</name>
|
||||
<description>TSS Integrate</description>
|
||||
<description>EyeAPN TSS</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<!-- versions -->
|
||||
|
@ -56,7 +56,7 @@
|
|||
<artifactId>state-spring-boot-starter</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/state-spring-boot-starter-1.0.3.jar</systemPath>
|
||||
<systemPath>${basedir}/lib/state-spring-boot-starter-1.0.5.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ipworks.local</groupId>
|
||||
|
@ -78,7 +78,7 @@
|
|||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>EyeTSS_CctvPtz</finalName>
|
||||
<finalName>EyeAPN_Tss</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -2,10 +2,11 @@ package kr.gmtc.tss;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package kr.gmtc.tss.config;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@Configuration
|
||||
@MapperScan(value = "kr.gmtc.eyesvtss.mapper", sqlSessionFactoryRef = "batchSqlSessionFactory" )
|
||||
@EnableTransactionManagement
|
||||
public class DbConfig {
|
||||
|
||||
@Bean(name = "dbDataSource")
|
||||
@ConfigurationProperties(prefix = "spring.db.datasource")
|
||||
public DataSource db5DataSource() {
|
||||
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Bean(name="batchSqlSessionFactory")
|
||||
public SqlSessionFactory batchSqlSessionFactoryBean(@Qualifier("dbDataSource") DataSource batchDataSource, ApplicationContext applicationContext)
|
||||
throws Exception {
|
||||
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
|
||||
factoryBean.setDataSource(batchDataSource);
|
||||
factoryBean.setConfigLocation(applicationContext.getResource("classpath:/mybatis-config.xml"));
|
||||
return factoryBean.getObject();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +1,12 @@
|
|||
package kr.gmtc.tss.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import kr.gmtc.tss.elkdata.vo.CctvPtzVO;
|
||||
import kr.gmtc.tss.util.ArrayBlockingLoggingQueue;
|
||||
|
||||
@Configuration("TssConfig")
|
||||
|
@ -23,32 +19,20 @@ public class TssConfig {
|
|||
public String consumeGroupId;
|
||||
|
||||
@Value("${file-zip-path}")
|
||||
public String fileZipPath;
|
||||
|
||||
@Value("${file-zip-bak-path}")
|
||||
public String fileZipBakPath;
|
||||
|
||||
@Value("${file-make-time}")
|
||||
public int fileMakeTime;
|
||||
|
||||
@Value("${data-zip-path}")
|
||||
public String dataZipPath;
|
||||
|
||||
@Value("${data-zip-bak-path}")
|
||||
@Value("${file-zip-bak-path}")
|
||||
public String dataZipBakPath;
|
||||
|
||||
@Value("${data-make-time}")
|
||||
@Value("${file-make-time}")
|
||||
public int dataMakeTime;
|
||||
|
||||
// @Value("${flag.database}")
|
||||
// public boolean flagDataBase;
|
||||
@Value("${file-save-days}")
|
||||
public int dataSaveDays;
|
||||
|
||||
@Value("${flag.datafile}")
|
||||
public boolean flagDataFile;
|
||||
|
||||
// @Value("${flag.file}")
|
||||
// public boolean flagFile;
|
||||
|
||||
@Value("${client.queue-count:10000}")
|
||||
public int queueCount=100000;
|
||||
|
||||
|
@ -80,71 +64,33 @@ public class TssConfig {
|
|||
public String logclassification;
|
||||
|
||||
|
||||
public Queue<String> rcvQueue;
|
||||
public Queue<CctvPtzVO> messageBodyQueue;
|
||||
public Map<String, Queue<String>> rcvQueueMap;
|
||||
public Queue<String> dataFileQueue;
|
||||
|
||||
public Queue<CctvPtzVO> trackQueue;
|
||||
|
||||
public Queue<CctvPtzVO> sqlLogTrackQueue;
|
||||
|
||||
public Queue<CctvPtzVO> trackLastQueue;
|
||||
|
||||
public Queue<CctvPtzVO> sqlLogTrackLastQueue;
|
||||
|
||||
|
||||
@Bean(name = "rcvQueue")
|
||||
// @Bean(name = "rcvQueueMap")
|
||||
public Map<String, Queue<String>> getRcvQueueMap() {
|
||||
|
||||
Map<String, Queue<String>> queList = new HashMap<String, Queue<String>>();
|
||||
if(this.rcvQueueMap == null){
|
||||
|
||||
this.rcvQueueMap = new HashMap<String, Queue<String>>();
|
||||
|
||||
for(String swIdx : swclassification){
|
||||
Queue<String> rcvQueue = new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
queList.put(swIdx, rcvQueue);
|
||||
this.rcvQueueMap.put(swIdx, rcvQueue);
|
||||
}
|
||||
}
|
||||
|
||||
return queList;
|
||||
return this.rcvQueueMap;
|
||||
|
||||
}
|
||||
|
||||
@Bean(name = "messageBodyQueue")
|
||||
public Queue<CctvPtzVO> getMessageBodyQueue() {
|
||||
this.messageBodyQueue = new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
return messageBodyQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "dataFileQueue")
|
||||
// @Bean(name = "dataFileQueue")
|
||||
public Queue<String> getDataFileQueue() {
|
||||
|
||||
if(this.dataFileQueue == null ){
|
||||
this.dataFileQueue = new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
return dataFileQueue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Bean(name = "trackQueue")
|
||||
public Queue<CctvPtzVO> getTrackQueue() {
|
||||
this.trackQueue = new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
return trackQueue;
|
||||
return this.dataFileQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "trackLastQueue")
|
||||
public Queue<CctvPtzVO> getTrackLastQueue() {
|
||||
this.trackQueue = new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
return new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
}
|
||||
|
||||
@Bean(name = "sqlLogTrackQueue")
|
||||
public Queue<CctvPtzVO> getSqlLogTrackQueue() {
|
||||
this.trackQueue = new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
return new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
}
|
||||
|
||||
@Bean(name = "sqlLogTrackLastQueue")
|
||||
public Queue<CctvPtzVO> getSqlLogTrackLastQueue() {
|
||||
this.trackQueue = new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
return new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,195 @@
|
|||
package kr.gmtc.tss.elkdata.runnable;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.tss.elkdata.vo.CctvTrackVO;
|
||||
|
||||
public class AiLocationParseRunnable implements Runnable {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
|
||||
private boolean isRunning = false;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
private String classification;
|
||||
private String swclassification;
|
||||
private String logclassification;
|
||||
|
||||
public AiLocationParseRunnable(Queue<String> rcvQueue
|
||||
, Queue<String> dataFileQueue
|
||||
, int listChunkSize
|
||||
, long sleepMillis
|
||||
, String classification, String swclassification, String logclassification) {
|
||||
this.rcvQueue = rcvQueue;
|
||||
this.dataFileQueue = dataFileQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
this.classification = classification;
|
||||
this.swclassification = swclassification;
|
||||
this.logclassification = logclassification;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
|
||||
int loopCnt = 0;
|
||||
if(rcvQueue.size()>listChunkSize) {
|
||||
loopCnt = listChunkSize;
|
||||
}else {
|
||||
loopCnt = rcvQueue.size();
|
||||
}
|
||||
String [] chunkArr = new String[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i] = rcvQueue.poll();
|
||||
}
|
||||
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
parseAndEnqueue(chunkArr[i]);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null) {
|
||||
logger.debug("[ParseTarget] Parsing Error Message : " ,e);
|
||||
} else {
|
||||
logger.info("[ParserThread] Parsing Error Call Stack" ,e);
|
||||
}
|
||||
}
|
||||
|
||||
sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private void parseAndEnqueue(String result) {
|
||||
try {
|
||||
ArrayList<CctvTrackVO> histroyQueue = new ArrayList<CctvTrackVO>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
// LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) convert.get("data");
|
||||
|
||||
logger.info("수신 데이터 변환 건수[" +swclassification + "] {}", list.size());
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
|
||||
String dateTime = dateFormat.format(new Date());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(dateTime); sb.append(",");
|
||||
sb.append(logclassification); sb.append(","); //log구분
|
||||
sb.append(swclassification); sb.append(","); //sw구분
|
||||
sb.append(classification); sb.append("|"); //서버구분
|
||||
int i = 0;
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
CctvTrackVO t = mapper.convertValue(map, CctvTrackVO.class);
|
||||
|
||||
if (i > 0) sb.append("^");
|
||||
|
||||
sb.append(t.getDtctTm()); sb.append(",");
|
||||
sb.append(t.getDtctCls()); sb.append(",");
|
||||
sb.append(t.getMtaTm()); sb.append(",");
|
||||
sb.append(t.getRwTm()); sb.append(",");
|
||||
// sb.append(t.getCcId()); sb.append(",");
|
||||
|
||||
int j = 0;
|
||||
for (String k : t.getCcId()) {
|
||||
if (j > 0) sb.append("@");
|
||||
sb.append(k);
|
||||
j++;
|
||||
}
|
||||
sb.append(",");
|
||||
|
||||
sb.append(t.getZnId()); sb.append(",");
|
||||
sb.append(t.getArcrftTp()); sb.append(",");
|
||||
sb.append(t.getArln()); sb.append(",");
|
||||
sb.append(t.getTrckId().replace(",", "-")); sb.append(",");
|
||||
|
||||
|
||||
j = 0;
|
||||
for (String k : t.getBbTlp()) {
|
||||
if (j > 0) sb.append("@");
|
||||
sb.append(k);
|
||||
j++;
|
||||
}
|
||||
sb.append(",");
|
||||
|
||||
j = 0;
|
||||
for (String k : t.getBbBrp()) {
|
||||
if (j > 0) sb.append("@");
|
||||
sb.append(k);
|
||||
j++;
|
||||
}
|
||||
sb.append(",");
|
||||
|
||||
j = 0;
|
||||
for (String k : t.getCrdFrm()) {
|
||||
if (j > 0) sb.append("@");
|
||||
sb.append(k);
|
||||
j++;
|
||||
}
|
||||
sb.append(",");
|
||||
|
||||
j = 0;
|
||||
for (String k : t.getCrdGlbl()) {
|
||||
if (j > 0) sb.append("@");
|
||||
sb.append(k);
|
||||
j++;
|
||||
}
|
||||
sb.append(",");
|
||||
|
||||
sb.append(t.getDrctn()); sb.append(",");
|
||||
sb.append(t.getArcrftStnd()); sb.append(",");
|
||||
sb.append(t.getSpd());
|
||||
|
||||
i++;
|
||||
histroyQueue.add(t);
|
||||
}
|
||||
|
||||
logger.info("logstash 포맷 변환 건수[" +swclassification + "] {}", histroyQueue.size());
|
||||
|
||||
dataFileQueue.add(sb.toString());
|
||||
|
||||
histroyQueue.clear();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[ParseTargetRunnable] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package kr.gmtc.tss.elkdata.runnable;
|
|||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
@ -14,12 +15,16 @@ import org.slf4j.LoggerFactory;
|
|||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.tss.elkdata.vo.RuteVO;
|
||||
import kr.gmtc.tss.elkdata.vo.RuteVO.MvPoints;
|
||||
import kr.gmtc.tss.elkdata.vo.StatsVO;
|
||||
import kr.gmtc.tss.elkdata.vo.VoiceVo;
|
||||
import kr.gmtc.tss.elkdata.vo.VoiceVo.VoiceKeyword;
|
||||
import kr.gmtc.tss.elkdata.vo.VoiceVo.VoiceReadback;
|
||||
|
||||
|
||||
public class AiVoiceMetaRunnable implements Runnable {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private Logger logger_sts = LoggerFactory.getLogger("STATS");
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
|
@ -83,13 +88,15 @@ public class AiVoiceMetaRunnable implements Runnable {
|
|||
|
||||
private void parseAndEnqueue(String result) {
|
||||
try {
|
||||
ArrayList<RuteVO> histroyQueue = new ArrayList<RuteVO>();
|
||||
ArrayList<VoiceVo> histroyQueue = new ArrayList<VoiceVo>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
|
||||
logger.info("수신 데이터 변환 건수 {}", list.size());
|
||||
logger.info("수신 데이터 변환 건수[" +swclassification + "] {}", list.size());
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
|
||||
String dateTime = dateFormat.format(new Date());
|
||||
|
@ -100,36 +107,101 @@ public class AiVoiceMetaRunnable implements Runnable {
|
|||
sb.append(logclassification); sb.append(","); //log구분
|
||||
sb.append(swclassification); sb.append(","); //sw구분
|
||||
sb.append(classification); sb.append("|"); //서버구분
|
||||
|
||||
String dateRecv = "";
|
||||
|
||||
int i = 0;
|
||||
int z = 0;
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
RuteVO t = mapper.convertValue(map, RuteVO.class);
|
||||
VoiceVo t = mapper.convertValue(map, VoiceVo.class);
|
||||
|
||||
if (i > 0) sb.append("^");
|
||||
|
||||
sb.append(t.getMv_id()); sb.append(",");
|
||||
sb.append(t.getTrgt_id()); sb.append(",");
|
||||
sb.append(t.getMv_type()); sb.append(",");
|
||||
sb.append(t.getDep_arr_ty()); sb.append(",");
|
||||
sb.append(t.getStarttime()); sb.append(",");
|
||||
sb.append(t.getEndtime()); sb.append(",");
|
||||
sb.append(t.getCom_type()); sb.append(",");
|
||||
sb.append(t.getChannel()); sb.append(",");
|
||||
sb.append(t.getSpeaker()); sb.append(",");
|
||||
sb.append(t.getFacility()); sb.append(",");
|
||||
sb.append(t.getCallsign()); sb.append(",");
|
||||
sb.append(t.getDoc_type()); sb.append(",");
|
||||
sb.append(t.getControl_type()); sb.append(",");
|
||||
|
||||
|
||||
int j = 0;
|
||||
for (MvPoints b : t.getMv_points()) {
|
||||
for (VoiceKeyword row : t.getKeywords()) {
|
||||
if (j > 0) sb.append("$");
|
||||
sb.append(b.toDataFormat());
|
||||
sb.append(row.getKeywordRow());
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
logger.info("logstash 포맷 변환 건수 {}", z++);
|
||||
sb.append(",");
|
||||
|
||||
j = 0;
|
||||
for (VoiceReadback row : t.getReadback()) {
|
||||
if (j > 0) sb.append("$");
|
||||
sb.append(row.getReadbackRow());
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
sb.append(",");
|
||||
sb.append(t.getFrequency()); sb.append(",");
|
||||
sb.append(t.getMedia_name()); sb.append(",");
|
||||
sb.append(t.getText());
|
||||
|
||||
histroyQueue.add(t);
|
||||
|
||||
dateRecv = t.getEndtime();
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
// logger.info("logstash 포맷 변환 건수[" +swclassification + "] {}", histroyQueue.size());
|
||||
|
||||
if(dateRecv == null || dateRecv.equals("")){
|
||||
dateRecv = dateFormat.format(new Date());
|
||||
}else{
|
||||
|
||||
// 1. 포멧 변경
|
||||
// 2. UTC -> KST
|
||||
|
||||
SimpleDateFormat recvDTFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
Date cnvDate = null;
|
||||
|
||||
cnvDate = recvDTFormat.parse(dateRecv);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
|
||||
cal.setTime(cnvDate);
|
||||
cal.add(Calendar.HOUR_OF_DAY, 9);
|
||||
cnvDate = new Date(cal.getTimeInMillis());
|
||||
|
||||
dateRecv = dateFormat.format(cnvDate);
|
||||
}
|
||||
|
||||
StatsVO stsVO = new StatsVO();
|
||||
|
||||
stsVO.setIntrfc_dt(dateRecv);
|
||||
stsVO.setIntrfc_id(swclassification);
|
||||
if(swclassification.equals("6")){
|
||||
stsVO.setIntrfc_nm("VCCS");
|
||||
}else{
|
||||
stsVO.setIntrfc_nm("LTE-A");
|
||||
}
|
||||
|
||||
stsVO.setRecv_co(1);
|
||||
stsVO.setParse_co(histroyQueue.size());
|
||||
|
||||
String sSts = mapper.writeValueAsString(stsVO);
|
||||
|
||||
// 수신 통계 로그
|
||||
logger_sts.info(sSts);
|
||||
|
||||
dataFileQueue.add(sb.toString());
|
||||
|
||||
histroyQueue.clear();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
|
|
|
@ -0,0 +1,186 @@
|
|||
package kr.gmtc.tss.elkdata.runnable;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.tss.elkdata.vo.AsdeTrackVO;
|
||||
import kr.gmtc.tss.elkdata.vo.StatsVO;
|
||||
|
||||
public class AsdeParseRunnable implements Runnable {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private Logger logger_sts = LoggerFactory.getLogger("STATS");
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
|
||||
private boolean isRunning = false;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
private String classification;
|
||||
private String swclassification;
|
||||
private String logclassification;
|
||||
|
||||
public AsdeParseRunnable(Queue<String> rcvQueue
|
||||
, Queue<String> dataFileQueue
|
||||
, int listChunkSize
|
||||
, long sleepMillis
|
||||
, String classification, String swclassification, String logclassification) {
|
||||
this.rcvQueue = rcvQueue;
|
||||
this.dataFileQueue = dataFileQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
this.classification = classification;
|
||||
this.swclassification = swclassification;
|
||||
this.logclassification = logclassification;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
|
||||
int loopCnt = 0;
|
||||
if(rcvQueue.size()>listChunkSize) {
|
||||
loopCnt = listChunkSize;
|
||||
}else {
|
||||
loopCnt = rcvQueue.size();
|
||||
}
|
||||
String [] chunkArr = new String[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i] = rcvQueue.poll();
|
||||
}
|
||||
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
parseAndEnqueue(chunkArr[i]);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null) {
|
||||
logger.debug("[ParseTarget] Parsing Error Message : " ,e);
|
||||
} else {
|
||||
logger.info("[ParserThread] Parsing Error Call Stack" ,e);
|
||||
}
|
||||
}
|
||||
|
||||
sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private void parseAndEnqueue(String result) {
|
||||
try {
|
||||
ArrayList<AsdeTrackVO> histroyQueue = new ArrayList<AsdeTrackVO>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
StatsVO stsVO = new StatsVO();
|
||||
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
//Map<String, Object> data = (Map<String, Object>) convert.get("data");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
|
||||
// logger.info("수신 데이터 변환 건수[" +swclassification + "] {}", list.size());
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
|
||||
String dateTime = dateFormat.format(new Date());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(dateTime); sb.append(",");
|
||||
sb.append(logclassification); sb.append(","); //log구분
|
||||
sb.append(swclassification); sb.append(","); //sw구분
|
||||
sb.append(classification); sb.append("|"); //서버구분
|
||||
|
||||
Date dateRecv = new Date();
|
||||
|
||||
int i = 0;
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
|
||||
AsdeTrackVO a = mapper.convertValue(map, AsdeTrackVO.class);
|
||||
|
||||
if (i > 0) sb.append("^");
|
||||
|
||||
sb.append(a.getTrgtId()); sb.append(",");
|
||||
sb.append(a.getModeScd()); sb.append(",");
|
||||
sb.append(a.getSsrCd()); sb.append(",");
|
||||
sb.append(a.getClsgn()); sb.append(",");
|
||||
sb.append(a.getTailNo()); sb.append(",");
|
||||
sb.append(a.getTrackNo()); sb.append(",");
|
||||
sb.append(a.getRecptnDt()); sb.append(",");
|
||||
sb.append(a.getCatTy()); sb.append(",");
|
||||
sb.append(a.getLat()); sb.append(",");
|
||||
sb.append(a.getLon()); sb.append(",");
|
||||
sb.append(a.getSpd()); sb.append(",");
|
||||
sb.append(a.getCos()); sb.append(",");
|
||||
sb.append(a.getTrgtTy()); sb.append(",");
|
||||
sb.append(a.getAlt());
|
||||
|
||||
histroyQueue.add(a);
|
||||
dateRecv = a.getRecptnDt();
|
||||
i++;
|
||||
}
|
||||
|
||||
// logger.info("logstash 포맷 변환 건수[" +swclassification + "] {}", histroyQueue.size());
|
||||
|
||||
String strRecvDt = dateFormat.format(dateRecv);
|
||||
|
||||
stsVO.setIntrfc_dt(strRecvDt);
|
||||
stsVO.setIntrfc_id(swclassification);
|
||||
stsVO.setIntrfc_nm("ASDE");
|
||||
stsVO.setRecv_co(1);
|
||||
stsVO.setParse_co(histroyQueue.size());
|
||||
|
||||
String sSts = mapper.writeValueAsString(stsVO);
|
||||
// 수신 통계 로그
|
||||
logger_sts.info(sSts);
|
||||
|
||||
dataFileQueue.add(sb.toString());
|
||||
|
||||
|
||||
|
||||
histroyQueue.clear();
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (e.getMessage() != null) {
|
||||
logger.debug("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
logger.debug("",e);
|
||||
} else {
|
||||
logger.debug("[ParserThread] Parsing Error Packet Message :" + result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[ParseTargetRunnable] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -19,20 +19,10 @@ import kr.gmtc.tss.elkdata.vo.CctvPtzVO;
|
|||
|
||||
public class CctvPtzParseRunnable implements Runnable {
|
||||
|
||||
private boolean flagFile;
|
||||
private boolean flagDataBase;
|
||||
private boolean flagDataFile;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<CctvPtzVO> trackQueue;
|
||||
Queue<CctvPtzVO> trackLastQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
Queue<CctvPtzVO> messageBodyQueue;
|
||||
|
||||
private int rcvPos = 0;
|
||||
private int rcvStatic = 0;
|
||||
|
||||
private boolean isRunning = false;
|
||||
private int listChunkSize = 100;
|
||||
|
@ -42,21 +32,15 @@ public class CctvPtzParseRunnable implements Runnable {
|
|||
private String swclassification;
|
||||
private String logclassification;
|
||||
|
||||
public CctvPtzParseRunnable(Queue<String> rcvQueue, Queue<CctvPtzVO> trackQueue, Queue<CctvPtzVO> trackLastQueue
|
||||
, Queue<String> dataFileQueue,Queue<CctvPtzVO> messageBodyQueue
|
||||
, int listChunkSize, long sleepMillis
|
||||
, boolean flagFile, boolean flagDataBase, boolean flagDataFile
|
||||
, String classification, String logclassification) {
|
||||
public CctvPtzParseRunnable(Queue<String> rcvQueue
|
||||
, Queue<String> dataFileQueue
|
||||
, int listChunkSize
|
||||
, long sleepMillis
|
||||
, String classification, String swclassification, String logclassification) {
|
||||
this.rcvQueue = rcvQueue;
|
||||
this.trackQueue = trackQueue;
|
||||
this.trackLastQueue = trackLastQueue;
|
||||
this.dataFileQueue = dataFileQueue;
|
||||
this.messageBodyQueue = messageBodyQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
this.flagFile = flagFile;
|
||||
this.flagDataBase = flagDataBase;
|
||||
this.flagDataFile = flagDataFile;
|
||||
this.classification = classification;
|
||||
this.swclassification = swclassification;
|
||||
this.logclassification = logclassification;
|
||||
|
@ -103,9 +87,11 @@ public class CctvPtzParseRunnable implements Runnable {
|
|||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
|
||||
logger.info("수신 데이터 변환 건수 {}", list.size());
|
||||
logger.info("수신 데이터 변환 건수[" +swclassification + "] {}", list.size());
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
|
||||
String dateTime = dateFormat.format(new Date());
|
||||
|
@ -116,12 +102,11 @@ public class CctvPtzParseRunnable implements Runnable {
|
|||
sb.append(logclassification); sb.append(","); //log구분
|
||||
sb.append(swclassification); sb.append(","); //sw구분
|
||||
sb.append(classification); sb.append("|"); //서버구분
|
||||
|
||||
int i = 0;
|
||||
int z = 0;
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
CctvPtzVO cnvVO = mapper.convertValue(map, CctvPtzVO.class);
|
||||
|
||||
if(flagDataFile) {
|
||||
if (i > 0) sb.append("^");
|
||||
|
||||
sb.append(cnvVO.getCam_id()); sb.append(",");
|
||||
|
@ -130,27 +115,15 @@ public class CctvPtzParseRunnable implements Runnable {
|
|||
sb.append(cnvVO.getTilt()); sb.append(",");
|
||||
sb.append(cnvVO.getZoom());
|
||||
|
||||
logger.info("logstash 포맷 변환 건수 {}", z++);
|
||||
}
|
||||
|
||||
histroyQueue.add(cnvVO);
|
||||
i++;
|
||||
}
|
||||
|
||||
logger.info("logstash 포맷 변환 건수[" +swclassification + "] {}", histroyQueue.size());
|
||||
|
||||
if(flagFile) {
|
||||
messageBodyQueue.addAll(histroyQueue);
|
||||
}
|
||||
|
||||
if(flagDataFile) {
|
||||
dataFileQueue.add(sb.toString());
|
||||
}
|
||||
|
||||
if(flagDataBase) {
|
||||
if (histroyQueue.size() > 0) {
|
||||
trackQueue.addAll(histroyQueue);
|
||||
}
|
||||
}
|
||||
histroyQueue.clear();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
package kr.gmtc.tss.elkdata.runnable;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.tss.elkdata.vo.TrackVO;
|
||||
import kr.gmtc.tss.elkdata.vo.TrackVO.BoundingBox;
|
||||
|
||||
public class FusionParseRunnable implements Runnable {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
|
||||
private boolean isRunning = false;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
private String classification;
|
||||
private String swclassification;
|
||||
private String logclassification;
|
||||
|
||||
public FusionParseRunnable(Queue<String> rcvQueue
|
||||
, Queue<String> dataFileQueue
|
||||
, int listChunkSize
|
||||
, long sleepMillis
|
||||
, String classification, String swclassification, String logclassification) {
|
||||
this.rcvQueue = rcvQueue;
|
||||
this.dataFileQueue = dataFileQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
this.classification = classification;
|
||||
this.swclassification = swclassification;
|
||||
this.logclassification = logclassification;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
|
||||
int loopCnt = 0;
|
||||
if(rcvQueue.size()>listChunkSize) {
|
||||
loopCnt = listChunkSize;
|
||||
}else {
|
||||
loopCnt = rcvQueue.size();
|
||||
}
|
||||
String [] chunkArr = new String[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i] = rcvQueue.poll();
|
||||
}
|
||||
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
parseAndEnqueue(chunkArr[i]);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null) {
|
||||
logger.debug("[ParseTarget] Parsing Error Message : " ,e);
|
||||
} else {
|
||||
logger.info("[ParserThread] Parsing Error Call Stack" ,e);
|
||||
}
|
||||
}
|
||||
|
||||
sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private void parseAndEnqueue(String result) {
|
||||
try {
|
||||
ArrayList<TrackVO> histroyQueue = new ArrayList<TrackVO>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
|
||||
logger.info("수신 데이터 변환 건수[" +swclassification + "] {}", list.size());
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
|
||||
String dateTime = dateFormat.format(new Date());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(dateTime); sb.append(",");
|
||||
sb.append(logclassification); sb.append(","); //log구분
|
||||
sb.append(swclassification); sb.append(","); //sw구분
|
||||
sb.append(classification); sb.append("|"); //서버구분
|
||||
int i = 0;
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
TrackVO t = mapper.convertValue(map, TrackVO.class);
|
||||
|
||||
if (i > 0) sb.append("^");
|
||||
|
||||
sb.append(t.getTargetId()); sb.append(",");
|
||||
sb.append(t.getReceptionDate()); sb.append(",");
|
||||
sb.append(t.getLatitude()); sb.append(",");
|
||||
sb.append(t.getLongitude()); sb.append(",");
|
||||
sb.append(t.getSpeed()); sb.append(",");
|
||||
sb.append(t.getCourse()); sb.append(",");
|
||||
sb.append(t.getTargetType()); sb.append(",");
|
||||
sb.append(t.getCorrectedLatitude()); sb.append(",");
|
||||
sb.append(t.getCorrectedLongitude()); sb.append(",");
|
||||
sb.append(t.getModeSCode()); sb.append(",");
|
||||
sb.append(t.getSsrCode()); sb.append(",");
|
||||
sb.append(t.getCallsign()); sb.append(",");
|
||||
sb.append(t.getTailNumber()); sb.append(",");
|
||||
|
||||
int j = 0;
|
||||
for (BoundingBox b : t.getBbox()) {
|
||||
if (j > 0) sb.append("$");
|
||||
sb.append(b.toDataFormat());
|
||||
|
||||
j++;
|
||||
}
|
||||
sb.append(",");
|
||||
sb.append(t.getAlt()); sb.append(",");
|
||||
sb.append(t.getSchdulId()); sb.append(",");
|
||||
sb.append(t.getIsCntrlzone());
|
||||
|
||||
histroyQueue.add(t);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
logger.info("logstash 포맷 변환 건수[" +swclassification + "] {}", histroyQueue.size());
|
||||
|
||||
dataFileQueue.add(sb.toString());
|
||||
|
||||
histroyQueue.clear();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
|
||||
// e.printStackTrace();
|
||||
// if (e.getMessage() != null) {
|
||||
// logger.debug("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
// logger.debug("",e);
|
||||
// } else {
|
||||
// logger.debug("[ParserThread] Parsing Error Packet Message :" + result);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[ParseTargetRunnable] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,178 @@
|
|||
package kr.gmtc.tss.elkdata.runnable;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.tss.elkdata.vo.RadarTrackVO;
|
||||
import kr.gmtc.tss.elkdata.vo.StatsVO;
|
||||
|
||||
public class RadarParseRunnable implements Runnable {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private Logger logger_sts = LoggerFactory.getLogger("STATS");
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
|
||||
private boolean isRunning = false;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
private String classification;
|
||||
private String swclassification;
|
||||
private String logclassification;
|
||||
|
||||
public RadarParseRunnable(Queue<String> rcvQueue
|
||||
, Queue<String> dataFileQueue
|
||||
, int listChunkSize
|
||||
, long sleepMillis
|
||||
, String classification, String swclassification, String logclassification) {
|
||||
this.rcvQueue = rcvQueue;
|
||||
this.dataFileQueue = dataFileQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
this.classification = classification;
|
||||
this.swclassification = swclassification;
|
||||
this.logclassification = logclassification;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
|
||||
int loopCnt = 0;
|
||||
if(rcvQueue.size()>listChunkSize) {
|
||||
loopCnt = listChunkSize;
|
||||
}else {
|
||||
loopCnt = rcvQueue.size();
|
||||
}
|
||||
String [] chunkArr = new String[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i] = rcvQueue.poll();
|
||||
}
|
||||
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
parseAndEnqueue(chunkArr[i]);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null) {
|
||||
logger.debug("[ParseTarget] Parsing Error Message : " ,e);
|
||||
} else {
|
||||
logger.info("[ParserThread] Parsing Error Call Stack" ,e);
|
||||
}
|
||||
}
|
||||
|
||||
sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private void parseAndEnqueue(String result) {
|
||||
try {
|
||||
ArrayList<RadarTrackVO> histroyQueue = new ArrayList<RadarTrackVO>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
StatsVO stsVO = new StatsVO();
|
||||
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
|
||||
// logger.info("수신 데이터 변환 건수[" +swclassification + "] {}", list.size());
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
|
||||
String dateTime = dateFormat.format(new Date());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(dateTime); sb.append(",");
|
||||
sb.append(logclassification); sb.append(","); //log구분
|
||||
sb.append(swclassification); sb.append(","); //sw구분
|
||||
sb.append(classification); sb.append("|"); //서버구분
|
||||
|
||||
String dateRecv = "";
|
||||
|
||||
int i = 0;
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
RadarTrackVO r = mapper.convertValue(map, RadarTrackVO.class);
|
||||
|
||||
if (i > 0) sb.append("^");
|
||||
|
||||
sb.append(r.getTrgtId()); sb.append(",");
|
||||
sb.append(r.getRecptnDt()); sb.append(",");
|
||||
sb.append(r.getLat()); sb.append(",");
|
||||
sb.append(r.getLon()); sb.append(",");
|
||||
sb.append(r.getSpd()); sb.append(",");
|
||||
sb.append(r.getCos()); sb.append(",");
|
||||
sb.append(r.getDetctCnt()); sb.append(",");
|
||||
sb.append(r.getUndetctCnt());
|
||||
|
||||
histroyQueue.add(r);
|
||||
dateRecv = r.getRecptnDt();
|
||||
i++;
|
||||
}
|
||||
|
||||
// logger.info("logstash 포맷 변환 건수[" +swclassification + "] {}", histroyQueue.size());
|
||||
|
||||
// String strRecvDt = dateFormat.format(dateRecv);
|
||||
|
||||
if(dateRecv == null || dateRecv.equals("")){
|
||||
dateRecv = dateFormat.format(new Date());
|
||||
}
|
||||
|
||||
stsVO.setIntrfc_dt(dateRecv);
|
||||
stsVO.setIntrfc_id(swclassification);
|
||||
stsVO.setIntrfc_nm("RADAR");
|
||||
stsVO.setRecv_co(1);
|
||||
stsVO.setParse_co(histroyQueue.size());
|
||||
|
||||
String sSts = mapper.writeValueAsString(stsVO);
|
||||
|
||||
// 수신 통계 로그
|
||||
logger_sts.info(sSts);
|
||||
|
||||
dataFileQueue.add(sb.toString());
|
||||
|
||||
histroyQueue.clear();
|
||||
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null) {
|
||||
logger.debug("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
logger.debug("",e);
|
||||
} else {
|
||||
logger.debug("[ParserThread] Parsing Error Packet Message :" + result);
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[ParseTargetRunnable] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -19,17 +19,10 @@ import kr.gmtc.tss.elkdata.vo.RuteVO.MvPoints;
|
|||
|
||||
public class RuteParseRunnable implements Runnable {
|
||||
|
||||
private boolean flagFile;
|
||||
private boolean flagDataBase;
|
||||
private boolean flagDataFile;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<RuteVO> trackQueue;
|
||||
Queue<RuteVO> trackLastQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
Queue<RuteVO> messageBodyQueue;
|
||||
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
@ -38,20 +31,15 @@ public class RuteParseRunnable implements Runnable {
|
|||
private String swclassification;
|
||||
private String logclassification;
|
||||
|
||||
public RuteParseRunnable(Queue<String> rcvQueue, Queue<RuteVO> trackQueue, Queue<RuteVO> trackLastQueue
|
||||
, Queue<String> dataFileQueue,Queue<RuteVO> messageBodyQueue, int listChunkSize
|
||||
, long sleepMillis, boolean flagFile, boolean flagDataBase, boolean flagDataFile
|
||||
public RuteParseRunnable(Queue<String> rcvQueue
|
||||
, Queue<String> dataFileQueue
|
||||
, int listChunkSize
|
||||
, long sleepMillis
|
||||
, String classification, String swclassification, String logclassification) {
|
||||
this.rcvQueue = rcvQueue;
|
||||
this.trackQueue = trackQueue;
|
||||
this.trackLastQueue = trackLastQueue;
|
||||
this.dataFileQueue = dataFileQueue;
|
||||
this.messageBodyQueue = messageBodyQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
this.flagFile = flagFile;
|
||||
this.flagDataBase = flagDataBase;
|
||||
this.flagDataFile = flagDataFile;
|
||||
this.classification = classification;
|
||||
this.swclassification = swclassification;
|
||||
this.logclassification = logclassification;
|
||||
|
@ -97,9 +85,11 @@ public class RuteParseRunnable implements Runnable {
|
|||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
|
||||
logger.info("수신 데이터 변환 건수 {}", list.size());
|
||||
logger.info("수신 데이터 변환 건수[" +swclassification + "] {}", list.size());
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
|
||||
String dateTime = dateFormat.format(new Date());
|
||||
|
@ -111,11 +101,10 @@ public class RuteParseRunnable implements Runnable {
|
|||
sb.append(swclassification); sb.append(","); //sw구분
|
||||
sb.append(classification); sb.append("|"); //서버구분
|
||||
int i = 0;
|
||||
int z = 0;
|
||||
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
RuteVO t = mapper.convertValue(map, RuteVO.class);
|
||||
|
||||
if(flagDataFile) {
|
||||
if (i > 0) sb.append("^");
|
||||
|
||||
sb.append(t.getMv_id()); sb.append(",");
|
||||
|
@ -131,59 +120,21 @@ public class RuteParseRunnable implements Runnable {
|
|||
j++;
|
||||
}
|
||||
|
||||
logger.info("logstash 포맷 변환 건수 {}", z++);
|
||||
}
|
||||
|
||||
histroyQueue.add(t);
|
||||
i++;
|
||||
}
|
||||
|
||||
logger.info("logstash 포맷 변환 건수[" +swclassification + "] {}", histroyQueue.size());
|
||||
|
||||
// if(flagFile) {
|
||||
// messageBodyQueue.addAll(histroyQueue);
|
||||
// }
|
||||
|
||||
if(flagDataFile) {
|
||||
dataFileQueue.add(sb.toString());
|
||||
}
|
||||
|
||||
// if(flagDataBase) {
|
||||
// if (histroyQueue.size() > 0) {
|
||||
// trackQueue.addAll(histroyQueue);
|
||||
// }
|
||||
|
||||
// if (flagDataBase) {
|
||||
// histroyQueue
|
||||
// .stream()
|
||||
// .collect(Collectors.groupingBy(RuteVO::getTargetId,
|
||||
// Collectors.maxBy(Comparator.comparing(RuteVO::getReceptionDate))
|
||||
// )).forEach((key, value) -> {
|
||||
// trackLastQueue.add(value.get());
|
||||
// });;
|
||||
// }
|
||||
// }
|
||||
histroyQueue.clear();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
|
||||
// e.printStackTrace();
|
||||
// if (e.getMessage() != null) {
|
||||
// logger.debug("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
// logger.debug("",e);
|
||||
// } else {
|
||||
// logger.debug("[ParserThread] Parsing Error Packet Message :" + result);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public synchronized CountStatus getCountAndSetZero() {
|
||||
// CountStatus countStatus = new CountStatus(rcvPos,rcvStatic);
|
||||
// rcvPos = 0;
|
||||
// rcvStatic = 0;
|
||||
// return countStatus;
|
||||
// }
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
|
|
|
@ -0,0 +1,154 @@
|
|||
package kr.gmtc.tss.elkdata.runnable;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.tss.elkdata.vo.StandStatusVO;
|
||||
|
||||
public class StandStatusParseRunnable implements Runnable {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
|
||||
private boolean isRunning = false;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
private String classification;
|
||||
private String swclassification;
|
||||
private String logclassification;
|
||||
|
||||
public StandStatusParseRunnable(Queue<String> rcvQueue
|
||||
, Queue<String> dataFileQueue
|
||||
, int listChunkSize
|
||||
, long sleepMillis
|
||||
, String classification, String swclassification, String logclassification) {
|
||||
this.rcvQueue = rcvQueue;
|
||||
this.dataFileQueue = dataFileQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
this.classification = classification;
|
||||
this.swclassification = swclassification;
|
||||
this.logclassification = logclassification;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
|
||||
int loopCnt = 0;
|
||||
if(rcvQueue.size()>listChunkSize) {
|
||||
loopCnt = listChunkSize;
|
||||
}else {
|
||||
loopCnt = rcvQueue.size();
|
||||
}
|
||||
String [] chunkArr = new String[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i] = rcvQueue.poll();
|
||||
}
|
||||
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
parseAndEnqueue(chunkArr[i]);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null) {
|
||||
logger.debug("[ParseTarget] Parsing Error Message : " ,e);
|
||||
} else {
|
||||
logger.info("[ParserThread] Parsing Error Call Stack" ,e);
|
||||
}
|
||||
}
|
||||
|
||||
sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private void parseAndEnqueue(String result) {
|
||||
|
||||
try {
|
||||
|
||||
ArrayList<StandStatusVO> histroyQueue = new ArrayList<StandStatusVO>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
|
||||
logger.info("수신 데이터 변환 건수[" +swclassification + "] {}", list.size());
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
|
||||
String dateTime = dateFormat.format(new Date());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(dateTime); sb.append(",");
|
||||
sb.append(logclassification); sb.append(","); //log구분
|
||||
sb.append(swclassification); sb.append(","); //sw구분
|
||||
sb.append(classification); sb.append("|"); //서버구분
|
||||
int i = 0;
|
||||
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
StandStatusVO s = mapper.convertValue(map, StandStatusVO.class);
|
||||
|
||||
|
||||
if (i > 0) sb.append("^");
|
||||
|
||||
sb.append(s.getStandNo()); sb.append(",");
|
||||
sb.append(s.getStandSttusTy().toDataFormat()); sb.append(",");
|
||||
sb.append(s.getAircraftSttusTy()); sb.append(",");
|
||||
sb.append(s.getClsgn());
|
||||
|
||||
histroyQueue.add(s);
|
||||
i++;
|
||||
}
|
||||
|
||||
logger.info("logstash 포맷 변환 건수[" +swclassification + "] {}", histroyQueue.size());
|
||||
|
||||
dataFileQueue.add(sb.toString());
|
||||
|
||||
histroyQueue.clear();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (e.getMessage() != null) {
|
||||
logger.debug("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
logger.debug("",e);
|
||||
} else {
|
||||
logger.debug("[ParserThread] Parsing Error Packet Message :" + result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[ParseTargetRunnable] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package kr.gmtc.tss.elkdata.runnable;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.tss.elkdata.vo.AlarmVO;
|
||||
|
||||
public class StatusAnaParseRunnable implements Runnable {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
|
||||
private boolean isRunning = false;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
private String classification;
|
||||
private String swclassification;
|
||||
private String logclassification;
|
||||
|
||||
public StatusAnaParseRunnable(Queue<String> rcvQueue
|
||||
, Queue<String> dataFileQueue
|
||||
, int listChunkSize
|
||||
, long sleepMillis
|
||||
, String classification, String swclassification, String logclassification) {
|
||||
this.rcvQueue = rcvQueue;
|
||||
this.dataFileQueue = dataFileQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
this.classification = classification;
|
||||
this.swclassification = swclassification;
|
||||
this.logclassification = logclassification;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
|
||||
int loopCnt = 0;
|
||||
if(rcvQueue.size()>listChunkSize) {
|
||||
loopCnt = listChunkSize;
|
||||
}else {
|
||||
loopCnt = rcvQueue.size();
|
||||
}
|
||||
String [] chunkArr = new String[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i] = rcvQueue.poll();
|
||||
}
|
||||
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
parseAndEnqueue(chunkArr[i]);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null) {
|
||||
logger.debug("[ParseTarget] Parsing Error Message : " ,e);
|
||||
} else {
|
||||
logger.info("[ParserThread] Parsing Error Call Stack" ,e);
|
||||
}
|
||||
}
|
||||
|
||||
sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private void parseAndEnqueue(String result) {
|
||||
try {
|
||||
ArrayList<AlarmVO> histroyQueue = new ArrayList<AlarmVO>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
|
||||
logger.info("수신 데이터 변환 건수[" +swclassification + "] {}", list.size());
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
|
||||
String dateTime = dateFormat.format(new Date());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(dateTime); sb.append(",");
|
||||
sb.append(logclassification); sb.append(","); //log구분
|
||||
sb.append(swclassification); sb.append(","); //sw구분
|
||||
sb.append(classification); sb.append("|"); //서버구분
|
||||
|
||||
int i = 0;
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
AlarmVO a = mapper.convertValue(map, AlarmVO.class);
|
||||
|
||||
|
||||
if (i > 0) sb.append("^");
|
||||
|
||||
sb.append(a.getAnalsId()); sb.append(",");
|
||||
sb.append(a.getAnalsDt()); sb.append(",");
|
||||
sb.append(a.getAnalsTy()); sb.append(",");
|
||||
sb.append(a.getArea().toDataFormat()); sb.append(",");
|
||||
sb.append(a.getTarget1().toDataFormat()); sb.append(",");
|
||||
sb.append(a.getTarget2().toDataFormat()); sb.append(",");
|
||||
sb.append(a.getAnalsMsg()); sb.append(",");
|
||||
sb.append(a.getRls_ty());
|
||||
|
||||
histroyQueue.add(a);
|
||||
i++;
|
||||
}
|
||||
|
||||
logger.info("logstash 포맷 변환 건수[" +swclassification + "] {}", histroyQueue.size());
|
||||
|
||||
dataFileQueue.add(sb.toString());
|
||||
|
||||
histroyQueue.clear();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (e.getMessage() != null) {
|
||||
logger.debug("[ParserThread] Parsing Error Message : " + e.getMessage());
|
||||
logger.debug("",e);
|
||||
} else {
|
||||
logger.debug("[ParserThread] Parsing Error Packet Message :" + result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[ParseTargetRunnable] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
package kr.gmtc.tss.elkdata.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class AlarmVO implements Comparable<AlarmVO> {
|
||||
|
||||
private boolean inserted=false;
|
||||
private String marineAreaId="";
|
||||
|
||||
public long timeStamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(9)).toEpochMilli();
|
||||
|
||||
public AlarmVO() {
|
||||
}
|
||||
|
||||
protected LocalDateTime dateTime;
|
||||
|
||||
@JsonProperty("anals_id")
|
||||
private String analsId;
|
||||
@JsonProperty("anals_dt")
|
||||
private String analsDt;
|
||||
@JsonProperty("anals_ty")
|
||||
private String analsTy;
|
||||
private Area area;
|
||||
private Target target1;
|
||||
private Target target2;
|
||||
@JsonProperty("anals_msg")
|
||||
private String analsMsg;
|
||||
|
||||
private String rls_ty;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" +
|
||||
"\"anals_id\":\"" + analsId + "\"" +
|
||||
",\"anals_dt\":\"" + analsDt + "\"" +
|
||||
",\"anals_ty\":\"" + analsTy + "\"" +
|
||||
",\"area\":{" + area.toString() + "}" +
|
||||
",\"target1\":" + target1.toString() +
|
||||
",\"target2\":" + target2.toString() +
|
||||
",\"anals_msg\":\"" + analsMsg + "\"" +
|
||||
"}";
|
||||
}
|
||||
|
||||
public String getAnalsId() {
|
||||
return analsId;
|
||||
}
|
||||
|
||||
public void setAnalsId(String analsId) {
|
||||
this.analsId = analsId;
|
||||
}
|
||||
|
||||
public String getAnalsDt() {
|
||||
return analsDt;
|
||||
}
|
||||
|
||||
public void setAnalsDt(String analsDt) {
|
||||
this.analsDt = analsDt;
|
||||
}
|
||||
|
||||
public String getAnalsTy() {
|
||||
return analsTy;
|
||||
}
|
||||
|
||||
public void setAnalsTy(String analsTy) {
|
||||
this.analsTy = analsTy;
|
||||
}
|
||||
|
||||
public Area getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(Area area) {
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
public Target getTarget1() {
|
||||
return target1;
|
||||
}
|
||||
|
||||
public void setTarget1(Target target1) {
|
||||
this.target1 = target1;
|
||||
}
|
||||
|
||||
public Target getTarget2() {
|
||||
return target2;
|
||||
}
|
||||
|
||||
public void setTarget2(Target target2) {
|
||||
this.target2 = target2;
|
||||
}
|
||||
|
||||
public String getAnalsMsg() {
|
||||
return analsMsg;
|
||||
}
|
||||
|
||||
public void setAnalsMsg(String analsMsg) {
|
||||
this.analsMsg = analsMsg;
|
||||
}
|
||||
|
||||
public boolean isInserted() {
|
||||
return inserted;
|
||||
}
|
||||
|
||||
public void setInserted(boolean inserted) {
|
||||
this.inserted = inserted;
|
||||
}
|
||||
|
||||
public String getMarineAreaId() {
|
||||
return marineAreaId;
|
||||
}
|
||||
|
||||
public void setMarineAreaId(String marineAreaId) {
|
||||
this.marineAreaId = marineAreaId;
|
||||
}
|
||||
|
||||
public long getTimeStamp() {
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
public void setTimeStamp(long timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public void setDateTime(LocalDateTime dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public String getRls_ty() {
|
||||
return rls_ty;
|
||||
}
|
||||
|
||||
public void setRls_ty(String rls_ty) {
|
||||
this.rls_ty = rls_ty;
|
||||
}
|
||||
|
||||
|
||||
public static class Area {
|
||||
private String area_type;
|
||||
private String area_id;
|
||||
|
||||
public String getArea_type() {
|
||||
return area_type;
|
||||
}
|
||||
public void setArea_type(String area_type) {
|
||||
this.area_type = area_type;
|
||||
}
|
||||
public String getArea_id() {
|
||||
return area_id;
|
||||
}
|
||||
public void setArea_id(String area_id) {
|
||||
this.area_id = area_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" +
|
||||
"\"area_type\":\"" + area_type + "\"" +
|
||||
",\"area_id\":\"" + area_id + "\"" +
|
||||
"}";
|
||||
}
|
||||
|
||||
public String toDataFormat() {
|
||||
return area_type+"@"+area_id;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Target {
|
||||
private String trgt_ty;
|
||||
private String trgt_id;
|
||||
|
||||
public String getTrgt_ty() {
|
||||
return trgt_ty;
|
||||
}
|
||||
public void setTrgt_ty(String trgt_ty) {
|
||||
this.trgt_ty = trgt_ty;
|
||||
}
|
||||
public String getTrgt_id() {
|
||||
return trgt_id;
|
||||
}
|
||||
public void setTrgt_id(String trgt_id) {
|
||||
this.trgt_id = trgt_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" +
|
||||
"\"trgt_ty\":\"" + trgt_ty + "\"" +
|
||||
",\"trgt_id\":\"" + trgt_id + "\"" +
|
||||
"}";
|
||||
}
|
||||
|
||||
public String toDataFormat() {
|
||||
return trgt_ty+"@"+trgt_id;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
//p1.equals(p2)
|
||||
if(obj instanceof AlarmVO) {
|
||||
AlarmVO p = (AlarmVO)obj;
|
||||
return this.hashCode()==p.hashCode();
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(AlarmVO o) {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,288 @@
|
|||
package kr.gmtc.tss.elkdata.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* @author choi
|
||||
*
|
||||
*/
|
||||
public class AsdeTrackVO implements Comparable<AsdeTrackVO> {
|
||||
|
||||
private boolean inserted=false;
|
||||
//private String marineAreaId="";
|
||||
|
||||
//public long timeStamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(9)).toEpochMilli();
|
||||
|
||||
public AsdeTrackVO() {
|
||||
}
|
||||
|
||||
//protected LocalDateTime dateTime;
|
||||
@JsonProperty("trgt_id")
|
||||
private String trgtId; // 타겟 ID
|
||||
@JsonProperty("mode_s_cd")
|
||||
private String modeScd; // Mode-S 코드
|
||||
@JsonProperty("ssr_cd")
|
||||
private String ssrCd; //
|
||||
private String clsgn; //
|
||||
@JsonProperty("tail_no")
|
||||
private String tailNo; //
|
||||
@JsonProperty("track_no")
|
||||
private int trackNo; // 추가 2023.04.07
|
||||
@JsonProperty("recptn_dt") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
|
||||
private Date recptnDt; //
|
||||
@JsonProperty("cat_ty")
|
||||
private double catTy; //
|
||||
private double lat; //
|
||||
private double lon; //
|
||||
private double spd; //
|
||||
private double cos; //
|
||||
@JsonProperty("trgt_ty")
|
||||
private String trgtTy; //
|
||||
|
||||
|
||||
// private String acRegNo;
|
||||
private String alt;
|
||||
// private String virtlTrgtAt;
|
||||
// private String trackCrrctAt;
|
||||
// private String trackCnfdnc;
|
||||
private String registerId;
|
||||
private String registDt;
|
||||
private String updusrId;
|
||||
private String updtDt;
|
||||
private boolean lstFlag;
|
||||
|
||||
public boolean isInserted() {
|
||||
return inserted;
|
||||
}
|
||||
|
||||
public void setInserted(boolean inserted) {
|
||||
this.inserted = inserted;
|
||||
}
|
||||
|
||||
// public String getMarineAreaId() {
|
||||
// return marineAreaId;
|
||||
// }
|
||||
//
|
||||
// public void setMarineAreaId(String marineAreaId) {
|
||||
// this.marineAreaId = marineAreaId;
|
||||
// }
|
||||
//
|
||||
// public long getTimeStamp() {
|
||||
// return timeStamp;
|
||||
// }
|
||||
//
|
||||
// public void setTimeStamp(long timeStamp) {
|
||||
// this.timeStamp = timeStamp;
|
||||
// }
|
||||
|
||||
public String getTrgtId() {
|
||||
return trgtId;
|
||||
}
|
||||
|
||||
public void setTrgtId(String trgtId) {
|
||||
this.trgtId = trgtId;
|
||||
}
|
||||
|
||||
// public String getAcRegNo() {
|
||||
// return acRegNo;
|
||||
// }
|
||||
//
|
||||
// public void setAcRegNo(String acRegNo) {
|
||||
// this.acRegNo = acRegNo;
|
||||
// }
|
||||
|
||||
public String getClsgn() {
|
||||
return clsgn;
|
||||
}
|
||||
|
||||
public void setClsgn(String clsgn) {
|
||||
this.clsgn = clsgn;
|
||||
}
|
||||
|
||||
public String getSsrCd() {
|
||||
return ssrCd;
|
||||
}
|
||||
|
||||
public void setSsrCd(String ssrCd) {
|
||||
this.ssrCd = ssrCd;
|
||||
}
|
||||
|
||||
public String getModeScd() {
|
||||
return modeScd;
|
||||
}
|
||||
|
||||
public void setModeScd(String modeScd) {
|
||||
this.modeScd = modeScd;
|
||||
}
|
||||
|
||||
public Date getRecptnDt() {
|
||||
return recptnDt;
|
||||
}
|
||||
|
||||
public void setRecptnDt(Date recptnDt) {
|
||||
this.recptnDt = recptnDt;
|
||||
}
|
||||
|
||||
public double getCatTy() {
|
||||
return catTy;
|
||||
}
|
||||
|
||||
public void setCatTy(double catTy) {
|
||||
this.catTy = catTy;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getSpd() {
|
||||
return spd;
|
||||
}
|
||||
|
||||
public void setSpd(double spd) {
|
||||
this.spd = spd;
|
||||
}
|
||||
|
||||
public double getCos() {
|
||||
return cos;
|
||||
}
|
||||
|
||||
public void setCos(double cos) {
|
||||
this.cos = cos;
|
||||
}
|
||||
|
||||
// public String getVirtlTrgtAt() {
|
||||
// return virtlTrgtAt;
|
||||
// }
|
||||
//
|
||||
// public void setVirtlTrgtAt(String virtlTrgtAt) {
|
||||
// this.virtlTrgtAt = virtlTrgtAt;
|
||||
// }
|
||||
//
|
||||
// public String getTrackCrrctAt() {
|
||||
// return trackCrrctAt;
|
||||
// }
|
||||
//
|
||||
// public void setTrackCrrctAt(String trackCrrctAt) {
|
||||
// this.trackCrrctAt = trackCrrctAt;
|
||||
// }
|
||||
//
|
||||
// public String getTrackCnfdnc() {
|
||||
// return trackCnfdnc;
|
||||
// }
|
||||
//
|
||||
// public void setTrackCnfdnc(String trackCnfdnc) {
|
||||
// this.trackCnfdnc = trackCnfdnc;
|
||||
// }
|
||||
|
||||
public String getAlt() {
|
||||
return alt;
|
||||
}
|
||||
|
||||
public void setAlt(String alt) {
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
public String getRegisterId() {
|
||||
return registerId;
|
||||
}
|
||||
|
||||
public void setRegisterId(String registerId) {
|
||||
this.registerId = registerId;
|
||||
}
|
||||
|
||||
public String getRegistDt() {
|
||||
return registDt;
|
||||
}
|
||||
|
||||
public void setRegistDt(String registDt) {
|
||||
this.registDt = registDt;
|
||||
}
|
||||
|
||||
public String getUpdusrId() {
|
||||
return updusrId;
|
||||
}
|
||||
|
||||
public void setUpdusrId(String updusrId) {
|
||||
this.updusrId = updusrId;
|
||||
}
|
||||
|
||||
public String getUpdtDt() {
|
||||
return updtDt;
|
||||
}
|
||||
|
||||
public void setUpdtDt(String updtDt) {
|
||||
this.updtDt = updtDt;
|
||||
}
|
||||
|
||||
// public LocalDateTime getDateTime() {
|
||||
// return dateTime;
|
||||
// }
|
||||
//
|
||||
// public void setDateTime(LocalDateTime dateTime) {
|
||||
// this.dateTime = dateTime;
|
||||
// }
|
||||
|
||||
public boolean isLstFlag() {
|
||||
return lstFlag;
|
||||
}
|
||||
|
||||
public void setLstFlag(boolean lstFlag) {
|
||||
this.lstFlag = lstFlag;
|
||||
}
|
||||
|
||||
public String getTailNo() {
|
||||
return tailNo;
|
||||
}
|
||||
|
||||
public void setTailNo(String tailNo) {
|
||||
this.tailNo = tailNo;
|
||||
}
|
||||
|
||||
public int getTrackNo() {
|
||||
return trackNo;
|
||||
}
|
||||
|
||||
public void setTrackNo(int trackNo) {
|
||||
this.trackNo = trackNo;
|
||||
}
|
||||
|
||||
public String getTrgtTy() {
|
||||
return trgtTy;
|
||||
}
|
||||
|
||||
public void setTrgtTy(String trgtTy) {
|
||||
this.trgtTy = trgtTy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
//p1.equals(p2)
|
||||
if(obj instanceof AsdeTrackVO) {
|
||||
AsdeTrackVO p = (AsdeTrackVO)obj;
|
||||
return this.hashCode()==p.hashCode();
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(AsdeTrackVO o) {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
package kr.gmtc.tss.elkdata.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CctvTrackVO implements Comparable<CctvTrackVO> {
|
||||
|
||||
private boolean inserted=false;
|
||||
|
||||
public long timeStamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(9)).toEpochMilli();
|
||||
|
||||
public CctvTrackVO() {
|
||||
}
|
||||
|
||||
protected LocalDateTime dateTime;
|
||||
|
||||
@JsonProperty("dtct_tm")
|
||||
private String dtctTm;
|
||||
|
||||
@JsonProperty("dtct_cls")
|
||||
private String dtctCls;
|
||||
|
||||
@JsonProperty("mta_tm")
|
||||
private String mtaTm;
|
||||
|
||||
@JsonProperty("rw_tm")
|
||||
private String rwTm;
|
||||
|
||||
@JsonProperty("cc_id")
|
||||
private List<String> ccId;
|
||||
|
||||
@JsonProperty("zn_id")
|
||||
private String znId;
|
||||
|
||||
@JsonProperty("arcrft_tp")
|
||||
private String arcrftTp;
|
||||
|
||||
@JsonProperty("arln")
|
||||
private String arln;
|
||||
|
||||
@JsonProperty("trck_id")
|
||||
private String trckId;
|
||||
|
||||
@JsonProperty("bb_tlp")
|
||||
private List<String> bbTlp;
|
||||
|
||||
@JsonProperty("bb_brp")
|
||||
private List<String> bbBrp;
|
||||
|
||||
@JsonProperty("crd_frm")
|
||||
private List<String> crdFrm;
|
||||
|
||||
@JsonProperty("crd_glbl")
|
||||
private List<String> crdGlbl;
|
||||
|
||||
@JsonProperty("drctn")
|
||||
private String drctn;
|
||||
|
||||
@JsonProperty("arcrft_stnd")
|
||||
private String arcrftStnd;
|
||||
|
||||
@JsonProperty("spd")
|
||||
private String spd;
|
||||
|
||||
@JsonProperty("prc_tm")
|
||||
private String prcTm;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TrackVO [inserted=" + inserted + ", timeStamp=" + timeStamp + ", dateTime=" + dateTime + ", dtctTm="
|
||||
+ dtctTm + ", dtctCls=" + dtctCls + ", mtaTm=" + mtaTm + ", rwTm=" + rwTm + ", ccId=" + ccId + ", znId="
|
||||
+ znId + ", arcrftTp=" + arcrftTp + ", arln=" + arln + ", trckId=" + trckId + ", bbTlp=" + bbTlp
|
||||
+ ", bbBrp=" + bbBrp + ", crdFrm=" + crdFrm + ", crdGlbl=" + crdGlbl + ", drctn=" + drctn
|
||||
+ ", arcrftStnd=" + arcrftStnd + ", spd=" + spd + ", prc_tm=" + prcTm +"]";
|
||||
}
|
||||
|
||||
public String toDataFormat(List<String> arr) {
|
||||
int j = 0;
|
||||
String s = "";
|
||||
for (String k : arr) {
|
||||
if (j > 0) s += "$";
|
||||
s += k;
|
||||
j++;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
public boolean isInserted() {
|
||||
return inserted;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setInserted(boolean inserted) {
|
||||
this.inserted = inserted;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public long getTimeStamp() {
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setTimeStamp(long timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
//p1.equals(p2)
|
||||
if(obj instanceof CctvTrackVO) {
|
||||
CctvTrackVO p = (CctvTrackVO)obj;
|
||||
return this.hashCode()==p.hashCode();
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(CctvTrackVO o) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
package kr.gmtc.tss.elkdata.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class RadarTrackVO implements Comparable<RadarTrackVO> {
|
||||
|
||||
private boolean inserted=false;
|
||||
|
||||
public RadarTrackVO() {
|
||||
}
|
||||
|
||||
@JsonProperty("trgt_id")
|
||||
private String trgtId;
|
||||
@JsonProperty("recptn_dt")
|
||||
private String recptnDt;
|
||||
private double lat;
|
||||
private double lon;
|
||||
private double spd;
|
||||
private double cos;
|
||||
@JsonProperty("detct_cnt")
|
||||
private int detctCnt;
|
||||
@JsonProperty("undetct_cnt")
|
||||
private int undetctCnt;
|
||||
|
||||
|
||||
private String registerId;
|
||||
private String registDt;
|
||||
private String updusrId;
|
||||
private String updtDt;
|
||||
private boolean lstFlag;
|
||||
|
||||
public boolean isInserted() {
|
||||
return inserted;
|
||||
}
|
||||
|
||||
public void setInserted(boolean inserted) {
|
||||
this.inserted = inserted;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getTrgtId() {
|
||||
return trgtId;
|
||||
}
|
||||
|
||||
public void setTrgtId(String trgtId) {
|
||||
this.trgtId = trgtId;
|
||||
}
|
||||
|
||||
public String getRecptnDt() {
|
||||
return recptnDt;
|
||||
}
|
||||
|
||||
public void setRecptnDt(String recptnDt) {
|
||||
this.recptnDt = recptnDt;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getSpd() {
|
||||
return spd;
|
||||
}
|
||||
|
||||
public void setSpd(double spd) {
|
||||
this.spd = spd;
|
||||
}
|
||||
|
||||
public double getCos() {
|
||||
return cos;
|
||||
}
|
||||
|
||||
public void setCos(double cos) {
|
||||
this.cos = cos;
|
||||
}
|
||||
|
||||
public String getRegisterId() {
|
||||
return registerId;
|
||||
}
|
||||
|
||||
public void setRegisterId(String registerId) {
|
||||
this.registerId = registerId;
|
||||
}
|
||||
|
||||
public String getRegistDt() {
|
||||
return registDt;
|
||||
}
|
||||
|
||||
public void setRegistDt(String registDt) {
|
||||
this.registDt = registDt;
|
||||
}
|
||||
|
||||
public String getUpdusrId() {
|
||||
return updusrId;
|
||||
}
|
||||
|
||||
public void setUpdusrId(String updusrId) {
|
||||
this.updusrId = updusrId;
|
||||
}
|
||||
|
||||
public String getUpdtDt() {
|
||||
return updtDt;
|
||||
}
|
||||
|
||||
public void setUpdtDt(String updtDt) {
|
||||
this.updtDt = updtDt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean isLstFlag() {
|
||||
return lstFlag;
|
||||
}
|
||||
|
||||
public void setLstFlag(boolean lstFlag) {
|
||||
this.lstFlag = lstFlag;
|
||||
}
|
||||
|
||||
public int getDetctCnt() {
|
||||
return detctCnt;
|
||||
}
|
||||
|
||||
public void setDetctCnt(int detctCnt) {
|
||||
this.detctCnt = detctCnt;
|
||||
}
|
||||
|
||||
public int getUndetctCnt() {
|
||||
return undetctCnt;
|
||||
}
|
||||
|
||||
public void setUndetctCnt(int undetctCnt) {
|
||||
this.undetctCnt = undetctCnt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
//p1.equals(p2)
|
||||
if(obj instanceof RadarTrackVO) {
|
||||
RadarTrackVO p = (RadarTrackVO)obj;
|
||||
return this.hashCode()==p.hashCode();
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(RadarTrackVO o) {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
package kr.gmtc.tss.elkdata.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class StandStatusVO implements Comparable<StandStatusVO> {
|
||||
|
||||
private boolean inserted=false;
|
||||
|
||||
public long timeStamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(9)).toEpochMilli();
|
||||
|
||||
public StandStatusVO() {
|
||||
}
|
||||
|
||||
protected LocalDateTime dateTime;
|
||||
|
||||
@JsonProperty("stand_no")
|
||||
private String standNo;
|
||||
@JsonProperty("stand_sttus_ty")
|
||||
private StandSttusTy standSttusTy; //AI 주기장 상황 분석 유형(공통코드-CT038)
|
||||
@JsonProperty("aircraft_sttus_ty")
|
||||
private String aircraftSttusTy; //주기장 항공기 상태 타입(공통코드-CT019)
|
||||
private String clsgn;
|
||||
private String schdul_id;
|
||||
private String ac_reg_no;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StandStatusVO [inserted=" + inserted + ", timeStamp=" + timeStamp + ", dateTime=" + dateTime
|
||||
+ ", standNo=" + standNo + ", standSttusTy=" + standSttusTy.toString() + ", aircraftSttusTy=" + aircraftSttusTy
|
||||
+ ", clsgn=" + clsgn + "]";
|
||||
}
|
||||
|
||||
public boolean isInserted() {
|
||||
return inserted;
|
||||
}
|
||||
|
||||
public void setInserted(boolean inserted) {
|
||||
this.inserted = inserted;
|
||||
}
|
||||
|
||||
public long getTimeStamp() {
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
public void setTimeStamp(long timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public void setDateTime(LocalDateTime dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public String getStandNo() {
|
||||
return standNo;
|
||||
}
|
||||
|
||||
public void setStandNo(String standNo) {
|
||||
this.standNo = standNo;
|
||||
}
|
||||
|
||||
public String getClsgn() {
|
||||
return clsgn;
|
||||
}
|
||||
|
||||
public void setClsgn(String clsgn) {
|
||||
this.clsgn = clsgn;
|
||||
}
|
||||
|
||||
public StandSttusTy getStandSttusTy() {
|
||||
return standSttusTy;
|
||||
}
|
||||
|
||||
public void setStandSttusTy(StandSttusTy standSttusTy) {
|
||||
this.standSttusTy = standSttusTy;
|
||||
}
|
||||
|
||||
public String getAircraftSttusTy() {
|
||||
return aircraftSttusTy;
|
||||
}
|
||||
|
||||
public void setAircraftSttusTy(String aircraftSttusTy) {
|
||||
this.aircraftSttusTy = aircraftSttusTy;
|
||||
}
|
||||
|
||||
public String getSchdul_id() {
|
||||
return schdul_id;
|
||||
}
|
||||
|
||||
public void setSchdul_id(String schdul_id) {
|
||||
this.schdul_id = schdul_id;
|
||||
}
|
||||
|
||||
public String getAc_reg_no() {
|
||||
return ac_reg_no;
|
||||
}
|
||||
|
||||
public void setAc_reg_no(String ac_reg_no) {
|
||||
this.ac_reg_no = ac_reg_no;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
//p1.equals(p2)
|
||||
if(obj instanceof StandStatusVO) {
|
||||
StandStatusVO p = (StandStatusVO)obj;
|
||||
return this.hashCode()==p.hashCode();
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(StandStatusVO o) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static class StandSttusTy {
|
||||
@JsonProperty("arcft_stand")
|
||||
private String arcrftStnd;
|
||||
@JsonProperty("brdg_cnnctd")
|
||||
private String brdgCnnctd;
|
||||
@JsonProperty("crg_dr_opnd")
|
||||
private String crgDrOpnd;
|
||||
@JsonProperty("pad_clear")
|
||||
private String padClear;
|
||||
@JsonProperty("twng_cr_cnnctd")
|
||||
private String twngCrCnnctd;
|
||||
public String getArcrftStnd() {
|
||||
return arcrftStnd;
|
||||
}
|
||||
public void setArcrftStnd(String arcrftStnd) {
|
||||
this.arcrftStnd = arcrftStnd;
|
||||
}
|
||||
public String getBrdgCnnctd() {
|
||||
return brdgCnnctd;
|
||||
}
|
||||
public void setBrdgCnnctd(String brdgCnnctd) {
|
||||
this.brdgCnnctd = brdgCnnctd;
|
||||
}
|
||||
public String getCrgDrOpnd() {
|
||||
return crgDrOpnd;
|
||||
}
|
||||
public void setCrgDrOpnd(String crgDrOpnd) {
|
||||
this.crgDrOpnd = crgDrOpnd;
|
||||
}
|
||||
public String getPadClear() {
|
||||
return padClear;
|
||||
}
|
||||
public void setPadClear(String padClear) {
|
||||
this.padClear = padClear;
|
||||
}
|
||||
public String getTwngCrCnnctd() {
|
||||
return twngCrCnnctd;
|
||||
}
|
||||
public void setTwngCrCnnctd(String twngCrCnnctd) {
|
||||
this.twngCrCnnctd = twngCrCnnctd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StandSttusTy [arcrftStnd=" + arcrftStnd + ", brdgCnnctd=" + brdgCnnctd + ", crgDrOpnd=" + crgDrOpnd
|
||||
+ ", padClear=" + padClear + ", twngCrCnnctd=" + twngCrCnnctd + "]";
|
||||
}
|
||||
|
||||
public String toDataFormat() {
|
||||
return arcrftStnd+"@"+brdgCnnctd+"@"+crgDrOpnd+"@"+padClear+"@"+twngCrCnnctd;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package kr.gmtc.tss.elkdata.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class StatsVO {
|
||||
|
||||
private String intrfc_dt;
|
||||
private String intrfc_id;
|
||||
private String intrfc_nm;
|
||||
private int recv_co;
|
||||
private int parse_co;
|
||||
|
||||
|
||||
}
|
|
@ -29,8 +29,12 @@ public class TrackVO implements Comparable<TrackVO> {
|
|||
private String speed;
|
||||
@JsonProperty("cos")
|
||||
private String course;
|
||||
@JsonProperty("alt")
|
||||
private String alt;
|
||||
@JsonProperty("trgt_ty")
|
||||
private String targetType;
|
||||
@JsonProperty("schdul_id")
|
||||
private String schdulId;
|
||||
@JsonProperty("mode_s_cd")
|
||||
private String modeSCode;
|
||||
@JsonProperty("ssr_cd")
|
||||
|
@ -43,9 +47,11 @@ public class TrackVO implements Comparable<TrackVO> {
|
|||
private String correctedLatitude;
|
||||
@JsonProperty("crrct_lon")
|
||||
private String correctedLongitude;
|
||||
@JsonProperty("is_cntrlzone")
|
||||
private String isCntrlzone;
|
||||
|
||||
private List<BoundingBox> bbox;
|
||||
@JsonProperty("alt")
|
||||
private String alt;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" +
|
||||
|
@ -56,12 +62,14 @@ public class TrackVO implements Comparable<TrackVO> {
|
|||
",\"spd\":\"" + speed + "\"" +
|
||||
",\"cos\":\"" + course + "\"" +
|
||||
",\"trgt_ty\":\"" + targetType + "\"" +
|
||||
",\"schdul_id\":\"" + schdulId + "\"" +
|
||||
",\"mode_s_cd\":\"" + modeSCode + "\"" +
|
||||
",\"ssr_cd\":\"" + ssrCode + "\"" +
|
||||
",\"clsgn\":\"" + callsign + "\"" +
|
||||
",\"tail_no\":\"" + tailNumber + "\"" +
|
||||
",\"crrct_lat\":\"" + correctedLatitude + "\"" +
|
||||
",\"crrct_lon\":\"" + correctedLongitude + "\"" +
|
||||
",\"is_cntrlzone\":\"" + isCntrlzone + "\"" +
|
||||
",\"bbox\":" + bbox.toString() +
|
||||
"}";
|
||||
}
|
||||
|
@ -220,6 +228,22 @@ public class TrackVO implements Comparable<TrackVO> {
|
|||
this.alt = alt;
|
||||
}
|
||||
|
||||
public String getSchdulId() {
|
||||
return schdulId;
|
||||
}
|
||||
|
||||
public void setSchdulId(String schdulId) {
|
||||
this.schdulId = schdulId;
|
||||
}
|
||||
|
||||
public String getIsCntrlzone() {
|
||||
return isCntrlzone;
|
||||
}
|
||||
|
||||
public void setIsCntrlzone(String isCntrlzone) {
|
||||
this.isCntrlzone = isCntrlzone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
//p1.equals(p2)
|
||||
|
@ -310,4 +334,5 @@ public class TrackVO implements Comparable<TrackVO> {
|
|||
this.py = py;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ public class VoiceVo {
|
|||
@JsonProperty("tag")
|
||||
private String tag;
|
||||
|
||||
public String getKeywordRow() {
|
||||
return keyword+"@"+tag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
@ -37,6 +41,21 @@ public class VoiceVo {
|
|||
|
||||
private List<VoiceKeyword> keywords;
|
||||
|
||||
public String getReadbackRow() {
|
||||
|
||||
StringBuilder sbReadbackRow = new StringBuilder();
|
||||
sbReadbackRow.append(result+"@"+read_starttime+"@");
|
||||
int j = 0;
|
||||
for(VoiceKeyword vk : keywords){
|
||||
if (j > 0) sbReadbackRow.append("$");
|
||||
|
||||
sbReadbackRow.append(vk.getKeywordRow());
|
||||
|
||||
}
|
||||
|
||||
return sbReadbackRow.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@JsonProperty("starttime")
|
||||
|
@ -80,4 +99,6 @@ public class VoiceVo {
|
|||
private String text;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,11 +5,6 @@ import java.util.Queue;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import kr.gmtc.tss.elkdata.vo.TrackVO;
|
||||
import kr.gmtc.tss.main.MainServer;
|
||||
import kr.gmtc.tss.util.FileUtil;
|
||||
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package kr.gmtc.tss.filelog;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.tss.elkdata.vo.TrackVO;
|
||||
import kr.gmtc.tss.main.MainServer;
|
||||
import kr.gmtc.tss.util.FileUtil;
|
||||
|
@ -80,7 +76,6 @@ private Logger logger = LoggerFactory.getLogger(this.getClass());
|
|||
// }
|
||||
|
||||
private String getMessageBody(TrackVO vo) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(vo.toString());
|
||||
|
|
|
@ -28,6 +28,7 @@ public class KafkaTopicReader implements Runnable {
|
|||
}
|
||||
|
||||
public void run() {
|
||||
|
||||
Properties props = new Properties();
|
||||
props.put("bootstrap.servers", bootstrapServers);
|
||||
props.put("group.id", consumeGroupId);
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -21,15 +20,20 @@ import kr.gmt.so.state.StateManager;
|
|||
import kr.gmt.so.state.model.SystemState;
|
||||
import kr.gmtc.tss.config.TopicsList;
|
||||
import kr.gmtc.tss.config.TssConfig;
|
||||
import kr.gmtc.tss.elkdata.runnable.AiLocationParseRunnable;
|
||||
import kr.gmtc.tss.elkdata.runnable.AiVoiceMetaRunnable;
|
||||
import kr.gmtc.tss.elkdata.runnable.AsdeParseRunnable;
|
||||
import kr.gmtc.tss.elkdata.runnable.CctvPtzParseRunnable;
|
||||
import kr.gmtc.tss.elkdata.vo.RuteVO;
|
||||
import kr.gmtc.tss.elkdata.runnable.FusionParseRunnable;
|
||||
import kr.gmtc.tss.elkdata.runnable.RadarParseRunnable;
|
||||
import kr.gmtc.tss.elkdata.runnable.RuteParseRunnable;
|
||||
import kr.gmtc.tss.elkdata.runnable.StandStatusParseRunnable;
|
||||
import kr.gmtc.tss.elkdata.runnable.StatusAnaParseRunnable;
|
||||
import kr.gmtc.tss.filelog.DataLogger;
|
||||
import kr.gmtc.tss.filelog.MessageBodyLogger;
|
||||
import kr.gmtc.tss.kafka.KafkaTopicReader;
|
||||
import kr.gmtc.tss.util.FileUtil;
|
||||
import kr.gmtc.tss.util.LogFileDelete;
|
||||
|
||||
@EnableScheduling
|
||||
@Component
|
||||
public class MainServer implements InitializingBean {
|
||||
|
||||
|
@ -42,8 +46,6 @@ public class MainServer implements InitializingBean {
|
|||
// Runnable parserRunnable;
|
||||
DataLogger dataLoggerRunnable;
|
||||
|
||||
MessageBodyLogger messageBodyLogger;
|
||||
|
||||
List<Thread> threadList = new ArrayList<Thread>();
|
||||
|
||||
@Autowired
|
||||
|
@ -57,6 +59,7 @@ public class MainServer implements InitializingBean {
|
|||
|
||||
@Autowired
|
||||
private StateManager stateMgr;
|
||||
private boolean swBeforeStatus = true;
|
||||
|
||||
public static int LAST_DATA_CNT = 0;
|
||||
|
||||
|
@ -69,7 +72,10 @@ public class MainServer implements InitializingBean {
|
|||
// logger.info("flagFile : "+cfg.flagFile);
|
||||
|
||||
// 최초 한번만 실행 - 로그파일이 없을 시 생성
|
||||
DATA_FILE_NAME = fileUtil.createLogFile(cfg.dataZipPath, cfg.dataZipBakPath, cfg.dataMakeTime); // logstash data file log
|
||||
String[] arrSW = cfg.swclassification;
|
||||
for(String swIdx : arrSW){
|
||||
DATA_FILE_NAME = fileUtil.createLogFile(cfg.dataZipPath +"/"+ swIdx , cfg.dataZipBakPath +"/"+ swIdx, cfg.dataMakeTime); // logstash data file log
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
|
@ -94,7 +100,7 @@ public class MainServer implements InitializingBean {
|
|||
|
||||
startKafkaThread();
|
||||
startParserThread();
|
||||
// startSqlLoggerThread();
|
||||
|
||||
}
|
||||
|
||||
@Scheduled(cron = "${process.status-check-cron}")
|
||||
|
@ -105,9 +111,22 @@ public class MainServer implements InitializingBean {
|
|||
boolean running = true;
|
||||
boolean swNewStatus = stateMgr.isActive();
|
||||
|
||||
// Active 상태로 변경된경우
|
||||
if(swNewStatus && !swBeforeStatus){
|
||||
logger.info("SW상태 변경됨[Active] 스레드 시작.");
|
||||
for(Thread ct : threadList ){
|
||||
ct.start();
|
||||
}
|
||||
// Standby 상태로 변경된경우
|
||||
}else if(!swNewStatus && swBeforeStatus){
|
||||
logger.info("SW상태 변경됨[Standby] 스레드 중지.");
|
||||
for(Thread ct : threadList ){
|
||||
ct.interrupt();
|
||||
}
|
||||
}else {
|
||||
|
||||
// 해당 프로그램이 Active일때 Thread Interrupt 유무 체크
|
||||
if(swNewStatus){
|
||||
|
||||
for(Thread ct : threadList ){
|
||||
if(ct.isInterrupted()){
|
||||
running = false;
|
||||
|
@ -117,43 +136,44 @@ public class MainServer implements InitializingBean {
|
|||
|
||||
if(running){
|
||||
stateMgr.updateState(SystemState.Normal);
|
||||
|
||||
for(Thread ct : threadList ){
|
||||
if(ct.getState() == Thread.State.NEW) ct.start();
|
||||
}
|
||||
|
||||
}else{
|
||||
stateMgr.updateState(SystemState.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Scheduled(cron = "${process.file-backup-cron}")
|
||||
public void fileRecv() throws Exception{
|
||||
// if (cfg.flagFile) {
|
||||
/* 파일 압축 */
|
||||
// fileUtil.createZipFile(cfg.fileZipPath, cfg.fileZipBakPath, cfg.fileMakeTime);
|
||||
// }
|
||||
}
|
||||
|
||||
swBeforeStatus = swNewStatus;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Scheduled(cron = "${process.data-backup-cron}")
|
||||
public void dataFileRecv() throws Exception{
|
||||
if (cfg.flagDataFile) {
|
||||
/* 파일 압축 */
|
||||
fileUtil.createZipFile(cfg.dataZipPath, cfg.dataZipBakPath, cfg.dataMakeTime);
|
||||
String[] arrSW = cfg.swclassification;
|
||||
for(String swIdx : arrSW){
|
||||
fileUtil.createZipFile(cfg.dataZipPath +"/"+ swIdx , cfg.dataZipBakPath +"/"+ swIdx, cfg.dataMakeTime);
|
||||
}
|
||||
}
|
||||
|
||||
// 매 시간 10분 간격 으로 실행
|
||||
@Scheduled(cron = "${process.file-make-cron}")
|
||||
public void fileMake() throws Exception{
|
||||
// if (cfg.flagFile) {
|
||||
// FILE_LOG_NAME = fileUtil.createLogFile(cfg.fileZipPath, cfg.fileZipBakPath, cfg.fileMakeTime);
|
||||
// }
|
||||
}
|
||||
|
||||
@Scheduled(cron = "${process.data-make-cron}")
|
||||
public void dataFileMake() throws Exception{
|
||||
if (cfg.flagDataFile) {
|
||||
DATA_FILE_NAME = fileUtil.createLogFile(cfg.dataZipPath, cfg.dataZipBakPath, cfg.dataMakeTime);
|
||||
String[] arrSW = cfg.swclassification;
|
||||
for(String swIdx : arrSW){
|
||||
DATA_FILE_NAME = fileUtil.createLogFile(cfg.dataZipPath +"/"+ swIdx , cfg.dataZipBakPath +"/"+ swIdx, cfg.dataMakeTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "${process.data-delete-cron}")
|
||||
public void dataFileDelete() throws Exception{
|
||||
fileUtil.deleteLogFiles(cfg.dataZipBakPath, cfg.dataSaveDays);
|
||||
}
|
||||
|
||||
|
||||
public void startKafkaThread() {
|
||||
|
||||
|
@ -169,7 +189,7 @@ public class MainServer implements InitializingBean {
|
|||
this.kafkaTopicReader=topicReader;
|
||||
Thread thread = new Thread(topicReader);
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
//thread.start();
|
||||
|
||||
threadList.add(thread);
|
||||
|
||||
|
@ -186,38 +206,97 @@ public class MainServer implements InitializingBean {
|
|||
|
||||
|
||||
String[] arrSW = cfg.swclassification;
|
||||
Map<String, String> topics = topicList.getTopics();
|
||||
// Map<String, String> topics = topicList.getTopics();
|
||||
|
||||
Queue<String> dataFileQue = cfg.getDataFileQueue();
|
||||
|
||||
Thread thread = null;
|
||||
|
||||
for(String swIdx : arrSW){
|
||||
String topic = topics.get(swIdx);
|
||||
// String topic = topics.get(swIdx);
|
||||
|
||||
Queue<String> rcvQueue = cfg.getRcvQueueMap().get(swIdx);
|
||||
|
||||
if(swIdx.equals("6")){
|
||||
if(swIdx.equals("1")){
|
||||
|
||||
AiVoiceMetaRunnable aiVoiceParseRunnable = new AiVoiceMetaRunnable(rcvQueue, cfg.dataFileQueue,
|
||||
AsdeParseRunnable parseRunnable = new AsdeParseRunnable(rcvQueue, dataFileQue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
Thread thread = new Thread(aiVoiceParseRunnable);
|
||||
thread = new Thread(parseRunnable);
|
||||
|
||||
}
|
||||
else if(swIdx.equals("2")){
|
||||
|
||||
AiLocationParseRunnable parseRunnable = new AiLocationParseRunnable(rcvQueue, dataFileQue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
thread = new Thread(parseRunnable);
|
||||
}
|
||||
else if(swIdx.equals("3")){
|
||||
|
||||
FusionParseRunnable parseRunnable = new FusionParseRunnable(rcvQueue, dataFileQue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
thread = new Thread(parseRunnable);
|
||||
}
|
||||
else if(swIdx.equals("4")){
|
||||
|
||||
RadarParseRunnable parseRunnable = new RadarParseRunnable(rcvQueue, dataFileQue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
thread = new Thread(parseRunnable);
|
||||
}
|
||||
else if(swIdx.equals("6")){
|
||||
|
||||
AiVoiceMetaRunnable parseRunnable = new AiVoiceMetaRunnable(rcvQueue, dataFileQue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
thread = new Thread(parseRunnable);
|
||||
}
|
||||
else if(swIdx.equals("7")){
|
||||
|
||||
StatusAnaParseRunnable parseRunnable = new StatusAnaParseRunnable(rcvQueue, dataFileQue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
thread = new Thread(parseRunnable);
|
||||
}
|
||||
else if(swIdx.equals("8")){
|
||||
|
||||
StandStatusParseRunnable parseRunnable = new StandStatusParseRunnable(rcvQueue, dataFileQue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
thread = new Thread(parseRunnable);
|
||||
}
|
||||
else if(swIdx.equals("9")){
|
||||
|
||||
CctvPtzParseRunnable parseRunnable = new CctvPtzParseRunnable(rcvQueue, dataFileQue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
thread = new Thread(parseRunnable);
|
||||
}
|
||||
else if(swIdx.equals("10")){
|
||||
|
||||
RuteParseRunnable parseRunnable = new RuteParseRunnable(rcvQueue, dataFileQue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
thread = new Thread(parseRunnable);
|
||||
}
|
||||
else if(swIdx.equals("11")){
|
||||
|
||||
AiVoiceMetaRunnable aiVoiceParseRunnable = new AiVoiceMetaRunnable(rcvQueue, dataFileQue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
thread = new Thread(aiVoiceParseRunnable);
|
||||
}
|
||||
|
||||
if(thread != null){
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
//thread.start();
|
||||
threadList.add(thread);
|
||||
|
||||
logger.info("parserThread 생성 [" +swIdx+ "]");
|
||||
}
|
||||
|
||||
if(swIdx.equals("11")){
|
||||
|
||||
AiVoiceMetaRunnable aiVoiceParseRunnable = new AiVoiceMetaRunnable(rcvQueue, cfg.dataFileQueue,
|
||||
cfg.queueChunkSize, cfg.parseTargetSleepMs,
|
||||
cfg.classification, swIdx, cfg.logclassification );
|
||||
Thread thread = new Thread(aiVoiceParseRunnable);
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
threadList.add(thread);
|
||||
|
||||
logger.info("parserThread 생성 [" +swIdx+ "]");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -229,7 +308,7 @@ public class MainServer implements InitializingBean {
|
|||
}
|
||||
|
||||
public void startDataLoggerThread() {
|
||||
DataLogger dataLoggerRunnable = new DataLogger(cfg.dataFileQueue, cfg.queueChunkSize, cfg.sqlLoggerSleepMs);
|
||||
DataLogger dataLoggerRunnable = new DataLogger(cfg.getDataFileQueue(), cfg.queueChunkSize, cfg.sqlLoggerSleepMs);
|
||||
this.dataLoggerRunnable = dataLoggerRunnable;
|
||||
|
||||
Thread thread = new Thread(dataLoggerRunnable);
|
||||
|
|
|
@ -15,36 +15,30 @@ public class ArrayBlockingLoggingQueue<Object> extends ArrayBlockingQueue<Object
|
|||
public ArrayBlockingLoggingQueue(int capacity, boolean fair,
|
||||
Collection<? extends Object> c) {
|
||||
super(capacity, fair, c);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ArrayBlockingLoggingQueue(int capacity, boolean fair) {
|
||||
super(capacity, fair);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ArrayBlockingLoggingQueue(int capacity) {
|
||||
super(capacity);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean add(Object e) {
|
||||
// TODO Auto-generated method stub
|
||||
logger.debug(e+"");
|
||||
return super.add(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean offer(Object e) {
|
||||
// TODO Auto-generated method stub
|
||||
logger.debug(e+"");
|
||||
return super.offer(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean offer(Object e, long timeout, TimeUnit unit) throws InterruptedException {
|
||||
// TODO Auto-generated method stub
|
||||
logger.debug(e+"");
|
||||
return super.offer(e, timeout, unit);
|
||||
}
|
||||
|
|
|
@ -7,27 +7,24 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class FileUtil {
|
||||
|
||||
// @Value("${file-zip-path}")
|
||||
// private String fileZipPath;
|
||||
//
|
||||
// @Value("${file-zip-bak-path}")
|
||||
// private String fileZipBakPath;
|
||||
//
|
||||
// @Value("${file-make-time}")
|
||||
// private int fileMakeTime;
|
||||
|
||||
// public static String FILE_LOG_NAME;
|
||||
private static final Logger logger = LoggerFactory.getLogger(FileUtil.class);
|
||||
|
||||
/**
|
||||
* 로그파일을 압축한다.
|
||||
|
@ -41,14 +38,14 @@ public class FileUtil {
|
|||
backDir.mkdirs();
|
||||
}
|
||||
|
||||
SimpleDateFormat fileFormatter = new SimpleDateFormat("yyyyMMddHHmm");
|
||||
SimpleDateFormat fileFormatter = new SimpleDateFormat("yyyyMMdd-HHmm");
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.MINUTE, -20); // 20분전 데이터 확인
|
||||
|
||||
String time20 = fileFormatter.format(cal.getTime());
|
||||
|
||||
// 압축할 파일 명 확인.
|
||||
String bakFileName = "file."+time20+".log";
|
||||
String bakFileName = "data."+time20+".log";
|
||||
|
||||
String fileName = "";
|
||||
ZipOutputStream zip_out = null;
|
||||
|
@ -84,7 +81,7 @@ public class FileUtil {
|
|||
|
||||
}
|
||||
} else {
|
||||
System.out.println("파일이 존재하지 않습니다.");
|
||||
//System.out.println("파일이 존재하지 않습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,27 +114,40 @@ public class FileUtil {
|
|||
|
||||
}
|
||||
|
||||
private void bakFileDelete(String fileZipPath, String date) throws IOException {
|
||||
File folder = new File(fileZipPath+"/"+date); // file 생성
|
||||
public void deleteLogFiles(String sFile, int day) {
|
||||
|
||||
File dirPath = new File(sFile);
|
||||
int sec = day * (24*60*60);
|
||||
|
||||
if (!dirPath.isDirectory()) return;
|
||||
|
||||
for (File adminDirs : dirPath.listFiles()) {
|
||||
|
||||
File files[] = adminDirs.listFiles();
|
||||
if (files == null) continue;
|
||||
|
||||
for (File f : files) {
|
||||
try {
|
||||
while(folder.exists()){
|
||||
File[] files = folder.listFiles();
|
||||
|
||||
for(File file : files){
|
||||
file.delete(); // 하위 파일 삭제
|
||||
long fModify = getSecondsFromModification(f);
|
||||
if (fModify > sec) {
|
||||
logger.info("백업 파일 삭제 : " + f.getAbsolutePath() + " 최종 로깅 : " + (fModify /24/60/60) + "일 전" );
|
||||
f.delete();
|
||||
}
|
||||
|
||||
// 폴더 삭제
|
||||
if(files.length == 0 && folder.isDirectory()){ // 하위 파일이 없는지와 폴더인지 확인 후 폴더 삭제
|
||||
folder.delete(); // 대상폴더 삭제
|
||||
}
|
||||
}
|
||||
|
||||
} catch(Exception e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 파일의 수정한 날짜를 현재 시간 대비 경과 시간을 초로 환산 하여 리턴
|
||||
private static long getSecondsFromModification(File f) throws IOException {
|
||||
|
||||
Path attribPath = f.toPath();
|
||||
BasicFileAttributes basicAttribs = Files.readAttributes(attribPath, BasicFileAttributes.class);
|
||||
return (System.currentTimeMillis() - basicAttribs.lastModifiedTime().to(TimeUnit.MILLISECONDS)) / 1000;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그파일을 생성하는 함수
|
||||
|
@ -172,11 +182,11 @@ public class FileUtil {
|
|||
}
|
||||
|
||||
// 생성할 파일명을 설정한다.
|
||||
SimpleDateFormat fileFormatter = new SimpleDateFormat("yyyyMMddHH");
|
||||
SimpleDateFormat fileFormatter = new SimpleDateFormat("yyyyMMdd-HH");
|
||||
String fileTime = fileFormatter.format(now) + nowT;
|
||||
|
||||
try {
|
||||
_path = fileZipPath+"/file."+fileTime+".log";
|
||||
_path = fileZipPath+"/data."+fileTime+".log";
|
||||
|
||||
// static 변수에 값을 세팅한다.
|
||||
//FILE_LOG_NAME = _path;
|
||||
|
@ -190,7 +200,7 @@ public class FileUtil {
|
|||
if (file.createNewFile()) {
|
||||
System.out.println("파일 생성 완료");
|
||||
} else {
|
||||
System.out.println("파일 이미 존재");
|
||||
//System.out.println("파일 이미 존재");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class LogFileDelete {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(LogFileDelete.class);
|
||||
|
||||
public static void deleteFolders(String sFile, int sec) {
|
||||
|
||||
File video = new File(sFile);
|
||||
|
||||
if (!video.isDirectory()) return;
|
||||
|
||||
for (File adminDirs : video.listFiles()) {
|
||||
|
||||
File files[] = adminDirs.listFiles();
|
||||
if (files == null) continue;
|
||||
|
||||
for (File f : files) {
|
||||
try {
|
||||
long fModify = getSecondsFromModification(f);
|
||||
if (fModify > sec) {
|
||||
log.info("백업 파일 삭제 : " + f.getAbsolutePath() + " 최종 로깅 : " + (fModify /24/60/60) + "일 전" );
|
||||
f.delete();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 파일의 수정한 날짜를 현재 시간 대비 경과 시간을 초로 환산 하여 리턴
|
||||
private static long getSecondsFromModification(File f) throws IOException {
|
||||
|
||||
Path attribPath = f.toPath();
|
||||
BasicFileAttributes basicAttribs = Files.readAttributes(attribPath, BasicFileAttributes.class);
|
||||
return (System.currentTimeMillis() - basicAttribs.lastModifiedTime().to(TimeUnit.MILLISECONDS)) / 1000;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,32 +1,18 @@
|
|||
server:
|
||||
port: 8090
|
||||
|
||||
# spring:
|
||||
# datasource:
|
||||
# hikari:
|
||||
# maximum-pool-size: 1
|
||||
# minimum-idle: 1
|
||||
#main:
|
||||
#web-application-type: none
|
||||
# db:
|
||||
# #db-type:oracle,mariadb(other - coding more!)
|
||||
# #db-type: oracle
|
||||
# batch-insert-size: 1000
|
||||
# datasource:
|
||||
# #jdbc-url: jdbc:tibero:thin:@118.220.143.174:18629:SACP_T_DB
|
||||
# jdbc-url: jdbc:tibero:thin:@10.200.31.4:8629:sacp #공항
|
||||
# driver-class-name: com.tmax.tibero.jdbc.TbDriver
|
||||
# username: UTRACK
|
||||
# password: UTRACK
|
||||
# connectionTimeout: 5000
|
||||
# maxLifetime: 30000
|
||||
port: 18990
|
||||
|
||||
spring:
|
||||
db:
|
||||
batch-insert-size: 1000
|
||||
datasource:
|
||||
driver-class-name: com.tmax.tibero.jdbc.TbDriver
|
||||
jdbc-url: jdbc:tibero:thin:@118.220.143.174:18629:SACP_T_DB
|
||||
username: UTRACK
|
||||
password: UTRACK
|
||||
connectionTimeout: 5000
|
||||
maxLifetime: 30000
|
||||
|
||||
client:
|
||||
server:
|
||||
ip: 127.0.0.1
|
||||
port: 8030
|
||||
reconn-time-sec: 5
|
||||
queue-count: 1000000
|
||||
|
||||
selep-time-ms:
|
||||
|
@ -42,60 +28,50 @@ dynamic-dedupl:
|
|||
|
||||
|
||||
process:
|
||||
#count-log-cron: 0 0/1 * 1/1 * *
|
||||
#count-log-cron: 0/10 * * 1/1 * *
|
||||
queue-chunk-size: 1000
|
||||
# 매일 오전 9시부터 오후7시까지 1분마다 실행
|
||||
# rest api 호출 스케줄러
|
||||
rest-cron: 0 0/1 * * * *
|
||||
# 파일 백업 스케쥴러 시간
|
||||
file-backup-cron: 0 0/10 * * * *
|
||||
# 파일 생성 스케쥴러 시간
|
||||
file-make-cron: 0 0/10 * * * *
|
||||
# 파일 백업 스케쥴러 시간
|
||||
data-backup-cron: 0 0/10 * * * *
|
||||
# 파일 생성 스케쥴러 시간
|
||||
data-make-cron: 0 0/10 * * * *
|
||||
# 파일 삭제 스케쥴러 시간
|
||||
data-delete-cron: 0 0 03 * * *
|
||||
# 스레드 상태 체크 스케줄러
|
||||
status-check-cron: 0/10 * * * * *
|
||||
|
||||
flag:
|
||||
# database: false
|
||||
datafile: true #logstash data log file, Log 포멧
|
||||
# file: true #rest api log file, Json
|
||||
|
||||
file-zip-path: ./logs/file
|
||||
file-zip-bak-path: ./logs/backup
|
||||
file-make-time: 10
|
||||
|
||||
data-zip-path: ./logs/data
|
||||
data-zip-bak-path: ./logs/databackup
|
||||
data-make-time: 10
|
||||
file-zip-path: ./logs/data
|
||||
file-zip-bak-path: ./logs/databackup
|
||||
file-make-time: 10 #Min
|
||||
file-save-days: 90 #Day
|
||||
|
||||
|
||||
kafka:
|
||||
bootstrapServers: http://10.200.31.6:9091,http://10.200.31.8:9091,http://10.200.31.142:9091 #공항
|
||||
groupId: TssTopicReader_TEST
|
||||
topics: # swclassification 동일하게 번호 설정
|
||||
1: ic.recv.asde
|
||||
2: ai.analyze.location
|
||||
3: ic.tracking.fusion
|
||||
4: ic.recv.radar
|
||||
5: ai.analyze.video
|
||||
6: ai.analyze.voice
|
||||
7: ic.analyze.situation
|
||||
8: ic.analyze.stand.status
|
||||
9: ic.tracking.ptz
|
||||
10: ic.service.route
|
||||
11: ai.analyze.ltea
|
||||
12: ic.tracking.ptz.manual
|
||||
1: ic.recv.asde # LK0402 #ASDE정보저장S/W
|
||||
2: ai.analyze.location # AI0202 #영상메타데이터저장S/W
|
||||
3: ic.tracking.fusion # IC0102 #위치융합정보저장S/W
|
||||
4: ic.recv.radar # LK0503 #레이더추적정보저장S/W
|
||||
# 5: ai.analyze.video # 미사용, 8번으로 대체
|
||||
6: ai.analyze.voice # AI0402 #음성메타데이터저장S/W
|
||||
7: ic.analyze.situation # IC0303 #주기장 상태 분석 정보저장S/W
|
||||
8: ic.analyze.stand.status # IC0303 #주기장 상태 분석 정보저장S/W
|
||||
9: ic.tracking.ptz # IC0502 #추적용CCTV제어정보저장S/W
|
||||
10: ic.service.route # IC0702 #이동경로분석정보저장S/W
|
||||
11: ai.analyze.ltea # AI0402 #음성메타데이터저장S/W
|
||||
12: ic.tracking.ptz.manual # IC0502 #추적용CCTV제어정보저장S/W
|
||||
|
||||
classification: 1 #이중화되어 있는 서버의 Index
|
||||
swclassification: 6, 11 #sw구분
|
||||
swclassification: 1 #sw구분
|
||||
logclassification: 1 #log구분
|
||||
|
||||
state:
|
||||
# 공통코드 CT001의 코드 6자리
|
||||
# 공통코드 시스템 코드(CT001)의 코드 6자리
|
||||
id: TEST09 # 위치융합정보
|
||||
# 1:Primary, 2:Secondary
|
||||
type: Primary
|
||||
# DisplayLog: true
|
||||
sendlog: true
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
<encoder
|
||||
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${LOG_PATTERN}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
@ -27,7 +26,6 @@
|
|||
<encoder
|
||||
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${LOG_PATTERN}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<rollingPolicy
|
||||
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
|
@ -37,6 +35,21 @@
|
|||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<appender name="Ststs_file"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/STATS/stats.log</file>
|
||||
<encoder
|
||||
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%msg%n</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy
|
||||
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/STATS/stats.%d{yyyy-MM-dd}.log
|
||||
</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
|
||||
<!--파일에 로그를 남깁니다. -->
|
||||
<appender name="SQL"
|
||||
|
@ -45,7 +58,6 @@
|
|||
<encoder
|
||||
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<rollingPolicy
|
||||
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
|
@ -81,4 +93,9 @@
|
|||
<appender-ref ref="File" />
|
||||
</root>
|
||||
|
||||
<logger name="STATS" level="INFO">
|
||||
<appender-ref ref="Console"/>
|
||||
<appender-ref ref="Ststs_file"/>
|
||||
</logger>
|
||||
|
||||
</configuration>
|
Loading…
Reference in New Issue