From ba128edd40817fcebbe08e462e89ba25a92550f9 Mon Sep 17 00:00:00 2001 From: kerwincui <164770707@qq.com> Date: Sun, 5 Jun 2022 13:17:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=B7=BB=E5=8A=A0=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/iot/service/impl/DeviceServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/DeviceServiceImpl.java b/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/DeviceServiceImpl.java index f45a5e51..76338431 100644 --- a/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/DeviceServiceImpl.java +++ b/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/DeviceServiceImpl.java @@ -426,13 +426,17 @@ public class DeviceServiceImpl implements IDeviceService { device.setTenantId(sysUser.getUserId()); device.setTenantName(sysUser.getUserName()); device.setRssi(0); - // 随机经纬度 + // 随机经纬度和地址 + device.setNetworkIp("127.0.0.1"); if(device.getLongitude()==null || device.getLongitude().equals("")){ device.setLongitude(BigDecimal.valueOf(116.23-(Math.random()*15))); } if(device.getLatitude()==null || device.getLatitude().equals("")){ device.setLatitude(BigDecimal.valueOf(39.54-(Math.random()*15))); } + if(device.getNetworkAddress()==null || device.getNetworkAddress().equals("")){ + device.setNetworkAddress("中国"); + } Product product=productService.selectProductByProductId(device.getProductId()); device.setImgUrl(product.getImgUrl()); deviceMapper.insertDevice(device);