|  | @@ -1,20 +1,19 @@
 | 
	
		
			
				|  |  |  package com.bz.smart_city.service.sync;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import com.bz.smart_city.dao.CustomerMapper;
 | 
	
		
			
				|  |  | -import com.bz.smart_city.dao.DeviceMapper;
 | 
	
		
			
				|  |  | -import com.bz.smart_city.dao.OperatingValveRecordMapper;
 | 
	
		
			
				|  |  | -import com.bz.smart_city.dao.UserMapper;
 | 
	
		
			
				|  |  | +import com.bz.smart_city.commom.model.Pagination;
 | 
	
		
			
				|  |  | +import com.bz.smart_city.dao.*;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.dao.assistant.InstallListMapper;
 | 
	
		
			
				|  |  | -import com.bz.smart_city.dao.assistant.InstallPlanMapper;
 | 
	
		
			
				|  |  | -import com.bz.smart_city.dto.ProgramItemDto;
 | 
	
		
			
				|  |  | +import com.bz.smart_city.dto.*;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.entity.*;
 | 
	
		
			
				|  |  | -import com.bz.smart_city.entity.assistant.InstallPlan;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.service.DeviceService;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.service.PlatformAapiService;
 | 
	
		
			
				|  |  | +import com.bz.smart_city.service.StatAndAnalysisService;
 | 
	
		
			
				|  |  | +import com.github.pagehelper.PageHelper;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | -import org.springframework.kafka.annotation.KafkaListener;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import javax.annotation.Resource;
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -32,6 +31,10 @@ public class PlatformAapiServiceImpl implements PlatformAapiService {
 | 
	
		
			
				|  |  |      private InstallListMapper installListMapper;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private UserMapper userMapper;
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    private BuildingMapper buildingMapper;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private StatAndAnalysisService statAndAnalysisService;
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void updateMeterNo(String meterNo, String meterCode, String customerNo) {
 | 
	
		
			
				|  |  |          Customer customer = customerMapper.findBySiteIdAndCustomerNo(null, customerNo);
 | 
	
	
		
			
				|  | @@ -102,6 +105,59 @@ public class PlatformAapiServiceImpl implements PlatformAapiService {
 | 
	
		
			
				|  |  |          // ;
 | 
	
		
			
				|  |  |          return result;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    private Double[]getCoordinate(String preCoordinate){
 | 
	
		
			
				|  |  | +         Double[]coordinates=new Double[2];
 | 
	
		
			
				|  |  | +        String[] preCoordinates = StringUtils.split(preCoordinate, ",");
 | 
	
		
			
				|  |  | +        coordinates[0]=Double.valueOf(preCoordinates[0]);
 | 
	
		
			
				|  |  | +        coordinates[1]=Double.valueOf(preCoordinates[1]);
 | 
	
		
			
				|  |  | +        return coordinates;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public List<MapStatisticalDto> getTheMapInformationOfTheDevice(QueryDeviceMonitorDto queryDeviceMonitorDto) {
 | 
	
		
			
				|  |  | +        List<Integer>siteList=new ArrayList<>();
 | 
	
		
			
				|  |  | +        siteList.add(1);
 | 
	
		
			
				|  |  | +        Double longitudeMin = 0d;
 | 
	
		
			
				|  |  | +        Double longitudeMax = 0d;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Double latitudeMin = 0d;
 | 
	
		
			
				|  |  | +        Double latitudeMax = 0d;
 | 
	
		
			
				|  |  | +        String northEast=queryDeviceMonitorDto.getNorthEast();
 | 
	
		
			
				|  |  | +        String southWest=queryDeviceMonitorDto.getSouthWest();
 | 
	
		
			
				|  |  | +        if (northEast != null && southWest != null) {
 | 
	
		
			
				|  |  | +            Double[]northEastDouble = getCoordinate(northEast);
 | 
	
		
			
				|  |  | +            Double[] southWestDouble =getCoordinate(southWest);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            longitudeMin =southWestDouble [0];
 | 
	
		
			
				|  |  | +            longitudeMax = northEastDouble[0];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            latitudeMin =southWestDouble [1];
 | 
	
		
			
				|  |  | +            latitudeMax = northEastDouble[1];
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<ProgramItem>programItemDtos = userMapper.findAuthByTenantId(queryDeviceMonitorDto.getTenantId());
 | 
	
		
			
				|  |  | +        if(programItemDtos.isEmpty()){
 | 
	
		
			
				|  |  | +            return new ArrayList<>();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        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);*/
 | 
	
		
			
				|  |  | +        List<MapStatisticalDto> mapStatisticalDtos = statAndAnalysisService.mapStatistical(queryDeviceMonitorDto.getType(), buildingInfoListDtos);
 | 
	
		
			
				|  |  | +        return mapStatisticalDtos;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public Pagination<DeviceDto> getDeviceListInformation(QueryDeviceMonitorDto queryDeviceMonitorDto) {
 | 
	
		
			
				|  |  | +        List<ProgramItem>programItemDtos = userMapper.findAuthByTenantId(queryDeviceMonitorDto.getTenantId());
 | 
	
		
			
				|  |  | +        if(programItemDtos.isEmpty()){
 | 
	
		
			
				|  |  | +            return new Pagination<>();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        PageHelper.startPage(queryDeviceMonitorDto.getPage(), queryDeviceMonitorDto.getSize());
 | 
	
		
			
				|  |  | +        List<DeviceDto> list =deviceMapper.findDevicesOnTheMap(queryDeviceMonitorDto,programItemDtos);
 | 
	
		
			
				|  |  | +        return new Pagination<>(list);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private Device getDevice(String meterNo, String customerNo){
 |