增加配置保护名单管理功能.
This commit is contained in:
57
src/main/java/com/nis/domain/basics/ProtectionListInfo.java
Normal file
57
src/main/java/com/nis/domain/basics/ProtectionListInfo.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.nis.domain.basics;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
|
||||
public class ProtectionListInfo extends BaseCfg<ProtectionListInfo> implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3781310894175345207L;
|
||||
private Integer proId;
|
||||
private String keyword;
|
||||
private String targetType;
|
||||
private String description;
|
||||
|
||||
|
||||
public Integer getProId() {
|
||||
return proId;
|
||||
}
|
||||
public void setProId(Integer proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
public String getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
public void setKeyword(String keyword) {
|
||||
this.keyword = keyword;
|
||||
}
|
||||
public String getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
public void setTargetType(String targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Date getEditTime() {
|
||||
return editTime;
|
||||
}
|
||||
public void setEditTime(Date editTime) {
|
||||
this.editTime = editTime;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -828,5 +828,10 @@ public final class Constants {
|
||||
/**
|
||||
* vpn cgi接口报错信息
|
||||
*/
|
||||
public static final String CGI_ERROR = Configurations.getStringProperty("cgiError","");;
|
||||
public static final String CGI_ERROR = Configurations.getStringProperty("cgiError","");
|
||||
|
||||
/**
|
||||
* 配置保护名单字典key
|
||||
*/
|
||||
public static final String CACHE_PROTECTION_LIST_DICT = "protetionListDict";
|
||||
}
|
||||
|
||||
@@ -155,6 +155,7 @@ import com.nis.web.service.SystemService;
|
||||
import com.nis.web.service.UserService;
|
||||
import com.nis.web.service.basics.AsnGroupInfoService;
|
||||
import com.nis.web.service.basics.AsnIpCfgService;
|
||||
import com.nis.web.service.basics.InnerProtectionListService;
|
||||
import com.nis.web.service.basics.IpReuseIpCfgService;
|
||||
import com.nis.web.service.basics.PolicyGroupInfoService;
|
||||
import com.nis.web.service.basics.ServiceDictInfoService;
|
||||
@@ -331,6 +332,8 @@ public class BaseController {
|
||||
protected PxyObjSpoofingIpPoolService pxyObjSpoofingIpPoolService;// 欺骗IP池
|
||||
@Autowired
|
||||
protected AsnGroupInfoService asnGroupInfoService;// asn组
|
||||
@Autowired
|
||||
protected InnerProtectionListService innerProtectionListService;
|
||||
/**
|
||||
* 管理基础路径
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ProtectionListInfo;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* 内置配置保护名单管理
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/innerProtectionList")
|
||||
public class InnerProtectionListController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"/list", ""})
|
||||
public String policyGroupList(ProtectionListInfo cfg,HttpServletRequest request, HttpServletResponse response, Model model,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
if(cfg == null)cfg=new ProtectionListInfo();
|
||||
Page<ProtectionListInfo> pageCondition = new Page<ProtectionListInfo>(request, response,"r");
|
||||
Page page = innerProtectionListService.findProtectionInfoList(pageCondition,cfg);
|
||||
|
||||
model.addAttribute("cfg", cfg);
|
||||
model.addAttribute("page", page);
|
||||
return "/basics/protectionInfoList";
|
||||
}
|
||||
|
||||
@RequestMapping(value={"/form"})
|
||||
public String form(Integer groupType,String ids,Model model,String doAction,RedirectAttributes redirectAttributes) {
|
||||
ProtectionListInfo protectionListInfo = new ProtectionListInfo();
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
protectionListInfo = innerProtectionListService.getById(Integer.parseInt(ids));
|
||||
}
|
||||
model.addAttribute("_cfg", protectionListInfo);
|
||||
return "/basics/protectionInfoForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(ProtectionListInfo cfg,Model model,String itType,Integer groupType,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
innerProtectionListService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("新增失败",e);
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/innerProtectionList/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value={"delete"})
|
||||
public String delete(RedirectAttributes redirectAttributes,String ids,int isValid) {
|
||||
try {
|
||||
innerProtectionListService.deldete(ids,isValid);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败",e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/innerProtectionList/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value="ajaxGetAllInfo",method=RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Map<String,List<String>> ajaxGetAllInfo(HttpServletRequest request, HttpServletResponse response){
|
||||
return innerProtectionListService.ajaxGetAllInfo();
|
||||
}
|
||||
}
|
||||
21
src/main/java/com/nis/web/dao/basics/InnerProtectionDao.java
Normal file
21
src/main/java/com/nis/web/dao/basics/InnerProtectionDao.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.nis.web.dao.basics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.basics.ProtectionListInfo;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface InnerProtectionDao extends CrudDao<ProtectionListInfo> {
|
||||
|
||||
List<ProtectionListInfo> findProtectionInfoList(ProtectionListInfo protectionListInfo);
|
||||
|
||||
ProtectionListInfo getById(@Param("proId")int proId);
|
||||
|
||||
List<ProtectionListInfo> ajaxGetAllInfo();
|
||||
|
||||
|
||||
}
|
||||
128
src/main/java/com/nis/web/dao/basics/InnerProtectionDao.xml
Normal file
128
src/main/java/com/nis/web/dao/basics/InnerProtectionDao.xml
Normal file
@@ -0,0 +1,128 @@
|
||||
<?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.nis.web.dao.basics.InnerProtectionDao" >
|
||||
|
||||
<resultMap id="ProtectionListInfoMap" type="com.nis.domain.basics.ProtectionListInfo" >
|
||||
<id column="id" property="proId" jdbcType="INTEGER" />
|
||||
<result column="keyword" property="keyword" jdbcType="VARCHAR" />
|
||||
<result column="target_type" property="targetType" jdbcType="VARCHAR" />
|
||||
<result column="description" property="description" jdbcType="VARCHAR" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="ProtectionListInfoColumns">
|
||||
r.id,r.keyword,r.target_type,r.description,r.create_time,r.edit_time,r.creator_id,r.editor_id
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findProtectionInfoList" resultMap="ProtectionListInfoMap">
|
||||
SELECT
|
||||
<include refid="ProtectionListInfoColumns"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name ,e.name as editor_name
|
||||
</trim>
|
||||
FROM inner_protection_list r
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND r.keyword like CONCAT(CONCAT('%',#{keyword,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="targetType != null">
|
||||
AND r.target_type like CONCAT(CONCAT('%',#{targetType,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
AND r.IS_VALID = 1
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND r.creator_name like CONCAT(CONCAT('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editorName != null and editorName != ''">
|
||||
AND r.editor_name like CONCAT(CONCAT('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
<!-- ${sqlMap.dsf} -->
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY r.id DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getById" resultMap="ProtectionListInfoMap">
|
||||
SELECT
|
||||
<include refid="ProtectionListInfoColumns"/>
|
||||
FROM
|
||||
inner_protection_list r
|
||||
WHERE
|
||||
r.ID = #{proId} AND r.IS_VALID = 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.basics.ProtectionListInfo" >
|
||||
INSERT INTO inner_protection_list(
|
||||
KEYWORD,
|
||||
TARGET_TYPE,
|
||||
DESCRIPTION,
|
||||
IS_VALID,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME
|
||||
)VALUES (
|
||||
#{keyword,jdbcType=VARCHAR},
|
||||
#{targetType,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=VARCHAR},
|
||||
#{isValid,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.basics.ProtectionListInfo" >
|
||||
update inner_protection_list
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="keyword != null and keyword != ''" >
|
||||
keyword = #{keyword,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="targetType != null and targetType != ''" >
|
||||
target_type = #{targetType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null and description != ''" >
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
<if test="proId != null" >
|
||||
AND id = #{proId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<select id="ajaxGetAllInfo" resultType="com.nis.domain.basics.ProtectionListInfo">
|
||||
SELECT
|
||||
<include refid="ProtectionListInfoColumns"/>
|
||||
FROM
|
||||
inner_protection_list r
|
||||
WHERE
|
||||
r.IS_VALID = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.nis.web.service.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ProtectionListInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.CacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.InnerProtectionDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
@Service
|
||||
public class InnerProtectionListService extends BaseService{
|
||||
|
||||
@Autowired
|
||||
private InnerProtectionDao innerProtectionDao;
|
||||
|
||||
public Page<ProtectionListInfo> findProtectionInfoList(Page<ProtectionListInfo> page, ProtectionListInfo entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<ProtectionListInfo> list = innerProtectionDao.findProtectionInfoList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
public ProtectionListInfo getById(int id) {
|
||||
ProtectionListInfo protectionListInfo = innerProtectionDao.getById(id);
|
||||
return protectionListInfo;
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(ProtectionListInfo cfg) throws MaatConvertException{
|
||||
cfg.setIsValid(1);
|
||||
if(cfg.getProId()==null){//新增
|
||||
Date createTime=new Date();
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
cfg.setCreateTime(createTime);
|
||||
innerProtectionDao.insert(cfg);
|
||||
|
||||
}else{//更新
|
||||
Date editTime=new Date();
|
||||
cfg.setEditorId(UserUtils.getUser().getId());
|
||||
cfg.setEditTime(editTime);
|
||||
innerProtectionDao.update(cfg);
|
||||
|
||||
}
|
||||
this.updateProtetionListDict();
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void deldete(String ids, int isValid){
|
||||
ProtectionListInfo entity=new ProtectionListInfo();
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
entity.setIsValid(isValid);
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
for (String id : ids.split(",")) {
|
||||
if(!StringUtil.isEmpty(id)){
|
||||
entity.setProId(Integer.parseInt(id));
|
||||
innerProtectionDao.update(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateProtetionListDict();
|
||||
}
|
||||
|
||||
public Map<String,List<String>> ajaxGetAllInfo() {
|
||||
Map<String,List<String>> dictMap = (Map<String,List<String>>)CacheUtils.get(Constants.CACHE_PROTECTION_LIST_DICT);
|
||||
if(StringUtil.isEmpty(dictMap)) {
|
||||
dictMap = this.updateProtetionListDict();
|
||||
}
|
||||
return dictMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新字典缓存
|
||||
* @return
|
||||
*/
|
||||
private Map<String, List<String>> updateProtetionListDict() {
|
||||
Map<String,List<String>> dictMap = new HashMap<String,List<String>>();
|
||||
List<ProtectionListInfo> list = innerProtectionDao.ajaxGetAllInfo();
|
||||
for (ProtectionListInfo info : list) {
|
||||
List<String> putList = new ArrayList<String>();
|
||||
if(dictMap.containsKey(info.getTargetType())) {
|
||||
putList = dictMap.get(info.getTargetType());
|
||||
}
|
||||
putList.add(info.getKeyword());
|
||||
dictMap.put(info.getTargetType(), putList);
|
||||
}
|
||||
CacheUtils.put(Constants.CACHE_PROTECTION_LIST_DICT, dictMap);
|
||||
return dictMap;
|
||||
}
|
||||
}
|
||||
@@ -1502,3 +1502,4 @@ schedule=Scheduler
|
||||
cancel_all=Cancel all configurations!
|
||||
pre_version=Previous Version
|
||||
approved_all=Approve all configurations!
|
||||
protection_list_manage=Protection List Manage
|
||||
@@ -1507,3 +1507,4 @@ schedule=Scheduler
|
||||
cancel_all=Cancel all configurations!
|
||||
pre_version=Previous Version
|
||||
approved_all=Approve all configurations!
|
||||
protection_list_manage=Protection List Manage
|
||||
@@ -1500,3 +1500,4 @@ cancel_all=\u53D6\u6D88\u6240\u6709\u914D\u7F6E!
|
||||
pre_version=\u4e0a\u4e00\u7248
|
||||
is_schduler=\u5b9a\u65f6\u5668
|
||||
approved_all=\u5BA1\u6838\u901A\u8FC7\u6240\u6709\u914D\u7F6E!
|
||||
protection_list_manage=\u5185\u7F6E\u4FDD\u62A4\u540D\u5355\u7BA1\u7406
|
||||
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE `inner_protection_list` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`keyword` varchar(500) NOT NULL COMMENT '关键词',
|
||||
`target_type` varchar(128) DEFAULT '' COMMENT '类型',
|
||||
`description` varchar(200) DEFAULT '',
|
||||
`is_valid` int(2) NOT NULL DEFAULT 0 COMMENT '-1删除 1有效',
|
||||
`create_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`editor_id` int(11) DEFAULT NULL,
|
||||
`creator_id` int(11) NOT NULL,
|
||||
`edit_time` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=108 DEFAULT CHARSET=utf8mb4;
|
||||
106
src/main/webapp/WEB-INF/views/basics/protectionInfoForm.jsp
Normal file
106
src/main/webapp/WEB-INF/views/basics/protectionInfoForm.jsp
Normal file
@@ -0,0 +1,106 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<html>
|
||||
<head>
|
||||
<title><spring:message code="${cfgName}"></spring:message></title>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#cfgFrom").validate({
|
||||
errorPlacement: function(error,element){
|
||||
if($(element).parents().hasClass("tagsinput")){
|
||||
$(element).parents(".col-md-6").next("div").append(error);
|
||||
}else{
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
}
|
||||
},
|
||||
submitHandler: function(form){
|
||||
loading('onloading...');
|
||||
form.submit();
|
||||
},
|
||||
errorContainer: "#messageBox",
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
<h3 class="page-title">
|
||||
<spring:message code="protection_list_manage"/>
|
||||
</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="portlet box blue">
|
||||
<div class="portlet-title">
|
||||
<div class="caption">
|
||||
<i class="fa fa-gift"></i>
|
||||
<c:if test="${empty _cfg.proId}"><spring:message code="add"></spring:message></c:if>
|
||||
<c:if test="${not empty _cfg.proId}"><spring:message code="edit"></spring:message></c:if>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body form">
|
||||
<!-- BEGIN FORM-->
|
||||
<form:form id="cfgFrom" modelAttribute="_cfg" action="${ctx}/basics/innerProtectionList/saveOrUpdate" method="post" class="form-horizontal">
|
||||
<input type="hidden" name="proId" value="${_cfg.proId}">
|
||||
<div class="form-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="keywords"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="text" name="keyword" value="${_cfg.keyword}">
|
||||
</div>
|
||||
<div for="keyword"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="type"/></label>
|
||||
<div class="col-md-6">
|
||||
<%-- <input class="form-control required" type="text" name="targetType" value="${_cfg.targetType}"> --%>
|
||||
<select name="targetType" class="selectpicker show-tick form-control required">
|
||||
<option value=""><spring:message code="select"/></option>
|
||||
<option value="urlCheck" <c:if test="${_cfg.targetType eq 'urlCheck'}">selected</c:if>><spring:message code="URL"/></option>
|
||||
<option value="domainCheck" <c:if test="${_cfg.targetType eq 'domainCheck'}">selected</c:if>><spring:message code="domain"/></option>
|
||||
<option value="keywordSign" <c:if test="${_cfg.targetType eq 'keywordSign'}">selected</c:if>><spring:message code="keywords"/></option>
|
||||
</select>
|
||||
</div>
|
||||
<div for="targetType"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label"><spring:message code="desc"/>:</label>
|
||||
<div class="col-md-6">
|
||||
<form:textarea path="description" htmlEscape="false" maxlength="128" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-md-offset-3 col-md-8">
|
||||
<button id="save" type="submit" class="btn green"><spring:message code="submit"/></button>
|
||||
<button id="cancel" type="button" class="btn default"><spring:message code="cancel"/></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</form:form>
|
||||
<!-- END FORM-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
260
src/main/webapp/WEB-INF/views/basics/protectionInfoList.jsp
Normal file
260
src/main/webapp/WEB-INF/views/basics/protectionInfoList.jsp
Normal file
@@ -0,0 +1,260 @@
|
||||
<%@
|
||||
page contentType="text/html;charset=UTF-8"%>
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<html>
|
||||
<head>
|
||||
<title><spring:message code="${cfgName}"></spring:message></title>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
//搜索框提示语初始化
|
||||
if("${cfg.keyword}"){
|
||||
$("#intype").val("${cfg.keyword}");
|
||||
}else{
|
||||
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
|
||||
}
|
||||
// 处理 Type下拉检索条件----------------+
|
||||
if($("#seltype").val() == "targetType"){
|
||||
$("#intype").hide();// 隐藏输入框
|
||||
}else{
|
||||
$("#targetType").selectpicker("hide");
|
||||
}
|
||||
|
||||
$("#seltype").change(function(){
|
||||
if($(this).val() == "targetType"){
|
||||
$("#intype").hide();// 隐藏输入框
|
||||
$("#intype").val("");// 清空input条件
|
||||
$("#targetType").find("option").removeAttr("selected",false);
|
||||
$("#targetType").selectpicker("refresh");
|
||||
$("#targetType").selectpicker("show");
|
||||
}else{
|
||||
$("#targetType").find("option:first").attr("selected",true);
|
||||
$("#targetType").selectpicker("hide");// 隐藏下拉框
|
||||
}
|
||||
$("#intype").attr("placeholder","<spring:message code='input'/> "+$(this).find("option:selected").text());
|
||||
});
|
||||
// 处理 Type下拉检索条件----------------+
|
||||
|
||||
//筛选功能初始化
|
||||
filterActionInit();
|
||||
//reset
|
||||
$("#resetBtn").on("click",function(){
|
||||
if($("#seltype").find("option:first").val() == "targetType"){
|
||||
$("#intype").hide();
|
||||
$("#targetType").selectpicker("show");
|
||||
return false;
|
||||
}
|
||||
if($("#seltype").val() == "targetType"){
|
||||
$("#intype").show();
|
||||
$("#intype").attr("placeholder",$.validator.messages.input+$("#seltype").find("option:first").text());
|
||||
$("#targetType").selectpicker("hide");
|
||||
};
|
||||
|
||||
$("select.selectpicker").each(function(){
|
||||
$(this).selectpicker('val',$(this).find('option:first').val());
|
||||
$(this).find("option").attr("selected",false);
|
||||
$(this).find("option:first").attr("selected",true);
|
||||
});
|
||||
$(".Wdate").attr("value",'');
|
||||
$("#searchForm")[0].reset();
|
||||
});
|
||||
});
|
||||
function deletes(url){
|
||||
var checkboxes=$("tbody tr td input.i-checks:checkbox");
|
||||
var ids="";
|
||||
var str="";
|
||||
checkboxes.each(function(){
|
||||
if(true == $(this).is(':checked')){
|
||||
|
||||
str+=$(this).attr("id")+",";
|
||||
}
|
||||
});
|
||||
if(str.substr(str.length-1)== ','){
|
||||
ids = str.substr(0,str.length-1);
|
||||
}
|
||||
|
||||
var canDel=true;
|
||||
if(canDel){
|
||||
var added = "";
|
||||
|
||||
top.$.jBox.confirm("<spring:message code='confirm_message'/>"+added,"<spring:message code='info'/>",function(v,h,f){
|
||||
if(v=="ok"){
|
||||
window.location = url+"&ids="+ids;
|
||||
|
||||
}
|
||||
},{buttonsFocus:1});
|
||||
top.$('.jbox-body .jbox-icon').css('top','55px');
|
||||
}else{
|
||||
$.jBox.tip(tip);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="theme-panel hidden-xs hidden-sm">
|
||||
<button type="button" class="btn btn-primary" onClick="javascript:window.location='${ctx}/basics/innerProtectionList/form'">
|
||||
<i class="fa fa-plus"></i>
|
||||
<spring:message code="add"></spring:message>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<h3 class="page-title">
|
||||
<spring:message code="protection_list_manage"/>
|
||||
</h3>
|
||||
<h5 class="page-header"></h5>
|
||||
<div class="col-md-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-body">
|
||||
<div class="row" >
|
||||
<form:form id="searchForm" modelAttribute="cfg" action="${ctx}/basics/innerProtectionList/list" method="post" class="form-search">
|
||||
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
|
||||
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
||||
<%-- <input id="groupType" name="groupType" type="hidden" value="${cfg.groupType}"/> --%>
|
||||
<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();" />
|
||||
<!-- 筛选按钮展开状态-->
|
||||
<input id="isFilterAction" name="isFilterAction" type="hidden" value="${cfg.isFilterAction }"/>
|
||||
|
||||
<!-- 搜索内容与操作按钮栏 -->
|
||||
<div class="col-md-12">
|
||||
<div class="pull-left">
|
||||
<div class="input-group">
|
||||
<div class="input-group-btn">
|
||||
<form:select path="seltype" class="selectpicker select2 input-small" >
|
||||
<form:option value="keyword"><spring:message code="keywords"></spring:message></form:option>
|
||||
<form:option value="targetType"><spring:message code="type"></spring:message></form:option>
|
||||
</form:select>
|
||||
</div>
|
||||
<input id="intype" class="form-control input-medium" type="text" value="">
|
||||
<div class="input-group-btn">
|
||||
<form:select id="targetType" path="targetType" class="selectpicker select2 input-small" >
|
||||
<form:option value=""><spring:message code="select"/></form:option>
|
||||
<form:option value="urlCheck"><spring:message code="URL"/></form:option>
|
||||
<form:option value="domainCheck"><spring:message code="domain"/></form:option>
|
||||
<form:option value="keywordSign"><spring:message code="keywords"/></form:option>
|
||||
</form:select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<button type="button" class="btn blue" onClick="return page()"> <i class="fa fa-search"></i> <spring:message code="search"/> </button>
|
||||
<button type="button" class="btn btn-default" id="resetBtn"> <i class="fa fa-refresh"></i> <spring:message code="reset"/> </button>
|
||||
<button type="button" class="btn btn-default" id="filter-btn"> <spring:message code="filter"/> <i class="fa fa-angle-double-down"></i></button>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<sys:delRow url="${ctx}/basics/innerProtectionList/form" id="contentTable" label="update"></sys:delRow>
|
||||
<a href="javascript:void(0);" class="btn btn-default" onclick="deletes('${ctx}/basics/innerProtectionList/delete?isValid=-1&functionId=${cfg.functionId }')" data-toggle="tooltip" data-placement="top">
|
||||
<i class="fa fa-trash"> <spring:message code="delete"/></i>
|
||||
</a>
|
||||
<%-- <sys:delRow url="${ctx}/basics/asn/delete?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow> --%>
|
||||
|
||||
<%-- <div class="btn-group"> 导出
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-wrench"></i> <spring:message code="export"></spring:message>
|
||||
<i class="fa fa-angle-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" style="min-width: 110px;" >
|
||||
<li><sys:delRow url="${ctx}/basics/policyGroup/exportGroup?exType=excel" searchUrl="${ctx}/basics/policyGroup/policyGroupList" id="contentTable" maxRow="5" label="cfg_excel"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/basics/policyGroup/exportGroup?exType=csv" searchUrl="${ctx}/basics/policyGroup/policyGroupList" id="contentTable" maxRow="5" label="cfg_csv"></sys:delRow></li>
|
||||
</ul>
|
||||
</div> --%>
|
||||
|
||||
<a class="btn btn-icon-only btn-default setfields tooltips"
|
||||
data-container="body" data-placement="top" data-original-title=<spring:message code="custom_columns"/> href="javascript:;">
|
||||
<i class="icon-wrench"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /搜索内容与操作按钮栏 -->
|
||||
|
||||
<!-- 筛选搜索内容栏默认隐藏-->
|
||||
<div class="col-md-12 filter-action-select-panle hide" >
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="config_time"/>:</label>
|
||||
<input name="search_create_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value='${cfg.search_create_time_start}' pattern='yyyy-MM-dd HH:mm:ss'/>" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label> </label>
|
||||
<input name="search_create_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_create_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="edit_time"/>:</label>
|
||||
<input name="search_edit_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_edit_time_start}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label> </label>
|
||||
<input name="search_edit_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
|
||||
value="<fmt:formatDate value="${cfg.search_edit_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /筛选搜索内容栏 结束-->
|
||||
</form:form>
|
||||
</div>
|
||||
<sys:message content="${message}" type="${messageType }"/>
|
||||
<div class="table-responsive">
|
||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
|
||||
<th column="keyword" ><spring:message code="keywords"/></th>
|
||||
<th column="targetType" ><spring:message code="type"/></th>
|
||||
<th column="desc" ><spring:message code="desc"/></th>
|
||||
<th column="creator" ><spring:message code="creator"/></th>
|
||||
<th column="config_time" class="sort-column r.create_time"><spring:message code="config_time"/></th>
|
||||
<th column="editor" ><spring:message code="editor"/></th>
|
||||
<th column="edit_time" class="sort-column r.edit_time"><spring:message code="edit_time"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${page.list }" var="cfg" varStatus="status" step="1">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="i-checks child-checks" id="${cfg.proId}"></td>
|
||||
<td>
|
||||
<a href="javascript:;" data-original-title="${cfg.keyword}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(cfg.keyword,20)}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<c:if test="${cfg.targetType eq 'urlCheck'}"><spring:message code="URL"/></c:if>
|
||||
<c:if test="${cfg.targetType eq 'domainCheck'}"><spring:message code="domain"/></c:if>
|
||||
<c:if test="${cfg.targetType eq 'keywordSign'}"><spring:message code="keywords"/></c:if>
|
||||
</td>
|
||||
<td title="${cfg.description }">${fns:abbr(cfg.description,20)}</td>
|
||||
<td>${cfg.creatorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
<td>${cfg.editorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.editTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="page">${page}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -85,7 +85,11 @@
|
||||
<!-- 此配置的关键词可以输入多个关键词 -->
|
||||
<c:if test="${region.configMultiKeywords eq 1}">
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required tags <c:if test="${fn:containsIgnoreCase(region.configServiceType,'domain') }"> domainCheck </c:if> <c:if test="${fn:containsIgnoreCase(region.configServiceType,'url') }"> urlCheck </c:if>" type="text" id="tags_${tabName}${status.index}"
|
||||
<input class="form-control required tags
|
||||
<c:if test="${fn:containsIgnoreCase(region.configServiceType,'domain') }"> domainCheck </c:if>
|
||||
<c:if test="${fn:containsIgnoreCase(region.configServiceType,'url') }"> urlCheck </c:if>
|
||||
<c:if test="${(!fn:containsIgnoreCase(region.configServiceType,'domain')) && (!fn:containsIgnoreCase(region.configServiceType,'url')) }"> keywordSign </c:if>"
|
||||
type="text" id="tags_${tabName}${status.index}"
|
||||
name="${cfgName}.cfgKeywords"
|
||||
value="${cfg.cfgKeywords}">
|
||||
</div>
|
||||
@@ -97,6 +101,7 @@
|
||||
<input class="form-control required invisibleChar
|
||||
<c:if test="${fn:containsIgnoreCase(region.configServiceType,'domain') }"> domainCheck </c:if>
|
||||
<c:if test="${fn:containsIgnoreCase(region.configServiceType,'url') }"> urlCheck </c:if>
|
||||
<c:if test="${(!fn:containsIgnoreCase(region.configServiceType,'domain')) && (!fn:containsIgnoreCase(region.configServiceType,'url')) }"> keywordSign </c:if>
|
||||
"
|
||||
type="text"
|
||||
name="${cfgName}.cfgKeywords"
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
$(function(){
|
||||
var protectedList = [".com"];
|
||||
$(".domainCheck").each(function(){
|
||||
$(this).on("blur",function(){
|
||||
protectedListWarn(this,$(this).val(),protectedList);
|
||||
});
|
||||
protectedListWarn(this,$(this).val(),protectedList);
|
||||
});
|
||||
|
||||
// var leff =$("span[class~='le-ca-fo']").attr("data-original-title")
|
||||
// getConfigSyncStatus();
|
||||
$("#contentTable").not(".logTb").find("tbody tr").each(function(i){
|
||||
@@ -33,7 +27,32 @@ $(function(){
|
||||
}
|
||||
})
|
||||
|
||||
/** 获取配置保护名单 **/
|
||||
var protectionData;
|
||||
var pathName = window.document.location.pathname.substring(0,window.document.location.pathname.lastIndexOf("/nis")+4);
|
||||
$.ajax({
|
||||
type:'get',
|
||||
url:pathName+'/basics/innerProtectionList/ajaxGetAllInfo',
|
||||
dataType:"json",
|
||||
async:false,
|
||||
success:function(data){
|
||||
if(data != null){
|
||||
protectionData = data;
|
||||
for(var key in data){
|
||||
var list = data[key];
|
||||
$("."+key).each(function(){
|
||||
if(!$(this).hasClass("tags")){
|
||||
this.setAttribute("onblur","protectedListWarn(this,'"+list+"')");
|
||||
}
|
||||
protectedListWarn(this,list);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//增加描述新增时的文字长度限制
|
||||
$("form input[name='cfgDesc']").attr("maxlength","128");
|
||||
@@ -436,8 +455,12 @@ $(function(){
|
||||
});
|
||||
$(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/
|
||||
exprTypeChecked(objNamePrefix,size,options);
|
||||
if($(this).hasClass("urlCheck")){
|
||||
protectedListWarn($("#"+$(this).attr("id")+"_tagsinput"),$(this).val(),protectedList);
|
||||
|
||||
var tagObj = $(this);
|
||||
for(var key in protectionData){
|
||||
if(tagObj.hasClass(key)){
|
||||
protectedListWarn(tagObj,protectionData[key]);
|
||||
}
|
||||
}
|
||||
},
|
||||
onRemoveTag:function(tag,size){
|
||||
@@ -449,8 +472,12 @@ $(function(){
|
||||
});
|
||||
$(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/
|
||||
exprTypeChecked(objNamePrefix,size,options);
|
||||
if($(this).hasClass("urlCheck")){
|
||||
protectedListWarn($("#"+$(this).attr("id")+"_tagsinput"),$(this).val(),protectedList);
|
||||
|
||||
var tagObj = $(this);
|
||||
for(var key in protectionData){
|
||||
if(tagObj.hasClass(key)){
|
||||
protectedListWarn(tagObj,protectionData[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1719,9 +1746,11 @@ function addPrintTableCss(rowValue,cellValue,tableIdValue,cssName){
|
||||
}
|
||||
}
|
||||
/**保护名单提醒**/
|
||||
function protectedListWarn(obj,value,protectedList){
|
||||
function protectedListWarn(obj,protectedList){
|
||||
$(obj).next(".fa-warning").remove();
|
||||
if(value !=null){
|
||||
var value = $(obj).val();
|
||||
if(value != ""){
|
||||
protectedList = typeof(protectedList) == 'string' ? protectedList.split(",") : protectedList;
|
||||
if(protectedList.indexOf(value) >= 0){
|
||||
//$(obj).after("<i class='fa fa-warning font-red-flamingo'>"+$.validator.messages.protect_warn+"</i>");
|
||||
$.jBox.info($.validator.messages.protect_warn,$.validator.messages.info);
|
||||
|
||||
Reference in New Issue
Block a user