提交 f0c0cec1 authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 f3786698
......@@ -3,6 +3,7 @@ package com.zrqx.resource.fg.service;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -47,6 +48,9 @@ public class FgResourceRelationServiceImpl extends BaseServiceImpl<ResourceRelat
startPage(pageParam);
list = mapper.queryArticleByResourceType(entity);
}
list.forEach(f -> {
f.setSynopsis(removeLabel(f.getSynopsis()));
});
return list;
}
......@@ -64,4 +68,32 @@ public class FgResourceRelationServiceImpl extends BaseServiceImpl<ResourceRelat
});
return list;
}
/**
* 去标签
* @param list
* @author ycw
* @date: 2019年4月18日 上午11:57:55
*/
private String removeLabel(String text){
if(StringUtils.isNotBlank(text)){
//vo.setSummary(vo.getSummary().replaceAll("\\<.*?>", ""));
//定义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 = "<[^>]+>";
// 定义一些特殊字符的正则表达式 如:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String regEx_special = "\\&[a-zA-Z]{1,10};";
text = text.replaceAll(regEx_script, "")
.replaceAll(regEx_style, "")
.replaceAll(regEx_html, "")
.replaceAll(regEx_special, "");
return text;
}
return null;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论