소스정리 미사용 클래스,메소드 제거
parent
79ceafc88d
commit
50c5e6f35b
@ -1,92 +0,0 @@
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.JobKey;
|
||||
|
||||
public class ANPRStatusJob implements Job {
|
||||
private String jobSays;
|
||||
|
||||
private float myFloatValue;
|
||||
|
||||
private ArrayList<Date> state;
|
||||
|
||||
private String g_strTenel = "";
|
||||
|
||||
private List<String> g_listN1 = new ArrayList<>();
|
||||
|
||||
private List<String> g_listN3 = new ArrayList<>();
|
||||
|
||||
private final Logger logger = Logger.getLogger(AnprImageJob.class);
|
||||
|
||||
public ANPRStatusJob() {
|
||||
PropertyConfigurator.configure("./log4j.properties");
|
||||
try {
|
||||
String propFile = "./config.properties";
|
||||
Properties props = new Properties();
|
||||
FileInputStream fis = new FileInputStream(propFile);
|
||||
props.load(new BufferedInputStream(fis));
|
||||
this.g_strTenel = props.getProperty("tennel_no");
|
||||
props.clear();
|
||||
props = null;
|
||||
System.out.println("===================== A");
|
||||
this.g_listN1.add("01");
|
||||
this.g_listN1.add("02");
|
||||
this.g_listN1.add("03");
|
||||
this.g_listN1.add("04");
|
||||
this.g_listN1.add("05");
|
||||
this.g_listN1.add("06");
|
||||
this.g_listN1.add("07");
|
||||
this.g_listN1.add("08");
|
||||
this.g_listN3.add("01");
|
||||
this.g_listN3.add("02");
|
||||
this.g_listN3.add("03");
|
||||
this.g_listN3.add("04");
|
||||
this.g_listN3.add("07");
|
||||
this.g_listN3.add("08");
|
||||
this.g_listN3.add("09");
|
||||
this.g_listN3.add("10");
|
||||
System.out.println("===================== B");
|
||||
} catch (Exception e) {
|
||||
this.logger.debug("Exception : " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
JobKey key = context.getJobDetail().getKey();
|
||||
this.state.add(new Date());
|
||||
this.logger.info("Instance " + key + " of DmbJob says: " + this.jobSays + ", and val is: " + this.myFloatValue +
|
||||
", state size:" + this.state.size() + "," + this.state.get(this.state.size() - 1));
|
||||
this.logger.debug("======== 차로개수 : " + this.g_listN3.size());
|
||||
List<String> list = new ArrayList<>();
|
||||
if (this.g_strTenel.equals("3")) {
|
||||
list.addAll(this.g_listN3);
|
||||
} else if (this.g_strTenel.equals("1")) {
|
||||
list.addAll(this.g_listN1);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void setJobSays(String jobSays) {
|
||||
this.jobSays = jobSays;
|
||||
}
|
||||
|
||||
public void setMyFloatValue(float myFloatValue) {
|
||||
this.myFloatValue = myFloatValue;
|
||||
}
|
||||
|
||||
public void setState(ArrayList<Date> state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,86 +0,0 @@
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
|
||||
public class AnprCarINfoSendFixDay {
|
||||
private String g_strTenel = "";
|
||||
|
||||
private List<String> g_listN1 = new ArrayList<>();
|
||||
|
||||
private List<String> g_listN3 = new ArrayList<>();
|
||||
|
||||
private final Logger logger = Logger.getLogger(AnprCarINfoSendFixDay.class);
|
||||
|
||||
public AnprCarINfoSendFixDay() {
|
||||
PropertyConfigurator.configure("./log4j.properties");
|
||||
try {
|
||||
String propFile = "./config.properties";
|
||||
Properties props = new Properties();
|
||||
FileInputStream fis = new FileInputStream(propFile);
|
||||
props.load(new BufferedInputStream(fis));
|
||||
this.g_strTenel = props.getProperty("tennel_no");
|
||||
props.clear();
|
||||
props = null;
|
||||
System.out.println("===================== A");
|
||||
this.g_listN1.add("01");
|
||||
this.g_listN1.add("02");
|
||||
this.g_listN1.add("03");
|
||||
this.g_listN1.add("04");
|
||||
this.g_listN1.add("05");
|
||||
this.g_listN1.add("06");
|
||||
this.g_listN1.add("07");
|
||||
this.g_listN1.add("08");
|
||||
|
||||
this.g_listN3.add("01");
|
||||
this.g_listN3.add("02");
|
||||
this.g_listN3.add("03");
|
||||
this.g_listN3.add("04");
|
||||
|
||||
this.g_listN3.add("07");
|
||||
this.g_listN3.add("08");
|
||||
this.g_listN3.add("09");
|
||||
this.g_listN3.add("10");
|
||||
System.out.println("===================== B");
|
||||
} catch (Exception e) {
|
||||
this.logger.debug("Exception : " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
this.logger.debug("======== 요금소 구분 : [" + this.g_strTenel + "]");
|
||||
this.logger.debug("======== 차로개수 : " + this.g_listN3.size());
|
||||
List<String> list = new ArrayList<>();
|
||||
if (this.g_strTenel.equals("3")) {
|
||||
list.addAll(this.g_listN3);
|
||||
} else if (this.g_strTenel.equals("1")) {
|
||||
list.addAll(this.g_listN1);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
SendThread obj = null;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
this.logger.info(String.format("%s차로 시작", new Object[] { list.get(i) }));
|
||||
obj = new SendThread(list.get(i)); //차로2자리
|
||||
obj.runCarNoImageSend();
|
||||
try {
|
||||
Thread.sleep(5L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.logger.info(String.format("%s차로 끝", new Object[] { list.get(i) }));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Location: C:\Users\sddd1\Desktop\anpr_img_send.jar!\AnprCarINfoSendFixDay.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
@ -1,167 +0,0 @@
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class AnprStateSend extends Thread {
|
||||
private String[] g_strDB = new String[4];
|
||||
|
||||
private String[] g_strFTP = new String[6];
|
||||
|
||||
private String[] g_strFTPColl = new String[4];
|
||||
|
||||
private String g_strTenel = "";
|
||||
|
||||
private String g_strLane = "";
|
||||
|
||||
private String g_strApiUrAnprStatusl = "";
|
||||
|
||||
private final Logger logger = Logger.getLogger(AnprStateSend.class);
|
||||
|
||||
public AnprStateSend(String str) {
|
||||
try {
|
||||
String propFile = "./config.properties";
|
||||
Properties props = new Properties();
|
||||
FileInputStream fis = new FileInputStream(propFile);
|
||||
props.load(new BufferedInputStream(fis));
|
||||
this.g_strDB[0] = props.getProperty("db_driver");
|
||||
this.g_strDB[1] = props.getProperty("db_connect");
|
||||
this.g_strDB[2] = props.getProperty("db_id");
|
||||
this.g_strDB[3] = props.getProperty("db_pw");
|
||||
this.g_strFTP[0] = props.getProperty("path_org");
|
||||
this.g_strFTP[1] = props.getProperty("ftp_ip");
|
||||
this.g_strFTP[2] = props.getProperty("ftp_id");
|
||||
this.g_strFTP[3] = props.getProperty("ftp_pw");
|
||||
this.g_strFTP[4] = props.getProperty("api_url");
|
||||
this.g_strFTP[5] = props.getProperty("path_desc");
|
||||
this.g_strFTPColl[0] = props.getProperty("coll_ftp_ip");
|
||||
this.g_strFTPColl[1] = props.getProperty("coll_ftp_id");
|
||||
this.g_strFTPColl[2] = props.getProperty("coll_ftp_pw");
|
||||
this.g_strFTPColl[3] = props.getProperty("center_ftp_ip");
|
||||
this.g_strTenel = props.getProperty("tennel_no");
|
||||
this.g_strLane = str;
|
||||
this.g_strApiUrAnprStatusl = props.getProperty("api_url_status");
|
||||
props.clear();
|
||||
props = null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
runCarNoImageSend();
|
||||
this.logger.debug(String.format("=======================================================", new Object[0]));
|
||||
}
|
||||
|
||||
public void runCarNoImageSend() {
|
||||
Map<String, String> cctvID = new HashMap<>();
|
||||
cctvID.put("101", "A10401001");
|
||||
cctvID.put("102", "A10301002");
|
||||
cctvID.put("103", "A10201003");
|
||||
cctvID.put("104", "A10101004");
|
||||
cctvID.put("105", "A10111005");
|
||||
cctvID.put("106", "A10211006");
|
||||
cctvID.put("107", "A10311007");
|
||||
cctvID.put("108", "A10411008");
|
||||
|
||||
cctvID.put("301", "A10503001");
|
||||
cctvID.put("302", "A10403002");
|
||||
cctvID.put("303", "A10303003");
|
||||
cctvID.put("304", "A10203004");
|
||||
|
||||
cctvID.put("307", "A10213005");
|
||||
cctvID.put("308", "A10313006");
|
||||
cctvID.put("309", "A10413007");
|
||||
cctvID.put("310", "A10513008");
|
||||
Calendar cal = Calendar.getInstance();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMddHHmmss");
|
||||
String strDate = sdf.format(cal.getTime());
|
||||
this.logger.debug("===========" + strDate);
|
||||
List<String> temp = new ArrayList<>();
|
||||
temp.add("13");
|
||||
temp.add("11");
|
||||
temp.add("12");
|
||||
int n = (int)(Math.random() * 1000.0D) % 3;
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
jsonParam.put("camId" , cctvID.get(String.valueOf(this.g_strTenel) + this.g_strLane));
|
||||
jsonParam.put("colctTime" , strDate);
|
||||
jsonParam.put("camConectSttus" , "0");
|
||||
jsonParam.put("rtuTp" , temp.get(n % 3)); //온도
|
||||
jsonParam.put("bxDoorSttus" , "0"); //함체도어상태
|
||||
jsonParam.put("camSdCardSttus" , "0"); //SD카드상태
|
||||
this.logger.debug("============== : " + jsonParam.toJSONString());
|
||||
callAnprCarnoSend(jsonParam.toJSONString());
|
||||
jsonParam.clear();
|
||||
}
|
||||
|
||||
private void callAnprCarnoSend(String strJson) {
|
||||
HttpURLConnection connection = null;
|
||||
InputStream is = null;
|
||||
InputStreamReader isr = null;
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
URL url = new URL(this.g_strApiUrAnprStatusl);
|
||||
|
||||
connection = (HttpURLConnection)url.openConnection();
|
||||
connection.setDoInput(true);
|
||||
connection.setDoOutput(true);
|
||||
connection.setUseCaches(false);
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setConnectTimeout(30000);
|
||||
connection.setReadTimeout(30000);
|
||||
connection.setRequestProperty("Accept", "application/json");
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());
|
||||
bos.write(strJson.getBytes("UTF-8"));
|
||||
bos.flush();
|
||||
bos.close();
|
||||
int resCode = connection.getResponseCode();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String inputLine = null;
|
||||
this.logger.debug("==== : " + resCode);
|
||||
if (resCode == 200) {
|
||||
is = connection.getInputStream();
|
||||
isr = new InputStreamReader(is, "UTF-8");
|
||||
br = new BufferedReader(isr);
|
||||
while ((inputLine = br.readLine()) != null)
|
||||
sb.append(inputLine);
|
||||
this.logger.debug("==== " + sb.toString());
|
||||
} else if (connection.getErrorStream() != null) {
|
||||
br = new BufferedReader(new InputStreamReader(connection.getErrorStream(), "UTF-8"));
|
||||
while ((inputLine = br.readLine()) != null)
|
||||
sb.append(inputLine);
|
||||
this.logger.debug("==== Http Error Resopnse : " + sb.toString());
|
||||
} else {
|
||||
this.logger.debug("==== Http Error Resopnse : " + sb.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
this.logger.debug("==== Http Error Resopnse : ");
|
||||
} finally {
|
||||
try {
|
||||
if (is != null)
|
||||
is.close();
|
||||
if (isr != null)
|
||||
isr.close();
|
||||
if (br != null)
|
||||
br.close();
|
||||
} catch (Exception exception) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.JobBuilder;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.ScheduleBuilder;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.quartz.Trigger;
|
||||
import org.quartz.TriggerBuilder;
|
||||
import org.quartz.impl.StdSchedulerFactory;
|
||||
|
||||
public class AnprStatusInfo {
|
||||
public static void main(String[] args) {
|
||||
String str = "*/1 * * * * ?";
|
||||
if (args.length > 0)
|
||||
str = String.format("*/%s * * * * ?", new Object[] { args[0] });
|
||||
AnprStateSend anpr = new AnprStateSend(str);
|
||||
anpr.runCarNoImageSend();
|
||||
}
|
||||
|
||||
public AnprStatusInfo() {
|
||||
Map<String, Boolean> mapIsRun_1 = new Hashtable<>();
|
||||
Map<String, Boolean> mapIsRun_3 = new Hashtable<>();
|
||||
mapIsRun_1.put("01", Boolean.valueOf(false));
|
||||
mapIsRun_1.put("02", Boolean.valueOf(false));
|
||||
mapIsRun_1.put("03", Boolean.valueOf(false));
|
||||
mapIsRun_1.put("04", Boolean.valueOf(false));
|
||||
mapIsRun_1.put("05", Boolean.valueOf(false));
|
||||
mapIsRun_1.put("06", Boolean.valueOf(false));
|
||||
mapIsRun_1.put("07", Boolean.valueOf(false));
|
||||
mapIsRun_1.put("08", Boolean.valueOf(false));
|
||||
mapIsRun_3.put("01", Boolean.valueOf(false));
|
||||
mapIsRun_3.put("02", Boolean.valueOf(false));
|
||||
mapIsRun_3.put("03", Boolean.valueOf(false));
|
||||
mapIsRun_3.put("04", Boolean.valueOf(false));
|
||||
mapIsRun_3.put("05", Boolean.valueOf(false));
|
||||
mapIsRun_3.put("06", Boolean.valueOf(false));
|
||||
mapIsRun_3.put("07", Boolean.valueOf(false));
|
||||
mapIsRun_3.put("08", Boolean.valueOf(false));
|
||||
mapIsRun_3.put("09", Boolean.valueOf(false));
|
||||
mapIsRun_3.put("10", Boolean.valueOf(false));
|
||||
}
|
||||
|
||||
public void runAnprCarInfo(String str) {
|
||||
try {
|
||||
ArrayList<String> state = new ArrayList<>();
|
||||
JobDetail job = JobBuilder.newJob(ANPRStatusJob.class)
|
||||
.withIdentity("testJob")
|
||||
.usingJobData("jobSays", "ant.xml")
|
||||
.usingJobData("myFloatValue", Float.valueOf(3.141F)).build();
|
||||
job.getJobDataMap().put("state", state);
|
||||
CronTrigger cronTrigger =
|
||||
(CronTrigger)TriggerBuilder.newTrigger()
|
||||
.withIdentity("crontrigger", "crontriggergroup1")
|
||||
.withSchedule(
|
||||
(ScheduleBuilder)CronScheduleBuilder.cronSchedule(" * /1 * * * *"))
|
||||
|
||||
.build();
|
||||
StdSchedulerFactory stdSchedulerFactory = new StdSchedulerFactory();
|
||||
Scheduler sch = stdSchedulerFactory.getScheduler();
|
||||
sch.start();
|
||||
sch.scheduleJob(job, (Trigger)cronTrigger);
|
||||
} catch (SchedulerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,122 +0,0 @@
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import oracle.jdbc.OracleConnection;
|
||||
import oracle.jdbc.OraclePreparedStatement;
|
||||
|
||||
public class DefaultCarImageDBUpdate {
|
||||
private static String[] g_strDB = new String[4];
|
||||
|
||||
private static String[] g_strFTP = new String[5];
|
||||
|
||||
private static String[] g_strFTPColl = new String[53];
|
||||
|
||||
public static void main(String[] args) {
|
||||
DefaultCarImageDBUpdate obj = new DefaultCarImageDBUpdate();
|
||||
Map<String, String> param = new HashMap<>();
|
||||
param.put("image_file", "030720190628150921S.JPG");
|
||||
param.put("work_times", "15092100");
|
||||
try {
|
||||
obj.runUpdate(param);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public DefaultCarImageDBUpdate() {
|
||||
try {
|
||||
String propFile = "./config.properties";
|
||||
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");
|
||||
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_strFTPColl[0] = props.getProperty("coll_ftp_ip");
|
||||
g_strFTPColl[1] = props.getProperty("coll_ftp_id");
|
||||
g_strFTPColl[2] = props.getProperty("coll_ftp_pw");
|
||||
Calendar cal = Calendar.getInstance();
|
||||
int date = cal.get(5);
|
||||
g_strFTP[0] = String.format("%s/%02d/07/", new Object[] { g_strFTP[0], Integer.valueOf(date) });
|
||||
props.clear();
|
||||
props = null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private Connection getOrclConn() throws Exception {
|
||||
Class.forName(g_strDB[0]);
|
||||
return DriverManager.getConnection(g_strDB[1], g_strDB[2], g_strDB[3]);
|
||||
}
|
||||
|
||||
public void runUpdate(Map<String, String> param) throws SQLException {
|
||||
OracleConnection conn = null;
|
||||
OraclePreparedStatement ps = null;
|
||||
Calendar cal = Calendar.getInstance();
|
||||
int year = cal.get(1);
|
||||
int month = cal.get(2) + 1;
|
||||
int day = cal.get(5);
|
||||
int n = 0;
|
||||
try {
|
||||
conn = (OracleConnection)getOrclConn();
|
||||
String sql = "";
|
||||
sql = "update DEFAULT_FARE_READ_INFO ";
|
||||
sql = String.valueOf(sql) + " set CARS_STOP_PICTURE_FILE = ?, send_flag = '9' ";
|
||||
sql = String.valueOf(sql) + " where fare_office_id = '03' and booth_id = '07'";
|
||||
sql = String.valueOf(sql) + " and collect_id = '40' ";
|
||||
sql = String.valueOf(sql) + " and year = ? and month = ? and day = ?";
|
||||
sql = String.valueOf(sql) + " and WORK_TIMES = ? ";
|
||||
System.out.println("=== : sql : " + sql);
|
||||
ps = (OraclePreparedStatement)conn.prepareStatement(sql);
|
||||
ps.setString(1, param.get("image_file"));
|
||||
ps.setString(2, String.format("%04d", new Object[] { Integer.valueOf(year) }));
|
||||
ps.setString(3, String.format("%02d", new Object[] { Integer.valueOf(month) }));
|
||||
ps.setString(4, String.format("%02d", new Object[] { Integer.valueOf(day) }));
|
||||
ps.setString(5, param.get("work_times").substring(0, 6));
|
||||
System.out.println(year);
|
||||
System.out.println(month);
|
||||
System.out.println(day);
|
||||
System.out.println(param.get("work_times").substring(0, 6));
|
||||
System.out.println(n);
|
||||
ps.close();
|
||||
sql = "update FARE_TERMINAL_INFO ";
|
||||
sql = String.valueOf(sql) + " set CARS_STOP_PICTURE_FILE = ?, send_flag = '0' ";
|
||||
sql = String.valueOf(sql) + " where fare_office_id = '03' and booth_id = '07'";
|
||||
sql = String.valueOf(sql) + " and collect_id = '40' ";
|
||||
sql = String.valueOf(sql) + " and year = ? and month = ? and day = ?";
|
||||
sql = String.valueOf(sql) + " and WORK_TIMES = ? ";
|
||||
System.out.println("=== : sql : " + sql);
|
||||
ps = (OraclePreparedStatement)conn.prepareStatement(sql);
|
||||
ps.setString(1, param.get("image_file"));
|
||||
ps.setString(2, String.format("%04d", new Object[] { Integer.valueOf(year) }));
|
||||
ps.setString(3, String.format("%02d", new Object[] { Integer.valueOf(month) }));
|
||||
ps.setString(4, String.format("%02d", new Object[] { Integer.valueOf(day) }));
|
||||
ps.setString(5, param.get("work_times").substring(0, 6));
|
||||
System.out.println(year);
|
||||
System.out.println(month);
|
||||
System.out.println(day);
|
||||
System.out.println(param.get("work_times").substring(0, 6));
|
||||
System.out.println(n);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
ps.close();
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,101 +0,0 @@
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.JobKey;
|
||||
|
||||
public class DumbJob implements Job {
|
||||
private String jobSays;
|
||||
|
||||
private float myFloatValue;
|
||||
|
||||
private ArrayList<Date> state;
|
||||
|
||||
private String g_strTenel = "";
|
||||
|
||||
private List<String> g_listN1 = new ArrayList<>();
|
||||
|
||||
private List<String> g_listN3 = new ArrayList<>();
|
||||
|
||||
private final Logger logger = Logger.getLogger(DumbJob.class);
|
||||
|
||||
public DumbJob() {
|
||||
PropertyConfigurator.configure("./log4j.properties");
|
||||
try {
|
||||
String propFile = "./config.properties";
|
||||
Properties props = new Properties();
|
||||
FileInputStream fis = new FileInputStream(propFile);
|
||||
props.load(new BufferedInputStream(fis));
|
||||
this.g_strTenel = props.getProperty("tennel_no");
|
||||
props.clear();
|
||||
props = null;
|
||||
System.out.println("===================== A");
|
||||
this.g_listN1.add("01");
|
||||
this.g_listN1.add("02");
|
||||
this.g_listN1.add("03");
|
||||
this.g_listN1.add("04");
|
||||
this.g_listN1.add("05");
|
||||
this.g_listN1.add("06");
|
||||
this.g_listN1.add("07");
|
||||
this.g_listN1.add("08");
|
||||
|
||||
this.g_listN3.add("01");
|
||||
this.g_listN3.add("02");
|
||||
this.g_listN3.add("03");
|
||||
this.g_listN3.add("04");
|
||||
|
||||
this.g_listN3.add("07");
|
||||
this.g_listN3.add("08");
|
||||
this.g_listN3.add("09");
|
||||
this.g_listN3.add("10");
|
||||
System.out.println("===================== B");
|
||||
} catch (Exception e) {
|
||||
this.logger.debug("Exception : " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
JobKey key = context.getJobDetail().getKey();
|
||||
this.state.add(new Date());
|
||||
this.logger.info("Instance " + key + " of DmbJob says: " + this.jobSays + ", and val is: " + this.myFloatValue +
|
||||
", state size:" + this.state.size() + "," + this.state.get(this.state.size() - 1));
|
||||
this.logger.debug("======== 차로개수 : " + this.g_listN3.size());
|
||||
List<String> list = new ArrayList<>();
|
||||
if (this.g_strTenel.equals("3")) {
|
||||
list.addAll(this.g_listN3);
|
||||
} else if (this.g_strTenel.equals("1")) {
|
||||
list.addAll(this.g_listN1);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
SendThread obj = null;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
this.logger.debug(String.format("%s차로 시작", new Object[] { list.get(i) }));
|
||||
obj = new SendThread(list.get(i)); //차로2자리
|
||||
obj.runCarNoImageSend();
|
||||
this.logger.debug(String.format("%s차로 끝", new Object[] { list.get(i) }));
|
||||
}
|
||||
}
|
||||
|
||||
public void setJobSays(String jobSays) {
|
||||
this.jobSays = jobSays;
|
||||
}
|
||||
|
||||
public void setMyFloatValue(float myFloatValue) {
|
||||
this.myFloatValue = myFloatValue;
|
||||
}
|
||||
|
||||
public void setState(ArrayList<Date> state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,112 +0,0 @@
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
public class ImageNameTranse {
|
||||
private static String[] g_strDB = new String[4];
|
||||
|
||||
private static String[] g_strFTP = new String[5];
|
||||
|
||||
private static String[] g_strFTPColl = new String[53];
|
||||
|
||||
public static void main(String[] args) {
|
||||
DefaultCarImageDBUpdate obj = new DefaultCarImageDBUpdate();
|
||||
ImageNameTranse img = new ImageNameTranse();
|
||||
List<String> list = new ArrayList<>();
|
||||
String pathOrg = String.valueOf(g_strFTP[0]) + "z/";
|
||||
findFileList(pathOrg, list);
|
||||
if (list.size() == 0) {
|
||||
System.out.println("=== 신규 이미지 없음");
|
||||
return;
|
||||
}
|
||||
Map<String, String> cctvID = new HashMap<>();
|
||||
cctvID.put("A20201107", "101");
|
||||
cctvID.put("A20201109", "103");
|
||||
cctvID.put("A20211110", "104");
|
||||
cctvID.put("A20201111", "105");
|
||||
cctvID.put("A20211112", "106");
|
||||
cctvID.put("A20201113", "107");
|
||||
cctvID.put("A20211114", "108");
|
||||
cctvID.put("A20203115", "301");
|
||||
cctvID.put("A20213116", "302");
|
||||
cctvID.put("A10103117", "303");
|
||||
cctvID.put("A10103118", "304");
|
||||
cctvID.put("A1013119", "307");
|
||||
cctvID.put("A10103120", "308");
|
||||
cctvID.put("A10103121", "309");
|
||||
cctvID.put("A10103122", "310");
|
||||
String strImage = "";
|
||||
String[] strarry = null;
|
||||
Map<String, String> map = new HashMap<>();
|
||||
for (int index = 0; index < list.size(); index++) {
|
||||
strarry = list.get(index).split("_");
|
||||
strImage = String.format("0%s%s%sS.JPG", new Object[] { cctvID.get(strarry[1]), strarry[2], strarry[3].subSequence(0, 6) });
|
||||
map.put("image_file", strImage);
|
||||
map.put("year", strarry[2].substring(0, 4));
|
||||
map.put("month", strarry[2].substring(4, 6));
|
||||
map.put("day", strarry[2].substring(6, 8));
|
||||
map.put("work_times", strarry[3].substring(0, 6));
|
||||
try {
|
||||
obj.runUpdate(map);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ImageNameTranse() {
|
||||
try {
|
||||
String propFile = "./config.properties";
|
||||
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");
|
||||
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_strFTPColl[0] = props.getProperty("coll_ftp_ip");
|
||||
g_strFTPColl[1] = props.getProperty("coll_ftp_id");
|
||||
g_strFTPColl[2] = props.getProperty("coll_ftp_pw");
|
||||
Calendar cal = Calendar.getInstance();
|
||||
int date = cal.get(5);
|
||||
g_strFTP[0] = String.format("%s/%02d/07/", new Object[] { g_strFTP[0], Integer.valueOf(date) });
|
||||
props.clear();
|
||||
props = null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void findFileList(String source, List<String> list) {
|
||||
File dir = new File(source);
|
||||
File[] fileList = dir.listFiles();
|
||||
try {
|
||||
for (int i = 0; i < fileList.length; i++) {
|
||||
File file = fileList[i];
|
||||
System.out.println("=== = " + file.getName());
|
||||
if (file.isFile()) {
|
||||
String tempFileName = file.getName();
|
||||
if (tempFileName.toLowerCase().endsWith("jpg"))
|
||||
list.add(tempFileName);
|
||||
} else if (file.isDirectory() &&
|
||||
!file.getName().equals("send")) {
|
||||
findFileList(file.getCanonicalPath().toString(), list);
|
||||
}
|
||||
}
|
||||
} catch (IOException iOException) {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,160 +0,0 @@
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class LaneStateSend extends Thread {
|
||||
private String[] g_strDB = new String[4];
|
||||
|
||||
private String[] g_strFTP = new String[6];
|
||||
|
||||
private String[] g_strFTPColl = new String[4];
|
||||
|
||||
private String g_strTenel = "";
|
||||
|
||||
private String g_strLane = "";
|
||||
|
||||
public LaneStateSend(String str) {
|
||||
try {
|
||||
String propFile = "./config.properties";
|
||||
Properties props = new Properties();
|
||||
FileInputStream fis = new FileInputStream(propFile);
|
||||
props.load(new BufferedInputStream(fis));
|
||||
this.g_strDB[0] = props.getProperty("db_driver");
|
||||
this.g_strDB[1] = props.getProperty("db_connect");
|
||||
this.g_strDB[2] = props.getProperty("db_id");
|
||||
this.g_strDB[3] = props.getProperty("db_pw");
|
||||
this.g_strFTP[0] = props.getProperty("path_org");
|
||||
this.g_strFTP[1] = props.getProperty("ftp_ip");
|
||||
this.g_strFTP[2] = props.getProperty("ftp_id");
|
||||
this.g_strFTP[3] = props.getProperty("ftp_pw");
|
||||
this.g_strFTP[4] = props.getProperty("api_url");
|
||||
this.g_strFTP[5] = props.getProperty("path_desc");
|
||||
this.g_strFTPColl[0] = props.getProperty("coll_ftp_ip");
|
||||
this.g_strFTPColl[1] = props.getProperty("coll_ftp_id");
|
||||
this.g_strFTPColl[2] = props.getProperty("coll_ftp_pw");
|
||||
this.g_strFTPColl[3] = props.getProperty("center_ftp_ip");
|
||||
this.g_strTenel = props.getProperty("tennel_no");
|
||||
this.g_strLane = str;
|
||||
props.clear();
|
||||
props = null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
runCarNoImageSend();
|
||||
System.out.println(String.format("=======================================================", new Object[0]));
|
||||
}
|
||||
|
||||
private void runCarNoImageSend() {
|
||||
Map<String, String> cctvID = new HashMap<>();
|
||||
cctvID.put("101", "A10401001");
|
||||
cctvID.put("102", "A10301002");
|
||||
cctvID.put("103", "A10201003");
|
||||
cctvID.put("104", "A10101004");
|
||||
cctvID.put("105", "A10111005");
|
||||
cctvID.put("106", "A10211006");
|
||||
cctvID.put("107", "A10311007");
|
||||
cctvID.put("108", "A10411008");
|
||||
cctvID.put("301", "A10503001");
|
||||
cctvID.put("302", "A10403002");
|
||||
cctvID.put("303", "A10303003");
|
||||
cctvID.put("304", "A10203004");
|
||||
cctvID.put("307", "A10213005");
|
||||
cctvID.put("308", "A10313006");
|
||||
cctvID.put("309", "A10413007");
|
||||
cctvID.put("310", "A10513008");
|
||||
Calendar cal = Calendar.getInstance();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMddhhmmss");
|
||||
String strDate = sdf.format(cal.getTime());
|
||||
System.out.println("===========" + strDate);
|
||||
List<String> temp = new ArrayList<>();
|
||||
temp.add("13");
|
||||
temp.add("11");
|
||||
temp.add("12");
|
||||
int n = (int)(Math.random() * 1000.0D) % 3;
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
jsonParam.put("camId", cctvID.get(String.valueOf(this.g_strTenel) + this.g_strLane));
|
||||
jsonParam.put("colctTime", strDate);
|
||||
jsonParam.put("camConectSttus", "0");
|
||||
jsonParam.put("rtuTp", temp.get(n % 3)); //온도
|
||||
jsonParam.put("bxDoorSttus", "0"); //함체도어상태
|
||||
jsonParam.put("camSdCardSttus", "0"); //SD카드상태
|
||||
System.out.println("============== : " + jsonParam.toJSONString());
|
||||
callAnprCarnoSend(jsonParam.toJSONString());
|
||||
jsonParam.clear();
|
||||
}
|
||||
|
||||
private void callAnprCarnoSend(String strJson) {
|
||||
HttpURLConnection connection = null;
|
||||
InputStream is = null;
|
||||
InputStreamReader isr = null;
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
URL url = new URL(this.g_strFTP[4]);
|
||||
System.out.println("==== 수집서버 주소 : " + this.g_strFTP[4]);
|
||||
connection = (HttpURLConnection)url.openConnection();
|
||||
connection.setDoInput(true);
|
||||
connection.setDoOutput(true);
|
||||
connection.setUseCaches(false);
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setConnectTimeout(30000);
|
||||
connection.setReadTimeout(30000);
|
||||
connection.setRequestProperty("Accept", "application/json");
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());
|
||||
bos.write(strJson.getBytes("UTF-8"));
|
||||
bos.flush();
|
||||
bos.close();
|
||||
int resCode = connection.getResponseCode();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String inputLine = null;
|
||||
System.out.println("==== : " + resCode);
|
||||
if (resCode == 200) {
|
||||
is = connection.getInputStream();
|
||||
isr = new InputStreamReader(is, "UTF-8");
|
||||
br = new BufferedReader(isr);
|
||||
while ((inputLine = br.readLine()) != null)
|
||||
sb.append(inputLine);
|
||||
System.out.println("==== " + sb.toString());
|
||||
} else if (connection.getErrorStream() != null) {
|
||||
br = new BufferedReader(new InputStreamReader(connection.getErrorStream(), "UTF-8"));
|
||||
while ((inputLine = br.readLine()) != null)
|
||||
sb.append(inputLine);
|
||||
System.out.println("==== Http Error Resopnse : " + sb.toString());
|
||||
} else {
|
||||
System.out.println("==== Http Error Resopnse : " + sb.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("==== Http Error Resopnse : ");
|
||||
} finally {
|
||||
try {
|
||||
if (is != null)
|
||||
is.close();
|
||||
if (isr != null)
|
||||
isr.close();
|
||||
if (br != null)
|
||||
br.close();
|
||||
} catch (Exception exception) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue