|
@@ -57,8 +57,8 @@ public class InvoiceServiceImpl extends MPJBaseServiceImpl<InvoiceMapper, Invoic
|
|
|
private final WxPayService wxPayService;
|
|
private final WxPayService wxPayService;
|
|
|
private final DataDictService dataDictService;
|
|
private final DataDictService dataDictService;
|
|
|
|
|
|
|
|
- public InvoiceServiceImpl(ChargeOrderService chargeOrderService, @Lazy WxPayService wxPayService,@Lazy DataDictService dataDictService) {
|
|
|
|
|
- this.dataDictService =dataDictService;
|
|
|
|
|
|
|
+ public InvoiceServiceImpl(ChargeOrderService chargeOrderService, @Lazy WxPayService wxPayService, @Lazy DataDictService dataDictService) {
|
|
|
|
|
+ this.dataDictService = dataDictService;
|
|
|
this.chargeOrderService = chargeOrderService;
|
|
this.chargeOrderService = chargeOrderService;
|
|
|
this.wxPayService = wxPayService;
|
|
this.wxPayService = wxPayService;
|
|
|
}
|
|
}
|
|
@@ -156,38 +156,6 @@ public class InvoiceServiceImpl extends MPJBaseServiceImpl<InvoiceMapper, Invoic
|
|
|
return new PageBean<>(list);
|
|
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
|
|
@Override
|
|
|
public List<Invoice> listInvoiceForApp(Integer status) {
|
|
public List<Invoice> listInvoiceForApp(Integer status) {
|
|
|
return lambdaQuery().eq(Invoice::getUserId, StpUtil.getLoginIdAsLong()).eq(status != null, Invoice::getStatus, status).list();
|
|
return lambdaQuery().eq(Invoice::getUserId, StpUtil.getLoginIdAsLong()).eq(status != null, Invoice::getStatus, status).list();
|
|
@@ -206,62 +174,4 @@ public class InvoiceServiceImpl extends MPJBaseServiceImpl<InvoiceMapper, Invoic
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public ExcelWriter exportInvoiceList(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);
|
|
|
|
|
- ExcelWriter writer = ExcelUtil.getWriter();
|
|
|
|
|
-//设置要导出到的sheet
|
|
|
|
|
-//自定义excel标题和列名
|
|
|
|
|
- writer.addHeaderAlias("status", "发票状态");
|
|
|
|
|
- writer.addHeaderAlias("mobilePhone", "用户手机号");
|
|
|
|
|
- writer.addHeaderAlias("invoiceTitle", "发票抬头");
|
|
|
|
|
- writer.addHeaderAlias("taxId", "公司税号");
|
|
|
|
|
- writer.addHeaderAlias("email", "接收发票邮箱");
|
|
|
|
|
- writer.addHeaderAlias("invoiceType", "发票类型");
|
|
|
|
|
- writer.addHeaderAlias("address", "公司地址");
|
|
|
|
|
- writer.addHeaderAlias("telephone", "购买方电话");
|
|
|
|
|
- writer.addHeaderAlias("bankName", "开户银行");
|
|
|
|
|
- writer.addHeaderAlias("bankAccount", "银行账户");
|
|
|
|
|
- writer.addHeaderAlias("biller", "开票人");
|
|
|
|
|
- writer.addHeaderAlias("invoiceAmount", "发票金额(元)");
|
|
|
|
|
- writer.addHeaderAlias("totalPower", "累积充电量(度)");
|
|
|
|
|
- writer.addHeaderAlias("totalMoney", "累积总金额(元)");
|
|
|
|
|
- writer.addHeaderAlias("elecMoney", "累积电费(元)");
|
|
|
|
|
- writer.addHeaderAlias("serviceMoney", "累积服务费(元)");
|
|
|
|
|
- writer.addHeaderAlias("serviceMoneyDiscount", "服务费优惠金额(元)");
|
|
|
|
|
-
|
|
|
|
|
- List<DataDict> dataDicts = dataDictService.lambdaQuery().list();
|
|
|
|
|
- Map<String, String> dictMap = dataDicts.stream().collect(Collectors.toMap(k -> k.getCode() + ":" + k.getValue(), DataDict::getName));
|
|
|
|
|
-//一次性写出内容,使用默认样式,强制输出标题
|
|
|
|
|
- List<Map<String, Object>> rows = new ArrayList<>();
|
|
|
|
|
- list.forEach(k -> {
|
|
|
|
|
- Map<String, Object> m = BeanUtil.beanToMap(k,"mobilePhone","invoiceTitle","taxId","email",
|
|
|
|
|
- "address","telephone","bankName","bankAccount","biller","totalPower");
|
|
|
|
|
- m.put("invoiceType", dictMap.getOrDefault("Invoice.type:"+k.getInvoiceType(),""));
|
|
|
|
|
- m.put("invoiceAmount", NumberUtil.decimalFormat("#.##",k.getInvoiceAmount()/100f));
|
|
|
|
|
- m.put("totalMoney",NumberUtil.decimalFormat("#.##",k.getTotalMoney()/100f));
|
|
|
|
|
- m.put("elecMoney", NumberUtil.decimalFormat("#.##",k.getElecMoney()/100f));
|
|
|
|
|
- m.put("serviceMoney", NumberUtil.decimalFormat("#.##",k.getServiceMoney()/100f));
|
|
|
|
|
- m.put("serviceMoneyDiscount",NumberUtil.decimalFormat("#.##",k.getServiceMoneyDiscount()/100f));
|
|
|
|
|
- m.put("status", dictMap.getOrDefault("Invoice.status:"+k.getStatus(),""));
|
|
|
|
|
- rows.add(m);
|
|
|
|
|
- });
|
|
|
|
|
- writer.write(rows, true);
|
|
|
|
|
-
|
|
|
|
|
- return writer;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|