| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | 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; |
| | |
| | | private ComActDAO comActDAO; |
| | | |
| | | @Override |
| | | public R batchSaveBuilding(List<ComMngBuildingExcelVO> newVoList, Long communityId, Long streetId) { |
| | | public R batchSaveBuilding(List<ComMngBuildingExcelVO> newVoList, Long communityId) { |
| | | ArrayList<ComMngBuildingDO> list = Lists.newArrayList(); |
| | | int index = 2; |
| | | List<ComMngPopulationImportErrorVO> errorList = 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){ |
| | | continue; |
| | | } |
| | | 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); |
| | | continue; |
| | | } |
| | | ComMngBuildingDO comMngBuildingDO = new ComMngBuildingDO(); |
| | |
| | | comMngBuildingDO.setPath(path.toString()); |
| | | comMngBuildingDO.setGridId(null); |
| | | list.add(comMngBuildingDO); |
| | | index ++; |
| | | } |
| | | |
| | | if(list.size()>0){ |
| | | this.saveBatch(list); |
| | | } |
| | | |
| | | if(errorList.size() > 0){ |
| | | return R.fail(JSON.toJSONString(errorList)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |