소스 검색

atrd statistics query date modify

shjung 3 년 전
부모
커밋
fb0fd3c4c2
1개의 변경된 파일45개의 추가작업 그리고 0개의 파일을 삭제
  1. 45 0
      src/main/java/com/its/op/dto/its/statistics/TrafficTermParam.java

+ 45 - 0
src/main/java/com/its/op/dto/its/statistics/TrafficTermParam.java

@@ -1,5 +1,6 @@
 package com.its.op.dto.its.statistics;
 
+import com.its.utils.ItsUtils;
 import io.swagger.annotations.ApiModel;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
@@ -15,4 +16,48 @@ public class TrafficTermParam extends QueryCondParam {
     private String ID;
     private String FROM_DT;
     private String TO_DT;
+
+    public TrafficTermParam(String ID, String FROM_DT, String TO_DT) {
+        this.ID = ID;
+        this.FROM_DT = FROM_DT;
+        this.TO_DT = TO_DT;
+
+        int fromDateLength = this.FROM_DT.length();
+        switch(fromDateLength) {
+            case  4: // YYYY
+                this.FROM_DT = this.FROM_DT + "0101000000";
+                break;
+            case  6: // YYYYMM
+                this.FROM_DT = this.FROM_DT + "01000000";
+                break;
+            case  8: // YYYYMMDD
+                this.FROM_DT = this.FROM_DT + "000000";
+                break;
+            case 10: // YYYYMMDDHH24
+                this.FROM_DT = this.FROM_DT + "0000";
+                break;
+            case 12: // YYYYMMDDHH24MI
+                this.FROM_DT = this.FROM_DT + "00";
+                break;
+        }
+
+        int toDateLength = this.TO_DT.length();
+        switch(toDateLength) {
+            case  4: // YYYY
+                this.TO_DT = this.TO_DT + "1231235959";
+                break;
+            case  6: // YYYYMM
+                this.TO_DT = ItsUtils.getLastDayOfMonth(this.TO_DT) + "235959";
+                break;
+            case  8: // YYYYMMDD
+                this.TO_DT = this.TO_DT + "235959";
+                break;
+            case 10: // YYYYMMDDHH24
+                this.TO_DT = this.TO_DT + "5959";
+                break;
+            case 12: // YYYYMMDDHH24MI
+                this.TO_DT = this.TO_DT + "59";
+                break;
+        }
+    }
 }