|
|
@@ -26,6 +26,9 @@ public class UticPtisServerService implements AbstractProcessService {
|
|
|
private final String INCD_ID = "IF_POL_MPSS_001";
|
|
|
private final String EVNT_ID = "IF_POL_MPSS_002";
|
|
|
private final String TRAF_ID = "IF_POL_MPSS_003";
|
|
|
+ private final String INCD_INFO = "돌발정보";
|
|
|
+ private final String EVNT_INFO = "통제정보";
|
|
|
+ private final String TRAF_INFO = "소통정보";
|
|
|
private final String agency = "도로교통공단";
|
|
|
private final String period = "5분";
|
|
|
private final ApplicationRepository applicationRepository;
|
|
|
@@ -34,9 +37,9 @@ public class UticPtisServerService implements AbstractProcessService {
|
|
|
void destroy() {
|
|
|
log.info("UticPtisServerService.destroy: start.");
|
|
|
// 프로그램 종료시 통계정보를 최종적으로 저장(내일 날짜로 저장됨)
|
|
|
- this.repo.mergeIndigoStats(this.INCD_ID, this.agency, "돌발정보", this.period, String.valueOf(ApplicationRepository.indigoStats.getIncdCnt()));
|
|
|
- this.repo.mergeIndigoStats(this.EVNT_ID, this.agency, "통제정보", this.period, String.valueOf(ApplicationRepository.indigoStats.getEvntCnt()));
|
|
|
- this.repo.mergeIndigoStats(this.TRAF_ID, this.agency, "소통정보", this.period, String.valueOf(ApplicationRepository.indigoStats.getTrafCnt()));
|
|
|
+// this.repo.mergeIndigoStats(this.INCD_ID, this.agency, this.INCD_INFO, this.period, String.valueOf(ApplicationRepository.indigoStats.getIncdCnt()));
|
|
|
+// this.repo.mergeIndigoStats(this.EVNT_ID, this.agency, this.EVNT_INFO, this.period, String.valueOf(ApplicationRepository.indigoStats.getEvntCnt()));
|
|
|
+// this.repo.mergeIndigoStats(this.TRAF_ID, this.agency, this.TRAF_INFO, this.period, String.valueOf(ApplicationRepository.indigoStats.getTrafCnt()));
|
|
|
|
|
|
log.info("UticPtisServerService.destroy: end.");
|
|
|
}
|
|
|
@@ -65,26 +68,6 @@ public class UticPtisServerService implements AbstractProcessService {
|
|
|
}
|
|
|
ApplicationRepository.lastRegDate.setIncdDt(result);
|
|
|
log.info("[INIT....] {}: Last registration date. {}", LogUtils.elapsedLog("LAST_REG_DATE"), ApplicationRepository.lastRegDate);
|
|
|
-
|
|
|
- // 초기화시 indigoStats 통계정보를 데이터베이스에서 조회하여 조치과 시킨다.(내일 날짜로 조회한다)
|
|
|
- List<IndigoStatsDataDto> indigoStats = this.repo.findAllIndigoStats();
|
|
|
- if (indigoStats != null) {
|
|
|
- for (IndigoStatsDataDto stats : indigoStats) {
|
|
|
- switch (stats.getIfId()) {
|
|
|
- case INCD_ID:
|
|
|
- ApplicationRepository.indigoStats.setIncdCnt(stats.getCountSnd());
|
|
|
- break;
|
|
|
- case EVNT_ID:
|
|
|
- ApplicationRepository.indigoStats.setEvntCnt(stats.getCountSnd());
|
|
|
- break;
|
|
|
- case TRAF_ID:
|
|
|
- ApplicationRepository.indigoStats.setTrafCnt(stats.getCountSnd());
|
|
|
- break;
|
|
|
- default:
|
|
|
- log.warn("[INIT....] {}: Unknown IF_ID: {}", LogUtils.elapsedLog("initialize.findAllIndigoStats"), stats.getIfId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
return true;
|
|
|
} catch (Exception e) {
|
|
|
log.error("[INIT....] {}: Exception: {}", LogUtils.elapsedLog("initialize.findLastRegDate"), e.getMessage());
|
|
|
@@ -97,18 +80,49 @@ public class UticPtisServerService implements AbstractProcessService {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- @ProcessingElapsed(type="01DAY", name="1-Day Processing")
|
|
|
- public void processDay() {
|
|
|
- // 일작업 수행, 프로그램 최초 기동할때 첫번째 가공은 항상 일작업을 처리하게 됨.
|
|
|
- log.info("[01DAY...] {}: Traf: {}, Event: {}, Incident: {}.", LogUtils.elapsedLog("Day Statistics"),
|
|
|
- ApplicationRepository.indigoStats.getTrafCnt(), ApplicationRepository.indigoStats.getEvntCnt(), ApplicationRepository.indigoStats.getIncdCnt());
|
|
|
+ @ProcessingElapsed(type="05MIN", name="INDIGO Processing(SEL)")
|
|
|
+ public void initIndigoStats() {
|
|
|
+
|
|
|
+ // 작업 시작시 indigoStats 통계정보를 데이터베이스에서 조회하여 이전 정보를 읽어온다.(내일 날짜로 조회한다)
|
|
|
+ ApplicationRepository.indigoStats.reset(); // 통계정보 초기화
|
|
|
+ List<IndigoStatsDataDto> indigoStats = this.repo.findAllIndigoStats();
|
|
|
+ if (indigoStats != null) {
|
|
|
+ for (IndigoStatsDataDto stats : indigoStats) {
|
|
|
+ switch (stats.getIfId()) {
|
|
|
+ case INCD_ID:
|
|
|
+ ApplicationRepository.indigoStats.setIncdCnt(stats.getCountSnd());
|
|
|
+ break;
|
|
|
+ case EVNT_ID:
|
|
|
+ ApplicationRepository.indigoStats.setEvntCnt(stats.getCountSnd());
|
|
|
+ break;
|
|
|
+ case TRAF_ID:
|
|
|
+ ApplicationRepository.indigoStats.setTrafCnt(stats.getCountSnd());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ log.warn("[INIT....] {}: Unknown IF_ID: {}", LogUtils.elapsedLog("initialize.findAllIndigoStats"), stats.getIfId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ printIndigoStats();
|
|
|
+ }
|
|
|
|
|
|
+ private void printIndigoStats() {
|
|
|
+ log.info("[05MIN...] {}: TRAF: {}, EVNT: {}, INCD: {}",
|
|
|
+ LogUtils.elapsedLog("INDIGO_STATUS"),
|
|
|
+ ApplicationRepository.indigoStats.getTrafCnt(),
|
|
|
+ ApplicationRepository.indigoStats.getEvntCnt(),
|
|
|
+ ApplicationRepository.indigoStats.getIncdCnt());
|
|
|
+ }
|
|
|
+ @ProcessingElapsed(type="05MIN", name="INDIGO Processing(INS)")
|
|
|
+ public void insIndigoStats() {
|
|
|
+ // 통계정보를 매 작업주기마다 업데이트 하고 작업전에 조회해서 처리하도록 수정함.
|
|
|
try {
|
|
|
- this.repo.insertIndigoStats(this.INCD_ID, this.agency, "돌발정보", this.period, String.valueOf(ApplicationRepository.indigoStats.getIncdCnt()));
|
|
|
- this.repo.insertIndigoStats(this.EVNT_ID, this.agency, "통제정보", this.period, String.valueOf(ApplicationRepository.indigoStats.getEvntCnt()));
|
|
|
- this.repo.insertIndigoStats(this.TRAF_ID, this.agency, "소통정보", this.period, String.valueOf(ApplicationRepository.indigoStats.getTrafCnt()));
|
|
|
+ this.repo.insertIndigoStats(this.INCD_ID, this.agency, this.INCD_INFO, this.period, String.valueOf(ApplicationRepository.indigoStats.getIncdCnt()));
|
|
|
+ this.repo.insertIndigoStats(this.EVNT_ID, this.agency, this.EVNT_INFO, this.period, String.valueOf(ApplicationRepository.indigoStats.getEvntCnt()));
|
|
|
+ this.repo.insertIndigoStats(this.TRAF_ID, this.agency, this.TRAF_INFO, this.period, String.valueOf(ApplicationRepository.indigoStats.getTrafCnt()));
|
|
|
+ printIndigoStats();
|
|
|
} catch (Exception e) {
|
|
|
- log.error("[01DAY...] {}: Exception: {}", LogUtils.elapsedLog("insertIndigoStats"), e.getMessage());
|
|
|
+ log.error("[05MIN...] {}: Exception: {}", LogUtils.elapsedLog("insertIndigoStats"), e.getMessage());
|
|
|
}
|
|
|
ApplicationRepository.indigoStats.reset(); // 일작업 후 통계정보 초기화
|
|
|
}
|
|
|
@@ -131,18 +145,18 @@ public class UticPtisServerService implements AbstractProcessService {
|
|
|
log.warn("[05MIN...] {}: No new traf data to process.", LogUtils.elapsedLog(trafTable));
|
|
|
}
|
|
|
|
|
|
-// // 교통정보 이관
|
|
|
-// result = this.repo.insertCurlinkstPoliceLog();
|
|
|
-// if (result < 0) {
|
|
|
-// log.error("[05MIN...] {}: Failed to insert traffic data.", LogUtils.elapsedLog("CURLINKST_POLICE_LOG"));
|
|
|
-// return; // 교통정보 이관 실패
|
|
|
-// }
|
|
|
-//
|
|
|
+ // 교통정보 이관
|
|
|
+ result = this.repo.insertCurlinkstPoliceLog();
|
|
|
+ if (result < 0) {
|
|
|
+ log.error("[05MIN...] {}: Failed to insert traffic data.", LogUtils.elapsedLog("CURLINKST_POLICE_LOG"));
|
|
|
+ return; // 교통정보 이관 실패
|
|
|
+ }
|
|
|
+
|
|
|
ApplicationRepository.lastRegDate.setTrafDt(regDate); // 교통정보 최종시각 갱신
|
|
|
ApplicationRepository.indigoStats.setTrafCnt(result + ApplicationRepository.indigoStats.getTrafCnt());
|
|
|
log.info("[05MIN...] {}: {} EA.", LogUtils.elapsedLog("Total Traffic"), ApplicationRepository.indigoStats.getTrafCnt());
|
|
|
|
|
|
-// // 임시 교통정보테이블 삭제
|
|
|
+// // 임시 교통정보테이블 삭제(사용안함)
|
|
|
// result = this.repo.deleteRcvLinkTrafficTmp();
|
|
|
// if (result < 0) {
|
|
|
// log.error("[05MIN...] {}: Failed to delete temporary traffic data.", LogUtils.elapsedLog("RCV_LINK_TRAFFIC_TMP"));
|
|
|
@@ -175,22 +189,22 @@ public class UticPtisServerService implements AbstractProcessService {
|
|
|
return; // 새로운 통제정보가 없음
|
|
|
}
|
|
|
|
|
|
-// // 통제정보 이관
|
|
|
-// result = this.repo.insertEventidPoliceLog(fromDate, regDate);
|
|
|
-// if (result < 0) {
|
|
|
-// log.error("[05MIN...] {}: Failed to insert event data.", LogUtils.elapsedLog("EVENTID_POLICE_LOG"));
|
|
|
-// return; // 통제정보 이관 실패
|
|
|
-// }
|
|
|
+ // 통제정보 이관
|
|
|
+ result = this.repo.insertEventidPoliceLog(fromDate, regDate);
|
|
|
+ if (result < 0) {
|
|
|
+ log.error("[05MIN...] {}: Failed to insert event data.", LogUtils.elapsedLog("EVENTID_POLICE_LOG"));
|
|
|
+ return; // 통제정보 이관 실패
|
|
|
+ }
|
|
|
|
|
|
ApplicationRepository.lastRegDate.setEvntDt(regDate); // 통제정보 최종시각 갱신
|
|
|
ApplicationRepository.indigoStats.setEvntCnt(result + ApplicationRepository.indigoStats.getEvntCnt());
|
|
|
log.info("[05MIN...] {}: {} EA.", LogUtils.elapsedLog("Total Event"), ApplicationRepository.indigoStats.getEvntCnt());
|
|
|
|
|
|
-// // 임시 통제정보테이블에 데이터 이관
|
|
|
-// result = this.repo.insertEventidPoliceLogTmp(fromDate, regDate);
|
|
|
-// if (result < 0) {
|
|
|
-// log.error("[05MIN...] {}: Failed to insert temporary event data.", LogUtils.elapsedLog("EVENTID_POLICE_LOG_TMP"));
|
|
|
-// }
|
|
|
+ // 임시 통제정보테이블에 데이터 이관
|
|
|
+ result = this.repo.insertEventidPoliceLogTmp(fromDate, regDate);
|
|
|
+ if (result < 0) {
|
|
|
+ log.error("[05MIN...] {}: Failed to insert temporary event data.", LogUtils.elapsedLog("EVENTID_POLICE_LOG_TMP"));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@ProcessingElapsed(type="05MIN", name="INCIDENT Processing")
|
|
|
@@ -212,22 +226,57 @@ public class UticPtisServerService implements AbstractProcessService {
|
|
|
return; // 새로운 돌발정보가 없음
|
|
|
}
|
|
|
|
|
|
-// // 돌발정보 이관
|
|
|
-// result = this.repo.insertOccuridPoliceLog(fromDate, regDate);
|
|
|
-// if (result < 0) {
|
|
|
-// log.error("[05MIN...] {}: Failed to insert incident data.", LogUtils.elapsedLog("OCCURID_POLICE_LOG"));
|
|
|
-// return; // 돌발정보 이관 실패
|
|
|
-// }
|
|
|
+ // 돌발정보 이관
|
|
|
+ result = this.repo.insertOccuridPoliceLog(fromDate, regDate);
|
|
|
+ if (result < 0) {
|
|
|
+ log.error("[05MIN...] {}: Failed to insert incident data.", LogUtils.elapsedLog("OCCURID_POLICE_LOG"));
|
|
|
+ return; // 돌발정보 이관 실패
|
|
|
+ }
|
|
|
|
|
|
ApplicationRepository.lastRegDate.setIncdDt(regDate); // 돌발정보 최종시각 갱신
|
|
|
ApplicationRepository.indigoStats.setIncdCnt(result + ApplicationRepository.indigoStats.getIncdCnt());
|
|
|
log.info("[05MIN...] {}: {} EA.", LogUtils.elapsedLog("Total Incident"), ApplicationRepository.indigoStats.getIncdCnt());
|
|
|
|
|
|
-// // 임시 돌발정보테이블에 데이터 이관
|
|
|
-// result = this.repo.insertOccuridPoliceLogTmp(fromDate, regDate);
|
|
|
-// if (result < 0) {
|
|
|
-// log.error("[05MIN...] {}: Failed to insert temporary incident data.", LogUtils.elapsedLog("OCCURID_POLICE_LOG_TMP"));
|
|
|
-// }
|
|
|
+ // 임시 돌발정보테이블에 데이터 이관
|
|
|
+ result = this.repo.insertOccuridPoliceLogTmp(fromDate, regDate);
|
|
|
+ if (result < 0) {
|
|
|
+ log.error("[05MIN...] {}: Failed to insert temporary incident data.", LogUtils.elapsedLog("OCCURID_POLICE_LOG_TMP"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ProcessingElapsed(type="05MIN", name="DELETE Processing")
|
|
|
+ public void jobDeleteTable() {
|
|
|
+ int result = 0;
|
|
|
+
|
|
|
+ result = this.repo.deleteRcvLinkTraffic();
|
|
|
+ if (result < 0) {
|
|
|
+ log.error("[05MIN...] {}: Failed to delete rcv traffic data.", LogUtils.elapsedLog("RCV_LINK_TRAFFIC"));
|
|
|
+ return; // 통제정보 이관 실패
|
|
|
+ }
|
|
|
+
|
|
|
+ // 통제정보 삭제
|
|
|
+ result = this.repo.deleteEventidPoliceLog();
|
|
|
+ if (result < 0) {
|
|
|
+ log.error("[05MIN...] {}: Failed to delete event data.", LogUtils.elapsedLog("EVENTID_POLICE_LOG"));
|
|
|
+ return; // 통제정보 이관 실패
|
|
|
+ }
|
|
|
+ // 임시 통제정보테이블 삭제
|
|
|
+ result = this.repo.deleteEventidPoliceLogTmp();
|
|
|
+ if (result < 0) {
|
|
|
+ log.error("[05MIN...] {}: Failed to delete temporary event data.", LogUtils.elapsedLog("EVENTID_POLICE_LOG_TMP"));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 돌발정보 삭제
|
|
|
+ result = this.repo.deleteOccuridPoliceLog();
|
|
|
+ if (result < 0) {
|
|
|
+ log.error("[05MIN...] {}: Failed to delete incident data.", LogUtils.elapsedLog("OCCURID_POLICE_LOG"));
|
|
|
+ return; // 돌발정보 이관 실패
|
|
|
+ }
|
|
|
+ // 임시 돌발정보테이블 삭제
|
|
|
+ result = this.repo.deleteOccuridPoliceLogTmp();
|
|
|
+ if (result < 0) {
|
|
|
+ log.error("[05MIN...] {}: Failed to delete temporary incident data.", LogUtils.elapsedLog("OCCURID_POLICE_LOG_TMP"));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|