Przeglądaj źródła

日志回显项目信息

qianxb 2 lat temu
rodzic
commit
8260c1118c

+ 107 - 9
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -128,6 +128,8 @@ public class ExcelTabController extends BladeController {
 
     private final ITableInfoService tableInfoService;
 
+    private final IContractInfoService contractInfoService;
+
     /**
      * 详情
      */
@@ -2029,6 +2031,8 @@ public class ExcelTabController extends BladeController {
     })
     public R<List<Map<String, Object>>> getTheLogBusinessData(String theLogId, String nodePrimaryKeyId, String recordTime, String contractId) {
         List<Map<String, Object>> resultMapList = new ArrayList<>();
+        //数据结果
+        Map<String, Object> reData = new HashMap<>();
         //获取对应的记录
         JSONObject theLogJson;
         if (StringUtils.isNotEmpty(theLogId)) {
@@ -2037,6 +2041,103 @@ public class ExcelTabController extends BladeController {
         } else {
             theLogJson = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTime(nodePrimaryKeyId, recordTime, contractId);
         }
+
+        WbsTreePrivate node = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, nodePrimaryKeyId));
+        WbsTreePrivate tableNode2 = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery()
+                .eq(WbsTreePrivate::getParentId, node.getId()).eq(WbsTreePrivate::getProjectId, node.getProjectId()));
+
+        // 匹配关联
+        try {
+//            File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
+                File file1 = ResourceUtil.getFile(tableNode2.getHtmlUrl());
+//            File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1633285246067671040.html");
+            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~=^项目名称]");
+
+
+                // Elements title = doc.select("el-input[placeholder~=^编号]");
+
+                /**
+                 * 承包单位 承包单位、施工单位:引用施工单位名称 ,
+                 * 监理单位:引用监理单位名称
+                 * 合同段、所属建设项目(合同段):引用合同段编号
+                 *
+                 * 施工单位:施工单位 和 安装单位
+                 *
+                 */
+                ContractInfo contractInfo = contractInfoService.getById(contractId);
+                // 施工单位名称
+                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 (htdtitle.size() >= 1) {
+                    for (Element element : htdtitle) {
+                        int trindex = Integer.parseInt(element.attr("trindex"));
+                        if (trindex <= 8) {
+                            reData.put(element.attr("keyName"), contractInfo.getContractNumber());
+                        }
+                    }
+                }
+                // 监理单位名称
+                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());
+                        }
+                    }
+                }
+
+                // 项目名称
+                if (xmtitle.size() >= 1) {
+                    for (Element element : xmtitle) {
+                        int trindex = Integer.parseInt(element.attr("trindex"));
+                        if (trindex <= 6) {
+                            ProjectInfo projectInfo = projectInfoService.getById(tableNode2.getProjectId());
+                            reData.put(element.attr("keyName"), projectInfo.getProjectName());
+                        }
+                    }
+                }
+            }
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        }
+
         if (theLogJson != null) {
             //查询对应的html
             WbsTreePrivate tableNode = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, theLogJson.getString("tableId")));
@@ -2056,8 +2157,7 @@ public class ExcelTabController extends BladeController {
             if (businessDataMap.size() > 0) {
 
                 for (Map<String, Object> mysqlData : businessDataMap) {
-                    //数据结果
-                    Map<String, Object> reData = new HashMap<>();
+
 
                     String id = mysqlData.get("id") + "";
                     String querySqlx = "SELECT tree_primary_key_id as primaryKeyId,title as path from u_contract_log_wbs where  business_id ='" + id + "' and is_deleted=0";
@@ -2132,20 +2232,18 @@ public class ExcelTabController extends BladeController {
                 }
             }
         } else {
-            WbsTreePrivate node = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, nodePrimaryKeyId));
-            WbsTreePrivate tableNode = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery()
-                    .eq(WbsTreePrivate::getParentId, node.getId()).eq(WbsTreePrivate::getProjectId, node.getProjectId()));
-            Map<String, Object> reData = new HashMap<>();
+            resultMapList.add(reData);
+            Map<String, Object> reData2 = new HashMap<>();
             // 获取默认值
             QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("type", 4);
-            queryWrapper.eq("tab_id", tableNode.getPKeyId());
+            queryWrapper.eq("tab_id", tableNode2.getPKeyId());
             final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
             if (!textdictInfos.isEmpty()) {
                 for (TextdictInfo textdictInfo : textdictInfos) {
-                    reData.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
+                    reData2.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
                 }
-                resultMapList.add(reData);
+                resultMapList.add(reData2);
             }
         }