(1)IP白名单调整字段
(2)域名白名单配增删改查提交 (3)common.js调整switchIp
This commit is contained in:
@@ -123,5 +123,12 @@ public class BaseStringCfg extends BaseCfg<BaseStringCfg> {
|
||||
public void setCfgKeywordsShowName(String cfgKeywordsShowName) {
|
||||
this.cfgKeywordsShowName = cfgKeywordsShowName;
|
||||
}
|
||||
/**
|
||||
* cfgKeywords
|
||||
* @return cfgKeywords
|
||||
*/
|
||||
|
||||
public String getCfgKeywords() {
|
||||
return cfgKeywords;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ package com.nis.domain.configuration;
|
||||
* @version V1.0
|
||||
*/
|
||||
public class DnsDomainCfg extends ComplexkeywordCfg {
|
||||
private static final String tableName="dns_domain_cfg";
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
@@ -36,4 +37,14 @@ public class DnsDomainCfg extends ComplexkeywordCfg {
|
||||
this.isHexbin=0;
|
||||
this.district="QNAME";
|
||||
}
|
||||
|
||||
/**
|
||||
* tablename
|
||||
* @return tablename
|
||||
*/
|
||||
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ package com.nis.domain.configuration;
|
||||
* @version V1.0
|
||||
*/
|
||||
public class HttpUrlCfg extends BaseStringCfg {
|
||||
private static final String tableName="http_url_cfg";
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
@@ -33,5 +34,13 @@ public class HttpUrlCfg extends BaseStringCfg {
|
||||
this.exprType=0;
|
||||
this.matchMethod=0;
|
||||
}
|
||||
/**
|
||||
* tablename
|
||||
* @return tablename
|
||||
*/
|
||||
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,8 +36,6 @@ public class IpPortCfg extends BaseIpCfg {
|
||||
}
|
||||
public void initDefaultValueImpl(){
|
||||
initDefaultValue();
|
||||
this.portPattern=1;
|
||||
this.port="0/0";
|
||||
}
|
||||
/**
|
||||
* 此表固定写0
|
||||
|
||||
@@ -17,10 +17,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.DnsDomainCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
|
||||
/**
|
||||
* 白名单
|
||||
@@ -33,8 +37,7 @@ public class WhiteListController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"ipList"})
|
||||
@RequiresPermissions(value={"whitelist:config","whitelist:audit"},logical=Logical.OR)
|
||||
public String ipList(Model model,String cfgName,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
public String ipList(Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> searchPage=new Page<BaseIpCfg>(request,response,"r");
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(searchPage, cfg);
|
||||
@@ -42,6 +45,16 @@ public class WhiteListController extends BaseController{
|
||||
initPageCondition(model,cfg);
|
||||
return "/cfg/whitelist/ipList";
|
||||
}
|
||||
@RequestMapping(value = {"domainList"})
|
||||
@RequiresPermissions(value={"whitelist:config","whitelist:audit"},logical=Logical.OR)
|
||||
public String domainList(Model model,@ModelAttribute("cfg")HttpUrlCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
cfg.setTableName(HttpUrlCfg.getTablename());
|
||||
Page<BaseStringCfg> searchPage=new Page<BaseStringCfg>(request,response,"r");
|
||||
Page<BaseStringCfg> page = stringCfgService.findPage(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
return "/cfg/whitelist/domainList";
|
||||
}
|
||||
@RequestMapping(value = {"ipForm"})
|
||||
@RequiresPermissions(value={"whitelist:config"})
|
||||
public String ipForm(Model model,String ids,BaseIpCfg entity) {
|
||||
@@ -60,7 +73,24 @@ public class WhiteListController extends BaseController{
|
||||
|
||||
return "/cfg/whitelist/ipForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"domainForm"})
|
||||
@RequiresPermissions(value={"whitelist:config"})
|
||||
public String domainForm(Model model,String ids,BaseStringCfg entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = stringCfgService.getStringCfgById(HttpUrlCfg.getTablename(),Long.parseLong(ids));
|
||||
}
|
||||
initFormCondition(model,entity);
|
||||
if(entity.getCfgId()!=null){
|
||||
model.addAttribute("_cfg", entity);
|
||||
}else{
|
||||
HttpUrlCfg cfg=new HttpUrlCfg();
|
||||
cfg.initDefaultValue();
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
model.addAttribute("_cfg", cfg);
|
||||
}
|
||||
|
||||
return "/cfg/whitelist/domainForm";
|
||||
}
|
||||
@RequestMapping(value = {"saveOrUpdateIp"})
|
||||
public String saveOrUpdateIp(Model model, IpPortCfg cfg) {
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
@@ -89,7 +119,34 @@ public class WhiteListController extends BaseController{
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ipList?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"saveOrUpdateDomain"})
|
||||
public String saveOrUpdateDomain(Model model, HttpUrlCfg cfg) {
|
||||
cfg.setTableName(HttpUrlCfg.getTablename());
|
||||
logger.info("saveOrUpdateIp loaded");
|
||||
try{
|
||||
if(cfg.getCompileId()==null){
|
||||
int compileId=0;
|
||||
cfg.setCompileId(compileId);
|
||||
}
|
||||
Date date=new Date();
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(cfg.getCfgId()==null){//新增
|
||||
cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
cfg.setCreateTime(date);
|
||||
stringCfgService.addStringCfg((BaseStringCfg)cfg,null);
|
||||
}else{//修改
|
||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setEditTime(new Date());
|
||||
stringCfgService.updateStringCfg((BaseStringCfg)cfg,null,null,null);
|
||||
}
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("保存失败",e);
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domainList?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"deleteIp"})
|
||||
@RequiresPermissions("whitelist:config")
|
||||
@@ -118,6 +175,33 @@ public class WhiteListController extends BaseController{
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ipList?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"deleteDomain"})
|
||||
@RequiresPermissions("whitelist:config")
|
||||
public String deleteDomain(Integer isAudit,Integer isValid,String ids,Integer functionId,Model model) {
|
||||
try{
|
||||
List<BaseStringCfg> cfgs=new ArrayList<BaseStringCfg>();
|
||||
Date date =new Date();
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
for(String idStr:ids.split(",")){
|
||||
if(StringUtils.isNotBlank(idStr)){
|
||||
BaseStringCfg cfg=new BaseStringCfg();
|
||||
cfg.setCfgId(Long.parseLong(idStr));
|
||||
cfg.setTableName(HttpUrlCfg.getTablename());
|
||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setEditTime(date);
|
||||
cfg.setIsValid(Constants.VALID_DEL);
|
||||
cfgs.add(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
stringCfgService.deleteBatch(cfgs, StringCfgDao.class);
|
||||
addMessage(model,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domainList?functionId="+functionId;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getCompileId(获取编译ID)
|
||||
|
||||
@@ -29,33 +29,7 @@
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="BaseStringMapWithUser" type="com.nis.domain.configuration.BaseStringCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
|
||||
<result column="classify" property="classify" jdbcType="VARCHAR" />
|
||||
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
|
||||
<result column="lable" property="lable" jdbcType="VARCHAR" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
|
||||
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
|
||||
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
|
||||
<resultMap id="BaseStringMapWithUser" type="com.nis.domain.configuration.BaseStringCfg" extends="BaseStringMap">
|
||||
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
|
||||
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
|
||||
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
|
||||
@@ -65,7 +39,7 @@
|
||||
CFG_ID, CFG_DESC, CFG_KEYWORDS,ACTION,IS_VALID,IS_AUDIT,
|
||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,FUNCTION_ID
|
||||
</sql>
|
||||
<!-- <sql id="BaseStringCfg_Column_List_with_id_alias" >
|
||||
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc, r.CFG_KEYWORDS as cfgKeywords, r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
|
||||
@@ -80,14 +54,14 @@
|
||||
${page.alias}.CFG_ID as cfgId, ${page.alias}.CFG_DESC as cfgDesc, ${page.alias}.CFG_KEYWORDS as cfgKeywords,${page.alias}.ACTION as action,${page.alias}.IS_VALID as isValid,${page.alias}.IS_AUDIT as isAudit,
|
||||
${page.alias}.CREATOR_ID as creatorId,${page.alias}.CREATE_TIME AS createTime,${page.alias}.EDITOR_ID as editorId,${page.alias}.EDIT_TIME AS editTime,${page.alias}.AUDITOR_ID as auditorId,${page.alias}.AUDIT_TIME AS auditTime,
|
||||
${page.alias}.SERVICE_ID as serviceId,${page.alias}.REQUEST_ID AS requestId,${page.alias}.COMPILE_ID AS compileId,${page.alias}.IS_AREA_EFFECTIVE as isAreaEffective,${page.alias}.classify,
|
||||
${page.alias}.ATTRIBUTE AS attribute,${page.alias}.LABLE AS lable,${page.alias}.AREA_EFFECTIVE_IDS AS areaEffectiveIds
|
||||
${page.alias}.ATTRIBUTE AS attribute,${page.alias}.LABLE AS lable,${page.alias}.AREA_EFFECTIVE_IDS AS areaEffectiveIds,${page.alias}.FUNCTION_ID AS functionId
|
||||
</when>
|
||||
<otherwise>
|
||||
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc, r.CFG_KEYWORDS as cfgKeywords, r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
|
||||
r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime,
|
||||
r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify,
|
||||
r.ATTRIBUTE AS attribute,r.LABLE AS lable,r.EXPR_TYPE as exprType,r.MATCH_METHOD as matchMethod,r.IS_HEXBIN as isHexbin,
|
||||
r.AREA_EFFECTIVE_IDS AS areaEffectiveIds
|
||||
r.AREA_EFFECTIVE_IDS AS areaEffectiveIds,r.FUNCTION_ID AS functionId
|
||||
</otherwise>
|
||||
</choose>
|
||||
</sql>
|
||||
@@ -95,7 +69,7 @@
|
||||
CFG_DESC, CFG_KEYWORDS, ACTION,IS_VALID,IS_AUDIT,
|
||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||
ATTRIBUTE,LABLE,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,AREA_EFFECTIVE_IDS
|
||||
ATTRIBUTE,LABLE,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,AREA_EFFECTIVE_IDS,FUNCTION_ID
|
||||
</sql>
|
||||
<sql id="BaseStringCfg_Value_List" >
|
||||
#{cfgDesc,jdbcType=VARCHAR},#{cfgKeywords,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
|
||||
@@ -105,7 +79,7 @@
|
||||
#{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
|
||||
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR}
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER}
|
||||
</sql>
|
||||
<select id="getById" resultMap="BaseStringMap" parameterType="java.lang.Long" >
|
||||
SELECT
|
||||
@@ -145,9 +119,6 @@
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
left join sys_user u on r.auditor_id=u.id
|
||||
left join request_info ri on r.request_id=ri.id
|
||||
left join service_dict_info sdic on r.classify=sdic.item_code and sdic.item_type=1 and sdic.is_leaf=0
|
||||
left join service_dict_info sdia on r.attribute=sdia.item_code and sdia.item_type=2 and sdia.is_leaf=0
|
||||
left join service_dict_info sdil on r.lable=sdil.item_code and sdil.item_type=3 and sdil.is_leaf=0
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
@@ -226,6 +197,9 @@
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
|
||||
AND ${page.alias}.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND ${page.alias}.FUNCTION_ID =#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="cfgId != null">
|
||||
@@ -300,6 +274,9 @@
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
|
||||
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.FUNCTION_ID =#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</trim>
|
||||
@@ -417,6 +394,9 @@
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null" >
|
||||
function_id = #{functionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
|
||||
@@ -130,6 +130,9 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
public ComplexkeywordCfg getStringCfgById(ComplexkeywordCfg cfg){
|
||||
return complexStringCfgDao.getById(cfg.getTableName(),cfg.getCfgId());
|
||||
}
|
||||
public ComplexkeywordCfg getStringCfgById(String tableName,long id){
|
||||
return complexStringCfgDao.getById(tableName,id);
|
||||
}
|
||||
public Integer getIsValid(ComplexkeywordCfg cfg){
|
||||
return complexStringCfgDao.getIsValid(cfg);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,9 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
public BaseStringCfg getStringCfgById(BaseStringCfg baseStringCfg){
|
||||
return stringCfgDao.getById(baseStringCfg.getTableName(), baseStringCfg.getCfgId());
|
||||
}
|
||||
public BaseStringCfg getStringCfgById(String tableName, long id){
|
||||
return stringCfgDao.getById(tableName, id);
|
||||
}
|
||||
public Integer getIsValid(BaseStringCfg baseStringCfg){
|
||||
return stringCfgDao.getIsValid(baseStringCfg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user