mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
bug修复
This commit is contained in:
@@ -37,7 +37,6 @@ public class ProductController extends BaseController
|
||||
/**
|
||||
* 查询产品列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:product:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("产品分页列表")
|
||||
public TableDataInfo list(Product product)
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.common.utils.ip.IpUtils;
|
||||
import com.ruoyi.iot.domain.Device;
|
||||
import com.ruoyi.iot.domain.DeviceLog;
|
||||
import com.ruoyi.iot.domain.DeviceUser;
|
||||
import com.ruoyi.iot.domain.Product;
|
||||
import com.ruoyi.iot.tdengine.service.ILogService;
|
||||
import com.ruoyi.iot.mapper.DeviceLogMapper;
|
||||
@@ -74,9 +75,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
// @Autowired
|
||||
// private IDeviceLogService deviceLogService;
|
||||
|
||||
@Autowired
|
||||
private ILogService logService;
|
||||
|
||||
@@ -201,7 +199,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
deviceLog.setIsMonitor(valueList.get(k).getIsMonitor());
|
||||
deviceLog.setLogType(type);
|
||||
logService.saveDeviceLog(deviceLog);
|
||||
// deviceLogMapper.insertDeviceLog(deviceLog);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -423,9 +420,12 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
device.setThingsModelValue(JSONObject.toJSONString(getThingsModelDefaultValue(device.getProductId())));
|
||||
device.setUserId(sysUser.getUserId());
|
||||
device.setUserName(sysUser.getUserName());
|
||||
device.setTenantId(sysUser.getUserId());
|
||||
device.setTenantName(sysUser.getUserName());
|
||||
device.setRssi(0);
|
||||
// 设置租户
|
||||
Product product=productService.selectProductByProductId(device.getProductId());
|
||||
device.setTenantId(product.getTenantId());
|
||||
device.setTenantName(product.getTenantName());
|
||||
device.setImgUrl(product.getImgUrl());
|
||||
// 随机经纬度和地址
|
||||
device.setNetworkIp("127.0.0.1");
|
||||
if(device.getLongitude()==null || device.getLongitude().equals("")){
|
||||
@@ -437,20 +437,18 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
if(device.getNetworkAddress()==null || device.getNetworkAddress().equals("")){
|
||||
device.setNetworkAddress("中国");
|
||||
}
|
||||
Product product=productService.selectProductByProductId(device.getProductId());
|
||||
device.setImgUrl(product.getImgUrl());
|
||||
deviceMapper.insertDevice(device);
|
||||
// 添加设备用户
|
||||
// DeviceUser deviceUser = new DeviceUser();
|
||||
// deviceUser.setUserId(sysUser.getUserId());
|
||||
// deviceUser.setUserName(sysUser.getUserName());
|
||||
// deviceUser.setPhonenumber(sysUser.getPhonenumber());
|
||||
// deviceUser.setDeviceId(device.getDeviceId());
|
||||
// deviceUser.setDeviceName(device.getDeviceName());
|
||||
// deviceUser.setTenantId(device.getDeviceId());
|
||||
// deviceUser.setTenantName(device.getTenantName());
|
||||
// deviceUser.setIsOwner(1);
|
||||
// deviceUserMapper.insertDeviceUser(deviceUser);
|
||||
DeviceUser deviceUser = new DeviceUser();
|
||||
deviceUser.setUserId(sysUser.getUserId());
|
||||
deviceUser.setUserName(sysUser.getUserName());
|
||||
deviceUser.setPhonenumber(sysUser.getPhonenumber());
|
||||
deviceUser.setDeviceId(device.getDeviceId());
|
||||
deviceUser.setDeviceName(device.getDeviceName());
|
||||
deviceUser.setTenantId(product.getTenantId());
|
||||
deviceUser.setTenantName(product.getTenantName());
|
||||
deviceUser.setIsOwner(1);
|
||||
deviceUserMapper.insertDeviceUser(deviceUser);
|
||||
return device;
|
||||
}
|
||||
|
||||
@@ -468,20 +466,26 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
SysUser user=userService.selectUserById(userId);
|
||||
device.setUserId(userId);
|
||||
device.setUserName(user.getUserName());
|
||||
Product product=productService.selectProductByProductId(productId);
|
||||
device.setProductId(productId);
|
||||
device.setProductName(product.getProductName());
|
||||
device.setTenantId(userId);
|
||||
device.setTenantName(user.getUserName());
|
||||
device.setFirmwareVersion(BigDecimal.valueOf(1.0));
|
||||
device.setStatus(3);
|
||||
device.setStatus(1); // 设备状态(1-未激活,2-禁用,3-在线,4-离线)
|
||||
device.setActiveTime(DateUtils.getNowDate());
|
||||
device.setIsShadow(0);
|
||||
device.setRssi(0);
|
||||
device.setIsCustomLocation(0);
|
||||
device.setIsCustomLocation(1); // 1-自动定位,2-设备定位,3-自定义位置
|
||||
device.setCreateTime(DateUtils.getNowDate());
|
||||
device.setThingsModelValue(JSONObject.toJSONString(getThingsModelDefaultValue(device.getProductId())));
|
||||
// 随机位置
|
||||
device.setLongitude(BigDecimal.valueOf(116.23-(Math.random()*15)));
|
||||
device.setLatitude(BigDecimal.valueOf(39.54-(Math.random()*15)));
|
||||
device.setNetworkAddress("中国");
|
||||
// 产品相关
|
||||
Product product=productService.selectProductByProductId(productId);
|
||||
device.setTenantId(userId);
|
||||
device.setTenantName(user.getUserName());
|
||||
device.setImgUrl(product.getImgUrl());
|
||||
device.setProductId(product.getProductId());
|
||||
device.setProductName(product.getProductName());
|
||||
return deviceMapper.insertDevice(device);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,11 +153,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join iot_device_user u on u.device_id = d.device_id
|
||||
<where>
|
||||
<if test="userId != null "> and u.user_id = #{userId}</if>
|
||||
<if test="tenantId != null "> and d.tenant_id = #{tenantId}</if>
|
||||
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="productId != null "> and d.product_id = #{productId}</if>
|
||||
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="userName != null and userName != ''"> and d.user_name like concat('%', #{userName}, '%')</if>
|
||||
<if test="tenantId != null "> and d.tenant_id = #{tenantId}</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and d.tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
<if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>
|
||||
<if test="status != null "> and d.status = #{status}</if>
|
||||
|
||||
Reference in New Issue
Block a user