diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/compare/utils/DiffUtils.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/compare/utils/DiffUtils.java index 586f01ee6..3f2f2a77c 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/compare/utils/DiffUtils.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/compare/utils/DiffUtils.java @@ -2229,8 +2229,33 @@ public class DiffUtils { } public List getHtmlDiffStr(String text1,String text2){ - text1 = text1.replaceAll("", ""); - text2 = text2.replaceAll("", ""); + Map replaceMap1 = new HashMap<>(); + Map replaceMap2 = new HashMap<>(); + //text1 = text1.replaceAll("", ""); + int startIndex = text1.indexOf(" -1) { + int endIndex = text1.indexOf(">", startIndex); + String subStr = text1.substring(startIndex, endIndex + 1); + String repStr = ""; + text1 = text1.replace(subStr, repStr); + replaceMap1.put(repStr,subStr); + index++; + startIndex = text1.indexOf("", ""); + startIndex = text2.indexOf(" -1) { + int endIndex = text2.indexOf(">", startIndex); + String subStr = text2.substring(startIndex, endIndex + 1); + String repStr = ""; + text2 = text2.replace(subStr, repStr); + replaceMap2.put(repStr,subStr); + index++; + startIndex = text2.indexOf(" diffs = diff_main(text1, text2); //定义输出结果 @@ -2254,6 +2279,12 @@ public class DiffUtils { } } List result =new ArrayList<>(); + for (String key:replaceMap1.keySet()) { + LResultStr = LResultStr.replace(key,replaceMap1.get(key)); + } + for (String key:replaceMap2.keySet()) { + RResultStr = RResultStr.replace(key,replaceMap2.get(key)); + } result.add(LResultStr); result.add(RResultStr); return result;