|
|
@@ -5,10 +5,14 @@ import com.siwei.apply.service.cadastre.IHouselService;
|
|
|
import com.siwei.common.core.domain.R;
|
|
|
import com.siwei.common.core.web.controller.BaseController;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
+import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -79,37 +83,16 @@ public class HouseAnalysisController extends BaseController {
|
|
|
return R.fail(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 宗地分析报表-宗地权利报表
|
|
|
- * 按地籍子区统计各权利类型(已登记/未登记/合计)面积(单位:亩)
|
|
|
- *
|
|
|
- * @return ZdqlReportVO 含列头定义、各地籍子区数据行、合计行
|
|
|
+ * 房屋用途报表统计
|
|
|
+ * @return
|
|
|
*/
|
|
|
- @GetMapping("/report/zdql")
|
|
|
- public R<ZdqlReportVO> getZdqlReport() {
|
|
|
+ @GetMapping("/report/fwyt")
|
|
|
+ public R<FwytReportVO> getFwytReport() {
|
|
|
try {
|
|
|
- ZdqlReportVO res = null;
|
|
|
+ FwytReportVO res = houselService.getZRZFwytReport();
|
|
|
return R.ok(res);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -118,31 +101,209 @@ public class HouseAnalysisController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 导出宗地权利报表(Excel格式)
|
|
|
- * 表格结构:
|
|
|
- * - 第1行:报表标题
|
|
|
- * - 第2行:列头(地籍子区代码、地籍子区名称、5种权利类型名称)
|
|
|
- * - 第3行:列头子行(合计面积、已登记面积、未登记面积)
|
|
|
- * - 数据行:各地籍子区数据
|
|
|
- * - 末行:合计行
|
|
|
- */
|
|
|
- @PostMapping("/zdql/export")
|
|
|
- public void exportZdqlReport(HttpServletResponse response) {
|
|
|
|
|
|
+ @PostMapping("/fwyt/export")
|
|
|
+ public void exportFwytReport(HttpServletResponse response) {
|
|
|
+ try {
|
|
|
+ FwytReportVO res = houselService.getZRZFwytReport();
|
|
|
+ if (res == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Workbook workbook = new XSSFWorkbook();
|
|
|
+ Sheet sheet = workbook.createSheet("房屋用途报表");
|
|
|
+
|
|
|
+ CellStyle titleStyle = workbook.createCellStyle();
|
|
|
+ titleStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ Font titleFont = workbook.createFont();
|
|
|
+ titleFont.setBold(true);
|
|
|
+ titleFont.setFontHeightInPoints((short) 14);
|
|
|
+ titleStyle.setFont(titleFont);
|
|
|
+ titleStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ titleStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ titleStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ titleStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+
|
|
|
+ CellStyle headerStyle = workbook.createCellStyle();
|
|
|
+ headerStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
|
|
+ headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
+ Font headerFont = workbook.createFont();
|
|
|
+ headerFont.setBold(true);
|
|
|
+ headerStyle.setFont(headerFont);
|
|
|
+ headerStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ headerStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ headerStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ headerStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+
|
|
|
+ CellStyle dataStyle = workbook.createCellStyle();
|
|
|
+ dataStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ dataStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ dataStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ dataStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ dataStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ dataStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+
|
|
|
+ CellStyle totalStyle = workbook.createCellStyle();
|
|
|
+ totalStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ totalStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ Font totalFont = workbook.createFont();
|
|
|
+ totalFont.setBold(true);
|
|
|
+ totalStyle.setFont(totalFont);
|
|
|
+ totalStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ totalStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ totalStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ totalStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+
|
|
|
+ int rowIndex = 0;
|
|
|
+
|
|
|
+ // 第1行:报表标题,跨11列(房屋用途代码+名称 2列 + 3个登记状态×3列=9列)
|
|
|
+ Row titleRow = sheet.createRow(rowIndex++);
|
|
|
+ Cell titleCell = titleRow.createCell(0);
|
|
|
+ titleCell.setCellValue("房屋用途报表");
|
|
|
+ titleCell.setCellStyle(titleStyle);
|
|
|
+ titleRow.setHeight((short) 500);
|
|
|
+ for (int i = 1; i <= 10; i++) {
|
|
|
+ titleRow.createCell(i).setCellStyle(titleStyle);
|
|
|
+ }
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 10));
|
|
|
+
|
|
|
+ // 第2行:列头 - 房屋用途代码(合并2行)、房屋用途名称(合并2行)、3个登记状态分组名(各跨3列)
|
|
|
+ Row headerRow = sheet.createRow(rowIndex++);
|
|
|
+ Cell codeHeader = headerRow.createCell(0);
|
|
|
+ codeHeader.setCellValue("房屋用途代码");
|
|
|
+ codeHeader.setCellStyle(headerStyle);
|
|
|
+ Cell nameHeader = headerRow.createCell(1);
|
|
|
+ nameHeader.setCellValue("房屋用途名称");
|
|
|
+ nameHeader.setCellStyle(headerStyle);
|
|
|
+
|
|
|
+ int colIndex = 2;
|
|
|
+ if (res.getRows() != null && !res.getRows().isEmpty()) {
|
|
|
+ for (FwytReportVO.DjztStatCell cell : res.getRows().get(0).getCells()) {
|
|
|
+ Cell groupHeader = headerRow.createCell(colIndex);
|
|
|
+ groupHeader.setCellValue(cell.getDjztName());
|
|
|
+ groupHeader.setCellStyle(headerStyle);
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(1, 1, colIndex, colIndex + 2));
|
|
|
+ colIndex += 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 第3行:列头子行 - 数量(个)、占用面积(亩)、建筑总面积(亩)
|
|
|
+ Row subHeaderRow = sheet.createRow(rowIndex++);
|
|
|
+ subHeaderRow.createCell(0).setCellStyle(headerStyle);
|
|
|
+ subHeaderRow.createCell(1).setCellStyle(headerStyle);
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(1, 2, 0, 0));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(1, 2, 1, 1));
|
|
|
+
|
|
|
+ int subColIndex = 2;
|
|
|
+ if (res.getRows() != null && !res.getRows().isEmpty()) {
|
|
|
+ for (int g = 0; g < res.getRows().get(0).getCells().size(); g++) {
|
|
|
+ Cell countHeader = subHeaderRow.createCell(subColIndex++);
|
|
|
+ countHeader.setCellValue("数量(个)");
|
|
|
+ countHeader.setCellStyle(headerStyle);
|
|
|
+
|
|
|
+ Cell occupiedHeader = subHeaderRow.createCell(subColIndex++);
|
|
|
+ occupiedHeader.setCellValue("占用面积(亩)");
|
|
|
+ occupiedHeader.setCellStyle(headerStyle);
|
|
|
+
|
|
|
+ Cell buildingHeader = subHeaderRow.createCell(subColIndex++);
|
|
|
+ buildingHeader.setCellValue("建筑总面积(亩)");
|
|
|
+ buildingHeader.setCellStyle(headerStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 数据行
|
|
|
+ if (res.getRows() != null) {
|
|
|
+ for (FwytReportVO.RowData rowData : res.getRows()) {
|
|
|
+ Row dataRow = sheet.createRow(rowIndex++);
|
|
|
+ dataRow.setHeight((short) 400);
|
|
|
+
|
|
|
+ Cell codeCell = dataRow.createCell(0);
|
|
|
+ codeCell.setCellValue(rowData.getUseTypeCode() != null ? rowData.getUseTypeCode() : "");
|
|
|
+ codeCell.setCellStyle(dataStyle);
|
|
|
+
|
|
|
+ Cell nameCell = dataRow.createCell(1);
|
|
|
+ nameCell.setCellValue(rowData.getUseTypeName() != null ? rowData.getUseTypeName() : "");
|
|
|
+ nameCell.setCellStyle(dataStyle);
|
|
|
+
|
|
|
+ int cellIndex = 2;
|
|
|
+ for (FwytReportVO.DjztStatCell cell : rowData.getCells()) {
|
|
|
+ Cell countCell = dataRow.createCell(cellIndex++);
|
|
|
+ countCell.setCellValue(cell.getCount() != null ? cell.getCount() : 0);
|
|
|
+ countCell.setCellStyle(dataStyle);
|
|
|
+
|
|
|
+ Cell occupiedCell = dataRow.createCell(cellIndex++);
|
|
|
+ occupiedCell.setCellValue(cell.getOccupiedArea() != null ? cell.getOccupiedArea() : 0.0);
|
|
|
+ occupiedCell.setCellStyle(dataStyle);
|
|
|
+
|
|
|
+ Cell buildingCell = dataRow.createCell(cellIndex++);
|
|
|
+ buildingCell.setCellValue(cell.getBuildingTotalArea() != null ? cell.getBuildingTotalArea() : 0.0);
|
|
|
+ buildingCell.setCellStyle(dataStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 合计行
|
|
|
+ if (res.getTotal() != null) {
|
|
|
+ Row totalRow = sheet.createRow(rowIndex++);
|
|
|
+ totalRow.setHeight((short) 400);
|
|
|
+
|
|
|
+ Cell totalCodeCell = totalRow.createCell(0);
|
|
|
+ totalCodeCell.setCellValue("");
|
|
|
+ totalCodeCell.setCellStyle(totalStyle);
|
|
|
+
|
|
|
+ Cell totalNameCell = totalRow.createCell(1);
|
|
|
+ totalNameCell.setCellValue(res.getTotal().getUseTypeName());
|
|
|
+ totalNameCell.setCellStyle(totalStyle);
|
|
|
+
|
|
|
+ int cellIndex = 2;
|
|
|
+ for (FwytReportVO.DjztStatCell cell : res.getTotal().getCells()) {
|
|
|
+ Cell countCell = totalRow.createCell(cellIndex++);
|
|
|
+ countCell.setCellValue(cell.getCount() != null ? cell.getCount() : 0);
|
|
|
+ countCell.setCellStyle(totalStyle);
|
|
|
+
|
|
|
+ Cell occupiedCell = totalRow.createCell(cellIndex++);
|
|
|
+ occupiedCell.setCellValue(cell.getOccupiedArea() != null ? cell.getOccupiedArea() : 0.0);
|
|
|
+ occupiedCell.setCellStyle(totalStyle);
|
|
|
+
|
|
|
+ Cell buildingCell = totalRow.createCell(cellIndex++);
|
|
|
+ buildingCell.setCellValue(cell.getBuildingTotalArea() != null ? cell.getBuildingTotalArea() : 0.0);
|
|
|
+ buildingCell.setCellStyle(totalStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i <= 10; i++) {
|
|
|
+ sheet.autoSizeColumn(i);
|
|
|
+ int currentWidth = sheet.getColumnWidth(i);
|
|
|
+ if (currentWidth < 3000) {
|
|
|
+ sheet.setColumnWidth(i, 3000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String fileName = "房屋用途报表";
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+ String encodedName = URLEncoder.encode(fileName, StandardCharsets.UTF_8).replace("+", "%20");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + encodedName);
|
|
|
+
|
|
|
+ workbook.write(response.getOutputStream());
|
|
|
+ workbook.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
- * 宗地用途报表
|
|
|
+ * 房屋性质报表统计
|
|
|
* @return
|
|
|
*/
|
|
|
- @GetMapping("/report/zdyt")
|
|
|
- public R<ZdytReportVO> getZdytReport() {
|
|
|
+ @GetMapping("/report/fwxz")
|
|
|
+ public R<FwxzReportVO> getFwxzReport() {
|
|
|
try {
|
|
|
- ZdytReportVO res = null;
|
|
|
+ FwxzReportVO res = houselService.getZRZFwxzReport();
|
|
|
return R.ok(res);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -152,5 +313,200 @@ public class HouseAnalysisController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/fwxz/export")
|
|
|
+ public void exportFwxzReport(HttpServletResponse response) {
|
|
|
+ try {
|
|
|
+ FwxzReportVO res = houselService.getZRZFwxzReport();
|
|
|
+ if (res == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Workbook workbook = new XSSFWorkbook();
|
|
|
+ Sheet sheet = workbook.createSheet("房屋性质报表");
|
|
|
+
|
|
|
+ CellStyle titleStyle = workbook.createCellStyle();
|
|
|
+ titleStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ Font titleFont = workbook.createFont();
|
|
|
+ titleFont.setBold(true);
|
|
|
+ titleFont.setFontHeightInPoints((short) 14);
|
|
|
+ titleStyle.setFont(titleFont);
|
|
|
+ titleStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ titleStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ titleStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ titleStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+
|
|
|
+ CellStyle headerStyle = workbook.createCellStyle();
|
|
|
+ headerStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
|
|
+ headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
+ Font headerFont = workbook.createFont();
|
|
|
+ headerFont.setBold(true);
|
|
|
+ headerStyle.setFont(headerFont);
|
|
|
+ headerStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ headerStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ headerStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ headerStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+
|
|
|
+ CellStyle dataStyle = workbook.createCellStyle();
|
|
|
+ dataStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ dataStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ dataStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ dataStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ dataStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ dataStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+
|
|
|
+ CellStyle totalStyle = workbook.createCellStyle();
|
|
|
+ totalStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ totalStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ Font totalFont = workbook.createFont();
|
|
|
+ totalFont.setBold(true);
|
|
|
+ totalStyle.setFont(totalFont);
|
|
|
+ totalStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ totalStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ totalStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ totalStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+
|
|
|
+ int rowIndex = 0;
|
|
|
+
|
|
|
+ // 第1行:报表标题,跨11列(房屋性质代码+名称 2列 + 3个登记状态×3列=9列)
|
|
|
+ Row titleRow = sheet.createRow(rowIndex++);
|
|
|
+ Cell titleCell = titleRow.createCell(0);
|
|
|
+ titleCell.setCellValue("房屋性质报表");
|
|
|
+ titleCell.setCellStyle(titleStyle);
|
|
|
+ titleRow.setHeight((short) 500);
|
|
|
+ for (int i = 1; i <= 10; i++) {
|
|
|
+ titleRow.createCell(i).setCellStyle(titleStyle);
|
|
|
+ }
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 10));
|
|
|
+
|
|
|
+ // 第2行:列头 - 房屋性质代码(合并2行)、房屋性质名称(合并2行)、3个登记状态分组名(各跨3列)
|
|
|
+ Row headerRow = sheet.createRow(rowIndex++);
|
|
|
+ Cell codeHeader = headerRow.createCell(0);
|
|
|
+ codeHeader.setCellValue("房屋性质代码");
|
|
|
+ codeHeader.setCellStyle(headerStyle);
|
|
|
+ Cell nameHeader = headerRow.createCell(1);
|
|
|
+ nameHeader.setCellValue("房屋性质名称");
|
|
|
+ nameHeader.setCellStyle(headerStyle);
|
|
|
+
|
|
|
+ int colIndex = 2;
|
|
|
+ if (res.getRows() != null && !res.getRows().isEmpty()) {
|
|
|
+ for (FwxzReportVO.DjztStatCell cell : res.getRows().get(0).getCells()) {
|
|
|
+ Cell groupHeader = headerRow.createCell(colIndex);
|
|
|
+ groupHeader.setCellValue(cell.getDjztName());
|
|
|
+ groupHeader.setCellStyle(headerStyle);
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(1, 1, colIndex, colIndex + 2));
|
|
|
+ colIndex += 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 第3行:列头子行 - 数量(个)、占用面积(亩)、建筑总面积(亩)
|
|
|
+ Row subHeaderRow = sheet.createRow(rowIndex++);
|
|
|
+ subHeaderRow.createCell(0).setCellStyle(headerStyle);
|
|
|
+ subHeaderRow.createCell(1).setCellStyle(headerStyle);
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(1, 2, 0, 0));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(1, 2, 1, 1));
|
|
|
+
|
|
|
+ int subColIndex = 2;
|
|
|
+ if (res.getRows() != null && !res.getRows().isEmpty()) {
|
|
|
+ for (int g = 0; g < res.getRows().get(0).getCells().size(); g++) {
|
|
|
+ Cell countHeader = subHeaderRow.createCell(subColIndex++);
|
|
|
+ countHeader.setCellValue("数量(个)");
|
|
|
+ countHeader.setCellStyle(headerStyle);
|
|
|
+
|
|
|
+ Cell occupiedHeader = subHeaderRow.createCell(subColIndex++);
|
|
|
+ occupiedHeader.setCellValue("占用面积(亩)");
|
|
|
+ occupiedHeader.setCellStyle(headerStyle);
|
|
|
+
|
|
|
+ Cell buildingHeader = subHeaderRow.createCell(subColIndex++);
|
|
|
+ buildingHeader.setCellValue("建筑总面积(亩)");
|
|
|
+ buildingHeader.setCellStyle(headerStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 数据行
|
|
|
+ if (res.getRows() != null) {
|
|
|
+ for (FwxzReportVO.RowData rowData : res.getRows()) {
|
|
|
+ Row dataRow = sheet.createRow(rowIndex++);
|
|
|
+ dataRow.setHeight((short) 400);
|
|
|
+
|
|
|
+ Cell codeCell = dataRow.createCell(0);
|
|
|
+ codeCell.setCellValue(rowData.getNatureCode() != null ? rowData.getNatureCode() : "");
|
|
|
+ codeCell.setCellStyle(dataStyle);
|
|
|
+
|
|
|
+ Cell nameCell = dataRow.createCell(1);
|
|
|
+ nameCell.setCellValue(rowData.getNatureName() != null ? rowData.getNatureName() : "");
|
|
|
+ nameCell.setCellStyle(dataStyle);
|
|
|
+
|
|
|
+ int cellIndex = 2;
|
|
|
+ for (FwxzReportVO.DjztStatCell cell : rowData.getCells()) {
|
|
|
+ Cell countCell = dataRow.createCell(cellIndex++);
|
|
|
+ countCell.setCellValue(cell.getCount() != null ? cell.getCount() : 0);
|
|
|
+ countCell.setCellStyle(dataStyle);
|
|
|
+
|
|
|
+ Cell occupiedCell = dataRow.createCell(cellIndex++);
|
|
|
+ occupiedCell.setCellValue(cell.getOccupiedArea() != null ? cell.getOccupiedArea() : 0.0);
|
|
|
+ occupiedCell.setCellStyle(dataStyle);
|
|
|
+
|
|
|
+ Cell buildingCell = dataRow.createCell(cellIndex++);
|
|
|
+ buildingCell.setCellValue(cell.getBuildingTotalArea() != null ? cell.getBuildingTotalArea() : 0.0);
|
|
|
+ buildingCell.setCellStyle(dataStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 合计行
|
|
|
+ if (res.getTotal() != null) {
|
|
|
+ Row totalRow = sheet.createRow(rowIndex++);
|
|
|
+ totalRow.setHeight((short) 400);
|
|
|
+
|
|
|
+ Cell totalCodeCell = totalRow.createCell(0);
|
|
|
+ totalCodeCell.setCellValue("");
|
|
|
+ totalCodeCell.setCellStyle(totalStyle);
|
|
|
+
|
|
|
+ Cell totalNameCell = totalRow.createCell(1);
|
|
|
+ totalNameCell.setCellValue(res.getTotal().getNatureName());
|
|
|
+ totalNameCell.setCellStyle(totalStyle);
|
|
|
+
|
|
|
+ int cellIndex = 2;
|
|
|
+ for (FwxzReportVO.DjztStatCell cell : res.getTotal().getCells()) {
|
|
|
+ Cell countCell = totalRow.createCell(cellIndex++);
|
|
|
+ countCell.setCellValue(cell.getCount() != null ? cell.getCount() : 0);
|
|
|
+ countCell.setCellStyle(totalStyle);
|
|
|
+
|
|
|
+ Cell occupiedCell = totalRow.createCell(cellIndex++);
|
|
|
+ occupiedCell.setCellValue(cell.getOccupiedArea() != null ? cell.getOccupiedArea() : 0.0);
|
|
|
+ occupiedCell.setCellStyle(totalStyle);
|
|
|
+
|
|
|
+ Cell buildingCell = totalRow.createCell(cellIndex++);
|
|
|
+ buildingCell.setCellValue(cell.getBuildingTotalArea() != null ? cell.getBuildingTotalArea() : 0.0);
|
|
|
+ buildingCell.setCellStyle(totalStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i <= 10; i++) {
|
|
|
+ sheet.autoSizeColumn(i);
|
|
|
+ int currentWidth = sheet.getColumnWidth(i);
|
|
|
+ if (currentWidth < 3000) {
|
|
|
+ sheet.setColumnWidth(i, 3000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String fileName = "房屋性质报表";
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+ String encodedName = URLEncoder.encode(fileName, StandardCharsets.UTF_8).replace("+", "%20");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + encodedName);
|
|
|
+
|
|
|
+ workbook.write(response.getOutputStream());
|
|
|
+ workbook.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|