| | |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.sys.ReportEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.service.all.UploadAttachService; |
| | | import com.lf.server.service.sys.ReportService; |
| | | import com.lf.server.service.sys.TokenService; |
| | |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | |
| | | int count = reportService.selectCount(name); |
| | | int count = reportService.selectCount(name, null); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<ReportEntity> rs = reportService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); |
| | | List<ReportEntity> rs = reportService.selectByPage(name, null, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | @GetMapping(value = "/download") |
| | | public void download(String guid, HttpServletResponse res) { |
| | | uploadAttachService.download(guid, res); |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "下载报告") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "报告ID", dataType = "Integer", paramType = "7") |
| | | }) |
| | | @GetMapping(value = "/downloadReport") |
| | | public void downloadReport(Integer id, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (null == id || id < 1) { |
| | | return; |
| | | } |
| | | |
| | | ReportEntity re = reportService.selectById(id); |
| | | if (null == re || StringHelper.isEmpty(re.getGuid()) || StringHelper.isEmpty(re.getType()) || StringHelper.isEmpty(re.getCode())) { |
| | | return; |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | |
| | | reportService.createReport(ue, re, res); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | } |