특정터널장비가 고장날 경우 다른터널장비의 영상을 받을 수 있도록 프로퍼티파일,자바소스 수정

main
이범준 6 months ago
parent 5a46445e0b
commit 44095e38bb

@ -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

@ -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

@ -31,11 +31,11 @@ public class DumbJob implements Job {
private ArrayList<String> state; private ArrayList<String> 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 static String[] g_strFTP = new String[3];
private String g_strNotBrokenTunnel = "";
private String g_strTenel = "";
public static void main(String[] args) { public static void main(String[] args) {
String str = ""; String str = "";
@ -57,23 +57,19 @@ public class DumbJob implements Job {
Properties props = new Properties(); Properties props = new Properties();
FileInputStream fis = new FileInputStream(propFile); FileInputStream fis = new FileInputStream(propFile);
props.load(new BufferedInputStream(fis)); props.load(new BufferedInputStream(fis));
g_strDB[0] = props.getProperty("db_driver");
g_strDB[1] = props.getProperty("db_connect"); g_strDB = props.getProperty("db_connect");
g_strDB[2] = props.getProperty("db_id");
g_strDB[3] = props.getProperty("db_pw"); System.out.println("=== " + g_strDB);
System.out.println("=== " + g_strDB[0]);
System.out.println("=== " + g_strDB[1]); this.g_strTunnel = props.getProperty("tunnel_no");
System.out.println("=== " + g_strDB[2]);
System.out.println("=== " + g_strDB[3]); g_strFTP[0] = props.getProperty("api_url");
g_strFTP[0] = props.getProperty("path_org"); g_strFTP[1] = props.getProperty("api_id");
g_strFTP[1] = props.getProperty("ftp_ip"); g_strFTP[2] = props.getProperty("api_pw");
g_strFTP[2] = props.getProperty("ftp_id");
g_strFTP[3] = props.getProperty("ftp_pw"); this.g_strNotBrokenTunnel = props.getProperty("not_broken_tunnel_no");
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");
props.clear(); props.clear();
props = null; props = null;
} catch (Exception e) { } catch (Exception e) {
@ -114,7 +110,7 @@ public class DumbJob implements Job {
map.put("0309", "07"); map.put("0309", "07");
map.put("0310", "08"); map.put("0310", "08");
JSONObject jsonParam = new JSONObject(); 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("start_dt", strPassDate);
jsonParam.put("end_dt", strPassDate); jsonParam.put("end_dt", strPassDate);
StringBuffer strbuf = new StringBuffer(); StringBuffer strbuf = new StringBuffer();
@ -148,14 +144,35 @@ public class DumbJob implements Job {
System.out.println(objectInArray); System.out.println(objectInArray);
nBoothId = Integer.parseInt(map.get(String.valueOf(objectInArray.get("FARE_OFFICE_ID").toString()) + objectInArray.get("BOOTH_ID").toString())); 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[] { String uri = String.format("%s/download/video%d.mp4", new Object[] {
g_strFTP[4], g_strFTP[0],
Integer.valueOf(nBoothId) Integer.valueOf(nBoothId)
}); });
String param_id_pw = String.format("user=%s&password=%s", new Object[] { String param_id_pw = String.format("user=%s&password=%s", new Object[] {
g_strFTP[5], g_strFTP[1],
g_strFTP[6] g_strFTP[2]
}); });
String param_start_end = String.format("start=%s&end=%s", new Object[] { String param_start_end = String.format("start=%s&end=%s", new Object[] {
@ -187,8 +204,8 @@ public class DumbJob implements Job {
InputStreamReader isr = null; InputStreamReader isr = null;
BufferedReader br = null; BufferedReader br = null;
try { try {
URL url = new URL(g_strDB[1]); URL url = new URL(g_strDB);
this.logger.info("==== : " + g_strDB[1]); this.logger.info("==== : " + g_strDB);
connection = (HttpURLConnection)url.openConnection(); connection = (HttpURLConnection)url.openConnection();
connection.setDoInput(true); connection.setDoInput(true);
connection.setDoOutput(true); connection.setDoOutput(true);

Loading…
Cancel
Save