@ -3,6 +3,7 @@ package com.jianshui.api.controller.http.invoice.v1;
import cn.hutool.core.bean.BeanUtil ;
import cn.hutool.core.bean.BeanUtil ;
import cn.hutool.core.codec.Base64Decoder ;
import cn.hutool.core.codec.Base64Decoder ;
import cn.hutool.core.codec.Base64Encoder ;
import cn.hutool.core.codec.Base64Encoder ;
import cn.hutool.core.date.DateUtil ;
import cn.hutool.core.util.ObjectUtil ;
import cn.hutool.core.util.ObjectUtil ;
import cn.hutool.core.util.StrUtil ;
import cn.hutool.core.util.StrUtil ;
import cn.hutool.json.JSONUtil ;
import cn.hutool.json.JSONUtil ;
@ -24,6 +25,7 @@ import com.jianshui.invoice.domain.ele.EleNewMessage;
import com.jianshui.invoice.domain.ele.FindRedInfoDTO ;
import com.jianshui.invoice.domain.ele.FindRedInfoDTO ;
import com.jianshui.invoice.mapper.InvoiceBackMapper ;
import com.jianshui.invoice.mapper.InvoiceBackMapper ;
import com.jianshui.invoice.mapper.InvoiceFileMapper ;
import com.jianshui.invoice.mapper.InvoiceFileMapper ;
import com.jianshui.invoice.mapper.InvoiceMapper ;
import com.jianshui.invoice.service.impl.api.ElephantInvoiceApiV6ServiceImpl ;
import com.jianshui.invoice.service.impl.api.ElephantInvoiceApiV6ServiceImpl ;
import com.jianshui.invoice.task.AddInvoiceBatchTask ;
import com.jianshui.invoice.task.AddInvoiceBatchTask ;
import com.jianshui.platform.dto.InvoiceAdd.BillInfoPDTO ;
import com.jianshui.platform.dto.InvoiceAdd.BillInfoPDTO ;
@ -92,6 +94,9 @@ public class InvoiceController {
@Autowired
@Autowired
private InvoiceFileMapper invoiceFileMapper ;
private InvoiceFileMapper invoiceFileMapper ;
@Autowired
private InvoiceMapper invoiceMapper ;
/ * *
/ * *
* 发票列表查询接口
* 发票列表查询接口
@ -408,6 +413,21 @@ public class InvoiceController {
String fileName = invoiceFile . getFileName ( ) ;
String fileName = invoiceFile . getFileName ( ) ;
String content = invoiceFile . getFileContent ( ) ;
String content = invoiceFile . getFileContent ( ) ;
//企业名称_发票号码_开票日期.pdf
try {
String fphm = invoiceFile . getFphm ( ) ;
if ( StrUtil . isNotEmpty ( fphm ) ) {
Invoice invoice = invoiceMapper . selectByFphm ( fphm ) ;
if ( invoice ! = null ) {
String buyerName = invoice . getBuyerName ( ) ;
String kprq = DateUtil . format ( invoice . getKprq ( ) , "yyyy-MM-dd" ) ;
fileName = buyerName + "_" + fphm + "_" + kprq ;
}
}
} catch ( Exception e ) {
log . info ( "下载名称组装错误,{}" , e . toString ( ) ) ;
}
try {
try {
byte [ ] buffer = Base64Decoder . decode ( content ) ; // 将文件流字符串转换为字节数组
byte [ ] buffer = Base64Decoder . decode ( content ) ; // 将文件流字符串转换为字节数组
response . reset ( ) ;
response . reset ( ) ;