实时更新
This commit is contained in:
		
							parent
							
								
									b8c28c02a7
								
							
						
					
					
						commit
						97700d2868
					
				| 
						 | 
					@ -405,7 +405,7 @@ public interface IAsDeviceService extends IService<AsDevice>
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 更新最新的位置信息
 | 
					     * 更新最新的位置信息
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    boolean updateLatestLocation(String sn);
 | 
					    boolean updateLatestLocation(AsDevice device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 获取最新的位置信息
 | 
					     * 获取最新的位置信息
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 | 
				
			||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
					import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
				
			||||||
import com.ruoyi.common.annotation.DataScope;
 | 
					import com.ruoyi.common.annotation.DataScope;
 | 
				
			||||||
import com.ruoyi.common.constant.*;
 | 
					import com.ruoyi.common.constant.*;
 | 
				
			||||||
import com.ruoyi.common.core.domain.entity.AsUser;
 | 
					 | 
				
			||||||
import com.ruoyi.common.core.domain.entity.SysDept;
 | 
					import com.ruoyi.common.core.domain.entity.SysDept;
 | 
				
			||||||
import com.ruoyi.common.core.redis.RedisCache;
 | 
					import com.ruoyi.common.core.redis.RedisCache;
 | 
				
			||||||
import com.ruoyi.common.exception.ServiceException;
 | 
					import com.ruoyi.common.exception.ServiceException;
 | 
				
			||||||
| 
						 | 
					@ -43,10 +42,7 @@ import java.math.BigDecimal;
 | 
				
			||||||
import java.math.RoundingMode;
 | 
					import java.math.RoundingMode;
 | 
				
			||||||
import java.text.ParseException;
 | 
					import java.text.ParseException;
 | 
				
			||||||
import java.text.SimpleDateFormat;
 | 
					import java.text.SimpleDateFormat;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.*;
 | 
				
			||||||
import java.util.Calendar;
 | 
					 | 
				
			||||||
import java.util.Date;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.concurrent.ScheduledExecutorService;
 | 
					import java.util.concurrent.ScheduledExecutorService;
 | 
				
			||||||
import java.util.concurrent.TimeUnit;
 | 
					import java.util.concurrent.TimeUnit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,13 +154,20 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
            device.setAreaName(etOperatingArea.getAreaName());
 | 
					            device.setAreaName(etOperatingArea.getAreaName());
 | 
				
			||||||
            device.setDeptName(etOperatingArea.getDeptName());
 | 
					            device.setDeptName(etOperatingArea.getDeptName());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        EtModel model = etModelService.selectEtModelByModelId(device.getModelId());
 | 
					        pullDeviceInfo(device);
 | 
				
			||||||
        if(ObjectUtil.isNotNull(model)){
 | 
					        if(ObjectUtil.isNotNull(areaId) && areaId!=0){
 | 
				
			||||||
            device.setModel(model.getModel());
 | 
					            SysDept sysDept = wxPayService.getDeptObjByAreaId(areaId);
 | 
				
			||||||
            if(StrUtil.isNotBlank(device.getVoltage())){
 | 
					            //https://dianche.chuantewulian.cn?sn=https://dche.ccttiot.com?sn=3000900
 | 
				
			||||||
                device.setRemainingMileage(CommonUtil.getRemainingMileage(device.getVoltage(),model.getFullVoltage(),model.getLowVoltage(),model.getFullEndurance()));
 | 
					            device.setQrText(sysDept.getDomain()+"?sn="+device.getSn());
 | 
				
			||||||
 | 
					            device.setDeptName(sysDept.getDeptName());
 | 
				
			||||||
 | 
					            device.setDeptId(sysDept.getDeptId());
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            device.setQrText("");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        return device;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void pullDeviceInfo(AsDevice device) {
 | 
				
			||||||
        String msg = redisCache.getCacheObject(CacheConstants.CACHE_DEVICE_KEY + device.getMac());
 | 
					        String msg = redisCache.getCacheObject(CacheConstants.CACHE_DEVICE_KEY + device.getMac());
 | 
				
			||||||
        if(StrUtil.isNotBlank(msg)){
 | 
					        if(StrUtil.isNotBlank(msg)){
 | 
				
			||||||
            LogEntry logEntry = JSONObject.parseObject(msg, LogEntry.class);
 | 
					            LogEntry logEntry = JSONObject.parseObject(msg, LogEntry.class);
 | 
				
			||||||
| 
						 | 
					@ -177,22 +180,13 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
                BigDecimal lat = BigDecimal.valueOf(doubles[0]).setScale(8, RoundingMode.HALF_UP);
 | 
					                BigDecimal lat = BigDecimal.valueOf(doubles[0]).setScale(8, RoundingMode.HALF_UP);
 | 
				
			||||||
                // long 转String
 | 
					                // long 转String
 | 
				
			||||||
                device.setLongitude(lon.toString());
 | 
					                device.setLongitude(lon.toString());
 | 
				
			||||||
                updateDevice2(logEntry.getAt(),value,device,lon,lat);
 | 
					                device.setLatitude(lat.toString());
 | 
				
			||||||
 | 
					                updateDevice2(logEntry.getAt(),value, device,lon,lat);
 | 
				
			||||||
            }else{
 | 
					            }else{
 | 
				
			||||||
                device.setLongitude(null);
 | 
					                device.setLongitude(null);
 | 
				
			||||||
                device.setLatitude(null);
 | 
					                device.setLatitude(null);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(ObjectUtil.isNotNull(areaId) && areaId!=0){
 | 
					 | 
				
			||||||
            SysDept sysDept = wxPayService.getDeptObjByAreaId(areaId);
 | 
					 | 
				
			||||||
            //https://dianche.chuantewulian.cn?sn=https://dche.ccttiot.com?sn=3000900
 | 
					 | 
				
			||||||
            device.setQrText(sysDept.getDomain()+"?sn="+device.getSn());
 | 
					 | 
				
			||||||
            device.setDeptName(sysDept.getDeptName());
 | 
					 | 
				
			||||||
            device.setDeptId(sysDept.getDeptId());
 | 
					 | 
				
			||||||
        }else{
 | 
					 | 
				
			||||||
            device.setQrText("");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return device;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -216,6 +210,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
                asDeviceVO.setIsBand(true);
 | 
					                asDeviceVO.setIsBand(true);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        pullDeviceInfo(asDevice);
 | 
				
			||||||
        return asDeviceVO;
 | 
					        return asDeviceVO;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -238,33 +233,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
            etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
 | 
					            etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
 | 
				
			||||||
            asDevice.setAreaName(etOperatingArea.getAreaName());
 | 
					            asDevice.setAreaName(etOperatingArea.getAreaName());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        EtModel model = etModelService.selectEtModelByModelId(asDevice.getModelId());
 | 
					        pullDeviceInfo(asDevice);
 | 
				
			||||||
        if(ObjectUtil.isNotNull(model)){
 | 
					 | 
				
			||||||
            asDevice.setModel(model.getModel());
 | 
					 | 
				
			||||||
            if(StrUtil.isNotBlank(asDevice.getVoltage())){
 | 
					 | 
				
			||||||
                asDevice.setRemainingMileage(CommonUtil.getRemainingMileage(asDevice.getVoltage(),model.getFullVoltage(),model.getLowVoltage(),model.getFullEndurance()));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        String msg = redisCache.getCacheObject(CacheConstants.CACHE_DEVICE_KEY + asDevice.getMac());
 | 
					 | 
				
			||||||
        if(StrUtil.isNotBlank(msg)){
 | 
					 | 
				
			||||||
            log.info("【根据sn号查询车辆实时信息】-========redis缓存中的数据:" + msg);
 | 
					 | 
				
			||||||
            LogEntry logEntry = JSONObject.parseObject(msg, LogEntry.class);
 | 
					 | 
				
			||||||
            log.info("【根据sn号查询车辆实时信息】============logEntry转换后的对象: logEntry---【{}】" , JSON.toJSONString(logEntry));
 | 
					 | 
				
			||||||
            LogEntry.LocationValue value = logEntry.getValue();
 | 
					 | 
				
			||||||
            if(!"0.0".equals(value.getLon()) && !"0.0".equals(value.getLat())){
 | 
					 | 
				
			||||||
                // 坐标转换  WGS84 转 GCJ02
 | 
					 | 
				
			||||||
                double[] doubles = CommonUtil.coordinateConvert(value.getLon(),value.getLat());
 | 
					 | 
				
			||||||
                BigDecimal lon = BigDecimal.valueOf(doubles[1]).setScale(8, RoundingMode.HALF_UP);
 | 
					 | 
				
			||||||
                BigDecimal lat = BigDecimal.valueOf(doubles[0]).setScale(8, RoundingMode.HALF_UP);
 | 
					 | 
				
			||||||
                // todo  0E-8 排除
 | 
					 | 
				
			||||||
                asDevice.setLongitude(lon.toString());
 | 
					 | 
				
			||||||
                asDevice.setLatitude(lat.toString());
 | 
					 | 
				
			||||||
            }else{
 | 
					 | 
				
			||||||
                asDevice.setLongitude(null);
 | 
					 | 
				
			||||||
                asDevice.setLatitude(null);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            asDevice.setLastLocationTime(new Date(logEntry.getAt()));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        //正在进行中的订单
 | 
					        //正在进行中的订单
 | 
				
			||||||
        EtOrder order = new EtOrder();
 | 
					        EtOrder order = new EtOrder();
 | 
				
			||||||
        order.setSn(asDevice.getSn());
 | 
					        order.setSn(asDevice.getSn());
 | 
				
			||||||
| 
						 | 
					@ -354,6 +323,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
            }else{
 | 
					            }else{
 | 
				
			||||||
                asDevice1.setQrText("");
 | 
					                asDevice1.setQrText("");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            pullDeviceInfo(asDevice1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return asDevices;
 | 
					        return asDevices;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -648,7 +618,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
                log.info("设备【"+device.getSn()+"】更新版本失败");
 | 
					                log.info("设备【"+device.getSn()+"】更新版本失败");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // 最新位置信息
 | 
					            // 最新位置信息
 | 
				
			||||||
            if(updateLatestLocation(device.getSn())){
 | 
					            if(updateLatestLocation(device)){
 | 
				
			||||||
                log.info("设备【"+device.getSn()+"】更新位置成功");
 | 
					                log.info("设备【"+device.getSn()+"】更新位置成功");
 | 
				
			||||||
            }else{
 | 
					            }else{
 | 
				
			||||||
                log.info("设备【"+device.getSn()+"】更新位置失败");
 | 
					                log.info("设备【"+device.getSn()+"】更新位置失败");
 | 
				
			||||||
| 
						 | 
					@ -678,7 +648,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
            log.info("设备【"+device.getSn()+"】更新版本失败");
 | 
					            log.info("设备【"+device.getSn()+"】更新版本失败");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // 最新位置信息
 | 
					        // 最新位置信息
 | 
				
			||||||
        if(updateLatestLocation(device.getSn())){
 | 
					        if(updateLatestLocation(device)){
 | 
				
			||||||
            log.info("设备【"+device.getSn()+"】更新位置成功");
 | 
					            log.info("设备【"+device.getSn()+"】更新位置成功");
 | 
				
			||||||
        }else{
 | 
					        }else{
 | 
				
			||||||
            log.info("设备【"+device.getSn()+"】更新位置失败");
 | 
					            log.info("设备【"+device.getSn()+"】更新位置失败");
 | 
				
			||||||
| 
						 | 
					@ -774,23 +744,8 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        List<AsDevice> asDevices = asDeviceMapper.selectList(wrapper);
 | 
					        List<AsDevice> asDevices = asDeviceMapper.selectList(wrapper);
 | 
				
			||||||
        for (AsDevice asDevice:asDevices){
 | 
					        if (ObjectUtil.isNotEmpty(asDevices)) {
 | 
				
			||||||
            Long modelId = asDevice.getModelId();
 | 
					            asDevices.forEach(this::pullDeviceInfo);
 | 
				
			||||||
            if (ObjectUtil.isNotNull(modelId)){
 | 
					 | 
				
			||||||
                EtModel model = etModelService.selectEtModelByModelId(modelId);
 | 
					 | 
				
			||||||
                if(ObjectUtil.isNotNull(model)){
 | 
					 | 
				
			||||||
                    asDevice.setModel(model.getModel());
 | 
					 | 
				
			||||||
                    Integer remainingMileage = 0;
 | 
					 | 
				
			||||||
                    if(StrUtil.isNotBlank(asDevice.getVoltage())){
 | 
					 | 
				
			||||||
                        remainingMileage = CommonUtil.getRemainingMileage(asDevice.getVoltage(), model.getFullVoltage(), model.getLowVoltage(), model.getFullEndurance());
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    Integer electricQuantity = CommonUtil.getElectricQuantity(asDevice.getVoltage(), model.getFullVoltage(), model.getLowVoltage());//电量百分百
 | 
					 | 
				
			||||||
                    asDevice.setRemainingMileage(remainingMileage);
 | 
					 | 
				
			||||||
                    asDevice.setRemainingPower(electricQuantity.toString());
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            // 根据sn获取redis中的最新定位
 | 
					 | 
				
			||||||
            getLatestLocation(asDevice);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return asDevices;
 | 
					        return asDevices;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -1136,22 +1091,30 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<AsDevice> deviceSearch(String key, String type, String areaId) {
 | 
					    public List<AsDevice> deviceSearch(String key, String type, String areaId) {
 | 
				
			||||||
        QueryWrapper<AsDevice> queryWrapper = new QueryWrapper<>();
 | 
					        QueryWrapper<AsDevice> queryWrapper = new QueryWrapper<>();
 | 
				
			||||||
        if(StrUtil.isNotBlank(areaId)){
 | 
					        if (StrUtil.isNotBlank(areaId)) {
 | 
				
			||||||
            queryWrapper.eq("area_id",areaId);
 | 
					            queryWrapper.eq("area_id", areaId);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        switch (type){
 | 
					
 | 
				
			||||||
            case "1":
 | 
					        if (StrUtil.isNotBlank(type)) {
 | 
				
			||||||
 | 
					            if ("1".equals(type)) {
 | 
				
			||||||
                queryWrapper.like("sn", key);
 | 
					                queryWrapper.like("sn", key);
 | 
				
			||||||
                return asDeviceMapper.selectList(queryWrapper);
 | 
					            } else if ("2".equals(type)) {
 | 
				
			||||||
            case "2":
 | 
					 | 
				
			||||||
                queryWrapper.like("mac", key);
 | 
					                queryWrapper.like("mac", key);
 | 
				
			||||||
                return asDeviceMapper.selectList(queryWrapper);
 | 
					            } else if ("3".equals(type)) {
 | 
				
			||||||
            case "3":
 | 
					 | 
				
			||||||
                queryWrapper.like("vehicle_num", key);
 | 
					                queryWrapper.like("vehicle_num", key);
 | 
				
			||||||
                return asDeviceMapper.selectList(queryWrapper);
 | 
					            } else {
 | 
				
			||||||
            default:
 | 
					                return Collections.emptyList();
 | 
				
			||||||
                return null;
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return Collections.emptyList();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<AsDevice> devices = asDeviceMapper.selectList(queryWrapper);
 | 
				
			||||||
 | 
					        if (ObjectUtil.isNotEmpty(devices)) {
 | 
				
			||||||
 | 
					            devices.forEach(this::pullDeviceInfo);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return devices;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -2570,6 +2533,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean isLowBattery(String sn) {
 | 
					    public boolean isLowBattery(String sn) {
 | 
				
			||||||
        AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
 | 
					        AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
 | 
				
			||||||
 | 
					        updateLatestLocation(device);
 | 
				
			||||||
        String remainingPower = device.getRemainingPower();
 | 
					        String remainingPower = device.getRemainingPower();
 | 
				
			||||||
        log.info("车辆【{}】电量为【{}】",sn,remainingPower);
 | 
					        log.info("车辆【{}】电量为【{}】",sn,remainingPower);
 | 
				
			||||||
        EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(device.getAreaId());
 | 
					        EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(device.getAreaId());
 | 
				
			||||||
| 
						 | 
					@ -2604,10 +2568,8 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
        wrapper.eq("status","1");
 | 
					        wrapper.eq("status","1");
 | 
				
			||||||
        List<AsDevice> asDevices = asDeviceMapper.selectList(wrapper);
 | 
					        List<AsDevice> asDevices = asDeviceMapper.selectList(wrapper);
 | 
				
			||||||
        // for循环
 | 
					        // for循环
 | 
				
			||||||
        for (AsDevice asDevice : asDevices) {
 | 
					        if (ObjectUtil.isNotEmpty(asDevices)) {
 | 
				
			||||||
            EtModel model = etModelService.selectEtModelByModelId(asDevice.getModelId());
 | 
					            asDevices.forEach(this::pullDeviceInfo);
 | 
				
			||||||
            Integer remainingMileage = CommonUtil.getRemainingMileage(asDevice.getVoltage(), model.getFullVoltage(), model.getLowVoltage(), model.getFullEndurance());
 | 
					 | 
				
			||||||
            asDevice.setRemainingMileage(remainingMileage);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return asDevices;
 | 
					        return asDevices;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -2909,11 +2871,10 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @SneakyThrows
 | 
					    @SneakyThrows
 | 
				
			||||||
    public boolean updateLatestLocation(String sn) {
 | 
					    public boolean updateLatestLocation(AsDevice device) {
 | 
				
			||||||
        AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
 | 
					 | 
				
			||||||
        if(device!=null){
 | 
					        if(device!=null){
 | 
				
			||||||
            String token = Token.getToken();
 | 
					            String token = Token.getToken();
 | 
				
			||||||
            DataPointRes datapoints = historyDatapoints(asDeviceMapper.selectAsDeviceBySn(sn).getMac(), token);
 | 
					            DataPointRes datapoints = historyDatapoints(device.getMac(), token);
 | 
				
			||||||
            if(datapoints.getCode() == 0){
 | 
					            if(datapoints.getCode() == 0){
 | 
				
			||||||
                Data data = datapoints.getData();
 | 
					                Data data = datapoints.getData();
 | 
				
			||||||
                List<Datastream> datastreams = data.getDevices();
 | 
					                List<Datastream> datastreams = data.getDevices();
 | 
				
			||||||
| 
						 | 
					@ -3048,6 +3009,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
            Integer electricQuantity = CommonUtil.getElectricQuantity(device.getVoltage(), model.getFullVoltage(), model.getLowVoltage());//电量百分百
 | 
					            Integer electricQuantity = CommonUtil.getElectricQuantity(device.getVoltage(), model.getFullVoltage(), model.getLowVoltage());//电量百分百
 | 
				
			||||||
            device.setRemainingMileage(remainingMileage);
 | 
					            device.setRemainingMileage(remainingMileage);
 | 
				
			||||||
            device.setRemainingPower(electricQuantity.toString());
 | 
					            device.setRemainingPower(electricQuantity.toString());
 | 
				
			||||||
 | 
					            device.setModel(model.getModel());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        device.setLastTime(new Date(at));
 | 
					        device.setLastTime(new Date(at));
 | 
				
			||||||
        device.setLastLocationTime(new Date(at));
 | 
					        device.setLastLocationTime(new Date(at));
 | 
				
			||||||
| 
						 | 
					@ -3089,28 +3051,4 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 判断是否靠近边界
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
//    @Override
 | 
					 | 
				
			||||||
//    public boolean isCloseToTheBoundary(String sn, EtOperatingArea area) {
 | 
					 | 
				
			||||||
//        Boolean isClose = false;
 | 
					 | 
				
			||||||
//        AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
 | 
					 | 
				
			||||||
//        String latitude = device.getLatitude();
 | 
					 | 
				
			||||||
//        String longitude = device.getLongitude();
 | 
					 | 
				
			||||||
//        Geometry geometry = GeoUtils.fromWkt(area.getBoundary());
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
//        double distanceToBoundary = GeoUtils.distanceToBoundary(longitude, latitude, geometry);
 | 
					 | 
				
			||||||
//        if(distanceToBoundary <= 3.0) {
 | 
					 | 
				
			||||||
//            log.info("车辆【{}】靠近【{}】运营边界",sn,area.getAreaName());
 | 
					 | 
				
			||||||
//            isClose = true;
 | 
					 | 
				
			||||||
//        }else{
 | 
					 | 
				
			||||||
//            log.info("车辆【{}】为靠近靠近【{}】运营边界",sn,area.getAreaName());
 | 
					 | 
				
			||||||
//        }
 | 
					 | 
				
			||||||
//        return isClose;
 | 
					 | 
				
			||||||
//    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user