|
|
@@ -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();
|
|
|
}
|