ソースを参照

试验汇总生成pdf数据获取优化

lvy 3 日 前
コミット
aa5f62d63d

+ 33 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialSummaryController.java

@@ -259,6 +259,13 @@ public class TrialSummaryController {
                             stringObjectMap.entrySet().removeIf(obj -> obj.getValue() == null || obj.getValue().equals(""));
                             Object tabData = stringObjectMap.getOrDefault(elementKey, null);
                             if (ObjectUtil.isEmpty(tabData)) {
+                                String keyName = elementKey + "__" + tabPkeyId;
+                                if (map.containsKey(keyName)) {
+                                    String existingValue = (String) map.get(keyName);
+                                    map.put(keyName, existingValue + "@@@###");
+                                } else {
+                                    map.put(keyName, "");
+                                }
                                 continue;
                             }
 
@@ -269,6 +276,9 @@ public class TrialSummaryController {
                                 for (String valueRow : split) {
                                     String[] splitValues = valueRow.split(Pattern.quote("_^_"));
                                     String valueInput = splitValues[0];
+                                    if (Objects.equals(valueInput, "/")) {
+                                        continue;
+                                    }
                                     /*String indexKey = splitValues[1];*/
                                     String keyName = elementKey + "__" + tabPkeyId;
 
@@ -353,7 +363,29 @@ public class TrialSummaryController {
                         if(obj == null){
                             map2.put(data.getHtmlKeyName().split("__")[0]+"__",map.get(mapKey));
                         } else {
-                            map2.put(data.getHtmlKeyName().split("__")[0]+"__", obj.toString() + "、" + map.get(mapKey));
+                            String[] split = obj.toString().split("@@@###");
+                            String[] split1 = map.get(mapKey).toString().split("@@@###");
+                            int max = Math.max(split.length, split1.length);
+                            StringBuilder sb = new StringBuilder();
+                            for (int i = 0; i < max; i++) {
+                                String v = "";
+                                if (i < split.length) {
+                                    v = split[i];
+                                }
+                                if (i < split1.length) {
+                                    if (!v.isEmpty()) {
+                                        v = v + "、" + split1[i];
+                                    } else {
+                                        v = split1[i];
+                                    }
+                                }
+                                if (sb.length() > 0) {
+                                    sb.append("@@@###").append( v);
+                                } else {
+                                    sb.append(v);
+                                }
+                            }
+                            map2.put(data.getHtmlKeyName().split("__")[0]+"__", sb.toString());
                         }
                     }
                  }