|
@ -1,9 +1,11 @@ |
|
|
package com.epmet.service.impl; |
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
|
|
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.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
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.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
@ -70,7 +72,7 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@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); |
|
|
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),null); |
|
|
if (null != count && count > 0) { |
|
|
if (null != count && count > 0) { |
|
@ -152,8 +154,10 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//3.获取网格下的所有小区
|
|
|
//3.获取网格下的所有小区
|
|
|
List<String> gridIdList = customerGridList.stream().map(a->a.getId()).collect(Collectors.toList()); |
|
|
List<String> gridIdList = customerGridList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); |
|
|
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getGridId, gridIdList)); |
|
|
LambdaQueryWrapper<IcNeighborHoodEntity> queryWrapper = new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getGridId, gridIdList); |
|
|
|
|
|
queryWrapper.orderByAsc(IcNeighborHoodEntity::getCreatedTime); |
|
|
|
|
|
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(queryWrapper); |
|
|
if(CollectionUtils.isEmpty(icNeighborHoodList)){ |
|
|
if(CollectionUtils.isEmpty(icNeighborHoodList)){ |
|
|
agencyList.addAll(gridList); |
|
|
agencyList.addAll(gridList); |
|
|
return covertToTree(customerAgency,agencyList); |
|
|
return covertToTree(customerAgency,agencyList); |
|
@ -171,8 +175,11 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
}).collect(Collectors.toList()); |
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
//3.获取小区下的所有楼宇
|
|
|
//3.获取小区下的所有楼宇
|
|
|
List<String> neighborHoodIdList = icNeighborHoodList.stream().map(a->a.getId()).collect(Collectors.toList()); |
|
|
List<String> neighborHoodIdList = icNeighborHoodList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); |
|
|
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(new QueryWrapper<IcBuildingEntity>().lambda().in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList)); |
|
|
LambdaQueryWrapper<IcBuildingEntity> buildingQueryWrapper = new QueryWrapper<IcBuildingEntity>().lambda() |
|
|
|
|
|
.in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList) |
|
|
|
|
|
.orderByAsc(IcBuildingEntity::getBuildingName); |
|
|
|
|
|
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(buildingQueryWrapper); |
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(neighborHoodIdList)){ |
|
|
if(CollectionUtils.isEmpty(neighborHoodIdList)){ |
|
|
agencyList.addAll(gridList); |
|
|
agencyList.addAll(gridList); |
|
@ -193,14 +200,6 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
return buildingTreeLevelDTO; |
|
|
return buildingTreeLevelDTO; |
|
|
}).collect(Collectors.toList()); |
|
|
}).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(gridList); |
|
|
agencyList.addAll(neighbourHoodList); |
|
|
agencyList.addAll(neighbourHoodList); |
|
|
agencyList.addAll(buildingList); |
|
|
agencyList.addAll(buildingList); |
|
@ -412,7 +411,7 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@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()); |
|
|
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),formDTO.getBuildingId()); |
|
|
if (null != count && count > 0) { |
|
|
if (null != count && count > 0) { |
|
@ -468,7 +467,7 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@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)); |
|
|
List<IcHouseEntity> icHouseEntities = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, buildingId)); |
|
|
if(!CollectionUtils.isEmpty(icHouseEntities)){ |
|
|
if(!CollectionUtils.isEmpty(icHouseEntities)){ |
|
|