From 089660d464ee9423dd724177ba5fa82afb9d5920 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期五, 15 十月 2021 16:24:53 +0800 Subject: [PATCH] 运营后台首页模块开发以及实有房屋导入接口开发 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java | 37 +++++++++++++++++++------------------ 1 files changed, 19 insertions(+), 18 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 e3bdc70..9e21817 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 @@ -1,6 +1,5 @@ package com.panzhihua.service_community.service.impl; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -27,7 +26,6 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; -import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Lists; @@ -65,22 +63,24 @@ ArrayList<ComMngBuildingDO> list = Lists.newArrayList(); List<GridBuildRelationDO> keyList = new ArrayList<>(); List<ComMngPopulationImportErrorVO> errorList = new ArrayList<>(); - ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); - importErrorVO.setErrorMsg("重复楼栋"); - StringBuilder sb = new StringBuilder(); 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) { + ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); + BeanUtils.copyProperties(vo,importErrorVO); + importErrorVO.setErrorMsg("该社区不存在此街路巷"); + errorList.add(importErrorVO); continue; } vo.setName(vo.getName().replace("栋", "")); List<ComMngBuildingDO> buildingDOList = this.baseMapper.selectList(new QueryWrapper<ComMngBuildingDO>() - .eq("street_id", comMngVillageDO.getStreetId()).eq("act_id", communityId) - .eq("village_id", comMngVillageDO.getVillageId()).eq("name", vo.getName())); + .eq("act_id", communityId).eq("village_id", comMngVillageDO.getVillageId()).eq("name", vo.getName())); if (buildingDOList.size() > 0) { - sb.append("街路巷:").append(vo.getAlley()).append(",门牌号:").append(vo.getDoorNo()).append(",楼栋号:") - .append(vo.getName()).append(";"); + ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); + BeanUtils.copyProperties(vo,importErrorVO); + importErrorVO.setErrorMsg("该楼栋已存在"); + errorList.add(importErrorVO); continue; } ComMngBuildingDO comMngBuildingDO = new ComMngBuildingDO(); @@ -88,12 +88,13 @@ comMngBuildingDO.setActId(comMngVillageDO.getCommunityId()); comMngBuildingDO.setStreetId(comMngVillageDO.getStreetId()); comMngBuildingDO.setVillageId(comMngVillageDO.getVillageId()); +// comMngBuildingDO.setElevatorTotal(vo.getElevatorTotal()); ComActDO actDO = comActDAO.selectById(comMngVillageDO.getCommunityId()); StringBuilder path = new StringBuilder(); path.append(vo.getAlley()).append(">").append(actDO.getName()).append(comMngVillageDO.getName()).append(">") .append(vo.getName()); comMngBuildingDO.setPath(path.toString()); - comMngBuildingDO.setGridId(vo.getGridId()); +// comMngBuildingDO.setGridId(vo.getGridId()); list.add(comMngBuildingDO); GridBuildRelationDO gridBuildRelation = getGridBuildRelationDO(communityId, comMngVillageDO.getStreetId(), vo, comMngBuildingDO); @@ -102,13 +103,13 @@ if (list.size() > 0) { this.saveBatch(list); + if(keyList.size() > 0){ + gridBuildRelationService.saveBatchGridBuildRelation(keyList); + } } - if (sb.length() > 0 && !StringUtils.isEmpty(sb.toString())) { - errorList.add(importErrorVO); - return R.fail(JSON.toJSONString(errorList)); + if (errorList.size() > 0) { + return R.fail(errorList); } - gridBuildRelationService.saveBatchGridBuildRelation(keyList); - this.saveBatch(list); return R.ok(); } @@ -121,9 +122,9 @@ gridBuildRelation.setVillageId(comMngBuildingDO.getVillageId()); gridBuildRelation.setGridCommunityId(communityId); gridBuildRelation.setGridStreetId(streetId); - if (vo.getGridId() != null) { - gridBuildRelation.setGridId(Long.valueOf(vo.getGridId())); - } +// if (vo.getGridId() != null) { +// gridBuildRelation.setGridId(Long.valueOf(vo.getGridId())); +// } gridBuildRelation.setGridName(vo.getGridName()); gridBuildRelation.setType(1); gridBuildRelation.setCreateAt(new Date()); -- Gitblit v1.7.1