|
@@ -217,12 +217,14 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
if (trialPdf2.exists()) {
|
|
|
trialPdf2.delete();
|
|
|
}
|
|
|
- //合并当前所有选择的试验pdf
|
|
|
- FileUtils.mergePdfPublicMethods(pdfList, trialPdf);
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", trialPdf);
|
|
|
- if (bladeFile != null && ObjectUtils.isNotEmpty(bladeFile.getLink())) {
|
|
|
- pdfUrl = bladeFile.getLink();
|
|
|
- return pdfUrl.toString();
|
|
|
+ if (pdfList.size() > 0) {
|
|
|
+ //合并当前所有选择的试验pdf
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfList, trialPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", trialPdf);
|
|
|
+ if (bladeFile != null && ObjectUtils.isNotEmpty(bladeFile.getLink())) {
|
|
|
+ pdfUrl = bladeFile.getLink();
|
|
|
+ return pdfUrl.toString();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
assert pdfUrl != null;
|
|
@@ -608,18 +610,20 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //合并pdf
|
|
|
- Long id = SnowFlakeUtil.getId();
|
|
|
- String pdfPath2 = file_path + "/pdf//" + id + "_2.pdf";
|
|
|
- File tabPdf2 = ResourceUtil.getFile(pdfPath2);
|
|
|
- if (tabPdf2.exists()) {
|
|
|
- tabPdf2.delete();
|
|
|
- }
|
|
|
- FileUtils.mergePdfPublicMethods(dataListPdf, pdfPath2);
|
|
|
+ if (dataListPdf.size() > 0) {
|
|
|
+ //合并pdf
|
|
|
+ Long id = SnowFlakeUtil.getId();
|
|
|
+ String pdfPath2 = file_path + "/pdf//" + id + "_2.pdf";
|
|
|
+ File tabPdf2 = ResourceUtil.getFile(pdfPath2);
|
|
|
+ if (tabPdf2.exists()) {
|
|
|
+ tabPdf2.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(dataListPdf, pdfPath2);
|
|
|
|
|
|
- BladeFile bladeFile = newIOSSClient.uploadFile(id + "2.pdf", pdfPath2);
|
|
|
- if (bladeFile != null) {
|
|
|
- return bladeFile.getLink();
|
|
|
+ BladeFile bladeFile = newIOSSClient.uploadFile(id + "2.pdf", pdfPath2);
|
|
|
+ if (bladeFile != null) {
|
|
|
+ return bladeFile.getLink();
|
|
|
+ }
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@@ -689,19 +693,20 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
//如果当前工程部位节点的关联试验记录id有多条,那么合并
|
|
|
List<TrialSelfInspectionRecord> pdfUrlList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().select(TrialSelfInspectionRecord::getPdfUrl).in(TrialSelfInspectionRecord::getId, trialRecordIds));
|
|
|
List<String> pdfS = pdfUrlList.stream().filter(f -> StringUtils.isNotEmpty(f.getPdfUrl())).map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
|
-
|
|
|
- String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- String listPdf = filePath + "/pdf/" + pKeyId + ".pdf";
|
|
|
- File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
- if (tabPDF.exists()) {
|
|
|
- tabPDF.delete();
|
|
|
- }
|
|
|
-
|
|
|
- FileUtils.mergePdfPublicMethods(pdfS, listPdf);
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(pKeyId + ".pdf", listPdf);
|
|
|
- if (bladeFile != null) {
|
|
|
- //修改合并的试验pdf到质检树节点的pdf_trial_url_position上存储
|
|
|
- baseMapper.updateInformationQuery(pKeyId, record.getContractId(), bladeFile.getLink());
|
|
|
+ if (ObjectUtil.isNotEmpty(pdfS) && pdfS.size() > 0) {
|
|
|
+ String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String listPdf = filePath + "/pdf/" + pKeyId + ".pdf";
|
|
|
+ File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabPDF.exists()) {
|
|
|
+ tabPDF.delete();
|
|
|
+ }
|
|
|
+
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfS, listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(pKeyId + ".pdf", listPdf);
|
|
|
+ if (bladeFile != null) {
|
|
|
+ //修改合并的试验pdf到质检树节点的pdf_trial_url_position上存储
|
|
|
+ baseMapper.updateInformationQuery(pKeyId, record.getContractId(), bladeFile.getLink());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1342,22 +1347,24 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
if (pdfList.size() > 0) {
|
|
|
//合并试验自检、第三方、外委的pdf
|
|
|
List<String> collect = pdfList.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
- String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
|
|
|
- File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
- if (tabPDF.exists()) {
|
|
|
- tabPDF.delete();
|
|
|
- }
|
|
|
- FileUtils.mergePdfPublicMethods(collect, listPdf);
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(informationQuery.getId() + ".pdf", listPdf);
|
|
|
- if (bladeFile != null) {
|
|
|
- //修改当前节点的pdfTrialURL地址
|
|
|
- if (informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, bladeFile.getLink()).eq(InformationQuery::getId, informationQuery.getId()))) {
|
|
|
- for (String recordId : Func.toStrList(dto.getIds())) {
|
|
|
- baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), recordId); //先删除对应记录
|
|
|
- baseMapper.insertSeletedStatus(SnowFlakeUtil.getId(), dto.getNodeId(), dto.getType(), recordId); //新增该类型选中的记录信息
|
|
|
+ if (ObjectUtil.isNotEmpty(collect) && collect.size() > 0) {
|
|
|
+ String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
|
|
|
+ File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabPDF.exists()) {
|
|
|
+ tabPDF.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(collect, listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(informationQuery.getId() + ".pdf", listPdf);
|
|
|
+ if (bladeFile != null) {
|
|
|
+ //修改当前节点的pdfTrialURL地址
|
|
|
+ if (informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, bladeFile.getLink()).eq(InformationQuery::getId, informationQuery.getId()))) {
|
|
|
+ for (String recordId : Func.toStrList(dto.getIds())) {
|
|
|
+ baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), recordId); //先删除对应记录
|
|
|
+ baseMapper.insertSeletedStatus(SnowFlakeUtil.getId(), dto.getNodeId(), dto.getType(), recordId); //新增该类型选中的记录信息
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1398,26 +1405,27 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
if (pdfList.size() > 0 && informationQuery != null) {
|
|
|
//重新合并
|
|
|
List<String> collect = pdfList.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
- String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
|
|
|
- File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
- if (tabPDF.exists()) {
|
|
|
- tabPDF.delete();
|
|
|
- }
|
|
|
- FileUtils.mergePdfPublicMethods(collect, listPdf);
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(informationQuery.getId() + ".pdf", listPdf);
|
|
|
- if (bladeFile != null) {
|
|
|
- //修改当前节点最新的pdfTrialURL地址
|
|
|
- if (informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, bladeFile.getLink()).eq(InformationQuery::getId, informationQuery.getId()))) {
|
|
|
- for (String recordId : recordIds) {
|
|
|
- baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), recordId); //先删除对应记录
|
|
|
- baseMapper.insertSeletedStatus(SnowFlakeUtil.getId(), dto.getNodeId(), dto.getType(), recordId); //新增该类型选中的记录信息
|
|
|
+ if (ObjectUtil.isNotEmpty(collect) && collect.size() > 0) {
|
|
|
+ String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
|
|
|
+ File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabPDF.exists()) {
|
|
|
+ tabPDF.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(collect, listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(informationQuery.getId() + ".pdf", listPdf);
|
|
|
+ if (bladeFile != null) {
|
|
|
+ //修改当前节点最新的pdfTrialURL地址
|
|
|
+ if (informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, bladeFile.getLink()).eq(InformationQuery::getId, informationQuery.getId()))) {
|
|
|
+ for (String recordId : recordIds) {
|
|
|
+ baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), recordId); //先删除对应记录
|
|
|
+ baseMapper.insertSeletedStatus(SnowFlakeUtil.getId(), dto.getNodeId(), dto.getType(), recordId); //新增该类型选中的记录信息
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
//修改pdfTrialUrl=null
|
|
|
if (informationQuery != null) {
|