feat:预览-文件列表
This commit is contained in:
@@ -23,6 +23,15 @@ public class ReportConstants {
|
||||
*/
|
||||
public static final String NO_USER_PRIVACY_INVOLVED = "不涉及用户隐私";
|
||||
|
||||
/**
|
||||
* 流程中
|
||||
*/
|
||||
public static final Integer IN_PROCESS = 1;
|
||||
|
||||
/**
|
||||
* 不在流程中
|
||||
*/
|
||||
public static final Integer NOT_IN_PROCESS = 2;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
package com.adc.da.report.eo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@TableName("ts_report_file")
|
||||
@Accessors(chain = true)
|
||||
public class ReportFile {
|
||||
|
||||
@TableId(value = "id",type = IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
@TableField("report_id")
|
||||
private String reportId;
|
||||
|
||||
@TableField("file_id")
|
||||
private String fileId;
|
||||
|
||||
@TableField("state")
|
||||
private String state;
|
||||
}
|
||||
|
||||
+79
-62
@@ -6,14 +6,12 @@ import com.adc.da.login.util.UserUtils;
|
||||
import com.adc.da.report.constant.ReportConstants;
|
||||
import com.adc.da.report.dao.mysql.FileDao;
|
||||
import com.adc.da.report.dao.mysql.ReportDao;
|
||||
import com.adc.da.report.dao.mysql.ReportFileDao;
|
||||
import com.adc.da.report.dao.mysql.ReportLabelDao;
|
||||
import com.adc.da.report.eo.*;
|
||||
import com.adc.da.report.service.*;
|
||||
import com.adc.da.report.util.*;
|
||||
import com.adc.da.report.vo.ChangeUploaderVo;
|
||||
import com.adc.da.report.vo.ReportDetailVo;
|
||||
import com.adc.da.report.vo.ReportQueryVo;
|
||||
import com.adc.da.report.vo.ReportVo;
|
||||
import com.adc.da.report.vo.*;
|
||||
import com.adc.da.sys.dao.mysql.RoleEODao;
|
||||
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
@@ -22,6 +20,7 @@ import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.service.MenuEOService;
|
||||
import com.adc.da.sys.service.OrgEOService;
|
||||
import com.adc.da.sys.util.BeanCopyUtils;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.CollectionUtils;
|
||||
@@ -128,6 +127,9 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
@Resource
|
||||
private MenuEOService menuEOService;
|
||||
|
||||
@Resource
|
||||
private ReportFileDao reportFileDao;
|
||||
|
||||
@Override
|
||||
public void addOrUpdate(ReportEntity reportEntity) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -529,38 +531,38 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
});
|
||||
}
|
||||
|
||||
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.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;
|
||||
}
|
||||
|
||||
@@ -612,38 +614,38 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
}
|
||||
});
|
||||
|
||||
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.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;
|
||||
}
|
||||
|
||||
@@ -716,6 +718,21 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
@Override
|
||||
public ResponseMessage reportDetail(String reportId) {
|
||||
ReportDetailVo reportDetailVo = reportDao.reportDetail(reportId);
|
||||
//设置文件信息
|
||||
LambdaQueryWrapper<ReportFile> reportFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
reportFileLambdaQueryWrapper.eq(ReportFile::getReportId, reportDetailVo.getId());
|
||||
reportFileLambdaQueryWrapper.eq(ReportFile::getState, ReportConstants.NOT_IN_PROCESS);
|
||||
List<ReportFile> reportFiles = reportFileDao.selectList(reportFileLambdaQueryWrapper);
|
||||
List<String> fileIds = new ArrayList<>();
|
||||
if (reportFiles != null) {
|
||||
fileIds = reportFiles.stream().map(ReportFile::getFileId).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(fileIds)) {
|
||||
List<FileEntity> fileEntities = fileDao.selectBatchIds(fileIds);
|
||||
List<FileVo> fileVos = BeanCopyUtils.copyBeanList(fileEntities, FileVo.class);
|
||||
reportDetailVo.setFileList(fileVos);
|
||||
}
|
||||
|
||||
//设置部门名称
|
||||
String department = reportDetailVo.getDepartment();
|
||||
if (StrUtil.isNotBlank(department)) {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.adc.da.report.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FileVo {
|
||||
|
||||
/**
|
||||
* 文件主键id
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
private String fileName;
|
||||
}
|
||||
@@ -44,6 +44,7 @@ public class ReportDetailVo {
|
||||
*/
|
||||
private String departmentId;
|
||||
|
||||
|
||||
private String department;
|
||||
/**
|
||||
* 部门
|
||||
@@ -65,13 +66,6 @@ public class ReportDetailVo {
|
||||
*/
|
||||
private String privacyLevel;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@@ -111,4 +105,9 @@ public class ReportDetailVo {
|
||||
* 保密到期日期
|
||||
*/
|
||||
private Date secrecyLast;
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
*/
|
||||
private List<FileVo> fileList;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,6 @@
|
||||
eo.maincontent AS mainContent,
|
||||
eo.DEPARTMENT AS department,
|
||||
eo.`YEAR` AS `year`,
|
||||
eo.fileid AS fileId,
|
||||
eo.confidentialLevel AS confidentialLevel,
|
||||
eo.privacyLevel AS privacyLevel,
|
||||
eo.createUserId AS createUserId,
|
||||
@@ -284,15 +283,12 @@
|
||||
rm.maincontent AS maincontent,
|
||||
rm.department AS department,
|
||||
rm.`year` AS `year`,
|
||||
rm.fileId AS fileId,
|
||||
f.file_name as fileName,
|
||||
rm.confidentialLevel AS confidentialLevel,
|
||||
rm.privacyLevel AS privacyLevel,
|
||||
rm.secrecy_last AS secrecyLast
|
||||
FROM `tt_report_manage` AS rm
|
||||
LEFT JOIN ts_user AS u ON u.USID = rm.createUserId
|
||||
LEFT JOIN ts_org as org on org.id = rm.department
|
||||
LEFT JOIN ts_file as f on rm.fileId=f.file_id
|
||||
WHERE rm.id = #{reportId}
|
||||
AND rm.del_flag = 0
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user