dnat复用策略提交.

This commit is contained in:
zhangwq
2018-12-07 19:47:37 +08:00
parent 47187a4974
commit b90c43b073
12 changed files with 1538 additions and 28 deletions

View File

@@ -0,0 +1,133 @@
package com.nis.domain.configuration;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.util.Constants;
/**
* IP复用DNAT策略实体
* @author dell
*
*/
public class IpReuseDnatPolicyCfg extends IpPortCfg{
private static final long serialVersionUID = 3965263675989864475L;
private String indexTable="ip_reuse_dnat_policy";
@Expose
@SerializedName("configId")
private Long cfgId;
@Expose
@SerializedName("originalAddrType")
private Integer ipType;
@Expose
@SerializedName("originalDestIp")
private String srcIpAddress;
@Expose
@SerializedName("originalDestPort")
private String srcPort;
@Expose
@SerializedName("originalProtocol")
private Integer protocol;
@Expose
@SerializedName("translatedDestIp")
private String destIpAddress;
@Expose
@SerializedName("translatedDestPort")
private String destPort;
@Expose
private Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
@Expose
@SerializedName("effectiveRange")
private String areaEffectiveIds;
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public Integer getIpType() {
return ipType;
}
public void setIpType(Integer ipType) {
this.ipType = ipType;
}
public Integer getProtocol() {
return protocol;
}
public void setProtocol(Integer protocol) {
this.protocol = protocol;
}
public Long getCfgId() {
return cfgId;
}
public void setCfgId(Long cfgId) {
this.cfgId = cfgId;
}
public String getSrcIpAddress() {
return srcIpAddress;
}
public void setSrcIpAddress(String srcIpAddress) {
this.srcIpAddress = srcIpAddress;
}
public String getSrcPort() {
return srcPort;
}
public void setSrcPort(String srcPort) {
this.srcPort = srcPort;
}
public String getDestIpAddress() {
return destIpAddress;
}
public void setDestIpAddress(String destIpAddress) {
this.destIpAddress = destIpAddress;
}
public String getDestPort() {
return destPort;
}
public void setDestPort(String destPort) {
this.destPort = destPort;
}
public Integer getDoLog() {
return doLog;
}
public void setDoLog(Integer doLog) {
this.doLog = doLog;
}
public String getAreaEffectiveIds() {
return areaEffectiveIds;
}
public void setAreaEffectiveIds(String areaEffectiveIds) {
this.areaEffectiveIds = areaEffectiveIds;
}
}

View File

@@ -33,6 +33,7 @@ import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.IpAddrPoolCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.IpReuseDnatPolicyCfg;
import com.nis.domain.configuration.IpReusePolicyCfg;
import com.nis.domain.configuration.UserManage;
import com.nis.domain.configuration.template.IpMultiplexPolicyTemplate;
@@ -280,42 +281,95 @@ public class IpMultiplexController extends CommonController {
@RequestMapping(value = {"/dnatPolicyList"})
public String dnatPolicyList(String cfgName,Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
this._ipList(cfgName,model, cfg, request, response);
return "/cfg/manipulation/ipmulitiplex/dnatPolicyList";
public String dnatPolicyList(String cfgName,Model model,@ModelAttribute("cfg")IpReuseDnatPolicyCfg cfg,
HttpServletRequest request,HttpServletResponse response) {
//this._ipList(cfgName,model, cfg, request, response);
Page<BaseIpCfg> page = ipMultiplexService.findPageDnat(new Page<BaseIpCfg>(request, response,"r"), cfg);
model.addAttribute("page", page);
initFormCondition(model,cfg);
return "/cfg/manipulation/ipmulitiplex/dnatPolicyList2";
}
@RequestMapping(value = {"/dnatPolicyForm"})
@RequiresPermissions(value={"dnat_policy:config"})
public String dnatPolicyForm(String cfgName,Model model,String ids,Integer functionId,BaseIpCfg entity) {
this._ipForm(cfgName,model, ids, functionId, entity);
// 获取拥有区域信息的策略分组
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.getHasAreaPolicyGroups(3);
model.addAttribute("policyGroups", policyGroups);
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
return "/cfg/manipulation/ipmulitiplex/dnatPolicyForm";
public String dnatPolicyForm(String cfgName,Model model,String ids,Integer functionId,IpReuseDnatPolicyCfg cfg) {
//this._ipForm(cfgName,model, ids, functionId, entity);
if(cfg == null){
cfg=new IpReuseDnatPolicyCfg();
}
if(!StringUtil.isEmpty(ids)){
cfg = ipMultiplexService.getDnatPolicyCfg(Long.valueOf(ids),null);
initUpdateFormCondition(model, cfg);
}else{
initFormCondition(model, cfg);
}
model.addAttribute("_cfg", cfg);
return "/cfg/manipulation/ipmulitiplex/dnatPolicyForm2";
}
@RequestMapping(value = {"/saveOrUpdateDnat"})
public String saveOrUpdateDnat(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
// 设置生效区域信息
groupAreaService.setAreaCodeByGroupId(cfg);
this._saveOrUpdateIp(cfgName,model, cfg);
public String saveOrUpdateDnat(Model model, RedirectAttributes redirectAttributes, IpReuseDnatPolicyCfg cfg,
HttpServletRequest request,HttpServletResponse response) {
try{
// 添加策略配置信息
ipMultiplexService.saveOrUpdateDnat(cfg, request, response);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e) {
e.printStackTrace();
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "save_failed");
}
}
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/dnatDelete"})
@RequiresPermissions("dnat_policy:config")
public String dnatDelete(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
this._deleteIp(cfgName,ids, compileIds, functionId, model);
public String dnatDelete(String ids, Integer isValid, Integer functionId,RedirectAttributes redirectAttributes) {
//this._deleteIp(cfgName,ids, compileIds, functionId, model);
try{
if(!StringUtil.isEmpty(ids)){
ipMultiplexService.deleteDnat(isValid,ids,functionId);
}
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error(e);
addMessage(redirectAttributes,"error","delete_failed");
}
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+functionId;
}
@RequestMapping(value = {"/auditDnat"})
@RequiresPermissions("dnat_policy:confirm")
public String auditDnat(String cfgName,String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
this._auditIp(cfgName,ids, cfg, redirectAttributes);
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+cfg.getFunctionId();
public String auditDnat(String ids,Integer isAudit,Integer isValid,Integer functionId,RedirectAttributes redirectAttributes) {
//this._auditIp(cfgName,ids, cfg, redirectAttributes);
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
Date auditTime=new Date();
for(String id :idArray){
try {
ipMultiplexService.auditDnatPolicy(isAudit,isValid,functionId,id,auditTime);
} catch (Exception e) {
e.printStackTrace();
logger.error("DNAT策略配置下发失败"+e.getMessage());
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
}
}
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+functionId;
}
//snat配置导出

View File

@@ -4,6 +4,8 @@ import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.IpReuseDnatPolicyCfg;
import com.nis.domain.configuration.IpReusePolicyCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@@ -24,7 +26,19 @@ public interface IpMultiplexDao extends CrudDao<IpMultiplexDao>{
// 校验地址池是否被引用
List<IpReusePolicyCfg> checkAddrPoolIsUsed(@Param("addrPoolId")String addrPoolId);
// SNAT策略更新审核状态
void updatePolicyAuditStatus(IpReusePolicyCfg cfg);
// DNAT策略更新审核状态
void updateDnatPolicyStatus(IpReuseDnatPolicyCfg cfg);
void saveDnatPolicyCfg(IpReuseDnatPolicyCfg entity);
void updateDnatPolicyCfg(IpReuseDnatPolicyCfg entity);
List<BaseIpCfg> findPageDnat(IpReuseDnatPolicyCfg entity);
List<IpReuseDnatPolicyCfg> findDnatList(@Param("cfgId")Long cfgId, @Param("isValid")Integer isValid);
}

View File

@@ -40,6 +40,41 @@
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="dnatPolicyMap" type="com.nis.domain.configuration.IpReuseDnatPolicyCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="translated_dest_ip" property="destIpAddress" jdbcType="VARCHAR" />
<result column="original_dest_ip" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="translated_dest_port" property="destPort" jdbcType="VARCHAR" />
<result column="original_dest_port" property="srcPort" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
<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="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<sql id="policyColumns">
r.CFG_ID,r.CFG_DESC,r.ADDR_POOL_ID,r.USER_NAME,r.USER_TYPE,r.IP_TYPE,r.IP_PATTERN,r.SRC_IP_ADDRESS,
r.ACTION,r.DO_LOG,r.IS_VALID,r.IS_AUDIT,r.CFG_REGION_CODE,r.CFG_TYPE,r.FUNCTION_ID,
@@ -49,6 +84,15 @@
r.USER_REGION1,r.USER_REGION2,r.USER_REGION3,r.USER_REGION4,r.USER_REGION5
</sql>
<sql id="dnatPolicyColumns" >
a.cfg_id,a.cfg_desc,a.ip_type,a.original_dest_ip,a.ip_pattern,a.port_pattern,a.original_dest_port,
a.protocol,a.protocol_id,a.cfg_type,a.action,a.translated_dest_port,a.translated_dest_ip,a.is_valid,
a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time,a.auditor_id,a.audit_time,
a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
a.area_effective_ids,a.function_id,a.cfg_region_code,a.user_region1,a.user_region2,
a.user_region3,a.user_region4,a.user_region5
</sql>
<select id="findPage" resultMap="policyMap">
SELECT
<include refid="policyColumns"/>
@@ -75,7 +119,10 @@
<if test="cfgId != null">
AND r.cfg_id=#{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId != null">
<if test="cfgDesc != null and cfgDesc != ''">
AND r.cfg_desc like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="compileId != null">
AND r.compile_id=#{compileId,jdbcType=BIGINT}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
@@ -94,10 +141,7 @@
</where>
)
</if>
<if test="compileId != null">
AND r.compile_id=#{compileId,jdbcType=BIGINT}
</if>
<if test="action != null">
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
@@ -362,4 +406,307 @@
WHERE
r.addr_pool_id = #{addrPoolId} AND r.is_valid != -1
</select>
<update id="updateDnatPolicyStatus" parameterType="com.nis.domain.configuration.IpReuseDnatPolicyCfg">
update ip_reuse_dnat_policy
<set>
<trim suffixOverrides=",">
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="auditorId != null" >
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and createTime != ''" >
audit_time = #{auditTime,jdbcType=TIMESTAMP},
</if>
</trim>
</set>
WHERE cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<insert id="saveDnatPolicyCfg" parameterType="com.nis.domain.configuration.IpReuseDnatPolicyCfg">
INSERT INTO ip_reuse_dnat_policy (
cfg_desc,
ip_type,
ip_pattern,
port_pattern,
original_dest_ip,
original_dest_port,
translated_dest_ip,
translated_dest_port,
protocol,
protocol_id,
is_valid,
is_audit,
do_log,
action,
service_id,
function_id,
compile_id,
is_area_effective,
area_effective_ids,
creator_id,
create_time,
editor_id,
edit_time,
auditor_id,
audit_time,
request_id,
classify,
attribute,
lable,
cfg_region_code,
cfg_type,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)VALUES (
#{cfgDesc,jdbcType=VARCHAR},
#{ipType,jdbcType=INTEGER},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{srcPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{destPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{doLog,jdbcType=INTEGER},
#{action,jdbcType=INTEGER},
#{serviceId,jdbcType=INTEGER},
#{functionId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{requestId,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<update id="updateDnatPolicyCfg" parameterType="com.nis.domain.configuration.IpReuseDnatPolicyCfg">
update ip_reuse_dnat_policy
<set>
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="ipType != null" >
ip_type = #{ipType,jdbcType=INTEGER},
</if>
<if test="ipPattern != null">
ip_pattern=#{ipPattern,jdbcType=INTEGER},
</if>
<if test="portPattern != null">
port_pattern=#{portPattern,jdbcType=INTEGER},
</if>
<if test="srcIpAddress != null">
original_dest_ip=#{srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="destIpAddress != null and destIpAddress != ''">
translated_dest_ip=#{destIpAddress,jdbcType=VARCHAR},
</if>
<if test="srcPort != null and srcPort !=''">
original_dest_port=#{srcPort,jdbcType=VARCHAR},
</if>
<if test="destPort != null and destPort !=''">
translated_dest_port=#{destPort,jdbcType=VARCHAR},
</if>
<if test="protocol != null" >
protocol = #{protocol,jdbcType=INTEGER},
</if>
<if test="protocolId != null" >
protocol_id = #{protocolId,jdbcType=INTEGER},
</if>
<if test="doLog != null" >
do_log = #{doLog,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and createTime != ''" >
audit_time = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
</trim>
</set>
WHERE cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<select id="findPageDnat" resultMap="dnatPolicyMap">
SELECT
<include refid="dnatPolicyColumns"/>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,
e.name as editor_name,
u.name as auditor_name,
ri.request_title as requestName
</trim>
FROM
ip_reuse_dnat_policy a
left join
sys_user s on a.creator_id = s.id
left join
sys_user e on a.editor_id = e.id
left join
sys_user u on a.auditor_id = u.id
left join
request_info ri on a.request_id = ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.cfg_id=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.cfg_desc like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="compileId != null">
AND a.compile_id=#{compileId,jdbcType=BIGINT}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND a.original_dest_ip=#{srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="destIpAddress != null and destIpAddress != ''">
AND a.translated_dest_ip=#{destIpAddress,jdbcType=VARCHAR}
</if>
<if test="srcPort != null and srcPort !=''">
AND a.original_dest_port=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="destPort != null and destPort !=''">
AND a.translated_dest_port=#{destPort,jdbcType=VARCHAR}
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND a.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND a.AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.cfg_id DESC
</otherwise>
</choose>
</select>
<!-- 获取数据跳转表单 -->
<select id="findDnatList" resultMap="dnatPolicyMap">
SELECT
<include refid="dnatPolicyColumns"/>
FROM
ip_reuse_dnat_policy a
<where>
<if test="cfgId != null">
AND a.cfg_id=#{cfgId,jdbcType=BIGINT}
</if>
<if test="isValid !=null">
AND a.is_valid = #{isValid,jdbcType=INTEGER}
</if>
<if test="isValid ==null">
AND a.is_valid != -1
</if>
</where>
ORDER BY a.cfg_id
</select>
</mapper>

View File

@@ -8,12 +8,15 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.Page;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.IpReuseDnatPolicyCfg;
import com.nis.domain.configuration.IpReusePolicyCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
@@ -201,4 +204,134 @@ public class IpMultiplexService extends BaseService{
return ipMultiplexDao.checkAddrPoolIsUsed(addrPoolId);
}
/**
* DNAT策略配置审核
* @param isAudit
* @param isValid
* @param functionId
* @param id
* @param auditTime
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void auditDnatPolicy(Integer isAudit, Integer isValid, Integer functionId, String id, Date auditTime) {
// 更新配置审核状态
IpReuseDnatPolicyCfg cfg = new IpReuseDnatPolicyCfg();
cfg.setCfgId(Long.valueOf(id));
cfg.setIsValid(isValid);
cfg.setIsAudit(isAudit);
cfg.setAuditorId(UserUtils.getUser().getId());
cfg.setAuditTime(auditTime);
ipMultiplexDao.updateDnatPolicyStatus(cfg);
// 获取配置信息
cfg = this.getDnatPolicyCfg(cfg.getCfgId(), null);
SysDictInfoService sysDictInfoService = SpringContextHolder.getBean(SysDictInfoService.class);
cfg.setAreaEffectiveIds(cfg.getIsAreaEffective() == 1?sysDictInfoService.setEffectiveRange(cfg.getAreaEffectiveIds()):"0");
String json="";
if(cfg.getIsAudit() == Constants.AUDIT_YES){
List list = Lists.newArrayList();
list.add(cfg);
json=gsonToJson(list);
logger.info("DNAT策略配置下发参数"+json);
//调用服务接口下发配置
try {
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
if(result!=null){
logger.info("DNAT策略配置下发响应信息"+result.getMsg());
}
} catch (Exception e) {
logger.error("DNAT策略配置下发失败",e);
throw e;
}
}else if(cfg.getIsAudit() == Constants.AUDIT_NOT_YES){
List list = Lists.newArrayList();
list.add(cfg);
json=gsonToJson(list);
logger.info("DNAT策略配置下发参数"+json);
//调用服务接口取消配置
try {
ToMaatResult result = ConfigServiceUtil.put(json, 2);
logger.info("DNAT策略配置响应信息"+result.getMsg());
} catch (Exception e) {
e.printStackTrace();
logger.info("DNAT策略配置配置失败");
throw e;
}
}
}
/**
* DNAT策略新增
* @param entity
* @param request
* @param response
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdateDnat(IpReuseDnatPolicyCfg entity, HttpServletRequest request, HttpServletResponse response) {
Date time = new Date();
entity.setIsValid(0);
entity.setIsAudit(0);
setAreaEffectiveIds(entity);
if(entity.getCfgId() == null){
entity.initDefaultValue();
entity.setCreateTime(time);
entity.setCreatorId(UserUtils.getUser().getId());
//调用服务接口获取compileId
try {
List<Integer> compileIds = ConfigServiceUtil.getId(1,1);
if(compileIds != null && compileIds.size() > 0 ){
entity.setCompileId(compileIds.get(0));
}
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
ipMultiplexDao.saveDnatPolicyCfg(entity);
}else{
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(time);
ipMultiplexDao.updateDnatPolicyCfg(entity);
}
}
public Page<BaseIpCfg> findPageDnat(Page<BaseIpCfg> page, IpReuseDnatPolicyCfg entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
entity.setPage(page);
List<BaseIpCfg> list=ipMultiplexDao.findPageDnat(entity);
page.setList(list);
return page;
}
public IpReuseDnatPolicyCfg getDnatPolicyCfg(Long cfgId, Integer isValid) {
List<IpReuseDnatPolicyCfg> list=ipMultiplexDao.findDnatList(cfgId,isValid);
IpReuseDnatPolicyCfg policyCfg=null;
if(list != null && list.size()>0){
policyCfg=list.get(0);
}
return policyCfg;
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void deleteDnat(Integer isValid, String ids, Integer functionId) {
String[] idArray = ids.split(",");
for(String id :idArray){
IpReuseDnatPolicyCfg entity = new IpReuseDnatPolicyCfg();
entity.setCfgId(Long.valueOf(id));
entity.setFunctionId(functionId);
entity.setIsValid(isValid);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
ipMultiplexDao.updateDnatPolicyCfg(entity);
}
}
}

View File

@@ -1348,4 +1348,8 @@ creat_time=Creat Time
close_time=Close Time
nat_ip=Multiplexed IP Address
traffic=Traffic
ip_info=IP Info
ip_info=IP Info
original_dest_ip=Original destination address
original_dest_port=Original destination port
translated_dest_ip=Post-translational destination address
translated_dest_port=Post-translational destination port

View File

@@ -1349,4 +1349,8 @@ policy_vpn_user=VPN access user name
policy_sipv4_user=Three tier access to IP(IPv4)
policy_sipv6_user=Three tier access to IP(IPv6)
traffic=\u0422\u0440\u0430\u0444\u0438\u043A
ip_info=IP Info
ip_info=IP Info
original_dest_ip=Original destination address
original_dest_port=Original destination port
translated_dest_ip=Post-translational destination address
translated_dest_port=Post-translational destination port

View File

@@ -1346,4 +1346,8 @@ creat_time=\u94FE\u63A5\u5EFA\u7ACB\u65F6\u95F4
close_time=\u94FE\u63A5\u7ED3\u675F\u65F6\u95F4
nat_ip=\u590D\u7528\u7684IP\u5730\u5740
traffic=Traffic
ip_info=IP\u5730\u5740\u4FE1\u606F
ip_info=IP\u5730\u5740\u4FE1\u606F
original_dest_ip=\u539F\u59CB\u76EE\u7684\u5730\u5740
original_dest_port=\u539F\u59CB\u76EE\u7684\u7AEF\u53E3
translated_dest_ip=\u7FFB\u8BD1\u540E\u76EE\u7684\u5730\u5740
translated_dest_port=\u7FFB\u8BD1\u540E\u76EE\u7684\u7AEF\u53E3

View File

@@ -0,0 +1,45 @@
-- ----------------------------
-- Table structure for ip_reuse_dnat_policy
-- ----------------------------
DROP TABLE IF EXISTS `ip_reuse_dnat_policy`;
CREATE TABLE `ip_reuse_dnat_policy` (
`cfg_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键,自增',
`cfg_desc` varchar(128) DEFAULT NULL,
`ip_type` int(11) NOT NULL COMMENT 'IPV4=4,IPV6=6',
`ip_pattern` int(11) NOT NULL,
`port_pattern` int(11) NOT NULL,
`original_dest_ip` varchar(128) NOT NULL,
`original_dest_port` varchar(16) NOT NULL,
`translated_dest_ip` varchar(128) NOT NULL,
`translated_dest_port` varchar(16) NOT NULL,
`protocol` int(11) NOT NULL,
`protocol_id` int(11) NOT NULL COMMENT '非0时maat规范需写入通用IP配置表与通用协议类型配置表 此表固定写0',
`is_valid` int(11) NOT NULL COMMENT '0无效1有效-1删除\r\n1 未审核时配置可删除\r\n2 审核通过此字段置1\r\n3 取消审核通过此字段置0',
`is_audit` int(11) NOT NULL COMMENT '0未审核1审核通过2审核未通过3取消审核通过\r\n1 审核未通过,配置可修改\r\n2 审核通过,配置不可删除,只能取消审核通过',
`do_log` int(11) DEFAULT NULL COMMENT '是否记录结构化日志1是 2否',
`action` int(11) NOT NULL COMMENT '1:阻断2监测 5 FD 白名单6监测白名单7: FD 监测都白名单应与业务ID所代表的逻辑相匹配8-灰名单',
`service_id` int(11) NOT NULL COMMENT '参考系统业务类型管理表',
`function_id` int(11) NOT NULL,
`compile_id` int(11) NOT NULL COMMENT '取自服务接口返回的maat配置的编译id配置初始入库时获取。',
`is_area_effective` int(11) NOT NULL COMMENT '0否1是',
`area_effective_ids` varchar(1024) DEFAULT NULL,
`creator_id` int(11) NOT NULL COMMENT '取自sys_user.id',
`create_time` datetime NOT NULL,
`editor_id` int(11) DEFAULT NULL COMMENT '取自sys_user.id',
`edit_time` datetime DEFAULT NULL,
`auditor_id` int(11) DEFAULT NULL COMMENT '取自sys_user.id',
`audit_time` datetime DEFAULT NULL,
`request_id` int(11) NOT NULL COMMENT '取自request_info.id',
`classify` varchar(128) DEFAULT NULL COMMENT '分类id多个用英文逗号分隔',
`attribute` varchar(128) DEFAULT NULL COMMENT '性质id多个用英文逗号分隔',
`lable` varchar(128) DEFAULT NULL COMMENT '标签id,多个用英文逗号分隔',
`cfg_region_code` int(11) DEFAULT NULL,
`cfg_type` varchar(64) DEFAULT NULL,
`user_region1` varchar(1024) DEFAULT NULL COMMENT '预留自定义域1',
`user_region2` varchar(1024) DEFAULT NULL COMMENT '预留自定义域2',
`user_region3` varchar(1024) DEFAULT NULL COMMENT '预留自定义域3',
`user_region4` varchar(1024) DEFAULT NULL COMMENT '预留自定义域4',
`user_region5` varchar(1024) DEFAULT NULL COMMENT '预留自定义域5',
`cancel_request_id` int(11) DEFAULT NULL COMMENT '取消审核来函',
PRIMARY KEY (`cfg_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;

View File

@@ -0,0 +1,8 @@
UPDATE
function_region_dict
SET
config_ip_port_show = '1,2,3,4',
config_ip_pattern = '3',
config_port_pattern = '1'
WHERE
dict_id = 232 AND function_id = 304;

View File

@@ -0,0 +1,312 @@
<%@ 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(){
if('${fn:length(serviceList)}'>1){
$("#serviceId").val($(".action:checked").attr("serviceId"));
$("#protocolId").val($(".action:checked").attr("protocolId"));
}
$(".action").on("change", function() {
$("#serviceId").val($(this).attr("serviceId"));
$("#protocolId").val($(this).attr("protocolId"));
});
$("#ipCfgFrom").validate({
errorPlacement: function(error,element){
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
},
submitHandler: function(form){
loading('<spring:message code="onloading"/>');
form.submit();
},
errorContainer: "#messageBox"
});
});
</script>
</head>
<body>
<div class="page-content">
<h3 class="page-title">
<spring:message code="${_cfg.menuNameCode }"></spring:message>
</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.cfgId}"><spring:message code="add"></spring:message></c:if>
<c:if test="${not empty _cfg.cfgId}"><spring:message code="edit"></spring:message></c:if>
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form id="ipCfgFrom" action="${ctx}/manipulation/ipmulitiplex/saveOrUpdateDnat" method="post" class="form-horizontal">
<div class="form-body row">
<input name="cfgName" type="hidden" value="${cfgName}"/>
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
<input type="hidden" name="compileId" value="${_cfg.compileId}">
<input type="hidden" name="functionId" value="${_cfg.functionId}">
<input name="isAreaEffective" type="hidden" value="0">
<c:if test="${fn:length(serviceList)==1}">
<c:forEach items="${serviceList}" var="service">
<input type="hidden" name="action" serviceId="${service.serviceId }" protocolId="${service.protocolId }" regionCode="${service.regionCode}" value="${service.action }">
<input type="hidden" id="protocolId" name="protocolId" value="${service.protocolId}">
<input type="hidden" id="serviceId" name="serviceId" value="${service.serviceId}">
</c:forEach>
</c:if>
<c:if test="${fn:length(serviceList)>1}">
<input type="hidden" id="protocolId" name="protocolId" value="${_cfg.protocolId}">
<input type="hidden" id="serviceId" name="serviceId" value="${_cfg.serviceId}">
</c:if>
<!-- 配置域类型 -->
<c:forEach items="${regionList}" var="region">
<input type="hidden" name="${cfgName}.configServiceType" value="${region.configServiceType}">
<input type="hidden" id="cfgType${region.configRegionCode}" name="cfgType" value="${region.configRegionValue}">
<input type="hidden" id="cfgRegionCode${region.configRegionCode}" name="cfgRegionCode"
isMaat="${region.isMaat}"
serviceType="${region.configServiceType}"
ipPortShow="${region.configIpPortShow}"
ipType="${region.configIpType}"
ipPattern="${region.configIpPattern}"
portPattern="${region.configPortPattern}"
direction="${region.configDirection}"
protocol="${region.configProtocol}"
regionType="${region.regionType}"
value="${region.configRegionCode}">
</c:forEach>
<div class="form-body">
<!-- desc and action -->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="config_describe"/></label>
<div class="col-md-6">
<input class="form-control" type="text" name="cfgDesc" value="${_cfg.cfgDesc}">
</div>
</div>
</div>
<c:if test="${fn:length(serviceList)>1}">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="action"/></label>
<div class="col-md-6">
<c:forEach items="${serviceList}" var="service"
varStatus="satus">
<label class="radio-inline"> <c:if
test="${_cfg.functionId eq service.functionId}">
<input type="radio" name="action"
serviceId="${service.serviceId }"
protocolId="${service.protocolId }"
regionCode="${service.regionCode }"
value="${service.action }" class="required action"
<c:if test="${_cfg.action==service.action || (_cfg.action==null && satus.index==0)}">checked</c:if>>
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
<c:if test="${dict.itemCode eq service.action }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</c:if>
</label>
</c:forEach>
</div>
<div for="action"></div>
</div>
</div>
</c:if>
</div>
<div class="row ipInfo">
<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="ip_type"/></label>
<div class="col-md-6">
<select name="ipType" class="selectpicker show-tick form-control required">
<c:forEach items="${fns:getDictList('IP_TYPE')}" var="ipTypeC">
<option value="${ipTypeC.itemCode}"
<c:if test="${_cfg.ipType==ipTypeC.itemCode
|| (_cfg.ipType==null && ipTypeC.itemCode==4)}">
selected
</c:if>
>
<spring:message code="${ipTypeC.itemValue}"/>
</option>
</c:forEach>
</select>
</div>
<div for="ipType"></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="protocol" /></label>
<div class="col-md-6">
<select name="protocol" class="selectpicker show-tick form-control required">
<c:forEach items="${fns:getDictList('PROTOCOL')}" var="protocolC">
<option value="${protocolC.itemCode}" <c:if test="${_cfg.protocol==protocolC.itemCode || (_cfg.protocol==null && protocolC.itemCode==0)}">selected</c:if>><spring:message code="${protocolC.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="protocol"></div>
</div>
</div>
</div>
<div class="row ip">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ip_pattern"/></label>
<div class="col-md-6">
<select name="ipPattern" class="selectpicker show-tick form-control required">
<c:forEach items="${fns:getDictList('IP_PATTERN')}" var="ipPatternC">
<option value="${ipPatternC.itemCode}" <c:if test="${_cfg.ipPattern==ipPatternC.itemCode || (_cfg.ipPattern==null && ipPatternC.itemCode==3)}">selected</c:if>><spring:message code="${ipPatternC.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="ipPattern"></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="port_pattern"/></label>
<div class="col-md-6">
<select name="portPattern" class="selectpicker show-tick form-control required">
<c:forEach items="${fns:getDictList('PORT_PATTERN')}" var="portPatternC">
<option value="${portPatternC.itemCode}" <c:if test="${_cfg.portPattern==portPatternC.itemCode || (_cfg.portPattern==null && portPatternC.itemCode==1)}">selected</c:if>><spring:message code="${portPatternC.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="portPattern"></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="original_dest_ip"/></label>
<div class="col-md-6">
<input class="form-control required ipCheck" type="text" name="srcIpAddress" value="${_cfg.srcIpAddress}">
</div>
<div for="srcIpAddress"></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="original_dest_port"/></label>
<div class="col-md-6">
<input class="form-control required portCheck" type="text" name="srcPort" value="${_cfg.srcPort}">
</div>
<div for="srcPort"></div>
</div>
</div>
</div>
<div class="row port">
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="translated_dest_ip"/></label>
<div class="col-md-6">
<input class="form-control required ipCheck" type="text" name="destIpAddress" value="${_cfg.destIpAddress}">
</div>
<div for="destIpAddress"></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="translated_dest_port"/></label>
<div class="col-md-6">
<input class="form-control required portCheck" type="text" name="destPort" value="${_cfg.destPort}">
</div>
<div for="destPort"></div>
</div>
</div>
</div>
<%-- <div class="row destPort">
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_ip"/></label>
<div class="col-md-6">
<input class="form-control required ipCheck" type="text" name="destIpAddress" value="${_cfg.destIpAddress}">
</div>
<div for="destIpAddress"></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="server_port"/></label>
<div class="col-md-6">
<input class="form-control required portCheck" type="text" name="destPort" value="${_cfg.destPort}">
</div>
<div for="destPort"></div>
</div>
</div>
</div> --%>
<div class="row protocol">
<div class="col-md-6">
<div class="form-group hidden">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="direction" /></label>
<div class="col-md-6">
<select name="direction" class="selectpicker show-tick form-control required">
<c:forEach items="${fns:getDictList('DIRECTION')}" var="directionC">
<option value="${directionC.itemCode}"><spring:message code="${directionC.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="direction"></div>
</div>
</div>
</div>
<br>
</div>
<div class="row ipmulitiplex">
<div class="col-md-6 hidden">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ir_type"/></label>
<div class="col-md-6">
<select name="irType" class="selectpicker show-tick form-control required">
<option value=""><spring:message code="select"/></option>
<c:forEach items="${fns:getDictList('IR_TYPE')}" var="irTypeC">
<option value="${irTypeC.itemCode}" <c:if test="${1==irTypeC.itemCode}">selected</c:if>><spring:message code="${irTypeC.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="irType"></div>
</div>
</div>
</div>
<div class="row ratelimit hidden">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ratelimit"/></label>
<div class="col-md-6">
<input class="form-control required number" range="[0,100]" type="text" name="ratelimit" value="${_cfg.ratelimit}">
</div>
<div for="ratelimit"></div>
</div>
</div>
</div>
<%@include file="/WEB-INF/include/form/basicInfo.jsp" %>
</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>
<!-- END FORM-->
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,452 @@
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title><spring:message code="dnat_policy"></spring:message></title>
<script>
$(document).ready(function() {
//搜索框提示语初始化
if("${cfg.cfgDesc}"){
$("#intype").val("${cfg.cfgDesc}");
}else if("${cfg.compileId}"){
$("#intype").val("${cfg.compileId}");
}else if("${cfg.srcIpAddress}"){
$("#intype").val("${cfg.srcIpAddress}");
}else if("${cfg.srcPort}"){
$("#intype").val("${cfg.srcPort}");
}else if("${cfg.destIpAddress}"){
$("#intype").val("${cfg.destIpAddress}");
}else if("${cfg.destPort}"){
$("#intype").val("${cfg.destPort}");
}else{
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
}
$("#seltype").change(function(){
$("#intype").attr("placeholder","<spring:message code='input'/> "+$(this).find("option:selected").text());
});
//筛选功能初始化
filterActionInit();
$("#isAudit").change(function(){
page();
});
//reset
$("#resetBtn").on("click",function(){
$("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",'');
$("#level").attr("value",'');
$("#searchForm")[0].reset();
});
if($("#exportType").val() != null && $("#exportType").val() != ""){
if($("#intype").val() != null && $("#intype").val() != ""){
$("#exportValue").val($("#intype").val());
}
}
});
</script>
</head>
<body>
<div class="page-content">
<div class="theme-panel hidden-xs hidden-sm">
<shiro:hasPermission name="dnat_policy:config">
<button type="button" class="btn btn-primary"
onClick="javascript:window.location='${ctx}/manipulation/ipmulitiplex/dnatPolicyForm?functionId=${cfg.functionId}'">
<i class="fa fa-plus"></i>
<spring:message code="add"></spring:message></button>
</shiro:hasPermission>
</div>
<h3 class="page-title">
<spring:message code="dnat_policy"></spring:message>
</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}/manipulation/ipmulitiplex/dnatPolicyList?functionId=${cfg.functionId}" method="post" class="form-search">
<input id="functionId" name="functionId" type="hidden" value="${cfg.functionId}"/>
<input id="audit" name="audit" type="hidden" value="${audit}"/>
<input id="exportType" type="hidden" value="${cfg.seltype}"/>
<input id="exportValue" type="hidden" value=""/>
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<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">
<c:set var="state"><spring:message code='state'/></c:set>
<form:select path="isAudit" class="selectpicker select2 input-small">
<form:option value=""><spring:message code="all_states"/></form:option>
<form:option value="0"><spring:message code="created"></spring:message></form:option>
<form:option value="1"><spring:message code="approved"></spring:message></form:option>
<form:option value="2"><spring:message code="unapproved"></spring:message></form:option>
</form:select>
</div>
<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="cfgDesc"><spring:message code="config_describe"></spring:message></form:option>
<form:option value="compileId"><spring:message code="cfg_id"></spring:message></form:option>
<form:option value="srcIpAddress"><spring:message code="original_dest_ip"></spring:message></form:option>
<form:option value="srcPort"><spring:message code="original_dest_port"></spring:message></form:option>
<form:option value="destIpAddress"><spring:message code="translated_dest_ip"></spring:message></form:option>
<form:option value="destPort"><spring:message code="translated_dest_port"></spring:message></form:option>
<%-- <form:option value="action"><spring:message code="block_type"></spring:message></form:option> --%>
<form:option value="isValid"><spring:message code="valid_identifier"></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="actionSelect" path="action" class="selectpicker select2 input-small" >
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${serviceList}" var="service">
<form:option value="${service.action }"><spring:message code="action_${service.actionCode }"/></form:option>
</c:forEach>
</form:select> --%>
<form:select path="isValid" class="selectpicker select2 input-small" >
<form:option value=""><spring:message code="select"/></form:option>
<form:option value="1"><spring:message code="yes"/></form:option>
<form:option value="0"><spring:message code="no"/></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">
<shiro:hasPermission name="dnat_policy:config">
<sys:delRow url="${ctx}/manipulation/ipmulitiplex/dnatPolicyForm" id="contentTable" label="update"></sys:delRow>
<sys:delRow url="${ctx}/manipulation/ipmulitiplex/dnatDelete?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
<%-- <sys:delRow url="${ctx}/manipulation/ipmulitiplex/exportDnat?functionId=${cfg.functionId }" searchUrl="${ctx}/manipulation/ipmulitiplex/dnatPolicyList?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="export"></sys:delRow> --%>
</shiro:hasPermission>
<shiro:hasPermission name="dnat_policy:confirm">
<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="examine"></spring:message>
<i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu pull-right">
<li><sys:delRow url="${ctx}/manipulation/ipmulitiplex/auditDnat?isAudit=1&isValid=1&functionId=${cfg.functionId }" id="contentTable" label="approved"></sys:delRow></li>
<li><sys:delRow url="${ctx}/manipulation/ipmulitiplex/auditDnat?isAudit=2&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="unapproved"></sys:delRow></li>
<li><sys:delRow url="${ctx}/manipulation/ipmulitiplex/auditDnat?isAudit=3&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="cancelPass"></sys:delRow></li>
</ul>
</div>
</shiro:hasPermission>
<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-3">
<div class="form-group">
<label class="control-label"><spring:message code='letter'/></label>
<c:set var="select"><spring:message code='select'/></c:set>
<form:select path="requestId" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${requestInfos}" var="requestInfo" >
<form:option value="${requestInfo.id}"><spring:message code="${requestInfo.requestTitle}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="control-label"><spring:message code='classification'/></label>
<form:select path="classify" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${fls}" var="fl" >
<form:option value="${fl.serviceDictId}"><spring:message code="${fl.itemValue}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="control-label"><spring:message code='attribute'/></label>
<c:set var="select"><spring:message code='select'/></c:set>
<form:select path="attribute" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${xzs}" var="xz" >
<form:option value="${xz.serviceDictId}"><spring:message code="${xz.itemValue}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="control-label"><spring:message code='label'/></label>
<form:select path="lable" class="selectpicker form-control" data-live-search="true" data-live-search-placeholder="search">
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${lables}" var="lable" >
<form:option value="${lable.serviceDictId}"><spring:message code="${lable.itemValue}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
</div>
</div>
<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>&nbsp;</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>&nbsp;</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 class="col-md-2">
<div class="form-group">
<label><spring:message code="audit_time"/></label>
<input name="search_audit_time_start" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="<fmt:formatDate value="${cfg.search_audit_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>&nbsp;</label>
<input name="search_audit_time_end" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="<fmt:formatDate value="${cfg.search_audit_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 class="sort-column a.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
<th class="sort-column a.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
<%-- <th class="sort-column a.action"><spring:message code="block_type"/></th> --%>
<th><spring:message code="original_dest_ip"/></th>
<th><spring:message code="original_dest_port"/></th>
<th><spring:message code="translated_dest_ip"/></th>
<th><spring:message code="translated_dest_port"/></th>
<th><spring:message code="protocol"/></th>
<th class="sort-column a.is_valid"><spring:message code="valid_identifier"/></th>
<th><spring:message code="is_audit"/></th>
<%-- <th><spring:message code="do_log"/></th> --%>
<%-- <th><spring:message code="whether_area_block"/></th> --%>
<th><spring:message code="letter"/></th>
<th><spring:message code="classification"/></th>
<th><spring:message code="attribute"/></th>
<th><spring:message code="label"/></th>
<%-- <th><spring:message code="log_total"/></th> --%>
<th><spring:message code="creator"/></th>
<th class="sort-column a.create_time"><spring:message code="config_time"/></th>
<th><spring:message code="editor"/></th>
<th class="sort-column a.edit_time"><spring:message code="edit_time"/></th>
<th><spring:message code="auditor"/></th>
<th class="sort-column a.audit_time"><spring:message code="audit_time"/></th>
</tr>
</thead>
<tbody>
<c:forEach items="${page.list }" var="indexCfg" varStatus="status" step="1">
<tr>
<td>
<input type="checkbox" class="i-checks child-checks" id="${indexCfg.cfgId}" value="${indexCfg.isAudit}">
</td>
<td>${indexCfg.compileId }</td>
<td>${indexCfg.cfgDesc }</td>
<%-- <td>
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.action }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td> --%>
<td>${indexCfg.srcIpAddress }</td>
<td>${indexCfg.srcPort }</td>
<td>${indexCfg.destIpAddress }</td>
<td>${indexCfg.destPort }</td>
<td>
<c:forEach items="${fns:getDictList('PROTOCOL')}" var="protocolC">
<c:if test="${indexCfg.protocol==protocolC.itemCode}">
<spring:message code="${protocolC.itemValue }"/>
</c:if>
</c:forEach>
</td>
<%-- <td>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.doLog }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td> --%>
<%-- <td>
<c:if test="${indexCfg.isAreaEffective==0}"><spring:message code="all"/></c:if>
<c:if test="${indexCfg.isAreaEffective==1}">
<a href="javascript:viewAreaInfo('${ctx}','${indexCfg.areaEffectiveIds }','${indexCfg.compileId }')" >
<spring:message code="selective"/>
</a>
</c:if>
</td> --%>
<td>
<c:if test="${indexCfg.isValid==0}"><spring:message code="no"/></c:if>
<c:if test="${indexCfg.isValid==1}"><spring:message code="yes"/></c:if>
<c:if test="${indexCfg.isValid==-1}"><spring:message code="deleted"/></c:if>
</td>
<td>
<c:choose>
<c:when test="${indexCfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
<c:when test="${indexCfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
<c:when test="${indexCfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
<c:when test="${indexCfg.isAudit eq '3'}"><span indexTable="${indexCfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon="&#xe01e;"> <spring:message code="cancel_approved"/></span></c:when>
</c:choose>
</td>
<td>${indexCfg.requestName }</td>
<td>
<c:set var="classify"></c:set>
<c:forEach items="${fn:split(indexCfg.classify,',')}" var="classifyId" varStatus="status">
<c:forEach items="${fls}" var="fl">
<c:if test="${classifyId eq fn:trim(fl.serviceDictId)}">
<c:if test="${status.index+1 eq 1}">
<c:set var="classify" value="${fl.itemValue}"></c:set>
</c:if>
<c:if test="${status.index+1 ne 1}">
<c:set var="classify" value="${classify},${fl.itemValue}"></c:set>
</c:if>
</c:if>
</c:forEach>
</c:forEach>
<a href="javascript:;" data-original-title="${classify}"
class="tooltips" data-flag="false" data-html="true" data-placement="top">
${fns:abbr(classify,20)}
</a>
</td>
<td>
<c:set var="attribute"></c:set>
<c:forEach items="${fn:split(indexCfg.attribute,',')}" var="attributeId" varStatus="status">
<c:forEach items="${xzs}" var="xz">
<c:if test="${attributeId eq fn:trim(xz.serviceDictId)}">
<c:if test="${status.index+1 eq 1}">
<c:set var="attribute" value="${xz.itemValue}"></c:set>
</c:if>
<c:if test="${status.index+1 ne 1}">
<c:set var="attribute" value="${attribute},${xz.itemValue}"></c:set>
</c:if>
</c:if>
</c:forEach>
</c:forEach>
<a href="javascript:;" data-original-title="${attribute}"
class="tooltips" data-flag="false" data-html="true" data-placement="top">
${fns:abbr(attribute,20)}
</a>
</td>
<td>
<c:set var="lableInfo"></c:set>
<c:forEach items="${fn:split(indexCfg.lable,',')}" var="lableId" varStatus="status">
<c:forEach items="${lables}" var="lable">
<c:if test="${lableId eq fn:trim(lable.serviceDictId)}">
<c:if test="${status.index+1 eq 1}">
<c:set var="lableInfo" value="${lable.itemValue}"></c:set>
</c:if>
<c:if test="${status.index+1 ne 1}">
<c:set var="lableInfo" value="${lableInfo},${lable.itemValue}"></c:set>
</c:if>
</c:if>
</c:forEach>
</c:forEach>
<a href="javascript:;" data-original-title="${lableInfo}"
class="tooltips" data-flag="false" data-html="true" data-placement="top">
${fns:abbr(lableInfo,20)}
</a>
</td>
<%-- <td audit="${indexCfg.isAudit}" functionId="${indexCfg.functionId}" compileId="${indexCfg.compileId}" action="${indexCfg.action}"><div class="loading-total"></div></td> --%>
<td>${indexCfg.creatorName }</td>
<td><fmt:formatDate value="${indexCfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
<td>${indexCfg.editorName }</td>
<td><fmt:formatDate value="${indexCfg.editTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
<td>${indexCfg.auditorName }</td>
<td><fmt:formatDate value="${indexCfg.auditTime }" 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>