fix: 修复根绝标签筛选报告显示不正确问题
This commit is contained in:
@@ -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<ReportVo> 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<ReportVo> list = reportService.list(vo);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除报告
|
||||
* @param ids id
|
||||
|
||||
@@ -23,13 +23,6 @@ public interface IReportService {
|
||||
*/
|
||||
String insert(ReportEntity entity, List<String> labelList) throws IOException;
|
||||
|
||||
/**
|
||||
* 报告列表展示
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
IPage<ReportVo> list(ReportQueryVo vo) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除报告
|
||||
* @param ids
|
||||
|
||||
@@ -199,86 +199,6 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告列表
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public IPage<ReportVo> list(ReportQueryVo vo) throws Exception {
|
||||
|
||||
IPage<ReportEntity> 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<String> idSet = new HashSet<>();
|
||||
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
|
||||
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
|
||||
//获取标签路径中最后一个标签
|
||||
reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1));
|
||||
//根据最后一个标签查询报表
|
||||
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
|
||||
reportLabelEntities.forEach(reportLabelEntity -> {
|
||||
idSet.add(reportLabelEntity.getReportId());
|
||||
});
|
||||
}
|
||||
|
||||
IPage<ReportVo> 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<String> userIdList = reportUserDao.selectList(
|
||||
new QueryWrapper<ReportUserEntity>().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<ReportDao, ReportEntity>
|
||||
Set<String> idSet = new HashSet<>();
|
||||
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
|
||||
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
|
||||
reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1));
|
||||
reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId());
|
||||
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
|
||||
reportLabelEntities.forEach(reportLabelEntity -> {
|
||||
idSet.add(reportLabelEntity.getReportId());
|
||||
});
|
||||
idSet.add("1");
|
||||
}
|
||||
|
||||
|
||||
@@ -486,7 +405,7 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
Set<String> idSet = new HashSet<>();
|
||||
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
|
||||
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
|
||||
reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1));
|
||||
reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId());
|
||||
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
|
||||
reportLabelEntities.forEach(reportLabelEntity -> {
|
||||
idSet.add(reportLabelEntity.getReportId());
|
||||
|
||||
@@ -2,55 +2,6 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.adc.da.report.dao.mysql.ReportDao">
|
||||
|
||||
<select id="list" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
|
||||
SELECT
|
||||
t.id,
|
||||
t.year,
|
||||
t.name,
|
||||
t.keycontent,
|
||||
t.fileId,
|
||||
t.createDate,
|
||||
t.department,
|
||||
t.maincontent,
|
||||
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.delFlag = 0
|
||||
AND t.createUserId = #{pageVO.usid}
|
||||
<!--报表名称搜索-->
|
||||
<if test="Vo.name != null and Vo.name != ''">
|
||||
and t.name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
|
||||
</if>
|
||||
|
||||
<!--年份搜索-->
|
||||
<if test="Vo.year != null and Vo.year.size() > 0">
|
||||
and t.year in
|
||||
<foreach collection="Vo.year" item="year" open="(" separator="," close=")">
|
||||
#{year}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<!--id搜索-->
|
||||
<if test="idSet !=null and idSet.size() > 0">
|
||||
and t.id in
|
||||
<foreach collection="idSet" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<!--id搜索-->
|
||||
<if test="Vo.ids !=null and Vo.ids.size() > 0">
|
||||
and Vo.ids in
|
||||
<foreach collection="Vo.ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
ORDER BY updateDate desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getReportDateList" parameterType="string" resultType="string">
|
||||
select distinct year from TT_REPORT_MANAGE t1
|
||||
left join TR_REPORT_USER t2 on t1.id=t2.reportId
|
||||
@@ -114,6 +65,7 @@
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="page" resultType="com.adc.da.report.vo.ReportVo">
|
||||
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user