Эх сурвалжийг харах

tb_evp_signal clct_dt column value current_timestamp(3) to STR_TO_DATE(#{clctDt},'%Y-%m-%d %H:%i:%s.%f')

shjung 1 жил өмнө
parent
commit
b34f455707
21 өөрчлөгдсөн 110 нэмэгдсэн , 35 устгасан
  1. 1 0
      conf/evps-comm-local.pid
  2. 1 0
      conf/evps-comm-server.pid
  3. BIN
      evps-comm-local-0.0.1.jar
  4. 14 5
      evps-comm-local/src/main/java/com/evps/comm/local/service/EvpsDataSimGen.java
  5. BIN
      evps-comm-server-0.0.1.jar
  6. 11 4
      evps-comm-server/src/main/java/com/evps/comm/server/EvpsCommServerApplication.java
  7. 4 3
      evps-comm-server/src/main/java/com/evps/comm/server/xnet/server/process/response/EvpsEvent.java
  8. 5 1
      evps-comm-server/src/main/java/com/evps/comm/server/xnet/server/process/response/EvpsNode.java
  9. 4 2
      evps-comm-server/src/main/java/com/evps/comm/server/xnet/server/process/response/EvpsService.java
  10. 5 4
      evps-comm-server/src/main/java/com/evps/comm/server/xnet/server/process/response/EvpsServiceEnd.java
  11. 3 1
      evps-comm-server/src/main/java/com/evps/comm/server/xnet/server/process/response/EvpsSignal.java
  12. 1 1
      evps-comm-server/src/main/resources/mybatis/mapper/EvpsServiceMapper.xml
  13. 20 9
      evps-comm-server/src/test/java/com/evps/comm/server/EvpsCommServerApplicationTest.java
  14. 6 0
      evps-common/src/main/java/com/evps/common/kafka/dto/EvpsNodeInfo.java
  15. 5 0
      evps-common/src/main/java/com/evps/common/kafka/dto/EvpsPhaseInfo.java
  16. 5 0
      evps-common/src/main/java/com/evps/common/kafka/dto/EvpsRouteInfo.java
  17. 5 0
      evps-common/src/main/java/com/evps/common/kafka/dto/EvpsSignalInfo.java
  18. 6 0
      evps-common/src/main/java/com/evps/common/kafka/dto/KafkaEvpsPhaseDto.java
  19. BIN
      evps-consumer.jar
  20. BIN
      evps-kafka-producer-0.0.1.jar
  21. 14 5
      evps-kafka-producer/src/main/java/com/evps/simulator/kafka/producer/service/EvpsKafkaSimGen.java

+ 1 - 0
conf/evps-comm-local.pid

@@ -0,0 +1 @@
+28404

+ 1 - 0
conf/evps-comm-server.pid

@@ -0,0 +1 @@
+23228

BIN
evps-comm-local-0.0.1.jar


+ 14 - 5
evps-comm-local/src/main/java/com/evps/comm/local/service/EvpsDataSimGen.java

@@ -41,9 +41,10 @@ public class EvpsDataSimGen {
         makeSignalData();
     }
     private void makeServiceData() {
+        String clctDt = EvpsUtils.getClctDt();
         this.serviceStartDto =  KafkaEvpsServiceDto.builder()
                 .serviceId(this.serviceId)
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .evNo(this.vehNo)
                 .curLat(36.3393600)
                 .curLng(127.4371250)
@@ -66,6 +67,7 @@ public class EvpsDataSimGen {
         for (int ii = 0; ii < lat.length; ii++) {
             EvpsRouteInfo route = EvpsRouteInfo.builder()
                     .serviceId(this.serviceId)
+                    .clctDt(clctDt)
                     .seqNo(ii + 1)
                     .lat(lat[ii])
                     .lng(lng[ii])
@@ -74,17 +76,19 @@ public class EvpsDataSimGen {
         }
     }
     private void makeServiceEndData() {
+        String clctDt = EvpsUtils.getClctDt();
         this.serviceEndDto =  KafkaEvpsServiceEndDto.builder()
                 .serviceId(this.serviceId)
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .reason(this.serviceEndReason)
                 .build();
     }
 
     private void makeNodeData() {
+        String clctDt = EvpsUtils.getClctDt();
         this.evpsNodeDto = KafkaEvpsNodeDto.builder()
                 .serviceId(this.serviceId)
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .nodeList(new ArrayList<>())
                 .build();
         // 노드정보
@@ -229,6 +233,7 @@ public class EvpsDataSimGen {
             long nodeId = nodeIdArr[ii];
             EvpsNodeInfo node = EvpsNodeInfo.builder()
                     .serviceId(this.serviceId)
+                    .clctDt(clctDt)
                     .seqNo(seqNo)
                     .nodeId(nodeId)
                     .nodeNm(nodeNm[ii])
@@ -240,6 +245,7 @@ public class EvpsDataSimGen {
             for (int jj = 0; jj < ring[ii].length; jj++) {
                 EvpsPhaseInfo phase = EvpsPhaseInfo.builder()
                         .serviceId(this.serviceId)
+                        .clctDt(clctDt)
                         .seqNo(seqNo)
                         .nodeId(nodeId)
                         .ring(ring[ii][jj])
@@ -279,10 +285,11 @@ public class EvpsDataSimGen {
 
 //        log.info("curLat: {}, curLng: {}, speed: {}, distance: {}", curLat.length, curLng.length, speed.length, distance.length);
 
+        String clctDt = EvpsUtils.getClctDt();
         for (int ii = 0; ii < curLat.length; ii++) {
             int eventCd = (ii == (curLat.length-1)) ? KafkaEvpsEventDto.EVPS_EVENT_SERVICE_END : KafkaEvpsEventDto.EVPS_EVENT_VEHICLE_MOVE;
             KafkaEvpsEventDto evpsEventDto = KafkaEvpsEventDto.builder()
-                    .clctDt(EvpsUtils.getClctDt())
+                    .clctDt(clctDt)
                     .serviceId(serviceId)
                     .evNo(this.vehNo)
                     .eventCd(eventCd)
@@ -2803,11 +2810,12 @@ public class EvpsDataSimGen {
 
         long[] nodeIdArr = {1382, 96, 97, 735, 238, 98, 667, 510, 439};
 
+        String clctDt = EvpsUtils.getClctDt();
         this.listSignalDto = new ArrayList<>();
         for (int jj = 0; jj < signalArr[0].length; jj++) {
             KafkaEvpsSignalDto data = KafkaEvpsSignalDto.builder()
                     .serviceId(this.serviceId)
-                    .clctDt(EvpsUtils.getClctDt())
+                    .clctDt(clctDt)
                     .signalList(new ArrayList<>())
                     .build();
 
@@ -2827,6 +2835,7 @@ public class EvpsDataSimGen {
 
                 EvpsSignalInfo signal = EvpsSignalInfo.builder()
                         .serviceId(this.serviceId)
+                        .clctDt(clctDt)
                         .nodeId(nodeId)
                         .seqNo(seqNo)
                         .remDist(remDist)

BIN
evps-comm-server-0.0.1.jar


+ 11 - 4
evps-comm-server/src/main/java/com/evps/comm/server/EvpsCommServerApplication.java

@@ -71,15 +71,17 @@ public class EvpsCommServerApplication implements CommandLineRunner, Application
         EvpsCommServerService evpsCommServerService = SpringUtils.getBean(EvpsCommServerService.class);
         evpsCommServerService.run();
 
+        Runtime.getRuntime().addShutdownHook(new Thread(() -> {
+            log.error("on shutdown hook.");
+            terminate();
+        }));
     }
 
-    @Override
-    public void onApplicationEvent(ContextClosedEvent contextClosedEvent) {
+    public void terminate() {
         SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
         log.error("************************************************************************************");
-        log.error("**    Application Terminated: {}, {}, {}",
-                sdfDate.format(new Date()), contextClosedEvent.getTimestamp(), contextClosedEvent);
+        log.error("**    Application Terminated: {}", sdfDate.format(new Date()));
         EvpsCommServerService cvimServer = SpringUtils.getBean(EvpsCommServerService.class);
         try {
             cvimServer.stop();
@@ -89,6 +91,11 @@ public class EvpsCommServerApplication implements CommandLineRunner, Application
         }
         log.error("************************************************************************************");
     }
+    @Override
+    public void onApplicationEvent(ContextClosedEvent contextClosedEvent) {
+        log.error("{}", contextClosedEvent);
+        terminate();
+    }
 
     @Override
     public void destroy() throws Exception {

+ 4 - 3
evps-comm-server/src/main/java/com/evps/comm/server/xnet/server/process/response/EvpsEvent.java

@@ -46,7 +46,7 @@ public class EvpsEvent implements EvpsCommResponse {
         return result;
     }
 
-    private KafkaEvpsEventDto getData(String serviceId, byte[] buffer, int idx) {
+    private KafkaEvpsEventDto getData(String serviceId, byte[] buffer, int idx, String clctDt) {
         // 차량번호
         byte[] vehNoArr = Arrays.copyOfRange(buffer, idx, idx+ EvpsProtocolConst.EVPS_VEHICLE_NO_SIZE);
         idx += EvpsProtocolConst.EVPS_VEHICLE_NO_SIZE;
@@ -60,7 +60,7 @@ public class EvpsEvent implements EvpsCommResponse {
         int distance   = ((buffer[idx++] & 0xFF) << 24) | ((buffer[idx++] & 0xFF) << 16) | ((buffer[idx++] & 0xFF) << 8) | (buffer[idx++] & 0xFF);
 
         return KafkaEvpsEventDto.builder()
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .serviceId(serviceId)
                 .evNo(EvpsByteUtils.toString(vehNoArr))
                 .eventCd(KafkaEvpsEventDto.EVPS_EVENT_VEHICLE_MOVE)
@@ -79,7 +79,8 @@ public class EvpsEvent implements EvpsCommResponse {
             return false;
         }
 
-        KafkaEvpsEventDto eventDto = getData(packet.getPacket().getServiceId(), buffer, 0);
+        String clctDt = EvpsUtils.getClctDt();
+        KafkaEvpsEventDto eventDto = getData(packet.getPacket().getServiceId(), buffer, 0, clctDt);
 
         if (center.isDump()) {
             log.info("[{}]. EvpsEvent.response: Service Id: {}, {}", center.getLogKey(), packet.getPacket().getServiceId(), eventDto);

+ 5 - 1
evps-comm-server/src/main/java/com/evps/comm/server/xnet/server/process/response/EvpsNode.java

@@ -89,14 +89,16 @@ public class EvpsNode implements EvpsCommResponse {
             return false;
         }
 
+        String clctDt = EvpsUtils.getClctDt();
         KafkaEvpsNodeDto nodeDto = KafkaEvpsNodeDto.builder()
                 .serviceId(serviceId)
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .nodeList(new ArrayList<>())
                 .build();
 
         KafkaEvpsPhaseDto phaseDto = KafkaEvpsPhaseDto.builder()
                 .serviceId(serviceId)
+                .clctDt(clctDt)
                 .phaseList(new ArrayList<>())
                 .build();
 
@@ -119,6 +121,7 @@ public class EvpsNode implements EvpsCommResponse {
             int seqNo = ii+1;
             EvpsNodeInfo node = EvpsNodeInfo.builder()
                     .serviceId(nodeDto.getServiceId())
+                    .clctDt(clctDt)
                     .seqNo(seqNo)
                     .nodeId(nodeId)
                     .nodeNm(EvpsByteUtils.toString(nodeNmArr))
@@ -155,6 +158,7 @@ public class EvpsNode implements EvpsCommResponse {
 
                 EvpsPhaseInfo phase = EvpsPhaseInfo.builder()
                         .serviceId(nodeDto.getServiceId())
+                        .clctDt(clctDt)
                         .seqNo(seqNo)
                         .nodeId(nodeId)
                         .ring(ring)

+ 4 - 2
evps-comm-server/src/main/java/com/evps/comm/server/xnet/server/process/response/EvpsService.java

@@ -125,10 +125,11 @@ public class EvpsService implements EvpsCommResponse {
             return false;
         }
 
+        String clctDt = EvpsUtils.getClctDt();
         // 서비스 시작 정보 입력
         KafkaEvpsServiceDto service = KafkaEvpsServiceDto.builder()
                 .serviceId(packet.getPacket().getServiceId())
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .evNo(EvpsByteUtils.toString(vehNoArr))
                 .curLat(currentLat/EvpsProtocolConst.EVPS_GEO_CORRECT)
                 .curLng(currentLng/EvpsProtocolConst.EVPS_GEO_CORRECT)
@@ -157,6 +158,7 @@ public class EvpsService implements EvpsCommResponse {
 
             EvpsRouteInfo route = EvpsRouteInfo.builder()
                     .serviceId(service.getServiceId())
+                    .clctDt(clctDt)
                     .seqNo(ii + 1)
                     .lat(routeLat / EvpsProtocolConst.EVPS_GEO_CORRECT)
                     .lng(routeLng / EvpsProtocolConst.EVPS_GEO_CORRECT)
@@ -185,7 +187,7 @@ public class EvpsService implements EvpsCommResponse {
 
         // 이벤트 정보 입력(서비스 시작)
         KafkaEvpsEventDto event = KafkaEvpsEventDto.builder()
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .serviceId(service.getServiceId())
                 .evNo(EvpsByteUtils.toString(vehNoArr).trim())
                 .eventCd(KafkaEvpsEventDto.EVPS_EVENT_VEHICLE_MOVE)

+ 5 - 4
evps-comm-server/src/main/java/com/evps/comm/server/xnet/server/process/response/EvpsServiceEnd.java

@@ -56,11 +56,11 @@ public class EvpsServiceEnd implements EvpsCommResponse {
         return result;
     }
 
-    private KafkaEvpsServiceEndDto getData(String serviceId, byte[] buffer, int idx) {
+    private KafkaEvpsServiceEndDto getData(String serviceId, byte[] buffer, int idx, String clctDt) {
         int reason = ((buffer[idx++] & 0xFF) << 24) | ((buffer[idx++] & 0xFF) << 16) | ((buffer[idx++] & 0xFF) << 8) | (buffer[idx++] & 0xFF);
         return KafkaEvpsServiceEndDto.builder()
                 .serviceId(serviceId)
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .reason(reason)
                 .build();
     }
@@ -73,14 +73,15 @@ public class EvpsServiceEnd implements EvpsCommResponse {
             return false;
         }
 
-        KafkaEvpsServiceEndDto data = getData(packet.getPacket().getServiceId(), buffer, 0);
+        String clctDt = EvpsUtils.getClctDt();
+        KafkaEvpsServiceEndDto data = getData(packet.getPacket().getServiceId(), buffer, 0, clctDt);
 
         log.info("[{}]. EvpsServiceEnd.response: Service Id: {}, {}", center.getLogKey(), data.getServiceId(), data);
 
         // 이벤트 정보 입력(서비스 종료)
         KafkaEvpsEventDto event = KafkaEvpsEventDto.builder()
                 .serviceId(data.getServiceId())
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .eventCd(KafkaEvpsEventDto.EVPS_EVENT_SERVICE_END)
                 .build();
 

+ 3 - 1
evps-comm-server/src/main/java/com/evps/comm/server/xnet/server/process/response/EvpsSignal.java

@@ -78,6 +78,7 @@ public class EvpsSignal implements EvpsCommResponse {
             return false;
         }
 
+        String clctDt = EvpsUtils.getClctDt();
         String serviceId = packet.getPacket().getServiceId();
 
         int idx = 0;
@@ -92,7 +93,7 @@ public class EvpsSignal implements EvpsCommResponse {
 
         KafkaEvpsSignalDto signalDto = KafkaEvpsSignalDto.builder()
                 .serviceId(serviceId)
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .signalList(new ArrayList<>())
                 .build();
 
@@ -107,6 +108,7 @@ public class EvpsSignal implements EvpsCommResponse {
 
             EvpsSignalInfo signal = EvpsSignalInfo.builder()
                     .serviceId(serviceId)
+                    .clctDt(clctDt)
                     .nodeId(nodeId)
                     .seqNo(ii+1)
                     .remDist(remDist)

+ 1 - 1
evps-comm-server/src/main/resources/mybatis/mapper/EvpsServiceMapper.xml

@@ -288,7 +288,7 @@
                                    a_ring_phase,
                                    b_ring_phase,
                                    hold_phase)
-        VALUES ( current_timestamp(3),
+        VALUES ( STR_TO_DATE(#{clctDt},'%Y-%m-%d %H:%i:%s.%f'),
                  #{serviceId},
                  #{nodeId},
                  #{seqNo},

+ 20 - 9
evps-comm-server/src/test/java/com/evps/comm/server/EvpsCommServerApplicationTest.java

@@ -221,10 +221,11 @@ public class EvpsCommServerApplicationTest {
         log.info("result: {}", makeEndData(packet, packet.getPacket().getBuffer()));
     }
 
-    private KafkaEvpsServiceEndDto getEndData(String serviceId, byte[] buffer, int idx) {
+    private KafkaEvpsServiceEndDto getEndData(String serviceId, byte[] buffer, int idx, String clctDt) {
         int reason = ((buffer[idx++] & 0xFF) << 24) | ((buffer[idx++] & 0xFF) << 16) | ((buffer[idx++] & 0xFF) << 8) | (buffer[idx++] & 0xFF);
         return KafkaEvpsServiceEndDto.builder()
                 .serviceId(serviceId)
+                .clctDt(clctDt)
                 .reason(reason)
                 .build();
     }
@@ -237,12 +238,13 @@ public class EvpsCommServerApplicationTest {
             return false;
         }
 
-        KafkaEvpsServiceEndDto data = getEndData(packet.getPacket().getServiceId(), buffer, 0);
+        String clctDt = EvpsUtils.getClctDt();
+        KafkaEvpsServiceEndDto data = getEndData(packet.getPacket().getServiceId(), buffer, 0, clctDt);
         log.info("[{}], EvpsServiceEnd.response: Service Id: {}, {}", center.getLogKey(), data.getServiceId(), data);
 
         // 이벤트 정보 입력(서비스 종료)
         KafkaEvpsEventDto event = KafkaEvpsEventDto.builder()
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .serviceId(data.getServiceId())
                 .eventCd(KafkaEvpsEventDto.EVPS_EVENT_SERVICE_END)
                 .build();
@@ -294,6 +296,7 @@ public class EvpsCommServerApplicationTest {
             return false;
         }
 
+        String clctDt = EvpsUtils.getClctDt();
         String serviceId = packet.getPacket().getServiceId();
 
         int idx = 0;
@@ -308,7 +311,7 @@ public class EvpsCommServerApplicationTest {
 
         KafkaEvpsSignalDto data = KafkaEvpsSignalDto.builder()
                 .serviceId(serviceId)
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .signalList(new ArrayList<>())
                 .build();
 
@@ -324,6 +327,7 @@ public class EvpsCommServerApplicationTest {
 
             EvpsSignalInfo signal = EvpsSignalInfo.builder()
                     .serviceId(serviceId)
+                    .clctDt(clctDt)
                     .nodeId(nodeId)
                     .seqNo(ii+1)
                     .remDist(remDist)
@@ -377,7 +381,7 @@ public class EvpsCommServerApplicationTest {
         log.info("result: {}", makeEventData(packet, packet.getPacket().getBuffer()));
     }
 
-    private KafkaEvpsEventDto getEventData(String serviceId, byte[] buffer, int idx) {
+    private KafkaEvpsEventDto getEventData(String serviceId, byte[] buffer, int idx, String clctDt) {
         // 차량번호
         byte[] vehNoArr = Arrays.copyOfRange(buffer, idx, idx+EvpsProtocolConst.EVPS_VEHICLE_NO_SIZE);
         idx += EvpsProtocolConst.EVPS_VEHICLE_NO_SIZE;
@@ -391,7 +395,7 @@ public class EvpsCommServerApplicationTest {
         int distance   = ((buffer[idx++] & 0xFF) << 24) | ((buffer[idx++] & 0xFF) << 16) | ((buffer[idx++] & 0xFF) << 8) | (buffer[idx++] & 0xFF);
 
         return KafkaEvpsEventDto.builder()
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .serviceId(serviceId)
                 .evNo(EvpsByteUtils.toString(vehNoArr))
                 .eventCd(KafkaEvpsEventDto.EVPS_EVENT_VEHICLE_MOVE)
@@ -410,7 +414,8 @@ public class EvpsCommServerApplicationTest {
             return false;
         }
 
-        KafkaEvpsEventDto data = getEventData(packet.getPacket().getServiceId(), buffer, 0);
+        String clctDt = EvpsUtils.getClctDt();
+        KafkaEvpsEventDto data = getEventData(packet.getPacket().getServiceId(), buffer, 0, clctDt);
 
         log.info("[{}], EvpsEvent.response: Service Id: {}, {}", center.getLogKey(), packet.getPacket().getServiceId(), data);
         return true;
@@ -455,8 +460,10 @@ public class EvpsCommServerApplicationTest {
             return false;
         }
 
+        String clctDt = EvpsUtils.getClctDt();
         KafkaEvpsNodeDto data = KafkaEvpsNodeDto.builder()
                 .serviceId(serviceId)
+                .clctDt(clctDt)
                 .nodeList(new ArrayList<>())
                 .build();
 
@@ -472,6 +479,7 @@ public class EvpsCommServerApplicationTest {
             int seqNo = ii+1;
             EvpsNodeInfo node = EvpsNodeInfo.builder()
                     .serviceId(serviceId)
+                    .clctDt(clctDt)
                     .seqNo(seqNo)
                     .nodeId(nodeId)
                     .nodeNm(EvpsByteUtils.toString(nodeNmArr))
@@ -509,6 +517,7 @@ public class EvpsCommServerApplicationTest {
 
                 EvpsPhaseInfo phase = EvpsPhaseInfo.builder()
                         .serviceId(serviceId)
+                        .clctDt(clctDt)
                         .seqNo(seqNo)
                         .nodeId(nodeId)
                         .ring(ring)
@@ -640,10 +649,11 @@ public class EvpsCommServerApplicationTest {
             return false;
         }
 
+        String clctDt = EvpsUtils.getClctDt();
         // 서비스 시작 정보 입력
         KafkaEvpsServiceDto service = KafkaEvpsServiceDto.builder()
                 .serviceId(packet.getPacket().getServiceId())
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .evNo(EvpsByteUtils.toString(vehNoArr))
                 .curLat(currentLat/EvpsProtocolConst.EVPS_GEO_CORRECT)
                 .curLng(currentLng/EvpsProtocolConst.EVPS_GEO_CORRECT)
@@ -671,6 +681,7 @@ public class EvpsCommServerApplicationTest {
 
             EvpsRouteInfo route = EvpsRouteInfo.builder()
                     .serviceId(service.getServiceId())
+                    .clctDt(clctDt)
                     .seqNo(ii + 1)
                     .lat(routeLat / EvpsProtocolConst.EVPS_GEO_CORRECT)
                     .lng(routeLng / EvpsProtocolConst.EVPS_GEO_CORRECT)
@@ -689,7 +700,7 @@ public class EvpsCommServerApplicationTest {
 
         // 이벤트 정보 입력(서비스 시작)
         KafkaEvpsEventDto event = KafkaEvpsEventDto.builder()
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .serviceId(service.getServiceId())
                 .evNo(EvpsByteUtils.toString(vehNoArr))
                 .eventCd(KafkaEvpsEventDto.EVPS_EVENT_VEHICLE_MOVE)

+ 6 - 0
evps-common/src/main/java/com/evps/common/kafka/dto/EvpsNodeInfo.java

@@ -17,6 +17,12 @@ public class EvpsNodeInfo {
      */
     @JsonIgnore
     private String serviceId;
+    /**
+     * 수집시각
+     */
+    @JsonIgnore
+    private String clctDt;
+
     /**
      * 교차로 순서(1,...,N)
      */

+ 5 - 0
evps-common/src/main/java/com/evps/common/kafka/dto/EvpsPhaseInfo.java

@@ -14,6 +14,11 @@ public class EvpsPhaseInfo {
      */
     @JsonIgnore
     private String serviceId;
+    /**
+     * 수집시각
+     */
+    @JsonIgnore
+    private String clctDt;
     /**
      * 교차로 순서(1,...,N)
      */

+ 5 - 0
evps-common/src/main/java/com/evps/common/kafka/dto/EvpsRouteInfo.java

@@ -17,6 +17,11 @@ public class EvpsRouteInfo {
      */
     @JsonIgnore
     private String serviceId;
+    /**
+     * 수집시각
+     */
+    @JsonIgnore
+    private String clctDt;
     /**
      * 경로 순서(1,...,N)
      */

+ 5 - 0
evps-common/src/main/java/com/evps/common/kafka/dto/EvpsSignalInfo.java

@@ -17,6 +17,11 @@ public class EvpsSignalInfo {
      */
     @JsonIgnore
     private String serviceId;
+    /**
+     * 수집시각
+     */
+    @JsonIgnore
+    private String clctDt;
     /**
      * 교차로 순서(1,...,N)
      */

+ 6 - 0
evps-common/src/main/java/com/evps/common/kafka/dto/KafkaEvpsPhaseDto.java

@@ -1,5 +1,6 @@
 package com.evps.common.kafka.dto;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.*;
 
 import java.util.ArrayList;
@@ -18,6 +19,11 @@ public class KafkaEvpsPhaseDto implements KafkaEvpsData{
      * 긴급차량 서비스 ID
      */
     private String serviceId;
+    /**
+     * 수집시각
+     */
+    @JsonIgnore
+    private String clctDt;
 
     @Builder.Default
     private List<EvpsPhaseInfo> phaseList = new ArrayList<>();

BIN
evps-consumer.jar


BIN
evps-kafka-producer-0.0.1.jar


+ 14 - 5
evps-kafka-producer/src/main/java/com/evps/simulator/kafka/producer/service/EvpsKafkaSimGen.java

@@ -41,9 +41,10 @@ public class EvpsKafkaSimGen {
         makeSignalData();
     }
     private void makeServiceData() {
+        String clctDt = EvpsUtils.getClctDt();
         this.serviceStartDto =  KafkaEvpsServiceDto.builder()
                 .serviceId(this.serviceId)
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .evNo(this.vehNo)
                 .curLat(36.3393600)
                 .curLng(127.4371250)
@@ -66,6 +67,7 @@ public class EvpsKafkaSimGen {
         for (int ii = 0; ii < lat.length; ii++) {
             EvpsRouteInfo route = EvpsRouteInfo.builder()
                     .serviceId(this.serviceId)
+                    .clctDt(clctDt)
                     .seqNo(ii + 1)
                     .lat(lat[ii])
                     .lng(lng[ii])
@@ -74,17 +76,19 @@ public class EvpsKafkaSimGen {
         }
     }
     private void makeServiceEndData() {
+        String clctDt = EvpsUtils.getClctDt();
         this.serviceEndDto =  KafkaEvpsServiceEndDto.builder()
                 .serviceId(this.serviceId)
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .reason(this.serviceEndReason)
                 .build();
     }
 
     private void makeNodeData() {
+        String clctDt = EvpsUtils.getClctDt();
         this.evpsNodeDto = KafkaEvpsNodeDto.builder()
                 .serviceId(this.serviceId)
-                .clctDt(EvpsUtils.getClctDt())
+                .clctDt(clctDt)
                 .nodeList(new ArrayList<>())
                 .build();
         // 노드정보
@@ -229,6 +233,7 @@ public class EvpsKafkaSimGen {
             long nodeId = nodeIdArr[ii];
             EvpsNodeInfo node = EvpsNodeInfo.builder()
                     .serviceId(this.serviceId)
+                    .clctDt(clctDt)
                     .seqNo(seqNo)
                     .nodeId(nodeId)
                     .nodeNm(nodeNm[ii])
@@ -240,6 +245,7 @@ public class EvpsKafkaSimGen {
             for (int jj = 0; jj < ring[ii].length; jj++) {
                 EvpsPhaseInfo phase = EvpsPhaseInfo.builder()
                         .serviceId(this.serviceId)
+                        .clctDt(clctDt)
                         .seqNo(seqNo)
                         .nodeId(nodeId)
                         .ring(ring[ii][jj])
@@ -279,10 +285,11 @@ public class EvpsKafkaSimGen {
 
 //        log.info("curLat: {}, curLng: {}, speed: {}, distance: {}", curLat.length, curLng.length, speed.length, distance.length);
 
+        String clctDt = EvpsUtils.getClctDt();
         for (int ii = 0; ii < curLat.length; ii++) {
             int eventCd = (ii == (curLat.length-1)) ? KafkaEvpsEventDto.EVPS_EVENT_SERVICE_END : KafkaEvpsEventDto.EVPS_EVENT_VEHICLE_MOVE;
             KafkaEvpsEventDto evpsEventDto = KafkaEvpsEventDto.builder()
-                    .clctDt(EvpsUtils.getClctDt())
+                    .clctDt(clctDt)
                     .serviceId(serviceId)
                     .evNo(this.vehNo)
                     .eventCd(eventCd)
@@ -2803,11 +2810,12 @@ public class EvpsKafkaSimGen {
 
         long[] nodeIdArr = {1382, 96, 97, 735, 238, 98, 667, 510, 439};
 
+        String clctDt = EvpsUtils.getClctDt();
         this.listSignalDto = new ArrayList<>();
         for (int jj = 0; jj < signalArr[0].length; jj++) {
             KafkaEvpsSignalDto data = KafkaEvpsSignalDto.builder()
                     .serviceId(this.serviceId)
-                    .clctDt(EvpsUtils.getClctDt())
+                    .clctDt(clctDt)
                     .signalList(new ArrayList<>())
                     .build();
 
@@ -2827,6 +2835,7 @@ public class EvpsKafkaSimGen {
 
                 EvpsSignalInfo signal = EvpsSignalInfo.builder()
                         .serviceId(this.serviceId)
+                        .clctDt(clctDt)
                         .nodeId(nodeId)
                         .seqNo(seqNo)
                         .remDist(remDist)