1.增加列表缺少字段导出相应修改 2.增加分组域配置批量删除功能 3.修复分组域配置导入不下发bug

This commit is contained in:
zhangwenqing
2019-06-19 16:15:21 +08:00
parent 5f7eb1ec43
commit bb13d8bbec
26 changed files with 882 additions and 92 deletions

View File

@@ -18,8 +18,11 @@ public class DomainCommCfg extends BaseStringCfg<DomainCommCfg>{
@ExcelField(title="group_name",sort=2)
protected String groupName;//公共组名称
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=18)
protected Integer exprType;
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=20)
protected Integer matchMethod ;
protected Integer matchMethod;
public String getCfgKeywords() {
return cfgKeywords;
@@ -54,5 +57,11 @@ public class DomainCommCfg extends BaseStringCfg<DomainCommCfg>{
public void setMatchMethod(Integer matchMethod) {
this.matchMethod = matchMethod;
}
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
}

View File

@@ -39,14 +39,14 @@ public class IpCommCfg extends BaseCfg<IpCommCfg> {
protected String destIpAddress;
@ExcelField(title="src_port_pattern",dictType="PORT_PATTERN",sort=54)
protected Integer srcPortPattern;
@ExcelField(title="dest_port_pattern",dictType="PORT_PATTERN",sort=54)
@ExcelField(title="dest_port_pattern",dictType="PORT_PATTERN",sort=56)
protected Integer destPortPattern;
@ExcelField(title="client_port",sort=55)
protected String srcPort;
@ExcelField(title="server_port",sort=56)
@ExcelField(title="server_port",sort=57)
protected String destPort;
protected Integer dnsStrategyId;
@ExcelField(title="ir_type",dictType="IR_TYPE",sort=57)
@ExcelField(title="ir_type",dictType="IR_TYPE",sort=58)
protected Integer irType;
@ExcelField(title="group_name",sort=45)
protected String groupName;

View File

@@ -18,8 +18,11 @@ public class ScriberIdCommCfg extends BaseStringCfg<ScriberIdCommCfg>{
@ExcelField(title="group_name",sort=2)
protected String groupName;//公共组名称
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=18)
protected Integer exprType;
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=20)
protected Integer matchMethod ;
protected Integer matchMethod;
public String getCfgKeywords() {
return cfgKeywords;
@@ -54,5 +57,11 @@ public class ScriberIdCommCfg extends BaseStringCfg<ScriberIdCommCfg>{
public void setMatchMethod(Integer matchMethod) {
this.matchMethod = matchMethod;
}
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
}

View File

@@ -16,8 +16,11 @@ public class UrlCommCfg extends BaseStringCfg<UrlCommCfg>{
@ExcelField(title="group_name",sort=2)
protected String groupName;//公共组名称
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=18)
protected Integer exprType;
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=20)
protected Integer matchMethod ;
protected Integer matchMethod;
public String getCfgKeywords() {
return cfgKeywords;
@@ -53,5 +56,11 @@ public class UrlCommCfg extends BaseStringCfg<UrlCommCfg>{
public void setMatchMethod(Integer matchMethod) {
this.matchMethod = matchMethod;
}
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
}

View File

@@ -116,9 +116,10 @@ public class DomainCommGroupController extends BaseController{
}
@RequestMapping(value = {"/delete"})
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes){
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")DomainCommCfg cfg){
try{
domainCommGroupService.delete(ids,groupIds);
domainCommGroupService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error("Delete failed",e);
@@ -264,7 +265,7 @@ public class DomainCommGroupController extends BaseController{
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), DomainCommCfg.class);
String cfgIndexInfoNoExport=",block_type,do_log,action,letter,whether_area_block,classification,attribute,label"
+ ",expression_type,userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ "is_hex,is_case_insenstive,cfg_id,is_audit,auditor,valid_identifier,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {

View File

@@ -47,7 +47,7 @@ public class IpCommGroupController extends BaseController {
@Autowired
private IpCommGroupCfgService ipCommGroupCfgService;
@RequestMapping(value = { "/list" })
public String list(Model model, @ModelAttribute("cfg") IpCommCfg entity, HttpServletRequest request, HttpServletResponse response) {
Page<IpCommCfg> page = ipCommGroupCfgService.findPage(new Page<IpCommCfg>(request, response, "r"),entity);
@@ -124,10 +124,11 @@ public class IpCommGroupController extends BaseController {
@RequestMapping(value = { "/delete" })
@RequiresPermissions(value = { "ip:common:config" })
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes) {
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")IpCommCfg cfg) {
try {
ipCommGroupCfgService.delete(ids, groupIds);
addMessage(redirectAttributes, "success", "delete_success");
ipCommGroupCfgService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes, "success", "delete_success");
} catch (Exception e) {
logger.error("Delete failed", e);
if (e instanceof MaatConvertException) {
@@ -172,7 +173,7 @@ public class IpCommGroupController extends BaseController {
classMap.put(entity.getMenuNameCode(), IpCommCfg.class);
String cfgIndexInfoNoExport = ",block_type,do_log,action"
+ ",letter,whether_area_block,classification,attribute,label,userregion1,userregion2,userregion3,userregion4,userregion5"
+ ",src_ip_pattern,src_port_pattern,client_port,dest_ip_pattern,dest_port_pattern,server_port,cfg_id,is_audit,auditor,valid_identifier,ir_type,";
+ ",cfg_id,is_audit,auditor,valid_identifier,ir_type,";
// 时间过滤
if (entity.getSearch_create_time_start() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;

View File

@@ -116,9 +116,10 @@ public class ScriberIdCommGroupController extends BaseController{
}
@RequestMapping(value = {"/delete"})
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes){
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")ScriberIdCommCfg cfg){
try{
scriberIdCommGroupService.delete(ids,groupIds);
scriberIdCommGroupService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error("Delete failed",e);
@@ -264,7 +265,7 @@ public class ScriberIdCommGroupController extends BaseController{
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ScriberIdCommCfg.class);
String cfgIndexInfoNoExport=",block_type,do_log,action,letter,whether_area_block,classification,attribute,label"
+ ",expression_type,userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ "is_hex,is_case_insenstive,cfg_id,is_audit,auditor,valid_identifier,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {

View File

@@ -116,9 +116,10 @@ public class UrlCommGroupController extends BaseController{
}
@RequestMapping(value = {"/delete"})
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes){
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")UrlCommCfg cfg){
try{
urlCommGroupService.delete(ids,groupIds);
urlCommGroupService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error("Delete failed",e);
@@ -264,7 +265,7 @@ public class UrlCommGroupController extends BaseController{
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), UrlCommCfg.class);
String cfgIndexInfoNoExport=",block_type,do_log,action,letter,whether_area_block,classification,attribute,label"
+ ",expression_type,userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ "is_hex,is_case_insenstive,cfg_id,is_audit,auditor,valid_identifier,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {

View File

@@ -5,6 +5,7 @@ import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.DomainCommCfg;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@@ -33,4 +34,5 @@ public interface DomainCommGroupDao extends CrudDao<DomainCommCfg>{
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<DomainCommCfg> getGroupIds(DomainCommCfg cfg);
}

View File

@@ -458,4 +458,68 @@
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.DomainCommCfg" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
domain_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</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="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
</trim>
</select>
</mapper>

View File

@@ -1,6 +1,7 @@
package com.nis.web.dao.basics;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
@@ -28,4 +29,7 @@ public interface IpCommGroupCfgDao extends CrudDao<IpCommCfg>{
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<IpCommCfg> getGroupIds(IpCommCfg cfg);
public void deleteCfgByGroupIds(@Param("groupIds")String groupIds);
}

View File

@@ -645,4 +645,84 @@
${sqlMap.dsf}
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.IpCommCfg" resultMap="IpCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
ip_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="destIpAddress != null and destIpAddress != ''">
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
</if>
<if test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="destPort != null and destPort !=''">
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
</if>
<if test="direction != null">
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
</trim>
</select>
<delete id="deleteCfgByGroupIds" parameterType="java.lang.String" >
delete from ip_comm_cfg where group_id in (${groupIds})
</delete>
</mapper>

View File

@@ -33,4 +33,5 @@ public interface ScriberIdCommGroupDao extends CrudDao<ScriberIdCommCfg>{
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<ScriberIdCommCfg> getGroupIds(ScriberIdCommCfg cfg);
}

View File

@@ -458,4 +458,68 @@
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.ScriberIdCommCfg" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
scriberid_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</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="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
</trim>
</select>
</mapper>

View File

@@ -37,4 +37,6 @@ public interface UrlCommGroupDao extends CrudDao<UrlCommCfg>{
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<UrlCommCfg> getGroupIds(UrlCommCfg cfg);
}

View File

@@ -470,4 +470,65 @@
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.UrlCommCfg" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
url_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</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="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
</trim>
</select>
</mapper>

View File

@@ -52,4 +52,7 @@ public interface CommonPolicyDao {
List<ObjGroupCfg> getObjGroupPagedList(ObjGroupCfg entity);
void cancelScheduCfg(@Param("compileIds")String compileIds,@Param("tableName")String tableName);
// 分组域配置管理 批量删除时使用
void updateCfgIndexCommonGroupIdsBatch(CfgIndexInfo cfgIndexInfo);
}

View File

@@ -343,6 +343,14 @@
</where>
)
</if>
<if test="userRegion5 != null and userRegion5 != ''">
AND
<foreach collection="userRegion5.split(',')" index="index" item="item" open="(" separator="OR" close=")">
<if test="item != ''">
a.common_group_ids LIKE concat(concat('%',#{item,jdbcType=VARCHAR}),'%')
</if>
</foreach>
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
@@ -1255,4 +1263,27 @@
where table_name= #{tableName}
and compile_id in(${compileIds})
</delete>
<update id="updateCfgIndexCommonGroupIdsBatch" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
UPDATE
cfg_index_info a
SET
a.common_group_ids = #{commonGroupIds,jdbcType=VARCHAR}
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="isValid != null">
AND a.IS_VALID = #{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="userRegion5 != null and userRegion5 != ''">
AND
<foreach collection="userRegion5.split(',')" index="index" item="item" open="(" separator="OR" close=")">
<if test="item != ''">
a.common_group_ids LIKE concat(concat('%',#{item,jdbcType=VARCHAR}),'%')
</if>
</foreach>
</if>
</trim>
</update>
</mapper>

View File

@@ -3,6 +3,10 @@ package com.nis.web.service.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
@@ -22,9 +26,12 @@ import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtils;
import com.nis.web.controller.configuration.ObjectGroupController;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.basics.DomainCommGroupDao;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.configuration.CommonPolicyDao;
import com.nis.web.service.CrudService;
import com.nis.web.service.SpringContextHolder;
@@ -33,9 +40,10 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
@Autowired
private DomainCommGroupDao domainCommGroupDao;
@Autowired
private PolicyGroupInfoDao policyGroupInfoDao;
@Autowired
private CommonPolicyDao commonPolicyDao;
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
@@ -137,12 +145,94 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void delete(String ids, String groupIds) {
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
domainCommGroupDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(policyGroupInfos, Constants.DOMAIN_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
public void delete(String ids, String groupIds, DomainCommCfg cfg, HttpServletRequest request, HttpServletResponse response) throws Exception {
if(ids == null) {
groupIds = "";
String cfgIds = "";
String serviceGroupIds = "";
// 删除操作后获取 ①需配置更新的分组(存在域配置)②需配置取消的分组(无域配置) -> 配置分别操作更新或取消
List<DomainCommCfg> set = domainCommGroupDao.getGroupIds(cfg);
if(set.size() == 0) { // 无可删除配置
return;
}else {
for (DomainCommCfg domainCommCfg : set) {
Integer groupId = domainCommCfg.getGroupId();
cfgIds += ","+domainCommCfg.getCfgId();
if(!serviceGroupIds.contains(groupId+"")) {
serviceGroupIds += ","+groupId;
}
}
cfgIds = cfgIds.substring(1);
serviceGroupIds = serviceGroupIds.substring(1);
}
domainCommGroupDao.delete(cfgIds);
String[] strings = serviceGroupIds.split(",");
serviceGroupIds = "";
for (String groupId : strings) {
Integer size = domainCommGroupDao.getCfgInfoByGroupIds(groupId);
if(size == 0) { // 需配置取消
serviceGroupIds += ","+groupId;
}else { // 需配置更新
groupIds += ","+groupId;
}
}
// 配置取消
if(StringUtils.isNotBlank(serviceGroupIds)) {
serviceGroupIds = serviceGroupIds.substring(1);
ObjectGroupController groupController = SpringContextHolder.getBean(ObjectGroupController.class);
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request,response,"r");
Properties props = groupController.getMsgProp();
// 配置未生效
String updateStatusGroupIds = "";
for (String groupId : serviceGroupIds.split(",")) {
List<CfgIndexInfo> list = commonPolicyDao.getObjGroupListByGroupIds(groupId, 888, Constants.VALID_NO);
if(list.size() > 0) {
updateStatusGroupIds += ","+groupId;
}
}
if(StringUtils.isNotBlank(updateStatusGroupIds)) {
updateStatusGroupIds = updateStatusGroupIds.substring(1);
CfgIndexInfo entity = new CfgIndexInfo();
entity.setUserRegion5(updateStatusGroupIds);
entity.setFunctionId(888);
entity.setCommonGroupIds("");
entity.setIsValid(Constants.VALID_NO);
commonPolicyDao.updateCfgIndexCommonGroupIdsBatch(entity);
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(updateStatusGroupIds);
groupManageService.updateGroupStatus(policyGroupInfos, Constants.DOMAIN_OBJ_GROUP_TYPE);
}
// 配置已生效
CfgIndexInfo entity = new CfgIndexInfo();
entity.setUserRegion5(serviceGroupIds);
entity.setServiceId(0);
entity.setFunctionId(888);
entity.setIsValid(Constants.VALID_NO);
entity.setIsAudit(Constants.AUDIT_NOT_YES);
entity.setBatchAuditValue("1");
entity.setBatchValidValue("1,0");
groupController.auditAll(auditPage, Constants.AUDIT_NOT_YES, entity, props);
}
// 配置更新
if(StringUtils.isNotBlank(groupIds)) {
groupIds = groupIds.substring(1);
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
transObjGroupToMaat(policyGroupInfos);
}
}else {
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
domainCommGroupDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(policyGroupInfos, Constants.DOMAIN_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
}
}
public List<DomainCommCfg> getByIds(String ids) {
@@ -158,7 +248,7 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
long start=System.currentTimeMillis();
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
SqlSession batchSqlSession = null;
// 需要通过新增域接口新增的ip集合
// 导入域配置 -> ①分组不存在新增分组并返回groupId ②分组存在获取groupId -> 数据 入库 -> 更新分组状态 -> 判断是否配置下发
try{
String ids = "";
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
@@ -180,6 +270,7 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
String serviceGroupIds = ids.substring(1);
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
groupManageService.updateGroupStatus(policyGroupInfos, Constants.DOMAIN_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
}finally {
if(batchSqlSession != null){

View File

@@ -3,10 +3,11 @@ package com.nis.web.service.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import org.apache.commons.collections.CollectionUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
@@ -16,17 +17,22 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.beust.jcommander.internal.Maps;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.IpCommCfg;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtils;
import com.nis.web.controller.configuration.ObjectGroupController;
import com.nis.web.dao.basics.IpCommGroupCfgDao;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.configuration.CommonPolicyDao;
import com.nis.web.service.BaseService;
import com.nis.web.service.SpringContextHolder;
@Service
@@ -36,7 +42,9 @@ public class IpCommGroupCfgService extends BaseService {
private IpCommGroupCfgDao ipCommGroupCfgDao;
@Autowired
private PolicyGroupInfoDao policyGroupInfoDao;
@Autowired
private CommonPolicyDao commonPolicyDao;
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
/**
@@ -61,16 +69,6 @@ public class IpCommGroupCfgService extends BaseService {
return ipCommGroupCfgDao.get(id);
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void save(List<IpCommCfg> entitys) {
logger.warn("Start to save IP,size:"+entitys.size());
long start=System.currentTimeMillis();
for(IpCommCfg ipCfg:entitys) {
ipCommGroupCfgDao.insert(ipCfg);
}
long end=System.currentTimeMillis();
logger.warn("Save IP finish,cost:"+(end-start));
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void update(IpCommCfg entity){
// 获取分组ID
@@ -132,21 +130,100 @@ public class IpCommGroupCfgService extends BaseService {
}
// 更新分组状态
groupManageService.updateGroupStatus(policyGroupInfos, 5);
groupManageService.updateGroupStatus(policyGroupInfos, Constants.IP_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
}
}
public void delete(String ids, String groupIds) {
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
if(ids==null) {
throw new RuntimeException("ids is null!");
public void delete(String ids, String groupIds, IpCommCfg cfg, HttpServletRequest request, HttpServletResponse response) throws Exception {
if(ids == null) {
groupIds = "";
String cfgIds = "";
String serviceGroupIds = "";
// 删除操作后获取 ①需配置更新的分组(存在域配置)②需配置取消的分组(无域配置)-> 配置分别操作更新或取消
List<IpCommCfg> set = ipCommGroupCfgDao.getGroupIds(cfg);
if(set.size() == 0) { // 无可删除配置
return;
}else {
for (IpCommCfg ipCommCfg : set) {
Integer groupId = ipCommCfg.getGroupId();
cfgIds += ","+ipCommCfg.getCfgId();
if(!serviceGroupIds.contains(groupId+"")) {
serviceGroupIds += ","+groupId;
}
}
cfgIds = cfgIds.substring(1);
serviceGroupIds = serviceGroupIds.substring(1);
}
ipCommGroupCfgDao.delete(cfgIds);
String[] strings = serviceGroupIds.split(",");
serviceGroupIds = "";
for (String groupId : strings) {
Integer size = ipCommGroupCfgDao.getCfgInfoByGroupIds(groupId);
if(size == 0) { // 需配置取消
serviceGroupIds += ","+groupId;
}else { // 需配置更新
groupIds += ","+groupId;
}
}
// 配置取消
if(StringUtils.isNotBlank(serviceGroupIds)) {
serviceGroupIds = serviceGroupIds.substring(1);
ObjectGroupController groupController = SpringContextHolder.getBean(ObjectGroupController.class);
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request,response,"r");
Properties props = groupController.getMsgProp();
// 配置未生效
String updateStatusGroupIds = "";
for (String groupId : serviceGroupIds.split(",")) {
List<CfgIndexInfo> list = commonPolicyDao.getObjGroupListByGroupIds(groupId, 888, Constants.VALID_NO);
if(list.size() > 0) {
updateStatusGroupIds += ","+groupId;
}
}
if(StringUtils.isNotBlank(updateStatusGroupIds)) {
updateStatusGroupIds = updateStatusGroupIds.substring(1);
CfgIndexInfo entity = new CfgIndexInfo();
entity.setUserRegion5(updateStatusGroupIds);
entity.setFunctionId(888);
entity.setCommonGroupIds("");
entity.setIsValid(Constants.VALID_NO);
commonPolicyDao.updateCfgIndexCommonGroupIdsBatch(entity);
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(updateStatusGroupIds);
groupManageService.updateGroupStatus(policyGroupInfos, Constants.IP_OBJ_GROUP_TYPE);
}
// 配置已生效
CfgIndexInfo entity = new CfgIndexInfo();
entity.setUserRegion5(serviceGroupIds);
entity.setServiceId(0);
entity.setFunctionId(888);
entity.setIsValid(Constants.VALID_NO);
entity.setIsAudit(Constants.AUDIT_NOT_YES);
entity.setBatchAuditValue("1");
entity.setBatchValidValue("1,0");
groupController.auditAll(auditPage, Constants.AUDIT_NOT_YES, entity, props);
}
// 配置更新
if(StringUtils.isNotBlank(groupIds)) {
groupIds = groupIds.substring(1);
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
transObjGroupToMaat(policyGroupInfos);
}
}else {
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
ipCommGroupCfgDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(policyGroupInfos, Constants.IP_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
}
ipCommGroupCfgDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(policyGroupInfos, 5);
transObjGroupToMaat(policyGroupInfos);
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
@@ -155,7 +232,7 @@ public class IpCommGroupCfgService extends BaseService {
long start=System.currentTimeMillis();
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
SqlSession batchSqlSession = null;
//需要通过新增域接口新增的ip集合
// 导入域配置 -> ①分组不存在新增分组并返回serviceGroupId ②分组存在获取serviceGroupId -> 数据入库 -> 更新分组状态 -> 判断是否配置下发
try{
String ids = "";
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
@@ -178,6 +255,8 @@ public class IpCommGroupCfgService extends BaseService {
String serviceGroupIds = ids.substring(1);
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
groupManageService.updateGroupStatus(policyGroupInfos, Constants.IP_OBJ_GROUP_TYPE);
// 判断是否配置下发
transObjGroupToMaat(policyGroupInfos);
}finally {
if(batchSqlSession != null){
@@ -190,4 +269,5 @@ public class IpCommGroupCfgService extends BaseService {
cfgs.clear();
cfgs=null;
}
}

View File

@@ -3,6 +3,10 @@ package com.nis.web.service.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
@@ -22,9 +26,12 @@ import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtils;
import com.nis.web.controller.configuration.ObjectGroupController;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.basics.ScriberIdCommGroupDao;
import com.nis.web.dao.configuration.CommonPolicyDao;
import com.nis.web.service.CrudService;
import com.nis.web.service.SpringContextHolder;
@@ -33,9 +40,10 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
@Autowired
private ScriberIdCommGroupDao scriberIdCommGroupDao;
@Autowired
private PolicyGroupInfoDao policyGroupInfoDao;
@Autowired
private CommonPolicyDao commonPolicyDao;
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
@@ -137,12 +145,95 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void delete(String ids, String groupIds) {
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
scriberIdCommGroupDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
public void delete(String ids, String groupIds, ScriberIdCommCfg cfg, HttpServletRequest request, HttpServletResponse response) throws Exception {
if(ids == null) {
groupIds = "";
String cfgIds = "";
String serviceGroupIds = "";
// 删除操作后获取 ①需配置更新的分组(存在域配置)②需配置取消的分组(无域配置) -> 配置分别操作更新或取消
List<ScriberIdCommCfg> set = scriberIdCommGroupDao.getGroupIds(cfg);
if(set.size() == 0) { // 无可删除配置
return;
}else {
for (ScriberIdCommCfg scriberIdCommCfg : set) {
Integer groupId = scriberIdCommCfg.getGroupId();
cfgIds += ","+scriberIdCommCfg.getCfgId();
if(!serviceGroupIds.contains(groupId+"")) {
serviceGroupIds += ","+groupId;
}
}
cfgIds = cfgIds.substring(1);
serviceGroupIds = serviceGroupIds.substring(1);
}
scriberIdCommGroupDao.delete(cfgIds);
String[] strings = serviceGroupIds.split(",");
serviceGroupIds = "";
for (String groupId : strings) {
Integer size = scriberIdCommGroupDao.getCfgInfoByGroupIds(groupId);
if(size == 0) { // 需配置取消
serviceGroupIds += ","+groupId;
}else { // 需配置更新
groupIds += ","+groupId;
}
}
// 配置取消
if(StringUtils.isNotBlank(serviceGroupIds)) {
serviceGroupIds = serviceGroupIds.substring(1);
ObjectGroupController groupController = SpringContextHolder.getBean(ObjectGroupController.class);
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request,response,"r");
Properties props = groupController.getMsgProp();
// 配置未生效
String updateStatusGroupIds = "";
for (String groupId : serviceGroupIds.split(",")) {
List<CfgIndexInfo> list = commonPolicyDao.getObjGroupListByGroupIds(groupId, 888, Constants.VALID_NO);
if(list.size() > 0) {
updateStatusGroupIds += ","+groupId;
}
}
if(StringUtils.isNotBlank(updateStatusGroupIds)) {
updateStatusGroupIds = updateStatusGroupIds.substring(1);
CfgIndexInfo entity = new CfgIndexInfo();
entity.setUserRegion5(updateStatusGroupIds);
entity.setFunctionId(888);
entity.setCommonGroupIds("");
entity.setIsValid(Constants.VALID_NO);
commonPolicyDao.updateCfgIndexCommonGroupIdsBatch(entity);
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(updateStatusGroupIds);
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
}
// 配置已生效
CfgIndexInfo entity = new CfgIndexInfo();
entity.setUserRegion5(serviceGroupIds);
entity.setServiceId(0);
entity.setFunctionId(888);
entity.setIsValid(Constants.VALID_NO);
entity.setIsAudit(Constants.AUDIT_NOT_YES);
entity.setBatchAuditValue("1");
entity.setBatchValidValue("1,0");
groupController.auditAll(auditPage, Constants.AUDIT_NOT_YES, entity, props);
}
// 配置更新
if(StringUtils.isNotBlank(groupIds)) {
groupIds = groupIds.substring(1);
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
transObjGroupToMaat(policyGroupInfos);
}
}else {
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
scriberIdCommGroupDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
}
}
public List<ScriberIdCommCfg> getByIds(String ids) {
@@ -158,7 +249,7 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
long start=System.currentTimeMillis();
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
SqlSession batchSqlSession = null;
// 需要通过新增域接口新增的ip集合
// 导入域配置 -> ①分组不存在新增分组并返回groupId ②分组存在获取groupId -> 数据 入库 -> 更新分组状态 -> 判断是否配置下发
try{
String ids = "";
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
@@ -180,6 +271,7 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
String serviceGroupIds = ids.substring(1);
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
}finally {
if(batchSqlSession != null){

View File

@@ -3,9 +3,10 @@ package com.nis.web.service.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
@@ -18,14 +19,19 @@ import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtils;
import com.nis.web.controller.configuration.ObjectGroupController;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.basics.UrlCommGroupDao;
import com.nis.web.dao.configuration.CommonPolicyDao;
import com.nis.web.service.CrudService;
import com.nis.web.service.SpringContextHolder;
@@ -36,6 +42,9 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
private UrlCommGroupDao urlCommGroupDao;
@Autowired
private PolicyGroupInfoDao policyGroupInfoDao;
@Autowired
private CommonPolicyDao commonPolicyDao;
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
public Page<UrlCommCfg> findPage(Page<UrlCommCfg> page, UrlCommCfg entity) {
@@ -136,12 +145,95 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void delete(String ids, String groupIds) {
urlCommGroupDao.delete(ids);
// 更新分组状态
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
groupManageService.updateGroupStatus(policyGroupInfos, Constants.URL_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
public void delete(String ids, String groupIds, UrlCommCfg cfg, HttpServletRequest request, HttpServletResponse response) throws Exception {
if(ids == null) {
groupIds = "";
String cfgIds = "";
String serviceGroupIds = "";
// 删除操作后获取 ①需配置更新的分组(存在域配置)②需配置取消的分组(无域配置) -> 配置分别操作更新或取消
List<UrlCommCfg> set = urlCommGroupDao.getGroupIds(cfg);
if(set.size() == 0) { // 无可删除配置
return;
}else {
for (UrlCommCfg urlCommCfg : set) {
Integer groupId = urlCommCfg.getGroupId();
cfgIds += ","+urlCommCfg.getCfgId();
if(!serviceGroupIds.contains(groupId+"")) {
serviceGroupIds += ","+groupId;
}
}
cfgIds = cfgIds.substring(1);
serviceGroupIds = serviceGroupIds.substring(1);
}
urlCommGroupDao.delete(cfgIds);
String[] strings = serviceGroupIds.split(",");
serviceGroupIds = "";
for (String groupId : strings) {
Integer size = urlCommGroupDao.getCfgInfoByGroupIds(groupId);
if(size == 0) { // 需配置取消
serviceGroupIds += ","+groupId;
}else { // 需配置更新
groupIds += ","+groupId;
}
}
// 配置取消
if(StringUtils.isNotBlank(serviceGroupIds)) {
serviceGroupIds = serviceGroupIds.substring(1);
ObjectGroupController groupController = SpringContextHolder.getBean(ObjectGroupController.class);
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request,response,"r");
Properties props = groupController.getMsgProp();
// 配置未生效
String updateStatusGroupIds = "";
for (String groupId : serviceGroupIds.split(",")) {
List<CfgIndexInfo> list = commonPolicyDao.getObjGroupListByGroupIds(groupId, 888, Constants.VALID_NO);
if(list.size() > 0) {
updateStatusGroupIds += ","+groupId;
}
}
if(StringUtils.isNotBlank(updateStatusGroupIds)) {
updateStatusGroupIds = updateStatusGroupIds.substring(1);
CfgIndexInfo entity = new CfgIndexInfo();
entity.setUserRegion5(updateStatusGroupIds);
entity.setFunctionId(888);
entity.setCommonGroupIds("");
entity.setIsValid(Constants.VALID_NO);
commonPolicyDao.updateCfgIndexCommonGroupIdsBatch(entity);
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(updateStatusGroupIds);
groupManageService.updateGroupStatus(policyGroupInfos, Constants.URL_OBJ_GROUP_TYPE);
}
// 配置已生效
CfgIndexInfo entity = new CfgIndexInfo();
entity.setUserRegion5(serviceGroupIds);
entity.setServiceId(0);
entity.setFunctionId(888);
entity.setIsValid(Constants.VALID_NO);
entity.setIsAudit(Constants.AUDIT_NOT_YES);
entity.setBatchAuditValue("1");
entity.setBatchValidValue("1,0");
groupController.auditAll(auditPage, Constants.AUDIT_NOT_YES, entity, props);
}
// 配置更新
if(StringUtils.isNotBlank(groupIds)) {
groupIds = groupIds.substring(1);
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
transObjGroupToMaat(policyGroupInfos);
}
}else {
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
urlCommGroupDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(policyGroupInfos, Constants.URL_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
}
}
public List<UrlCommCfg> getByIds(String ids) {
@@ -157,7 +249,7 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
long start=System.currentTimeMillis();
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
SqlSession batchSqlSession = null;
// 需要通过新增域接口新增的ip集合
// 导入域配置 -> ①分组不存在新增分组并返回groupId ②分组存在获取groupId -> 数据 入库 -> 更新分组状态 -> 判断是否配置下发
try{
String ids = "";
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
@@ -179,6 +271,7 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
String serviceGroupIds = ids.substring(1);
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
groupManageService.updateGroupStatus(policyGroupInfos, Constants.URL_OBJ_GROUP_TYPE);
transObjGroupToMaat(policyGroupInfos);
}finally {
if(batchSqlSession != null){

View File

@@ -113,8 +113,14 @@
top.$('.jbox-body .jbox-icon').css('top','55px');
}else{
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
top.$.jBox.confirm("<spring:message code='confirm_message'/>","<spring:message code='delete_all'/>",function(v,h,f){
if(v=="ok"){
$("#searchForm").attr("action",url);
page();
}
});
/* top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return; */
}
}
@@ -265,9 +271,10 @@
<thead>
<tr>
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
<th column="config_describe" ><spring:message code="config_describe"/></th>
<th class="sort-column r.cfg_desc" column="config_describe" ><spring:message code="config_describe"/></th>
<th class="sort-column r.group_id" column="groupId"><spring:message code="group_name"/></th>
<th class="sort-column cfg_keywords"><spring:message code="key_word"/></th>
<th column="expression_type" ><spring:message code="expression_type"/></th>
<th column="match_method" ><spring:message code="match_method"/></th>
<th column="creator" ><spring:message code="creator"/></th>
<th column="config_time" class="sort-column create_time"><spring:message code="config_time"/></th>
@@ -288,6 +295,13 @@
</c:forEach>
</td>
<td>${cfg.cfgKeywords }</td>
<td>
<c:forEach items="${fns:getDictList('EXPRESSION_TYPE')}" var="exprTypeC">
<c:if test="${exprTypeC.itemCode eq cfg.exprType}">
<spring:message code="${exprTypeC.itemValue}"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('MATCH_METHOD')}" var="matchMethodC">
<c:if test="${matchMethodC.itemCode eq cfg.matchMethod}">

View File

@@ -110,8 +110,14 @@
top.$('.jbox-body .jbox-icon').css('top','55px');
}else{
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
top.$.jBox.confirm("<spring:message code='confirm_message'/>","<spring:message code='delete_all'/>",function(v,h,f){
if(v=="ok"){
$("#searchForm").attr("action",url);
page();
}
});
/* top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return; */
}
}
@@ -296,13 +302,22 @@
<thead>
<tr>
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
<th column="config_describe" ><spring:message code="config_describe"/></th>
<th class="sort-column r.cfg_desc" column="config_describe" ><spring:message code="config_describe"/></th>
<th class="sort-column r.group_id" column="groupId" ><spring:message code="group_name"/></th>
<th column="ip_type" ><spring:message code="ip_type"/></th>
<th column="src_ip_pattern" ><spring:message code="src_ip_pattern"/></th>
<th column="client_ip" ><spring:message code="client_ip"/></th>
<th column="dest_ip_pattern" ><spring:message code="dest_ip_pattern"/></th>
<th column="server_ip" ><spring:message code="server_ip"/></th>
<th column="protocol" ><spring:message code="protocol"/></th>
<th column="src_port_pattern" ><spring:message code="src_port_pattern"/></th>
<th column="client_port" ><spring:message code="client_port"/></th>
<th column="dest_port_pattern" ><spring:message code="dest_port_pattern"/></th>
<th column="server_port" ><spring:message code="server_port"/></th>
<th column="direction" ><spring:message code="direction"/></th>
<th column="protocol" ><spring:message code="protocol"/></th>
<th column="creator" ><spring:message code="creator"/></th>
<th column="config_time" class="sort-column r.create_time"><spring:message code="config_time"/></th>
<th column="editor" ><spring:message code="editor"/></th>
@@ -323,24 +338,58 @@
</td>
<td>
<c:forEach items="${fns:getDictList('IP_TYPE')}" var="ipTypeC">
<c:if test="${cfg.ipType==ipTypeC.itemCode}"><spring:message code="${ipTypeC.itemValue }"/></c:if>
</c:forEach>
</td>
<td title="${cfg.srcIpAddress }">${fns:abbr(cfg.srcIpAddress, 42)}</td>
<td title="${cfg.destIpAddress }">${fns:abbr(cfg.destIpAddress, 42)}</td>
<td>
<c:forEach items="${fns:getDictList('PROTOCOL')}" var="protocolC">
<c:if test="${cfg.protocol==protocolC.itemCode }">
<spring:message code="${protocolC.itemValue }"/>
<c:if test="${cfg.ipType == ipTypeC.itemCode}">
<spring:message code="${ipTypeC.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('IP_PATTERN')}" var="ipPatternC">
<c:if test="${cfg.srcIpPattern == ipPatternC.itemCode}">
<spring:message code="${ipPatternC.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td title="${cfg.srcIpAddress }">${fns:abbr(cfg.srcIpAddress, 42)}</td>
<td>
<c:forEach items="${fns:getDictList('IP_PATTERN')}" var="ipPatternC">
<c:if test="${cfg.destIpPattern == ipPatternC.itemCode}">
<spring:message code="${ipPatternC.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td title="${cfg.destIpAddress }">${fns:abbr(cfg.destIpAddress, 42)}</td>
<td>
<c:forEach items="${fns:getDictList('PORT_PATTERN')}" var="portPatternC">
<c:if test="${cfg.srcPortPattern == portPatternC.itemCode}">
<spring:message code="${portPatternC.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>${cfg.srcPort }</td>
<td>
<c:forEach items="${fns:getDictList('PORT_PATTERN')}" var="portPatternC">
<c:if test="${cfg.destPortPattern == portPatternC.itemCode}">
<spring:message code="${portPatternC.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>${cfg.destPort }</td>
<td>
<c:forEach items="${fns:getDictList('DIRECTION')}" var="directionC">
<c:if test="${cfg.direction==directionC.itemCode}">
<spring:message code="${directionC.itemValue}"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('PROTOCOL')}" var="protocolC">
<c:if test="${cfg.protocol==protocolC.itemCode }">
<spring:message code="${protocolC.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td>${cfg.creatorName }</td>
<td><fmt:formatDate value="${cfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>

View File

@@ -113,8 +113,14 @@
top.$('.jbox-body .jbox-icon').css('top','55px');
}else{
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
top.$.jBox.confirm("<spring:message code='confirm_message'/>","<spring:message code='delete_all'/>",function(v,h,f){
if(v=="ok"){
$("#searchForm").attr("action",url);
page();
}
});
/* top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return; */
}
}
@@ -265,9 +271,10 @@
<thead>
<tr>
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
<th column="config_describe" ><spring:message code="config_describe"/></th>
<th class="sort-column r.cfg_desc" column="config_describe" ><spring:message code="config_describe"/></th>
<th class="sort-column r.group_id" column="groupId"><spring:message code="group_name"/></th>
<th class="sort-column cfg_keywords"><spring:message code="key_word"/></th>
<th column="expression_type" ><spring:message code="expression_type"/></th>
<th column="match_method" ><spring:message code="match_method"/></th>
<th column="creator" ><spring:message code="creator"/></th>
<th column="config_time" class="sort-column create_time"><spring:message code="config_time"/></th>
@@ -288,6 +295,13 @@
</c:forEach>
</td>
<td>${cfg.cfgKeywords }</td>
<td>
<c:forEach items="${fns:getDictList('EXPRESSION_TYPE')}" var="exprTypeC">
<c:if test="${exprTypeC.itemCode eq cfg.exprType}">
<spring:message code="${exprTypeC.itemValue}"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('MATCH_METHOD')}" var="matchMethodC">
<c:if test="${matchMethodC.itemCode eq cfg.matchMethod}">

View File

@@ -108,8 +108,14 @@
top.$('.jbox-body .jbox-icon').css('top','55px');
}else{
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
top.$.jBox.confirm("<spring:message code='confirm_message'/>","<spring:message code='delete_all'/>",function(v,h,f){
if(v=="ok"){
$("#searchForm").attr("action",url);
page();
}
});
/* top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return; */
}
}
@@ -260,9 +266,10 @@
<thead>
<tr>
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
<th column="config_describe" ><spring:message code="config_describe"/></th>
<th class="sort-column r.cfg_desc" column="config_describe" ><spring:message code="config_describe"/></th>
<th class="sort-column r.group_id" column="groupId"><spring:message code="group_name"/></th>
<th class="sort-column cfg_keywords"><spring:message code="key_word"/></th>
<th column="expression_type" ><spring:message code="expression_type"/></th>
<th column="match_method" ><spring:message code="match_method"/></th>
<th column="creator" ><spring:message code="creator"/></th>
<th column="config_time" class="sort-column create_time"><spring:message code="config_time"/></th>
@@ -283,6 +290,13 @@
</c:forEach>
</td>
<td>${cfg.cfgKeywords }</td>
<td>
<c:forEach items="${fns:getDictList('EXPRESSION_TYPE')}" var="exprTypeC">
<c:if test="${exprTypeC.itemCode eq cfg.exprType}">
<spring:message code="${exprTypeC.itemValue}"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('MATCH_METHOD')}" var="matchMethodC">
<c:if test="${matchMethodC.itemCode eq cfg.matchMethod}">