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);