Browse Source

控制中心地图BUG

lin 4 năm trước cách đây
mục cha
commit
8ed4151990

+ 1 - 0
smart-city-platform/src/main/java/com/bz/smart_city/controller/system/BuildingController.java

@@ -362,6 +362,7 @@ public class BuildingController {
         buildingService.downTemplate(response);
     }
 
+    @Deprecated
     @ResponseBody
     @PostMapping("/importExcel")
     @ApiOperation(value = "Execl批量导入建筑", notes = "Execl批量导入建筑")

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

@@ -59,7 +59,7 @@ public interface BuildingMapper {
 
     Building findByBuildingName(@Param("buildingName") String buildingName);
 
-    List<BuildingInfoListDto> getBuildingStatistics(@Param("siteList") List<Integer> siteList, @Param("programItems") List<ProgramItem> programItems, @Param("sysId") Integer sysId, @Param("buildingId") String buildingId, @Param("buildingName") String buildingName, @Param("province") Integer province, @Param("city") Integer city, @Param("region") Integer region, @Param("community") Integer community, @Param("type") Integer type, @Param("longitudeMin") Double longitudeMin, @Param("longitudeMax") Double longitudeMax, @Param("latitudeMin") Double latitudeMin, @Param("latitudeMax") Double latitudeMax);
+    List<BuildingInfoListDto> getBuildingStatistics(@Param("siteList") List<Integer> siteList, @Param("programItems") List<ProgramItem> programItems, @Param("sysId") Integer sysId, @Param("buildingId") String buildingId, @Param("buildingName") String buildingName, @Param("province") Integer province, @Param("city") Integer city, @Param("region") Integer region, @Param("community") Integer community, @Param("type") Integer type, @Param("longitudeMin") Double longitudeMin, @Param("longitudeMax") Double longitudeMax, @Param("latitudeMin") Double latitudeMin, @Param("latitudeMax") Double latitudeMax, @Param("customerIds") List<Integer> customerIds);
 
     List<BuildingDto> getList(@Param("siteId") Integer siteId, @Param("buildingName") String buildingName, @Param("customerIds") List<Integer> customerIds);
 

+ 18 - 4
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/BuildingServiceImpl.java

@@ -987,7 +987,7 @@ public class BuildingServiceImpl implements BuildingService {
         //查询权限的场景ids
         List<Integer> channelIds = channelService.getUserChannelIds(loginUser);
 
-        List<BuildingInfoListDto> list = buildingMapper.getBuildingStatistics(siteList, UserUtil.getCurrentSiteProgramItems(loginUser), sysId, buildingId, buildingName, province, city, region, null, 0, null, null, null, null);
+        List<BuildingInfoListDto> list = buildingMapper.getBuildingStatistics(siteList, UserUtil.getCurrentSiteProgramItems(loginUser), sysId, buildingId, buildingName, province, city, region, null, 0, null, null, null, null, UserUtil.getCustomerIds());
         return list;
     }
 
@@ -1000,7 +1000,7 @@ public class BuildingServiceImpl implements BuildingService {
         List<Integer> buildingIds = this.getIdsByDataPermissionMultiSite();
         //查询权限的场景ids
         List<Integer> channelIds = channelService.getUserChannelIdsByMultiSite(loginUser);
-        return buildingMapper.getBuildingStatistics(siteList, UserUtil.getCurrentSiteProgramItems(loginUser), sysId, buildingId, buildingName, province, city, region, null, 0, null, null, null, null);
+        return buildingMapper.getBuildingStatistics(siteList, UserUtil.getCurrentSiteProgramItems(loginUser), sysId, buildingId, buildingName, province, city, region, null, 0, null, null, null, null, UserUtil.getCustomerIds());
     }
 
 
@@ -1031,8 +1031,15 @@ public class BuildingServiceImpl implements BuildingService {
             throw new ServiceException(-900, "建筑名称已经存在");
         }
 
+        Community community = communityMapper.findById(building.getCommunity());
         if(building.getProvince() == null || building.getProvince() == 0){
-            throw new ServiceException(-900, "获取省市区编码错误,请重新输入");
+            building.setProvince(community.getProvince());
+        }
+        if(building.getCity() == null || building.getCity() == 0){
+            building.setCity(community.getCity());
+        }
+        if(building.getRegion() == null || building.getRegion() == 0){
+            building.setRegion(community.getRegion());
         }
         building.setSiteId(loginUser.getSiteId());
         building.setStatus(1);
@@ -1088,8 +1095,15 @@ public class BuildingServiceImpl implements BuildingService {
         if (nameResult > 0) {
             throw new ServiceException(-900, "建筑名称已经存在");
         }
+        Community community = communityMapper.findById(building.getCommunity());
         if(building.getProvince() == null || building.getProvince() == 0){
-            throw new ServiceException(-900, "获取省市区编码错误,请重新输入");
+            building.setProvince(community.getProvince());
+        }
+        if(building.getCity() == null || building.getCity() == 0){
+            building.setCity(community.getCity());
+        }
+        if(building.getRegion() == null || building.getRegion() == 0){
+            building.setRegion(community.getRegion());
         }
         int result = this.updateByPrimaryKeySelective(building);
         //添加建筑

+ 18 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/CommunityServiceImpl.java

@@ -166,6 +166,15 @@ public class CommunityServiceImpl implements CommunityService{
         if (loginUser.getSiteType() == 1) {
             siteId = loginUser.getSiteId();
         }
+        if(communityDto.getProvince() == null || communityDto.getProvince() == 0){
+            throw new ServiceException(-900, "获取省编码错误,请重新输入");
+        }
+        if(communityDto.getCity() == null || communityDto.getCity() == 0){
+            throw new ServiceException(-900, "获取市编码错误,请重新输入");
+        }
+        if(communityDto.getRegion() == null || communityDto.getRegion() == 0){
+            throw new ServiceException(-900, "获取区编码错误,请重新输入");
+        }
         int resultName = communityMapper.findByNameUnique(siteId,null,communityDto.getProvince(),communityDto.getCity(),communityDto.getRegion(), communityDto.getName());
         if(resultName > 0) {
             throw new ServiceException(-900, "名称已经存在");
@@ -203,6 +212,15 @@ public class CommunityServiceImpl implements CommunityService{
         if (loginUser.getSiteType() == 1) {
             siteId = loginUser.getSiteId();
         }
+        if(community.getProvince() == null || community.getProvince() == 0){
+            throw new ServiceException(-900, "获取省编码错误,请重新输入");
+        }
+        if(community.getCity() == null || community.getCity() == 0){
+            throw new ServiceException(-900, "获取市编码错误,请重新输入");
+        }
+        if(community.getRegion() == null || community.getRegion() == 0){
+            throw new ServiceException(-900, "获取区编码错误,请重新输入");
+        }
         int resultName = communityMapper.findByNameUnique(siteId, community.getId(), community.getProvince(), community.getCity(), community.getRegion(), community.getName());
         if(resultName > 0) {
             throw new ServiceException(-900, "名称已经存在");

+ 2 - 4
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/StatAndAnalysisImpl.java

@@ -4,7 +4,6 @@ import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.util.*;
 
-import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.util.UserUtil;
 import com.bz.smart_city.commom.util.Util;
 import com.bz.smart_city.dao.*;
@@ -13,7 +12,6 @@ import com.bz.smart_city.entity.*;
 import com.bz.smart_city.service.BuildingService;
 
 import com.bz.smart_city.service.ChannelService;
-import com.bz.smart_city.service.DeviceService;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -425,7 +423,7 @@ public class StatAndAnalysisImpl implements StatAndAnalysisService {
         //设置当前站点
         List<Integer> siteList = UserUtil.getUserCurrentSiteIds();
 
-        List<BuildingInfoListDto> buildingInfoListDtoList = buildingMapper.getBuildingStatistics(siteList, UserUtil.getCurrentSiteProgramItems(loginUser), sysId, null, null, province, city, region,  community, type, longitudeMin, longitudeMax, latitudeMin, latitudeMax);
+        List<BuildingInfoListDto> buildingInfoListDtoList = buildingMapper.getBuildingStatistics(siteList, UserUtil.getCurrentSiteProgramItems(loginUser), sysId, null, null, province, city, region,  community, type, longitudeMin, longitudeMax, latitudeMin, latitudeMax, UserUtil.getCustomerIds());
         return this.mapStatistical(type, buildingInfoListDtoList);
     }
 
@@ -450,7 +448,7 @@ public class StatAndAnalysisImpl implements StatAndAnalysisService {
         //设置站点
         List<Integer> siteList = UserUtil.getUserAllSiteIds();
 
-        List<BuildingInfoListDto> buildingInfoListDtoList = buildingMapper.getBuildingStatistics(siteList, UserUtil.getAllSiteProgramItems(loginUser), sysId, null, null, province, city, region, community,type, longitudeMin, longitudeMax, latitudeMin, latitudeMax);
+        List<BuildingInfoListDto> buildingInfoListDtoList = buildingMapper.getBuildingStatistics(siteList, UserUtil.getAllSiteProgramItems(loginUser), sysId, null, null, province, city, region, community,type, longitudeMin, longitudeMax, latitudeMin, latitudeMax,UserUtil.getCustomerIds());
         return this.mapStatistical(type, buildingInfoListDtoList);
     }
 

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

@@ -975,6 +975,9 @@
         <if test="community != null"> AND sb.community = #{community}</if>
         <if test="type != null and (type == 4 or type == 5) and longitudeMin != 0 and longitudeMax != 0"> and sb.longitude > #{longitudeMin} AND sb.longitude <![CDATA[  < ]]> #{longitudeMax} </if>
         <if test="type != null and (type == 4 or type == 5) and latitudeMin != 0 and latitudeMax != 0"> and sb.latitude > #{latitudeMin} AND sb.latitude <![CDATA[  < ]]> #{latitudeMax} </if>
+        <if test="customerIds != null and customerIds.size() != 0">
+            and sc.customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach>
+        </if>
         order by sb.update_date desc
     </select>