| | |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import com.lf.server.service.all.BaseUploadService; |
| | | import org.apache.commons.text.StringEscapeUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | * 获取映射 |
| | | */ |
| | | private List<TabMapperEntity> getMappers(String zipPath, File[] files) { |
| | | String temp = pathHelper.getConfig().getTempPath(); |
| | | |
| | | List<TabMapperEntity> list = new ArrayList<>(); |
| | | for (File f : files) { |
| | | String fileName = FileHelper.getFileName(f.getPath()); |
| | | if (fileName.contains(XLS)) { |
| | | list.add(new TabMapperEntity(fileName, "xls", fileName)); |
| | | String path = f.getPath().replace(temp + File.separator, ""); |
| | | list.add(new TabMapperEntity(fileName, "xls", null, path)); |
| | | continue; |
| | | } |
| | | if (fileName.contains(MDB)) { |
| | | String path = f.getPath().replace(temp + File.separator, ""); |
| | | List<String> tabs = MdbHelper.getTabNames(f.getPath()); |
| | | for (String tab : tabs) { |
| | | list.add(new TabMapperEntity(fileName, "mdb", tab, fileName)); |
| | | list.add(new TabMapperEntity(fileName, "mdb", tab, path)); |
| | | } |
| | | continue; |
| | | } |
| | |
| | | List<String> files = new ArrayList<>(); |
| | | getShpFiles(subPath, files); |
| | | |
| | | String root = subPath.substring(0, subPath.lastIndexOf(File.separator) + 1); |
| | | String root = pathHelper.getConfig().getTempPath() + File.separator; |
| | | for (String file : files) { |
| | | String name = FileHelper.getFileName(file); |
| | | String path = file.replace(root, ""); |
| | |
| | | List<String> files = new ArrayList<>(); |
| | | getGdbFiles(subPath, files); |
| | | |
| | | String root = subPath.substring(0, subPath.lastIndexOf(File.separator) + 1); |
| | | String root = pathHelper.getConfig().getTempPath() + File.separator; |
| | | for (String file : files) { |
| | | String path = file.replace(root, ""); |
| | | List<String> tabs = GdbHelper.getTabNames(file); |
| | |
| | | case "shp": |
| | | case "gdb": |
| | | case "mdb": |
| | | String zipPath = FileHelper.getPath(temp + File.separator + mf.getPath()) + "_zip"; |
| | | insertDb(me.getType(), zipPath, mfe, tabs); |
| | | insertDb(me.getType(), temp, mfe, tabs); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | continue; |
| | | } |
| | | |
| | | String filePath = StringEscapeUtils.escapeJava(root + File.separator + tab.getSubPath()); |
| | | List<?> list = null; |
| | | switch (type) { |
| | | case "shp": |
| | | list = ShpHelper.readData(clazz, root + File.separator + tab.getSubPath()); |
| | | list = ShpHelper.readData(clazz, filePath); |
| | | break; |
| | | case "gdb": |
| | | list = GdbHelper.readData(clazz, root + File.separator + tab.getSubPath(), tab.getTab()); |
| | | list = GdbHelper.readData(clazz, filePath, tab.getTab()); |
| | | break; |
| | | case "mdb": |
| | | list = MdbHelper.readData(clazz, root + File.separator + tab.getSubPath(), tab.getTab()); |
| | | list = MdbHelper.readData(clazz, filePath, tab.getTab()); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | setCreateInfo(list, mfe); |
| | | |
| | | Integer rows = basicMapper.insertBatch(list); |
| | | if (basicMapper instanceof GeomBaseMapper) { |
| | | updateDbGeom((GeomBaseMapper) basicMapper, list); |
| | | } |
| | | |
| | | tab.setRows(rows); |
| | | } |