Commit ac8131d4 authored by 吴琼's avatar 吴琼

导出修改

parent 2aa71ad1
...@@ -73,7 +73,7 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR ...@@ -73,7 +73,7 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
@Value("${kdsp-operation}") @Value("${kdsp-operation}")
private String kdspOperationUrl; private String kdspOperationUrl;
//@Value("${customer.contract.http}") @Value("${pdf.quantgroup.cn.http}")
private String contractUrl; private String contractUrl;
@Value("${passportapi2.tjzimu.http}") @Value("${passportapi2.tjzimu.http}")
...@@ -89,6 +89,13 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR ...@@ -89,6 +89,13 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
private String password; private String password;
@Value("${customer.transaction.basePath}") @Value("${customer.transaction.basePath}")
private String basePath; private String basePath;
@Value("${customer.transaction.local.file.uploadPath}")
private String uploadLocalPath;
@Value("${customer.transaction.local.file.downloadPath}")
private String downloadLocalPath;
@Value("${customer.transaction.local.file.downloadZipPath}")
private String downloadZipLocalPath;
@Override @Override
public JsonResult<Page<TransactionReceiptRecordVO>> findRecordsByQuery(TransactionReceiptRecordQuery query) { public JsonResult<Page<TransactionReceiptRecordVO>> findRecordsByQuery(TransactionReceiptRecordQuery query) {
...@@ -262,7 +269,10 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR ...@@ -262,7 +269,10 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
return JsonResult.buildErrorStateResult("没有可以导出得数据"); return JsonResult.buildErrorStateResult("没有可以导出得数据");
} }
List <Map<String,Object>> filePathList =new ArrayList<>(); List <Map<String,Object>> filePathList =new ArrayList<>();
log.info("[TransactionReceiptRecordServiceImpl.kdspOperationUrl 调用kdsp-op 接口begin]"); log.info("[TransactionReceiptRecordServiceImpl.kdspOperationUrl 调用kdsp-op 接口begin]", System.currentTimeMillis());
SFTPUtil sftpUtil = new SFTPUtil(username,password,host,port);
sftpUtil.login();
log.info("uploadFile | 成功连接ftp");
for(TransactionReceiptRecord record : transactionReceiptRecordList){ for(TransactionReceiptRecord record : transactionReceiptRecordList){
Integer userId = record.getUserId(); Integer userId = record.getUserId();
String orderNo = record.getOrderNo(); String orderNo = record.getOrderNo();
...@@ -311,24 +321,17 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR ...@@ -311,24 +321,17 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
continue; continue;
} }
//生成pdf //生成pdf
basePath= "D:/交易凭证"; String directory =record.getBatchNo()+record.getUserName();
//String basicPath="D:\\交易凭证0225";
String directory ="/"+record.getBatchNo()+record.getUserName()+"/";
FileToZip.mkdir(basePath+directory);
String pdfFileName = record.getOrderNo()+".pdf"; String pdfFileName = record.getOrderNo()+".pdf";
generatePDF(transactionReceiptVOList.get(0),basePath+directory+pdfFileName); FileToZip.mkdir(uploadLocalPath+directory);
//保存到文件服务器上 generatePDF(transactionReceiptVOList.get(0),uploadLocalPath+"/"+directory+"/"+pdfFileName);
/*SFTPUtil sftpUtil = new SFTPUtil(username,password,host,port); File file1 = new File(uploadLocalPath+"/"+directory+"/"+pdfFileName);
sftpUtil.login(); InputStream inputStream = new FileInputStream(file1);
log.info("uploadFile | 成功连接ftp"); sftpUtil.upload(basePath,directory,pdfFileName,inputStream);
File file = new File(pdfFileName);
InputStream is = new FileInputStream(file);
sftpUtil.upload(basePath,directory,pdfFileName,is);
sftpUtil.logout();*/
//将文件路径和useId放入list,进行签章 //将文件路径和useId放入list,进行签章
Map<String,Object> map =Maps.newHashMap(); Map<String,Object> map =Maps.newHashMap();
map.put("userId",record.getUserId()); map.put("userId",record.getUserId());
map.put("fileAddress",basePath+directory+pdfFileName); map.put("fileAddress",basePath+directory+"/"+pdfFileName);
filePathList.add(map); filePathList.add(map);
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -336,9 +339,11 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR ...@@ -336,9 +339,11 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
return JsonResult.buildErrorStateResult(e.getMessage()); return JsonResult.buildErrorStateResult(e.getMessage());
} }
} }
log.info("[TransactionReceiptRecordServiceImpl.kdspOperationUrl 调用kdsp-op 接口end]"); sftpUtil.logout();
log.info("[TransactionReceiptRecordServiceImpl.kdspOperationUrl 调用kdsp-op 接口end]",System.currentTimeMillis());
//上传文件
//调用签章接口 //调用签章接口
/*String url = contractUrl + "/contract/batch/sign"; /* String url = contractUrl + "/contract/batch/sign";
Map<String, String> header = Maps.newHashMap(); Map<String, String> header = Maps.newHashMap();
header.put("Content-type", "application/json"); header.put("Content-type", "application/json");
Map param = Maps.newHashMap(); Map param = Maps.newHashMap();
...@@ -349,24 +354,81 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR ...@@ -349,24 +354,81 @@ public class TransactionReceiptRecordServiceImpl implements ITransactionReceiptR
JSONObject json = JSONObject.parseObject(contractResult); JSONObject json = JSONObject.parseObject(contractResult);
String jsonResult = json.getString("data"); String jsonResult = json.getString("data");
String businessCode = json.getString("businessCode");*/ String businessCode = json.getString("businessCode");*/
//下载签章文件 //下载签章文件
/* SFTPUtil sftpUtil = new SFTPUtil(username,password,host,port);
sftpUtil.login();
log.info("downloadFile | 成功连接ftp"); log.info("downloadFile | 成功连接ftp");
sftpUtil.download("","");*/ for(Map<String,Object> map :filePathList){
//转换成zip包 SFTPUtil sftpUtil1 = new SFTPUtil(username,password,host,port);
File file = ZipUtil.zip(basePath, basePath+".zip");//zip 包保存路径 sftpUtil1.login();
//sftpUtil.logout(); String filepath = (String) map.get("fileAddress");
int totallength =filepath.length();
//byte[] bytes = sftpUtil1.download("/lzshopkf/transaction/交易凭证/1张三/","1498571250795298816.pdf");
//getFile(bytes,downloadLocalPath+"交易凭证/1张三","1498571250795298816.pdf");//downloadLocalPath=D:/tmp1/
int length = filepath.lastIndexOf("/");
String fileName =filepath.substring(length+1,totallength);
filepath =filepath.substring(0,length+1);
byte[] bytes = sftpUtil1.download(filepath,fileName);
String subPath = filepath.substring(0,filepath.length()-1);
int length2 = subPath.lastIndexOf("/");
String directory = subPath.substring(length2+1,subPath.length());
FileToZip.mkdir(downloadLocalPath+"/"+directory);
getFile(bytes,downloadLocalPath+"/"+directory,fileName);
sftpUtil1.logout();
}
//byte[] bytes = sftpUtil.download("/lzshopkf/transaction/交易凭证/1张三","",username,password,host,port);
//getFile(bytes,"D:/0301/交易凭证/1张三","1498571250795298816.pdf");
//转换成zip包
//FileToZip.mkdir("D:/0301/交易凭证");
//File file = ZipUtil.zip("D:/0301/交易凭证", "D:/0301/交易凭证"+".zip");//zip 包保存路径
//FileToZip.mkdir(downloadLocalPath);
File file = ZipUtil.zip(downloadLocalPath, downloadLocalPath+".zip");//zip 包保存路径
FileInputStream is = new FileInputStream(file); FileInputStream is = new FileInputStream(file);
byte[] fileData = IOUtils.readNBytes(is, is.available()); byte[] fileData = IOUtils.readNBytes(is, is.available());
//FileOutputStream fos1 = new FileOutputStream(new File("D:/交易凭证.zip"));
//FileToZip.toZip(basicPath, fos1,true);
//返回给前端 //返回给前端
return this.outputFile(response,"交易凭证.zip",fileData ,100,20); return this.outputFile(response,"交易凭证.zip",fileData ,100,20);
} }
/**
*将字节数组转换为file
*/
/**
* 根据byte数组,生成文件
*/
public void getFile(byte[] bfile, String filePath,String fileName) {
BufferedOutputStream bos = null;
FileOutputStream fos = null;
File file = null;
try {
File dir = new File(filePath);
if(!dir.exists()&&dir.isDirectory()){//判断文件目录是否存在
dir.mkdirs();
}
FileToZip.mkdir(filePath);
file = new File(filePath+"/"+fileName);
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
bos.write(bfile);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (bos != null) {
try {
bos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
public JsonResult outputFile(HttpServletResponse response, String fileName, public JsonResult outputFile(HttpServletResponse response, String fileName,
byte[] file,Integer successCount,Integer failCount){ byte[] file,Integer successCount,Integer failCount){
if (ArrayUtils.isEmpty(file)) { if (ArrayUtils.isEmpty(file)) {
......
...@@ -9,8 +9,13 @@ import com.jcraft.jsch.SftpATTRS; ...@@ -9,8 +9,13 @@ import com.jcraft.jsch.SftpATTRS;
import com.jcraft.jsch.SftpException; import com.jcraft.jsch.SftpException;
import java.io.*; import java.io.*;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import java.util.Properties; import java.util.Properties;
import java.util.Vector; import java.util.Vector;
import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import sun.misc.IOUtils; import sun.misc.IOUtils;
...@@ -60,12 +65,20 @@ public class SFTPUtil { ...@@ -60,12 +65,20 @@ public class SFTPUtil {
this.session.connect(); this.session.connect();
Channel channel = this.session.openChannel("sftp"); Channel channel = this.session.openChannel("sftp");
channel.connect(); channel.connect();
Class<ChannelSftp> c = ChannelSftp.class;
Field f = c.getDeclaredField("server_version");
f.setAccessible(true);
// chSftp = (ChannelSftp) channel;
this.sftp = (ChannelSftp)channel; this.sftp = (ChannelSftp)channel;
f.set(sftp, 2);
sftp.setFilenameEncoding("GBK");
this.logger.info("pwd = [{}]", this.sftp.pwd()); this.logger.info("pwd = [{}]", this.sftp.pwd());
} catch (JSchException var4) { } catch (JSchException var4) {
var4.printStackTrace(); var4.printStackTrace();
} catch (SftpException var5) { } catch (SftpException var5) {
var5.printStackTrace(); var5.printStackTrace();
}catch (Exception var5){
} }
} }
...@@ -82,38 +95,56 @@ public class SFTPUtil { ...@@ -82,38 +95,56 @@ public class SFTPUtil {
} }
public void upload(String basePath, String directory, String sftpFileName, InputStream input) throws SftpException { public void upload(String basePath, String directory, String sftpFileName, InputStream input) throws SftpException {
try { /*try {
this.sftp.cd(basePath); String[] dirs = basePath.split("/");
this.sftp.cd(directory);
} catch (SftpException var14) {
String[] dirs = directory.split("/");
String tempPath = basePath;
String[] var8 = dirs; String[] var8 = dirs;
int var9 = dirs.length; int var9 = dirs.length;
for(int var10 = 0; var10 < var9; ++var10) { for(int var10 = 0; var10 < var9; ++var10) {
String dir = var8[var10]; String dir = var8[var10];
if (null != dir && !"".equals(dir)) { if (null != dir && !"".equals(dir)) {
tempPath = tempPath + "/" + dir; this.sftp.cd(dir);
}
}
if(this.isDirExist(basePath+"/"+directory)){
this.sftp.cd(directory);
}else{
this.sftp.mkdir(directory);
this.sftp.cd(directory);
}
} catch (SftpException var14) {
String tempPath = "/"+directory;
String[] dirs = tempPath.split("/");
String[] var8 = dirs;
int var9 = dirs.length;
for(int var10 = 0; var10 < var9; ++var10) {
String dir = var8[var10];
if (null != dir && !"".equals(dir)) {
//tempPath = tempPath + "/" + dir;
try { try {
this.sftp.cd(tempPath); this.sftp.cd(dir);
} catch (SftpException var13) { } catch (SftpException var13) {
this.sftp.mkdir(tempPath); this.sftp.mkdir(dir);
this.sftp.cd(tempPath); this.sftp.cd(dir);
} }
} }
} }
} }*/
createDir(basePath+directory);
this.sftp.put(input, sftpFileName); this.sftp.put(input, sftpFileName);
} }
public void download(String directory, String downloadFile, String saveDirectory, String saveFile) throws SftpException, FileNotFoundException { public void download(String directory, String downloadFile, String saveDirectory, String saveFile) throws SftpException, FileNotFoundException {
if (directory != null && !"".equals(directory)) { String[] dirs = directory.split("/");
this.sftp.cd(directory); String[] var8 = dirs;
int var9 = dirs.length;
for(int var10 = 0; var10 < var9; ++var10) {
String dir = var8[var10];
if (null != dir && !"".equals(dir)) {
this.sftp.cd(dir);
}
} }
File file = new File(saveDirectory, saveFile); File file = new File(saveDirectory, saveFile);
this.sftp.get(downloadFile, new FileOutputStream(file)); this.sftp.get(downloadFile, new FileOutputStream(file));
} }
...@@ -126,14 +157,80 @@ public class SFTPUtil { ...@@ -126,14 +157,80 @@ public class SFTPUtil {
this.sftp.get(downloadFile, new FileOutputStream(file)); this.sftp.get(downloadFile, new FileOutputStream(file));
} }
public byte[] download(String directory, String downloadFile) throws SftpException, IOException { public byte[] download(String directory, String downloadFile){
if (directory != null && !"".equals(directory)) { ByteArrayOutputStream fileOutputStream = new ByteArrayOutputStream();
this.sftp.cd(directory); String[] dirs = directory.split("/");
String[] var8 = dirs;
int var9 = dirs.length;
for(int var10 = 0; var10 < var9; ++var10) {
String dir = var8[var10];
if (null != dir && !"".equals(dir)) {
try {
this.sftp.cd(dir);
} catch (SftpException e) {
e.printStackTrace();
}
}
} }
try {
InputStream is = this.sftp.get(downloadFile); this.sftp.get(downloadFile,fileOutputStream);
byte[] fileData = IOUtils.readNBytes(is, is.available()); } catch (SftpException e) {
e.printStackTrace();
}
byte[] fileData = fileOutputStream.toByteArray();
//byte[] fileData= IOUtils.readNBytes(is, is.available());
return fileData; return fileData;
}
public byte[] download(String directory,String downloadFile,
String userName,String password,String host,int port) throws SftpException, IOException {
if (StringUtils.isNotBlank(directory)){
downloadFile = directory.concat("/"+downloadFile);
}
ByteArrayOutputStream fileOutputStream = new ByteArrayOutputStream();
JSch jsch = null;
Session session = null;
Channel channel = null;
ChannelSftp channelSftp = null;
try {
jsch = new JSch();
session = jsch.getSession(userName, host,port);
session.setPassword(password.getBytes(Charset.forName("ISO-8859-1")));
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
//session.setTimeout(SO_TIME_OUT);
//log.info("连接 SFTP 服务器 " + baseInfo.getHost() + ":" + baseInfo.getPort());
session.connect();
channel = session.openChannel("sftp");
channel.connect();
channelSftp = (ChannelSftp) channel;
if (channelSftp == null || session == null || !session.isConnected() || !channelSftp.isConnected()) {
//log.info("SFTP channel 已经关闭");
throw new Exception("系统内部异常");
}
channelSftp.get(downloadFile, fileOutputStream);
//log.info("SFTP.client.下载成功 文件名={}", fileName);
return fileOutputStream.toByteArray();
} catch (Exception e) {
//log.error("SFTP.client.创建连接失败");
return null;
} finally {
if (channelSftp != null) {
channelSftp.disconnect();
}
if (channel != null) {
channel.disconnect();
}
if (session != null) {
session.disconnect();
}
}
} }
public void delete(String directory, String deleteFile) throws SftpException { public void delete(String directory, String deleteFile) throws SftpException {
...@@ -192,15 +289,17 @@ public class SFTPUtil { ...@@ -192,15 +289,17 @@ public class SFTPUtil {
} }
public static void main(String[] args) { public static void main(String[] args) {
SFTPUtil sftp = new SFTPUtil("lhphy", "47.105.211.91", 22223, "MIIEpQIBAAKCAQEAzCJdHIHjBobXq8S+Vq6IoAY7y3u98KQ1dyA6Ixpa83bw0xZJ0yA/vrcNxueyUesdL7DaG/4kruAdiCeLukYqlmJR+SsFcBUxnB4zYSrWx106CoLjPujvv1DvFgPacDGyp4+e7ifGt/RQlAPONQ+XbaHDHjr6R/0i/93Gm+/yn+/wQvsGUVOqE4kSvpY+36mcVyAgXf2f7Q5YvGsuA7Y7wx0tqU/M/7RI2cRYa3/PumMtBAvx/3Ny17is4I+8RRCq5B/UjOiwsSd391QWMpT0B3T5tO9stpMXLL1Vfm/O4lBUIWkEJsGBqjtgLp7LUpCzDyOGW7+Bi+kDTo5Z1huvfwIDAQABAoIBAQDHcX+lnaXRN6e6NDR/fnEQYGbFjbXrSpTOOhdzOonIO9pZcvpYI7cEP9dfEfsgnGVcth6zoN/4WBGieHjFW066tX8/we/DLYHV9Y/fjLph+Mz/fhhG29F6C7o8uTEP0w6pNeJi70vxaOvdYcZ0AzLBM33uqFLmSQWMFgO5UXutFEDtgi6y6w067CFHq0LEn6PrHZqnevKsPCBMdEXQcTfDaL3JHQGGrIw7WGsi6c6uVk6EVSoSeag0mV6gLfQZzP7zf4oSTZb1Oxt10mk3hVrQV1FiNtHFQpfR9TBCrJBiRER0QQOh/PHet6lXzQ9SQbswLVsbL9asuAS7zOoFwWRBAoGBAPsjwf6waEB8YwPgL8MpD9cRd+VlwjJD9HQGSAr8IHgMNgrwhB2EZx+GOqSqI4FaXhQjb2Safs2POLZOArDmSDSajT7E6etue3c+P5MP/hprjNaSidaEcXsF/eCMjzntZ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lh2f0rOmltkLY6ax/o+BPPC6TaUKmiBAoGASC1VYOzpelcN0ne3RfOrTDzRH3lQzGTh7E+2UxsVpkdxJg0N4e47MGKpGyylxEiuqpcoc9w7ec+IqylcL5Hx2jzDLx4OJHagtZVv8Gx9tixG6+vAdjjl7E38HS5WQcFJzQRAyktCeeoiLYIA3UvSN0GOXqDPAkFzPtX853APRwQ=");
SFTPUtil sftp = new SFTPUtil("lzshopkf","Q0lEkbamFm4aKZEi","172.27.8.47",22);
sftp.login(); sftp.login();
try { try {
boolean has = sftp.isDirExist("./tst/20190819/account"); /*boolean has = sftp.isDirExist("/lzshopkf/transaction/交易凭证/2张三");
System.out.println(has); System.out.println(has);
if (!has) { if (!has) {
sftp.createDir("./tst/20190819/account"); sftp.createDir("/lzshopkf/transaction/交易凭证/2账务");
} }*/
byte [] bytes = sftp.download("/lzshopkf/transaction","交易凭证");
} catch (Exception var3) { } catch (Exception var3) {
var3.printStackTrace(); var3.printStackTrace();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment