|
|
@ -1,9 +1,11 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
@ -70,7 +72,7 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void AddBuilding(String customerId, IcBulidingFormDTO formDTO) { |
|
|
|
public void addBuilding(String customerId, IcBulidingFormDTO formDTO) { |
|
|
|
//同一小区下不能存在楼栋名字一样的
|
|
|
|
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),null); |
|
|
|
if (null != count && count > 0) { |
|
|
@ -152,8 +154,11 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
|
|
|
|
|
|
|
|
//3.获取网格下的所有小区
|
|
|
|
List<String> gridIdList = customerGridList.stream().map(a->a.getId()).collect(Collectors.toList()); |
|
|
|
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getGridId, gridIdList)); |
|
|
|
List<String> gridIdList = customerGridList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); |
|
|
|
LambdaQueryWrapper<IcNeighborHoodEntity> queryWrapper = new QueryWrapper<IcNeighborHoodEntity>().lambda() |
|
|
|
.in(IcNeighborHoodEntity::getGridId, gridIdList) |
|
|
|
.orderByAsc(IcNeighborHoodEntity::getCreatedTime); |
|
|
|
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(queryWrapper); |
|
|
|
if(CollectionUtils.isEmpty(icNeighborHoodList)){ |
|
|
|
agencyList.addAll(gridList); |
|
|
|
return covertToTree(customerAgency,agencyList); |
|
|
@ -171,8 +176,11 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//3.获取小区下的所有楼宇
|
|
|
|
List<String> neighborHoodIdList = icNeighborHoodList.stream().map(a->a.getId()).collect(Collectors.toList()); |
|
|
|
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(new QueryWrapper<IcBuildingEntity>().lambda().in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList)); |
|
|
|
List<String> neighborHoodIdList = icNeighborHoodList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); |
|
|
|
LambdaQueryWrapper<IcBuildingEntity> buildingQueryWrapper = new QueryWrapper<IcBuildingEntity>().lambda() |
|
|
|
.in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList) |
|
|
|
.orderByAsc(IcBuildingEntity::getCreatedTime,IcBuildingEntity::getBuildingName); |
|
|
|
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(buildingQueryWrapper); |
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(neighborHoodIdList)){ |
|
|
|
agencyList.addAll(gridList); |
|
|
@ -193,14 +201,6 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
return buildingTreeLevelDTO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//组织
|
|
|
|
// gridList.stream()
|
|
|
|
// Map<String, List<BuildingTreeLevelDTO>> gridMap = gridList.stream().collect(Collectors.groupingBy(e -> e.getPId()));
|
|
|
|
// List<BuildingTreeLevelDTO> allList = agencyList.addAll(gridList)
|
|
|
|
|
|
|
|
agencyList.addAll(gridList); |
|
|
|
agencyList.addAll(neighbourHoodList); |
|
|
|
agencyList.addAll(buildingList); |
|
|
@ -365,25 +365,9 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
private IPage<Map<String, Object>> searchBuilding(ListIcNeighborHoodFormDTO formDTO) { |
|
|
|
IPage<IcBuildingEntity> page = new Page<IcBuildingEntity>(formDTO.getPageNo(),formDTO.getPageSize()); |
|
|
|
|
|
|
|
// IcNeighborHoodEntity neighbor = new IcNeighborHoodEntity();
|
|
|
|
// IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
|
|
|
|
|
|
|
|
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
|
|
|
|
// neighborHoodEntityQueryWrapper.lambda()
|
|
|
|
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
|
|
|
|
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
|
|
|
|
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
|
|
|
|
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
|
|
|
|
|
|
|
|
|
|
|
|
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class); |
|
|
|
building.setDelFlag("0"); |
|
|
|
// QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper = new QueryWrapper<>();
|
|
|
|
//
|
|
|
|
// buildingEntityQueryWrapper.lambda()
|
|
|
|
// .eq(!StringUtils.isEmpty(formDTO.getBuildingId()),IcBuildingEntity::getId,formDTO.getBuildingId())
|
|
|
|
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
|
|
|
|
// buildingEntityQueryWrapper.eq("a.DEL_FLAG","0");
|
|
|
|
|
|
|
|
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class); |
|
|
|
IPage<Map<String, Object>> mapIPage = icBuildingDao.searchBuildingByPage(page, building, house); |
|
|
|
List<Map<String, Object>> records = mapIPage.getRecords(); |
|
|
@ -428,7 +412,7 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void UpdateBuilding(String customerId, IcBulidingFormDTO formDTO) { |
|
|
|
public void updateBuilding(String customerId, IcBulidingFormDTO formDTO) { |
|
|
|
//同一小区下不能存在楼栋名字一样的
|
|
|
|
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),formDTO.getBuildingId()); |
|
|
|
if (null != count && count > 0) { |
|
|
@ -484,7 +468,7 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void DelBuilding(String buildingId) { |
|
|
|
public void delBuilding(String buildingId) { |
|
|
|
//如果存在房屋,无法删除
|
|
|
|
List<IcHouseEntity> icHouseEntities = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, buildingId)); |
|
|
|
if(!CollectionUtils.isEmpty(icHouseEntities)){ |
|
|
|