shjung il y a 10 mois
Parent
commit
b472f54930

+ 32 - 2
src/main/java/com/ggits/etlp/server/entity/ggits/TbScsTConIntFlow.java

@@ -66,16 +66,46 @@ public class TbScsTConIntFlow implements Serializable {
     */
     private Double flowELat;
 
+    private boolean isValid() {
+        if (this.flowSLng == 0. ||
+                this.flowSLat == 0. ||
+                this.flowMLng == 0. ||
+                this.flowMLat == 0. ||
+                this.flowELng == 0. ||
+                this.flowELat == 0.) {
+            return false;
+        }
+        if (this.flowNo == 0 || this.flowNo == 18) {
+            // flowNo == 18 --> 무신호, 현시를 그리지 않는다. A링 하나만 있는 경우
+            return false;
+        }
+        return true;
+    }
     public HashMap<String, Object> toSig(String regionCd) {
         HashMap<String, Object> param = new HashMap<>();
+        if (!isValid()) {
+            // flowNo == 18 --> 무신호, 현시를 그리지 않는다. A링 하나만 있는 경우
+            return new HashMap<>();
+        }
+
         // OK
         param.put("REGION_CD",  regionCd);
         param.put("INT_NO",     this.intNo);
         param.put("MAP_NO",     this.intPlanClss > 0 ? this.intPlanClss -1 : this.intPlanClss); // 0~6
         param.put("RING_NO",    this.intRing == 1 ? 0 : 1); // 0:A링, 1:B링
         param.put("PHASE_NO",   this.intPhaseNo > 0 ? this.intPhaseNo-1 : this.intPhaseNo); // 0~7
-        param.put("FLOW_NO",    this.flowNo);
-        param.put("FLOW_TP",    "A");
+        param.put("FLOW_NO",    this.flowNo);   //이동류번호(1-16, 17, 18), 21, 23, 26, 27
+
+        String flowTp;
+        if (this.flowNo == 17) {
+            flowTp = "P";   // 보행자
+        }
+        else {
+            flowTp = (this.flowNo % 2) == 1 ? "L" : "S";    // 1,3,5,7,9,11,13,15 --> 홀수 --> 좌회전, 짝수 --> 직진
+        }
+
+        param.put("FLOW_TP",    flowTp);
+
         param.put("FLOW_S_LAT", this.flowSLat);
         param.put("FLOW_S_LNG", this.flowSLng);
         param.put("FLOW_M_LAT", this.flowMLat);

+ 12 - 6
src/main/java/com/ggits/etlp/server/service/GgitsEtlpService.java

@@ -254,6 +254,7 @@ public class GgitsEtlpService {
             TimeUtils.sleep(500);
             elapsed.reset();
 
+            int invalidData = 0;
             int writeCount = 0;
             int currWriteCount;
             Elapsed job = new Elapsed();
@@ -287,10 +288,15 @@ public class GgitsEtlpService {
                         currWriteCount = 0;
                         for(TbScsTConIntFlow obj: result) {
                             HashMap<String, Object> param = obj.toSig(center.getRegionCd());
-                            lists.add(param);
-                            if (lists.size() >= BatchDaoService.MAX_BATCH_SIZE) {
-                                currWriteCount += this.dao.updateTbIntFlow(lists);
-                                lists = new ArrayList<>();
+                            if (!param.isEmpty()) {
+                                lists.add(param);
+                                if (lists.size() >= BatchDaoService.MAX_BATCH_SIZE) {
+                                    currWriteCount += this.dao.updateTbIntFlow(lists);
+                                    lists = new ArrayList<>();
+                                }
+                            }
+                            else {
+                                invalidData++;
                             }
                         }
                         if (!lists.isEmpty()) {
@@ -302,8 +308,8 @@ public class GgitsEtlpService {
                     }
                 }
                 etlp.endEtlp(true, writeCount);
-                log.info("TB_INT_FLOW, SCS_T_CON_INTFLOW WRITE. {}, {}, {} EA. {}",
-                        center.getRegionCd(), center.getRegionNm(), writeCount, elapsed.elapsedTimeStr());
+                log.info("TB_INT_FLOW, SCS_T_CON_INTFLOW WRITE. {}, {}, {} EA. Invalid Data {} EA. {}",
+                        center.getRegionCd(), center.getRegionNm(), writeCount, invalidData, elapsed.elapsedTimeStr());
                 log.info("-------------------------------------------------------------------------------------------------");
             }
             catch (Exception e) {