koul пре 2 година
родитељ
комит
9956eb441b

+ 6 - 0
src/com/uas/fileUtil/FileUtil.java

@@ -246,6 +246,12 @@ public class FileUtil {
 				result=true;
 			} catch (SQLException e) {
 				e.printStackTrace();
+			}finally {
+				try {
+					statement.close();
+				} catch (SQLException e) {
+					throw new RuntimeException(e);
+				}
 			}
 		}
 		return result;

+ 5 - 14
src/com/uas/main/Download.java

@@ -1,21 +1,14 @@
 package com.uas.main;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.sql.Connection;
 import java.sql.SQLException;
-import java.sql.Statement;
-import java.text.SimpleDateFormat;
 import java.util.*;
-
 import com.uas.fileUtil.FileUtil;
 import org.apache.commons.net.ftp.FTPClient;
-
 import com.uas.util.BaseUtil;
 import com.uas.util.FtpUtil;
 import com.uas.util.JdbcUtil;
-import org.apache.http.entity.ContentType;
-import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 public class Download {
@@ -26,14 +19,14 @@ public class Download {
         Map<String,Object> servMap = JdbcUtil.getFtpConfigs();
         Set<String> set = servMap.keySet();
         boolean bol = false;
-        Connection consz ;
-        Connection conhk ;
-        Connection conzx ;
-		Connection conza ;
         for(String key:set){
             if("12".equals(key)||"13".equals(key)){
                 Map<String,Object> ftpMap = (Map<String,Object>)servMap.get(key);
                 FTPClient client = null;
+				Connection consz = null ;
+				Connection conhk = null ;
+				Connection conzx = null ;
+				Connection conza = null ;
                 try {
                     client = FtpUtil.connect(ftpMap);
                     if(client!=null){
@@ -285,9 +278,7 @@ public class Download {
             }else if("14".equals(key)){
 				Map<String,Object> ftpMap = (Map<String,Object>)servMap.get(key);
 				FTPClient client = null;
-				Map<String, Object> map = null;
-				Connection con = null;
-				con = JdbcUtil.getConnectBySob("YHND_SZ");
+				Connection con = JdbcUtil.getConnectBySob("YHND_SZ");
 				try {
 					client = FtpUtil.connect(ftpMap);
 					if(client!=null){

+ 0 - 7
src/properties/ftpconfig.properties

@@ -1,11 +1,4 @@
 {
-	"local":{
-		"ip":"192.168.253.97",
-		"port":21,
-		"user":"luhg",
-		"password":"342521",
-		"downloadpath":"TEST"
-	},
     "12":{
         "ip":"sz.hi-mantech.com",
         "port":46688,