main
MonHun 2024-06-29 12:07:25 +09:00
parent 33db750355
commit ceab861975
8 changed files with 312 additions and 35 deletions

View File

@ -37,6 +37,12 @@
<version>3.0.0</version> <version>3.0.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency> <dependency>
<groupId>kr.gmt.so</groupId> <groupId>kr.gmt.so</groupId>
<artifactId>state-spring-boot-starter</artifactId> <artifactId>state-spring-boot-starter</artifactId>

View File

@ -28,6 +28,7 @@ import kr.gmtc.gw.comp.thread.CustomThread;
import kr.gmtc.gw.eyegw.config.ServiceConfig; import kr.gmtc.gw.eyegw.config.ServiceConfig;
import kr.gmtc.gw.eyegw.db1.EaiIfCheckService; import kr.gmtc.gw.eyegw.db1.EaiIfCheckService;
import kr.gmtc.gw.eyegw.db1.EaiProcService; import kr.gmtc.gw.eyegw.db1.EaiProcService;
import kr.gmtc.gw.eyegw.satats.IntrfcRecvStatsManager;
@Component("controller") @Component("controller")
public class MainController implements ApplicationListener<ContextClosedEvent> { public class MainController implements ApplicationListener<ContextClosedEvent> {
@ -83,6 +84,8 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
private boolean swBeforeStatus = true; private boolean swBeforeStatus = true;
private IntrfcRecvStatsManager recvStatsMgr;
/** 초기화 실패 시 프로그램 종료 */ /** 초기화 실패 시 프로그램 종료 */
// private void systemError() { // private void systemError() {
// // logger.writeLevelLog("-- FAIL TO STARTUP --", LogLevelType.LOG_ERROR, "AllLog"); // // logger.writeLevelLog("-- FAIL TO STARTUP --", LogLevelType.LOG_ERROR, "AllLog");
@ -110,6 +113,8 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
public void initialize() { public void initialize() {
try { try {
recvStatsMgr = new IntrfcRecvStatsManager();
// 업무 스래드(프로시저 호출) // 업무 스래드(프로시저 호출)
listCustomThreads = new ArrayList<CustomThread>(); listCustomThreads = new ArrayList<CustomThread>();
@ -238,11 +243,21 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
if( Integer.parseInt(sCnt) > 0 ) { if( Integer.parseInt(sCnt) > 0 ) {
LocalDateTime dt_before = LocalDateTime.now(); LocalDateTime dt_before = LocalDateTime.now();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("ar_dt", "%");
paramMap.put("ret_minDt", "");
paramMap.put("ret_procCnt", 0);
eaiProcService.callProcArtsArr(); //DB 프로시져 Call
eaiProcService.callProcArtsArr(paramMap);
Duration diff = Duration.between(dt_before, LocalDateTime.now()); Duration diff = Duration.between(dt_before, LocalDateTime.now());
logger.info("callProcArtsArr Call " + sCnt + "건 " + diff.toMillis() + "msec"); logger.info("callProcArtsArr Call " + sCnt + "건 " + diff.toMillis() + "msec");
// 수신(처리) 건수 집계 -> ELK전송용
recvStatsMgr.writeStatsLog_KST((String) paramMap.get("ret_minDt"), "103", "ARTS_ARR", (int) paramMap.get("ret_procCnt"), 0);
} }
// Thread.sleep(3000); // Thread.sleep(3000);
@ -261,10 +276,19 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
LocalDateTime dt_before = LocalDateTime.now(); LocalDateTime dt_before = LocalDateTime.now();
eaiProcService.callProcArtsDep(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("ar_dt", "%");
paramMap.put("ret_minDt", "");
paramMap.put("ret_procCnt", 0);
eaiProcService.callProcArtsDep(paramMap);
Duration diff = Duration.between(dt_before, LocalDateTime.now()); Duration diff = Duration.between(dt_before, LocalDateTime.now());
logger.info("callProcArtsDep Call " + sCnt + "건 " + diff.toMillis() + "msec"); logger.info("callProcArtsDep Call " + sCnt + "건 " + diff.toMillis() + "msec");
// 수신(처리) 건수 집계 -> ELK전송용
recvStatsMgr.writeStatsLog_KST((String) paramMap.get("ret_minDt"), "104", "ARTS_DEP", (int) paramMap.get("ret_procCnt"), 0);
} }
@ -284,10 +308,19 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
LocalDateTime dt_before = LocalDateTime.now(); LocalDateTime dt_before = LocalDateTime.now();
eaiProcService.callProcAcdmArr(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("ar_dt", "%");
paramMap.put("ret_minDt", "");
paramMap.put("ret_procCnt", 0);
eaiProcService.callProcAcdmArr(paramMap);
Duration diff = Duration.between(dt_before, LocalDateTime.now()); Duration diff = Duration.between(dt_before, LocalDateTime.now());
logger.info("callProcAcdmArr Call " + sCnt + "건 " + diff.toMillis() + "msec"); logger.info("callProcAcdmArr Call " + sCnt + "건 " + diff.toMillis() + "msec");
// 수신(처리) 건수 집계 -> ELK전송용
recvStatsMgr.writeStatsLog_KST((String) paramMap.get("ret_minDt"), "101", "ACDM_ARR", (int) paramMap.get("ret_procCnt"), 0);
} }
// Thread.sleep(3000); // Thread.sleep(3000);
@ -305,10 +338,19 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
LocalDateTime dt_before = LocalDateTime.now(); LocalDateTime dt_before = LocalDateTime.now();
eaiProcService.callProcAcdmDep(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("ar_dt", "%");
paramMap.put("ret_minDt", "");
paramMap.put("ret_procCnt", 0);
eaiProcService.callProcAcdmDep(paramMap);
Duration diff = Duration.between(dt_before, LocalDateTime.now()); Duration diff = Duration.between(dt_before, LocalDateTime.now());
logger.info("callProcAcdmDep Call " + sCnt + "건 " + diff.toMillis() + "msec"); logger.info("callProcAcdmDep Call " + sCnt + "건 " + diff.toMillis() + "msec");
// 수신(처리) 건수 집계 -> ELK전송용
recvStatsMgr.writeStatsLog_KST((String) paramMap.get("ret_minDt"), "102", "ACDM_DEP", (int) paramMap.get("ret_procCnt"), 0);
} }
// Thread.sleep(3000); // Thread.sleep(3000);
@ -326,10 +368,19 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
LocalDateTime dt_before = LocalDateTime.now(); LocalDateTime dt_before = LocalDateTime.now();
eaiProcService.callProcGam(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("ar_dt", "%");
paramMap.put("ret_minDt", "");
paramMap.put("ret_procCnt", 0);
eaiProcService.callProcGam(paramMap);
Duration diff = Duration.between(dt_before, LocalDateTime.now()); Duration diff = Duration.between(dt_before, LocalDateTime.now());
logger.info("callProcGam Call " + sCnt + "건 " + diff.toMillis() + "msec"); logger.info("callProcGam Call " + sCnt + "건 " + diff.toMillis() + "msec");
// 수신(처리) 건수 집계 -> ELK전송용
recvStatsMgr.writeStatsLog_KST((String) paramMap.get("ret_minDt"), "105", "GAM", (int) paramMap.get("ret_procCnt"), 0);
} }
// Thread.sleep(3000); // Thread.sleep(3000);
@ -348,10 +399,19 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
LocalDateTime dt_before = LocalDateTime.now(); LocalDateTime dt_before = LocalDateTime.now();
eaiProcService.callProcAmos(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("ar_dt", "%");
paramMap.put("ret_minDt", "");
paramMap.put("ret_procCnt", 0);
eaiProcService.callProcAmos(paramMap);
Duration diff = Duration.between(dt_before, LocalDateTime.now()); Duration diff = Duration.between(dt_before, LocalDateTime.now());
logger.info("callProcAmos Call " + sCnt + "건 " + diff.toMillis() + "msec"); logger.info("callProcAmos Call " + sCnt + "건 " + diff.toMillis() + "msec");
// 수신(처리) 건수 집계 -> ELK전송용
recvStatsMgr.writeStatsLog_KST((String) paramMap.get("ret_minDt"), "106", "AMOS", (int) paramMap.get("ret_procCnt"), 0);
} }
// Thread.sleep(3000); // Thread.sleep(3000);
@ -369,10 +429,19 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
LocalDateTime dt_before = LocalDateTime.now(); LocalDateTime dt_before = LocalDateTime.now();
eaiProcService.callProcNotam(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("ar_dt", "%");
paramMap.put("ret_minDt", "");
paramMap.put("ret_procCnt", 0);
eaiProcService.callProcNotam(paramMap);
Duration diff = Duration.between(dt_before, LocalDateTime.now()); Duration diff = Duration.between(dt_before, LocalDateTime.now());
logger.info("callProcNotam Call " + sCnt + "건 " + diff.toMillis() + "msec"); logger.info("callProcNotam Call " + sCnt + "건 " + diff.toMillis() + "msec");
// 수신(처리) 건수 집계 -> ELK전송용
recvStatsMgr.writeStatsLog_KST((String) paramMap.get("ret_minDt"), "107", "NOTAM", (int) paramMap.get("ret_procCnt"), 0);
} }
// Thread.sleep(3000); // Thread.sleep(3000);

View File

@ -1,16 +1,19 @@
package kr.gmtc.gw.eyegw.db1; package kr.gmtc.gw.eyegw.db1;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface EaiProcMapper { public interface EaiProcMapper {
void callProcArtsArr(); void callProcArtsArr(Map<String, Object> parameterMap);
void callProcArtsDep(); void callProcArtsDep(Map<String, Object> parameterMap);
void callProcAcdmArr(); void callProcAcdmArr(Map<String, Object> parameterMap);
void callProcAcdmDep(); void callProcAcdmDep(Map<String, Object> parameterMap);
void callProcGam(); void callProcGam(Map<String, Object> parameterMap);
void callProcAmos(); void callProcAmos(Map<String, Object> parameterMap);
void callProcNotam(); void callProcNotam(Map<String, Object> parameterMap);
void callProcAll(Map<String, Object> parameterMap);
} }

View File

@ -1,5 +1,7 @@
package kr.gmtc.gw.eyegw.db1; package kr.gmtc.gw.eyegw.db1;
import java.util.Map;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
@ -10,45 +12,51 @@ public class EaiProcService {
this.ueaiProcMapper = ueaiProcMapper; this.ueaiProcMapper = ueaiProcMapper;
} }
public void callProcArtsArr() { public void callProcArtsArr(Map<String, Object> parameterMap) {
ueaiProcMapper.callProcArtsArr(); ueaiProcMapper.callProcArtsArr(parameterMap);
} }
public void callProcArtsDep() { public void callProcArtsDep(Map<String, Object> parameterMap) {
ueaiProcMapper.callProcArtsDep(); ueaiProcMapper.callProcArtsDep(parameterMap);
} }
public void callProcAcdmArr() { public void callProcAcdmArr(Map<String, Object> parameterMap) {
ueaiProcMapper.callProcAcdmArr(); ueaiProcMapper.callProcAcdmArr(parameterMap);
} }
public void callProcAcdmDep() { public void callProcAcdmDep(Map<String, Object> parameterMap) {
ueaiProcMapper.callProcAcdmDep(); ueaiProcMapper.callProcAcdmDep(parameterMap);
} }
public void callProcGam() { public void callProcGam(Map<String, Object> parameterMap) {
ueaiProcMapper.callProcGam(); ueaiProcMapper.callProcGam(parameterMap);
} }
public void callProcAmos() { public void callProcAmos(Map<String, Object> parameterMap) {
ueaiProcMapper.callProcAmos(); ueaiProcMapper.callProcAmos(parameterMap);
} }
public void callProcNotam() { public void callProcNotam(Map<String, Object> parameterMap) {
ueaiProcMapper.callProcNotam(); ueaiProcMapper.callProcNotam(parameterMap);
}
public void callProcAll(Map<String, Object> parameterMap) {
ueaiProcMapper.callProcAll(parameterMap);
} }

View File

@ -0,0 +1,116 @@
package kr.gmtc.gw.eyegw.satats;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class IntrfcRecvStatsManager {
private Logger logger = LoggerFactory.getLogger("STATS");
ObjectMapper mapper = new ObjectMapper();
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
DateFormat cnvDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
public IntrfcRecvStatsManager(){
}
public void writeStatsLog_KST(String strRecvDate, String strIntrfcId, String strIntrfcNm, int iRecvCo, int iParseCo){
IntrfcRecvStatsVO stsVO = new IntrfcRecvStatsVO();
stsVO.setIntrfc_dt(strRecvDate);
stsVO.setIntrfc_id(strIntrfcId);
stsVO.setIntrfc_nm(strIntrfcNm);
stsVO.setRecv_co(iRecvCo);
stsVO.setParse_co(iParseCo);
String cnvJsonString = "";
try {
cnvJsonString = mapper.writeValueAsString(stsVO);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
logger.info(cnvJsonString);
}
public void writeStatsLog(String strRecvDate, String strIntrfcId, String strIntrfcNm, int iRecvCo, int iParseCo){
IntrfcRecvStatsVO stsVO = new IntrfcRecvStatsVO();
String strCnvDate = convertDate(strRecvDate);
stsVO.setIntrfc_dt(strCnvDate);
stsVO.setIntrfc_id(strIntrfcId);
stsVO.setIntrfc_nm(strIntrfcNm);
stsVO.setRecv_co(iRecvCo);
stsVO.setParse_co(iParseCo);
String cnvJsonString = "";
try {
cnvJsonString = mapper.writeValueAsString(stsVO);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
logger.info(cnvJsonString);
}
private String convertDate(String p_strDate){
String strCnvDate = "";
DateFormat df;
Calendar cal = Calendar.getInstance();
if(p_strDate == null || p_strDate.equals("")){
strCnvDate = dateFormat.format(new Date());
}else{
// 1. 포멧 변경
// 2. UTC -> KST
if(p_strDate.length() > 18 ){
df = cnvDateFormat;
}else{
df = dateFormat;
}
Date cnvDate = null;
try {
cnvDate = df.parse(p_strDate);
} catch (ParseException e) {
e.printStackTrace();
}
cal.setTime(cnvDate);
cal.add(Calendar.HOUR_OF_DAY, 9);
cnvDate = new Date(cal.getTimeInMillis());
strCnvDate = dateFormat.format(cnvDate);
}
return strCnvDate;
}
}

View File

@ -0,0 +1,16 @@
package kr.gmtc.gw.eyegw.satats;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class IntrfcRecvStatsVO {
private String intrfc_dt;
private String intrfc_id;
private String intrfc_nm;
private int recv_co;
private int parse_co;
}

View File

@ -100,6 +100,19 @@
<!-- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ --> <!-- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -->
<appender name="Ststs_file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}${file.separator}STATS${file.separator}stats.log</file>
<encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}${file.separator}STATS${file.separator}stats.%d{yyyy-MM-dd}.log
</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>
<!-- 로그 전역 세팅 --> <!-- 로그 전역 세팅 -->
<!-- <root level="${LOG_LEVEL}"> <!-- <root level="${LOG_LEVEL}">
<appender-ref ref="CONSOLE"/> <appender-ref ref="CONSOLE"/>
@ -111,6 +124,11 @@
<appender-ref ref="FILE"/> <appender-ref ref="FILE"/>
</logger> </logger>
<logger name="STATS" level="INFO">
<!-- <appender-ref ref="CONSOLE"/> -->
<appender-ref ref="Ststs_file"/>
</logger>
<!-- <!--
<logger name="kr.gmt.so" level="INFO"> <logger name="kr.gmt.so" level="INFO">
<appender-ref ref="CONSOLE"/> <appender-ref ref="CONSOLE"/>

View File

@ -4,43 +4,84 @@
<select id="callProcAmos" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap"> <select id="callProcAmos" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap">
<![CDATA[ <![CDATA[
call PROC_EAI_INTRFC_AMOS() call PROC_EAI_INTRFC_AMOS_NEW(
#{ar_dt, mode=IN, jdbcType=VARCHAR}
,#{ret_minDt, mode=OUT, jdbcType=VARCHAR}
,#{ret_procCnt, mode=OUT, jdbcType=INTEGER}
)
]]> ]]>
</select> </select>
<select id="callProcNotam" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap"> <select id="callProcNotam" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap">
<![CDATA[ <![CDATA[
call PROC_EAI_INTRFC_AFTNFLTINFO_RCV() call PROC_EAI_INTRFC_AFTNFLTINFO_RCV_NEW(
#{ar_dt, mode=IN, jdbcType=VARCHAR}
,#{ret_minDt, mode=OUT, jdbcType=VARCHAR}
,#{ret_procCnt, mode=OUT, jdbcType=INTEGER}
)
]]> ]]>
</select> </select>
<select id="callProcArtsArr" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap"> <select id="callProcArtsArr" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap">
<![CDATA[ <![CDATA[
call PROC_EAI_INTRFC_ARTS_ARR() call PROC_EAI_INTRFC_ARTS_ARR_NEW(
#{ar_dt, mode=IN, jdbcType=VARCHAR}
,#{ret_minDt, mode=OUT, jdbcType=VARCHAR}
,#{ret_procCnt, mode=OUT, jdbcType=INTEGER}
)
]]> ]]>
</select> </select>
<select id="callProcArtsDep" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap"> <select id="callProcArtsDep" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap">
<![CDATA[ <![CDATA[
call PROC_EAI_INTRFC_ARTS_DEP() call PROC_EAI_INTRFC_ARTS_DEP_NEW(
#{ar_dt, mode=IN, jdbcType=VARCHAR}
,#{ret_minDt, mode=OUT, jdbcType=VARCHAR}
,#{ret_procCnt, mode=OUT, jdbcType=INTEGER}
)
]]> ]]>
</select> </select>
<select id="callProcAcdmArr" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap"> <select id="callProcAcdmArr" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap">
<![CDATA[ <![CDATA[
call PROC_EAI_INTRFC_ACDM_ARR() call PROC_EAI_INTRFC_ACDM_ARR_NEW(
#{ar_dt, mode=IN, jdbcType=VARCHAR}
,#{ret_minDt, mode=OUT, jdbcType=VARCHAR}
,#{ret_procCnt, mode=OUT, jdbcType=INTEGER}
)
]]> ]]>
</select> </select>
<select id="callProcAcdmDep" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap"> <select id="callProcAcdmDep" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap">
<![CDATA[ <![CDATA[
call PROC_EAI_INTRFC_ACDM_DEP() call PROC_EAI_INTRFC_ACDM_DEP_NEW(
#{ar_dt, mode=IN, jdbcType=VARCHAR}
,#{ret_minDt, mode=OUT, jdbcType=VARCHAR}
,#{ret_procCnt, mode=OUT, jdbcType=INTEGER}
)
]]> ]]>
</select> </select>
<select id="callProcGam" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap"> <select id="callProcGam" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap">
<![CDATA[ <![CDATA[
call PROC_EAI_INTRFC_GAM() call PROC_EAI_INTRFC_GAM_NEW(
#{ar_dt, mode=IN, jdbcType=VARCHAR}
,#{ret_minDt, mode=OUT, jdbcType=VARCHAR}
,#{ret_procCnt, mode=OUT, jdbcType=INTEGER}
)
]]>
</select>
<select id="callProcAll" parameterType="hashmap" statementType="CALLABLE" resultType="hashmap">
<![CDATA[
call PROC_EAI_INTRFC_ALL(
#{ret_minDt, mode=OUT, jdbcType=VARCHAR}
,#{ret_arts_arr_cnt, mode=OUT, jdbcType=INTEGER}
,#{ret_arts_dep_cnt, mode=OUT, jdbcType=INTEGER}
,#{ret_acdm_arr_cnt, mode=OUT, jdbcType=INTEGER}
,#{ret_acdm_dep_cnt, mode=OUT, jdbcType=INTEGER}
,#{ret_gam_cnt, mode=OUT, jdbcType=INTEGER}
)
]]> ]]>
</select> </select>