Explorar el Código

实验默认值 保存后不修改

zhuwei hace 1 mes
padre
commit
d6181c1083

+ 21 - 15
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -2834,6 +2834,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         //实体数据
         String querySql = "select * from " + wbsTreePrivate.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + groupId;
         List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
+
+
+
         String keyNames="";
         //匹配关联
         try {
@@ -2850,6 +2853,20 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
             htmlString = htmlString.replaceAll("title", "titlexx");
             Document doc = Jsoup.parse(htmlString);
+
+
+            // 获取默认值
+            Elements elements = doc.getElementsByAttribute("defText");
+            if(Func.isNotEmpty(elements) && elements.size()>=1){
+                for(Element eleme: elements){
+                    String id = Func.isNull(eleme.attr("id"))?eleme.attr("keyname"):eleme.attr("id");
+                    if(Func.isNotEmpty(id)){
+
+                        reData.put(id, eleme.attr("defText"));
+                    }
+                }
+            }
+
             keyNames= getKeyNameList(doc);
             TrialSelfInspectionRecord record = jdbcTemplate.query("select * from u_trial_self_inspection_record where id = " + groupId, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
             // 优先使用试验记录中的委托单和样品
@@ -3146,25 +3163,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     }
                 }
             }
+
+
         } catch (Exception e) {
             e.printStackTrace();
         }
 
-        // 获取默认值
-        QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
-        queryWrapper.select("col_key", "sig_role_name");
-        queryWrapper.eq("type", 4);
-        queryWrapper.eq("tab_id", wbsTreePrivate.getPKeyId());
-        final List<TextdictInfo> textDictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
-        if (!textDictInfos.isEmpty()) {
-            for (TextdictInfo textdictInfo : textDictInfos) {
-                if (reData.containsKey(textdictInfo.getColKey())) {
-                    String keyVal = reData.get(textdictInfo.getColKey()) + "";
-                } else {
-                    reData.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
-                }
-            }
-        }
+
+
 
         // 移除Id 和 p_key_id
         reData.remove("id");