|
@@ -339,7 +339,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
List<NodeTable> tableAll = createNodeTables(nodeId, tableInfoList.get(0).getContractId(), tableInfoList.get(0).getProjectId(), type);
|
|
|
StopWatch stopWatch = new StopWatch();
|
|
|
List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(tableInfoList.stream().map(TableInfo::getPkeyId).filter(Func::isNotEmpty).map(Long::parseLong).collect(Collectors.toList()), tableInfoList.get(0).getProjectId(), String.valueOf(nodeId), type);
|
|
|
- if (Func.isNotEmpty(keyMappers)) {
|
|
|
+ if (Func.isNotEmpty(keyMappers) && Func.isNotEmpty(tableAll)) {
|
|
|
Map<String, Map<String, String>> coordinateMap = createCoordinateMap(keyMappers, type);
|
|
|
stopWatch.start("公式处理");
|
|
|
List<Formula> formulas = this.formulaService.getFormulaList(keyMappers);
|
|
@@ -702,9 +702,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void gsColor(Long pKeyId,String nodeId,String projectId,Document doc) {
|
|
|
- try{
|
|
|
- List<KeyMapper> keyMappers=this.formulaService.getKeyMapperList(Collections.singletonList(pKeyId),projectId,nodeId,ExecuteType.INSPECTION);
|
|
|
+ public void gsColor(Long pKeyId, String nodeId, String projectId, Document doc) {
|
|
|
+ try {
|
|
|
+ List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(Collections.singletonList(pKeyId), projectId, nodeId, ExecuteType.INSPECTION);
|
|
|
if (!keyMappers.isEmpty()) {
|
|
|
keyMappers.stream()
|
|
|
.filter(e -> e.getFormulaId() != null)
|
|
@@ -714,10 +714,11 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
processElements(doc.select("el-date-picker[keyname^=" + key + "]"));
|
|
|
});
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private void processElements(Elements elements) {
|
|
|
elements.forEach(element -> element.parent().attr("gscolor", "11"));
|
|
|
}
|
|
@@ -2372,63 +2373,65 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
|
|
|
|
|
|
- //附件
|
|
|
- TableFile tableFile1 = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getType, 1)).stream().findAny().orElse(null);
|
|
|
- if (tableFile1 != null) {
|
|
|
+ if (bladeFile != null) {
|
|
|
+ //附件
|
|
|
+ TableFile tableFile1 = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getType, 1)).stream().findAny().orElse(null);
|
|
|
+ if (tableFile1 != null) {
|
|
|
/*tableFile1.setDomainPdfUrl(bladeFile.getLink());
|
|
|
tableFileService.saveOrUpdate(tableFile1);*/
|
|
|
- tableFileService.update(Wrappers.<TableFile>lambdaUpdate().set(TableFile::getDomainPdfUrl, bladeFile.getLink()).eq(TableFile::getId, tableFile1.getId()));
|
|
|
- } else {
|
|
|
- TableFile tableFile = new TableFile();
|
|
|
- String fileExtension = FileUtil.getFileExtension(wbsTreePrivate.getFullName() + ".pdf");
|
|
|
- tableFile.setTabId(pkeyId + "");
|
|
|
- tableFile.setName(wbsTreePrivate.getFullName() + ".pdf");
|
|
|
- tableFile.setType(1);
|
|
|
- tableFile.setDomainUrl(bladeFile.getLink());
|
|
|
- tableFile.setIsDeleted(0);
|
|
|
- tableFile.setExtension(fileExtension);
|
|
|
- tableFile.setDomainPdfUrl(bladeFile.getLink());
|
|
|
- tableFile.setTrialRecordId(id);
|
|
|
- tableFileService.saveOrUpdate(tableFile);
|
|
|
- }
|
|
|
+ tableFileService.update(Wrappers.<TableFile>lambdaUpdate().set(TableFile::getDomainPdfUrl, bladeFile.getLink()).eq(TableFile::getId, tableFile1.getId()));
|
|
|
+ } else {
|
|
|
+ TableFile tableFile = new TableFile();
|
|
|
+ String fileExtension = FileUtil.getFileExtension(wbsTreePrivate.getFullName() + ".pdf");
|
|
|
+ tableFile.setTabId(pkeyId + "");
|
|
|
+ tableFile.setName(wbsTreePrivate.getFullName() + ".pdf");
|
|
|
+ tableFile.setType(1);
|
|
|
+ tableFile.setDomainUrl(bladeFile.getLink());
|
|
|
+ tableFile.setIsDeleted(0);
|
|
|
+ tableFile.setExtension(fileExtension);
|
|
|
+ tableFile.setDomainPdfUrl(bladeFile.getLink());
|
|
|
+ tableFile.setTrialRecordId(id);
|
|
|
+ tableFileService.saveOrUpdate(tableFile);
|
|
|
+ }
|
|
|
|
|
|
- //获取当前试验记录的中的元素表的附件文件
|
|
|
- List<TableFile> tableFileList = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getTrialRecordId, id));
|
|
|
+ //获取当前试验记录的中的元素表的附件文件
|
|
|
+ List<TableFile> tableFileList = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getTrialRecordId, id));
|
|
|
|
|
|
- if (tableFileList.size() > 0) {
|
|
|
- tableFileList.sort(Comparator.comparing(TableFile::getType));
|
|
|
- List<String> dataListPdf = tableFileList.stream().filter(tableFile ->
|
|
|
- tableFile.getDomainPdfUrl() != null
|
|
|
- && (tableFile.getType() == 1 || tableFile.getType() == 2)
|
|
|
- ).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
|
|
|
+ if (tableFileList.size() > 0) {
|
|
|
+ tableFileList.sort(Comparator.comparing(TableFile::getType));
|
|
|
+ List<String> dataListPdf = tableFileList.stream().filter(tableFile ->
|
|
|
+ tableFile.getDomainPdfUrl() != null
|
|
|
+ && (tableFile.getType() == 1 || tableFile.getType() == 2)
|
|
|
+ ).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
- String pdfPath2 = file_path + "/pdf//" + pkeyId + "_2.pdf";
|
|
|
+ String pdfPath2 = file_path + "/pdf//" + pkeyId + "_2.pdf";
|
|
|
|
|
|
- File tabPdf2 = ResourceUtil.getFile(pdfPath2);
|
|
|
- if (tabPdf2.exists()) {
|
|
|
- tabPdf2.delete();
|
|
|
- }
|
|
|
- FileUtils.mergePdfPublicMethods(dataListPdf, pdfPath2);
|
|
|
-
|
|
|
- BladeFile bladeFile2 = newIOSSClient.uploadFile(pkeyId + "2.pdf", pdfPath2);
|
|
|
-
|
|
|
- //查询是否存在关系
|
|
|
- String sqlQuery = "select id from u_trial_self_data_record where record_id = " + id + " and tab_id = " + pkeyId;
|
|
|
- List<TrialSelfDataRecord> query = jdbcTemplate.query(sqlQuery, new BeanPropertyRowMapper<>(TrialSelfDataRecord.class));
|
|
|
- String sql;
|
|
|
- if (query.size() == 0) {
|
|
|
- //新增关系
|
|
|
- sql = "insert into u_trial_self_data_record(id,record_id,tab_id,is_buss_show,is_tab_pdf,is_tab_file_type,pdf_url) values" +
|
|
|
- "(" + SnowFlakeUtil.getId() + "," + id + "," + pkeyId + "," + 1 + "," + 2 + "," + 1 + ",'" + bladeFile2.getLink() + "')";
|
|
|
- } else {
|
|
|
- //修改pdfUrl
|
|
|
- sql = "update u_trial_self_data_record set pdf_url ='" + bladeFile2.getLink() + "' where record_id = " + id + " and tab_id = " + pkeyId;
|
|
|
- }
|
|
|
- jdbcTemplate.execute(sql);
|
|
|
+ File tabPdf2 = ResourceUtil.getFile(pdfPath2);
|
|
|
+ if (tabPdf2.exists()) {
|
|
|
+ tabPdf2.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(dataListPdf, pdfPath2);
|
|
|
+
|
|
|
+ BladeFile bladeFile2 = newIOSSClient.uploadFile(pkeyId + "2.pdf", pdfPath2);
|
|
|
+
|
|
|
+ //查询是否存在关系
|
|
|
+ String sqlQuery = "select id from u_trial_self_data_record where record_id = " + id + " and tab_id = " + pkeyId;
|
|
|
+ List<TrialSelfDataRecord> query = jdbcTemplate.query(sqlQuery, new BeanPropertyRowMapper<>(TrialSelfDataRecord.class));
|
|
|
+ String sql;
|
|
|
+ if (query.size() == 0) {
|
|
|
+ //新增关系
|
|
|
+ sql = "insert into u_trial_self_data_record(id,record_id,tab_id,is_buss_show,is_tab_pdf,is_tab_file_type,pdf_url) values" +
|
|
|
+ "(" + SnowFlakeUtil.getId() + "," + id + "," + pkeyId + "," + 1 + "," + 2 + "," + 1 + ",'" + bladeFile2.getLink() + "')";
|
|
|
+ } else {
|
|
|
+ //修改pdfUrl
|
|
|
+ sql = "update u_trial_self_data_record set pdf_url ='" + bladeFile2.getLink() + "' where record_id = " + id + " and tab_id = " + pkeyId;
|
|
|
+ }
|
|
|
+ jdbcTemplate.execute(sql);
|
|
|
|
|
|
- return bladeFile2.getLink();
|
|
|
+ return bladeFile2.getLink();
|
|
|
+ }
|
|
|
+ return bladeFile.getLink();
|
|
|
}
|
|
|
-
|
|
|
return "";
|
|
|
}
|
|
|
|