|
@@ -1085,105 +1085,117 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
// 匹配关联
|
|
|
try {
|
|
|
- File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
|
|
|
- if (file1.exists()) {
|
|
|
-
|
|
|
- String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
|
- Document doc = Jsoup.parse(htmlString);
|
|
|
-
|
|
|
- // 解析
|
|
|
- // 模糊匹配
|
|
|
- Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
|
|
|
- Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
|
|
|
- Elements sgtitle1 = doc.select("el-input[placeholder=安装单位]");
|
|
|
- sgtitle.addAll(sgtitle1);
|
|
|
-
|
|
|
- Elements htdtitle = doc.select("el-input[placeholder~=.*合同段.*]");
|
|
|
- Elements htdtitle1 = doc.select("el-input[placeholder~=合同名称.*]");
|
|
|
- htdtitle.addAll(htdtitle1);
|
|
|
-
|
|
|
- Elements jltitle = doc.select("el-input[placeholder~=监理单位.*]");
|
|
|
-
|
|
|
- Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
|
|
|
- Elements bhtitle1 = doc.select("el-input[placeholder~=合同编号.*]");
|
|
|
- bhtitle.addAll(bhtitle1);
|
|
|
-
|
|
|
-
|
|
|
- Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
|
|
|
-
|
|
|
+ InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(wbsTreeContract.getHtmlUrl());
|
|
|
|
|
|
- // Elements title = doc.select("el-input[placeholder~=^编号]");
|
|
|
+ String htmlString = IoUtil.readToString(inputStreamByUrl);
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
|
|
|
- /**
|
|
|
- * 承包单位 承包单位、施工单位:引用施工单位名称 ,
|
|
|
- * 监理单位:引用监理单位名称
|
|
|
- * 合同段、所属建设项目(合同段):引用合同段编号
|
|
|
- *
|
|
|
- * 施工单位:施工单位 和 安装单位
|
|
|
- *
|
|
|
- */
|
|
|
- ContractInfo contractInfo = contractInfoService.getById(wbsTreeContract.getContractId());
|
|
|
- // 施工单位名称
|
|
|
- if (dwtitle.size() >= 1) {
|
|
|
- int y = Integer.parseInt(dwtitle.attr("trindex"));
|
|
|
- if (y <= 10) {
|
|
|
- reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
- }
|
|
|
+ // 解析
|
|
|
+ // 模糊匹配
|
|
|
+ Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
|
|
|
+ Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
|
|
|
+ Elements sgtitle1 = doc.select("el-input[placeholder=安装单位]");
|
|
|
+ sgtitle.addAll(sgtitle1);
|
|
|
+
|
|
|
+ //合同段显示合同编号
|
|
|
+ Elements htdtitle = doc.select("el-input[placeholder~=.*合同段.*]");
|
|
|
+ //合同名称显示合同名称
|
|
|
+ Elements htdtitle1 = doc.select("el-input[placeholder~=合同名称.*]");
|
|
|
+// htdtitle.addAll(htdtitle1);
|
|
|
+
|
|
|
+ Elements jltitle = doc.select("el-input[placeholder~=监理单位.*]");
|
|
|
+
|
|
|
+ //编号为父节点划分编号
|
|
|
+ Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
|
|
|
+ //合同编号为合同编号
|
|
|
+ Elements bhtitle1 = doc.select("el-input[placeholder~=合同编号.*]");
|
|
|
+ bhtitle1.addAll(htdtitle);
|
|
|
+
|
|
|
+ Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
|
|
|
+
|
|
|
+
|
|
|
+ // Elements title = doc.select("el-input[placeholder~=^编号]");
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 承包单位 承包单位、施工单位:引用施工单位名称 ,
|
|
|
+ * 监理单位:引用监理单位名称
|
|
|
+ * 合同段、所属建设项目(合同段):引用合同段编号
|
|
|
+ *
|
|
|
+ * 施工单位:施工单位 和 安装单位
|
|
|
+ *
|
|
|
+ */
|
|
|
+ ContractInfo contractInfo = contractInfoService.getById(wbsTreeContract.getContractId());
|
|
|
+ // 施工单位名称
|
|
|
+ if (dwtitle.size() >= 1) {
|
|
|
+ int y = Integer.parseInt(dwtitle.attr("trindex"));
|
|
|
+ if (y <= 10) {
|
|
|
+ reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ if (sgtitle.size() >= 1) {
|
|
|
+ int y = Integer.parseInt(sgtitle.attr("trindex"));
|
|
|
+ if (y <= 10) {
|
|
|
+ reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
}
|
|
|
- if (sgtitle.size() >= 1) {
|
|
|
- int y = Integer.parseInt(sgtitle.attr("trindex"));
|
|
|
- if (y <= 10) {
|
|
|
- reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 合同段名称
|
|
|
+ if (htdtitle1.size() >= 1) {
|
|
|
+ for (Element element : htdtitle1) {
|
|
|
+ int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
+ if (trindex <= 8) {
|
|
|
+ reData.put(element.attr("keyName"), contractInfo.getContractName());
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+ // 监理单位名称
|
|
|
+ if (jltitle.size() >= 1) {
|
|
|
|
|
|
- // 合同段名称
|
|
|
- if (htdtitle.size() >= 1) {
|
|
|
- for (Element element : htdtitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 8) {
|
|
|
- reData.put(element.attr("keyName"), contractInfo.getContractNumber());
|
|
|
- }
|
|
|
+ for (Element element : jltitle) {
|
|
|
+ int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
+ if (trindex <= 10) {
|
|
|
+ reData.put(element.attr("keyName"), contractInfo.getSupervisionUnitName());
|
|
|
}
|
|
|
}
|
|
|
- // 监理单位名称
|
|
|
- if (jltitle.size() >= 1) {
|
|
|
-
|
|
|
- for (Element element : jltitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 10) {
|
|
|
- reData.put(element.attr("keyName"), contractInfo.getSupervisionUnitName());
|
|
|
- }
|
|
|
+ }
|
|
|
+ //获取父节点划分编号
|
|
|
+ WbsTreeContract node = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getId, wbsTreeContract.getParentId())
|
|
|
+ .eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId()));
|
|
|
+ // 编号
|
|
|
+ if (bhtitle.size() >= 1 && contractInfo.getIsReferenceNumber() == 1) {
|
|
|
+ for (Element element : bhtitle) {
|
|
|
+ int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
+ if (trindex <= 10) {
|
|
|
+ reData.put(element.attr("keyName"), node.getPartitionCode() == null ? "" : node.getPartitionCode());
|
|
|
}
|
|
|
}
|
|
|
- //获取父节点划分编号
|
|
|
- WbsTreeContract node = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
- .eq(WbsTreeContract::getId, wbsTreeContract.getParentId())
|
|
|
- .eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId()));
|
|
|
- // 编号
|
|
|
- if (bhtitle.size() >= 1 && contractInfo.getIsReferenceNumber() == 1) {
|
|
|
- for (Element element : bhtitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 10) {
|
|
|
- reData.put(element.attr("keyName"), node.getPartitionCode() == null ? "" : node.getPartitionCode());
|
|
|
- }
|
|
|
+ }
|
|
|
+ //获取合同编号
|
|
|
+ if (bhtitle1.size() >= 1) {
|
|
|
+ for (Element element : bhtitle1) {
|
|
|
+ int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
+ if (trindex <= 10) {
|
|
|
+ reData.put(element.attr("keyName"), contractInfo.getContractNumber());
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- // 项目名称
|
|
|
- if (xmtitle.size() >= 1) {
|
|
|
- for (Element element : xmtitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 6) {
|
|
|
- ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
|
|
|
- reData.put(element.attr("keyName"), projectInfo.getProjectName());
|
|
|
- }
|
|
|
+ // 项目名称
|
|
|
+ if (xmtitle.size() >= 1) {
|
|
|
+ for (Element element : xmtitle) {
|
|
|
+ int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
+ if (trindex <= 6) {
|
|
|
+ ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
|
|
|
+ reData.put(element.attr("keyName"), projectInfo.getProjectName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} catch (FileNotFoundException e) {
|
|
|
e.printStackTrace();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
if (dataIn != null && dataIn.size() >= 1) {
|