|
@@ -513,7 +513,10 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
if ( null != reportData){
|
|
|
List<ProjectReportWorkAttachmentDTO> dtos = attachmentMapper.selectByInfoId(reportData.getId());
|
|
|
if (null != dtos){
|
|
|
- dtos.forEach(d->{
|
|
|
+
|
|
|
+ Iterator<ProjectReportWorkAttachmentDTO> it = dtos.iterator();
|
|
|
+ while(it.hasNext()){
|
|
|
+ ProjectReportWorkAttachmentDTO d = it.next();
|
|
|
//根据id查出cw_project_report_file文件表的其他信息
|
|
|
//未签章附件
|
|
|
CwProjectReportFile file = attachmentMapper.selectInfoByFileId(d.getId(),"0");
|
|
@@ -532,6 +535,7 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
d.setCreateBy(userDTO);
|
|
|
d.setCreateDate(file.getCreateDate());
|
|
|
dtoList.add(d);
|
|
|
+ it.remove();
|
|
|
}
|
|
|
|
|
|
//已签章附件
|
|
@@ -551,20 +555,33 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
d.setCreateBy(userDTO2);
|
|
|
d.setCreateDate(signatureFile.getCreateDate());
|
|
|
signatureList.add(d);
|
|
|
+ it.remove();
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
reportData.setCwFileInfoList(dtoList);
|
|
|
reportData.setSignatureFileList(signatureList);
|
|
|
}
|
|
|
+
|
|
|
//将附件信息查出
|
|
|
// 查询附件信息
|
|
|
List<WorkAttachmentDto> fileInfo2 = reportMapper.findDtos(id);
|
|
|
+ List<WorkAttachmentDto> reportFileList = Lists.newArrayList();
|
|
|
+ if(CollectionUtils.isNotEmpty(dtos) && CollectionUtils.isNotEmpty(fileInfo2)){
|
|
|
+ for (ProjectReportWorkAttachmentDTO dto : dtos) {
|
|
|
+ for (WorkAttachmentDto workAttachmentDto : fileInfo2) {
|
|
|
+ if(dto.getId().equals(workAttachmentDto.getId())){
|
|
|
+ reportFileList.add(workAttachmentDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (CollectionUtils.isNotEmpty(dtos)) {
|
|
|
- for (WorkAttachmentDto i : fileInfo2) {
|
|
|
+ for (WorkAttachmentDto i : reportFileList) {
|
|
|
i.setCreateBy(UserUtils.get(i.getBy()));
|
|
|
}
|
|
|
}
|
|
|
- reportData.setCwFileInfoList2(fileInfo2);
|
|
|
+ reportData.setCwFileInfoList2(reportFileList);
|
|
|
//设置历史报告列表
|
|
|
//根据项目id查出所有的信息
|
|
|
List<CwProjectReportData> byProjectList = reportMapper.getByProjectId(reportData.getProjectId());
|
|
@@ -2331,6 +2348,7 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
return reportData;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 修改附件信息
|
|
|
* @param list 待修改的附件列表
|
|
@@ -2404,16 +2422,16 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
* @param id 关联id
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void updateFiles2(List<WorkAttachmentDto> list, UserDTO userDTO, String id) {
|
|
|
+ public void updateSignatureFiles(List<ProjectReportWorkAttachmentDTO> list, UserDTO userDTO, String id) {
|
|
|
int j = 1;
|
|
|
String names = new String();
|
|
|
//表中存在,但是传过来不存在,说明已删除,表中数据也要删除
|
|
|
- for (WorkAttachmentDto dto : list) {
|
|
|
+ for (ProjectReportWorkAttachmentDTO dto : list) {
|
|
|
names = names + "," +dto.getUrl();
|
|
|
}
|
|
|
//查询保存的附件信息
|
|
|
List<WorkAttachment> infoList = reportMapper.findFileList(id);
|
|
|
- if (CollectionUtils.isNotEmpty(infoList)) {
|
|
|
+ if (org.flowable.editor.language.json.converter.util.CollectionUtils.isNotEmpty(infoList)) {
|
|
|
for (WorkAttachment i : infoList) {
|
|
|
if (!names.contains(i.getUrl())) {
|
|
|
ossServiceMapper.deleteById(i.getId());
|
|
@@ -2425,11 +2443,9 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ reportMapper.deleteAttachement(id,"cwReportSignature");
|
|
|
//保存信息
|
|
|
- for (WorkAttachmentDto dto : list) {
|
|
|
- //判断是否存在
|
|
|
- Integer isExit = reportMapper.findIsExit(id, dto.getName());
|
|
|
- if (isExit == 0) {
|
|
|
+ for (ProjectReportWorkAttachmentDTO dto : list) {
|
|
|
WorkAttachment i = new WorkAttachment();
|
|
|
//包含了url、size、name
|
|
|
i.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
@@ -2446,12 +2462,15 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
}
|
|
|
i.setAttachmentId(id);
|
|
|
i.setAttachmentName(dto.getName());
|
|
|
- i.setAttachmentFlag("cwWorkContract");
|
|
|
+ i.setAttachmentFlag("cwReportSignature");
|
|
|
i.setFileSize(dto.getSize());
|
|
|
i.setSort(j);
|
|
|
ossServiceMapper.insertWorkAttachment(i, userDTO);
|
|
|
+ CwProjectReportFile reportFile = new CwProjectReportFile();
|
|
|
+ BeanUtils.copyProperties(dto, reportFile);
|
|
|
+ reportFile.setReportFileId(i.getId());
|
|
|
+ attachmentMapper.insert(reportFile);
|
|
|
j++;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|