Bläddra i källkod

feat: 不动产资源地图建筑列表接口添加省本部查询

weijianghai 1 år sedan
förälder
incheckning
8ae23a86d6

+ 12 - 1
scripts/8000.conf

@@ -1,7 +1,7 @@
 server {
     listen       8000 ssl;
     listen  [::]:8000 ssl;
-    server_name 133.96.95.30, 172.16.107.4, localhost;
+    server_name localhost;
 
     ssl_certificate /etc/nginx/ssl/server.crt;
     ssl_certificate_key /etc/nginx/ssl/server.key;
@@ -51,6 +51,17 @@ server {
         proxy_pass http://172.16.107.4:39203;
     }
 
+    # 车辆资源地图接口
+    location /house-car/car/resource-map/api {
+        proxy_pass http://172.16.107.4:39204;
+    }
+
+    # 车辆资源地图页面
+    location /house-car/car/resource-map {
+        rewrite ^/house-car/car/resource-map/(.*)$ /$1 break;
+        proxy_pass http://172.16.107.4:39204;
+    }
+
     # 不动产系统
     location /house-car/house/dist/ {
         proxy_pass http://172.16.107.4:39089/house/dist/;

+ 1 - 1
scripts/house-report/default.conf

@@ -1,7 +1,7 @@
 server {
     listen       39202;
     listen  [::]:39202;
-    server_name 133.96.95.30, 172.16.107.4, localhost;
+    server_name localhost;
 
     access_log access.log;
     error_log error.log;

+ 1 - 1
scripts/house-resource-map/default.conf

@@ -1,7 +1,7 @@
 server {
     listen       39201;
     listen  [::]:39201;
-    server_name 133.96.95.30, 172.16.107.4, localhost;
+    server_name localhost;
 
     access_log access.log;
     error_log error.log;

+ 127 - 4
src/main/java/com/nokia/financeapi/dao/house/HouseResourceMapMapper.java

@@ -197,7 +197,7 @@ where
     and district = #{dto.district}
 order by
     building_area desc
-limit 1
+limit 10
 ),
 t102 as (
 select
@@ -237,12 +237,11 @@ from
     t103
 order by
     building_area desc
-limit 150
 """)
     List<GetBuildingMapVo> getBuildingByDistrict(@Param("dto") GetBuildingMapDto dto);
 
     /**
-     * 获取坐标范围内的建筑,相同局址保留建筑面积最大的
+     * 获取坐标范围内的建筑,相同坐标保留建筑面积最大的
      */
     @Select("""
 with
@@ -425,7 +424,7 @@ order by create_time desc
     List<GetHouseNoticeVo> getNotice(@Param("dto") GetHouseNoticeDto dto);
 
     /**
-     * 获取区县内的建筑,相同局址保留建筑面积最大的
+     * 获取区县内的建筑,相同坐标保留建筑面积最大的
      */
     @Select("""
 with
@@ -486,4 +485,128 @@ order by
     building_area desc
 """)
     List<GetBuildingOptionsVo> getBuildingOptions(@Param("dto") GetBuildingOptionsDto dto);
+
+    /**
+     * 获取省本部建筑选项,相同坐标保留建筑面积最大的
+     */
+    @Select("""
+with
+t101 as (
+select
+    distinct on
+    (lng_bd09, lat_bd09) *
+from
+    house.building_month
+where
+    lng_bd09 is not null
+    and lat_bd09 is not null
+    and year_month = #{dto.endDate}
+    and area_name = #{dto.city}
+order by
+    lng_bd09,
+    lat_bd09,
+    building_area desc
+),
+t102 as (
+select
+    building_id,
+    sum(amount) as maintenance_cost
+from
+    house.building_repair_main_month
+where
+    repair_type != '财务预提冲销'
+    and exists (select 1 from t101 where t101.building_id = house.building_repair_main_month.building_id)
+    and year_month >= #{dto.startDate}
+    and year_month <= #{dto.endDate}
+group by
+    building_id
+),
+t103 as (
+select
+t101.*,
+t102.maintenance_cost
+from t101 left join t102 on t101.building_id = t102.building_id
+)
+select
+    building_id,
+    address,
+    area_sector,
+    building_name,
+    acquisition_date,
+    building_use,
+    building_area,
+    building_area_idle,
+    building_area_rent,
+    round(maintenance_cost, 2) as maintenance_cost,
+    building_img,
+    lng_bd09 as lng,
+    lat_bd09 as lat
+from
+    t103
+order by
+    building_area desc
+""")
+    List<GetBuildingOptionsVo> getSbbBuildingOptions(@Param("dto") GetBuildingOptionsDto dto);
+
+    /**
+     * 获取省本部建筑,相同坐标保留建筑面积最大的
+     */
+    @Select("""
+with
+t101 as (
+select
+    distinct on
+    (lng_bd09, lat_bd09) *
+from
+    house.building_month
+where
+    lng_bd09 is not null
+    and lat_bd09 is not null
+    and year_month = #{dto.endDate}
+    and area_name = #{dto.city}
+order by
+    lng_bd09,
+    lat_bd09,
+    building_area desc
+),
+t102 as (
+select
+    building_id,
+    sum(amount) as maintenance_cost
+from
+    house.building_repair_main_month
+where
+    repair_type != '财务预提冲销'
+    and exists (select 1 from t101 where t101.building_id = house.building_repair_main_month.building_id)
+    and year_month >= #{dto.startDate}
+    and year_month <= #{dto.endDate}
+group by
+    building_id
+),
+t103 as (
+select
+t101.*,
+t102.maintenance_cost
+from t101 left join t102 on t101.building_id = t102.building_id
+)
+select
+    building_id,
+    address,
+    area_sector,
+    building_name,
+    acquisition_date,
+    building_use,
+    building_area,
+    building_area_idle,
+    building_area_rent,
+    round(maintenance_cost, 2) as maintenance_cost,
+    building_img,
+    lng_bd09 as lng,
+    lat_bd09 as lat
+from
+    t103
+order by
+    building_area desc
+""")
+    List<GetBuildingMapVo> getSbbBuildings(@Param("dto") GetBuildingMapDto dto);
 }

+ 22 - 0
src/main/java/com/nokia/financeapi/service/house/HouseResourceMapService.java

@@ -86,6 +86,10 @@ public class HouseResourceMapService {
                 districtVoList.add(districtVo);
             }
         }
+        TreeAreaVo sbb = new TreeAreaVo();
+        sbb.setLabel("省本部");
+        sbb.setValue(-12);
+        cityVoList.add(sbb);
         return R.ok(vo);
     }
 
@@ -119,6 +123,15 @@ public class HouseResourceMapService {
         dto.setStartDate(startDate);
         // 坐标为空根据区县获取建筑
         if (dto.getLeftLng() == null || dto.getRightLng() == null || dto.getLeftLat() == null || dto.getRightLat() == null) {
+            if ("省本部".equals(dto.getCity())) {
+                List<GetBuildingMapVo> vo = houseResourceMapMapper.getSbbBuildings(dto);
+                vo.forEach(t -> {
+                    String buildingImg = fileService.getBucket()
+                            + (StringUtils.hasText(t.getBuildingImg()) ? t.getBuildingImg() : DEFAULT_BUILDING_IMG);
+                    t.setBuildingImg(buildingImg);
+                });
+                return R.ok(vo);
+            }
             List<GetBuildingMapVo> vo = houseResourceMapMapper.getBuildingByDistrict(dto);
             vo.forEach(t -> {
                 String buildingImg = fileService.getBucket()
@@ -247,6 +260,15 @@ public class HouseResourceMapService {
         LocalDate startLocalDate = endLocalDate.withDayOfYear(1);
         Integer startDate = Integer.valueOf(startLocalDate.format(DateTimeFormatter.ofPattern("yyyyMM")));
         dto.setStartDate(startDate);
+        if ("省本部".equals(dto.getCity())) {
+            List<GetBuildingOptionsVo> vo = houseResourceMapMapper.getSbbBuildingOptions(dto);
+            vo.forEach(t -> {
+                String buildingImg = fileService.getBucket()
+                        + (StringUtils.hasText(t.getBuildingImg()) ? t.getBuildingImg() : DEFAULT_BUILDING_IMG);
+                t.setBuildingImg(buildingImg);
+            });
+            return R.ok(vo);
+        }
         List<GetBuildingOptionsVo> vo = houseResourceMapMapper.getBuildingOptions(dto);
         vo.forEach(t -> {
             String buildingImg = fileService.getBucket()