fix:修复报告管理接口Bug(标签)

This commit is contained in:
2023-05-10 17:16:25 +08:00
parent 5997e134b9
commit d0eb3d8b7f
2 changed files with 24 additions and 85 deletions
@@ -382,78 +382,6 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
return list;
}
// @Override
// public IPage<ReportVo> page(ReportQueryVo vo) {
// IPage<ReportEntity> page = new Page<>();
// page.setCurrent(vo.getPageNo());
// page.setSize(vo.getPageSize());
// //判断是不是管理员
// boolean admin = false;
// List<RoleEO> roleEOList = roleEODao.selectByuserId(UserUtils.getUserId());
// for (RoleEO roleEO : roleEOList) {
// if ("管理员".equals(roleEO.getName())){
// admin= !admin;
// }
// }
// if (admin) {
// vo.setUsid(null);
// } else {
// vo.setUsid(UserUtils.getUserId());
// }
//
// //按照labelId筛选
// Set<String> idSet = new HashSet<>();
// if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
// LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
// reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId());
// List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
// reportLabelEntities.forEach(reportLabelEntity -> {
// idSet.add(reportLabelEntity.getReportId());
// });
// idSet.add("1");
// }
//
//
// IPage<ReportVo> list = reportDao.page(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<String> userIdList = reportUserDao.selectList(
// new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
// .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
// });
// return list;
// }
@Override
public IPage<ReportVo> page(ReportQueryVo vo) {
IPage<ReportEntity> page = new Page<>();
@@ -462,14 +390,16 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
//按照labelId筛选
Set<String> idSet = new HashSet<>();
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
if (CollectionUtils.isNotEmpty(vo.getLabelId())) {
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId());
reportLabelEntityWrapper.in(ReportLabelEntity::getLastLabel, vo.getLabelId());
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
reportLabelEntities.forEach(reportLabelEntity -> {
idSet.add(reportLabelEntity.getReportId());
});
idSet.add("1");
if (CollectionUtils.isEmpty(idSet)) {
idSet.add("默认搜索条件");
}
}
IPage<ReportVo> list = reportDao.page(page, vo, idSet);
@@ -555,22 +485,33 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
//按照labelId筛选
Set<String> idSet = new HashSet<>();
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
if (CollectionUtils.isNotEmpty(vo.getLabelId())) {
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId());
reportLabelEntityWrapper.in(ReportLabelEntity::getLastLabel, vo.getLabelId());
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
reportLabelEntities.forEach(reportLabelEntity -> {
idSet.add(reportLabelEntity.getReportId());
});
idSet.add("1");
if (CollectionUtils.isEmpty(idSet)) {
idSet.add("默认搜索条件");
}
}
IPage<ReportVo> list = reportDao.reportManagerPage(page, vo, idSet);
//获取所有报告的labelId
list.getRecords().forEach((reportVo) -> {
reportVo.setLabelList(findLabelList(reportVo.getId()));
//设置标签路径
list.getRecords().forEach(c -> {
LambdaQueryWrapper<ReportLabelEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ReportLabelEntity::getReportId, c.getId());
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(reportLabelEntities)) {
reportLabelEntities.forEach(reportLabelEntity -> {
c.setLabelList(new ArrayList<>());
c.getLabelList().add(reportLabelEntity.getLabelId());
});
}
});
list.getRecords().forEach(c -> {
FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
if (StringUtils.isEmpty(fileEntity.getFileType())) {
@@ -113,7 +113,6 @@
AVG( trur.user_rating ) AS reportRating
FROM
TT_REPORT_MANAGE eo
INNER JOIN ts_report_label AS trl ON eo.id = trl.report_id
LEFT JOIN ts_user tu ON tu.USID = eo.createUserId
LEFT JOIN tr_report_user ru ON eo.id = ru.reportId
LEFT JOIN power_apply pa ON pa.report_id = eo.id
@@ -168,8 +167,8 @@
</select>
<select id="reportManagerPage" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
SELECT DISTINCT
trl.report_id AS id,
SELECT
t.id,
t.year,
t.name,
t.keycontent,
@@ -180,7 +179,6 @@
t.confidentialLevel,
t.privacyLevel
FROM `tt_report_manage` AS t
INNER JOIN ts_report_label AS trl ON t.id = trl.report_id
WHERE t.del_flag = 0
<!--报表名称搜索-->
<if test="Vo.name != null and Vo.name != ''">