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

业务分析-统计-项目展示列表

chenendian 1 месяц назад
Родитель
Сommit
2c1e4c7936

+ 86 - 15
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/SupplyController.java

@@ -2,23 +2,26 @@ package com.siwei.apply.controller.cadastre;
 
 import com.siwei.apply.domain.cadastre.LandSupplyReportDTO;
 import com.siwei.apply.domain.res.*;
+import com.siwei.apply.domain.vo.LandSupplyProjectVO;
 import com.siwei.apply.domain.vo.LandSupplyReportVO;
+import com.siwei.apply.domain.vo.YdbpDataFilterVo;
+import com.siwei.apply.domain.vo.YdbpExcelVo;
 import com.siwei.apply.service.cadastre.ISupplyService;
 import com.siwei.apply.service.cadastre.IZymlService;
 import com.siwei.common.core.domain.R;
+import com.siwei.common.core.utils.bean.BeanUtils;
+import com.siwei.common.core.utils.poi.ExcelUtil;
 import com.siwei.common.core.web.controller.BaseController;
 import org.gdal.ogr.*;
-import org.gdal.osr.SpatialReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import javax.servlet.http.HttpServletResponse;
+import java.io.PrintStream;
+import java.util.*;
 
 /**
- * 地籍土地供应模块
+ * 业务分析土地供应模块
  *
  */
 
@@ -29,13 +32,9 @@ public class SupplyController extends BaseController {
     @Autowired
     private IZymlService zymlService;
 
-    private final LinkedHashMap<String, OGRVectorTiler> m_TilerMap = new LinkedHashMap<String, OGRVectorTiler>();
-
     @Autowired
     private ISupplyService supplyService;
 
-
-
     /**
      *
      * 年度统计
@@ -53,8 +52,6 @@ public class SupplyController extends BaseController {
     }
 
 
-
-
     /**
      *
      * 趋势统计
@@ -70,7 +67,6 @@ public class SupplyController extends BaseController {
     }
 
 
-
     /**
      *
      * 根据时间范围查询土地供应统计报表数据
@@ -89,15 +85,33 @@ public class SupplyController extends BaseController {
     }
 
 
+
+    /**
+     * 根据年份和供地类型查询土地供应统计报表数据
+     * @param year
+     * @param supplyType (1-计划,2-完成)
+     * @return
+     */
+    @GetMapping("/projectList")
+    public R<List<LandSupplyProjectVO>> getProjectList(@RequestParam String year,@RequestParam Integer supplyType) {
+        try {
+                List<LandSupplyProjectVO> resList =  supplyService.projectList(year,supplyType);
+                return R.ok(resList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
     /**
-     *
      *
      * 根据时间范围查询土地供应统计报表数据
      * 供应用途分析报表
      *
      */
     @GetMapping("/report/purpose")
-    public R<LandSupplyReportVO> getTdgyPurposeReport(@RequestParam String startYear, @RequestParam String endYear) {
+    public R<LandSupplyReportVO> getTdgyProjectList(@RequestParam String startYear, @RequestParam String endYear) {
         try {
             LandSupplyReportVO res =  supplyService.getTdgyPurposeReport(startYear,endYear);
             return R.ok(res);
@@ -109,4 +123,61 @@ public class SupplyController extends BaseController {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+    // todo 供应用途分析报表导出接口,前端传入时间范围,后端查询数据并生成Excel文件返回给前端
+    // 前端可以使用a标签的download属性来下载文件,后端需要设置响应头Content-Disposition为attachment; filename=xxx.xlsx
+    // 导出代码逻辑可用参考exportList2 方法。可用自行定义一个新的ExcelVo类来适配供应用途分析报表的数据结构,或者直接使用LandSupplyReportVO中的数据来生成Excel文件。
+    // 最终程呈现的效果见参考图片
+    @PostMapping("/purpose/export")
+    public void exportPurposeReport(HttpServletResponse response, @RequestParam String startYear, @RequestParam String endYear) {
+        try {
+            LandSupplyReportVO res =  supplyService.getTdgyPurposeReport(startYear,endYear);
+            ExcelUtil<YdbpExcelVo> util = new ExcelUtil<>(YdbpExcelVo.class);
+            util.exportExcel(response, null, "报批数据");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+
+    /**
+     * 用地报批数据导出
+     *
+     * @param ydbpExcelVo
+     * @return
+     */
+    @PostMapping("/export2")
+    public void exportList2(HttpServletResponse response, YdbpExcelVo ydbpExcelVo) {
+        try {
+            YdbpDataFilterVo filterVo = new YdbpDataFilterVo();
+            BeanUtils.copyProperties(ydbpExcelVo, filterVo);
+//            Map<String, Object> result = ydbpDataService.getList(filterVo);
+//            List<YdbpExcelVo> list = ydbpDataService.transformation(result);
+            List<YdbpExcelVo> list = new ArrayList<>();
+            ExcelUtil<YdbpExcelVo> util = new ExcelUtil<>(YdbpExcelVo.class);
+            util.exportExcel(response, list, "报批数据");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+
+
+
+
+
 }

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

@@ -12,6 +12,9 @@ import java.util.Date;
 @Data
 public class TdgyStatisticsRes {
 
+    private String projectId;
+
+    private String company;
 
     private BigDecimal mjPfm;
 

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

@@ -0,0 +1,11 @@
+package com.siwei.apply.domain.vo;
+import lombok.Data;
+
+@Data
+public class LandSupplyProjectVO {
+    private String projectPropertyId;
+    private String projectName;
+    private String companyName;
+    private String supplyMethod;
+    private String geom;
+}

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

@@ -4,10 +4,13 @@ package com.siwei.apply.service.cadastre;
 import com.siwei.apply.domain.cadastre.LandSupplyReportDTO;
 import com.siwei.apply.domain.res.SupplyYearStatisticsRes;
 import com.siwei.apply.domain.res.TrendStatisticsRes;
+import com.siwei.apply.domain.vo.LandSupplyProjectVO;
 import com.siwei.apply.domain.vo.LandSupplyPurposeReportVO;
 import com.siwei.apply.domain.vo.LandSupplyReportVO;
 import com.siwei.common.core.domain.R;
 
+import java.util.List;
+
 
 public interface ISupplyService {
     Object GetList(String param);
@@ -22,5 +25,7 @@ public interface ISupplyService {
 
     LandSupplyReportVO getTdgyPurposeReport(String startYear, String endYear);
 
+    List<LandSupplyProjectVO> projectList(String year, Integer supplyType);
+
 
 }

+ 49 - 20
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/SupplyServiceImpl.java

@@ -5,6 +5,7 @@ import com.siwei.apply.domain.LandType;
 import com.siwei.apply.domain.cadastre.*;
 import com.siwei.apply.domain.res.*;
 import com.siwei.apply.domain.vo.GongdiJihuaFilterVo;
+import com.siwei.apply.domain.vo.LandSupplyProjectVO;
 import com.siwei.apply.domain.vo.LandSupplyReportVO;
 import com.siwei.apply.enums.LandUseTypeEnum;
 import com.siwei.apply.mapper.GongdiJihuaMapper;
@@ -389,20 +390,14 @@ public class SupplyServiceImpl implements ISupplyService {
 
 
 
-
-
     @Override
     public LandSupplyReportVO getTdgyPurposeReport(String startYear, String endYear){
-        List<TdgyStatisticsRes> completeList2 = dgyMapper.getListByYear(null, null, startYear, endYear);
-
-        SupplyYearStatisticsRes res = new SupplyYearStatisticsRes();
-        GongdiJihuaFilterVo filterVo = new GongdiJihuaFilterVo();
-        filterVo.setPageSize(100000);
-        List<GongdiJihua> completeList = gongdiJihuaMapper.getList(filterVo);
-
-
-
+        List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(null, null, startYear, endYear);
 
+//        SupplyYearStatisticsRes res = new SupplyYearStatisticsRes();
+//        GongdiJihuaFilterVo filterVo = new GongdiJihuaFilterVo();
+//        filterVo.setPageSize(100000);
+//        List<GongdiJihua> completeList = gongdiJihuaMapper.getList(filterVo);
 
         if (CollectionUtils.isEmpty(completeList)) {
             return new LandSupplyReportVO();
@@ -417,7 +412,7 @@ public class SupplyServiceImpl implements ISupplyService {
 
         // 2. 统计年份并排序
         Set<Integer> yearSet = new TreeSet<>();
-        for (GongdiJihua item : completeList) {
+        for (TdgyStatisticsRes item : completeList) {
             if (item.getGysj() != null) {
                 yearSet.add(item.getGysj().getYear() + 1900);
             }
@@ -428,10 +423,10 @@ public class SupplyServiceImpl implements ISupplyService {
         // Map<一级分类名称, Map<供应方式, Map<年份, 面积汇总>>>
         Map<String, Map<String, Map<String, Double>>> stats = new HashMap<>();
 
-        for (GongdiJihua item : completeList) {
+        for (TdgyStatisticsRes item : completeList) {
             if (item.getGysj() == null || item.getTdyt() == null || item.getTdyt().length() < 2) continue;
-            String firstLevelCode  = LandUseTypeEnum.getCodeByName(item.getTdyt());
-            //String firstLevelCode = item.getTdyt().substring(0, 2);
+            //String firstLevelCode  = LandUseTypeEnum.getCodeByName(item.getTdyt());
+            String firstLevelCode = item.getTdyt().substring(0, 2);
             String parentName = codeToFirstName.getOrDefault(firstLevelCode, "其他");
             String year = String.valueOf(item.getGysj().getYear() + 1900);
             String gyfs = "划拨".equals(item.getGyfs()) ? "划拨" : ("出让".equals(item.getGyfs()) ? "出让" : "其他");
@@ -460,7 +455,7 @@ public class SupplyServiceImpl implements ISupplyService {
             
             // 总计数据
             LandSupplyReportVO.CategoryData totalData = new LandSupplyReportVO.CategoryData();
-            Map<String, Double> totalYearData = new HashMap<>();
+            Map<String, Double> totalYearData = new LinkedHashMap<>();
             double grandTotal = 0.0;
             for (Integer y : report.getYears()) {
                 String yearStr = String.valueOf(y);
@@ -485,7 +480,7 @@ public class SupplyServiceImpl implements ISupplyService {
 
     private LandSupplyReportVO.CategoryData buildCategoryData(Map<String, Double> yearCounts, List<Integer> years) {
         LandSupplyReportVO.CategoryData data = new LandSupplyReportVO.CategoryData();
-        Map<String, Double> yearData = new HashMap<>();
+        Map<String, Double> yearData = new LinkedHashMap<>();
         double total = 0.0;
         for (Integer y : years) {
             String yearStr = String.valueOf(y);
@@ -499,9 +494,43 @@ public class SupplyServiceImpl implements ISupplyService {
     }
 
 
-
-
-
+    /**
+     * supplyType (1-计划,2-完成)
+     * @param year
+     * @param supplyType
+     * @return
+     */
+    @Override
+    public List<LandSupplyProjectVO>  projectList(String year, Integer supplyType) {
+        List<LandSupplyProjectVO> resList = new ArrayList<>();
+        if(supplyType== 1){
+            GongdiJihuaFilterVo filterVo = new GongdiJihuaFilterVo();
+            filterVo.setYear(year);
+            filterVo.setPageSize(100000);
+            List<GongdiJihua> planList = gongdiJihuaMapper.getList(filterVo);
+            resList = planList.stream().map(item -> {
+                LandSupplyProjectVO vo = new LandSupplyProjectVO();
+                vo.setProjectPropertyId(String.valueOf(item.getGid()));
+                vo.setProjectName(item.getXmmc());
+                vo.setCompanyName("暂无");
+                vo.setSupplyMethod(item.getGyfs());
+                vo.setGeom(item.getGeom());
+                return vo;
+            }).collect(Collectors.toList());
+        }else if(supplyType == 2){
+             List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(year, null, null, null);
+             resList = completeList.stream().map(item -> {
+                 LandSupplyProjectVO vo = new LandSupplyProjectVO();
+                 vo.setProjectPropertyId(item.getProjectId());
+                 vo.setProjectName(item.getXmmc());
+                 vo.setCompanyName(item.getCompany());
+                 vo.setSupplyMethod(item.getGyfs());
+                 vo.setGeom(item.getGeom());
+                 return vo;
+             }).collect(Collectors.toList());
+        }
+        return resList;
+    }
 
 
 

+ 3 - 1
siwei-modules/siwei-apply/src/main/resources/mapper/TdgyMapper.xml

@@ -126,6 +126,7 @@
         SELECT
             project.ID AS projectId,
             project.NAME AS xmmc,
+            project.company ,
             t_node.ID AS nodeId,
             t_node.tdyt,
             t_node.gd_type AS gyfs,
@@ -144,7 +145,8 @@
             details.geom_json as geomJson,
             details.sort,
             details.geom_area as geomArea,
-            details.geom
+            ST_AsEWKT(details.geom) as geom
+
         FROM
             t_geom_db_details details
             LEFT JOIN t_node_land land ON details.upload_id :: TEXT = land.geom_db_id ::TEXT