From 13e7eb21936345a70e77905dd85c2403de80db62 Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期五, 27 五月 2022 10:52:05 +0800 Subject: [PATCH] bug修改 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java | 28 ++++++++++++++++++---------- 1 files changed, 18 insertions(+), 10 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 b38f725..7e7d3b0 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 @@ -6,6 +6,8 @@ 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; @@ -25,14 +27,6 @@ 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; /** @@ -50,6 +44,8 @@ ComMngPopulationDAO populationDAO; @Resource private ComMngPopulationHouseDAO comMngPopulationHouseDAO; + @Resource + private ComMngBuildingDAO comMngBuildingDAO; @Override public R addComActVillage(ComMngVillageVO comMngVillageVO) { @@ -231,12 +227,24 @@ if (comMngVillageDO == null) { return R.fail("id有误!"); } - BeanUtils.copyProperties(comMngVillageVO, comMngVillageDO); - comMngVillageDO.setName(comMngVillageVO.getGroupAt()); + 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("街路巷已存在"); + } 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.setAddress(comMngPopulationDO.getAddress().replace(comMngVillageDO.getAlley()+comMngVillageDO.getHouseNum(),comMngVillageVO.getAlley()+comMngVillageVO.getHouseNum())); + this.populationDAO.updateById(comMngPopulationDO); + }); + } + 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)); -- Gitblit v1.7.1