1
0
فهرست منبع

土地供应统计增加存量数据

chenendian 2 هفته پیش
والد
کامیت
8723e5fd54

+ 43 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/third/OfferDataController.java

@@ -201,6 +201,44 @@ public class OfferDataController extends BaseController {
         }
     }
 
+
+    /**
+     * 单个文件下载
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @PostMapping("/download")
+    public ResponseEntity<Resource> uploadAttachment(@RequestBody Map<String,String> param, HttpServletRequest request, HttpServletResponse response) {
+        try {
+            String filePath =  param.get("filePath");
+            if (StringUtils.isBlank(filePath)) {
+                return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
+            }
+            Path path = Paths.get(filePath);
+            File file = path.toFile();
+            Resource resource = new FileSystemResource(file);
+            if (!resource.exists()) {
+                return ResponseEntity.notFound().build();
+            }
+            String contentType = Files.probeContentType(path);
+            if (contentType == null) {
+                contentType = MediaType.APPLICATION_OCTET_STREAM_VALUE;
+            }
+            String encodedName = URLEncoder.encode(file.getName(), "UTF-8");
+            HttpHeaders headers = new HttpHeaders();
+            headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + encodedName);
+            headers.setContentType(MediaType.parseMediaType(contentType));
+            return ResponseEntity.ok().headers(headers).contentLength(Files.size(path)).body(resource);
+        } catch (Exception e) {
+            return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
+        }
+    }
+
+
+
+
     /**
      * 文件下载
      *
@@ -248,4 +286,9 @@ public class OfferDataController extends BaseController {
         }
     }
 
+
+
+
+
+
 }

+ 1 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/TdgyMapper.java

@@ -60,6 +60,7 @@ public interface TdgyMapper {
 
 
     List<TdgyStatisticsRes> getListByYear(@Param("year") String year,@Param("landTypeCode") String landTypeCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    List<TdgyStatisticsRes> getSjgdListByYear(@Param("year") String year,@Param("landTypeCode") String landTypeCode, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
 
 

+ 72 - 27
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/SupplyServiceImpl.java

@@ -17,7 +17,6 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.time.LocalDate;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -39,7 +38,6 @@ public class SupplyServiceImpl implements ISupplyService {
     @Override
     public Object GetList(String param) {
 
-
         return null;
     }
 
@@ -56,7 +54,17 @@ public class SupplyServiceImpl implements ISupplyService {
         filterVo.setYear(year);
         filterVo.setPageSize(100000);
         List<GongdiJihua> list = gongdiJihuaMapper.getList(filterVo);
-        List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(year, null, null, null);
+
+        //这里合并两部分数据
+        List<TdgyStatisticsRes> completeList = new ArrayList<>();
+        List<TdgyStatisticsRes> completeBusinessStatusList = dgyMapper.getListByYear(year, null, null, null);
+        List<TdgyStatisticsRes> completeSjgdList = dgyMapper.getSjgdListByYear(year, null, null, null);
+        if(CollectionUtils.isNotEmpty(completeBusinessStatusList)){
+            completeList.addAll(completeBusinessStatusList);
+        }
+        if(CollectionUtils.isNotEmpty(completeSjgdList)){
+            completeList.addAll(completeSjgdList);
+        }
 
         if(CollectionUtils.isNotEmpty(list)) {
             double completeRate =0;
@@ -191,14 +199,18 @@ public class SupplyServiceImpl implements ISupplyService {
      */
     @Override
     public TrendStatisticsRes trendStatistics(String landType) {
+        //这里合并两部分数据
+        List<TdgyStatisticsRes> completeList = new ArrayList<>();
+        List<TdgyStatisticsRes> completeBusinessStatusList = dgyMapper.getListByYear(null, landType, null, null);
+        List<TdgyStatisticsRes> completeSjgdList = dgyMapper.getSjgdListByYear(null, landType, null, null);
+        if(CollectionUtils.isNotEmpty(completeBusinessStatusList)){
+            completeList.addAll(completeBusinessStatusList);
+        }
+        if(CollectionUtils.isNotEmpty(completeSjgdList)){
+            completeList.addAll(completeSjgdList);
+        }
 
 
-
-
-
-
-        List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(null, landType, null, null);
-
         TrendStatisticsRes res = new TrendStatisticsRes();
         List<Map<String, Object>> areaTrendStatisticsList = new ArrayList<>();
         List<Map<String, Object>> supplyModeStatisticsList = new ArrayList<>();
@@ -253,10 +265,16 @@ public class SupplyServiceImpl implements ISupplyService {
         LandSupplyReportDTO report = new LandSupplyReportDTO();
         report.setTitle("土地供应进度分析报表");
         report.setStatTimeRange(startTime + " 至 " + endTime);
-
-        // 获取时间范围内的完成数据
-        List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(null, null, startTime, endTime);
-
+        //获取时间范围内的完成数据
+        List<TdgyStatisticsRes> completeList = new ArrayList<>();
+        List<TdgyStatisticsRes> completeBusinessStatusList = dgyMapper.getListByYear(null, null,  startTime, endTime);
+        List<TdgyStatisticsRes> completeSjgdList = dgyMapper.getSjgdListByYear(null, null,  startTime, endTime);
+        if(CollectionUtils.isNotEmpty(completeBusinessStatusList)){
+            completeList.addAll(completeBusinessStatusList);
+        }
+        if(CollectionUtils.isNotEmpty(completeSjgdList)){
+            completeList.addAll(completeSjgdList);
+        }
         // 获取时间范围内的计划数据
         Map<String, Object> planSummary = gongdiJihuaMapper.getPlanSummaryByTimeRange(startTime, endTime);
         List<Map<String, Object>> planStatsByLandType = gongdiJihuaMapper.getPlanStatsByLandType(startTime, endTime);
@@ -403,10 +421,21 @@ public class SupplyServiceImpl implements ISupplyService {
     public LandSupplyReportVO getTdgyPurposeReport(String startYear, String endYear){
         //List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(null, null, startYear, endYear);
         //todo 这里需要修改
-        SupplyYearStatisticsRes res = new SupplyYearStatisticsRes();
-        GongdiJihuaFilterVo filterVo = new GongdiJihuaFilterVo();
-        filterVo.setPageSize(100000);
-        List<GongdiJihua> completeList = gongdiJihuaMapper.getList(filterVo);
+//        SupplyYearStatisticsRes res = new SupplyYearStatisticsRes();
+//        GongdiJihuaFilterVo filterVo = new GongdiJihuaFilterVo();
+//        filterVo.setPageSize(100000);
+//        List<GongdiJihua> completeList = gongdiJihuaMapper.getList(filterVo);
+
+        //这里合并两部分数据
+        List<TdgyStatisticsRes> completeList = new ArrayList<>();
+        List<TdgyStatisticsRes> completeBusinessStatusList = dgyMapper.getListByYear(null, null, startYear, endYear);
+        List<TdgyStatisticsRes> completeSjgdList = dgyMapper.getSjgdListByYear(null, null, startYear, endYear);
+        if(CollectionUtils.isNotEmpty(completeBusinessStatusList)){
+            completeList.addAll(completeBusinessStatusList);
+        }
+        if(CollectionUtils.isNotEmpty(completeSjgdList)){
+            completeList.addAll(completeSjgdList);
+        }
 
         if (CollectionUtils.isEmpty(completeList)) {
             return new LandSupplyReportVO();
@@ -421,7 +450,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);
             }
@@ -432,11 +461,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());
-            //todo 这里需要修改
-            //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()) ? "出让" : "其他");
@@ -529,8 +557,18 @@ public class SupplyServiceImpl implements ISupplyService {
                 return vo;
             }).collect(Collectors.toList());
         }else if(supplyType == 2){
-             List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(year, null, null, null);
-             resList = completeList.stream().map(item -> {
+            //这里合并两部分数据
+            List<TdgyStatisticsRes> completeList = new ArrayList<>();
+            List<TdgyStatisticsRes> completeBusinessStatusList = dgyMapper.getListByYear(year, null, null, null);
+            List<TdgyStatisticsRes> completeSjgdList = dgyMapper.getSjgdListByYear(year, null, null, null);
+            if(CollectionUtils.isNotEmpty(completeBusinessStatusList)){
+                completeList.addAll(completeBusinessStatusList);
+            }
+            if(CollectionUtils.isNotEmpty(completeSjgdList)){
+                completeList.addAll(completeSjgdList);
+            }
+
+            resList = completeList.stream().map(item -> {
                  LandSupplyProjectVO vo = new LandSupplyProjectVO();
                  vo.setProjectPropertyId(item.getProjectId());
                  vo.setProjectName(item.getXmmc());
@@ -558,9 +596,16 @@ public class SupplyServiceImpl implements ISupplyService {
                 vo.setGeom(item.getGeom());
                 return vo;
             }).collect(Collectors.toList());
-
-
-            List<TdgyStatisticsRes> completeList = dgyMapper.getListByYear(year, null, null, null);
+            //这里合并两部分数据
+            List<TdgyStatisticsRes> completeList = new ArrayList<>();
+            List<TdgyStatisticsRes> completeBusinessStatusList = dgyMapper.getListByYear(year, null, null, null);
+            List<TdgyStatisticsRes> completeSjgdList = dgyMapper.getSjgdListByYear(year, null, null, null);
+            if(CollectionUtils.isNotEmpty(completeBusinessStatusList)){
+                completeList.addAll(completeBusinessStatusList);
+            }
+            if(CollectionUtils.isNotEmpty(completeSjgdList)){
+                completeList.addAll(completeSjgdList);
+            }
             List<LandSupplyProjectVO> resList2 = completeList.stream().map(item -> {
                 LandSupplyProjectVO vo = new LandSupplyProjectVO();
                 vo.setProjectPropertyId(item.getProjectId());

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

@@ -169,6 +169,39 @@
         </if>
     </select>
 
-
+    <!-- 查询当前存量土地实际供应情况! -->
+    <select id="getSjgdListByYear" resultType="com.siwei.apply.domain.res.TdgyStatisticsRes" parameterType="String">
+        SELECT
+        '' AS projectId,
+        xmmc AS xmmc,
+        srr AS company,
+        gid AS nodeId,
+        COALESCE ( land.code, '23' ) AS tdyt,
+        gyfs,
+        qdrq AS gysj,
+        ROUND(COALESCE ( gymj, 0 ) / 666.6666667,2)     AS mjMu,-- 平方米 -> 亩
+        '' AS geomDbId,
+        '' AS uploadId,
+        '' AS geomJson,
+        0 AS sort,
+        shape_area AS geomArea,
+        ST_AsEWKT ( geom ) AS geom
+        FROM
+        vector.gj_gd_data
+        LEFT JOIN public.land_type land ON land.NAME = gj_gd_data.tdyt
+        WHERE 1=1
+        <if test="year != null">
+            AND  LEFT(gj_gd_data.qdrq, 4) = #{year}
+        </if>
+        <if test="landTypeCode != null">
+            AND LEFT(land.code,2)=#{landTypeCode}
+        </if>
+        <if test="startTime != null and startTime != ''">
+            AND CAST(gj_gd_data.qdrq AS VARCHAR) &gt;= #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            AND CAST(gj_gd_data.qdrq AS VARCHAR) &lt;= #{endTime}
+        </if>
+    </select>
 
 </mapper>