(1)特定服务管理,增加一列,配置类型;

(2)app策略,增加一列行为类型
This commit is contained in:
wangxin
2018-07-23 18:48:11 +08:00
parent 5d99522e57
commit cb650427e4
19 changed files with 262 additions and 27 deletions

View File

@@ -36,7 +36,11 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
private Integer specServiceId;
private String appName;
private String cfgKeywords;
private String userRegion1;
private String userRegion2;
private String userRegion3;
private String userRegion4;
private String userRegion5;
@Expose
@ExcelField(title="expression_type")
@SerializedName("exprType")
@@ -155,5 +159,45 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
public void setIpPort(IpPortCfg ipPort) {
this.ipPort = ipPort;
}
public String getUserRegion1() {
return userRegion1;
}
public void setUserRegion1(String userRegion1) {
this.userRegion1 = userRegion1;
}
public String getUserRegion2() {
return userRegion2;
}
public void setUserRegion2(String userRegion2) {
this.userRegion2 = userRegion2;
}
public String getUserRegion3() {
return userRegion3;
}
public void setUserRegion3(String userRegion3) {
this.userRegion3 = userRegion3;
}
public String getUserRegion4() {
return userRegion4;
}
public void setUserRegion4(String userRegion4) {
this.userRegion4 = userRegion4;
}
public String getUserRegion5() {
return userRegion5;
}
public void setUserRegion5(String userRegion5) {
this.userRegion5 = userRegion5;
}
}

View File

@@ -25,11 +25,17 @@ public class SpecificServiceCfg extends BaseEntity<SpecificServiceCfg>{
private SpecificServiceCfg parent; //parent_id 父节点id int N 0表示一级节点
private Integer isLeaf; //is_leaf 是否是叶子节点 int N 0否1是只有一级填0
private Integer groupId; //group_id maat端配置分组id int N 缺省0表示未与maat分组同步
private Integer cfgType;//配置类型1app;2,加密隧道协议
private Date beginDate; // 开始日期
private Date endDate; // 结束日期
private String showSequence; //显示序号
public Integer getCfgType() {
return cfgType;
}
public void setCfgType(Integer cfgType) {
this.cfgType = cfgType;
}
public Integer getSpecServiceId() {
return specServiceId;
}

View File

@@ -16,14 +16,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.ServiceConfigInfo;
import com.nis.domain.configuration.AppByteCfg;
import com.nis.domain.configuration.AppDomainCfg;
import com.nis.domain.configuration.AppHttpCfg;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.exceptions.MaatConvertException;

View File

@@ -190,7 +190,7 @@ public class SpecificServiceCfgController extends BaseController {
@ResponseBody
@RequestMapping(value = "treeData")
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide,
@RequestParam(required=false)boolean isLeafShow,HttpServletResponse response){
@RequestParam(required=false)boolean isLeafShow,@RequestParam(required=true)Integer cfgType,HttpServletResponse response){
List<Map<String, Object>> mapList = Lists.newArrayList();
Map<String, Object> map2 = Maps.newHashMap();
map2.put("id", 0);
@@ -203,7 +203,7 @@ public class SpecificServiceCfgController extends BaseController {
SpecificServiceCfg specificServiceCfg = list.get(i);
if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){
if(specificServiceCfg.getIsValid().equals(0)||
(!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))){
(!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))||specificServiceCfg.getCfgType().intValue()!=cfgType){
continue;
}
Map<String, Object> map = Maps.newHashMap();
@@ -215,7 +215,26 @@ public class SpecificServiceCfgController extends BaseController {
}
return mapList;
}
/**
*
*/
@ResponseBody
@RequestMapping(value = "childrenList")
public List<Map<String, Object>> childrenList(@RequestParam(required=false)Integer parent,HttpServletResponse response){
List<Map<String, Object>> mapList = Lists.newArrayList();
List<SpecificServiceCfg> list = specificServiceCfgService.getChildrenById(parent);
for (int i=0; i<list.size(); i++){
Map<String, Object> map = Maps.newHashMap();
SpecificServiceCfg specificServiceCfg = list.get(i);
if(specificServiceCfg.getIsLeaf().equals(1)){
map.put("code", specificServiceCfg.getSpecServiceCode());
map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
map.put("name",specificServiceCfg.getSpecServiceName());
mapList.add(map);
}
}
return mapList;
}
/**
* 校验协议id是否重复
* @param specServiceId

View File

@@ -29,6 +29,11 @@
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<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" />
</resultMap>
<resultMap id="AppIpCfgMap" type="com.nis.domain.configuration.AppIpCfg" >
@@ -229,7 +234,8 @@
r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME,
r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY,
r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.RATELIMIT,r.FUNCTION_ID,
r.CFG_TYPE,r.CFG_REGION_CODE,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN
r.CFG_TYPE,r.CFG_REGION_CODE,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.USER_REGION1,r.USER_REGION2,
r.USER_REGION3,r.USER_REGION4,r.USER_REGION5
</sql>
<sql id="AppIpCfg_Column" >
@@ -440,6 +446,21 @@
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="userRegion1 != null and userRegion1 != ''">
AND r.user_region1 =#{userRegion1,jdbcType=VARCHAR}
</if>
<if test="userRegion2 != null and userRegion2 != ''">
AND r.user_region2 =#{userRegion2,jdbcType=VARCHAR}
</if>
<if test="userRegion3 != null and userRegion3 != ''">
AND r.user_region3 =#{userRegion3,jdbcType=VARCHAR}
</if>
<if test="userRegion4 != null and userRegion4 != ''">
AND r.user_region4 =#{userRegion4,jdbcType=VARCHAR}
</if>
<if test="userRegion5 != null and userRegion5 != ''">
AND r.user_region5 =#{userRegion5,jdbcType=VARCHAR}
</if>
<if test="ipPort!=null">
AND r.compile_id in (select t.compile_id from ip_port_cfg t
@@ -991,10 +1012,13 @@
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,RATELIMIT,FUNCTION_ID,
CFG_TYPE,CFG_REGION_CODE,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN
CFG_TYPE,CFG_REGION_CODE,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,USER_REGION1
,USER_REGION2,USER_REGION3,USER_REGION4,USER_REGION5
)values (
<include refid="AppCommonCfg_Value_List" />,
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER}
,#{userRegion1,jdbcType=VARCHAR} ,#{userRegion2,jdbcType=VARCHAR} ,#{userRegion3,jdbcType=VARCHAR}
,#{userRegion4,jdbcType=VARCHAR} ,#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<insert id="insertAppIpCfg" parameterType="com.nis.domain.configuration.AppIpCfg" >
@@ -1230,6 +1254,21 @@
</if>
<if test="cfgType != null and cfgType != ''">
CFG_TYPE =#{cfgType,jdbcType=VARCHAR},
</if>
<if test="userRegion1 != null and userRegion1 != ''">
USER_REGION1 =#{userRegion1,jdbcType=VARCHAR},
</if>
<if test="userRegion2 != null and userRegion2 != ''">
USER_REGION2 =#{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''">
USER_REGION1 =#{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''">
USER_REGION1 =#{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''">
USER_REGION1 =#{userRegion5,jdbcType=VARCHAR},
</if>
</trim>
</set>

View File

@@ -11,6 +11,7 @@
<result column="op_time" property="opTime" jdbcType="TIMESTAMP" />
<result column="is_leaf" property="isLeaf" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="INTEGER" />
<!-- 父id -->
<association property="parent" javaType="com.nis.domain.specific.SpecificServiceCfg">
<id column="parent_id" property="specServiceId" jdbcType="INTEGER" />
@@ -26,7 +27,8 @@
s.op_time AS opTime,
s.parent_id AS "parent.specServiceId",
s.is_leaf AS isLeaf,
s.group_id AS groupId
s.group_id AS groupId,
s.cfg_type AS cfgType
</sql>
@@ -53,6 +55,9 @@
<if test="groupId != null and groupId != '' ">
AND group_id like '%${groupId}%'
</if>
<if test="cfgType != null and cfgType != '' ">
AND cfg_type =#{cfgType,jdbcType=INTEGER}
</if>
<if test="beginDate != null" >
AND s.op_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
@@ -112,6 +117,9 @@
<if test="specificServiceCfg.groupId != null and specificServiceCfg.groupId != '' ">
AND group_id like '%${specificServiceCfg.groupId}%'
</if>
<if test="specificServiceCfg.cfgType != null and specificServiceCfg.cfgType != '' ">
AND cfg_type = #{specificServiceCfg.cfgType}
</if>
<if test="specificServiceCfg.beginDate != null">
AND op_time &gt; #{specificServiceCfg.beginDate}
</if>
@@ -130,8 +138,8 @@
<!-- 新增 -->
<insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceCfg" useGeneratedKeys="true">
insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id)
values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId})
insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id,cfg_type)
values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId},#{cfgType})
</insert>
<!-- 修改 -->
@@ -144,7 +152,8 @@
s.op_time = #{opTime},
s.parent_id = #{parent.specServiceId},
s.is_leaf = #{isLeaf},
s.group_id = #{groupId}
s.group_id = #{groupId},
s.cfg_type = #{cfgType}
WHERE s.spec_service_id = #{specServiceId}
</update>

View File

@@ -86,6 +86,19 @@ public class ServiceDictInfoService extends BaseService{
}
return list;
}
/**
* 查询该类型所有的非叶子配置
*/
public List<ServiceDictInfo> findAllNoLeafDictList(String itType,Integer cfgType) {
List<ServiceDictInfo> list = Lists.newArrayList();
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType);
for(Integer intType:intArr){
List<ServiceDictInfo> tempList = serviceDictInfoDao.findAllNoLeafDictList(intType);
list.addAll(tempList);
}
return list;
}
/**
* 根据主键查询字典详细信息
* @param serviceDictId