| | |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = dataLibService.createZipFile(ue, dre.getEntities(), dre.getWkt(), dre.getPwd()); |
| | | String depcode = null == dre.getDepcodes() || dre.getDepcodes().isEmpty() ? null : dre.getDepcodes().get(0); |
| | | String guid = dataLibService.createZipFile(ue, dre.getEntities(), depcode, dre.getDirs(), dre.getWkt(), dre.getPwd()); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | |
| | | List<String> entities = Arrays.asList(entity.getEntities().split(",")); |
| | | String pwd = AesHelper.decrypt(entity.getPwd()); |
| | | |
| | | dataLibService.createZipFile(ue, entities, entity.getWkt(), pwd); |
| | | dataLibService.createZipFile(ue, entities, null, null, entity.getWkt(), pwd); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | |
| | | /** |
| | | * 创建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; |