|
|
@@ -9,6 +9,8 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -16,6 +18,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import com.goafanti.common.model.JtNews;
|
|
|
import com.goafanti.news.bo.InputJtNews;
|
|
|
+import com.goafanti.news.bo.OutJtNews;
|
|
|
import com.goafanti.news.service.EventPlanningService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -893,8 +896,46 @@ public class PublicController extends BaseController {
|
|
|
public Result getEventPlanningList(InputJtNews inputJtNews){
|
|
|
Result res = new Result();
|
|
|
inputJtNews.setReleaseStatus(1);
|
|
|
- res.setData(eventPlanningService.listnewsDetails(inputJtNews));
|
|
|
+ Pagination<OutJtNews> p= eventPlanningService.listnewsDetails(inputJtNews);
|
|
|
+ List<OutJtNews> list = (List<OutJtNews>) p.getList();
|
|
|
+ for (OutJtNews outJtNews : list) {
|
|
|
+ outJtNews.setContent(removeHtmlTag(outJtNews.getContent()));
|
|
|
+ }
|
|
|
+ res.setData(p);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除Html标签
|
|
|
+ */
|
|
|
+ public static String removeHtmlTag(String htmlStr) {
|
|
|
+ //定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script>
|
|
|
+ //String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>";
|
|
|
+ //定义style的正则表达式{或<style[^>]*?>[\\s\\S]*?<\\/style>
|
|
|
+// String regEx_style = "<[\\s]*?style[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?style[\\s]*?>";
|
|
|
+ //定义HTML标签的正则表达式
|
|
|
+ String regEx_html = "<[^>]+>";
|
|
|
+ //定义一些特殊字符的正则表达式 如:
|
|
|
+ String regEx_special = "\\&[a-zA-Z]{1,10};";
|
|
|
+
|
|
|
+// //1.过滤script标签
|
|
|
+// Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
|
|
|
+// Matcher m_script = p_script.matcher(htmlStr);
|
|
|
+// htmlStr = m_script.replaceAll("");
|
|
|
+// //2.过滤style标签
|
|
|
+// Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE);
|
|
|
+// Matcher m_style = p_style.matcher(htmlStr);
|
|
|
+// htmlStr = m_style.replaceAll("");
|
|
|
+ //3.过滤html标签
|
|
|
+ Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
|
|
|
+ Matcher m_html = p_html.matcher(htmlStr);
|
|
|
+ htmlStr = m_html.replaceAll("");
|
|
|
+ //4.过滤特殊标签
|
|
|
+ Pattern p_special = Pattern.compile(regEx_special, Pattern.CASE_INSENSITIVE);
|
|
|
+ Matcher m_special = p_special.matcher(htmlStr);
|
|
|
+ htmlStr = m_special.replaceAll("");
|
|
|
+
|
|
|
+ return htmlStr;
|
|
|
+ }
|
|
|
+
|
|
|
}
|