Browse Source

模板映射修改

rengb 4 years ago
parent
commit
f326a13c86

+ 24 - 0
trans/src/main/java/com/lantone/qc/trans/beilun/util/BeiLunHtmlAnalysisUtil.java

@@ -28,6 +28,9 @@ public class BeiLunHtmlAnalysisUtil {
      * @param map
      */
     public static void tableStyle1InsertMap(Element tableElement, Map<String, String> map) {
+        if (tableElement == null || map == null) {
+            return;
+        }
         List<Element> tdElements = Lists.newArrayList();
         tableElement.selectFirst("tbody").children().forEach(trElement -> {
             trElement.children().forEach(tdElement -> {
@@ -68,6 +71,9 @@ public class BeiLunHtmlAnalysisUtil {
      * @param map
      */
     public static void tableStyle2InsertMap(Element tableElement, Map<String, String> map) {
+        if (tableElement == null || map == null) {
+            return;
+        }
         List<Element> tdElements = Lists.newArrayList();
         tableElement.selectFirst("tbody").children().forEach(trElement -> {
             trElement.children().forEach(tdElement -> {
@@ -103,6 +109,9 @@ public class BeiLunHtmlAnalysisUtil {
      * @return
      */
     public static String blockDivToStr(Element divElement, boolean isLineBreak) {
+        if (divElement == null) {
+            return "";
+        }
         StringBuffer sbf = new StringBuffer();
         for (Element childElement : divElement.children()) {
             if (isLineBreak) {
@@ -122,6 +131,9 @@ public class BeiLunHtmlAnalysisUtil {
      * @return
      */
     public static String elementLayer1ToStr(Element element, boolean isLineBreak) {
+        if (element == null) {
+            return "";
+        }
         StringBuffer sbf = new StringBuffer();
         List<Element> elements = Lists.newArrayList();
         Elements childElements = element.children();
@@ -144,10 +156,22 @@ public class BeiLunHtmlAnalysisUtil {
         return sbf.toString().replaceAll(" ", " ");
     }
 
+    /**
+     * 查询并插入页面模板id
+     *
+     * @param recTitle
+     * @param map
+     */
     public static void insertModuleId(String recTitle, Map<String, String> map) {
+        if (StringUtil.isBlank(recTitle) || map == null) {
+            return;
+        }
         SpecialStorageUtil specialStorageUtil = SpringContextUtil.getBean("specialStorageUtil");
         BehospitalInfoVO behospitalInfo = specialStorageUtil.getBehospitalInfoThreadLocal().get();
         String deptName = behospitalInfo.getBehDeptName();
+        if (StringUtil.isBlank(deptName)) {
+            return;
+        }
         if (!excludeDepts.contains(deptName)) {
             deptName = "";
         }