|
|
@@ -3,8 +3,11 @@ package com.jzg.console.service.impl;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
import com.jzg.commons.entity.report.dto.*;
|
|
|
import com.jzg.commons.entity.report.vo.ReportSearchCommonVo;
|
|
|
+import com.jzg.commons.util.EasyExcelUtils;
|
|
|
+import com.jzg.commons.util.ServletUtils;
|
|
|
import com.jzg.console.mapper.ReportReceivableDataMapper;
|
|
|
import com.jzg.console.service.ReportReceivableDataService;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -147,4 +150,90 @@ public class ReportReceivableDataServiceImpl extends ReportBaseServiceImpl imple
|
|
|
}
|
|
|
return reportReceivableDataMapper.getReceivableStatisticsDetail(reportSearchCommonVo, systemCode);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportReceivableStatistics(ReportSearchCommonVo reportSearchCommonVo, String systemCode) {
|
|
|
+ log.info("财务数据-应收统计导出Excel. reportSearchCommonVo=[{}], systemCode=[{}]", JSONUtil.toJsonStr(reportSearchCommonVo), systemCode);
|
|
|
+ List<ReportReceivableDataDto> dataList = reportReceivableDataMapper.getReceivableStatisticsByMonth(reportSearchCommonVo, systemCode);
|
|
|
+ EasyExcelUtils.exportForWeb(ServletUtils.getResponse(), ReportReceivableDataDto.class, dataList, "财务数据-应收统计");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportReceivableStatisticsDetail(ReportSearchCommonVo reportSearchCommonVo, String systemCode) {
|
|
|
+ log.info("财务数据-应收统计明细导出Excel. reportSearchCommonVo=[{}], systemCode=[{}]", JSONUtil.toJsonStr(reportSearchCommonVo), systemCode);
|
|
|
+ List<ReportReceivableDetailDto> dataList = reportReceivableDataMapper.getReceivableStatisticsDetail(reportSearchCommonVo, systemCode);
|
|
|
+
|
|
|
+ // 构建表头
|
|
|
+ List<List<String>> head = java.util.Arrays.asList(
|
|
|
+ java.util.Arrays.asList("保险公司名称"),
|
|
|
+ java.util.Arrays.asList("应收-手续费金额"), java.util.Arrays.asList("应收-跟单费金额"),
|
|
|
+ java.util.Arrays.asList("应收-平台应收金额"), java.util.Arrays.asList("应收-合计金额"),
|
|
|
+ java.util.Arrays.asList("未开票-手续费金额"), java.util.Arrays.asList("未开票-跟单费金额"),
|
|
|
+ java.util.Arrays.asList("未开票-平台应收金额"), java.util.Arrays.asList("未开票-合计金额"),
|
|
|
+ java.util.Arrays.asList("已开票-手续费金额"), java.util.Arrays.asList("已开票-跟单费金额"),
|
|
|
+ java.util.Arrays.asList("已开票-平台应收金额"), java.util.Arrays.asList("已开票-合计金额"),
|
|
|
+ java.util.Arrays.asList("未结算-手续费金额"), java.util.Arrays.asList("未结算-跟单费金额"),
|
|
|
+ java.util.Arrays.asList("未结算-平台应收金额"), java.util.Arrays.asList("未结算-合计金额"),
|
|
|
+ java.util.Arrays.asList("已结算-手续费金额"), java.util.Arrays.asList("已结算-跟单费金额"),
|
|
|
+ java.util.Arrays.asList("已结算-平台应收金额"), java.util.Arrays.asList("已结算-合计金额")
|
|
|
+ );
|
|
|
+
|
|
|
+ // 构建数据行
|
|
|
+ List<List<Object>> rows = dataList.stream().map(dto -> {
|
|
|
+ List<Object> row = new java.util.ArrayList<>();
|
|
|
+ row.add(dto.getCompanyName());
|
|
|
+ if (dto.getReceivable() != null) {
|
|
|
+ row.add(dto.getReceivable().getCommissionFee());
|
|
|
+ row.add(dto.getReceivable().getFollowFee());
|
|
|
+ row.add(dto.getReceivable().getPlatformReceivable());
|
|
|
+ row.add(dto.getReceivable().getTotalAmount());
|
|
|
+ } else {
|
|
|
+ row.add(null); row.add(null); row.add(null); row.add(null);
|
|
|
+ }
|
|
|
+ if (dto.getUninvoiced() != null) {
|
|
|
+ row.add(dto.getUninvoiced().getCommissionFee());
|
|
|
+ row.add(dto.getUninvoiced().getFollowFee());
|
|
|
+ row.add(dto.getUninvoiced().getPlatformReceivable());
|
|
|
+ row.add(dto.getUninvoiced().getTotalAmount());
|
|
|
+ } else {
|
|
|
+ row.add(null); row.add(null); row.add(null); row.add(null);
|
|
|
+ }
|
|
|
+ if (dto.getInvoiced() != null) {
|
|
|
+ row.add(dto.getInvoiced().getCommissionFee());
|
|
|
+ row.add(dto.getInvoiced().getFollowFee());
|
|
|
+ row.add(dto.getInvoiced().getPlatformReceivable());
|
|
|
+ row.add(dto.getInvoiced().getTotalAmount());
|
|
|
+ } else {
|
|
|
+ row.add(null); row.add(null); row.add(null); row.add(null);
|
|
|
+ }
|
|
|
+ if (dto.getUnsettled() != null) {
|
|
|
+ row.add(dto.getUnsettled().getCommissionFee());
|
|
|
+ row.add(dto.getUnsettled().getFollowFee());
|
|
|
+ row.add(dto.getUnsettled().getPlatformReceivable());
|
|
|
+ row.add(dto.getUnsettled().getTotalAmount());
|
|
|
+ } else {
|
|
|
+ row.add(null); row.add(null); row.add(null); row.add(null);
|
|
|
+ }
|
|
|
+ if (dto.getSettled() != null) {
|
|
|
+ row.add(dto.getSettled().getCommissionFee());
|
|
|
+ row.add(dto.getSettled().getFollowFee());
|
|
|
+ row.add(dto.getSettled().getPlatformReceivable());
|
|
|
+ row.add(dto.getSettled().getTotalAmount());
|
|
|
+ } else {
|
|
|
+ row.add(null); row.add(null); row.add(null); row.add(null);
|
|
|
+ }
|
|
|
+ return row;
|
|
|
+ }).toList();
|
|
|
+
|
|
|
+ try {
|
|
|
+ jakarta.servlet.http.HttpServletResponse response = ServletUtils.getResponse();
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+ String fileEName = java.net.URLEncoder.encode("财务数据-应收统计明细", "UTF-8").replaceAll("\\+", "%20");
|
|
|
+ response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileEName + ".xlsx");
|
|
|
+ EasyExcel.write(response.getOutputStream()).head(head).sheet("财务数据-应收统计明细").doWrite(rows);
|
|
|
+ } catch (java.io.IOException e) {
|
|
|
+ log.error("导出文件异常", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|