Selaa lähdekoodia

add etlp asn traffic

HANTE 2 kuukautta sitten
vanhempi
commit
79a1370dbb
27 muutettua tiedostoa jossa 357 lisäystä ja 684 poistoa
  1. 2 0
      utic-ptis-server/build.gradle
  2. 7 0
      utic-ptis-server/src/main/java/com/utic/ptis/server/UticPtisServerApplication.java
  3. 2 4
      utic-ptis-server/src/main/java/com/utic/ptis/server/config/TraceConfig.java
  4. 9 2
      utic-ptis-server/src/main/java/com/utic/ptis/server/controller/LinkTrafEtlpController.java
  5. 7 5
      utic-ptis-server/src/main/java/com/utic/ptis/server/controller/LinkTrafPrcsController.java
  6. 0 103
      utic-ptis-server/src/main/java/com/utic/ptis/server/dao/mapper/BatchDaoService.java
  7. 19 0
      utic-ptis-server/src/main/java/com/utic/ptis/server/dao/mapper/utic/LinkTrafAsnMapper.java
  8. 0 151
      utic-ptis-server/src/main/java/com/utic/ptis/server/dao/mapper/utic/batch/UticPtisServerDao.java
  9. 17 0
      utic-ptis-server/src/main/java/com/utic/ptis/server/dto/LinkTrafAsnCountDto.java
  10. 16 0
      utic-ptis-server/src/main/java/com/utic/ptis/server/dto/LinkTrafAsnTimeDto.java
  11. 2 2
      utic-ptis-server/src/main/java/com/utic/ptis/server/scheduler/LinkTrafPrcsScheduler.java
  12. 173 0
      utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafAsnEtlpService.java
  13. 2 2
      utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafParamService.java
  14. 5 4
      utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafPatternService.java
  15. 0 390
      utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafPrcsTime.java
  16. 3 2
      utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafPrepareService.java
  17. 1 1
      utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafSaveService.java
  18. 1 1
      utic-ptis-server/src/main/java/com/utic/ptis/server/service/worker/LinkTrafDeleteWorker.java
  19. 8 0
      utic-ptis-server/src/main/java/com/utic/ptis/server/utils/LogUtils.java
  20. 1 1
      utic-ptis-server/src/main/resources/logback-spring-appender.xml
  21. 0 6
      utic-ptis-server/src/main/resources/mybatis/mapper/dwdb/collect/LinkCollectOPER.xml
  22. 82 0
      utic-ptis-server/src/main/resources/mybatis/mapper/utic/asn/LinkTrafAsnMapper.xml
  23. 0 2
      utic-ptis-server/src/main/resources/mybatis/mapper/utic/collect/LinkCollectDONGBU.xml
  24. 0 2
      utic-ptis-server/src/main/resources/mybatis/mapper/utic/collect/LinkCollectMOCT.xml
  25. 0 2
      utic-ptis-server/src/main/resources/mybatis/mapper/utic/collect/LinkCollectPRIO.xml
  26. 0 2
      utic-ptis-server/src/main/resources/mybatis/mapper/utic/collect/LinkCollectPRIOETC.xml
  27. 0 2
      utic-ptis-server/src/main/resources/mybatis/mapper/utic/collect/LinkCollectUTIS.xml

+ 2 - 0
utic-ptis-server/build.gradle

@@ -15,6 +15,8 @@ repositories {
 
 dependencies {
 //    compileOnly 'org.jetbrains:annotations'
+//    implementation 'org.fusesource.jansi:jansi:1.18'
+
     // lombok 라이브러리 추가 시작
     compileOnly 'org.projectlombok:lombok'
     annotationProcessor 'org.projectlombok:lombok'

+ 7 - 0
utic-ptis-server/src/main/java/com/utic/ptis/server/UticPtisServerApplication.java

@@ -56,15 +56,22 @@ public class UticPtisServerApplication implements CommandLineRunner, Application
         ApplicationConfig applicationConfig = SpringUtils.getBean(ApplicationConfig.class);
         applicationConfig.setStartSchedule(false);
 
+        // 프로세스 상태 저장
         ProcessStateService processStateService = SpringUtils.getBean(ProcessStateService.class);
         processStateService.processStart();
 
+        // 링크 기본 정보 조회
         LinkRepositoryService linkRepositoryService = SpringUtils.getBean(LinkRepositoryService.class);
         linkRepositoryService.processing();
 
+        // 파라미터 정보 조회
         LinkTrafPrepareService linkTrafPrepareService = SpringUtils.getBean(LinkTrafPrepareService.class);
         linkTrafPrepareService.processing();
 
+        // ASN 교통정보 이관
+        LinkTrafAsnEtlpService linkTrafAsnEtlpService = SpringUtils.getBean(LinkTrafAsnEtlpService.class);
+        linkTrafAsnEtlpService.processing();
+
         LinkTrafPrcsController linkTrafPrcsController = SpringUtils.getBean(LinkTrafPrcsController.class);
 //        linkTrafPrcsController.run();
 

+ 2 - 4
utic-ptis-server/src/main/java/com/utic/ptis/server/config/TraceConfig.java

@@ -42,7 +42,7 @@ public class TraceConfig {
             return props;
         }
         catch(Exception e) {
-            log.error("{}.getTraceFileInputStream: Exception1: {}", this.getClass().getSimpleName(), e.toString());
+//            log.error("{}.getTraceFileInputStream: Exception1: {}", this.getClass().getSimpleName(), e.toString());
             return null;
         }
     }
@@ -58,9 +58,7 @@ public class TraceConfig {
             String dumps  = props.getProperty("DEBUG",  "").trim();
             if (!dumps.isEmpty()) {
                 List<String> linkIds = StringUtils.split(dumps, ",");
-                linkIds.forEach(linkId -> {
-                    this.debugLinks.add(linkId);
-                });
+                this.debugLinks.addAll(linkIds);
             }
         }
         catch(Exception e) {

+ 9 - 2
utic-ptis-server/src/main/java/com/utic/ptis/server/controller/LinkTrafEtlpController.java

@@ -1,5 +1,8 @@
 package com.utic.ptis.server.controller;
 
+import com.utic.common.utils.TimeUtils;
+import com.utic.ptis.server.service.LinkTrafAsnEtlpService;
+import com.utic.ptis.server.utils.LogUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Controller;
@@ -10,15 +13,19 @@ import org.springframework.util.StopWatch;
 @RequiredArgsConstructor
 public class LinkTrafEtlpController implements AbstractProcessController {
 
+    private final LinkTrafAsnEtlpService linkTrafAsnEtlpService;
+
     public void initialize() {
     }
 
     public void run() {
         StopWatch stopWatch = new StopWatch();
         stopWatch.start("LinkTrafPrcsPrepareController");
-        log.info("[PREPARE]                  LinkTrafPrcsPrepareController: START.");
+        log.info("[BE-PREP] >>>>> {}: [{}]", LogUtils.elapsedLog("교통정보 가공 준비 시작"), TimeUtils.getCurrentTimeString());
+
+        this.linkTrafAsnEtlpService.processing();
 
         stopWatch.stop();
-        log.info("[PREPARE]                  LinkTrafPrcsPrepareController: ..END. {} ms", stopWatch.getTotalTimeMillis());
+        log.info("[BE-PREP] <<<<< {}: [{} ms]", LogUtils.elapsedLog("교통정보 가공 준비 완료"), stopWatch.getTotalTimeMillis());
     }
 }

+ 7 - 5
utic-ptis-server/src/main/java/com/utic/ptis/server/controller/LinkTrafPrcsController.java

@@ -2,6 +2,7 @@ package com.utic.ptis.server.controller;
 
 import com.utic.common.utils.TimeUtils;
 import com.utic.ptis.server.service.*;
+import com.utic.ptis.server.utils.LogUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Controller;
@@ -41,14 +42,15 @@ public class LinkTrafPrcsController implements AbstractProcessController {
         this.linkRepo.getFusionInfo().setPrcsType(this.trafParamService.getAnalysisType().getAnalysisType());
         this.linkRepo.getFusionInfo().setLinkCnt(this.linkRepo.getLink1Count());
 
-        log.info("[TIME...]      Current/PrcsTime/PatternTime: {}/{}/{}", currTime, this.linkRepo.getPrcsTime(), this.linkRepo.getPatternTime());
+        log.info("[TRAFFIC] (TIME){}: {}/{}/{}", LogUtils.elapsedLog("Current/PrcsTime/PatternTime"), currTime, this.linkRepo.getPrcsTime(), this.linkRepo.getPatternTime());
     }
 
     public void run() {
 
-        log.info("[TRAFFIC] >>>>>>>>>>>>>>>>>>>>>>> 5분주기 작업 시작.");
+        log.info("[TRAFFIC] >>>>> {}: [{}]", LogUtils.elapsedLog("5분주기 작업 시작"), this.linkRepo.getPrcsTime());
+
         if (this.isProcessing) {
-            log.error("[TRAFFIC] ======================= 5분주기 작업 시작. 실패: 이전주기 작업이 실행중입니다.");
+            log.warn("[TRAFFIC] ======================== 5분주기 작업 시작. 경고: 이전 주기 작업이 실행중입니다.");
         }
 
         StopWatch stopWatch = new StopWatch();
@@ -67,7 +69,7 @@ public class LinkTrafPrcsController implements AbstractProcessController {
         // 1. 수집원별 링크 원시 교통정보 조회
         this.trafCollectService.processing();
 
-        // 2. 가공방식에 따른 퓨전 소통정보 생
+        // 2. 가공방식에 따른 퓨전 소통정보 생
         this.trafFusionService.processing();
 
         // 3. 결측처리
@@ -86,7 +88,7 @@ public class LinkTrafPrcsController implements AbstractProcessController {
         this.linkTrafPrepareService.processing();
 
         stopWatch.stop();
-        log.info("[TRAFFIC] <<<<<<<<<<<<<<<<<<<<<<< 5분주기 작업 완료. {} ms.\n", stopWatch.getTotalTimeMillis());
+        log.info("[TRAFFIC] <<<<< {}: [{} ms]", LogUtils.elapsedLog("5분주기 작업 완료"), stopWatch.getTotalTimeMillis());
 
     }
 }

+ 0 - 103
utic-ptis-server/src/main/java/com/utic/ptis/server/dao/mapper/BatchDaoService.java

@@ -1,103 +0,0 @@
-package com.utic.ptis.server.dao.mapper;
-
-import lombok.Data;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.session.ExecutorType;
-import org.apache.ibatis.session.SqlSession;
-import org.apache.ibatis.session.SqlSessionFactory;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Data
-@Slf4j
-public abstract class BatchDaoService {
-
-    protected final int MAX_BATCH_SIZE = 1000;
-
-    protected final SqlSessionFactory sqlSessionFactory;
-    protected String serviceName;
-    protected int count;
-
-    public BatchDaoService(SqlSessionFactory sqlSessionFactory) {
-        this.sqlSessionFactory = sqlSessionFactory;
-    }
-
-    public int getCount() {
-        return this.count;
-    }
-
-    public int execute(String mapperName) {
-        int total = 0;
-        SqlSession sqlSession = null;
-        try {
-            sqlSession = this.sqlSessionFactory.openSession(ExecutorType.SIMPLE, false);
-            total = sqlSession.update(mapperName);
-        }
-        finally {
-            if (sqlSession != null) {
-                sqlSession.commit();
-                sqlSession.close();
-            }
-        }
-        return total;
-    }
-
-    public int insertBatch(String mapperName, List<HashMap<String, Object>> lists) {
-        int total = lists.size();
-        if (total == 0) {
-            log.info("[BATCH--DAO] {}:insertBatch: {}: No Data.", this.serviceName, mapperName);
-            return 0;
-        }
-        int jobCnt = 0;
-        SqlSession sqlSession = null;
-        try {
-            sqlSession = this.sqlSessionFactory.openSession(ExecutorType.BATCH, false);
-            for (Map<String, Object> param : lists) {
-                sqlSession.insert(mapperName, param);
-                jobCnt++;
-                if (jobCnt % this.MAX_BATCH_SIZE == 0 || jobCnt == total) {
-                    sqlSession.flushStatements();
-                }
-            }
-        }
-        finally {
-            if (sqlSession != null) {
-                sqlSession.commit();
-                sqlSession.close();
-            }
-        }
-        this.count = total;
-        return this.count;
-    }
-
-    public int updateBatch(String mapperName, List<HashMap<String, Object>> lists) {
-        int total = lists.size();
-        if (total == 0) {
-            log.info("[BATCH--DAO] {}:updateBatch: {}: No Data.", this.serviceName, mapperName);
-            return 0;
-        }
-        int jobCnt = 0;
-        SqlSession sqlSession = null;
-        try {
-            sqlSession = this.sqlSessionFactory.openSession(ExecutorType.BATCH, false);
-            for (Map<String, Object> param : lists) {
-                sqlSession.update(mapperName, param);
-                jobCnt++;
-                if (jobCnt % this.MAX_BATCH_SIZE == 0 || jobCnt == total) {
-                    sqlSession.flushStatements();
-                }
-            }
-        }
-        finally {
-            if (sqlSession != null) {
-                sqlSession.commit();
-                sqlSession.close();
-            }
-        }
-        this.count = total;
-        return this.count;
-    }
-
-}

+ 19 - 0
utic-ptis-server/src/main/java/com/utic/ptis/server/dao/mapper/utic/LinkTrafAsnMapper.java

@@ -0,0 +1,19 @@
+package com.utic.ptis.server.dao.mapper.utic;
+
+import com.utic.ptis.server.dto.LinkTrafAsnCountDto;
+import com.utic.ptis.server.dto.LinkTrafAsnTimeDto;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface LinkTrafAsnMapper {
+
+    int deleteTrafficLoc();
+    LinkTrafAsnTimeDto findLinkTrafAsnTime();
+    int insertTrafficLoc(@Param("obj") LinkTrafAsnTimeDto obj);
+    List<LinkTrafAsnCountDto> findAllTrafficLoc(@Param("obj") LinkTrafAsnTimeDto obj);
+    int insertIncidentCommon(@Param("obj") LinkTrafAsnTimeDto obj);
+
+}

+ 0 - 151
utic-ptis-server/src/main/java/com/utic/ptis/server/dao/mapper/utic/batch/UticPtisServerDao.java

@@ -1,151 +0,0 @@
-package com.utic.ptis.server.dao.mapper.utic.batch;
-
-import com.utic.common.utils.Elapsed;
-import com.utic.ptis.server.dao.mapper.BatchDaoService;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.session.SqlSessionFactory;
-import org.springframework.stereotype.Repository;
-
-import java.util.HashMap;
-import java.util.List;
-
-@Slf4j
-@Repository
-public class UticPtisServerDao extends BatchDaoService {
-
-    public UticPtisServerDao(SqlSessionFactory sqlSessionFactory) {
-        super(sqlSessionFactory);
-        this.serviceName = "UticPtisServerDao";
-    }
-//
-//    public List<HashMap<String, Object>> getIntPhaseSttsList(List<IntStatusDto> req) {
-//        List<HashMap<String, Object>> lists = new ArrayList<>();
-//        req.forEach(obj -> {
-//            HashMap<String, Object> param = new HashMap<>();
-//
-//            param.put("REGION_CD",                  obj.regionCd);
-//            param.put("INT_NO",                     obj.intNo);
-//            param.put("COLLCT_DTIME",               obj.commDt);
-//            param.put("COMM_ON_OFF_FLAG",           obj.commStts);
-//            param.put("CONTRLR_OPER_MODE_CD",       obj.operMode);
-//            param.put("A_RING_PHASE_VAL",           obj.ringPhaseA);
-//            param.put("B_RING_PHASE_VAL",           obj.ringPhaseB);
-//            param.put("SIGLIGHT_TURNOFF_FLAG",      obj.turnOffFlag);
-//            param.put("SIGLIGHT_BLINK_FLAG",        obj.blinking);
-//            param.put("CONTRLR_MANUAL_FLAG",        obj.manualFlag);
-//            param.put("MAP_NO",                     obj.mapNo);
-//            param.put("CONTRLR_TMDIFF_CONTRL_FLAG",	obj.tmDiffFlag);
-//            param.put("INT_SIG_CYCLE_CNT",          obj.count);
-//            param.put("INT_SIG_CYCLE_LEN",         	obj.cycle);
-//            param.put("A_RING_1_PHASE_VAL",         obj.phaseA1);
-//            param.put("A_RING_2_PHASE_VAL",         obj.phaseA2);
-//            param.put("A_RING_3_PHASE_VAL",         obj.phaseA3);
-//            param.put("A_RING_4_PHASE_VAL",         obj.phaseA4);
-//            param.put("A_RING_5_PHASE_VAL",         obj.phaseA5);
-//            param.put("A_RING_6_PHASE_VAL",         obj.phaseA6);
-//            param.put("A_RING_7_PHASE_VAL",         obj.phaseA7);
-//            param.put("A_RING_8_PHASE_VAL",         obj.phaseA8);
-//            param.put("B_RING_1_PHASE_VAL",         obj.phaseB1);
-//            param.put("B_RING_2_PHASE_VAL",         obj.phaseB2);
-//            param.put("B_RING_3_PHASE_VAL",         obj.phaseB3);
-//            param.put("B_RING_4_PHASE_VAL",         obj.phaseB4);
-//            param.put("B_RING_5_PHASE_VAL",         obj.phaseB5);
-//            param.put("B_RING_6_PHASE_VAL",         obj.phaseB6);
-//            param.put("B_RING_7_PHASE_VAL",         obj.phaseB7);
-//            param.put("B_RING_8_PHASE_VAL",         obj.phaseB8);
-//            param.put("PPC_CONTRL_FLAG",            obj.ppcControl);
-//            param.put("GROUP_NO",                   obj.groupNo);
-//
-//            lists.add(param);
-//        });
-//        return lists;
-//    }
-
-//    public int updateIntPhaseChange(String regionCd, List<IntStatusDto> req) {
-//        log.info("{}.updateIntPhaseChange: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-//        Elapsed elapsed = new Elapsed();
-//        int total = updateBatch("updateIntPhaseChange", getIntPhaseSttsList(req));
-//        log.info("{}.updateIntPhaseChange: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-//        return total;
-//    }
-
-    public int updateIntPhaseChange(String regionCd, List<HashMap<String, Object>> req) {
-        log.info("{}.updateIntPhaseChange: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-        Elapsed elapsed = new Elapsed();
-        int total = updateBatch("updateIntPhaseChange", req);
-        log.info("{}.updateIntPhaseChange: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-        return total;
-    }
-
-    public int updateIntStaticCycle(String regionCd, List<HashMap<String, Object>> req) {
-        log.info("{}.updateIntStaticCycle: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-        Elapsed elapsed = new Elapsed();
-        int total = updateBatch("updateIntStaticCycle", req);
-        log.info("{}.updateIntStaticCycle: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-        return total;
-    }
-
-    public int insertIntEventHist(String regionCd, List<HashMap<String, Object>> req) {
-        log.info("{}.insertIntEventHist: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-        Elapsed elapsed = new Elapsed();
-        int total = insertBatch("insertIntEventHist", req);
-        log.info("{}.insertIntEventHist: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-        return total;
-    }
-
-    public int updateIntTodPlan(String regionCd, List<HashMap<String, Object>> req) {
-        log.info("{}.updateIntTodPlan: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-        Elapsed elapsed = new Elapsed();
-        int total = updateBatch("updateIntTodPlan", req);
-        log.info("{}.updateIntTodPlan: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-        return total;
-    }
-
-    public int updateIntOperPlan(String regionCd, List<HashMap<String, Object>> req) {
-        log.info("{}.updateIntOperPlan: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-        Elapsed elapsed = new Elapsed();
-        int total = updateBatch("updateIntOperPlan", req);
-        log.info("{}.updateIntOperPlan: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-        return total;
-    }
-
-    public int updateIntHolidayPlan(String regionCd, List<HashMap<String, Object>> req) {
-        log.info("{}.updateIntHolidayPlan: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-        Elapsed elapsed = new Elapsed();
-        int total = updateBatch("updateIntHolidayPlan", req);
-        log.info("{}.updateIntHolidayPlan: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-        return total;
-    }
-
-    public int updateIntWeekdayPlan(String regionCd, List<HashMap<String, Object>> req) {
-        log.info("{}.updateIntWeekdayPlan: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-        Elapsed elapsed = new Elapsed();
-        int total = updateBatch("updateIntWeekdayPlan", req);
-        log.info("{}.updateIntWeekdayPlan: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-        return total;
-    }
-
-    public int updateIntReservedPlan(String regionCd, List<HashMap<String, Object>> req) {
-        log.info("{}.updateIntReservedPlan: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-        Elapsed elapsed = new Elapsed();
-        int total = updateBatch("updateIntReservedPlan", req);
-        log.info("{}.updateIntReservedPlan: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-        return total;
-    }
-
-    public int updateIntSignalMap(String regionCd, List<HashMap<String, Object>> req) {
-        log.info("{}.updateIntSignalMap: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-        Elapsed elapsed = new Elapsed();
-        int total = updateBatch("updateIntSignalMap", req);
-        log.info("{}.updateIntSignalMap: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-        return total;
-    }
-
-    public int updateIntType(String regionCd, List<HashMap<String, Object>> req) {
-        log.info("{}.updateIntType: START. [{}], {} EA", this.serviceName, regionCd, req.size());
-        Elapsed elapsed = new Elapsed();
-        int total = updateBatch("updateIntType", req);
-        log.info("{}.updateIntType: ..END. [{}], {} EA. {} ms.", this.serviceName, regionCd, total, elapsed.milliSeconds());
-        return total;
-    }
-}

+ 17 - 0
utic-ptis-server/src/main/java/com/utic/ptis/server/dto/LinkTrafAsnCountDto.java

@@ -0,0 +1,17 @@
+package com.utic.ptis.server.dto;
+
+import lombok.Data;
+
+@Data
+public class LinkTrafAsnCountDto {
+
+    private String centerId;
+    private String centerName;
+    private Integer dataCount;
+
+    public LinkTrafAsnCountDto(String centerId, String centerName) {
+        this.centerId = centerId;
+        this.centerName = centerName;
+        this.dataCount = 0;
+    }
+}

+ 16 - 0
utic-ptis-server/src/main/java/com/utic/ptis/server/dto/LinkTrafAsnTimeDto.java

@@ -0,0 +1,16 @@
+package com.utic.ptis.server.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class LinkTrafAsnTimeDto {
+
+    private String currTime;
+    private String past05MinTime;
+    private String past10MinTime;
+    private String incdTime;
+
+    private List<String> inCenterIds;
+}

+ 2 - 2
utic-ptis-server/src/main/java/com/utic/ptis/server/scheduler/LinkTrafPrcsScheduler.java

@@ -31,8 +31,8 @@ public class LinkTrafPrcsScheduler {
     }
 
     @ScheduleElapsed
-    @Scheduled(cron = "5 4/5 * * * *")  // 5분주기 - 1분전 작업 실행
-    public void scheduleLinkTrafPrepareProcess() {
+    @Scheduled(cron = "30 4/5 * * * *")  // 5분주기 - 30초전 작업 실행
+    public void scheduleLinkTrafPrepare() {
         if (this.applicationConfig.isStartSchedule()) {
             runJob(this.linkTrafEtlpController, "Link Traffic Etlp Processing");
         }

+ 173 - 0
utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafAsnEtlpService.java

@@ -0,0 +1,173 @@
+package com.utic.ptis.server.service;
+
+import com.utic.common.utils.Elapsed;
+import com.utic.ptis.server.dao.mapper.utic.LinkTrafAsnMapper;
+import com.utic.ptis.server.dto.LinkTrafAsnCountDto;
+import com.utic.ptis.server.dto.LinkTrafAsnTimeDto;
+import com.utic.ptis.server.utils.LogUtils;
+import lombok.Data;
+import lombok.RequiredArgsConstructor;
+import lombok.ToString;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Data
+@ToString
+@RequiredArgsConstructor
+@Service
+public class LinkTrafAsnEtlpService implements AbstractProcessService {
+
+    private final LinkTrafAsnMapper linkTrafAsnMapper;
+    private ConcurrentHashMap<String, LinkTrafAsnCountDto> mapData = new ConcurrentHashMap<>();
+
+    @PostConstruct
+    public void init() {
+        log.info("[SAVE...] LinkTrafAsnEtlpService.init: start.");
+        Elapsed elapsed = new Elapsed();
+
+        // 초기화
+        this.mapData.put("L01", new LinkTrafAsnCountDto("L01", "서울지역센터"));
+        this.mapData.put("L02", new LinkTrafAsnCountDto("L02", "인천지역센터"));
+        this.mapData.put("L03", new LinkTrafAsnCountDto("L03", "부천지역센터"));
+        this.mapData.put("L04", new LinkTrafAsnCountDto("L04", "광명지역센터"));
+        this.mapData.put("L05", new LinkTrafAsnCountDto("L05", "안양지역센터"));
+        this.mapData.put("L06", new LinkTrafAsnCountDto("L06", "과천지역센터"));
+        this.mapData.put("L07", new LinkTrafAsnCountDto("L07", "안산지역센터"));
+        this.mapData.put("L08", new LinkTrafAsnCountDto("L08", "용인지역센터"));
+        this.mapData.put("L09", new LinkTrafAsnCountDto("L09", "성남시지역센터"));
+        this.mapData.put("L10", new LinkTrafAsnCountDto("L10", "고양시지역센터"));
+        this.mapData.put("L11", new LinkTrafAsnCountDto("L11", "시흥지역센터"));
+        this.mapData.put("L12", new LinkTrafAsnCountDto("L12", "파주시지역센터"));
+        this.mapData.put("L13", new LinkTrafAsnCountDto("L13", "양주지역센터"));
+        this.mapData.put("L14", new LinkTrafAsnCountDto("L14", "의정부지역센터"));
+        this.mapData.put("L15", new LinkTrafAsnCountDto("L15", "김포지역센터"));
+        this.mapData.put("L16", new LinkTrafAsnCountDto("L16", "의왕지역센터"));
+        this.mapData.put("L17", new LinkTrafAsnCountDto("L17", "군포지역센터"));
+        this.mapData.put("L18", new LinkTrafAsnCountDto("L18", "남양주지역센터"));
+        this.mapData.put("L19", new LinkTrafAsnCountDto("L19", "수원지역센터"));
+        this.mapData.put("L20", new LinkTrafAsnCountDto("L20", "광주시지역센터"));
+        this.mapData.put("L21", new LinkTrafAsnCountDto("L21", "구리시지역센터"));
+        this.mapData.put("L22", new LinkTrafAsnCountDto("L22", "하남지역센터"));
+        this.mapData.put("L23", new LinkTrafAsnCountDto("L23", "부산시지역센터"));
+        this.mapData.put("L24", new LinkTrafAsnCountDto("L24", "양산지역센터"));
+        this.mapData.put("L25", new LinkTrafAsnCountDto("L25", "창원지역센터"));
+        this.mapData.put("L26", new LinkTrafAsnCountDto("L26", "김해지역센터"));
+        this.mapData.put("L28", new LinkTrafAsnCountDto("L28", "거제지역센터"));
+        this.mapData.put("L29", new LinkTrafAsnCountDto("L29", "대구지역센터"));
+        this.mapData.put("L30", new LinkTrafAsnCountDto("L30", "대전지역센터"));
+        this.mapData.put("L31", new LinkTrafAsnCountDto("L31", "광주지역센터"));
+        this.mapData.put("L32", new LinkTrafAsnCountDto("L32", "울산지역센터"));
+        this.mapData.put("L33", new LinkTrafAsnCountDto("L33", "전주지역센터"));
+        this.mapData.put("L34", new LinkTrafAsnCountDto("L34", "원주지역센터"));
+        this.mapData.put("L35", new LinkTrafAsnCountDto("L35", "청주지역센터"));
+        this.mapData.put("L36", new LinkTrafAsnCountDto("L36", "천안시지역센터"));
+        this.mapData.put("L37", new LinkTrafAsnCountDto("L37", "포항지역센터"));
+        this.mapData.put("L38", new LinkTrafAsnCountDto("L38", "제주지역센터"));
+        this.mapData.put("L40", new LinkTrafAsnCountDto("L40", "경주지역센터"));
+        this.mapData.put("L41", new LinkTrafAsnCountDto("L41", "구미지역센터"));
+        this.mapData.put("L42", new LinkTrafAsnCountDto("L42", "여수지역센터"));
+        this.mapData.put("L43", new LinkTrafAsnCountDto("L43", "순천지역센터"));
+        this.mapData.put("L44", new LinkTrafAsnCountDto("L44", "평택시지역센터"));
+        this.mapData.put("L45", new LinkTrafAsnCountDto("L45", "충주지역센터"));
+        this.mapData.put("L46", new LinkTrafAsnCountDto("L46", "군산지역센터"));
+        this.mapData.put("L47", new LinkTrafAsnCountDto("L47", "경산시지역센터"));
+        this.mapData.put("L48", new LinkTrafAsnCountDto("L48", "화성시지역센터"));
+        this.mapData.put("L49", new LinkTrafAsnCountDto("L49", "아산지역센터"));
+        this.mapData.put("L50", new LinkTrafAsnCountDto("L50", "목포지역센터"));
+        this.mapData.put("L51", new LinkTrafAsnCountDto("L51", "익산지역센터"));
+        this.mapData.put("L52", new LinkTrafAsnCountDto("L52", "강릉지역센터"));
+        this.mapData.put("L54", new LinkTrafAsnCountDto("L54", "공주지역센터"));
+        this.mapData.put("L55", new LinkTrafAsnCountDto("L55", "진주지역센터"));
+        this.mapData.put("L56", new LinkTrafAsnCountDto("L56", "안성지역센터"));
+        this.mapData.put("L57", new LinkTrafAsnCountDto("L57", "제천지역센터"));
+        this.mapData.put("L58", new LinkTrafAsnCountDto("L58", "김제지역센터"));
+        this.mapData.put("L59", new LinkTrafAsnCountDto("L59", "여주시지역센터"));
+        this.mapData.put("L60", new LinkTrafAsnCountDto("L60", "남원시지역센터"));
+        this.mapData.put("L65", new LinkTrafAsnCountDto("L65", "이천시지역센터"));
+        this.mapData.put("L66", new LinkTrafAsnCountDto("L66", "당진지역센터"));
+        this.mapData.put("L67", new LinkTrafAsnCountDto("L67", "안동지역센터"));
+
+        log.info("[SAVE...] LinkTrafAsnEtlpService.init: end. {} ms.", elapsed.milliSeconds());
+    }
+
+    private int initialize() {
+        this.mapData.forEach((centerId, result) -> {
+            result.setDataCount(0);
+        });
+        return 0;
+    }
+
+    public int processing() {
+        log.info("[ETLP...]****** {}", LogUtils.elapsedLog("ASN 지역 교통정보 이관 시작"));
+        Elapsed elapsed = new Elapsed();
+
+        // 데이터 초기화
+        initialize();
+
+        LinkTrafAsnTimeDto linkTrafAsnTime = this.linkTrafAsnMapper.findLinkTrafAsnTime();
+//        String inCenterId = mapData.values().stream()
+//                .map(dto -> "'" + dto.getCenterId() + "'") // 싱글 쿼테이션 추가
+//                .collect(Collectors.joining(", "));
+        List<String> inCenterIds = mapData.values().stream()
+                .map(LinkTrafAsnCountDto::getCenterId)
+                .collect(Collectors.toList());
+
+        linkTrafAsnTime.setInCenterIds(inCenterIds);
+
+        linkTrafAsnTime.setPast10MinTime("20240806100000");
+        log.info("[ETLP...]       {}: currTime[{}], past05MinTime[{}], past10MinTime[{}], incdTime[{}]",
+                LogUtils.elapsedLog("이관 작업 파라미터"),
+                linkTrafAsnTime.getCurrTime(), linkTrafAsnTime.getPast05MinTime(), linkTrafAsnTime.getPast10MinTime(), linkTrafAsnTime.getIncdTime());
+
+        Elapsed tmpElapsed = new Elapsed();
+
+        // 1. 저장공간 삭제
+        this.linkTrafAsnMapper.deleteTrafficLoc();
+        log.info("[ETLP...] (TRC) {}", LogUtils.elapsedLog("교통정보 삭제(TRAFFIC_LOC)", tmpElapsed.milliSeconds()));
+
+        // 2. 지역센터 소통정보 이관
+        tmpElapsed.reset();
+        int etlpCount = this.linkTrafAsnMapper.insertTrafficLoc(linkTrafAsnTime);
+        log.info("[ETLP...] (INS) {}", LogUtils.elapsedLog("교통정보 저장(TRAFFIC_LOC)", etlpCount, tmpElapsed.milliSeconds()));
+
+        // 3. 지역센터 소통정보 이관 결과 조회
+        tmpElapsed.reset();
+        List<LinkTrafAsnCountDto> linkTrafAsnCountList = this.linkTrafAsnMapper.findAllTrafficLoc(linkTrafAsnTime);
+        log.info("[ETLP...] (SEL) {}", LogUtils.elapsedLog("교통정보 결과(TRAFFIC_LOC)", linkTrafAsnCountList.size(), tmpElapsed.milliSeconds()));
+
+        // 모든 작업이 완료된 후 결과를 출력
+        for (LinkTrafAsnCountDto asnCount: linkTrafAsnCountList) {
+            String centerId = asnCount.getCenterId();
+            LinkTrafAsnCountDto result = this.mapData.get(centerId);
+            if (result != null) {
+                result.setDataCount(asnCount.getDataCount());
+            } else {
+                log.error("[ETLP...] LinkTrafAsnEtlpService.processing: {} is not found.", centerId);
+            }
+        }
+        for (Map.Entry<String, LinkTrafAsnCountDto> entry : this.mapData.entrySet()) {
+            LinkTrafAsnCountDto result = entry.getValue();
+            if (result.getDataCount() > 0) {
+                log.info("[ETLP...]       {}: [{} EA]",
+                        LogUtils.elapsedLog(result.getCenterName() + "(" + result.getCenterId() + ")"),
+                        LogUtils.numberLog(result.getDataCount()));
+            }
+        }
+
+        // 4. 표준 통합돌발정보 이관
+        tmpElapsed.reset();
+        int incidentCount = this.linkTrafAsnMapper.insertIncidentCommon(linkTrafAsnTime);
+        log.info("[ETLP...] (INS) {}", LogUtils.elapsedLog("돌발정보 이관(PTAPP.INCIDENT_COMMON)", incidentCount, tmpElapsed.milliSeconds()));
+
+        log.info("[ETLP...]****** {}", LogUtils.elapsedLog("ASN 지역 교통정보 이관 완료", elapsed.milliSeconds()));
+        return 0;
+    }
+
+}

+ 2 - 2
utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafParamService.java

@@ -58,8 +58,8 @@ public class LinkTrafParamService implements AbstractProcessService {
         try {
             ParamAnalysisType analysisType = this.dwdbParamMapper.findAnalysisType();
             this.analysisType.setParam(analysisType);
-            log.info("[PARAM..] (SEL) {} [({})가공방식(0:우선순위,1:가중치)]",
-                    LogUtils.elapsedLog("가공파라미터", 1, elapsed.milliSeconds()),
+            log.info("[PARAM..] (SEL) {} [({})(0:우선순위,1:가중치)]",
+                    LogUtils.elapsedLog("가공방식파라미터", 1, elapsed.milliSeconds()),
                     this.analysisType.getAnalysisType());
         } catch (Exception e) {
             log.error("[PARAM..] findAnalysisType: Exception: {}", e.getMessage());

+ 5 - 4
utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafPatternService.java

@@ -35,16 +35,17 @@ public class LinkTrafPatternService implements AbstractProcessService {
             .build();
 
     private int patternCount = 0;
+    private String currTime = "20000101000000";
     private String prcsTime = "20000101000000";
     private String patternTime = "20000101000000";
 
     private boolean initialize() {
-        String currTime = TimeUtils.getCurrentTimeString();
-        String nextTime = TimeUtils.addMinutes(currTime, 5);
+        this.currTime = TimeUtils.getCurrentTimeString();
+        String nextTime = TimeUtils.addMinutes(this.currTime, 5);
         this.prcsTime = TimeUtils.getFiveMinString(TimeUtils.stringToDate(nextTime));
         String patternTime = TimeUtils.roundToQuarterHour(this.prcsTime);
 
-        log.info("[PATTERN] currTime[{}], nextTime[{}], prcsTime[{}], patternTime[{}]/[{}].", currTime, nextTime, this.prcsTime, patternTime, this.patternTime);
+        log.info("[PATTERN] (TIME){}: [{}/{}/{}/{}]", LogUtils.elapsedLog("curr/next/prcs/pattern"), currTime, nextTime, this.prcsTime, patternTime, this.patternTime);
 
         if (patternTime.equals(this.patternTime)) {
             return false;
@@ -70,7 +71,7 @@ public class LinkTrafPatternService implements AbstractProcessService {
     }
 
     public void loadingPatternSpeed() {
-        log.info("[PATTERN] ..... {}: [{}][{}]", LogUtils.elapsedLog("패턴정보 조회 시작"), this.prcsTime, this.patternTime);
+        log.info("[PATTERN] ..... {}: [{}][{}][{}]", LogUtils.elapsedLog("패턴정보 조회 시작"), this.currTime, this.prcsTime, this.patternTime);
         Elapsed elapsed = new Elapsed();
 
         String logDate = TimeUtils.addDays(this.patternTime, -this.patternEffectDay.getEffectDays());

+ 0 - 390
utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafPrcsTime.java

@@ -1,390 +0,0 @@
-package com.utic.ptis.server.service;
-
-import com.utic.ptis.server.repository.ITS;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-
-@Slf4j
-@Getter
-@Setter
-@Service
-public class LinkTrafPrcsTime {
-
-	/*
-	 * 모든 시각은 'YYYYMMDDHH24MISS' 형태로 사용한다.
-	 */
-
-	/*
-	 *  데이터베이스에 입력 또는 데어터 조회 하는 시각을 설정하기 위해 사용한다.
-	 */
-	private String currTime;			/* 20170718153504 - 현재시각 */
-	private String currFiveMin;			/* 20170718153500 - 현재시각 - 초를 00으로 초기화한 현재 정주기 5분 시각 */
-	private String prevFiveMin;			/* 20170718153000 - 이전 정주기 5분 시각 */
-	private String prcsFiveMin;			/* 20170718153500 - 현재 정주기 5분 시각 - 시스템에 따라 5분 이전시각이 될수 있고 현재 정주기 5분 시각이 될수 있다. */
-	private String prcsFiveMinFrom; 	/* 20170718153000 - 이전 정주기 5분 시각 */
-	private String prcsFiveMinTo;   	/* 20170718153459 - 이전 정주기 5분 시각 + 4분 59초 */
-
-	private String prcsDayWeekCd;
-	private int    prcsDayWeek;			/* 요일 유형 - prcsFiveMin */
-	private String prcsDayQuater;		/* 분기 - prcsFiveMin */
-
-	private String stat15MinTime;
-	private String stat15MinFrom;
-	private String stat15MinTo;
-
-	private String statHourTime;
-	private String statHourFrom;
-	private String statHourTo;
-
-	private String statDayTime;
-	private String statDayFrom;
-	private String statDayTo;
-
-	private String statMonTime;
-	private String statMonFrom;
-	private String statMonTo;
-
-	private String statYearTime;
-	private String statYearFrom;
-	private String statYearTo;
-
-	private boolean isStat15Min = false;
-	private boolean isStatHour  = false;
-	private boolean isStatDay   = false;
-	private boolean isStatMon   = false;
-	private boolean isStatYear  = false;
-
-	private boolean changePtrnMonth;
-
-	private boolean isPatternUpdate = false;
-	
-	private boolean isProcessing = false;
-	private Date    startDate;
-	private Date    endDate;
-
-	private String ptrn05M;
-	private String ptrn15M;
-
-	public LinkTrafPrcsTime() {
-		startDate = new Date();
-		endDate   = new Date();
-	}
-
-	public void setProcessing(boolean isProcessing) {
-		this.isProcessing = isProcessing;
-		if (this.isProcessing) {
-			startDate = new Date();
-		}
-		else {
-			endDate = new Date();
-		}
-	}
-
-	public Date convertString2Date(String paramTime) {
-		SimpleDateFormat transFormat = new SimpleDateFormat("yyyyMMddHHmmss");
-		Date to = null;
-		try {
-			to = transFormat.parse(paramTime);
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
-		return to;
-	}
-
-	public String getDateToString(Date paramDt, String paramFmt) {
-		Calendar cal = Calendar.getInstance();
-		cal.setTime(paramDt);
-		return new SimpleDateFormat(paramFmt).format(cal.getTime());
-	}
-	public String getCurr05MinString(Date paramDt) {
-		Calendar cal = Calendar.getInstance();
-		cal.setTime(paramDt);
-		cal.set(Calendar.SECOND, 0);
-		cal.set(Calendar.MILLISECOND, 0);
-		int min = cal.get(Calendar.MINUTE);
-		cal.add(Calendar.MINUTE, -(min % 5));
-		return new SimpleDateFormat("yyyyMMddHHmmss").format(cal.getTime());
-	}
-	public String getCurr15MinString(Date paramDt) {
-		Calendar cal = Calendar.getInstance();
-		cal.setTime(paramDt);
-		cal.set(Calendar.SECOND, 0);
-		cal.set(Calendar.MILLISECOND, 0);
-		int min = cal.get(Calendar.MINUTE);
-		cal.add(Calendar.MINUTE, -(min % 15));
-		return new SimpleDateFormat("yyyyMMddHHmmss").format(cal.getTime());
-	}
-
-	public String calDate(String paramTm, int addSec/*초단위*/) {
-		String result = paramTm;
-		SimpleDateFormat transFormat = new SimpleDateFormat("yyyyMMddHHmmss");
-		try {
-			Date to = new Date();
-			addSec = addSec * 1000;	/* mili-second로 변환 */
-			to.setTime(transFormat.parse(paramTm).getTime() + addSec);
-			result = getDateToString(to, "yyyyMMddHHmmss");
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
-		return result;
-	}
-
-	public String calDateFormat(String paramFmt, String paramTm, int addSec) {
-		String result = paramTm;
-		SimpleDateFormat transFormat = new SimpleDateFormat("yyyyMMddHHmmss");
-		try {
-			Date to = new Date();
-			addSec = addSec * 1000;	/* mili-second로 변환 */
-			to.setTime(transFormat.parse(paramTm).getTime() + addSec);
-			result = getDateToString(to, paramFmt);
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
-		return result;
-	}
-	
-	public String calLastDayFormat(String paramFmt, String paramTm) {
-		String result = paramTm;
-		SimpleDateFormat transFormat = new SimpleDateFormat("yyyyMMddHHmmss");
-		try {
-			Date to = new Date();
-			to.setTime(transFormat.parse(paramTm).getTime());
-			Calendar cal = Calendar.getInstance();
-			cal.setTime(to);
-			int day = cal.getActualMaximum(Calendar.DATE);
-			
-			cal.set(Calendar.DAY_OF_MONTH, day);
-			return new SimpleDateFormat(paramFmt).format(cal.getTime());
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
-		return result;
-	}
-	
-	public String getCurrentTimeString() {
-		Calendar cal = Calendar.getInstance();
-		return new SimpleDateFormat("yyyyMMddHHmmss").format(cal.getTime());
-	}
-
-	public void initValue() {
-		this.currTime    = "";
-		this.currFiveMin = "";
-		this.prevFiveMin = "";
-
-		this.prcsFiveMin     = "";
-		this.prcsFiveMinFrom = "";
-		this.prcsFiveMinTo   = "";
-
-		this.prcsDayWeek   = 0;		/* 요일 유형 */
-		this.prcsDayQuater = "";		/* 분기 */
-
-		this.stat15MinTime = "";
-		this.stat15MinFrom = "";
-		this.stat15MinTo   = "";
-
-		this.statHourTime  = "";
-		this.statHourFrom  = "";
-		this.statHourTo    = "";
-
-		this.statDayTime   = "";
-		this.statDayFrom   = "";
-		this.statDayTo     = "";
-
-		this.statMonTime   = "";
-		this.statMonFrom   = "";
-		this.statMonTo     = "";
-
-		this.statYearTime   = "";
-		this.statYearFrom   = "";
-		this.statYearTo     = "";
-
-		this.isStat15Min = false;
-		this.isStatHour  = false;
-		this.isStatDay   = false;
-		this.isStatMon   = false;
-		this.isStatYear  = false;
-		
-		this.isPatternUpdate = false;
-	}
-	public void init() {
-
-		initValue();
-
-		/*
-		 * 시간대 계산은 아직 안함(추후 시간대 계산이 필요하면 여기서 하면 됨)
-		 */
-		this.currTime = getCurrentTimeString();										/* 20170718153504 - 현재시각 */
-		this.currFiveMin = getCurr05MinString(convertString2Date(this.currTime));	/* 20170718153500 */
-		this.prevFiveMin = calDate(this.currFiveMin, -60*5); 				/* 20170718153000 - 이전 정주기 5분 시각 */
-
-		String beforeOneWeek = calDate(this.currTime, -60*60*24*7);			/* 7일전 */
-		this.ptrn05M = getCurr05MinString(convertString2Date(beforeOneWeek));		/* 7일전 정주기 05분 패턴 시각 */
-		//this.ptrn15M = calDate(this.ptrn05M, -60*15);						/* 7일전 정주기 15분 패턴 시각 */
-		this.ptrn15M = getCurr15MinString(convertString2Date(this.ptrn05M));		/* 7일전 정주기 15분 패턴 시각 */
-
-		this.prcsFiveMin     = this.prevFiveMin;									/* 20170718153000 - 이전 정주기 5분 시각 이용하여 입력 */
-		this.prcsFiveMinFrom = this.prevFiveMin;									/* 20170718153000 - 이전 정주기 5분 시각 */
-		this.prcsFiveMinTo   = calDate(this.currFiveMin, -1);				/* 20170718153459 - 현재 정주기 시각에서 -1초 */
-
-		Calendar cal = Calendar.getInstance();
-		cal.setTime(convertString2Date(this.currFiveMin));							/* 년월일시분초는 현재시각 기준으로 계산 */
-		int year  = cal.get(Calendar.YEAR);
-		int month = cal.get(Calendar.MONTH) + 1;
-		int day   = cal.get(Calendar.DAY_OF_MONTH);
-		int hour  = cal.get(Calendar.HOUR_OF_DAY);	// 24시간제, HOUR: 12시간제
-		int min   = cal.get(Calendar.MINUTE);
-		int sec   = cal.get(Calendar.SECOND);
-
-		String strCurrTime = String.format("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, min, sec);
-		log.info("[TIME...]        TrafficProcessingTime.init: {}", strCurrTime);
-
-		cal.setTime(convertString2Date(this.prcsFiveMin));		/* 요일, 사사분기는 가공시각을 기준으로 계산 */
-		this.prcsDayWeek   = cal.get(Calendar.DAY_OF_WEEK);		/* DAY_OF_WEEK 리턴값이 일요일(1), 월요일(2), 화요일(3) ~~ 토요일(7)을 반환합니다. */
-		this.prcsDayQuater = String.valueOf((month/3)+1);
-		this.prcsDayWeekCd = ITS.getDayWeekCd(this.prcsDayWeek);
-
-		/*
-		 * 5분 정주기 가공이 끝나고 15분 주기일 경우(00, 15, 30, 45 분 일경우 15분 통계 정보를 생성한다)
-		 */
-		if (min % 15 == 0) {
-			this.isStat15Min = true;
-		}
-		this.stat15MinFrom = calDate(this.currFiveMin, -60*15);
-		this.stat15MinTo   = calDate(this.stat15MinFrom,   (60*15)-1);
-		this.stat15MinTime = this.stat15MinFrom;
-
-		/*
-		 * 매시 5분 가공이 끝나면 1시간 통계 정보를 생성한다.
-		 */
-		if (min == 5) {
-			this.isStatHour = true;
-		}
-		String statHour = calDateFormat("yyyyMMddHH", this.currFiveMin, -60*60);
-		this.statHourFrom = statHour + "0000";
-		this.statHourTo   = statHour + "5959";
-		this.statHourTime = this.statHourFrom;
-
-		/*
-		 * 00시 10분 가공이 끝나면 이전일의 통계 정보를 가공.
-		 */
-		if (hour == 0 && min == 10) {
-			this.isStatDay = true;
-		}
-		String statDay = calDateFormat("yyyyMMdd", this.currFiveMin, -60*60*24);
-		this.statDayFrom = statDay + "000000";
-		this.statDayTo   = statDay + "235959";
-		this.statDayTime = statDay + "000000";
-
-		/*
-		 * 01시 10분 가공이 끝나면 이전일의 월통계 정보를 누적 가공.
-		 */
-		if (hour == 1 && min == 10) {
-			this.isStatMon = true;
-		}
-		this.statMonFrom = calDateFormat("yyyyMM", this.currFiveMin, -60*60*24) + "01000000";
-		this.statMonTo   = calLastDayFormat("yyyyMMdd", this.statMonFrom)                +   "235959";
-		this.statMonTime = calDateFormat("yyyyMM", this.currFiveMin, -60*60*24) + "00000000";
-
-		/*
-		 * 02시 5분 가공이 끝나면 이전일의 연통계 정보를 누적 가공.
-		 */
-		if (hour == 2 && min == 10) {
-			this.isStatYear = true;
-		}
-		this.statYearTime = calDateFormat("yyyy", this.currFiveMin, -60*60*24);
-		this.statYearFrom = this.statYearTime + "0101000000";
-		this.statYearTo   = this.statYearTime + "1231235959";
-		this.statYearTime = this.statYearTime + "0000000000";
-
-		/*
-		 * 패턴업데이트 시각 체크: 매일 새벽 3시 10분
-		 */
-		if (hour == 3 && min == 10) {
-			this.isPatternUpdate = true;
-		}
-	}
-
-	public String getWeekCd(String prcsDt) {
-		Calendar cal = Calendar.getInstance();
-		cal.setTime(convertString2Date(prcsDt));
-		return ITS.getDayWeekCd(cal.get(Calendar.DAY_OF_WEEK));
-	}
-
-	public String getStat15M(String prcsDt) {
-		Calendar cal = Calendar.getInstance();
-		cal.setTime(convertString2Date(prcsDt));
-		int year  = cal.get(Calendar.YEAR);
-		int month = cal.get(Calendar.MONTH) + 1;
-		int day   = cal.get(Calendar.DAY_OF_MONTH);
-		int hour  = cal.get(Calendar.HOUR_OF_DAY);	// 24시간제, HOUR: 12시간제
-		int min = cal.get(Calendar.MINUTE);
-		min = (int)(min / 15);
-		min = min * 15;
-
-		return String.format("%04d%02d%02d%02d%02d00", year, month, day, hour, min);
-	}
-
-	/* 정주기 현재 5분 시각 */
-	public String getCurrentFiveMinString() {
-		Calendar cal = Calendar.getInstance();
-		cal.set(Calendar.SECOND, 0);
-		cal.set(Calendar.MILLISECOND, 0);
-		int min = cal.get(Calendar.MINUTE);
-		cal.add(Calendar.MINUTE, -(min % 5));
-		return new SimpleDateFormat("yyyyMMddHHmmss").format(cal.getTime());
-	}
-	public String getCurrentFiveMinToString() {
-		Calendar cal = Calendar.getInstance();
-		cal.set(Calendar.SECOND, 0);
-		cal.set(Calendar.MILLISECOND, 0);
-		int min = cal.get(Calendar.MINUTE);
-		cal.add(Calendar.MINUTE, -(min % 5));
-		cal.add(Calendar.SECOND, -1);	/* 정주기 현재 5분 시각에서 1초를 뺀 시각 */
-		return new SimpleDateFormat("yyyyMMddHHmmss").format(cal.getTime());
-	}
-
-	/* 정주기 이전 5분 시각 */
-	public String getBeforeFiveMinString() {
-		Calendar cal = Calendar.getInstance();
-		cal.set(Calendar.SECOND, 0);
-		cal.set(Calendar.MILLISECOND, 0);
-		int min = cal.get(Calendar.MINUTE);
-		cal.add(Calendar.MINUTE, -(min % 5) - 5);	/* 정주기 현재 5분에서 5분을 뺀 시각 */
-		return new SimpleDateFormat("yyyyMMddHHmmss").format(cal.getTime());
-	}
-
-	/* 현재 시각을 문자열로 리턴 */
-	public String getCurrentTimeString(String parmaFmt) {
-		Calendar cal = Calendar.getInstance();
-		return new SimpleDateFormat(parmaFmt).format(cal.getTime());
-	}
-	
-	/* 현재 시각을 Date 형으로 리턴 */
-	public Date getCurrentDate() {
-		Calendar cal = Calendar.getInstance();
-		return cal.getTime();
-	}
-
-	/* 현재 시각을 second 로 리턴 */
-	public long getCurrentTimeSeconds() {
-		Calendar cal = Calendar.getInstance();
-		return cal.getTimeInMillis();
-		//return System.currentTimeMillis();
-	}
-
-	public int getDayWeek(String paramDt) {
-		return getDayWeek(convertString2Date(paramDt));
-	}
-	public int getDayWeek(Date paramDt) {
-		Calendar cal = Calendar.getInstance();
-		cal.setTime(paramDt);
-		return cal.get(Calendar.DAY_OF_WEEK);		/* DAY_OF_WEEK 리턴값이 일요일(1), 월요일(2), 화요일(3) ~~ 토요일(7)을 반환합니다. */
-	}
-}

+ 3 - 2
utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafPrepareService.java

@@ -20,13 +20,14 @@ public class LinkTrafPrepareService implements AbstractProcessService {
     private final LinkTrafPatternService linkTrafPatternService;
 
     public int processing() {
-        log.info("[PREPARE]****** {}: [{}]", LogUtils.elapsedLog("가공 기초정보 로딩 시작"), TimeUtils.getCurrentTimeString());
+        log.info("[AFTER..]****** {}: [{}]", LogUtils.elapsedLog("가공 기초정보 로딩 시작"), TimeUtils.getCurrentTimeString());
+
         Elapsed elapsed = new Elapsed();
 
         this.linkTrafPatternService.processing();
         this.linkTrafParamService.processing();
 
-        log.info("[PREPARE]****** {}", LogUtils.elapsedLog("가공 초기정보 로딩 완료", elapsed.milliSeconds()));
+        log.info("[AFTER..]****** {}", LogUtils.elapsedLog("가공 초기정보 로딩 완료", elapsed.milliSeconds()));
         return 0;
     }
 

+ 1 - 1
utic-ptis-server/src/main/java/com/utic/ptis/server/service/LinkTrafSaveService.java

@@ -108,7 +108,7 @@ public class LinkTrafSaveService implements AbstractProcessService {
             log.info("[SAVE...] (SAV) {}", LogUtils.elapsedLog(result.getTableName(), result.getEffects(), result.getElapsedTime()));
         }
 
-        log.info("[SAVE...]****** {}", LogUtils.elapsedLog("교통정보 저장 시작", elapsed.milliSeconds()));
+        log.info("[SAVE...]****** {}", LogUtils.elapsedLog("교통정보 저장 완료", elapsed.milliSeconds()));
         return 0;
     }
 

+ 1 - 1
utic-ptis-server/src/main/java/com/utic/ptis/server/service/worker/LinkTrafDeleteWorker.java

@@ -40,7 +40,7 @@ public class LinkTrafDeleteWorker implements Runnable {
         stopWatch.stop();
         this.dbmsJobResult.setEffects(resultCount);
         this.dbmsJobResult.setElapsedTime(stopWatch.getTotalTimeMillis());
-        log.info("[DELETE.] LinkTrafDeleteWorker.run:  (DEL) {}", LogUtils.elapsedLog(this.deleteTable, resultCount, stopWatch.getTotalTimeMillis()));
+        log.info("[DELETE.] (DEL) {}", LogUtils.elapsedLog(this.deleteTable, resultCount, stopWatch.getTotalTimeMillis()));
     }
 
 }

+ 8 - 0
utic-ptis-server/src/main/java/com/utic/ptis/server/utils/LogUtils.java

@@ -46,4 +46,12 @@ public class LogUtils {
         DecimalFormat df = new DecimalFormat("#,###");
         return String.format("%s: [%8s ms]", adjustedMsg, df.format(elapsedTime));
     }
+    public static String numberLog(long nmbr) {
+        DecimalFormat df = new DecimalFormat("#,###");
+        return String.format("%8s", df.format(nmbr));
+    }
+    public static String numberLog(int nmbr) {
+        DecimalFormat df = new DecimalFormat("#,###");
+        return String.format("%8s", df.format(nmbr));
+    }
 }

+ 1 - 1
utic-ptis-server/src/main/resources/logback-spring-appender.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <included>
     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
-        <!--        <withJansi>true</withJansi>-->
+<!--        <withJansi>true</withJansi>-->
         <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
             <charset>${LOG_CHARSET}</charset>
             <pattern>${LOG_PATTERN_CONSOLE}</pattern>

+ 0 - 6
utic-ptis-server/src/main/resources/mybatis/mapper/dwdb/collect/LinkCollectOPER.xml

@@ -4,7 +4,6 @@
 <mapper namespace="mapper.dwdb.collect.OPER">
 
     <select id="findLinkCollectOPER" resultType="com.utic.ptis.server.dto.LinkCollectDto" parameterType="com.utic.ptis.server.dto.LinkCollectParam" fetchSize="1500">
-    <![CDATA[
         SELECT a.LINKID AS linkId,
                0        AS crtPriority,
                'O'      AS missValueYn,
@@ -17,11 +16,8 @@
           AND A.LINKID    = B.LINKID
           AND B.LINKLEVEL = '1'
         ORDER BY linkId, crtPriority
-
-        ]]>
     </select>
     <select id="findLinkCollectOPERbak" resultType="com.utic.ptis.server.dto.LinkCollectDto" parameterType="com.utic.ptis.server.dto.LinkCollectParam" fetchSize="1500">
-    <![CDATA[
         SELECT A.LINKID AS linkId,
                1        AS crtPriority,
                'O'      AS missValueYn,
@@ -46,7 +42,5 @@
           AND A.LINKID    = B.LINKID
           AND B.LINKLEVEL = '1'
         ORDER BY linkId, crtPriority
-
-        ]]>
     </select>
 </mapper>

+ 82 - 0
utic-ptis-server/src/main/resources/mybatis/mapper/utic/asn/LinkTrafAsnMapper.xml

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.utic.ptis.server.dao.mapper.utic.LinkTrafAsnMapper">
+
+    <delete id="deleteTrafficLoc">
+        TRUNCATE TABLE TRAFFIC_LOC
+    </delete>
+
+    <select id="findLinkTrafAsnTime" resultType="com.utic.ptis.server.dto.LinkTrafAsnTimeDto">
+        SELECT TO_CHAR(SYSDATE,            'YYYYMMDDHH24MI')||'00' AS currTime,
+               TO_CHAR(SYSDATE -   5/1440, 'YYYYMMDDHH24MI')||'00' AS past05MinTime,
+               TO_CHAR(SYSDATE -   6/1440, 'YYYYMMDDHH24MI')||'00' AS past10MinTime,
+               TO_CHAR(SYSDATE - 720/1440, 'YYYYMMDDHH24MI')||'00' AS incdTime
+        FROM DUAL
+    </select>
+
+    <insert id="insertTrafficLoc" parameterType="com.utic.ptis.server.dto.LinkTrafAsnTimeDto">
+        INSERT INTO TRAFFIC_LOC(LOGDATE, CENTERID, LINKID, LOCALDATE, SPEED)
+        SELECT TO_DATE(#{obj.currTime}, 'YYYYMMDDHH24MISS')         AS LOGDATE,
+               FROMCENTERID                                         AS CENTERID,
+               SUBSTR(MAXDATA, 18, 10)                              AS LINKID,
+               TO_DATE(SUBSTR(MAXDATA, 28, 14), 'YYYYMMDDHH24MISS') AS LOCALDATE,
+               TO_NUMBER(SUBSTR(MAXDATA, 43, 4))                    AS SPEED
+          FROM (
+                SELECT FROMCENTERID, MAX(TO_CHAR(LOGDATE, 'YYYYMMDDHH24MISS')||FROMCENTERID||TO_CHAR(LINKNUMBER)||TO_CHAR(REGDATE, 'YYYYMMDDHH24MISS')||TO_CHAR(SPEEDRATE, '0000')) MAXDATA
+                  FROM RCV_LINK_TRAFFIC@ASNDB
+                 WHERE LOGDATE <![CDATA[>]]>  TO_DATE(#{obj.past10MinTime}, 'YYYYMMDDHH24MISS')
+                   AND LOGDATE <![CDATA[<=]]> TO_DATE(#{obj.currTime}, 'YYYYMMDDHH24MISS')
+                   AND FROMCENTERID IN
+                     <foreach item="centerId" collection="obj.inCenterIds" open="("  close=")" separator=",">
+                         #{centerId}
+                     </foreach>
+                   AND LINKNUMBER <![CDATA[>]]> '1000000000'
+                   AND LINKNUMBER <![CDATA[<]]> '4210000000'
+                 GROUP BY FROMCENTERID, LINKNUMBER
+               )
+    </insert>
+
+    <select id="findAllTrafficLoc" resultType="com.utic.ptis.server.dto.LinkTrafAsnCountDto">
+        SELECT CENTERID AS centerId,
+               COUNT(1) AS dataCount
+          FROM TRAFFIC_LOC
+         WHERE LOGDATE = TO_DATE(#{obj.currTime}, 'YYYYMMDDHH24MISS')
+         GROUP BY CENTERID
+    </select>
+
+    <insert id="insertIncidentCommon" parameterType="com.utic.ptis.server.dto.LinkTrafAsnTimeDto">
+        INSERT INTO PTAPP.INCIDENT_COMMON(INCIDENTID,LOGDATE,REPORTDATE,LINKID,CENTERID,STARTDATE,ENDDATE,TRAFFICGRADE,
+                                          TROUBLEGRADE, INCIDENTTITLE, INCIDENTINFO, INCIDENTCODE, INCIDENTSUBCODE, LOCATION,
+                                          COORDX, COORDY, DATARESID)
+        SELECT NODE_NODEIDNUMBER, SYSDATE,
+               TO_DATE(SUBSTR(UPDATETYPEOTHER, 1, 14),  'YYYYMMDDHH24MISS'),
+               LINK_LINKIDNUMBER,
+               SUBSTR(NODE_NODEIDNUMBER, 1,3),
+               TO_DATE(SUBSTR(UPDATETYPEOTHER, 15, 14), 'YYYYMMDDHH24MISS'),
+               TO_DATE(SUBSTR(UPDATETYPEOTHER, 29, 14), 'YYYYMMDDHH24MISS'),
+               LTRIM(TO_CHAR(INCIDENTSTATUSCODE, '00')),
+               UPDATETYPECODE,
+               DESCRIPTIONTYPEINCIDENTOTHER,
+               INCIDENTVEHICLESINVOLVEDOTHER,
+               DESCRIPTIONTYPEINCIDENTCODE,
+               INCIDENTVEHICLESINVOLVEDCODE,
+               SUBSTR(INCIDENTSTATUSOTHER, 35, 120),
+               TO_NUMBER(LTRIM(SUBSTR(INCIDENTSTATUSOTHER, 1, 17))),
+               TO_NUMBER(SUBSTR(INCIDENTSTATUSOTHER, 19, 16)),
+               SUBSTR(NODE_NODEIDNUMBER, 2,2)
+        FROM RCV_INCIDENT@ASNDB
+        WHERE NODE_NODEIDNUMBER in
+              (
+                  SELECT NODE_NODEIDNUMBER INCIDENTID
+                  FROM RCV_INCIDENT@ASNDB
+                  WHERE LogDate > TO_DATE(#{obj.incdTime}, 'YYYYMMDDHH24MISS')
+            MINUS
+        SELECT INCIDENTID
+        FROM PTAPP.INCIDENT_COMMON
+        WHERE LogDate > TO_DATE(#{obj.incdTime}, 'YYYYMMDDHH24MISS')
+            )
+     AND FROMCENTERID = 'L01'
+    </insert>
+
+</mapper>

+ 0 - 2
utic-ptis-server/src/main/resources/mybatis/mapper/utic/collect/LinkCollectDONGBU.xml

@@ -4,7 +4,6 @@
 <mapper namespace="mapper.utic.collect.DONGBU">
 
     <select id="findLinkCollectDONGBU" resultType="com.utic.ptis.server.dto.LinkCollectDto" parameterType="com.utic.ptis.server.dto.LinkCollectParam" fetchSize="1500">
-    <![CDATA[
         SELECT A.LINKID AS linkId,
                1        AS crtPriority,
                'R'      AS missValueYn,
@@ -17,7 +16,6 @@
           AND A.LOGDATE > TO_DATE(#{ansTime}, 'YYYYMMDDHH24MISS') - 10/1440
           AND A.PRCDATE > TO_DATE(#{ansTime}, 'YYYYMMDDHH24MISS') - 20/1440
           AND A.SPEED BETWEEN 1 AND 149
-        ]]>
     </select>
 
 </mapper>

+ 0 - 2
utic-ptis-server/src/main/resources/mybatis/mapper/utic/collect/LinkCollectMOCT.xml

@@ -4,7 +4,6 @@
 <mapper namespace="mapper.utic.collect.MOCT">
 
     <select id="findLinkCollectMOCT" resultType="com.utic.ptis.server.dto.LinkCollectDto" parameterType="com.utic.ptis.server.dto.LinkCollectParam" fetchSize="1500">
-    <![CDATA[
         SELECT A.STD_LINK_ID AS linkId,
                1             AS crtPriority,
                'R'           AS missValueYn,
@@ -16,7 +15,6 @@
           AND A.STD_LINK_ID = B.LINKID
           AND B.LINKLEVEL = '1'
           AND A.SPEED BETWEEN 1 AND 149
-        ]]>
     </select>
 
 </mapper>

+ 0 - 2
utic-ptis-server/src/main/resources/mybatis/mapper/utic/collect/LinkCollectPRIO.xml

@@ -5,7 +5,6 @@
 
     <!--  우선순위가 높은 순서로 처리해야 함 팻치 순서에 따라 먼저 처리됨 -->
     <select id="findLinkCollectPRIO" resultType="com.utic.ptis.server.dto.LinkCollectDto" parameterType="com.utic.ptis.server.dto.LinkCollectParam" fetchSize="1500">
-    <![CDATA[
         SELECT LINKID      AS linkId,
                CRTPRIORITY AS crtPriority,
                MISSVALUEYN AS missValueYn,
@@ -45,7 +44,6 @@
                 AND A.SPEED BETWEEN 1 AND 149
              )
         ORDER BY LINKID, CRTPRIORITY
-        ]]>
     </select>
 
 </mapper>

+ 0 - 2
utic-ptis-server/src/main/resources/mybatis/mapper/utic/collect/LinkCollectPRIOETC.xml

@@ -5,7 +5,6 @@
 
     <!--  우선순위가 높은 순서로 처리해야 함 팻치 순서에 따라 먼저 처리됨 -->
     <select id="findLinkCollectPRIOETC" resultType="com.utic.ptis.server.dto.LinkCollectDto" parameterType="com.utic.ptis.server.dto.LinkCollectParam" fetchSize="1500">
-    <![CDATA[
         SELECT A.LINKID AS linkId,
                1        AS crtPriority,
                'R'      AS missValueYn,
@@ -20,7 +19,6 @@
           AND A.SPEED BETWEEN 1 AND 149
           AND A.LINKID NOT IN (SELECT DISTINCT LINKID FROM LOCAL_MATCH)
         GROUP BY A.LINKID
-        ]]>
     </select>
 
 </mapper>

+ 0 - 2
utic-ptis-server/src/main/resources/mybatis/mapper/utic/collect/LinkCollectUTIS.xml

@@ -4,7 +4,6 @@
 <mapper namespace="mapper.utic.collect.UTIS">
 
     <select id="findLinkCollectUTIS" resultType="com.utic.ptis.server.dto.LinkCollectDto" parameterType="com.utic.ptis.server.dto.LinkCollectParam" fetchSize="1500">
-    <![CDATA[
         SELECT LINKID   AS linkId,
                1        AS crtPriority,
                'R'      AS missValueYn,
@@ -21,7 +20,6 @@
                 AND A.SPD BETWEEN 11 AND 1499
               GROUP BY B.LINKID
              )
-        ]]>
     </select>
 
 </mapper>