1
0
chenendian 2 дней назад
Родитель
Сommit
0adc45a5d0

+ 168 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/ReportBatchController.java

@@ -0,0 +1,168 @@
+package com.siwei.apply.controller.cadastre;
+
+import com.siwei.apply.domain.GongdiJihua;
+import com.siwei.apply.domain.LandType;
+import com.siwei.apply.domain.cadastre.LandSupplyReportDTO;
+import com.siwei.apply.domain.res.BatchRateRes;
+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.LandSupplyReportVO;
+import com.siwei.apply.domain.vo.YdbpDataFilterVo;
+import com.siwei.apply.service.cadastre.ISupplyService;
+import com.siwei.apply.service.cadastre.impl.BatchServiceImpl;
+import com.siwei.apply.service.cadastre.impl.StorageServiceImpl;
+import com.siwei.common.core.domain.R;
+import com.siwei.common.core.web.controller.BaseController;
+import org.apache.poi.ss.usermodel.*;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * 批次报批数据分析
+ *
+ */
+@RestController
+@RequestMapping("/cadastre/batch")
+public class ReportBatchController extends BaseController {
+
+    @Autowired
+    private ISupplyService supplyService;
+
+
+    @Autowired
+    private BatchServiceImpl batchServiceImpl;
+
+
+    /**
+     *
+     * 年度统计
+     *
+     */
+    @GetMapping("/yearStatistics/{year}")
+    public R<BatchRateRes> getYearStatistics(@PathVariable String year) {
+        try {
+            BatchRateRes res =  batchServiceImpl.yearStatistics(year);
+            return R.ok(res);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+
+
+
+
+    /**
+     *
+     * 趋势分析
+     */
+    @GetMapping("/trendStatistics")
+    public R<BatchRateRes> getTrendStatistics() {
+        try {
+            BatchRateRes res =  batchServiceImpl.trendStatistics("");
+            return R.ok(res);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+    /**
+     * 根据年份和供地类型查询土地供应统计报表数据
+     * @param year
+     * @param supplyType (1-计划,2-完成)
+     * @return
+     */
+    @GetMapping("/projectList")
+    public R<List<LandSupplyProjectVO>> getProjectList(@RequestParam(required = false) 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("/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());
+        }
+    }
+
+
+    @GetMapping("/getActualProject")
+    public R<Map<String,Object>> getActualProject(@RequestParam String propertyId) {
+        try {
+            Map<String,Object> res =  supplyService.getActualProject(propertyId);
+            return R.ok(res);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+    /**
+     *
+     * 根据时间范围查询土地供应统计报表数据
+     * 供应用途分析报表
+     *
+     */
+    @GetMapping("/report/purpose")
+    public R<LandSupplyReportVO> getTdgyProjectList(@RequestParam String startYear, @RequestParam String endYear) {
+        try {
+            LandSupplyReportVO res =  supplyService.getTdgyPurposeReport(startYear,endYear);
+            return R.ok(res);
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+
+    @GetMapping("/landTypeList")
+    public R<List<LandType>> getLandTypeList() {
+        try {
+            return R.ok(supplyService.getLandTypeList());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+
+
+
+
+
+
+}

+ 18 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/res/BatchRateRes.java

@@ -0,0 +1,18 @@
+package com.siwei.apply.domain.res;
+
+import lombok.Data;
+
+/**
+ * 报批年份统计vo
+ *
+ */
+@Data
+public class BatchRateRes {
+    private Integer batchProjectCount = 0;
+    private Double  batchArea= 0d;
+    private Integer  singleProjectCount= 0;
+    private Double  singleArea= 0d;
+    private Integer  allProjectCount= 0;
+    private Double  allArea= 0d;
+    private String areaUnit= "亩";// 面积单位
+}

+ 4 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/YdbpDataMapper.java

@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface YdbpDataMapper {
@@ -52,6 +53,9 @@ public interface YdbpDataMapper {
 
     void updateHasOnchain(@Param("id") String id, @Param("hasOnchain") Boolean hasOnchain);
 
+    List<YdbpData> getStatisticsList(@Param("year") String year);
+
+
 
 
 }

+ 9 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/YdbpMapper.java

@@ -5,6 +5,9 @@ import com.siwei.apply.domain.vo.YdbpUpdateVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+import java.util.Map;
+
 // 用地报批 Mapper 接口
 @Mapper
 public interface YdbpMapper {
@@ -49,4 +52,10 @@ public interface YdbpMapper {
      * @param hasOnchain 是否已上链
      */
     void updateHasOnchain(@Param("id") String id, @Param("hasOnchain") Boolean hasOnchain);
+
+
+
+    List<Map<String, Object>> getStatisticsList(@Param("year") String year);
+
+
 }

+ 104 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/BatchServiceImpl.java

@@ -0,0 +1,104 @@
+package com.siwei.apply.service.cadastre.impl;
+
+import com.siwei.apply.domain.YdbpData;
+import com.siwei.apply.domain.res.*;
+import com.siwei.apply.mapper.*;
+import com.siwei.common.core.utils.StringUtils;
+import com.siwei.spatial.api.RemoteSpatialFilesDbService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+
+
+@Slf4j
+@Service
+public class BatchServiceImpl{
+
+    @Autowired
+    private GongdiJihuaMapper gongdiJihuaMapper;
+
+    @Autowired
+    private TdgyMapper dgyMapper;
+
+    @Autowired
+    private LandTypeMapper landTypeMapper;
+
+    @Autowired
+    private RemoteSpatialFilesDbService remoteSpatialFilesDbService;
+
+    @Autowired
+    private YdbpMapper ydbpMapper;
+
+    @Autowired
+    private YdbpDataMapper ydbpDataMapper;
+
+
+
+
+
+    /**
+     * 年度统计
+     * @param year
+     * @return
+     */
+    public BatchRateRes trendStatistics(String year) {
+        if (StringUtils.isBlank(year) || "0".equals(year)) {
+            year = "";
+        }
+        BatchRateRes res = new BatchRateRes();
+        return null;
+    }
+
+
+    /**
+     * 年度统计
+     * @param year
+     * @return
+     */
+    public BatchRateRes yearStatistics(String year) {
+        if(StringUtils.isBlank(year)||"0".equals(year)){
+            year="";
+        }
+        BatchRateRes res = new BatchRateRes();
+        List<Map<String,Object>> singleBatchList =  ydbpMapper.getStatisticsList(year);
+        List<YdbpData> reportBatchList =  ydbpDataMapper.getStatisticsList(year);
+        if(CollectionUtils.isNotEmpty(singleBatchList)) {
+            res.setSingleArea(sumAreaForSingle(singleBatchList));
+            res.setSingleProjectCount(singleBatchList.size());
+        }
+        if(CollectionUtils.isNotEmpty(reportBatchList)) {
+            res.setBatchArea(sumArea(reportBatchList));
+            res.setBatchProjectCount(reportBatchList.size());
+        }
+        res.setAllArea(res.getSingleArea() + res.getBatchArea());
+        res.setAllProjectCount(res.getSingleProjectCount() + res.getBatchProjectCount());
+        return res;
+    }
+
+    private Double sumAreaForSingle(List<Map<String,Object>> list) {
+        Double sum = 0d;
+        if (CollectionUtils.isNotEmpty(list)) {
+            for (Map<String,Object> item : list) {
+                sum += item.get("mj_mu") == null ? 0d : (Double) item.get("mj_mu");
+            }
+        }
+        return Math.round(sum * 100) / 100.0;
+    }
+
+
+    private Double sumArea(List<YdbpData> list) {
+        double sum = 0d;
+        if (CollectionUtils.isNotEmpty(list)) {
+            for (YdbpData item : list) {
+                sum += item.getZsArea() == null ? 0 : item.getZsArea();
+            }
+        }
+        return Math.round(sum * 100) / 100.0;
+    }
+
+}

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

@@ -136,7 +136,8 @@
                         WHEN t_node.gd_unit = '平方米' THEN
                             COALESCE ( t_node.gd_area, 0 ) / 666.6666667-- 平方米 -> 亩
                         WHEN t_node.gd_unit = '公顷' THEN
-                            COALESCE ( t_node.gd_area, 0 ) * 15-- 公顷 -> 亩 ELSE COALESCE ( t_node.gd_area, 0 ) -- 默认当作亩(含 '2')
+                            COALESCE ( t_node.gd_area, 0 ) * 15-- 公顷 -> 亩
+                            ELSE COALESCE ( t_node.gd_area, 0 ) -- 默认当作亩(含 '2')
                         END,
                     0
             ) AS mjMu,

+ 29 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/YdbpDataMapper.xml

@@ -109,4 +109,33 @@
         SET has_onchain = #{hasOnchain}, updated_at = now()
         WHERE id = #{id}
     </update>
+
+    <select id="getStatisticsList" resultMap="YdbpDataResultMap">
+        select
+        COALESCE (
+            CASE
+            WHEN zs_unit = '平方米' THEN
+            COALESCE ( zs_area, 0 ) / 666.6666667
+            WHEN zs_unit = '公顷' THEN
+            COALESCE ( zs_area, 0 ) * 15
+            WHEN zs_unit = '亩' THEN
+            COALESCE ( zs_area, 0 ) * 1
+            END,
+            0
+        ) AS zs_area ,
+        '亩' as  zs_unit,
+        has_zz, bp_date, pfwh, pf_date, creator_id, created_at, updated_at,has_onchain
+        FROM t_ydbp_data
+        WHERE has_onchain='t'
+        <if test="year != null and year != '' ">
+            AND left(pf_date,4) = #{year}
+        </if>
+    </select>
+
+
+
+
+
+
+
 </mapper>

+ 31 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/YdbpMapper.xml

@@ -48,6 +48,37 @@
         WHERE id = #{id}
     </select>
 
+    <select id="getStatisticsList" resultType="map">
+        SELECT
+            pro.ID AS project_id,
+            bp.ID AS node_id,
+            bp.zs_area,
+            bp.zs_unit,
+            COALESCE (
+                    CASE
+                        WHEN bp.zs_unit = '平方米' THEN
+                            COALESCE ( bp.zs_area, 0 ) / 666.6666667
+                        WHEN bp.zs_unit = '公顷' THEN
+                            COALESCE ( bp.zs_area, 0 ) * 15
+                        WHEN bp.zs_unit = '亩' THEN
+                            COALESCE ( bp.zs_area, 0 ) * 1
+                        END,
+                    0
+            ) AS mj_mu
+        FROM
+            t_ydbp bp
+                LEFT JOIN t_project pro ON bp.project_id = pro."id"
+        WHERE
+            pro.on_chain_num > 0
+          AND bp.has_onchain = 't'
+        <if test="year != null and year != '' ">
+            AND left(bp.pf_date,4) = #{year}
+        </if>
+    </select>
+
+
+
+
 
     <!-- 更新语句 -->
     <update id="update" parameterType="com.siwei.apply.domain.vo.YdbpUpdateVo">