Url分组配置修改、删除和审核服务端
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
@@ -28,8 +30,11 @@ import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.basics.UrlCommGroupService;
|
||||
|
||||
import jersey.repackaged.com.google.common.collect.Lists;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/url")
|
||||
public class UrlCommGroupController extends BaseController{
|
||||
@@ -77,7 +82,7 @@ public class UrlCommGroupController extends BaseController{
|
||||
@RequiresPermissions(value={"http:url:config"})
|
||||
public String save(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
|
||||
|
||||
System.out.println("URL分组");
|
||||
// System.out.println("URL分组");
|
||||
try{
|
||||
urlCommGroupService.saveUrlCommGroupCfg(cfg);
|
||||
}catch(Exception e){
|
||||
@@ -93,7 +98,81 @@ public class UrlCommGroupController extends BaseController{
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/updateForm"})
|
||||
public String updateForm(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,String ids,@ModelAttribute("cfg")UrlCommGroupCfg cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
cfg = urlCommGroupService.get(Long.parseLong(ids));
|
||||
// initUpdateFormCondition(model, cfg);
|
||||
cfg.setGroupType(11);
|
||||
initUpdateFormCondition(model,cfg);
|
||||
//List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(4);
|
||||
//model.addAttribute("policyGroups", groupInfos);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/basics/urlCommGroupFormUpdate";
|
||||
}
|
||||
@RequestMapping(value = {"/update"})
|
||||
@RequiresPermissions(value={"http:url:config"})
|
||||
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")UrlCommGroupCfg cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
urlCommGroupService.update(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"http:url:config"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")UrlCommGroupCfg cfg
|
||||
,Integer isAudit
|
||||
,Integer isValid
|
||||
,String ids
|
||||
,Integer functionId
|
||||
, HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
//选中配置审核
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
List<UrlCommGroupCfg> urlGroupCfgs=urlCommGroupService.getByIds(ids);
|
||||
|
||||
/********************每次下发一个组的region,保证事物********************/
|
||||
for (UrlCommGroupCfg urlCommGroup : urlGroupCfgs) {
|
||||
try {
|
||||
urlCommGroupService.audit(urlCommGroup,isAudit,isValid);
|
||||
} catch (Exception e) {
|
||||
logger.error("审核失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"http:url:config"})
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
urlCommGroupService.delete(ids);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("Delete failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+functionId;
|
||||
}
|
||||
//urlComm配置导出
|
||||
@RequestMapping(value = "/exportUrlComm")
|
||||
public void exportAsnIp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@@ -118,7 +197,7 @@ public class UrlCommGroupController extends BaseController{
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), UrlCommGroupCfg.class);
|
||||
String cfgIndexInfoNoExport=",block_type,do_log,action"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",letter,whether_area_block,classification,attribute,label,expression_type,match_method"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,asn_no,is_hex,is_case_insenstive,";
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null ) {
|
||||
|
||||
@@ -9,14 +9,30 @@ import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface UrlCommGroupDao extends CrudDao<UrlCommGroupDao>{
|
||||
public interface UrlCommGroupDao extends CrudDao<UrlCommGroupCfg>{
|
||||
|
||||
// 查询列表
|
||||
public List<UrlCommGroupCfg> findAllPageList(UrlCommGroupCfg entity);
|
||||
|
||||
public List<UrlCommGroupCfg> findByPage(@Param("ids")String ids);
|
||||
|
||||
public List<UrlCommGroupCfg> findInfoByCfgId(@Param("cfgId")String cfgId);
|
||||
public List<UrlCommGroupCfg> findInfoByCfgId(@Param("cfgId")Long cfgId);
|
||||
//新增
|
||||
public int insertUrlCommGroupCfg(UrlCommGroupCfg entity);
|
||||
|
||||
public Integer findUrlUdFlag(@Param("groupId")Integer groupId);
|
||||
|
||||
public int updateUrlUdFlag(@Param("groupId")Integer groupId,@Param("udFlag")Integer udFlag);
|
||||
|
||||
//修改
|
||||
public int update(UrlCommGroupCfg entity);
|
||||
|
||||
//删除
|
||||
public int delete(@Param("ids")String ids);
|
||||
|
||||
public List<UrlCommGroupCfg> getByIds(@Param("ids")String ids);
|
||||
|
||||
|
||||
public Integer getGroupIdCount(@Param("groupId")String groupId);
|
||||
|
||||
}
|
||||
|
||||
@@ -165,17 +165,24 @@
|
||||
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
|
||||
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
|
||||
r.cfg_region_code,r.cfg_type,r.ratelimit,r.user_region1,r.user_region2,
|
||||
r.user_region3,r.user_region4,r.user_region5,
|
||||
s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name
|
||||
r.user_region3,r.user_region4,r.user_region5
|
||||
FROM
|
||||
http_url_cfg r
|
||||
LEFT JOIN sys_user s ON r.creator_id = s.id
|
||||
LEFT JOIN sys_user e ON r.editor_id = e.id
|
||||
LEFT JOIN sys_user u ON r.auditor_id = u.id
|
||||
where r.CFG_ID =#{cfgId}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="get" resultMap="urlCommGroupCfgMap">
|
||||
SELECT
|
||||
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,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.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
|
||||
r.cfg_region_code,r.cfg_type,r.ratelimit,r.user_region1,r.user_region2,
|
||||
r.user_region3,r.user_region4,r.user_region5
|
||||
from http_url_cfg r
|
||||
where r.cfg_id=#{cfgId}
|
||||
</select>
|
||||
|
||||
<insert id="insertUrlCommGroupCfg" parameterType="com.nis.domain.basics.UrlCommGroupCfg">
|
||||
insert into http_url_cfg (
|
||||
@@ -245,4 +252,135 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="findUrlUdFlag" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
||||
SELECT ud_flag from policy_group_info
|
||||
where group_id=#{groupId}
|
||||
and group_type=11
|
||||
</select>
|
||||
|
||||
<update id="updateUrlUdFlag" parameterType="java.lang.Integer">
|
||||
UPDATE policy_group_info SET ud_flag =#{udFlag}
|
||||
WHERE group_id=#{groupId}
|
||||
and group_type=11
|
||||
</update>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.basics.UrlCommGroupCfg" >
|
||||
update http_url_cfg
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgKeywords != null and cfgKeywords != ''" >
|
||||
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null" >
|
||||
action = #{action,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAudit != null" >
|
||||
is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
request_id = #{requestId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="compileId != null and compileId != ''" >
|
||||
compile_id = #{compileId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAreaEffective != null" >
|
||||
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="classify != null and classify != ''" >
|
||||
classify = #{classify,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''" >
|
||||
attribute = #{attribute,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lable != null and lable != ''" >
|
||||
lable = #{lable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="exprType != null" >
|
||||
expr_type = #{exprType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="matchMethod != null" >
|
||||
match_method = #{matchMethod,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isHexbin != null" >
|
||||
is_hexbin = #{isHexbin,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null" >
|
||||
function_id = #{functionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType != ''" >
|
||||
cfg_type = #{cfgType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgRegionCode != null " >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="ratelimit != null and ratelimit != ''" >
|
||||
ratelimit = #{ratelimit,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_region3 = #{userRegion3,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion4 != null and userRegion4 != ''" >
|
||||
user_region4 = #{userRegion4,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion5 != null and userRegion5 != ''" >
|
||||
user_region5 = #{userRegion5,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
and cfg_id = #{cfgId,jdbcType=INTEGER}
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="java.lang.String" >
|
||||
delete from http_url_cfg where cfg_id in (${ids})
|
||||
</delete>
|
||||
|
||||
<select id="getByIds" resultMap="urlCommGroupCfgMap">
|
||||
select
|
||||
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,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.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
|
||||
r.cfg_region_code,r.cfg_type,r.ratelimit,r.user_region1,r.user_region2,
|
||||
r.user_region3,r.user_region4,r.user_region5
|
||||
from http_url_cfg r
|
||||
where r.cfg_id in (${ids}) and is_valid !=-1
|
||||
</select>
|
||||
|
||||
<select id="getGroupIdCount" parameterType="java.lang.String" resultType="java.lang.Integer">
|
||||
SELECT COUNT(cfg_id) groupCount from http_url_cfg
|
||||
WHERE user_region3= #{groupId}
|
||||
and is_valid=1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -4,6 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -13,13 +16,27 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.UrlCommGroupCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
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.GroupCfg;
|
||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
||||
import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.basics.UrlCommGroupDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
@Service
|
||||
public class UrlCommGroupService extends CrudService<CrudDao<UrlCommGroupCfg>, UrlCommGroupCfg>{
|
||||
@@ -32,6 +49,10 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommGroupCfg>, U
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<UrlCommGroupCfg> list=urlCommGroupDao.findAllPageList(entity);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
String key=list.get(i).getCfgKeywords().replace("***and***", " ");
|
||||
list.get(i).setCfgKeywords(key);
|
||||
}
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
@@ -42,33 +63,91 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommGroupCfg>, U
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public UrlCommGroupCfg get(Long id ) {
|
||||
return urlCommGroupDao.get(id);
|
||||
}
|
||||
|
||||
//新增 insertUrlCommGroupCfg
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveUrlCommGroupCfg(CfgIndexInfo entity) {
|
||||
Date createTime=new Date();
|
||||
if(entity.getUrlCommGroupList()!=null) {
|
||||
for(UrlCommGroupCfg cfg:entity.getUrlCommGroupList()) {
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setRequestId(0);
|
||||
cfg.setClassify("0");
|
||||
cfg.setAttribute("0");
|
||||
cfg.setLable("0");
|
||||
cfg.setIsHexbin(0);
|
||||
cfg.setCreateTime(createTime);
|
||||
cfg.setCreatorId(entity.getCurrentUser().getId());
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(cfg.getCfgKeywords().contains("and")){
|
||||
cfg.setExprType(1);
|
||||
for (int i = 0; i < entity.getUrlCommGroupList().size(); i++) {
|
||||
BeanUtils.copyProperties(entity, entity.getUrlCommGroupList().get(i), new String[]{"cfgId"});
|
||||
entity.getUrlCommGroupList().get(i).setRequestId(0);
|
||||
entity.getUrlCommGroupList().get(i).setClassify("0");
|
||||
entity.getUrlCommGroupList().get(i).setAttribute("0");
|
||||
entity.getUrlCommGroupList().get(i).setLable("0");
|
||||
entity.getUrlCommGroupList().get(i).setIsHexbin(0);
|
||||
entity.getUrlCommGroupList().get(i).setCreateTime(createTime);
|
||||
entity.getUrlCommGroupList().get(i).setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.getUrlCommGroupList().get(i).setIsValid(Constants.VALID_NO);
|
||||
entity.getUrlCommGroupList().get(i).setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(entity.getUrlCommGroupList().get(i).getCfgKeywords().contains("***and***")){
|
||||
entity.getUrlCommGroupList().get(i).setExprType(1);
|
||||
}else{
|
||||
cfg.setExprType(0);
|
||||
entity.getUrlCommGroupList().get(i).setExprType(0);
|
||||
}
|
||||
urlCommGroupDao.insertUrlCommGroupCfg(cfg);
|
||||
urlCommGroupDao.insertUrlCommGroupCfg(entity.getUrlCommGroupList().get(i));
|
||||
}
|
||||
|
||||
// //修改公共组的标识
|
||||
// Integer udFlag=urlCommGroupDao.findUrlUdFlag(Integer.parseInt(entity.getUserRegion3()));
|
||||
// if(udFlag == 0){
|
||||
// urlCommGroupDao.updateUrlUdFlag(Integer.parseInt(entity.getUserRegion3()), 1);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void update(UrlCommGroupCfg entity){
|
||||
Date editTime=new Date();
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
entity.setEditTime(editTime);
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
if(entity.getCfgKeywords().contains("***and***")){
|
||||
entity.setExprType(1);
|
||||
}else{
|
||||
entity.setExprType(0);
|
||||
}
|
||||
urlCommGroupDao.update(entity);
|
||||
}
|
||||
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(String ids) {
|
||||
|
||||
urlCommGroupDao.delete(ids);
|
||||
}
|
||||
|
||||
public List<UrlCommGroupCfg> getByIds(String ids) {
|
||||
if(ids==null) {
|
||||
throw new RuntimeException("ids is null!");
|
||||
}
|
||||
return urlCommGroupDao.getByIds(ids);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void audit(UrlCommGroupCfg urlGroupCfg,Integer isAudit,Integer isValid) {
|
||||
|
||||
if(!StringUtil.isEmpty(urlGroupCfg)){
|
||||
urlGroupCfg.setIsValid(isValid);
|
||||
urlGroupCfg.setIsAudit(isAudit);
|
||||
urlGroupCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
urlGroupCfg.setAuditTime(new Date());
|
||||
|
||||
urlCommGroupDao.update(urlGroupCfg);
|
||||
}
|
||||
//下发配置时改变公共组udFlag标识
|
||||
//查询有效的url配置个数
|
||||
Integer groupCount=urlCommGroupDao.getGroupIdCount(urlGroupCfg.getUserRegion3());
|
||||
if(groupCount>0){//udFlag 设置为1
|
||||
urlCommGroupDao.updateUrlUdFlag(Integer.parseInt(urlGroupCfg.getUserRegion3()), 1);
|
||||
}else{//udFlag 设置为0
|
||||
urlCommGroupDao.updateUrlUdFlag(Integer.parseInt(urlGroupCfg.getUserRegion3()), 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,11 +42,22 @@ var addContent = function(obj, contentClassName) {
|
||||
var index=0;
|
||||
$("."+contentClassName).each(function(){
|
||||
reSort($(this),index);
|
||||
// $(".tags").attr("id","tags_"+index+"_tagsinput");
|
||||
// $(".tags").attr("id","tags_"+index);
|
||||
$("input[name='urlCommGroupList["+index+"].cfgKeywords']").attr("id","tags_"+index);
|
||||
index++;
|
||||
});
|
||||
$(".selectpicker").selectpicker("render");
|
||||
|
||||
var aaa=0
|
||||
/* $(".tagsinput").each(function(){
|
||||
$(this).attr("id","tags_"+aaa+"_tagsinput");
|
||||
if(aaa>0 && aaa==($(".tagsinput").length-1)){
|
||||
// if(aaa==($(".tagsinput").length-1) && aaa !=0){
|
||||
$("#tags_"+aaa+"_tagsinput").remove();
|
||||
// }
|
||||
ssss();
|
||||
}
|
||||
aaa++;
|
||||
}); */
|
||||
}
|
||||
|
||||
//业务窗口关闭
|
||||
@@ -61,6 +72,7 @@ var delContent = function(obj,contentClassName) {
|
||||
reSort($(this),index);
|
||||
index++;
|
||||
});
|
||||
|
||||
}
|
||||
var reSort=function(obj,index){
|
||||
$(obj).find("input,select").each(function(){
|
||||
@@ -70,6 +82,7 @@ var reSort=function(obj,index){
|
||||
var namePrefix="urlCommGroupList[";
|
||||
var nameSubfix=name.substring(name.indexOf("]"));
|
||||
var nameNew=namePrefix+index+nameSubfix;
|
||||
// $(".tags").attr("id","tags_"+index);
|
||||
if(nameNew!=name){
|
||||
$(this).attr("name",nameNew);
|
||||
$(this).parents(".form-group").find("div[for='"+name+"']").attr("for",nameNew);
|
||||
@@ -80,6 +93,86 @@ var reSort=function(obj,index){
|
||||
})
|
||||
}
|
||||
|
||||
function ssss(leng){
|
||||
|
||||
var tagsInputSettings1="#tags";
|
||||
var options;
|
||||
var ccc=0;
|
||||
$("input[name$='cfgKeywords']").each(function(){
|
||||
var tagsId = $(this).attr("id");
|
||||
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0];
|
||||
var isTags = $(this).hasClass("tags");//有tags样式的关键字输入框才需处理
|
||||
if(typeof(tagsId)!=='undefined' && tagsId.indexOf("tags_")!=-1 && isTags){
|
||||
// 表达式类型初始
|
||||
if($("input:radio[name='"+objNamePrefix+"exprType'][checked=checked]").val()==1){
|
||||
options = $("select[name='"+objNamePrefix+"matchMethod']").find("option[value!=0]");
|
||||
$("select[name='"+objNamePrefix+"matchMethod']").find("option[value!=0]").remove();
|
||||
}else{
|
||||
options = $("select[name='"+objNamePrefix+"matchMethod']").find("option[value!=0]");
|
||||
}
|
||||
//表单中如果有关键字内容可能输入多个关键字的情况,根据输入关键字个数确定表达式选中情况,不允许手动选中
|
||||
if($("select[name='"+objNamePrefix+"district']").val()!="Payload"){//如果是app 的payload特征,可选择表达式
|
||||
$("input:radio[name='"+objNamePrefix+"exprType']").attr("disabled",true);
|
||||
}
|
||||
|
||||
if(tagsId !="tags_0" && ccc>0 && ccc==($("input[name$='cfgKeywords']").length-1)){
|
||||
tagsInputSettings1 = tagsInputSettings1+",#"+tagsId;
|
||||
}
|
||||
ccc++;
|
||||
}
|
||||
|
||||
});
|
||||
$(tagsInputSettings1).tagsInput({
|
||||
width:$(tagsInputSettings1).find(".form-control").width(),
|
||||
defaultText:'please input keywords',
|
||||
'delimiter':'***and***',//特殊字符串分隔与表达式的多关键词
|
||||
maxCount:4,
|
||||
onAddTag:function(tag,size){
|
||||
var reg = new RegExp(/\t|\r|\n/);
|
||||
/* if (tag.match(reg)) {
|
||||
$(this).parent(".col-md-6").next("div").html("<label class='error'>"+$.validator.messages.hasInvisibleChar.replace("{0}","'"+tag+"'")+"</label>");
|
||||
}else{
|
||||
$(this).parent(".col-md-6").next("div").html("");
|
||||
} */
|
||||
//var keywordValue = "";
|
||||
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0];
|
||||
/*$("span[class='tag']").each(function(){
|
||||
keywordValue = keywordValue+"***iie***"+$(this).find("span").text().trim();
|
||||
});
|
||||
$(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/
|
||||
exprTypeChecked(objNamePrefix,size,options);
|
||||
/* if($(this).hasClass("urlCheck")){
|
||||
protectedListWarn($("#"+$(this).attr("id")+"_tagsinput"),$(this).val(),protectedList);
|
||||
} */
|
||||
},
|
||||
onRemoveTag:function(tag,size){
|
||||
// $(this).parent(".col-md-6").next("div").html("");
|
||||
//var keywordValue = "";
|
||||
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0];
|
||||
/*$("span[class='tag']").each(function(){
|
||||
keywordValue = keywordValue+"***iie***"+$(this).find("span").text().trim();
|
||||
});
|
||||
$(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/
|
||||
exprTypeChecked(objNamePrefix,size,options);
|
||||
/* if($(this).hasClass("urlCheck")){
|
||||
protectedListWarn($("#"+$(this).attr("id")+"_tagsinput"),$(this).val(),protectedList);
|
||||
} */
|
||||
}
|
||||
});
|
||||
$(".tagsinput").popover({
|
||||
animation:true,
|
||||
container:'body',
|
||||
placement:'right',
|
||||
html:true,
|
||||
trigger:"hover",
|
||||
title:"",
|
||||
content:function(){
|
||||
var content = $("#tagsinputTip").text();
|
||||
return content;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
@@ -187,7 +280,7 @@ var reSort=function(obj,index){
|
||||
<!-- 此配置的关键词可以输入多个关键词 -->
|
||||
<c:if test="${region.configMultiKeywords eq 1}">
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required tags <c:if test="${fn:containsIgnoreCase(region.configServiceType,'domain') }"> domainCheck </c:if> <c:if test="${fn:containsIgnoreCase(region.configServiceType,'url') }"> urlCheck </c:if>" type="text" id="tags_${tabName}${status.index}"
|
||||
<input class="form-control required tags <c:if test="${fn:containsIgnoreCase(region.configServiceType,'domain') }"> domainCheck </c:if> <c:if test="${fn:containsIgnoreCase(region.configServiceType,'url') }"> urlCheck </c:if>" type="text" id="tags_${status.index}"
|
||||
name="urlCommGroupList[-1].cfgKeywords"
|
||||
>
|
||||
</div>
|
||||
|
||||
266
src/main/webapp/WEB-INF/views/basics/urlCommGroupFormUpdate.jsp
Normal file
266
src/main/webapp/WEB-INF/views/basics/urlCommGroupFormUpdate.jsp
Normal file
@@ -0,0 +1,266 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<html>
|
||||
<head>
|
||||
<title><spring:message code="url_group_configuration"></spring:message></title>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
$("#cfgFrom").validate({
|
||||
errorPlacement: function(error,element){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
},
|
||||
submitHandler: function(form){
|
||||
/* $("[name='country']").val($("[name='userRegion1'] option:selected").attr("country"));
|
||||
$("[name='detail']").val($("[name='userRegion1'] option:selected").attr("detail"));
|
||||
$("[name='asnIpGroup']").val($("[name='userRegion1'] option:selected").attr("asnIpGroup")); */
|
||||
loading('onloading...');
|
||||
form.submit();
|
||||
},
|
||||
errorContainer: "#messageBox",
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
<h3 class="page-title">
|
||||
<spring:message code="url_group_configuration"></spring:message>
|
||||
</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="portlet box blue">
|
||||
<div class="portlet-title">
|
||||
<div class="caption">
|
||||
<i class="fa fa-gift"></i>
|
||||
<spring:message code="edit"></spring:message>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body form">
|
||||
<!-- BEGIN FORM-->
|
||||
<form id="cfgFrom" action="${ctx}/basics/url/update" method="post" class="form-horizontal">
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
<input type="hidden" name="regionId" value="${_cfg.regionId}">
|
||||
<input type="hidden" name="compileId" value="${_cfg.compileId}">
|
||||
<input type="hidden" name="functionId" value="${_cfg.functionId}">
|
||||
<input type="hidden" name="isValid" value="${_cfg.isValid}">
|
||||
<input type="hidden" name="isAudit" value="${_cfg.isAudit}">
|
||||
<input type="hidden" id="serviceId" name="serviceId" value="${_cfg.serviceId}">
|
||||
<input type="hidden" id="isAreaEffective" name="isAreaEffective" value="0">
|
||||
<input type="hidden" id="requestId" name="requestId" value="${_cfg.requestId}">
|
||||
<%-- <input type="hidden" id="protocolId" name="protocolId" value="${_cfg.protocolId}">
|
||||
<input type="hidden" id="asnIpGroup" name="asnIpGroup" value="${_cfg.asnIpGroup}"> --%>
|
||||
<!-- 配置域类型 -->
|
||||
<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"
|
||||
isMaat="${region.isMaat}"
|
||||
serviceType="${region.configServiceType}"
|
||||
ipPortShow="${region.configIpPortShow}"
|
||||
ipType="${region.configIpType}"
|
||||
ipPattern="${region.configIpPattern}"
|
||||
portPattern="${region.configPortPattern}"
|
||||
direction="${region.configDirection}"
|
||||
protocol="${region.configProtocol}"
|
||||
regionType="${region.regionType}"
|
||||
value="${region.configRegionCode}">
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<div class="form-body">
|
||||
<!-- desc and action -->
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="config_describe"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control" type="text" name="cfgDesc" value="${_cfg.cfgDesc}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="urlGroup"/></label>
|
||||
<div class="col-md-6">
|
||||
<%-- <input class="form-control required digits asnMustExists" type="text" name="${cfgName}.cfgKeywords" value="${cfg.cfgKeywords}" ctx="${ctx}"> --%>
|
||||
<select name="userRegion3" data-live-search="true" data-live-search-placeholder="search" class="selectpicker form-control required">
|
||||
<option value="${_cfg.userRegion3}"><spring:message code="select"/></option>
|
||||
<c:forEach items="${policyGroupInfos}" var="urlGroupInfo">
|
||||
<option value="${urlGroupInfo.groupId}"
|
||||
<c:if test="${_cfg.userRegion3 eq urlGroupInfo.groupId }">
|
||||
selected
|
||||
</c:if>
|
||||
>${urlGroupInfo.groupName}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="userRegion3"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- desc and action -->
|
||||
<h4 class="form-section">
|
||||
<spring:message code="http_url_title" />
|
||||
<!-- <small> <span
|
||||
class="glyphicon glyphicon-plus asnIpAdd"
|
||||
onClick="addContent(this,'strInfo')" title="add"></span></small> -->
|
||||
</h4>
|
||||
<!-- <div class="row strInfo boxSolid asnIp hidden disabled"> -->
|
||||
<!-- <input type="hidden" name="asnIpCfgs[0].protocolId" value="0"> -->
|
||||
<!-- <div class="row">
|
||||
<div class="pull-right">
|
||||
<span class="glyphicon glyphicon-remove pull-right" title="remove"
|
||||
onClick="delContent(this,'strInfo');" />
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<c:forEach items="${regionList}" var="region" varStatus="status">
|
||||
<%-- <c:set var="cfgName" value="urlCommGroupList[-1]"></c:set> --%>
|
||||
<%-- <input type="hidden" name="${cfgName}.sourceCompileId" value="${cfg.sourceCompileId }"> --%>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font>
|
||||
<spring:message code="keywords" />
|
||||
</label>
|
||||
<!-- 此配置的关键词可以输入多个关键词 -->
|
||||
<c:if test="${region.configMultiKeywords eq 1}">
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required tags <c:if test="${fn:containsIgnoreCase(region.configServiceType,'domain') }"> domainCheck </c:if> <c:if test="${fn:containsIgnoreCase(region.configServiceType,'url') }"> urlCheck </c:if>" type="text" id="tags_${tabName}${status.index}"
|
||||
name="cfgKeywords"
|
||||
value="${_cfg.cfgKeywords}">
|
||||
</div>
|
||||
</c:if>
|
||||
<!-- 此配置的关键词不允许输入多个关键词 -->
|
||||
<c:if test="${(region.configMultiKeywords eq 0) or (empty region.configMultiKeywords)}">
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required invisibleChar
|
||||
<c:if test="${fn:containsIgnoreCase(region.configServiceType,'domain') }"> domainCheck </c:if>
|
||||
<c:if test="${fn:containsIgnoreCase(region.configServiceType,'url') }"> urlCheck </c:if>
|
||||
"
|
||||
type="text"
|
||||
name="cfgKeywords"
|
||||
value="${_cfg.cfgKeywords}">
|
||||
</div>
|
||||
</c:if>
|
||||
<div for="cfgKeywords"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 exprType">
|
||||
<div class="form-group">
|
||||
|
||||
<label class="control-label col-md-3"><font color="red">*</font>
|
||||
<spring:message code="expression_type" /></label>
|
||||
<div class="col-md-6">
|
||||
<c:if test="${!empty region.configExprType}">
|
||||
<c:forEach var="exprType" items="${fn:split(region.configExprType,',')}" varStatus="stat" >
|
||||
<c:forEach items="${fns:getDictList('EXPRESSION_TYPE')}" var="exprTypeC" >
|
||||
<c:if test="${exprTypeC.itemCode eq exprType}">
|
||||
<label class="radio-inline">
|
||||
<input type="radio"
|
||||
name="exprType" value="${exprType }"
|
||||
class="required"
|
||||
<%-- <c:if test="${stat.index == 0 }"> checked </c:if> --%>
|
||||
<c:if test="${_cfg.exprType eq exprType || (empty _cfg.exprType && exprType eq 0)}">
|
||||
checked
|
||||
</c:if>
|
||||
>
|
||||
<spring:message code="${exprTypeC.itemValue }" />
|
||||
</label>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
<c:if test="${empty region.configExprType}">
|
||||
<c:forEach items="${fns:getDictList('EXPRESSION_TYPE')}" var="exprTypeC">
|
||||
<c:if test="${exprTypeC.itemCode eq 0}">
|
||||
<label class="radio-inline">
|
||||
<input type="radio"
|
||||
name="exprType" value="${exprTypeC.itemCode }"
|
||||
class="required" checked >
|
||||
<spring:message code="${exprTypeC.itemValue }" />
|
||||
</label>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
</div>
|
||||
<div for="exprType"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 matchMethod">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font>
|
||||
<spring:message code="match_method" /></label>
|
||||
<div class="col-md-6">
|
||||
<select name="matchMethod"
|
||||
class="selectpicker select2 form-control required ">
|
||||
<c:if test="${!empty region.configMatchMethod}">
|
||||
<c:forEach var="matchMethod" items="${fn:split(region.configMatchMethod,',')}">
|
||||
<c:forEach items="${fns:getDictList('MATCH_METHOD')}" var="matchMethodC">
|
||||
<c:if test="${matchMethodC.itemCode eq matchMethod}">
|
||||
<option value="${matchMethodC.itemCode}"
|
||||
>
|
||||
<spring:message code="${matchMethodC.itemValue}"/>
|
||||
</option>
|
||||
</c:if>
|
||||
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
<c:if test="${empty region.configMatchMethod}">
|
||||
<c:forEach items="${fns:getDictList('MATCH_METHOD')}" var="matchMethodC">
|
||||
<c:if test="${matchMethodC.itemCode eq 0}">
|
||||
<option value="${matchMethodC.itemCode}"
|
||||
selected
|
||||
>
|
||||
<spring:message code="${matchMethodC.itemValue}"/>
|
||||
</option>
|
||||
</c:if>
|
||||
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
</select>
|
||||
</div>
|
||||
<div for="matchMethod"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</c:forEach>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-md-offset-3 col-md-8">
|
||||
<button id="save" type="submit" class="btn green"><spring:message code="submit"/></button>
|
||||
<button id="cancel" type="button" class="btn default"><spring:message code="cancel"/></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- END FORM-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -146,8 +146,8 @@
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<shiro:hasPermission name="asn:ip:config">
|
||||
<sys:delRow url="${ctx}/basics/asn/updateForm?functionId=${cfg.functionId}" id="contentTable" label="update"></sys:delRow>
|
||||
<sys:delRow url="${ctx}/basics/asn/delete?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
||||
<sys:delRow url="${ctx}/basics/url/updateForm?functionId=${cfg.functionId}" id="contentTable" label="update"></sys:delRow>
|
||||
<sys:delRow url="${ctx}/basics/url/delete?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
||||
</shiro:hasPermission>
|
||||
|
||||
<div class="btn-group">
|
||||
@@ -169,9 +169,9 @@
|
||||
<i class="fa fa-angle-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right">
|
||||
<li><sys:delRow url="${ctx}/basics/asn/audit?isAudit=1&isValid=1&functionId=${cfg.functionId }" id="contentTable" label="approved"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/basics/asn/audit?isAudit=2&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="unapproved"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/basics/asn/audit?isAudit=3&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="cancelPass"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/basics/url/audit?isAudit=1&isValid=1&functionId=${cfg.functionId }" id="contentTable" label="approved"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/basics/url/audit?isAudit=2&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="unapproved"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/basics/url/audit?isAudit=3&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="cancelPass"></sys:delRow></li>
|
||||
</ul>
|
||||
</div>
|
||||
</shiro:hasPermission>
|
||||
|
||||
Reference in New Issue
Block a user