no message

main
이범준 5 months ago
parent 8af220c225
commit 9179a7e589

@ -89,7 +89,7 @@ public class AnprImageJob implements Job {
return;
}
SendThread obj = null;
for (int i = 0; i < list.size(); i++) {
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자리

@ -1,7 +1,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.log4j.Logger;
@ -25,25 +24,6 @@ public class FTPUtil {
public String mkdir(String path) throws SftpException {
String[] pathArray = path.split("/");
String currentDirectory = String.valueOf(this.channelSftp.pwd()) + "/";
String totPathArray = "";
for (int i = 0; i < pathArray.length; i++) {
if (pathArray[i].length() != 0) {
totPathArray = String.valueOf(totPathArray) + pathArray[i] + "/";
String currentPath = String.valueOf(currentDirectory) + totPathArray;
try {
this.channelSftp.mkdir(currentPath);
this.channelSftp.cd(currentPath);
} catch (Exception e) {
this.channelSftp.cd(currentPath);
}
}
}
return String.valueOf(currentDirectory) + "/" + totPathArray;
}
public String mkdir2(String path) throws SftpException {
String[] pathArray = path.split("/");
String currentDirectory = "/";
@ -88,6 +68,13 @@ public class FTPUtil {
return sftpInitSuccess;
}
/**
* dir :
* file :
* old :
* neo :
*
* */
public void upload(String dir, File file, String old, String neo) throws SftpException, IOException, JSchException {
FileInputStream in = null;
in = new FileInputStream(file);
@ -99,13 +86,22 @@ public class FTPUtil {
this.channelSftp.rename(old, neo);
}
/**
* dir :
* file :
* old :
* neo :
*
* */
public void upload2(String dir, File file, String old, String neo) throws SftpException, IOException, JSchException {
FileInputStream in = null;
this.logger.debug(String.format("============= :upload2 1 ", new Object[0]));
in = new FileInputStream(file);
this.logger.debug(String.format("============= :upload2 2 ", new Object[0]));
this.logger.debug(dir);
this.channelSftp.cd(dir);
this.logger.debug(String.format("============= :upload2 3 ", new Object[0]));
this.channelSftp.put(in, file.getName());
this.logger.debug(String.format("============= :upload2 4 ", new Object[0]));
@ -115,17 +111,7 @@ public class FTPUtil {
this.logger.debug(String.format("============= :upload2 6 ", new Object[0]));
}
public InputStream download(String dir, String fileNm) {
InputStream in = null;
String path = "...";
try {
this.channelSftp.cd(String.valueOf(path) + dir);
in = this.channelSftp.get(fileNm);
} catch (SftpException se) {
this.logger.debug("Exception : " + se);
}
return in;
}
public void disconnect() {
this.channelSftp.quit();

@ -134,8 +134,14 @@ public void run() {
mapDic.put("7", "1");
mapDic.put("8", "1");
this.logger.debug("============================= Z : " + mapDic.get(dirc));
mapDefault.put("image_path_desc", String.format("/data2/DOTR/%s/0%s/IMAGE/", new Object[] { strarr[0], tennel }));
mapDefault.put("image_path_desc_center", String.format(" /images/ANPRImage/cfs/%s/0%s/%s/", new Object[] { strarr[0].substring(0, 4), tennel, strarr[0] }));
mapDefault.put(
"image_path_desc_center",
String.format(
" /images/ANPRImage/cfs/%s/0%s/%s/",
new Object[] { strarr[0].substring(0, 4), tennel, strarr[0] }
)
);
mapDefault.put("work_times", strarr[1]);
mapDefault.put("seqno", strarr[2]);
int n = Integer.parseInt(strarr[2].substring(6, 8));
@ -171,9 +177,8 @@ public void run() {
StringBuilder pathOrg = new StringBuilder();
pathOrg.append(this.g_strFTP[0]);
StringBuilder path = new StringBuilder();
path.append(this.g_strFTP[5]);
path.append("/");
path.append(strarr[0].substring(0, 4));
path.append("/");
path.append(strarr[0].substring(4, 6));
@ -205,15 +210,31 @@ public void run() {
strbuf.append(strarr[2]);
strbuf.append(".jpg");
mapDefault.put("image_file_new2",
String.format("0%s%s%s%sS.JPG", new Object[] { tennel, line, strarr[0], strarr[1].substring(0, 6) }));
String.format(
"0%s%s%s%sS.JPG",
new Object[] { tennel, line, strarr[0], strarr[1].substring(0, 6) }
)
);
mapDefault.put("image_path", pathOrg.toString());
mapDefault.put("image_file", strOrgFile);
this.logger.debug("=== pathOrg.toString() : " + pathOrg.toString());
this.logger.debug("=== path.toString() : " + path.toString());
this.logger.debug("=== strbuf.toString() : " + strbuf.toString());
jsonParam.put("allImagePath", String.format("%s%s", new Object[] { path.toString().replace(String.valueOf(this.g_strFTP[5]) + "/", ""), strbuf.toString() }));
jsonParam.put("allImagePath",
String.format(
"%s%s",
new Object[] {
path.toString(), strbuf.toString()
}
)
);
this.logger.debug("=== : " + jsonParam.toJSONString());
return String.valueOf(pathOrg.toString()) + "#" + path.toString() + "#" + strbuf.toString() + "#" + line;
return String.valueOf(pathOrg.toString())
+ "#" + path.toString() + "#" + strbuf.toString()
+ "#" + line;
}
//연계api호출
@ -225,7 +246,7 @@ public void run() {
BufferedReader br = null;
try {
URL url = new URL(this.g_strFTP[4]);
this.logger.info("==== 수집서버 주소가 아니고 대외연계서버 주소 : " + this.g_strFTP[4]);
this.logger.info("==== 대외연계서버 주소 + 녹색과태료 API URL : " + this.g_strFTP[4]);
connection = (HttpURLConnection)url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
@ -323,7 +344,7 @@ public void run() {
return;
}
for (int i = 0; i < list.size(); i++) {
for (int i = 0; i < list.size(); i++) { //디렉토리 경로상에 현재 존재하는 JPG파일
mapDefaultCar.clear();
this.logger.debug("=== i : " + i + ", : " + list.get(i));
//
@ -378,6 +399,7 @@ public void run() {
this.logger.debug("=== 4 : " + strTargPath[1]);
isOk = false;
try {
//SFTP 1-1
sftp.mkdir2(strTargPath[1].substring(1));
this.logger.debug("폴더가 생성되었습니다.");
} catch (Exception e) {
@ -385,7 +407,7 @@ public void run() {
}
this.logger.debug(String.format("============= : 업로드 전 ", new Object[0]));
try {
//SFTP 1-2
sftp.upload(strTargPath[1], file, list.get(i), strTargPath[2]);
this.logger.debug(String.format("============= : 업로드 성공 ", new Object[0]));
@ -414,7 +436,8 @@ public void run() {
this.logger.debug(String.format("=== update param : %s, %s, %s", new Object[] { strTargPath[1], file, list.get(i), strTargPath[2] }));
this.logger.debug("==== 미납 수행 시작");
try {
//
//2번째FTP처리
DefaultCarCenter(strTargPath[3], file, mapDefaultCar);
} catch (SQLException e) {
@ -462,6 +485,7 @@ public void run() {
} catch (Exception e) {
e.getStackTrace();
}
this.logger.debug("=== " + map.get("image_path_desc_center"));
this.logger.debug("=== image_file_new2 : " + map.get("image_file_new2"));
this.logger.info(String.format("============= : DefaultCarCenter 파일전송 전 ", new Object[0]));

Loading…
Cancel
Save