| | |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import com.lf.server.service.data.DownloadService; |
| | | import com.lf.server.service.data.UploadService; |
| | | import com.lf.server.service.show.DataLibService; |
| | | import com.lf.server.service.sys.AttachService; |
| | | import com.lf.server.service.sys.DepService; |
| | |
| | | @ApiOperation(value = "根据表名分页查询表") |
| | | @GetMapping(value = "/selectTabsByPage") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "depcode", value = "单位编码", dataType = "String", paramType = "query", example = "00"), |
| | | @ApiImplicitParam(name = "dirs", value = "目录编码", dataType = "String", paramType = "query", example = "00,01"), |
| | | @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "dlg_"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | public ResponseMsg<List<TabEntity>> selectTabsByPage(String tab, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<TabEntity>> selectTabsByPage(String depcode, String dirs, String tab, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | if (StringHelper.isSqlInjection(depcode)) { |
| | | return fail("单位代码含有非法字符", null); |
| | | } |
| | | |
| | | String filters = "1=1"; |
| | | if (!StringHelper.isEmpty(depcode)) { |
| | | filters += String.format(" and depid like '%s%%'", depcode); |
| | | } |
| | | dirs = DataLibService.copeCodes(dirs, "dirid"); |
| | | if (dirs != null) { |
| | | filters += String.format(" and (%s)", dirs); |
| | | } |
| | | |
| | | int count = baseQueryService.selectTabsForCount(tab); |
| | |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, pageSize, pageSize * (pageIndex - 1)); |
| | | List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, filters, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | List<Integer> list = dataLibService.selectDbOverflowDep(ue, reqEntity.getEntities(), reqEntity.getWkt()); |
| | | List<String> list = dataLibService.selectDbOverflowDep(ue, reqEntity.getEntities(), reqEntity.getWkt()); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "请求DB数据下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "reqEntity", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | @ApiImplicitParam(name = "dre", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadDbReq") |
| | | public ResponseMsg<Object> downloadDbReq(@RequestBody DownloadReqEntity reqEntity, HttpServletRequest req, HttpServletResponse res) { |
| | | public ResponseMsg<Object> downloadDbReq(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (null == reqEntity || StringHelper.isEmpty(reqEntity.getPwd())) { |
| | | if (null == dre || StringHelper.isEmpty(dre.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (null == reqEntity.getEntities() || reqEntity.getEntities().isEmpty()) { |
| | | if (null == dre.getEntities() || dre.getEntities().isEmpty()) { |
| | | return fail("请选择要下载的实体名"); |
| | | } |
| | | reqEntity.setWkt(AesHelper.decrypt(reqEntity.getWkt())); |
| | | if (StringHelper.isEmpty(reqEntity.getWkt())) { |
| | | dre.setWkt(AesHelper.decrypt(dre.getWkt())); |
| | | if (StringHelper.isEmpty(dre.getWkt())) { |
| | | return fail("请选择要下载的WKT范围"); |
| | | } |
| | | if (!DownloadService.decryptPwd(reqEntity)) { |
| | | if (!DownloadService.decryptPwd(dre)) { |
| | | return fail("密码解密失败", null); |
| | | } |
| | | if (StringHelper.isPwdInvalid(reqEntity.getPwd())) { |
| | | if (StringHelper.isPwdInvalid(dre.getPwd())) { |
| | | return fail("密码不符合要求"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = dataLibService.createZipFile(ue, reqEntity.getEntities(), reqEntity.getWkt(), reqEntity.getPwd()); |
| | | String guid = dataLibService.createZipFile(ue, dre.getEntities(), dre.getWkt(), dre.getPwd()); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "请求实体数据下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "dre", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadEntityReq") |
| | | public ResponseMsg<Object> downloadEntityReq(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (null == dre || StringHelper.isEmpty(dre.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (null == dre.getEntities() || dre.getEntities().isEmpty()) { |
| | | return fail("请选择要下载的实体名"); |
| | | } |
| | | if (!DownloadService.decryptPwd(dre)) { |
| | | return fail("密码解密失败", null); |
| | | } |
| | | if (StringHelper.isPwdInvalid(dre.getPwd())) { |
| | | return fail("密码不符合要求"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = dataLibService.zipDbData(ue, dre.getEntities().get(0), dre.getFilter(), dre.getPwd()); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getCreateUser(), 3, name, pageSize, pageSize * (pageIndex - 1)); |
| | | List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getCreateUser(), 4, name, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | public ResponseMsg<Object> selectProject() { |
| | | try { |
| | | List<KeyValueEntity> list = baseQueryService.selectProject(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询字典表并统计记录") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "dirs", value = "目录ID", dataType = "String", paramType = "query", example = "2,5,309"), |
| | | @ApiImplicitParam(name = "depid", value = "单位ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectTabCount") |
| | | public ResponseMsg<Object> selectTabCount(String name, String dirs, Integer depid) { |
| | | try { |
| | | List<DictEntity> list = baseQueryService.selectTabCount(name, dirs, depid); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |