| | |
| | | select * from bs.m_pipeline where parentid in ('fdac47da-8879-478d-b67c-9624e8b79d6c') |
| | | select * from lf.sys_attach where tab='bs.m_pipeline' and tab_guid in (select eventid from bs.m_pipeline where parentid in ('fdac47da-8879-478d-b67c-9624e8b79d6c')) |
| | | |
| | | select * from lf.sys_publish |
| | | select * from lf.sys_apply order by id desc |
| | | select * from lf.sys_download order by id desc |
| | | |
| | | |
| | | |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "请求DB数据下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "dre", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | @ApiImplicitParam(name = "dr", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadDbReq") |
| | | public ResponseMsg<Object> downloadDbReq(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { |
| | | public ResponseMsg<Object> downloadDbReq(@RequestBody DownloadReqEntity dr, HttpServletRequest req) { |
| | | try { |
| | | if (null == dre || StringHelper.isEmpty(dre.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (null == dre.getEntities() || dre.getEntities().isEmpty()) { |
| | | if (null == dr || null == dr.getEntities() || dr.getEntities().isEmpty()) { |
| | | return fail("请选择要下载的实体名"); |
| | | } |
| | | dre.setWkt(AesHelper.decrypt(dre.getWkt())); |
| | | if (StringHelper.isEmpty(dre.getWkt())) { |
| | | return fail("请选择要下载的WKT范围"); |
| | | if (StringHelper.isEmpty(dr.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (!DownloadService.decryptPwd(dre)) { |
| | | if (!DownloadService.decryptPwd(dr)) { |
| | | return fail("密码解密失败", null); |
| | | } |
| | | if (StringHelper.isPwdInvalid(dre.getPwd())) { |
| | | if (StringHelper.isPwdInvalid(dr.getPwd())) { |
| | | return fail("密码不符合要求"); |
| | | } |
| | | if (!StringHelper.isEmpty(dr.getWkt())) { |
| | | dr.setWkt(AesHelper.decrypt(dr.getWkt())); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = dataLibService.downloadDbReq(ue, dr); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "请求DB数据下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "dr", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadDbReq") |
| | | public ResponseMsg<Object> downloadDbReq(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (null == dr || StringHelper.isEmpty(dr.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (null == dr.getEntities() || dr.getEntities().isEmpty()) { |
| | | return fail("请选择要下载的实体名"); |
| | | } |
| | | dr.setWkt(AesHelper.decrypt(dr.getWkt())); |
| | | if (StringHelper.isEmpty(dr.getWkt())) { |
| | | return fail("请选择要下载的WKT范围"); |
| | | } |
| | | if (!DownloadService.decryptPwd(dr)) { |
| | | return fail("密码解密失败", null); |
| | | } |
| | | if (StringHelper.isPwdInvalid(dr.getPwd())) { |
| | | return fail("密码不符合要求"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | 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()); |
| | | String guid = dataLibService.downloadDbReq4Wkt(ue, dr); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadEntityReq") |
| | | public ResponseMsg<Object> downloadEntityReq(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { |
| | | public ResponseMsg<Object> downloadEntityReq(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (null == dre || StringHelper.isEmpty(dre.getPwd())) { |
| | | if (null == dr || StringHelper.isEmpty(dr.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (null == dre.getEntities() || dre.getEntities().isEmpty()) { |
| | | if (null == dr.getEntities() || dr.getEntities().isEmpty()) { |
| | | return fail("请选择要下载的实体名"); |
| | | } |
| | | if (!DownloadService.decryptPwd(dre)) { |
| | | if (!DownloadService.decryptPwd(dr)) { |
| | | return fail("密码解密失败", null); |
| | | } |
| | | if (StringHelper.isPwdInvalid(dre.getPwd())) { |
| | | if (StringHelper.isPwdInvalid(dr.getPwd())) { |
| | | return fail("密码不符合要求"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String depcode = null == dre.getDepcodes() || dre.getDepcodes().isEmpty() ? null : dre.getDepcodes().get(0); |
| | | String guid = dataLibService.zipDbData(ue, dre.getEntities().get(0), depcode, dre.getDirs(), dre.getFilter(), dre.getPwd()); |
| | | String guid = dataLibService.downloadDbReq4Prop(ue, dr); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | |
| | | List<String> entities = Arrays.asList(entity.getEntities().split(",")); |
| | | String pwd = AesHelper.decrypt(entity.getPwd()); |
| | | |
| | | dataLibService.createZipFile(ue, entities, null, null, entity.getWkt(), pwd); |
| | | DownloadReqEntity dr = new DownloadReqEntity(); |
| | | dr.setEntities(entities); |
| | | dr.setWkt(dr.getWkt()); |
| | | dr.setPwd(pwd); |
| | | dr.setIds(null); |
| | | dr.setDirs(null); |
| | | dr.setFilter(null); |
| | | dr.setDepcodes(null); |
| | | |
| | | dataLibService.downloadDbReq4Wkt(ue, dr); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建Zip包 |
| | | * 请求DB数据下载 |
| | | */ |
| | | 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); |
| | | public String downloadDbReq(UserEntity ue, DownloadReqEntity dr) throws Exception { |
| | | if (StringHelper.isEmpty(dr.getWkt())) { |
| | | return downloadDbReq4Wkt(ue, dr); |
| | | } |
| | | |
| | | return downloadDbReq4Prop(ue, dr); |
| | | } |
| | | |
| | | /** |
| | | * 请求DB数据下载-空间查询 |
| | | */ |
| | | public String downloadDbReq4Wkt(UserEntity ue, DownloadReqEntity dr) throws Exception { |
| | | String depcode = null == dr.getDepcodes() || dr.getDepcodes().isEmpty() ? null : dr.getDepcodes().get(0); |
| | | Map<String, List<?>> map = queryData(dr.getEntities(), depcode, dr.getDirs(), dr.getWkt()); |
| | | if (map.size() == 0) { |
| | | return null; |
| | | } |
| | |
| | | String zipName = tempName + ".gdb.zip"; |
| | | String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName; |
| | | |
| | | ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd); |
| | | ZipFile zip = Zip4jHelper.createZipFile(zipFile, dr.getPwd()); |
| | | ZipParameters params = Zip4jHelper.getZipParams(true); |
| | | addZipFiles(zip, params, file.listFiles()); |
| | | |
| | | String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); |
| | | String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd())); |
| | | DownloadEntity downloadEntity = getDownloadEntity(ue, zipFile, dbPwd); |
| | | int rows = downloadMapper.insert(downloadEntity); |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 打包DB数据 |
| | | * 请求DB数据下载-属性查询 |
| | | */ |
| | | public String zipDbData(UserEntity ue, String name, String depcode, String dirs, String filter, String pwd) throws Exception { |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(name); |
| | | public String downloadDbReq4Prop(UserEntity ue, DownloadReqEntity dr) throws Exception { |
| | | String dirs = dr.getDirs(); |
| | | String entity = dr.getEntities().get(0); |
| | | String depcode = null == dr.getDepcodes() || dr.getDepcodes().isEmpty() ? null : dr.getDepcodes().get(0); |
| | | |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); |
| | | if (baseMapper == null) { |
| | | return null; |
| | | } |
| | | |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | baseQueryService.addFilterWrapper(wrapper, filter); |
| | | baseQueryService.addFilterWrapper(wrapper, dr.getFilter()); |
| | | if (baseMapper instanceof GeomBaseMapper) { |
| | | wrapper.select("ST_AsText(geom) as geom, *"); |
| | | } |
| | |
| | | } |
| | | |
| | | String tab = BaseQueryService.getTabName(baseMapper); |
| | | String ids = getAnnexFilter(StringHelper.isEmpty(depcode) && StringHelper.isEmpty(dirs) && StringHelper.isEmpty(filter), list); |
| | | String ids = getAnnexFilter(StringHelper.isEmpty(depcode) && StringHelper.isEmpty(dirs) && StringHelper.isEmpty(dr.getFilter()), list); |
| | | List<AttachEntity> annex = baseQueryService.selectAnnexByTab(tab, ids); |
| | | |
| | | Map<String, List<?>> map = new HashMap<>(1); |
| | | map.put(name, list); |
| | | map.put(entity, list); |
| | | |
| | | return zipData(ue, map, annex, pwd); |
| | | return zipData(ue, map, annex, dr.getPwd()); |
| | | } |
| | | |
| | | /** |