Просмотр исходного кода

修改模版文件 增加日志

shuiqilin-optimize
JianShengFei 9 месяцев назад
Родитель
Сommit
eba19d3b25

+ 3
- 0
src/main/java/com/qtzl/alterSales/manager/service/AflCommissionReportExportServiceImpl.java Просмотреть файл



@Override @Override
public String exportExcel(List<Integer> yearAndMonths) throws ServiceHandleException { public String exportExcel(List<Integer> yearAndMonths) throws ServiceHandleException {
log.info("【{}】开始导出excel...", "手续费");
// yearAndMonth按照从小到大排序 // yearAndMonth按照从小到大排序
AtomicInteger indexSer = new AtomicInteger(1); AtomicInteger indexSer = new AtomicInteger(1);
Collections.sort(yearAndMonths); Collections.sort(yearAndMonths);


return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
log.info("【{}】推送数据完成", "手续费");


InputStream inputStream; InputStream inputStream;
try { try {
excelWriter.fill(map, writeSheet); excelWriter.fill(map, writeSheet);


excelWriter.finish(); excelWriter.finish();
log.info("【{}】导出excel完成", "手续费");


File file = new File(fileName); File file = new File(fileName);
// 上传文件到文件服务器并返回文件请求路径 // 上传文件到文件服务器并返回文件请求路径

+ 4
- 0
src/main/java/com/qtzl/alterSales/manager/service/AflPaccountReceivableBillServiceImpl.java Просмотреть файл



@Override @Override
public String export(List<Integer> accountDates) throws ServiceHandleException { public String export(List<Integer> accountDates) throws ServiceHandleException {
log.info("【{}】开始导出数据", "通行费");
List<AflPaccountReceivableBillDateGroupVO> receivableBillDateGroupVOS = aflPaccountReceivableBillRepo.findMapByAccountDates(accountDates); List<AflPaccountReceivableBillDateGroupVO> receivableBillDateGroupVOS = aflPaccountReceivableBillRepo.findMapByAccountDates(accountDates);


InputStream inputStream; InputStream inputStream;
ExcelWriter excelWriter = EasyExcelFactory.write(fileName + ".xlsx").withTemplate(inputStream).build(); ExcelWriter excelWriter = EasyExcelFactory.write(fileName + ".xlsx").withTemplate(inputStream).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet().build(); WriteSheet writeSheet = EasyExcelFactory.writerSheet().build();


log.info("开始推送数据...");
AtomicReference<Long> totalAmountAll = new AtomicReference<>(0L); AtomicReference<Long> totalAmountAll = new AtomicReference<>(0L);
AtomicInteger indexSer = new AtomicInteger(1); AtomicInteger indexSer = new AtomicInteger(1);
List<ExcelHeadTollPaymentReceiptVO> collect = receivableBillDateGroupVOS.stream().map(e -> { List<ExcelHeadTollPaymentReceiptVO> collect = receivableBillDateGroupVOS.stream().map(e -> {
totalAmountAll.updateAndGet(v -> v + totalAmount); totalAmountAll.updateAndGet(v -> v + totalAmount);
return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
log.info("数据推送完成...");


FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
excelWriter.fill(collect, fillConfig, writeSheet); excelWriter.fill(collect, fillConfig, writeSheet);
map.put("totalAmountAll", String.valueOf(totalAmountAll.get())); map.put("totalAmountAll", String.valueOf(totalAmountAll.get()));
excelWriter.fill(map, writeSheet); excelWriter.fill(map, writeSheet);
excelWriter.finish(); excelWriter.finish();
log.info("【{}】导出数据完成", "通行费");


// 将文件上传到文件服务器 // 将文件上传到文件服务器
File file = new File(fileName + ".xlsx"); File file = new File(fileName + ".xlsx");

Двоичные данные
src/main/resources/excel-template/BydIncomeCostTemplate.xlsx Просмотреть файл


Загрузка…
Отмена
Сохранить