소스정리 미사용 클래스,메소드 제거

main
이범준 5 months ago
parent 79ceafc88d
commit 50c5e6f35b

@ -3,4 +3,10 @@
남산 연계 서버 프로세스 중 하나 [anpr_img_send.jar]
메인클래스 : AnprCarInfoSend
메인클래스 : AnprCarInfoSend
주기 : 5분
기능 : 이미지 업로드 후 차량정보인식정보(차량번호,차종,차량색상,인식신뢰도 등) 녹색과태료에 전달

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

@ -10,6 +10,7 @@ import org.quartz.SchedulerException;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;
//메인클래스
public class AnprCarInfoSend {
public static boolean g_isRunning = false;

@ -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) {}
}
}
}

@ -2,13 +2,7 @@ import java.util.HashMap;
import java.util.Map;
public class MakeCarNoHex2CarNo {
public static void main(String[] args) {
String[] array = { "0004332416", "9902422041", "", "", "" };
for (int i = 0; i < array.length; i++) {
if (array[i].length() != 0)
System.out.println(makeCarNoHex2CarNo(array[i]));
}
}
public static boolean isNumeric(String s) {
return s.matches("-?\\d+(\\.\\d+)?");

@ -24,11 +24,9 @@ import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.SftpException;
public class SendThread 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 = "";
@ -47,22 +45,18 @@ public void run() {
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");
Calendar cal = Calendar.getInstance();
int date = cal.get(5);
@ -161,8 +155,8 @@ public void run() {
jsonParam.put("camId" , cctvID.get(String.valueOf(tennel) + line));
jsonParam.put("pasageTime" , String.valueOf(strarr[0]) + strarr[1].substring(0, 6));
jsonParam.put("vhcleNum" , strCarNo);
jsonParam.put("vhcleKnd" , strarr[5].substring(0, 1));
jsonParam.put("vhcleColor" , "0"); //색상정보그냥0
jsonParam.put("vhcleKnd" , strarr[5].substring(0, 1)); //차종
jsonParam.put("vhcleColor" , "0"); //차량색상정보 그냥 0
jsonParam.put("allImagePath" , "./car_img/");
jsonParam.put("vhcleImagePath" , "");
jsonParam.put("nopltImagePath" , "");
@ -222,6 +216,7 @@ public void run() {
return String.valueOf(pathOrg.toString()) + "#" + path.toString() + "#" + strbuf.toString() + "#" + line;
}
//연계api호출
private int callAnprCarnoSend(String strJson) {
int nResult = 0;
HttpURLConnection connection = null;
@ -288,6 +283,7 @@ public void run() {
}
//차로갯수만큼 반복문 내에서 실행
//FTP업로드 후 연계API(차량번호 인식 정보 송신(차량번호,차종,차량색상,인식신뢰도 등))호출
public void runCarNoImageSend() {
List<String> list = new ArrayList<>();
String pathOrg = this.g_strFTP[0];
@ -406,7 +402,7 @@ public void run() {
this.logger.debug(String.format("============= : 업로드 후 ", new Object[0]));
if (isOk) {
//
//연계api호출
int nResult = callAnprCarnoSend(jsonParam.toJSONString());
jsonParam.clear();
@ -449,7 +445,8 @@ public void run() {
private void DefaultCarCenter(String strBoothId, File file, Map<String, String> map) throws SQLException {
boolean isOk = false;
FTPUtil sftp = new FTPUtil();
boolean initSuccess = sftp.init(this.g_strFTP[1], this.g_strFTP[2], this.g_strFTP[3]);
@ -474,7 +471,8 @@ public void run() {
sftp.upload2(map.get("image_path_desc_center").toString().trim(), file, map.get("image_file"), map.get("image_file_new2"));
this.logger.info(String.format("============= : DefaultCarCenter 파일전송 후 ", new Object[0]));
isOk = true;
} catch (IOException e) {
e.printStackTrace();
this.logger.info("Exception : " + e);

Loading…
Cancel
Save