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

土地收储出入库矢量列表

chenendian 6 дней назад
Родитель
Сommit
3e97fafc25

+ 21 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/StorageController.java

@@ -172,6 +172,27 @@ public class StorageController extends BaseController {
         }
     }
 
+
+    /**
+     * 出入库分析
+     * supplyType: 0-全部,1-入库,2-出库
+     */
+    @GetMapping("/inOutProjectList")
+    public R<List<LandSupplyProjectVO>> inOutProjectList(@RequestParam(required = false) String year,
+                                                       @RequestParam Integer supplyType,
+                                                       @RequestParam(required = false) String useType) {
+        try {
+            //List<LandSupplyProjectVO> resList = storageServiceImpl.projectList(year, supplyType, useType);
+            List<LandSupplyProjectVO> resList = storageServiceImpl.inOutProjectList(year, supplyType, useType);
+            return R.ok(resList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+
     /**
      * 获取计划收储详情
      */

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

@@ -12,4 +12,7 @@ public class TrendUseStatisticsData {
     private String useName; // 用途名称
     private String inDataArea; //入库地块面积
     private String outDataArea; //出库地块面积
+    private String inDataGeom; //入库地块矢量
+    private String outDataGeom; //出库地块矢量
+
 }

+ 115 - 6
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/StorageServiceImpl.java

@@ -1,18 +1,18 @@
 package com.siwei.apply.service.cadastre.impl;
 
+import com.siwei.apply.domain.LandType;
 import com.siwei.apply.domain.Tdgy;
 import com.siwei.apply.domain.cadastre.LandStorageInOutReportDTO;
 import com.siwei.apply.domain.cadastre.LandStorageReportDTO;
 import com.siwei.apply.domain.cadastre.LandSupplyReportDTO;
 import com.siwei.apply.domain.res.*;
 import com.siwei.apply.domain.vo.LandSupplyProjectVO;
-import com.siwei.apply.mapper.GjShijiShouchuMapper;
-import com.siwei.apply.mapper.GjShouchuJihuaMapper;
-import com.siwei.apply.mapper.GongdiJihuaMapper;
-import com.siwei.apply.mapper.TdgyMapper;
+import com.siwei.apply.mapper.*;
+import com.siwei.apply.service.NodeLandService;
 import com.siwei.common.core.constant.SecurityConstants;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.exception.ServiceException;
+import com.siwei.common.core.utils.DateUtils;
 import com.siwei.common.core.utils.StringUtils;
 import com.siwei.spatial.api.RemoteSpatialFilesDbService;
 import com.siwei.spatial.api.domain.file.TGeomDb;
@@ -29,6 +29,8 @@ import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.siwei.apply.service.third.impl.DealExcelServiceImpl.allLandTypeList;
+
 @Slf4j
 @Service
 public class StorageServiceImpl {
@@ -64,6 +66,11 @@ public class StorageServiceImpl {
     @Autowired
     private GongdiJihuaMapper gongdiJihuaMapper;
 
+    @Autowired
+    private LandTypeMapper landTypeMapper;
+
+    @Autowired
+    private NodeLandService nodeLandService;
 
 
     public LandStorageInOutReportDTO inOutDetails() {
@@ -473,7 +480,7 @@ public class StorageServiceImpl {
             }
         }
 
-        //第二部分,计算供地
+        //第二部分,计算入库
         List<Map<String, Object>> statsList = gjShijiShouchuMapper.getStatsByYear();
         if (CollectionUtils.isNotEmpty(statsList)) {
             for (Map<String, Object> stat : statsList) {
@@ -549,6 +556,9 @@ public class StorageServiceImpl {
                 TrendUseStatisticsData data = new TrendUseStatisticsData();
                 data.setUseName(convertCategory(String.valueOf(stat.get("use_name"))));
                 data.setInDataArea(String.valueOf(stat.get("in_data_area")));
+
+
+
                 data.setOutDataArea("0");
                 res.add(data);
             }
@@ -556,6 +566,10 @@ public class StorageServiceImpl {
         return res;
     }
 
+
+
+
+
     public List<Map<String, Object>> landStock(String year) {
         if(StringUtils.isBlank(year)||"0".equals(year)){
             year = null;
@@ -596,6 +610,88 @@ public class StorageServiceImpl {
         return res;
     }
 
+
+
+
+    public List<LandSupplyProjectVO> inOutProjectList(String year, Integer supplyType,String useType) {
+        List<LandSupplyProjectVO> resList = new ArrayList<>();
+        if (supplyType == 1||supplyType == 0) {//入库
+            List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null, null, null);
+            if (CollectionUtils.isNotEmpty(completeList)) {
+                for (TdgyStatisticsRes item : completeList) {
+                    LandSupplyProjectVO vo = new LandSupplyProjectVO();
+                    String category = convertCategory(item.getTdyt());
+                    vo.setProjectPropertyId(item.getProjectId());
+                    vo.setNodeId(item.getNodeId());
+                    vo.setProjectName(item.getXmmc());
+                    vo.setCompanyName("暂无");
+                    vo.setSupplyMethod(item.getGyfs());
+                    vo.setSupplyType("1");
+                    vo.setDateType("1");
+                    vo.setGeom(item.getGeom());
+                    vo.setYear(item.getGysj());
+                    vo.setArea(String.format("%.2f", item.getMjMu() == null ? BigDecimal.ZERO : item.getMjMu()));
+                    vo.setUseType(category);
+                    resList.add(vo);
+                }
+            }
+        }
+        if (supplyType == 2||supplyType == 0) {//这里计算供地,用两部分数据进行实例化
+            List<TdgyStatisticsRes> completeSjgdList = tdgyMapper.getSjgdListByYear(year, null, null, null);
+            List<Tdgy> tdgyList = tdgyMapper.getTdgyList(year,year);
+            //这里获取实际供地数据:根据年份进行分组:
+            if(CollectionUtils.isNotEmpty(completeSjgdList)){
+                for (TdgyStatisticsRes item : completeSjgdList) {
+                    LandSupplyProjectVO vo = new LandSupplyProjectVO();
+                    String category = getTdytByCode(item.getTdyt());
+                    vo.setProjectPropertyId(item.getProjectId());
+                    vo.setNodeId(item.getNodeId());
+                    vo.setProjectName(item.getXmmc());
+                    vo.setCompanyName("暂无");
+                    vo.setSupplyMethod(item.getGyfs());
+                    vo.setSupplyType("2");
+                    vo.setDateType("2");
+                    vo.setGeom(item.getGeom());
+                    vo.setYear(item.getGysj());
+                    vo.setArea(String.format("%.2f", item.getMjMu() == null ? BigDecimal.ZERO : item.getMjMu()));
+                    vo.setUseType(category);
+                    resList.add(vo);
+                }//
+            }
+
+            if(CollectionUtils.isNotEmpty(tdgyList)){
+                for (Tdgy item : tdgyList) {
+                    LandSupplyProjectVO vo = new LandSupplyProjectVO();
+                    String category = getTdytByCode(item.getTdyt());
+                    vo.setProjectPropertyId(item.getProjectId());
+                    vo.setNodeId(item.getId());
+                    vo.setProjectName("");
+                    vo.setCompanyName("暂无");
+                    vo.setSupplyMethod(item.getGdType());
+                    vo.setSupplyType("2");
+                    vo.setDateType("2");
+                    List<Map<String, String>> geomDetailsList= nodeLandService.selectTGeomDbDetailsByNodeId(item.getId());
+                    if(CollectionUtils.isNotEmpty(geomDetailsList)){
+                        String geoms = geomDetailsList.stream().map(s->s.get("geom")).collect(Collectors.joining(","));
+                        vo.setGeom(geoms);
+                    }
+                    vo.setYear(DateUtils.parseDate(item.getHbcrhtDate()));
+                    vo.setArea(String.format("%.2f", item.getGdArea() == null ? BigDecimal.ZERO : item.getGdArea()));
+                    vo.setUseType(category);
+                    resList.add(vo);
+                }
+            }
+        }
+
+        if(StringUtils.isNotBlank(useType)){ //这里通过用途计算
+            resList = resList.stream().filter(s->s.getUseType().equals(useType)).collect(Collectors.toList());
+        }
+
+        return resList;
+    }
+
+
+
     public List<LandSupplyProjectVO> projectList(String year, Integer supplyType) {
         return projectList(year, supplyType, null);
     }
@@ -788,7 +884,7 @@ public class StorageServiceImpl {
 
     private String convertCategory(String category) {
         if (category == null || category.equals("未知") || category.equals("null") || category.trim().isEmpty()) {
-            return "其";
+            return "其";
         }
         return category;
     }
@@ -1014,5 +1110,18 @@ public class StorageServiceImpl {
         }
     }
 
+    public String getTdytByCode(String code) {
+        String name = "";
+        List<LandType> all = landTypeMapper.selectAll();
+        // 转换为节点
+        Optional<LandType> filterRes = all.stream().filter(s -> s.getCode().equalsIgnoreCase(code)).findFirst();
+        if (filterRes.isPresent()) {
+            name = filterRes.get().getName();
+        }
+        return name;
+    }
+
+
+
 
 }

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

@@ -302,9 +302,8 @@
         WHERE
             pro.on_chain_num > 0
           AND gd.has_onchain = 't'
-
         <if test="(startYear != null and startYear != null) and (endYear != '' and endYear != '')">
-            AND left(bp.pf_date,4)::NUMERIC BETWEEN #{startYear}::NUMERIC AND #{endYear}::NUMERIC
+            AND left(gd.hbcrht_date,4)::NUMERIC BETWEEN #{startYear}::NUMERIC AND #{endYear}::NUMERIC
         </if>
     </select>