[修改] 草稿功能开发,及部分bug修改
This commit is contained in:
@@ -96,6 +96,21 @@ public class ReportManageConroller {
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告管理列表
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation("报告管理列表")
|
||||
@PostMapping("/reportManagerPage")
|
||||
public ResponseMessage reportManagerPage(@RequestBody ReportQueryVo vo) throws Exception {
|
||||
IPage<ReportVo> list = reportService.reportManagerPage(vo);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 报告列表
|
||||
* @param vo
|
||||
|
||||
@@ -36,4 +36,6 @@ public interface ReportDao extends BaseMapper<ReportEntity> {
|
||||
IPage<ReportVo> getAddReportPage(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo);
|
||||
|
||||
IPage<ReportVo> page(IPage<ReportEntity> page,@Param("pageVO") ReportQueryVo vo,@Param("idSet")Set<String> idSet);
|
||||
|
||||
IPage<ReportVo> reportManagerPage(IPage<ReportEntity> page,@Param("pageVO") ReportQueryVo vo,@Param("idSet")Set<String> idSet);
|
||||
}
|
||||
|
||||
@@ -51,4 +51,6 @@ public interface IReportService {
|
||||
IPage<ReportVo> addReportPage(ReportQueryVo vo) throws Exception;
|
||||
|
||||
IPage<ReportVo> page(ReportQueryVo vo);
|
||||
|
||||
IPage<ReportVo> reportManagerPage(ReportQueryVo vo);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
if (StringUtils.isEmpty(entity.getId())) {
|
||||
entity.setId(UUID.randomUUID10());
|
||||
entity.setCreateDate(format.format(new Date()));
|
||||
entity.setCreateUserId(CommonUtils.getUserId());
|
||||
entity.setCreateUserId(UserUtils.getUserId());
|
||||
entity.setDelFlag("0");
|
||||
entity.setUpdateDate(format.format(new Date()));
|
||||
reportDao.insert(entity);
|
||||
@@ -448,6 +448,79 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<ReportVo> reportManagerPage(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.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1));
|
||||
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
|
||||
reportLabelEntities.forEach(reportLabelEntity -> {
|
||||
idSet.add(reportLabelEntity.getReportId());
|
||||
});
|
||||
idSet.add("1");
|
||||
}
|
||||
|
||||
|
||||
IPage<ReportVo> list = reportDao.reportManagerPage(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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建htmlstring
|
||||
*
|
||||
|
||||
@@ -190,12 +190,8 @@
|
||||
WHERE
|
||||
eo.DEL_FLAG = 0
|
||||
<if test="pageVO.usid !='' and pageVO.usid != null">
|
||||
and ru.userId != #{pageVO.usid}
|
||||
</if>
|
||||
<if test="pageVO.usid !='' and pageVO.usid != null">
|
||||
and eo.id not in (
|
||||
SELECT tt.report_id from power_apply tt WHERE tt.user_id = #{pageVO.usid}
|
||||
)
|
||||
AND eo.id NOT IN ( SELECT ru.reportId FROM tr_report_user ru WHERE ru.userId = #{pageVO.usid} )
|
||||
AND eo.id NOT IN ( SELECT tt.report_id FROM power_apply tt WHERE tt.user_id = #{pageVO.usid} )
|
||||
</if>
|
||||
<if test="pageVO.name !='' and pageVO.name != null">
|
||||
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
|
||||
@@ -250,9 +246,6 @@
|
||||
or eo.id in (
|
||||
SELECT tt.report_id from power_apply tt WHERE tt.user_id = #{pageVO.usid})
|
||||
)
|
||||
</if>
|
||||
<if test="pageVO.usid !='' and pageVO.usid != null">
|
||||
|
||||
</if>
|
||||
<if test="pageVO.name !='' and pageVO.name != null">
|
||||
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
|
||||
@@ -274,6 +267,54 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--id搜索-->
|
||||
<if test="idSet !=null and idSet.size() > 0">
|
||||
and eo.id in
|
||||
<foreach collection="idSet" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
eo.id
|
||||
ORDER BY
|
||||
eo.updateDate DESC
|
||||
|
||||
</select>
|
||||
<select id="reportManagerPage" resultType="com.adc.da.report.vo.ReportVo">
|
||||
SELECT
|
||||
eo.id,
|
||||
eo.NAME,
|
||||
eo.keycontent,
|
||||
eo.maincontent,
|
||||
eo.DEPARTMENT,
|
||||
eo.YEAR,
|
||||
eo.fileid,
|
||||
eo.confidentialLevel,
|
||||
eo.privacyLevel,
|
||||
pa.report_id,
|
||||
pa.user_id,
|
||||
pa.power
|
||||
FROM
|
||||
TT_REPORT_MANAGE eo
|
||||
LEFT JOIN tr_report_user ru ON eo.id = ru.reportId
|
||||
LEFT JOIN power_apply pa ON pa.report_id = eo.id
|
||||
WHERE
|
||||
eo.DEL_FLAG = 0
|
||||
and eo.createUserId = #{pageVO.usid}
|
||||
<if test="pageVO.name !='' and pageVO.name != null">
|
||||
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
|
||||
</if>
|
||||
<if test="pageVO.keyContent !='' and pageVO.keyContent != null">
|
||||
and keycontent like CONCAT(CONCAT('%',#{pageVO.keyContent}),'%')
|
||||
</if>
|
||||
<!--年份搜索-->
|
||||
<if test="pageVO.year != null and pageVO.year.size() > 0">
|
||||
and year in
|
||||
<foreach collection="pageVO.year" item="year" open="(" separator="," close=")">
|
||||
#{year}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="pageVO.ids != null and pageVO.ids.size() > 0">
|
||||
and eo.id in
|
||||
<foreach collection="pageVO.ids" item="id" open="(" separator="," close=")">
|
||||
@@ -291,7 +332,6 @@
|
||||
eo.id
|
||||
ORDER BY
|
||||
eo.updateDate DESC
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user