发票批量下载优化

This commit is contained in:
lihao 2025-05-26 18:42:30 +08:00
parent e31edd11d7
commit 3bfb0429a0
1 changed files with 12 additions and 7 deletions

View File

@ -122,7 +122,8 @@ public class InvoiceDownloadAction implements ICommonAction {
String ofdData = (String) infoMap.get("taxofd"); String ofdData = (String) infoMap.get("taxofd");
if (MMValueCheck.isEmpty(pdfData) && MMValueCheck.isEmpty(xmlData) && MMValueCheck.isEmpty(ofdData)) { if (MMValueCheck.isEmpty(pdfData) && MMValueCheck.isEmpty(xmlData) && MMValueCheck.isEmpty(ofdData)) {
throw new Exception("δ²éѯµ½·¢Æ±ÐÅÏ¢"); // throw new Exception("未查询到发票信息");
continue;
} }
String ctcode = ""; String ctcode = "";
@ -135,13 +136,17 @@ public class InvoiceDownloadAction implements ICommonAction {
"AND bd.pk_defdoc = '" + ivApplicationHeadVO.getDef2().toString() + "' "; "AND bd.pk_defdoc = '" + ivApplicationHeadVO.getDef2().toString() + "' ";
// List<Map<String,Object>> operationresult = (List<Map<String,Object>>) getQueryService().executeQuery(operationSql, new ArrayListProcessor()); // List<Map<String,Object>> operationresult = (List<Map<String,Object>>) getQueryService().executeQuery(operationSql, new ArrayListProcessor());
Map<String, Object> valList = (Map<String, Object>) getQueryService().executeQuery(operationSql, new MapProcessor()); Map<String, Object> valList = (Map<String, Object>) getQueryService().executeQuery(operationSql, new MapProcessor());
ctcode = (String) valList.get("name"); if(valList == null){
ctcode = ivApplicationHeadVO.getDef2(); // 合同号
}
}
if(!ctcode.equals("") && !ctcode.equals("/") ){
ctcode=ctcode+"_";
} }
// 添加 PDF // 添加 PDF
if (!MMValueCheck.isEmpty(pdfData)) { if (!MMValueCheck.isEmpty(pdfData)) {
byte[] pdfBytes = DatatypeConverter.parseBase64Binary(pdfData); byte[] pdfBytes = DatatypeConverter.parseBase64Binary(pdfData);
zipStream.putNextEntry(new ZipEntry(ctcode + "_" + headVO.getGmfmc() + "_" + headVO.getFphm() + "_" + String.valueOf(headVO.getJshj().toDouble()) + ".pdf")); zipStream.putNextEntry(new ZipEntry(ctcode + headVO.getGmfmc() + "_" + headVO.getFphm() + "_" + String.valueOf(headVO.getJshj().toDouble()) + ".pdf"));
zipStream.write(pdfBytes); zipStream.write(pdfBytes);
zipStream.closeEntry(); zipStream.closeEntry();
} }
@ -149,7 +154,7 @@ public class InvoiceDownloadAction implements ICommonAction {
// 添加 XML // 添加 XML
if (!MMValueCheck.isEmpty(xmlData)) { if (!MMValueCheck.isEmpty(xmlData)) {
byte[] xmlBytes = DatatypeConverter.parseBase64Binary(xmlData); byte[] xmlBytes = DatatypeConverter.parseBase64Binary(xmlData);
zipStream.putNextEntry(new ZipEntry(ctcode + "_" + headVO.getGmfmc() + "_" + headVO.getFphm() + "_" + String.valueOf(headVO.getJshj().toDouble()) + ".xml")); zipStream.putNextEntry(new ZipEntry(ctcode + headVO.getGmfmc() + "_" + headVO.getFphm() + "_" + String.valueOf(headVO.getJshj().toDouble()) + ".xml"));
zipStream.write(xmlBytes); zipStream.write(xmlBytes);
zipStream.closeEntry(); zipStream.closeEntry();
} }
@ -157,11 +162,11 @@ public class InvoiceDownloadAction implements ICommonAction {
// 添加 OFD // 添加 OFD
if (!MMValueCheck.isEmpty(ofdData)) { if (!MMValueCheck.isEmpty(ofdData)) {
byte[] ofdBytes = DatatypeConverter.parseBase64Binary(ofdData); byte[] ofdBytes = DatatypeConverter.parseBase64Binary(ofdData);
zipStream.putNextEntry(new ZipEntry(ctcode + "_" + headVO.getGmfmc() + "_" + headVO.getFphm() + "_" + String.valueOf(headVO.getJshj().toDouble()) + ".ofd")); zipStream.putNextEntry(new ZipEntry(ctcode + headVO.getGmfmc() + "_" + headVO.getFphm() + "_" + String.valueOf(headVO.getJshj().toDouble()) + ".ofd"));
zipStream.write(ofdBytes); zipStream.write(ofdBytes);
zipStream.closeEntry(); zipStream.closeEntry();
} }
zipName=ctcode + "_" + headVO.getGmfmc() + "_" + headVO.getFphm() + "_" + String.valueOf(headVO.getJshj().toDouble()); zipName=ctcode + headVO.getGmfmc() + "_" + headVO.getFphm() + "_" + String.valueOf(headVO.getJshj().toDouble());
} else { } else {
throw new Exception("获取发票信息失败"); throw new Exception("获取发票信息失败");
} }