koul 5 years ago
parent
commit
083b46794c

+ 12 - 12
.idea/artifacts/yhnd_jar.xml → .idea/artifacts/yhnd_csv_jar.xml

@@ -1,21 +1,21 @@
 <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">
+  <artifact type="jar" name="yhnd_csv:jar">
+    <output-path>$PROJECT_DIR$/target/classes/artifacts/yhnd_csv_jar</output-path>
+    <root id="archive" name="yhnd_csv.jar">
       <element id="directory" name="META-INF">
         <element id="file-copy" path="$PROJECT_DIR$/META-INF/MANIFEST.MF" />
       </element>
-      <element id="module-output" name="yhnd" />
-      <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/httpcore-4.4.10.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/junit.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$PROJECT_DIR$/lib/commons-net-3.6.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$PROJECT_DIR$/lib/ojdbc6-11.2.0.jar" path-in-jar="/" />
+      <element id="module-output" name="yhnd_csv" />
       <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/flexjson-2.1.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/commons-net-3.6.jar" path-in-jar="/" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/flexjson-2.1.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-csv-1.4.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/log4j-1.2.15.jar" path-in-jar="/" />
+      <element id="library" level="project" name="commons-csv-1.4" />
+      <element id="extracted-dir" path="$PROJECT_DIR$/lib/jackson-core-asl-1.9.13.jar" path-in-jar="/" />
     </root>
   </artifact>
 </component>

+ 18 - 0
.idea/libraries/commons_csv_1_4.xml

@@ -0,0 +1,18 @@
+<component name="libraryTable">
+  <library name="commons-csv-1.4">
+    <ANNOTATIONS>
+      <root url="jar://$PROJECT_DIR$/lib/commons-csv-1.4.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/commons-net-3.6.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/dom4j-1.6.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/flexjson-2.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/jackson-core-asl-1.9.13.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/jackson-mapper-asl-1.9.13.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/junit.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/log4j-1.2.15.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ojdbc6-11.2.0.jar!/" />
+    </ANNOTATIONS>
+    <CLASSES />
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 0 - 9
.idea/libraries/httpcore_4_4_10.xml

@@ -1,9 +0,0 @@
-<component name="libraryTable">
-  <library name="httpcore-4.4.10">
-    <CLASSES>
-      <root url="jar://$PROJECT_DIR$/lib/httpcore-4.4.10.jar!/" />
-    </CLASSES>
-    <JAVADOC />
-    <SOURCES />
-  </library>
-</component>

+ 1 - 1
.idea/misc.xml

@@ -64,7 +64,7 @@
     </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" />
+    <output url="file://$PROJECT_DIR$/target/classes" />
   </component>
   <component name="SvnBranchConfigurationManager">
     <option name="myConfigurationMap">

+ 1 - 1
.idea/modules.xml

@@ -2,7 +2,7 @@
 <project version="4">
   <component name="ProjectModuleManager">
     <modules>
-      <module fileurl="file://$PROJECT_DIR$/yhnd.iml" filepath="$PROJECT_DIR$/yhnd.iml" />
+      <module fileurl="file://$PROJECT_DIR$/yhnd_csv.iml" filepath="$PROJECT_DIR$/yhnd_csv.iml" />
     </modules>
   </component>
 </project>

+ 1 - 1
META-INF/MANIFEST.MF

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

BIN
lib/commons-io-2.4.jar


BIN
lib/httpcore-4.4.10.jar


+ 384 - 0
src/com/uas/main/CsvParse.java

@@ -0,0 +1,384 @@
+package com.uas.main;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.commons.csv.CSVFormat;
+import org.apache.commons.csv.CSVParser;
+import org.apache.commons.csv.CSVRecord;
+import org.apache.commons.net.ftp.FTPClient;
+
+import com.uas.util.BaseUtil;
+import com.uas.util.FtpUtil;
+import com.uas.util.JdbcUtil;
+import com.uas.util.PraseCsvUtil;
+
+public class CsvParse{
+	
+	public static List<String> parseCsvFileToSqlsForStockin(File file){
+		List<String> sqls = null;
+		Reader in = null;
+		try{
+			in = new FileReader(file);
+			sqls = new ArrayList<String>();  		
+			CSVParser csvParser = CSVFormat.EXCEL.parse(in);
+			List<CSVRecord> records = csvParser.getRecords();  		
+			boolean skip = true;
+			String sql = "";
+			String value = "";
+			String custCode = "";
+			String poCode = "";
+			String qty = "";
+			String invoiceNo = "";
+			String lineNo = "";
+			String sob = "";
+			String fileName = file.getName();
+			for(int i=0;i<records.size();i++){
+				CSVRecord record = records.get(i);
+				sob = "";
+				for(int j=0;j<record.size();j++){
+					if(skip){
+						if("Customer Code".equals(record.get(j))){
+	    					skip = false;
+	    					break;
+	    				}	
+					}else{						
+						String rec = record.get(j);
+						if(j==1){
+							if(rec.startsWith("E")){
+								rec = rec.replace("E", "HK-");
+							}else if(rec.startsWith("NSZPO")){
+								sob = "YHND_SZ.";
+							}
+						}
+						if(!"".equals(rec)){
+							value = getSqlValueForStockin(rec,value);			
+						}
+						if(j==0){
+							custCode = rec;
+						}else if(j==1){
+							poCode = rec;
+						}else if(j==5){
+							qty = rec;
+						}else if(j==7){
+							invoiceNo = rec;
+						}else if(j==14){
+							lineNo = rec;
+						}
+					}
+				}    				
+				if(!"".equals(value)){
+					sql = "insert into "+sob+"csvdatalog(cl_id,cl_cucode,cl_pucode,cl_orispeccode,cl_cardno,cl_countrycode,"
+							+ "cl_qty,cl_shippingdate,cl_invoiceno,cl_currency,cl_price,cl_ycweight,cl_yhweight,cl_gyhweight,"
+							+ "cl_cbm,cl_lineno,cl_rate,import_,filename_) select CSVDATALOG_SEQ.NEXTVAL";
+					sqls.add(sql + value + ",0,'"+fileName.replace("'", "''")+"' from dual  where not exists (select 1 from "+sob+"csvdatalog where nvl(cl_cucode,' ')='" + custCode.replace("'", "''")
+								+ "' and nvl(cl_pucode,' ')='"+poCode.replace("'", "''")+"' and nvl(cl_qty,0)='"+qty + "' and nvl(cl_invoiceno,' ')='" + invoiceNo 
+								+"' and nvl(cl_lineno,0)='"+lineNo+"')");
+					value = "";
+				}
+			}
+			in.close();
+			in = null;
+		}catch(Exception e){
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}finally{
+			try {
+				if(in!=null){
+					in.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			in = null;
+		}
+		return sqls;
+	}
+    
+	public static String getSqlValueForStockin(String rec,String value){ //日期转换
+		if(rec.matches("\\d{4}[-/]\\d{1,2}[-/]\\d{1,2}")){ 
+			String split = "/";
+			if(rec.contains("-")){
+				split = "-";
+			}
+			String[] ymd = rec.split(split);
+			if(ymd[1].length()==1){
+				rec = rec.replace(split+ymd[1], split+"0" + ymd[1]);
+			}
+			if(ymd[2].length()==1){
+				rec = rec.replace(split+ymd[2], split+"0" + ymd[2]);
+			}  							
+			value += ",to_date('"+rec+"','yyyy"+split+"mm"+split+"dd')";
+		}else{
+			value += ",'"+rec+"'";
+		}
+		return value;
+	}
+
+	public static List<String> parseCsvFileToSqlsForFirm(File file){
+		List<String> sqls = null;
+		Reader in = null;
+		try{
+			in = new FileReader(file);
+			sqls = new ArrayList<String>();  		
+			CSVParser csvParser = CSVFormat.EXCEL.parse(in);
+			List<CSVRecord> records = csvParser.getRecords();  		
+			boolean skip = true;
+			String sql = "";
+			String value = "";
+			String sob = "";
+			String fileName = file.getName();
+			for(int i=0;i<records.size();i++){
+				CSVRecord record = records.get(i);
+				sob = "";
+				for(int j=0;j<24;j++){
+					if(skip){
+						if("FIRM".equals(record.get(j))){
+	    					skip = false;
+	    					break;
+	    				}	
+					}else{						
+						String rec = record.get(j);
+						if(!"".equals(rec)){
+							value = getSqlValueForFirm(rec,value);			
+						}else{
+							value=value+",''";
+						}
+					}
+				}    				
+				if(!"".equals(value)){
+					sql = "insert into "+sob+"csvdataloga(ID,FIRM,CLERK_CODE,CUSTOMER,CUSTOMER_PART_NO,EXTERN_MURATA_TYPE,PURCHASE_CARD_NO,"
+							+ "CARD_NO,SUPPLIER_CARD_NO,BACKLOG_QTY_PC,CUSTOMER_PURCH_ORDER_NO,Purchase_Order_Line_No,CUSTOMER_REQUESTED_DATE,LATEST_STOCK_IN_DATE,"
+							+ "PURCH_ORDER_DATE,SEQUNECE_NO,PURCHASE_SEQ_NO,PICKING_NOTE_NO,SP_IN_SALES_CURRENCY,SALES_CURRENCY,ORIGIN,DESCRIPTION,"
+							+ "SALES_MANAGER_DESC,SALESMAN_DESC,SALES_PERSON,import_,filename_) "
+							+ "select CSVDATALOGA_SEQ.NEXTVAL";
+					sqls.add(sql + value + ",0,'"+fileName.replace("'", "''")+"' from dual");
+					value = "";
+				}
+			}
+			in.close();
+			in = null;
+		}catch(Exception e){
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}finally{
+			try {
+				if(in!=null){
+					in.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			in = null;
+		}
+		System.err.println(sqls);
+		return sqls;
+	}
+	
+	public static List<String> parseCsvFileToSqlsForWarehouse(File file){
+		List<String> sqls = null;
+		Reader in = null;
+		try{
+			in = new FileReader(file);
+			sqls = new ArrayList<String>();  		
+			CSVParser csvParser = CSVFormat.EXCEL.parse(in);
+			List<CSVRecord> records = csvParser.getRecords();  		
+			boolean skip = true;
+			String sql = "";
+			String value = "";
+			String fileName = file.getName();
+			String sob = "";
+			for(int i=0;i<records.size();i++){
+				CSVRecord record = records.get(i);
+				sob = "";
+				for(int j=0;j<18;j++){
+					if(skip){
+						if("Warehouse Code".equals(record.get(j))){
+	    					skip = false;
+	    					break;
+	    				}	
+					}else{						
+						String rec = record.get(j);
+						if(!"".equals(rec)){
+							value = getSqlValueForWarehouse(rec,value);			
+						}else{
+							value=value+",''";
+						}
+					}
+				}    				
+				if(!"".equals(value)){
+					sql = "insert into "+sob+"csvdatalogb(ID,WAREHOUSE_CODE,FIRM_CODE,CUSTOMER_CODE,CUSTOMER_NAME,INVOICE_NUMBER,PICKING_NOTE,"
+							+ "ADDRESS_CODE,TOTAL_QTY,EXCHANGE_RATE,CURRENCY,TOTAL_AMOUNT,HKD,HKD_AMOUNT,MURATA_CLERK,INVOICE_DATE,CREATE_DATE,USER_,"
+							+ "SECTION_MANAGER,IMPORT_,filename_) "
+							+ "select CSVDATALOGA_SEQ.NEXTVAL";
+					sqls.add(sql + value + ",0,'"+fileName.replace("'", "''")+"' from dual");
+					value = "";
+				}
+			}
+			in.close();
+			in = null;
+		}catch(Exception e){
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}finally{
+			try {
+				if(in!=null){
+					in.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			in = null;
+		}
+		return sqls;
+	}
+    
+	public static String getSqlValueForFirm(String rec,String value){ //日期转换
+		if(rec.matches("\\d{4}[-/]\\d{1,2}[-/]\\d{1,2}")){ 
+			String split = "/";
+			if(rec.contains("-")){
+				split = "-";
+			}
+			String[] ymd = rec.split(split);
+			if(ymd[1].length()==1){
+				rec = rec.replace(split+ymd[1], split+"0" + ymd[1]);
+			}
+			if(ymd[2].length()==1){
+				rec = rec.replace(split+ymd[2], split+"0" + ymd[2]);
+			}  							
+			value += ",to_date('"+rec+"','yyyy"+split+"mm"+split+"dd')";
+		}else if("0".equals(rec)){
+			value+=",null ";
+		}
+		else{
+			value += ",'"+rec.replace("'", "")+"'";
+		}
+		return value;
+	}
+	public static String getSqlValueForWarehouse(String rec,String value){ //日期转换
+		if(rec.matches("\\d{4}[-/]\\d{1,2}[-/]\\d{1,2}")){ 
+			String split = "/";
+			if(rec.contains("-")){
+				split = "-";
+			}
+			String[] ymd = rec.split(split);
+			if(ymd[1].length()==1){
+				rec = rec.replace(split+ymd[1], split+"0" + ymd[1]);
+			}
+			if(ymd[2].length()==1){
+				rec = rec.replace(split+ymd[2], split+"0" + ymd[2]);
+			}  							
+			value += ",to_date('"+rec+"','yyyy"+split+"mm"+split+"dd')";
+		}/*else if("0".equals(rec)){
+			value+=",null ";
+		}*/
+		else{
+			value += ",'"+rec.replace("'", "")+"'";
+		}
+		return value;
+	}
+	
+	@SuppressWarnings({"unused" })
+    public static void main(String[] args){
+		FTPClient client = null;
+		String filePath = "C:\\mendelson\\opensource\\as2\\messages\\Mantech\\inbox";
+		String backupPath = "C:\\mendelson\\opensource\\as2\\messages\\Mantech\\inbox_bak\\in\\";
+		List<String> filePaths = new ArrayList<String>();
+		Connection connect = null;
+		boolean execute = false;
+    	try {
+			File inbox = new File(filePath);
+			if(inbox.exists()){
+				File[] files = inbox.listFiles();
+				String fileName = "";
+				if(files!=null&&files.length>0){
+					connect = JdbcUtil.getConnectBySob("HK");
+					for(File file:files){
+						if(file.isDirectory()){
+							continue;
+						}
+						try{
+							InputStream in = new FileInputStream(file);
+							BufferedReader bfin = new BufferedReader(new InputStreamReader(in));
+							String line = "";
+							int i=0;
+							char[] diff = new char[10];
+							boolean csvFile = false;
+							String type = null;
+							    bfin.read(diff,0,10);
+								if(String.valueOf(diff).trim().startsWith("{payment}")){
+									csvFile = true;
+									type="payment";
+								}else if(String.valueOf(diff).trim().startsWith("FIRM")){
+									csvFile = true;
+									type="firm";
+								}else if(String.valueOf(diff).trim().startsWith("Warehouse")){
+									csvFile = true;
+									type="warehouse";
+								}else if(String.valueOf(diff).trim().startsWith("{stockin}")){
+									csvFile = true;
+									type="stockin";
+								}
+							
+							if(csvFile&&type!=null){
+								BaseUtil.getLogger().info("process file:" + file.getName() + " type:"+type+" start!");
+								
+								List<String> sqls=new LinkedList<String>();
+								if("payment".equals(type)){
+									sqls = PraseCsvUtil.parseCsvFileToSqlsForPayment(file);
+								}else if("warehouse".equals(type)){
+									sqls = parseCsvFileToSqlsForWarehouse(file);
+								}else if("firm".equals(type)){
+									sqls = parseCsvFileToSqlsForFirm(file);
+								}else if("stockin".equals(type)){
+									sqls = parseCsvFileToSqlsForStockin(file);
+								}
+							    execute = JdbcUtil.executeSqls(connect,sqls);
+							};
+							bfin.close();
+							bfin = null;
+							in.close();
+							in = null;	
+
+							if(csvFile&&execute){
+								boolean bol = file.renameTo(new File(backupPath+file.getName()));
+								System.out.println(bol);
+							}							
+						}catch(Exception e){
+							e.printStackTrace();
+							BaseUtil.getLogger().error(e.toString());
+						}finally{
+							BaseUtil.getLogger().info("process file:" + file.getName() + " end!");
+						}
+					}	
+				}
+			}
+    	} catch (Exception e) {
+    		BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}finally{
+			if(connect!=null){
+				try {
+					connect.close();
+				} catch (SQLException e) {
+					e.printStackTrace();
+					BaseUtil.getLogger().error(e.toString());
+				}
+				connect = null;				
+			}
+		}
+    }
+ }

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

@@ -1,97 +0,0 @@
-package com.uas.main;
-
-import java.io.File;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.*;
-
-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;
-		List<String> sqls = new ArrayList<String>();	
-		String content = BaseUtil.getStringByFile(file);
-		String hk = (String) map.get("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("YHND_WH");
-		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){
-				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(),"/reply_bak/"+file.getName());
-										}else{
-											client.rename(file.getName(),"/reply_bak/"+file.getName());
-											//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;
-		}
-	}
-}

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

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

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

@@ -1,241 +0,0 @@
-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");
-		/*System.err.println(datastr);
-		System.err.println(datastr.substring(5400,5450));*/
-		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");
-		uploadBySob("YHND_WH");
-	}
-	
-	@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");
-					}
-				}catch(Exception e){
-					e.printStackTrace();
-					BaseUtil.getLogger().error(e.toString());
-					continue;
-				}
-			}
-			if(client!=null){
-				FtpUtil.closeFtpClient(client);
-				client = null;
-			}
-			try{
-				JdbcUtil.clearXmlTemplate();
-				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);
-			}
-		}
-	}
-}

+ 11 - 35
src/com/uas/util/BaseUtil.java

@@ -54,7 +54,7 @@ public class BaseUtil {
 		String condition = "";
 		String code = "";
 		InputStream in = null;
-		String hkSob =null;
+		boolean hkSob = false;
 		
 		try {
 			in = new FileInputStream(file);
@@ -70,7 +70,7 @@ public class BaseUtil {
 			e1.printStackTrace();
 		}  
 		Element root = doc.getRootElement();
-
+    	
 		List<Element> e = root.elements();
     	for(Element el:e){
         	 String name = el.getName();
@@ -82,58 +82,34 @@ public class BaseUtil {
         	 }else if(name=="Status"){
         		 json += ",\"PI_LOGISTICSSTATUS:\":\"" + el.getData() + "\"";
         		 sql += "PI_LOGISTICSSTATUS='" + el.getData() + "',";
-        	 }else if(name=="TrackingNo"){
-        		 json += ",\"PI_LISTCODE:\":\"" + el.getData() + "\"";
-        		 sql += "PI_LISTCODE='" + 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 = "YHND_HK.";
-        		 }else if (code.trim().toUpperCase().startsWith("YT")){
-        			 hkSob = "YITOA_ZX.";
-        		 }else if (code.trim().toUpperCase().startsWith("WH")){
-					 hkSob = "YHND_WH.";
-				 }else {
-					 hkSob = "YHND_SZ.";
-				 }
+        			 hkSob = true;
+        		 }else{
+        			 hkSob = false;
+        		 }
         		 json += ",\"PI_INOUTNO:\":\"" + code + "\"";
         		 condition = "PI_INOUTNO='"+code+"'";
-        	 }else if (name == "ExType"){
-				 json += ",\"PI_TRANSPORT:\":\"" + el.getData() + "\"";
-				 sql += "PI_TRANSPORT='" + el.getData() + "',";
-			 }else if(name == "ExNumber"){
-				 json += ",\"PI_LOGISTICSCODE:\":\"" + el.getData() + "\"";
-				 sql += "PI_LOGISTICSCODE='" + el.getData() + "',";
-			 }else if(name == "ExTime"){
-				 json += ",\"PI_GOODSDATE:\":\"" + el.getData() + "\"";
-				 sql += "PI_GOODSDATE=to_date('" + el.getData() + "','yyyymmddHH24:mi'),";
-			 }
+        	 }
     	}
     	if(!"".equals(json)){
     		json = "{" + json.substring(1) + "}";
     	}
-    	if(!"".equals(sql)&&hkSob != null){
-    		sql = "update " + hkSob + "prodinout set " + sql.substring(0, sql.lastIndexOf(",")) + " where " + condition;
+    	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);
+    	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);
-			}
+			content = new Scanner(file).useDelimiter("\\Z").next(); 
 		} catch (FileNotFoundException e) {
 			e.printStackTrace();
 			BaseUtil.getLogger().error(e.toString());

+ 17 - 65
src/com/uas/util/FtpUtil.java

@@ -6,7 +6,11 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.*;
+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;
@@ -43,7 +47,7 @@ public class FtpUtil {
 	
 	/**
 	 * 获取ftp连接,该连接指向ftp配置中的downloadpath文件夹
-	 * @param map //包含ftp连接配置的map
+	 * @param map包含ftp连接配置的map
 	 */
 	public static FTPClient connect(Map<String,Object> map) throws Exception {
 		return connect(map,map.get("downloadpath").toString());
@@ -51,7 +55,7 @@ public class FtpUtil {
 
 	/**
 	 * 获取ftp连接,该连接指向ftp配置中的downloadpath文件夹
-	 * @param map  //包含ftp连接配置的map
+	 * @param map包含ftp连接配置的map
 	 */
 	public static FTPClient connect(Map<String,Object> map,String path){
 		FTPClient ftp = null;
@@ -62,7 +66,6 @@ public class FtpUtil {
 			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)){
@@ -75,13 +78,10 @@ public class FtpUtil {
 				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());
+			BaseUtil.getLogger().error("ip:" + addr + e.toString());
 			return null;
 		}
 	}
@@ -105,11 +105,11 @@ public class FtpUtil {
 				return false;
 			}
 			InputStream inputStream = new FileInputStream(file);
-			flag = ftpClient.storeFile(file.getName(), inputStream);
+			ftpClient.storeFile(file.getName(), inputStream);
 			inputStream.close();
 			//ftpClient.logout();
+			flag = true;
 		} catch (Exception e) {
-			flag = false;
 			e.printStackTrace();
 			BaseUtil.getLogger().error(e.toString());
 			if (ftpClient.isConnected()) {
@@ -152,30 +152,13 @@ public class FtpUtil {
 		try {
 			ftpClient.enterLocalPassiveMode();
 			FTPFile[] ftpFiles = ftpClient.listFiles();
-			if (ftpFiles != null && ftpFiles.length > 0) {
-				ArrayList<FTPFile> list = new ArrayList<FTPFile>(Arrays.asList(ftpFiles)) ;
-				Collections.sort(list, new Comparator<FTPFile>() {
-					@Override
-					public int compare(FTPFile o1, FTPFile o2) {
-						long time = o1.getTimestamp().getTime().getTime();
-						long time1 = o2.getTimestamp().getTime().getTime();
-						if ( time>time1 ) {
-							return 1;
-						}
-						if (time == time1) {
-							return 0;
-						}
-						return -1;
-					}
-				});
-				for (FTPFile file : list) {
-					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);
-					}
+			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) {
@@ -184,37 +167,6 @@ public class FtpUtil {
 		}
 		return files;
 	}
-
-
-    /**
-     *
-     * @param ftpClient
-     * @return 获取连接到的ftp站点下的文件夹所有文件
-     */
-    public static List<File> downloadAllFile(FTPClient ftpClient,String directory) {
-        List<File> files = new ArrayList<File>();
-        try {
-			ftpClient.enterLocalPassiveMode();
-			//ftpClient.setRemoteVerificationEnabled(false);
-			ftpClient.changeWorkingDirectory("/"+directory);// 转移到FTP服务器目录
-			FTPFile[] ftpFiles = ftpClient.listFiles();
-			//FTPFile[] newFtpFiles = ftpClient.listFiles("/re/");
-            for (FTPFile file : ftpFiles) {
-            	if (!".".equals(file.getName())&&!"..".equals(file.getName())){
-                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连接

+ 3 - 6
src/com/uas/util/JdbcUtil.java

@@ -27,14 +27,14 @@ public class JdbcUtil {
 	 * 从xmltemplate表获取所有模板
 	 * @return Map形式 {caller:templatecontent}
 	 */
-	public static Map<String,Object> getXmlTemplate(Connection connection,String sob){
+	public static Map<String,Object> getXmlTemplate(Connection connection){
 		if(template==null){
 			template = new HashMap<String,Object>();
 			try{
 				Statement statement = connection.createStatement();
-				ResultSet rs = statement.executeQuery("select * from " + sob + "." + "xmltemplate");
+				ResultSet rs = statement.executeQuery("select * from xmltemplate");
 				while(rs.next()){
-					template.put(rs.getString("xt_caller")+"_"+rs.getString("xt_ftpdepot"),rs.getString("xt_content"));
+					template.put(rs.getString("xt_caller")+"_"+rs.getString("xt_ftpdepot"),rs.getString("xt_content"));	
 				}
 			}catch (Exception e){
 				BaseUtil.getLogger().error(e.toString());
@@ -197,11 +197,9 @@ public class JdbcUtil {
 		boolean bol = true;
 		try{		
 			statement = connection.createStatement();		
-			
 			for(String sql:str){
 				statement.addBatch(sql);
 			}
-			
 			try {
 				statement.setQueryTimeout(180);
 				statement.executeBatch();
@@ -220,7 +218,6 @@ public class JdbcUtil {
 		}catch(Exception e){
 			bol = false;
 			BaseUtil.getLogger().error(e.toString());
-			BaseUtil.getLogger().info("execute fail!");
 			try {
 				if(connection!=null){
 					connection.rollback();

+ 81 - 0
src/com/uas/util/PraseCsvUtil.java

@@ -0,0 +1,81 @@
+package com.uas.util;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.csv.CSVFormat;
+import org.apache.commons.csv.CSVParser;
+import org.apache.commons.csv.CSVRecord;
+
+public class PraseCsvUtil {
+
+	public static List<String> parseCsvFileToSqlsForPayment(File file){
+		List<String> sqls = null;
+		Reader in = null;
+		try{
+			in = new FileReader(file);
+			sqls = new ArrayList<String>();  		
+			CSVParser csvParser = CSVFormat.EXCEL.parse(in);
+			List<CSVRecord> records = csvParser.getRecords();  		
+			boolean skip = true;
+			String sql = "";
+			String value = "";
+			String sob = "";
+			String fileName = file.getName();
+			for(int i=0;i<records.size();i++){
+				CSVRecord record = records.get(i);
+				sob = "";
+				for(int j=1;j<13;j++){
+					if(skip){
+						if("Customer Code".equals(record.get(j))){
+	    					skip = false;
+	    					break;
+	    				}	
+					}else{						
+						String rec = record.get(j);
+						if(!"".equals(rec)){
+							value = getValue(rec, value,j);			
+						}else{
+							value=value+",''";
+						}
+					}
+				}    				
+				if(!"".equals(value)){
+					sql = "insert into "+sob+"csvdatalogc(ID,CUSTOMER_CODE,PO,PART_NO,COUNTRY_CODE,"
+							+ "QUANTITY,INVOCIE_DATE,INVOICE_NO,CURRENCY,UNIT_PRICE,LINE,EXCHANGE_RATE,STOCK_BOOKING_DATE,IMPORT_,filename_) "
+							+ "select CSVDATALOGC_SEQ.NEXTVAL";
+					sqls.add(sql + value + ",0,'"+fileName.replace("'", "''")+"' from dual");
+					value = "";
+				}
+			}
+			in.close();
+			in = null;
+		}catch(Exception e){
+			BaseUtil.getLogger().error(e.toString());
+			e.printStackTrace();
+		}finally{
+			try {
+				if(in!=null){
+					in.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			in = null;
+		}
+		return sqls;
+	}
+	
+	public static String getValue(String rec,String value,int j){
+		if(j==6||j==12){
+			value+=",to_date('"+rec+"','yyyymmdd')";
+		}else{
+			value += ",'"+rec.replace("'", "''")+"'";
+		}
+		return value;
+	}
+}

+ 5 - 15
src/properties/dbconfig.properties

@@ -1,22 +1,12 @@
 {
-	"YHND_SZ":{
-		"url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl",
+	"SZ":{
+		"url":"jdbc:oracle:thin:@sz.hi-mantech.com:1521:orcl",
 		"user":"YHND_SZ",
 		"password":"select!#%*("
 	},
-	"YHND_HK":{
-		"url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl",
+	"HK":{
+		"url":"jdbc:oracle:thin:@sz.hi-mantech.com:1521:orcl",
 		"user":"YHND_HK",
 		"password":"select!#%*("
-	},
-	"YHND_WH":{
-		"url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl",
-		"user":"YHND_WH",
-		"password":"select!#%*("
-	},
-	"YITOA_ZX":{
-		"url":"jdbc:oracle:thin:@127.0.0.1:1521:orcl",
-		"user":"YITOA_ZX",
-		"password":"select!#%*("
-}
+	}
 }

+ 12 - 0
src/properties/dbconfig_dev.properties

@@ -0,0 +1,12 @@
+{
+	"SZ":{
+		"url":"jdbc:oracle:thin:@192.168.253.6:1521:orcl",
+		"user":"UAS_DEV",
+		"password":"select!#%*("
+	},
+	"HK":{
+		"url":"jdbc:oracle:thin:@192.168.253.6:1521:orcl",
+		"user":"UAS_DEV",
+		"password":"select!#%*("
+	}
+}

+ 6 - 126
src/properties/ftpconfig.properties

@@ -17,57 +17,17 @@
 		"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":"user_123456",
+		"ip":"218.255.13.107",
+		"port":21,
+		"user":"mantech",
+		"password":"mantech",
 		"downloadpath":"WMSANS",
 		"in":"WMSRECV",
 		"out":"WMSRELS",
-		"remark":"上海仓库"
-	},
-	"4":{
-		"ip":"omsftp.icorebuy.com",
-		"port":21,
-		"user":"YHND04",
-		"password":"Yhnd#$%2019",
-		"downloadpath":"reply",
-		"in":"appointment_in",
-		"out":"distribute_in",
-		"remark":"旗丰"
-	},
-	"5":{
-		"ip":"omsftp.icorebuy.com",
-		"port":21,
-		"user":"YHND05",
-		"password":"Yhnd#$%2019",
-		"downloadpath":"reply",
-		"in":"appointment_in",
-		"out":"distribute_in",
-		"remark":"旗丰"
-	},
-	"6":{
-		"ip":"omsftp.icorebuy.com",
-		"port":21,
-		"user":"YHND03",
-		"password":"Yhnd@#$2018",
-		"downloadpath":"reply",
-		"in":"appointment_in",
-		"out":"distribute_in",
-		"remark":"\u65D7\u4E30-Megafone"
+		"remark":"上海WGQ"
 	},
 	"7":{
-		"ip":"omsftp.icorebuy.com",
+		"ip":"112.74.205.182",
 		"port":21,
 		"user":"YHND02",
 		"password":"Yhnd*$@2017",
@@ -75,85 +35,5 @@
 		"in":"appointment_in",
 		"out":"distribute_in",
 		"remark":"旗丰"
-	},
-	"8":{
-		"ip":"sz.hi-mantech.com",
-		"port":46688,
-		"user":"userLY",
-		"password":"user_123456",
-		"downloadpath":"WMSANS",
-		"in":"WMSRECV",
-		"out":"WMSRELS",
-		"remark":"YHND_LY"
-	},
-	"9":{
-		"ip":"omsftp.icorebuy.com",
-		"port":21,
-		"user":"YHND06",
-		"password":"Yhnd#$%2019",
-		"downloadpath":"reply",
-		"in":"appointment_in",
-		"out":"distribute_in",
-		"remark":"YHND_Hunan"
-	},
-	"10":{
-		"ip":"omsftp.icorebuy.com",
-		"port":21,
-		"user":"YHND07",
-		"password":"Yhnd#$%2019",
-		"downloadpath":"reply",
-		"in":"appointment_in",
-		"out":"distribute_in",
-		"remark":"YHND_Wingtech"
-	},
-	"11":{
-		"ip":"omsftp.icorebuy.com",
-		"port":21,
-		"user":"YTZX02",
-		"password":"Yhnd#$%2019",
-		"downloadpath":"reply",
-		"in":"appointment_in",
-		"out":"distribute_in",
-		"remark":"YHND_Wingtech"
-	},
-	"12":{
-		"ip":"omsftp.icorebuy.com",
-		"port":21,
-		"user":"YHND09",
-		"password":"Yhnd#$%2019",
-		"downloadpath":"reply",
-		"in":"appointment_in",
-		"out":"distribute_in",
-		"remark":"YHND Tesla"
-	},
-	"13":{
-		"ip":"sz.hi-mantech.com",
-		"port":46688,
-		"user":"userDCL",
-		"password":"user_123456",
-		"downloadpath":"WMSANS",
-		"in":"WMSRECV",
-		"out":"WMSRELS",
-		"remark":"上海WGQ新仓库DCL"
-	},
-	"14":{
-		"ip":"ftp.roadsimple.net",
-		"port":13321,
-		"user":"yhnd",
-		"password":"442t78Mw",
-		"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"
 	}
 }

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

@@ -1,69 +0,0 @@
-{
-	"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"
-	}
-}

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

@@ -1,89 +0,0 @@
-{
-	"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"
-	}
-}

+ 2 - 3
yhnd.iml → yhnd_csv.iml

@@ -15,8 +15,7 @@
     </src_description>
   </component>
   <component name="NewModuleRootManager">
-    <output url="file://$MODULE_DIR$/bin" />
-    <exclude-output />
+    <output url="file://$MODULE_DIR$/target/bin" />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
       <excludeFolder url="file://$MODULE_DIR$/target" />
@@ -104,8 +103,8 @@
         <SOURCES />
       </library>
     </orderEntry>
-    <orderEntry type="library" name="httpcore-4.4.10" level="project" />
     <orderEntry type="library" name="commons-io-1.3.2" level="project" />
     <orderEntry type="library" name="commons-io-2.4" level="project" />
+    <orderEntry type="library" name="commons-csv-1.4" level="project" />
   </component>
 </module>