Ver Fonte

一体化设备地图修改

hym há 3 anos atrás
pai
commit
879b0f98b4

+ 5 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/BuildingMapper.java

@@ -84,5 +84,10 @@ public interface BuildingMapper {
     int countBycCommunityId(@Param("communityId") Integer communityId);
 
     int findByNameUnique(@Param("id") Integer id, @Param("siteId") Integer siteId, @Param("community") Integer community, @Param("name") String name);
+
+    List<BuildingInfoListDto> obtainBuildingInformationOnTheIntegratedMap
+            (@Param("programItems")List<ProgramItem> programItemDtos,@Param("longitudeMin") Double longitudeMin,
+             @Param("longitudeMax") Double longitudeMax, @Param("latitudeMin") Double latitudeMin,
+             @Param("latitudeMax") Double latitudeMax);
 }
 

+ 5 - 2
smart-city-platform/src/main/java/com/bz/smart_city/service/sync/PlatformAapiServiceImpl.java

@@ -137,10 +137,13 @@ public class PlatformAapiServiceImpl implements PlatformAapiService {
         if(programItemDtos.isEmpty()){
             return new ArrayList<>();
         }
-        List<BuildingInfoListDto>buildingInfoListDtos=buildingMapper.getBuildingStatistics(siteList, programItemDtos, null, null, null,
+        List<BuildingInfoListDto>buildingInfoListDtos=buildingMapper.
+                obtainBuildingInformationOnTheIntegratedMap(programItemDtos,longitudeMin,
+                        longitudeMax, latitudeMin, latitudeMax);
+              /*  buildingMapper.getBuildingStatistics(siteList, programItemDtos, null, null, null,
                 queryDeviceMonitorDto.getProvince(), queryDeviceMonitorDto.getCity(), queryDeviceMonitorDto.getRegion(),
                 queryDeviceMonitorDto.getCommunity(),queryDeviceMonitorDto.getType(),
-                longitudeMin, longitudeMax, latitudeMin, latitudeMax,null);
+                longitudeMin, longitudeMax, latitudeMin, latitudeMax,null);*/
         List<MapStatisticalDto> mapStatisticalDtos = statAndAnalysisService.mapStatistical(queryDeviceMonitorDto.getType(), buildingInfoListDtos);
         return mapStatisticalDtos;
     }

+ 52 - 0
smart-city-platform/src/main/resources/mapper/BuildingMapper.xml

@@ -1306,6 +1306,58 @@
         select count(1) from sc_building where status = 1 and name = #{name} and site_id = #{siteId} and community = #{community}
         <if test="id != null"> and id != #{id}</if>
     </select>
+    <select id="obtainBuildingInformationOnTheIntegratedMap"
+            resultType="com.bz.smart_city.dto.BuildingInfoListDto">
+        select
+        sb.id as building_id,
+        sb.name as building_name,
+        sb.address ,
+        sb.province,
+        sb.city,
+        sb.region,
+        sb.community,
+        sa1.name as province_name,
+        sa2.name as city_name,
+        sa3.name as region_name,
+        sc.name as community_name,
+        sb.latitude,
+        sb.longitude,
+        temp.device_count,
+        temp.normal_count,
+        temp.alarm_count,
+        temp.fault_count,
+        temp.offline_count,
+        temp.device_unused_count
+        from sc_building sb
+        JOIN(
+        SELECT
+        sd.building_id,
+        count(1) as device_count,
+        SUM(IF(sd.device_status = 1, 1, 0)) as normal_count,
+        SUM(IF(sd.device_status = 2, 1, 0)) as alarm_count,
+        SUM(IF(sd.device_status = 3, 1, 0)) as fault_count,
+        SUM(IF(sd.device_status = 4, 1, 0)) as offline_count,
+        SUM(IF(sd.device_status = 5, 1, 0)) as device_unused_count
+        from sc_device sd
+        <if test="programItems != null and programItems.size() != 0">
+            left join sc_device_dimension sdd on (sdd.device_id = sd.id and sdd.status = 1)</if>
+        WHERE sd.status = 1 and sd.sys_id != -99
+       <if test="programItems != null and programItems.size() != 0"> and
+            <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
+                sdd.${item.dimensionCode} = #{item.dimensionValue}
+            </foreach>
+        </if>
+        GROUP BY sd.building_id
+        ) temp on (sb.id = temp.building_id)
+        left join sc_area sa1 on sa1.id = sb.province
+        left join sc_area sa2 on sa2.id = sb.city
+        left join sc_area sa3 on sa3.id = sb.region
+        left join sc_community sc on sc.id = sb.community
+        where sb.status = 1
+        <if test=" longitudeMin != 0 and longitudeMax != 0"> and sb.longitude > #{longitudeMin} AND sb.longitude <![CDATA[  < ]]> #{longitudeMax} </if>
+        <if test=" latitudeMin != 0 and latitudeMax != 0"> and sb.latitude > #{latitudeMin} AND sb.latitude <![CDATA[  < ]]> #{latitudeMax} </if>
+
+    </select>
 
 
 </mapper>