Explorar el Código

详情联调修改

chenendian hace 1 mes
padre
commit
0c00c42b83

+ 172 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/SupplyController.java

@@ -1,5 +1,6 @@
 package com.siwei.apply.controller.cadastre;
 
+import com.siwei.apply.domain.GongdiJihua;
 import com.siwei.apply.domain.cadastre.LandSupplyReportDTO;
 import com.siwei.apply.domain.res.*;
 import com.siwei.apply.domain.vo.LandSupplyProjectVO;
@@ -91,6 +92,156 @@ public class SupplyController extends BaseController {
 
 
 
+
+    // todo  当前方法为导出excel的方法, 导出代码逻辑可用参考 (public void exportPurposeReport(HttpServletResponse response, @RequestParam String startYear, @RequestParam String endYear) 方法。可用自行定义一个新的ExcelVo类来适配供应用途分析报表的数据结构,或者直接使用LandSupplyReportDTO中的数据来生成Excel文件。
+    //  最终前端下载的excel文件程呈现的效果见参考图片
+    //  根据需求,完善当前方法,当前方法可以任意命名,参数也可以根据需要调整,主要是实现根据时间范围查询土地供应统计报表数据,并将数据导出成Excel文件供前端下载。
+    @PostMapping("/progress/export")
+    public void exportProgressReport(HttpServletResponse response, @RequestParam String startTime, @RequestParam String endTime) {
+        try {
+            LandSupplyReportDTO res = supplyService.getTdgyReport(startTime, endTime);
+
+            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.RIGHT);
+            dataStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            dataStyle.setBorderTop(BorderStyle.THIN);
+            dataStyle.setBorderBottom(BorderStyle.THIN);
+            dataStyle.setBorderLeft(BorderStyle.THIN);
+            dataStyle.setBorderRight(BorderStyle.THIN);
+
+            CellStyle rateStyle = workbook.createCellStyle();
+            rateStyle.setAlignment(HorizontalAlignment.CENTER);
+            rateStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            rateStyle.setBorderTop(BorderStyle.THIN);
+            rateStyle.setBorderBottom(BorderStyle.THIN);
+            rateStyle.setBorderLeft(BorderStyle.THIN);
+            rateStyle.setBorderRight(BorderStyle.THIN);
+
+            int rowIndex = 0;
+
+            Row titleRow = sheet.createRow(rowIndex++);
+            Cell titleCell = titleRow.createCell(0);
+            titleCell.setCellValue(res.getTitle() != null ? res.getTitle() : "供应进度报表");
+            titleCell.setCellStyle(titleStyle);
+            sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 10));
+            titleRow.setHeight((short) 600);
+
+            Row subTitleRow = sheet.createRow(rowIndex++);
+            Cell subTitleCell = subTitleRow.createCell(0);
+            subTitleCell.setCellValue("统计时间范围:" + (res.getStatTimeRange() != null ? res.getStatTimeRange() : startTime + " 至 " + endTime));
+            subTitleCell.setCellStyle(titleStyle);
+            sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 10));
+
+            Row headerRow = sheet.createRow(rowIndex++);
+            
+            String[] headers = {"用地类型", "供应率", "计划面积", "计划数量", "计划出让", "计划划拨", "计划其他", "完成面积", "完成数量", "完成出让", "完成划拨", "完成其他"};
+            for (int i = 0; i < headers.length; i++) {
+                Cell cell = headerRow.createCell(i);
+                cell.setCellValue(headers[i]);
+                cell.setCellStyle(headerStyle);
+            }
+
+            if (res.getDetails() != null) {
+                for (LandSupplyReportDTO.DetailDTO detail : res.getDetails()) {
+                    Row dataRow = sheet.createRow(rowIndex++);
+                    
+                    Cell typeCell = dataRow.createCell(0);
+                    typeCell.setCellValue(detail.getCategory() != null ? detail.getCategory() : "");
+                    typeCell.setCellStyle(dataStyle);
+                    
+                    Cell rateCell = dataRow.createCell(1);
+                    rateCell.setCellValue(detail.getSupplyRate() != null ? detail.getSupplyRate() : "0%");
+                    rateCell.setCellStyle(rateStyle);
+                    
+                    int colIndex = 2;
+                    if (detail.getPlan() != null) {
+                        dataRow.createCell(colIndex++).setCellValue(detail.getPlan().getArea() != null ? detail.getPlan().getArea() : 0.0);
+                        dataRow.createCell(colIndex++).setCellValue(detail.getPlan().getCount() != null ? detail.getPlan().getCount() : 0);
+                        dataRow.createCell(colIndex++).setCellValue(detail.getPlan().getTransfer() != null ? detail.getPlan().getTransfer() : 0.0);
+                        dataRow.createCell(colIndex++).setCellValue(detail.getPlan().getAllocation() != null ? detail.getPlan().getAllocation() : 0.0);
+                        dataRow.createCell(colIndex++).setCellValue(detail.getPlan().getOther() != null ? detail.getPlan().getOther() : 0.0);
+                    } else {
+                        colIndex += 5;
+                    }
+                    
+                    if (detail.getCompleted() != null) {
+                        dataRow.createCell(colIndex++).setCellValue(detail.getCompleted().getArea() != null ? detail.getCompleted().getArea() : 0.0);
+                        dataRow.createCell(colIndex++).setCellValue(detail.getCompleted().getCount() != null ? detail.getCompleted().getCount() : 0);
+                        dataRow.createCell(colIndex++).setCellValue(detail.getCompleted().getTransfer() != null ? detail.getCompleted().getTransfer() : 0.0);
+                        dataRow.createCell(colIndex++).setCellValue(detail.getCompleted().getAllocation() != null ? detail.getCompleted().getAllocation() : 0.0);
+                        dataRow.createCell(colIndex++).setCellValue(detail.getCompleted().getOther() != null ? detail.getCompleted().getOther() : 0.0);
+                    } else {
+                        colIndex += 5;
+                    }
+                    
+                    for (int i = 0; i <= 12; i++) {
+                        if (dataRow.getCell(i) == null) {
+                            dataRow.createCell(i).setCellStyle(dataStyle);
+                        } else {
+                            dataRow.getCell(i).setCellStyle(dataStyle);
+                        }
+                    }
+                }
+            }
+
+            for (int i = 0; i <= 11; i++) {
+                sheet.autoSizeColumn(i);
+            }
+
+            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+            response.setCharacterEncoding("utf-8");
+            String fileName = "土地供应进度分析报表.xlsx";
+            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();
+        }
+    }
+
+
+
+
+
+
+
+
+
+
     /**
      * 根据年份和供地类型查询土地供应统计报表数据
      * @param year
@@ -109,6 +260,19 @@ public class SupplyController extends BaseController {
     }
 
 
+    @GetMapping("/getPlanProject")
+    public R<GongdiJihua> getPlanProject(@RequestParam String propertyId) {
+        try {
+            GongdiJihua res =  supplyService.getPlanProject(propertyId);
+            return R.ok(res);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+
     /**
      *
      * 根据时间范围查询土地供应统计报表数据
@@ -126,6 +290,13 @@ public class SupplyController extends BaseController {
     }
 
 
+
+
+
+
+
+
+
     @PostMapping("/purpose/export")
     public void exportPurposeReport(HttpServletResponse response, @RequestParam String startYear, @RequestParam String endYear) {
         try {
@@ -260,7 +431,7 @@ public class SupplyController extends BaseController {
             totalLabelCell.setCellStyle(headerStyle);
 
             int totalColIndex = 1;
-            
+
             for (Integer year : years) {
                 String yearStr = String.valueOf(year);
                 double yearTotal = 0.0;

+ 2 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/res/TdgyStatisticsRes.java

@@ -14,6 +14,8 @@ public class TdgyStatisticsRes {
 
     private String projectId;
 
+    private String nodeId;
+
     private String company;
 
     private BigDecimal mjPfm;

+ 2 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/LandSupplyProjectVO.java

@@ -4,8 +4,10 @@ import lombok.Data;
 @Data
 public class LandSupplyProjectVO {
     private String projectPropertyId;
+    private String nodeId;
     private String projectName;
     private String companyName;
     private String supplyMethod;
+    private String supplyType;
     private String geom;
 }

+ 2 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/ISupplyService.java

@@ -1,6 +1,7 @@
 package com.siwei.apply.service.cadastre;
 
 
+import com.siwei.apply.domain.GongdiJihua;
 import com.siwei.apply.domain.cadastre.LandSupplyReportDTO;
 import com.siwei.apply.domain.res.SupplyYearStatisticsRes;
 import com.siwei.apply.domain.res.TrendStatisticsRes;
@@ -27,5 +28,6 @@ public interface ISupplyService {
 
     List<LandSupplyProjectVO> projectList(String year, Integer supplyType);
 
+    GongdiJihua getPlanProject(String id);
 
 }

+ 12 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/SupplyServiceImpl.java

@@ -12,6 +12,7 @@ import com.siwei.apply.mapper.GongdiJihuaMapper;
 import com.siwei.apply.mapper.LandTypeMapper;
 import com.siwei.apply.mapper.TdgyMapper;
 import com.siwei.apply.service.cadastre.ISupplyService;
+import com.siwei.common.core.utils.StringUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -516,6 +517,7 @@ public class SupplyServiceImpl implements ISupplyService {
                 vo.setProjectName(item.getXmmc());
                 vo.setCompanyName("暂无");
                 vo.setSupplyMethod(item.getGyfs());
+                vo.setSupplyType(supplyType.toString());
                 vo.setGeom(item.getGeom());
                 return vo;
             }).collect(Collectors.toList());
@@ -527,6 +529,8 @@ public class SupplyServiceImpl implements ISupplyService {
                  vo.setProjectName(item.getXmmc());
                  vo.setCompanyName(item.getCompany());
                  vo.setSupplyMethod(item.getGyfs());
+                 vo.setSupplyType(supplyType.toString());
+                 vo.setNodeId(item.getNodeId());
                  vo.setGeom(item.getGeom());
                  return vo;
              }).collect(Collectors.toList());
@@ -534,7 +538,14 @@ public class SupplyServiceImpl implements ISupplyService {
         return resList;
     }
 
-
+    @Override
+    public GongdiJihua getPlanProject(String id) {
+        GongdiJihua res = null;
+        if(StringUtils.isNumeric(id)){
+            res = gongdiJihuaMapper.get(Integer.parseInt(id));
+        }
+        return res;
+    }
 
 
     @Override