| | |
| | | */ |
| | | private void loadData(List<MetaFileEntity> list) { |
| | | for (MetaFileEntity mf : list) { |
| | | if (StringHelper.isEmpty(mf.getEntity())) { |
| | | continue; |
| | | } |
| | | if (StaticData.SHP.equals(mf.getExtName()) || StaticData.GDB.equals(mf.getExtName())) { |
| | | loadSpatialData(mf); |
| | | } |
| | |
| | | if (StaticData.SHP.equals(mf.getExtName())) { |
| | | list = ShpHelper.readData(clazz, mf.getPath()); |
| | | } else { |
| | | GdbHelper.readData(clazz, mf.getPath(), mf.getTab()); |
| | | list = GdbHelper.readData(clazz, mf.getPath(), mf.getTab()); |
| | | } |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | |
| | | break; |
| | | case StaticData.GDB: |
| | | if (gdbList.contains(mf.getPath())) { |
| | | MetaEntity meta = metaService.selectByGuid(mf.getGuid()); |
| | | if (null != meta) { |
| | | mf.setPath(meta.getPath()); |
| | | String path = findPathByGuid(list, mf); |
| | | if (null != path) { |
| | | mf.setPath(path); |
| | | } |
| | | continue; |
| | | } |
| | |
| | | |
| | | File newFile = new File(targetPath); |
| | | if (newFile.exists()) { |
| | | mf.setMsg("文件已存在"); |
| | | file.delete(); |
| | | return 0; |
| | | } |
| | |
| | | |
| | | File newFile = new File(targetPath); |
| | | if (newFile.exists() && newFile.isDirectory()) { |
| | | mf.setMsg("文件已存在"); |
| | | FileHelper.deleteFiles(file); |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据GUID查找路径 |
| | | */ |
| | | private String findPathByGuid(List<MetaFileEntity> list, MetaFileEntity mf) { |
| | | for (MetaFileEntity meta : list) { |
| | | if (meta.getGuid().equals(mf.getGuid())) { |
| | | return meta.getPath(); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 插入元数据 |
| | | */ |
| | | private List<MetaEntity> insertMetas(List<MetaFileEntity> list) { |
| | |
| | | metas.add(createMeta(mf)); |
| | | } |
| | | } |
| | | if (metas.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | int rows = metaService.inserts(metas); |
| | | |