win 0213
parent
8be31e9e28
commit
0065a81fe7
cctv
data
src/main
java/kr/gmtc/tss
main
sqllog
cctv_new - 복사본
.mvn/wrapper
data
src/main
java
META-INF
kr/gmtc/tss
cctv_new
.mvn/wrapper
data
src/main
java
META-INF
kr/gmtc/tss
main
sqllog
radar
130522
cctv/data/marine_area.xml
130522
cctv/data/marine_area.xml
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
63
cctv/pom.xml
63
cctv/pom.xml
|
@ -5,15 +5,14 @@
|
|||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.5</version>
|
||||
<version>2.7.8</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>kr.gmtc</groupId>
|
||||
<artifactId>cctv</artifactId>
|
||||
<artifactId>tss</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>cctv</name>
|
||||
<description>CCTV TSS</description>
|
||||
|
||||
<description>TRACK cctv</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<!-- versions -->
|
||||
|
@ -32,7 +31,7 @@
|
|||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -40,20 +39,19 @@
|
|||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.3.7</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
|
@ -61,7 +59,6 @@
|
|||
<version>1.16</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
|
@ -72,26 +69,26 @@
|
|||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<version>2.17.2</version>
|
||||
</dependency>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
|
||||
<dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>4.1.85.Final</version>
|
||||
</dependency>
|
||||
</dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.projectreactor</groupId>
|
||||
<artifactId>reactor-spring</artifactId>
|
||||
<version>1.0.1.RELEASE</version>
|
||||
</dependency>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
<!-- <dependency>
|
||||
|
@ -99,34 +96,42 @@
|
|||
<artifactId>EyeGW-Core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>2.14.0</version>
|
||||
</dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>kr.gmtc</groupId>
|
||||
<artifactId>EyeGW-Core</artifactId>
|
||||
<version>0.0.3</version>
|
||||
|
||||
<dependency>
|
||||
<groupId>kr.gmt.so</groupId>
|
||||
<artifactId>state-spring-boot-starter</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/EyeGW-Core-0.0.3.jar</systemPath>
|
||||
</dependency>
|
||||
<systemPath>${basedir}/lib/state-spring-boot-starter-1.0.3.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ipworks.local</groupId>
|
||||
<artifactId>ipworks-local-1.0.0</artifactId>
|
||||
<scope>system</scope>
|
||||
<version>1.0.0</version>
|
||||
<systemPath>${basedir}/lib/ipworks-local-1.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tmax.tibero</groupId>
|
||||
<artifactId>tibero-jdbc</artifactId>
|
||||
<version>6.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/tibero6-jdbc.jar</systemPath>
|
||||
</dependency>
|
||||
<systemPath>${basedir}/lib/tibero6-jdbc.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>EyeTSS_AiLocation</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -11,39 +11,41 @@ import kr.gmtc.tss.db.BatchInsertManager;
|
|||
public class DataInsertRunnable implements Runnable {
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<CctvTrackVO> cctvTrackQueue;
|
||||
Queue<CctvTrackVO> cctvTrackLastQueue;
|
||||
Queue<CctvTrackVO> trackQueue;
|
||||
Queue<CctvTrackVO> trackLastQueue;
|
||||
private boolean isRunning = false;
|
||||
private int batchInsertSize = 1000;
|
||||
|
||||
BatchInsertManager batchInsertManager;
|
||||
private long sleepMillis;
|
||||
private String topic;
|
||||
|
||||
public DataInsertRunnable(Queue<CctvTrackVO> cctvTrackQueue, Queue<CctvTrackVO> cctvTrackLastQueue, int batchInsertSize, BatchInsertManager batchInsertManager, long sleepMillis) {
|
||||
this.cctvTrackQueue = cctvTrackQueue;
|
||||
this.cctvTrackLastQueue = cctvTrackLastQueue;
|
||||
this.batchInsertSize = batchInsertSize;
|
||||
this.batchInsertManager = batchInsertManager;
|
||||
this.sleepMillis = sleepMillis;
|
||||
public DataInsertRunnable(Queue<CctvTrackVO> trackQueue, Queue<CctvTrackVO> trackLastQueue, int batchInsertSize, BatchInsertManager batchInsertManager, long sleepMillis, String topic) {
|
||||
this.trackQueue=trackQueue;
|
||||
this.trackLastQueue=trackLastQueue;
|
||||
this.batchInsertSize=batchInsertSize;
|
||||
this.batchInsertManager=batchInsertManager;
|
||||
this.sleepMillis=sleepMillis;
|
||||
this.topic=topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning=true;
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
CctvTrackVO [] chunkTrackArr = getChunkTrackArr(cctvTrackQueue);
|
||||
CctvTrackVO [] chunkTrackLastArr = getChunkTrackArr(cctvTrackLastQueue);
|
||||
CctvTrackVO [] chunkTrackArr = getChunkTrackArr(trackQueue);
|
||||
// TrackVO [] chunkTrackLastArr = getChunkTrackArr(trackLastQueue);
|
||||
if(isRunning) {
|
||||
if(chunkTrackArr.length > 0) {
|
||||
batchInsertManager.insertCctvData(chunkTrackArr);
|
||||
batchInsertManager.insertTrackData(chunkTrackArr,topic);
|
||||
}
|
||||
|
||||
if(chunkTrackLastArr.length > 0) {
|
||||
//last테이블 사용안하기로함
|
||||
//batchInsertManager.insertCctvLastData(chunkTrackLastArr);
|
||||
}
|
||||
/*
|
||||
* if(chunkTrackLastArr.length > 0) {
|
||||
* batchInsertManager.insertTrackLastData(chunkTrackLastArr); }
|
||||
*/
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -69,7 +71,7 @@ public class DataInsertRunnable implements Runnable {
|
|||
}
|
||||
return chunkArr;
|
||||
}
|
||||
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
|
|
|
@ -8,18 +8,19 @@ import java.util.LinkedHashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.apache.ibatis.javassist.compiler.ast.Keyword;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.tss.data.vo.CctvTrackVO;
|
||||
|
||||
import kr.gmtc.tss.status.CountStatus;
|
||||
|
||||
public class ParseTargetRunnable implements Runnable {
|
||||
|
||||
|
||||
private boolean flagFile;
|
||||
private boolean flagDataBase;
|
||||
private boolean flagDataFile;
|
||||
|
@ -27,10 +28,10 @@ public class ParseTargetRunnable implements Runnable {
|
|||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<CctvTrackVO> cctvTrackQueue;
|
||||
Queue<CctvTrackVO> cctvTrackLastQueue;
|
||||
Queue<CctvTrackVO> trackQueue;
|
||||
Queue<CctvTrackVO> trackLastQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
Queue<String> messageBodyQueue;
|
||||
Queue<CctvTrackVO> messageBodyQueue;
|
||||
|
||||
private int rcvPos = 0;
|
||||
private int rcvStatic = 0;
|
||||
|
@ -38,18 +39,18 @@ public class ParseTargetRunnable implements Runnable {
|
|||
private boolean isRunning = false;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
|
||||
private String classification;
|
||||
private String swclassification;
|
||||
private String logclassification;
|
||||
|
||||
public ParseTargetRunnable(Queue<String> rcvQueue, Queue<CctvTrackVO> cctvTrackQueue, Queue<CctvTrackVO> cctvTrackLastQueue
|
||||
, Queue<String> dataFileQueue, Queue<String> messageBodyQueue
|
||||
, int listChunkSize, long sleepMillis, boolean flagFile, boolean flagDataBase, boolean flagDataFile
|
||||
|
||||
public ParseTargetRunnable(Queue<String> rcvQueue, Queue<CctvTrackVO> trackQueue, Queue<CctvTrackVO> trackLastQueue
|
||||
, Queue<String> dataFileQueue,Queue<CctvTrackVO> messageBodyQueue, int listChunkSize
|
||||
, long sleepMillis, boolean flagFile, boolean flagDataBase, boolean flagDataFile
|
||||
, String classification, String swclassification, String logclassification) {
|
||||
this.rcvQueue = rcvQueue;
|
||||
this.cctvTrackQueue = cctvTrackQueue;
|
||||
this.cctvTrackLastQueue = cctvTrackLastQueue;
|
||||
this.trackQueue = trackQueue;
|
||||
this.trackLastQueue = trackLastQueue;
|
||||
this.dataFileQueue = dataFileQueue;
|
||||
this.messageBodyQueue = messageBodyQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
|
@ -99,150 +100,136 @@ public class ParseTargetRunnable implements Runnable {
|
|||
|
||||
private void parseAndEnqueue(String result) {
|
||||
try {
|
||||
if(flagFile) {
|
||||
messageBodyQueue.add(result);
|
||||
}
|
||||
ArrayList<CctvTrackVO> histroyQueue = new ArrayList<CctvTrackVO>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
if(flagDataBase||flagDataFile) {
|
||||
ArrayList<CctvTrackVO> histroyQueue = new ArrayList<CctvTrackVO>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
// 2023-08-09 cjj 실환경 시 아래 주석 해야 함.
|
||||
// 임시로 json 파일 읽어 오는 부분으로 적용
|
||||
/* start */
|
||||
// ClassPathResource resource = new ClassPathResource("ai_location.json");
|
||||
// byte[] fileData = FileCopyUtils.copyToByteArray(resource.getInputStream());
|
||||
// String json = new String(fileData, Charset.defaultCharset());
|
||||
//
|
||||
// Map<String, Object> jsonMap = mapper.readValue(json, Map.class);
|
||||
// ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) jsonMap.get("data");
|
||||
/* end */
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
// LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) convert.get("data");
|
||||
|
||||
logger.info("수신 데이터 변환 건수 {}", 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;
|
||||
int z = 0;
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
CctvTrackVO t = mapper.convertValue(map, CctvTrackVO.class);
|
||||
|
||||
// 2023-08-09 cjj 실환경 시 아래 주석 해제 해야함.
|
||||
Map<String, Object> convert = mapper.readValue(result, new TypeReference<Map<String, Object>>() {});
|
||||
ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
|
||||
if(list.size() > 0 ) {
|
||||
if(flagDataFile) {
|
||||
if (i > 0) sb.append("^");
|
||||
|
||||
logger.info("수신 데이터 변환 건수 {}", list.size());
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
|
||||
SimpleDateFormat tmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.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 j = 0;
|
||||
for (LinkedHashMap<String, Object> map : list) {
|
||||
// 파싱 작업 시작
|
||||
CctvTrackVO vo = new CctvTrackVO();
|
||||
java.util.Date parsedDate = tmFormat.parse(map.get("dtct_tm").toString());
|
||||
java.sql.Date sqlDate = new java.sql.Date(parsedDate.getTime());
|
||||
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(",");
|
||||
|
||||
vo.setDetctDt(sqlDate);
|
||||
vo.setDetctTy(map.get("dtct_cls").toString());
|
||||
// jjchoi 김동균 선임님과 얘기하여 cc_id의 경우 , 구분자를 두고 한 컬럼에 저장하는것으로 결정.
|
||||
ArrayList<String> cc_id = (ArrayList<String>) map.get("cc_id");
|
||||
String cctvId = "";
|
||||
for (int i = 0; i < cc_id.size(); i++) {
|
||||
if(i != 0) {
|
||||
cctvId += ',';
|
||||
}
|
||||
cctvId += cc_id.get(i);
|
||||
}
|
||||
vo.setCctvInfo(cctvId);
|
||||
vo.setCctvChrgZone(map.get("zn_id").toString());
|
||||
vo.setAcTy(map.get("arcrft_tp").toString());
|
||||
vo.setArlnCd(map.get("arln").toString());
|
||||
vo.setTrackId(map.get("trck_id").toString());
|
||||
|
||||
|
||||
ArrayList<String> bb_tlp = (ArrayList<String>) map.get("bb_tlp");
|
||||
vo.setBbTopLeftX(Double.parseDouble(bb_tlp.get(0).toString()));
|
||||
vo.setBbTopLeftY(Double.parseDouble(bb_tlp.get(1).toString()));
|
||||
|
||||
ArrayList<String> bb_brp = (ArrayList<String>) map.get("bb_brp");
|
||||
vo.setBbBottomRightX(Double.parseDouble(bb_brp.get(0).toString()));
|
||||
vo.setBbBottomRightY(Double.parseDouble(bb_brp.get(1).toString()));
|
||||
|
||||
ArrayList<String> crd_frm = (ArrayList<String>) map.get("crd_frm");
|
||||
vo.setCrdntX(Double.parseDouble(crd_frm.get(0).toString()));
|
||||
vo.setCrdntY(Double.parseDouble(crd_frm.get(1).toString()));
|
||||
|
||||
ArrayList<String> crd_glb = (ArrayList<String>) map.get("crd_glbl");
|
||||
vo.setCrdntLat(Double.parseDouble(crd_glb.get(0).toString()));
|
||||
vo.setCrdntLon(Double.parseDouble(crd_glb.get(1).toString()));
|
||||
|
||||
vo.setDrctn(map.get("drctn").toString());
|
||||
|
||||
vo.setAcStandOnAt(map.get("arcrft_stnd").toString());
|
||||
vo.setObjectSpd(Double.parseDouble(map.get("spd").toString()));
|
||||
|
||||
histroyQueue.add(vo);
|
||||
|
||||
if (j > 0) sb.append("^");
|
||||
sb.append(vo.getDetctDt()); sb.append(",");
|
||||
sb.append(vo.getDetctTy()); sb.append(",");
|
||||
for (int i = 0; i < cc_id.size(); i++) {
|
||||
if(i != 0) {
|
||||
sb.append("@");
|
||||
}
|
||||
sb.append(cc_id.get(i));
|
||||
}
|
||||
sb.append(",");
|
||||
sb.append(vo.getCctvChrgZone()); sb.append(",");
|
||||
sb.append(vo.getAcTy()); sb.append(",");
|
||||
sb.append(vo.getArlnCd()); sb.append(",");
|
||||
sb.append(vo.getTrackId()); sb.append(",");
|
||||
sb.append(vo.getBbTopLeftX()); sb.append("@"); sb.append(vo.getBbTopLeftY()); sb.append(",");
|
||||
sb.append(vo.getBbBottomRightX()); sb.append("@"); sb.append(vo.getBbBottomRightY()); sb.append(",");
|
||||
sb.append(vo.getCrdntX()); sb.append("@"); sb.append(vo.getCrdntY()); sb.append(",");
|
||||
sb.append(vo.getCrdntLat()); sb.append("@"); sb.append(vo.getCrdntLon()); sb.append(",");
|
||||
sb.append(vo.getDrctn()); sb.append(",");
|
||||
sb.append(vo.getAcStandOnAt()); sb.append(",");
|
||||
sb.append(vo.getObjectSpd());
|
||||
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()); sb.append(",");
|
||||
// sb.append(t.getBbTlp()); sb.append(",");
|
||||
// sb.append(t.getBbBrp()); sb.append(",");
|
||||
// sb.append(t.getCrdFrm()); sb.append(",");
|
||||
// sb.append(t.getCrdGlbl()); sb.append(",");
|
||||
|
||||
if(flagDataFile) dataFileQueue.add(sb.toString());
|
||||
if (histroyQueue.size() > 0) {
|
||||
if(flagDataBase) cctvTrackQueue.addAll(histroyQueue);
|
||||
}
|
||||
|
||||
j = 0;
|
||||
for (String k : t.getBbTlp()) {
|
||||
if (j > 0) sb.append("@");
|
||||
sb.append(k);
|
||||
j++;
|
||||
}
|
||||
sb.append(",");
|
||||
|
||||
// histroyQueue.stream().collect(Collectors.groupingBy(TrackVO::getTrgtId), Collectors.maxBy(Comparator.comparing(TrackVO::getRecptnDt)));
|
||||
// histroyQueue
|
||||
// .stream()
|
||||
// .collect(Collectors.groupingBy(CctvTrackVO::getVideoMetaId,
|
||||
// Collectors.maxBy(Comparator.comparing(CctvTrackVO::getDetctDt))
|
||||
// )).forEach((key, value) -> {
|
||||
// logger.info(""+value.get().getDetctDt());
|
||||
// cctvTrackLastQueue.add(value.get());
|
||||
// // value.get().setLstFlag(true);
|
||||
// // logger.info("==>>" + value.get().isLstFlag());
|
||||
// });;
|
||||
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++;
|
||||
|
||||
// if (lastQueue.size() > 0) {
|
||||
// resultMap.put("lastQueue", lastQueue);
|
||||
// resultMap.put("lastQueueTotal", lastQueue.size());
|
||||
// } else {
|
||||
// resultMap.put("lastQueueTotal", 0);
|
||||
// }
|
||||
// logger.info("logstash 포맷 변환 건수 {}", z++);
|
||||
}
|
||||
|
||||
histroyQueue.add(t);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
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(TrackVO::getTargetId,
|
||||
// Collectors.maxBy(Comparator.comparing(TrackVO::getReceptionDate))
|
||||
// )).forEach((key, value) -> {
|
||||
// trackLastQueue.add(value.get());
|
||||
// });;
|
||||
// }
|
||||
}
|
||||
|
||||
} 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);
|
||||
}
|
||||
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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,4 +252,4 @@ public class ParseTargetRunnable implements Runnable {
|
|||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ import java.util.concurrent.ConcurrentSkipListSet;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import gmt.stddecoder.vo.DynamicVO;
|
||||
import kr.gmtc.tss.area.MarineAreaLoader;
|
||||
import kr.gmtc.tss.data.vo.SetDynamicVO;
|
||||
import kr.gmtc.tss.data.vo.SetDynamicVO;
|
||||
import kr.gmtc.tss.util.vo.DynamicVO;
|
||||
|
||||
public class TargetManageRunnable implements Runnable {
|
||||
|
||||
|
|
|
@ -2,273 +2,323 @@ package kr.gmtc.tss.data.vo;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.sql.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.ibatis.javassist.compiler.ast.Keyword;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class CctvTrackVO implements Comparable<CctvTrackVO> {
|
||||
|
||||
private boolean inserted=false;
|
||||
private String marineAreaId="";
|
||||
|
||||
|
||||
public long timeStamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(9)).toEpochMilli();
|
||||
|
||||
public CctvTrackVO() {
|
||||
}
|
||||
|
||||
protected LocalDateTime dateTime;
|
||||
private String videoMetaId;
|
||||
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss.SSS", timezone = "Asia/Seoul")
|
||||
private Date detctDt;
|
||||
// private String detctDt;
|
||||
private String detctTy;
|
||||
private String cctvInfo;
|
||||
private String cctvChrgZone;
|
||||
private String acTy;
|
||||
private String arlnCd;
|
||||
private String trackId;
|
||||
private double bbTopLeftX;
|
||||
private double bbTopLeftY;
|
||||
private double bbBottomRightX;
|
||||
private double bbBottomRightY;
|
||||
private double crdntX;
|
||||
private double crdntY;
|
||||
private double crdntLat;
|
||||
private double crdntLon;
|
||||
|
||||
@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;
|
||||
private String acStandOnAt;
|
||||
private double objectSpd;
|
||||
private String registerId;
|
||||
private String registDt;
|
||||
private String updusrId;
|
||||
private String updtDt;
|
||||
private boolean lstFlag;
|
||||
|
||||
@JsonProperty("arcrft_stnd")
|
||||
private String arcrftStnd;
|
||||
|
||||
@JsonProperty("spd")
|
||||
private String spd;
|
||||
|
||||
|
||||
|
||||
@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 + "]";
|
||||
}
|
||||
|
||||
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 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 getVideoMetaId() {
|
||||
return videoMetaId;
|
||||
|
||||
|
||||
public String getDtctTm() {
|
||||
return dtctTm;
|
||||
}
|
||||
|
||||
public void setVideoMetaId(String videoMetaId) {
|
||||
this.videoMetaId = videoMetaId;
|
||||
|
||||
|
||||
public void setDtctTm(String dtctTm) {
|
||||
this.dtctTm = dtctTm;
|
||||
}
|
||||
|
||||
public Date getDetctDt() {
|
||||
return detctDt;
|
||||
|
||||
|
||||
public String getDtctCls() {
|
||||
return dtctCls;
|
||||
}
|
||||
|
||||
public void setDetctDt(Date detctDt) {
|
||||
this.detctDt = detctDt;
|
||||
|
||||
|
||||
public void setDtctCls(String dtctCls) {
|
||||
this.dtctCls = dtctCls;
|
||||
}
|
||||
|
||||
public String getDetctTy() {
|
||||
return detctTy;
|
||||
|
||||
|
||||
public String getMtaTm() {
|
||||
return mtaTm;
|
||||
}
|
||||
|
||||
public void setDetctTy(String detctTy) {
|
||||
this.detctTy = detctTy;
|
||||
|
||||
|
||||
public void setMtaTm(String mtaTm) {
|
||||
this.mtaTm = mtaTm;
|
||||
}
|
||||
|
||||
public String getCctvInfo() {
|
||||
return cctvInfo;
|
||||
|
||||
|
||||
public String getRwTm() {
|
||||
return rwTm;
|
||||
}
|
||||
|
||||
public void setCctvInfo(String cctvInfo) {
|
||||
this.cctvInfo = cctvInfo;
|
||||
|
||||
|
||||
public void setRwTm(String rwTm) {
|
||||
this.rwTm = rwTm;
|
||||
}
|
||||
|
||||
public String getCctvChrgZone() {
|
||||
return cctvChrgZone;
|
||||
|
||||
|
||||
public List<String> getCcId() {
|
||||
return ccId;
|
||||
}
|
||||
|
||||
public void setCctvChrgZone(String cctvChrgZone) {
|
||||
this.cctvChrgZone = cctvChrgZone;
|
||||
|
||||
|
||||
public void setCcId(List<String> ccId) {
|
||||
this.ccId = ccId;
|
||||
}
|
||||
|
||||
public String getAcTy() {
|
||||
return acTy;
|
||||
|
||||
|
||||
public String getZnId() {
|
||||
return znId;
|
||||
}
|
||||
|
||||
public void setAcTy(String acTy) {
|
||||
this.acTy = acTy;
|
||||
|
||||
|
||||
public void setZnId(String znId) {
|
||||
this.znId = znId;
|
||||
}
|
||||
|
||||
public String getArlnCd() {
|
||||
return arlnCd;
|
||||
|
||||
|
||||
public String getArcrftTp() {
|
||||
return arcrftTp;
|
||||
}
|
||||
|
||||
public void setArlnCd(String arlnCd) {
|
||||
this.arlnCd = arlnCd;
|
||||
|
||||
|
||||
public void setArcrftTp(String arcrftTp) {
|
||||
this.arcrftTp = arcrftTp;
|
||||
}
|
||||
|
||||
public String getTrackId() {
|
||||
return trackId;
|
||||
|
||||
|
||||
public String getArln() {
|
||||
return arln;
|
||||
}
|
||||
|
||||
public void setTrackId(String trackId) {
|
||||
this.trackId = trackId;
|
||||
|
||||
|
||||
public void setArln(String arln) {
|
||||
this.arln = arln;
|
||||
}
|
||||
|
||||
public double getBbTopLeftX() {
|
||||
return bbTopLeftX;
|
||||
|
||||
|
||||
public String getTrckId() {
|
||||
return trckId;
|
||||
}
|
||||
|
||||
public void setBbTopLeftX(double bbTopLeftX) {
|
||||
this.bbTopLeftX = bbTopLeftX;
|
||||
|
||||
|
||||
public void setTrckId(String trckId) {
|
||||
this.trckId = trckId;
|
||||
}
|
||||
|
||||
public double getBbTopLeftY() {
|
||||
return bbTopLeftY;
|
||||
|
||||
|
||||
public List<String> getBbTlp() {
|
||||
return bbTlp;
|
||||
}
|
||||
|
||||
public void setBbTopLeftY(double bbTopLeftY) {
|
||||
this.bbTopLeftY = bbTopLeftY;
|
||||
|
||||
|
||||
public void setBbTlp(List<String> bbTlp) {
|
||||
this.bbTlp = bbTlp;
|
||||
}
|
||||
|
||||
public double getBbBottomRightX() {
|
||||
return bbBottomRightX;
|
||||
|
||||
|
||||
public List<String> getBbBrp() {
|
||||
return bbBrp;
|
||||
}
|
||||
|
||||
public void setBbBottomRightX(double bbBottomRightX) {
|
||||
this.bbBottomRightX = bbBottomRightX;
|
||||
|
||||
|
||||
public void setBbBrp(List<String> bbBrp) {
|
||||
this.bbBrp = bbBrp;
|
||||
}
|
||||
|
||||
public double getBbBottomRightY() {
|
||||
return bbBottomRightY;
|
||||
|
||||
|
||||
public List<String> getCrdFrm() {
|
||||
return crdFrm;
|
||||
}
|
||||
|
||||
public void setBbBottomRightY(double bbBottomRightY) {
|
||||
this.bbBottomRightY = bbBottomRightY;
|
||||
|
||||
|
||||
public void setCrdFrm(List<String> crdFrm) {
|
||||
this.crdFrm = crdFrm;
|
||||
}
|
||||
|
||||
public double getCrdntX() {
|
||||
return crdntX;
|
||||
|
||||
|
||||
public List<String> getCrdGlbl() {
|
||||
return crdGlbl;
|
||||
}
|
||||
|
||||
public void setCrdntX(double crdntX) {
|
||||
this.crdntX = crdntX;
|
||||
|
||||
|
||||
public void setCrdGlbl(List<String> crdGlbl) {
|
||||
this.crdGlbl = crdGlbl;
|
||||
}
|
||||
|
||||
public double getCrdntY() {
|
||||
return crdntY;
|
||||
}
|
||||
|
||||
public void setCrdntY(double crdntY) {
|
||||
this.crdntY = crdntY;
|
||||
}
|
||||
|
||||
public double getCrdntLat() {
|
||||
return crdntLat;
|
||||
}
|
||||
|
||||
public void setCrdntLat(double crdntLat) {
|
||||
this.crdntLat = crdntLat;
|
||||
}
|
||||
|
||||
public double getCrdntLon() {
|
||||
return crdntLon;
|
||||
}
|
||||
|
||||
public void setCrdntLon(double crdntLon) {
|
||||
this.crdntLon = crdntLon;
|
||||
}
|
||||
|
||||
public String getAcStandOnAt() {
|
||||
return acStandOnAt;
|
||||
}
|
||||
|
||||
public void setAcStandOnAt(String acStandOnAt) {
|
||||
this.acStandOnAt = acStandOnAt;
|
||||
}
|
||||
|
||||
public double getObjectSpd() {
|
||||
return objectSpd;
|
||||
}
|
||||
|
||||
public void setObjectSpd(double objectSpd) {
|
||||
this.objectSpd = objectSpd;
|
||||
}
|
||||
|
||||
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 String getDrctn() {
|
||||
return drctn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setDrctn(String drctn) {
|
||||
this.drctn = drctn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getArcrftStnd() {
|
||||
return arcrftStnd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setArcrftStnd(String arcrftStnd) {
|
||||
this.arcrftStnd = arcrftStnd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getSpd() {
|
||||
return spd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setSpd(String spd) {
|
||||
this.spd = spd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
//p1.equals(p2)
|
||||
|
@ -284,4 +334,6 @@ public class CctvTrackVO implements Comparable<CctvTrackVO> {
|
|||
public int compareTo(CctvTrackVO o) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,240 +0,0 @@
|
|||
package kr.gmtc.tss.data.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.sql.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
public class CctvTrackVOBak implements Comparable<CctvTrackVOBak> {
|
||||
|
||||
private boolean inserted=false;
|
||||
private String marineAreaId="";
|
||||
|
||||
public long timeStamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(9)).toEpochMilli();
|
||||
|
||||
public CctvTrackVOBak() {
|
||||
}
|
||||
|
||||
protected LocalDateTime dateTime;
|
||||
private String trgtId;
|
||||
private String trgtTy;
|
||||
private String trkId;
|
||||
private String acTyIcao;
|
||||
private String arlnCdIcao;
|
||||
private String eqpmnTy;
|
||||
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
|
||||
private Date recptnDt;
|
||||
private double lat;
|
||||
private double lon;
|
||||
private double spd;
|
||||
private double cos;
|
||||
private String cctvId;
|
||||
private double xCnts;
|
||||
private double yCnts;
|
||||
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 LocalDateTime getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public void setDateTime(LocalDateTime dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public String getTrgtId() {
|
||||
return trgtId;
|
||||
}
|
||||
|
||||
public void setTrgtId(String trgtId) {
|
||||
this.trgtId = trgtId;
|
||||
}
|
||||
|
||||
public String getTrgtTy() {
|
||||
return trgtTy;
|
||||
}
|
||||
|
||||
public void setTrgtTy(String trgtTy) {
|
||||
this.trgtTy = trgtTy;
|
||||
}
|
||||
|
||||
public String getTrkId() {
|
||||
return trkId;
|
||||
}
|
||||
|
||||
public void setTrkId(String trkId) {
|
||||
this.trkId = trkId;
|
||||
}
|
||||
|
||||
public String getAcTyIcao() {
|
||||
return acTyIcao;
|
||||
}
|
||||
|
||||
public void setAcTyIcao(String acTyIcao) {
|
||||
this.acTyIcao = acTyIcao;
|
||||
}
|
||||
|
||||
public String getArlnCdIcao() {
|
||||
return arlnCdIcao;
|
||||
}
|
||||
|
||||
public void setArlnCdIcao(String arlnCdIcao) {
|
||||
this.arlnCdIcao = arlnCdIcao;
|
||||
}
|
||||
|
||||
public String getEqpmnTy() {
|
||||
return eqpmnTy;
|
||||
}
|
||||
|
||||
public void setEqpmnTy(String eqpmnTy) {
|
||||
this.eqpmnTy = eqpmnTy;
|
||||
}
|
||||
|
||||
public Date getRecptnDt() {
|
||||
return recptnDt;
|
||||
}
|
||||
|
||||
public void setRecptnDt(Date 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 getCctvId() {
|
||||
return cctvId;
|
||||
}
|
||||
|
||||
public void setCctvId(String cctvId) {
|
||||
this.cctvId = cctvId;
|
||||
}
|
||||
|
||||
public double getxCnts() {
|
||||
return xCnts;
|
||||
}
|
||||
|
||||
public void setxCnts(double xCnts) {
|
||||
this.xCnts = xCnts;
|
||||
}
|
||||
|
||||
public double getyCnts() {
|
||||
return yCnts;
|
||||
}
|
||||
|
||||
public void setyCnts(double yCnts) {
|
||||
this.yCnts = yCnts;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
//p1.equals(p2)
|
||||
if(obj instanceof CctvTrackVOBak) {
|
||||
CctvTrackVOBak p = (CctvTrackVOBak)obj;
|
||||
return this.hashCode()==p.hashCode();
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(CctvTrackVOBak o) {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import java.time.LocalDateTime;
|
|||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import gmt.stddecoder.vo.DynamicVO;
|
||||
import kr.gmtc.tss.util.vo.DynamicVO;
|
||||
|
||||
public class SetDynamicVO extends DynamicVO implements Comparable<SetDynamicVO> {
|
||||
|
||||
|
|
|
@ -16,15 +16,13 @@ import kr.gmtc.tss.main.MainServer;
|
|||
import kr.gmtc.tss.status.CountStatus;
|
||||
|
||||
public class BatchInsertManager {
|
||||
|
||||
/** Logger. */
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private SqlSessionFactory sqlSessionFactory;
|
||||
private SqlSession session;
|
||||
|
||||
private Queue<CctvTrackVO> sqlLogCctvTrackQueue;
|
||||
private Queue<CctvTrackVO> sqlLogCctvTrackLastQueue;
|
||||
private Queue<CctvTrackVO> sqlLogTrackQueue;
|
||||
private Queue<CctvTrackVO> sqlLogTrackLastQueue;
|
||||
|
||||
private int savePos=0;
|
||||
private int saveLast=0;
|
||||
|
@ -33,15 +31,17 @@ public class BatchInsertManager {
|
|||
private int failLast=0;
|
||||
private int failStatic=0;
|
||||
|
||||
private String topic;
|
||||
|
||||
/**
|
||||
* mybatis batch insert 속도가 느려서 jdbc 객체를 직접 제어함.
|
||||
* @param sqlSessionFactory
|
||||
* @param dbType
|
||||
*/
|
||||
public BatchInsertManager(SqlSessionFactory sqlSessionFactory, Queue<CctvTrackVO> sqlLogCctvTrackQueue,Queue<CctvTrackVO> sqlLogCctvTrackLastQueue) {
|
||||
public BatchInsertManager(SqlSessionFactory sqlSessionFactory, Queue<CctvTrackVO> sqlLogTrackQueue,Queue<CctvTrackVO> sqlLogTrackLastQueue) {
|
||||
this.sqlSessionFactory = sqlSessionFactory;
|
||||
this.sqlLogCctvTrackQueue = sqlLogCctvTrackQueue;
|
||||
this.sqlLogCctvTrackLastQueue = sqlLogCctvTrackLastQueue;
|
||||
this.sqlLogTrackQueue = sqlLogTrackQueue;
|
||||
this.sqlLogTrackLastQueue = sqlLogTrackLastQueue;
|
||||
// this.dbType=dbType;
|
||||
openSession(false);
|
||||
}
|
||||
|
@ -56,18 +56,21 @@ public class BatchInsertManager {
|
|||
session.close();
|
||||
}
|
||||
|
||||
public void insertCctvData(CctvTrackVO[] setCctvTrackVOArr) {
|
||||
insertCctvData(setCctvTrackVOArr,true);
|
||||
public void insertTrackData(CctvTrackVO[] setTrackVOArr, String topic) {
|
||||
this.topic = topic;
|
||||
insertTrackData(setTrackVOArr,true);
|
||||
}
|
||||
|
||||
|
||||
private void insertCctvData(CctvTrackVO[] setCctvTrackVOArr, boolean isBatch) {
|
||||
int fail = 0;
|
||||
int save = 0;
|
||||
private void insertTrackData(CctvTrackVO[] setTrackVOArr, boolean isBatch) {
|
||||
int fusionFail = 0;
|
||||
int fusionSave = 0;
|
||||
int bboxFail = 0;
|
||||
int bboxSave = 0;
|
||||
|
||||
if(setCctvTrackVOArr==null || setCctvTrackVOArr.length<1) {
|
||||
if(setTrackVOArr==null || setTrackVOArr.length<1) {
|
||||
// logger.error("insertDataAll - No tableList data");
|
||||
logger.debug("insertData(Batch:"+isBatch+") - no data in setCctvTrackVOArr");
|
||||
logger.debug("insertTrackData(Batch:"+isBatch+") - no data in setTrackVOArr");
|
||||
return;
|
||||
}
|
||||
// Table destTable=tableList.get(0);
|
||||
|
@ -76,19 +79,24 @@ public class BatchInsertManager {
|
|||
// String sql = "INSERT INTO " + destTable.getName() + " (" + getInsertCols(destTable.getColumnList()) + ") "
|
||||
// + "VALUES (" + getInsertValueParams(destTable.getColumnList()) + ")";
|
||||
|
||||
// String tableName = "SACP_CCTV_TRACK_" + setCctvTrackVOArr[0].getRecptnDt().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
// String tableName = "SACP_CCTV_TRACK_" + setTrackVOArr[0].getRecptnDt().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
|
||||
// TODO 날짜 처리
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String now_dt = format.format(setCctvTrackVOArr[0].getDetctDt());
|
||||
|
||||
String tableName = "SACP_VIDEO_META_LC";
|
||||
// SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
// String now_dt = format.format(setTrackVOArr[0].getRecptnDt());
|
||||
|
||||
// String tableName = "SACP_TRACK_" + now_dt;
|
||||
String tableName = "SACP_TRACK_FUSION";
|
||||
String sql = "INSERT INTO "+tableName+" (" +
|
||||
" VIDEO_META_ID, DETCT_DT, DETCT_TY, CCTV_INFO, CCTV_CHRG_ZONE, AC_TY, ARLN_CD, TRACK_ID, BB_TOP_LEFT_X, BB_TOP_LEFT_Y, " +
|
||||
" BB_BOTTOM_RIGHT_X, BB_BOTTOM_RIGHT_Y, CRDNT_X, CRDNT_Y, CRDNT_LAT, CRDNT_LON, AC_STAND_ON_AT, OBJECT_SPD, REGISTER_ID) " +
|
||||
" VALUES (UCM.FUN_GET_WORK_NO( '"+now_dt+"', 'VIDEO'), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'SYSTEM')";
|
||||
" TRGT_ID, RECPTN_DT, LAT, LON, SPD, COS, TRGT_TY, REVISN_LAT, REVISN_LON, MODE_S_CD, SSR_CD, CLSGN, AC_REG_NO, REGISTER_ID) " +
|
||||
" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
String subTableName = "SACP_FUSION_TRACK_BBOX";
|
||||
String subSql = "INSERT INTO "+subTableName+" (" +
|
||||
" TRGT_ID, RECPTN_DT, CCTV_ID, BBOX_TOP_LEFT_X, BBOX_TOP_LEFT_Y, BBOX_BOTTOM_RIGHT_X, BBOX_BOTTOM_RIGHT_Y, CRDNT_X, CRDNT_Y, REGISTER_ID) " +
|
||||
" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
PreparedStatement ps=null;
|
||||
PreparedStatement stmt=null;
|
||||
Connection con=null;
|
||||
try {
|
||||
|
||||
|
@ -100,74 +108,95 @@ public class BatchInsertManager {
|
|||
}
|
||||
con.setAutoCommit(false);
|
||||
|
||||
// Statement statement = session.getConnection().createStatement();
|
||||
ps = con.prepareStatement(sql);
|
||||
//logger.info("입력 건수"+setCctvTrackVOArr.length);
|
||||
for (int i = 0; i < setCctvTrackVOArr.length; i++) {
|
||||
CctvTrackVO vo = setCctvTrackVOArr[i];
|
||||
stmt = con.prepareStatement(subSql);
|
||||
// for (int i = 0; i < setTrackVOArr.length; i++) {
|
||||
// TrackVO vo = setTrackVOArr[i];
|
||||
// //입력으로 처리
|
||||
// //중복 입력 방지를 위함
|
||||
// vo.setInserted(true);
|
||||
// try {
|
||||
// ps.setString(1, vo.getTargetId());
|
||||
// ps.setString(2, vo.getReceptionDate());
|
||||
// ps.setString(3, vo.getLatitude());
|
||||
// ps.setString(4, vo.getLongitude());
|
||||
// ps.setString(5, vo.getSpeed());
|
||||
// ps.setString(6, vo.getCourse());
|
||||
// ps.setString(7, vo.getTargetType());
|
||||
// ps.setString(8, vo.getCorrectedLatitude());
|
||||
// ps.setString(9, vo.getCorrectedLongitude());
|
||||
// ps.setString(10, vo.getModeSCode());
|
||||
// ps.setString(11, vo.getSsrCode());
|
||||
// ps.setString(12, vo.getCallsign());
|
||||
// ps.setString(13, vo.getTailNumber());
|
||||
// ps.setString(14, "fusion");
|
||||
|
||||
// ///건별 입력
|
||||
// if(!isBatch) {
|
||||
// ps.execute();
|
||||
// savePos++;
|
||||
// fusionSave++;
|
||||
// }
|
||||
|
||||
// try {
|
||||
// for (int j = 0; j < vo.getBbox().size(); j++) {
|
||||
// stmt.setString(1, vo.getTargetId());
|
||||
// stmt.setString(2, vo.getReceptionDate());
|
||||
// stmt.setString(3, vo.getBbox().get(j).getCctvId());
|
||||
// stmt.setString(4, vo.getBbox().get(j).getLeftTopX());
|
||||
// stmt.setString(5, vo.getBbox().get(j).getLeftTopY());
|
||||
// stmt.setString(6, vo.getBbox().get(j).getRightBottomX());
|
||||
// stmt.setString(7, vo.getBbox().get(j).getRightBottomY());
|
||||
// stmt.setString(8, vo.getBbox().get(j).getPx());
|
||||
// stmt.setString(9, vo.getBbox().get(j).getPy());
|
||||
// stmt.setString(10, "fusion");
|
||||
|
||||
// ///건별 입력
|
||||
// if(!isBatch) {
|
||||
// stmt.execute();
|
||||
// bboxSave++;
|
||||
// } else {
|
||||
// stmt.addBatch();
|
||||
// }
|
||||
// }
|
||||
// } catch(Exception ex) {
|
||||
// bboxFail++;
|
||||
// throw ex;
|
||||
// }
|
||||
|
||||
// //배치 입력
|
||||
// if(isBatch) {
|
||||
// ps.addBatch();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// logger.debug("Data Insert error UseSqlLog");
|
||||
// sqlLogTrackQueue.add(vo);
|
||||
// failPos++;
|
||||
// fusionFail++;
|
||||
// }
|
||||
|
||||
// //입력으로 처리
|
||||
// //중복 입력 방지를 위함
|
||||
vo.setInserted(true);
|
||||
|
||||
try {
|
||||
ps.setDate(1, vo.getDetctDt());
|
||||
ps.setString(2, vo.getDetctTy());
|
||||
ps.setString(3, vo.getCctvInfo());
|
||||
ps.setString(4, vo.getCctvChrgZone());
|
||||
ps.setString(5, vo.getAcTy());
|
||||
ps.setString(6, vo.getArlnCd());
|
||||
ps.setString(7, vo.getTrackId());
|
||||
ps.setDouble(8, vo.getBbTopLeftX());
|
||||
ps.setDouble(9, vo.getBbTopLeftY());
|
||||
ps.setDouble(10, vo.getBbBottomRightX());
|
||||
ps.setDouble(11, vo.getBbBottomRightY());
|
||||
ps.setDouble(12, vo.getCrdntX());
|
||||
ps.setDouble(13, vo.getCrdntY());
|
||||
ps.setDouble(14, vo.getCrdntLat());
|
||||
ps.setDouble(15, vo.getCrdntLon());
|
||||
ps.setString(16, vo.getAcStandOnAt());
|
||||
ps.setDouble(17, vo.getObjectSpd());
|
||||
|
||||
///건별 입력
|
||||
if(!isBatch) {
|
||||
ps.execute();
|
||||
savePos++;
|
||||
save++;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.debug("Data Insert error UseSqlLog");
|
||||
sqlLogCctvTrackQueue.add(vo);
|
||||
failPos++;
|
||||
fail++;
|
||||
}
|
||||
|
||||
//배치 입력
|
||||
if(isBatch) {
|
||||
ps.addBatch();
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
if(isBatch) {
|
||||
ps.executeBatch();
|
||||
|
||||
stmt.executeBatch();
|
||||
//배치 insert는 arr 건수만큼
|
||||
savePos+=setCctvTrackVOArr.length;
|
||||
save = setCctvTrackVOArr.length - fail;
|
||||
logger.info("배치 저장 건수 {} : 실패 건수 {}", save, fail);
|
||||
// logger.info("savePos 건수"+savePos);
|
||||
//savePos+=setTrackVOArr.length;
|
||||
//logger.info("savePos 건수"+savePos);
|
||||
|
||||
fusionSave = setTrackVOArr.length - fusionFail;
|
||||
logger.info("topic {} 배치 저장 건수 {} : 실패 건수 {}", topic, fusionSave, fusionFail);
|
||||
} else {
|
||||
logger.info("단건 저장 건수 {} : 실패 건수 {}", save, fail);
|
||||
logger.info("topic {} 단건 저장 건수 {} : 실패 건수 {}", topic, fusionSave, fusionFail);
|
||||
}
|
||||
|
||||
con.commit();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("insertData(Batch:"+isBatch+") error", e);
|
||||
if(isBatch) {
|
||||
logger.error("Try insert row by row");
|
||||
insertCctvData(setCctvTrackVOArr, false);
|
||||
insertTrackData(setTrackVOArr, false);
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
@ -179,6 +208,14 @@ public class BatchInsertManager {
|
|||
logger.error("insertData(Batch:"+isBatch+") PreparedStatement close error",e);
|
||||
}
|
||||
}
|
||||
|
||||
if(stmt!=null) {
|
||||
try {
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
logger.error("insertData(Batch:"+isBatch+") PreparedStatement close error",e);
|
||||
}
|
||||
}
|
||||
if(con!=null) {
|
||||
try {
|
||||
con.commit();
|
||||
|
@ -188,60 +225,41 @@ public class BatchInsertManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void insertCctvLastData(CctvTrackVO[] setCctvTrackVOArr) {
|
||||
insertCctvLastData(setCctvTrackVOArr,true);
|
||||
public void insertTrackLastData(CctvTrackVO[] setTrackVOArr) {
|
||||
insertTrackLastData(setTrackVOArr,true);
|
||||
}
|
||||
|
||||
private void insertCctvLastData(CctvTrackVO[] setCctvTrackVOArr, boolean isBatch) {
|
||||
private void insertTrackLastData(CctvTrackVO[] setTrackLastVOArr, boolean isBatch) {
|
||||
|
||||
if(setCctvTrackVOArr==null || setCctvTrackVOArr.length<1) {
|
||||
if(setTrackLastVOArr == null || setTrackLastVOArr.length<1) {
|
||||
// logger.error("mergeDynamicLastAll - No tableList data");
|
||||
logger.debug("insertCctvLastData(Batch:"+isBatch+") - no data in setCctvTrackVOArr");
|
||||
logger.debug("insertTrackLastData(Batch:"+isBatch+") - no data in setTrackVOArr");
|
||||
return;
|
||||
}
|
||||
// Table destTable=tableList.get(0);
|
||||
|
||||
|
||||
// String sql = "INSERT INTO " + destTable.getName() + " (" + getInsertCols(destTable.getColumnList()) + ") "
|
||||
// + "VALUES (" + getInsertValueParams(destTable.getColumnList()) + ")";
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String now_dt = format.format(setCctvTrackVOArr[0].getDetctDt());
|
||||
|
||||
String tableName = "SACP_VIDEO_META_LC";
|
||||
// String sql = "MERGE INTO "+tableName+" A" +
|
||||
// " USING DUAL" +
|
||||
// " ON (A.TRGT_ID = ?)" +
|
||||
// " WHEN MATCHED THEN" +
|
||||
// " UPDATE" +
|
||||
// " SET A.TRGT_TY=?, A.TRK_ID=?, A.AC_TY_ICAO=?, A.ARLN_CD_ICAO=?, A.EQPMN_TY=?, A.RECPTN_DT=?, A.LAT=?, A.LON=?, A.SPD=?, A.COS=?, A.CCTV_ID=?, A.X_CNTS=?, A.Y_CNTS=?, A.UPDUSR_ID=?, A.UPDT_DT=TO_TIMESTAMP(SYSDATE,'yyyyMMdd')" +
|
||||
// " WHEN NOT MATCHED THEN " +
|
||||
// " INSERT " +
|
||||
// " (A.TRGT_ID , A.TRGT_TY, A.TRK_ID, A.AC_TY_ICAO, A.ARLN_CD_ICAO, A.EQPMN_TY, A.RECPTN_DT, A.LAT, A.LON, A.SPD, A.COS, A.CCTV_ID, A.X_CNTS, A.Y_CNTS, A.REGISTER_ID)" +
|
||||
// " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
String tableName = "SACP_TRACK_LAST";
|
||||
String sql = "";
|
||||
|
||||
if(MainServer.LAST_DATA_CNT > 0) {
|
||||
sql = " UPDATE " + tableName
|
||||
+ " SET DETCT_DT = ?, DETCT_TY = ?, CCTV_INFO = ?, CCTV_CHRG_ZONE = ?, AC_TY = ?, ARLN_CD = ?,"
|
||||
+ " TRACK_ID = ?, BB_TOP_LEFT_X = ?, BB_TOP_LEFT_Y = ?, BB_BOTTOM_RIGHT_X = ?, BB_BOTTOM_RIGHT_Y = ?, CRDNT_X = ?, CRDNT_Y = ?,"
|
||||
+ " CRDNT_LAT = ?, CRDNT_LON = ?, AC_STAND_ON_AT = ?, OBJECT_SPD = ?, "
|
||||
+ " UPDUSR_ID ='SYSTEM', UPDT_DT=TO_TIMESTAMP(SYSDATE,'yyyyMMdd')"
|
||||
+ " WHERE VIDEO_META_ID = ?";
|
||||
+ " SET AC_REG_NO=?, CLSGN=?, SSR_CD=?, MODE_S_CD=?, RECPTN_DT=?, SENSOR_TY=?, CAT_TY=?, LAT=?, LON=?, "
|
||||
+ " SPD=?, COS=?, ALT=?, VIRTL_TRGT_AT=?, TRACK_CRRCT_AT=?, TRACK_CNFDNC=?, CCTV_ID=?, X_CNTS=?, Y_CNTS=?, "
|
||||
+ " UPDUSR_ID=?, UPDT_DT=TO_TIMESTAMP(SYSDATE,'yyyyMMdd')"
|
||||
+ " WHERE TRGT_ID = ?";
|
||||
}else {
|
||||
sql = " INSERT INTO " + tableName
|
||||
+ " ( VIDEO_META_ID, DETCT_DT, DETCT_TY, CCTV_INFO, CCTV_CHRG_ZONE, AC_TY, ARLN_CD, TRACK_ID, BB_TOP_LEFT_X, BB_TOP_LEFT_Y,"
|
||||
+ " BB_BOTTOM_RIGHT_X, BB_BOTTOM_RIGHT_Y, CRDNT_X, CRDNT_Y, CRDNT_LAT, CRDNT_LON, AC_STAND_ON_AT, OBJECT_SPD, REGISTER_ID)"
|
||||
+ " VALUES (UCM.FUN_GET_WORK_NO( '"+now_dt+"', 'VIDEO'), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'SYSTEM')";
|
||||
+ " ( TRGT_ID, AC_REG_NO, CLSGN, SSR_CD, MODE_S_CD, RECPTN_DT, SENSOR_TY, CAT_TY, "
|
||||
+ " LAT, LON, SPD, COS, ALT, VIRTL_TRGT_AT, TRACK_CRRCT_AT, TRACK_CNFDNC, CCTV_ID, "
|
||||
+ " X_CNTS, Y_CNTS, REGISTER_ID)"
|
||||
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
}
|
||||
|
||||
System.out.println("last sql = "+sql);
|
||||
PreparedStatement ps=null;
|
||||
Connection con=null;
|
||||
try {
|
||||
|
||||
con=session.getConnection();
|
||||
if(con.isClosed() || !con.isValid(1)) {
|
||||
closeSession();
|
||||
|
@ -249,57 +267,21 @@ public class BatchInsertManager {
|
|||
con=session.getConnection();
|
||||
}
|
||||
con.setAutoCommit(false);
|
||||
|
||||
|
||||
// Statement statement = session.getConnection().createStatement();
|
||||
ps = con.prepareStatement(sql);
|
||||
|
||||
for (int i = 0; i < setCctvTrackVOArr.length; i++) {
|
||||
CctvTrackVO vo = setCctvTrackVOArr[i];
|
||||
for (int i = 0; i < setTrackLastVOArr.length; i++) {
|
||||
CctvTrackVO vo = setTrackLastVOArr[i];
|
||||
//입력으로 처리
|
||||
//중복 입력 방지를 위함
|
||||
vo.setInserted(true);
|
||||
|
||||
try {
|
||||
|
||||
if(MainServer.LAST_DATA_CNT > 0) {
|
||||
ps.setDate(1, vo.getDetctDt());
|
||||
ps.setString(2, vo.getDetctTy());
|
||||
ps.setString(3, vo.getCctvInfo());
|
||||
ps.setString(4, vo.getCctvChrgZone());
|
||||
ps.setString(5, vo.getAcTy());
|
||||
ps.setString(6, vo.getArlnCd());
|
||||
ps.setString(7, vo.getTrackId());
|
||||
ps.setDouble(8, vo.getBbTopLeftX());
|
||||
ps.setDouble(9, vo.getBbTopLeftY());
|
||||
ps.setDouble(10, vo.getBbBottomRightX());
|
||||
ps.setDouble(11, vo.getBbBottomRightY());
|
||||
ps.setDouble(12, vo.getCrdntX());
|
||||
ps.setDouble(13, vo.getCrdntY());
|
||||
ps.setDouble(14, vo.getCrdntLat());
|
||||
ps.setDouble(15, vo.getCrdntLon());
|
||||
ps.setString(16, vo.getAcStandOnAt());
|
||||
ps.setDouble(17, vo.getObjectSpd());
|
||||
ps.setString(18, vo.getVideoMetaId());
|
||||
}else {
|
||||
ps.setDate(1, vo.getDetctDt());
|
||||
ps.setString(2, vo.getDetctTy());
|
||||
ps.setString(3, vo.getCctvInfo());
|
||||
ps.setString(4, vo.getCctvChrgZone());
|
||||
ps.setString(5, vo.getAcTy());
|
||||
ps.setString(6, vo.getArlnCd());
|
||||
ps.setString(7, vo.getTrackId());
|
||||
ps.setDouble(8, vo.getBbTopLeftX());
|
||||
ps.setDouble(9, vo.getBbTopLeftY());
|
||||
ps.setDouble(10, vo.getBbBottomRightX());
|
||||
ps.setDouble(11, vo.getBbBottomRightY());
|
||||
ps.setDouble(12, vo.getCrdntX());
|
||||
ps.setDouble(13, vo.getCrdntY());
|
||||
ps.setDouble(14, vo.getCrdntLat());
|
||||
ps.setDouble(15, vo.getCrdntLon());
|
||||
ps.setString(16, vo.getAcStandOnAt());
|
||||
ps.setDouble(17, vo.getObjectSpd());
|
||||
}
|
||||
|
||||
///건별 입력
|
||||
if(!isBatch) {
|
||||
ps.execute();
|
||||
|
@ -309,10 +291,9 @@ public class BatchInsertManager {
|
|||
MainServer.LAST_DATA_CNT = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.debug("Data Insert error UseSqlLog");
|
||||
sqlLogCctvTrackLastQueue.add(vo);
|
||||
sqlLogTrackLastQueue.add(vo);
|
||||
failLast++;
|
||||
}
|
||||
|
||||
|
@ -320,28 +301,27 @@ public class BatchInsertManager {
|
|||
if(isBatch) {
|
||||
ps.addBatch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(isBatch) {
|
||||
ps.executeBatch();
|
||||
|
||||
|
||||
if(MainServer.LAST_DATA_CNT == 0 ) {
|
||||
MainServer.LAST_DATA_CNT = 1;
|
||||
}
|
||||
|
||||
|
||||
//배치 insert는 arr 건수만큼
|
||||
saveLast+=setCctvTrackVOArr.length;
|
||||
saveLast += setTrackLastVOArr.length;
|
||||
}
|
||||
|
||||
con.commit();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("cctvLast(Batch:"+isBatch+") error", e);
|
||||
logger.error("trackLast(Batch:"+isBatch+") error", e);
|
||||
if(isBatch) {
|
||||
logger.error("Try insert row by row");
|
||||
insertCctvLastData(setCctvTrackVOArr, false);
|
||||
// insertTrackLastData(setTrackLastVOArr, false);
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
@ -350,7 +330,7 @@ public class BatchInsertManager {
|
|||
try {
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
logger.error("cctvLast(Batch:"+isBatch+") PreparedStatement close error",e);
|
||||
logger.error("trackLast(Batch:"+isBatch+") PreparedStatement close error",e);
|
||||
}
|
||||
}
|
||||
if(con!=null) {
|
||||
|
@ -358,11 +338,10 @@ public class BatchInsertManager {
|
|||
con.commit();
|
||||
con.setAutoCommit(true);
|
||||
} catch (SQLException e) {
|
||||
logger.error("cctvLast(Batch:"+isBatch+") commit error",e);
|
||||
logger.error("trackLast(Batch:"+isBatch+") commit error",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public synchronized CountStatus getCountAndSetZero() {
|
||||
CountStatus countStatus = new CountStatus(savePos, saveLast, saveStatic, failPos, failLast, failStatic);
|
||||
|
|
|
@ -7,6 +7,7 @@ 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.data.vo.CctvTrackVO;
|
||||
import kr.gmtc.tss.main.MainServer;
|
||||
|
@ -16,13 +17,13 @@ public class DataLogger implements Runnable {
|
|||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private Queue<String> cctvTrackQueue;
|
||||
private Queue<String> trackQueue;
|
||||
private boolean isRunning = true;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
public DataLogger(Queue<String> cctvTrackQueue, int listChunkSize, long sleepMillis) {
|
||||
this.cctvTrackQueue = cctvTrackQueue;
|
||||
public DataLogger(Queue<String> trackQueue, int listChunkSize, long sleepMillis) {
|
||||
this.trackQueue = trackQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
}
|
||||
|
@ -33,7 +34,7 @@ public class DataLogger implements Runnable {
|
|||
|
||||
while (isRunning) {
|
||||
try {
|
||||
String [] chunkArr = getChunkMessageArr(cctvTrackQueue);
|
||||
String [] chunkArr = getChunkMessageArr(trackQueue);
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
FileUtil.writeLogFile(getMessageBody(chunkArr[i]), MainServer.DATA_FILE_NAME);
|
||||
}
|
||||
|
@ -46,28 +47,30 @@ public class DataLogger implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
private String [] getChunkMessageArr(Queue<String> cctvTrackQueue) {
|
||||
private String [] getChunkMessageArr(Queue<String> trackQueue) {
|
||||
int loopCnt = 0;
|
||||
|
||||
if(cctvTrackQueue.size()>listChunkSize) {
|
||||
if(trackQueue.size()>listChunkSize) {
|
||||
loopCnt = listChunkSize;
|
||||
}else {
|
||||
loopCnt = cctvTrackQueue.size();
|
||||
loopCnt = trackQueue.size();
|
||||
}
|
||||
|
||||
String [] chunkArr = new String[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i] = cctvTrackQueue.poll();
|
||||
chunkArr[i] = trackQueue.poll();
|
||||
}
|
||||
|
||||
return chunkArr;
|
||||
}
|
||||
|
||||
private String getMessageBody(String s) {
|
||||
private String getMessageBody(String str) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(s);
|
||||
|
||||
sb.append(str);
|
||||
sb.append("\n");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@ import java.util.Queue;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmtc.tss.data.vo.CctvTrackVO;
|
||||
import kr.gmtc.tss.main.MainServer;
|
||||
import kr.gmtc.tss.util.FileUtil;
|
||||
|
||||
|
@ -14,12 +17,12 @@ public class MessageBodyLogger implements Runnable {
|
|||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private Queue<String> messageBodyQueue;
|
||||
private Queue<CctvTrackVO> messageBodyQueue;
|
||||
private boolean isRunning = true;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
public MessageBodyLogger(Queue<String> messageBodyQueue, int listChunkSize, long sleepMillis) {
|
||||
public MessageBodyLogger(Queue<CctvTrackVO> messageBodyQueue, int listChunkSize, long sleepMillis) {
|
||||
this.messageBodyQueue = messageBodyQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
|
@ -31,7 +34,7 @@ private Logger logger = LoggerFactory.getLogger(this.getClass());
|
|||
|
||||
while (isRunning) {
|
||||
try {
|
||||
String [] chunkArr = getChunkMessageArr(messageBodyQueue);
|
||||
CctvTrackVO [] chunkArr = getChunkMessageArr(messageBodyQueue);
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
//logger.error(getMessageBody(chunkArr[i]));
|
||||
FileUtil.writeLogFile(getMessageBody(chunkArr[i]), MainServer.FILE_LOG_NAME);
|
||||
|
@ -45,7 +48,7 @@ private Logger logger = LoggerFactory.getLogger(this.getClass());
|
|||
}
|
||||
}
|
||||
|
||||
private String [] getChunkMessageArr(Queue<String> messageBodyQueue) {
|
||||
private CctvTrackVO [] getChunkMessageArr(Queue<CctvTrackVO> messageBodyQueue) {
|
||||
int loopCnt = 0;
|
||||
|
||||
if(messageBodyQueue.size()>listChunkSize) {
|
||||
|
@ -54,7 +57,7 @@ private Logger logger = LoggerFactory.getLogger(this.getClass());
|
|||
loopCnt = messageBodyQueue.size();
|
||||
}
|
||||
|
||||
String [] chunkArr = new String[loopCnt];
|
||||
CctvTrackVO [] chunkArr = new CctvTrackVO[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i] = messageBodyQueue.poll();
|
||||
|
@ -63,19 +66,29 @@ private Logger logger = LoggerFactory.getLogger(this.getClass());
|
|||
return chunkArr;
|
||||
}
|
||||
|
||||
private String getMessageBody(String str) {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// private String getMessageBody(String str) {
|
||||
// Date date = new Date();
|
||||
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
//
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
//
|
||||
// sb.append(formatter.format(date));
|
||||
// sb.append(" ");
|
||||
// sb.append(str);
|
||||
//
|
||||
// return sb.toString();
|
||||
// }
|
||||
|
||||
private String getMessageBody(CctvTrackVO vo) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(formatter.format(date));
|
||||
sb.append(" ");
|
||||
sb.append(str);
|
||||
|
||||
|
||||
sb.append(vo.toString());
|
||||
sb.append("\n");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
|
@ -87,4 +100,4 @@ private Logger logger = LoggerFactory.getLogger(this.getClass());
|
|||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,8 +28,8 @@ public class KafkaTopicReader implements Runnable {
|
|||
public void run() {
|
||||
Properties props = new Properties();
|
||||
props.put("bootstrap.servers", bootstrapServers);
|
||||
props.put("group.id", "kafka-topic-reader");
|
||||
props.put("auto.offset.reset", "earliest");
|
||||
props.put("group.id", "kafka-topic-reader-aivideo");
|
||||
props.put("auto.offset.reset", "latest");
|
||||
props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
|
||||
props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
|
||||
try (KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props)) {
|
||||
|
@ -38,8 +38,10 @@ public class KafkaTopicReader implements Runnable {
|
|||
consumer.subscribe(Collections.singletonList(topic));
|
||||
|
||||
while (true) {
|
||||
ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(100));
|
||||
ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(1000));
|
||||
|
||||
if (records.count() > 0) logger.info("topic {} 수신 건수 {}", topic, records.count());
|
||||
|
||||
for (ConsumerRecord<String, String> record : records) {
|
||||
rcvQueue.add(record.value());
|
||||
}
|
|
@ -5,9 +5,7 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
@ -25,12 +23,9 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kr.gmt.so.state.StateManager;
|
||||
import kr.gmt.so.state.model.SystemState;
|
||||
import kr.gmtc.tss.data.DataInsertRunnable;
|
||||
import kr.gmtc.tss.data.ParseTargetRunnable;
|
||||
import kr.gmtc.tss.data.TargetManageRunnable;
|
||||
|
@ -38,6 +33,7 @@ import kr.gmtc.tss.data.vo.CctvTrackVO;
|
|||
import kr.gmtc.tss.db.BatchInsertManager;
|
||||
import kr.gmtc.tss.filelog.DataLogger;
|
||||
import kr.gmtc.tss.filelog.MessageBodyLogger;
|
||||
import kr.gmtc.tss.kafka.KafkaTopicReader;
|
||||
import kr.gmtc.tss.netty.StringClient;
|
||||
import kr.gmtc.tss.sqllog.SqlLogger;
|
||||
import kr.gmtc.tss.util.ArrayBlockingLoggingQueue;
|
||||
|
@ -49,14 +45,11 @@ public class MainServer implements InitializingBean {
|
|||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Value("${rest.server.ip}")
|
||||
private String restServerIp;
|
||||
@Value("${kafka.bootstrapServers}")
|
||||
private String bootstrapServers;
|
||||
|
||||
@Value("${rest.server.port}")
|
||||
private String restServerPort;
|
||||
|
||||
@Value("${rest.server.path}")
|
||||
private String restServerPath;
|
||||
@Value("${kafka.topic}")
|
||||
private String topic;
|
||||
|
||||
@Value("${file-zip-path}")
|
||||
private String fileZipPath;
|
||||
|
@ -136,6 +129,7 @@ public class MainServer implements InitializingBean {
|
|||
private String logclassification;
|
||||
|
||||
StringClient client;
|
||||
KafkaTopicReader kafkaTopicReader;
|
||||
ParseTargetRunnable parserRunnable;
|
||||
DataLogger dataLoggerRunnable;
|
||||
TargetManageRunnable targetManageRunnable;
|
||||
|
@ -147,24 +141,24 @@ public class MainServer implements InitializingBean {
|
|||
List<Thread> threadList = new ArrayList<Thread>();
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<CctvTrackVO> sqlLogCctvTrackQueue;
|
||||
Queue<CctvTrackVO> sqlLogCctvTrackLastQueue;
|
||||
Queue<CctvTrackVO> sqlLogTrackQueue;
|
||||
Queue<CctvTrackVO> sqlLogTrackLastQueue;
|
||||
|
||||
// cctv 위치정보 저장
|
||||
Queue<CctvTrackVO> cctvTrackQueue;
|
||||
// track 위치정보 저장
|
||||
Queue<CctvTrackVO> trackQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
Queue<CctvTrackVO> cctvTrackLastQueue;
|
||||
Queue<CctvTrackVO> trackLastQueue;
|
||||
|
||||
Queue<String> messageBodyQueue;
|
||||
Queue<CctvTrackVO> messageBodyQueue;
|
||||
|
||||
@Bean(name = "rcvQueue")
|
||||
public Queue<String> getRcvQueue() {
|
||||
return rcvQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "cctvTrackQueue")
|
||||
public Queue<CctvTrackVO> getCctvTrackQueue() {
|
||||
return cctvTrackQueue;
|
||||
@Bean(name = "trackQueue")
|
||||
public Queue<CctvTrackVO> getTrackQueue() {
|
||||
return trackQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "dataFileQueue")
|
||||
|
@ -172,51 +166,55 @@ public class MainServer implements InitializingBean {
|
|||
return dataFileQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "cctvTrackLastQueue")
|
||||
public Queue<CctvTrackVO> getCctvTrackLastQueue() {
|
||||
return cctvTrackLastQueue;
|
||||
@Bean(name = "trackLastQueue")
|
||||
public Queue<CctvTrackVO> getTrackLastQueue() {
|
||||
return trackLastQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "sqlLogCctvTrackQueue")
|
||||
public Queue<CctvTrackVO> getSqlLogCctvTrackQueue() {
|
||||
return sqlLogCctvTrackQueue;
|
||||
@Bean(name = "sqlLogTrackQueue")
|
||||
public Queue<CctvTrackVO> getSqlLogTrackQueue() {
|
||||
return sqlLogTrackQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "sqlLogCctvTrackLastQueue")
|
||||
public Queue<CctvTrackVO> getSqlLogCctvTrackLastQueue() {
|
||||
return sqlLogCctvTrackLastQueue;
|
||||
@Bean(name = "sqlLogTrackLastQueue")
|
||||
public Queue<CctvTrackVO> getSqlLogTrackLastQueue() {
|
||||
return sqlLogTrackLastQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "messageBodyQueue")
|
||||
public Queue<String> getMessageBodyQueue() {
|
||||
public Queue<CctvTrackVO> getMessageBodyQueue() {
|
||||
return messageBodyQueue;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private WebClient webClient;
|
||||
|
||||
private FileUtil fileUtil;
|
||||
|
||||
@Autowired
|
||||
private FileUtil fileUtil;
|
||||
private StateManager stateMgr;
|
||||
// private boolean swBeforeStatus = true;
|
||||
|
||||
public static int LAST_DATA_CNT = 0;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
|
||||
stateMgr.updateState();
|
||||
|
||||
logger.info("DataQueue Count : "+queueCount);
|
||||
logger.info("flagDataBase : "+flagDataBase);
|
||||
logger.info("flagDataFile : "+flagDataFile);
|
||||
logger.info("flagFile : "+flagFile);
|
||||
|
||||
rcvQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
sqlLogCctvTrackQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
sqlLogCctvTrackLastQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
cctvTrackQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
sqlLogTrackQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
sqlLogTrackLastQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
trackQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
dataFileQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
cctvTrackLastQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
trackLastQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
messageBodyQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
|
||||
// LAST TABLE 데이터 확인
|
||||
//DBLastDataStatus();
|
||||
DBLastDataStatus();
|
||||
|
||||
// 최초 한번만 실행 - 로그파일이 없을 시 생성
|
||||
if (flagFile) FILE_LOG_NAME = fileUtil.createLogFile(fileZipPath, fileZipBakPath, fileMakeTime); // rest log file
|
||||
|
@ -260,20 +258,50 @@ public class MainServer implements InitializingBean {
|
|||
if(flagDataFile) startDataLoggerThread();
|
||||
if(flagFile) startMessageBodyThread();
|
||||
|
||||
startKafkaThread();
|
||||
startParserThread();
|
||||
startSqlLoggerThread();
|
||||
}
|
||||
|
||||
|
||||
// @Scheduled(cron = "${process.rest-cron}")
|
||||
@Scheduled(fixedRateString = "5000", initialDelay = 3000)
|
||||
public void restRecv() {
|
||||
checkQueueSize();
|
||||
|
||||
MultiValueMap<String, String> param = new LinkedMultiValueMap<String, String>();
|
||||
// 추후 아래 주소 변경해야함 2023-08-09 cjj
|
||||
// yml에서 변경필요
|
||||
getClient(restServerIp, restServerPort, restServerPath, param);
|
||||
|
||||
@Scheduled(cron = "${process.status-check-cron}")
|
||||
private void chkThreadStatus() throws InterruptedException{
|
||||
|
||||
stateMgr.updateState();
|
||||
|
||||
boolean running = true;
|
||||
boolean swNewStatus = stateMgr.isActive();
|
||||
|
||||
// // 이중화 Active / Standby 상태 변경 체크
|
||||
// if(swBeforeStatus != swNewStatus){
|
||||
|
||||
// parserRunnable.setRunning(swNewStatus);
|
||||
// dataInsertRunnable2.setRunning(swNewStatus);
|
||||
// dataLoggerRunnable.setRunning(swNewStatus);
|
||||
// sqlLoggerRunnable.setRunning(swNewStatus);
|
||||
// messageBodyLogger.setRunning(swNewStatus);
|
||||
|
||||
// }
|
||||
|
||||
// 해당 프로그램이 Active일때 Thread Interrupt 유무 체크
|
||||
if(swNewStatus){
|
||||
|
||||
for(Thread ct : threadList ){
|
||||
if(ct.isInterrupted()){
|
||||
running = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(running){
|
||||
stateMgr.updateState(SystemState.Normal);
|
||||
}else{
|
||||
stateMgr.updateState(SystemState.Error);
|
||||
}
|
||||
}
|
||||
|
||||
// swBeforeStatus = stateMgr.isActive();
|
||||
|
||||
// logger.info("swBeforeStatus : " + swBeforeStatus);
|
||||
}
|
||||
|
||||
@Scheduled(cron = "${process.file-backup-cron}")
|
||||
|
@ -311,42 +339,50 @@ public class MainServer implements InitializingBean {
|
|||
if(rcvQueue.size()==queueCount) {
|
||||
logger.error("rcvQueue is Full!!");
|
||||
}
|
||||
if(cctvTrackQueue.size()==queueCount) {
|
||||
logger.error("cctvTrackQueue is Full!!");
|
||||
if(trackQueue.size()==queueCount) {
|
||||
logger.error("trackQueue is Full!!");
|
||||
}
|
||||
if(dataFileQueue.size()==queueCount) {
|
||||
logger.error("dataFileQueue is Full!!");
|
||||
}
|
||||
if(cctvTrackLastQueue.size()==queueCount) {
|
||||
logger.error("cctvTrackLastQueue is Full!!");
|
||||
if(trackLastQueue.size()==queueCount) {
|
||||
logger.error("trackLastQueue is Full!!");
|
||||
}
|
||||
if(sqlLogCctvTrackQueue.size()==queueCount) {
|
||||
logger.error("sqlLogCctvTrackQueue is Full!!");
|
||||
if(sqlLogTrackQueue.size()==queueCount) {
|
||||
logger.error("sqlLogTrackQueue is Full!!");
|
||||
}
|
||||
if(sqlLogCctvTrackLastQueue.size()==queueCount) {
|
||||
logger.error("sqlLogCctvTrackLastQueue is Full!!");
|
||||
if(sqlLogTrackLastQueue.size()==queueCount) {
|
||||
logger.error("sqlLogTrackLastQueue is Full!!");
|
||||
}
|
||||
if(messageBodyQueue.size()==queueCount) {
|
||||
logger.error("messageBodyQueue is Full!!");
|
||||
}
|
||||
}
|
||||
|
||||
public void startKafkaThread() {
|
||||
KafkaTopicReader topicReader = new KafkaTopicReader(bootstrapServers, topic, rcvQueue);
|
||||
this.kafkaTopicReader=topicReader;
|
||||
|
||||
Thread thread = new Thread(topicReader);
|
||||
thread.start();
|
||||
|
||||
threadList.add(thread);
|
||||
}
|
||||
|
||||
public void startParserThread() {
|
||||
ParseTargetRunnable parserRunnable = new ParseTargetRunnable(rcvQueue, cctvTrackQueue, cctvTrackLastQueue, dataFileQueue, messageBodyQueue, queueChunkSize, parseTargetSleepMs, flagFile, flagDataBase, flagDataFile, classification, swclassification, logclassification);
|
||||
ParseTargetRunnable parserRunnable = new ParseTargetRunnable(rcvQueue, trackQueue, trackLastQueue, dataFileQueue, messageBodyQueue, queueChunkSize, parseTargetSleepMs ,flagFile, flagDataBase, flagDataFile, classification, swclassification, logclassification);
|
||||
this.parserRunnable=parserRunnable;
|
||||
Thread thread = new Thread(parserRunnable);
|
||||
thread.start();
|
||||
threadList.add(thread);
|
||||
parserRunnable.getCountAndSetZero();
|
||||
}
|
||||
|
||||
|
||||
public void startDataInsertThread() {
|
||||
BatchInsertManager batchInsertManager = new BatchInsertManager(sqlSessionFactory, sqlLogCctvTrackQueue,sqlLogCctvTrackLastQueue);
|
||||
BatchInsertManager batchInsertManager = new BatchInsertManager(sqlSessionFactory, sqlLogTrackQueue,sqlLogTrackLastQueue);
|
||||
this.batchInsertManager=batchInsertManager;
|
||||
|
||||
DataInsertRunnable dataInsertRunnable = new DataInsertRunnable(cctvTrackQueue, cctvTrackLastQueue, batchInsertSize, batchInsertManager, dataInsertSleepMs);
|
||||
DataInsertRunnable dataInsertRunnable = new DataInsertRunnable(trackQueue, trackLastQueue, batchInsertSize, batchInsertManager, dataInsertSleepMs, topic);
|
||||
this.dataInsertRunnable = dataInsertRunnable;
|
||||
|
||||
Thread thread = new Thread(dataInsertRunnable);
|
||||
|
@ -366,7 +402,7 @@ public class MainServer implements InitializingBean {
|
|||
}
|
||||
|
||||
public void startSqlLoggerThread() {
|
||||
SqlLogger sqlLoggerRunnable = new SqlLogger(sqlLogCctvTrackQueue, sqlLogCctvTrackLastQueue, queueChunkSize, sqlLoggerSleepMs);
|
||||
SqlLogger sqlLoggerRunnable = new SqlLogger(sqlLogTrackQueue, sqlLogTrackLastQueue, queueChunkSize, sqlLoggerSleepMs);
|
||||
this.sqlLoggerRunnable = sqlLoggerRunnable;
|
||||
|
||||
Thread thread = new Thread(sqlLoggerRunnable);
|
||||
|
@ -385,48 +421,10 @@ public class MainServer implements InitializingBean {
|
|||
threadList.add(thread);
|
||||
}
|
||||
|
||||
private void getClient(String ip, String port, String path, MultiValueMap<String, String> param){
|
||||
String result = webClient
|
||||
.mutate()
|
||||
.baseUrl("http://" + ip + ":" + port)
|
||||
.build()
|
||||
.get()
|
||||
.uri(uriBuilder -> uriBuilder.path(path)
|
||||
.queryParams(param)
|
||||
.build())
|
||||
.retrieve()
|
||||
.bodyToMono(String.class)
|
||||
.block();
|
||||
// String result = "aaa";
|
||||
rcvQueue.add(result);
|
||||
}
|
||||
|
||||
private Map<String, Object> postClient(String url, String path, MultiValueMap<String, String> param){
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String result = webClient
|
||||
.mutate()
|
||||
.baseUrl(url)
|
||||
.build()
|
||||
.post()
|
||||
.uri(uriBuilder ->
|
||||
uriBuilder.path(path)
|
||||
.queryParams(param)
|
||||
.build())
|
||||
.retrieve()
|
||||
.bodyToMono(String.class)
|
||||
.block();
|
||||
try {
|
||||
resultMap = mapper.readValue(result, HashMap.class);
|
||||
} catch (Exception e) {}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
public void DBLastDataStatus() {
|
||||
openSession(false);
|
||||
|
||||
String sql = "SELECT COUNT(*) FROM SACP_CCTV_TRACK_LAST ";
|
||||
String sql = "SELECT COUNT(*) FROM SACP_TRACK_LAST ";
|
||||
|
||||
PreparedStatement ps = null;
|
||||
Connection con = null;
|
||||
|
|
|
@ -11,35 +11,35 @@ import kr.gmtc.tss.main.MainServer;
|
|||
|
||||
public class SqlLogger implements Runnable {
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private Queue<CctvTrackVO> sqlLogCctvTrackQueue;
|
||||
private Queue<CctvTrackVO> sqlLogCctvTrackLastQueue;
|
||||
private Queue<CctvTrackVO> sqlLogTrackQueue;
|
||||
private Queue<CctvTrackVO> sqlLogTrackLastQueue;
|
||||
private boolean isRunning=true;
|
||||
private int listChunkSize= 100;
|
||||
private long sleepMillis;
|
||||
|
||||
public SqlLogger(Queue<CctvTrackVO> sqlLogCctvTrackQueue,Queue<CctvTrackVO> sqlLogCctvTrackLastQueue, int listChunkSize, long sleepMillis) {
|
||||
this.sqlLogCctvTrackQueue = sqlLogCctvTrackQueue;
|
||||
this.sqlLogCctvTrackLastQueue = sqlLogCctvTrackLastQueue;
|
||||
public SqlLogger(Queue<CctvTrackVO> sqlLogTrackQueue,Queue<CctvTrackVO> sqlLogTrackLastQueue, int listChunkSize, long sleepMillis) {
|
||||
this.sqlLogTrackQueue = sqlLogTrackQueue;
|
||||
this.sqlLogTrackLastQueue = sqlLogTrackLastQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning=true;
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
CctvTrackVO [] chunkArr = getChunkTrackArr(sqlLogCctvTrackQueue);
|
||||
CctvTrackVO [] chunkArr = getChunkTrackArr(sqlLogTrackQueue);
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
logger.error(getInsertCctvSql(chunkArr[i]));
|
||||
logger.error(getInsertTrackSql(chunkArr[i]));
|
||||
}
|
||||
|
||||
chunkArr = getChunkTrackArr(sqlLogCctvTrackLastQueue);
|
||||
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
logger.error(getInsertLastCctvSql(chunkArr[i]));
|
||||
}
|
||||
/*
|
||||
* chunkArr = getChunkTrackArr(sqlLogTrackLastQueue); for (int i = 0; i <
|
||||
* chunkArr.length; i++) { logger.error(getInsertLastTrackSql(chunkArr[i])); }
|
||||
*/
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.info("-- [SqlLogger] LogSave error : " +e.getLocalizedMessage());
|
||||
}
|
||||
|
@ -65,96 +65,54 @@ public class SqlLogger implements Runnable {
|
|||
|
||||
return chunkArr;
|
||||
}
|
||||
|
||||
|
||||
private String getInsertCctvSql(CctvTrackVO vo) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String now_dt = format.format(vo.getDetctDt());
|
||||
String tableName = "SACP_VIDEO_META_LC";
|
||||
|
||||
private String getInsertTrackSql(CctvTrackVO vo) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// sb.append("\n");
|
||||
// sb.append("INSERT INTO ");
|
||||
// sb.append("SACP_TRACK_FUSION");
|
||||
// sb.append(" (TRGT_ID, RECPTN_DT, LAT, LON, SPD, COS, TRGT_TY, REVISN_LAT, REVISN_LON, MODE_S_CD, SSR_CD, CLSGN, AC_REG_NO, REGISTER_ID)");
|
||||
// sb.append("VALUES (");
|
||||
// sb.append("'"); sb.append(vo.getTargetId()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getReceptionDate()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getLatitude()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getLongitude()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getSpeed()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getCourse()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getTargetType()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getCorrectedLatitude()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getCorrectedLongitude()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getModeSCode()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getSsrCode()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getCallsign()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getTailNumber()); sb.append("',");
|
||||
// sb.append("'"); sb.append("fusion"); sb.append("');");
|
||||
|
||||
sb.append("INSERT INTO ");
|
||||
sb.append(tableName);
|
||||
sb.append(" (VIDEO_META_ID, DETCT_DT, DETCT_TY, CCTV_INFO, CCTV_CHRG_ZONE, AC_TY, ARLN_CD, TRACK_ID, BB_TOP_LEFT_X, BB_TOP_LEFT_Y,");
|
||||
sb.append(" BB_BOTTOM_RIGHT_X, BB_BOTTOM_RIGHT_Y, CRDNT_X, CRDNT_Y, CRDNT_LAT, CRDNT_LON, AC_STAND_ON_AT, OBJECT_SPD, REGISTER_ID");
|
||||
sb.append(") VALUES (");
|
||||
sb.append("'"); sb.append("UCM.FUN_GET_WORK_NO( '"+now_dt+"', 'VIDEO')"); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getDetctDt()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getDetctTy()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getCctvInfo()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getCctvChrgZone()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getAcTy()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getArlnCd()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getTrackId()); sb.append("',");
|
||||
sb.append(vo.getBbTopLeftX()); sb.append(",");
|
||||
sb.append(vo.getBbTopLeftY()); sb.append(",");
|
||||
sb.append(vo.getBbBottomRightX()); sb.append(",");
|
||||
sb.append(vo.getBbBottomRightY()); sb.append(",");
|
||||
sb.append(vo.getCrdntX()); sb.append(",");
|
||||
sb.append(vo.getCrdntY()); sb.append(",");
|
||||
sb.append(vo.getCrdntLat()); sb.append(",");
|
||||
sb.append(vo.getCrdntLon()); sb.append(",");
|
||||
sb.append("'"); sb.append(vo.getAcStandOnAt()); sb.append("',");
|
||||
sb.append(vo.getObjectSpd()); sb.append(",");
|
||||
sb.append("'"); sb.append("SYSTEM"); sb.append("')");
|
||||
// for (int j = 0; j < vo.getBbox().size(); j++) {
|
||||
// sb.append("\n");
|
||||
// sb.append("INSERT INTO ");
|
||||
// sb.append("SACP_FUSION_TRACK_BBOX");
|
||||
// sb.append(" (TRGT_ID, RECPTN_DT, CCTV_ID, BBOX_TOP_LEFT_X, BBOX_TOP_LEFT_Y, BBOX_BOTTOM_RIGHT_X, BBOX_BOTTOM_RIGHT_Y, CRDNT_X, CRDNT_Y, REGISTER_ID)");
|
||||
// sb.append("VALUES (");
|
||||
// sb.append("'"); sb.append(vo.getTargetId()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getReceptionDate()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getBbox().get(j).getCctvId()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getBbox().get(j).getLeftTopX()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getBbox().get(j).getLeftTopY()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getBbox().get(j).getRightBottomX()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getBbox().get(j).getRightBottomY()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getBbox().get(j).getPx()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getBbox().get(j).getPy()); sb.append("',");
|
||||
// sb.append("'"); sb.append("fusion"); sb.append("');");
|
||||
// }
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
private String getInsertLastCctvSql(CctvTrackVO vo) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String now_dt = format.format(vo.getDetctDt());
|
||||
|
||||
private String getInsertLastTrackSql(CctvTrackVO vo) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if(MainServer.LAST_DATA_CNT > 0) {
|
||||
// update
|
||||
sb.append(" UPDATE SACP_VIDEO_META_LC");
|
||||
sb.append(" SET DETCT_DT = "); sb.append("'");sb.append(vo.getDetctTy());sb.append("'");
|
||||
sb.append(" , DETCT_TY = "); sb.append("'");sb.append(vo.getDetctTy());sb.append("'");
|
||||
sb.append(" , CCTV_INFO = "); sb.append("'");sb.append(vo.getCctvInfo());sb.append("'");
|
||||
sb.append(" , CCTV_CHRG_ZONE = "); sb.append("'");sb.append(vo.getCctvChrgZone());sb.append("'");
|
||||
sb.append(" , AC_TY = "); sb.append("'");sb.append(vo.getAcTy());sb.append("'");
|
||||
sb.append(" , ARLN_CD = "); sb.append("'");sb.append(vo.getArlnCd());sb.append("'");
|
||||
sb.append(" , TRACK_ID = "); sb.append("'");sb.append(vo.getTrackId());sb.append("'");
|
||||
sb.append(" , BB_TOP_LEFT_X = "); sb.append(vo.getBbTopLeftX());
|
||||
sb.append(" , BB_TOP_LEFT_Y = "); sb.append(vo.getBbTopLeftY());
|
||||
sb.append(" , BB_BOTTOM_RIGHT_X = "); sb.append(vo.getBbBottomRightX());
|
||||
sb.append(" , BB_BOTTOM_RIGHT_Y = "); sb.append(vo.getBbBottomRightY());
|
||||
sb.append(" , CRDNT_X = "); sb.append(vo.getCrdntX());
|
||||
sb.append(" , CRDNT_Y = "); sb.append(vo.getCrdntY());
|
||||
sb.append(" , CRDNT_LAT = "); sb.append(vo.getCrdntLat());
|
||||
sb.append(" , CRDNT_LON = "); sb.append(vo.getCrdntLon());
|
||||
sb.append(" , AC_STAND_ON_AT = "); sb.append(vo.getAcStandOnAt());
|
||||
sb.append(" , OBJECT_SPD = "); sb.append(vo.getObjectSpd());
|
||||
sb.append(" , UPDUSR_ID = "); sb.append("'SYSTEM'");
|
||||
sb.append(" , UPDT_DT = TO_TIMESTAMP(SYSDATE,'yyyyMMdd')");
|
||||
sb.append(" WHERE VIDEO_META_ID = "); sb.append("'");sb.append(vo.getVideoMetaId());sb.append("')");
|
||||
}else {
|
||||
sb.append(" INSERT INTO SACP_VIDEO_META_LC");
|
||||
sb.append(" ( VIDEO_META_ID, DETCT_DT, DETCT_TY, CCTV_INFO, CCTV_CHRG_ZONE, AC_TY, ARLN_CD, TRACK_ID, BB_TOP_LEFT_X, BB_TOP_LEFT_Y,");
|
||||
sb.append(" BB_BOTTOM_RIGHT_X, BB_BOTTOM_RIGHT_Y, CRDNT_X, CRDNT_Y, CRDNT_LAT, CRDNT_LON, AC_STAND_ON_AT, OBJECT_SPD, REGISTER_ID");
|
||||
sb.append(" ) VALUES (");
|
||||
sb.append("'"); sb.append("UCM.FUN_GET_WORK_NO( '"+now_dt+"', 'VIDEO')"); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getDetctDt()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getDetctTy()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getCctvInfo()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getCctvChrgZone()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getAcTy()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getArlnCd()); sb.append("',");
|
||||
sb.append("'"); sb.append(vo.getTrackId()); sb.append("',");
|
||||
sb.append(vo.getBbTopLeftX()); sb.append(",");
|
||||
sb.append(vo.getBbTopLeftY()); sb.append(",");
|
||||
sb.append(vo.getBbBottomRightX()); sb.append(",");
|
||||
sb.append(vo.getBbBottomRightY()); sb.append(",");
|
||||
sb.append(vo.getCrdntX()); sb.append(",");
|
||||
sb.append(vo.getCrdntY()); sb.append(",");
|
||||
sb.append(vo.getCrdntLat()); sb.append(",");
|
||||
sb.append(vo.getCrdntLon()); sb.append(",");
|
||||
sb.append("'"); sb.append(vo.getAcStandOnAt()); sb.append("',");
|
||||
sb.append(vo.getObjectSpd()); sb.append(",");
|
||||
sb.append("'"); sb.append("SYSTEM"); sb.append("')");
|
||||
sb.append("UPDATE SACP_TRACK_LAST");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
|
|
|
@ -143,7 +143,6 @@ public class FileUtil {
|
|||
* 로그파일을 생성하는 함수
|
||||
*/
|
||||
public String createLogFile(String fileZipPath, String fileZipBakPath, int fileMakeTime) {
|
||||
// 폴더가 존재하는지 확인
|
||||
File fileDir = new File(fileZipPath);
|
||||
if(!fileDir.exists()) {
|
||||
fileDir.mkdirs();
|
||||
|
@ -182,12 +181,12 @@ public class FileUtil {
|
|||
// static 변수에 값을 세팅한다.
|
||||
//FILE_LOG_NAME = _path;
|
||||
|
||||
|
||||
System.out.println("=============");
|
||||
System.out.println(_path);
|
||||
System.out.println("=============");
|
||||
|
||||
File file = new File(_path);
|
||||
File parentDir = file.getParentFile();
|
||||
if (!parentDir.exists()) {
|
||||
parentDir.mkdirs();
|
||||
}
|
||||
|
||||
if (file.createNewFile()) {
|
||||
System.out.println("파일 생성 완료");
|
||||
} else {
|
||||
|
|
|
@ -33,10 +33,9 @@ public class WebClientConfig {
|
|||
connection.addHandlerLast(new WriteTimeoutHandler(5000, TimeUnit.MILLISECONDS));
|
||||
});
|
||||
|
||||
//Memory 조정: 10M (default 256KB)
|
||||
//Memory 조정: 2M (default 256KB)
|
||||
ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
|
||||
//.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(10*1024*1024))
|
||||
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(-1))
|
||||
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2*1024*1024))
|
||||
.build();
|
||||
|
||||
return WebClient.builder()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,12 +9,13 @@ spring:
|
|||
#db-type: oracle
|
||||
batch-insert-size: 1000
|
||||
datasource:
|
||||
jdbc-url: jdbc:tibero:thin:@10.200.31.1:8629:sacp
|
||||
driver-class-name: com.tmax.tibero.jdbc.TbDriver
|
||||
username: UIC
|
||||
password: UIC
|
||||
connectionTimeout: 5000
|
||||
maxLifetime: 30000
|
||||
#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
|
||||
|
||||
|
||||
client:
|
||||
|
@ -42,7 +43,7 @@ process:
|
|||
queue-chunk-size: 1000
|
||||
# 매일 오전 9시부터 오후7시까지 1분마다 실행
|
||||
# rest api 호출 스케줄러
|
||||
rest-cron: 0/10 * * * * *
|
||||
rest-cron: 0 0/1 * * * *
|
||||
# 파일 백업 스케쥴러 시간
|
||||
file-backup-cron: 0 0/10 * * * *
|
||||
# 파일 생성 스케쥴러 시간
|
||||
|
@ -51,12 +52,10 @@ process:
|
|||
data-backup-cron: 0 0/10 * * * *
|
||||
# 파일 생성 스케쥴러 시간
|
||||
data-make-cron: 0 0/10 * * * *
|
||||
# 스레드 상태 체크 스케줄러
|
||||
status-check-cron: 0/10 * * * * *
|
||||
|
||||
|
||||
marine-area:
|
||||
file-path: ./data/marine_area.xml
|
||||
|
||||
|
||||
flag:
|
||||
database: false
|
||||
datafile: true #logstash data log file
|
||||
|
@ -70,12 +69,18 @@ data-zip-path: ./logs/data
|
|||
data-zip-bak-path: ./logs/databackup
|
||||
data-make-time: 10
|
||||
|
||||
rest:
|
||||
server:
|
||||
ip: 10.200.31.110
|
||||
port: 30000
|
||||
path: /meta/obj
|
||||
|
||||
kafka:
|
||||
#bootstrapServers: http://118.220.143.175:9091,http://118.220.143.176:9091,http://118.220.143.176:9092
|
||||
bootstrapServers: http://10.200.31.6:9091,http://10.200.31.8:9091,http://10.200.31.142:9091 #공항
|
||||
topic: ai.analyze.location
|
||||
|
||||
classification: 1 #이중화되어 있는 서버의 Index
|
||||
swclassification: 2 #sw구분 ai_location
|
||||
logclassification: 1 #log구분
|
||||
swclassification: 2 #sw구분 cctv(ai_location)
|
||||
logclassification: 1 #log구분
|
||||
|
||||
state:
|
||||
# 공통코드 CT001의 코드 6자리
|
||||
id: AI0202 # 영상메타데이터
|
||||
# 1:Primary, 2:Secondary
|
||||
type: Primary
|
|
@ -1,3 +0,0 @@
|
|||
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
|
||||
|
||||
log4jdbc.dump.sql.maxlinelength=0
|
|
@ -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">
|
||||
|
@ -45,7 +43,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">
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
/bin
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/logs/
|
Binary file not shown.
|
@ -1,2 +0,0 @@
|
|||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
|
|
@ -1,2 +0,0 @@
|
|||
# TSS
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,316 +0,0 @@
|
|||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven Start Up Batch script
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# M2_HOME - location of maven2's installed home dir
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "`uname`" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||
else
|
||||
export JAVA_HOME="/Library/Java/Home"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=`java-config --jre-home`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$M2_HOME" ] ; then
|
||||
## resolve links - $0 may be a link to maven's home
|
||||
PRG="$0"
|
||||
|
||||
# need this for relative symlinks
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG="`dirname "$PRG"`/$link"
|
||||
fi
|
||||
done
|
||||
|
||||
saveddir=`pwd`
|
||||
|
||||
M2_HOME=`dirname "$PRG"`/..
|
||||
|
||||
# make it fully qualified
|
||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||
|
||||
cd "$saveddir"
|
||||
# echo Using m2 at $M2_HOME
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="`which javac`"
|
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=`which readlink`
|
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||
else
|
||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||
fi
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="`\\unset -f command; \\command -v java`"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=`cd "$wdir/.."; pwd`
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
echo "${basedir}"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
echo "$(tr -s '\n' ' ' < "$1")"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
||||
fi
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||
fi
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
else
|
||||
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
fi
|
||||
while IFS="=" read key value; do
|
||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||
esac
|
||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Downloading from: $jarUrl"
|
||||
fi
|
||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if $cygwin; then
|
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found wget ... using wget"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found curl ... using curl"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||
else
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||
fi
|
||||
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Falling back to using Java to download"
|
||||
fi
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaClass=`cygpath --path --windows "$javaClass"`
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
# Compiling the Java class
|
||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||
fi
|
||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
# Running the downloader
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Running MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo $MAVEN_PROJECTBASEDIR
|
||||
fi
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.home=${M2_HOME}" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
|
@ -1,188 +0,0 @@
|
|||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Maven Start Up Batch script
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM M2_HOME - location of maven2's installed home dir
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %DOWNLOAD_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
|
@ -1,151 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.8</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>kr.gmtc</groupId>
|
||||
<artifactId>tss</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>ana</name>
|
||||
<description>ANA TSS</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<!-- versions -->
|
||||
<gmtc.version>0.0.1-SNAPSHOT</gmtc.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.3.7</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
||||
<version>1.16</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.17.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<version>2.17.2</version>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
|
||||
<!-- <dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>4.1.85.Final</version>
|
||||
</dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.projectreactor</groupId>
|
||||
<artifactId>reactor-spring</artifactId>
|
||||
<version>1.0.1.RELEASE</version>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>kr.gmtc</groupId>
|
||||
<artifactId>EyeGW-Core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>2.14.0</version>
|
||||
</dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>kr.gmt.so</groupId>
|
||||
<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>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ipworks.local</groupId>
|
||||
<artifactId>ipworks-local-1.0.0</artifactId>
|
||||
<scope>system</scope>
|
||||
<version>1.0.0</version>
|
||||
<systemPath>${basedir}/lib/ipworks-local-1.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tmax.tibero</groupId>
|
||||
<artifactId>tibero-jdbc</artifactId>
|
||||
<version>6.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/tibero6-jdbc.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>EyeTSS_ANA</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -1,2 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package kr.gmtc.tss;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package kr.gmtc.tss.kafka;
|
||||
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collections;
|
||||
import java.util.Properties;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
||||
import org.apache.kafka.clients.consumer.KafkaConsumer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class KafkaTopicReader implements Runnable {
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private final String bootstrapServers;
|
||||
private final String topic;
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
|
||||
public KafkaTopicReader(String bootstrapServers, String topic, Queue<String> rcvQueue) {
|
||||
this.bootstrapServers = bootstrapServers;
|
||||
this.topic = topic;
|
||||
this.rcvQueue = rcvQueue;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
Properties props = new Properties();
|
||||
props.put("bootstrap.servers", bootstrapServers);
|
||||
props.put("group.id", "kafka-topic-reader");
|
||||
props.put("auto.offset.reset", "earliest");
|
||||
props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
|
||||
props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
|
||||
try (KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props)) {
|
||||
|
||||
// 토픽 구독
|
||||
consumer.subscribe(Collections.singletonList(topic));
|
||||
|
||||
while (true) {
|
||||
/*
|
||||
* rcvQueue.
|
||||
* add("{\"header\":{\"result_code\":\"200\",\"result_msg\":\"Success\"},\"data\":[{\"anals_id\":\"anals_id\",\"anals_dt\":\"2023-05-26 10:06:18\",\"anals_ty\":\"지시위반\",\"area\":{\"area_type\":\"AF03006\",\"area_id\":\"106\"},\"target1\":{\"trgt_ty\":\"1\",\"trgt_id\":\"KAL035\"},\"target2\":{\"trgt_ty\":null,\"trgt_id\":null},\"anals_msg\":\"PDC발부 전 PushBack 진행중 입니다.\"}]}"
|
||||
* ); Thread.sleep(10000);
|
||||
*/
|
||||
ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(100));
|
||||
|
||||
if (records.count() > 0) logger.info("topic {} 수신 건수 {}", topic, records.count());
|
||||
|
||||
for (ConsumerRecord<String, String> record : records) {
|
||||
rcvQueue.add(record.value());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,246 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package kr.gmtc.tss.netty;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Queue;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandler.Sharable;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import io.netty.handler.codec.serialization.ClassResolvers;
|
||||
import io.netty.handler.codec.serialization.ObjectDecoder;
|
||||
import io.netty.handler.codec.serialization.ObjectEncoder;
|
||||
import io.netty.handler.codec.string.StringDecoder;
|
||||
import io.netty.handler.codec.string.StringEncoder;
|
||||
import io.netty.handler.ssl.SslContext;
|
||||
import io.netty.handler.ssl.SslContextBuilder;
|
||||
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
|
||||
import io.netty.handler.timeout.IdleStateHandler;
|
||||
import kr.gmtc.tss.status.ContextDestroyStatus;
|
||||
//import kr.gmt.routing.dds.support.ContextDestroyStatus;
|
||||
//import kr.gmt.routing.netty.server.ObjectEchoServerHandler;
|
||||
|
||||
/**
|
||||
* Modification of {@link EchoClient} which utilizes Java object serialization.
|
||||
*/
|
||||
@Sharable
|
||||
public class StringClient extends Thread {
|
||||
private static Logger logger = LoggerFactory.getLogger(StringClient.class);
|
||||
|
||||
static boolean SSL = System.getProperty("ssl") != null;
|
||||
static String HOST = System.getProperty("tcp.server.ip", "127.0.0.1");
|
||||
static int PORT = Integer.parseInt(System.getProperty("tcp.server.port", "8030"));
|
||||
static int SIZE = Integer.parseInt(System.getProperty("size", "256"));
|
||||
|
||||
private EventLoopGroup eventLoop;
|
||||
|
||||
|
||||
long reconnTime=3000;
|
||||
String threadName="";
|
||||
|
||||
// Queue<byte[]> dataQueue;
|
||||
|
||||
ChannelFuture channelFuture;
|
||||
StringClient client;
|
||||
StringClientHandler clientHandler;
|
||||
// ContextDestroyStatus contextDestroyStatus;
|
||||
|
||||
private boolean isServerStarted=false;
|
||||
|
||||
private Bootstrap b;
|
||||
|
||||
public void setServerStarted(boolean isServerStarted) {
|
||||
this.isServerStarted = isServerStarted;
|
||||
}
|
||||
|
||||
|
||||
public StringClient(String ip, int port, Queue<String> dataQueue, long reconnTime
|
||||
// ,
|
||||
// ChannelFuture channelFuture,
|
||||
// ContextDestroyStatus contextDestroyStatus
|
||||
) {
|
||||
this.HOST = ip;
|
||||
this.PORT = port;
|
||||
// this.dataQueue = dataQueue;
|
||||
this.client=this;
|
||||
this.reconnTime=reconnTime;
|
||||
this.channelFuture=client.channelFuture;
|
||||
// this.channelFuture=channelFuture;
|
||||
// this.contextDestroyStatus= contextDestroyStatus;
|
||||
clientHandler=new StringClientHandler(client,threadName, dataQueue,reconnTime);
|
||||
}
|
||||
|
||||
public EventLoopGroup getEventLoop() {
|
||||
return eventLoop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void interrupt() {
|
||||
// TODO Auto-generated method stub
|
||||
super.interrupt();
|
||||
eventLoop.shutdownGracefully();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
this.threadName = Thread.currentThread().getName();
|
||||
// startClient(new Bootstrap(),eventLoop,threadName);
|
||||
// boolean startStat=true;
|
||||
// eventLoop=new NioEventLoopGroup();
|
||||
startClient( );
|
||||
|
||||
/* while(!contextDestroyStatus.getShutdownStat()) {
|
||||
if(eventLoop!=null)
|
||||
eventLoop.shutdownGracefully();
|
||||
if (channelFuture==null||!channelFuture.isSuccess()||(!isServerStarted&&eventLoop.isShutdown())) {
|
||||
logger.info("서버 연결 시도 - /"+HOST+":"+PORT);
|
||||
eventLoop=new NioEventLoopGroup();
|
||||
// if(startClient( eventLoop,threadName)) {
|
||||
|
||||
if(startClient( )) {}
|
||||
// {
|
||||
|
||||
// break;
|
||||
// }
|
||||
isServerStarted=false;
|
||||
}
|
||||
|
||||
threadSleep(reconnTime);
|
||||
|
||||
if(contextDestroyStatus.getShutdownStat()) {
|
||||
logger.info("ObjectEchoClient Shutdown called");
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void threadSleep(long mills) {
|
||||
try {
|
||||
Thread.sleep(mills);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("Sleep Interrupted - "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// public ChannelFuture getChannelFuture() {
|
||||
// return channelFuture;
|
||||
// }
|
||||
|
||||
public boolean startClient() {
|
||||
return startClient( this.threadName);
|
||||
}
|
||||
|
||||
public boolean startClient(String threadName) {
|
||||
isServerStarted=true;
|
||||
boolean rtnVal=false;
|
||||
// try {
|
||||
eventLoop=new NioEventLoopGroup();
|
||||
EventLoopGroup group =eventLoop;
|
||||
|
||||
// final SslContext sslCtx;
|
||||
// if (SSL) {
|
||||
//
|
||||
// sslCtx = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();
|
||||
//
|
||||
// } else {
|
||||
// sslCtx = null;
|
||||
// }
|
||||
//
|
||||
// EventLoopGroup group = new NioEventLoopGroup();
|
||||
try {
|
||||
b = new Bootstrap();
|
||||
|
||||
b.group(group)
|
||||
.channel(NioSocketChannel.class)
|
||||
.option(ChannelOption.TCP_NODELAY, true)
|
||||
.option(ChannelOption.SO_KEEPALIVE, true)
|
||||
// .option(ChannelOption.SO_REUSEADDR, true)
|
||||
.handler(new ChannelInitializer<SocketChannel>() {
|
||||
@Override
|
||||
public void initChannel(SocketChannel ch) throws Exception {
|
||||
try {
|
||||
|
||||
|
||||
ChannelPipeline p = ch.pipeline();
|
||||
// if (sslCtx != null) {
|
||||
// p.addLast(sslCtx.newHandler(ch.alloc(), HOST, PORT));
|
||||
// }
|
||||
// p.addLast(new ObjectEncoder(),
|
||||
// new ObjectDecoder(ClassResolvers.cacheDisabled(null)),
|
||||
// clientHandler);
|
||||
p.addLast(
|
||||
// new IdleStateHandler(3, 0 , 0),
|
||||
new StringEncoder(),
|
||||
new StringDecoder(Charset.forName("MS949")),
|
||||
clientHandler);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
logger.error("init error ",e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
rtnVal=connecServer();
|
||||
|
||||
}catch(Exception e) {
|
||||
logger.error("서버 연결 실패 - "+e.getLocalizedMessage());
|
||||
logger.debug("call stack : ",e);
|
||||
} finally {
|
||||
// group.shutdownGracefully();
|
||||
}
|
||||
// } catch (SSLException e) {
|
||||
// logger.error("SSLException - ", e);
|
||||
// }
|
||||
// finally {
|
||||
// logger.info("Client cycle over!");
|
||||
// }
|
||||
return rtnVal;
|
||||
}
|
||||
|
||||
|
||||
public boolean connecServer() {
|
||||
boolean rtnVal=false;
|
||||
// group.
|
||||
try {
|
||||
channelFuture = b.connect(HOST, PORT);
|
||||
channelFuture.sync();
|
||||
channelFuture.channel().closeFuture().sync();
|
||||
rtnVal=true;
|
||||
// } catch (InterruptedException e) {
|
||||
// logger.error("서버 연결 실패 - "+e.getLocalizedMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("서버 연결 실패 - "+e.getLocalizedMessage());
|
||||
}
|
||||
return rtnVal;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package kr.gmtc.tss.netty;
|
||||
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import io.netty.channel.ChannelHandler.Sharable;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
|
||||
/**
|
||||
* Handler implementation for the object echo client. It initiates the ping-pong
|
||||
* traffic between the object echo client and server by sending the first
|
||||
* message to the server.
|
||||
*/
|
||||
@Sharable
|
||||
public class StringClientHandler
|
||||
//extends SimpleChannelInboundHandler<Object>{
|
||||
extends ChannelInboundHandlerAdapter {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(StringClientHandler.class);
|
||||
|
||||
String threadNm="";
|
||||
|
||||
Queue<String> dataQueue;
|
||||
|
||||
StringClient client;
|
||||
|
||||
long reconnTime=3000;
|
||||
|
||||
long queueFullCnt=0;
|
||||
|
||||
ApplicationContext appContext;
|
||||
|
||||
public StringClientHandler(StringClient client, String threadNm, Queue<String> dataQueue, long reconnTime) {
|
||||
this.threadNm=threadNm;
|
||||
this.dataQueue=dataQueue;
|
||||
this.client=client;
|
||||
this.reconnTime=reconnTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) {
|
||||
logger.info("서버 접속 - " + ctx.channel().remoteAddress().toString());
|
||||
}
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||
|
||||
// logger.info(msg.toString());
|
||||
if(dataQueue!=null) {
|
||||
if(!dataQueue.offer(msg.toString())) {
|
||||
logger.debug("Client data queue is full!");
|
||||
}
|
||||
}else {
|
||||
logger.error("dataQueue is null!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
logger.info("서버 연결 해제 - " +ctx.channel().remoteAddress());
|
||||
|
||||
ctx.close();
|
||||
super.channelInactive(ctx);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelReadComplete(ChannelHandlerContext ctx) {
|
||||
ctx.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
|
||||
logger.info("접속 오류 발생- " + ctx.channel().remoteAddress().toString()+"/cause : "+cause.getLocalizedMessage());
|
||||
|
||||
logger.debug("",cause);
|
||||
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
// super.channelUnregistered(ctx);
|
||||
|
||||
logger.info("접속 불가 - " + client.HOST+":"+client.PORT+" - "+client.reconnTime+"초 후 재 접속 시도 합니다.");
|
||||
ctx.channel().eventLoop().schedule(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
logger.info("재접속 시도 - "+ client.HOST+":"+client.PORT);
|
||||
client.connecServer();
|
||||
}
|
||||
}, client.reconnTime, TimeUnit.SECONDS);
|
||||
super.channelUnregistered(ctx);
|
||||
}
|
||||
|
||||
/*private void reConnection(ChannelHandlerContext ctx) {
|
||||
String serverAddr=ctx.channel().remoteAddress()+"";
|
||||
logger.info("서버 재연결 시작 - "+serverAddr);
|
||||
ctx.flush();
|
||||
ctx.close();
|
||||
Thread reconThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
while(!ctx.channel().isRegistered ()) {
|
||||
logger.info("서버 재연결 시도 - "+ctx.channel().remoteAddress());
|
||||
// client.getEventLoop().shutdownGracefully();
|
||||
//
|
||||
// if(!client.getEventLoop().isShutdown()){
|
||||
// logger.info("No Shutdown before");
|
||||
// threadSleep(reconnTime);
|
||||
// continue;
|
||||
// }
|
||||
|
||||
if(client.startClient()) {
|
||||
break;
|
||||
}
|
||||
|
||||
threadSleep(reconnTime);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
reconThread.start();
|
||||
}*/
|
||||
|
||||
private void threadSleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("thread sleep fail",e);
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// logger.info(msg.toString());
|
||||
// if(dataQueue!=null) {
|
||||
// if(!dataQueue.offer(msg.toString())) {
|
||||
// logger.error("Client data queue is full!");
|
||||
// }
|
||||
// }else {
|
||||
// logger.error("dataQueue is null!");
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package kr.gmtc.tss.status;
|
||||
|
||||
public interface ContextDestroyEventListener {
|
||||
/**
|
||||
* Context destroy event handler.
|
||||
*/
|
||||
void onDestroy();
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package kr.gmtc.tss.status;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
public class ContextDestroyStatus {
|
||||
/**
|
||||
* Logger.
|
||||
*/
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
* linstener list.
|
||||
*/
|
||||
private final List<ContextDestroyEventListener> contextDestroyEventListeners = new ArrayList<ContextDestroyEventListener>();
|
||||
|
||||
/**
|
||||
* context destroy 여부 상태 값.
|
||||
*/
|
||||
private boolean shutdown = false;
|
||||
|
||||
/**
|
||||
* Shutdown flag 설정 등. 등록된 listener의 onDestroy event를 fire 한다.
|
||||
*/
|
||||
@PreDestroy
|
||||
public void destroy() {
|
||||
logger.info("Called destroy()!");
|
||||
shutdown = true;
|
||||
|
||||
for (ContextDestroyEventListener listener : contextDestroyEventListeners) {
|
||||
listener.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return destroy 된다면 true. 동작 중에는 false.
|
||||
*/
|
||||
public boolean getShutdownStat() {
|
||||
return shutdown;
|
||||
}
|
||||
public void setShutdownStat(boolean shutdown ) {
|
||||
this.shutdown=shutdown;
|
||||
// return shutdown;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param listener
|
||||
* event fire 대상 class.
|
||||
*/
|
||||
public void addListener(final ContextDestroyEventListener listener) {
|
||||
contextDestroyEventListeners.add(listener);
|
||||
logger.info("addListener ({}) complete. Listeners count is {}.", listener.getClass().getName(),
|
||||
contextDestroyEventListeners.size());
|
||||
}
|
||||
}
|
|
@ -1,240 +0,0 @@
|
|||
package kr.gmtc.tss.status;
|
||||
|
||||
public class CountStatus {
|
||||
|
||||
private int rcvPos=0;
|
||||
private int rcvStat=0;
|
||||
private int savePos=0;
|
||||
private int saveLast=0;
|
||||
private int saveStatic=0;
|
||||
private int failPos=0;
|
||||
private int failLast=0;
|
||||
private int failStatic=0;
|
||||
private int exceptPos=0;
|
||||
|
||||
|
||||
private int rcvQueueSize=0;
|
||||
private int dynamicVoQueueSize=0;
|
||||
private int staticVoQueueSize=0;
|
||||
private int dynamicInsertQueueSize=0;
|
||||
private int sqlLogDynamicQueueSize=0;
|
||||
private int sqlLogDynamicLastQueueSize=0;
|
||||
private int sqlLogStaticQueueSize=0;
|
||||
|
||||
|
||||
|
||||
public CountStatus(int rcvPos, int rcvStat) {
|
||||
this.rcvPos=rcvPos;
|
||||
this.rcvStat=rcvStat;
|
||||
}
|
||||
|
||||
public CountStatus(int savePos, int saveLast, int saveStatic, int failPos, int failLast, int failStatic) {
|
||||
this.savePos=savePos;
|
||||
this.saveLast=saveLast;
|
||||
this.saveStatic=saveStatic;
|
||||
this.failPos=failPos;
|
||||
this.failLast=failLast;
|
||||
this.failStatic=failStatic;
|
||||
}
|
||||
|
||||
public CountStatus() {
|
||||
|
||||
}
|
||||
|
||||
public int getRcvPos() {
|
||||
return rcvPos;
|
||||
}
|
||||
|
||||
public void setRcvPos(int rcvPos) {
|
||||
this.rcvPos = rcvPos;
|
||||
}
|
||||
|
||||
public int getRcvStat() {
|
||||
return rcvStat;
|
||||
}
|
||||
|
||||
public void setRcvStat(int rcvStat) {
|
||||
this.rcvStat = rcvStat;
|
||||
}
|
||||
|
||||
public int getSavePos() {
|
||||
return savePos;
|
||||
}
|
||||
|
||||
public void setSavePos(int savePos) {
|
||||
this.savePos = savePos;
|
||||
}
|
||||
|
||||
public int getSaveLast() {
|
||||
return saveLast;
|
||||
}
|
||||
|
||||
public void setSaveLast(int saveLast) {
|
||||
this.saveLast = saveLast;
|
||||
}
|
||||
|
||||
public int getSaveStatic() {
|
||||
return saveStatic;
|
||||
}
|
||||
|
||||
public void setSaveStatic(int saveStatic) {
|
||||
this.saveStatic = saveStatic;
|
||||
}
|
||||
|
||||
public int getFailPos() {
|
||||
return failPos;
|
||||
}
|
||||
|
||||
public void setFailPos(int failPos) {
|
||||
this.failPos = failPos;
|
||||
}
|
||||
|
||||
public int getFailLast() {
|
||||
return failLast;
|
||||
}
|
||||
|
||||
public void setFailLast(int failLast) {
|
||||
this.failLast = failLast;
|
||||
}
|
||||
|
||||
public int getFailStatic() {
|
||||
return failStatic;
|
||||
}
|
||||
|
||||
public void setFailStatic(int failStatic) {
|
||||
this.failStatic = failStatic;
|
||||
}
|
||||
|
||||
public int getExceptPos() {
|
||||
return exceptPos;
|
||||
}
|
||||
|
||||
public void setExceptPos(int exceptPos) {
|
||||
this.exceptPos = exceptPos;
|
||||
}
|
||||
|
||||
|
||||
public int getRcvQueueSize() {
|
||||
return rcvQueueSize;
|
||||
}
|
||||
|
||||
public void setRcvQueueSize(int rcvQueueSize) {
|
||||
this.rcvQueueSize = rcvQueueSize;
|
||||
}
|
||||
|
||||
public int getDynamicVoQueueSize() {
|
||||
return dynamicVoQueueSize;
|
||||
}
|
||||
|
||||
public void setDynamicVoQueueSize(int dynamicVoQueueSize) {
|
||||
this.dynamicVoQueueSize = dynamicVoQueueSize;
|
||||
}
|
||||
|
||||
public int getStaticVoQueueSize() {
|
||||
return staticVoQueueSize;
|
||||
}
|
||||
|
||||
public void setStaticVoQueueSize(int staticVoQueueSize) {
|
||||
this.staticVoQueueSize = staticVoQueueSize;
|
||||
}
|
||||
|
||||
public int getDynamicInsertQueueSize() {
|
||||
return dynamicInsertQueueSize;
|
||||
}
|
||||
|
||||
public void setDynamicInsertQueueSize(int dynamicInsertQueueSize) {
|
||||
this.dynamicInsertQueueSize = dynamicInsertQueueSize;
|
||||
}
|
||||
|
||||
public int getSqlLogDynamicQueueSize() {
|
||||
return sqlLogDynamicQueueSize;
|
||||
}
|
||||
|
||||
public void setSqlLogDynamicQueueSize(int sqlLogDynamicQueueSize) {
|
||||
this.sqlLogDynamicQueueSize = sqlLogDynamicQueueSize;
|
||||
}
|
||||
|
||||
public int getSqlLogDynamicLastQueueSize() {
|
||||
return sqlLogDynamicLastQueueSize;
|
||||
}
|
||||
|
||||
public void setSqlLogDynamicLastQueueSize(int sqlLogDynamicLastQueueSize) {
|
||||
this.sqlLogDynamicLastQueueSize = sqlLogDynamicLastQueueSize;
|
||||
}
|
||||
|
||||
public int getSqlLogStaticQueueSize() {
|
||||
return sqlLogStaticQueueSize;
|
||||
}
|
||||
|
||||
public void setSqlLogStaticQueueSize(int sqlLogStaticQueueSize) {
|
||||
this.sqlLogStaticQueueSize = sqlLogStaticQueueSize;
|
||||
}
|
||||
|
||||
public void initZero() {
|
||||
|
||||
rcvPos = 0;
|
||||
rcvStat = 0;
|
||||
savePos = 0;
|
||||
saveLast = 0;
|
||||
saveStatic = 0;
|
||||
failPos = 0;
|
||||
failLast = 0;
|
||||
failStatic = 0;
|
||||
|
||||
}
|
||||
|
||||
public String getCountLog() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "\r\n");
|
||||
sb.append( "===============================================\r\n" );
|
||||
sb.append( " Count Info \r\n" );
|
||||
sb.append( "===============================================\r\n" );
|
||||
sb.append( " 위치정보 \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " 수신 / 저장성공 / 저장실패 / 제외 / \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " "+String.format(" %5s", rcvPos)+" / "+String.format(" %5s", savePos)+" / "+String.format(" %5s", failPos)+" / "+String.format(" %5s", exceptPos)+"\r\n" );
|
||||
sb.append( "===============================================\r\n" );
|
||||
sb.append( " 정적정보 \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " 수신 / 저장성공 / 저장실패 / \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " "+String.format(" %5s", rcvStat)+" / "+String.format(" %5s", saveStatic)+" / "+String.format(" %5s", failStatic)+" / \r\n");
|
||||
sb.append( "===============================================\r\n");;
|
||||
sb.append( " 최종위치정보 \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " 저장성공 / 저장실패 / \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " "+String.format(" %5s", saveLast)+" / "+String.format(" %5s", failLast)+" / \r\n");
|
||||
sb.append( "===============================================\r\n");
|
||||
sb.append( " 큐 상태 \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " 수신 / 동적 / 동적(입력) / 정적 / \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " "+String.format(" %5s", rcvQueueSize)+" / "+String.format(" %5s", dynamicVoQueueSize)+" / "+String.format(" %5s", dynamicInsertQueueSize)+" / "+String.format(" %5s", staticVoQueueSize)+" / \r\n");
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " SQL \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " 동적 / 최종 / 정적 / \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " "+String.format(" %5s", sqlLogDynamicQueueSize)+" / "+String.format(" %5s", sqlLogDynamicLastQueueSize)+" / "+String.format(" %5s", sqlLogStaticQueueSize)+" / \r\n");
|
||||
sb.append( "===============================================\r\n");
|
||||
|
||||
//
|
||||
|
||||
// private int rcvQueueSize=0;
|
||||
// private int dynamicVoQueueSize=0;
|
||||
// private int staticVoQueueSize=0;
|
||||
// private int dynamicInsertQueueSize=0;
|
||||
// private int sqlLogDynamicQueueSize=0;
|
||||
// private int sqlLogDynamicLastQueueSize=0;
|
||||
// private int sqlLogStaticQueueSize=0;
|
||||
|
||||
|
||||
initZero();
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
package kr.gmtc.tss.status;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CountingComponent {
|
||||
|
||||
private int rcvPos=0;
|
||||
private int rcvStatic=0;
|
||||
private int savePos=0;
|
||||
private int failPos=0;
|
||||
private int saveStatic=0;
|
||||
private int failStatic=0;
|
||||
|
||||
public int getRcvPos() {
|
||||
return rcvPos;
|
||||
}
|
||||
public void setRcvPos(int rcvPos) {
|
||||
this.rcvPos = rcvPos;
|
||||
}
|
||||
public int getRcvStatic() {
|
||||
return rcvStatic;
|
||||
}
|
||||
public void setRcvStatic(int rcvStatic) {
|
||||
this.rcvStatic = rcvStatic;
|
||||
}
|
||||
public int getSavePos() {
|
||||
return savePos;
|
||||
}
|
||||
public void setSavePos(int savePos) {
|
||||
this.savePos = savePos;
|
||||
}
|
||||
public int getFailPos() {
|
||||
return failPos;
|
||||
}
|
||||
public void setFailPos(int failPos) {
|
||||
this.failPos = failPos;
|
||||
}
|
||||
public int getSaveStatic() {
|
||||
return saveStatic;
|
||||
}
|
||||
public void setSaveStatic(int saveStatic) {
|
||||
this.saveStatic = saveStatic;
|
||||
}
|
||||
public int getFailStatic() {
|
||||
return failStatic;
|
||||
}
|
||||
public void setFailStatic(int failStatic) {
|
||||
this.failStatic = failStatic;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void initZero() {
|
||||
rcvPos=0;
|
||||
rcvStatic=0;
|
||||
savePos=0;
|
||||
failPos=0;
|
||||
saveStatic=0;
|
||||
failStatic=0;
|
||||
}
|
||||
|
||||
public String getCountLog() {
|
||||
String log = "\r\n"
|
||||
+ "===============================================\r\n"
|
||||
+ " Count Info \r\n"
|
||||
+ "===============================================\r\n"
|
||||
+ " 위치정보 \r\n"
|
||||
+ "-----------------------------------------------\r\n"
|
||||
+ " 수신 / 저장성공 / 저장실패 \r\n"
|
||||
+ "-----------------------------------------------\r\n"
|
||||
+ " "+String.format(" %5s", rcvPos)+" / "+String.format(" %5s", savePos)+" / "+String.format(" %5s", failPos)+"\r\n"
|
||||
+ "===============================================\r\n"
|
||||
+ " 정적정보 \r\n"
|
||||
+ "-----------------------------------------------\r\n"
|
||||
+ " 수신 / 저장성공 / 저장실패 \r\n"
|
||||
+ "-----------------------------------------------\r\n"
|
||||
+ " "+String.format(" %5s", rcvStatic)+" / "+String.format(" %5s", saveStatic)+" / "+String.format(" %5s", failStatic)+"\r\n"
|
||||
+ "===============================================\r\n";
|
||||
|
||||
initZero();
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class ArrayBlockingLoggingQueue<Object> extends ArrayBlockingQueue<Object> {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ArrayBlockingLoggingQueue.class);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,229 +0,0 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
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);
|
||||
|
||||
/**
|
||||
* 로그파일을 압축한다.
|
||||
* 라이브 데이터 압축을 피하기 위해 20분전 데이터를 압축하는 것으로 세팅
|
||||
*/
|
||||
public void createZipFile(String fileZipPath, String fileZipBakPath, int fileMakeTime) {
|
||||
|
||||
// 압축파일이 저장될 폴더가 존재하는지 확인
|
||||
File backDir = new File(fileZipBakPath);
|
||||
if(!backDir.exists()) {
|
||||
backDir.mkdirs();
|
||||
}
|
||||
|
||||
SimpleDateFormat fileFormatter = new SimpleDateFormat("yyyyMMddHHmm");
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.MINUTE, -20); // 20분전 데이터 확인
|
||||
|
||||
String time20 = fileFormatter.format(cal.getTime());
|
||||
|
||||
// 압축할 파일 명 확인.
|
||||
String bakFileName = "file."+time20+".log";
|
||||
|
||||
String fileName = "";
|
||||
ZipOutputStream zip_out = null;
|
||||
|
||||
// 압축 파일 명 세팅
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(bakFileName);
|
||||
sb.append(".zip");
|
||||
fileName = sb.toString();
|
||||
|
||||
String _path = fileZipPath+"/"+bakFileName;
|
||||
|
||||
File bakFile = new File(_path);
|
||||
|
||||
// 파일이 존재할 경우에만 실행.
|
||||
if(bakFile.exists()) {
|
||||
if (fileZipPath.charAt(fileZipPath.length() - 1) != '/') {
|
||||
_path = _path + "/";
|
||||
}
|
||||
|
||||
try {
|
||||
zip_out = new ZipOutputStream(new FileOutputStream(fileZipBakPath+"/"+fileName));
|
||||
zipFolder("", bakFile, zip_out);
|
||||
zip_out.close();
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} finally {
|
||||
|
||||
}
|
||||
} else {
|
||||
logger.error("{} 파일이 존재하지 않습니다.", fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ZipOutputStream를 넘겨 받아서 하나의 압축파일로 만든다.
|
||||
* @param parent 상위폴더명
|
||||
* @param file 압축할 파일
|
||||
* @param zout 압축전체스트림
|
||||
* @throws IOException
|
||||
*/
|
||||
private void zipFolder(String parent, File file, ZipOutputStream zout) throws IOException {
|
||||
byte[] data = new byte[2048];
|
||||
|
||||
int read;
|
||||
|
||||
BufferedInputStream instream = new BufferedInputStream(new FileInputStream(file));
|
||||
|
||||
ZipEntry zipEntry = new ZipEntry(parent + file.getName());
|
||||
zout.putNextEntry(zipEntry);
|
||||
|
||||
while ((read = instream.read(data, 0, 2048)) != -1) {
|
||||
zout.write(data, 0, read);
|
||||
}
|
||||
|
||||
zout.flush();
|
||||
zout.closeEntry();
|
||||
instream.close();
|
||||
|
||||
file.delete(); // 파일 삭제
|
||||
|
||||
}
|
||||
|
||||
private void bakFileDelete(String fileZipPath, String date) throws IOException {
|
||||
File folder = new File(fileZipPath+"/"+date); // file 생성
|
||||
|
||||
try {
|
||||
while(folder.exists()){
|
||||
File[] files = folder.listFiles();
|
||||
|
||||
for(File file : files){
|
||||
file.delete(); // 하위 파일 삭제
|
||||
}
|
||||
|
||||
// 폴더 삭제
|
||||
if(files.length == 0 && folder.isDirectory()){ // 하위 파일이 없는지와 폴더인지 확인 후 폴더 삭제
|
||||
folder.delete(); // 대상폴더 삭제
|
||||
}
|
||||
}
|
||||
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그파일을 생성하는 함수
|
||||
*/
|
||||
public String createLogFile(String fileZipPath, String fileZipBakPath, int fileMakeTime, String fileNm) {
|
||||
File fileDir = new File(fileZipPath);
|
||||
if(!fileDir.exists()) {
|
||||
fileDir.mkdirs();
|
||||
}
|
||||
|
||||
// 현재 시각 중에 분을 구해온다. (minute)
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("mm");
|
||||
String _path = "";
|
||||
|
||||
Date now = new Date();
|
||||
String nowTime = formatter.format(now);
|
||||
int time = Integer.parseInt(nowTime);
|
||||
String nowT = "";
|
||||
|
||||
// 현재 분이 설정한 값의 배수인지 확인한다.
|
||||
if(time%fileMakeTime == 0){
|
||||
if(time == 0) {
|
||||
nowT = "00";
|
||||
}else{
|
||||
nowT = String.valueOf(time);
|
||||
}
|
||||
}else{
|
||||
if(time < fileMakeTime) {
|
||||
nowT = "00";
|
||||
}else{
|
||||
nowT = nowTime.substring(0, 1)+"0";
|
||||
}
|
||||
}
|
||||
|
||||
// 생성할 파일명을 설정한다.
|
||||
SimpleDateFormat fileFormatter = new SimpleDateFormat("yyyyMMddHH");
|
||||
String fileTime = fileFormatter.format(now) + nowT;
|
||||
|
||||
try {
|
||||
_path = fileZipPath+"/"+fileNm+"."+fileTime+".log";
|
||||
|
||||
// static 변수에 값을 세팅한다.
|
||||
//FILE_LOG_NAME = _path;
|
||||
|
||||
File file = new File(_path);
|
||||
|
||||
File parentDir = file.getParentFile();
|
||||
if (!parentDir.exists()) {
|
||||
parentDir.mkdirs();
|
||||
}
|
||||
|
||||
if (file.createNewFile()) {
|
||||
logger.info("{} 파일 생성 완료", _path);
|
||||
} else {
|
||||
logger.info("{} 파일 존재", _path);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return _path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일에 메세지를 쓰는 함수
|
||||
* @param msg
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeLogFile(String msg, String fileName) throws Exception{
|
||||
// File file = new File(FILE_LOG_NAME);
|
||||
File file = new File(fileName);
|
||||
|
||||
// 파일이 존재할 경우에만 실행
|
||||
if(file.exists()) {
|
||||
FileWriter fw;
|
||||
try {
|
||||
fw = new FileWriter(file, true);
|
||||
fw.write(msg);
|
||||
fw.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else {
|
||||
logger.error("{} 파일 없음, 파일명 확인 필요.", fileName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class MapUtil {
|
||||
|
||||
public static ArrayList<String> toKeyArray(Map mapData){
|
||||
Set key = mapData.keySet();
|
||||
ArrayList<String> keyArr=new ArrayList<String>();
|
||||
for (Iterator iterator = key.iterator(); iterator.hasNext();) {
|
||||
keyArr.add((String)iterator.next());
|
||||
}
|
||||
return keyArr;
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<Object> toArray(Map mapData){
|
||||
Set key = mapData.keySet();
|
||||
ArrayList<Object> dataArr=new ArrayList<Object>();
|
||||
for (Iterator iterator = key.iterator(); iterator.hasNext();) {
|
||||
// dataArr.add((String)iterator.next());
|
||||
dataArr.add(mapData.get(iterator.next()));
|
||||
}
|
||||
return dataArr;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
|
||||
import org.springframework.web.reactive.function.client.ClientRequest;
|
||||
import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
|
||||
import org.springframework.web.reactive.function.client.ExchangeStrategies;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||
import io.netty.handler.timeout.WriteTimeoutHandler;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.netty.http.client.HttpClient;
|
||||
|
||||
@Configuration
|
||||
public class WebClientConfig {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Bean
|
||||
public WebClient webClient() {
|
||||
// 기본 설정으로 생성
|
||||
HttpClient httpClient = HttpClient.create();
|
||||
|
||||
httpClient.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000);
|
||||
httpClient.doOnConnected(connection -> {
|
||||
connection.addHandlerLast(new ReadTimeoutHandler(5000, TimeUnit.MILLISECONDS));
|
||||
connection.addHandlerLast(new WriteTimeoutHandler(5000, TimeUnit.MILLISECONDS));
|
||||
});
|
||||
|
||||
//Memory 조정: 2M (default 256KB)
|
||||
ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
|
||||
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2*1024*1024))
|
||||
.build();
|
||||
|
||||
return WebClient.builder()
|
||||
.baseUrl("")
|
||||
.defaultHeader("Access-Control-Allow-Origin", "*")
|
||||
.clientConnector(new ReactorClientHttpConnector(httpClient))
|
||||
.exchangeStrategies(exchangeStrategies)
|
||||
.filter(
|
||||
(req, next) -> next.exchange(
|
||||
ClientRequest.from(req).header("from", "webclient").build()
|
||||
)
|
||||
)
|
||||
.filter(
|
||||
ExchangeFilterFunction.ofRequestProcessor(
|
||||
clientRequest -> {
|
||||
log.info(">>>>>>>>>> REQUEST <<<<<<<<<<");
|
||||
log.info("Request: {} {}", clientRequest.method(), clientRequest.url());
|
||||
clientRequest.headers().forEach(
|
||||
(name, values) -> values.forEach(value -> log.info("{} : {}", name, value))
|
||||
);
|
||||
return Mono.just(clientRequest);
|
||||
}
|
||||
)
|
||||
)
|
||||
.filter(
|
||||
ExchangeFilterFunction.ofResponseProcessor(
|
||||
clientResponse -> {
|
||||
log.info(">>>>>>>>>> RESPONSE <<<<<<<<<<");
|
||||
clientResponse.headers().asHttpHeaders().forEach((name, values) -> values.forEach(value -> log.info("{} : {}", name, value)));
|
||||
return Mono.just(clientResponse);
|
||||
}
|
||||
)
|
||||
)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -1,500 +0,0 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import kr.gmtc.tss.util.vo.NodeValue;
|
||||
|
||||
|
||||
|
||||
public class XmlParseUtil {
|
||||
|
||||
|
||||
/** Logger. */
|
||||
private static final Logger logger = LoggerFactory.getLogger(XmlParseUtil.class);
|
||||
|
||||
|
||||
|
||||
|
||||
public static Map<String,Object> parseXml(String fileDir) {
|
||||
|
||||
File file = new File(fileDir);
|
||||
if(file==null||!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
return parseXml(file);
|
||||
}
|
||||
|
||||
public static Map<String,Object> parseXml(File file) {
|
||||
// String fileDir="D:\\TEMP\\20200714\\EXCH_ROOT\\CATALOG.XML";
|
||||
Map<String,Object> map=null;
|
||||
|
||||
|
||||
if(file==null||!file.exists()) {
|
||||
return map;
|
||||
}
|
||||
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = null;
|
||||
try {
|
||||
builder = factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
|
||||
// e.printStackTrace();
|
||||
logger.error("",e);
|
||||
}
|
||||
org.w3c.dom.Document doc = null;
|
||||
try {
|
||||
doc = builder.parse(file);
|
||||
} catch (SAXException | IOException e) {
|
||||
|
||||
// e.printStackTrace();
|
||||
// logger.error("",e);
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
inputStream = new FileInputStream(file.getPath());
|
||||
} catch (FileNotFoundException e1) {
|
||||
|
||||
logger.error("",e);
|
||||
}// Your InputStream from your database.
|
||||
Reader reader = null;
|
||||
try {
|
||||
reader = new InputStreamReader(inputStream, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
|
||||
logger.error("",e);
|
||||
}
|
||||
|
||||
InputSource is = new InputSource(reader);
|
||||
is.setEncoding("UTF-8");
|
||||
try {
|
||||
doc = builder.parse(is);
|
||||
} catch (SAXException | IOException e1) {
|
||||
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
|
||||
if(doc==null) {
|
||||
return map;
|
||||
}
|
||||
|
||||
NodeList nodeList = doc.getChildNodes();
|
||||
|
||||
|
||||
map=nodeListToMap(nodeList);
|
||||
|
||||
// System.out.println(getNodeValue(map, "S-111_exchangeCatalogue/identiFier/daTe", true));
|
||||
//
|
||||
// System.out.println("content : "+getNodeTextContents(map, "S-111_exchangeCatalogue/identiFier/daTe", true));
|
||||
// System.out.println("end");
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static String checkNode(String nodePath) {
|
||||
String firstNode="";
|
||||
|
||||
if(nodePath.isEmpty()) {
|
||||
return firstNode;
|
||||
}
|
||||
|
||||
if(nodePath.indexOf("/")==0) {
|
||||
nodePath=nodePath.substring(1);
|
||||
}
|
||||
firstNode=nodePath;
|
||||
return firstNode;
|
||||
}
|
||||
|
||||
private static String getFirstNode(String nodePath) {
|
||||
String firstNode="";
|
||||
|
||||
if(nodePath.isEmpty()) {
|
||||
return firstNode;
|
||||
}
|
||||
|
||||
if(nodePath.contains("/")) {
|
||||
String [] nodeNms = nodePath.split("/");
|
||||
firstNode=nodeNms[0];
|
||||
}else {
|
||||
firstNode=nodePath;
|
||||
}
|
||||
|
||||
return firstNode;
|
||||
|
||||
}
|
||||
|
||||
public static String getFirstPath(Map<String,Object> nodeMap) {
|
||||
String firstNode="";
|
||||
|
||||
if(nodeMap.isEmpty()) {
|
||||
return firstNode;
|
||||
}
|
||||
|
||||
ArrayList<String> keyList=MapUtil.toKeyArray(nodeMap);
|
||||
|
||||
if(keyList.size()>0) {
|
||||
firstNode=keyList.get(0);
|
||||
}
|
||||
//
|
||||
|
||||
return firstNode;
|
||||
|
||||
}
|
||||
|
||||
private static String getOtherNode(String curNode,String nodePath) {
|
||||
String otherNode="";
|
||||
|
||||
if(nodePath.isEmpty()) {
|
||||
return otherNode;
|
||||
}
|
||||
|
||||
nodePath=checkNode(nodePath);
|
||||
|
||||
if(nodePath.contains("/")||nodePath.equals(curNode)) {
|
||||
otherNode= nodePath.substring(curNode.length());
|
||||
}else {
|
||||
otherNode=nodePath;
|
||||
}
|
||||
|
||||
return otherNode;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static String getMapKey(Map<String,Object> nodeMap,String curNode) {
|
||||
return getMapKey(nodeMap, curNode, true);
|
||||
}
|
||||
|
||||
|
||||
private static String getMapKey(Map<String,Object> nodeMap,String curNode,boolean noCase) {
|
||||
String mapKey="";
|
||||
|
||||
if(!noCase) {
|
||||
return curNode;
|
||||
}else {
|
||||
ArrayList<String> list=MapUtil.toKeyArray(nodeMap);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).toLowerCase().equals(curNode.toLowerCase())) {
|
||||
mapKey=list.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return mapKey;
|
||||
}
|
||||
|
||||
public static Object getNodeObject(Map<String,Object> nodeMap,String nodePath) {
|
||||
return getNodeObject(nodeMap, nodePath, true);
|
||||
}
|
||||
|
||||
public static Object getNodeObject(Map<String,Object> nodeMap,String nodePath,boolean noCase) {
|
||||
Object nodeValue = null;
|
||||
try {
|
||||
|
||||
|
||||
String checkedNodePath=checkNode(nodePath);
|
||||
|
||||
String curNode=getFirstNode(checkedNodePath);
|
||||
|
||||
String otherNode=getOtherNode(curNode,checkedNodePath);
|
||||
|
||||
if(!curNode.isEmpty()) {
|
||||
nodeValue= nodeMap.get(getMapKey(nodeMap, curNode, noCase));
|
||||
|
||||
if(nodeValue!=null) {
|
||||
// nodeValue=getNodeValue(nodeMap, checkedNodePath, noCase);
|
||||
String chkdOtherNode=checkNode(otherNode);
|
||||
if(!chkdOtherNode.isEmpty()) {
|
||||
nodeValue=getNodeObject(((NodeValue)nodeValue).getChildMap(), otherNode, noCase);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
|
||||
// e.printStackTrace();
|
||||
logger.error("",e);
|
||||
}
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static NodeValue getNodeValue(Map<String,Object> nodeMap,String nodePath) {
|
||||
return getNodeValue(nodeMap, nodePath, true);
|
||||
}
|
||||
|
||||
public static NodeValue getNodeValue(Map<String,Object> nodeMap,String nodePath,boolean noCase) {
|
||||
NodeValue nodeValue = null;
|
||||
try {
|
||||
|
||||
|
||||
String checkedNodePath=checkNode(nodePath);
|
||||
|
||||
String curNode=getFirstNode(checkedNodePath);
|
||||
|
||||
String otherNode=getOtherNode(curNode,checkedNodePath);
|
||||
|
||||
if(!curNode.isEmpty()) {
|
||||
nodeValue=(NodeValue) nodeMap.get(getMapKey(nodeMap, curNode, noCase));
|
||||
|
||||
if(nodeValue!=null) {
|
||||
// nodeValue=getNodeValue(nodeMap, checkedNodePath, noCase);
|
||||
String chkdOtherNode=checkNode(otherNode);
|
||||
if(!chkdOtherNode.isEmpty()) {
|
||||
nodeValue=getNodeValue(nodeValue.getChildMap(), otherNode, noCase);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
|
||||
// e.printStackTrace();
|
||||
logger.error("",e);
|
||||
}
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
|
||||
public static List<NodeValue> getNodeValueList(Map<String,Object> nodeMap,String nodePath) {
|
||||
return getNodeValueList(nodeMap, nodePath, true);
|
||||
}
|
||||
|
||||
|
||||
public static List<NodeValue> getNodeValueList(Map<String,Object> nodeMap,String nodePath,boolean noCase) {
|
||||
|
||||
Object nodeObj=getNodeObject(nodeMap, nodePath, noCase);
|
||||
|
||||
if(nodeObj!=null&&(nodeObj.getClass()==List.class||nodeObj.getClass()==ArrayList.class)) {
|
||||
return (List<NodeValue> )nodeObj;
|
||||
}else {
|
||||
List<NodeValue> result = new ArrayList<>();
|
||||
if(nodeObj!=null)
|
||||
result.add((NodeValue)nodeObj);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Object getNodeData(Map<String,Object> nodeMap,String nodePath,int category) {
|
||||
return getNodeData(nodeMap, nodePath, true,category);
|
||||
}
|
||||
|
||||
public static Object getNodeData(Map<String,Object> nodeMap,String nodePath,boolean noCase,int category) {
|
||||
NodeValue nodeValue=getNodeValue(nodeMap, nodePath, noCase);
|
||||
|
||||
if(nodeValue!=null) {
|
||||
//1 : text
|
||||
//2 : ns
|
||||
//3 : nodename
|
||||
//4 : nodeFullname
|
||||
//5 : ndoeAttr
|
||||
//6 : nodeChild
|
||||
switch (category) {
|
||||
case 2:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getNodeNs();
|
||||
case 3:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getNodeName();
|
||||
case 4:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getNodeFullName();
|
||||
case 5:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getAttrMap();
|
||||
case 6:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getChildMap();
|
||||
default:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getText();
|
||||
// break;
|
||||
}
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getNodeTextContents(Map<String,Object> nodeMap,String nodePath) {
|
||||
return getNodeTextContents(nodeMap, nodePath, true);
|
||||
}
|
||||
|
||||
public static String getNodeTextContents(Map<String,Object> nodeMap,String nodePath,boolean noCase) {
|
||||
NodeValue nodeValue=getNodeValue(nodeMap, nodePath, noCase);
|
||||
|
||||
if(nodeValue!=null) {
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getText();
|
||||
}else {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getNodeNamespaceNm(Map<String,Object> nodeMap,String nodePath) {
|
||||
return getNodeNamespaceNm(nodeMap, nodePath, true);
|
||||
}
|
||||
|
||||
public static String getNodeNamespaceNm(Map<String,Object> nodeMap,String nodePath,boolean noCase) {
|
||||
NodeValue nodeValue=getNodeValue(nodeMap, nodePath, noCase);
|
||||
|
||||
if(nodeValue!=null) {
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getNodeNs();
|
||||
}else {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// System.out.println("node : "+getFirstNode("/asdfzxxcvzxc/saedf/asdf"));
|
||||
// }
|
||||
|
||||
|
||||
/*public static void main(String[] args) {
|
||||
String fileDir="D:\\TEMP\\20200714\\EXCH_ROOT\\CATALOG.XML";
|
||||
|
||||
|
||||
Map<String,Object> map=parseXml(fileDir);
|
||||
|
||||
// System.out.println("content : "+getNodeTextContents(map, "S-111_exchangeCatalogue/identiFier/daTe", true));
|
||||
// System.out.println("end");
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
private static NodeValue putNodeData(Map<String,Object> map, Node node) {
|
||||
NodeValue nodeValue = new NodeValue(node.getNodeName(),node.getTextContent());
|
||||
|
||||
|
||||
if (node.hasAttributes()) {
|
||||
NamedNodeMap namedNodeMap = node.getAttributes();
|
||||
for (int j = 0; j < namedNodeMap.getLength(); j++) {
|
||||
// System.out.println("NodeNm : "+node.getNodeName()+", Name :
|
||||
// "+namedNodeMap.item(i).getNodeName()+", Value :
|
||||
// "+namedNodeMap.item(i).getNodeValue());
|
||||
nodeValue.putAttr(namedNodeMap.item(j).getNodeName(), namedNodeMap.item(j).getNodeValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(map.containsKey(nodeValue.getNodeName())) {
|
||||
Object data = map.get(nodeValue.getNodeName());
|
||||
if(data instanceof List<?>) {
|
||||
((List<NodeValue>) data).add(nodeValue);
|
||||
}else {
|
||||
List<NodeValue> valueList = new ArrayList<>();
|
||||
//기존데이터 리스트에 입력
|
||||
valueList.add((NodeValue) data);
|
||||
//현재 데이터 입력
|
||||
valueList.add(nodeValue);
|
||||
|
||||
// map.put(node.getNodeName(), valueList);
|
||||
map.put(nodeValue.getNodeName(), valueList);
|
||||
}
|
||||
}else {
|
||||
// map.put(node.getNodeName(), nodeValue);
|
||||
map.put(nodeValue.getNodeName(), nodeValue);
|
||||
}
|
||||
|
||||
|
||||
return nodeValue;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static Map<String, Object> nodeListToMap(NodeList nodeList) {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
for (int i = 0; i < nodeList.getLength(); i++) {
|
||||
Node node = nodeList.item(i);
|
||||
//#text로 잘못 생성되는 node 제거를 위함
|
||||
if("#text".equals(node.getNodeName())||"#comment".equals(node.getNodeName()))
|
||||
continue;
|
||||
|
||||
NodeValue nodeValue= putNodeData(map, node);
|
||||
|
||||
if(node.hasChildNodes()) {
|
||||
|
||||
nodeValue.setChildMap(nodeListToMap(node.getChildNodes()));
|
||||
}
|
||||
// if (x.hasChildNodes() == true) {
|
||||
// int y = 1;
|
||||
// String key = x.getNodeName();
|
||||
// String tempkey = "";
|
||||
// if (map.containsKey(key)) {
|
||||
// do {
|
||||
// y++;
|
||||
// tempkey = key + "_" + y;
|
||||
// } while (map.containsKey(tempkey) == true);
|
||||
// map.put(tempkey, x.getTextContent().trim());
|
||||
// tempkey = "";
|
||||
// } else {
|
||||
// map.put(key, x.getTextContent().trim());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Map<String,String> getAllNsOrXsiMap(Map<String,Object> nodeMap,boolean isNsMap){
|
||||
Map<String,String> nsMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
|
||||
ArrayList<String> list = MapUtil.toKeyArray(nodeMap);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(nodeMap.get(list.get(i)).getClass()!=NodeValue.class) {
|
||||
continue;
|
||||
}
|
||||
NodeValue nodeValue = (NodeValue) nodeMap.get(list.get(i));
|
||||
|
||||
if(isNsMap)
|
||||
nsMap.putAll(nodeValue.getNsMap());
|
||||
else
|
||||
nsMap.putAll(nodeValue.getXsiMap());
|
||||
|
||||
if (nodeValue.getChildMap() != null) {
|
||||
nsMap.putAll(getAllNsOrXsiMap(nodeValue.getChildMap(),isNsMap));
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return nsMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
package kr.gmtc.tss.util.vo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class NodeValue{
|
||||
|
||||
public NodeValue() {
|
||||
|
||||
}
|
||||
public NodeValue(String nodeFullName,String text) {
|
||||
|
||||
this.text=text;
|
||||
this.nodeFullName=nodeFullName;
|
||||
if(!nodeFullName.isEmpty()&&nodeFullName.contains(":")) {
|
||||
String[] nodeNmArr=nodeFullName.split(":");
|
||||
if(nodeNmArr.length>1) {
|
||||
this.nodeName=nodeNmArr[1];
|
||||
this.nodeNs=nodeNmArr[0];
|
||||
}
|
||||
}else {
|
||||
this.nodeName=nodeFullName;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
String nodeFullName;
|
||||
String nodeName;
|
||||
String nodeNs="";
|
||||
String text;
|
||||
Map<String,String> attrMap = new HashMap<>();
|
||||
Map<String,Object> childMap = new HashMap<>();
|
||||
|
||||
Map<String, String> nsMap = new HashMap<>();
|
||||
Map<String, String> xsiMap = new HashMap<>();
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
public Map<String, String> getAttrMap() {
|
||||
return attrMap;
|
||||
}
|
||||
|
||||
public String getAttrMapValue(String key) {
|
||||
return attrMap.get(key);
|
||||
}
|
||||
|
||||
|
||||
public void setAttrMap(Map<String, String> attrMap) {
|
||||
this.attrMap = attrMap;
|
||||
}
|
||||
|
||||
public void putAttr(String key,String data) {
|
||||
|
||||
if(key.contains("xmlns:")) {
|
||||
String [] keyVal = key.split(":");
|
||||
try {
|
||||
nsMap.put(keyVal[1], data);
|
||||
} catch (NullPointerException e) {
|
||||
nsMap.put(key, data);
|
||||
}
|
||||
|
||||
}else if(key.contains("xsi:")) {
|
||||
String [] keyVal = key.split(":");
|
||||
try {
|
||||
xsiMap.put(keyVal[1], data);
|
||||
} catch (NullPointerException e) {
|
||||
xsiMap.put(key, data);
|
||||
}
|
||||
}else {
|
||||
attrMap.put(key, data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Map<String, Object> getChildMap() {
|
||||
return childMap;
|
||||
}
|
||||
public void setChildMap(Map<String, Object> childMap) {
|
||||
this.childMap = childMap;
|
||||
}
|
||||
|
||||
public void putChildMap(String key,Object data) {
|
||||
childMap.put(key, data);
|
||||
}
|
||||
|
||||
|
||||
public String getNsMapValue(String key) {
|
||||
return nsMap.get(key);
|
||||
}
|
||||
public Map<String, String> getNsMap() {
|
||||
return nsMap;
|
||||
}
|
||||
public void setNsMap(Map<String, String> nsMap) {
|
||||
this.nsMap = nsMap;
|
||||
}
|
||||
|
||||
|
||||
public String getXsiMapValue(String key) {
|
||||
return xsiMap.get(key);
|
||||
}
|
||||
public Map<String, String> getXsiMap() {
|
||||
return xsiMap;
|
||||
}
|
||||
public void setXsiMap(Map<String, String> xsiMap) {
|
||||
this.xsiMap = xsiMap;
|
||||
}
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
public String getNodeNs() {
|
||||
return nodeNs;
|
||||
}
|
||||
public void setNodeNs(String nodeNs) {
|
||||
this.nodeNs = nodeNs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getNodeFullName() {
|
||||
return nodeFullName;
|
||||
}
|
||||
public void setNodeFullName(String nodeFullName) {
|
||||
this.nodeFullName = nodeFullName;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NodeValue [nodeName=" + nodeName + ", nodeNs=" + nodeNs + ", text=" + text + ", attrMap=" + attrMap
|
||||
+ ", childMap=" + childMap + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
server:
|
||||
port: 8090
|
||||
|
||||
spring:
|
||||
#main:
|
||||
#web-application-type: none
|
||||
db:
|
||||
#db-type:oracle,mariadb(other - coding more!)
|
||||
#db-type: oracle
|
||||
batch-insert-size: 1000
|
||||
datasource:
|
||||
# driver-class-name: oracle.jdbc.driver.OracleDriver
|
||||
# jdbc-url: jdbc:oracle:thin:@192.168.4.106:1521:GMTDB
|
||||
driver-class-name: com.tmax.tibero.jdbc.TbDriver
|
||||
jdbc-url: jdbc:tibero:thin:@118.220.143.174:18629:SACP_T_DB
|
||||
username: UIC
|
||||
password: UIC
|
||||
connectionTimeout: 5000
|
||||
maxLifetime: 30000
|
||||
|
||||
|
||||
client:
|
||||
server:
|
||||
ip: 127.0.0.1
|
||||
port: 8030
|
||||
reconn-time-sec: 5
|
||||
queue-count: 1000000
|
||||
|
||||
selep-time-ms:
|
||||
parse-target: 50
|
||||
target-manage: 1
|
||||
data-insert: 50
|
||||
sql-logger: 50
|
||||
|
||||
|
||||
dynamic-dedupl:
|
||||
set-size: 50000
|
||||
set-remove-unit-size: 5000
|
||||
|
||||
|
||||
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 * * * *
|
||||
# 스레드 상태 체크 스케줄러
|
||||
status-check-cron: 0/10 * * * * *
|
||||
|
||||
|
||||
flag:
|
||||
database: false
|
||||
datafile: true #logstash data log file
|
||||
file: false #rest api log file
|
||||
|
||||
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
|
||||
|
||||
|
||||
kafka:
|
||||
bootstrapServers: http://118.220.143.175:9091,http://118.220.143.176:9091,http://118.220.143.176:9092
|
||||
topic:
|
||||
alarm: ic.analyze.situation
|
||||
status: ic.analyze.stand.status
|
||||
|
||||
classification: 1 #이중화되어 있는 서버의 Index
|
||||
swclassification: 7 #sw구분
|
||||
logclassification: 1 #log구분
|
||||
|
||||
state:
|
||||
# 공통코드 CT001의 코드 6자리
|
||||
id: IC0301 # AI상황인지분석
|
||||
# 1:Primary, 2:Secondary
|
||||
type: Primary
|
|
@ -1,5 +0,0 @@
|
|||
______ ____ ____
|
||||
/_ __/ / __/ / __/
|
||||
/ / _\ \ _\ \
|
||||
/_/ /___/ /___/
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
|
||||
|
||||
log4jdbc.dump.sql.maxlinelength=0
|
|
@ -1,84 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?> <!-- 60초마다 설정 파일의 변경을 확인 하여 변경시 갱신 -->
|
||||
<configuration scan="true" scanPeriod="60 seconds"> <!--springProfile 태그를 사용하면 logback 설정파일에서 복수개의 프로파일을 설정할 수 있다. -->
|
||||
<springProperty scope="context" name="LOG_LEVEL" source="logging.level.root" /> <!-- log file path -->
|
||||
<property name="LOG_PATH" value="./logs" /> <!-- log file name -->
|
||||
<property name="LOG_FILE_NAME" value="tss_pg" /> <!-- err log file name -->
|
||||
<property name="LOG_PATTERN" value="%-5level %d{yy-MM-dd HH:mm:ss}[%thread][%logger{0}:%line]-%msg%n" /> <!-- Console Appender -->
|
||||
<property name="SQL_LOG_PATH" value="./logs/sql" />
|
||||
<property name="SQL_LOG_FILE_NAME" value="sql" />
|
||||
|
||||
<property name="FILE_LOG_PATH" value="./logs/file" />
|
||||
<property name="FILE_LOG_FILE_NAME" value="file" />
|
||||
|
||||
<!--콘솔에 로그를 남깁니다. -->
|
||||
<appender name="Console"
|
||||
class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder
|
||||
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${LOG_PATTERN}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--파일에 로그를 남깁니다. -->
|
||||
<appender name="File"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/${LOG_FILE_NAME}.log</file>
|
||||
<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">
|
||||
<fileNamePattern>${LOG_PATH}/${LOG_FILE_NAME}.%d{yyyy-MM-dd}.log
|
||||
</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
|
||||
<!--파일에 로그를 남깁니다. -->
|
||||
<appender name="SQL"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- <file>${SQL_LOG_PATH}/${SQL_LOG_FILE_NAME}.log</file> -->
|
||||
<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">
|
||||
<fileNamePattern>${SQL_LOG_PATH}/${SQL_LOG_FILE_NAME}.%d{yyyy-MM-dd}.log
|
||||
</fileNamePattern>
|
||||
<!-- <maxHistory>30</maxHistory> -->
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<logger name="jdbc" level="OFF"/>
|
||||
<logger name="jdbc.sqlonly" level="ERROR"/>
|
||||
<logger name="jdbc.sqltiming" level="ERROR"/>
|
||||
<logger name="jdbc.audit" level="OFF"/>
|
||||
<logger name="jdbc.resultset" level="OFF"/>
|
||||
<logger name="jdbc.resultsettable" level="ERROR"/>
|
||||
<logger name="jdbc.connection" level="OFF"/>
|
||||
<logger name="System.out" level="OFF"/>
|
||||
|
||||
|
||||
<logger name="kr.gmtc.tss" level="INFO" additivity="false">
|
||||
<appender-ref ref="Console" />
|
||||
<appender-ref ref="File" />
|
||||
</logger>
|
||||
|
||||
<logger name="kr.gmtc.tss.sqllog" level="INFO" additivity="false">
|
||||
<appender-ref ref="SQL" />
|
||||
</logger>
|
||||
|
||||
<!-- DEBUG 레벨 로그를 Console, File, RollingFile에 남깁니다. ERROR 인 경우 wds-error.log에 남깁니다. -->
|
||||
<!-- <root level="${LOG_LEVEL}"> -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="Console" />
|
||||
<appender-ref ref="File" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<settings>
|
||||
<setting name="cacheEnabled" value="false"/>
|
||||
<setting name="lazyLoadingEnabled" value="true"/>
|
||||
<setting name="multipleResultSetsEnabled" value="true"/>
|
||||
<setting name="useColumnLabel" value="true"/>
|
||||
<setting name="defaultStatementTimeout" value="25000"/>
|
||||
<setting name="defaultExecutorType" value="BATCH"/>
|
||||
</settings>
|
||||
<!-- <mappers> -->
|
||||
<!-- <mapper resource="kr/gmtc/eyesvtss/mapper/batchMapper.xml"/> -->
|
||||
<!-- </mappers> -->
|
||||
</configuration>
|
|
@ -1,35 +0,0 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
/bin
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/logs/
|
Binary file not shown.
|
@ -1,2 +0,0 @@
|
|||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
|
|
@ -1,2 +0,0 @@
|
|||
# TSS
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,316 +0,0 @@
|
|||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven Start Up Batch script
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# M2_HOME - location of maven2's installed home dir
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "`uname`" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||
else
|
||||
export JAVA_HOME="/Library/Java/Home"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=`java-config --jre-home`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$M2_HOME" ] ; then
|
||||
## resolve links - $0 may be a link to maven's home
|
||||
PRG="$0"
|
||||
|
||||
# need this for relative symlinks
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG="`dirname "$PRG"`/$link"
|
||||
fi
|
||||
done
|
||||
|
||||
saveddir=`pwd`
|
||||
|
||||
M2_HOME=`dirname "$PRG"`/..
|
||||
|
||||
# make it fully qualified
|
||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||
|
||||
cd "$saveddir"
|
||||
# echo Using m2 at $M2_HOME
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="`which javac`"
|
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=`which readlink`
|
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||
else
|
||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||
fi
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="`\\unset -f command; \\command -v java`"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=`cd "$wdir/.."; pwd`
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
echo "${basedir}"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
echo "$(tr -s '\n' ' ' < "$1")"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
||||
fi
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||
fi
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
else
|
||||
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
fi
|
||||
while IFS="=" read key value; do
|
||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||
esac
|
||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Downloading from: $jarUrl"
|
||||
fi
|
||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if $cygwin; then
|
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found wget ... using wget"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found curl ... using curl"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||
else
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||
fi
|
||||
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Falling back to using Java to download"
|
||||
fi
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaClass=`cygpath --path --windows "$javaClass"`
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
# Compiling the Java class
|
||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||
fi
|
||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
# Running the downloader
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Running MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo $MAVEN_PROJECTBASEDIR
|
||||
fi
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.home=${M2_HOME}" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
|
@ -1,188 +0,0 @@
|
|||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Maven Start Up Batch script
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM M2_HOME - location of maven2's installed home dir
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %DOWNLOAD_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
151
cctv_new/pom.xml
151
cctv_new/pom.xml
|
@ -1,151 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.8</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>kr.gmtc</groupId>
|
||||
<artifactId>tss</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>ana</name>
|
||||
<description>ANA TSS</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<!-- versions -->
|
||||
<gmtc.version>0.0.1-SNAPSHOT</gmtc.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.3.7</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
||||
<version>1.16</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.17.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<version>2.17.2</version>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
|
||||
<!-- <dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>4.1.85.Final</version>
|
||||
</dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.projectreactor</groupId>
|
||||
<artifactId>reactor-spring</artifactId>
|
||||
<version>1.0.1.RELEASE</version>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>kr.gmtc</groupId>
|
||||
<artifactId>EyeGW-Core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency> -->
|
||||
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>2.14.0</version>
|
||||
</dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>kr.gmt.so</groupId>
|
||||
<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>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ipworks.local</groupId>
|
||||
<artifactId>ipworks-local-1.0.0</artifactId>
|
||||
<scope>system</scope>
|
||||
<version>1.0.0</version>
|
||||
<systemPath>${basedir}/lib/ipworks-local-1.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tmax.tibero</groupId>
|
||||
<artifactId>tibero-jdbc</artifactId>
|
||||
<version>6.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/tibero6-jdbc.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>EyeTSS_ANA</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -1,2 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package kr.gmtc.tss;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
package kr.gmtc.tss.data;
|
||||
|
||||
import java.util.Queue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import kr.gmtc.tss.data.vo.CctvTrackVO;
|
||||
import kr.gmtc.tss.db.BatchInsertManager;
|
||||
|
||||
public class DataInsertRunnable implements Runnable {
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<CctvTrackVO> trackQueue;
|
||||
Queue<CctvTrackVO> trackLastQueue;
|
||||
private boolean isRunning = false;
|
||||
private int batchInsertSize = 1000;
|
||||
|
||||
BatchInsertManager batchInsertManager;
|
||||
private long sleepMillis;
|
||||
private String topic;
|
||||
|
||||
public DataInsertRunnable(Queue<CctvTrackVO> trackQueue, Queue<CctvTrackVO> trackLastQueue, int batchInsertSize, BatchInsertManager batchInsertManager, long sleepMillis, String topic) {
|
||||
this.trackQueue=trackQueue;
|
||||
this.trackLastQueue=trackLastQueue;
|
||||
this.batchInsertSize=batchInsertSize;
|
||||
this.batchInsertManager=batchInsertManager;
|
||||
this.sleepMillis=sleepMillis;
|
||||
this.topic=topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
CctvTrackVO [] chunkTrackArr = getChunkTrackArr(trackQueue);
|
||||
// TrackVO [] chunkTrackLastArr = getChunkTrackArr(trackLastQueue);
|
||||
if(isRunning) {
|
||||
if(chunkTrackArr.length > 0) {
|
||||
// batchInsertManager.insertCctvLastData(chunkTrackArr,topic);
|
||||
}
|
||||
|
||||
/*
|
||||
* if(chunkTrackLastArr.length > 0) {
|
||||
* batchInsertManager.insertTrackLastData(chunkTrackLastArr); }
|
||||
*/
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("[DataInsertRunnable] Data Insert error : " ,e);
|
||||
}
|
||||
|
||||
sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private CctvTrackVO [] getChunkTrackArr(Queue<CctvTrackVO> sqlQueue) {
|
||||
int loopCnt=0;
|
||||
if(sqlQueue.size()>batchInsertSize) {
|
||||
loopCnt=batchInsertSize;
|
||||
}else {
|
||||
loopCnt=sqlQueue.size();
|
||||
}
|
||||
|
||||
CctvTrackVO [] chunkArr = new CctvTrackVO[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i]=sqlQueue.poll();
|
||||
}
|
||||
return chunkArr;
|
||||
}
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[TargetManager] sleep error : " +e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -1,255 +0,0 @@
|
|||
package kr.gmtc.tss.data;
|
||||
|
||||
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.apache.ibatis.javassist.compiler.ast.Keyword;
|
||||
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.data.vo.CctvTrackVO;
|
||||
|
||||
import kr.gmtc.tss.status.CountStatus;
|
||||
|
||||
public class ParseTargetRunnable implements Runnable {
|
||||
|
||||
private boolean flagFile;
|
||||
private boolean flagDataBase;
|
||||
private boolean flagDataFile;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<CctvTrackVO> trackQueue;
|
||||
Queue<CctvTrackVO> trackLastQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
Queue<CctvTrackVO> messageBodyQueue;
|
||||
|
||||
private int rcvPos = 0;
|
||||
private int rcvStatic = 0;
|
||||
|
||||
private boolean isRunning = false;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
private String classification;
|
||||
private String swclassification;
|
||||
private String logclassification;
|
||||
|
||||
public ParseTargetRunnable(Queue<String> rcvQueue, Queue<CctvTrackVO> trackQueue, Queue<CctvTrackVO> trackLastQueue
|
||||
, Queue<String> dataFileQueue,Queue<CctvTrackVO> messageBodyQueue, int listChunkSize
|
||||
, long sleepMillis, boolean flagFile, boolean flagDataBase, boolean flagDataFile
|
||||
, 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;
|
||||
}
|
||||
|
||||
@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>>() {});
|
||||
// ArrayList<LinkedHashMap<String, Object>> list = (ArrayList<LinkedHashMap<String, Object>>) convert.get("data");
|
||||
LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) convert.get("data");;
|
||||
|
||||
// logger.info("수신 데이터 변환 건수 {}", 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;
|
||||
int z = 0;
|
||||
// for (LinkedHashMap<String, Object> map : list) {
|
||||
CctvTrackVO t = mapper.convertValue(map, CctvTrackVO.class);
|
||||
|
||||
if(flagDataFile) {
|
||||
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()); sb.append(",");
|
||||
// sb.append(t.getBbTlp()); sb.append(",");
|
||||
// sb.append(t.getBbBrp()); sb.append(",");
|
||||
// sb.append(t.getCrdFrm()); sb.append(",");
|
||||
// sb.append(t.getCrdGlbl()); 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++;
|
||||
|
||||
// logger.info("logstash 포맷 변환 건수 {}", z++);
|
||||
}
|
||||
|
||||
histroyQueue.add(t);
|
||||
i++;
|
||||
// }
|
||||
|
||||
|
||||
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(TrackVO::getTargetId,
|
||||
// Collectors.maxBy(Comparator.comparing(TrackVO::getReceptionDate))
|
||||
// )).forEach((key, value) -> {
|
||||
// trackLastQueue.add(value.get());
|
||||
// });;
|
||||
// }
|
||||
}
|
||||
|
||||
} 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);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[ParseTargetRunnable] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -1,186 +0,0 @@
|
|||
package kr.gmtc.tss.data;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import kr.gmtc.tss.data.vo.SetDynamicVO;
|
||||
import kr.gmtc.tss.util.vo.DynamicVO;
|
||||
|
||||
public class TargetManageRunnable implements Runnable {
|
||||
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
Queue<DynamicVO> dynamicVoQueue;
|
||||
Queue<SetDynamicVO> dynamicInsertQueue;
|
||||
private int listChunkSize=100;
|
||||
private boolean isRunning = false;
|
||||
|
||||
private int exceptCnt=0;
|
||||
|
||||
private int dynamicSetSize;
|
||||
private int dynamicRemoveUnitSize;
|
||||
|
||||
private long sleepMillis;
|
||||
|
||||
|
||||
private Comparator<SetDynamicVO> comparator = Comparator.comparingLong(v -> v.timeStamp);
|
||||
// private Comparator<SetDynamicVO> comparator = Comparator.comparingLong(v -> ((LocalDateTime)v.getDateTime()).toInstant(ZoneOffset.ofHours(9)).toEpochMilli());
|
||||
// private Comparator<SetDynamicVO> comparator = Comparator.comparing( ,(a,b) -> a.getdattime())
|
||||
// Set<SetDynamicVO> dynamicSet = ConcurrentSkipListMap.n.newKeySet(10000);
|
||||
// ConcurrentSkipListSet<SetDynamicVO> dynamicSet = new ConcurrentSkipListSet<SetDynamicVO>();
|
||||
// ConcurrentSkipListSet<SetVo> dynamicSet = new ConcurrentSkipListSet<SetVo>();
|
||||
ConcurrentSkipListSet<String> dynamicSet = new ConcurrentSkipListSet<String>();
|
||||
//
|
||||
|
||||
|
||||
public TargetManageRunnable(Queue<DynamicVO> dynamicVoQueue, Queue<SetDynamicVO> dynamicInsertQueue, int dynamicSetSize, int dynamicRemoveUnitSize, int listChunkSize, long sleepMillis) {
|
||||
this.dynamicVoQueue=dynamicVoQueue;
|
||||
this.dynamicInsertQueue=dynamicInsertQueue;
|
||||
this.dynamicSetSize=dynamicSetSize;
|
||||
this.dynamicRemoveUnitSize=dynamicRemoveUnitSize;
|
||||
this.listChunkSize=listChunkSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// ConcurrentSkipListSet<SetDynamicVO> dynamicSet = new ConcurrentSkipListSet<SetDynamicVO>(comparator);
|
||||
//
|
||||
System.out.println("runn");
|
||||
isRunning=true;
|
||||
|
||||
while (isRunning) {
|
||||
|
||||
try {
|
||||
int loopCnt=0;
|
||||
if(dynamicVoQueue.size()>listChunkSize) {
|
||||
loopCnt=listChunkSize;
|
||||
}else {
|
||||
loopCnt=dynamicVoQueue.size();
|
||||
}
|
||||
|
||||
DynamicVO [] chunkArr = new DynamicVO[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i]=dynamicVoQueue.poll();
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
// parseAndEnqueue(chunkArr[i]);
|
||||
// chunkArr[i].getDynamicVO()
|
||||
putQueueData(chunkArr[i]);
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// if (e.getMessage() != null) {
|
||||
logger.info("[TargetManager] Parsing Error Message : " ,e);
|
||||
// } else {
|
||||
//// logger.info("[ParserThread] Parsing Error Packet Message :" + packetMsg);
|
||||
// logger.info("[ParserThread] Parsing Error Call Stack" ,e);
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
sleep(sleepMillis);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void putQueueData(DynamicVO dynamicVO) {
|
||||
|
||||
removeOverCountQueue();
|
||||
|
||||
SetDynamicVO vo = new SetDynamicVO(dynamicVO);
|
||||
String key=vo.getDateTime().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))+vo.getShipID();//+vo.getLongitude()+vo.getLatitude();
|
||||
// SetVo setVo = new SetVo(key);
|
||||
|
||||
//Set에 안 담겨 있는경우에는 insert 큐에 입력(중복 방지)
|
||||
if(!dynamicSet.contains(key)) {
|
||||
dynamicSet.add(key);
|
||||
|
||||
// vo.setMarineAreaId(marineAreaLoader.getMarineAreaId(vo.getLongitude(), vo.getLatitude()));
|
||||
|
||||
// if(!vo.isInserted()) {
|
||||
dynamicInsertQueue.add(vo);
|
||||
|
||||
|
||||
// vo.setInserted(true);
|
||||
// }else {
|
||||
// logger.info(vo.getString());
|
||||
// }
|
||||
|
||||
}else {
|
||||
logger.debug("except msg : "+vo.getString());
|
||||
exceptCnt++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Set 개수가 10000개가 넘어가면 과거데이터를 500개씩 제거한다.
|
||||
private void removeOverCountQueue() {
|
||||
if(dynamicSet.size()>dynamicSetSize) {
|
||||
// logger.info("removeOverCountQueue!!!!("+dynamicSet.size()+")");
|
||||
int i=0;
|
||||
for( Iterator<String> itr =dynamicSet.iterator(); itr.hasNext()&&i<dynamicRemoveUnitSize; )
|
||||
{
|
||||
dynamicSet.remove(itr.next());
|
||||
i++;
|
||||
}
|
||||
// logger.info("removeOverCountQueue2!!!!("+dynamicSet.size()+")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public synchronized int getCountAndSetZero() {
|
||||
int cnt=exceptCnt;
|
||||
exceptCnt = 0;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[TargetManageRunnable] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
|
||||
|
||||
// public void setMarineAreaLoader(MarineAreaLoader marineAreaLoader) {
|
||||
// this.marineAreaLoader = marineAreaLoader;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// class SetVo implements Comparable<SetVo>{
|
||||
// public SetVo(String key) {
|
||||
// this.key=key;
|
||||
// }
|
||||
// String key;
|
||||
// long timeStamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(9)).toEpochMilli();
|
||||
// @Override
|
||||
// public int compareTo(SetVo o) {
|
||||
// return Integer.parseInt((this.timeStamp-o.timeStamp)+"");
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
|
@ -1,339 +0,0 @@
|
|||
package kr.gmtc.tss.data.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.javassist.compiler.ast.Keyword;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
@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 + "]";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public LocalDateTime getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setDateTime(LocalDateTime dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getDtctTm() {
|
||||
return dtctTm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setDtctTm(String dtctTm) {
|
||||
this.dtctTm = dtctTm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getDtctCls() {
|
||||
return dtctCls;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setDtctCls(String dtctCls) {
|
||||
this.dtctCls = dtctCls;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getMtaTm() {
|
||||
return mtaTm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setMtaTm(String mtaTm) {
|
||||
this.mtaTm = mtaTm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getRwTm() {
|
||||
return rwTm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setRwTm(String rwTm) {
|
||||
this.rwTm = rwTm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<String> getCcId() {
|
||||
return ccId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setCcId(List<String> ccId) {
|
||||
this.ccId = ccId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getZnId() {
|
||||
return znId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setZnId(String znId) {
|
||||
this.znId = znId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getArcrftTp() {
|
||||
return arcrftTp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setArcrftTp(String arcrftTp) {
|
||||
this.arcrftTp = arcrftTp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getArln() {
|
||||
return arln;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setArln(String arln) {
|
||||
this.arln = arln;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getTrckId() {
|
||||
return trckId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setTrckId(String trckId) {
|
||||
this.trckId = trckId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<String> getBbTlp() {
|
||||
return bbTlp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setBbTlp(List<String> bbTlp) {
|
||||
this.bbTlp = bbTlp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<String> getBbBrp() {
|
||||
return bbBrp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setBbBrp(List<String> bbBrp) {
|
||||
this.bbBrp = bbBrp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<String> getCrdFrm() {
|
||||
return crdFrm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setCrdFrm(List<String> crdFrm) {
|
||||
this.crdFrm = crdFrm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<String> getCrdGlbl() {
|
||||
return crdGlbl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setCrdGlbl(List<String> crdGlbl) {
|
||||
this.crdGlbl = crdGlbl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getDrctn() {
|
||||
return drctn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setDrctn(String drctn) {
|
||||
this.drctn = drctn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getArcrftStnd() {
|
||||
return arcrftStnd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setArcrftStnd(String arcrftStnd) {
|
||||
this.arcrftStnd = arcrftStnd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getSpd() {
|
||||
return spd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setSpd(String spd) {
|
||||
this.spd = spd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
package kr.gmtc.tss.data.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import kr.gmtc.tss.util.vo.DynamicVO;
|
||||
|
||||
public class SetDynamicVO extends DynamicVO implements Comparable<SetDynamicVO> {
|
||||
|
||||
private boolean inserted=false;
|
||||
private String marineAreaId="";
|
||||
|
||||
public long timeStamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(9)).toEpochMilli();
|
||||
|
||||
public SetDynamicVO() {
|
||||
}
|
||||
|
||||
public SetDynamicVO(DynamicVO vo) {
|
||||
|
||||
this.targetSensor = vo.getTargetSensor();
|
||||
this.packetID = vo.getPacketID();
|
||||
this.shipID = vo.getShipID();
|
||||
this.dateTime = vo.getDateTime();
|
||||
this.areaID = vo.getAreaID();
|
||||
this.msgType = vo.getMsgType();
|
||||
this.dataLength = vo.getDataLength();
|
||||
|
||||
setMode(vo.getMode());
|
||||
setRot(vo.getRot());
|
||||
setSog(vo.getSog());
|
||||
setPosacc(vo.getPosacc());
|
||||
|
||||
setLonInt(vo.getLonInt());
|
||||
setLatInt(vo.getLatInt());
|
||||
setLongitude(vo.getLongitude());
|
||||
setLatitude(vo.getLatitude());
|
||||
setCog(vo.getCog());
|
||||
setHeading(vo.getHeading());
|
||||
setEndflag(vo.getEndflag());
|
||||
setCommState(vo.getCommState());
|
||||
setSyncState(vo.getSyncState());
|
||||
setSlotTimeOut(vo.getSlotTimeOut());
|
||||
setSubMessage(vo.getSubMessage());
|
||||
setSlotInc(vo.getSlotInc());
|
||||
setNumberOfSlot(vo.getNumberOfSlot());
|
||||
setSlotOffSet(vo.getSlotOffSet());
|
||||
setKeepFlag(vo.getKeepFlag());
|
||||
setNaviStatus(vo.getNaviStatus());
|
||||
setSpecialManoeuve(vo.getSpecialManoeuve());
|
||||
setClassBUnit(vo.getClassBUnit());
|
||||
setClassBDisplay(vo.getClassBDisplay());
|
||||
setClassBBand(vo.getClassBBand());
|
||||
setClassBMsg22(vo.getClassBMsg22());
|
||||
setClassBDSC(vo.getClassBDSC());
|
||||
setModeFlag(vo.getModeFlag());
|
||||
setRaim(vo.getRaim());
|
||||
setIsRepeat(vo.getIsRepeat());
|
||||
setbSUTC(vo.getbSUTC());
|
||||
setbSUTCStr(vo.getbSUTCStr());
|
||||
setTimeStamp(vo.getTimeStamp());
|
||||
setmSec(vo.getmSec());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public String getMarineAreaId() {
|
||||
return marineAreaId;
|
||||
}
|
||||
|
||||
public void setMarineAreaId(String marineAreaId) {
|
||||
this.marineAreaId = marineAreaId;
|
||||
}
|
||||
|
||||
public boolean isInserted() {
|
||||
return inserted;
|
||||
}
|
||||
|
||||
public void setInserted(boolean inserted) {
|
||||
this.inserted = inserted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (this.getShipID()+this.getDateTime().format(DateTimeFormatter.ofPattern("yyyyMMdd"))+this.getLongitude()+this.getLatitude()).hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
//p1.equals(p2)
|
||||
if(obj instanceof SetDynamicVO) {
|
||||
SetDynamicVO p = (SetDynamicVO)obj;
|
||||
return this.hashCode()==p.hashCode();
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SetDynamicVO o) {
|
||||
|
||||
return this.getTimeStamp()-o.getTimeStamp();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,574 +0,0 @@
|
|||
package kr.gmtc.tss.db;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import kr.gmtc.tss.data.vo.CctvTrackVO;
|
||||
import kr.gmtc.tss.main.MainServer;
|
||||
import kr.gmtc.tss.status.CountStatus;
|
||||
|
||||
public class BatchInsertManager {
|
||||
|
||||
/** Logger. */
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private SqlSessionFactory sqlSessionFactory;
|
||||
private SqlSession session;
|
||||
|
||||
private Queue<CctvTrackVO> sqlLogCctvTrackQueue;
|
||||
private Queue<CctvTrackVO> sqlLogCctvTrackLastQueue;
|
||||
|
||||
private int savePos=0;
|
||||
private int saveLast=0;
|
||||
private int saveStatic=0;
|
||||
private int failPos=0;
|
||||
private int failLast=0;
|
||||
private int failStatic=0;
|
||||
|
||||
/**
|
||||
* mybatis batch insert 속도가 느려서 jdbc 객체를 직접 제어함.
|
||||
* @param sqlSessionFactory
|
||||
* @param dbType
|
||||
*/
|
||||
public BatchInsertManager(SqlSessionFactory sqlSessionFactory, Queue<CctvTrackVO> sqlLogCctvTrackQueue,Queue<CctvTrackVO> sqlLogCctvTrackLastQueue) {
|
||||
this.sqlSessionFactory = sqlSessionFactory;
|
||||
this.sqlLogCctvTrackQueue = sqlLogCctvTrackQueue;
|
||||
this.sqlLogCctvTrackLastQueue = sqlLogCctvTrackLastQueue;
|
||||
// this.dbType=dbType;
|
||||
openSession(false);
|
||||
}
|
||||
|
||||
public void openSession(boolean forceOpen) {
|
||||
if(session==null||forceOpen)
|
||||
session = sqlSessionFactory.openSession();
|
||||
}
|
||||
|
||||
public void closeSession() {
|
||||
if(session!=null)
|
||||
session.close();
|
||||
}
|
||||
|
||||
public void insertCctvData(CctvTrackVO[] setCctvTrackVOArr) {
|
||||
insertCctvData(setCctvTrackVOArr,true);
|
||||
}
|
||||
|
||||
|
||||
private void insertCctvData(CctvTrackVO[] setCctvTrackVOArr, boolean isBatch) {
|
||||
int fail = 0;
|
||||
int save = 0;
|
||||
|
||||
if(setCctvTrackVOArr==null || setCctvTrackVOArr.length<1) {
|
||||
// logger.error("insertDataAll - No tableList data");
|
||||
logger.debug("insertData(Batch:"+isBatch+") - no data in setCctvTrackVOArr");
|
||||
return;
|
||||
}
|
||||
// Table destTable=tableList.get(0);
|
||||
|
||||
|
||||
// String sql = "INSERT INTO " + destTable.getName() + " (" + getInsertCols(destTable.getColumnList()) + ") "
|
||||
// + "VALUES (" + getInsertValueParams(destTable.getColumnList()) + ")";
|
||||
|
||||
// String tableName = "SACP_CCTV_TRACK_" + setCctvTrackVOArr[0].getRecptnDt().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
|
||||
// TODO 날짜 처리
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String now_dt = format.format(setCctvTrackVOArr[0].getDtctTm());
|
||||
|
||||
String tableName = "SACP_VIDEO_META_LC";
|
||||
String sql = "INSERT INTO "+tableName+" (" +
|
||||
" VIDEO_META_ID, DETCT_DT, DETCT_TY, CCTV_INFO, CCTV_CHRG_ZONE, AC_TY, ARLN_CD, TRACK_ID, BB_TOP_LEFT_X, BB_TOP_LEFT_Y, " +
|
||||
" BB_BOTTOM_RIGHT_X, BB_BOTTOM_RIGHT_Y, CRDNT_X, CRDNT_Y, CRDNT_LAT, CRDNT_LON, AC_STAND_ON_AT, OBJECT_SPD, REGISTER_ID) " +
|
||||
" VALUES (UCM.FUN_GET_WORK_NO( '"+now_dt+"', 'VIDEO'), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'SYSTEM')";
|
||||
|
||||
PreparedStatement ps=null;
|
||||
Connection con=null;
|
||||
try {
|
||||
|
||||
con=session.getConnection();
|
||||
if(con.isClosed() || !con.isValid(1)) {
|
||||
closeSession();
|
||||
openSession(true);
|
||||
con=session.getConnection();
|
||||
}
|
||||
con.setAutoCommit(false);
|
||||
|
||||
// Statement statement = session.getConnection().createStatement();
|
||||
ps = con.prepareStatement(sql);
|
||||
//logger.info("입력 건수"+setCctvTrackVOArr.length);
|
||||
for (int i = 0; i < setCctvTrackVOArr.length; i++) {
|
||||
CctvTrackVO vo = setCctvTrackVOArr[i];
|
||||
|
||||
// //입력으로 처리
|
||||
// //중복 입력 방지를 위함
|
||||
vo.setInserted(true);
|
||||
|
||||
try {
|
||||
// ps.setDate(1, vo.getDetctDt());
|
||||
// ps.setString(2, vo.getDetctTy());
|
||||
// ps.setString(3, vo.getCctvInfo());
|
||||
// ps.setString(4, vo.getCctvChrgZone());
|
||||
// ps.setString(5, vo.getAcTy());
|
||||
// ps.setString(6, vo.getArlnCd());
|
||||
// ps.setString(7, vo.getTrackId());
|
||||
// ps.setDouble(8, vo.getBbTopLeftX());
|
||||
// ps.setDouble(9, vo.getBbTopLeftY());
|
||||
// ps.setDouble(10, vo.getBbBottomRightX());
|
||||
// ps.setDouble(11, vo.getBbBottomRightY());
|
||||
// ps.setDouble(12, vo.getCrdntX());
|
||||
// ps.setDouble(13, vo.getCrdntY());
|
||||
// ps.setDouble(14, vo.getCrdntLat());
|
||||
// ps.setDouble(15, vo.getCrdntLon());
|
||||
// ps.setString(16, vo.getAcStandOnAt());
|
||||
// ps.setDouble(17, vo.getObjectSpd());
|
||||
|
||||
///건별 입력
|
||||
if(!isBatch) {
|
||||
ps.execute();
|
||||
savePos++;
|
||||
save++;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.debug("Data Insert error UseSqlLog");
|
||||
sqlLogCctvTrackQueue.add(vo);
|
||||
failPos++;
|
||||
fail++;
|
||||
}
|
||||
|
||||
//배치 입력
|
||||
if(isBatch) {
|
||||
ps.addBatch();
|
||||
}
|
||||
}
|
||||
if(isBatch) {
|
||||
ps.executeBatch();
|
||||
|
||||
//배치 insert는 arr 건수만큼
|
||||
savePos+=setCctvTrackVOArr.length;
|
||||
save = setCctvTrackVOArr.length - fail;
|
||||
logger.info("배치 저장 건수 {} : 실패 건수 {}", save, fail);
|
||||
// logger.info("savePos 건수"+savePos);
|
||||
} else {
|
||||
logger.info("단건 저장 건수 {} : 실패 건수 {}", save, fail);
|
||||
}
|
||||
|
||||
con.commit();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("insertData(Batch:"+isBatch+") error", e);
|
||||
if(isBatch) {
|
||||
logger.error("Try insert row by row");
|
||||
insertCctvData(setCctvTrackVOArr, false);
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
||||
if(ps!=null) {
|
||||
try {
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
logger.error("insertData(Batch:"+isBatch+") PreparedStatement close error",e);
|
||||
}
|
||||
}
|
||||
if(con!=null) {
|
||||
try {
|
||||
con.commit();
|
||||
con.setAutoCommit(true);
|
||||
} catch (SQLException e) {
|
||||
logger.error("insertData(Batch:"+isBatch+") commit error",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void insertCctvLastData(CctvTrackVO[] setCctvTrackVOArr) {
|
||||
insertCctvLastData(setCctvTrackVOArr,true);
|
||||
}
|
||||
|
||||
private void insertCctvLastData(CctvTrackVO[] setCctvTrackVOArr, boolean isBatch) {
|
||||
|
||||
if(setCctvTrackVOArr==null || setCctvTrackVOArr.length<1) {
|
||||
// logger.error("mergeDynamicLastAll - No tableList data");
|
||||
logger.debug("insertCctvLastData(Batch:"+isBatch+") - no data in setCctvTrackVOArr");
|
||||
return;
|
||||
}
|
||||
// Table destTable=tableList.get(0);
|
||||
|
||||
|
||||
// String sql = "INSERT INTO " + destTable.getName() + " (" + getInsertCols(destTable.getColumnList()) + ") "
|
||||
// + "VALUES (" + getInsertValueParams(destTable.getColumnList()) + ")";
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String now_dt = format.format(setCctvTrackVOArr[0].getDtctTm());
|
||||
|
||||
String tableName = "SACP_VIDEO_META_LC";
|
||||
// String sql = "MERGE INTO "+tableName+" A" +
|
||||
// " USING DUAL" +
|
||||
// " ON (A.TRGT_ID = ?)" +
|
||||
// " WHEN MATCHED THEN" +
|
||||
// " UPDATE" +
|
||||
// " SET A.TRGT_TY=?, A.TRK_ID=?, A.AC_TY_ICAO=?, A.ARLN_CD_ICAO=?, A.EQPMN_TY=?, A.RECPTN_DT=?, A.LAT=?, A.LON=?, A.SPD=?, A.COS=?, A.CCTV_ID=?, A.X_CNTS=?, A.Y_CNTS=?, A.UPDUSR_ID=?, A.UPDT_DT=TO_TIMESTAMP(SYSDATE,'yyyyMMdd')" +
|
||||
// " WHEN NOT MATCHED THEN " +
|
||||
// " INSERT " +
|
||||
// " (A.TRGT_ID , A.TRGT_TY, A.TRK_ID, A.AC_TY_ICAO, A.ARLN_CD_ICAO, A.EQPMN_TY, A.RECPTN_DT, A.LAT, A.LON, A.SPD, A.COS, A.CCTV_ID, A.X_CNTS, A.Y_CNTS, A.REGISTER_ID)" +
|
||||
// " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
String sql = "";
|
||||
|
||||
if(MainServer.LAST_DATA_CNT > 0) {
|
||||
sql = " UPDATE " + tableName
|
||||
+ " SET DETCT_DT = ?, DETCT_TY = ?, CCTV_INFO = ?, CCTV_CHRG_ZONE = ?, AC_TY = ?, ARLN_CD = ?,"
|
||||
+ " TRACK_ID = ?, BB_TOP_LEFT_X = ?, BB_TOP_LEFT_Y = ?, BB_BOTTOM_RIGHT_X = ?, BB_BOTTOM_RIGHT_Y = ?, CRDNT_X = ?, CRDNT_Y = ?,"
|
||||
+ " CRDNT_LAT = ?, CRDNT_LON = ?, AC_STAND_ON_AT = ?, OBJECT_SPD = ?, "
|
||||
+ " UPDUSR_ID ='SYSTEM', UPDT_DT=TO_TIMESTAMP(SYSDATE,'yyyyMMdd')"
|
||||
+ " WHERE VIDEO_META_ID = ?";
|
||||
}else {
|
||||
sql = " INSERT INTO " + tableName
|
||||
+ " ( VIDEO_META_ID, DETCT_DT, DETCT_TY, CCTV_INFO, CCTV_CHRG_ZONE, AC_TY, ARLN_CD, TRACK_ID, BB_TOP_LEFT_X, BB_TOP_LEFT_Y,"
|
||||
+ " BB_BOTTOM_RIGHT_X, BB_BOTTOM_RIGHT_Y, CRDNT_X, CRDNT_Y, CRDNT_LAT, CRDNT_LON, AC_STAND_ON_AT, OBJECT_SPD, REGISTER_ID)"
|
||||
+ " VALUES (UCM.FUN_GET_WORK_NO( '"+now_dt+"', 'VIDEO'), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'SYSTEM')";
|
||||
}
|
||||
|
||||
PreparedStatement ps=null;
|
||||
Connection con=null;
|
||||
try {
|
||||
|
||||
con=session.getConnection();
|
||||
if(con.isClosed() || !con.isValid(1)) {
|
||||
closeSession();
|
||||
openSession(true);
|
||||
con=session.getConnection();
|
||||
}
|
||||
con.setAutoCommit(false);
|
||||
|
||||
|
||||
// Statement statement = session.getConnection().createStatement();
|
||||
ps = con.prepareStatement(sql);
|
||||
|
||||
for (int i = 0; i < setCctvTrackVOArr.length; i++) {
|
||||
CctvTrackVO vo = setCctvTrackVOArr[i];
|
||||
//입력으로 처리
|
||||
//중복 입력 방지를 위함
|
||||
vo.setInserted(true);
|
||||
|
||||
try {
|
||||
|
||||
// if(MainServer.LAST_DATA_CNT > 0) {
|
||||
// ps.setDate(1, vo.getDetctDt());
|
||||
// ps.setString(2, vo.getDetctTy());
|
||||
// ps.setString(3, vo.getCctvInfo());
|
||||
// ps.setString(4, vo.getCctvChrgZone());
|
||||
// ps.setString(5, vo.getAcTy());
|
||||
// ps.setString(6, vo.getArlnCd());
|
||||
// ps.setString(7, vo.getTrackId());
|
||||
// ps.setDouble(8, vo.getBbTopLeftX());
|
||||
// ps.setDouble(9, vo.getBbTopLeftY());
|
||||
// ps.setDouble(10, vo.getBbBottomRightX());
|
||||
// ps.setDouble(11, vo.getBbBottomRightY());
|
||||
// ps.setDouble(12, vo.getCrdntX());
|
||||
// ps.setDouble(13, vo.getCrdntY());
|
||||
// ps.setDouble(14, vo.getCrdntLat());
|
||||
// ps.setDouble(15, vo.getCrdntLon());
|
||||
// ps.setString(16, vo.getAcStandOnAt());
|
||||
// ps.setDouble(17, vo.getObjectSpd());
|
||||
// ps.setString(18, vo.getVideoMetaId());
|
||||
// }else {
|
||||
// ps.setDate(1, vo.getDetctDt());
|
||||
// ps.setString(2, vo.getDetctTy());
|
||||
// ps.setString(3, vo.getCctvInfo());
|
||||
// ps.setString(4, vo.getCctvChrgZone());
|
||||
// ps.setString(5, vo.getAcTy());
|
||||
// ps.setString(6, vo.getArlnCd());
|
||||
// ps.setString(7, vo.getTrackId());
|
||||
// ps.setDouble(8, vo.getBbTopLeftX());
|
||||
// ps.setDouble(9, vo.getBbTopLeftY());
|
||||
// ps.setDouble(10, vo.getBbBottomRightX());
|
||||
// ps.setDouble(11, vo.getBbBottomRightY());
|
||||
// ps.setDouble(12, vo.getCrdntX());
|
||||
// ps.setDouble(13, vo.getCrdntY());
|
||||
// ps.setDouble(14, vo.getCrdntLat());
|
||||
// ps.setDouble(15, vo.getCrdntLon());
|
||||
// ps.setString(16, vo.getAcStandOnAt());
|
||||
// ps.setDouble(17, vo.getObjectSpd());
|
||||
// }
|
||||
///건별 입력
|
||||
if(!isBatch) {
|
||||
ps.execute();
|
||||
saveLast++;
|
||||
|
||||
if(MainServer.LAST_DATA_CNT == 0 ) {
|
||||
MainServer.LAST_DATA_CNT = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.debug("Data Insert error UseSqlLog");
|
||||
sqlLogCctvTrackLastQueue.add(vo);
|
||||
failLast++;
|
||||
}
|
||||
|
||||
//배치 입력
|
||||
if(isBatch) {
|
||||
ps.addBatch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(isBatch) {
|
||||
ps.executeBatch();
|
||||
|
||||
if(MainServer.LAST_DATA_CNT == 0 ) {
|
||||
MainServer.LAST_DATA_CNT = 1;
|
||||
}
|
||||
|
||||
//배치 insert는 arr 건수만큼
|
||||
saveLast+=setCctvTrackVOArr.length;
|
||||
}
|
||||
|
||||
con.commit();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("cctvLast(Batch:"+isBatch+") error", e);
|
||||
if(isBatch) {
|
||||
logger.error("Try insert row by row");
|
||||
insertCctvLastData(setCctvTrackVOArr, false);
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
||||
if(ps!=null) {
|
||||
try {
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
logger.error("cctvLast(Batch:"+isBatch+") PreparedStatement close error",e);
|
||||
}
|
||||
}
|
||||
if(con!=null) {
|
||||
try {
|
||||
con.commit();
|
||||
con.setAutoCommit(true);
|
||||
} catch (SQLException e) {
|
||||
logger.error("cctvLast(Batch:"+isBatch+") commit error",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public synchronized CountStatus getCountAndSetZero() {
|
||||
CountStatus countStatus = new CountStatus(savePos, saveLast, saveStatic, failPos, failLast, failStatic);
|
||||
|
||||
savePos = 0;
|
||||
saveLast = 0;
|
||||
saveStatic = 0;
|
||||
failPos = 0;
|
||||
failLast = 0;
|
||||
failStatic = 0;
|
||||
|
||||
return countStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 오류 발생시 건/건으로 저장할 수 있도록 수정
|
||||
* @param setDynamicVoArr
|
||||
*/
|
||||
/*public void insertData(SetDynamicVO[] setDynamicVoArr) {
|
||||
|
||||
if(setDynamicVoArr==null || setDynamicVoArr.length<1) {
|
||||
// logger.error("insertDataAll - No tableList data");
|
||||
logger.debug("insertData - no data in setDynamicVoArr");
|
||||
return;
|
||||
}
|
||||
// Table destTable=tableList.get(0);
|
||||
|
||||
|
||||
// String sql = "INSERT INTO " + destTable.getName() + " (" + getInsertCols(destTable.getColumnList()) + ") "
|
||||
// + "VALUES (" + getInsertValueParams(destTable.getColumnList()) + ")";
|
||||
|
||||
String tableName = "th_ais_" + setDynamicVoArr[0].getDateTime().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
|
||||
String sql = "INSERT INTO "+tableName +" (" +
|
||||
" ship_id, recv_dt, lon_val, lat_val, sog_val, cog_val, hdg_val, rot_val, zone_id) " +
|
||||
" VALUES (?, TO_TIMESTAMP(?,'yyyyMMddhh24miss'), ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
|
||||
PreparedStatement ps=null;
|
||||
Connection con=null;
|
||||
try {
|
||||
|
||||
con=session.getConnection();
|
||||
if(con.isClosed() || !con.isValid(1)) {
|
||||
closeSession();
|
||||
openSession(true);
|
||||
con=session.getConnection();
|
||||
}
|
||||
con.setAutoCommit(false);
|
||||
|
||||
|
||||
// Statement statement = session.getConnection().createStatement();
|
||||
ps = con.prepareStatement(sql);
|
||||
|
||||
for (int i = 0; i < setDynamicVoArr.length; i++) {
|
||||
SetDynamicVO vo = setDynamicVoArr[i];
|
||||
//입력으로 처리
|
||||
//중복 입력 방지를 위함
|
||||
vo.setInserted(true);
|
||||
|
||||
|
||||
try {
|
||||
|
||||
ps.setString(1, vo.getShipID());
|
||||
// ps.setDate(2, vo.getDateTime());
|
||||
ps.setString(2, vo.getDateTime().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
|
||||
ps.setDouble(3, vo.getLongitude());
|
||||
ps.setDouble(4, vo.getLatitude());
|
||||
ps.setDouble(5,vo.getSog());
|
||||
ps.setDouble(6,vo.getCog());
|
||||
ps.setInt(7, vo.getHeading());
|
||||
ps.setInt(8, vo.getRot());
|
||||
ps.setString(9, vo.getZoneId());
|
||||
// ps.addBatch();
|
||||
ps.execute();
|
||||
|
||||
} catch (Exception e) {
|
||||
// logger.error("insertData error", e);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// ps.executeBatch();
|
||||
|
||||
con.commit();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("insertData error", e);
|
||||
} finally {
|
||||
|
||||
if(ps!=null) {
|
||||
try {
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
logger.error("insertData PreparedStatement close error",e);
|
||||
}
|
||||
}
|
||||
if(con!=null) {
|
||||
try {
|
||||
con.commit();
|
||||
con.setAutoCommit(true);
|
||||
} catch (SQLException e) {
|
||||
logger.error("insertData commit error",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
// /**
|
||||
// * Insert colums 성성
|
||||
// * @param columnList
|
||||
// * @return
|
||||
// */
|
||||
// private String getInsertCols(List<Column> columnList) {
|
||||
// StringBuilder result=new StringBuilder();
|
||||
// for (int i = 0; i < columnList.size(); i++) {
|
||||
// result.append(columnList.get(i).getName());
|
||||
// //마지막에는 ,를 안붙이기 위해
|
||||
// if(i!=columnList.size()-1)
|
||||
// result.append(",");
|
||||
// }
|
||||
// return result.toString();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private String getInsertValueParams(List<Column> columnList) {
|
||||
// StringBuilder result=new StringBuilder();
|
||||
// for (int i = 0; i < columnList.size(); i++) {
|
||||
// result.append(setInsertParam(columnList.get(i)));
|
||||
// //마지막에는 ,를 안붙이기 위해
|
||||
// if(i!=columnList.size()-1)
|
||||
// result.append(",");
|
||||
// }
|
||||
// return result.toString();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 파라미터는 ? 로 표현하여 ps.set~~~으로...
|
||||
// * @param column
|
||||
// * @return
|
||||
// */
|
||||
// private String setInsertParam(Column column) {
|
||||
// switch (dbType) {
|
||||
// case ORACLE:
|
||||
// return setInsertParamOracle(column);
|
||||
// default:
|
||||
// //mariadb default
|
||||
// return setInsertParamMariadb(column);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private String setInsertParamMariadb(Column column) {
|
||||
//
|
||||
// if(column.isCustom()) {
|
||||
// return column.getCustomStr();
|
||||
// }else {
|
||||
// switch (column.getColumnTypeName()) {
|
||||
// case "DATE":
|
||||
// case "DATETIME":
|
||||
// return "STR_TO_DATE(?,'%Y%m%d%H%i%S')";
|
||||
// case "TIMESTAMP":
|
||||
// case "TIMESTAMP_WITH_TIMEZONE":
|
||||
// return "STR_TO_DATE(?,'%Y%m%d%H%i%S%f')";
|
||||
// case "TIME":
|
||||
// case "TIME_WITH_TIMEZONE":
|
||||
// return "STR_TO_DATE(?,'%H%i%S')";
|
||||
// default:
|
||||
// return "?";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// private String setInsertParamOracle(Column column) {
|
||||
//
|
||||
// if(column.isCustom()) {
|
||||
// return column.getCustomStr();
|
||||
// }else {
|
||||
// switch (column.getColumnTypeName()) {
|
||||
// case "DATE":
|
||||
// case "DATETIME":
|
||||
// return "TO_DATE(?,'yyyymmddhh24miss')";
|
||||
// case "TIMESTAMP":
|
||||
// case "TIMESTAMP_WITH_TIMEZONE":
|
||||
// return "TO_TIMESTAMP(?,'yyyymmddhh24missff')";
|
||||
// case "TIME":
|
||||
// case "TIME_WITH_TIMEZONE":
|
||||
// return "TO_DATE(?,'hh24miss')";
|
||||
// default:
|
||||
// return "?";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package kr.gmtc.tss.db;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
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();
|
||||
}
|
||||
//
|
||||
// @Bean(name = "packetQ")
|
||||
// public Queue<String> packetQ(){
|
||||
// return new LinkedBlockingQueue<String>();
|
||||
// }
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
package kr.gmtc.tss.filelog;
|
||||
|
||||
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.data.vo.CctvTrackVO;
|
||||
import kr.gmtc.tss.main.MainServer;
|
||||
import kr.gmtc.tss.util.FileUtil;
|
||||
|
||||
public class DataLogger implements Runnable {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private Queue<String> trackQueue;
|
||||
private boolean isRunning = true;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
public DataLogger(Queue<String> trackQueue, int listChunkSize, long sleepMillis) {
|
||||
this.trackQueue = trackQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
String [] chunkArr = getChunkMessageArr(trackQueue);
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
FileUtil.writeLogFile(getMessageBody(chunkArr[i]), MainServer.DATA_FILE_NAME);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.info("-- [SqlLogger] LogSave error : " +e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private String [] getChunkMessageArr(Queue<String> trackQueue) {
|
||||
int loopCnt = 0;
|
||||
|
||||
if(trackQueue.size()>listChunkSize) {
|
||||
loopCnt = listChunkSize;
|
||||
}else {
|
||||
loopCnt = trackQueue.size();
|
||||
}
|
||||
|
||||
String [] chunkArr = new String[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i] = trackQueue.poll();
|
||||
}
|
||||
|
||||
return chunkArr;
|
||||
}
|
||||
|
||||
private String getMessageBody(String str) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(str);
|
||||
sb.append("\n");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[SqlLogger] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
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.data.vo.CctvTrackVO;
|
||||
import kr.gmtc.tss.main.MainServer;
|
||||
import kr.gmtc.tss.util.FileUtil;
|
||||
|
||||
public class MessageBodyLogger implements Runnable {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private Queue<CctvTrackVO> messageBodyQueue;
|
||||
private boolean isRunning = true;
|
||||
private int listChunkSize = 100;
|
||||
private long sleepMillis;
|
||||
|
||||
public MessageBodyLogger(Queue<CctvTrackVO> messageBodyQueue, int listChunkSize, long sleepMillis) {
|
||||
this.messageBodyQueue = messageBodyQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning = true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
CctvTrackVO [] chunkArr = getChunkMessageArr(messageBodyQueue);
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
//logger.error(getMessageBody(chunkArr[i]));
|
||||
FileUtil.writeLogFile(getMessageBody(chunkArr[i]), MainServer.FILE_LOG_NAME);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.info("-- [SqlLogger] LogSave error : " +e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private CctvTrackVO [] getChunkMessageArr(Queue<CctvTrackVO> messageBodyQueue) {
|
||||
int loopCnt = 0;
|
||||
|
||||
if(messageBodyQueue.size()>listChunkSize) {
|
||||
loopCnt = listChunkSize;
|
||||
}else {
|
||||
loopCnt = messageBodyQueue.size();
|
||||
}
|
||||
|
||||
CctvTrackVO [] chunkArr = new CctvTrackVO[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i] = messageBodyQueue.poll();
|
||||
}
|
||||
|
||||
return chunkArr;
|
||||
}
|
||||
|
||||
// private String getMessageBody(String str) {
|
||||
// Date date = new Date();
|
||||
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
//
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
//
|
||||
// sb.append(formatter.format(date));
|
||||
// sb.append(" ");
|
||||
// sb.append(str);
|
||||
//
|
||||
// return sb.toString();
|
||||
// }
|
||||
|
||||
private String getMessageBody(CctvTrackVO vo) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(vo.toString());
|
||||
sb.append("\n");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[SqlLogger] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package kr.gmtc.tss.kafka;
|
||||
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collections;
|
||||
import java.util.Properties;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
||||
import org.apache.kafka.clients.consumer.KafkaConsumer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class KafkaTopicReader implements Runnable {
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private final String bootstrapServers;
|
||||
private final String topic;
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
|
||||
public KafkaTopicReader(String bootstrapServers, String topic, Queue<String> rcvQueue) {
|
||||
this.bootstrapServers = bootstrapServers;
|
||||
this.topic = topic;
|
||||
this.rcvQueue = rcvQueue;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
Properties props = new Properties();
|
||||
props.put("bootstrap.servers", bootstrapServers);
|
||||
props.put("group.id", "kafka-topic-reader");
|
||||
props.put("auto.offset.reset", "earliest");
|
||||
props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
|
||||
props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
|
||||
try (KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props)) {
|
||||
|
||||
// 토픽 구독
|
||||
consumer.subscribe(Collections.singletonList(topic));
|
||||
|
||||
while (true) {
|
||||
/*
|
||||
* rcvQueue.
|
||||
* add("{\"header\":{\"result_code\":\"200\",\"result_msg\":\"Success\"},\"data\":[{\"anals_id\":\"anals_id\",\"anals_dt\":\"2023-05-26 10:06:18\",\"anals_ty\":\"지시위반\",\"area\":{\"area_type\":\"AF03006\",\"area_id\":\"106\"},\"target1\":{\"trgt_ty\":\"1\",\"trgt_id\":\"KAL035\"},\"target2\":{\"trgt_ty\":null,\"trgt_id\":null},\"anals_msg\":\"PDC발부 전 PushBack 진행중 입니다.\"}]}"
|
||||
* ); Thread.sleep(10000);
|
||||
*/
|
||||
ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(100));
|
||||
|
||||
if (records.count() > 0) logger.info("topic {} 수신 건수 {}", topic, records.count());
|
||||
|
||||
for (ConsumerRecord<String, String> record : records) {
|
||||
rcvQueue.add(record.value());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,462 +0,0 @@
|
|||
package kr.gmtc.tss.main;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import kr.gmt.so.state.StateManager;
|
||||
import kr.gmt.so.state.model.SystemState;
|
||||
import kr.gmtc.tss.data.DataInsertRunnable;
|
||||
import kr.gmtc.tss.data.ParseTargetRunnable;
|
||||
import kr.gmtc.tss.data.TargetManageRunnable;
|
||||
import kr.gmtc.tss.data.vo.CctvTrackVO;
|
||||
import kr.gmtc.tss.db.BatchInsertManager;
|
||||
import kr.gmtc.tss.filelog.DataLogger;
|
||||
import kr.gmtc.tss.filelog.MessageBodyLogger;
|
||||
import kr.gmtc.tss.kafka.KafkaTopicReader;
|
||||
import kr.gmtc.tss.netty.StringClient;
|
||||
import kr.gmtc.tss.sqllog.SqlLogger;
|
||||
import kr.gmtc.tss.util.ArrayBlockingLoggingQueue;
|
||||
import kr.gmtc.tss.util.FileUtil;
|
||||
|
||||
@EnableScheduling
|
||||
@Component
|
||||
public class MainServer implements InitializingBean {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Value("${kafka.bootstrapServers}")
|
||||
private String bootstrapServers;
|
||||
|
||||
@Value("${kafka.topic}")
|
||||
private String topic;
|
||||
|
||||
@Value("${file-zip-path}")
|
||||
private String fileZipPath;
|
||||
|
||||
@Value("${file-zip-bak-path}")
|
||||
private String fileZipBakPath;
|
||||
|
||||
@Value("${file-make-time}")
|
||||
private int fileMakeTime;
|
||||
|
||||
@Value("${data-zip-path}")
|
||||
private String dataZipPath;
|
||||
|
||||
@Value("${data-zip-bak-path}")
|
||||
private String dataZipBakPath;
|
||||
|
||||
@Value("${data-make-time}")
|
||||
private int dataMakeTime;
|
||||
|
||||
@Value("${flag.database}")
|
||||
private boolean flagDataBase;
|
||||
|
||||
@Value("${flag.datafile}")
|
||||
private boolean flagDataFile;
|
||||
|
||||
@Value("${flag.file}")
|
||||
private boolean flagFile;
|
||||
|
||||
@Value("${client.server.ip:127.0.0.1}")
|
||||
private String tcpServerIp="127.0.0.1";
|
||||
|
||||
@Value("${client.reconn-time-sec:3000}")
|
||||
private long reconnTime=3000;
|
||||
|
||||
@Value("${client.queue-count:10000}")
|
||||
private int queueCount=100000;
|
||||
|
||||
@Value("${dynamic-dedupl.set-size:10000}")
|
||||
private int dynamicSetSize;
|
||||
|
||||
@Value("${dynamic-dedupl.set-remove-unit-size:500}")
|
||||
private int dynamicRemoveUnitSize;
|
||||
|
||||
@Value("${spring.db.batch-insert-size:1000}")
|
||||
private int batchInsertSize;
|
||||
|
||||
@Value("${process.queue-chunk-size:1000}")
|
||||
private int queueChunkSize;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("batchSqlSessionFactory")
|
||||
public SqlSessionFactory sqlSessionFactory;
|
||||
private SqlSession session;
|
||||
|
||||
public static String FILE_LOG_NAME;
|
||||
public static String DATA_FILE_NAME;
|
||||
|
||||
@Value("${selep-time-ms.parse-target:50}")
|
||||
private long parseTargetSleepMs;
|
||||
|
||||
@Value("${selep-time-ms.target-manage:50}")
|
||||
private long targetManageSleepMs;
|
||||
|
||||
@Value("${selep-time-ms.data-insert:50}")
|
||||
private long dataInsertSleepMs;
|
||||
|
||||
@Value("${selep-time-ms.sql-logger:50}")
|
||||
private long sqlLoggerSleepMs;
|
||||
|
||||
@Value("${classification}")
|
||||
private String classification;
|
||||
|
||||
@Value("${swclassification}")
|
||||
private String swclassification;
|
||||
|
||||
@Value("${logclassification}")
|
||||
private String logclassification;
|
||||
|
||||
StringClient client;
|
||||
KafkaTopicReader kafkaTopicReader;
|
||||
ParseTargetRunnable parserRunnable;
|
||||
DataLogger dataLoggerRunnable;
|
||||
TargetManageRunnable targetManageRunnable;
|
||||
SqlLogger sqlLoggerRunnable;
|
||||
BatchInsertManager batchInsertManager;
|
||||
DataInsertRunnable dataInsertRunnable;
|
||||
MessageBodyLogger messageBodyLogger;
|
||||
|
||||
List<Thread> threadList = new ArrayList<Thread>();
|
||||
|
||||
Queue<String> rcvQueue;
|
||||
Queue<CctvTrackVO> sqlLogTrackQueue;
|
||||
Queue<CctvTrackVO> sqlLogTrackLastQueue;
|
||||
|
||||
// track 위치정보 저장
|
||||
Queue<CctvTrackVO> trackQueue;
|
||||
Queue<String> dataFileQueue;
|
||||
Queue<CctvTrackVO> trackLastQueue;
|
||||
|
||||
Queue<CctvTrackVO> messageBodyQueue;
|
||||
|
||||
@Bean(name = "rcvQueue")
|
||||
public Queue<String> getRcvQueue() {
|
||||
return rcvQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "trackQueue")
|
||||
public Queue<CctvTrackVO> getTrackQueue() {
|
||||
return trackQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "dataFileQueue")
|
||||
public Queue<String> getDataFileQueue() {
|
||||
return dataFileQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "trackLastQueue")
|
||||
public Queue<CctvTrackVO> getTrackLastQueue() {
|
||||
return trackLastQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "sqlLogTrackQueue")
|
||||
public Queue<CctvTrackVO> getSqlLogTrackQueue() {
|
||||
return sqlLogTrackQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "sqlLogTrackLastQueue")
|
||||
public Queue<CctvTrackVO> getSqlLogTrackLastQueue() {
|
||||
return sqlLogTrackLastQueue;
|
||||
}
|
||||
|
||||
@Bean(name = "messageBodyQueue")
|
||||
public Queue<CctvTrackVO> getMessageBodyQueue() {
|
||||
return messageBodyQueue;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private FileUtil fileUtil;
|
||||
|
||||
public static int LAST_DATA_CNT = 0;
|
||||
|
||||
@Autowired
|
||||
private StateManager stateMgr;
|
||||
// private boolean swBeforeStatus = true;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
|
||||
stateMgr.updateState();
|
||||
|
||||
logger.info("DataQueue Count : "+queueCount);
|
||||
logger.info("flagDataBase : "+flagDataBase);
|
||||
logger.info("flagDataFile : "+flagDataFile);
|
||||
logger.info("flagFile : "+flagFile);
|
||||
|
||||
rcvQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
sqlLogTrackQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
sqlLogTrackLastQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
trackQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
dataFileQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
trackLastQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
messageBodyQueue=new ArrayBlockingLoggingQueue<>(queueCount);
|
||||
|
||||
// LAST TABLE 데이터 확인
|
||||
DBLastDataStatus();
|
||||
|
||||
// 최초 한번만 실행 - 로그파일이 없을 시 생성
|
||||
if (flagFile) FILE_LOG_NAME = fileUtil.createLogFile(fileZipPath, fileZipBakPath, fileMakeTime, "AILOC"); // rest log file
|
||||
if (flagDataFile) DATA_FILE_NAME = fileUtil.createLogFile(dataZipPath, dataZipBakPath, dataMakeTime, "AILOC"); // logstash data file log
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void destroy() {
|
||||
// parserRunnable;
|
||||
// targetManageRunnable;
|
||||
// sqlLoggerRunnable;
|
||||
// batchInsertManager;
|
||||
// dataInsertRunnable.s;
|
||||
// client.isInterrupted();
|
||||
logger.info("Pre destroy called!!");
|
||||
client.interrupt();
|
||||
dataInsertRunnable.setRunning(false);
|
||||
sqlLoggerRunnable.setRunning(false);
|
||||
parserRunnable.setRunning(false);
|
||||
//targetManageRunnable.setRunning(false);
|
||||
// sqlSessionFactory.ge
|
||||
// batchInsertManager.setRunning(false);
|
||||
|
||||
// for (int i = 0; i < threadList.size(); i++) {
|
||||
// try {
|
||||
//
|
||||
// logger.info("["+threadList.get(i).getClass().getName() +"/"+threadList.get(i).getName()+"] thread destroy");
|
||||
// threadList.get(i).interrupt();
|
||||
// } catch (Exception e) {
|
||||
// logger.error("Thread interrupt error - ",e);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if(flagDataBase) startDataInsertThread();
|
||||
if(flagDataFile) startDataLoggerThread();
|
||||
if(flagFile) startMessageBodyThread();
|
||||
|
||||
startKafkaThread();
|
||||
startParserThread();
|
||||
startSqlLoggerThread();
|
||||
}
|
||||
|
||||
@Scheduled(cron = "${process.status-check-cron}")
|
||||
private void chkThreadStatus() throws InterruptedException{
|
||||
|
||||
stateMgr.updateState();
|
||||
|
||||
boolean running = true;
|
||||
boolean swNewStatus = stateMgr.isActive();
|
||||
|
||||
// // 이중화 Active / Standby 상태 변경 체크
|
||||
// if(swBeforeStatus != swNewStatus){
|
||||
|
||||
// parserRunnable.setRunning(swNewStatus);
|
||||
// dataInsertRunnable2.setRunning(swNewStatus);
|
||||
// dataLoggerRunnable.setRunning(swNewStatus);
|
||||
// sqlLoggerRunnable.setRunning(swNewStatus);
|
||||
// messageBodyLogger.setRunning(swNewStatus);
|
||||
|
||||
// }
|
||||
|
||||
// 해당 프로그램이 Active일때 Thread Interrupt 유무 체크
|
||||
if(swNewStatus){
|
||||
|
||||
for(Thread ct : threadList ){
|
||||
if(ct.isInterrupted()){
|
||||
running = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(running){
|
||||
stateMgr.updateState(SystemState.Normal);
|
||||
}else{
|
||||
stateMgr.updateState(SystemState.Error);
|
||||
}
|
||||
}
|
||||
|
||||
// swBeforeStatus = stateMgr.isActive();
|
||||
|
||||
// logger.info("swBeforeStatus : " + swBeforeStatus);
|
||||
}
|
||||
|
||||
@Scheduled(cron = "${process.file-backup-cron}")
|
||||
public void fileRecv() throws Exception{
|
||||
if (flagFile) {
|
||||
/* 파일 압축 */
|
||||
fileUtil.createZipFile(fileZipPath, fileZipBakPath, fileMakeTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "${process.data-backup-cron}")
|
||||
public void dataFileRecv() throws Exception{
|
||||
if (flagDataFile) {
|
||||
/* 파일 압축 */
|
||||
fileUtil.createZipFile(dataZipPath, dataZipBakPath, dataMakeTime);
|
||||
}
|
||||
}
|
||||
|
||||
// 매 시간 10분 간격 으로 실행
|
||||
@Scheduled(cron = "${process.file-make-cron}")
|
||||
public void fileMake() throws Exception{
|
||||
if (flagFile) {
|
||||
FILE_LOG_NAME = fileUtil.createLogFile(fileZipPath, fileZipBakPath, fileMakeTime, "AILOC");
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "${process.data-make-cron}")
|
||||
public void dataFileMake() throws Exception{
|
||||
if (flagDataFile) {
|
||||
DATA_FILE_NAME = fileUtil.createLogFile(dataZipPath, dataZipBakPath, dataMakeTime, "AILOC");
|
||||
}
|
||||
}
|
||||
|
||||
private void checkQueueSize() {
|
||||
if(rcvQueue.size()==queueCount) {
|
||||
logger.error("rcvQueue is Full!!");
|
||||
}
|
||||
if(trackQueue.size()==queueCount) {
|
||||
logger.error("trackQueue is Full!!");
|
||||
}
|
||||
if(dataFileQueue.size()==queueCount) {
|
||||
logger.error("dataFileQueue is Full!!");
|
||||
}
|
||||
if(trackLastQueue.size()==queueCount) {
|
||||
logger.error("trackLastQueue is Full!!");
|
||||
}
|
||||
if(sqlLogTrackQueue.size()==queueCount) {
|
||||
logger.error("sqlLogTrackQueue is Full!!");
|
||||
}
|
||||
if(sqlLogTrackLastQueue.size()==queueCount) {
|
||||
logger.error("sqlLogTrackLastQueue is Full!!");
|
||||
}
|
||||
if(messageBodyQueue.size()==queueCount) {
|
||||
logger.error("messageBodyQueue is Full!!");
|
||||
}
|
||||
}
|
||||
|
||||
public void startKafkaThread() {
|
||||
KafkaTopicReader topicReader = new KafkaTopicReader(bootstrapServers, topic, rcvQueue);
|
||||
this.kafkaTopicReader=topicReader;
|
||||
|
||||
Thread thread = new Thread(topicReader);
|
||||
thread.start();
|
||||
|
||||
threadList.add(thread);
|
||||
}
|
||||
|
||||
public void startParserThread() {
|
||||
ParseTargetRunnable parserRunnable = new ParseTargetRunnable(rcvQueue, trackQueue, trackLastQueue, dataFileQueue, messageBodyQueue, queueChunkSize, parseTargetSleepMs ,flagFile, flagDataBase, flagDataFile, classification, swclassification, logclassification);
|
||||
this.parserRunnable=parserRunnable;
|
||||
Thread thread = new Thread(parserRunnable);
|
||||
thread.start();
|
||||
threadList.add(thread);
|
||||
parserRunnable.getCountAndSetZero();
|
||||
}
|
||||
|
||||
public void startDataInsertThread() {
|
||||
BatchInsertManager batchInsertManager = new BatchInsertManager(sqlSessionFactory, sqlLogTrackQueue,sqlLogTrackLastQueue);
|
||||
this.batchInsertManager=batchInsertManager;
|
||||
|
||||
DataInsertRunnable dataInsertRunnable = new DataInsertRunnable(trackQueue, trackLastQueue, batchInsertSize, batchInsertManager, dataInsertSleepMs, topic);
|
||||
this.dataInsertRunnable = dataInsertRunnable;
|
||||
|
||||
Thread thread = new Thread(dataInsertRunnable);
|
||||
thread.start();
|
||||
|
||||
threadList.add(thread);
|
||||
}
|
||||
|
||||
public void startDataLoggerThread() {
|
||||
DataLogger dataLoggerRunnable = new DataLogger(dataFileQueue, queueChunkSize, sqlLoggerSleepMs);
|
||||
this.dataLoggerRunnable = dataLoggerRunnable;
|
||||
|
||||
Thread thread = new Thread(dataLoggerRunnable);
|
||||
thread.start();
|
||||
|
||||
threadList.add(thread);
|
||||
}
|
||||
|
||||
public void startSqlLoggerThread() {
|
||||
SqlLogger sqlLoggerRunnable = new SqlLogger(sqlLogTrackQueue, sqlLogTrackLastQueue, queueChunkSize, sqlLoggerSleepMs);
|
||||
this.sqlLoggerRunnable = sqlLoggerRunnable;
|
||||
|
||||
Thread thread = new Thread(sqlLoggerRunnable);
|
||||
thread.start();
|
||||
|
||||
threadList.add(thread);
|
||||
}
|
||||
|
||||
public void startMessageBodyThread() {
|
||||
MessageBodyLogger messageBodyLogger = new MessageBodyLogger(messageBodyQueue, queueChunkSize, sqlLoggerSleepMs);
|
||||
this.messageBodyLogger = messageBodyLogger;
|
||||
|
||||
Thread thread = new Thread(messageBodyLogger);
|
||||
thread.start();
|
||||
|
||||
threadList.add(thread);
|
||||
}
|
||||
|
||||
public void DBLastDataStatus() {
|
||||
openSession(false);
|
||||
|
||||
String sql = "SELECT COUNT(*) FROM SACP_TRACK_LAST ";
|
||||
|
||||
PreparedStatement ps = null;
|
||||
Connection con = null;
|
||||
|
||||
con = session.getConnection();
|
||||
|
||||
try {
|
||||
if(con.isClosed() || !con.isValid(1)) {
|
||||
closeSession();
|
||||
openSession(true);
|
||||
con = session.getConnection();
|
||||
}
|
||||
con.setAutoCommit(false);
|
||||
ps = con.prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
LAST_DATA_CNT = rs.getInt(1);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void openSession(boolean forceOpen) {
|
||||
if(session==null||forceOpen)
|
||||
session = sqlSessionFactory.openSession();
|
||||
}
|
||||
|
||||
public void closeSession() {
|
||||
if(session!=null)
|
||||
session.close();
|
||||
}
|
||||
}
|
|
@ -1,246 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package kr.gmtc.tss.netty;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Queue;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandler.Sharable;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import io.netty.handler.codec.serialization.ClassResolvers;
|
||||
import io.netty.handler.codec.serialization.ObjectDecoder;
|
||||
import io.netty.handler.codec.serialization.ObjectEncoder;
|
||||
import io.netty.handler.codec.string.StringDecoder;
|
||||
import io.netty.handler.codec.string.StringEncoder;
|
||||
import io.netty.handler.ssl.SslContext;
|
||||
import io.netty.handler.ssl.SslContextBuilder;
|
||||
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
|
||||
import io.netty.handler.timeout.IdleStateHandler;
|
||||
import kr.gmtc.tss.status.ContextDestroyStatus;
|
||||
//import kr.gmt.routing.dds.support.ContextDestroyStatus;
|
||||
//import kr.gmt.routing.netty.server.ObjectEchoServerHandler;
|
||||
|
||||
/**
|
||||
* Modification of {@link EchoClient} which utilizes Java object serialization.
|
||||
*/
|
||||
@Sharable
|
||||
public class StringClient extends Thread {
|
||||
private static Logger logger = LoggerFactory.getLogger(StringClient.class);
|
||||
|
||||
static boolean SSL = System.getProperty("ssl") != null;
|
||||
static String HOST = System.getProperty("tcp.server.ip", "127.0.0.1");
|
||||
static int PORT = Integer.parseInt(System.getProperty("tcp.server.port", "8030"));
|
||||
static int SIZE = Integer.parseInt(System.getProperty("size", "256"));
|
||||
|
||||
private EventLoopGroup eventLoop;
|
||||
|
||||
|
||||
long reconnTime=3000;
|
||||
String threadName="";
|
||||
|
||||
// Queue<byte[]> dataQueue;
|
||||
|
||||
ChannelFuture channelFuture;
|
||||
StringClient client;
|
||||
StringClientHandler clientHandler;
|
||||
// ContextDestroyStatus contextDestroyStatus;
|
||||
|
||||
private boolean isServerStarted=false;
|
||||
|
||||
private Bootstrap b;
|
||||
|
||||
public void setServerStarted(boolean isServerStarted) {
|
||||
this.isServerStarted = isServerStarted;
|
||||
}
|
||||
|
||||
|
||||
public StringClient(String ip, int port, Queue<String> dataQueue, long reconnTime
|
||||
// ,
|
||||
// ChannelFuture channelFuture,
|
||||
// ContextDestroyStatus contextDestroyStatus
|
||||
) {
|
||||
this.HOST = ip;
|
||||
this.PORT = port;
|
||||
// this.dataQueue = dataQueue;
|
||||
this.client=this;
|
||||
this.reconnTime=reconnTime;
|
||||
this.channelFuture=client.channelFuture;
|
||||
// this.channelFuture=channelFuture;
|
||||
// this.contextDestroyStatus= contextDestroyStatus;
|
||||
clientHandler=new StringClientHandler(client,threadName, dataQueue,reconnTime);
|
||||
}
|
||||
|
||||
public EventLoopGroup getEventLoop() {
|
||||
return eventLoop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void interrupt() {
|
||||
// TODO Auto-generated method stub
|
||||
super.interrupt();
|
||||
eventLoop.shutdownGracefully();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
this.threadName = Thread.currentThread().getName();
|
||||
// startClient(new Bootstrap(),eventLoop,threadName);
|
||||
// boolean startStat=true;
|
||||
// eventLoop=new NioEventLoopGroup();
|
||||
startClient( );
|
||||
|
||||
/* while(!contextDestroyStatus.getShutdownStat()) {
|
||||
if(eventLoop!=null)
|
||||
eventLoop.shutdownGracefully();
|
||||
if (channelFuture==null||!channelFuture.isSuccess()||(!isServerStarted&&eventLoop.isShutdown())) {
|
||||
logger.info("서버 연결 시도 - /"+HOST+":"+PORT);
|
||||
eventLoop=new NioEventLoopGroup();
|
||||
// if(startClient( eventLoop,threadName)) {
|
||||
|
||||
if(startClient( )) {}
|
||||
// {
|
||||
|
||||
// break;
|
||||
// }
|
||||
isServerStarted=false;
|
||||
}
|
||||
|
||||
threadSleep(reconnTime);
|
||||
|
||||
if(contextDestroyStatus.getShutdownStat()) {
|
||||
logger.info("ObjectEchoClient Shutdown called");
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void threadSleep(long mills) {
|
||||
try {
|
||||
Thread.sleep(mills);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("Sleep Interrupted - "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// public ChannelFuture getChannelFuture() {
|
||||
// return channelFuture;
|
||||
// }
|
||||
|
||||
public boolean startClient() {
|
||||
return startClient( this.threadName);
|
||||
}
|
||||
|
||||
public boolean startClient(String threadName) {
|
||||
isServerStarted=true;
|
||||
boolean rtnVal=false;
|
||||
// try {
|
||||
eventLoop=new NioEventLoopGroup();
|
||||
EventLoopGroup group =eventLoop;
|
||||
|
||||
// final SslContext sslCtx;
|
||||
// if (SSL) {
|
||||
//
|
||||
// sslCtx = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();
|
||||
//
|
||||
// } else {
|
||||
// sslCtx = null;
|
||||
// }
|
||||
//
|
||||
// EventLoopGroup group = new NioEventLoopGroup();
|
||||
try {
|
||||
b = new Bootstrap();
|
||||
|
||||
b.group(group)
|
||||
.channel(NioSocketChannel.class)
|
||||
.option(ChannelOption.TCP_NODELAY, true)
|
||||
.option(ChannelOption.SO_KEEPALIVE, true)
|
||||
// .option(ChannelOption.SO_REUSEADDR, true)
|
||||
.handler(new ChannelInitializer<SocketChannel>() {
|
||||
@Override
|
||||
public void initChannel(SocketChannel ch) throws Exception {
|
||||
try {
|
||||
|
||||
|
||||
ChannelPipeline p = ch.pipeline();
|
||||
// if (sslCtx != null) {
|
||||
// p.addLast(sslCtx.newHandler(ch.alloc(), HOST, PORT));
|
||||
// }
|
||||
// p.addLast(new ObjectEncoder(),
|
||||
// new ObjectDecoder(ClassResolvers.cacheDisabled(null)),
|
||||
// clientHandler);
|
||||
p.addLast(
|
||||
// new IdleStateHandler(3, 0 , 0),
|
||||
new StringEncoder(),
|
||||
new StringDecoder(Charset.forName("MS949")),
|
||||
clientHandler);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
logger.error("init error ",e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
rtnVal=connecServer();
|
||||
|
||||
}catch(Exception e) {
|
||||
logger.error("서버 연결 실패 - "+e.getLocalizedMessage());
|
||||
logger.debug("call stack : ",e);
|
||||
} finally {
|
||||
// group.shutdownGracefully();
|
||||
}
|
||||
// } catch (SSLException e) {
|
||||
// logger.error("SSLException - ", e);
|
||||
// }
|
||||
// finally {
|
||||
// logger.info("Client cycle over!");
|
||||
// }
|
||||
return rtnVal;
|
||||
}
|
||||
|
||||
|
||||
public boolean connecServer() {
|
||||
boolean rtnVal=false;
|
||||
// group.
|
||||
try {
|
||||
channelFuture = b.connect(HOST, PORT);
|
||||
channelFuture.sync();
|
||||
channelFuture.channel().closeFuture().sync();
|
||||
rtnVal=true;
|
||||
// } catch (InterruptedException e) {
|
||||
// logger.error("서버 연결 실패 - "+e.getLocalizedMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("서버 연결 실패 - "+e.getLocalizedMessage());
|
||||
}
|
||||
return rtnVal;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package kr.gmtc.tss.netty;
|
||||
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import io.netty.channel.ChannelHandler.Sharable;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
|
||||
/**
|
||||
* Handler implementation for the object echo client. It initiates the ping-pong
|
||||
* traffic between the object echo client and server by sending the first
|
||||
* message to the server.
|
||||
*/
|
||||
@Sharable
|
||||
public class StringClientHandler
|
||||
//extends SimpleChannelInboundHandler<Object>{
|
||||
extends ChannelInboundHandlerAdapter {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(StringClientHandler.class);
|
||||
|
||||
String threadNm="";
|
||||
|
||||
Queue<String> dataQueue;
|
||||
|
||||
StringClient client;
|
||||
|
||||
long reconnTime=3000;
|
||||
|
||||
long queueFullCnt=0;
|
||||
|
||||
ApplicationContext appContext;
|
||||
|
||||
public StringClientHandler(StringClient client, String threadNm, Queue<String> dataQueue, long reconnTime) {
|
||||
this.threadNm=threadNm;
|
||||
this.dataQueue=dataQueue;
|
||||
this.client=client;
|
||||
this.reconnTime=reconnTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) {
|
||||
logger.info("서버 접속 - " + ctx.channel().remoteAddress().toString());
|
||||
}
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||
|
||||
// logger.info(msg.toString());
|
||||
if(dataQueue!=null) {
|
||||
if(!dataQueue.offer(msg.toString())) {
|
||||
logger.debug("Client data queue is full!");
|
||||
}
|
||||
}else {
|
||||
logger.error("dataQueue is null!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
logger.info("서버 연결 해제 - " +ctx.channel().remoteAddress());
|
||||
|
||||
ctx.close();
|
||||
super.channelInactive(ctx);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelReadComplete(ChannelHandlerContext ctx) {
|
||||
ctx.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
|
||||
logger.info("접속 오류 발생- " + ctx.channel().remoteAddress().toString()+"/cause : "+cause.getLocalizedMessage());
|
||||
|
||||
logger.debug("",cause);
|
||||
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
// super.channelUnregistered(ctx);
|
||||
|
||||
logger.info("접속 불가 - " + client.HOST+":"+client.PORT+" - "+client.reconnTime+"초 후 재 접속 시도 합니다.");
|
||||
ctx.channel().eventLoop().schedule(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
logger.info("재접속 시도 - "+ client.HOST+":"+client.PORT);
|
||||
client.connecServer();
|
||||
}
|
||||
}, client.reconnTime, TimeUnit.SECONDS);
|
||||
super.channelUnregistered(ctx);
|
||||
}
|
||||
|
||||
/*private void reConnection(ChannelHandlerContext ctx) {
|
||||
String serverAddr=ctx.channel().remoteAddress()+"";
|
||||
logger.info("서버 재연결 시작 - "+serverAddr);
|
||||
ctx.flush();
|
||||
ctx.close();
|
||||
Thread reconThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
while(!ctx.channel().isRegistered ()) {
|
||||
logger.info("서버 재연결 시도 - "+ctx.channel().remoteAddress());
|
||||
// client.getEventLoop().shutdownGracefully();
|
||||
//
|
||||
// if(!client.getEventLoop().isShutdown()){
|
||||
// logger.info("No Shutdown before");
|
||||
// threadSleep(reconnTime);
|
||||
// continue;
|
||||
// }
|
||||
|
||||
if(client.startClient()) {
|
||||
break;
|
||||
}
|
||||
|
||||
threadSleep(reconnTime);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
reconThread.start();
|
||||
}*/
|
||||
|
||||
private void threadSleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("thread sleep fail",e);
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// logger.info(msg.toString());
|
||||
// if(dataQueue!=null) {
|
||||
// if(!dataQueue.offer(msg.toString())) {
|
||||
// logger.error("Client data queue is full!");
|
||||
// }
|
||||
// }else {
|
||||
// logger.error("dataQueue is null!");
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -1,174 +0,0 @@
|
|||
package kr.gmtc.tss.sqllog;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import kr.gmtc.tss.data.vo.CctvTrackVO;
|
||||
import kr.gmtc.tss.main.MainServer;
|
||||
|
||||
public class SqlLogger implements Runnable {
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private Queue<CctvTrackVO> sqlLogCctvTrackQueue;
|
||||
private Queue<CctvTrackVO> sqlLogCctvTrackLastQueue;
|
||||
private boolean isRunning=true;
|
||||
private int listChunkSize= 100;
|
||||
private long sleepMillis;
|
||||
|
||||
public SqlLogger(Queue<CctvTrackVO> sqlLogCctvTrackQueue,Queue<CctvTrackVO> sqlLogCctvTrackLastQueue, int listChunkSize, long sleepMillis) {
|
||||
this.sqlLogCctvTrackQueue = sqlLogCctvTrackQueue;
|
||||
this.sqlLogCctvTrackLastQueue = sqlLogCctvTrackLastQueue;
|
||||
this.listChunkSize = listChunkSize;
|
||||
this.sleepMillis = sleepMillis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
isRunning=true;
|
||||
|
||||
while (isRunning) {
|
||||
try {
|
||||
CctvTrackVO [] chunkArr = getChunkTrackArr(sqlLogCctvTrackQueue);
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
logger.error(getInsertCctvSql(chunkArr[i]));
|
||||
}
|
||||
|
||||
chunkArr = getChunkTrackArr(sqlLogCctvTrackLastQueue);
|
||||
|
||||
for (int i = 0; i < chunkArr.length; i++) {
|
||||
logger.error(getInsertLastCctvSql(chunkArr[i]));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("-- [SqlLogger] LogSave error : " +e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
sleep(sleepMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private CctvTrackVO [] getChunkTrackArr(Queue<CctvTrackVO> sqlQueue) {
|
||||
int loopCnt=0;
|
||||
|
||||
if(sqlQueue.size()>listChunkSize) {
|
||||
loopCnt=listChunkSize;
|
||||
}else {
|
||||
loopCnt=sqlQueue.size();
|
||||
}
|
||||
|
||||
CctvTrackVO [] chunkArr = new CctvTrackVO[loopCnt];
|
||||
|
||||
for (int i = 0; i < loopCnt; i++) {
|
||||
chunkArr[i]=sqlQueue.poll();
|
||||
}
|
||||
|
||||
return chunkArr;
|
||||
}
|
||||
|
||||
|
||||
private String getInsertCctvSql(CctvTrackVO vo) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String now_dt = format.format(vo.getDtctTm());
|
||||
String tableName = "SACP_VIDEO_META_LC";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// sb.append("INSERT INTO ");
|
||||
// sb.append(tableName);
|
||||
// sb.append(" (VIDEO_META_ID, DETCT_DT, DETCT_TY, CCTV_INFO, CCTV_CHRG_ZONE, AC_TY, ARLN_CD, TRACK_ID, BB_TOP_LEFT_X, BB_TOP_LEFT_Y,");
|
||||
// sb.append(" BB_BOTTOM_RIGHT_X, BB_BOTTOM_RIGHT_Y, CRDNT_X, CRDNT_Y, CRDNT_LAT, CRDNT_LON, AC_STAND_ON_AT, OBJECT_SPD, REGISTER_ID");
|
||||
// sb.append(") VALUES (");
|
||||
// sb.append("'"); sb.append("UCM.FUN_GET_WORK_NO( '"+now_dt+"', 'VIDEO')"); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getDetctDt()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getDetctTy()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getCctvInfo()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getCctvChrgZone()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getAcTy()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getArlnCd()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getTrackId()); sb.append("',");
|
||||
// sb.append(vo.getBbTopLeftX()); sb.append(",");
|
||||
// sb.append(vo.getBbTopLeftY()); sb.append(",");
|
||||
// sb.append(vo.getBbBottomRightX()); sb.append(",");
|
||||
// sb.append(vo.getBbBottomRightY()); sb.append(",");
|
||||
// sb.append(vo.getCrdntX()); sb.append(",");
|
||||
// sb.append(vo.getCrdntY()); sb.append(",");
|
||||
// sb.append(vo.getCrdntLat()); sb.append(",");
|
||||
// sb.append(vo.getCrdntLon()); sb.append(",");
|
||||
// sb.append("'"); sb.append(vo.getAcStandOnAt()); sb.append("',");
|
||||
// sb.append(vo.getObjectSpd()); sb.append(",");
|
||||
// sb.append("'"); sb.append("SYSTEM"); sb.append("')");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
private String getInsertLastCctvSql(CctvTrackVO vo) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String now_dt = format.format(vo.getDtctTm());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// if(MainServer.LAST_DATA_CNT > 0) {
|
||||
// // update
|
||||
// sb.append(" UPDATE SACP_VIDEO_META_LC");
|
||||
// sb.append(" SET DETCT_DT = "); sb.append("'");sb.append(vo.getDetctTy());sb.append("'");
|
||||
// sb.append(" , DETCT_TY = "); sb.append("'");sb.append(vo.getDetctTy());sb.append("'");
|
||||
// sb.append(" , CCTV_INFO = "); sb.append("'");sb.append(vo.getCctvInfo());sb.append("'");
|
||||
// sb.append(" , CCTV_CHRG_ZONE = "); sb.append("'");sb.append(vo.getCctvChrgZone());sb.append("'");
|
||||
// sb.append(" , AC_TY = "); sb.append("'");sb.append(vo.getAcTy());sb.append("'");
|
||||
// sb.append(" , ARLN_CD = "); sb.append("'");sb.append(vo.getArlnCd());sb.append("'");
|
||||
// sb.append(" , TRACK_ID = "); sb.append("'");sb.append(vo.getTrackId());sb.append("'");
|
||||
// sb.append(" , BB_TOP_LEFT_X = "); sb.append(vo.getBbTopLeftX());
|
||||
// sb.append(" , BB_TOP_LEFT_Y = "); sb.append(vo.getBbTopLeftY());
|
||||
// sb.append(" , BB_BOTTOM_RIGHT_X = "); sb.append(vo.getBbBottomRightX());
|
||||
// sb.append(" , BB_BOTTOM_RIGHT_Y = "); sb.append(vo.getBbBottomRightY());
|
||||
// sb.append(" , CRDNT_X = "); sb.append(vo.getCrdntX());
|
||||
// sb.append(" , CRDNT_Y = "); sb.append(vo.getCrdntY());
|
||||
// sb.append(" , CRDNT_LAT = "); sb.append(vo.getCrdntLat());
|
||||
// sb.append(" , CRDNT_LON = "); sb.append(vo.getCrdntLon());
|
||||
// sb.append(" , AC_STAND_ON_AT = "); sb.append(vo.getAcStandOnAt());
|
||||
// sb.append(" , OBJECT_SPD = "); sb.append(vo.getObjectSpd());
|
||||
// sb.append(" , UPDUSR_ID = "); sb.append("'SYSTEM'");
|
||||
// sb.append(" , UPDT_DT = TO_TIMESTAMP(SYSDATE,'yyyyMMdd')");
|
||||
// sb.append(" WHERE VIDEO_META_ID = "); sb.append("'");sb.append(vo.getVideoMetaId());sb.append("')");
|
||||
// }else {
|
||||
// sb.append(" INSERT INTO SACP_VIDEO_META_LC");
|
||||
// sb.append(" ( VIDEO_META_ID, DETCT_DT, DETCT_TY, CCTV_INFO, CCTV_CHRG_ZONE, AC_TY, ARLN_CD, TRACK_ID, BB_TOP_LEFT_X, BB_TOP_LEFT_Y,");
|
||||
// sb.append(" BB_BOTTOM_RIGHT_X, BB_BOTTOM_RIGHT_Y, CRDNT_X, CRDNT_Y, CRDNT_LAT, CRDNT_LON, AC_STAND_ON_AT, OBJECT_SPD, REGISTER_ID");
|
||||
// sb.append(" ) VALUES (");
|
||||
// sb.append("'"); sb.append("UCM.FUN_GET_WORK_NO( '"+now_dt+"', 'VIDEO')"); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getDetctDt()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getDetctTy()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getCctvInfo()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getCctvChrgZone()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getAcTy()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getArlnCd()); sb.append("',");
|
||||
// sb.append("'"); sb.append(vo.getTrackId()); sb.append("',");
|
||||
// sb.append(vo.getBbTopLeftX()); sb.append(",");
|
||||
// sb.append(vo.getBbTopLeftY()); sb.append(",");
|
||||
// sb.append(vo.getBbBottomRightX()); sb.append(",");
|
||||
// sb.append(vo.getBbBottomRightY()); sb.append(",");
|
||||
// sb.append(vo.getCrdntX()); sb.append(",");
|
||||
// sb.append(vo.getCrdntY()); sb.append(",");
|
||||
// sb.append(vo.getCrdntLat()); sb.append(",");
|
||||
// sb.append(vo.getCrdntLon()); sb.append(",");
|
||||
// sb.append("'"); sb.append(vo.getAcStandOnAt()); sb.append("',");
|
||||
// sb.append(vo.getObjectSpd()); sb.append(",");
|
||||
// sb.append("'"); sb.append("SYSTEM"); sb.append("')");
|
||||
// }
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("[SqlLogger] sleep error : "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package kr.gmtc.tss.status;
|
||||
|
||||
public interface ContextDestroyEventListener {
|
||||
/**
|
||||
* Context destroy event handler.
|
||||
*/
|
||||
void onDestroy();
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package kr.gmtc.tss.status;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
public class ContextDestroyStatus {
|
||||
/**
|
||||
* Logger.
|
||||
*/
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
* linstener list.
|
||||
*/
|
||||
private final List<ContextDestroyEventListener> contextDestroyEventListeners = new ArrayList<ContextDestroyEventListener>();
|
||||
|
||||
/**
|
||||
* context destroy 여부 상태 값.
|
||||
*/
|
||||
private boolean shutdown = false;
|
||||
|
||||
/**
|
||||
* Shutdown flag 설정 등. 등록된 listener의 onDestroy event를 fire 한다.
|
||||
*/
|
||||
@PreDestroy
|
||||
public void destroy() {
|
||||
logger.info("Called destroy()!");
|
||||
shutdown = true;
|
||||
|
||||
for (ContextDestroyEventListener listener : contextDestroyEventListeners) {
|
||||
listener.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return destroy 된다면 true. 동작 중에는 false.
|
||||
*/
|
||||
public boolean getShutdownStat() {
|
||||
return shutdown;
|
||||
}
|
||||
public void setShutdownStat(boolean shutdown ) {
|
||||
this.shutdown=shutdown;
|
||||
// return shutdown;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param listener
|
||||
* event fire 대상 class.
|
||||
*/
|
||||
public void addListener(final ContextDestroyEventListener listener) {
|
||||
contextDestroyEventListeners.add(listener);
|
||||
logger.info("addListener ({}) complete. Listeners count is {}.", listener.getClass().getName(),
|
||||
contextDestroyEventListeners.size());
|
||||
}
|
||||
}
|
|
@ -1,240 +0,0 @@
|
|||
package kr.gmtc.tss.status;
|
||||
|
||||
public class CountStatus {
|
||||
|
||||
private int rcvPos=0;
|
||||
private int rcvStat=0;
|
||||
private int savePos=0;
|
||||
private int saveLast=0;
|
||||
private int saveStatic=0;
|
||||
private int failPos=0;
|
||||
private int failLast=0;
|
||||
private int failStatic=0;
|
||||
private int exceptPos=0;
|
||||
|
||||
|
||||
private int rcvQueueSize=0;
|
||||
private int dynamicVoQueueSize=0;
|
||||
private int staticVoQueueSize=0;
|
||||
private int dynamicInsertQueueSize=0;
|
||||
private int sqlLogDynamicQueueSize=0;
|
||||
private int sqlLogDynamicLastQueueSize=0;
|
||||
private int sqlLogStaticQueueSize=0;
|
||||
|
||||
|
||||
|
||||
public CountStatus(int rcvPos, int rcvStat) {
|
||||
this.rcvPos=rcvPos;
|
||||
this.rcvStat=rcvStat;
|
||||
}
|
||||
|
||||
public CountStatus(int savePos, int saveLast, int saveStatic, int failPos, int failLast, int failStatic) {
|
||||
this.savePos=savePos;
|
||||
this.saveLast=saveLast;
|
||||
this.saveStatic=saveStatic;
|
||||
this.failPos=failPos;
|
||||
this.failLast=failLast;
|
||||
this.failStatic=failStatic;
|
||||
}
|
||||
|
||||
public CountStatus() {
|
||||
|
||||
}
|
||||
|
||||
public int getRcvPos() {
|
||||
return rcvPos;
|
||||
}
|
||||
|
||||
public void setRcvPos(int rcvPos) {
|
||||
this.rcvPos = rcvPos;
|
||||
}
|
||||
|
||||
public int getRcvStat() {
|
||||
return rcvStat;
|
||||
}
|
||||
|
||||
public void setRcvStat(int rcvStat) {
|
||||
this.rcvStat = rcvStat;
|
||||
}
|
||||
|
||||
public int getSavePos() {
|
||||
return savePos;
|
||||
}
|
||||
|
||||
public void setSavePos(int savePos) {
|
||||
this.savePos = savePos;
|
||||
}
|
||||
|
||||
public int getSaveLast() {
|
||||
return saveLast;
|
||||
}
|
||||
|
||||
public void setSaveLast(int saveLast) {
|
||||
this.saveLast = saveLast;
|
||||
}
|
||||
|
||||
public int getSaveStatic() {
|
||||
return saveStatic;
|
||||
}
|
||||
|
||||
public void setSaveStatic(int saveStatic) {
|
||||
this.saveStatic = saveStatic;
|
||||
}
|
||||
|
||||
public int getFailPos() {
|
||||
return failPos;
|
||||
}
|
||||
|
||||
public void setFailPos(int failPos) {
|
||||
this.failPos = failPos;
|
||||
}
|
||||
|
||||
public int getFailLast() {
|
||||
return failLast;
|
||||
}
|
||||
|
||||
public void setFailLast(int failLast) {
|
||||
this.failLast = failLast;
|
||||
}
|
||||
|
||||
public int getFailStatic() {
|
||||
return failStatic;
|
||||
}
|
||||
|
||||
public void setFailStatic(int failStatic) {
|
||||
this.failStatic = failStatic;
|
||||
}
|
||||
|
||||
public int getExceptPos() {
|
||||
return exceptPos;
|
||||
}
|
||||
|
||||
public void setExceptPos(int exceptPos) {
|
||||
this.exceptPos = exceptPos;
|
||||
}
|
||||
|
||||
|
||||
public int getRcvQueueSize() {
|
||||
return rcvQueueSize;
|
||||
}
|
||||
|
||||
public void setRcvQueueSize(int rcvQueueSize) {
|
||||
this.rcvQueueSize = rcvQueueSize;
|
||||
}
|
||||
|
||||
public int getDynamicVoQueueSize() {
|
||||
return dynamicVoQueueSize;
|
||||
}
|
||||
|
||||
public void setDynamicVoQueueSize(int dynamicVoQueueSize) {
|
||||
this.dynamicVoQueueSize = dynamicVoQueueSize;
|
||||
}
|
||||
|
||||
public int getStaticVoQueueSize() {
|
||||
return staticVoQueueSize;
|
||||
}
|
||||
|
||||
public void setStaticVoQueueSize(int staticVoQueueSize) {
|
||||
this.staticVoQueueSize = staticVoQueueSize;
|
||||
}
|
||||
|
||||
public int getDynamicInsertQueueSize() {
|
||||
return dynamicInsertQueueSize;
|
||||
}
|
||||
|
||||
public void setDynamicInsertQueueSize(int dynamicInsertQueueSize) {
|
||||
this.dynamicInsertQueueSize = dynamicInsertQueueSize;
|
||||
}
|
||||
|
||||
public int getSqlLogDynamicQueueSize() {
|
||||
return sqlLogDynamicQueueSize;
|
||||
}
|
||||
|
||||
public void setSqlLogDynamicQueueSize(int sqlLogDynamicQueueSize) {
|
||||
this.sqlLogDynamicQueueSize = sqlLogDynamicQueueSize;
|
||||
}
|
||||
|
||||
public int getSqlLogDynamicLastQueueSize() {
|
||||
return sqlLogDynamicLastQueueSize;
|
||||
}
|
||||
|
||||
public void setSqlLogDynamicLastQueueSize(int sqlLogDynamicLastQueueSize) {
|
||||
this.sqlLogDynamicLastQueueSize = sqlLogDynamicLastQueueSize;
|
||||
}
|
||||
|
||||
public int getSqlLogStaticQueueSize() {
|
||||
return sqlLogStaticQueueSize;
|
||||
}
|
||||
|
||||
public void setSqlLogStaticQueueSize(int sqlLogStaticQueueSize) {
|
||||
this.sqlLogStaticQueueSize = sqlLogStaticQueueSize;
|
||||
}
|
||||
|
||||
public void initZero() {
|
||||
|
||||
rcvPos = 0;
|
||||
rcvStat = 0;
|
||||
savePos = 0;
|
||||
saveLast = 0;
|
||||
saveStatic = 0;
|
||||
failPos = 0;
|
||||
failLast = 0;
|
||||
failStatic = 0;
|
||||
|
||||
}
|
||||
|
||||
public String getCountLog() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "\r\n");
|
||||
sb.append( "===============================================\r\n" );
|
||||
sb.append( " Count Info \r\n" );
|
||||
sb.append( "===============================================\r\n" );
|
||||
sb.append( " 위치정보 \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " 수신 / 저장성공 / 저장실패 / 제외 / \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " "+String.format(" %5s", rcvPos)+" / "+String.format(" %5s", savePos)+" / "+String.format(" %5s", failPos)+" / "+String.format(" %5s", exceptPos)+"\r\n" );
|
||||
sb.append( "===============================================\r\n" );
|
||||
sb.append( " 정적정보 \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " 수신 / 저장성공 / 저장실패 / \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " "+String.format(" %5s", rcvStat)+" / "+String.format(" %5s", saveStatic)+" / "+String.format(" %5s", failStatic)+" / \r\n");
|
||||
sb.append( "===============================================\r\n");;
|
||||
sb.append( " 최종위치정보 \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " 저장성공 / 저장실패 / \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " "+String.format(" %5s", saveLast)+" / "+String.format(" %5s", failLast)+" / \r\n");
|
||||
sb.append( "===============================================\r\n");
|
||||
sb.append( " 큐 상태 \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " 수신 / 동적 / 동적(입력) / 정적 / \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " "+String.format(" %5s", rcvQueueSize)+" / "+String.format(" %5s", dynamicVoQueueSize)+" / "+String.format(" %5s", dynamicInsertQueueSize)+" / "+String.format(" %5s", staticVoQueueSize)+" / \r\n");
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " SQL \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " 동적 / 최종 / 정적 / \r\n" );
|
||||
sb.append( "-----------------------------------------------\r\n" );
|
||||
sb.append( " "+String.format(" %5s", sqlLogDynamicQueueSize)+" / "+String.format(" %5s", sqlLogDynamicLastQueueSize)+" / "+String.format(" %5s", sqlLogStaticQueueSize)+" / \r\n");
|
||||
sb.append( "===============================================\r\n");
|
||||
|
||||
//
|
||||
|
||||
// private int rcvQueueSize=0;
|
||||
// private int dynamicVoQueueSize=0;
|
||||
// private int staticVoQueueSize=0;
|
||||
// private int dynamicInsertQueueSize=0;
|
||||
// private int sqlLogDynamicQueueSize=0;
|
||||
// private int sqlLogDynamicLastQueueSize=0;
|
||||
// private int sqlLogStaticQueueSize=0;
|
||||
|
||||
|
||||
initZero();
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
package kr.gmtc.tss.status;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CountingComponent {
|
||||
|
||||
private int rcvPos=0;
|
||||
private int rcvStatic=0;
|
||||
private int savePos=0;
|
||||
private int failPos=0;
|
||||
private int saveStatic=0;
|
||||
private int failStatic=0;
|
||||
|
||||
public int getRcvPos() {
|
||||
return rcvPos;
|
||||
}
|
||||
public void setRcvPos(int rcvPos) {
|
||||
this.rcvPos = rcvPos;
|
||||
}
|
||||
public int getRcvStatic() {
|
||||
return rcvStatic;
|
||||
}
|
||||
public void setRcvStatic(int rcvStatic) {
|
||||
this.rcvStatic = rcvStatic;
|
||||
}
|
||||
public int getSavePos() {
|
||||
return savePos;
|
||||
}
|
||||
public void setSavePos(int savePos) {
|
||||
this.savePos = savePos;
|
||||
}
|
||||
public int getFailPos() {
|
||||
return failPos;
|
||||
}
|
||||
public void setFailPos(int failPos) {
|
||||
this.failPos = failPos;
|
||||
}
|
||||
public int getSaveStatic() {
|
||||
return saveStatic;
|
||||
}
|
||||
public void setSaveStatic(int saveStatic) {
|
||||
this.saveStatic = saveStatic;
|
||||
}
|
||||
public int getFailStatic() {
|
||||
return failStatic;
|
||||
}
|
||||
public void setFailStatic(int failStatic) {
|
||||
this.failStatic = failStatic;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void initZero() {
|
||||
rcvPos=0;
|
||||
rcvStatic=0;
|
||||
savePos=0;
|
||||
failPos=0;
|
||||
saveStatic=0;
|
||||
failStatic=0;
|
||||
}
|
||||
|
||||
public String getCountLog() {
|
||||
String log = "\r\n"
|
||||
+ "===============================================\r\n"
|
||||
+ " Count Info \r\n"
|
||||
+ "===============================================\r\n"
|
||||
+ " 위치정보 \r\n"
|
||||
+ "-----------------------------------------------\r\n"
|
||||
+ " 수신 / 저장성공 / 저장실패 \r\n"
|
||||
+ "-----------------------------------------------\r\n"
|
||||
+ " "+String.format(" %5s", rcvPos)+" / "+String.format(" %5s", savePos)+" / "+String.format(" %5s", failPos)+"\r\n"
|
||||
+ "===============================================\r\n"
|
||||
+ " 정적정보 \r\n"
|
||||
+ "-----------------------------------------------\r\n"
|
||||
+ " 수신 / 저장성공 / 저장실패 \r\n"
|
||||
+ "-----------------------------------------------\r\n"
|
||||
+ " "+String.format(" %5s", rcvStatic)+" / "+String.format(" %5s", saveStatic)+" / "+String.format(" %5s", failStatic)+"\r\n"
|
||||
+ "===============================================\r\n";
|
||||
|
||||
initZero();
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class ArrayBlockingLoggingQueue<Object> extends ArrayBlockingQueue<Object> {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ArrayBlockingLoggingQueue.class);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,229 +0,0 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
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);
|
||||
|
||||
/**
|
||||
* 로그파일을 압축한다.
|
||||
* 라이브 데이터 압축을 피하기 위해 20분전 데이터를 압축하는 것으로 세팅
|
||||
*/
|
||||
public void createZipFile(String fileZipPath, String fileZipBakPath, int fileMakeTime) {
|
||||
|
||||
// 압축파일이 저장될 폴더가 존재하는지 확인
|
||||
File backDir = new File(fileZipBakPath);
|
||||
if(!backDir.exists()) {
|
||||
backDir.mkdirs();
|
||||
}
|
||||
|
||||
SimpleDateFormat fileFormatter = new SimpleDateFormat("yyyyMMddHHmm");
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.MINUTE, -20); // 20분전 데이터 확인
|
||||
|
||||
String time20 = fileFormatter.format(cal.getTime());
|
||||
|
||||
// 압축할 파일 명 확인.
|
||||
String bakFileName = "file."+time20+".log";
|
||||
|
||||
String fileName = "";
|
||||
ZipOutputStream zip_out = null;
|
||||
|
||||
// 압축 파일 명 세팅
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(bakFileName);
|
||||
sb.append(".zip");
|
||||
fileName = sb.toString();
|
||||
|
||||
String _path = fileZipPath+"/"+bakFileName;
|
||||
|
||||
File bakFile = new File(_path);
|
||||
|
||||
// 파일이 존재할 경우에만 실행.
|
||||
if(bakFile.exists()) {
|
||||
if (fileZipPath.charAt(fileZipPath.length() - 1) != '/') {
|
||||
_path = _path + "/";
|
||||
}
|
||||
|
||||
try {
|
||||
zip_out = new ZipOutputStream(new FileOutputStream(fileZipBakPath+"/"+fileName));
|
||||
zipFolder("", bakFile, zip_out);
|
||||
zip_out.close();
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} finally {
|
||||
|
||||
}
|
||||
} else {
|
||||
logger.error("{} 파일이 존재하지 않습니다.", fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ZipOutputStream를 넘겨 받아서 하나의 압축파일로 만든다.
|
||||
* @param parent 상위폴더명
|
||||
* @param file 압축할 파일
|
||||
* @param zout 압축전체스트림
|
||||
* @throws IOException
|
||||
*/
|
||||
private void zipFolder(String parent, File file, ZipOutputStream zout) throws IOException {
|
||||
byte[] data = new byte[2048];
|
||||
|
||||
int read;
|
||||
|
||||
BufferedInputStream instream = new BufferedInputStream(new FileInputStream(file));
|
||||
|
||||
ZipEntry zipEntry = new ZipEntry(parent + file.getName());
|
||||
zout.putNextEntry(zipEntry);
|
||||
|
||||
while ((read = instream.read(data, 0, 2048)) != -1) {
|
||||
zout.write(data, 0, read);
|
||||
}
|
||||
|
||||
zout.flush();
|
||||
zout.closeEntry();
|
||||
instream.close();
|
||||
|
||||
file.delete(); // 파일 삭제
|
||||
|
||||
}
|
||||
|
||||
private void bakFileDelete(String fileZipPath, String date) throws IOException {
|
||||
File folder = new File(fileZipPath+"/"+date); // file 생성
|
||||
|
||||
try {
|
||||
while(folder.exists()){
|
||||
File[] files = folder.listFiles();
|
||||
|
||||
for(File file : files){
|
||||
file.delete(); // 하위 파일 삭제
|
||||
}
|
||||
|
||||
// 폴더 삭제
|
||||
if(files.length == 0 && folder.isDirectory()){ // 하위 파일이 없는지와 폴더인지 확인 후 폴더 삭제
|
||||
folder.delete(); // 대상폴더 삭제
|
||||
}
|
||||
}
|
||||
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그파일을 생성하는 함수
|
||||
*/
|
||||
public String createLogFile(String fileZipPath, String fileZipBakPath, int fileMakeTime, String fileNm) {
|
||||
File fileDir = new File(fileZipPath);
|
||||
if(!fileDir.exists()) {
|
||||
fileDir.mkdirs();
|
||||
}
|
||||
|
||||
// 현재 시각 중에 분을 구해온다. (minute)
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("mm");
|
||||
String _path = "";
|
||||
|
||||
Date now = new Date();
|
||||
String nowTime = formatter.format(now);
|
||||
int time = Integer.parseInt(nowTime);
|
||||
String nowT = "";
|
||||
|
||||
// 현재 분이 설정한 값의 배수인지 확인한다.
|
||||
if(time%fileMakeTime == 0){
|
||||
if(time == 0) {
|
||||
nowT = "00";
|
||||
}else{
|
||||
nowT = String.valueOf(time);
|
||||
}
|
||||
}else{
|
||||
if(time < fileMakeTime) {
|
||||
nowT = "00";
|
||||
}else{
|
||||
nowT = nowTime.substring(0, 1)+"0";
|
||||
}
|
||||
}
|
||||
|
||||
// 생성할 파일명을 설정한다.
|
||||
SimpleDateFormat fileFormatter = new SimpleDateFormat("yyyyMMddHH");
|
||||
String fileTime = fileFormatter.format(now) + nowT;
|
||||
|
||||
try {
|
||||
_path = fileZipPath+"/"+fileNm+"."+fileTime+".log";
|
||||
|
||||
// static 변수에 값을 세팅한다.
|
||||
//FILE_LOG_NAME = _path;
|
||||
|
||||
File file = new File(_path);
|
||||
|
||||
File parentDir = file.getParentFile();
|
||||
if (!parentDir.exists()) {
|
||||
parentDir.mkdirs();
|
||||
}
|
||||
|
||||
if (file.createNewFile()) {
|
||||
logger.info("{} 파일 생성 완료", _path);
|
||||
} else {
|
||||
logger.info("{} 파일 존재", _path);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return _path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일에 메세지를 쓰는 함수
|
||||
* @param msg
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeLogFile(String msg, String fileName) throws Exception{
|
||||
// File file = new File(FILE_LOG_NAME);
|
||||
File file = new File(fileName);
|
||||
|
||||
// 파일이 존재할 경우에만 실행
|
||||
if(file.exists()) {
|
||||
FileWriter fw;
|
||||
try {
|
||||
fw = new FileWriter(file, true);
|
||||
fw.write(msg);
|
||||
fw.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else {
|
||||
logger.error("{} 파일 없음, 파일명 확인 필요.", fileName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class MapUtil {
|
||||
|
||||
public static ArrayList<String> toKeyArray(Map mapData){
|
||||
Set key = mapData.keySet();
|
||||
ArrayList<String> keyArr=new ArrayList<String>();
|
||||
for (Iterator iterator = key.iterator(); iterator.hasNext();) {
|
||||
keyArr.add((String)iterator.next());
|
||||
}
|
||||
return keyArr;
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<Object> toArray(Map mapData){
|
||||
Set key = mapData.keySet();
|
||||
ArrayList<Object> dataArr=new ArrayList<Object>();
|
||||
for (Iterator iterator = key.iterator(); iterator.hasNext();) {
|
||||
// dataArr.add((String)iterator.next());
|
||||
dataArr.add(mapData.get(iterator.next()));
|
||||
}
|
||||
return dataArr;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
|
||||
import org.springframework.web.reactive.function.client.ClientRequest;
|
||||
import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
|
||||
import org.springframework.web.reactive.function.client.ExchangeStrategies;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||
import io.netty.handler.timeout.WriteTimeoutHandler;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.netty.http.client.HttpClient;
|
||||
|
||||
@Configuration
|
||||
public class WebClientConfig {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Bean
|
||||
public WebClient webClient() {
|
||||
// 기본 설정으로 생성
|
||||
HttpClient httpClient = HttpClient.create();
|
||||
|
||||
httpClient.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000);
|
||||
httpClient.doOnConnected(connection -> {
|
||||
connection.addHandlerLast(new ReadTimeoutHandler(5000, TimeUnit.MILLISECONDS));
|
||||
connection.addHandlerLast(new WriteTimeoutHandler(5000, TimeUnit.MILLISECONDS));
|
||||
});
|
||||
|
||||
//Memory 조정: 2M (default 256KB)
|
||||
ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
|
||||
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2*1024*1024))
|
||||
.build();
|
||||
|
||||
return WebClient.builder()
|
||||
.baseUrl("")
|
||||
.defaultHeader("Access-Control-Allow-Origin", "*")
|
||||
.clientConnector(new ReactorClientHttpConnector(httpClient))
|
||||
.exchangeStrategies(exchangeStrategies)
|
||||
.filter(
|
||||
(req, next) -> next.exchange(
|
||||
ClientRequest.from(req).header("from", "webclient").build()
|
||||
)
|
||||
)
|
||||
.filter(
|
||||
ExchangeFilterFunction.ofRequestProcessor(
|
||||
clientRequest -> {
|
||||
log.info(">>>>>>>>>> REQUEST <<<<<<<<<<");
|
||||
log.info("Request: {} {}", clientRequest.method(), clientRequest.url());
|
||||
clientRequest.headers().forEach(
|
||||
(name, values) -> values.forEach(value -> log.info("{} : {}", name, value))
|
||||
);
|
||||
return Mono.just(clientRequest);
|
||||
}
|
||||
)
|
||||
)
|
||||
.filter(
|
||||
ExchangeFilterFunction.ofResponseProcessor(
|
||||
clientResponse -> {
|
||||
log.info(">>>>>>>>>> RESPONSE <<<<<<<<<<");
|
||||
clientResponse.headers().asHttpHeaders().forEach((name, values) -> values.forEach(value -> log.info("{} : {}", name, value)));
|
||||
return Mono.just(clientResponse);
|
||||
}
|
||||
)
|
||||
)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -1,500 +0,0 @@
|
|||
package kr.gmtc.tss.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import kr.gmtc.tss.util.vo.NodeValue;
|
||||
|
||||
|
||||
|
||||
public class XmlParseUtil {
|
||||
|
||||
|
||||
/** Logger. */
|
||||
private static final Logger logger = LoggerFactory.getLogger(XmlParseUtil.class);
|
||||
|
||||
|
||||
|
||||
|
||||
public static Map<String,Object> parseXml(String fileDir) {
|
||||
|
||||
File file = new File(fileDir);
|
||||
if(file==null||!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
return parseXml(file);
|
||||
}
|
||||
|
||||
public static Map<String,Object> parseXml(File file) {
|
||||
// String fileDir="D:\\TEMP\\20200714\\EXCH_ROOT\\CATALOG.XML";
|
||||
Map<String,Object> map=null;
|
||||
|
||||
|
||||
if(file==null||!file.exists()) {
|
||||
return map;
|
||||
}
|
||||
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = null;
|
||||
try {
|
||||
builder = factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
|
||||
// e.printStackTrace();
|
||||
logger.error("",e);
|
||||
}
|
||||
org.w3c.dom.Document doc = null;
|
||||
try {
|
||||
doc = builder.parse(file);
|
||||
} catch (SAXException | IOException e) {
|
||||
|
||||
// e.printStackTrace();
|
||||
// logger.error("",e);
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
inputStream = new FileInputStream(file.getPath());
|
||||
} catch (FileNotFoundException e1) {
|
||||
|
||||
logger.error("",e);
|
||||
}// Your InputStream from your database.
|
||||
Reader reader = null;
|
||||
try {
|
||||
reader = new InputStreamReader(inputStream, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
|
||||
logger.error("",e);
|
||||
}
|
||||
|
||||
InputSource is = new InputSource(reader);
|
||||
is.setEncoding("UTF-8");
|
||||
try {
|
||||
doc = builder.parse(is);
|
||||
} catch (SAXException | IOException e1) {
|
||||
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
|
||||
if(doc==null) {
|
||||
return map;
|
||||
}
|
||||
|
||||
NodeList nodeList = doc.getChildNodes();
|
||||
|
||||
|
||||
map=nodeListToMap(nodeList);
|
||||
|
||||
// System.out.println(getNodeValue(map, "S-111_exchangeCatalogue/identiFier/daTe", true));
|
||||
//
|
||||
// System.out.println("content : "+getNodeTextContents(map, "S-111_exchangeCatalogue/identiFier/daTe", true));
|
||||
// System.out.println("end");
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static String checkNode(String nodePath) {
|
||||
String firstNode="";
|
||||
|
||||
if(nodePath.isEmpty()) {
|
||||
return firstNode;
|
||||
}
|
||||
|
||||
if(nodePath.indexOf("/")==0) {
|
||||
nodePath=nodePath.substring(1);
|
||||
}
|
||||
firstNode=nodePath;
|
||||
return firstNode;
|
||||
}
|
||||
|
||||
private static String getFirstNode(String nodePath) {
|
||||
String firstNode="";
|
||||
|
||||
if(nodePath.isEmpty()) {
|
||||
return firstNode;
|
||||
}
|
||||
|
||||
if(nodePath.contains("/")) {
|
||||
String [] nodeNms = nodePath.split("/");
|
||||
firstNode=nodeNms[0];
|
||||
}else {
|
||||
firstNode=nodePath;
|
||||
}
|
||||
|
||||
return firstNode;
|
||||
|
||||
}
|
||||
|
||||
public static String getFirstPath(Map<String,Object> nodeMap) {
|
||||
String firstNode="";
|
||||
|
||||
if(nodeMap.isEmpty()) {
|
||||
return firstNode;
|
||||
}
|
||||
|
||||
ArrayList<String> keyList=MapUtil.toKeyArray(nodeMap);
|
||||
|
||||
if(keyList.size()>0) {
|
||||
firstNode=keyList.get(0);
|
||||
}
|
||||
//
|
||||
|
||||
return firstNode;
|
||||
|
||||
}
|
||||
|
||||
private static String getOtherNode(String curNode,String nodePath) {
|
||||
String otherNode="";
|
||||
|
||||
if(nodePath.isEmpty()) {
|
||||
return otherNode;
|
||||
}
|
||||
|
||||
nodePath=checkNode(nodePath);
|
||||
|
||||
if(nodePath.contains("/")||nodePath.equals(curNode)) {
|
||||
otherNode= nodePath.substring(curNode.length());
|
||||
}else {
|
||||
otherNode=nodePath;
|
||||
}
|
||||
|
||||
return otherNode;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static String getMapKey(Map<String,Object> nodeMap,String curNode) {
|
||||
return getMapKey(nodeMap, curNode, true);
|
||||
}
|
||||
|
||||
|
||||
private static String getMapKey(Map<String,Object> nodeMap,String curNode,boolean noCase) {
|
||||
String mapKey="";
|
||||
|
||||
if(!noCase) {
|
||||
return curNode;
|
||||
}else {
|
||||
ArrayList<String> list=MapUtil.toKeyArray(nodeMap);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).toLowerCase().equals(curNode.toLowerCase())) {
|
||||
mapKey=list.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return mapKey;
|
||||
}
|
||||
|
||||
public static Object getNodeObject(Map<String,Object> nodeMap,String nodePath) {
|
||||
return getNodeObject(nodeMap, nodePath, true);
|
||||
}
|
||||
|
||||
public static Object getNodeObject(Map<String,Object> nodeMap,String nodePath,boolean noCase) {
|
||||
Object nodeValue = null;
|
||||
try {
|
||||
|
||||
|
||||
String checkedNodePath=checkNode(nodePath);
|
||||
|
||||
String curNode=getFirstNode(checkedNodePath);
|
||||
|
||||
String otherNode=getOtherNode(curNode,checkedNodePath);
|
||||
|
||||
if(!curNode.isEmpty()) {
|
||||
nodeValue= nodeMap.get(getMapKey(nodeMap, curNode, noCase));
|
||||
|
||||
if(nodeValue!=null) {
|
||||
// nodeValue=getNodeValue(nodeMap, checkedNodePath, noCase);
|
||||
String chkdOtherNode=checkNode(otherNode);
|
||||
if(!chkdOtherNode.isEmpty()) {
|
||||
nodeValue=getNodeObject(((NodeValue)nodeValue).getChildMap(), otherNode, noCase);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
|
||||
// e.printStackTrace();
|
||||
logger.error("",e);
|
||||
}
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static NodeValue getNodeValue(Map<String,Object> nodeMap,String nodePath) {
|
||||
return getNodeValue(nodeMap, nodePath, true);
|
||||
}
|
||||
|
||||
public static NodeValue getNodeValue(Map<String,Object> nodeMap,String nodePath,boolean noCase) {
|
||||
NodeValue nodeValue = null;
|
||||
try {
|
||||
|
||||
|
||||
String checkedNodePath=checkNode(nodePath);
|
||||
|
||||
String curNode=getFirstNode(checkedNodePath);
|
||||
|
||||
String otherNode=getOtherNode(curNode,checkedNodePath);
|
||||
|
||||
if(!curNode.isEmpty()) {
|
||||
nodeValue=(NodeValue) nodeMap.get(getMapKey(nodeMap, curNode, noCase));
|
||||
|
||||
if(nodeValue!=null) {
|
||||
// nodeValue=getNodeValue(nodeMap, checkedNodePath, noCase);
|
||||
String chkdOtherNode=checkNode(otherNode);
|
||||
if(!chkdOtherNode.isEmpty()) {
|
||||
nodeValue=getNodeValue(nodeValue.getChildMap(), otherNode, noCase);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
|
||||
// e.printStackTrace();
|
||||
logger.error("",e);
|
||||
}
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
|
||||
public static List<NodeValue> getNodeValueList(Map<String,Object> nodeMap,String nodePath) {
|
||||
return getNodeValueList(nodeMap, nodePath, true);
|
||||
}
|
||||
|
||||
|
||||
public static List<NodeValue> getNodeValueList(Map<String,Object> nodeMap,String nodePath,boolean noCase) {
|
||||
|
||||
Object nodeObj=getNodeObject(nodeMap, nodePath, noCase);
|
||||
|
||||
if(nodeObj!=null&&(nodeObj.getClass()==List.class||nodeObj.getClass()==ArrayList.class)) {
|
||||
return (List<NodeValue> )nodeObj;
|
||||
}else {
|
||||
List<NodeValue> result = new ArrayList<>();
|
||||
if(nodeObj!=null)
|
||||
result.add((NodeValue)nodeObj);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Object getNodeData(Map<String,Object> nodeMap,String nodePath,int category) {
|
||||
return getNodeData(nodeMap, nodePath, true,category);
|
||||
}
|
||||
|
||||
public static Object getNodeData(Map<String,Object> nodeMap,String nodePath,boolean noCase,int category) {
|
||||
NodeValue nodeValue=getNodeValue(nodeMap, nodePath, noCase);
|
||||
|
||||
if(nodeValue!=null) {
|
||||
//1 : text
|
||||
//2 : ns
|
||||
//3 : nodename
|
||||
//4 : nodeFullname
|
||||
//5 : ndoeAttr
|
||||
//6 : nodeChild
|
||||
switch (category) {
|
||||
case 2:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getNodeNs();
|
||||
case 3:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getNodeName();
|
||||
case 4:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getNodeFullName();
|
||||
case 5:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getAttrMap();
|
||||
case 6:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getChildMap();
|
||||
default:
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getText();
|
||||
// break;
|
||||
}
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getNodeTextContents(Map<String,Object> nodeMap,String nodePath) {
|
||||
return getNodeTextContents(nodeMap, nodePath, true);
|
||||
}
|
||||
|
||||
public static String getNodeTextContents(Map<String,Object> nodeMap,String nodePath,boolean noCase) {
|
||||
NodeValue nodeValue=getNodeValue(nodeMap, nodePath, noCase);
|
||||
|
||||
if(nodeValue!=null) {
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getText();
|
||||
}else {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getNodeNamespaceNm(Map<String,Object> nodeMap,String nodePath) {
|
||||
return getNodeNamespaceNm(nodeMap, nodePath, true);
|
||||
}
|
||||
|
||||
public static String getNodeNamespaceNm(Map<String,Object> nodeMap,String nodePath,boolean noCase) {
|
||||
NodeValue nodeValue=getNodeValue(nodeMap, nodePath, noCase);
|
||||
|
||||
if(nodeValue!=null) {
|
||||
return getNodeValue(nodeMap, nodePath, noCase).getNodeNs();
|
||||
}else {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// System.out.println("node : "+getFirstNode("/asdfzxxcvzxc/saedf/asdf"));
|
||||
// }
|
||||
|
||||
|
||||
/*public static void main(String[] args) {
|
||||
String fileDir="D:\\TEMP\\20200714\\EXCH_ROOT\\CATALOG.XML";
|
||||
|
||||
|
||||
Map<String,Object> map=parseXml(fileDir);
|
||||
|
||||
// System.out.println("content : "+getNodeTextContents(map, "S-111_exchangeCatalogue/identiFier/daTe", true));
|
||||
// System.out.println("end");
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
private static NodeValue putNodeData(Map<String,Object> map, Node node) {
|
||||
NodeValue nodeValue = new NodeValue(node.getNodeName(),node.getTextContent());
|
||||
|
||||
|
||||
if (node.hasAttributes()) {
|
||||
NamedNodeMap namedNodeMap = node.getAttributes();
|
||||
for (int j = 0; j < namedNodeMap.getLength(); j++) {
|
||||
// System.out.println("NodeNm : "+node.getNodeName()+", Name :
|
||||
// "+namedNodeMap.item(i).getNodeName()+", Value :
|
||||
// "+namedNodeMap.item(i).getNodeValue());
|
||||
nodeValue.putAttr(namedNodeMap.item(j).getNodeName(), namedNodeMap.item(j).getNodeValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(map.containsKey(nodeValue.getNodeName())) {
|
||||
Object data = map.get(nodeValue.getNodeName());
|
||||
if(data instanceof List<?>) {
|
||||
((List<NodeValue>) data).add(nodeValue);
|
||||
}else {
|
||||
List<NodeValue> valueList = new ArrayList<>();
|
||||
//기존데이터 리스트에 입력
|
||||
valueList.add((NodeValue) data);
|
||||
//현재 데이터 입력
|
||||
valueList.add(nodeValue);
|
||||
|
||||
// map.put(node.getNodeName(), valueList);
|
||||
map.put(nodeValue.getNodeName(), valueList);
|
||||
}
|
||||
}else {
|
||||
// map.put(node.getNodeName(), nodeValue);
|
||||
map.put(nodeValue.getNodeName(), nodeValue);
|
||||
}
|
||||
|
||||
|
||||
return nodeValue;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static Map<String, Object> nodeListToMap(NodeList nodeList) {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
for (int i = 0; i < nodeList.getLength(); i++) {
|
||||
Node node = nodeList.item(i);
|
||||
//#text로 잘못 생성되는 node 제거를 위함
|
||||
if("#text".equals(node.getNodeName())||"#comment".equals(node.getNodeName()))
|
||||
continue;
|
||||
|
||||
NodeValue nodeValue= putNodeData(map, node);
|
||||
|
||||
if(node.hasChildNodes()) {
|
||||
|
||||
nodeValue.setChildMap(nodeListToMap(node.getChildNodes()));
|
||||
}
|
||||
// if (x.hasChildNodes() == true) {
|
||||
// int y = 1;
|
||||
// String key = x.getNodeName();
|
||||
// String tempkey = "";
|
||||
// if (map.containsKey(key)) {
|
||||
// do {
|
||||
// y++;
|
||||
// tempkey = key + "_" + y;
|
||||
// } while (map.containsKey(tempkey) == true);
|
||||
// map.put(tempkey, x.getTextContent().trim());
|
||||
// tempkey = "";
|
||||
// } else {
|
||||
// map.put(key, x.getTextContent().trim());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Map<String,String> getAllNsOrXsiMap(Map<String,Object> nodeMap,boolean isNsMap){
|
||||
Map<String,String> nsMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
|
||||
ArrayList<String> list = MapUtil.toKeyArray(nodeMap);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(nodeMap.get(list.get(i)).getClass()!=NodeValue.class) {
|
||||
continue;
|
||||
}
|
||||
NodeValue nodeValue = (NodeValue) nodeMap.get(list.get(i));
|
||||
|
||||
if(isNsMap)
|
||||
nsMap.putAll(nodeValue.getNsMap());
|
||||
else
|
||||
nsMap.putAll(nodeValue.getXsiMap());
|
||||
|
||||
if (nodeValue.getChildMap() != null) {
|
||||
nsMap.putAll(getAllNsOrXsiMap(nodeValue.getChildMap(),isNsMap));
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return nsMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
package kr.gmtc.tss.util.vo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class NodeValue{
|
||||
|
||||
public NodeValue() {
|
||||
|
||||
}
|
||||
public NodeValue(String nodeFullName,String text) {
|
||||
|
||||
this.text=text;
|
||||
this.nodeFullName=nodeFullName;
|
||||
if(!nodeFullName.isEmpty()&&nodeFullName.contains(":")) {
|
||||
String[] nodeNmArr=nodeFullName.split(":");
|
||||
if(nodeNmArr.length>1) {
|
||||
this.nodeName=nodeNmArr[1];
|
||||
this.nodeNs=nodeNmArr[0];
|
||||
}
|
||||
}else {
|
||||
this.nodeName=nodeFullName;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
String nodeFullName;
|
||||
String nodeName;
|
||||
String nodeNs="";
|
||||
String text;
|
||||
Map<String,String> attrMap = new HashMap<>();
|
||||
Map<String,Object> childMap = new HashMap<>();
|
||||
|
||||
Map<String, String> nsMap = new HashMap<>();
|
||||
Map<String, String> xsiMap = new HashMap<>();
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
public Map<String, String> getAttrMap() {
|
||||
return attrMap;
|
||||
}
|
||||
|
||||
public String getAttrMapValue(String key) {
|
||||
return attrMap.get(key);
|
||||
}
|
||||
|
||||
|
||||
public void setAttrMap(Map<String, String> attrMap) {
|
||||
this.attrMap = attrMap;
|
||||
}
|
||||
|
||||
public void putAttr(String key,String data) {
|
||||
|
||||
if(key.contains("xmlns:")) {
|
||||
String [] keyVal = key.split(":");
|
||||
try {
|
||||
nsMap.put(keyVal[1], data);
|
||||
} catch (NullPointerException e) {
|
||||
nsMap.put(key, data);
|
||||
}
|
||||
|
||||
}else if(key.contains("xsi:")) {
|
||||
String [] keyVal = key.split(":");
|
||||
try {
|
||||
xsiMap.put(keyVal[1], data);
|
||||
} catch (NullPointerException e) {
|
||||
xsiMap.put(key, data);
|
||||
}
|
||||
}else {
|
||||
attrMap.put(key, data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Map<String, Object> getChildMap() {
|
||||
return childMap;
|
||||
}
|
||||
public void setChildMap(Map<String, Object> childMap) {
|
||||
this.childMap = childMap;
|
||||
}
|
||||
|
||||
public void putChildMap(String key,Object data) {
|
||||
childMap.put(key, data);
|
||||
}
|
||||
|
||||
|
||||
public String getNsMapValue(String key) {
|
||||
return nsMap.get(key);
|
||||
}
|
||||
public Map<String, String> getNsMap() {
|
||||
return nsMap;
|
||||
}
|
||||
public void setNsMap(Map<String, String> nsMap) {
|
||||
this.nsMap = nsMap;
|
||||
}
|
||||
|
||||
|
||||
public String getXsiMapValue(String key) {
|
||||
return xsiMap.get(key);
|
||||
}
|
||||
public Map<String, String> getXsiMap() {
|
||||
return xsiMap;
|
||||
}
|
||||
public void setXsiMap(Map<String, String> xsiMap) {
|
||||
this.xsiMap = xsiMap;
|
||||
}
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
public String getNodeNs() {
|
||||
return nodeNs;
|
||||
}
|
||||
public void setNodeNs(String nodeNs) {
|
||||
this.nodeNs = nodeNs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getNodeFullName() {
|
||||
return nodeFullName;
|
||||
}
|
||||
public void setNodeFullName(String nodeFullName) {
|
||||
this.nodeFullName = nodeFullName;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NodeValue [nodeName=" + nodeName + ", nodeNs=" + nodeNs + ", text=" + text + ", attrMap=" + attrMap
|
||||
+ ", childMap=" + childMap + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
server:
|
||||
port: 8090
|
||||
|
||||
spring:
|
||||
#main:
|
||||
#web-application-type: none
|
||||
db:
|
||||
#db-type:oracle,mariadb(other - coding more!)
|
||||
#db-type: oracle
|
||||
batch-insert-size: 1000
|
||||
datasource:
|
||||
# driver-class-name: oracle.jdbc.driver.OracleDriver
|
||||
# jdbc-url: jdbc:oracle:thin:@192.168.4.106:1521:GMTDB
|
||||
driver-class-name: com.tmax.tibero.jdbc.TbDriver
|
||||
jdbc-url: jdbc:tibero:thin:@118.220.143.174:18629:SACP_T_DB
|
||||
username: UIC
|
||||
password: UIC
|
||||
connectionTimeout: 5000
|
||||
maxLifetime: 30000
|
||||
|
||||
|
||||
client:
|
||||
server:
|
||||
ip: 127.0.0.1
|
||||
port: 8030
|
||||
reconn-time-sec: 5
|
||||
queue-count: 1000000
|
||||
|
||||
selep-time-ms:
|
||||
parse-target: 50
|
||||
target-manage: 1
|
||||
data-insert: 50
|
||||
sql-logger: 50
|
||||
|
||||
|
||||
dynamic-dedupl:
|
||||
set-size: 50000
|
||||
set-remove-unit-size: 5000
|
||||
|
||||
|
||||
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 * * * *
|
||||
# 스레드 상태 체크 스케줄러
|
||||
status-check-cron: 0/10 * * * * *
|
||||
|
||||
|
||||
flag:
|
||||
database: false
|
||||
datafile: true #logstash data log file
|
||||
file: false #rest api log file
|
||||
|
||||
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
|
||||
|
||||
|
||||
kafka:
|
||||
bootstrapServers: http://118.220.143.175:9091,http://118.220.143.176:9091,http://118.220.143.176:9092
|
||||
topic: ai.analyze.location
|
||||
|
||||
classification: 1 #이중화되어 있는 서버의 Index
|
||||
swclassification: 2 #sw구분 (ai_location)
|
||||
logclassification: 1 #log구분
|
||||
|
||||
state:
|
||||
# 공통코드 CT001의 코드 6자리
|
||||
id: AI0202 # 영상메타데이터저장(위치정보)
|
||||
# 1:Primary, 2:Secondary
|
||||
type: Primary
|
|
@ -1,5 +0,0 @@
|
|||
______ ____ ____
|
||||
/_ __/ / __/ / __/
|
||||
/ / _\ \ _\ \
|
||||
/_/ /___/ /___/
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
|
||||
|
||||
log4jdbc.dump.sql.maxlinelength=0
|
|
@ -1,84 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?> <!-- 60초마다 설정 파일의 변경을 확인 하여 변경시 갱신 -->
|
||||
<configuration scan="true" scanPeriod="60 seconds"> <!--springProfile 태그를 사용하면 logback 설정파일에서 복수개의 프로파일을 설정할 수 있다. -->
|
||||
<springProperty scope="context" name="LOG_LEVEL" source="logging.level.root" /> <!-- log file path -->
|
||||
<property name="LOG_PATH" value="./logs" /> <!-- log file name -->
|
||||
<property name="LOG_FILE_NAME" value="tss_pg" /> <!-- err log file name -->
|
||||
<property name="LOG_PATTERN" value="%-5level %d{yy-MM-dd HH:mm:ss}[%thread][%logger{0}:%line]-%msg%n" /> <!-- Console Appender -->
|
||||
<property name="SQL_LOG_PATH" value="./logs/sql" />
|
||||
<property name="SQL_LOG_FILE_NAME" value="sql" />
|
||||
|
||||
<property name="FILE_LOG_PATH" value="./logs/file" />
|
||||
<property name="FILE_LOG_FILE_NAME" value="file" />
|
||||
|
||||
<!--콘솔에 로그를 남깁니다. -->
|
||||
<appender name="Console"
|
||||
class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder
|
||||
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${LOG_PATTERN}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--파일에 로그를 남깁니다. -->
|
||||
<appender name="File"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/${LOG_FILE_NAME}.log</file>
|
||||
<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">
|
||||
<fileNamePattern>${LOG_PATH}/${LOG_FILE_NAME}.%d{yyyy-MM-dd}.log
|
||||
</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
|
||||
<!--파일에 로그를 남깁니다. -->
|
||||
<appender name="SQL"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- <file>${SQL_LOG_PATH}/${SQL_LOG_FILE_NAME}.log</file> -->
|
||||
<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">
|
||||
<fileNamePattern>${SQL_LOG_PATH}/${SQL_LOG_FILE_NAME}.%d{yyyy-MM-dd}.log
|
||||
</fileNamePattern>
|
||||
<!-- <maxHistory>30</maxHistory> -->
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<logger name="jdbc" level="OFF"/>
|
||||
<logger name="jdbc.sqlonly" level="ERROR"/>
|
||||
<logger name="jdbc.sqltiming" level="ERROR"/>
|
||||
<logger name="jdbc.audit" level="OFF"/>
|
||||
<logger name="jdbc.resultset" level="OFF"/>
|
||||
<logger name="jdbc.resultsettable" level="ERROR"/>
|
||||
<logger name="jdbc.connection" level="OFF"/>
|
||||
<logger name="System.out" level="OFF"/>
|
||||
|
||||
|
||||
<logger name="kr.gmtc.tss" level="INFO" additivity="false">
|
||||
<appender-ref ref="Console" />
|
||||
<appender-ref ref="File" />
|
||||
</logger>
|
||||
|
||||
<logger name="kr.gmtc.tss.sqllog" level="INFO" additivity="false">
|
||||
<appender-ref ref="SQL" />
|
||||
</logger>
|
||||
|
||||
<!-- DEBUG 레벨 로그를 Console, File, RollingFile에 남깁니다. ERROR 인 경우 wds-error.log에 남깁니다. -->
|
||||
<!-- <root level="${LOG_LEVEL}"> -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="Console" />
|
||||
<appender-ref ref="File" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<settings>
|
||||
<setting name="cacheEnabled" value="false"/>
|
||||
<setting name="lazyLoadingEnabled" value="true"/>
|
||||
<setting name="multipleResultSetsEnabled" value="true"/>
|
||||
<setting name="useColumnLabel" value="true"/>
|
||||
<setting name="defaultStatementTimeout" value="25000"/>
|
||||
<setting name="defaultExecutorType" value="BATCH"/>
|
||||
</settings>
|
||||
<!-- <mappers> -->
|
||||
<!-- <mapper resource="kr/gmtc/eyesvtss/mapper/batchMapper.xml"/> -->
|
||||
<!-- </mappers> -->
|
||||
</configuration>
|
|
@ -1,35 +0,0 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
/bin
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/logs/
|
Binary file not shown.
|
@ -1,2 +0,0 @@
|
|||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue