| | |
| | | return R.fail("用户信息不存在"); |
| | | } |
| | | if(StringUtils.isNotEmpty(comMngPopulationDO.getBirthday())){//计算年龄 |
| | | comMngPopulationDO.setAge(AgeUtils.getAgeFromBirthTime(comMngPopulationDO.getBirthday())); |
| | | comMngPopulationDO.setAge(AgeUtils.getAgeFromBirthTimes(comMngPopulationDO.getBirthday())); |
| | | } |
| | | |
| | | ComMngPopulationVO comMngPopulationVO = new ComMngPopulationVO(); |
| | |
| | | //查询当前用户房屋信息 |
| | | List<ComMngHouseVo> houseList = comMngPopulationHouseDAO.getPopulHouseListByPopulId(populationId); |
| | | if(!houseList.isEmpty()){ |
| | | houseList.forEach(house ->{ |
| | | |
| | | }); |
| | | comMngPopulationVO.setHouseList(houseList); |
| | | } |
| | | |
| | |
| | | if(!iPage.getRecords().isEmpty()){ |
| | | iPage.getRecords().forEach(populDO -> { |
| | | if(StringUtils.isNotEmpty(populDO.getBirthday())){ |
| | | populDO.setAge(AgeUtils.getAgeFromBirthTime(populDO.getBirthday())); |
| | | populDO.setAge(AgeUtils.getAgeFromBirthTimes(populDO.getBirthday())); |
| | | } |
| | | }); |
| | | } |
| | |
| | | int index = 2; |
| | | //处理实有人口信息 |
| | | List<ComMngPopulationDO> savePopulList = new ArrayList<>(); |
| | | List<ComMngPopulationHouseDO> saveHouseList = new ArrayList<>(); |
| | | for (ComMngPopulationServeExcelVO vo : list) { |
| | | String address = ""; |
| | | //查询街路巷是否存在 |
| | |
| | | |
| | | //先判断房屋是否存在 |
| | | ComMngPopulationHouseDO populationHouseDO = comMngPopulationHouseDAO.selectOne(new QueryWrapper<ComMngPopulationHouseDO>().lambda() |
| | | .eq(ComMngPopulationHouseDO::getCommunityId,communityId).eq(ComMngPopulationHouseDO::getAlley,vo.getRoad()).eq(ComMngPopulationHouseDO::getHouseNum,vo.getDoorNo()) |
| | | .eq(ComMngPopulationHouseDO::getCommunityId,communityId).eq(ComMngPopulationHouseDO::getVillageId,comMngVillageDO.getVillageId()) |
| | | .eq(ComMngPopulationHouseDO::getFloor,vo.getFloor()).eq(ComMngPopulationHouseDO::getUnitNo,vo.getUnitNo()) |
| | | .eq(ComMngPopulationHouseDO::getHouseNo,vo.getHouseNo())); |
| | | if(populationHouseDO == null){ |
| | | //查询该房屋未建立,执行建立房屋信息 |
| | | populationHouseDO = new ComMngPopulationHouseDO(); |
| | | populationHouseDO.setAlley(vo.getRoad()); |
| | | populationHouseDO.setHouseNum(vo.getDoorNo()); |
| | | populationHouseDO.setCommunityId(communityId); |
| | | populationHouseDO.setFloor(vo.getFloor()); |
| | | populationHouseDO.setUnitNo(vo.getUnitNo()); |
| | | populationHouseDO.setHouseNo(vo.getHouseNo()); |
| | | populationHouseDO.setAddress(address); |
| | | if(StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())){ |
| | | populationHouseDO.setIsEmpty(PopulIsOksEnum.YES.getCode()); |
| | | boolean isExits = true; |
| | | if(!saveHouseList.isEmpty()){ |
| | | for (ComMngPopulationHouseDO saveHouse:saveHouseList){ |
| | | if(saveHouse.getVillageId().equals(comMngVillageDO.getVillageId()) |
| | | && saveHouse.getFloor().equals(vo.getFloor()) && saveHouse.getUnitNo().equals(vo.getUnitNo()) |
| | | && saveHouse.getHouseNo().equals(vo.getHouseNo())){ |
| | | populationHouseDO = saveHouse; |
| | | isExits = false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if(vo.getHouseStatus() != null){ |
| | | populationHouseDO.setStatus(vo.getHouseStatus()); |
| | | if(isExits){ |
| | | //查询该房屋未建立,执行建立房屋信息 |
| | | populationHouseDO = new ComMngPopulationHouseDO(); |
| | | populationHouseDO.setVillageId(comMngVillageDO.getVillageId()); |
| | | populationHouseDO.setCommunityId(communityId); |
| | | populationHouseDO.setFloor(vo.getFloor()); |
| | | populationHouseDO.setUnitNo(vo.getUnitNo()); |
| | | populationHouseDO.setHouseNo(vo.getHouseNo()); |
| | | populationHouseDO.setAddress(address); |
| | | if(StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())){ |
| | | populationHouseDO.setIsEmpty(PopulIsOksEnum.YES.getCode()); |
| | | } |
| | | if(vo.getHouseStatus() != null){ |
| | | populationHouseDO.setStatus(vo.getHouseStatus()); |
| | | } |
| | | if(vo.getHousePurpose() != null){ |
| | | populationHouseDO.setPurpose(vo.getHousePurpose()); |
| | | } |
| | | if(vo.getControlStatus() != null){ |
| | | populationHouseDO.setControlStatus(vo.getControlStatus()); |
| | | } |
| | | comMngPopulationHouseDAO.insert(populationHouseDO); |
| | | saveHouseList.add(populationHouseDO); |
| | | } |
| | | if(vo.getHousePurpose() != null){ |
| | | populationHouseDO.setPurpose(vo.getHousePurpose()); |
| | | } |
| | | if(vo.getControlStatus() != null){ |
| | | populationHouseDO.setControlStatus(vo.getControlStatus()); |
| | | } |
| | | comMngPopulationHouseDAO.insert(populationHouseDO); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())){ |
| | |
| | | populationDO.setStreetId(comActDO.getStreetId()); |
| | | } |
| | | |
| | | //查询当前用户所有房屋id |
| | | List<Long> houseIds = comMngPopulationHouseUserDAO.getPopulationHouseIdByUserId(vo.getId()); |
| | | //清除用户房屋居住信息 |
| | | comMngPopulationHouseUserDAO.deletePopulationHouseByUserId(vo.getId()); |
| | | if(!houseIds.isEmpty()){ |
| | | houseIds.forEach(houseId -> { |
| | | //查询当前房屋下是否有人口信息,如果没有则将房屋设置为空户 |
| | | List<Long> oldHouseIds = comMngPopulationHouseUserDAO.getPopulationHouseIdByhHosueId(houseId); |
| | | if(oldHouseIds.isEmpty()){ |
| | | //修改房屋信息为空户 |
| | | comMngPopulationHouseDAO.updateHouseByIsEmpty(houseId,1); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | //更新用户的房屋信息 |
| | | Long houseId = null; |
| | |
| | | houseId = houseEditDto.getId();//居住地 |
| | | } |
| | | populationHouseUserDOList.add(populationHouseUserDO); |
| | | |
| | | //修改房屋信息不为空户 |
| | | comMngPopulationHouseDAO.updateHouseByIsEmpty(houseEditDto.getId(),2); |
| | | } |
| | | } |
| | | comMngPopulationHouseUserService.saveBatch(populationHouseUserDOList); |