From eefbb8708d62ce3ca9b0f00402d586c78716af77 Mon Sep 17 00:00:00 2001 From: manailin <261030956@qq.com> Date: 星期六, 12 六月 2021 17:37:07 +0800 Subject: [PATCH] [新增]导入特殊人群信息,导入小区,导入楼栋和网格信息 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java | 42 ++++++++++++++++++++++++++++++++++-------- 1 files changed, 34 insertions(+), 8 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java index 0e7e3b0..77d75e2 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java @@ -5,19 +5,23 @@ import com.google.common.collect.Lists; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngBuildingExcelVO; -import com.panzhihua.common.model.vos.community.ComMngPopulationImportErrorVO; +import com.panzhihua.common.utlis.Snowflake; import com.panzhihua.service_community.dao.ComActDAO; import com.panzhihua.service_community.dao.ComActVillageDAO; import com.panzhihua.service_community.dao.ComMngBuildingDAO; import com.panzhihua.service_community.model.dos.ComActDO; import com.panzhihua.service_community.model.dos.ComMngBuildingDO; import com.panzhihua.service_community.model.dos.ComMngVillageDO; +import com.panzhihua.service_community.model.dos.GridBuildRelationDO; import com.panzhihua.service_community.service.ComActBuildingService; +import com.panzhihua.service_community.service.GridBuildRelationService; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; /** * @author xyh @@ -30,18 +34,21 @@ private ComActVillageDAO comActVillageDAO; @Resource private ComActDAO comActDAO; + @Resource + private GridBuildRelationService gridBuildRelationService; @Override public R batchSaveBuilding(List<ComMngBuildingExcelVO> newVoList, Long communityId, Long streetId) { ArrayList<ComMngBuildingDO> list = Lists.newArrayList(); - for(ComMngBuildingExcelVO vo:newVoList){ + List<GridBuildRelationDO> keyList = new ArrayList<>(); + for (ComMngBuildingExcelVO vo : newVoList) { - ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley",vo.getAlley()).eq("house_num",vo.getDoorNo()).eq("community_id",communityId)); - if(comMngVillageDO == null){ + ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley", vo.getAlley()).eq("house_num", vo.getDoorNo()).eq("community_id", communityId)); + if (comMngVillageDO == null) { continue; } ComMngBuildingDO comMngBuildingDO = new ComMngBuildingDO(); - BeanUtils.copyProperties(vo,comMngBuildingDO); + BeanUtils.copyProperties(vo, comMngBuildingDO); comMngBuildingDO.setActId(comMngVillageDO.getCommunityId()); comMngBuildingDO.setStreetId(comMngVillageDO.getStreetId()); comMngBuildingDO.setVillageId(comMngVillageDO.getVillageId()); @@ -49,11 +56,30 @@ StringBuilder path = new StringBuilder(); path.append(vo.getAlley()).append(">").append(actDO.getName()).append(vo.getVillageName()).append(">").append(vo.getName()); comMngBuildingDO.setPath(path.toString()); - comMngBuildingDO.setGridId(null); + comMngBuildingDO.setGridId(vo.getGridId()); list.add(comMngBuildingDO); + GridBuildRelationDO gridBuildRelation = getGridBuildRelationDO(communityId, streetId, vo, comMngBuildingDO); + keyList.add(gridBuildRelation); } - + gridBuildRelationService.saveBatchGridBuildRelation(keyList); this.saveBatch(list); return R.ok(); } + + public GridBuildRelationDO getGridBuildRelationDO(Long communityId, Long streetId, ComMngBuildingExcelVO vo, ComMngBuildingDO comMngBuildingDO) { + GridBuildRelationDO gridBuildRelation = new GridBuildRelationDO(); + gridBuildRelation.setId(Snowflake.getId()); + gridBuildRelation.setBuildId(comMngBuildingDO.getId()); + gridBuildRelation.setBuildName(comMngBuildingDO.getPath()); + gridBuildRelation.setVillageId(comMngBuildingDO.getVillageId()); + gridBuildRelation.setGridCommunityId(communityId); + gridBuildRelation.setGridStreetId(streetId); + if (vo.getGridId() != null) { + gridBuildRelation.setGridId(Long.valueOf(vo.getGridId())); + } + gridBuildRelation.setGridName(vo.getGridName()); + gridBuildRelation.setType(1); + gridBuildRelation.setCreateAt(new Date()); + return gridBuildRelation; + } } -- Gitblit v1.7.1