|
|
@@ -1,6 +1,8 @@
|
|
|
package com.kym.service.miniapp.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
+import cn.hutool.poi.excel.ExcelUtil;
|
|
|
+import cn.hutool.poi.excel.ExcelWriter;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
@@ -144,6 +146,38 @@ public class InvoiceServiceImpl extends MPJBaseServiceImpl<InvoiceMapper, Invoic
|
|
|
return new PageBean<>(list);
|
|
|
}
|
|
|
|
|
|
+ void invoiceExport(InvoiceQueryParam params){
|
|
|
+ MPJLambdaWrapper<Invoice> wrapper = JoinWrappers.lambda(Invoice.class)
|
|
|
+ .selectAsClass(Invoice.class, InvoiceVo.class)
|
|
|
+ .selectAll(Invoice.class)
|
|
|
+ .select(User::getMobilePhone)
|
|
|
+ .leftJoin(User.class, User::getId, Invoice::getUserId)
|
|
|
+ .like(CommUtil.isNotEmptyAndNull(params.getPhone()), User::getMobilePhone, params.getPhone())
|
|
|
+ .like(CommUtil.isNotEmptyAndNull(params.getInvoiceTitle()), Invoice::getInvoiceTitle, params.getInvoiceTitle())
|
|
|
+ .like(CommUtil.isNotEmptyAndNull(params.getBiller()), Invoice::getBiller, params.getBiller())
|
|
|
+ .like(CommUtil.isNotEmptyAndNull(params.getTaxId()), Invoice::getTaxId, params.getTaxId())
|
|
|
+ .like(CommUtil.isNotEmptyAndNull(params.getInvoiceType()), Invoice::getInvoiceType, params.getInvoiceType())
|
|
|
+ .like(CommUtil.isNotEmptyAndNull(params.getEmail()), Invoice::getEmail, params.getEmail())
|
|
|
+ .eq(params.getStatus() != null, Invoice::getStatus, params.getStatus())
|
|
|
+ .orderByDesc(Invoice::getId);
|
|
|
+ var list = selectJoinList(InvoiceVo.class, wrapper);
|
|
|
+
|
|
|
+ // 通过工具类创建writer,默认创建xls格式
|
|
|
+ ExcelWriter writer = ExcelUtil.getWriter();
|
|
|
+
|
|
|
+ //自定义标题别名
|
|
|
+ writer.addHeaderAlias("", "发票号码");
|
|
|
+ writer.addHeaderAlias("", "开票日期");
|
|
|
+ writer.addHeaderAlias("", "货物、应税劳务及服务");
|
|
|
+ writer.addHeaderAlias("", "金额");
|
|
|
+ writer.addHeaderAlias("", "税率");
|
|
|
+ writer.addHeaderAlias("", "税额");
|
|
|
+ writer.addHeaderAlias("", "购方识别号");
|
|
|
+ writer.addHeaderAlias("", "购方单位名称");
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<Invoice> listInvoiceForApp(Integer status) {
|
|
|
return lambdaQuery().eq(Invoice::getUserId, StpUtil.getLoginIdAsLong()).eq(status != null, Invoice::getStatus, status).list();
|