| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.utils.NodeTreeUtil; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | |
| | | |
| | | @Override |
| | | public IPage<GridVO> selectGridPage(IPage<GridVO> page, GridVO grid) { |
| | | return page.setRecords(baseMapper.selectGridPage(page, grid)); |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | return page.setRecords(baseMapper.selectGridPage(page, grid,regionChildCodesList,isAdministrator)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param isCovered |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importGrid(List<GridExcel> data, Boolean isCovered) { |
| | | List<GridEntity> list = new ArrayList<>(); |
| | | // 遍历 |
| | | for (GridExcel gridExcel : data) { |
| | | // 取出名称分隔 |
| | | String[] split = gridExcel.getGridName().split("居民委员会"); |
| | | String[] split = gridExcel.getGridName().split("第"); |
| | | GridEntity gridEntity = new GridEntity(); |
| | | String communityName = split[0] + "居民委员会"; |
| | | gridEntity.setCommunityName(communityName); |
| | | // 通过社区名称查询对应的社区编号 |
| | | QueryWrapper<Region> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("name",split[0]); |
| | | wrapper.like("name",split[0]); |
| | | System.out.println("社区名称 = " + split[0]); |
| | | Region region = regionService.getOne(wrapper); |
| | | if (null!=region){ |
| | | gridEntity.setCommunityCode(region.getCode()); |
| | |
| | | // 比对网格是否存在,如果已存在则更新,否则则新增 |
| | | QueryWrapper<GridEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_deleted",0) |
| | | .eq("grid_name",split[1]) |
| | | .eq("grid_name","第" + split[1]) |
| | | .eq("community_code",region.getCode()); |
| | | GridEntity one = getOne(queryWrapper); |
| | | if (null!=one){ |
| | | one.setGridCode(gridExcel.getGridCode()); |
| | | one.setGridName(split[1]); |
| | | one.setGridName("第" + split[1]); |
| | | one.setGeom(gridExcel.getGeom()); |
| | | one.setUpdateUser(AuthUtil.getUserId()); |
| | | one.setUpdateTime(new Date()); |
| | |
| | | }else { |
| | | // 设置网格数据 |
| | | gridEntity.setGridCode(gridExcel.getGridCode()); |
| | | gridEntity.setGridName(split[1]); |
| | | gridEntity.setGridName("第" + split[1]); |
| | | gridEntity.setGeom(gridExcel.getGeom()); |
| | | gridEntity.setCreateUser(AuthUtil.getUserId()); |
| | | gridEntity.setCreateTime(new Date()); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public GridVO getGridDetailByHouseCode(String houseCode) { |
| | | return baseMapper.getGridDetailByHouseCode(houseCode); |
| | | public GridVO getPlaceGridDetailByHouseCode(String houseCode) { |
| | | return baseMapper.getPlaceGridDetailByHouseCode(houseCode); |
| | | } |
| | | |
| | | /** |
| | |
| | | public Object getGridList(GridVO grid) { |
| | | return baseMapper.getGridList(grid); |
| | | } |
| | | |
| | | /** |
| | | * 查询小区网格绑定 |
| | | * @param aoiCode 小区aoiCode |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<GridVO> getGridListByAoiCode(String aoiCode) { |
| | | return baseMapper.getGridListByAoiCode(aoiCode); |
| | | } |
| | | |
| | | /** |
| | | * 查询对应网格人对应的网格 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public GridEntity getGridByUserId(Long userId) { |
| | | return baseMapper.getGridByUserId(userId); |
| | | } |
| | | |
| | | /** |
| | | * 根据网格名称,社区名称查询对应的网格 |
| | | * @param gridName |
| | | * @param communityName |
| | | * @return |
| | | */ |
| | | @Override |
| | | public GridEntity getGridByNames(String gridName, String communityName) { |
| | | return baseMapper.getGridByNames(gridName,communityName); |
| | | } |
| | | } |