feature: 潍焦文件下载组装

beta-prop-all
dongxiaoke 7 months ago
parent 1057655640
commit 8781d706e6
  1. 20
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java
  2. 1
      jianshui-invoice/src/main/java/com/jianshui/invoice/mapper/InvoiceMapper.java
  3. 8
      jianshui-invoice/src/main/resources/mapper/invoice/InvoiceMapper.xml

@ -3,6 +3,7 @@ package com.jianshui.api.controller.http.invoice.v1;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.codec.Base64Decoder;
import cn.hutool.core.codec.Base64Encoder;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
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.mapper.InvoiceBackMapper;
import com.jianshui.invoice.mapper.InvoiceFileMapper;
import com.jianshui.invoice.mapper.InvoiceMapper;
import com.jianshui.invoice.service.impl.api.ElephantInvoiceApiV6ServiceImpl;
import com.jianshui.invoice.task.AddInvoiceBatchTask;
import com.jianshui.platform.dto.InvoiceAdd.BillInfoPDTO;
@ -92,6 +94,9 @@ public class InvoiceController {
@Autowired
private InvoiceFileMapper invoiceFileMapper;
@Autowired
private InvoiceMapper invoiceMapper;
/**
* 发票列表查询接口
@ -408,6 +413,21 @@ public class InvoiceController {
String fileName = invoiceFile.getFileName();
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 {
byte[] buffer = Base64Decoder.decode(content); // 将文件流字符串转换为字节数组
response.reset();

@ -120,6 +120,7 @@ public interface InvoiceMapper extends BaseMapper<Invoice> {
* @return
*/
public Invoice selectByFpdmFphm(@Param(("companyId")) Long companyId, @Param("fpdm") String fpdm, @Param("fphm") String fphm);
public Invoice selectByFphm(@Param("fphm") String fphm);
public Invoice selectInvoiceByBillInfoId(Long id);

@ -276,6 +276,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where a.company_id = #{companyId} and a.fpdm = #{fpdm} and a.fphm = #{fphm}
</select>
<select id="selectByFphm" resultMap="InvoiceInvoiceDetailResult">
select a.id, a.bill_info_id, a.company_id, a.system_orderno, a.out_trade_orderno, a.fpqqlsh, a.invoice_type, a.state, a.c_invoiceid, a.fpdm, a.fphm, a.kprq, a.buyer_name, a.buyer_taxnum, a.buyer_address, a.buyer_telephone, a.buyer_account, a.buyer_email, a.buyer_phone, a.seller_name, a.seller_taxnum, a.seller_address, a.seller_telephone, a.seller_account, a.message, a.clerk, a.payee, a.checker, a.taxfreeamt, a.tax, a.taxamt, a.origin_fpdm, a.origin_fphm, a.jym, a.qr_code, a.machine_code, a.cipher_text, a.invoice_pdf_url, a.invoice_jpg_url,a.invoice_file_storage, a.invoice_msg, a.invoice_result_msg, a.product_oil_flag, a.qdbz, a.c_ofd_url, a.fjh, a.terminal_number,a.deprecate_type,a.deprecate_reason, a.create_by, a.create_time, a.update_by, a.update_time,
b.id as sub_id, b.invoice_id as sub_invoice_id, b.index as sub_index, b.good_name as sub_good_name, b.num as sub_num, b.price as sub_price, b.hsbz as sub_hsbz, b.taxrate as sub_taxrate, b.spec as sub_spec, b.unit as sub_unit, b.spbm as sub_spbm, b.bmbbh as sub_bmbbh, b.zsbm as sub_zsbm, b.fphxz as sub_fphxz, b.yhzcbs as sub_yhzcbs, b.zzstsgl as sub_zzstsgl, b.lslbs as sub_lslbs, b.kce as sub_kce, b.taxfreeamt as sub_taxfreeamt, b.tax as sub_tax, b.taxamt as sub_taxamt, b.tspz as sub_tspz, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by
from invoice a
left join invoice_detail b on b.invoice_id = a.id
where a.fphm = #{fphm}
</select>
<insert id="insertInvoice" parameterType="Invoice" useGeneratedKeys="true" keyProperty="id">
insert into invoice
<trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save