This commit is contained in:
@@ -32,7 +32,7 @@ public class TbBuildingBo extends BaseEntity {
|
||||
/**
|
||||
* 园区编码
|
||||
*/
|
||||
@NotBlank(message = "园区id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
@NotNull(message = "园区id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
|
@@ -3,11 +3,21 @@ package org.dromara.property.dubbo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.domain.TreeNode;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.property.api.RemoteFloorService;
|
||||
import org.dromara.property.api.domain.vo.RemoteFloorVo;
|
||||
import org.dromara.property.domain.vo.TbBuildingVo;
|
||||
import org.dromara.property.domain.vo.TbCommunityVo;
|
||||
import org.dromara.property.domain.vo.TbFloorVo;
|
||||
import org.dromara.property.domain.vo.TbUnitVo;
|
||||
import org.dromara.property.service.ITbBuildingService;
|
||||
import org.dromara.property.service.ITbCommunityService;
|
||||
import org.dromara.property.service.ITbFloorService;
|
||||
import org.dromara.property.service.ITbUnitService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 楼层服务远程调用实现
|
||||
@@ -19,11 +29,76 @@ import org.dromara.property.service.ITbFloorService;
|
||||
@DubboService
|
||||
public class RemoteFloorServiceImpl implements RemoteFloorService {
|
||||
|
||||
private final ITbCommunityService tbCommunityService;
|
||||
private final ITbBuildingService tbBuildingService;
|
||||
private final ITbUnitService unitService;
|
||||
private final ITbFloorService floorService;
|
||||
|
||||
|
||||
@Override
|
||||
public RemoteFloorVo queryByFloorId(Long floorId) {
|
||||
TbFloorVo tbFloorVo = floorService.queryById(floorId);
|
||||
return MapstructUtils.convert(tbFloorVo, RemoteFloorVo.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<TreeNode<Long>> queryTreeList() {
|
||||
|
||||
List<TreeNode<Long>> treeList = new ArrayList<>();
|
||||
List<TbCommunityVo> tbCommunityVos = tbCommunityService.queryAll();
|
||||
if (tbCommunityVos == null || tbCommunityVos.isEmpty()) {
|
||||
return treeList;
|
||||
}
|
||||
List<TreeNode<Long>> l1 = tbCommunityVos.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
node.setLevel(1);
|
||||
node.setCode(item.getId());
|
||||
node.setParentCode(0L);
|
||||
node.setLabel(item.getCommunityName());
|
||||
return node;
|
||||
}).toList();
|
||||
treeList.addAll(l1);
|
||||
List<TbBuildingVo> tbBuildingVos = tbBuildingService.queryAll();
|
||||
if (tbBuildingVos == null || tbBuildingVos.isEmpty()) {
|
||||
return treeList;
|
||||
}
|
||||
List<TreeNode<Long>> l2 = tbBuildingVos.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
node.setLevel(2);
|
||||
node.setCode(item.getId());
|
||||
node.setParentCode(item.getCommunityId());
|
||||
node.setLabel(item.getBuildingName());
|
||||
return node;
|
||||
}).toList();
|
||||
treeList.addAll(l2);
|
||||
|
||||
List<TbUnitVo> tbUnitVos = unitService.queryAll();
|
||||
if (tbUnitVos == null || tbUnitVos.isEmpty()) {
|
||||
return treeList;
|
||||
}
|
||||
List<TreeNode<Long>> l3 = tbUnitVos.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
node.setLevel(3);
|
||||
node.setCode(item.getId());
|
||||
node.setParentCode(item.getBuildingId());
|
||||
node.setLabel(item.getUnitName());
|
||||
return node;
|
||||
}).toList();
|
||||
treeList.addAll(l3);
|
||||
List<TbFloorVo> tbFloorVos = floorService.queryAll();
|
||||
if (tbFloorVos == null || tbFloorVos.isEmpty()) {
|
||||
return treeList;
|
||||
}
|
||||
List<TreeNode<Long>> l4 = tbFloorVos.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
node.setLevel(4);
|
||||
node.setCode(item.getId());
|
||||
node.setParentCode(item.getUnitId());
|
||||
node.setLabel(item.getFloorName());
|
||||
return node;
|
||||
}).toList();
|
||||
treeList.addAll(l4);
|
||||
return treeList;
|
||||
}
|
||||
}
|
||||
|
@@ -66,10 +66,6 @@ public interface ITbBuildingService {
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 加载当前租户下的所有建筑
|
||||
* @param tenantId 租户编码
|
||||
* @return 返回建筑列表
|
||||
*/
|
||||
List<TbBuildingVo> queryByTenantId(String tenantId);
|
||||
|
||||
List<TbBuildingVo> queryAll();
|
||||
}
|
||||
|
@@ -25,13 +25,8 @@ public interface ITbCommunityService {
|
||||
*/
|
||||
TbCommunityVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询小区列表
|
||||
*
|
||||
* @param tenantId 租户编码
|
||||
* @return 小区
|
||||
*/
|
||||
List<TbCommunityVo> queryByTenantId(String tenantId);
|
||||
|
||||
List<TbCommunityVo> queryAll();
|
||||
|
||||
/**
|
||||
* 分页查询小区列表
|
||||
@@ -77,9 +72,10 @@ public interface ITbCommunityService {
|
||||
|
||||
/**
|
||||
* 加载社区树结构
|
||||
*
|
||||
* @param level 加载等级
|
||||
* @return 树结构
|
||||
*/
|
||||
List<TreeNode<Long>> tree(Integer level,String tenantId);
|
||||
List<TreeNode<Long>> tree(Integer level, String tenantId);
|
||||
|
||||
}
|
||||
|
@@ -67,5 +67,7 @@ public interface ITbFloorService {
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
List<TbFloorVo> queryByTenantId(String tenantId);
|
||||
|
||||
List<TbFloorVo> queryAll();
|
||||
|
||||
}
|
||||
|
@@ -68,5 +68,6 @@ public interface ITbRoomService {
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
List<TbRoomVo> queryByTenantId(String tenantId);
|
||||
List<TbRoomVo> queryAll();
|
||||
|
||||
}
|
||||
|
@@ -66,6 +66,7 @@ public interface ITbUnitService {
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
List<TbUnitVo> queryByTenantId(String tenantId);
|
||||
|
||||
List<TbUnitVo> queryAll();
|
||||
|
||||
}
|
||||
|
@@ -147,10 +147,9 @@ public class TbBuildingServiceImpl implements ITbBuildingService {
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<TbBuildingVo> queryByTenantId(String tenantId) {
|
||||
LambdaQueryWrapper<TbBuilding> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(TbBuilding::getTenantId, tenantId);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
public List<TbBuildingVo> queryAll() {
|
||||
return baseMapper.selectVoList(null);
|
||||
}
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ public class TbCommunityServiceImpl implements ITbCommunityService {
|
||||
@Override
|
||||
public List<TreeNode<Long>> tree(Integer level, String tenantId) {
|
||||
// 默认加载社区树
|
||||
List<TbCommunityVo> tbCommunityVos = queryByTenantId(tenantId);
|
||||
List<TbCommunityVo> tbCommunityVos = queryAll();
|
||||
if (tbCommunityVos == null || tbCommunityVos.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class TbCommunityServiceImpl implements ITbCommunityService {
|
||||
return community;
|
||||
}
|
||||
if (level >= 2) {
|
||||
List<TbBuildingVo> vos = buildingService.queryByTenantId(tenantId);
|
||||
List<TbBuildingVo> vos = buildingService.queryAll();
|
||||
if (vos != null && !vos.isEmpty()) {
|
||||
List<TreeNode<Long>> list = vos.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
@@ -77,7 +77,7 @@ public class TbCommunityServiceImpl implements ITbCommunityService {
|
||||
}
|
||||
}
|
||||
if (level >= 3) {
|
||||
List<TbUnitVo> vos = unitService.queryByTenantId(tenantId);
|
||||
List<TbUnitVo> vos = unitService.queryAll();
|
||||
if (vos != null && !vos.isEmpty()) {
|
||||
List<TreeNode<Long>> list = vos.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
@@ -92,7 +92,7 @@ public class TbCommunityServiceImpl implements ITbCommunityService {
|
||||
}
|
||||
}
|
||||
if (level >= 4) {
|
||||
List<TbFloorVo> vos = floorService.queryByTenantId(tenantId);
|
||||
List<TbFloorVo> vos = floorService.queryAll();
|
||||
if (vos != null && !vos.isEmpty()) {
|
||||
List<TreeNode<Long>> list = vos.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
@@ -108,7 +108,7 @@ public class TbCommunityServiceImpl implements ITbCommunityService {
|
||||
}
|
||||
|
||||
if (level >= 5) {
|
||||
List<TbRoomVo> vos = roomService.queryByTenantId(tenantId);
|
||||
List<TbRoomVo> vos = roomService.queryAll();
|
||||
if (vos != null && !vos.isEmpty()) {
|
||||
List<TreeNode<Long>> list = vos.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
@@ -125,11 +125,10 @@ public class TbCommunityServiceImpl implements ITbCommunityService {
|
||||
return TreeUtils.build(community, 0L);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<TbCommunityVo> queryByTenantId(String tenantId) {
|
||||
LambdaQueryWrapper<TbCommunity> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.eq(TbCommunity::getTenantId, tenantId);
|
||||
return baseMapper.selectVoList(queryWrapper);
|
||||
public List<TbCommunityVo> queryAll() {
|
||||
return baseMapper.selectVoList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -145,9 +145,7 @@ public class TbFloorServiceImpl implements ITbFloorService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbFloorVo> queryByTenantId(String tenantId) {
|
||||
LambdaQueryWrapper<TbFloor> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(TbFloor::getTenantId, tenantId);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
public List<TbFloorVo> queryAll() {
|
||||
return baseMapper.selectVoList();
|
||||
}
|
||||
}
|
||||
|
@@ -146,9 +146,7 @@ public class TbRoomServiceImpl implements ITbRoomService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbRoomVo> queryByTenantId(String tenantId) {
|
||||
LambdaQueryWrapper<TbRoom> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(TbRoom::getTenantId, tenantId);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
public List<TbRoomVo> queryAll() {
|
||||
return baseMapper.selectVoList();
|
||||
}
|
||||
}
|
||||
|
@@ -143,9 +143,7 @@ public class TbUnitServiceImpl implements ITbUnitService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbUnitVo> queryByTenantId(String tenantId) {
|
||||
LambdaQueryWrapper<TbUnit> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.eq(TbUnit::getTenantId, tenantId);
|
||||
return baseMapper.selectVoList(queryWrapper);
|
||||
public List<TbUnitVo> queryAll() {
|
||||
return baseMapper.selectVoList();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user