weiwenhai 7 жил өмнө
parent
commit
1184ad9266

+ 26 - 27
cqb-paper/src/main/java/com/qmth/cqb/paper/service/export/ExportPaperAbstractService.java

@@ -326,8 +326,9 @@ public abstract class ExportPaperAbstractService {
                        if(rObj.getClass().equals(R.class)){
                            List<Object> rContent = ((R)rObj).getContent();
                            for(Object tObj:rContent){
-                               if (tObj instanceof JAXBElement)
-                                   tObj = ((JAXBElement<?>) tObj).getValue();
+                               if (tObj instanceof JAXBElement){
+                            	   tObj = ((JAXBElement<?>) tObj).getValue();
+                               }
                                if(tObj.getClass().equals(Text.class)){
                                    Text text = (Text)tObj;
                                    String str = text.getValue();
@@ -341,31 +342,29 @@ public abstract class ExportPaperAbstractService {
                                    text.setValue(str);
                                    //3
                                    Pattern pattern = Pattern.compile("##\\d{1,}##");
-                           		Matcher m = pattern.matcher(str);
-                               	while(m.find()){
-                               		int curNum = num + index;
-                                       String a = m.group();
-                                       str = str.replaceAll(a, "___"+(curNum)+"___");
-                                       text.setValue(str);
-                                       index++;
-                               	}
-                               	//4
-                                   /*if(str.startsWith("#") || str.equals("___")){
-                                       curMap.put(cur,str);
-                                       text.setValue("");
-                                   }*/
-                                   //5
-                                   if(str.matches("^\\d{1,}$")){
-                                       String preStr = curMap.get(cur - 1);
-                                       int curNum = num + index;
-                                       if(!StringUtils.isEmpty(preStr) && preStr.startsWith("#")){
-                                           text.setValue("___"+(curNum)+"___");
-                                       }else{
-                                       	text.setValue(curNum+"");
-                                       }
-                                       index++;
-                                   }
-                                   cur++;
+	                           		Matcher m = pattern.matcher(str);
+	                               	while(m.find()){
+	                               		int curNum = num + index;
+	                                       String a = m.group();
+	                                       str = str.replaceAll(a, "___"+(curNum)+"___");
+	                                       text.setValue(str);
+	                                       index++;
+	                               	}
+	                               	//4
+	                               /*if(str.startsWith("#") || str.equals("___")){
+	                                   curMap.put(cur,str);
+	                                   text.setValue("");
+	                               }*/
+	                               //5
+	                               if(str.matches("^\\d{1,}$")){
+	                                   String preStr = curMap.get(cur - 1);
+	                                   int curNum = num + index;
+	                                   if(!StringUtils.isEmpty(preStr) && preStr.startsWith("#")){
+	                                       text.setValue("___"+(curNum)+"___");
+	                                   }
+	                                   index++;
+	                               }
+	                               cur++;
                                }
                            }
                        }