|
@@ -293,112 +293,17 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
String filecode = SnowFlakeUtil.getId() + "";
|
|
|
String thmlUrl = file_path + filecode + ".html";
|
|
|
- String thmlUrl2 = file_path + filecode + "123.html";
|
|
|
String exceUrl = file_path + filecode + "123.xlsx";
|
|
|
-
|
|
|
- // 解析原始excel
|
|
|
- Workbook wb = new Workbook();
|
|
|
- wb.loadFromMHtml(file.getInputStream());
|
|
|
-
|
|
|
- // 操作
|
|
|
- Workbook wb2 = new Workbook();
|
|
|
- wb2.loadFromMHtml(file.getInputStream());
|
|
|
- Worksheet sheet2 = wb2.getWorksheets().get(0);
|
|
|
-
|
|
|
- HTMLOptions options = new HTMLOptions();
|
|
|
- options.setImageEmbedded(true);
|
|
|
- //获取工作表
|
|
|
- Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
- sheet.saveToHtml(thmlUrl, options);
|
|
|
-
|
|
|
- CellRange[] mergedCells = sheet.getMergedCells();
|
|
|
- CellRange[] mergedCells3 = sheet2.getMergedCells();
|
|
|
- Map<String, Map<String, Integer>> xyList = new HashMap<>();
|
|
|
- int j = 0;
|
|
|
- for (int i = 0; i < mergedCells.length; i++) {
|
|
|
- Map<String, Integer> dataMap = new HashMap<>();
|
|
|
- CellRange mergedCell = mergedCells[i];
|
|
|
- j = j + 1;
|
|
|
- mergedCells3[i].getComment().getRichText().setText(j + "");
|
|
|
- mergedCell.setValue(j + "");
|
|
|
- dataMap.put("x1", mergedCell.getRow());
|
|
|
- dataMap.put("x2", mergedCell.getLastRow());
|
|
|
- dataMap.put("y1", mergedCell.getColumn());
|
|
|
- dataMap.put("y2", mergedCell.getLastColumn());
|
|
|
- xyList.put(j + "", dataMap);
|
|
|
- }
|
|
|
-
|
|
|
- CellRange[] mergedCells2 = sheet.getCells();
|
|
|
- CellRange[] mergedCells4 = sheet2.getCells();
|
|
|
- for (int i = 0; i < mergedCells2.length; i++) {
|
|
|
- CellRange mergedCell = mergedCells2[i];
|
|
|
- String data = mergedCell.getComment().getRichText().getText();
|
|
|
- if (StringUtils.isEmpty(data)) {
|
|
|
- j = j + 1;
|
|
|
- mergedCells4[i].getComment().getRichText().setText(j + "");
|
|
|
- mergedCell.setValue(j + "");
|
|
|
- Map<String, Integer> dataMap = new HashMap<>();
|
|
|
- dataMap.put("x1", mergedCell.getRow());
|
|
|
- dataMap.put("x2", mergedCell.getLastRow());
|
|
|
- dataMap.put("y1", mergedCell.getColumn());
|
|
|
- dataMap.put("y2", mergedCell.getLastColumn());
|
|
|
- xyList.put(j + "", dataMap);
|
|
|
- }
|
|
|
- }
|
|
|
- sheet.saveToHtml(thmlUrl2, options);
|
|
|
-
|
|
|
- // 组装坐标
|
|
|
- File html1 = new File(thmlUrl); // 原始html
|
|
|
- File html2 = new File(thmlUrl2); // 坐标html
|
|
|
- InputStream inputStream1 = new FileInputStream(html1);
|
|
|
- InputStream inputStream2 = new FileInputStream(html2);
|
|
|
- String htmlString1 = IoUtil.readToString(inputStream1);
|
|
|
- String htmlString2 = IoUtil.readToString(inputStream2);
|
|
|
-
|
|
|
- Document doc1 = Jsoup.parse(htmlString1);
|
|
|
- Element table1 = doc1.select("table").first();
|
|
|
- Elements trs1 = table1.select("tr");
|
|
|
- Document doc2 = Jsoup.parse(htmlString2);
|
|
|
- Element table2 = doc2.select("table").first();
|
|
|
- Elements trs2 = table2.select("tr");
|
|
|
-
|
|
|
- for (int i = 0; i < trs1.size(); i++) {
|
|
|
- Elements td1 = trs1.get(i).select("td");
|
|
|
- Elements td2 = trs2.get(i).select("td");
|
|
|
- for (int x = 0; x < td1.size(); x++) {
|
|
|
- Element cell1 = td1.get(x);
|
|
|
- Element cell2 = td2.get(x);
|
|
|
- String html = cell2.html();
|
|
|
- if (html.indexOf("div") >= 0) {
|
|
|
- html = cell2.children().get(0).html();
|
|
|
- }
|
|
|
- Map<String, Integer> xyMap = xyList.get(html);
|
|
|
- if (xyMap != null) {
|
|
|
- cell1.attr("x1", xyMap.get("x1") + "");
|
|
|
- cell1.attr("x2", xyMap.get("x2") + "");
|
|
|
- cell1.attr("y1", xyMap.get("y1") + "");
|
|
|
- cell1.attr("y2", xyMap.get("y2") + "");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ FileUtils.excelInfo(file.getInputStream(),exceUrl,thmlUrl,"1");
|
|
|
// 上传excel文件
|
|
|
- wb2.saveToFile(exceUrl,FileFormat.Version2013);
|
|
|
-
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(file.getOriginalFilename(),exceUrl);
|
|
|
-
|
|
|
- File writeFile = new File(thmlUrl);
|
|
|
- FileUtil.writeToFile(writeFile, doc1.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
-
|
|
|
+ // R<BladeFile> bladeFile = iossClient.addFileInfo(file);
|
|
|
+ // BladeFile bladeFile1 = bladeFile.getData();
|
|
|
detail.setExtension(file.getOriginalFilename());
|
|
|
detail.setFileUrl(bladeFile.getLink());
|
|
|
detail.setFileType(3); // 表示为清表信息 1 表示祖节点 2 表示为节点信息 3 表示清表
|
|
|
detail.setHtmlUrl(thmlUrl);
|
|
|
excelTabService.saveOrUpdate(detail);
|
|
|
-
|
|
|
- if (html2.exists()) {
|
|
|
- html2.delete();
|
|
|
- }
|
|
|
// 解析html
|
|
|
expailHtmlInfo(thmlUrl, detail.getId());
|
|
|
return R.success("上传成功");
|
|
@@ -563,11 +468,9 @@ public class ExcelTabController extends BladeController {
|
|
|
// 复制模版htmlURL
|
|
|
|
|
|
File file_in = ResourceUtil.getFile(excelTab.getHtmlUrl());
|
|
|
-// File file_in = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1605183410156863488.html");
|
|
|
|
|
|
String filecode = SnowFlakeUtil.getId() + "";
|
|
|
String thmlUrl = file_path + "/privateUrl/" + filecode + ".html";
|
|
|
-// String thmlUrl = "C:\\Users\\泓创研发01\\Desktop\\privateUrl\\out\\acc.html";
|
|
|
File file_out = ResourceUtil.getFile(thmlUrl);
|
|
|
FileUtil.copy(file_in, file_out);
|
|
|
updateWrapper.set("html_url", thmlUrl);
|
|
@@ -657,9 +560,7 @@ public class ExcelTabController extends BladeController {
|
|
|
element.children().get(0).attr("placeholder", lastName)
|
|
|
.attr("weighing", maxScore + "").attr("id", attrInfo).attr("keyName", attrInfo)
|
|
|
.attr("@blur", "getRegularExpression(" + regularExpression + ",'" + filedLength + "')")
|
|
|
- .attr("maxlength", filedLength)
|
|
|
- .attr("class", "warnstyle");
|
|
|
-
|
|
|
+ .attr("maxlength", filedLength);
|
|
|
}
|
|
|
element.attr("@click", "getInformation(" + oncklickText + ")");
|
|
|
}
|
|
@@ -2181,10 +2082,8 @@ public class ExcelTabController extends BladeController {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
//更新缓存
|
|
|
informationQueryClient.delAsyncWbsTree(contractId);
|
|
|
-
|
|
|
return R.data("操作成功");
|
|
|
}
|
|
|
|
|
@@ -3516,7 +3415,6 @@ public class ExcelTabController extends BladeController {
|
|
|
InputStream fileInputStream = null;
|
|
|
if (file1.exists()) {
|
|
|
fileInputStream = new FileInputStream(file1);
|
|
|
- ;
|
|
|
} else {
|
|
|
String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
|
|
|
fileInputStream = CommonUtil.getOSSInputStream(path);
|