| | |
| | | /** |
| | | * 创建Zip包 |
| | | */ |
| | | public String createZipFile(UserEntity ue, List<String> entities, String wkt, String pwd) throws Exception { |
| | | Map<String, List<?>> map = queryData(entities, wkt); |
| | | public String createZipFile(UserEntity ue, List<String> entities, String depcode, String dirs, String wkt, String pwd) throws Exception { |
| | | Map<String, List<?>> map = queryData(entities, depcode, dirs, wkt); |
| | | if (map.size() == 0) { |
| | | return null; |
| | | } |
| | |
| | | /** |
| | | * 查询数据 |
| | | */ |
| | | private Map<String, List<?>> queryData(List<String> entities, String wkt) { |
| | | private Map<String, List<?>> queryData(List<String> entities, String depcode, String dirs, String wkt) { |
| | | Map<String, List<?>> map = new HashMap<>(5); |
| | | for (String enity : entities) { |
| | | try { |
| | |
| | | continue; |
| | | } |
| | | |
| | | QueryWrapper wrapper = createWrapper(baseMapper, wkt); |
| | | QueryWrapper wrapper = createWrapper(baseMapper, depcode, dirs, wkt); |
| | | List<?> list = baseMapper.selectList(wrapper); |
| | | if (null == list || list.size() == 0) { |
| | | continue; |
| | |
| | | /** |
| | | * 创建QueryWrapper |
| | | */ |
| | | private QueryWrapper createWrapper(GeomBaseMapper baseMapper, String wkt) { |
| | | private QueryWrapper createWrapper(BasicMapper baseMapper, String depcode, String dirs, String wkt) { |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.select("ST_AsText(geom) as geom, *"); |
| | | if (baseMapper instanceof GeomBaseMapper) { |
| | | wrapper.select("ST_AsText(geom) as geom, *"); |
| | | |
| | | Integer srid = baseQueryService.getSrid(baseMapper); |
| | | if (null != srid) { |
| | | wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", wkt, srid)); |
| | | Integer srid = baseQueryService.getSrid((GeomBaseMapper) baseMapper); |
| | | if (null != srid) { |
| | | wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", wkt, srid)); |
| | | } |
| | | } |
| | | if (!StringHelper.isEmpty(depcode)) { |
| | | wrapper.likeRight("depid", depcode); |
| | | } |
| | | |
| | | dirs = DataLibService.copeCodes(dirs, "dirid"); |
| | | if (!StringHelper.isEmpty(dirs)) { |
| | | wrapper.apply(dirs); |
| | | } |
| | | |
| | | return wrapper; |
| | |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) throws Exception { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |
| | | // 1-Shp文件,2-专题图,3-源数据,4-业务数据,5-管道分析,6-统计报告 |
| | | // 1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析,6-统计报告 |
| | | de.setType(4); |
| | | de.setSizes(FileHelper.sizeToMb(new File(file).length())); |
| | | de.setDepid(ue.getDepid()); |
| | |
| | | /** |
| | | * 打包DB数据 |
| | | */ |
| | | public String zipDbData(UserEntity ue, String name, String filter, String pwd) throws Exception { |
| | | public String zipDbData(UserEntity ue, String name, String depcode, String dirs, String filter, String pwd) throws Exception { |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(name); |
| | | if (baseMapper == null) { |
| | | return null; |
| | |
| | | if (baseMapper instanceof GeomBaseMapper) { |
| | | wrapper.select("ST_AsText(geom) as geom, *"); |
| | | } |
| | | if (!StringHelper.isEmpty(depcode)) { |
| | | wrapper.likeRight("depid", depcode); |
| | | } |
| | | |
| | | dirs = DataLibService.copeCodes(dirs, "dirid"); |
| | | if (!StringHelper.isEmpty(dirs)) { |
| | | wrapper.apply(dirs); |
| | | } |
| | | |
| | | List<?> list = baseMapper.selectList(wrapper); |
| | | if (null == list || 0 == list.size()) { |