(1)IP配置审核提交
(2)域名白名单审核修改
This commit is contained in:
@@ -29,6 +29,8 @@ public final class Constants {
|
|||||||
public static final int ACTION_DJ = 2;
|
public static final int ACTION_DJ = 2;
|
||||||
public static final int ACTION_BMD = 5;
|
public static final int ACTION_BMD = 5;
|
||||||
public static final int ACTION_HMD = 8;
|
public static final int ACTION_HMD = 8;
|
||||||
|
public static final Integer DROP_ACTION = Configurations.getIntProperty("drop_action",32);
|
||||||
|
public static final Integer LOOP_ACTION = Configurations.getIntProperty("loop_action",96);
|
||||||
public static final int CFG_PAGE = 0;
|
public static final int CFG_PAGE = 0;
|
||||||
public static final int AUDIT_PAGE = 1;
|
public static final int AUDIT_PAGE = 1;
|
||||||
public static final String DEFAULT_CAPTCHA_PARAM = "captcha";
|
public static final String DEFAULT_CAPTCHA_PARAM = "captcha";
|
||||||
|
|||||||
@@ -397,152 +397,7 @@ public class BaseController {
|
|||||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(cfg.getFunctionId());
|
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(cfg.getFunctionId());
|
||||||
model.addAttribute("serviceList", serviceList);
|
model.addAttribute("serviceList", serviceList);
|
||||||
}
|
}
|
||||||
|
@Deprecated
|
||||||
protected void setSaveOrUpdateProps(Model model,BaseCfg cfg,String areaCfgIds) throws Exception{
|
protected void setSaveOrUpdateProps(Model model,BaseCfg cfg,String areaCfgIds) throws Exception{
|
||||||
String tableName=cfg.getTableName();
|
|
||||||
List<BaseIpCfg> areaCfg=cfg.getAreaCfg();
|
|
||||||
List<AreaBean> areaIsps=cfg.getAreaIsp();
|
|
||||||
if(Constants.IS_AREA_EFFECTIVE_NO==cfg.getIsAreaEffective()){
|
|
||||||
cfg.setAreaEffectiveIds("");
|
|
||||||
cfg.setAreaType(null);
|
|
||||||
}else if(Constants.IS_AREA_EFFECTIVE_YES==cfg.getIsAreaEffective()){
|
|
||||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==cfg.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
|
|
||||||
StringBuffer areaEffectiveIds=new StringBuffer();
|
|
||||||
for(int i=0;i<areaIsps.size();i++){
|
|
||||||
if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
|
||||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
|
||||||
}else{
|
|
||||||
areaEffectiveIds.append(areaIsps.get(i).getArea());
|
|
||||||
}
|
|
||||||
if(i!=areaIsps.size()-1){
|
|
||||||
areaEffectiveIds.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(StringUtils.isBlank(areaEffectiveIds.toString())){
|
|
||||||
logger.error("区域管控,且按照地域运营商管控,但是地域运营商为空!");
|
|
||||||
addMessage(model,"save_failed");
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
cfg.setAreaEffectiveIds(areaEffectiveIds.toString());
|
|
||||||
}else if(Constants.AREA_EFFECTIVE_TYPE_AREA_IP==cfg.getAreaType()&&areaCfg!=null&&areaCfg.size()>0){
|
|
||||||
cfg.setAreaEffectiveIds("");
|
|
||||||
}else{
|
|
||||||
logger.error("区域管控,但是地域+ISP以及地域IP全部为空!");
|
|
||||||
addMessage(model,"save_failed");
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int serviceId=cfg.getServiceId();
|
|
||||||
if(StringUtils.isBlank(tableName)){
|
|
||||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
|
||||||
if(serviceConfigInfo!=null){
|
|
||||||
tableName=serviceConfigInfo.getTableName();
|
|
||||||
cfg.setTableName(tableName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(cfg.getCompileId()==null){
|
|
||||||
int compileId=0;
|
|
||||||
cfg.setCompileId(compileId);
|
|
||||||
}
|
|
||||||
Date date=new Date();
|
|
||||||
cfg.setIsValid(Constants.VALID_NO);
|
|
||||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
|
||||||
if(cfg.getCfgId()==null){//新增
|
|
||||||
cfg.setCreatorId(cfg.getCurrentUser().getId());
|
|
||||||
cfg.setCreateTime(date);
|
|
||||||
if(Constants.IS_AREA_EFFECTIVE_YES==cfg.getIsAreaEffective()&&areaCfg!=null){
|
|
||||||
for(BaseIpCfg area:areaCfg){
|
|
||||||
area.setTableName(AreaIpCfg.getTablename());
|
|
||||||
area.setServiceId(serviceId);
|
|
||||||
area.setCompileId(cfg.getCompileId());
|
|
||||||
area.setAction(cfg.getAction());
|
|
||||||
area.setIsValid(Constants.VALID_NO);
|
|
||||||
area.setIsAudit(Constants.AUDIT_NOT_YET);
|
|
||||||
area.setRequestId(cfg.getRequestId());
|
|
||||||
area.setClassify(cfg.getClassify());
|
|
||||||
area.setAttribute(cfg.getAttribute());
|
|
||||||
area.setLable(cfg.getLable());
|
|
||||||
area.setCreatorId(cfg.getCurrentUser().getId());
|
|
||||||
area.setCreateTime(date);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(cfg instanceof BaseIpCfg){
|
|
||||||
ipCfgService.addIpCfg((BaseIpCfg)cfg,areaCfg);
|
|
||||||
}else if(cfg instanceof BaseStringCfg){
|
|
||||||
stringCfgService.addStringCfg((BaseStringCfg)cfg,areaCfg);
|
|
||||||
}else if(cfg instanceof NumBoundaryCfg){
|
|
||||||
numCfgService.addNumCfg((NumBoundaryCfg)cfg,areaCfg);
|
|
||||||
}else if(cfg instanceof ComplexkeywordCfg){
|
|
||||||
complexStringCfgService.addStringCfg((ComplexkeywordCfg)cfg,areaCfg);
|
|
||||||
}
|
|
||||||
}else{//修改
|
|
||||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
|
||||||
cfg.setEditTime(new Date());
|
|
||||||
List<BaseIpCfg> updateAreaCfg=new ArrayList<>();
|
|
||||||
List<BaseIpCfg> deleteAreaCfg=new ArrayList<>();
|
|
||||||
List<BaseIpCfg> addAreaCfg=new ArrayList<>();
|
|
||||||
String[] cfgIds=null;
|
|
||||||
if(!StringUtils.isBlank(areaCfgIds)){
|
|
||||||
cfgIds=areaCfgIds.split(",");
|
|
||||||
}
|
|
||||||
if(Constants.IS_AREA_EFFECTIVE_YES==cfg.getIsAreaEffective()&&areaCfg!=null){
|
|
||||||
for(BaseIpCfg area:areaCfg){
|
|
||||||
area.setTableName(AreaIpCfg.getTablename());
|
|
||||||
area.setServiceId(serviceId);
|
|
||||||
area.setCompileId(cfg.getCompileId());
|
|
||||||
area.setAction(cfg.getAction());
|
|
||||||
area.setIsValid(Constants.VALID_NO);
|
|
||||||
area.setIsAudit(Constants.AUDIT_NOT_YET);
|
|
||||||
area.setRequestId(cfg.getRequestId());
|
|
||||||
area.setClassify(cfg.getClassify());
|
|
||||||
area.setAttribute(cfg.getAttribute());
|
|
||||||
area.setLable(cfg.getLable());
|
|
||||||
if(area.getCfgId()==null){
|
|
||||||
area.setCreatorId(cfg.getCurrentUser().getId());
|
|
||||||
area.setCreateTime(date);
|
|
||||||
addAreaCfg.add(area);
|
|
||||||
}else if(cfgIds!=null){
|
|
||||||
area.setEditorId(cfg.getCurrentUser().getId());
|
|
||||||
area.setEditTime(date);
|
|
||||||
boolean contains=false;
|
|
||||||
for(String cfgId:cfgIds){
|
|
||||||
if(!StringUtils.isBlank(cfgId)&&area.getCfgId().longValue()==Long.parseLong(cfgId)){
|
|
||||||
contains=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(contains){
|
|
||||||
updateAreaCfg.add(area);
|
|
||||||
}else{
|
|
||||||
deleteAreaCfg.add(area);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(cfgIds!=null){
|
|
||||||
for(String cfgId:cfgIds){
|
|
||||||
if(!StringUtils.isBlank(cfgId)){
|
|
||||||
AreaIpCfg area=new AreaIpCfg();
|
|
||||||
area.setTableName(AreaIpCfg.getTablename());
|
|
||||||
area.setIsValid(Constants.VALID_DEL);
|
|
||||||
area.setCfgId(Long.parseLong(cfgId));
|
|
||||||
area.setEditorId(cfg.getCurrentUser().getId());
|
|
||||||
area.setEditTime(date);
|
|
||||||
deleteAreaCfg.add(area);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(cfg instanceof BaseIpCfg){
|
|
||||||
ipCfgService.updateIpCfg((BaseIpCfg)cfg,addAreaCfg,updateAreaCfg,deleteAreaCfg);
|
|
||||||
}else if(cfg instanceof BaseStringCfg){
|
|
||||||
stringCfgService.updateStringCfg((BaseStringCfg)cfg,addAreaCfg,updateAreaCfg,deleteAreaCfg);
|
|
||||||
}else if(cfg instanceof NumBoundaryCfg){
|
|
||||||
numCfgService.updateNumCfg((NumBoundaryCfg)cfg,addAreaCfg,updateAreaCfg,deleteAreaCfg);
|
|
||||||
}else if(cfg instanceof ComplexkeywordCfg){
|
|
||||||
complexStringCfgService.updateStringCfg((ComplexkeywordCfg)cfg,addAreaCfg,updateAreaCfg,deleteAreaCfg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
addMessage(model,"save_success");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,4 +100,28 @@ public class IpController extends BaseController{
|
|||||||
}
|
}
|
||||||
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+functionId;
|
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+functionId;
|
||||||
}
|
}
|
||||||
|
@RequestMapping(value = {"audit"})
|
||||||
|
// @RequiresPermissions("iplist:audit")
|
||||||
|
public String audit(String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
|
||||||
|
try{
|
||||||
|
for(String id:ids.split(",")){
|
||||||
|
Long.parseLong(id);
|
||||||
|
}
|
||||||
|
List<BaseIpCfg> beans=ipCfgService.getListByCfgId(IpPortCfg.getTablename(),ids);
|
||||||
|
Date date=new Date();
|
||||||
|
for(BaseIpCfg bean:beans){
|
||||||
|
bean.setTableName(IpPortCfg.getTablename());
|
||||||
|
bean.setAuditorId(bean.getCurrentUser().getId());
|
||||||
|
bean.setAuditTime(date);
|
||||||
|
bean.setIsAudit(cfg.getIsAudit());
|
||||||
|
bean.setIsValid(cfg.getIsValid());
|
||||||
|
ipCfgService.audit(bean);
|
||||||
|
}
|
||||||
|
addMessage(redirectAttributes,"audit_success");
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("审核失败", e);
|
||||||
|
addMessage(redirectAttributes, "audit_failed");
|
||||||
|
}
|
||||||
|
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+cfg.getFunctionId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,10 +36,10 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="BaseStringCfg_Column_List_with_id" >
|
<sql id="BaseStringCfg_Column_List_with_id" >
|
||||||
CFG_ID, CFG_DESC, CFG_KEYWORDS,ACTION,IS_VALID,IS_AUDIT,
|
CFG_ID, CFG_DESC, CFG_KEYWORDS,CFG_TYPE,ACTION,IS_VALID,IS_AUDIT,
|
||||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,FUNCTION_ID
|
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,FUNCTION_ID,CFG_REGION_CODE
|
||||||
</sql>
|
</sql>
|
||||||
<!-- <sql id="BaseStringCfg_Column_List_with_id_alias" >
|
<!-- <sql id="BaseStringCfg_Column_List_with_id_alias" >
|
||||||
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc, r.CFG_KEYWORDS as cfgKeywords, r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
|
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc, r.CFG_KEYWORDS as cfgKeywords, r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
|
||||||
@@ -51,35 +51,35 @@
|
|||||||
<sql id="BaseStringCfg_Column_List_with_id_alias" >
|
<sql id="BaseStringCfg_Column_List_with_id_alias" >
|
||||||
<choose>
|
<choose>
|
||||||
<when test="page !=null and page.alias != null and page.alias != ''">
|
<when test="page !=null and page.alias != null and page.alias != ''">
|
||||||
${page.alias}.CFG_ID as cfgId, ${page.alias}.CFG_DESC as cfgDesc, ${page.alias}.CFG_KEYWORDS as cfgKeywords,${page.alias}.ACTION as action,${page.alias}.IS_VALID as isValid,${page.alias}.IS_AUDIT as isAudit,
|
${page.alias}.CFG_ID as cfgId, ${page.alias}.CFG_DESC as cfgDesc, ${page.alias}.CFG_KEYWORDS as cfgKeywords,${page.alias}.CFG_TYPE as cfgType,${page.alias}.ACTION as action,${page.alias}.IS_VALID as isValid,${page.alias}.IS_AUDIT as isAudit,
|
||||||
${page.alias}.CREATOR_ID as creatorId,${page.alias}.CREATE_TIME AS createTime,${page.alias}.EDITOR_ID as editorId,${page.alias}.EDIT_TIME AS editTime,${page.alias}.AUDITOR_ID as auditorId,${page.alias}.AUDIT_TIME AS auditTime,
|
${page.alias}.CREATOR_ID as creatorId,${page.alias}.CREATE_TIME AS createTime,${page.alias}.EDITOR_ID as editorId,${page.alias}.EDIT_TIME AS editTime,${page.alias}.AUDITOR_ID as auditorId,${page.alias}.AUDIT_TIME AS auditTime,
|
||||||
${page.alias}.SERVICE_ID as serviceId,${page.alias}.REQUEST_ID AS requestId,${page.alias}.COMPILE_ID AS compileId,${page.alias}.IS_AREA_EFFECTIVE as isAreaEffective,${page.alias}.classify,
|
${page.alias}.SERVICE_ID as serviceId,${page.alias}.REQUEST_ID AS requestId,${page.alias}.COMPILE_ID AS compileId,${page.alias}.IS_AREA_EFFECTIVE as isAreaEffective,${page.alias}.classify,
|
||||||
${page.alias}.ATTRIBUTE AS attribute,${page.alias}.LABLE AS lable,${page.alias}.AREA_EFFECTIVE_IDS AS areaEffectiveIds,${page.alias}.FUNCTION_ID AS functionId
|
${page.alias}.ATTRIBUTE AS attribute,${page.alias}.LABLE AS lable,${page.alias}.AREA_EFFECTIVE_IDS AS areaEffectiveIds,${page.alias}.FUNCTION_ID AS functionId,${page.alias}.CFG_REGION_CODE as cfgRegionCode
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc, r.CFG_KEYWORDS as cfgKeywords, r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
|
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc, r.CFG_KEYWORDS as cfgKeywords,r.CFG_TYPE as cfgType, r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
|
||||||
r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime,
|
r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime,
|
||||||
r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify,
|
r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify,
|
||||||
r.ATTRIBUTE AS attribute,r.LABLE AS lable,r.EXPR_TYPE as exprType,r.MATCH_METHOD as matchMethod,r.IS_HEXBIN as isHexbin,
|
r.ATTRIBUTE AS attribute,r.LABLE AS lable,r.EXPR_TYPE as exprType,r.MATCH_METHOD as matchMethod,r.IS_HEXBIN as isHexbin,
|
||||||
r.AREA_EFFECTIVE_IDS AS areaEffectiveIds,r.FUNCTION_ID AS functionId
|
r.AREA_EFFECTIVE_IDS AS areaEffectiveIds,r.FUNCTION_ID AS functionId,r.CFG_REGION_CODE as cfgRegionCode
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="BaseStringCfg_Column_List" >
|
<sql id="BaseStringCfg_Column_List" >
|
||||||
CFG_DESC, CFG_KEYWORDS, ACTION,IS_VALID,IS_AUDIT,
|
CFG_DESC, CFG_KEYWORDS,CFG_TYPE, ACTION,IS_VALID,IS_AUDIT,
|
||||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||||
ATTRIBUTE,LABLE,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,AREA_EFFECTIVE_IDS,FUNCTION_ID
|
ATTRIBUTE,LABLE,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,AREA_EFFECTIVE_IDS,FUNCTION_ID,CFG_REGION_CODE
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="BaseStringCfg_Value_List" >
|
<sql id="BaseStringCfg_Value_List" >
|
||||||
#{cfgDesc,jdbcType=VARCHAR},#{cfgKeywords,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
|
#{cfgDesc,jdbcType=VARCHAR},#{cfgKeywords,jdbcType=VARCHAR},#{cfgType,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
|
||||||
#{isValid,jdbcType=INTEGER},#{isAudit,jdbcType=INTEGER},#{creatorId,jdbcType=INTEGER},
|
#{isValid,jdbcType=INTEGER},#{isAudit,jdbcType=INTEGER},#{creatorId,jdbcType=INTEGER},
|
||||||
#{createTime,jdbcType=TIMESTAMP},#{editorId,jdbcType=INTEGER},#{editTime,jdbcType=TIMESTAMP},
|
#{createTime,jdbcType=TIMESTAMP},#{editorId,jdbcType=INTEGER},#{editTime,jdbcType=TIMESTAMP},
|
||||||
#{auditorId,jdbcType=INTEGER},#{auditTime,jdbcType=TIMESTAMP},#{serviceId,jdbcType=INTEGER},
|
#{auditorId,jdbcType=INTEGER},#{auditTime,jdbcType=TIMESTAMP},#{serviceId,jdbcType=INTEGER},
|
||||||
#{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
|
#{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
|
||||||
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
|
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
|
||||||
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER},
|
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER},
|
||||||
#{areaEffectiveIds,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER}
|
#{areaEffectiveIds,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER},#{cfgRegionCode,jdbcType=INTEGER}
|
||||||
</sql>
|
</sql>
|
||||||
<select id="getById" resultMap="BaseStringMap" parameterType="java.lang.Long" >
|
<select id="getById" resultMap="BaseStringMap" parameterType="java.lang.Long" >
|
||||||
SELECT
|
SELECT
|
||||||
@@ -139,6 +139,9 @@
|
|||||||
<if test="cfgKeywords != null and cfgKeywords != ''">
|
<if test="cfgKeywords != null and cfgKeywords != ''">
|
||||||
AND ${page.alias}.CFG_KEYWORDS like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
|
AND ${page.alias}.CFG_KEYWORDS like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="cfgType != null and cfgType != ''">
|
||||||
|
AND ${page.alias}.CFG_TYPE=#{cfgType,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
<if test="action != null">
|
<if test="action != null">
|
||||||
AND ${page.alias}.ACTION=#{action,jdbcType=INTEGER}
|
AND ${page.alias}.ACTION=#{action,jdbcType=INTEGER}
|
||||||
</if>
|
</if>
|
||||||
@@ -205,6 +208,9 @@
|
|||||||
<if test="functionId != null">
|
<if test="functionId != null">
|
||||||
AND ${page.alias}.FUNCTION_ID =#{functionId,jdbcType=INTEGER}
|
AND ${page.alias}.FUNCTION_ID =#{functionId,jdbcType=INTEGER}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="cfgRegionCode != null">
|
||||||
|
AND ${page.alias}.CFG_REGION_CODE =#{cfgRegionCode,jdbcType=INTEGER}
|
||||||
|
</if>
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
<if test="cfgId != null">
|
<if test="cfgId != null">
|
||||||
@@ -216,6 +222,9 @@
|
|||||||
<if test="cfgKeywords != null and cfgKeywords != ''">
|
<if test="cfgKeywords != null and cfgKeywords != ''">
|
||||||
AND r.CFG_KEYWORDS like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
|
AND r.CFG_KEYWORDS like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="cfgType != null and cfgType != ''">
|
||||||
|
AND r.CFG_TYPE =#{cfgType,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
<if test="action != null">
|
<if test="action != null">
|
||||||
AND r.ACTION=#{action,jdbcType=INTEGER}
|
AND r.ACTION=#{action,jdbcType=INTEGER}
|
||||||
</if>
|
</if>
|
||||||
@@ -282,6 +291,9 @@
|
|||||||
<if test="functionId != null">
|
<if test="functionId != null">
|
||||||
AND r.FUNCTION_ID =#{functionId,jdbcType=INTEGER}
|
AND r.FUNCTION_ID =#{functionId,jdbcType=INTEGER}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="cfgRegionCode != null">
|
||||||
|
AND r.CFG_REGION_CODE =#{cfgRegionCode,jdbcType=INTEGER}
|
||||||
|
</if>
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
</trim>
|
</trim>
|
||||||
@@ -339,6 +351,9 @@
|
|||||||
<if test="cfgKeywords != null and cfgKeywords != ''">
|
<if test="cfgKeywords != null and cfgKeywords != ''">
|
||||||
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
|
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="cfgType != null and cfgType != ''">
|
||||||
|
CFG_TYPE=#{cfgType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="action != null" >
|
<if test="action != null" >
|
||||||
action = #{action,jdbcType=INTEGER},
|
action = #{action,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
@@ -402,6 +417,9 @@
|
|||||||
<if test="functionId != null" >
|
<if test="functionId != null" >
|
||||||
function_id = #{functionId,jdbcType=INTEGER},
|
function_id = #{functionId,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="cfgRegionCode != null" >
|
||||||
|
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</set>
|
</set>
|
||||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.nis.web.service.configuration;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -54,9 +55,6 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
*/
|
*/
|
||||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||||
public void addIpCfg(BaseIpCfg cfg){
|
public void addIpCfg(BaseIpCfg cfg){
|
||||||
//区域IPsetAreaEffectiveIds设置
|
|
||||||
List<AreaIpCfg> areaCfg=cfg.getAreaCfg();
|
|
||||||
List<AreaBean> areaIsps=cfg.getAreaIsp();
|
|
||||||
//调用服务接口获取compileId
|
//调用服务接口获取compileId
|
||||||
Integer compileId = 0;
|
Integer compileId = 0;
|
||||||
try {
|
try {
|
||||||
@@ -71,29 +69,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
}
|
}
|
||||||
if(compileId!=0){
|
if(compileId!=0){
|
||||||
cfg.setCompileId(compileId);
|
cfg.setCompileId(compileId);
|
||||||
if(Constants.IS_AREA_EFFECTIVE_NO==cfg.getIsAreaEffective()){
|
setAreaEffectiveIds(cfg);
|
||||||
cfg.setAreaEffectiveIds("0");
|
if(cfg.getAreaCfg()!=null&&cfg.getAreaCfg().size()>0){
|
||||||
cfg.setAreaType(null);
|
|
||||||
}else if(Constants.IS_AREA_EFFECTIVE_YES==cfg.getIsAreaEffective()){
|
|
||||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==cfg.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
|
|
||||||
StringBuffer areaEffectiveIds=new StringBuffer();
|
|
||||||
for(int i=0;i<areaIsps.size();i++){
|
|
||||||
if(StringUtils.isNotBlank(areaIsps.get(i).getArea())&&StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
|
||||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
|
||||||
}else if(StringUtils.isNotBlank(areaIsps.get(i).getArea())){
|
|
||||||
areaEffectiveIds.append(areaIsps.get(i).getArea());
|
|
||||||
}else if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
|
||||||
areaEffectiveIds.append(areaIsps.get(i).getIsp());
|
|
||||||
}
|
|
||||||
if(i!=areaIsps.size()-1){
|
|
||||||
areaEffectiveIds.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cfg.setAreaEffectiveIds(areaEffectiveIds.toString());
|
|
||||||
}else if(Constants.AREA_EFFECTIVE_TYPE_AREA_IP==cfg.getAreaType()&&areaCfg!=null&&areaCfg.size()>0){
|
|
||||||
cfg.setAreaEffectiveIds("0");
|
|
||||||
}
|
|
||||||
if(areaCfg!=null&&areaCfg.size()>0){
|
|
||||||
for(AreaIpCfg c:cfg.getAreaCfg()){
|
for(AreaIpCfg c:cfg.getAreaCfg()){
|
||||||
c.initDefaultValue();
|
c.initDefaultValue();
|
||||||
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
|
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
|
||||||
@@ -103,8 +80,6 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
}
|
}
|
||||||
this.saveIpBatch(cfg.getAreaCfg());
|
this.saveIpBatch(cfg.getAreaCfg());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ipCfgDao.insert(cfg);
|
ipCfgDao.insert(cfg);
|
||||||
}else{
|
}else{
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
@@ -153,77 +128,166 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
area.setFunctionId(cfg.getFunctionId());
|
area.setFunctionId(cfg.getFunctionId());
|
||||||
areaIpCfgDao.deleteAreaIpCfg(area);
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
||||||
//区域IPsetAreaEffectiveIds设置
|
//区域IPsetAreaEffectiveIds设置
|
||||||
List<AreaIpCfg> areaCfg=cfg.getAreaCfg();
|
setAreaEffectiveIds(cfg);
|
||||||
List<AreaBean> areaIsps=cfg.getAreaIsp();
|
Date date=new Date();
|
||||||
if(Constants.IS_AREA_EFFECTIVE_NO==cfg.getIsAreaEffective()){
|
if(cfg.getAreaCfg()!=null&&cfg.getAreaCfg().size()>0){
|
||||||
cfg.setAreaEffectiveIds("0");
|
|
||||||
cfg.setAreaType(null);
|
|
||||||
}else if(Constants.IS_AREA_EFFECTIVE_YES==cfg.getIsAreaEffective()){
|
|
||||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==cfg.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
|
|
||||||
StringBuffer areaEffectiveIds=new StringBuffer();
|
|
||||||
for(int i=0;i<areaIsps.size();i++){
|
|
||||||
if(StringUtils.isNotBlank(areaIsps.get(i).getArea())&&StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
|
||||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
|
||||||
}else if(StringUtils.isNotBlank(areaIsps.get(i).getArea())){
|
|
||||||
areaEffectiveIds.append(areaIsps.get(i).getArea());
|
|
||||||
}else if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
|
||||||
areaEffectiveIds.append(areaIsps.get(i).getIsp());
|
|
||||||
}
|
|
||||||
if(i!=areaIsps.size()-1){
|
|
||||||
areaEffectiveIds.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cfg.setAreaEffectiveIds(areaEffectiveIds.toString());
|
|
||||||
}else if(Constants.AREA_EFFECTIVE_TYPE_AREA_IP==cfg.getAreaType()&&areaCfg!=null&&areaCfg.size()>0){
|
|
||||||
cfg.setAreaEffectiveIds("0");
|
|
||||||
}
|
|
||||||
if(areaCfg!=null&&areaCfg.size()>0){
|
|
||||||
for(AreaIpCfg c:cfg.getAreaCfg()){
|
for(AreaIpCfg c:cfg.getAreaCfg()){
|
||||||
c.initDefaultValue();
|
c.initDefaultValue();
|
||||||
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
|
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
|
||||||
"protocol","protocolId","areaEffectiveIds","cfgRegionCode",
|
"protocol","protocolId","areaEffectiveIds","cfgRegionCode",
|
||||||
"cfgType","ipPattern","srcIpAddress","portPattern","srcPort","destIpAddress","destPort"});
|
"cfgType","ipPattern","srcIpAddress","portPattern","srcPort","destIpAddress","destPort"});
|
||||||
c.setTableName(AreaIpCfg.getTablename());
|
c.setTableName(AreaIpCfg.getTablename());
|
||||||
|
c.setCreatorId(cfg.getCurrentUser().getId());
|
||||||
|
c.setCreateTime(date);
|
||||||
}
|
}
|
||||||
this.saveIpBatch(cfg.getAreaCfg());
|
this.saveIpBatch(cfg.getAreaCfg());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ipCfgDao.update(cfg);
|
ipCfgDao.update(cfg);
|
||||||
}
|
}
|
||||||
/**
|
public void audit(BaseIpCfg cfg) throws Exception{
|
||||||
*
|
//更新IP配置与区域IP的状态
|
||||||
* updateIpCfg(更新IP类配置)
|
List<BaseIpCfg> beans=new ArrayList<>();
|
||||||
* (继承BaseIpCfg这个类方可使用)
|
beans.add(cfg);
|
||||||
* @param baseIpCfg
|
this.auditBatch(beans, IpCfgDao.class);
|
||||||
* @return
|
List<BaseIpCfg> beans1=new ArrayList<>();
|
||||||
*int
|
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(cfg.getCompileId());
|
||||||
* @exception
|
for(AreaIpCfg area:areaIpCfgList){
|
||||||
* @since 1.0.0
|
BeanUtils.copyProperties(cfg,area ,new String[]{"cfgRegionCode"
|
||||||
*/
|
,"cfgType"
|
||||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
,"cfgId"
|
||||||
public void updateIpCfg(BaseIpCfg baseIpCfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
,"ipType"
|
||||||
// if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
,"ipPattern"
|
||||||
// this.saveIpBatch(addAreaCfg);
|
,"srcIpAddress"
|
||||||
// }
|
,"portPattern"
|
||||||
// if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
,"srcPort"
|
||||||
// this.updateIpBatch(updateAreaCfg);
|
,"destPort"
|
||||||
// }
|
,"protocol"
|
||||||
// if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
,"direction"
|
||||||
// this.deleteIpBatch(deleteAreaCfgs);
|
,"protocolId"
|
||||||
// }
|
});
|
||||||
// return ipCfgDao.update(baseIpCfg);
|
beans1.add(area);
|
||||||
|
}
|
||||||
|
this.auditIpBatch(beans1);
|
||||||
|
|
||||||
|
List<MaatCfg> configCompileList = new ArrayList<>();
|
||||||
|
List<GroupCfg> groupRelationList = new ArrayList<>();
|
||||||
|
// List<GroupCfg> areaGroupRelationList = new ArrayList<>();
|
||||||
|
List<IpCfg> ipRegionList = new ArrayList<>();
|
||||||
|
List<StringCfg> strRegionList = new ArrayList<>();
|
||||||
|
List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
||||||
|
List<DigestCfg> digestRegionList = new ArrayList<>();
|
||||||
|
List<IpCfg> areaIpRegionList = new ArrayList<>();
|
||||||
|
ToMaatBean maatBean = new ToMaatBean();
|
||||||
|
MaatCfg maatCfg = new MaatCfg();
|
||||||
|
maatCfg.initDefaultValue();
|
||||||
|
BeanUtils.copyProperties(cfg, maatCfg);
|
||||||
|
String json="";
|
||||||
|
if(cfg.getIsAudit()==1){
|
||||||
|
if(Constants.DROP_ACTION==cfg.getAction()||Constants.LOOP_ACTION==cfg.getAction()){
|
||||||
|
//调用服务接口下发配置数据
|
||||||
|
json=gsonToJson(cfg);
|
||||||
|
logger.info("IP管控下发配置参数:"+json);
|
||||||
|
//调用服务接口下发配置
|
||||||
|
try {
|
||||||
|
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||||
|
if(result!=null){
|
||||||
|
logger.info("IP管控配置下发响应信息:"+result.getMsg());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("IP管控配置下发失败",e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Map<String,List> map = cfgConvert(ipRegionList,beans,1,cfg,groupRelationList);
|
||||||
|
ipRegionList=map.get("dstList");
|
||||||
|
groupRelationList=map.get("groupList");
|
||||||
|
Map<String,List> areaMap = cfgConvert(areaIpRegionList,beans1,1,cfg,groupRelationList);
|
||||||
|
groupRelationList=areaMap.get("groupList");
|
||||||
|
areaIpRegionList=areaMap.get("dstList");
|
||||||
|
maatCfg.setAreaEffectiveIds(StringUtils.isBlank(cfg.getAreaEffectiveIds())?"0":cfg.getAreaEffectiveIds());
|
||||||
|
maatCfg.setUserRegion(cfg.getCompileId()+"");
|
||||||
|
maatCfg.setAction(cfg.getAction());
|
||||||
|
maatCfg.setAuditTime(cfg.getAuditTime());
|
||||||
|
maatCfg.setIpRegionList(ipRegionList);
|
||||||
|
maatCfg.setStrRegionList(strRegionList);
|
||||||
|
maatCfg.setNumRegionList(numRegionList);
|
||||||
|
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||||
|
maatCfg.setDigestRegionList(digestRegionList);
|
||||||
|
maatCfg.setGroupRelationList(groupRelationList);
|
||||||
|
maatCfg.setGroupNum(groupRelationList.size());
|
||||||
|
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||||
|
configCompileList.add(maatCfg);
|
||||||
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||||
|
maatBean.setConfigCompileList(configCompileList);
|
||||||
|
maatBean.setAuditTime(cfg.getAuditTime());
|
||||||
|
maatBean.setCreatorName(cfg.getCurrentUser().getName());
|
||||||
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||||
|
//调用服务接口下发配置数据
|
||||||
|
json=gsonToJson(maatBean);
|
||||||
|
logger.info("IP管控下发配置参数:"+json);
|
||||||
|
//调用服务接口下发配置
|
||||||
|
try {
|
||||||
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||||
|
if(result!=null){
|
||||||
|
logger.info("IP管控配置下发响应信息:"+result.getMsg());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("IP管控配置下发失败",e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(cfg.getIsAudit()==3){
|
||||||
|
if(Constants.DROP_ACTION==cfg.getAction()||Constants.LOOP_ACTION==cfg.getAction()){
|
||||||
|
Map<String,Object> map=new HashMap<String, Object>();
|
||||||
|
map.put("updateStatCfgList", cfg);
|
||||||
|
//调用服务接口取消配置
|
||||||
|
json=gsonToJson(map);
|
||||||
|
logger.info("IP管控配置参数:"+json);
|
||||||
|
//调用服务接口取消配置
|
||||||
|
try {
|
||||||
|
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||||
|
logger.info("IP管控取消配置响应信息:"+result.getMsg());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.info("IP管控取消配置失败");
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
maatCfg.setCompileId(cfg.getCompileId());
|
||||||
|
maatCfg.setServiceId(cfg.getServiceId());
|
||||||
|
maatCfg.setIsValid(0);//无效
|
||||||
|
configCompileList.add(maatCfg);
|
||||||
|
maatBean.setConfigCompileList(configCompileList);
|
||||||
|
maatBean.setAuditTime(cfg.getAuditTime());
|
||||||
|
maatBean.setCreatorName(cfg.getCurrentUser().getName());
|
||||||
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||||
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||||
|
//调用服务接口取消配置
|
||||||
|
json=gsonToJson(maatBean);
|
||||||
|
logger.info("IP管控配置参数:"+json);
|
||||||
|
//调用服务接口取消配置
|
||||||
|
try {
|
||||||
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
||||||
|
logger.info("IP管控取消配置响应信息:"+result.getMsg());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.info("IP管控取消配置失败");
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void auditWhiteIp(BaseIpCfg cfg) throws Exception{
|
public void auditWhiteIp(BaseIpCfg cfg) throws Exception{
|
||||||
List<BaseIpCfg> beans=new ArrayList<>();
|
List<BaseIpCfg> beans=new ArrayList<>();
|
||||||
beans.add(cfg);
|
beans.add(cfg);
|
||||||
this.auditBatch(beans, IpCfgDao.class);
|
this.auditBatch(beans, IpCfgDao.class);
|
||||||
List<MaatCfg> configCompileList = new ArrayList();
|
List<MaatCfg> configCompileList = new ArrayList<>();
|
||||||
List<GroupCfg> groupRelationList = new ArrayList();
|
List<GroupCfg> groupRelationList = new ArrayList<>();
|
||||||
List<IpCfg> ipRegionList = new ArrayList();
|
List<IpCfg> ipRegionList = new ArrayList<>();
|
||||||
List<StringCfg> strRegionList = new ArrayList();
|
List<StringCfg> strRegionList = new ArrayList<>();
|
||||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
||||||
List<DigestCfg> digestRegionList = new ArrayList();
|
List<DigestCfg> digestRegionList = new ArrayList<>();
|
||||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
List<IpCfg> areaIpRegionList = new ArrayList<>();
|
||||||
ToMaatBean maatBean = new ToMaatBean();
|
ToMaatBean maatBean = new ToMaatBean();
|
||||||
MaatCfg maatCfg = new MaatCfg();
|
MaatCfg maatCfg = new MaatCfg();
|
||||||
maatCfg.initDefaultValue();
|
maatCfg.initDefaultValue();
|
||||||
@@ -287,48 +351,6 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void auditWhiteIp(String ids,IpPortCfg cfg) throws Exception{
|
|
||||||
|
|
||||||
List<BaseIpCfg> beans=this.getListByCfgId(IpPortCfg.getTablename(),ids);
|
|
||||||
Date date=new Date();
|
|
||||||
for(BaseIpCfg bean:beans){
|
|
||||||
bean.setTableName(IpPortCfg.getTablename());
|
|
||||||
bean.setAuditorId(bean.getCurrentUser().getId());
|
|
||||||
bean.setAuditTime(date);
|
|
||||||
bean.setIsAudit(cfg.getIsAudit());
|
|
||||||
bean.setIsValid(cfg.getIsValid());
|
|
||||||
}
|
|
||||||
this.auditBatch(beans, IpCfgDao.class);
|
|
||||||
if(cfg.getIsAudit()==1){
|
|
||||||
//待调整
|
|
||||||
|
|
||||||
//调用服务接口下发配置数据
|
|
||||||
String json=gsonToJson(beans);
|
|
||||||
logger.info("IP白名单下发配置参数:"+json);
|
|
||||||
//调用服务接口下发配置
|
|
||||||
try {
|
|
||||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
||||||
logger.info("IP白名单配置下发响应信息:"+result.getMsg());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
logger.info("IP白名单配置下发失败");
|
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
|
||||||
}
|
|
||||||
}else if(cfg.getIsAudit()==3){
|
|
||||||
//调用服务接口取消配置
|
|
||||||
String json=gsonToJson(beans);
|
|
||||||
logger.info("IP白名单配置参数:"+json);
|
|
||||||
//调用服务接口取消配置
|
|
||||||
try {
|
|
||||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
|
||||||
logger.info("IP白名单取消配置响应信息:"+result.getMsg());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
logger.info("IP白名单取消配置失败");
|
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* auditIpCfg(审核IP类配置)
|
* auditIpCfg(审核IP类配置)
|
||||||
|
|||||||
@@ -14,15 +14,14 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import com.nis.domain.configuration.BaseIpCfg;
|
import com.nis.domain.configuration.BaseIpCfg;
|
||||||
import com.nis.domain.configuration.BaseStringCfg;
|
import com.nis.domain.configuration.BaseStringCfg;
|
||||||
import com.nis.domain.configuration.HttpUrlCfg;
|
import com.nis.domain.configuration.HttpUrlCfg;
|
||||||
import com.nis.domain.configuration.IpPortCfg;
|
|
||||||
import com.nis.domain.maat.MaatCfg;
|
import com.nis.domain.maat.MaatCfg;
|
||||||
import com.nis.domain.maat.ToMaatBean;
|
|
||||||
import com.nis.domain.maat.ToMaatResult;
|
|
||||||
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
||||||
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
||||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||||
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
||||||
import com.nis.domain.maat.MaatCfg.StringCfg;
|
import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||||
|
import com.nis.domain.maat.ToMaatBean;
|
||||||
|
import com.nis.domain.maat.ToMaatResult;
|
||||||
import com.nis.exceptions.MaatConvertException;
|
import com.nis.exceptions.MaatConvertException;
|
||||||
import com.nis.util.ConfigServiceUtil;
|
import com.nis.util.ConfigServiceUtil;
|
||||||
import com.nis.util.Constants;
|
import com.nis.util.Constants;
|
||||||
@@ -102,13 +101,13 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
|||||||
List<BaseStringCfg> beans=new ArrayList<>();
|
List<BaseStringCfg> beans=new ArrayList<>();
|
||||||
beans.add(cfg);
|
beans.add(cfg);
|
||||||
this.auditBatch(beans, StringCfgDao.class);
|
this.auditBatch(beans, StringCfgDao.class);
|
||||||
List<MaatCfg> configCompileList = new ArrayList();
|
List<MaatCfg> configCompileList = new ArrayList<>();
|
||||||
List<GroupCfg> groupRelationList = new ArrayList();
|
List<GroupCfg> groupRelationList = new ArrayList<>();
|
||||||
List<IpCfg> ipRegionList = new ArrayList();
|
List<IpCfg> ipRegionList = new ArrayList<>();
|
||||||
List<StringCfg> strRegionList = new ArrayList();
|
List<StringCfg> strRegionList = new ArrayList<>();
|
||||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
||||||
List<DigestCfg> digestRegionList = new ArrayList();
|
List<DigestCfg> digestRegionList = new ArrayList<>();
|
||||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
List<IpCfg> areaIpRegionList = new ArrayList<>();
|
||||||
ToMaatBean maatBean = new ToMaatBean();
|
ToMaatBean maatBean = new ToMaatBean();
|
||||||
MaatCfg maatCfg = new MaatCfg();
|
MaatCfg maatCfg = new MaatCfg();
|
||||||
maatCfg.initDefaultValue();
|
maatCfg.initDefaultValue();
|
||||||
@@ -117,7 +116,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
|||||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||||
Map<String,List> map = cfgConvert(strRegionList,beans,2,cfg,groupRelationList);
|
Map<String,List> map = cfgConvert(strRegionList,beans,2,cfg,groupRelationList);
|
||||||
groupRelationList=map.get("groupList");
|
groupRelationList=map.get("groupList");
|
||||||
ipRegionList=map.get("dstList");
|
strRegionList=map.get("dstList");
|
||||||
maatCfg.setAreaEffectiveIds("0");
|
maatCfg.setAreaEffectiveIds("0");
|
||||||
maatCfg.setUserRegion(cfg.getCompileId()+"");
|
maatCfg.setUserRegion(cfg.getCompileId()+"");
|
||||||
maatCfg.setAction(cfg.getAction());
|
maatCfg.setAction(cfg.getAction());
|
||||||
@@ -140,10 +139,10 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
|||||||
//调用服务接口下发配置
|
//调用服务接口下发配置
|
||||||
try {
|
try {
|
||||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||||
logger.info("IP白名单配置下发响应信息:"+result.getMsg());
|
logger.info("域名白名单配置下发响应信息:"+result.getMsg());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.info("IP白名单配置下发失败");
|
logger.info("域名白名单配置下发失败");
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||||
}
|
}
|
||||||
}else if(cfg.getIsAudit()==3){
|
}else if(cfg.getIsAudit()==3){
|
||||||
@@ -157,57 +156,15 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
|||||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||||
//调用服务接口取消配置
|
//调用服务接口取消配置
|
||||||
String json=gsonToJson(beans);
|
String json=gsonToJson(maatBean);
|
||||||
logger.info("IP白名单配置参数:"+json);
|
logger.info("域名白名单配置参数:"+json);
|
||||||
//调用服务接口取消配置
|
//调用服务接口取消配置
|
||||||
try {
|
try {
|
||||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
||||||
logger.info("IP白名单取消配置响应信息:"+result.getMsg());
|
logger.info("域名白名单取消配置响应信息:"+result.getMsg());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.info("IP白名单取消配置失败");
|
logger.info("域名白名单取消配置失败");
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void auditWhiteDomain(String ids,HttpUrlCfg cfg) throws Exception{
|
|
||||||
for(String id:ids.split(",")){
|
|
||||||
Long.parseLong(id);
|
|
||||||
}
|
|
||||||
List<BaseStringCfg> beans=stringCfgDao.getListByCfgId(HttpUrlCfg.getTablename(),ids);
|
|
||||||
Date date=new Date();
|
|
||||||
for(BaseStringCfg bean:beans){
|
|
||||||
bean.setTableName(IpPortCfg.getTablename());
|
|
||||||
bean.setAuditorId(bean.getCurrentUser().getId());
|
|
||||||
bean.setAuditTime(date);
|
|
||||||
bean.setIsAudit(cfg.getIsAudit());
|
|
||||||
bean.setIsValid(cfg.getIsValid());
|
|
||||||
}
|
|
||||||
this.auditBatch(beans, StringCfgDao.class);
|
|
||||||
if(cfg.getIsAudit()==1){
|
|
||||||
//调用服务接口下发配置数据
|
|
||||||
String json=gsonToJson(beans);
|
|
||||||
logger.info("文件样例下发配置参数:"+json);
|
|
||||||
//调用服务接口下发配置
|
|
||||||
try {
|
|
||||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
||||||
logger.info("IP白名单配置下发响应信息:"+result.getMsg());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
logger.info("IP白名单配置下发失败");
|
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
|
||||||
}
|
|
||||||
}else if(cfg.getIsAudit()==3){
|
|
||||||
//调用服务接口取消配置
|
|
||||||
String json=gsonToJson(beans);
|
|
||||||
logger.info("IP白名单配置参数:"+json);
|
|
||||||
//调用服务接口取消配置
|
|
||||||
try {
|
|
||||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
|
||||||
logger.info("IP白名单取消配置响应信息:"+result.getMsg());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
logger.info("IP白名单取消配置失败");
|
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,6 +103,13 @@ $(function(){
|
|||||||
<c:if test="${fn:length(serviceList)>1}">
|
<c:if test="${fn:length(serviceList)>1}">
|
||||||
<input type="hidden" id="serviceId" name="serviceId" value="${_cfg.serviceId}">
|
<input type="hidden" id="serviceId" name="serviceId" value="${_cfg.serviceId}">
|
||||||
</c:if>
|
</c:if>
|
||||||
|
<!-- 配置域类型 -->
|
||||||
|
<c:forEach items="${regionList}" var="region">
|
||||||
|
<c:if test="${_cfg.functionId eq region.functionId}">
|
||||||
|
<input type="hidden" name="cfgType" value="${region.configRegionValue}">
|
||||||
|
<input type="hidden" name="cfgRegionCode" value="${region.configRegionCode}">
|
||||||
|
</c:if>
|
||||||
|
</c:forEach>
|
||||||
<div class="form-body">
|
<div class="form-body">
|
||||||
<h3 class="form-section"><spring:message code="block_config"/></h3>
|
<h3 class="form-section"><spring:message code="block_config"/></h3>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
Reference in New Issue
Block a user