| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.common.model.dtos.community.ComMngPopulationHouseInsertAdminDTO; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.service.ComMngPopulationHouseUserService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private ComActVillageDAO comActVillageDAO; |
| | | @Resource |
| | | private ComMngPopulationHouseDAO comMngPopulationHouseDAO; |
| | | @Resource |
| | | private ComMngPopulationHouseService comMngPopulationHouseService; |
| | | @Resource |
| | | private ComMngPopulationHouseUserService comMngPopulationHouseUserService; |
| | | |
| | | private static <T> Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor) { |
| | | Map<Object, Boolean> seen = new ConcurrentHashMap<>(); |
| | |
| | | cascadeHouseVOList = this.baseMapper.getHouseLevelByAlley(cascadeHouseDTO.getCommunityId(), |
| | | cascadeHouseDTO.getVillageId()); |
| | | cascadeHouseVOList = cascadeHouseVOList.stream() |
| | | .collect(Collectors.collectingAndThen( |
| | | Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getAlley()))), |
| | | ArrayList::new)); |
| | | .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>( |
| | | Comparator.comparing(ComMngCascadeHouseVO::getAlley))),ArrayList::new)); |
| | | cascadeHouseVOList.forEach(cascade -> { |
| | | cascade.setName(cascade.getAlley()); |
| | | }); |
| | |
| | | return R.ok(this.comMngPopulationDAO.getSecondHouseAddress(cascadeHouseDTO.getCommunityId())); |
| | | } |
| | | |
| | | @Override |
| | | public R getSecondHouse(CascadeHouseDTO cascadeHouseDTO) { |
| | | return R.ok(this.comMngPopulationDAO.getSecondHouse(cascadeHouseDTO.getCommunityId())); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询房屋列表 |
| | | * |
| | |
| | | break; |
| | | case 2: |
| | | populationHouseAdminDTO.setRoad(houseDO.getAlley()); |
| | | populationHouseAdminDTO.setDoorNo(houseDO.getHouseNum()); |
| | | // populationHouseAdminDTO.setDoorNo(houseDO.getHouseNum()); |
| | | break; |
| | | case 3: |
| | | populationHouseAdminDTO.setRoad(houseDO.getAlley()); |
| | | populationHouseAdminDTO.setDoorNo(houseDO.getHouseNum()); |
| | | populationHouseAdminDTO.setFloor(houseDO.getFloor()); |
| | | // populationHouseAdminDTO.setFloor(houseDO.getFloor()); |
| | | break; |
| | | case 4: |
| | | populationHouseAdminDTO.setRoad(houseDO.getAlley()); |
| | | populationHouseAdminDTO.setDoorNo(houseDO.getHouseNum()); |
| | | populationHouseAdminDTO.setFloor(houseDO.getFloor()); |
| | | populationHouseAdminDTO.setUnitNo(houseDO.getUnitNo()); |
| | | // populationHouseAdminDTO.setUnitNo(houseDO.getUnitNo()); |
| | | break; |
| | | case 5: |
| | | populationHouseAdminDTO.setRoad(houseDO.getAlley()); |
| | | populationHouseAdminDTO.setDoorNo(houseDO.getHouseNum()); |
| | | populationHouseAdminDTO.setFloor(houseDO.getFloor()); |
| | | populationHouseAdminDTO.setUnitNo(houseDO.getUnitNo()); |
| | | populationHouseAdminDTO.setHouseNo(houseDO.getHouseNo()); |
| | | if(populationHouseAdminDTO.getLevelIsAll() == null){ |
| | | populationHouseAdminDTO.setHouseNo(houseDO.getHouseNo()); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | } |
| | | // 查询该房屋的住户信息 |
| | | List<PopulationListVO> populationList = |
| | | this.baseMapper.getGridVillageBuildingPopulationList(buildingHouseDetailVO.getId(), null, 1); |
| | | this.baseMapper.getGridVillageBuildingPopulationList(buildingHouseDetailVO.getId(), null, null); |
| | | if (!populationList.isEmpty()) { |
| | | populationList.forEach(population -> { |
| | | try { |
| | |
| | | return R.ok(subordinateList); |
| | | } |
| | | |
| | | @Override |
| | | public R populationRelationHouse(ComMngPopulationRelationHouseDTO relationHouseDTO) { |
| | | |
| | | if (relationHouseDTO.getPopulationId().isEmpty()) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 实有房屋数据修复定时任务 |
| | | * @return 实有房屋数据修复定时任务 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public R timedTaskHouseJobHandler(){ |
| | | |
| | | //需要修改的房屋信息 |
| | | List<ComMngPopulationHouseDO> updateHouseList = new ArrayList<>(); |
| | | //需要修改的房屋人员关系信息 |
| | | List<ComMngPopulationHouseUserDO> updateHouseUserList = new ArrayList<>(); |
| | | |
| | | ComMngPopulationDO population = new ComMngPopulationDO(); |
| | | |
| | | //查询所有房屋列表信息 |
| | | List<ComMngPopulationHouseDO> houseList = comMngPopulationHouseDAO.selectList(null); |
| | | //遍历房屋信息 |
| | | for (ComMngPopulationHouseDO house : houseList) { |
| | | List<ComMngPopulationHouseUserDO> houseUserList = comMngPopulationHouseUserDAO.selectList(new QueryWrapper<ComMngPopulationHouseUserDO>() |
| | | .lambda().eq(ComMngPopulationHouseUserDO::getHouseId,house.getId())); |
| | | if(houseUserList.isEmpty()){ |
| | | house.setStatus(ComMngPopulationHouseDO.status.kongzhi); |
| | | }else{ |
| | | house.setStatus(ComMngPopulationHouseDO.status.zizhu); |
| | | |
| | | //查询该房屋下人员是否是租住状态 |
| | | List<Long> populationIds = houseUserList.stream().map(ComMngPopulationHouseUserDO::getPopulId).collect(Collectors.toList()); |
| | | Integer count = comMngPopulationHouseUserDAO.getHouseUserIsRent(populationIds); |
| | | if(count > 0){ |
| | | house.setStatus(ComMngPopulationHouseDO.status.zuzhu); |
| | | } |
| | | |
| | | //查询该房屋下人员的关联信息的关系 |
| | | for (ComMngPopulationHouseUserDO houseUser : houseUserList) { |
| | | population = comMngPopulationDAO.selectById(houseUser.getPopulId()); |
| | | if(population != null){ |
| | | if(population.getIsRent() != null && population.getIsRent().equals(ComMngPopulationDO.isOk.yes)){ |
| | | houseUser.setRelationId(ComMngPopulationHouseUserDO.relationId.zuhu); |
| | | }else { |
| | | houseUser.setRelationId(ComMngPopulationHouseUserDO.relationId.zuzhu); |
| | | } |
| | | updateHouseUserList.add(houseUser); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //查看房子的楼层排序 |
| | | if(house.getFloorNum() == null && StringUtils.isNotEmpty(house.getHouseNo())){ |
| | | boolean result = house.getHouseNo().matches("[0-9]+"); |
| | | if (result) {// 该字段为纯数字 |
| | | if (house.getHouseNo().length() == 4) { |
| | | String floorNum = house.getHouseNo().substring(0, 2).replaceAll("^(0+)", ""); |
| | | if(StringUtils.isNotEmpty(floorNum)){ |
| | | house.setFloorNum(Integer.parseInt(floorNum)); |
| | | } |
| | | } else if (house.getHouseNo().length() == 3) { |
| | | String floorNum = house.getHouseNo().substring(0, 1).replaceAll("^(0+)", ""); |
| | | if(StringUtils.isNotEmpty(floorNum)){ |
| | | house.setFloorNum(Integer.parseInt(floorNum)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | updateHouseList.add(house); |
| | | } |
| | | |
| | | if(!updateHouseList.isEmpty()){ |
| | | comMngPopulationHouseService.updateBatchById(updateHouseList); |
| | | } |
| | | |
| | | if(!updateHouseUserList.isEmpty()){ |
| | | comMngPopulationHouseUserService.updateBatchById(updateHouseUserList); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |