From 70d2a5d0f9c6951b2d4cac954041ed73582ff7eb Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期一, 09 六月 2025 11:54:00 +0800 Subject: [PATCH] 6.9新增登录失败冻结逻辑 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java | 82 +++++++++++++++++++++++++++-------------- 1 files changed, 54 insertions(+), 28 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java index c731023..24d319a 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java @@ -28,6 +28,7 @@ import com.panzhihua.common.utlis.Snowflake; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_community.service.ComMngVillageService; +import org.springframework.util.CollectionUtils; /** * @author: llming @@ -80,11 +81,34 @@ @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); } @@ -227,33 +251,35 @@ if (comMngVillageDO == null) { return R.fail("id有误!"); } - 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("街路巷已存在"); + 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("社区没有绑定街道,请绑定后操作!"); - } - //历史人口数据处理 - 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); - }); } BeanUtils.copyProperties(comMngVillageVO, comMngVillageDO); comMngVillageDO.setName(comMngVillageVO.getGroupAt()); -- Gitblit v1.7.1