mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-19 17:35:54 +08:00
多租户调整
This commit is contained in:
@@ -426,6 +426,13 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
device.setTenantId(sysUser.getUserId());
|
||||
device.setTenantName(sysUser.getUserName());
|
||||
device.setRssi(0);
|
||||
// 随机经纬度
|
||||
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)));
|
||||
}
|
||||
Product product=productService.selectProductByProductId(device.getProductId());
|
||||
device.setImgUrl(product.getImgUrl());
|
||||
deviceMapper.insertDevice(device);
|
||||
|
||||
@@ -76,8 +76,14 @@ public class ProductServiceImpl implements IProductService
|
||||
@Override
|
||||
public List<IdAndName> selectProductShortList()
|
||||
{
|
||||
Product product =new Product();
|
||||
SysUser user = getLoginUser().getUser();
|
||||
return productMapper.selectProductShortList(user.getUserId());
|
||||
List<SysRole> roles=user.getRoles();
|
||||
// 租户
|
||||
if(roles.stream().anyMatch(a->a.getRoleKey().equals("tenant"))){
|
||||
product.setTenantId(user.getUserId());
|
||||
}
|
||||
return productMapper.selectProductShortList(product);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user