|
|
@ -13,45 +13,37 @@ import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.ImportErrorMsgConstants; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.*; |
|
|
|
import com.epmet.dto.BuildingTreeLevelDTO; |
|
|
|
import com.epmet.dto.CustomerStaffAgencyDTO; |
|
|
|
import com.epmet.dto.IcBuildingDTO; |
|
|
|
import com.epmet.dto.form.IcBulidingFormDTO; |
|
|
|
import com.epmet.dto.form.ImportInfoFormDTO; |
|
|
|
import com.epmet.dto.form.ImportTaskCommonFormDTO; |
|
|
|
import com.epmet.dto.form.ListIcNeighborHoodFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.dto.result.BuildingResultDTO; |
|
|
|
import com.epmet.dto.result.BuildingResultPagedDTO; |
|
|
|
import com.epmet.dto.result.IcNeighborHoodResultDTO; |
|
|
|
import com.epmet.dto.result.ImportTaskCommonResultDTO; |
|
|
|
import com.epmet.entity.*; |
|
|
|
import com.epmet.enums.BuildingTypeEnums; |
|
|
|
import com.epmet.excel.IcBuildingExcel; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import com.epmet.model.BuildingInfoModel; |
|
|
|
import com.epmet.model.HouseInfoModel; |
|
|
|
import com.epmet.model.ImportBuildingInfoListener; |
|
|
|
import com.epmet.redis.IcHouseRedis; |
|
|
|
import com.epmet.service.*; |
|
|
|
import com.epmet.service.BuildingService; |
|
|
|
import com.epmet.service.IcBuildingService; |
|
|
|
import com.epmet.service.IcBuildingUnitService; |
|
|
|
import com.epmet.service.IcHouseService; |
|
|
|
import com.epmet.util.ExcelPoiUtils; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.scheduling.annotation.EnableAsync; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
@ -128,8 +120,8 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<BuildingTreeLevelDTO> treeList(String staffId) { |
|
|
|
CustomerStaffAgencyDTO agency = customerStaffAgencyDao.selectLatestCustomerByStaff(staffId); |
|
|
|
public List<BuildingTreeLevelDTO> treeList(String customerId, String staffId) { |
|
|
|
CustomerStaffInfoCacheResult agency = CustomerStaffRedis.getStaffInfo(customerId, staffId); |
|
|
|
if(null == agency || StringUtils.isBlank(agency.getAgencyId())){ |
|
|
|
log.error("com.epmet.service.impl.BuildingServiceImpl.treeList,没有找到工作人员所属的机关信息,用户Id:{}",staffId); |
|
|
|
return new ArrayList<>(); |
|
|
@ -163,7 +155,7 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
|
|
|
|
|
|
|
|
//2.获取组织所在网格
|
|
|
|
List<String> agencyIdList = customerAgencyList.stream().map(a->a.getId()).collect(Collectors.toList()); |
|
|
|
List<String> agencyIdList = customerAgencyList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); |
|
|
|
// agencyIdList.add(customerAgency.getId());
|
|
|
|
List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getPid, agencyIdList)); |
|
|
|
|
|
|
@ -222,8 +214,12 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
agencyList.addAll(neighbourHoodList); |
|
|
|
return covertToTree(customerAgency,agencyList); |
|
|
|
} |
|
|
|
//获取楼里已经有多少个房屋
|
|
|
|
LambdaQueryWrapper<IcHouseEntity> icHouseEntityWrapper = new QueryWrapper<IcHouseEntity>().lambda() |
|
|
|
.in(IcHouseEntity::getNeighborHoodId, neighborHoodIdList); |
|
|
|
List<IcHouseEntity> buildingHouseCount = icHouseDao.selectList(icHouseEntityWrapper); |
|
|
|
Map<String, Long> buildingHouseCountMap = buildingHouseCount.stream().collect(Collectors.groupingBy(IcHouseEntity::getBuildingId, Collectors.counting())); |
|
|
|
//组合封装
|
|
|
|
|
|
|
|
List<BuildingTreeLevelDTO> buildingList = icBuildingList.stream().map(item -> { |
|
|
|
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO(); |
|
|
|
buildingTreeLevelDTO.setId(item.getId()); |
|
|
@ -246,9 +242,10 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
//02.11 之前录入的户数概念改为总户数,无需计算直接用就可以了
|
|
|
|
Integer total = null == item.getTotalHouseNum() ? NumConstant.ZERO : item.getTotalHouseNum(); |
|
|
|
//已经添加了多少户
|
|
|
|
LambdaQueryWrapper<IcHouseEntity> icHouseEntityWrapper = new QueryWrapper<IcHouseEntity>().lambda() |
|
|
|
.in(IcHouseEntity::getBuildingId, item.getId()); |
|
|
|
int count= icHouseDao.selectCount(icHouseEntityWrapper); |
|
|
|
// LambdaQueryWrapper<IcHouseEntity> icHouseEntityWrapper = new QueryWrapper<IcHouseEntity>().lambda()
|
|
|
|
// .in(IcHouseEntity::getBuildingId, item.getId());
|
|
|
|
// int count= icHouseDao.selectCount(icHouseEntityWrapper);
|
|
|
|
int count = buildingHouseCountMap.getOrDefault(item.getId(), NumConstant.ZERO_L).intValue(); |
|
|
|
if(NumConstant.ZERO==total){ |
|
|
|
buildingTreeLevelDTO.setShowNum(String.format("%s/%s",count,count)); |
|
|
|
}else{ |
|
|
|