| | |
| | | @SysLog() |
| | | @ApiOperation(value = "请求下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "pwd", value = "密码", dataType = "String", paramType = "body", example = ""), |
| | | @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "body", example = "1,2") |
| | | @ApiImplicitParam(name = "dr", value = "请求下载实体类", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadReq") |
| | | public ResponseMsg<Object> downloadReq(@RequestBody DownloadReqEntity reqEntity, HttpServletRequest req, HttpServletResponse res) { |
| | | public ResponseMsg<Object> downloadReq(@RequestBody DownloadReqEntity dr, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (null == reqEntity || StringHelper.isEmpty(reqEntity.getPwd())) { |
| | | if (null == dr || StringHelper.isEmpty(dr.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (null == reqEntity.getIds() || reqEntity.getIds().isEmpty()) { |
| | | if (null == dr.getIds() || dr.getIds().isEmpty()) { |
| | | return fail("请选择要下载的文件"); |
| | | } |
| | | if (!DownloadService.decryptPwd(reqEntity)) { |
| | | if (!DownloadService.decryptPwd(dr)) { |
| | | return fail("密码解密失败", null); |
| | | } |
| | | if (StringHelper.isPwdInvalid(reqEntity.getPwd())) { |
| | | if (StringHelper.isPwdInvalid(dr.getPwd())) { |
| | | return fail("密码不符合要求"); |
| | | } |
| | | |
| | | List<MetaEntity> list = metaService.selectMetaFiles(reqEntity.getIds()); |
| | | List<MetaEntity> list = metaService.selectMetaFiles(dr.getIds()); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("没有找到元数据"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = downloadService.zipFiles(ue, list, reqEntity.getPwd()); |
| | | String guid = downloadService.zipFiles(ue, list, dr.getPwd()); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |