anderx лет назад: 3
Родитель
Сommit
fbebdd480c

+ 42 - 1
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -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 = "<[^>]+>";
+		//定义一些特殊字符的正则表达式 如:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+		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;
+	}
+
 }

+ 14 - 14
src/main/java/com/goafanti/common/utils/FileUtils.java

@@ -39,7 +39,7 @@ public class FileUtils {
 
 	/**
 	 * response 输出JSON
-	 * 
+	 *
 	 * @param hresponse
 	 * @param resultMap
 	 * @throws IOException
@@ -63,7 +63,7 @@ public class FileUtils {
 
 	/**
 	 * Excel报表导出
-	 * 
+	 *
 	 * @param response
 	 * @param fileName
 	 * @param workbook
@@ -97,7 +97,7 @@ public class FileUtils {
 
 	/**
 	 * 根据上传文件 拼接fileName
-	 * 
+	 *
 	 * @param mf
 	 * @param isPrivate
 	 * @param sign
@@ -109,7 +109,7 @@ public class FileUtils {
 		boolean uniq = false;
 		if (sign.indexOf("demand_picture") != -1|| sign.indexOf("achievement_picture") != -1 || sign.indexOf("user_picture")!=-1
 				|| sign.indexOf("jt_project_picture")!=-1 || sign.indexOf("jt_business_picture")!=-1 || sign.indexOf("honor_picture")!=-1
-				|| sign.indexOf("banners")!=-1|| sign.indexOf("head_portrait")!=-1 || sign.indexOf("video")!=-1 ) {
+				|| sign.indexOf("banners")!=-1|| sign.indexOf("head_portrait")!=-1 || sign.indexOf("video")!=-1 ||sign.indexOf("eventPlanning")!=-1 ) {
 			uniq = true;
 		}
 		String fileName = "";
@@ -124,7 +124,7 @@ public class FileUtils {
 		}
 		return fileName;
 	}
-	
+
 	public static String mosaicFileName( String fn, boolean isPrivate, String path, String uid) {
 		String fileName = "";
 		if (isPrivate) {
@@ -137,7 +137,7 @@ public class FileUtils {
 
 	/**
 	 * 获取下载文件名称
-	 * 
+	 *
 	 * @param path
 	 * @return
 	 */
@@ -159,7 +159,7 @@ public class FileUtils {
 
 	/**
 	 * 拼接文件路径
-	 * 
+	 *
 	 * @param root
 	 * @param params
 	 * @return
@@ -177,7 +177,7 @@ public class FileUtils {
 
 	/**
 	 * 拼接文件名字
-	 * 
+	 *
 	 * @param root
 	 * @param params
 	 * @return
@@ -196,7 +196,7 @@ public class FileUtils {
 	}
 
 	/**
-	 * 
+	 *
 	 * @param response
 	 * @param fileName
 	 * @param realFilePath
@@ -256,7 +256,7 @@ public class FileUtils {
         }
         return workbook;
         }
-	
+
 	public static Sheet pushReadFile(MultipartFile file) {
 		 //获得Workbook工作薄对象
 	       Workbook workbook = getWorkBook(file);
@@ -270,7 +270,7 @@ public class FileUtils {
 	       }
 	       return sheet;
 	}
-	
+
 	public static  int rowDispose(Sheet sheet, int firstRowNum) {
 		int lastRowNum=sheet.getLastRowNum();
 		//处理空白行
@@ -299,13 +299,13 @@ public class FileUtils {
    				    sheet.shiftRows(i+1, sheet.getLastRowNum(),-1);
    			}
    		}
-   		
+
    		if (lastRowNum<2) {
    			throw new BusinessException(new Error("未找到正确的参数。"));
 			}
 		return sheet.getLastRowNum();
 	}
-	
+
 	public static  int rowDisposeNotBlank(Sheet sheet, int firstRowNum) {
 		int lastRowNum=sheet.getLastRowNum();
 		//行数从0开始 默认使用2行做头部,则设置1
@@ -326,7 +326,7 @@ public class FileUtils {
 			}
 		return i;
 	}
-	
+
 	public static String getCellValue(Cell cell){
      	String cellValue = "";
      	if(cell == null){

+ 1 - 1
src/main/webapp/WEB-INF/views/common.html

@@ -51,7 +51,7 @@
 					</li>
 				</ul>
 			</div>
-			<div class="technology"><a class="technology_login" th:href="@{/portal/evaluation/evaluate}">技术创业</a><a class="technology_estimate" href="javascript:;">技术评估</a></div>
+			<div class="technology"><a class="technology_login" href="javascript:;" >技术创业</a><a class="technology_estimate" th:href="@{/portal/evaluation/evaluate}">技术评估</a></div>
 			<div class="APP">
 				<img th:src="${portalHost+'/img/indedImg/inded30.png'}" alt="" />
 				<a>APP下载<span class="webkitDown"></span>