diff --git a/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java b/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java new file mode 100644 index 000000000..806641e01 --- /dev/null +++ b/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java @@ -0,0 +1,194 @@ +package com.nis.web.controller.configuration; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import com.nis.domain.Page; +import com.nis.domain.SysDataDictionaryItem; +import com.nis.domain.configuration.AppPolicyCfg; +import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.specific.SpecificServiceCfg; +import com.nis.exceptions.MaatConvertException; +import com.nis.util.Constants; +import com.nis.util.DictUtils; +import com.nis.web.controller.BaseController; +import com.nis.web.security.UserUtils; + +/** + * 加密隧道行为控制类 + * @author wx + * + */ +@Controller +@RequestMapping("${adminPath}/encryptedtunnelbehav") +public class EncryptedTunnelBehaviorController extends BaseController { + /** + * app策略列表 + * @param model + * @param cfg + * @param request + * @param response + * @return + */ + @RequestMapping(value = {"list"}) + public String policyCfgList(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,HttpServletRequest request,HttpServletResponse response) { + Page searchPage=new Page(request,response,"r"); + Page page = appCfgService.findAppPolicyList(searchPage, cfg); + for(AppPolicyCfg entity:page.getList()){ + SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId()); + entity.setAppName(app.getSpecServiceName()); + } + //查找社交应用的所有有效二级特定服务 + SpecificServiceCfg second=new SpecificServiceCfg(); + for(SysDataDictionaryItem dict:DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) { + if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) { + second.setCfgType(Integer.parseInt(dict.getItemCode())); + break; + } + } + second.setIsValid(Constants.VALID_YES); + second.setIsLeaf(1); + List secondList=specificServiceCfgService.findAllSpecificServiceCfg(second, null); + //遍历,找到匹配项后将行为设置进去 + for(SpecificServiceCfg secondCfg:secondList) { + if(secondCfg.getSpecServiceCode()==null) continue; + for(AppPolicyCfg entity:page.getList()){ + if(entity.getBehavCode()==null) continue; + if(secondCfg.getSpecServiceCode().intValue()==entity.getBehavCode().intValue()) { + entity.setBehavName(secondCfg.getSpecServiceName()); + break; + } + } + } + model.addAttribute("page", page); + initPageCondition(model,cfg); + return "/cfg/encryptedtunnelbehav/list"; + } + /** + * 查询APP策略IP子配置 + * @param model + * @param cfgId + * @param index + * @return + */ + @RequestMapping(value = {"ajaxIpList"}) + public String ajaxSslSubList(Model model,Long cfgId,Integer index) { + AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId); + List tabList = new ArrayList(); + if(cfg.getIpPortList()!=null){ + String cfgType = null; + for(IpPortCfg ip:cfg.getIpPortList()){ + if(!ip.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"1",ip.getCfgType()}); + cfgType = ip.getCfgType(); + } + } + } + model.addAttribute("_cfg", cfg); + model.addAttribute("index", index); + model.addAttribute("tabList", tabList); + return "/cfg/encryptedtunnelbehav/ipList"; + } + /** + * 策略配置表单 + * @param model + * @param ids + * @param entity + * @return + */ + @RequestMapping(value = {"form"}) + @RequiresPermissions(value={"encryptedtunnelbehav:config"}) + public String policyCfgForm(Model model,String ids,AppPolicyCfg entity) { + if(StringUtils.isNotBlank(ids)){ + entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids)); + initUpdateFormCondition(model,entity); + }else{ + initFormCondition(model,entity); + } + model.addAttribute("_cfg", entity); + return "/cfg/encryptedtunnelbehav/form"; + } + /** + * 策略配置新增修改 + * @param model + * @param request + * @param response + * @param entity + * @param redirectAttributes + * @return + */ + @RequestMapping(value = {"save"}) + @RequiresPermissions(value={"encryptedtunnelbehav:config"}) + public String saveAppPolicyCfg(Model model,HttpServletRequest request,HttpServletResponse response, + AppPolicyCfg entity,RedirectAttributes redirectAttributes) { + try { + SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId()); + if(specificService!=null){ + entity.setAppCode(specificService.getSpecServiceCode()); + } + appCfgService.saveOrUpdateAppPolicyCfg(entity); + } catch (Exception e) { + e.printStackTrace(); + addMessage(redirectAttributes, e.getMessage()); + } + + return "redirect:" + adminPath +"/encryptedtunnelbehav/list?functionId="+entity.getFunctionId(); + } + /** + * 策略配置审核 + * @param isAudit + * @param isValid + * @param ids + * @param functionId + * @param redirectAttributes + * @return + */ + @RequestMapping(value = {"audit"}) + @RequiresPermissions(value={"encryptedtunnelbehav:confirm"}) + public String auditAppPolicyCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + AppPolicyCfg entity = new AppPolicyCfg(); + String[] idArray = ids.split(","); + for(String id :idArray){ + entity = appCfgService.getAppPolicyCfg(Long.parseLong(id)); + entity.setIsAudit(isAudit); + entity.setIsValid(isValid); + entity.setAuditorId(UserUtils.getUser().getId()); + entity.setAuditTime(new Date()); + entity.setFunctionId(functionId); + entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR); + try { + appCfgService.auditAppPolicyCfg(entity,isAudit); + } catch (MaatConvertException e) { + e.printStackTrace(); + logger.info("app策略配置下发失败:"+e.getMessage()); + addMessage(redirectAttributes, e.getMessage()); + } + } + return "redirect:" + adminPath +"/encryptedtunnelbehav/list?functionId="+functionId; + } + /** + * 策略配置删除 + * @param isValid + * @param ids + * @param functionId + * @return + */ + @RequestMapping(value = {"updateValid"}) + @RequiresPermissions(value={"encryptedtunnelbehav:config"}) + public String updateAppPolicyCfgValid(Integer isValid,String ids,Integer functionId) { + appCfgService.updateAppPolicyCfgValid(isValid,ids,functionId); + return "redirect:" + adminPath +"/encryptedtunnelbehav/list?functionId="+functionId; + } +} diff --git a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml index 6b1f5d881..2395f4f71 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml @@ -1708,7 +1708,7 @@ - delete from ip_port_cfg where compile_id=#{compileId} and protocol_id=21 and function_id=#{functionId} + delete from ip_port_cfg where compile_id=#{compileId} and function_id=#{functionId} + + + + <%-- --%> + <%-- --%> + + + +
+ + + + + + + +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ + + +
+
+
+
+
+
+ +
+ +
+
+
+
+ +
+
+ +

+ + + +

+ + + + + +
+ <%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%> +
+ +
+
+
+ + + + +
+
+
+ <%@include file="/WEB-INF/include/form/areaInfo.jsp" %> + <%@include file="/WEB-INF/include/form/basicInfo.jsp" %> +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/encryptedtunnelbehav/ipList.jsp b/src/main/webapp/WEB-INF/views/cfg/encryptedtunnelbehav/ipList.jsp new file mode 100644 index 000000000..8bb0252d2 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/encryptedtunnelbehav/ipList.jsp @@ -0,0 +1,130 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + +
+ + +
+ +
+
+
+
+ +
+
+
+
+
+ + +
+ + +
+
+ + + + + + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/encryptedtunnelbehav/list.jsp b/src/main/webapp/WEB-INF/views/cfg/encryptedtunnelbehav/list.jsp new file mode 100644 index 000000000..a50cb9544 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/encryptedtunnelbehav/list.jsp @@ -0,0 +1,452 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="encrypted_protocol_behavior"></spring:message> + + + + + + +
+ + + + + +

+ + +

+ +
+
+
+
+ + + + + + + + + + +
+
+ + + + + + + + +
+ +
+ + +
+
+
+
+ + + + + +
+ + + +
+
+
+ + + +
+
+ + + + + +
+ + +
+
+ href="javascript:;"> + + +
+
+ + + +
+
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+
+
+ + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+
+ + +
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + ${cfg.cfgDesc }${cfg.appName }${cfg.behavName }${cfg.ratelimit } + + + + + + + + + + + + + ${cfg.requestName } + + + + + + + + + + + + + + + ${fns:abbr(classify,20)} + + + + + + + + + + + + + + + + + ${fns:abbr(attribute,20)} + + + + + + + + + + + + + + + + + + ${fns:abbr(lableInfo,20)} + + + + + + + + + + + + +
${cfg.creatorName }${cfg.editorName }${cfg.auditorName }
+
${page}
+
+ +
+
+
+ + + \ No newline at end of file