Browse Source

信息中心-敏感词提示

Aslee 2 years ago
parent
commit
a2bcd9eec2

+ 10 - 0
src/main/java/com/caimei/modules/baike/web/CmBaikeProductController.java

@@ -9,6 +9,7 @@ import com.caimei.modules.baike.entity.CmBaikeProductParam;
 import com.caimei.modules.baike.entity.CmBaikeProductQuestion;
 import com.caimei.modules.baike.entity.CmBaikeType;
 import com.caimei.modules.baike.service.CmBaikeTypeService;
+import com.caimei.modules.info.dao.InfoDao;
 import com.caimei.modules.opensearch.GenerateUtils;
 import com.caimei.modules.user.entity.NewCmShop;
 import com.google.common.collect.Maps;
@@ -51,6 +52,9 @@ public class CmBaikeProductController extends BaseController {
 	@Resource
     private CmBaikeProductDao cmBaikeProductDao;
 
+	@Resource
+	private InfoDao infoDao;
+
 	@Resource
 	private GenerateUtils generateUtils;
 	
@@ -109,9 +113,12 @@ public class CmBaikeProductController extends BaseController {
 		// 供应商列表
 		List<NewCmShop> shopList = cmBaikeProductDao.findShopList();
 		cmBaikeProduct.setShopList(shopList);
+		// 敏感词
+		String sensitiveWords = infoDao.getSensitiveWords();
 		model.addAttribute("cmBaikeProduct", cmBaikeProduct);
 		model.addAttribute("typeList", typeList);
 		model.addAttribute("commodityType", commodityType);
+		model.addAttribute("sensitiveWords", sensitiveWords);
 		return "modules/baikePage/cmBaikeProductForm";
 	}
 
@@ -267,6 +274,9 @@ public class CmBaikeProductController extends BaseController {
 		// 分类列表
 		List<CmBaikeType> typeList = cmBaikeTypeService.findList(cmBaikeType);
 		model.addAttribute("typeList", typeList);
+		// 敏感词
+		String sensitiveWords = infoDao.getSensitiveWords();
+		model.addAttribute("sensitiveWords", sensitiveWords);
         return "modules/baikePage/auditBaikeProductPage";
 	}
 

+ 15 - 0
src/main/java/com/caimei/modules/info/dao/CmSensitiveWordsDao.java

@@ -0,0 +1,15 @@
+package com.caimei.modules.info.dao;
+
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.caimei.modules.info.entity.CmSensitiveWords;
+
+/**
+ * 敏感词库DAO接口
+ * @author Aslee
+ * @version 2022-06-01
+ */
+@MyBatisDao
+public interface CmSensitiveWordsDao extends CrudDao<CmSensitiveWords> {
+	
+}

+ 2 - 0
src/main/java/com/caimei/modules/info/dao/InfoDao.java

@@ -35,4 +35,6 @@ public interface InfoDao extends CrudDao<Info> {
 	void auditInfo(@Param("id") String id, @Param("auditStatus") Integer auditStatus, @Param("failReason") String failReason, @Param("pubdate") Date pubdate);
 
     void offlineInfo(Integer id);
+
+    String getSensitiveWords();
 }

+ 52 - 0
src/main/java/com/caimei/modules/info/entity/CmSensitiveWords.java

@@ -0,0 +1,52 @@
+package com.caimei.modules.info.entity;
+
+import org.hibernate.validator.constraints.Length;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+/**
+ * 敏感词库Entity
+ * @author Aslee
+ * @version 2022-06-01
+ */
+public class CmSensitiveWords extends DataEntity<CmSensitiveWords> {
+	
+	private static final long serialVersionUID = 1L;
+	private String words;		// 敏感词
+	private String checkPoints;		// 检查位置:1供应商端文章,2供应商端百科,3管理员端文章,4管理员端百科
+	private String status;		// 状态:1启用,0停用
+	
+	public CmSensitiveWords() {
+		super();
+	}
+
+	public CmSensitiveWords(String id){
+		super(id);
+	}
+
+	public String getWords() {
+		return words;
+	}
+
+	public void setWords(String words) {
+		this.words = words;
+	}
+	
+	@Length(min=0, max=45, message="检查位置:1供应商端文章,2供应商端百科,3管理员端文章,4管理员端百科长度必须介于 0 和 45 之间")
+	public String getCheckPoints() {
+		return checkPoints;
+	}
+
+	public void setCheckPoints(String checkPoints) {
+		this.checkPoints = checkPoints;
+	}
+	
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	
+}

+ 44 - 0
src/main/java/com/caimei/modules/info/service/CmSensitiveWordsService.java

@@ -0,0 +1,44 @@
+package com.caimei.modules.info.service;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import com.caimei.modules.info.entity.CmSensitiveWords;
+import com.caimei.modules.info.dao.CmSensitiveWordsDao;
+
+/**
+ * 敏感词库Service
+ * @author Aslee
+ * @version 2022-06-01
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmSensitiveWordsService extends CrudService<CmSensitiveWordsDao, CmSensitiveWords> {
+
+	public CmSensitiveWords get(String id) {
+		return super.get(id);
+	}
+	
+	public List<CmSensitiveWords> findList(CmSensitiveWords cmSensitiveWords) {
+		return super.findList(cmSensitiveWords);
+	}
+	
+	public Page<CmSensitiveWords> findPage(Page<CmSensitiveWords> page, CmSensitiveWords cmSensitiveWords) {
+		return super.findPage(page, cmSensitiveWords);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(CmSensitiveWords cmSensitiveWords) {
+		super.save(cmSensitiveWords);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(CmSensitiveWords cmSensitiveWords) {
+		super.delete(cmSensitiveWords);
+	}
+	
+}

+ 79 - 0
src/main/java/com/caimei/modules/info/web/CmSensitiveWordsController.java

@@ -0,0 +1,79 @@
+package com.caimei.modules.info.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.web.BaseController;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.caimei.modules.info.entity.CmSensitiveWords;
+import com.caimei.modules.info.service.CmSensitiveWordsService;
+
+/**
+ * 敏感词库Controller
+ * @author Aslee
+ * @version 2022-06-01
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/info/cmSensitiveWords")
+public class CmSensitiveWordsController extends BaseController {
+
+	@Autowired
+	private CmSensitiveWordsService cmSensitiveWordsService;
+	
+	@ModelAttribute
+	public CmSensitiveWords get(@RequestParam(required=false) String id) {
+		CmSensitiveWords entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = cmSensitiveWordsService.get(id);
+		}
+		if (entity == null){
+			entity = new CmSensitiveWords();
+		}
+		return entity;
+	}
+	
+	@RequestMapping(value = {"list", ""})
+	public String list(CmSensitiveWords cmSensitiveWords, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<CmSensitiveWords> page = cmSensitiveWordsService.findPage(new Page<CmSensitiveWords>(request, response), cmSensitiveWords); 
+		model.addAttribute("page", page);
+		return "modules/info/cmSensitiveWordsList";
+	}
+
+	@RequestMapping(value = "form")
+	public String form(CmSensitiveWords cmSensitiveWords, Model model) {
+		model.addAttribute("cmSensitiveWords", cmSensitiveWords);
+		return "modules/info/cmSensitiveWordsForm";
+	}
+
+	@RequestMapping(value = "save")
+	public String save(CmSensitiveWords cmSensitiveWords, Model model, RedirectAttributes redirectAttributes) {
+		if (!beanValidator(model, cmSensitiveWords)){
+			return form(cmSensitiveWords, model);
+		}
+		cmSensitiveWordsService.save(cmSensitiveWords);
+		addMessage(redirectAttributes, "保存敏感词库成功");
+		if ("1".equals(cmSensitiveWords.getId())) {
+			return "redirect:"+Global.getAdminPath()+"/info/cmSensitiveWords/form?id=1";
+		}
+		return "redirect:"+Global.getAdminPath()+"/info/cmSensitiveWords/?repage";
+	}
+	
+	@RequestMapping(value = "delete")
+	public String delete(CmSensitiveWords cmSensitiveWords, RedirectAttributes redirectAttributes) {
+		cmSensitiveWordsService.delete(cmSensitiveWords);
+		addMessage(redirectAttributes, "删除敏感词库成功");
+		return "redirect:"+Global.getAdminPath()+"/info/cmSensitiveWords/?repage";
+	}
+
+}

+ 9 - 0
src/main/java/com/caimei/modules/info/web/InfoController.java

@@ -6,6 +6,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.caimei.modules.info.dao.InfoDao;
 import com.caimei.modules.info.entity.CmInfoDocSyn;
 import com.caimei.modules.info.service.CmInfoDocSynService;
 import com.caimei.modules.opensearch.GenerateUtils;
@@ -55,6 +56,8 @@ public class InfoController extends BaseController {
 	private RedisService redisService;
     @Resource
     private GenerateUtils generateUtils;
+	@Autowired
+	private InfoDao infoDao;
 	@ModelAttribute
 	public Info get(@RequestParam(required=false) String id) {
 		Info entity = null;
@@ -134,9 +137,12 @@ public class InfoController extends BaseController {
 		}
 		InfoType infoType = new InfoType();
 		List<InfoType> typeList = infoTypeService.findList(infoType);
+		// 敏感词
+		String sensitiveWords = infoDao.getSensitiveWords();
 		model.addAttribute("typeList", typeList);
 		model.addAttribute("info", info);
 		model.addAttribute("ltype", ltype);
+		model.addAttribute("sensitiveWords", sensitiveWords);
 		return "modules/info/infoForm";
 	}
 
@@ -308,6 +314,9 @@ public class InfoController extends BaseController {
 		List<InfoType> typeList = infoTypeService.findList(infoType);
 		model.addAttribute("typeList", typeList);
 		model.addAttribute("info", info);
+		// 敏感词
+		String sensitiveWords = infoDao.getSensitiveWords();
+		model.addAttribute("sensitiveWords", sensitiveWords);
 		return "modules/info/auditInfoPage";
     }
 

+ 84 - 0
src/main/resources/mappings/modules/info/CmSensitiveWordsMapper.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.info.dao.CmSensitiveWordsDao">
+    
+	<sql id="cmSensitiveWordsColumns">
+		a.id AS "id",
+		a.words AS "words",
+		a.checkPoints AS "checkPoints",
+		a.status AS "status"
+	</sql>
+	
+	<sql id="cmSensitiveWordsJoins">
+	</sql>
+    
+	<select id="get" resultType="CmSensitiveWords">
+		SELECT 
+			<include refid="cmSensitiveWordsColumns"/>
+		FROM cm_sensitive_words a
+		<include refid="cmSensitiveWordsJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="CmSensitiveWords">
+		SELECT 
+			<include refid="cmSensitiveWordsColumns"/>
+		FROM cm_sensitive_words a
+		<include refid="cmSensitiveWordsJoins"/>
+		<where>
+			
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="CmSensitiveWords">
+		SELECT 
+			<include refid="cmSensitiveWordsColumns"/>
+		FROM cm_sensitive_words a
+		<include refid="cmSensitiveWordsJoins"/>
+		<where>
+			
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert" parameterType="CmSensitiveWords"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_sensitive_words(
+			id,
+			words,
+			checkPoints,
+			status
+		) VALUES (
+			#{id},
+			#{words},
+			#{checkPoints},
+			#{status}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_sensitive_words SET 	
+			words = #{words},
+			checkPoints = #{checkPoints},
+			status = #{status}
+		WHERE id = #{id}
+	</update>
+	
+	<delete id="delete">
+		DELETE FROM cm_sensitive_words
+		WHERE id = #{id}
+	</delete>
+	
+</mapper>

+ 6 - 1
src/main/resources/mappings/modules/info/InfoMapper.xml

@@ -152,8 +152,13 @@
 			</otherwise>
 		</choose>
 	</select>
+    <select id="getSensitiveWords" resultType="java.lang.String">
+		select words
+		from cm_sensitive_words
+		where id = 1
+	</select>
 
-	<insert id="insert" parameterType="Info"  keyProperty="id" useGeneratedKeys="true">
+    <insert id="insert" parameterType="Info"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO info(
 			typeId,
 			title,

+ 115 - 0
src/main/webapp/WEB-INF/views/modules/baikePage/auditBaikeProductPage.jsp

@@ -16,6 +16,10 @@
 		.paramRow {
 			margin-top: 10px;
 		}
+
+		.red {
+			color: red;
+		}
 	</style>
 	<style>
 		.clearfix::after{
@@ -190,24 +194,28 @@
 			<label class="control-label">${commodityType}名称:</label>
 			<div class="controls">
 				<form:input path="name" htmlEscape="false" class="input-xlarge "/>
+				<label id="nameSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">${commodityType}别名:</label>
 			<div class="controls">
 				<form:input path="alias" htmlEscape="false" class="input-xlarge " placeholder="输入英文名或者其他名称"/>
+				<label id="aliasSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">${commodityType}概述:</label>
 			<div class="controls" style="width:812px">
                 <textarea type="text" id="discription" name="discription" style="position: relative;height: 100px; width: 450px;"  >${cmBaikeProduct.discription}</textarea>
+				<label id="discriptionSensitiveWords" class="red"></label>
             </div>
 		</div>
 		<div class="control-group" style="position: relative">
 			<label class="control-label">${commodityType}链接:</label>
 			<div class="controls">
 				<form:input path="productLink" htmlEscape="false" class="input-xxlarge " placeholder="输入采美商城的相关商品详情链接,便于用户精准找到"/>
+				<label id="productLinkSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -232,6 +240,7 @@
                 <label class="control-label">认证链接:</label>
                 <div class="controls">
                     <form:input path="authLink" htmlEscape="false" class="input-xxlarge " cssStyle="position: relative"/>
+					<label id="authLinkSensitiveWords" class="red"></label>
                 </div>
             </div>
 			<div class="control-group">
@@ -255,42 +264,54 @@
 			<div class="controls paramRow" id="paramRow0">
 				<input name="paramList[0].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:型号">
+				<label id="param0SensitiveWords" class="red"></label>
 				<input name="paramList[0].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+				<label id="content0SensitiveWords" class="red"></label>
 			</div>
 			<div class="controls paramRow" id="paramRow1">
 				<input name="paramList[1].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:性质类型">
+				<label id="param1SensitiveWords" class="red"></label>
 				<input name="paramList[1].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+				<label id="content1SensitiveWords" class="red"></label>
 				<a onclick="deleteParam(1)" style="cursor: pointer">删除</a>
 			</div>
 			<div class="controls paramRow" id="paramRow2">
 				<input name="paramList[2].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:成分">
+				<label id="param2SensitiveWords" class="red"></label>
 				<input name="paramList[2].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+				<label id="content2SensitiveWords" class="red"></label>
 				<a onclick="deleteParam(2)" style="cursor: pointer">删除</a>
 			</div>
 			<div class="controls paramRow" id="paramRow3">
 				<input name="paramList[3].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:规格">
+				<label id="param3SensitiveWords" class="red"></label>
 				<input name="paramList[3].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+				<label id="content3SensitiveWords" class="red"></label>
 				<a onclick="deleteParam(3)" style="cursor: pointer">删除</a>
 			</div>
 			<div class="controls paramRow" id="paramRow4">
 				<input name="paramList[4].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:性质类型">
+				<label id="param4SensitiveWords" class="red"></label>
 				<input name="paramList[4].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+				<label id="content4SensitiveWords" class="red"></label>
 				<a onclick="deleteParam(4)" style="cursor: pointer">删除</a>
 			</div>
 			<div class="controls paramRow" id="paramRow5">
 				<input name="paramList[5].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:性质类型">
+				<label id="param5SensitiveWords" class="red"></label>
 				<input name="paramList[5].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+				<label id="content5SensitiveWords" class="red"></label>
 				<a onclick="deleteParam(5)" style="cursor: pointer">删除</a>
 			</div>
 		</div>
@@ -299,6 +320,7 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="advantage" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="advantageEditor" class="contentEditor">${cmBaikeProduct.advantage}</div>
+				<label id="advantageSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -306,6 +328,7 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="disadvantage" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="disadvantageEditor" class="contentEditor">${cmBaikeProduct.disadvantage}</div>
+				<label id="disadvantageSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -313,12 +336,14 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="principle" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="principleEditor" class="contentEditor">${cmBaikeProduct.principle}</div>
+				<label id="principleSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">SEO关键词:</label>
 			<div class="controls">
 				<form:input path="seoKeyword" htmlEscape="false" style="position: relative" class="input-xlarge"/>
+				<label id="seoKeywordSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -328,12 +353,14 @@
 			<label class="control-label">品牌:</label>
 			<div class="controls">
 				<form:input path="brand" htmlEscape="false" class="input-xlarge "/>
+				<label id="brandSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">产地:</label>
 			<div class="controls">
 				<form:input path="producePlace" htmlEscape="false" class="input-xlarge "/>
+				<label id="producePlaceSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -348,6 +375,7 @@
 			<label class="control-label">供应商:</label>
 			<div class="controls">
 				<form:input path="company" htmlEscape="false" class="input-xlarge "/>
+				<label id="companySensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group" style="position: relative">
@@ -393,6 +421,7 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="adaptiveMan" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="adaptiveManEditor" class="contentEditor">${cmBaikeProduct.adaptiveMan}</div>
+				<label id="adaptiveManSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -400,6 +429,7 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="unAdaptiveMan" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="unAdaptiveManEditor" class="contentEditor">${cmBaikeProduct.unAdaptiveMan}</div>
+				<label id="unAdaptiveManSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -407,6 +437,7 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="aroundOperation" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="aroundOperationEditor" class="contentEditor">${cmBaikeProduct.aroundOperation}</div>
+				<label id="aroundOperationSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group" style="width: 1000px">
@@ -448,18 +479,21 @@
                 <label class="control-label">问题1:</label>
                 <div class="controls">
                     <input name="questionList[0].question" style="width: 550px" htmlEscape="false" class="input-xlarge ">
+					<label id="question0SensitiveWords" class="red"></label>
                 </div>
             </div>
             <div class="control-group" id="answerRow0">
                 <label class="control-label">答:</label>
                 <div class="controls">
                     <input name="questionList[0].answer" style="width: 550px" htmlEscape="false" class="input-xlarge ">
+					<label id="answer0SensitiveWords" class="red"></label>
                 </div>
             </div>
             <div class="control-group" id="questionRow1">
                 <label class="control-label">问题2:</label>
                 <div class="controls">
                     <input name="questionList[1].question" style="width: 550px" htmlEscape="false" class="input-xlarge  questionInput">
+					<label id="question1SensitiveWords" class="red"></label>
                     <a id="questionDelBtn1" onclick="deleteQuestion(1)" style="cursor: pointer">删除</a>
                 </div>
             </div>
@@ -467,6 +501,7 @@
                 <label class="control-label">答:</label>
                 <div class="controls">
                     <input name="questionList[1].answer" style="width: 550px" htmlEscape="false" class="input-xlarge  questionInput">
+					<label id="answer1SensitiveWords" class="red"></label>
                 </div>
             </div>
         </div>
@@ -528,6 +563,7 @@
 
 <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
 <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
+<script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
 <script>
 	var paramIndex = 6;
 	var questionIndex = 2;
@@ -713,6 +749,85 @@
 			$('input[name="' + questionInput + '"]').val(questionArray[i]);
 			$('input[name="' + answerInput + '"]').val(answerArray[i]);
 		}
+
+		debugger
+		var commodityType = $("#commodityType").val();
+		var name = $("#name").val();
+		var alias = $("#alias").val();
+		var discription = $("#discription").val();
+		var productLink = $("#productLink").val();
+		var authLink = $("#authLink").val();
+		var advantage = $("#advantage").val();
+		var disadvantage = $("#disadvantage").val();
+		var principle = $("#principle").val();
+		var seoKeyword = $("#seoKeyword").val();
+		var brand = $("#brand").val();
+		var producePlace = $("#producePlace").val();
+		var company = $("#company").val();
+		var adaptiveMan = $("#adaptiveMan").val();
+		var unAdaptiveMan = $("#unAdaptiveMan").val();
+		var aroundOperation = $("#aroundOperation").val();
+		// 检测敏感词
+		var propertyMap = new Map();
+		propertyMap.set("name", name);
+		propertyMap.set("alias", alias);
+		propertyMap.set("discription", discription);
+		propertyMap.set("productLink", productLink);
+		for (var i = 0; i <= 20; i++) {
+			var paramName = "\"paramList[" + i + "].name\"";
+			var contentName = "\"paramList[" + i + "].content\"";
+			var param = $('input[name=' + paramName + ']').val();
+			var content = $('input[name=' + contentName + ']').val();
+			if ( param === undefined || param === '') {
+				break;
+			} else {
+				propertyMap.set("param" + i, param);
+				propertyMap.set("content" + i, content);
+			}
+		}
+		propertyMap.set("advantage", advantage);
+		propertyMap.set("disadvantage", disadvantage);
+		propertyMap.set("principle", principle);
+		propertyMap.set("seoKeyword", seoKeyword);
+		propertyMap.set("brand", brand);
+		propertyMap.set("producePlace", producePlace);
+		propertyMap.set("company", company);
+		propertyMap.set("adaptiveMan", adaptiveMan);
+		propertyMap.set("unAdaptiveMan", unAdaptiveMan);
+		propertyMap.set("aroundOperation", aroundOperation);
+		if (2 == commodityType) {
+			propertyMap.set("authLink", authLink);
+		}
+		for (var i = 0; i <= 20; i++) {
+			var questionName = "\"questionList[" + i + "].question\"";
+			var answerName = "\"questionList[" + i + "].answer\"";
+			var question = $('input[name=' + questionName + ']').val();
+			var answer = $('input[name=' + answerName + ']').val();
+			if (question === undefined || question === '') {
+				break;
+			} else {
+				propertyMap.set("question" + i, question);
+				propertyMap.set("answer" + i, answer);
+			}
+		}
+		var sensitiveWords = '${sensitiveWords}';
+		const mint = new MintFilter(sensitiveWords.split('|'));
+		var filterSync = '';
+		var touchWords = '';
+		var touchNum = 0;
+		propertyMap.forEach(function (value,key,map) {
+			filterSync = mint.filterSync(value);
+			filterSync.words.forEach(word=>{
+				touchWords += touchWords === '' ? word : "," + word;
+			})
+			if (touchWords !== '') {
+				// 增加敏感词触发数量
+				touchNum++;
+				// 设置敏感词提示
+				$("#" + key + "SensitiveWords").text("敏感词:" + touchWords);
+				touchWords = '';
+			}
+		});
 	})
 
 	//删除参数

+ 122 - 4
src/main/webapp/WEB-INF/views/modules/baikePage/cmBaikeProductForm.jsp

@@ -151,16 +151,19 @@
 		.select2-choice{
 			width: 200px
 		}
+
+		.red {
+			color: red;
+		}
 	</style>
 	<script type="text/javascript">
 		$(document).ready(function() {
 			//$("#name").focus();
 			$("#inputForm").validate({
 				submitHandler: function(form){
-					var status = $("#status").val();
+					var status = $("input[name='status']:checked").val();
 					var commodityType = $("#commodityType").val();
 					// 计算空数据条数
-
 					var propertyArr = [];
 					var name = $("#name").val();
 					var alias = $("#alias").val();
@@ -226,12 +229,87 @@
 						}
 					}
 					$("#emptyNum").val(emptyNum);
+
+					// 检测敏感词
+					var propertyMap = new Map();
+					propertyMap.set("name", name);
+					propertyMap.set("alias", alias);
+					propertyMap.set("discription", discription);
+					propertyMap.set("productLink", productLink);
+					for (var i = 0; i <= 20; i++) {
+						var paramName = "\"paramList[" + i + "].name\"";
+						var contentName = "\"paramList[" + i + "].content\"";
+						var param = $('input[name=' + paramName + ']').val();
+						var content = $('input[name=' + contentName + ']').val();
+						if ( param === undefined || param === '') {
+							break;
+						} else {
+							propertyMap.set("param" + i, param);
+							propertyMap.set("content" + i, content);
+						}
+					}
+					propertyMap.set("advantage", advantage);
+					propertyMap.set("disadvantage", disadvantage);
+					propertyMap.set("principle", principle);
+					propertyMap.set("seoKeyword", seoKeyword);
+					propertyMap.set("brand", brand);
+					propertyMap.set("producePlace", producePlace);
+					propertyMap.set("company", company);
+					propertyMap.set("adaptiveMan", adaptiveMan);
+					propertyMap.set("unAdaptiveMan", unAdaptiveMan);
+					propertyMap.set("aroundOperation", aroundOperation);
+                    if (2 == commodityType) {
+                        propertyMap.set("authLink", authLink);
+                    }
+					for (var i = 0; i <= 20; i++) {
+						var questionName = "\"questionList[" + i + "].question\"";
+						var answerName = "\"questionList[" + i + "].answer\"";
+						var question = $('input[name=' + questionName + ']').val();
+						var answer = $('input[name=' + answerName + ']').val();
+						if (question === undefined || question === '') {
+							break;
+						} else {
+							propertyMap.set("question" + i, question);
+							propertyMap.set("answer" + i, answer);
+						}
+					}
+					var sensitiveWords = '${sensitiveWords}';
+					const mint = new MintFilter(sensitiveWords.split('|'));
+					var filterSync = '';
+					var touchWords = '';
+					var touchNum = 0;
+					propertyMap.forEach(function (value,key,map) {
+						filterSync = mint.filterSync(value);
+						filterSync.words.forEach(word=>{
+							touchWords += touchWords === '' ? word : "," + word;
+						})
+						if (touchWords !== '') {
+							// 增加敏感词触发数量
+							touchNum++;
+							// 设置敏感词提示
+							$("#" + key + "SensitiveWords").text("敏感词:" + touchWords);
+							touchWords = '';
+						}
+					});
 					if (1 == status && emptyNum > 0) {
 						var msg = "您还剩余" + emptyNum + "项未完善,将会导致用户对您产品/仪器的认识度不够,确认是否提交?";
 						top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
 							if (v == 'ok') {
-								loading('正在提交,请稍等...');
-								form.submit();
+								if (touchNum > 0) {
+									var msg = 1 == status?"当前发布内容存在敏感词,已为您标记在输入框下方," +
+											"请修改后,再进行保存发布,强行保存发布将会导致审核不通过!":
+											"当前内容存在敏感词,已为您标记在输入框下方,建议修改后再进行保存!否则," +
+											"将会影响发布时审核不通过!";
+									top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+										if (v == 'ok') {
+                                            loading('正在提交,请稍等...');
+                                            form.submit();
+										}
+									}, {buttonsFocus: 1, persistent: true});
+								} else{
+                                    loading('正在提交,请稍等...');
+                                    form.submit();
+                                }
 							}
 						}, {buttonsFocus: 1, persistent: true});
 					} else {
@@ -269,18 +347,21 @@
 			<label class="control-label">${commodityType}名称:</label>
 			<div class="controls">
 				<form:input path="name" htmlEscape="false" class="input-xlarge "/>
+				<label id="nameSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">${commodityType}别名:</label>
 			<div class="controls">
 				<form:input path="alias" htmlEscape="false" class="input-xlarge " placeholder="输入英文名或者其他名称"/>
+				<label id="aliasSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">${commodityType}概述:</label>
 			<div class="controls" style="width:812px">
                 <textarea type="text" id="discription" name="discription" style="position: relative;height: 100px; width: 450px;"  >${cmBaikeProduct.discription}</textarea>
+                <label id="discriptionSensitiveWords" class="red"></label>
             </div>
 		</div>
 		<div class="control-group">
@@ -296,6 +377,7 @@
 			<label class="control-label">${commodityType}链接:</label>
 			<div class="controls">
 				<form:input path="productLink" htmlEscape="false" class="input-xxlarge " placeholder="输入采美商城的相关商品详情链接,便于用户精准找到"/>
+                <label id="productLinkSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -320,6 +402,7 @@
                 <label class="control-label">认证链接:</label>
                 <div class="controls">
                     <form:input path="authLink" htmlEscape="false" class="input-xxlarge " cssStyle="position: relative"/>
+                    <label id="authLinkSensitiveWords" class="red"></label>
                 </div>
             </div>
 			<div class="control-group">
@@ -343,42 +426,54 @@
 			<div class="controls paramRow" id="paramRow0">
 				<input name="paramList[0].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:型号">
+                <label id="param0SensitiveWords" class="red"></label>
 				<input name="paramList[0].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+                <label id="content0SensitiveWords" class="red"></label>
 			</div>
 			<div class="controls paramRow" id="paramRow1">
 				<input name="paramList[1].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:性质类型">
+                <label id="param1SensitiveWords" class="red"></label>
 				<input name="paramList[1].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+                <label id="content1SensitiveWords" class="red"></label>
 				<a onclick="deleteParam(1)" style="cursor: pointer">删除</a>
 			</div>
 			<div class="controls paramRow" id="paramRow2">
 				<input name="paramList[2].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:成分">
+                <label id="param2SensitiveWords" class="red"></label>
 				<input name="paramList[2].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+                <label id="content2SensitiveWords" class="red"></label>
 				<a onclick="deleteParam(2)" style="cursor: pointer">删除</a>
 			</div>
 			<div class="controls paramRow" id="paramRow3">
 				<input name="paramList[3].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:规格">
+                <label id="param3SensitiveWords" class="red"></label>
 				<input name="paramList[3].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+                <label id="content3SensitiveWords" class="red"></label>
 				<a onclick="deleteParam(3)" style="cursor: pointer">删除</a>
 			</div>
 			<div class="controls paramRow" id="paramRow4">
 				<input name="paramList[4].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:性质类型">
+                <label id="param4SensitiveWords" class="red"></label>
 				<input name="paramList[4].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+                <label id="content4SensitiveWords" class="red"></label>
 				<a onclick="deleteParam(4)" style="cursor: pointer">删除</a>
 			</div>
 			<div class="controls paramRow" id="paramRow5">
 				<input name="paramList[5].name" htmlEscape="false" class="input-small "
 					   placeholder="例如:性质类型">
+                <label id="param5SensitiveWords" class="red"></label>
 				<input name="paramList[5].content" htmlEscape="false" class="input-xlarge "
 					   placeholder="输入参数信息">
+                <label id="content5SensitiveWords" class="red"></label>
 				<a onclick="deleteParam(5)" style="cursor: pointer">删除</a>
 			</div>
 		</div>
@@ -387,6 +482,7 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="advantage" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="advantageEditor" class="contentEditor">${cmBaikeProduct.advantage}</div>
+                <label id="advantageSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -394,6 +490,7 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="disadvantage" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="disadvantageEditor" class="contentEditor">${cmBaikeProduct.disadvantage}</div>
+                <label id="disadvantageSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -401,12 +498,14 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="principle" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="principleEditor" class="contentEditor">${cmBaikeProduct.principle}</div>
+                <label id="principleSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">SEO关键词:</label>
 			<div class="controls">
 				<form:input path="seoKeyword" htmlEscape="false" style="position: relative" class="input-xlarge"/>
+                <label id="seoKeywordSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -416,12 +515,14 @@
 			<label class="control-label">品牌:</label>
 			<div class="controls">
 				<form:input path="brand" htmlEscape="false" class="input-xlarge "/>
+                <label id="brandSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">产地:</label>
 			<div class="controls">
 				<form:input path="producePlace" htmlEscape="false" class="input-xlarge "/>
+                <label id="producePlaceSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -436,6 +537,7 @@
 			<label class="control-label">供应商:</label>
 			<div class="controls">
 				<form:input path="company" htmlEscape="false" class="input-xlarge "/>
+                <label id="companySensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group" style="position: relative">
@@ -481,6 +583,7 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="adaptiveMan" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="adaptiveManEditor" class="contentEditor">${cmBaikeProduct.adaptiveMan}</div>
+                <label id="adaptiveManSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -488,6 +591,7 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="unAdaptiveMan" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="unAdaptiveManEditor" class="contentEditor">${cmBaikeProduct.unAdaptiveMan}</div>
+                <label id="unAdaptiveManSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group">
@@ -495,6 +599,7 @@
 			<div class="controls" style="width:812px">
 				<form:textarea path="aroundOperation" htmlEscape="false" class="input-xlarge  hide" />
 				<div id="aroundOperationEditor" class="contentEditor">${cmBaikeProduct.aroundOperation}</div>
+                <label id="aroundOperationSensitiveWords" class="red"></label>
 			</div>
 		</div>
 		<div class="control-group" style="width: 1000px">
@@ -536,18 +641,21 @@
                 <label class="control-label">问题1:</label>
                 <div class="controls">
                     <input name="questionList[0].question" style="width: 550px" htmlEscape="false" class="input-xlarge ">
+                    <label id="question0SensitiveWords" class="red"></label>
                 </div>
             </div>
             <div class="control-group" id="answerRow0">
                 <label class="control-label">答:</label>
                 <div class="controls">
                     <input name="questionList[0].answer" style="width: 550px" htmlEscape="false" class="input-xlarge ">
+                    <label id="answer0SensitiveWords" class="red"></label>
                 </div>
             </div>
             <div class="control-group" id="questionRow1">
                 <label class="control-label">问题2:</label>
                 <div class="controls">
                     <input name="questionList[1].question" style="width: 550px" htmlEscape="false" class="input-xlarge  questionInput">
+                    <label id="question1SensitiveWords" class="red"></label>
                     <a id="questionDelBtn1" onclick="deleteQuestion(1)" style="cursor: pointer">删除</a>
                 </div>
             </div>
@@ -555,6 +663,7 @@
                 <label class="control-label">答:</label>
                 <div class="controls">
                     <input name="questionList[1].answer" style="width: 550px" htmlEscape="false" class="input-xlarge  questionInput">
+                    <label id="answer1SensitiveWords" class="red"></label>
                 </div>
             </div>
         </div>
@@ -596,6 +705,7 @@
 
 <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
 <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
+<script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
 <script>
 	var paramIndex = 6;
 	var questionIndex = 2;
@@ -715,7 +825,9 @@
 			while (index < paramListSize) {
 				$(".paramList").append("<div class=\"controls paramRow\" id=\"paramRow" + index + "\">\n" +
 						"\t\t\t\t<input name=\"paramList[" + index + "].name\" htmlEscape=\"false\" class=\"input-small \" placeholder=\"参数名称\">\n" +
+						"\t\t\t\t<label id=\"param" + index + "SensitiveWords\" class=\"red\"></label>\n" +
 						"\t\t\t\t<input name=\"paramList[" + index + "].content\" htmlEscape=\"false\" class=\"input-xlarge \" placeholder=\"输入参数信息\">\n" +
+						"\t\t\t\t<label id=\"content" + index + "SensitiveWords\" class=\"red\"></label>\n" +
 						"\t\t\t\t<a onclick=\"deleteParam(" + index + ")\" style=\"cursor: pointer\">删除</a>\n" +
 						"            </div>");
 				index = index + 1;
@@ -751,6 +863,7 @@
 						"                <label class=\"control-label\">问题" + (index+1) + ":</label>\n" +
 						"                <div class=\"controls\">\n" +
 						"                    <input name=\"questionList[" + index + "].question\" style=\"width: 550px\" htmlEscape=\"false\" class=\"input-xlarge \">\n" +
+						"\t\t\t\t<label id=\"question" + index + "SensitiveWords\" class=\"red\"></label>\n" +
 						"\t\t\t\t<a id=\"questionDelBtn" + index + "\" onclick=\"deleteQuestion(" + index + ")\" style=\"cursor: pointer\">删除</a>\n" +
 						"                </div>\n" +
 						"            </div>\n" +
@@ -758,6 +871,7 @@
 						"                <label class=\"control-label\">答:</label>\n" +
 						"                <div class=\"controls\">\n" +
 						"                    <input name=\"questionList[" + index + "].answer\" style=\"width: 550px\" htmlEscape=\"false\" class=\"input-xlarge \">\n" +
+						"\t\t\t\t<label id=\"answer" + index + "SensitiveWords\" class=\"red\"></label>\n" +
 						"                </div>\n" +
 						"            </div>");
 				index = index + 1;
@@ -792,7 +906,9 @@
 	function addParam() {
 		$(".paramList").append("<div class=\"controls paramRow\" id=\"paramRow" + paramIndex + "\">\n" +
 				"\t\t\t\t<input name=\"paramList[" + paramIndex + "].name\" htmlEscape=\"false\" class=\"input-small \" placeholder=\"例如:性质类型\">\n" +
+				"\t\t\t\t<label id=\"param" + paramIndex + "SensitiveWords\" class=\"red\"></label>\n" +
 				"\t\t\t\t<input name=\"paramList[" + paramIndex + "].content\" htmlEscape=\"false\" class=\"input-xlarge \" placeholder=\"输入参数信息\">\n" +
+				"\t\t\t\t<label id=\"content" + paramIndex + "SensitiveWords\" class=\"red\"></label>\n" +
 				"\t\t\t\t<a onclick=\"deleteParam(" + paramIndex + ")\" style=\"cursor: pointer\">删除</a>\n" +
 				"            </div>")
 		paramIndex = paramIndex + 1;
@@ -813,6 +929,7 @@
             "                <label class=\"control-label\">问题" + (questionIndex+1) + ":</label>\n" +
             "                <div class=\"controls\">\n" +
             "                    <input name=\"questionList[" + questionIndex + "].question\" style=\"width: 550px\" htmlEscape=\"false\" class=\"input-xlarge \">\n" +
+				"\t\t\t\t<label id=\"question" + questionIndex + "SensitiveWords\" class=\"red\"></label>\n" +
             "\t\t\t\t<a id=\"questionDelBtn" + questionIndex + "\" onclick=\"deleteQuestion(" + questionIndex + ")\" style=\"cursor: pointer\">删除</a>\n" +
             "                </div>\n" +
             "            </div>\n" +
@@ -820,6 +937,7 @@
             "                <label class=\"control-label\">答:</label>\n" +
             "                <div class=\"controls\">\n" +
             "                    <input name=\"questionList[" + questionIndex + "].answer\" style=\"width: 550px\" htmlEscape=\"false\" class=\"input-xlarge \">\n" +
+				"\t\t\t\t<label id=\"answer" + questionIndex + "SensitiveWords\" class=\"red\"></label>\n" +
             "                </div>\n" +
             "            </div>")
         $("#questionDelBtn" + (questionIndex - 1)).attr("style", "display:none;cursor: pointer");

+ 58 - 5
src/main/webapp/WEB-INF/views/modules/info/auditInfoPage.jsp

@@ -27,12 +27,16 @@
 	<table border="0" cellspacing="0" cellpadding="0" width="100%">
 		<tr>
 			<th><span class="red">*</span>文章标题:</th>
-			<td colspan="3"><form:input path="title" htmlEscape="false" maxlength="100" class="input-xxlarge required"/></td>
+			<td colspan="3">
+				<form:input path="title" htmlEscape="false" maxlength="100" class="input-xxlarge required"/>
+				<label id="titleSensitiveWords" class="red"></label>
+			</td>
 		</tr>
 		<tr>
 			<th><span class="red">*</span>文章标签:</th>
 			<td colspan="3">
 				<form:input path="label" htmlEscape="false" maxlength="100" class="input-xxlarge required"/>
+				<label id="labelSensitiveWords" class="red"></label>
 				<span class="help-inline">多个标签之间请用逗号分隔开</span>
 				<div class="init-label"></div>
 				<input id="labelName" type="text" placeholder="在此处输入标签,将自动关联到文章标签" class="input-xlarge"/>
@@ -41,19 +45,31 @@
 		</tr>
 		<tr>
 			<th><span class="red">*</span>SEO关键词:</th>
-			<td colspan="3"><form:input path="keyword" htmlEscape="false" maxlength="50" class="input-xxlarge required"/></td>
+			<td colspan="3">
+				<form:input path="keyword" htmlEscape="false" maxlength="50" class="input-xxlarge required"/>
+				<label id="keywordSensitiveWords" class="red"></label>
+			</td>
 		</tr>
 		<tr>
 			<th><span class="red">*</span>发布人:</th>
-			<td colspan="3"><form:input path="publisher" htmlEscape="false" maxlength="50" class="input-xxlarge required"/></td>
+			<td colspan="3">
+				<form:input path="publisher" htmlEscape="false" maxlength="50" class="input-xxlarge required"/>
+				<label id="publisherSensitiveWords" class="red"></label>
+			</td>
 		</tr>
 		<tr>
 			<th><span class="red">*</span>来源:</th>
-			<td colspan="3"><form:input path="source" htmlEscape="false" maxlength="50" class="input-xlarge"/></td>
+			<td colspan="3">
+				<form:input path="source" htmlEscape="false" maxlength="50" class="input-xlarge"/>
+				<label id="sourceSensitiveWords" class="red"></label>
+			</td>
 		</tr>
 		<tr>
 			<th><span class="red">*</span>推荐语(描述):</th>
-			<td colspan="3"><form:textarea path="recommendContent" htmlEscape="false" maxlength="1000" class="input-xxlarge required"/></td>
+			<td colspan="3">
+				<form:textarea path="recommendContent" htmlEscape="false" maxlength="1000" class="input-xxlarge required"/>
+				<label id="recommendContentSensitiveWords" class="red"></label>
+			</td>
 		</tr>
 		<tr>
 			<th><span class="red">*</span>文章内容:</th>
@@ -62,6 +78,7 @@
 					<form:textarea path="infoContent" class="input-xlarge hide"/>
 					<!-- 富文本编辑器 -->
 					<div id="infoDetailEditor">${info.infoContent}</div>
+					<label id="infoContentSensitiveWords" class="red"></label>
 				</div>
 			</td>
 		</tr>
@@ -157,6 +174,7 @@
 <%--<script src="https://cdn.bootcdn.net/ajax/libs/jquery-validate/1.19.3/jquery.validate.min.js"></script>--%>
 <script type="text/javascript" src="${ctxStatic}/jquery-validation/1.19.3/jquery.validate.js"></script>
 <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
+<script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
 <script type="text/javascript">
 	$(document).ready(function() {
 		//$("#name").focus();
@@ -235,6 +253,41 @@
 				setLabel(label);
 			}
 		});
+
+
+		var title = $("#title").val();
+		var label = $("#label").val();
+		var keyword = $("#keyword").val();
+		var publisher = $("#publisher").val();
+		var source = $("#source").val();
+		var recommendContent = $("#recommendContent").val();
+		var infoContent = $("#infoContent").val();// 检测敏感词
+		var propertyMap = new Map();
+		propertyMap.set("title", title);
+		propertyMap.set("label", label);
+		propertyMap.set("keyword", keyword);
+		propertyMap.set("publisher", publisher);
+		propertyMap.set("source", source);
+		propertyMap.set("recommendContent", recommendContent);
+		propertyMap.set("infoContent", infoContent);
+		var sensitiveWords = '${sensitiveWords}';
+		const mint = new MintFilter(sensitiveWords.split('|'));
+		var filterSync = '';
+		var touchWords = '';
+		var touchNum = 0;
+		propertyMap.forEach(function (value,key,map) {
+			filterSync = mint.filterSync(value);
+			filterSync.words.forEach(word=>{
+				touchWords += touchWords === '' ? word : "," + word;
+			})
+			if (touchWords !== '') {
+				// 增加敏感词触发数量
+				touchNum++;
+				// 设置敏感词提示
+				$("#" + key + "SensitiveWords").text("敏感词:" + touchWords);
+				touchWords = '';
+			}
+		});
 	});
 
 	function updateAuditStatus(auditStatus) {

+ 78 - 0
src/main/webapp/WEB-INF/views/modules/info/cmSensitiveWordsForm.jsp

@@ -0,0 +1,78 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>敏感词库管理</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+		
+		function changeCheckPoints() {
+			var checkPoints = '';
+			$("input[name='checkPoint']:checked").each(function () {
+				checkPoints += checkPoints === '' ? $(this).val() : "," + $(this).val();
+			});
+			$("#checkPoints").val(checkPoints);
+		}
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/info/cmSensitiveWords/form?id=1">敏感词库</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmSensitiveWords" action="${ctx}/info/cmSensitiveWords/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<sys:message content="${message}"/>
+		<form:hidden path="checkPoints"/>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>敏感词:</label>
+			<div class="controls">
+				<form:textarea path="words" maxlength="3000" placeholder="支持输入多个敏感词,例如:操|操你妈|傻逼" class="input-xxlarge required"  rows="6" />
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>检测位置:</label>
+			<div class="controls">
+				<div>
+					<input type="checkbox" name="checkPoint" value="1" onclick="changeCheckPoints()" ${fn:contains(cmSensitiveWords.checkPoints,'1')?"checked":""}/>采美文章(文章管理)
+					<input type="checkbox" name="checkPoint" value="2" onclick="changeCheckPoints()" ${fn:contains(cmSensitiveWords.checkPoints,'2')?"checked":""} />采美百科(产品,仪器)
+				</div>
+				<div>
+					<input type="checkbox" name="checkPoint" value="3" onclick="changeCheckPoints()" ${fn:contains(cmSensitiveWords.checkPoints,'3')?"checked":""} />文章中心(文章列表)
+					<input type="checkbox" name="checkPoint" value="4" onclick="changeCheckPoints()" ${fn:contains(cmSensitiveWords.checkPoints,'4')?"checked":""} />采美百科(采美文库)
+				</div>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">状态:</label>
+			<div class="controls">
+				<form:select path="status" class="input-xlarge ">
+					<form:option value="1" label="启用"/>
+					<form:option value="0" label="停用"/>
+				</form:select>
+			</div>
+		</div>
+		<div class="form-actions">
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+</body>
+</html>

+ 58 - 0
src/main/webapp/WEB-INF/views/modules/info/cmSensitiveWordsList.jsp

@@ -0,0 +1,58 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>敏感词库管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/info/cmSensitiveWords/">敏感词库列表</a></li>
+		<shiro:hasPermission name="info:cmSensitiveWords:edit"><li><a href="${ctx}/info/cmSensitiveWords/form">敏感词库添加</a></li></shiro:hasPermission>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmSensitiveWords" action="${ctx}/info/cmSensitiveWords/" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<shiro:hasPermission name="info:cmSensitiveWords:edit"><th>操作</th></shiro:hasPermission>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmSensitiveWords">
+			<tr>
+				<shiro:hasPermission name="info:cmSensitiveWords:edit"><td>
+    				<a href="${ctx}/info/cmSensitiveWords/form?id=${cmSensitiveWords.id}">编辑</a>
+    				<shiro:hasPermission name="info:cmSensitiveWords:delete">
+					<a href="${ctx}/info/cmSensitiveWords/delete?id=${cmSensitiveWords.id}" onclick="return confirmx('确认要删除该敏感词库吗?', this.href)">删除</a>
+					</shiro:hasPermission>
+				</td></shiro:hasPermission>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+</body>
+</html>

+ 90 - 20
src/main/webapp/WEB-INF/views/modules/info/infoForm.jsp

@@ -27,12 +27,16 @@
 	<table border="0" cellspacing="0" cellpadding="0" width="100%">
 		<tr>
 			<th><span class="red">*</span>文章标题:</th>
-			<td colspan="3"><form:input path="title" htmlEscape="false" maxlength="100" class="input-xxlarge required"/></td>
+			<td colspan="3">
+				<form:input path="title" htmlEscape="false" maxlength="100" class="input-xxlarge required"/>
+				<label id="titleSensitiveWords" class="red"></label>
+			</td>
 		</tr>
 		<tr>
 			<th><span class="red">*</span>文章标签:</th>
 			<td colspan="3">
 				<form:input path="label" htmlEscape="false" maxlength="100" class="input-xxlarge required"/>
+				<label id="labelSensitiveWords" class="red"></label>
 				<span class="help-inline">多个标签之间请用逗号分隔开</span>
 				<div class="init-label"></div>
 				<input id="labelName" type="text" placeholder="在此处输入标签,将自动关联到文章标签" class="input-xlarge"/>
@@ -41,19 +45,31 @@
 		</tr>
 		<tr>
 			<th><span class="red">*</span>SEO关键词:</th>
-			<td colspan="3"><form:input path="keyword" htmlEscape="false" maxlength="50" class="input-xxlarge required"/></td>
+			<td colspan="3">
+				<form:input path="keyword" htmlEscape="false" maxlength="50" class="input-xxlarge required"/>
+				<label id="keywordSensitiveWords" class="red"></label>
+			</td>
 		</tr>
 		<tr>
 			<th><span class="red">*</span>发布人:</th>
-			<td colspan="3"><form:input path="publisher" htmlEscape="false" maxlength="50" class="input-xxlarge required"/></td>
+			<td colspan="3">
+				<form:input path="publisher" htmlEscape="false" maxlength="50" class="input-xxlarge required"/>
+				<label id="publisherSensitiveWords" class="red"></label>
+			</td>
 		</tr>
 		<tr>
 			<th><span class="red">*</span>来源:</th>
-			<td colspan="3"><form:input path="source" htmlEscape="false" maxlength="50" class="input-xlarge"/></td>
+			<td colspan="3">
+				<form:input path="source" htmlEscape="false" maxlength="50" class="input-xlarge"/>
+				<label id="sourceSensitiveWords" class="red"></label>
+			</td>
 		</tr>
 		<tr>
 			<th><span class="red">*</span>推荐语(描述):</th>
-			<td colspan="3"><form:textarea path="recommendContent" htmlEscape="false" maxlength="1000" class="input-xxlarge required"/></td>
+			<td colspan="3">
+				<form:textarea path="recommendContent" htmlEscape="false" maxlength="1000" class="input-xxlarge required"/>
+				<label id="recommendContentSensitiveWords" class="red"></label>
+			</td>
 		</tr>
 		<tr>
 			<th><span class="red">*</span>文章内容:</th>
@@ -62,6 +78,7 @@
 					<form:textarea path="infoContent" class="input-xlarge hide"/>
 					<!-- 富文本编辑器 -->
 					<div id="infoDetailEditor">${info.infoContent}</div>
+					<label id="infoContentSensitiveWords" class="red"></label>
 				</div>
 			</td>
 		</tr>
@@ -105,7 +122,8 @@
 		<tr>
 			<th><span class="red">*</span>状态:</th>
 			<td colspan="3">
-				<form:radiobuttons path="enabledStatus" items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
+				<form:radiobutton path="enabledStatus" label="发布" value="1" checked="${empty info.enabledStatus?'checked':''}"/>
+				<form:radiobutton path="enabledStatus" label="保存草稿箱" value="0"/>
 			</td>
 		</tr>
 		<tr>
@@ -152,55 +170,108 @@
 <%--<script src="https://cdn.bootcdn.net/ajax/libs/jquery-validate/1.19.3/jquery.validate.min.js"></script>--%>
 <script type="text/javascript" src="${ctxStatic}/jquery-validation/1.19.3/jquery.validate.js"></script>
 <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
+<script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
 <script type="text/javascript">
 	$(document).ready(function() {
 		//$("#name").focus();
 		$("#inputForm").validate({
 			ignore:"",
 			submitHandler: function(form){
-				debugger
-				if ($("#title").val() == '') {
+				var status = $("input[name='enabledStatus']:checked").val();
+				var title = $("#title").val();
+				var label = $("#label").val();
+				var keyword = $("#keyword").val();
+				var publisher = $("#publisher").val();
+				var source = $("#source").val();
+				var pubdate = $("#pubdate").val();
+				var recommendContent = $("#recommendContent").val();
+				var infoContent = $("#infoContent").val();
+				var guidanceImage = $("#guidanceImage").val();
+				var basePraise = $("#basePraise").val();
+				var basePv = $("#basePv").val();
+				if (title == '') {
 					alertx("请输入文章标题");
 					return false;
 				}
-				if ($("#label").val() == '') {
+				if (label == '') {
 					alertx("请输入文章标签");
 					return false;
 				}
-				if ($("#keyword").val() == '') {
+				if (keyword == '') {
 					alertx("请输入SEO关键词");
 					return false;
 				}
-				if ($("#publisher").val() == '') {
+				if (publisher == '') {
 					alertx("请输入发布人");
 					return false;
 				}
-				if ($("#pubdate").val() == '') {
+				if (pubdate == '') {
 					alertx("请输入发布时间");
 					return false;
 				}
-				if ($("#recommendContent").val() == '') {
+				if (recommendContent == '') {
 					alertx("请输入推荐语(描述)");
 					return false;
 				}
-				if ($("#infoContent").val() == '') {
+				if (infoContent == '') {
 					alertx("请输入文章内容");
 					return false;
 				}
-				if ($("#guidanceImage").val() == '') {
+				if (guidanceImage == '') {
 					alertx("请上传引导图");
 					return false;
 				}
-				if ($("#basePraise").val() == '') {
+				if (basePraise == '') {
 					alertx("请输入基础点赞");
 					return false;
 				}
-				if ($("#basePv").val() == '') {
+				if (basePv == '') {
 					alertx("请输入基础浏览量");
 					return false;
 				}
-				loading('正在提交,请稍等...');
-				form.submit();
+
+				// 检测敏感词
+				var propertyMap = new Map();
+				propertyMap.set("title", title);
+				propertyMap.set("label", label);
+				propertyMap.set("keyword", keyword);
+				propertyMap.set("publisher", publisher);
+				propertyMap.set("source", source);
+				propertyMap.set("recommendContent", recommendContent);
+				propertyMap.set("infoContent", infoContent);
+				var sensitiveWords = '${sensitiveWords}';
+				const mint = new MintFilter(sensitiveWords.split('|'));
+				var filterSync = '';
+				var touchWords = '';
+				var touchNum = 0;
+				propertyMap.forEach(function (value,key,map) {
+					filterSync = mint.filterSync(value);
+					filterSync.words.forEach(word=>{
+						touchWords += touchWords === '' ? word : "," + word;
+					})
+					if (touchWords !== '') {
+						// 增加敏感词触发数量
+						touchNum++;
+						// 设置敏感词提示
+						$("#" + key + "SensitiveWords").text("敏感词:" + touchWords);
+						touchWords = '';
+					}
+				});
+				if (touchNum > 0) {
+					var msg = 1 == status?"当前发布内容存在敏感词,已为您标记在输入框下方," +
+							"请修改后,再进行保存发布,强行保存发布将会导致审核不通过!":
+							"当前内容存在敏感词,已为您标记在输入框下方,建议修改后再进行保存!否则," +
+							"将会影响发布时审核不通过!";
+					top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+						if (v == 'ok') {
+							loading('正在提交,请稍等...');
+							form.submit();
+						}
+					}, {buttonsFocus: 1, persistent: true});
+				} else{
+					loading('正在提交,请稍等...');
+					form.submit();
+				}
 			},
 			errorContainer: "#messageBox",
 			errorPlacement: function(error, element) {
@@ -233,7 +304,6 @@
 
 	//富文本框编辑
 	function checkInfo() {
-		debugger
 		var infoContent = infoDetailEditor.getData();
 		$("#infoContent").val(infoContent);
 		console.log(infoContent);

+ 4 - 4
src/main/webapp/WEB-INF/views/modules/info/infoList.jsp

@@ -280,13 +280,13 @@
 				</td>
 				<td>
 					<c:if test="${info.enabledStatus eq 1 }">
-						<a href="javascript:void(0);" onclick="updateStatus('0','${info.id}','enabledStatus','${info.enabledStatus}');" >
-							<img alt="启用" src="/static/images/yes.gif" width="15px" border="none" title="启用">
+						<font color="green">已发布</font>
+						<a href="javascript:void(0)" onclick="updateStatus('0','${info.id}','enabledStatus','${info.enabledStatus}');" style="cursor: pointer">保存草稿箱
 						</a>
 					</c:if>
 					<c:if test="${info.enabledStatus ne 1 }">
-						<a href="javascript:void(0)" onclick="updateStatus('1','${info.id}','enabledStatus','${info.enabledStatus}');">
-							<img alt="停用" src="/static/images/no.gif" width="15px" border="none" title="停用">
+						<font color="red">保存草稿箱</font>
+						<a href="javascript:void(0)" onclick="updateStatus('1','${info.id}','enabledStatus','${info.enabledStatus}');" style="cursor: pointer">发布
 						</a>
 					</c:if>
 				</td>

File diff suppressed because it is too large
+ 0 - 0
src/main/webapp/static/sensitiveWords/mint-filter.umd.js


Some files were not shown because too many files changed in this diff