diff --git a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/compare/utils/DiffUtils.java b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/compare/utils/DiffUtils.java index 3f2f2a7..a3f7773 100644 --- a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/compare/utils/DiffUtils.java +++ b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/compare/utils/DiffUtils.java @@ -2231,6 +2231,8 @@ public class DiffUtils { public List getHtmlDiffStr(String text1,String text2){ Map replaceMap1 = new HashMap<>(); Map replaceMap2 = new HashMap<>(); + Map replaceMap3 = new HashMap<>(); + Map replaceMap4 = 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); + replaceMap3.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); + replaceMap4.put(repStr,subStr); + index++; + startIndex = text2.indexOf(" diffs = diff_main(text1, text2); //定义输出结果 String LResultStr=""; @@ -2285,6 +2312,12 @@ public class DiffUtils { for (String key:replaceMap2.keySet()) { RResultStr = RResultStr.replace(key,replaceMap2.get(key)); } + for (String key:replaceMap3.keySet()) { + LResultStr = LResultStr.replace(key,replaceMap3.get(key)); + } + for (String key:replaceMap4.keySet()) { + RResultStr = RResultStr.replace(key,replaceMap4.get(key)); + } result.add(LResultStr); result.add(RResultStr); return result;