完善IP复用地址池、策略配置.
This commit is contained in:
@@ -9,7 +9,7 @@ public class IpAddrPool extends InlineIp{
|
||||
@Expose
|
||||
private Integer groupId;
|
||||
@Expose
|
||||
private Integer addrPoolId;
|
||||
private Long addrPoolId;
|
||||
|
||||
public Integer getRegionId() {
|
||||
return regionId;
|
||||
@@ -27,11 +27,12 @@ public class IpAddrPool extends InlineIp{
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public Integer getAddrPoolId() {
|
||||
public Long getAddrPoolId() {
|
||||
return addrPoolId;
|
||||
}
|
||||
|
||||
public void setAddrPoolId(Integer addrPoolId) {
|
||||
public void setAddrPoolId(Long addrPoolId) {
|
||||
this.addrPoolId = addrPoolId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ public class IpAddrPoolCfg extends BaseCfg<IpAddrPoolCfg>{
|
||||
private static final long serialVersionUID = 1392197458744667669L;
|
||||
private String indexTable="ip_reuse_addr_pool";
|
||||
|
||||
private Integer addrPoolId; // 地址池ID
|
||||
private String addrPoolName; // 地址池名称
|
||||
private Integer ipTotal; // IP总数
|
||||
private Integer availableIpTotal; // 可用IP总数
|
||||
@@ -31,12 +30,6 @@ public class IpAddrPoolCfg extends BaseCfg<IpAddrPoolCfg>{
|
||||
public void setIndexTable(String indexTable) {
|
||||
this.indexTable = indexTable;
|
||||
}
|
||||
public Integer getAddrPoolId() {
|
||||
return addrPoolId;
|
||||
}
|
||||
public void setAddrPoolId(Integer addrPoolId) {
|
||||
this.addrPoolId = addrPoolId;
|
||||
}
|
||||
public String getAddrPoolName() {
|
||||
return addrPoolName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
/**
|
||||
* IP复用策略
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class IpReusePolicyCfg extends BaseCfg<IpReusePolicyCfg>{
|
||||
|
||||
private static final long serialVersionUID = 2904010760648378142L;
|
||||
private String indexTable="ip_reuse_policy_cfg";
|
||||
|
||||
private Integer userId; // 用户标识
|
||||
private String userType; // 用户类型
|
||||
private Integer addrPoolId; // 地址池ID
|
||||
private String translateParam; // 地址翻译参数
|
||||
|
||||
private String userName; // 仅用于列表条件检索
|
||||
private String addrPoolName;
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
public String getUserType() {
|
||||
return userType;
|
||||
}
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
public Integer getAddrPoolId() {
|
||||
return addrPoolId;
|
||||
}
|
||||
public void setAddrPoolId(Integer addrPoolId) {
|
||||
this.addrPoolId = addrPoolId;
|
||||
}
|
||||
public String getTranslateParam() {
|
||||
return translateParam;
|
||||
}
|
||||
public void setTranslateParam(String translateParam) {
|
||||
this.translateParam = translateParam;
|
||||
}
|
||||
public String getIndexTable() {
|
||||
return indexTable;
|
||||
}
|
||||
public void setIndexTable(String indexTable) {
|
||||
this.indexTable = indexTable;
|
||||
}
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
public String getAddrPoolName() {
|
||||
return addrPoolName;
|
||||
}
|
||||
public void setAddrPoolName(String addrPoolName) {
|
||||
this.addrPoolName = addrPoolName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -65,8 +65,6 @@ public class IpAddrPoolController extends BaseController{
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipAddrPoolCfgService.getIpAddrPoolCfg(Long.valueOf(ids),null);
|
||||
PolicyGroupInfo groupInfo = policyGroupInfoService.getById(cfg.getAddrPoolId());
|
||||
cfg.setAddrPoolName(groupInfo.getGroupName());
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model, cfg);
|
||||
@@ -81,17 +79,7 @@ public class IpAddrPoolController extends BaseController{
|
||||
public String snatSaveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@ModelAttribute("cfg")IpAddrPoolCfg cfg){
|
||||
try{
|
||||
// 保存地址池信息 -> policy_group_info
|
||||
PolicyGroupInfo entity = new PolicyGroupInfo();
|
||||
if(cfg.getAddrPoolId() != null){
|
||||
entity.setGroupId(cfg.getAddrPoolId());
|
||||
}
|
||||
entity.setGroupType(2);
|
||||
entity.setGroupName(cfg.getAddrPoolName());
|
||||
entity.setDescription(cfg.getDescription());
|
||||
policyGroupInfoService.saveOrUpdate(entity);
|
||||
cfg.setAddrPoolId(policyGroupInfoService.getGroupIdByGroupName(cfg.getAddrPoolName()));
|
||||
|
||||
// 添加地址池配置信息
|
||||
ipAddrPoolCfgService.saveOrUpdate(cfg, request, response);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e) {
|
||||
@@ -130,13 +118,24 @@ public class IpAddrPoolController extends BaseController{
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置删除
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
* @param model
|
||||
* @param redirectAttributes
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/snatDelete"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String snatdelete(Integer isAudit,Integer isValid,String ids,Integer functionId,Model model,RedirectAttributes redirectAttributes
|
||||
,HttpServletRequest request,HttpServletResponse response){
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
// ?未被任何策略引用的地址池可删除
|
||||
ipAddrPoolCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
|
||||
@@ -19,6 +19,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
@@ -35,6 +36,7 @@ import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.IpAddrPoolCfg;
|
||||
import com.nis.domain.configuration.IpMultiplexPoolCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.IpReusePolicyCfg;
|
||||
import com.nis.domain.configuration.UserManage;
|
||||
import com.nis.domain.configuration.template.IpMultiplexPolicyTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
@@ -43,6 +45,7 @@ import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.service.configuration.IpMultiplexService;
|
||||
|
||||
/**
|
||||
* @ClassName: ControlController.java
|
||||
@@ -54,6 +57,10 @@ import com.nis.web.controller.configuration.CommonController;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/manipulation/ipmulitiplex")
|
||||
public class IpMultiplexController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private IpMultiplexService ipMultiplexService;
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
// @RequiresPermissions(value={"ip:mulitiplex:config","ip:mulitiplex:confirm"},logical=Logical.OR)
|
||||
public String ipList(String cfgName,Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
@@ -129,8 +136,12 @@ public class IpMultiplexController extends CommonController {
|
||||
* IP复用策略拆分为SNAT/DNAT复用策略
|
||||
*/
|
||||
@RequestMapping(value = {"/snatPolicyList"})
|
||||
public String snatPolicyList(String cfgName,Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
this._ipList(cfgName,model, cfg, request, response);
|
||||
public String snatPolicyList(Model model,@ModelAttribute("cfg")IpReusePolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(new Page<IpReusePolicyCfg>(request, response,"r"), cfg);
|
||||
model.addAttribute("page", page);
|
||||
initFormCondition(model,cfg);
|
||||
|
||||
// 获取地址池、用户信息
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
@@ -142,8 +153,17 @@ public class IpMultiplexController extends CommonController {
|
||||
|
||||
@RequestMapping(value = {"/snatPolicyForm"})
|
||||
@RequiresPermissions(value={"snat_policy:config"})
|
||||
public String snatPolicyForm(String cfgName,Model model,String ids,Integer functionId,BaseIpCfg entity, HttpServletRequest request,HttpServletResponse response) {
|
||||
this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
public String snatPolicyForm(Model model, String ids, IpReusePolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
if(cfg == null){
|
||||
cfg=new IpReusePolicyCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexService.getPolicyCfg(Long.valueOf(ids),null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
|
||||
// 获取用户信息 地址池信息
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
@@ -151,7 +171,7 @@ public class IpMultiplexController extends CommonController {
|
||||
List<IpAddrPoolCfg> addrPoolsNew=new ArrayList<>();
|
||||
for (IpAddrPoolCfg addrPool : addrPools) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("addr_pool_id", addrPool.getAddrPoolId());
|
||||
params.put("addr_pool_id", addrPool.getCfgId());
|
||||
String url =Constants.IP_REUSE_CALL_CGI_URL ;
|
||||
Map<String, Object> resultMap=ConfigServiceUtil.getCGIInfo(url, Constants.IP_NUM_GET, params);
|
||||
if(!StringUtil.isEmpty(resultMap)
|
||||
@@ -161,6 +181,7 @@ public class IpMultiplexController extends CommonController {
|
||||
}
|
||||
}
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("users", users);
|
||||
model.addAttribute("addrPools", addrPoolsNew);
|
||||
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
@@ -168,32 +189,52 @@ public class IpMultiplexController extends CommonController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdateSnat"})
|
||||
public String saveOrUpdateSnat(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
|
||||
// 设置生效区域信息
|
||||
//groupAreaService.setAreaEffective(cfg);
|
||||
public String saveOrUpdateSnat(Model model, HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, IpReusePolicyCfg cfg) {
|
||||
try{
|
||||
// 添加策略配置信息
|
||||
ipMultiplexService.saveOrUpdate(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");
|
||||
}
|
||||
}
|
||||
|
||||
this._saveOrUpdateIp(cfgName,model, cfg);
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatDelete"})
|
||||
@RequiresPermissions("snat_policy:config")
|
||||
public String snatDelete(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
public String snatDelete(String ids, Integer isValid, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexService.delete(isValid,ids,functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/auditSnat"})
|
||||
@RequiresPermissions("snat_policy:confirm")
|
||||
public String auditSnat(String cfgName,String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
//this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
public String auditSnat(String ids,Integer isAudit,Integer isValid,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
try {
|
||||
ipAddrPoolCfgService.auditSnatStrategy(id, cfg, auditTime);
|
||||
ipMultiplexService.auditSnatPolicy(isAudit,isValid,functionId,id,auditTime);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("SNAT策略配置下发失败:"+e.getMessage());
|
||||
@@ -206,7 +247,7 @@ public class IpMultiplexController extends CommonController {
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+cfg.getFunctionId();
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/dnatPolicyList"})
|
||||
|
||||
@@ -18,21 +18,22 @@ public interface IpAddrPoolCfgDao extends CrudDao<IpAddrPoolCfgDao>{
|
||||
,@Param("isAudit")Integer isAudit
|
||||
,@Param("isValid")Integer isValid);
|
||||
|
||||
|
||||
void saveAddrPoolCfg(IpAddrPoolCfg cfg);
|
||||
|
||||
void updateAddrPoolCfg(IpAddrPoolCfg entity);
|
||||
|
||||
void saveReuseIpCfgs(BaseIpCfg ipCfg);
|
||||
|
||||
List<BaseIpCfg> getReuseIpCfgs(@Param("addrPoolId")Integer addrPoolId);
|
||||
|
||||
void deleteReuseIpCfgs(@Param("addrPoolId")Integer addrPoolId);
|
||||
|
||||
Integer getAddrPoolId(@Param("cfgId")Long cfgId);
|
||||
List<BaseIpCfg> getReuseIpCfgs(@Param("cfgId")Long cfgId);
|
||||
|
||||
IpAddrPoolCfg getCfgInfo(IpAddrPoolCfg cfg);
|
||||
|
||||
void saveAddrPoolCfg(IpAddrPoolCfg cfg);
|
||||
void saveReuseIpCfgs(BaseIpCfg ipCfg);
|
||||
|
||||
void updateAddrPoolCfg(IpAddrPoolCfg entity);
|
||||
void updateReuseIpCfgs(IpAddrPoolCfg entity);
|
||||
|
||||
void deleteReuseIpCfgs(@Param("addrPoolId")Long addrPoolId);
|
||||
|
||||
List<IpAddrPoolCfg> findAddrPoolCfg();
|
||||
|
||||
Long getAddrPoolIdByName(String addrPoolName);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
<mapper namespace="com.nis.web.dao.configuration.IpAddrPoolCfgDao">
|
||||
|
||||
<resultMap id="addrPoolMap" type="com.nis.domain.configuration.IpAddrPoolCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="addr_pool_id" property="addrPoolId" jdbcType="INTEGER"/>
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT"/>
|
||||
<result column="addr_pool_name" property="addrPoolName" jdbcType="VARCHAR"/>
|
||||
<result column="ip_total" property="ipTotal" jdbcType="INTEGER"/>
|
||||
<result column="available_ip_total" property="availableIpTotal" jdbcType="INTEGER"/>
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
@@ -38,7 +36,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="addrPoolColumns">
|
||||
r.CFG_ID,r.ADDR_POOL_ID,r.IP_TOTAL,r.AVAILABLE_IP_TOTAL,r.ACTION,r.IS_VALID,r.IS_AUDIT,
|
||||
r.CFG_ID,r.ADDR_POOL_NAME,r.IP_TOTAL,r.ACTION,r.IS_VALID,r.IS_AUDIT,
|
||||
r.CFG_REGION_CODE,r.CFG_TYPE,r.FUNCTION_ID,r.SERVICE_ID,r.COMPILE_ID,r.REQUEST_ID,
|
||||
r.CLASSIFY,r.ATTRIBUTE,r.LABLE,
|
||||
r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME,
|
||||
@@ -62,13 +60,10 @@
|
||||
,s.name as creator_name,
|
||||
e.name as editor_name,
|
||||
u.name as auditor_name,
|
||||
a.group_name as addr_pool_name,
|
||||
ri.request_title as requestName
|
||||
</trim>
|
||||
FROM
|
||||
ip_reuse_addr_pool r
|
||||
left join
|
||||
policy_group_info a on r.addr_pool_id = a.group_Id
|
||||
left join
|
||||
sys_user s on r.creator_id = s.id
|
||||
left join
|
||||
@@ -81,24 +76,18 @@
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</if>
|
||||
<if test="cfgId != null">
|
||||
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
<if test="cfgId != null">
|
||||
AND r.cfg_id=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND r.compile_id=#{compileId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="addrPoolId != null">
|
||||
AND r.addr_pool_id = #{addrPoolId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="addrPoolName != null and addrPoolName != ''">
|
||||
AND r.addr_pool_name = #{addrPoolName,jdbcType=VARCHAR}
|
||||
AND r.addr_pool_name LIKE concat(concat('%',#{addrPoolName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="ipTotal != null">
|
||||
AND r.ip_total = #{ipTotal,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="availableIpTotal != null">
|
||||
AND r.available_ip_total = #{availableIpTotal,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND r.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
@@ -149,7 +138,7 @@
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY r.CFG_ID DESC
|
||||
ORDER BY r.cfg_id DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
@@ -161,6 +150,9 @@
|
||||
FROM
|
||||
ip_reuse_addr_pool r
|
||||
<where>
|
||||
<if test="cfgId != null">
|
||||
AND r.cfg_id=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="isValid !=null">
|
||||
AND r.is_valid = #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
@@ -169,12 +161,9 @@
|
||||
</if>
|
||||
<if test="isAudit !=null">
|
||||
AND r.is_audit = #{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="cfgId != null">
|
||||
AND r.cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY cfg_Id
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY r.cfg_id
|
||||
</select>
|
||||
|
||||
<!-- 保存地址池IP信息 -->
|
||||
@@ -258,10 +247,8 @@
|
||||
|
||||
<insert id="saveAddrPoolCfg" parameterType="com.nis.domain.configuration.IpAddrPoolCfg">
|
||||
INSERT INTO ip_reuse_addr_pool(
|
||||
addr_pool_id,
|
||||
addr_pool_name,
|
||||
ip_total,
|
||||
available_ip_total,
|
||||
action,
|
||||
is_valid,
|
||||
is_audit,
|
||||
@@ -289,10 +276,8 @@
|
||||
user_region4,
|
||||
user_region5
|
||||
)VALUES (
|
||||
#{addrPoolId,jdbcType=INTEGER},
|
||||
#{addrPoolName,jdbcType=VARCHAR},
|
||||
#{ipTotal,jdbcType=INTEGER},
|
||||
#{availableIpTotal,jdbcType=INTEGER},
|
||||
#{action,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
@@ -328,19 +313,62 @@
|
||||
FROM
|
||||
ip_reuse_ip_cfg a
|
||||
WHERE
|
||||
a.is_valid != -1 AND a.user_region1 = #{addrPoolId}
|
||||
a.is_valid != -1 AND a.user_region1 = #{cfgId}
|
||||
</select>
|
||||
|
||||
<select id="getAddrPoolId" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
a.addr_pool_id
|
||||
FROM
|
||||
ip_reuse_addr_pool a
|
||||
WHERE
|
||||
a.is_valid != -1 AND a.cfg_id = #{cfgId}
|
||||
</select>
|
||||
<update id="updateReuseIpCfgs" parameterType="com.nis.domain.configuration.IpAddrPoolCfg">
|
||||
update ip_reuse_ip_cfg
|
||||
<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="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 user_region1 = #{cfgId,jdbcType=BIGINT}
|
||||
|
||||
</update>
|
||||
|
||||
<delete id="deleteReuseIpCfgs" parameterType="java.lang.Integer">
|
||||
<delete id="deleteReuseIpCfgs" parameterType="java.lang.Long">
|
||||
DELETE FROM ip_reuse_ip_cfg WHERE user_region1 = #{addrPoolId}
|
||||
</delete>
|
||||
|
||||
@@ -348,18 +376,9 @@
|
||||
update ip_reuse_addr_pool
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="addrPoolId != null" >
|
||||
addr_pool_id = #{addrPoolId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="ipTotal != null" >
|
||||
ip_total = #{ipTotal,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="availableIpTotal != null" >
|
||||
available_ip_total = #{availableIpTotal,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="action != null" >
|
||||
action = #{action,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
@@ -423,16 +442,16 @@
|
||||
FROM ip_reuse_addr_pool r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="cfgId != null">
|
||||
AND r.cfg_id=#{cfgId,jdbcType=BIGINT}
|
||||
AND r.cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="isValid !=null">
|
||||
AND r.is_valid =#{isValid,jdbcType=INTEGER}
|
||||
AND r.is_valid = #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND r.is_valid != -1
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.function_id=#{functionId,jdbcType=INTEGER}
|
||||
AND r.function_id = #{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="addrPoolName != null and addrPoolName != ''">
|
||||
AND r.addr_pool_name = #{addrPoolName,jdbcType=VARCHAR}
|
||||
@@ -442,7 +461,16 @@
|
||||
|
||||
<select id="findAddrPoolCfg" resultMap="addrPoolMap">
|
||||
SELECT
|
||||
<include refid="addrPoolColumns"/>,r.ADDR_POOL_NAME
|
||||
<include refid="addrPoolColumns"/>
|
||||
FROM ip_reuse_addr_pool r WHERE r.is_audit=1
|
||||
</select>
|
||||
|
||||
<select id="getAddrPoolIdByName" resultType="java.lang.Long">
|
||||
SELECT
|
||||
r.cfg_id
|
||||
FROM
|
||||
ip_reuse_addr_pool r
|
||||
WHERE
|
||||
r.addr_pool_name = #{addrPoolName} AND r.is_valid != -1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.IpReusePolicyCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface IpMultiplexDao extends CrudDao<IpMultiplexDao>{
|
||||
|
||||
List<IpReusePolicyCfg> findPage(IpReusePolicyCfg entity);
|
||||
|
||||
List<IpReusePolicyCfg> findList(@Param("cfgId")Long cfgId
|
||||
,@Param("isAudit")Integer isAudit
|
||||
,@Param("isValid")Integer isValid);
|
||||
|
||||
void savePolicyCfg(IpReusePolicyCfg entity);
|
||||
|
||||
void updatePolicyCfg(IpReusePolicyCfg entity);
|
||||
|
||||
String getUserType(@Param("userId")Integer userId);
|
||||
|
||||
}
|
||||
311
src/main/java/com/nis/web/dao/configuration/IpMultiplexDao.xml
Normal file
311
src/main/java/com/nis/web/dao/configuration/IpMultiplexDao.xml
Normal file
@@ -0,0 +1,311 @@
|
||||
<?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.configuration.IpMultiplexDao">
|
||||
|
||||
<resultMap id="policyMap" type="com.nis.domain.configuration.IpReusePolicyCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT"/>
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR"/>
|
||||
<result column="addr_pool_id" property="addrPoolId" jdbcType="INTEGER"/>
|
||||
<result column="user_id" property="userId" jdbcType="INTEGER"/>
|
||||
<result column="user_type" property="userType" jdbcType="VARCHAR"/>
|
||||
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
|
||||
<result column="request_id" property="requestId" 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="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="user_region1" property="userRegion1" jdbcType="VARCHAR" />
|
||||
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="policyColumns">
|
||||
r.CFG_ID,r.CFG_DESC,r.ADDR_POOL_ID,r.USER_ID,r.USER_TYPE,
|
||||
r.ACTION,r.IS_VALID,r.IS_AUDIT,r.CFG_REGION_CODE,r.CFG_TYPE,r.FUNCTION_ID,
|
||||
r.SERVICE_ID,r.COMPILE_ID,r.REQUEST_ID,r.CLASSIFY,r.ATTRIBUTE,r.LABLE,
|
||||
r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME,
|
||||
r.CANCEL_REQUEST_ID,r.IS_AREA_EFFECTIVE,r.AREA_EFFECTIVE_IDS,
|
||||
r.USER_REGION1,r.USER_REGION2,r.USER_REGION3,r.USER_REGION4,r.USER_REGION5
|
||||
</sql>
|
||||
|
||||
<select id="findPage" resultMap="policyMap">
|
||||
SELECT
|
||||
<include refid="policyColumns"/>
|
||||
<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_policy_cfg r
|
||||
left join
|
||||
sys_user s on r.creator_id = s.id
|
||||
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
|
||||
<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 r.cfg_id=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND r.compile_id=#{compileId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
AND r.user_id in (SELECT u.id FROM user_manage u
|
||||
<where>
|
||||
u.user_name LIKE concat(concat('%',#{userName,jdbcType=VARCHAR}),'%')
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
<if test="addrPoolName != null and addrPoolName != ''">
|
||||
AND r.addr_pool_id in (SELECT i.cfg_id FROM ip_reuse_addr_pool i
|
||||
<where>
|
||||
i.addr_pool_name LIKE concat(concat('%',#{addrPoolName,jdbcType=VARCHAR}),'%')
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND r.compile_id=#{compileId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND r.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND r.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND 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>
|
||||
<if test="auditorName != null and auditorName != ''">
|
||||
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify != ''">
|
||||
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''">
|
||||
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable != ''">
|
||||
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.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 r.cfg_id DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 获取数据跳转表单 -->
|
||||
<select id="findList" resultMap="policyMap">
|
||||
SELECT
|
||||
<include refid="policyColumns"/>
|
||||
FROM
|
||||
ip_reuse_policy_cfg r
|
||||
<where>
|
||||
<if test="cfgId != null">
|
||||
AND r.cfg_id=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="isValid !=null">
|
||||
AND r.is_valid = #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid ==null">
|
||||
AND r.is_valid != -1
|
||||
</if>
|
||||
<if test="isAudit !=null">
|
||||
AND r.is_audit = #{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY r.cfg_id
|
||||
</select>
|
||||
|
||||
<insert id="savePolicyCfg" parameterType="com.nis.domain.configuration.IpReusePolicyCfg">
|
||||
INSERT INTO ip_reuse_policy_cfg (
|
||||
cfg_desc,
|
||||
addr_pool_id,
|
||||
user_id,
|
||||
user_type,
|
||||
action,
|
||||
is_valid,
|
||||
is_audit,
|
||||
cfg_type,
|
||||
cfg_region_code,
|
||||
function_id,
|
||||
service_id,
|
||||
compile_id,
|
||||
is_area_effective,
|
||||
area_effective_ids,
|
||||
request_id,
|
||||
classify,
|
||||
attribute,
|
||||
lable,
|
||||
creator_id,
|
||||
create_time,
|
||||
editor_id,
|
||||
edit_time,
|
||||
auditor_id,
|
||||
audit_time,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
)VALUES (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{addrPoolId,jdbcType=INTEGER},
|
||||
#{userId,jdbcType=INTEGER},
|
||||
#{userType,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="getUserType" resultType="java.lang.String">
|
||||
SELECT
|
||||
user_type
|
||||
FROM
|
||||
user_manage
|
||||
WHERE
|
||||
id = #{userId}
|
||||
</select>
|
||||
|
||||
<update id="updatePolicyCfg" parameterType="com.nis.domain.configuration.IpReusePolicyCfg">
|
||||
update ip_reuse_policy_cfg
|
||||
<set>
|
||||
<trim suffixOverrides=",">
|
||||
<if test="userId != null" >
|
||||
user_id = #{userId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="userType != null and userType != ''" >
|
||||
user_type = #{userType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="addrPoolId != null" >
|
||||
addr_pool_id = #{addrPoolId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="translateParam != null and translateParam != ''" >
|
||||
translate_param = #{translateParam,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userId != null" >
|
||||
user_id = #{userId,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>
|
||||
</mapper>
|
||||
@@ -15,34 +15,24 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.callback.IpAddrPool;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpAddrPoolCfg;
|
||||
import com.nis.domain.configuration.IpMultiplexPoolCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.UserManage;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.dao.configuration.IpAddrPoolCfgDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
import com.nis.web.service.basics.PolicyGroupInfoService;
|
||||
import com.nis.web.service.basics.SysDictInfoService;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Maps;
|
||||
|
||||
@Service
|
||||
public class IpAddrPoolCfgService extends BaseService{
|
||||
|
||||
@@ -69,16 +59,16 @@ public class IpAddrPoolCfgService extends BaseService{
|
||||
* @param isValid
|
||||
* @return
|
||||
*/
|
||||
public IpAddrPoolCfg getIpAddrPoolCfg(Long id, Integer isValid) {
|
||||
public IpAddrPoolCfg getIpAddrPoolCfg(Long cfgId, Integer isValid) {
|
||||
// 1.获取地址池配置信息
|
||||
List<IpAddrPoolCfg> list=ipAddrPoolCfgDao.findList(id,isValid,null);
|
||||
List<IpAddrPoolCfg> list=ipAddrPoolCfgDao.findList(cfgId,isValid,null);
|
||||
IpAddrPoolCfg addrPoolCfg=null;
|
||||
if(list != null && list.size()>0){
|
||||
addrPoolCfg=list.get(0);
|
||||
}
|
||||
|
||||
// 2.获取地址池内IP信息
|
||||
List<BaseIpCfg> ipCfgs = ipAddrPoolCfgDao.getReuseIpCfgs(addrPoolCfg.getAddrPoolId());
|
||||
List<BaseIpCfg> ipCfgs = ipAddrPoolCfgDao.getReuseIpCfgs(addrPoolCfg.getCfgId());
|
||||
if(ipCfgs != null && ipCfgs.size()>0){
|
||||
addrPoolCfg.setIpCfgs(ipCfgs);
|
||||
}
|
||||
@@ -94,23 +84,13 @@ public class IpAddrPoolCfgService extends BaseService{
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(IpAddrPoolCfg entity, HttpServletRequest req, HttpServletResponse res) {
|
||||
|
||||
// 可用IP数(需调用CGI接口查询)
|
||||
/*Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("cmd", "IpNumGet");
|
||||
params.put("addr_pool_id", entity.getAddrPoolId());
|
||||
try {
|
||||
String resJson = HttpClientUtil.getMsg("", params, req);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}*/
|
||||
|
||||
// 1.更新配置信息
|
||||
// 1.更新地址池信息
|
||||
Date time = new Date();
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
setAreaEffectiveIds(entity);
|
||||
entity.setIpTotal(entity.getIpCfgs().size());
|
||||
if(entity.getCfgId()==null){
|
||||
if(entity.getCfgId() == null){
|
||||
entity.initDefaultValue();
|
||||
entity.setCreateTime(time);
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
@@ -134,12 +114,13 @@ public class IpAddrPoolCfgService extends BaseService{
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
}
|
||||
ipAddrPoolCfgDao.deleteReuseIpCfgs(entity.getAddrPoolId());
|
||||
Long addrPoolId = ipAddrPoolCfgDao.getAddrPoolIdByName(entity.getAddrPoolName());
|
||||
|
||||
// 2.保存IP信息 -> ip_reuse_ip_cfg(该表user_region1字段 存放 地址池ID)
|
||||
// 2.更新地址池IP信息
|
||||
ipAddrPoolCfgDao.deleteReuseIpCfgs(addrPoolId);
|
||||
for (BaseIpCfg IpCfg : entity.getIpCfgs()) {
|
||||
BeanUtils.copyProperties(entity, IpCfg);
|
||||
IpCfg.setUserRegion1(entity.getAddrPoolId()+"");
|
||||
BeanUtils.copyProperties(entity, IpCfg, new String[]{"cfgId"});
|
||||
IpCfg.setUserRegion1(addrPoolId+"");
|
||||
ipAddrPoolCfgDao.saveReuseIpCfgs(IpCfg);
|
||||
}
|
||||
|
||||
@@ -148,7 +129,6 @@ public class IpAddrPoolCfgService extends BaseService{
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
String[] idArray = ids.split(",");
|
||||
String groupIds = "";
|
||||
for(String id :idArray){
|
||||
IpAddrPoolCfg entity = new IpAddrPoolCfg();
|
||||
entity.setCfgId(Long.valueOf(id));
|
||||
@@ -157,15 +137,11 @@ public class IpAddrPoolCfgService extends BaseService{
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
Integer addrPoolId = ipAddrPoolCfgDao.getAddrPoolId(entity.getCfgId());
|
||||
groupIds += addrPoolId+",";
|
||||
ipAddrPoolCfgDao.deleteReuseIpCfgs(addrPoolId);
|
||||
|
||||
ipAddrPoolCfgDao.updateAddrPoolCfg(entity);
|
||||
ipAddrPoolCfgDao.updateReuseIpCfgs(entity);
|
||||
|
||||
}
|
||||
PolicyGroupInfoService groupInfoService = SpringContextHolder.getBean(PolicyGroupInfoService.class);
|
||||
groupInfoService.deldete(groupIds, isValid);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,8 +161,9 @@ public class IpAddrPoolCfgService extends BaseService{
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(auditTime);
|
||||
ipAddrPoolCfgDao.updateAddrPoolCfg(cfg);// 更新配置审核状态
|
||||
ipAddrPoolCfgDao.updateReuseIpCfgs(cfg);
|
||||
|
||||
cfg=getIpAddrPoolCfg(cfg.getCfgId(), null);
|
||||
cfg = this.getIpAddrPoolCfg(cfg.getCfgId(), null);
|
||||
String json="";
|
||||
if(cfg.getIsAudit()==1){
|
||||
List<IpAddrPool> resStrategyList=new ArrayList<IpAddrPool>();
|
||||
@@ -216,9 +193,9 @@ public class IpAddrPoolCfgService extends BaseService{
|
||||
ip.setIsValid(cfg.getIsValid());
|
||||
ip.setAction(ipcfg.getAction());
|
||||
ip.setService(ipcfg.getServiceId());
|
||||
ip.setAddrPoolId(cfg.getAddrPoolId());
|
||||
ip.setAddrPoolId(cfg.getCfgId());
|
||||
ip.setOpTime(auditTime);
|
||||
ip.setAreaEffectiveIds(cfg.getAreaEffectiveIds());//添加区域管控
|
||||
//ip.setAreaEffectiveIds(cfg.getAreaEffectiveIds());//添加区域管控
|
||||
|
||||
resStrategyList.add(ip);
|
||||
}
|
||||
@@ -261,9 +238,9 @@ public class IpAddrPoolCfgService extends BaseService{
|
||||
ip.setIsValid(cfg.getIsValid());
|
||||
ip.setAction(ipcfg.getAction());
|
||||
ip.setService(ipcfg.getServiceId());
|
||||
ip.setAddrPoolId(cfg.getAddrPoolId());
|
||||
ip.setAddrPoolId(cfg.getCfgId());
|
||||
ip.setOpTime(auditTime);
|
||||
ip.setAreaEffectiveIds(cfg.getAreaEffectiveIds());
|
||||
//ip.setAreaEffectiveIds(cfg.getAreaEffectiveIds());
|
||||
resStrategyList.add(ip);
|
||||
}
|
||||
//调用服务接口取消配置
|
||||
@@ -295,107 +272,7 @@ public class IpAddrPoolCfgService extends BaseService{
|
||||
* @return
|
||||
*/
|
||||
public List<IpAddrPoolCfg> getEffectiveAddrPool() {
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgDao.findAddrPoolCfg();
|
||||
|
||||
/*String cgiUrl = "http://localhost:8080/gwall/nis/maintenance/ipMultiplexPoolCfg/cgiCall";
|
||||
if(StringUtils.isNotBlank(Constants.IP_REUSE_CGI_URL)){
|
||||
cgiUrl = Constants.IP_REUSE_CGI_URL;
|
||||
}
|
||||
for (IpAddrPoolCfg cfg : addrPools) {
|
||||
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("cmd", "IpNumGet");
|
||||
params.put("addr_pool_id", cfg.getAddrPoolId());
|
||||
try {
|
||||
String resJson = HttpClientUtil.getMsg(cgiUrl, params, req);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("获取地址池信息失败!", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
return addrPools;
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置审核
|
||||
* @param ids
|
||||
* @param cfg
|
||||
* @param auditTime
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditSnatStrategy(String id, IpPortCfg cfg, Date auditTime) {
|
||||
cfg.setCfgId(Long.valueOf(id));
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(auditTime);
|
||||
// 更新配置审核状态
|
||||
IpCfgDao ipCfgDao = SpringContextHolder.getBean(IpCfgDao.class);
|
||||
IpCfgService IpCfgService = SpringContextHolder.getBean(IpCfgService.class);
|
||||
ipCfgDao.auditCfg(cfg);
|
||||
|
||||
// 获取配置信息
|
||||
BaseIpCfg ipCfg = IpCfgService.getIpCfgById(cfg);
|
||||
SysDictInfoService sysDictInfoService = SpringContextHolder.getBean(SysDictInfoService.class);
|
||||
UserManageService userManageService = SpringContextHolder.getBean(UserManageService.class);
|
||||
UserManage user = userManageService.getUserById(ipCfg.getUserRegion1());
|
||||
String json="";
|
||||
if(cfg.getIsAudit() == Constants.AUDIT_YES){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("configId", ipCfg.getCompileId());
|
||||
params.put("addrPoolId", ipCfg.getUserRegion2());
|
||||
params.put("userType", user.getUserType());
|
||||
params.put("userId", user.getId());
|
||||
params.put("isValid", 1);
|
||||
params.put("opTime", auditTime);
|
||||
if(ipCfg.getIsAreaEffective() == 1){
|
||||
params.put("effectiveRange", sysDictInfoService.setEffectiveRange(ipCfg.getAreaEffectiveIds()));
|
||||
}
|
||||
List list = Lists.newArrayList();
|
||||
list.add(params);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(list);
|
||||
logger.info("SNAT策略配置下发参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("SNAT地址池配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("SNAT策略配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}else if(cfg.getIsAudit() == Constants.AUDIT_NOT_YES){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("configId", ipCfg.getCompileId());
|
||||
params.put("addrPoolId", ipCfg.getUserRegion2());
|
||||
params.put("userType", user.getUserType());
|
||||
params.put("userId", user.getId());
|
||||
params.put("isValid", 0);
|
||||
params.put("opTime", auditTime);
|
||||
if(ipCfg.getIsAreaEffective() == 1){
|
||||
params.put("effectiveRange", sysDictInfoService.setEffectiveRange(ipCfg.getAreaEffectiveIds()));
|
||||
}
|
||||
List list = Lists.newArrayList();
|
||||
list.add(params);
|
||||
//调用服务接口取消配置
|
||||
json=gsonToJson(list);
|
||||
logger.info("SNAT策略配置下发参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("SNAT策略配置响应信息:"+result.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("SNAT策略配置配置失败");
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
return ipAddrPoolCfgDao.findAddrPoolCfg();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
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.IpReusePolicyCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.configuration.IpMultiplexDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
import com.nis.web.service.basics.SysDictInfoService;
|
||||
|
||||
@Service
|
||||
public class IpMultiplexService extends BaseService{
|
||||
|
||||
@Autowired
|
||||
private IpMultiplexDao ipMultiplexDao;
|
||||
|
||||
public Page<IpReusePolicyCfg> findPage(Page<IpReusePolicyCfg> page, IpReusePolicyCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<IpReusePolicyCfg> list=ipMultiplexDao.findPage(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
public IpReusePolicyCfg getPolicyCfg(Long cfgId, Integer isValid) {
|
||||
List<IpReusePolicyCfg> list=ipMultiplexDao.findList(cfgId,isValid,null);
|
||||
IpReusePolicyCfg policyCfg=null;
|
||||
if(list != null && list.size()>0){
|
||||
policyCfg=list.get(0);
|
||||
}
|
||||
return policyCfg;
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(IpReusePolicyCfg entity, HttpServletRequest request, HttpServletResponse response) {
|
||||
Date time = new Date();
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
setAreaEffectiveIds(entity);
|
||||
|
||||
// 获取用户/账号类型
|
||||
if(entity.getUserId() != null){
|
||||
String userType = ipMultiplexDao.getUserType(entity.getUserId());
|
||||
entity.setUserType(userType);
|
||||
}
|
||||
|
||||
// 更新策略信息
|
||||
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.savePolicyCfg(entity);
|
||||
|
||||
}else{
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(time);
|
||||
ipMultiplexDao.updatePolicyCfg(entity);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(Integer isValid, String ids, Integer functionId) {
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
IpReusePolicyCfg entity = new IpReusePolicyCfg();
|
||||
entity.setCfgId(Long.valueOf(id));
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
ipMultiplexDao.updatePolicyCfg(entity);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置审核
|
||||
* @param ids
|
||||
* @param cfg
|
||||
* @param auditTime
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditSnatPolicy(Integer isAudit, Integer isValid, Integer functionId, String id, Date auditTime) {
|
||||
// 更新配置审核状态
|
||||
IpReusePolicyCfg cfg = new IpReusePolicyCfg();
|
||||
cfg.setCfgId(Long.valueOf(id));
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setIsAudit(isAudit);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(auditTime);
|
||||
ipMultiplexDao.updatePolicyCfg(cfg);
|
||||
|
||||
SysDictInfoService sysDictInfoService = SpringContextHolder.getBean(SysDictInfoService.class);
|
||||
// 获取配置信息
|
||||
cfg = this.getPolicyCfg(cfg.getCfgId(), null);
|
||||
String json="";
|
||||
if(cfg.getIsAudit() == Constants.AUDIT_YES){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("configId", cfg.getCompileId());
|
||||
params.put("addrPoolId", cfg.getAddrPoolId());
|
||||
params.put("userType", cfg.getUserType());
|
||||
params.put("userId", cfg.getUserId());
|
||||
params.put("isValid", 1);
|
||||
params.put("opTime", auditTime);
|
||||
if(cfg.getIsAreaEffective() == 1){
|
||||
params.put("effectiveRange", sysDictInfoService.setEffectiveRange(cfg.getAreaEffectiveIds()));
|
||||
}
|
||||
List list = Lists.newArrayList();
|
||||
list.add(params);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(list);
|
||||
logger.info("SNAT策略配置下发参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("SNAT策略配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("SNAT策略配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}else if(cfg.getIsAudit() == Constants.AUDIT_NOT_YES){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("configId", cfg.getCompileId());
|
||||
params.put("addrPoolId", cfg.getAddrPoolId());
|
||||
params.put("userType", cfg.getUserType());
|
||||
params.put("userId", cfg.getUserId());
|
||||
params.put("isValid", 0);
|
||||
params.put("opTime", auditTime);
|
||||
if(cfg.getIsAreaEffective() == 1){
|
||||
params.put("effectiveRange", sysDictInfoService.setEffectiveRange(cfg.getAreaEffectiveIds()));
|
||||
}
|
||||
List list = Lists.newArrayList();
|
||||
list.add(params);
|
||||
//调用服务接口取消配置
|
||||
json=gsonToJson(list);
|
||||
logger.info("SNAT策略配置下发参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("SNAT策略配置响应信息:"+result.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("SNAT策略配置配置失败");
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1327,7 +1327,7 @@ outgoing_unicast_packets=Upload Packets
|
||||
outgoing_unicast_total_size=Upload Byte
|
||||
incoming_unicast_packets=Download Packets
|
||||
incoming_unicast_total_size=Download Byte
|
||||
address_pool=Address Pool
|
||||
address_pool=Address Pool Name
|
||||
ip_total=IP Total
|
||||
available_ip_total=Available IP Total
|
||||
address_pool_id=Address Pool ID
|
||||
|
||||
@@ -1327,7 +1327,7 @@ outgoing_unicast_packets=Upload Packets
|
||||
outgoing_unicast_total_size=Upload Byte
|
||||
incoming_unicast_packets=Download Packets
|
||||
incoming_unicast_total_size=Download Byte
|
||||
address_pool=Address Pool
|
||||
address_pool=Address Pool Name
|
||||
ip_total=IP Total
|
||||
available_ip_total=Available IP Total
|
||||
address_pool_id=Address Pool ID
|
||||
|
||||
@@ -1325,7 +1325,7 @@ outgoing_unicast_packets=Upload Packets
|
||||
outgoing_unicast_total_size=Upload Byte
|
||||
incoming_unicast_packets=Download Packets
|
||||
incoming_unicast_total_size=Download Byte
|
||||
address_pool=\u5730\u5740\u6C60
|
||||
address_pool=\u5730\u5740\u6C60\u540D\u79F0
|
||||
ip_total=IP\u603B\u6570
|
||||
available_ip_total=\u53EF\u7528IP\u6570
|
||||
address_pool_id=\u5730\u5740\u6C60ID
|
||||
|
||||
@@ -103,7 +103,6 @@ var resetIndex = function(){
|
||||
<form:form id="cfgFrom" modelAttribute="_cfg" action="${ctx}/maintenance/ipMultiplexPoolCfg/snatSaveOrUpdate" method="post" class="form-horizontal">
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
<input type="hidden" name="functionId" value="${_cfg.functionId}">
|
||||
<input type="hidden" name="addrPoolId" value="${_cfg.addrPoolId}">
|
||||
<input type="hidden" id="compileId" name="compileId" value="${_cfg.compileId}">
|
||||
<c:if test="${fn:length(serviceList)==1}">
|
||||
<c:forEach items="${serviceList}" var="service">
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
//搜索框提示语初始化
|
||||
if("${cfg.addrPoolId}"){
|
||||
$("#intype").val("${cfg.addrPoolId}");
|
||||
if("${cfg.cfgId}"){
|
||||
$("#intype").val("${cfg.cfgId}");
|
||||
}else if("${cfg.addrPoolName}"){
|
||||
$("#intype").val("${cfg.addrPoolName}");
|
||||
}else{
|
||||
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
|
||||
}
|
||||
@@ -38,8 +40,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
var requestUrl = "http://192.168.11.137:8090/command/?cmd=IpNumGet&addr_pool_id=";
|
||||
//var requestUrl = "https://api.douban.com/v2/book/search?q=javascript&count=1";
|
||||
$("td[addrPoolId]").each(function(){
|
||||
var td = $(this);
|
||||
var audit = $(this).attr("audit")
|
||||
@@ -48,7 +48,6 @@
|
||||
var failed=$.validator.messages.failed;
|
||||
// 判断是否为审核通过状态
|
||||
if(audit == 1){
|
||||
// $.getJSON(requestUrl,function(data,status){});
|
||||
$.ajax({
|
||||
timeout:15000,// 超时时间
|
||||
data:{"addrPoolId":addrPoolId,"cmd":"IpNumGet"},
|
||||
@@ -178,7 +177,8 @@
|
||||
<div class="input-group">
|
||||
<div class="input-group-btn">
|
||||
<form:select path="seltype" class="selectpicker select2 input-small" >
|
||||
<form:option value="addrPoolId"><spring:message code="address_pool_id"></spring:message></form:option>
|
||||
<form:option value="cfgId"><spring:message code="address_pool_id"></spring:message></form:option>
|
||||
<form:option value="addrPoolName"><spring:message code="address_pool"></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>
|
||||
@@ -357,7 +357,7 @@
|
||||
<!-- /筛选搜索内容栏 结束-->
|
||||
</form:form>
|
||||
</div>
|
||||
<sys:message content="${message}"/>
|
||||
<sys:message content="${message}" type="${messageTypes }"/>
|
||||
<div class="table-responsive">
|
||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||
<thead>
|
||||
@@ -371,7 +371,7 @@
|
||||
<th><spring:message code="block_type"/></th>
|
||||
<th class="sort-column r.is_valid"><spring:message code="valid_identifier"/></th>
|
||||
<th><spring:message code="is_audit"/></th>
|
||||
<th><spring:message code="whether_area_block"/></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>
|
||||
@@ -388,8 +388,8 @@
|
||||
<tbody>
|
||||
<c:forEach items="${page.list }" var="cfg" varStatus="status" step="1">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="i-checks" serviceId="${cfg.serviceId}" id="${cfg.cfgId}" value="${cfg.isAudit}" addressPoolId="${cfg.addrPoolId }" ></td>
|
||||
<td>${cfg.addrPoolId }</td>
|
||||
<td><input type="checkbox" class="i-checks" serviceId="${cfg.serviceId}" id="${cfg.cfgId}" value="${cfg.isAudit}" addressPoolId="${cfg.cfgId }" ></td>
|
||||
<td>${cfg.cfgId }</td>
|
||||
<td>
|
||||
<a href="javascript:;" data-original-title="${cfg.addrPoolName}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
@@ -397,7 +397,7 @@
|
||||
</a>
|
||||
</td>
|
||||
<td>${cfg.ipTotal }</td>
|
||||
<td audit="${cfg.isAudit}" addrPoolId="${cfg.addrPoolId }"><div class="loading-total"></div></td>
|
||||
<td audit="${cfg.isAudit}" addrPoolId="${cfg.cfgId }"><div class="loading-total"></div></td>
|
||||
|
||||
<td>
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
|
||||
@@ -419,14 +419,14 @@
|
||||
<c:when test="${cfg.isAudit eq '3'}"><span indexTable="${cfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon=""> <spring:message code="cancel_approved"/></span></c:when>
|
||||
</c:choose>
|
||||
</td>
|
||||
<td>
|
||||
<%-- <td>
|
||||
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="all"/></c:if>
|
||||
<c:if test="${cfg.isAreaEffective==1}">
|
||||
<a href="javascript:viewAreaInfo('${ctx}','${cfg.areaEffectiveIds }','${cfg.compileId }')" >
|
||||
<spring:message code="selective"/>
|
||||
</a>
|
||||
</c:if>
|
||||
</td>
|
||||
</td> --%>
|
||||
<td>${cfg.requestName }</td>
|
||||
<td>
|
||||
<c:set var="classify"></c:set>
|
||||
@@ -488,7 +488,7 @@
|
||||
<td>
|
||||
<!-- <a href="#">新增IP</a>
|
||||
<a href="#">删除IP</a> -->
|
||||
<a href="javascript:;" onclick="getInfo(this)" addrPoolId="${cfg.addrPoolId }"><spring:message code="show_detail"/></a>
|
||||
<a href="javascript:;" onclick="getInfo(this)" addrPoolId="${cfg.cfgId }"><spring:message code="show_detail"/></a>
|
||||
</td>
|
||||
<td>${cfg.creatorName }</td>
|
||||
<td><fmt:formatDate value="${cfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||
|
||||
@@ -79,7 +79,7 @@ $(function(){
|
||||
<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}" autocomplete="off">
|
||||
<input class="form-control" type="text" name="cfgDesc" value="${_cfg.cfgDesc}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -87,14 +87,14 @@ $(function(){
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="user"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="userRegion1" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<select name="userId" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<option value="" ><spring:message code="select"/></option>
|
||||
<c:forEach items="${users }" var="user">
|
||||
<option value="${user.id}" <c:if test="${_cfg.userRegion1 eq user.id }">selected</c:if>><spring:message code="${user.userName}"/></option>
|
||||
<option value="${user.id}" <c:if test="${_cfg.userId eq user.id }">selected</c:if>><spring:message code="${user.userName}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="userRegion1"></div>
|
||||
<div for="userId"></div>
|
||||
</div>
|
||||
</div>
|
||||
<c:if test="${fn:length(serviceList)>1}">
|
||||
@@ -131,138 +131,18 @@ $(function(){
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="address_pool"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="userRegion2" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<select name="addrPoolId" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<option value="" ><spring:message code="select"/></option>
|
||||
<c:forEach items="${addrPools }" var="addrPool">
|
||||
<option value="${addrPool.addrPoolId}" <c:if test="${_cfg.userRegion2 eq addrPool.addrPoolId }">selected</c:if>><spring:message code="${addrPool.addrPoolName}"/></option>
|
||||
<option value="${addrPool.cfgId}" <c:if test="${_cfg.addrPoolId eq addrPool.cfgId }">selected</c:if>><spring:message code="${addrPool.addrPoolName}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="userRegion2"></div>
|
||||
<div for="addrPoolId"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row ipInfo hidden">
|
||||
<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}">
|
||||
<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="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}"><spring:message code="${ipPatternC.itemValue}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="ipPattern"></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="client_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required ipCheck" type="text" name="srcIpAddress">
|
||||
</div>
|
||||
<div for="srcIpAddress"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row port">
|
||||
<div class="col-md-6 hidden">
|
||||
<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}"><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="client_port"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required portCheck" type="text" name="srcPort">
|
||||
</div>
|
||||
<div for="srcPort"></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">
|
||||
</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">
|
||||
</div>
|
||||
<div for="destPort"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row hidden protocol">
|
||||
<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}"><spring:message code="${protocolC.itemValue}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="protocol"></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="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">
|
||||
@@ -279,17 +159,6 @@ $(function(){
|
||||
</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>
|
||||
<br>
|
||||
<%@include file="/WEB-INF/include/form/areaInfo.jsp"%>
|
||||
<br>
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
//搜索框提示语初始化
|
||||
if("${cfg.cfgDesc}"){
|
||||
$("#intype").val("${cfg.cfgDesc}");
|
||||
}else if("${cfg.addrPoolName}"){
|
||||
$("#intype").val("${cfg.addrPoolName}");
|
||||
}else if("${cfg.userName}"){
|
||||
$("#intype").val("${cfg.userName}");
|
||||
}else if("${cfg.compileId}"){
|
||||
$("#intype").val("${cfg.compileId}");
|
||||
}else{
|
||||
@@ -63,7 +67,6 @@
|
||||
<div class="portlet">
|
||||
<div class="portlet-body">
|
||||
<div class="row" >
|
||||
<sys:message content="${message}" type="${messageTypes }"/>
|
||||
<form:form id="searchForm" modelAttribute="cfg" action="${ctx}/manipulation/ipmulitiplex/snatPolicyList?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}"/>
|
||||
@@ -94,7 +97,9 @@
|
||||
|
||||
<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="userName"><spring:message code="user"></spring:message></form:option>
|
||||
<form:option value="compileId"><spring:message code="cfg_id"></spring:message></form:option>
|
||||
<form:option value="addrPoolName"><spring:message code="address_pool"></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>
|
||||
@@ -125,7 +130,7 @@
|
||||
<div class="pull-right">
|
||||
<shiro:hasPermission name="snat_policy:config">
|
||||
<sys:delRow url="${ctx}/manipulation/ipmulitiplex/snatPolicyForm" id="contentTable" label="update"></sys:delRow>
|
||||
<sys:delRow url="${ctx}/manipulation/ipmulitiplex/snatDelete?functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
||||
<sys:delRow url="${ctx}/manipulation/ipmulitiplex/snatDelete?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
||||
<sys:delRow url="${ctx}/manipulation/ipmulitiplex/exportSnat?functionId=${cfg.functionId }" searchUrl="${ctx}/manipulation/ipmulitiplex/snatPolicyList?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="export"></sys:delRow>
|
||||
</shiro:hasPermission>
|
||||
<shiro:hasPermission name="snat_policy:confirm">
|
||||
@@ -274,6 +279,7 @@
|
||||
<!-- /筛选搜索内容栏 结束-->
|
||||
</form:form>
|
||||
</div>
|
||||
<sys:message content="${message}" type="${messageTypes }"/>
|
||||
<div class="table-responsive">
|
||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||
<thead>
|
||||
@@ -310,14 +316,14 @@
|
||||
<td>${indexCfg.cfgDesc }</td>
|
||||
<td>
|
||||
<c:forEach items="${addrPools }" var="addrPool">
|
||||
<c:if test="${indexCfg.userRegion2 eq addrPool.addrPoolId }">
|
||||
<c:if test="${indexCfg.addrPoolId eq addrPool.cfgId }">
|
||||
<spring:message code="${addrPool.addrPoolName }"/>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td>
|
||||
<c:forEach items="${users }" var="user">
|
||||
<c:if test="${indexCfg.userRegion1 eq user.id }">
|
||||
<c:if test="${indexCfg.userId eq user.id }">
|
||||
<spring:message code="${user.userName }"/>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
|
||||
Reference in New Issue
Block a user