| | |
| | | List<DirEntity> dirs = dirService.selectDirRecursive(dir.getName()); |
| | | for (MetaFileEntity meta : metas) { |
| | | meta.setEventid(StringHelper.getGuid()); |
| | | meta.setDirid(dir.getId()); |
| | | meta.setDepid(ue.getDepid()); |
| | | meta.setDircode(dir.getCode()); |
| | | meta.setDepcode(ue.getDepcode()); |
| | | meta.setVerid(ver.getId()); |
| | | meta.setCreateUser(ue.getId()); |
| | | meta.setEpsgCode(epsgCode); |
| | |
| | | continue; |
| | | } |
| | | |
| | | int dirid = getDirByPath(f.getPath(), fileName, dir, dirs); |
| | | String dircode = getDirByPath(f.getPath(), fileName, dir, dirs); |
| | | boolean isShp = StaticData.SHP.equals(extName); |
| | | if (isGdb) { |
| | | List<MetaFileEntity> rs = getGdbMappers(f, meta, dirid, start); |
| | | List<MetaFileEntity> rs = getGdbMappers(f, meta, dircode, start); |
| | | if (null != rs && rs.size() > 0) { |
| | | list.addAll(rs); |
| | | } |
| | |
| | | } |
| | | |
| | | MetaFileEntity mf = createMetaFileEntity(meta); |
| | | mf.setDirid(dirid); |
| | | mf.setDircode(dircode); |
| | | mf.setEventid(StringHelper.getGuid()); |
| | | mf.setName(fileName); |
| | | mf.setExtName(extName); |
| | |
| | | */ |
| | | private MetaFileEntity createMetaFileEntity(MetaFileEntity meta) { |
| | | MetaFileEntity mf = new MetaFileEntity(); |
| | | mf.setDirid(meta.getDirid()); |
| | | mf.setDepid(meta.getDepid()); |
| | | mf.setDircode(meta.getDircode()); |
| | | mf.setDepcode(meta.getDepcode()); |
| | | mf.setVerid(meta.getVerid()); |
| | | mf.setCreateUser(meta.getCreateUser()); |
| | | mf.setEpsgCode(meta.getEpsgCode()); |
| | |
| | | /** |
| | | * 根据文件路径获取目录ID |
| | | */ |
| | | private int getDirByPath(String filePath,String fileName, DirEntity dir, List<DirEntity> dirs) { |
| | | private String getDirByPath(String filePath,String fileName, DirEntity dir, List<DirEntity> dirs) { |
| | | if (0 != dir.getPid() || null == dirs || dirs.isEmpty()) { |
| | | return dir.getId(); |
| | | return dir.getCode(); |
| | | } |
| | | if (StaticData.SLASH.equals(File.separator)) { |
| | | filePath = filePath.replace("/", "\\"); |
| | |
| | | |
| | | for (DirEntity entity : dirs) { |
| | | if (filePath.contains(entity.getFullName() + "\\" + fileName)) { |
| | | return entity.getId(); |
| | | return entity.getCode(); |
| | | } |
| | | } |
| | | |
| | | return dir.getId(); |
| | | return dir.getCode(); |
| | | } |
| | | |
| | | /** |
| | | * 获取SHP文件集合 |
| | | */ |
| | | private List<String> getShpFiles(String shpPath) { |
| | | private List<String> getShpFiles(String shpPath) { |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(shpPath); |
| | | |
| | |
| | | /** |
| | | * 获取GDB文件映射 |
| | | */ |
| | | private List<MetaFileEntity> getGdbMappers(File f, MetaFileEntity meta, int dirid, int start) { |
| | | private List<MetaFileEntity> getGdbMappers(File f, MetaFileEntity meta, String dircode, int start) { |
| | | List<String> tabs = GdbHelper.getTabNames(f.getPath()); |
| | | if (null == tabs || tabs.size() == 0) { |
| | | return null; |
| | |
| | | List<MetaFileEntity> list = new ArrayList<>(); |
| | | for (String tab : tabs) { |
| | | MetaFileEntity mf = createMetaFileEntity(meta); |
| | | mf.setDirid(dirid); |
| | | mf.setDircode(dircode); |
| | | mf.setEventid(StringHelper.getGuid()); |
| | | mf.setName(fileName); |
| | | mf.setExtName(extName); |