koul 5 years ago
commit
fab5c2d0c8

+ 1 - 0
.idea/.name

@@ -0,0 +1 @@
+yhnd

+ 17 - 0
.idea/artifacts/yhnd_jar.xml

@@ -0,0 +1,17 @@
+<component name="ArtifactManager">
+  <artifact type="jar" name="yhnd:jar">
+    <output-path>$PROJECT_DIR$/classes/artifacts/yhnd_jar</output-path>
+    <root id="archive" name="yhnd.jar">
+      <element id="module-output" name="yhnd" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/flexjson-2.1.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/jackson-core-asl-1.9.13.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/log4j-1.2.15.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/commons-csv-1.4.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/jackson-mapper-asl-1.9.13.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/dom4j-1.6.1.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/ojdbc6-11.2.0.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/junit.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/commons-net-3.6.jar" path-in-jar="/" />
+    </root>
+  </artifact>
+</component>

+ 7 - 0
.idea/compiler.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <option name="BUILD_PROCESS_HEAP_SIZE" value="2048" />
+    <bytecodeTargetLevel target="8" />
+  </component>
+</project>

+ 6 - 0
.idea/encodings.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8" addBOMForNewFiles="with NO BOM">
+    <file url="PROJECT" charset="UTF-8" />
+  </component>
+</project>

+ 82 - 0
.idea/misc.xml

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AndroidDexCompilerConfiguration">
+    <option name="MAX_HEAP_SIZE" value="2048" />
+  </component>
+  <component name="Kotlin2JsCompilerArguments">
+    <option name="sourceMapEmbedSources" />
+  </component>
+  <component name="ProjectInspectionProfilesVisibleTreeState">
+    <entry key="Project Default">
+      <profile-state>
+        <expanded-state>
+          <State />
+          <State>
+            <id>Class structureJava</id>
+          </State>
+          <State>
+            <id>Code maturityJava</id>
+          </State>
+          <State>
+            <id>Google Web Toolkit</id>
+          </State>
+          <State>
+            <id>JUnitJava</id>
+          </State>
+          <State>
+            <id>Java</id>
+          </State>
+          <State>
+            <id>Java 5Java language level migration aidsJava</id>
+          </State>
+          <State>
+            <id>Java 7Java language level migration aidsJava</id>
+          </State>
+          <State>
+            <id>Java 8Java language level migration aidsJava</id>
+          </State>
+          <State>
+            <id>Java language level migration aidsJava</id>
+          </State>
+          <State>
+            <id>JavadocJava</id>
+          </State>
+          <State>
+            <id>Numeric issuesJava</id>
+          </State>
+          <State>
+            <id>PerformanceJava</id>
+          </State>
+          <State>
+            <id>Spring</id>
+          </State>
+          <State>
+            <id>Spring AOPSpring</id>
+          </State>
+          <State>
+            <id>TestNGJava</id>
+          </State>
+          <State>
+            <id>Threading issuesJava</id>
+          </State>
+        </expanded-state>
+      </profile-state>
+    </entry>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/classes" />
+  </component>
+  <component name="SvnBranchConfigurationManager">
+    <option name="myConfigurationMap">
+      <map>
+        <entry key="$PROJECT_DIR$">
+          <value>
+            <SvnBranchConfiguration>
+              <option name="trunkUrl" value="svn+ssh://10.10.101.21/source/uas/yhndftp" />
+            </SvnBranchConfiguration>
+          </value>
+        </entry>
+      </map>
+    </option>
+  </component>
+</project>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/yhnd.iml" filepath="$PROJECT_DIR$/yhnd.iml" />
+    </modules>
+  </component>
+</project>

+ 7 - 0
.idea/vcs.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="svn" />
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

BIN
lib/commons-csv-1.4.jar


BIN
lib/commons-net-3.6.jar


BIN
lib/dom4j-1.6.1.jar


BIN
lib/flexjson-2.1.jar


BIN
lib/jackson-core-asl-1.9.13.jar


BIN
lib/jackson-mapper-asl-1.9.13.jar


BIN
lib/junit.jar


BIN
lib/log4j-1.2.15.jar


BIN
lib/ojdbc6-11.2.0.jar


+ 3 - 0
src/META-INF/MANIFEST.MF

@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: com.uas.main.Main
+

+ 106 - 0
src/com/uas/main/Download.java

@@ -0,0 +1,106 @@
+package com.uas.main;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.net.ftp.FTPClient;
+
+import com.uas.util.BaseUtil;
+import com.uas.util.FtpUtil;
+import com.uas.util.JdbcUtil;
+
+public class Download {	
+	public static boolean updateAndLog(Connection connection,Map<String,Object> map,String depot,File file){
+		boolean bool = false;
+		String hk = "";
+		List<String> sqls = new ArrayList<String>();	
+		String content = BaseUtil.getStringByFile(file);
+		if("true".equals(map.get("hk"))){
+			hk = "YHND_HK.";
+		}
+		sqls.add("insert into "+hk+"xmldatalog (xl_id,xl_data,xl_date,xl_depot,xl_code,xl_from,xl_status,xl_filename)"
+					+ " values("+hk+"XMLDATALOG_SEQ.NEXTVAL,'"+content+"',sysdate,'"+depot+"','"+map.get("code")+"','download','success','"+file.getName()+"')");			
+		sqls.add(map.get("sql").toString());
+		bool = JdbcUtil.executeSqls(connection, sqls);
+		return bool;
+	}
+
+	public static void run(){
+		downloadByDepotAndSob("YHND_SZ");
+		downloadByDepotAndSob("YHND_HK");
+		downloadByDepotAndSob("YITOA_ZX");
+
+	}
+	
+	@SuppressWarnings("unchecked")
+	public static void downloadByDepotAndSob(String sob){
+		Map<String,Object> servMap = JdbcUtil.getFtpConfigs();
+		Set<String> set = servMap.keySet();
+		Map<String, Object> map = null;
+		Connection con = null;
+		con = JdbcUtil.getConnectBySob(sob);
+		boolean bol = false;
+		if(con==null) return;
+		for(String key:set){
+			if(!"local".equals(key)){
+				Map<String,Object> ftpMap = (Map<String,Object>)servMap.get(key);
+				FTPClient client = null;
+				try {
+					client = FtpUtil.connect(ftpMap);
+					if(client!=null){
+						List<File> files = FtpUtil.downloadAllFileByType(client,"XML");
+						String fileName = "";
+						if(files!=null&&files.size()>0){
+							for(File file:files){
+								try{
+									fileName += "," + file.getName();
+									map = BaseUtil.getDataAndSqlByXml(file);
+									bol = updateAndLog(con,map,key,file);
+									if(bol){
+										if("1".equals(key)||"2".equals(key)|"3".equals(key)){
+											client.rename(file.getName(),".."+ File.separator + "reply_bak"+ File.separator + file.getName());
+										}else{
+											FtpUtil.deleteFile(client,file.getName());
+										}
+									}
+									
+								}catch(Exception e){
+									e.printStackTrace();
+									BaseUtil.getLogger().error(e.toString());
+									continue;
+								}
+								System.out.println("download " + file.getName() + " from " + ftpMap.get("ip") + " path:" + ftpMap.get("downloadpath"));
+							}				
+						}
+						if(!"".equals(fileName)){
+							System.out.println("download " + fileName.substring(1) + " from " + ftpMap.get("ip") + " path:" + ftpMap.get("downloadpath"));
+							BaseUtil.getLogger().info("download " + fileName.substring(1) + " from " + ftpMap.get("ip") + " path:" + ftpMap.get("downloadpath"));
+						}					
+					}
+				} catch (Exception e) {
+					BaseUtil.getLogger().error(e.toString());
+					e.printStackTrace();
+				}finally{
+					if(client!=null){
+						FtpUtil.closeFtpClient(client);					
+					}
+				}				
+			}
+		}
+		try{
+			if(con!=null){
+				con.close();
+			}
+		}catch(SQLException e){
+			BaseUtil.getLogger().error(e.toString());
+		}finally{
+			con = null;
+		}
+	}
+}

+ 14 - 0
src/com/uas/main/Main.java

@@ -0,0 +1,14 @@
+package com.uas.main;
+
+import com.uas.util.BaseUtil;
+
+public class Main {
+	public static void main(String[] args) {
+		System.out.println("run start!");
+		BaseUtil.getLogger().info("run start!");
+		Upload.run();
+		Download.run();		
+		System.out.println("run over!");
+		BaseUtil.getLogger().info("run over!");
+	}
+}

+ 238 - 0
src/com/uas/main/Upload.java

@@ -0,0 +1,238 @@
+package com.uas.main;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.OutputStreamWriter;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.net.ftp.FTPClient;
+import org.codehaus.jackson.map.ObjectMapper;
+
+import com.uas.util.BaseUtil;
+import com.uas.util.FtpUtil;
+import com.uas.util.JdbcUtil;
+
+public class Upload {
+	public static Pattern pat = Pattern.compile("\\{(.*?)\\}");	
+	
+	public static String getHeader(String xmltemp){ //获取Header
+		return xmltemp.substring(xmltemp.indexOf("<?xml"),xmltemp.indexOf("<Item>"));
+	}
+	
+	public static String getDetailItem(String xmltemp){ //获取Item
+		return xmltemp.substring(xmltemp.indexOf("<Item>"),xmltemp.indexOf("</Detail"));
+	}
+	
+	public static String replaceFieldByData(String str,Map<String,Object> data){ //替换xml字段为具体数据
+		Matcher mat = pat.matcher(str);
+		String res = str;
+		while(mat.find()){
+			if(data.get(mat.group(1).toUpperCase())!=null){
+				res = res.replace("{" + mat.group(1).toUpperCase() + "}", replaceXmlSpecialSymbol(data.get(mat.group(1).toUpperCase()).toString()));				
+			}else{
+				res = res.replace("{" + mat.group(1).toUpperCase() + "}", "");					
+			}
+		}	
+		return res;
+	}
+	
+	public static String replaceXmlSpecialSymbol(String data){
+		return data.replace("&", "&amp;")
+				.replace("<", "&lt;")
+				.replace(">", "&gt;")
+				.replace("'", "&apos;")
+				.replace("\"", "&quot;");
+	}
+	
+	public static String getCurrentdate(String format){ //获致当时日期
+		DateFormat df = new SimpleDateFormat(format);
+		Date today = Calendar.getInstance().getTime();	
+		return df.format(today);
+	}
+	
+	
+	public static File createXmlFile(String header,String items,String template,String id,String type){ //生成xml文件
+		File xmlFile = null;
+		try{
+			String xml = header + items + "</Detail>" + template.toString().substring(template.toString().indexOf("</Detail>")+9);
+			xmlFile = new File(System.getProperty("java.io.tmpdir")+File.separator + type + "-" + getCurrentdate("yyyyMMdd") + id+".xml");
+			if(!xmlFile.exists()){
+				xmlFile.createNewFile();
+			}
+			FileWriter fw = new FileWriter(xmlFile.getAbsoluteFile());
+            OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(xmlFile.getAbsoluteFile()),"UTF-8");
+            out.write(xml);
+            out.flush();
+            out.close();
+			//fw.write(xml);
+			fw.close();				
+		}catch(Exception e){
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}
+		return xmlFile;
+	}
+	
+	@SuppressWarnings("unchecked")
+	public static File decodeAndGenerateXml(String template,String datastr,String xlid,String type) throws Exception{
+		String header = getHeader(template.toString());
+		String detailItem = getDetailItem(template.toString());
+		String currentDate = getCurrentdate("yyyyMMddHHmm");
+		Map<String,Object> data = new ObjectMapper().readValue(datastr, HashMap.class);
+		data.put("FILENAME", type + "-" + data.get("FILENAME"));
+		data.put("CURRENTDATE", currentDate);
+		header = replaceFieldByData(header,data);
+		
+		StringBuffer sb = new StringBuffer();
+		List<Map<String,Object>> detailData = (List<Map<String,Object>>)data.get("DETAIL");
+		for(Map<String,Object> detail:detailData){
+			sb.append(replaceFieldByData(detailItem,detail));
+		}
+		
+		File file = createXmlFile(header,sb.toString(),template.toString(),xlid,type);	
+		return file;
+	}
+	
+	public static void turnToFormal(Connection connection,String id,File file,String sob){ //临时表数据转入正式
+		Statement statement = null;
+		try{
+			connection.setAutoCommit(false);
+			statement = connection.createStatement();
+			statement.execute("insert into "+sob + "."+"xmldatalog(xl_id,xl_data,xl_date,xl_depot,xl_caller,xl_code,xl_from,xl_status,xl_sourceid,xl_filename) "
+					+ "select "+sob + "."+"XMLDATALOG_SEQ.NEXTVAL,xl_data,sysdate,xl_depot,xl_caller,xl_code,'upload','success',xl_sourceid,'"+file.getName()+"' from xmldatalogtemp where xl_id=" + id);
+			statement.execute("delete from "+sob + "."+"xmldatalogtemp where xl_id=" + id);
+			connection.commit();
+			BaseUtil.getLogger().info("trun to formal success!");	
+		}catch(Exception e){
+			try {
+				connection.rollback();
+			} catch (SQLException e1) {
+				BaseUtil.getLogger().error(e1.toString());
+				e1.printStackTrace();
+			}
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}finally{
+			try{
+				if(statement!=null){
+					statement.close();
+				}			
+			}catch(Exception e){
+				BaseUtil.getLogger().error(e.toString());
+			}
+			statement = null;
+		}
+	}
+	
+	public static boolean upload(FTPClient client,String ip,String folder,File file){
+		boolean flag = false;
+		if(client!=null){
+			flag = FtpUtil.uploadFile(client, folder,file);
+		}
+		System.out.println("upload " + file.getName() + " to " + ip + ":" + folder + " " + (flag?"success":"fail")+"");
+		BaseUtil.getLogger().info("upload " + file.getName() + " to " + ip + ":" + folder + " " + (flag?"success":"fail")+"");	
+		return flag;
+	}
+	
+	public static void run() {
+		uploadBySob("YHND_SZ");
+		uploadBySob("YHND_HK");
+		uploadBySob("YITOA_ZX");
+	}
+	
+	@SuppressWarnings("unchecked")
+	public static void uploadBySob(String sob) {		
+		Statement statement = null;
+		FTPClient client = null;
+		
+		Connection con = null;
+		con = JdbcUtil.getConnectBySob(sob);
+		
+		try{
+			statement = con.createStatement();
+			ResultSet rs = statement.executeQuery("select * from "+sob+"."+"xmldatalogtemp where xl_depot is not null order by xl_depot desc");	
+			String depot = "";				
+			while(rs.next()){
+				try{
+					String xldepot = rs.getString("xl_depot");
+					String type = rs.getString("xl_type");
+					if(!"null".equals(xldepot)&&xldepot!=null&&!"null".equals(type)&&type!=null){
+						Object template = JdbcUtil.getXmlTemplate(con,sob).get(rs.getString("xl_caller")+"_" + xldepot);
+						if(template!=null){							
+							Map<String,Object> ftpConfig = JdbcUtil.getFtpConfigs();			
+							Map<String,Object> config = (Map<String,Object>)ftpConfig.get(xldepot);
+							String folder = config.get(type).toString();
+							
+							if(!depot.equals(xldepot)){ //连接ftp站点
+								if(client!=null){
+									FtpUtil.closeFtpClient(client);
+								}
+								depot = xldepot;
+								client = FtpUtil.connect(config,config.get(type).toString());
+							}
+							
+							File file = decodeAndGenerateXml(template.toString(),rs.getString("xl_data"),rs.getString("xl_id"),folder); //生成文件
+							boolean uploadSuccess = upload(client,config.get("ip").toString(),folder,file);
+							if(uploadSuccess){ //如果文件上传成功,则转入正式数据记录表
+								turnToFormal(con,rs.getString("xl_id"),file,sob); //转入正式
+							}														
+							file.delete();
+						}else{
+							BaseUtil.getLogger().info("caller:"+rs.getString("xl_caller")+" depot:"+xldepot+" template is null");
+						}
+					}else{
+						BaseUtil.getLogger().info("warehouse ftpdepot is null");
+					}
+					JdbcUtil.clearXmlTemplate();						
+				}catch(Exception e){
+					e.printStackTrace();
+					BaseUtil.getLogger().error(e.toString());
+					continue;
+				}
+			}
+			if(client!=null){
+				FtpUtil.closeFtpClient(client);
+				client = null;
+			}
+			try{
+				con.close();
+			}catch(SQLException e){
+				e.printStackTrace();
+				BaseUtil.getLogger().error(e.toString());
+			}finally{
+				con = null;
+			}
+				
+
+		}catch(Exception e){
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}finally{
+			if(statement!=null){
+				try {
+					statement.close();
+				} catch (SQLException e1) {
+					BaseUtil.getLogger().error(e1.toString());
+					e1.printStackTrace();
+				}
+				statement = null;				
+			}
+			if(client!=null){
+				FtpUtil.closeFtpClient(client);
+			}
+		}
+	}
+}

+ 142 - 0
src/com/uas/util/BaseUtil.java

@@ -0,0 +1,142 @@
+package com.uas.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Scanner;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+
+public class BaseUtil {
+	public static Logger logger;
+	
+	/**
+	 * 获取日志类
+	 * @return 日志类
+	 */
+	public static Logger getLogger(){
+		if(logger==null){
+			logger = Logger.getLogger(BaseUtil.class);
+		    //loger所需的配置文件路径   
+			Properties prop = new Properties();
+		    try {
+				prop.load(BaseUtil.class.getResourceAsStream("/properties/log4j.properties"));
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		    PropertyConfigurator.configure(prop); 
+		}
+		return logger;
+	}
+	
+	/**
+	 * 解析xml文件,生成数据
+	 * @param file xml文件
+	 * @return
+	 */
+	@SuppressWarnings("unchecked")
+    public static Map<String,Object> getDataAndSqlByXml(File file){
+		Map<String,Object> map = new HashMap<String,Object>();
+		String json = "";
+		String sql = "";
+		String condition = "";
+		String code = "";
+		InputStream in = null;
+		boolean hkSob = false;
+		
+		try {
+			in = new FileInputStream(file);
+		} catch (FileNotFoundException e1) {
+			e1.printStackTrace();
+		}
+		SAXReader reader = new SAXReader();
+		Document doc = null;
+		try {
+			doc = reader.read(in);
+			in.close();
+		} catch (Exception e1) {
+			e1.printStackTrace();
+		}  
+		Element root = doc.getRootElement();
+    	
+		List<Element> e = root.elements();
+    	for(Element el:e){
+        	 String name = el.getName();
+        	 if(name=="DocumentNumber"){
+        		 json += ",\"FILENAME:\":\"" + el.getData() + "\"";
+        	 }else if(name=="DocumentANSDateTime"){
+        		 json += ",\"RESPONSEDATE:\":\"" + el.getData() + "\"";
+        		 sql += "PI_LOGISTICSDATE=to_date('" + el.getData() + "','yyyymmddHH24:mi'),";
+        	 }else if(name=="Status"){
+        		 json += ",\"PI_LOGISTICSSTATUS:\":\"" + el.getData() + "\"";
+        		 sql += "PI_LOGISTICSSTATUS='" + el.getData() + "',";
+        	 }else if(name=="TrackingNo"){
+        		 json += ",\"PI_LOGISTICSCODE:\":\"" + el.getData() + "\"";
+        		 sql += "PI_LOGISTICSCODE='" + el.getData() + "',";
+        	 }else if(name=="FreightCost"){
+        		 json += ",\"PI_FREIGHT:\":\"" + el.getData() + "\"";
+        		 sql += "PI_FREIGHT='" + el.getData() + "',";
+        	 }else if(name=="RefNo"){
+        		 code = el.getData().toString();
+        		 if(code.trim().toUpperCase().startsWith("HK")){
+        			 hkSob = true;
+        		 }else{
+        			 hkSob = false;
+        		 }
+        		 json += ",\"PI_INOUTNO:\":\"" + code + "\"";
+        		 condition = "PI_INOUTNO='"+code+"'";
+        	 }
+    	}
+    	if(!"".equals(json)){
+    		json = "{" + json.substring(1) + "}";
+    	}
+    	if(!"".equals(sql)){
+    		sql = "update "+(hkSob?"YHND_HK.":"")+"prodinout set " + sql.substring(0,sql.lastIndexOf(",")) + " where " + condition;
+    	}
+    	map.put("json", json);
+    	map.put("sql", sql);
+    	map.put("code",code);
+    	map.put("hk",hkSob?"true":"false");
+    	return map;		
+	}
+	
+	public static String getStringByFile(File file){
+    	String content = "";
+		try {
+			content = new Scanner(file).useDelimiter("\\Z").next();
+			content.replace("'", "''");
+			if(content.length()>=100){
+				content = splitAndConcat(content,100,"'","'","||");
+				content = content.substring(1,content.length()-1);
+			}
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+			BaseUtil.getLogger().error(e.toString());
+		}		
+		return content;
+	}
+	
+	public static String splitAndConcat(String str, int length, String prevStr, String subStr, String concatStr) {
+		int strLen = str.length();
+		int len = (int) Math.ceil((double) strLen / length);
+		StringBuffer buffer = new StringBuffer();
+		for (int i = 0; i < len; i++) {
+			if (i > 0)
+				buffer.append(concatStr);
+			buffer.append(prevStr).append(str.substring(i * length, i < len - 1 ? (i + 1) * length : strLen)).append(subStr);
+		}
+		return buffer.toString();
+	}
+}

+ 189 - 0
src/com/uas/util/FtpUtil.java

@@ -0,0 +1,189 @@
+package com.uas.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.SocketException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPFile;
+import org.apache.commons.net.ftp.FTPReply;
+
+public class FtpUtil {
+	/**
+	 * 连接到ftp站点,判断是否可以连接
+	 * @param path  要连接到的目录
+	 * @param addr  站点地址
+	 * @param port  端口
+	 * @param username 用户名
+	 * @param password 密码
+	 * @return
+	 * @throws Exception
+	 */
+	public static boolean connect(String path, String addr, int port, String username,
+			String password) throws Exception {
+		boolean result = false;
+		FTPClient ftp = new FTPClient();
+		int reply;
+		ftp.connect(addr, port);
+		ftp.login(username, password);
+		ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
+		reply = ftp.getReplyCode();
+		if (!FTPReply.isPositiveCompletion(reply)) {
+			ftp.disconnect();
+			return result;
+		}
+		ftp.changeWorkingDirectory(path);
+		result = true;
+		return result;
+	}
+	
+	/**
+	 * 获取ftp连接,该连接指向ftp配置中的downloadpath文件夹
+	 * @param map包含ftp连接配置的map
+	 */
+	public static FTPClient connect(Map<String,Object> map) throws Exception {
+		return connect(map,map.get("downloadpath").toString());
+	}
+
+	/**
+	 * 获取ftp连接,该连接指向ftp配置中的downloadpath文件夹
+	 * @param map包含ftp连接配置的map
+	 */
+	public static FTPClient connect(Map<String,Object> map,String path){
+		FTPClient ftp = null;
+		String addr = null;
+		try{
+			addr = map.get("ip").toString();
+			int port = Integer.parseInt(map.get("port").toString());
+			String username = map.get("user").toString();
+			String password = map.get("password").toString();
+			ftp = new FTPClient();
+			ftp.setConnectTimeout(40*1000);
+			int reply;
+			ftp.connect(addr, port);		
+			if(!ftp.login(username, password)){
+				return null;
+			}
+			ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
+			reply = ftp.getReplyCode();
+			if (!FTPReply.isPositiveCompletion(reply)) {
+				ftp.disconnect();
+				return null;
+			}
+			ftp.changeWorkingDirectory(path);
+			System.out.println("connect to ip:" + addr + " success!");
+			BaseUtil.getLogger().info("connect to ip:" + addr + " success!");
+			return ftp;			
+		}catch(Exception e){ 
+			e.printStackTrace();
+			System.out.println("connect to ip:" + addr + " fail!");
+			BaseUtil.getLogger().error("connect to ip:" + addr + " fail!" + e.toString());
+			return null;
+		}
+	}
+
+	/**
+	 * 上传文件
+	 * @param ftpClient 已连接的ftp客户端
+	 * @param pathname 路径
+	 * @param file 待上传的文件
+	 * @return 上传结果
+	 */
+	public static boolean uploadFile(FTPClient ftpClient, String pathname, File file) {
+		boolean flag = false;
+		ftpClient.setControlEncoding("UTF-8");
+		try {
+			ftpClient.enterLocalPassiveMode();
+			ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
+			boolean change = ftpClient.changeWorkingDirectory("/"+pathname);
+			if(!change){
+				BaseUtil.getLogger().info("change to " + pathname + " fail");
+				return false;
+			}
+			InputStream inputStream = new FileInputStream(file);
+			flag = ftpClient.storeFile(file.getName(), inputStream);
+			inputStream.close();
+			//ftpClient.logout();
+		} catch (Exception e) {
+			flag = false;
+			e.printStackTrace();
+			BaseUtil.getLogger().error(e.toString());
+			if (ftpClient.isConnected()) {
+				try {
+					ftpClient.disconnect();
+				} catch (IOException e1) {
+					BaseUtil.getLogger().error(e1.toString());
+					e1.printStackTrace();
+				}
+			}
+		}
+		return flag;
+	}
+	
+	/**
+	 * 删除后关闭ftp连接
+	 * @param ftpClient 
+	 * @param filename 要删除的文件名
+	 * @return 删除结果
+	 */
+	public static boolean deleteFile(FTPClient ftpClient,String filename) {
+		boolean flag = false;
+		try {
+			ftpClient.dele(filename);
+			flag = true;
+		} catch (Exception e) {
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}
+		return flag;
+	}
+
+	/**
+	 * 
+	 * @param ftpClient
+	 * @return 获取连接到的ftp站点下的文件夹所有文件
+	 */
+	public static List<File> downloadAllFileByType(FTPClient ftpClient,String fileType) {
+		List<File> files = new ArrayList<File>();	
+		try {
+			ftpClient.enterLocalPassiveMode();
+			FTPFile[] ftpFiles = ftpClient.listFiles();
+			for (FTPFile file : ftpFiles) {
+				if(file.getName().toUpperCase().endsWith("." + fileType)){
+					File localFile = new File(System.getProperty("java.io.tmpdir") + File.separator + file.getName());
+					OutputStream os = new FileOutputStream(localFile);
+					ftpClient.retrieveFile(file.getName(), os);
+					os.close();
+					files.add(localFile);					
+				}
+			}
+		} catch (Exception e) {
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}
+		return files;
+	}
+	
+	/**
+	 * 关闭ftp连接
+	 * @param ftpClient
+	 */
+	public static void closeFtpClient(FTPClient ftpClient){
+		if (ftpClient.isConnected()) {
+			try {
+				ftpClient.logout();
+			} catch (IOException e) {
+				BaseUtil.getLogger().error(e.toString());
+			}
+		}		
+	}
+	
+}

+ 239 - 0
src/com/uas/util/JdbcUtil.java

@@ -0,0 +1,239 @@
+package com.uas.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.codehaus.jackson.map.ObjectMapper;
+
+public class JdbcUtil {
+	public static Map<String,Object> ftpConfigs;
+	//public static Connection connection;
+	public static Map<String,Object> template;
+	public static List<Connection> connections;
+	
+	/**
+	 * 从xmltemplate表获取所有模板
+	 * @return Map形式 {caller:templatecontent}
+	 */
+	public static Map<String,Object> getXmlTemplate(Connection connection,String sob){
+		if(template==null){
+			template = new HashMap<String,Object>();
+			try{
+				Statement statement = connection.createStatement();
+				ResultSet rs = statement.executeQuery("select * from " + sob + "." + "xmltemplate");
+				while(rs.next()){
+					template.put(rs.getString("xt_caller")+"_"+rs.getString("xt_ftpdepot"),rs.getString("xt_content"));
+				}
+			}catch (Exception e){
+				BaseUtil.getLogger().error(e.toString());
+				try {
+					connection.close();
+				} catch (SQLException e1) {
+					BaseUtil.getLogger().error(e1.toString());
+					e1.printStackTrace();
+				}finally{
+					connection = null;
+				}
+				e.printStackTrace();
+			}			
+		}
+		return template;
+	}
+
+	public static void clearXmlTemplate(){
+		if(template!=null){
+			template = null;
+		}
+	}
+	
+	/**
+	 * 从ftpconfigs配置文件中获取ftp站点配置信息
+	 * @return Map<String,Object>
+	 */
+	@SuppressWarnings("unchecked")
+	public static Map<String,Object> getFtpConfigs(){
+		if(ftpConfigs==null){
+			try {
+				ftpConfigs = new ObjectMapper().readValue(JdbcUtil.class.getResourceAsStream("/properties/ftpconfig.properties"), HashMap.class);
+			}catch (Exception e) {
+				BaseUtil.getLogger().error(e.toString());
+				e.printStackTrace();
+			}			
+		}
+		return ftpConfigs;
+	}
+	
+	/**
+	 * 连接到数据库
+	 * @param url 地址
+	 * @param user 用户名
+	 * @param password 密码
+	 * @return 返回一个连接
+	 * @throws Exception
+	 */
+	public static Connection getConnect(String url,String user,String password) throws Exception{
+        Class.forName("oracle.jdbc.driver.OracleDriver");// 加载Oracle驱动程序
+        Connection con = DriverManager.getConnection(url, user, password);// 获取连接
+        return con;	       
+	}
+	
+
+	/**
+	 * 从dbconfig配置文件中获取数据库连接
+	 * @return 返回数据库连接
+	 */
+	@SuppressWarnings("unchecked")
+	public static List<Connection> getConnections(){
+		List<Connection> cons = new ArrayList<Connection>();
+		Connection con = null;
+		//if(connections==null){
+		    try{
+				InputStream dbinput = JdbcUtil.class.getResourceAsStream("/properties/dbconfig.properties");
+				Map<String,Object> sob = new ObjectMapper().readValue(dbinput,HashMap.class);
+				Set<String> sets = sob.keySet();
+				for(String key:sets){
+					Map<String,String> dbmsg = (Map<String,String>)sob.get(key);
+					con = getConnect(dbmsg.get("url"), dbmsg.get("user"), dbmsg.get("password"));
+					cons.add(con);
+				}
+		    }catch (Exception e){
+		    	e.printStackTrace();
+		    	BaseUtil.getLogger().error(e.toString());
+	    		if(cons.size()>0){
+	    			for(int i=0;i<cons.size();i++){
+	    				if(cons.get(i)!=null){
+	    					Connection c = cons.get(i);
+	    					try{
+	    						c.close();
+	    					}catch(SQLException e2){
+	    						e2.printStackTrace();
+	    						BaseUtil.getLogger().error(e2.toString());
+	    					}finally{
+	    						c = null;
+	    					}
+	    				}
+	    			}
+	    		}				
+		    } 			
+		//}
+		return cons;
+	}
+	
+	/**
+	 * 从dbconfig配置文件中获取数据库连接
+	 * @return 返回数据库连接
+	 */
+	@SuppressWarnings("unchecked")
+	public static Connection getConnectBySob(String sob){
+		Connection con = null;
+	    try{
+	    	InputStream dbinput = JdbcUtil.class.getResourceAsStream("/properties/dbconfig.properties");;
+			Map<String,Object> sobs = new ObjectMapper().readValue(dbinput,HashMap.class);
+			Map<String,String> dbmsg = (Map<String,String>)sobs.get(sob);
+			con = getConnect(dbmsg.get("url"), dbmsg.get("user"), dbmsg.get("password"));
+	    }catch (Exception e){
+	    	BaseUtil.getLogger().error(e.toString());
+	    	try {
+	    		if(con!=null){
+	    			con.close();
+	    		}				
+			} catch (SQLException e1) {
+				BaseUtil.getLogger().error(e1.toString());
+				e1.printStackTrace();
+			}finally{
+				con = null;
+			}
+	        e.printStackTrace();
+	    } 			
+		return con;
+	}
+	
+	/**
+	 * 关闭连接
+	 * @param con
+	 * @param pre
+	 * @param result
+	 * @return
+	 */
+	public static boolean closeCn(Connection con,PreparedStatement pre,ResultSet result){
+        try{
+            if (result != null)
+                result.close();
+            	result = null;
+            if (pre != null)
+                pre.close();
+            	pre = null;
+            if (con != null)
+                con.close();
+        }
+        catch (Exception e){
+        	BaseUtil.getLogger().error(e.toString());
+            e.printStackTrace();
+        }
+		return true;
+	}
+	
+	/**
+	 * 执行多条sql语句
+	 * @param connection 连接
+	 * @param str 多条sqls语句
+	 * @return
+	 */
+	@SuppressWarnings("finally")
+	public static boolean executeSqls(Connection connection,List<String> str){
+		Statement statement = null;
+		boolean bol = true;
+		try{		
+			statement = connection.createStatement();		
+			
+			for(String sql:str){
+				statement.addBatch(sql);
+			}
+			
+			try {
+				statement.setQueryTimeout(180);
+				statement.executeBatch();
+			} catch (SQLException e) {
+				bol = false;
+				BaseUtil.getLogger().error(e.toString());
+				try {
+					statement.close();
+				} catch (SQLException e1) {
+					BaseUtil.getLogger().error(e1.toString());
+					e1.printStackTrace();
+				}
+				e.printStackTrace();
+			}
+			statement.close();
+		}catch(Exception e){
+			bol = false;
+			BaseUtil.getLogger().error(e.toString());
+			BaseUtil.getLogger().info("execute fail!");
+			try {
+				if(connection!=null){
+					connection.rollback();
+				}				
+			} catch (SQLException e1) {
+				BaseUtil.getLogger().error(e1.toString());
+				e1.printStackTrace();
+			}
+			e.printStackTrace();
+		}finally{
+			statement = null;
+			return bol;
+		}
+	}
+	
+}

+ 17 - 0
src/properties/dbconfig.properties

@@ -0,0 +1,17 @@
+{
+	"YHND_SZ":{
+		"url":"jdbc:oracle:thin:@sz.hi-mantech.com:1521:orcl",
+		"user":"YHND_SZ",
+		"password":"select!#%*("
+	},
+	"YHND_HK":{
+		"url":"jdbc:oracle:thin:@sz.hi-mantech.com:1521:orcl",
+		"user":"YHND_HK",
+		"password":"select!#%*("
+	},
+	"YITOA_ZX":{
+		"url":"jdbc:oracle:thin:@sz.hi-mantech.com:1521:orcl",
+		"user":"YITOA_ZX",
+		"password":"select!#%*("
+}
+}

+ 149 - 0
src/properties/ftpconfig.properties

@@ -0,0 +1,149 @@
+{
+	"local":{
+		"ip":"192.168.253.97",
+		"port":21,
+		"user":"luhg",
+		"password":"342521",
+		"downloadpath":"TEST"
+	},
+	"1":{
+		"ip":"ftp.eascs.com",
+		"port":21,
+		"user":"hi-mantech",
+		"password":"Ders8744",
+		"downloadpath":"HND_RECWMSRELS_2",
+		"in":"HND_WMSRECV",
+		"out":"HND_WMSRELS",
+		"remark":"怡亚通"
+	},
+	"2":{
+		"ip":"sz.hi-mantech.com",
+		"port":46688,
+		"user":"user",
+		"password":"user_123456",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海仓库"
+	},
+	"3":{
+		"ip":"sz.hi-mantech.com",
+		"port":46688,
+		"user":"userzx",
+		"password":"userzx_123456",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海仓库"
+	},
+	"6":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND03",
+		"password":"Yhnd@#$2018",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"\u65D7\u4E30-Megafone"
+	},
+	"3":{
+		"ip":"sz.hi-mantech.com",
+		"port":46688,
+		"user":"userzx",
+		"password":"userzx_123456",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海仓库"
+	},
+	"4":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND04",
+		"password":"Yhnd#$%2019",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"旗丰"
+	},
+	"5":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND05",
+		"password":"Yhnd#$%2019",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"旗丰"
+	},
+	"6":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND03",
+		"password":"Yhnd@#$2018",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"\u65D7\u4E30-Megafone"
+	},
+	"7":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND02",
+		"password":"Yhnd*$@2017",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"旗丰"
+	},
+	"9":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND06",
+		"password":"Yhnd#$%2019",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"YHND_Hunan"
+	},
+	"10":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND07",
+		"password":"Yhnd#$%2019",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"YHND_Wingtech"
+	},
+	"8":{
+		"ip":"sz.hi-mantech.com",
+		"port":46688,
+		"user":"userLY",
+		"password":"user_123456",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"YHND_LY"
+	},
+	"11":{
+		"ip":"183.62.216.214",
+		"port":21,
+		"user":"YTZX02",
+		"password":"Yhnd#$%2019",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"YHND_Wingtech"
+	},
+	"2_old":{
+		"ip":"218.255.13.107",
+		"port":21,
+		"user":"mantech",
+		"password":"mantech",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海WGQ"
+	}
+}

+ 69 - 0
src/properties/ftpconfig.properties.mine

@@ -0,0 +1,69 @@
+{
+	"local":{
+		"ip":"192.168.253.97",
+		"port":21,
+		"user":"luhg",
+		"password":"342521",
+		"downloadpath":"TEST"
+	},
+	"1":{
+		"ip":"ftp.eascs.com",
+		"port":21,
+		"user":"hi-mantech",
+		"password":"Ders8744",
+		"downloadpath":"HND_RECWMSRELS_2",
+		"in":"HND_WMSRECV",
+		"out":"HND_WMSRELS",
+		"remark":"怡亚通"
+	},
+	"2":{
+		"ip":"sz.hi-mantech.com",
+		"port":46688,
+		"user":"user",
+		"password":"user_123456",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海仓库"
+	},
+	"3":{
+		"ip":"sz.hi-mantech.com",
+		"port":46688,
+		"user":"userzx",
+		"password":"userzx_123456",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海仓库"
+	},
+	"6":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND03",
+		"password":"Yhnd@#$2018",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"\u65D7\u4E30-Megafone"
+	},
+	"7":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND02",
+		"password":"Yhnd*$@2017",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"旗丰"
+	},
+	"2_old":{
+		"ip":"218.255.13.107",
+		"port":21,
+		"user":"mantech",
+		"password":"mantech",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海WGQ"
+	}
+}

+ 49 - 0
src/properties/ftpconfig.properties.r22716

@@ -0,0 +1,49 @@
+{
+	"local":{
+		"ip":"192.168.253.97",
+		"port":21,
+		"user":"luhg",
+		"password":"342521",
+		"downloadpath":"TEST"
+	},
+	"1":{
+		"ip":"ftp.eascs.com",
+		"port":21,
+		"user":"hi-mantech",
+		"password":"Ders8744",
+		"downloadpath":"HND_RECWMSRELS_2",
+		"in":"HND_WMSRECV",
+		"out":"HND_WMSRELS",
+		"remark":"怡亚通"
+	},
+	"2":{
+		"ip":"sz.hi-mantech.com",
+		"port":46688,
+		"user":"user",
+		"password":"user_123456",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海仓库"
+	},
+	"7":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND02",
+		"password":"Yhnd*$@2017",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"旗丰"
+	},
+	"2_old":{
+		"ip":"218.255.13.107",
+		"port":21,
+		"user":"mantech",
+		"password":"mantech",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海WGQ"
+	}
+}

+ 89 - 0
src/properties/ftpconfig.properties.r25751

@@ -0,0 +1,89 @@
+{
+	"local":{
+		"ip":"192.168.253.97",
+		"port":21,
+		"user":"luhg",
+		"password":"342521",
+		"downloadpath":"TEST"
+	},
+	"1":{
+		"ip":"ftp.eascs.com",
+		"port":21,
+		"user":"hi-mantech",
+		"password":"Ders8744",
+		"downloadpath":"HND_RECWMSRELS_2",
+		"in":"HND_WMSRECV",
+		"out":"HND_WMSRELS",
+		"remark":"怡亚通"
+	},
+	"2":{
+		"ip":"sz.hi-mantech.com",
+		"port":46688,
+		"user":"user",
+		"password":"user_123456",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海仓库"
+	},
+	"3":{
+		"ip":"sz.hi-mantech.com",
+		"port":46688,
+		"user":"userzx",
+		"password":"userzx_123456",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海仓库"
+	},
+	"4":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND04",
+		"password":"Yhnd#$%2019",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"旗丰"
+	},
+	"5":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND05",
+		"password":"Yhnd#$%2019",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"旗丰"
+	},
+	"6":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND03",
+		"password":"Yhnd@#$2018",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"\u65D7\u4E30-Megafone"
+	},
+	"7":{
+		"ip":"112.74.205.182",
+		"port":21,
+		"user":"YHND02",
+		"password":"Yhnd*$@2017",
+		"downloadpath":"reply",
+		"in":"appointment_in",
+		"out":"distribute_in",
+		"remark":"旗丰"
+	},
+	"2_old":{
+		"ip":"218.255.13.107",
+		"port":21,
+		"user":"mantech",
+		"password":"mantech",
+		"downloadpath":"WMSANS",
+		"in":"WMSRECV",
+		"out":"WMSRELS",
+		"remark":"上海WGQ"
+	}
+}

+ 6 - 0
src/properties/log4j.properties

@@ -0,0 +1,6 @@
+log4j.rootLogger=DEBUG, R     
+log4j.appender.R=org.apache.log4j.FileAppender   
+log4j.appender.R.file=my.log     
+log4j.appender.R.Append=true   
+log4j.appender.R.layout=org.apache.log4j.PatternLayout   
+log4j.appender.R.layout.ConversionPattern=%n%n%d%p[%c]-%m%n   

+ 107 - 0
yhnd.iml

@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="EclipseModuleManager">
+    <libelement value="jar://$MODULE_DIR$/lib/commons-csv-1.4.jar!/" />
+    <libelement value="jar://$MODULE_DIR$/lib/commons-net-3.6.jar!/" />
+    <libelement value="jar://$MODULE_DIR$/lib/dom4j-1.6.1.jar!/" />
+    <libelement value="jar://$MODULE_DIR$/lib/flexjson-2.1.jar!/" />
+    <libelement value="jar://$MODULE_DIR$/lib/jackson-core-asl-1.9.13.jar!/" />
+    <libelement value="jar://$MODULE_DIR$/lib/jackson-mapper-asl-1.9.13.jar!/" />
+    <libelement value="jar://$MODULE_DIR$/lib/junit.jar!/" />
+    <libelement value="jar://$MODULE_DIR$/lib/log4j-1.2.15.jar!/" />
+    <libelement value="jar://$MODULE_DIR$/lib/ojdbc6-11.2.0.jar!/" />
+    <src_description expected_position="1">
+      <src_folder value="file://$MODULE_DIR$/src" expected_position="1" />
+    </src_description>
+  </component>
+  <component name="NewModuleRootManager">
+    <output url="file://$MODULE_DIR$/bin" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module-library">
+      <library name="commons-csv-1.4.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/commons-csv-1.4.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="commons-net-3.6.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/commons-net-3.6.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="dom4j-1.6.1.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/dom4j-1.6.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="flexjson-2.1.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/flexjson-2.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="jackson-core-asl-1.9.13.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jackson-core-asl-1.9.13.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="jackson-mapper-asl-1.9.13.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jackson-mapper-asl-1.9.13.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="junit.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/junit.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="log4j-1.2.15.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/log4j-1.2.15.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="ojdbc6-11.2.0.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/ojdbc6-11.2.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+  </component>
+</module>