package com.java110.job.export.adapt; import com.alibaba.fastjson.JSONObject; import com.java110.dto.data.ExportDataDto; import com.java110.dto.room.ApplyRoomDiscountDto; import com.java110.intf.fee.IApplyRoomDiscountInnerServiceSMO; import com.java110.intf.fee.IReportFeeInnerServiceSMO; import com.java110.job.export.IExportDataAdapt; import com.java110.utils.util.BeanConvertUtil; import com.java110.utils.util.StringUtil; import com.java110.vo.FeeQueryParams; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; import java.util.Map; /** * 优惠申请导出 * * @author fqz * @date 2023-12-14 13:52 */ @Service(value = "whiteOrderReportDiscount") public class WhiteOrderReportFeeAdapt implements IExportDataAdapt { @Autowired private IReportFeeInnerServiceSMO reportFeeInnerServiceSMOImpl; @Autowired private IApplyRoomDiscountInnerServiceSMO applyRoomDiscountInnerServiceSMOImpl; private static final int MAX_ROW = 60000; @Override public SXSSFWorkbook exportData(ExportDataDto exportDataDto) { SXSSFWorkbook workbook = null; //工作簿 //工作表 workbook = new SXSSFWorkbook(); workbook.setCompressTempFiles(false); Sheet sheet = workbook.createSheet("白单流水报表"); Row row = sheet.createRow(0); row.createCell(0).setCellValue("RowNo"); row.createCell(1).setCellValue("房屋"); row.createCell(2).setCellValue("序号"); row.createCell(3).setCellValue("收费日期"); row.createCell(4).setCellValue("发票、收据号码"); row.createCell(5).setCellValue("业主地址"); row.createCell(6).setCellValue("门幢室号"); row.createCell(7).setCellValue("归属年份(年)"); row.createCell(8).setCellValue("收费区间"); row.createCell(9).setCellValue("收费内容"); row.createCell(10).setCellValue("收费金额"); row.createCell(11).setCellValue("收费人"); row.createCell(12).setCellValue("银行解款日期"); row.createCell(13).setCellValue("银行解款人"); row.createCell(14).setCellValue("拆分后银行解款金额"); row.createCell(15).setCellValue("银行解款金额"); row.createCell(16).setCellValue("核对金额"); row.createCell(17).setCellValue("白单存档编号"); row.createCell(18).setCellValue("张数"); row.createCell(19).setCellValue("财务收账人"); row.createCell(20).setCellValue("输入时间"); row.createCell(21).setCellValue("输入人员"); row.createCell(22).setCellValue("收款年/月"); row.createCell(23).setCellValue("收款年度"); row.createCell(24).setCellValue("白单存档单号"); row.createCell(25).setCellValue("车牌号"); row.createCell(26).setCellValue("待解决问题"); row.createCell(27).setCellValue("22项分类"); row.createCell(28).setCellValue("财务核对"); row.createCell(29).setCellValue("车位号"); JSONObject reqJson = exportDataDto.getReqJson(); //查询数据 getApplyRoomDiscount(sheet, reqJson); return workbook; } private void getApplyRoomDiscount(Sheet sheet, JSONObject reqJson) { FeeQueryParams feeQueryParams = BeanConvertUtil.covertBean(reqJson, FeeQueryParams.class); feeQueryParams.setPage(1); feeQueryParams.setRow(MAX_ROW); feeQueryParams.setCommunityId(reqJson.getString("communityId")); feeQueryParams.setEndYear(new Date().getYear()); feeQueryParams.setStartYear(2020); List applyRoomDiscounts = reportFeeInnerServiceSMOImpl.repostPaidInFeeByWhiteOrder(feeQueryParams); appendData(applyRoomDiscounts, sheet); } private void appendData(List applyRoomDiscounts, Sheet sheet) { Row row = null; for (int index = 0; index < applyRoomDiscounts.size(); index++) { row = sheet.createRow(index + 1); Map applyRoomDiscountDto = applyRoomDiscounts.get(index); row.createCell(0).setCellValue(applyRoomDiscountDto.get("row2") != null ? applyRoomDiscountDto.get("row1").toString() : ""); row.createCell(1).setCellValue(applyRoomDiscountDto.get("row2") != null ? applyRoomDiscountDto.get("row2").toString() : ""); row.createCell(2).setCellValue(applyRoomDiscountDto.get("row3") != null ? applyRoomDiscountDto.get("row3").toString() : ""); row.createCell(3).setCellValue(applyRoomDiscountDto.get("row4") != null ? applyRoomDiscountDto.get("row4").toString() : ""); row.createCell(4).setCellValue(applyRoomDiscountDto.get("row5") != null ? applyRoomDiscountDto.get("row5").toString() : ""); row.createCell(5).setCellValue(applyRoomDiscountDto.get("row6") != null ? applyRoomDiscountDto.get("row6").toString() : ""); row.createCell(6).setCellValue(applyRoomDiscountDto.get("row7") != null ? applyRoomDiscountDto.get("row7").toString() : ""); row.createCell(7).setCellValue(applyRoomDiscountDto.get("row8") != null ? applyRoomDiscountDto.get("row8").toString() : ""); row.createCell(8).setCellValue(applyRoomDiscountDto.get("row9") != null ? applyRoomDiscountDto.get("row9").toString() : ""); row.createCell(9).setCellValue(applyRoomDiscountDto.get("row10") != null ? applyRoomDiscountDto.get("row10").toString() : ""); row.createCell(10).setCellValue(applyRoomDiscountDto.get("row11") != null ? applyRoomDiscountDto.get("row11").toString() : ""); row.createCell(11).setCellValue(applyRoomDiscountDto.get("row12") != null ? applyRoomDiscountDto.get("row12").toString() : ""); row.createCell(12).setCellValue(applyRoomDiscountDto.get("row13") != null ? applyRoomDiscountDto.get("row13").toString() : ""); row.createCell(13).setCellValue(applyRoomDiscountDto.get("row14") != null ? applyRoomDiscountDto.get("row14").toString() : ""); row.createCell(14).setCellValue(applyRoomDiscountDto.get("row15") != null ? applyRoomDiscountDto.get("row15").toString() : ""); row.createCell(15).setCellValue(applyRoomDiscountDto.get("row16") != null ? applyRoomDiscountDto.get("row16").toString() : ""); row.createCell(16).setCellValue(applyRoomDiscountDto.get("row17") != null ? applyRoomDiscountDto.get("row17").toString() : ""); row.createCell(17).setCellValue(applyRoomDiscountDto.get("row18") != null ? applyRoomDiscountDto.get("row18").toString() : ""); row.createCell(18).setCellValue(applyRoomDiscountDto.get("row19") != null ? applyRoomDiscountDto.get("row19").toString() : ""); row.createCell(19).setCellValue(applyRoomDiscountDto.get("row20") != null ? applyRoomDiscountDto.get("row20").toString() : ""); row.createCell(20).setCellValue(applyRoomDiscountDto.get("row21") != null ? applyRoomDiscountDto.get("row21").toString() : ""); row.createCell(21).setCellValue(applyRoomDiscountDto.get("row22") != null ? applyRoomDiscountDto.get("row22").toString() : ""); row.createCell(22).setCellValue(applyRoomDiscountDto.get("row23") != null ? applyRoomDiscountDto.get("row23").toString() : ""); row.createCell(23).setCellValue(applyRoomDiscountDto.get("row24") != null ? applyRoomDiscountDto.get("row24").toString() : ""); row.createCell(24).setCellValue(applyRoomDiscountDto.get("row25") != null ? applyRoomDiscountDto.get("row25").toString() : ""); row.createCell(25).setCellValue(applyRoomDiscountDto.get("row26") != null ? applyRoomDiscountDto.get("row26").toString() : ""); row.createCell(26).setCellValue(applyRoomDiscountDto.get("row27") != null ? applyRoomDiscountDto.get("row27").toString() : ""); row.createCell(27).setCellValue(applyRoomDiscountDto.get("row28") != null ? applyRoomDiscountDto.get("row28").toString() : ""); } } }