From 44095e38bb49851f819991ff861266f3941877c4 Mon Sep 17 00:00:00 2001 From: leebj Date: Thu, 19 Jun 2025 09:22:50 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8A=B9=EC=A0=95=ED=84=B0=EB=84=90=EC=9E=A5?= =?UTF-8?q?=EB=B9=84=EA=B0=80=20=EA=B3=A0=EC=9E=A5=EB=82=A0=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EB=8B=A4=EB=A5=B8=ED=84=B0=EB=84=90=EC=9E=A5?= =?UTF-8?q?=EB=B9=84=EC=9D=98=20=EC=98=81=EC=83=81=EC=9D=84=20=EB=B0=9B?= =?UTF-8?q?=EC=9D=84=20=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=8D=BC=ED=8B=B0=ED=8C=8C=EC=9D=BC,=EC=9E=90?= =?UTF-8?q?=EB=B0=94=EC=86=8C=EC=8A=A4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1호터널config.properties | 8 +++++ 3호터널config.properties | 8 +++++ src/main/java/DumbJob.java | 71 +++++++++++++++++++++++--------------- 3 files changed, 60 insertions(+), 27 deletions(-) create mode 100644 1호터널config.properties create mode 100644 3호터널config.properties diff --git a/1호터널config.properties b/1호터널config.properties new file mode 100644 index 0000000..f53e7e0 --- /dev/null +++ b/1호터널config.properties @@ -0,0 +1,8 @@ +db_connect=http://192.168.201.146:92/cfs/trsmrcv/selectDefaultCarInfoMovie.do +tunnel_no=1 + +#api_url=http://150.50.53.230:80 3호 고장 +api_url=http://150.50.55.250:83 +api_id=admin +api_pw=1234 +not_broken_tunnel_no=1 diff --git a/3호터널config.properties b/3호터널config.properties new file mode 100644 index 0000000..b6b33d9 --- /dev/null +++ b/3호터널config.properties @@ -0,0 +1,8 @@ +db_connect=http://192.168.201.146:92/cfs/trsmrcv/selectDefaultCarInfoMovie.do +tunnel_no=3 + +#api_url=http://150.50.53.230:80 3호 고장 +api_url=http://150.50.55.250:83 +api_id=admin +api_pw=1234 +not_broken_tunnel_no=1 diff --git a/src/main/java/DumbJob.java b/src/main/java/DumbJob.java index add1085..84ce84b 100644 --- a/src/main/java/DumbJob.java +++ b/src/main/java/DumbJob.java @@ -31,11 +31,11 @@ public class DumbJob implements Job { private ArrayList state; - private static String[] g_strDB = new String[4]; + private static String g_strDB = ""; + private String g_strTunnel = ""; - private static String[] g_strFTP = new String[7]; - - private String g_strTenel = ""; + private static String[] g_strFTP = new String[3]; + private String g_strNotBrokenTunnel = ""; public static void main(String[] args) { String str = ""; @@ -57,23 +57,19 @@ public class DumbJob implements Job { Properties props = new Properties(); FileInputStream fis = new FileInputStream(propFile); props.load(new BufferedInputStream(fis)); - g_strDB[0] = props.getProperty("db_driver"); - g_strDB[1] = props.getProperty("db_connect"); - g_strDB[2] = props.getProperty("db_id"); - g_strDB[3] = props.getProperty("db_pw"); - System.out.println("=== " + g_strDB[0]); - System.out.println("=== " + g_strDB[1]); - System.out.println("=== " + g_strDB[2]); - System.out.println("=== " + g_strDB[3]); - g_strFTP[0] = props.getProperty("path_org"); - g_strFTP[1] = props.getProperty("ftp_ip"); - g_strFTP[2] = props.getProperty("ftp_id"); - g_strFTP[3] = props.getProperty("ftp_pw"); - g_strFTP[4] = props.getProperty("api_url"); - g_strFTP[5] = props.getProperty("api_id"); - g_strFTP[6] = props.getProperty("api_pw"); - - this.g_strTenel = props.getProperty("tennel_no"); + + g_strDB = props.getProperty("db_connect"); + + System.out.println("=== " + g_strDB); + + this.g_strTunnel = props.getProperty("tunnel_no"); + + g_strFTP[0] = props.getProperty("api_url"); + g_strFTP[1] = props.getProperty("api_id"); + g_strFTP[2] = props.getProperty("api_pw"); + + this.g_strNotBrokenTunnel = props.getProperty("not_broken_tunnel_no"); + props.clear(); props = null; } catch (Exception e) { @@ -114,7 +110,7 @@ public class DumbJob implements Job { map.put("0309", "07"); map.put("0310", "08"); JSONObject jsonParam = new JSONObject(); - jsonParam.put("fareOfficeId", String.format("0%s", new Object[] { this.g_strTenel.trim() })); + jsonParam.put("fareOfficeId", String.format("0%s", new Object[] { this.g_strTunnel.trim() })); jsonParam.put("start_dt", strPassDate); jsonParam.put("end_dt", strPassDate); StringBuffer strbuf = new StringBuffer(); @@ -148,14 +144,35 @@ public class DumbJob implements Job { System.out.println(objectInArray); nBoothId = Integer.parseInt(map.get(String.valueOf(objectInArray.get("FARE_OFFICE_ID").toString()) + objectInArray.get("BOOTH_ID").toString())); + if(this.g_strNotBrokenTunnel != null && !this.g_strNotBrokenTunnel.trim().equals("")) { + if(!this.g_strNotBrokenTunnel.trim().equals(this.g_strTunnel.trim())) { + switch(nBoothId) { + case 1 : + nBoothId = 5; + break; + case 2 : + nBoothId = 6; + break; + case 3 : + nBoothId = 7; + break; + case 4 : + nBoothId = 8; + break; + } + } + } + + + String uri = String.format("%s/download/video%d.mp4", new Object[] { - g_strFTP[4], + g_strFTP[0], Integer.valueOf(nBoothId) }); String param_id_pw = String.format("user=%s&password=%s", new Object[] { - g_strFTP[5], - g_strFTP[6] + g_strFTP[1], + g_strFTP[2] }); String param_start_end = String.format("start=%s&end=%s", new Object[] { @@ -187,8 +204,8 @@ public class DumbJob implements Job { InputStreamReader isr = null; BufferedReader br = null; try { - URL url = new URL(g_strDB[1]); - this.logger.info("==== : " + g_strDB[1]); + URL url = new URL(g_strDB); + this.logger.info("==== : " + g_strDB); connection = (HttpURLConnection)url.openConnection(); connection.setDoInput(true); connection.setDoOutput(true);