Browse Source

总览接口修改

gushoubang 8 months ago
parent
commit
762756cc0e

+ 3 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/tdgy/TdgyMapper.java

@@ -3,6 +3,7 @@ package com.onemap.apply.mapper.tdgy;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.onemap.apply.domain.tdgy.dto.TdgySjDTO;
 import com.onemap.common.datasource.annotation.Slave;
+import io.swagger.models.auth.In;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -13,7 +14,8 @@ import java.util.Map;
 public interface TdgyMapper extends BaseMapper<TdgySjDTO> {
     List<Map<String, Object>> getSuspectedIdleLand(@Param("key") String key, @Param("xzqh") String xzqh, @Param("limit") Integer limit, @Param("offset") Integer offset);
 
-    String getLandGeometry(@Param("pid") Integer pid);
+    @Slave
+    Map<String, Object> getLandCountArea();
 
     @Slave
     Map<String, Object> getCountAreaSuspected();

+ 15 - 2
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/tdgy/TdtjServiceImp.java

@@ -6,6 +6,7 @@ import com.onemap.common.core.web.domain.RequestResult;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -17,13 +18,15 @@ public class TdtjServiceImp implements TdtjService {
     @Resource
     private TdgyMapper tdgyMapper;
 
+    // TODO:只统计22年~24年的数据
+
     @Override
     public RequestResult getOverview() {
+        Map<String, Object> map = new HashMap<>();
+
         // 获取疑似土地总数
         Map<String, Object> suspectedRes = tdgyMapper.getCountAreaSuspected();
 
-
-        Map<String, Object> map = new HashMap<>();
         Map<String, Object> mapSuspected = new HashMap<>();
         mapSuspected.put("area", suspectedRes.get("area"));
         mapSuspected.put("count", suspectedRes.get("total"));
@@ -45,6 +48,16 @@ public class TdtjServiceImp implements TdtjService {
         mapDisposal.put("count", disposalRes.get("total"));
         map.put("disposal", mapDisposal);
 
+        // 获取土地闲置率
+        Map<String, Object> landMap = tdgyMapper.getLandCountArea();
+        BigDecimal landArea = (BigDecimal) landMap.get("area");
+        BigDecimal confirmArea = (BigDecimal) confirmRes.get("area");
+        map.put("idleRate", confirmArea.floatValue() / landArea.floatValue());
+
+        // 获取闲置处置率
+        BigDecimal disposalArea = (BigDecimal) disposalRes.get("area");
+        map.put("disposalRate", disposalArea.floatValue() / confirmArea.floatValue());
+
         return RequestResult.success(map);
     }
 

+ 3 - 5
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/tdgy/TdgyMapper.xml

@@ -20,11 +20,9 @@
         LIMIT #{limit} OFFSET #{offset};
     </select>
 
-    <select id="getLandGeometry" resultType="String">
-        public.st_asewkt(public.st_union(geom))
-        from "TB_TDGY_SJ"
-        WHERE pid=
-        #{pid};
+    <select id="getLandCountArea" resultType="map">
+        select count(*) as total, sum(ts.crmj::NUMERIC) as area
+        from tdgy_sj ts
     </select>
 
     <select id="getCountAreaSuspected" resultType="map">