|
@@ -174,9 +174,13 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
infoData.setUpdateBy(UserUtils.getCurrentUserDTO().getId());
|
|
|
infoData.setUpdateDate(new Date());
|
|
|
infoMapper.updateById(infoData);
|
|
|
+
|
|
|
//对上传的文件数据进行持久化操作
|
|
|
List<ProjectReportWorkAttachmentDTO> cwFileInfoList = report.getCwFileInfoList();
|
|
|
- if (CollectionUtils.isNotEmpty(cwFileInfoList)) {
|
|
|
+ List<WorkAttachmentDto> cwFileInfoList2 = report.getCwFileInfoList2();
|
|
|
+ if (CollectionUtils.isNotEmpty(cwFileInfoList2)) {
|
|
|
+ updateFiles2(cwFileInfoList2, userDTO, report.getId());
|
|
|
+ } else if (CollectionUtils.isNotEmpty(cwFileInfoList)) {
|
|
|
updateFiles(cwFileInfoList, userDTO, report.getId());
|
|
|
} else {
|
|
|
//删除所有的文件信息
|
|
@@ -291,12 +295,43 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
// }
|
|
|
infoMapper.insert(infoData);
|
|
|
|
|
|
+ //对上传的附件进行持久化操作
|
|
|
+ List<WorkAttachmentDto> fileInfoList2 = new ArrayList<>();
|
|
|
+ if ( null !=report.getCwFileInfoList2()){
|
|
|
+ fileInfoList2 = report.getCwFileInfoList2();
|
|
|
+ }
|
|
|
+ ossServiceMapper.delete(new QueryWrapper<WorkAttachment>().lambda().eq(WorkAttachment::getAttachmentId, report.getId()));
|
|
|
+
|
|
|
+ AtomicInteger j2 = new AtomicInteger(1);
|
|
|
+ if (fileInfoList2 != null){
|
|
|
+ fileInfoList2.forEach(item -> {
|
|
|
+ WorkAttachment i = new WorkAttachment();
|
|
|
+ //包含了url、size、name
|
|
|
+ i.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ i.setCreateDate(new Date());
|
|
|
+ i.setUpdateDate(new Date());
|
|
|
+ i.setDelFlag(0);
|
|
|
+ i.setUrl(item.getUrl());
|
|
|
+ //文件类型处理
|
|
|
+ List<String> strings = Arrays.asList(item.getName().split("\\."));
|
|
|
+ if (CollectionUtils.isNotEmpty(strings)) {
|
|
|
+ i.setType(strings.get(1));
|
|
|
+ }
|
|
|
+ i.setAttachmentId(report.getId());
|
|
|
+ i.setAttachmentName(item.getName());
|
|
|
+ i.setAttachmentFlag("cw_project_report");
|
|
|
+ i.setFileSize(item.getSize());
|
|
|
+ i.setSort(j2.get());
|
|
|
+ ossServiceMapper.insertWorkAttachment(i, userDTO);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
//对上传的文件数据进行持久化操作
|
|
|
List<ProjectReportWorkAttachmentDTO> fileInfoList = new ArrayList<>();
|
|
|
if ( null !=report.getCwFileInfoList()){
|
|
|
fileInfoList = report.getCwFileInfoList();
|
|
|
}
|
|
|
- ossServiceMapper.delete(new QueryWrapper<WorkAttachment>().lambda().eq(WorkAttachment::getAttachmentId, report.getId()));
|
|
|
+// ossServiceMapper.delete(new QueryWrapper<WorkAttachment>().lambda().eq(WorkAttachment::getAttachmentId, report.getId()));
|
|
|
AtomicInteger j = new AtomicInteger(1);
|
|
|
if (fileInfoList != null){
|
|
|
fileInfoList.forEach(item -> {
|
|
@@ -510,6 +545,15 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
reportData.setCwFileInfoList(dtoList);
|
|
|
reportData.setSignatureFileList(signatureList);
|
|
|
}
|
|
|
+ //将附件信息查出
|
|
|
+ // 查询附件信息
|
|
|
+ List<WorkAttachmentDto> fileInfo2 = reportMapper.findDtos(id);
|
|
|
+ if (CollectionUtils.isNotEmpty(dtos)) {
|
|
|
+ for (WorkAttachmentDto i : fileInfo2) {
|
|
|
+ i.setCreateBy(UserUtils.get(i.getBy()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reportData.setCwFileInfoList2(fileInfo2);
|
|
|
//设置历史报告列表
|
|
|
//根据项目id查出所有的信息
|
|
|
List<CwProjectReportData> byProjectList = reportMapper.getByProjectId(reportData.getProjectId());
|
|
@@ -637,6 +681,14 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
reportData.setCwFileInfoList(dtoList);
|
|
|
reportData.setSignatureFileList(signatureList);
|
|
|
}
|
|
|
+ // 查询附件信息
|
|
|
+ List<WorkAttachmentDto> fileInfo2 = reportMapper.findDtos(id);
|
|
|
+ if (CollectionUtils.isNotEmpty(dtos)) {
|
|
|
+ for (WorkAttachmentDto i : fileInfo2) {
|
|
|
+ i.setCreateBy(UserUtils.get(i.getBy()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reportData.setCwFileInfoList2(fileInfo2);
|
|
|
//设置历史报告列表
|
|
|
//根据项目id查出所有的信息
|
|
|
List<CwProjectReportData> byProjectList = reportMapper.getByProjectId(reportData.getProjectId());
|
|
@@ -1321,6 +1373,63 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改附件信息
|
|
|
+ * @param list 待修改的附件列表
|
|
|
+ * @param userDTO 当前登录用户
|
|
|
+ * @param id 关联id
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void updateFiles2(List<WorkAttachmentDto> list, UserDTO userDTO, String id) {
|
|
|
+ int j = 1;
|
|
|
+ String names = new String();
|
|
|
+ //表中存在,但是传过来不存在,说明已删除,表中数据也要删除
|
|
|
+ for (WorkAttachmentDto dto : list) {
|
|
|
+ names = names + "," +dto.getUrl();
|
|
|
+ }
|
|
|
+ //查询保存的附件信息
|
|
|
+ List<WorkAttachment> infoList = reportMapper.findFileList(id);
|
|
|
+ if (CollectionUtils.isNotEmpty(infoList)) {
|
|
|
+ for (WorkAttachment i : infoList) {
|
|
|
+ if (!names.contains(i.getUrl())) {
|
|
|
+ ossServiceMapper.deleteById(i.getId());
|
|
|
+ List<String> fileId = attachmentMapper.getFileId(i.getId());
|
|
|
+ fileId.forEach(fid->{
|
|
|
+ attachmentMapper.deleteById(fid);
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //保存信息
|
|
|
+ for (WorkAttachmentDto dto : list) {
|
|
|
+ //判断是否存在
|
|
|
+ Integer isExit = reportMapper.findIsExit(id, dto.getName());
|
|
|
+ if (isExit == 0) {
|
|
|
+ WorkAttachment i = new WorkAttachment();
|
|
|
+ //包含了url、size、name
|
|
|
+ i.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+// i.getCreateBy().setId(userDTO.getId());
|
|
|
+ i.setCreateDate(new Date());
|
|
|
+// i.getUpdateBy().setId(userDTO.getId());
|
|
|
+ i.setUpdateDate(new Date());
|
|
|
+ i.setDelFlag(0);
|
|
|
+ i.setUrl(dto.getUrl());
|
|
|
+ //文件类型处理
|
|
|
+ List<String> strings = Arrays.asList(dto.getName().split("\\."));
|
|
|
+ if (org.flowable.editor.language.json.converter.util.CollectionUtils.isNotEmpty(strings)) {
|
|
|
+ i.setType(strings.get(1));
|
|
|
+ }
|
|
|
+ i.setAttachmentId(id);
|
|
|
+ i.setAttachmentName(dto.getName());
|
|
|
+ i.setAttachmentFlag("cwWorkContract");
|
|
|
+ i.setFileSize(dto.getSize());
|
|
|
+ i.setSort(j);
|
|
|
+ ossServiceMapper.insertWorkAttachment(i, userDTO);
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 根据报告签章id查询签章审核节点信息
|