manailin
2021-06-20 1390400a03b5088a0a23fc02ee9969ca8b8fef07
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java
@@ -8,6 +8,7 @@
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.common.utlis.StringUtils;
import com.panzhihua.service_community.dao.ComActDAO;
import com.panzhihua.service_community.dao.ComActVillageDAO;
import com.panzhihua.service_community.dao.ComMngBuildingDAO;
@@ -42,9 +43,11 @@
    @Override
    public R batchSaveBuilding(List<ComMngBuildingExcelVO> newVoList, Long communityId) {
        ArrayList<ComMngBuildingDO> list = Lists.newArrayList();
        int index = 2;
        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){
@@ -52,10 +55,7 @@
            }
            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()));
            if(buildingDOList.size() > 0){
                ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
                importErrorVO.setErrorMsg("重复楼栋");
                importErrorVO.setErrorPosition("第" + index + "行");
                errorList.add(importErrorVO);
                sb.append("街路巷:").append(vo.getAlley()).append(",门牌号:").append(vo.getDoorNo()).append(",楼栋号:").append(vo.getName()).append(";");
                continue;
            }
            ComMngBuildingDO comMngBuildingDO = new ComMngBuildingDO();
@@ -65,11 +65,10 @@
            comMngBuildingDO.setVillageId(comMngVillageDO.getVillageId());
            ComActDO actDO = comActDAO.selectById(comMngVillageDO.getCommunityId());
            StringBuilder path = new StringBuilder();
            path.append(vo.getAlley()).append(">").append(actDO.getName()).append(vo.getVillageName()).append(">").append(vo.getName());
            path.append(vo.getAlley()).append(">").append(actDO.getName()).append(comMngVillageDO.getName()).append(">").append(vo.getName());
            comMngBuildingDO.setPath(path.toString());
            comMngBuildingDO.setGridId(vo.getGridId());
            list.add(comMngBuildingDO);
            index ++;
            GridBuildRelationDO gridBuildRelation = getGridBuildRelationDO(communityId, comMngVillageDO.getStreetId(), vo, comMngBuildingDO);
            keyList.add(gridBuildRelation);
        }
@@ -77,8 +76,8 @@
        if(list.size()>0){
            this.saveBatch(list);
        }
        if(errorList.size() > 0){
        if(sb.length() > 0 && !StringUtils.isEmpty(sb.toString())){
            errorList.add(importErrorVO);
            return R.fail(JSON.toJSONString(errorList));
        }
        gridBuildRelationService.saveBatchGridBuildRelation(keyList);