| | |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import com.lf.server.service.data.DownloadService; |
| | | import com.lf.server.service.data.MetaService; |
| | | import com.lf.server.service.show.DataLibService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | |
| | | @Autowired |
| | | TokenService tokenService; |
| | | |
| | | @Autowired |
| | | DataLibService dataLibService; |
| | | |
| | | @Autowired |
| | | DownloadService downloadService; |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "请æ±ä¸è½½") |
| | | @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 = "reqEntity", value = "请æ±ä¸è½½å®ä½", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadReq") |
| | |
| | | WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "请æ±DBæ°æ®ä¸è½½") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "reqEntity", value = "请æ±ä¸è½½å®ä½", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadDbReq") |
| | | public ResponseMsg<Object> downloadDbReq(@RequestBody DownloadReqEntity reqEntity, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (null == reqEntity || StringHelper.isEmpty(reqEntity.getPwd())) { |
| | | return fail("å¯ç ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (null == reqEntity.getIds() || reqEntity.getIds().isEmpty()) { |
| | | return fail("è¯·éæ©è¦ä¸è½½çæä»¶"); |
| | | } |
| | | if (!downloadService.decryptPwd(reqEntity)) { |
| | | return fail("å¯ç è§£å¯å¤±è´¥", null); |
| | | } |
| | | if (!StringHelper.checkPwdValid(reqEntity.getPwd())) { |
| | | return fail("å¯ç ä¸ç¬¦åè¦æ±"); |
| | | } |
| | | |
| | | List<MetaFileEntity> list = metaService.selectMetaFiles(reqEntity.getIds()); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("æ²¡ææ¾å°å
æ°æ®"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = downloadService.zipFiles(ue, list, reqEntity.getPwd()); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |