| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.service_community.dao.*; |
| | | import com.panzhihua.service_community.model.dos.*; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | import com.panzhihua.common.model.vos.grid.ComMngVillageBuildingVO; |
| | | import com.panzhihua.common.utlis.Snowflake; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.dao.ComActDAO; |
| | | import com.panzhihua.service_community.dao.ComActVillageDAO; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationDAO; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationHouseDAO; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationHouseDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngVillageDO; |
| | | import com.panzhihua.service_community.service.ComMngVillageService; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | /** |
| | | * @author: llming |
| | |
| | | ComMngPopulationDAO populationDAO; |
| | | @Resource |
| | | private ComMngPopulationHouseDAO comMngPopulationHouseDAO; |
| | | @Resource |
| | | private ComMngBuildingDAO comMngBuildingDAO; |
| | | |
| | | @Override |
| | | public R addComActVillage(ComMngVillageVO comMngVillageVO) { |
| | |
| | | @Override |
| | | public R listComActVillage(ComMngVillageVO comMngVillageVO) { |
| | | List<ComMngVillageDO> vos = Lists.newArrayList(); |
| | | LambdaQueryWrapper<ComMngVillageDO> param = new QueryWrapper<ComMngVillageDO>().lambda(); |
| | | param.eq(ComMngVillageDO::getAlley, comMngVillageVO.getAlley()); |
| | | param.eq(ComMngVillageDO::getCommunityId, comMngVillageVO.getCommunityId()); |
| | | List<ComMngVillageDO> comMngVillageDOS = comActVillageDAO.selectList(param); |
| | | BeanUtils.copyProperties(vos, comMngVillageDOS); |
| | | if(comMngVillageVO.getCommunityId()!=null){ |
| | | LambdaQueryWrapper<ComMngVillageDO> param = new QueryWrapper<ComMngVillageDO>().lambda(); |
| | | if(StringUtils.isNotEmpty(comMngVillageVO.getName())){ |
| | | param.like(ComMngVillageDO::getName, comMngVillageVO.getName()); |
| | | } |
| | | if(comMngVillageVO.getCommunityId()!=0){ |
| | | param.eq(ComMngVillageDO::getCommunityId, comMngVillageVO.getCommunityId()); |
| | | } |
| | | List<ComMngVillageDO> comMngVillageDOS = comActVillageDAO.selectList(param); |
| | | BeanUtils.copyProperties(comMngVillageDOS, vos); |
| | | if(CollectionUtils.isEmpty(comMngVillageDOS)){ |
| | | //默认添加小区 |
| | | ComMngVillageDO comMngVillageDO=new ComMngVillageDO(); |
| | | comMngVillageDO.setVillageId(1540264792718184449L); |
| | | comMngVillageDO.setType(1); |
| | | comMngVillageDO.setName("该社区/村暂未添加小区(院落),请先选择本项"); |
| | | comMngVillageDOS.add(comMngVillageDO); |
| | | } |
| | | return R.ok(comMngVillageDOS); |
| | | } |
| | | if(CollectionUtils.isEmpty(vos)){ |
| | | //默认添加小区 |
| | | ComMngVillageDO comMngVillageDO=new ComMngVillageDO(); |
| | | comMngVillageDO.setVillageId(1540264792718184449L); |
| | | comMngVillageDO.setType(1); |
| | | comMngVillageDO.setName("该社区/村暂未添加小区(院落),请先选择本项"); |
| | | vos.add(comMngVillageDO); |
| | | } |
| | | return R.ok(vos); |
| | | } |
| | | |
| | |
| | | } |
| | | Page userPage = new Page(pageComMngVillageDTO.getPageNum(), pageComMngVillageDTO.getPageSize()); |
| | | IPage<ComMngVillageDO> doPager = |
| | | comActVillageDAO.selectPage(userPage, userLambdaQueryWrapper.orderByDesc(ComMngVillageDO::getCreateAt)); |
| | | comActVillageDAO.selectPage(userPage, userLambdaQueryWrapper.orderByDesc(ComMngVillageDO::getName)); |
| | | |
| | | IPage<ComMngVillageVO> villageVOIPage = new Page<>(); |
| | | villageVOIPage.setCurrent(doPager.getCurrent()); |
| | |
| | | villageVO.setPopulationTotal(villageTotal.getPopulationTotal()); |
| | | } |
| | | villageVOList.add(villageVO); |
| | | |
| | | }); |
| | | villageVOIPage.setRecords(villageVOList); |
| | | } |
| | |
| | | boolean result = comMngVillageDOs.stream().anyMatch( |
| | | village -> village.getAlley().equals(vo.getAlley()) && village.getHouseNum().equals(vo.getHouseNum())); |
| | | if (result) { |
| | | return R.fail("导入街路巷已存在(" + vo.getAlley() + ")"); |
| | | return R.fail("导入街路巷重复(" + vo.getAlley() + ")"); |
| | | } |
| | | ComMngVillageDO comMngVillageDO=new ComMngVillageDO(); |
| | | BeanUtils.copyProperties(vo,comMngVillageDO); |
| | | comMngVillageDOs.add(comMngVillageDO); |
| | | index++; |
| | | } |
| | | ComActDO comActDO = comActDAO.selectById(communityId); |
| | |
| | | list.forEach(vo -> { |
| | | ComMngVillageDO comMngVillageDO = new ComMngVillageDO(); |
| | | BeanUtils.copyProperties(vo, comMngVillageDO); |
| | | if(StringUtils.isNotEmpty(vo.getType())){ |
| | | if("城镇".equals(vo.getType())){ |
| | | comMngVillageDO.setType(1); |
| | | } |
| | | else { |
| | | comMngVillageDO.setType(2); |
| | | } |
| | | } |
| | | comMngVillageDO.setCommunityId(comActDO.getCommunityId()); |
| | | comMngVillageDO.setStreetId(comActDO.getStreetId()); |
| | | StringBuilder path = new StringBuilder(); |
| | | path.append(vo.getAlley()).append(">").append(vo.getHouseNum()).append(">").append(vo.getGroupAt()); |
| | | comMngVillageDO.setPath(path.toString()); |
| | | comMngVillageDO.setUpdateAt(new Date()); |
| | | comMngVillageDO.setName(comMngVillageDO.getGroupAt()); |
| | | comMngVillageDOS.add(comMngVillageDO); |
| | | }); |
| | | this.saveBatch(comMngVillageDOS); |
| | | return R.ok("共计导入实有房屋数量:" + comMngVillageDOS.size()); |
| | | return R.ok("共计导入实有小区数量:" + comMngVillageDOS.size()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (comMngVillageDO == null) { |
| | | return R.fail("id有误!"); |
| | | } |
| | | BeanUtils.copyProperties(comMngVillageVO, comMngVillageDO); |
| | | if(!comMngVillageVO.getAlley().equals(comMngVillageDO.getAlley())&&!comMngVillageVO.getHouseNum().equals(comMngVillageDO.getHouseNum())){ |
| | | Integer count= this.baseMapper.selectCount(new QueryWrapper<ComMngVillageDO>().lambda().eq(ComMngVillageDO::getAlley,comMngVillageVO.getAlley()).eq(ComMngVillageDO::getHouseNum,comMngVillageVO.getHouseNum())); |
| | | if(count>0){ |
| | | return R.fail("街路巷已存在"); |
| | | } |
| | | //历史人口数据处理 |
| | | List<ComMngPopulationDO> populationDOS=this.populationDAO.selectList(new QueryWrapper<ComMngPopulationDO>().lambda().eq(ComMngPopulationDO::getVillageId,villageId)); |
| | | if(!populationDOS.isEmpty()){ |
| | | populationDOS.forEach(comMngPopulationDO -> { |
| | | comMngPopulationDO.setRoad(comMngVillageVO.getAlley()); |
| | | comMngPopulationDO.setDoorNo(comMngVillageVO.getHouseNum()); |
| | | comMngPopulationDO.setAddress(comMngPopulationDO.getAddress().replace(comMngVillageDO.getAlley()+comMngVillageDO.getHouseNum(),comMngVillageVO.getAlley()+comMngVillageVO.getHouseNum())); |
| | | this.populationDAO.updateById(comMngPopulationDO); |
| | | }); |
| | | } |
| | | //历史房屋数据处理 |
| | | List<ComMngPopulationHouseDO> comMngPopulationHouseDOS=this.comMngPopulationHouseDAO.selectList(new QueryWrapper<ComMngPopulationHouseDO>().lambda().eq(ComMngPopulationHouseDO::getVillageId,comMngVillageVO.getVillageId())); |
| | | if(!comMngPopulationHouseDOS.isEmpty()){ |
| | | comMngPopulationHouseDOS.forEach(comMngPopulationHouseDO -> { |
| | | comMngPopulationHouseDO.setAlley(comMngVillageVO.getAlley()); |
| | | comMngPopulationHouseDO.setHouseNum(comMngVillageVO.getHouseNum()); |
| | | comMngPopulationHouseDO.setAddress(comMngPopulationHouseDO.getAddress().replace(comMngVillageDO.getAlley()+comMngVillageDO.getHouseNum(),comMngVillageVO.getAlley()+comMngVillageVO.getHouseNum())); |
| | | this.comMngPopulationHouseDAO.updateById(comMngPopulationHouseDO); |
| | | }); |
| | | } |
| | | } |
| | | ComActDO comActDO = comActDAO.selectById(comMngVillageDO.getCommunityId()); |
| | | if (comActDO == null || comActDO.getStreetId() == null) { |
| | | return R.fail("社区没有绑定街道,请绑定后操作!"); |
| | | } |
| | | BeanUtils.copyProperties(comMngVillageVO, comMngVillageDO); |
| | | comMngVillageDO.setName(comMngVillageVO.getGroupAt()); |
| | | comMngVillageDO.setStreetId(comActDO.getStreetId()); |
| | | int update = this.baseMapper.update(comMngVillageDO, |
| | | new LambdaQueryWrapper<ComMngVillageDO>().eq(ComMngVillageDO::getVillageId, villageId)); |
| | |
| | | new Page(villageListAppDTO.getPageNum(), villageListAppDTO.getPageSize()), villageListAppDTO)); |
| | | } |
| | | |
| | | @Override |
| | | public R getGridVillageListApp(ComMngVillageListAppDTO villageListAppDTO) { |
| | | return R.ok(this.baseMapper.getGridVillageList( |
| | | new Page(villageListAppDTO.getPageNum(), villageListAppDTO.getPageSize()), villageListAppDTO)); |
| | | } |
| | | |
| | | /** |
| | | * 综治app-根据小区id查询小区下楼栋列表 |
| | | * |