|
@@ -701,14 +701,44 @@ public class ExcelTabController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
|
+// File file1 = ResourceUtil.getFile("D:\\develop\\1613737889349238784.html");
|
|
FileInputStream fileInputStream = new FileInputStream(file1);
|
|
FileInputStream fileInputStream = new FileInputStream(file1);
|
|
String htmlString = IoUtil.readToString(fileInputStream);
|
|
String htmlString = IoUtil.readToString(fileInputStream);
|
|
// 解析 style
|
|
// 解析 style
|
|
|
|
+ htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
|
|
+ htmlString = htmlString.replaceAll("title", "titlexx");
|
|
|
|
+
|
|
|
|
+ // 远程搜索配置
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Element table = doc.select("table").first();
|
|
Element table = doc.select("table").first();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Elements col = doc.select("Col");
|
|
doc.select("Col").remove();
|
|
doc.select("Col").remove();
|
|
|
|
+ ProjectInfo projectInfo = projectInfoService.getById(wbsTreePrivate.getProjectId());
|
|
|
|
+ // 添加标题显示
|
|
|
|
+
|
|
|
|
+ Elements trs = table.select("tr");
|
|
|
|
+ for (int i = 1; i < 6; i++) {
|
|
|
|
+ Element tr = trs.get(i);
|
|
|
|
+ Elements tds = tr.select("td");
|
|
|
|
+ for (int j = 0; j < tds.size(); j++) {
|
|
|
|
+ Element data = tds.get(j);
|
|
|
|
+ int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
|
+ String style = data.attr("style");
|
|
|
|
+ if (style.indexOf("font-size") >= 0) {
|
|
|
|
+ int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:") + 10, style.indexOf(".0pt")));
|
|
|
|
+ if (StringUtils.isNotEmpty(data.text()) && fontsize >= 12) {
|
|
|
|
+ trs.get(i - 1).select("td").get(0).text(projectInfo.getProjectName());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
fileInputStream.close();
|
|
fileInputStream.close();
|
|
- return R.data((table + "").replaceAll("title","axis").replaceAll("placeholder","name"));
|
|
|
|
|
|
+ return R.data(table + "");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1574,10 +1604,10 @@ public class ExcelTabController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
if (theLogJson != null) {
|
|
if (theLogJson != null) {
|
|
- String evPdf = theLogJson.getString("eVisaPdfUrl");
|
|
|
|
- if(StringUtils.isNotEmpty(evPdf)){
|
|
|
|
- return R.data(evPdf);
|
|
|
|
- }
|
|
|
|
|
|
+// String evPdf = theLogJson.getString("eVisaPdfUrl");
|
|
|
|
+// if(StringUtils.isNotEmpty(evPdf)){
|
|
|
|
+// return R.data(evPdf);
|
|
|
|
+// }
|
|
|
|
|
|
theLogId = theLogJson.getString("id");
|
|
theLogId = theLogJson.getString("id");
|
|
//查询对应的html
|
|
//查询对应的html
|
|
@@ -1601,7 +1631,7 @@ public class ExcelTabController extends BladeController {
|
|
List<Map<String, Object>> businessDataMapList = this.getTheLogBusinessData(theLogId, nodePrimaryKeyId, recordTime, contractId).getData();
|
|
List<Map<String, Object>> businessDataMapList = this.getTheLogBusinessData(theLogId, nodePrimaryKeyId, recordTime, contractId).getData();
|
|
//PDF路径
|
|
//PDF路径
|
|
List<String> pdfUrls = new ArrayList<>();
|
|
List<String> pdfUrls = new ArrayList<>();
|
|
-
|
|
|
|
|
|
+ ProjectInfo projectInfo = projectInfoService.getById(tableNode.getProjectId());
|
|
//处理数据
|
|
//处理数据
|
|
for (Map<String, Object> dataMap : businessDataMapList) {
|
|
for (Map<String, Object> dataMap : businessDataMapList) {
|
|
// 获取excel流 和 html流
|
|
// 获取excel流 和 html流
|
|
@@ -1609,15 +1639,26 @@ public class ExcelTabController extends BladeController {
|
|
wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
|
|
wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
|
|
//获取工作表
|
|
//获取工作表
|
|
Worksheet sheet = wb.getWorksheets().get(0);
|
|
Worksheet sheet = wb.getWorksheets().get(0);
|
|
-
|
|
|
|
// 数据不为空 &&
|
|
// 数据不为空 &&
|
|
if (StringUtils.isNotEmpty(tableNode.getHtmlUrl())) {
|
|
if (StringUtils.isNotEmpty(tableNode.getHtmlUrl())) {
|
|
File htmlFile = ResourceUtil.getFile(tableNode.getHtmlUrl());
|
|
File htmlFile = ResourceUtil.getFile(tableNode.getHtmlUrl());
|
|
|
|
+// File htmlFile = ResourceUtil.getFile("D:\\develop\\1613737889349238784.html");
|
|
if (htmlFile.exists()) {
|
|
if (htmlFile.exists()) {
|
|
String htmlString = IoUtil.readToString(new FileInputStream(htmlFile));
|
|
String htmlString = IoUtil.readToString(new FileInputStream(htmlFile));
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Element table = doc.select("table").first();
|
|
Element table = doc.select("table").first();
|
|
Elements trs = table.select("tr");
|
|
Elements trs = table.select("tr");
|
|
|
|
+ //添加标题
|
|
|
|
+ CellRange[] columns = sheet.getMergedCells();
|
|
|
|
+ for (int i = 0; i < columns.length; i++) {
|
|
|
|
+ CellRange cellRange = columns[i];
|
|
|
|
+ System.out.println(cellRange.getStyle().getFont().getSize());
|
|
|
|
+ if (cellRange.getStyle().getFont().getSize() >= 12) {
|
|
|
|
+ cellRange.setText(projectInfo.getProjectName());
|
|
|
|
+ cellRange.getStyle().getFont().setSize(20);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(dataMap)) {
|
|
if (ObjectUtil.isNotEmpty(dataMap)) {
|
|
for (String val : dataMap.keySet()) {
|
|
for (String val : dataMap.keySet()) {
|
|
@@ -1684,7 +1725,6 @@ public class ExcelTabController extends BladeController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
// 组装电签设置
|
|
// 组装电签设置
|
|
QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.eq("type", 2);
|
|
queryWrapper.eq("type", 2);
|
|
@@ -1715,7 +1755,7 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
Long fileName = SnowFlakeUtil.getId();
|
|
Long fileName = SnowFlakeUtil.getId();
|
|
String onePdfPath = file_path + "/pdf//" + fileName + ".pdf";
|
|
String onePdfPath = file_path + "/pdf//" + fileName + ".pdf";
|
|
-
|
|
|
|
|
|
+// wb.saveToFile("d://123123.xls", ExcelVersion.Version2010);
|
|
sheet.saveToPdf(onePdfPath);
|
|
sheet.saveToPdf(onePdfPath);
|
|
|
|
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(fileName + ".pdf", onePdfPath);
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(fileName + ".pdf", onePdfPath);
|
|
@@ -1855,6 +1895,8 @@ public class ExcelTabController extends BladeController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
return R.data(resultMapList);
|
|
return R.data(resultMapList);
|
|
}
|
|
}
|
|
|
|
|