Jelajahi Sumber

ZSD修改服务器

koul 4 tahun lalu
induk
melakukan
22aa6736d0

+ 10 - 3
src/main/java/com/uas/service/Impl/DownloadFilePathServiceImpl.java

@@ -42,7 +42,7 @@ public class DownloadFilePathServiceImpl implements DownloadFilePathService {
 	}
 	
 	@SuppressWarnings("unchecked")
-	@Async("taskExecutor")
+	/*@Async("taskExecutor")*/
 	@Override
 	public void downloadFilePath(String depot,String sob){
 		BaseUtil.getLogger().info("download file" + " from "+depot);
@@ -53,7 +53,7 @@ public class DownloadFilePathServiceImpl implements DownloadFilePathService {
     		Map<String,Object> servMap = JdbcUtil.getFtpConfigs();
 			Map<String,Object> ftpMap = (Map<String,Object>)servMap.get(depot);
 			String fileName = "";
-			if ("N_YITOA_LHCT-SF".equals(depot)||"N_YITOA_LHCT_T-SF".equals(depot)){
+			if ("N_YITOA_LHCT-SF".equals(depot)||"N_YITOA_LHCT_T-SF".equals(depot)||"N_YITOA_LHCT-ZSD".equals(depot)){
 				sftp = new SFTPUtil(ftpMap.get("user").toString(),ftpMap.get("password").toString(),
 						ftpMap.get("ip").toString(),
 						Integer.parseInt(ftpMap.get("port").toString()));
@@ -73,11 +73,18 @@ public class DownloadFilePathServiceImpl implements DownloadFilePathService {
                                             Boolean rename =
                                                     sftp.rename("/" + ftpMap.get("file").toString() + "/" + file.getName(),
                                                             "/outbounddeliverydetails/backup/" + file.getName());
-                                        }
+                                        }else if ("N_YITOA_LHCT-ZSD".equals(depot)){
+											Boolean rename =
+													sftp.rename("/" + ftpMap.get("file").toString() + "/" + file.getName(),
+															"/lhcthkhub/LHCT/reply_bak/" + file.getName());
+										}
 									}else {
 										if ("N_YITOA_LHCT-SF".equals(depot)||"N_YITOA_LHCT_T-SF".equals(depot)) {
 											Boolean rename =
 													sftp.rename("/" + ftpMap.get("file").toString() + "/" + file.getName(), "goodsreceipt/backup/" + file.getName());
+										}else if ("N_YITOA_LHCT-ZSD".equals(depot)){
+											Boolean rename =
+													sftp.rename("/" + ftpMap.get("file").toString() + "/" + file.getName(), "/lhcthkhub/LHCT/reply_bak/" + file.getName());
 										}
 									}
 								} catch (Exception e) {

+ 9 - 5
src/main/java/com/uas/service/Impl/DownloadServiceImpl.java

@@ -56,7 +56,7 @@ public class DownloadServiceImpl implements DownloadService {
 
 	@SuppressWarnings("unchecked")
 	@Override
-	@Async("taskExecutor")
+	/*@Async("taskExecutor")*/
 	public void downloadByDepotAndSob(String depot,String sob,String enterprise){
 		BaseUtil.getLogger().info("download xml" + " from "+depot);
 		FTPClient client = null;
@@ -68,7 +68,7 @@ public class DownloadServiceImpl implements DownloadService {
 		try {
 			Map<String,Object> servMap = JdbcUtil.getFtpConfigs();
 			Map<String,Object> ftpMap = (Map<String,Object>)servMap.get(depot);
-			if ("N_YITOA_LHCT-SF".equals(depot)||"N_YITOA_LHCT_T-SF".equals(depot)){
+			if ("N_YITOA_LHCT-SF".equals(depot)||"N_YITOA_LHCT_T-SF".equals(depot)||"N_YITOA_LHCT-ZSD".equals(depot)){
 				sftp = new SFTPUtil(ftpMap.get("user").toString(),ftpMap.get("password").toString(),
 						ftpMap.get("ip").toString(),
 						Integer.parseInt(ftpMap.get("port").toString()));
@@ -82,7 +82,7 @@ public class DownloadServiceImpl implements DownloadService {
 			}
 			if(client!=null||sftp!=null) {
 				List<File> files = null;
-				if ("N_YITOA_LHCT-SF".equals(depot)||"N_YITOA_LHCT_T-SF".equals(depot)) {
+				if ("N_YITOA_LHCT-SF".equals(depot)||"N_YITOA_LHCT_T-SF".equals(depot)||"N_YITOA_LHCT-ZSD".equals(depot)) {
 					files = sftp.download(ftpMap.get("downloadpath").toString());
 
 				}else if("N_YITOA_LHCT-SLC".equals(depot)){
@@ -115,14 +115,18 @@ public class DownloadServiceImpl implements DownloadService {
 								if (executeRes) {
 									if ("N_YITOA_LHCT-SF".equals(depot)||"N_YITOA_LHCT_T-SF".equals(depot)) {
 										Boolean rename = sftp.rename(ftpMap.get("downloadpath").toString() + "/" + s, "goodsreceipt/backup/" + s);
-									} else {
+									} if ("N_YITOA_LHCT-ZSD".equals(depot)){
+										Boolean rename = sftp.rename(ftpMap.get("downloadpath").toString() + "/" + s, "lhcthkhub/LHCT/reply_bak/" + s);
+									}else {
 										//移动处理完的文件到bak文件夹下
 										client.rename(file.getName(), "bak/" + file.getName());
 									}
 								}else{
 									if ("N_YITOA_LHCT-SF".equals(depot)||"N_YITOA_LHCT_T-SF".equals(depot)) {
 										Boolean rename = sftp.rename(ftpMap.get("downloadpath").toString() + "/" + s, "goodsreceipt/backup/" + s);
-									} else {
+									}else if ("N_YITOA_LHCT-ZSD".equals(depot)){
+										Boolean rename = sftp.rename(ftpMap.get("downloadpath").toString() + "/" + s, "lhcthkhub/LHCT/reply_bak/" + s);
+									}else {
 										//移动处理完的文件到failed文件夹下
 										client.rename(file.getName(), "failed/" + file.getName());
 									}

+ 5 - 17
src/main/java/com/uas/service/Impl/UploadServiceImpl.java

@@ -36,7 +36,7 @@ public class UploadServiceImpl implements UploadService {
 
 	@Override
 	@SuppressWarnings({ "unchecked"})
-	@Async("taskExecutor")
+	/*@Async("taskExecutor")*/
 	public void uploadBySob(String sob) {
 		BaseUtil.getLogger().info("upload" + " from "+sob);
 		Statement statement = null;
@@ -57,7 +57,7 @@ public class UploadServiceImpl implements UploadService {
 				ResultSet rs = 	getXmlData(statement);
 				String depot = "";
 				while(rs.next()){
-					/*try{*/
+					try{
 						xldata = rs.getString("xl_data");
 						fileprefix = rs.getString("xl_fileprefix");
 						xldate = rs.getString("xl_date");
@@ -76,9 +76,7 @@ public class UploadServiceImpl implements UploadService {
 								if(config==null){
 									continue;
 								}
-								System.out.println(config);
-								BaseUtil.logger.info(config);
-								if ("SF".equals(depot)||"ZX".equals(depot)){
+								if ("SF".equals(depot)||"ZX".equals(depot)||"ZSD".equals(depot)){
 									sftp = new SFTPUtil(config.get("user").toString(),config.get("password").toString(),config.get("ip").toString(),
 											Integer.parseInt(config.get("port").toString()));
 									try {
@@ -89,7 +87,6 @@ public class UploadServiceImpl implements UploadService {
 								}else {
 									client = FtpUtil.connect(config,config.get("in").toString());
 								}
-								BaseUtil.logger.info(sftp);
 								if(client==null&&sftp==null){
 									continue;
 								}
@@ -103,24 +100,15 @@ public class UploadServiceImpl implements UploadService {
 							if(xldata==null||"".equals(xldata)){
 								continue;
 							}
-
 							boolean uploadSuccess = false;
 							//生成文件
-							BaseUtil.logger.info(xldata);
-							BaseUtil.logger.info(xlid);
-							BaseUtil.logger.info(folder);
-							BaseUtil.logger.info(fileprefix);
-							BaseUtil.logger.info(xldate);
 							File file = createXmlFile(xldata,xlid,folder,fileprefix,xldate);
 							if (client!=null) {
 								uploadSuccess = upload(client, config.get("ip").toString(), folder, file);
 							}
 							if (sftp!=null){
-                                BaseUtil.logger.info(file);
-                                BaseUtil.logger.info(file.getName());
 								InputStream is = new FileInputStream(file);
 								uploadSuccess = sftp.upload("/", folder, file.getName(), is);
-                                BaseUtil.logger.info(uploadSuccess);
 							}
 							//如果文件上传成功,则转入正式数据记录表
 							if(uploadSuccess){
@@ -128,11 +116,11 @@ public class UploadServiceImpl implements UploadService {
 								turnToFormal(connect,xlid,file.getName());
 							}
 						}
-					/*}catch(Exception e){
+					}catch(Exception e){
 						e.printStackTrace();
 						BaseUtil.getLogger().error(e.toString());
 						continue;
-					}*/
+					}
 				}
 				rs.close();
 			}

+ 10 - 10
src/main/resources/properties/ftpconfig.properties

@@ -9,13 +9,13 @@
         "file":"YITOA/chuangt_signback"
     },
     "N_YITOA_LHCT-ZSD":{
-        "ip":"47.106.234.187",
-        "port":21,
+        "ip":"sftp.jusdaglobal.com",
+        "port":50035,
         "user":"lhct",
-        "password":"bE!8M3#5y0",
-        "downloadpath":"LHCT/reply",
-        "in":"LHCT/appointment_in",
-        "file":"LHCT/signback"
+        "password":"CUJFbQA7s)da",
+        "downloadpath":"lhcthkhub/LHCT/reply",
+        "in":"lhcthkhub/LHCT/appointment_in",
+        "file":"lhcthkhub/LHCT/signback"
     },
     "N_YITOA_LHCT_HK-FS":{
         "ip":"113.100.137.106",
@@ -63,10 +63,10 @@
         "file":"outbounddeliverydetails/data"
     },
     "LHCT_SZ-ZSD":{
-        "ip":"47.106.234.187",
-        "port":21,
-        "user":"lhctdz",
-        "password":"lhctdz@0121",
+        "ip":"sftp.jusdaglobal.com",
+        "port":50035,
+        "user":"lhct",
+        "password":"CUJFbQA7s)da",
         "downloadpath":"LHCT/LHCTDZ/postback",
         "in":"LHCT/LHCTDZ/normal",
         "file":"LHCT/LHCTDZ/signback"