下载发票xml附件
This commit is contained in:
parent
a780d9717d
commit
0813623f14
|
@ -1,6 +1,7 @@
|
|||
package com.hzya.frame.seeyon.invoice.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
@ -236,11 +237,11 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
|||
}
|
||||
//获取xml文件到本地 并为xml取名,否则会报无法访问错误
|
||||
logger.info("========开始将xml文件保存到本地========");
|
||||
String xmlFileName = generateFileName(xmlUrl, "XML");
|
||||
String xmlFileName = generateFileName(xmlUrl, "zip");
|
||||
String xmlSavePath = invoiceXmlUrl + xmlFileName;
|
||||
downloadPdf(xmlUrl, xmlSavePath);
|
||||
File fileXml = downloadXml(xmlUrl, xmlSavePath);
|
||||
logger.info("========xml文件保存到本地完成========");
|
||||
File fileXml = new File(xmlSavePath);
|
||||
//File fileXml = new File(xmlSavePath);
|
||||
if(null !=fileXml){
|
||||
logger.info("========开始将xml文件上传OA========");
|
||||
ManyfileUpload(fileXml, entity, sub_reference, att_reference, jsonObject);
|
||||
|
@ -462,6 +463,20 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载发票xml附件, 税务系统返回的xml文件是.zip压缩包
|
||||
* @param xmlUrl
|
||||
* @param savePath
|
||||
*/
|
||||
private File downloadXml(String xmlUrl,String savePath){
|
||||
long size = HttpUtil.downloadFile(xmlUrl,savePath);
|
||||
File xmlZipFile = new File(savePath);
|
||||
// if (null != xmlZipFile && xmlZipFile.getName().endsWith(".zip")){
|
||||
// File unzip = ZipUtil.unzip(xmlZipFile);
|
||||
// return unzip;
|
||||
// }
|
||||
return xmlZipFile;
|
||||
}
|
||||
private static void trustAllCertificates(HttpsURLConnection conn) throws Exception {
|
||||
TrustManager[] trustAllCerts = new TrustManager[]{
|
||||
new X509TrustManager() {
|
||||
|
|
Loading…
Reference in New Issue