diff --git a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java index f203b8c..57fee37 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java +++ b/adc-da-report/src/main/java/com/adc/da/report/controller/ReportManageConroller.java @@ -88,19 +88,6 @@ public class ReportManageConroller { return Result.success(map); } - /** - * 报告列表 - * @param vo - * @return - * @throws Exception - */ - @ApiOperation("报告列表") - @PostMapping("/list") - public ResponseMessage list(@RequestBody ReportQueryVo vo) throws Exception { - IPage list = reportService.list(vo); - return Result.success(list); - } - /** * 报告管理列表 * @param vo @@ -129,19 +116,6 @@ public class ReportManageConroller { return Result.success(list); } - /** - * 报告列表(带权限验证) - * @param vo - * @return - * @throws Exception - */ - @ApiOperation("报告列表(带权限)") - @PostMapping("/list-auth") - public ResponseMessage listWithAuth(@RequestBody ReportQueryVo vo) throws Exception { - IPage list = reportService.list(vo); - return Result.success(list); - } - /** * 删除报告 * @param ids id diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java index 52281eb..7c59055 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IReportService.java @@ -23,13 +23,6 @@ public interface IReportService { */ String insert(ReportEntity entity, List labelList) throws IOException; - /** - * 报告列表展示 - * @param vo - * @return - */ - IPage list(ReportQueryVo vo) throws Exception; - /** * 删除报告 * @param ids diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java index b3ba764..1ce3b6e 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java @@ -199,86 +199,6 @@ public class IReportServiceImpl extends ServiceImpl return entity.getName(); } - /** - * 报告列表 - * - * @param vo - * @return - * @throws Exception - */ - @Override - public IPage list(ReportQueryVo vo) throws Exception { - - IPage page = new Page<>(); - page.setCurrent(vo.getPageNo()); - page.setSize(vo.getPageSize()); - - //判断是不是管理员 - boolean admin = CommonUtils.isAdmin(); - if (admin) { - vo.setUsid(null); - } else { - vo.setUsid(CommonUtils.getUserId()); - } - - //按照labelId筛选 - Set idSet = new HashSet<>(); - if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) { - LambdaQueryWrapper reportLabelEntityWrapper = new LambdaQueryWrapper<>(); - //获取标签路径中最后一个标签 - reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1)); - //根据最后一个标签查询报表 - List reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper); - reportLabelEntities.forEach(reportLabelEntity -> { - idSet.add(reportLabelEntity.getReportId()); - }); - } - - IPage list = reportDao.list(page, vo, idSet); - - - //获取所有报告的labelId - list.getRecords().forEach((reportVo) -> { - reportVo.setLabelList(findLabelList(reportVo.getId())); - }); - list.getRecords().forEach(c -> { - FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity()); - if (StringUtils.isEmpty(fileEntity.getFileType())) { - c.setFileType(null); - } - //ppt文件 - else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) || - ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) { - c.setFileType("1"); - } - //excel文件 - else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) || - ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) { - c.setFileType("2"); - } - //pdf文件 - else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) { - c.setFileType("3"); - } - //word文件 - else { - c.setFileType("4"); - } - - //文件大小 - c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize()) - ? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb"); - c.setFileName(fileEntity.getFileName()); - List userIdList = reportUserDao.selectList( - new QueryWrapper().eq("reportId", c.getId())) - .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList()); - c.setReportUserIdList(userIdList); - }); - - - return list; - } - /** * 找出报告的所有标签中最长的那条路径 * @@ -413,12 +333,11 @@ public class IReportServiceImpl extends ServiceImpl Set idSet = new HashSet<>(); if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) { LambdaQueryWrapper reportLabelEntityWrapper = new LambdaQueryWrapper<>(); - reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1)); + reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId()); List reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper); reportLabelEntities.forEach(reportLabelEntity -> { idSet.add(reportLabelEntity.getReportId()); }); - idSet.add("1"); } @@ -486,7 +405,7 @@ public class IReportServiceImpl extends ServiceImpl Set idSet = new HashSet<>(); if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) { LambdaQueryWrapper reportLabelEntityWrapper = new LambdaQueryWrapper<>(); - reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1)); + reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId()); List reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper); reportLabelEntities.forEach(reportLabelEntity -> { idSet.add(reportLabelEntity.getReportId()); diff --git a/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml index eab2c8f..1244a3d 100644 --- a/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml +++ b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml @@ -2,55 +2,6 @@ - - - +