| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "请求管道分析结果下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "pe", value = "管道分析实体类", dataType = "PipelineEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadReq") |
| | | public ResponseMsg<Object> downloadReq(@RequestBody PipelineEntity pe, HttpServletRequest req) { |
| | | try { |
| | | if (null == pe || StringHelper.isEmpty(pe.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (null == pe.getTabs() || 0 == pe.getTabs().size()) { |
| | | return fail("请输入表名"); |
| | | } |
| | | if (!checkTabs(pe.getTabs())) { |
| | | return fail("存在非法表名"); |
| | | } |
| | | if (!DownloadService.decryptPwd(pe)) { |
| | | return fail("密码解密失败", null); |
| | | } |
| | | if (StringHelper.isPwdInvalid(pe.getPwd())) { |
| | | return fail("密码不符合要求"); |
| | | } |
| | | |
| | | Map<String, List<PipelineEntity>> map = new HashMap<>(4); |
| | | for (String tab : pe.getTabs()) { |
| | | List<PipelineEntity> rs = pipelineService.selectPipeAnalysis(tab, pe.getGid()); |
| | | if (null != rs && rs.size() > 0) { |
| | | map.put(tab, rs); |
| | | } |
| | | } |
| | | if (map.size() == 0) { |
| | | return fail("查无数据"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = pipelineService.createZipFile(ue, map, pe.getPwd()); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询下载文件") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""), |
| | |
| | | return fail("用户未登录", null); |
| | | } |
| | | |
| | | int count = downloadService.selectCountForUser(ue.getCreateUser(), 4, name); |
| | | int count = downloadService.selectCountForUser(ue.getCreateUser(), 5, name); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |