Przeglądaj źródła

update

shuiqilin-optimize
houyi 9 miesięcy temu
rodzic
commit
fa0257efbc

+ 19
- 16
src/main/java/com/qtzl/alterSales/manager/service/AflReportExportServiceImpl.java Wyświetl plik

@@ -22,6 +22,7 @@ import com.qtzl.alterSales.manager.service.third.FmsService;
import com.qtzl.alterSales.manager.tools.RedisUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;

@@ -29,6 +30,7 @@ import javax.annotation.Resource;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.time.LocalDateTime;
@@ -251,22 +253,23 @@ public class AflReportExportServiceImpl implements AflReportExportService {
}

private void writeExcel(String filePathAndName) throws ServiceHandleException {
String templateFilePath;
ExcelWriter excelWriter;
try {
templateFilePath = ResourceUtils.getFile("classpath:excel-template/Byd50ServiceFeeTemplate.xlsx").getAbsolutePath();
final ClassPathResource resource = new ClassPathResource("excel-template/Byd50ServiceFeeTemplate.xlsx");
InputStream inputStream = resource.getInputStream();
excelWriter = EasyExcelFactory.write(filePathAndName).withTemplate(inputStream).build();
} catch (Exception e) {
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(e.getMessage());
log.error("加载末班文件失败", e);
throw new NullPointerException("加载末班文件失败");
}

ExcelWriter excelWriter = EasyExcelFactory.write(filePathAndName).withTemplate(templateFilePath).build();

// 设置策略
WriteSheet class2973Pay = EasyExcelFactory.writerSheet(0, "2973收款分类").build();
WriteSheet class2973Service = EasyExcelFactory.writerSheet(1, "2973服务费分类").build();
WriteSheet class2973Refund = EasyExcelFactory.writerSheet(2, "2973退款分类").build();
WriteSheet statistics50ServiceFee = EasyExcelFactory.writerSheet(3, "比亚迪50服务费统计").build();
WriteSheet classFeeFlow = EasyExcelFactory.writerSheet(4, "部中心请款流水分类").build();
WriteSheet classRefundFlow = EasyExcelFactory.writerSheet(5, "部中心退款流水分类").build();
// WriteSheet class2973Pay = EasyExcelFactory.writerSheet(0, "2973收款分类").build();
// WriteSheet class2973Service = EasyExcelFactory.writerSheet(1, "2973服务费分类").build();
// WriteSheet class2973Refund = EasyExcelFactory.writerSheet(2, "2973退款分类").build();
WriteSheet statistics50ServiceFee = EasyExcelFactory.writerSheet(0, "比亚迪50服务费统计").build();
// WriteSheet classFeeFlow = EasyExcelFactory.writerSheet(4, "部中心请款流水分类").build();
// WriteSheet classRefundFlow = EasyExcelFactory.writerSheet(5, "部中心退款流水分类").build();

// 渲染数据到excel
boolean blnContinue = true;
@@ -285,9 +288,9 @@ public class AflReportExportServiceImpl implements AflReportExportService {
switch (queueDataBean.getDataEnum()) {
case LIST_FOR_2973_DATA:
List<AflMchStatistics> list1 = (List<AflMchStatistics>) dataList;
excelWriter.fill(getClass2973PaySheet(list1), class2973Pay);
excelWriter.fill(getClass2973ServiceSheet(list1), class2973Service);
excelWriter.fill(getClass2973RefundSheet(list1), class2973Refund);
// excelWriter.fill(getClass2973PaySheet(list1), class2973Pay);
// excelWriter.fill(getClass2973ServiceSheet(list1), class2973Service);
// excelWriter.fill(getClass2973RefundSheet(list1), class2973Refund);
break;
case LIST_FOR_50_SERVICE_FEE_DATA:
List<ExcelHead50ServiceFeeVO> list2 = (List<ExcelHead50ServiceFeeVO>) dataList;
@@ -295,11 +298,11 @@ public class AflReportExportServiceImpl implements AflReportExportService {
break;
case LIST_FOR_PAY_FLOW_DATA:
List<ExcelHeadFlowClassificationVO> list3 = (List<ExcelHeadFlowClassificationVO>) dataList;
excelWriter.fill(getClassFlowSheet(list3), classFeeFlow);
// excelWriter.fill(getClassFlowSheet(list3), classFeeFlow);
break;
case LIST_FOR_REFUND_FLOW_DATA:
List<ExcelHeadFlowClassificationVO> list4 = (List<ExcelHeadFlowClassificationVO>) dataList;
excelWriter.fill(getClassFlowSheet(list4), classRefundFlow);
// excelWriter.fill(getClassFlowSheet(list4), classRefundFlow);
break;
case DATA_PUSH_SUCCESS:
printDataHandleFinishInfo();

Ładowanie…
Anuluj
Zapisz