diff --git a/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java b/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java index da27c0bfe..2873bfd98 100644 --- a/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppPolicyCfg.java @@ -129,6 +129,8 @@ public class AppPolicyCfg extends BaseCfg { // TODO Auto-generated method stub super.initDefaultValue(); this.isHexbin = 0; + this.exprType=0; + this.matchMethod=0; } diff --git a/src/main/java/com/nis/domain/configuration/AppTcpCfg.java b/src/main/java/com/nis/domain/configuration/AppTcpCfg.java new file mode 100644 index 000000000..40270b491 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/AppTcpCfg.java @@ -0,0 +1,176 @@ +/** + *@Title: BaseStringConfig.java + *@Package com.nis.domain.restful + *@Description TODO + *@author dell + *@date 2018年2月5日 下午5:26:02 + *@version 版本号 + */ +package com.nis.domain.configuration; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; +import com.nis.util.excel.ExcelField; + +/** + * APP TCP会话字节数特征 + * @author dell + * + */ +public class AppTcpCfg extends BaseCfg { + + /** + * + */ + private static final long serialVersionUID = -4366457794248757698L; + private static final String tableName="app_session_cfg"; + @Expose + private Integer compileId; + @Expose + private Integer ratelimit; + private Integer appCode;//specific_service_cfg表一级节点的spec_service_code + private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code + private Integer specServiceId; + private String district; + private String cfgKeywords; + private String appName; + + /** + * 数值下界 + */ + protected Integer lowBoundary; + /** + * 数值上界 + */ + protected Integer upBoundary; + + @Expose + @ExcelField(title="expression_type") + @SerializedName("exprType") + protected Integer exprType ; + + @Expose + @ExcelField(title="match_method") + @SerializedName("matchMethod") + protected Integer matchMethod ; + + @Expose + @ExcelField(title="whether_hexbinary") + @SerializedName("isHexbin") + protected Integer isHexbin; + + + + + + public Integer getLowBoundary() { + return lowBoundary; + } + + public void setLowBoundary(Integer lowBoundary) { + this.lowBoundary = lowBoundary; + } + + public Integer getUpBoundary() { + return upBoundary; + } + + public void setUpBoundary(Integer upBoundary) { + this.upBoundary = upBoundary; + } + + public Integer getExprType() { + return exprType; + } + + public void setExprType(Integer exprType) { + this.exprType = exprType; + } + + public Integer getMatchMethod() { + return matchMethod; + } + + public void setMatchMethod(Integer matchMethod) { + this.matchMethod = matchMethod; + } + + public Integer getIsHexbin() { + return isHexbin; + } + + public void setIsHexbin(Integer isHexbin) { + this.isHexbin = isHexbin; + } + @Override + public void initDefaultValue() { + // TODO Auto-generated method stub + super.initDefaultValue(); + this.isHexbin = 0; + } + + + public Integer getCompileId() { + return compileId; + } + public void setCompileId(Integer compileId) { + this.compileId = compileId; + } + + public static String getTablename() { + return tableName; + } + + public Integer getRatelimit() { + return ratelimit; + } + + public void setRatelimit(Integer ratelimit) { + this.ratelimit = ratelimit; + } + public Integer getAppCode() { + return appCode; + } + public void setAppCode(Integer appCode) { + this.appCode = appCode; + } + public Integer getSpecServiceId() { + return specServiceId; + } + public void setSpecServiceId(Integer specServiceId) { + this.specServiceId = specServiceId; + } + + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + + public String getCfgKeywords() { + return cfgKeywords; + } + + public void setCfgKeywords(String cfgKeywords) { + this.cfgKeywords = cfgKeywords; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + public Integer getBehavCode() { + return behavCode; + } + + public void setBehavCode(Integer behavCode) { + this.behavCode = behavCode; + } + +} diff --git a/src/main/java/com/nis/domain/configuration/AppTopicDomainCfg.java b/src/main/java/com/nis/domain/configuration/AppTopicDomainCfg.java new file mode 100644 index 000000000..9fb349789 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/AppTopicDomainCfg.java @@ -0,0 +1,153 @@ +/** + *@Title: BaseStringConfig.java + *@Package com.nis.domain.restful + *@Description TODO + *@author dell + *@date 2018年2月5日 下午5:26:02 + *@version 版本号 + */ +package com.nis.domain.configuration; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; +import com.nis.util.excel.ExcelField; + +/** + * @Description: 主题网站配置 + * @author (dell) + * @date 2018年2月5日 下午5:26:02 + * @version V1.0 + */ +public class AppTopicDomainCfg extends BaseCfg { + + private static final long serialVersionUID = -442502179959427340L; + + private static final String tableName="app_topic_domain_cfg"; + @Expose + private Integer compileId; + @Expose + private Integer ratelimit; +// private Integer appCode;//specific_service_cfg表一级节点的spec_service_code + private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code + private Integer specServiceId; + private String domain; + private String cfgKeywords; + private String appName; + private String topic; + + @Expose + @ExcelField(title="expression_type") + @SerializedName("exprType") + protected Integer exprType ; + + @Expose + @ExcelField(title="match_method") + @SerializedName("matchMethod") + protected Integer matchMethod ; + + @Expose + @ExcelField(title="whether_hexbinary") + @SerializedName("isHexbin") + protected Integer isHexbin; + + + public String getTopic() { + return topic; + } + + public void setTopic(String topic) { + this.topic = topic; + } + + public Integer getExprType() { + return exprType; + } + + public void setExprType(Integer exprType) { + this.exprType = exprType; + } + + public Integer getMatchMethod() { + return matchMethod; + } + + public void setMatchMethod(Integer matchMethod) { + this.matchMethod = matchMethod; + } + + public Integer getIsHexbin() { + return isHexbin; + } + + public void setIsHexbin(Integer isHexbin) { + this.isHexbin = isHexbin; + } + @Override + public void initDefaultValue() { + super.initDefaultValue(); + this.isHexbin = 0; + this.doLog = 0;//app特征域不记录日志 + } + + + public Integer getCompileId() { + return compileId; + } + public void setCompileId(Integer compileId) { + this.compileId = compileId; + } + + public static String getTablename() { + return tableName; + } + + public Integer getRatelimit() { + return ratelimit; + } + + public void setRatelimit(Integer ratelimit) { + this.ratelimit = ratelimit; + } +// public Integer getAppCode() { +// return appCode; +// } +// public void setAppCode(Integer appCode) { +// this.appCode = appCode; +// } + public Integer getSpecServiceId() { + return specServiceId; + } + public void setSpecServiceId(Integer specServiceId) { + this.specServiceId = specServiceId; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + public String getCfgKeywords() { + return cfgKeywords; + } + + public void setCfgKeywords(String cfgKeywords) { + this.cfgKeywords = cfgKeywords; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + public Integer getBehavCode() { + return behavCode; + } + + public void setBehavCode(Integer behavCode) { + this.behavCode = behavCode; + } + +} diff --git a/src/main/java/com/nis/domain/configuration/FileDigestCfg.java b/src/main/java/com/nis/domain/configuration/FileDigestCfg.java index f77e350af..bc7c7eab3 100644 --- a/src/main/java/com/nis/domain/configuration/FileDigestCfg.java +++ b/src/main/java/com/nis/domain/configuration/FileDigestCfg.java @@ -30,7 +30,10 @@ public class FileDigestCfg extends BaseCfg { private String digest; private Integer cfdsLevel; private String fileUrl; - + + private NtcSubscribeIdCfg ntcSubscribeIdCfg; + private List ntcSubscribeIdCfgList; + public static String getTablename() { return tableName; } @@ -61,5 +64,17 @@ public class FileDigestCfg extends BaseCfg { public void setFileUrl(String fileUrl) { this.fileUrl = fileUrl; } + public NtcSubscribeIdCfg getNtcSubscribeIdCfg() { + return ntcSubscribeIdCfg; + } + public void setNtcSubscribeIdCfg(NtcSubscribeIdCfg ntcSubscribeIdCfg) { + this.ntcSubscribeIdCfg = ntcSubscribeIdCfg; + } + public List getNtcSubscribeIdCfgList() { + return ntcSubscribeIdCfgList; + } + public void setNtcSubscribeIdCfgList(List ntcSubscribeIdCfgList) { + this.ntcSubscribeIdCfgList = ntcSubscribeIdCfgList; + } } diff --git a/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java b/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java index 703842e88..d930b4496 100644 --- a/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java +++ b/src/main/java/com/nis/domain/specific/SpecificServiceCfg.java @@ -31,7 +31,14 @@ public class SpecificServiceCfg extends BaseEntity{ private Date endDate; // 结束日期 private String showSequence; //显示序号 private String businessType; + private Integer addFlag;//app界面添加标记 + public Integer getAddFlag() { + return addFlag; + } + public void setAddFlag(Integer addFlag) { + this.addFlag = addFlag; + } public String getBusinessType() { return businessType; } diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 4c2ff5e96..c54e7724d 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -7,6 +7,8 @@ import java.util.Map; import com.google.gson.GsonBuilder; public final class Constants { + public static Integer APP_SPEC_SERVICE_CODE_MIN_VAL=Configurations.getIntProperty("app_spec_service_code_min_val", 300001); + public static Integer APP_SPEC_SERVICE_CODE_MAX_VAL=Configurations.getIntProperty("app_spec_service_code_max_val", 268435455); public static String APP_CFG_USERREGION_SPLITOR=Configurations.getStringProperty("app_cfg_userregion_splitor", "&"); /** * MaatConfig 默认值 @@ -494,6 +496,7 @@ public final class Constants { public static final String P2P_HASH_BIN_REGION = Configurations.getStringProperty("p2p_hash_bin_region","NTC_P2P_HASH_BIN"); public static final String P2P_KEYWORDS_REGION = Configurations.getStringProperty("p2p_keywords_region","NTC_P2P_KEYWORDS"); public static final String NTC_SUBSCRIBE_ID_REGION = Configurations.getStringProperty("ntc_subscribe_id_region","NTC_SUBSCRIBE_ID"); + public static final String PXY_CRTL_SUBSCRIBE_ID_REGION = Configurations.getStringProperty("pxy_crtl_subscribe_id_region","PXY_CRTL_SUBSCRIBE_ID"); /** * 样例文件URL关键字 */ diff --git a/src/main/java/com/nis/web/controller/TagController.java b/src/main/java/com/nis/web/controller/TagController.java index ebedf03a1..049960d7c 100644 --- a/src/main/java/com/nis/web/controller/TagController.java +++ b/src/main/java/com/nis/web/controller/TagController.java @@ -7,6 +7,8 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; +import com.nis.web.security.UserUtils; + @Controller @RequestMapping("${adminPath}/tag") @@ -26,7 +28,9 @@ public class TagController extends BaseController { model.addAttribute("selectIds", request.getParameter("selectIds")); // 指定默认选中的ID model.addAttribute("isAll", request.getParameter("isAll")); // 是否读取全部数据,不进行权限过滤 model.addAttribute("module", request.getParameter("module")); // 过滤栏目模型(仅针对CMS的Category树) - model.addAttribute("title", request.getParameter("title")); + model.addAttribute("title", request.getParameter("title"));//根节点替换文本 + model.addAttribute("enableAddBtn", request.getParameter("enableAddBtn"));//节点是否可编辑 + model.addAttribute("userId", UserUtils.getUser().getId());//如果启用了addBtn,则使用userId判断是否是用户自己创建的,用户自己创建的节点可删除 return "/sys/tagTreeselect"; } diff --git a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java index b619ddb04..091e856e7 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java @@ -24,13 +24,18 @@ import com.nis.domain.configuration.AppHttpCfg; import com.nis.domain.configuration.AppIpCfg; import com.nis.domain.configuration.AppPolicyCfg; import com.nis.domain.configuration.AppSslCertCfg; +import com.nis.domain.configuration.AppTcpCfg; +import com.nis.domain.configuration.AppTopicDomainCfg; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.domain.specific.SpecificServiceCfg; +import com.nis.exceptions.CallExternalProceduresException; import com.nis.exceptions.MaatConvertException; +import com.nis.util.CodeDicUtils; import com.nis.util.Constants; import com.nis.util.DictUtils; import com.nis.web.controller.BaseController; +import com.nis.web.dao.dashboard.codedic.CodeResult; import com.nis.web.security.UserUtils; /** @@ -755,6 +760,126 @@ public class AppCfgController extends BaseController { appCfgService.updateAppSslCfgValid(isValid,ids,functionId); return "redirect:" + adminPath +"/app/sslCfgList?functionId="+functionId; } + + + /** + * APP TCP会话字节数特征 列表 + * @param model + * @param cfg + * @param request + * @param response + * @return + */ + @RequestMapping(value = {"tcpCfgList"}) + public String tcpCfgList(Model model,@ModelAttribute("cfg")AppTcpCfg cfg,HttpServletRequest request,HttpServletResponse response) { + Page searchPage=new Page(request,response,"r"); + Page page = appCfgService.findAppTcpList(searchPage, cfg); + for(AppTcpCfg entity:page.getList()){ + SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId()); + entity.setAppName(app.getSpecServiceName()); + } + model.addAttribute("page", page); + initPageCondition(model,cfg); + return "/cfg/app/appTcpCfgList"; + } + + /** + * APP TCP会话字节数特征表单(新增/修改) + * @param model + * @param ids + * @param entity + * @return + */ + @RequestMapping(value = {"tcpCfgForm"}) + @RequiresPermissions(value={"app:tcp:config"}) + public String tcpCfgForm(Model model,String ids,AppTcpCfg entity) { + if(StringUtils.isNotBlank(ids)){ + entity = appCfgService.getAppTcpCfg(Long.parseLong(ids)); + initUpdateFormCondition(model,entity); + }else{ + initFormCondition(model,entity); + } + model.addAttribute("_cfg", entity); + return "/cfg/app/appTcpCfgForm"; + } + + /** + * APP TCP会话字节数特征配置(新增/修改)提交 + * @param model + * @param request + * @param response + * @param entity + * @param redirectAttributes + * @return + */ + @RequestMapping(value = {"saveAppTcpCfg"}) + @RequiresPermissions(value={"app:tcp:config"}) + public String saveAppTcpCfg(Model model,HttpServletRequest request,HttpServletResponse response, + AppTcpCfg entity,RedirectAttributes redirectAttributes) { + try { + SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId()); + if(specificService!=null){ + entity.setAppCode(specificService.getSpecServiceCode()); + } + appCfgService.saveOrUpdateAppTcpeCfg(entity); + } catch (Exception e) { + e.printStackTrace(); + addMessage(redirectAttributes, e.getMessage()); + } + + return "redirect:" + adminPath +"/app/tcpCfgList?functionId="+entity.getFunctionId(); + } + + /** + * APP TCP会话字节数特征配置删除 + * @param isValid + * @param ids + * @param functionId + * @return + */ + @RequestMapping(value = {"updateAppTcpCfgValid"}) + @RequiresPermissions(value={"app:tcp:config"}) + public String updateAppTcpCfgValid(Integer isValid,String ids,Integer functionId) { + appCfgService.updateAppTcpCfgValid(isValid,ids,functionId); + return "redirect:" + adminPath +"/app/tcpCfgList?functionId="+functionId; + } + + + /** + * APP TCP会话字节数特征配置 审核 + * @param isAudit + * @param isValid + * @param ids + * @param functionId + * @param redirectAttributes + * @return + */ + @RequestMapping(value = {"auditAppTcpCfg"}) + @RequiresPermissions(value={"app:tcp:confirm"}) + public String auditAppTcpCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + AppTcpCfg entity = new AppTcpCfg(); + String[] idArray = ids.split(","); + for(String id :idArray){ + entity = appCfgService.getAppTcpCfg(Long.parseLong(id)); + entity.setIsAudit(isAudit); + entity.setIsValid(isValid); + entity.setAuditorId(UserUtils.getUser().getId()); + entity.setAuditTime(new Date()); + entity.setFunctionId(functionId); + try { + appCfgService.auditAppTcpCfg(entity,isAudit); + } catch (MaatConvertException e) { + e.printStackTrace(); + logger.info("app SSL配置下发失败:"+e.getMessage()); + addMessage(redirectAttributes, e.getMessage()); + } + } + return "redirect:" + adminPath +"/app/tcpCfgList?functionId="+functionId; + } + + + + /** * APP header特征配置 列表 * @param model @@ -864,4 +989,150 @@ public class AppCfgController extends BaseController { appCfgService.updateAppHeaderCfgValid(isValid,ids,functionId); return "redirect:" + adminPath +"/app/headerCfgList?functionId="+functionId; } + + /** + * 主题网站配置列表 + * @param model + * @param cfg + * @param request + * @param response + * @return + */ + @RequestMapping(value = {"topicDomainCfgList"}) + public String TopicDomainCfgList(Model model,@ModelAttribute("cfg")AppTopicDomainCfg cfg,HttpServletRequest request,HttpServletResponse response) { + Page searchPage=new Page(request,response,"r"); + Page page = appCfgService.findAppTopicDomainList(searchPage, cfg); +// for(AppTopicDomainCfg entity:page.getList()){ +// SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId()); +// entity.setAppName(app.getSpecServiceName()); +// } + //设置topic主题 + for (AppTopicDomainCfg entity:page.getList()) { + List codeList = CodeDicUtils.getCodeList("serviceCode"); + for (CodeResult codeResult : codeList) { + if(null!=entity.getTopic()&&codeResult.getCode().equals(entity.getTopic())){ + entity.setAppName(codeResult.getItem()); + } + } + } + model.addAttribute("page", page); + initPageCondition(model,cfg); + return "/cfg/app/appTopicDomainCfgList"; + } + /** + * app主题网站配置表单 + * @param model + * @param ids + * @param entity + * @return + */ + @RequestMapping(value = {"topicDomainCfgForm"}) + @RequiresPermissions(value={"app:topic:config"}) + public String topicDomainCfgForm(Model model,String ids,@ModelAttribute("_cfg")AppTopicDomainCfg entity) { + if(StringUtils.isNotBlank(ids)){ + entity = appCfgService.getAppTopicDomainCfg(Long.parseLong(ids)); + initUpdateFormCondition(model,entity); + }else{ + initFormCondition(model,entity); + } + model.addAttribute("_cfg", entity); + return "/cfg/app/appTopicDomainCfgForm"; + } +/** + * app主题网站配置新增修改 + * @param model + * @param request + * @param response + * @param entity + * @param redirectAttributes + * @return + */ + @RequestMapping(value = {"saveAppTopicDomainCfg"}) + @RequiresPermissions(value={"app:topic:config"}) + public String saveAppTopicDomainCfg(Model model,HttpServletRequest request,HttpServletResponse response, + AppTopicDomainCfg entity,RedirectAttributes redirectAttributes) { + try { +// SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId()); +// if(specificService!=null){ +// entity.setAppCode(specificService.getSpecServiceCode()); +// } + appCfgService.saveOrUpdateAppTopicDomainCfg(entity); + addMessage(redirectAttributes,"save_success"); + } catch (Exception e) { + if(e instanceof MaatConvertException) { + e.printStackTrace(); + logger.info("app主题网站配置下发失败:"+e.getMessage());; + addMessage(redirectAttributes,"request_service_failed"); + }else { + e.printStackTrace(); + logger.error("app主题网站配置下发失败",e); + addMessage(redirectAttributes,"save_failed"); + } + } + + return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+entity.getFunctionId(); + } + /** + * domain配置审核 + * @param isAudit + * @param isValid + * @param ids + * @param functionId + * @param redirectAttributes + * @return + */ + @RequestMapping(value = {"auditAppTopicDomainCfg"}) +// @RequiresPermissions(value={"app:domain:confirm"}) + public String auditAppTopicDomainCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + AppTopicDomainCfg entity = new AppTopicDomainCfg(); + String[] idArray = ids.split(","); + for(String id :idArray){ + entity = appCfgService.getAppTopicDomainCfg(Long.parseLong(id)); + entity.setIsAudit(isAudit); + entity.setIsValid(isValid); + entity.setAuditorId(UserUtils.getUser().getId()); + entity.setAuditTime(new Date()); + entity.setFunctionId(functionId); + try { + appCfgService.auditAppTopicDomainCfg(entity,isAudit); + addMessage(redirectAttributes,"audit_success"); + } catch (MaatConvertException e) { + if(e instanceof MaatConvertException) { + e.printStackTrace(); + logger.info("app主题网站配置下发失败:"+e.getMessage());; + addMessage(redirectAttributes,"request_service_failed"); + }else { + e.printStackTrace(); + logger.error("app主题网站配置下发失败",e); + addMessage(redirectAttributes,"audit_failed"); + } + } + } + return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+functionId; + } + /** + * 网站主题配置删除 + * @param isValid + * @param ids + * @param functionId + * @return + */ + @RequestMapping(value = {"updateAppTopicDomainCfgValid"}) + @RequiresPermissions(value={"app:topic:config"}) + public String updateAppTopicDomainCfgValid(Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) { + try { + appCfgService.updateAppTopicDomainCfgValid(isValid,ids,functionId); + addMessage(redirectAttributes,"delete_success"); + } catch (Exception e) { + logger.error("app主题网站删除失败",e); + if(e instanceof MaatConvertException||e instanceof CallExternalProceduresException) { + e.printStackTrace(); + addMessage(redirectAttributes,"request_service_failed"); + }else { + e.printStackTrace(); + addMessage(redirectAttributes,"delete_failed"); + } + } + return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+functionId; + } } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java b/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java index 491dff836..42e621c49 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java @@ -225,7 +225,7 @@ public class FileTransferCfgController extends BaseController{ entity.setCreateTime(date); fileTime=entity.getCreateTime(); } - ToMaatResult result = null; + ToMaatResult result = new ToMaatResult(); if(file!=null && file.getSize()>0 && entity!=null){ String sep = System.getProperty("file.separator"); String digestFilePath = request.getRealPath("/")+"digestFile"; @@ -245,6 +245,10 @@ public class FileTransferCfgController extends BaseController{ String md5 = DigestUtils.md5Hex(file.getBytes()); fileMap.put("checksum", md5); result = ConfigServiceUtil.getFileDigest(null, uploadFile, JsonMapper.toJsonString(fileMap)); + if((result.getData().getRawLen() == null) || (result.getData().getDigest() == null)) { + logger.info("文件摘要信息获取有误!"); + throw new MaatConvertException(":"+null); + } logger.info("获取文件摘要响应信息:"+result); } fileTransferCfgService.saveOrUpdateFileDigestCfg(entity,result,areaCfgIds); @@ -282,6 +286,25 @@ public class FileTransferCfgController extends BaseController{ } return "redirect:" + adminPath +"/ntc/fileTransfer/fileDigestList?functionId="+functionId; } + @RequestMapping(value = {"ajaxFileDigestSubIdList"}) + public String ajaxFileDigestSubIdList(Model model,Long cfgId,Integer index) { + FileDigestCfg cfg = fileTransferCfgService.getFileDigestSubIdCfg(cfgId); + List tabList = new ArrayList(); + //查询SubscribeId域配置 + if(cfg.getNtcSubscribeIdCfgList()!=null){ + String cfgType = null; + for(NtcSubscribeIdCfg ntc:cfg.getNtcSubscribeIdCfgList()){ + if(!ntc.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"2",ntc.getCfgType()}); + cfgType = ntc.getCfgType(); + } + } + } + model.addAttribute("_cfg", cfg); + model.addAttribute("index", index); + model.addAttribute("tabList", tabList); + return "/cfg/fileTransfer/fileDigestSubList"; + } @RequestMapping(value = {"p2pList"}) public String p2pList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) { diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/XmppController.java b/src/main/java/com/nis/web/controller/configuration/ntc/XmppController.java index ce6a23cf8..739a014c6 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/XmppController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/XmppController.java @@ -27,6 +27,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.nis.domain.Page; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.exceptions.MaatConvertException; import com.nis.web.controller.BaseController; import com.nis.web.security.UserUtils; @@ -104,6 +105,15 @@ public class XmppController extends BaseController { } } } + if(cfg.getNtcSubscribeIdCfgList()!=null){ + String cfgType = null; + for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){ + if(!keyword.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"2",keyword.getCfgType()}); + cfgType = keyword.getCfgType(); + } + } + } model.addAttribute("_cfg", cfg); model.addAttribute("index", index); model.addAttribute("tabList", tabList); diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java b/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java index ce251b69c..39ac83275 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java +++ b/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java @@ -24,11 +24,14 @@ import com.nis.domain.configuration.HttpReqHeadCfg; import com.nis.domain.configuration.HttpResHeadCfg; import com.nis.domain.configuration.HttpUrlCfg; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.exceptions.MaatConvertException; import com.nis.util.Constants; import com.nis.web.controller.BaseController; import com.nis.web.security.UserUtils; +import jersey.repackaged.com.google.common.collect.Lists; + /** * http重定向策略 * @author zhangwei @@ -78,6 +81,9 @@ public class HttpRedirectPolicyController extends BaseController{ IpPortCfg ipPortCfg = new IpPortCfg(); ipPortCfg.setCfgType(Constants.HTTP_REDIRECT_IP_REGION); entity.setIpPort(ipPortCfg); + NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg(); + subscribeIdCfg.setCfgType(Constants.PXY_CRTL_SUBSCRIBE_ID_REGION); + entity.setNtcSubscribeIdCfg(subscribeIdCfg); if(entity.getHttpUrlList().size()==0){ entity.getHttpUrlList().add(urlCfg); @@ -97,6 +103,9 @@ public class HttpRedirectPolicyController extends BaseController{ if(entity.getIpPortList().size()==0){ entity.getIpPortList().add(ipPortCfg); } + if(entity.getNtcSubscribeIdCfgList().size()==0){ + entity.getNtcSubscribeIdCfgList().add(subscribeIdCfg); + } initUpdateFormCondition(model,entity); }else{ //设置http各类配置的配置域类型 @@ -118,6 +127,10 @@ public class HttpRedirectPolicyController extends BaseController{ IpPortCfg ipPortCfg = new IpPortCfg(); ipPortCfg.setCfgType(Constants.HTTP_IP_REGION); entity.setIpPort(ipPortCfg); + //subscribeId + NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg(); + subscribeIdCfg.setCfgType(Constants.PXY_CRTL_SUBSCRIBE_ID_REGION); + entity.setNtcSubscribeIdCfg(subscribeIdCfg); List urlList=new ArrayList(); urlList.add(urlCfg); @@ -138,6 +151,11 @@ public class HttpRedirectPolicyController extends BaseController{ List ipPortList=new ArrayList(); ipPortList.add(ipPortCfg); entity.setIpPortList(ipPortList); + + List subscribeCfgList = Lists.newArrayList(); + subscribeCfgList.add(subscribeIdCfg); + entity.setNtcSubscribeIdCfgList(subscribeCfgList); + initFormCondition(model,entity); } //获取所有的响应文件内容,阻断,或重定向时可以选择 diff --git a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java index 0962220b2..2ce2d1381 100644 --- a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java +++ b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java @@ -19,6 +19,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.nis.domain.Page; +import com.nis.domain.PageLog; import com.nis.util.CodeDicUtils; import com.nis.util.Constants; import com.nis.util.StringUtil; @@ -408,16 +409,19 @@ public class DashboardController extends BaseController{ @RequestMapping(value="ipActiveList") public String ipActiveList( HttpServletRequest request, HttpServletResponse response, Model model){ - Page page = new Page(request, response); - TrafficIpActiveStatistic ip = new TrafficIpActiveStatistic(); - ip.setIpAddr("1.1.1.1"); - ip.setAreaId("11"); - ip.setLinkNum(1212); + PageLog page = new PageLog(request, response); List list = new ArrayList(); - list.add(ip); + for (int i = 1; i < 10; i++) { + TrafficIpActiveStatistic ip = new TrafficIpActiveStatistic(); + ip.setId(i); + ip.setIpAddr(3+i+".1.1."+i); + ip.setAreaId("11"); + ip.setLinkNum(1212); + list.add(ip); + } page.setList(list); model.addAttribute("page", page); - return "/dashboard/trafficIpActiveList"; + return "/dashboard/trafficConnList"; } @@ -450,6 +454,7 @@ public class DashboardController extends BaseController{ return "/dashboard/trafficIpActiveChart"; } public class TrafficIpActiveStatistic{ + Integer id=1; String ipAddr="10.1.1.2"; String areaId="1045"; Integer linkNum=3121; @@ -459,6 +464,12 @@ public class DashboardController extends BaseController{ Integer s2cByteLen=23323; String statTime; + public Integer getId() { + return id; + } + public void setId(Integer id) { + this.id = id; + } public String getStatTime() { return statTime; } diff --git a/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java b/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java index 7d1d980a3..4335b9050 100644 --- a/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java +++ b/src/main/java/com/nis/web/controller/specific/SpecificServiceCfgController.java @@ -1,6 +1,5 @@ package com.nis.web.controller.specific; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Properties; @@ -13,6 +12,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.mvc.support.RedirectAttributes; @@ -22,6 +22,8 @@ import com.google.common.collect.Maps; import com.nis.domain.Page; import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.specific.SpecificServiceCfg; +import com.nis.exceptions.MaatConvertException; +import com.nis.util.Constants; import com.nis.util.DictUtils; import com.nis.util.StringUtils; import com.nis.web.controller.BaseController; @@ -201,8 +203,9 @@ public class SpecificServiceCfgController extends BaseController { Map map2 = Maps.newHashMap(); map2.put("id", 0); map2.put("pId", 0); - map2.put("type",0); + map2.put("serviceType",0); map2.put("business",-2); + map2.put("groupId",0); map2.put("name","root_node"); //map2.put("placeholder","0"); mapList.add(map2); @@ -222,6 +225,7 @@ public class SpecificServiceCfgController extends BaseController { map.put("name",props.getProperty(dict.getItemValue(), dict.getItemValue())); map.put("serviceType",cfgType); map.put("businessType","-1"); + map.put("groupId",0); businessList.add(map); } mapList.addAll(businessList); @@ -242,7 +246,12 @@ public class SpecificServiceCfgController extends BaseController { map.put("pId", "businessType"+business.getItemCode()); map.put("name",specificServiceCfg.getSpecServiceName()); map.put("serviceType",specificServiceCfg.getCfgType()); + map.put("serviceCode",specificServiceCfg.getSpecServiceCode()); map.put("businessType",specificServiceCfg.getBusinessType()); + map.put("groupId",specificServiceCfg.getGroupId()); + if(specificServiceCfg.getAddFlag()!=null) { + map.put("user",specificServiceCfg.getAddFlag()); + } mapList.add(map); break; } @@ -253,6 +262,7 @@ public class SpecificServiceCfgController extends BaseController { map.put("pId", specificServiceCfg.getParent().getSpecServiceId()); map.put("name",specificServiceCfg.getSpecServiceName()); map.put("serviceType",specificServiceCfg.getCfgType()); + map.put("groupId",specificServiceCfg.getGroupId()); mapList.add(map); } } @@ -272,6 +282,10 @@ public class SpecificServiceCfgController extends BaseController { map.put("pId", specificServiceCfg.getParent().getSpecServiceId()); map.put("name",specificServiceCfg.getSpecServiceName()); map.put("type",specificServiceCfg.getCfgType()); + map.put("groupId",specificServiceCfg.getGroupId()); + if(specificServiceCfg.getAddFlag()!=null) { + map.put("user",specificServiceCfg.getAddFlag()); + } mapList.add(map); } } @@ -380,5 +394,70 @@ public class SpecificServiceCfgController extends BaseController { } return false; } + @ResponseBody + @RequestMapping(value = "ajaxSaveOrUpdateApp",method=RequestMethod.POST ) + public Map ajaxSaveOrUpdateApp(@RequestParam(required=true,value="specServiceId")String specServiceId,@RequestParam(required=false,value="specServiceCode")String specServiceCode,@RequestParam(required=true,value="specServiceName") String specServiceName, + @RequestParam(required=true,value="cfgType") String cfgType, @RequestParam(required=true,value="businessType")String businessType,@RequestParam(required=false,value="addFlag")String addFlag, + @RequestParam(required=false,value="groupId")String groupId){ + Map map = Maps.newHashMap(); + //校验是真ID还是假ID,假的Id以manual开头无法转换成数字 + boolean isTrueId=false; + try { + Long.parseLong(specServiceId); + isTrueId=true; + }catch (Exception e) { + // TODO: handle exception + } + try{ + SpecificServiceCfg cfg=new SpecificServiceCfg(); + if(isTrueId) { + cfg.setSpecServiceId(Integer.parseInt(specServiceId)); + } + if(StringUtils.isNotBlank(specServiceCode)) { + cfg.setSpecServiceCode(Integer.parseInt(specServiceCode)); + } + cfg.setAddFlag(Integer.parseInt(addFlag)); + cfg.setSpecServiceName(specServiceName); + cfg.setBusinessType(businessType); + cfg.setCfgType(Integer.parseInt(cfgType)); + cfg.setIsValid(Constants.VALID_YES); + if(StringUtils.isNotBlank(groupId)) { + cfg.setGroupId(Integer.parseInt(groupId)); + } + + SpecificServiceCfg parent=new SpecificServiceCfg(); + parent.setSpecServiceId(0); + cfg.setParent(parent); + specificServiceCfgService.saveOrUpdate(cfg); + cfg=specificServiceCfgService.getBySpecServiceId(cfg.getSpecServiceId()); + map.put("id", cfg.getSpecServiceId()); + map.put("pId", "businessType"+cfg.getBusinessType()); + map.put("name",cfg.getSpecServiceName()); + map.put("serviceType",cfg.getCfgType()); + map.put("businessType",cfg.getBusinessType()); + map.put("groupId",cfg.getGroupId()); + return map; + }catch (Exception e) { + e.printStackTrace(); + if(e instanceof MaatConvertException) { + map.put("errTip", "request_service_failed"); + }else { + map.put("errTip", "save_failed"); + } + } + + return map; + } + @ResponseBody + @RequestMapping(value = "ajaxRemoveApp",method=RequestMethod.POST ) + public boolean ajaxRemoveApp(@RequestParam(required=true,value="specServiceId")Integer specServiceId){ + try{ + specificServiceCfgService.delete(String.valueOf(specServiceId)); + return true; + }catch (Exception e) { + e.printStackTrace(); + } + return false; + } } diff --git a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java index 7c15dd79b..26307a96e 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java @@ -17,6 +17,8 @@ import com.nis.domain.configuration.AppIpCfg; import com.nis.domain.configuration.AppPolicyCfg; import com.nis.domain.configuration.AppSslCertCfg; import com.nis.domain.configuration.AppStringCfg; +import com.nis.domain.configuration.AppTcpCfg; +import com.nis.domain.configuration.AppTopicDomainCfg; import com.nis.domain.configuration.BaseCfg; import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.ComplexkeywordCfg; @@ -57,6 +59,11 @@ public interface AppCfgDao { public AppDomainCfg getAppDomainCfg(Long cfgId) ; public int insertAppDomainCfg(AppDomainCfg entity); public int updateAppDomainCfg(AppDomainCfg entity); + //app 主题网站配置增删改查 + public List findAppTopicDomainList(AppTopicDomainCfg entity) ; + public AppTopicDomainCfg getAppTopicDomainCfg(Long cfgId) ; + public int insertAppTopicDomainCfg(AppTopicDomainCfg entity); + public int updateAppTopicDomainCfg(AppTopicDomainCfg entity); //app 字节特征增删改查 public List findAppByteList(AppByteCfg entity) ; public AppByteCfg getAppByteCfg(Long cfgId) ; @@ -77,7 +84,11 @@ public interface AppCfgDao { public AppHeaderCfg getAppHeaderCfg(Long cfgId); public int insertAppHeaderCfg(AppHeaderCfg entity); public int updateAppHeaderCfg(AppHeaderCfg entity); - + //APP TCP会话字节数特征 + public List findAppTcpList(AppTcpCfg entity); + public AppTcpCfg getAppTcpCfg(Long cfgId); + public int insertAppTcpCfg(AppTcpCfg entity); + public int updateAppTcpCfg(AppTcpCfg entity); //审核配置 public void auditCfg(BaseCfg entity); //修改配置状态 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 94696fa3d..309954269 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml @@ -137,6 +137,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -297,6 +328,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + r.CFG_ID, r.APP_CODE,r.BEHAV_CODE,r.SPEC_SERVICE_ID,r.CFG_DESC,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.AREA_EFFECTIVE_IDS,r.RATELIMIT,r.FUNCTION_ID,r.CFG_TYPE,r.CFG_REGION_CODE, + r.low_boundary,r.up_boundary as upBoundary,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.do_log + + r.CFG_ID, r.APP_CODE,r.BEHAV_CODE,r.SPEC_SERVICE_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT, @@ -332,6 +404,14 @@ r.DOMAIN,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.DO_LOG + + r.CFG_ID, r.TOPIC,r.BEHAV_CODE,r.SPEC_SERVICE_ID,r.CFG_DESC,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.AREA_EFFECTIVE_IDS,r.RATELIMIT,r.FUNCTION_ID,r.CFG_TYPE,r.CFG_REGION_CODE, + r.DOMAIN,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.DO_LOG + + r.CFG_ID, r.APP_CODE,r.BEHAV_CODE,r.SPEC_SERVICE_ID,r.CFG_DESC,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, @@ -358,6 +438,17 @@ #{areaEffectiveIds,jdbcType=VARCHAR},#{ratelimit,jdbcType=INTEGER},#{functionId,jdbcType=INTEGER}, #{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER} + + #{topic,jdbcType=VARCHAR},#{behavCode,jdbcType=INTEGER},#{specServiceId,jdbcType=INTEGER}, + #{cfgDesc,jdbcType=VARCHAR},#{action,jdbcType=INTEGER}, + #{isValid,jdbcType=INTEGER},#{isAudit,jdbcType=INTEGER},#{creatorId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP},#{editorId,jdbcType=INTEGER},#{editTime,jdbcType=TIMESTAMP}, + #{auditorId,jdbcType=INTEGER},#{auditTime,jdbcType=TIMESTAMP},#{serviceId,jdbcType=INTEGER}, + #{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER}, + #{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR}, + #{areaEffectiveIds,jdbcType=VARCHAR},#{ratelimit,jdbcType=INTEGER},#{functionId,jdbcType=INTEGER}, + #{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER} + a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port @@ -438,6 +529,13 @@ FROM app_domain_cfg r WHERE CFG_ID = #{cfgId,jdbcType=BIGINT} + + + + + + + + + + SELECT LAST_INSERT_ID() + + insert into app_session_cfg ( + APP_CODE,BEHAV_CODE,SPEC_SERVICE_ID,CFG_DESC,ACTION,IS_VALID,IS_AUDIT, + CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME, + SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY, + ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,RATELIMIT,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE, + low_boundary,up_boundary,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG + )values ( + , + #{lowBoundary,jdbcType=INTEGER},#{upBoundary,jdbcType=INTEGER}, + #{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER} + ) + SELECT LAST_INSERT_ID() @@ -1330,7 +1672,7 @@ , #{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER} ,#{userRegion1,jdbcType=VARCHAR} ,#{userRegion2,jdbcType=VARCHAR} ,#{userRegion3,jdbcType=VARCHAR} - ,#{userRegion4,jdbcType=VARCHAR} ,#{userRegion5,jdbcType=VARCHAR} + ,#{userRegion4,jdbcType=VARCHAR} ,#{userRegion5,jdbcType=VARCHAR} ,#{doLog,jdbcType=INTEGER} ) @@ -1383,6 +1725,23 @@ #{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER} ) + + + + SELECT LAST_INSERT_ID() + + insert into app_topic_domain_cfg ( + TOPIC,BEHAV_CODE,SPEC_SERVICE_ID,CFG_DESC,ACTION,IS_VALID,IS_AUDIT, + CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME, + SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY, + ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,RATELIMIT,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE, + DOMAIN,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG + )values ( + , + #{domain,jdbcType=VARCHAR},#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER}, + #{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER} + ) + SELECT LAST_INSERT_ID() @@ -1615,7 +1974,16 @@ --> USER_REGION1 =#{userRegion5,jdbcType=VARCHAR}, - DO_LOG=#{doLog,jdbcType=INTEGER} + DO_LOG=#{doLog,jdbcType=INTEGER}, + + expr_type=#{exprType,jdbcType=INTEGER}, + + + match_method=#{matchMethod,jdbcType=INTEGER}, + + + is_hexbin=#{isHexbin,jdbcType=INTEGER}, + where cfg_id = #{cfgId,jdbcType=BIGINT} @@ -1933,6 +2301,106 @@ where cfg_id = #{cfgId,jdbcType=BIGINT} + + + update app_topic_domain_cfg + + + + cfg_desc = #{cfgDesc,jdbcType=VARCHAR}, + + + TOPIC = #{topic,jdbcType=VARCHAR}, + + + BEHAV_CODE = #{behavCode,jdbcType=INTEGER}, + + + SPEC_SERVICE_ID = #{specServiceId,jdbcType=INTEGER}, + + + action = #{action,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + is_audit = #{isAudit,jdbcType=INTEGER}, + + + creator_id = #{creatorId,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + auditor_id = #{auditorId,jdbcType=INTEGER}, + + + audit_time = #{auditTime,jdbcType=TIMESTAMP}, + + + service_id = #{serviceId,jdbcType=INTEGER}, + + + request_id = #{requestId,jdbcType=INTEGER}, + + + compile_id = #{compileId,jdbcType=INTEGER}, + + + is_area_effective = #{isAreaEffective,jdbcType=INTEGER}, + + + classify = #{classify,jdbcType=VARCHAR}, + + + attribute = #{attribute,jdbcType=VARCHAR}, + + + lable = #{lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{functionId,jdbcType=INTEGER}, + + + RATELIMIT=#{ratelimit,jdbcType=INTEGER}, + + + CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}, + + + CFG_TYPE =#{cfgType,jdbcType=VARCHAR}, + + + domain=#{domain,jdbcType=VARCHAR}, + + + expr_type=#{exprType,jdbcType=INTEGER}, + + + match_method=#{matchMethod,jdbcType=INTEGER}, + + + is_hexbin=#{isHexbin,jdbcType=INTEGER}, + + + + + where cfg_id = #{cfgId,jdbcType=BIGINT} + + update app_byte_cfg @@ -2267,6 +2735,108 @@ + + update app_session_cfg + + + + cfg_desc = #{cfgDesc,jdbcType=VARCHAR}, + + + APP_CODE = #{appCode,jdbcType=INTEGER}, + + + BEHAV_CODE = #{behavCode,jdbcType=INTEGER}, + + + SPEC_SERVICE_ID = #{specServiceId,jdbcType=INTEGER}, + + + action = #{action,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + is_audit = #{isAudit,jdbcType=INTEGER}, + + + creator_id = #{creatorId,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + auditor_id = #{auditorId,jdbcType=INTEGER}, + + + audit_time = #{auditTime,jdbcType=TIMESTAMP}, + + + service_id = #{serviceId,jdbcType=INTEGER}, + + + request_id = #{requestId,jdbcType=INTEGER}, + + + compile_id = #{compileId,jdbcType=INTEGER}, + + + is_area_effective = #{isAreaEffective,jdbcType=INTEGER}, + + + classify = #{classify,jdbcType=VARCHAR}, + + + attribute = #{attribute,jdbcType=VARCHAR}, + + + lable = #{lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{functionId,jdbcType=INTEGER}, + + + RATELIMIT=#{ratelimit,jdbcType=INTEGER}, + + + CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}, + + + CFG_TYPE =#{cfgType,jdbcType=VARCHAR}, + + + low_boundary=#{lowBoundary,jdbcType=INTEGER}, + + + up_boundary=#{upBoundary,jdbcType=INTEGER}, + + + expr_type=#{exprType,jdbcType=INTEGER}, + + + match_method=#{matchMethod,jdbcType=INTEGER}, + + + is_hexbin=#{isHexbin,jdbcType=INTEGER}, + + + do_log=#{doLog,jdbcType=INTEGER}, + + + + where cfg_id = #{cfgId,jdbcType=BIGINT} + + delete from ip_port_cfg where compile_id=#{compileId} and function_id=#{functionId} diff --git a/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.java b/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.java index 83a5eb280..15f6853be 100644 --- a/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.java @@ -41,6 +41,7 @@ public interface BgpCfgDao extends CrudDao{ public void saveIpPortCfg(IpPortCfg entity); public void updateBgpAsCfg(CfgIndexInfo entity); public void updateSubscribeIdCfg(CfgIndexInfo entity); + public void deleteSubscribeIdCfg(CfgIndexInfo entity); //public void saveHttpUrlCfg(HttpUrlCfg entity); public void deleteHttpIpCfg(CfgIndexInfo entity); //public void deleteHttpUrlCfg(CfgIndexInfo entity); diff --git a/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.xml index be0035cba..2553b3695 100644 --- a/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/BgpCfgDao.xml @@ -639,6 +639,10 @@ delete from ntc_bgp_as_cfg where compile_id=#{compileId} and function_id=#{functionId} + + delete from ntc_subscribe_id_cfg where compile_id=#{compileId} and function_id=#{functionId} + + update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , diff --git a/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.java b/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.java index e43bc8ca3..297a8b4e7 100644 --- a/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.java @@ -38,6 +38,8 @@ public interface FileTransferCfgDao extends CrudDao { public void auditCfg(BaseCfg entity); public FileDigestCfg getFileDigest(Long id); public void updateFileDigestCfg(FileDigestCfg entity); + public void deleteFileDigestSubscribeIdCfg(FileDigestCfg entity); + public List getFileDigestSubscribeidList(FileDigestCfg entity); // P2P域配置新增 public void saveP2pHashCfg(BaseStringCfg cfg); @@ -53,4 +55,5 @@ public interface FileTransferCfgDao extends CrudDao { public void deleteP2pHashCfg(CfgIndexInfo entity); public void deleteP2pKeywordCfg(CfgIndexInfo entity); public void deleteP2pSubscribeIdCfg(CfgIndexInfo entity); + } diff --git a/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.xml index 9140f8307..21f48b1cb 100644 --- a/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.xml @@ -1051,11 +1051,14 @@ delete from p2p_keyword_cfg where compile_id=#{compileId} and function_id=#{functionId} - + delete from ntc_subscribe_id_cfg where compile_id=#{compileId} and function_id=#{functionId} - + + + delete from ntc_subscribe_id_cfg where compile_id=#{compileId} and function_id=#{functionId} + + + update file_digest_cfg diff --git a/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml index af9281a06..6fbdc94f0 100644 --- a/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml @@ -705,14 +705,14 @@ and r.COMPILE_ID=#{compileId,jdbcType=INTEGER} - + diff --git a/src/main/java/com/nis/web/dao/configuration/XmppCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/XmppCfgDao.xml index 758388079..3c0e87e07 100644 --- a/src/main/java/com/nis/web/dao/configuration/XmppCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/XmppCfgDao.xml @@ -23,6 +23,7 @@ + @@ -121,7 +122,7 @@ a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT, a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME, a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY, - a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id + a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,do_log a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port @@ -301,7 +302,8 @@ ATTRIBUTE, LABLE, AREA_EFFECTIVE_IDS, - function_id + function_id, + do_log )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -321,7 +323,8 @@ #{attribute,jdbcType=VARCHAR}, #{lable,jdbcType=VARCHAR}, #{areaEffectiveIds,jdbcType=VARCHAR}, - #{functionId,jdbcType=INTEGER} + #{functionId,jdbcType=INTEGER}, + #{doLog,jdbcType=INTEGER} ) @@ -445,6 +448,9 @@ function_id = #{functionId,jdbcType=INTEGER}, + + + do_log = #{doLog,jdbcType=INTEGER}, diff --git a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java index 2360e1d46..44d828b53 100644 --- a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java +++ b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.java @@ -50,5 +50,6 @@ public interface SpecificServiceCfgDao extends CrudDao { Integer getParentType(Integer specServiceId); Integer getParentCode(Integer specServiceId); SpecificServiceCfg getRepeat(@Param("specServiceCode")Integer code, @Param("cfgType")Integer cfgType,@Param("parentId")Integer parentId); + Integer getMaxServiceCode(@Param("maxCode")Integer code, @Param("cfgType")Integer cfgType,@Param("addFlag")Integer addFlag); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml index f24e7ac07..782502ca3 100644 --- a/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml +++ b/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml @@ -12,6 +12,7 @@ + @@ -30,7 +31,8 @@ s.is_leaf AS isLeaf, s.group_id AS groupId, s.cfg_type AS cfgType, - s.business_type AS businessType + s.business_type AS businessType, + s.add_flag AS addFlag @@ -152,6 +154,9 @@ AND op_time < #{specificServiceCfg.endDate} + + AND add_flag = #{specificServiceCfg.addFlag} + ORDER BY ${orderBy} @@ -161,11 +166,23 @@ - + - insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id,cfg_type,business_type) - values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId},#{cfgType},#{businessType}) + + SELECT LAST_INSERT_ID() + + insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id,cfg_type,business_type,add_flag) + values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId},#{cfgType}, + #{businessType},#{addFlag}) diff --git a/src/main/java/com/nis/web/service/configuration/AppCfgService.java b/src/main/java/com/nis/web/service/configuration/AppCfgService.java index 1e5902067..d08a11bed 100644 --- a/src/main/java/com/nis/web/service/configuration/AppCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppCfgService.java @@ -18,6 +18,8 @@ import com.nis.domain.configuration.AppHttpCfg; import com.nis.domain.configuration.AppIpCfg; import com.nis.domain.configuration.AppPolicyCfg; import com.nis.domain.configuration.AppSslCertCfg; +import com.nis.domain.configuration.AppTcpCfg; +import com.nis.domain.configuration.AppTopicDomainCfg; import com.nis.domain.configuration.AreaIpCfg; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.NtcSubscribeIdCfg; @@ -41,9 +43,9 @@ import com.nis.web.dao.configuration.StringCfgDao; import com.nis.web.security.UserUtils; import com.nis.web.service.BaseService; - /** * 特定协议相关配置事务类 + * * @author dell * */ @@ -55,186 +57,245 @@ public class AppCfgService extends BaseService { protected AreaIpCfgDao areaIpCfgDao; @Autowired protected StringCfgDao stringcfgDao; - - + public Page findAppPolicyList(Page page, AppPolicyCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppPolicyList(entity); page.setList(list); return page; } + public Page findAppIpList(Page page, AppIpCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppIpList(entity); page.setList(list); return page; } + public Page findAppHttpList(Page page, AppHttpCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppHttpList(entity); page.setList(list); return page; } + public Page findAppDomainList(Page page, AppDomainCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppDomainList(entity); page.setList(list); return page; } + + // 主题网站列表 + public Page findAppTopicDomainList(Page page, AppTopicDomainCfg entity) { + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); + entity.setPage(page); + List list = appCfgDao.findAppTopicDomainList(entity); + page.setList(list); + return page; + } + public Page findAppByteList(Page page, AppByteCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppByteList(entity); page.setList(list); return page; } + public Page findAppSslList(Page page, AppSslCertCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppSslList(entity); page.setList(list); return page; } - public AppPolicyCfg getAppPolicyCfg(Long cfgId){ + + public Page findAppTcpList(Page page, AppTcpCfg entity) { + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); + entity.setPage(page); + List list = appCfgDao.findAppTcpList(entity); + page.setList(list); + return page; + } + + public AppTcpCfg getAppTcpCfg(Long cfgId) { + return appCfgDao.getAppTcpCfg(cfgId); + } + + public AppPolicyCfg getAppPolicyCfg(Long cfgId) { AppPolicyCfg policy = appCfgDao.getAppPolicyCfg(cfgId); List ipPortList = appCfgDao.getAppPolicyIpList(policy); - //查询关键字 - if(policy.getCompileId()!=null){ + // 查询关键字 + if (policy.getCompileId() != null) { NtcSubscribeIdCfg ntcSubscribeIdCfg = new NtcSubscribeIdCfg(); ntcSubscribeIdCfg.setCompileId(policy.getCompileId()); List ntcList = stringcfgDao.findSubscribeIdCfgList(ntcSubscribeIdCfg); policy.setNtcSubscribeIdCfgList(ntcList); } - + policy.setIpPortList(ipPortList); return policy; } - public AppIpCfg getAppIpCfg(Long cfgId){ + + public AppIpCfg getAppIpCfg(Long cfgId) { return appCfgDao.getAppIpCfg(cfgId); } - public AppHttpCfg getAppHttpCfg(Long cfgId){ + + public AppHttpCfg getAppHttpCfg(Long cfgId) { return appCfgDao.getAppHttpCfg(cfgId); } - public AppDomainCfg getAppDomainCfg(Long cfgId){ + + public AppDomainCfg getAppDomainCfg(Long cfgId) { return appCfgDao.getAppDomainCfg(cfgId); } - public AppByteCfg getAppByteCfg(Long cfgId){ + + // 主题网站form + public AppTopicDomainCfg getAppTopicDomainCfg(Long cfgId) { + return appCfgDao.getAppTopicDomainCfg(cfgId); + } + + public AppByteCfg getAppByteCfg(Long cfgId) { return appCfgDao.getAppByteCfg(cfgId); } - public AppSslCertCfg getAppSslCfg(Long cfgId){ + + public AppSslCertCfg getAppSslCfg(Long cfgId) { return appCfgDao.getAppSslCfg(cfgId); } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppPolicyCfg(AppPolicyCfg entity) throws Exception{ - //设置区域运营商信息 + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppPolicyCfg(AppPolicyCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - - if(entity.getCfgId()==null){ + + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } - entity.setCompileId(compileId); - entity.setCreateTime(new Date()); - entity.setCreatorId(entity.getCurrentUser().getId()); - entity.setIsValid(0); - entity.setIsAudit(0); - appCfgDao.insertAppPolicyCfg(entity); - //保存策略IP配置 - if(entity!=null&&entity.getIpPortList()!=null){ - for(IpPortCfg cfg:entity.getIpPortList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - appCfgDao.insertAppPolicyIpCfg(cfg); - } - } - //保存关键字配置 - if(entity!=null&&entity.getNtcSubscribeIdCfgList()!=null){ - for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ - entity.setCfgKeywords(cfg.getCfgKeywords()); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - stringcfgDao.saveSubscribeIdCfg(cfg); - } - } - } - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ - cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); - areaIpCfgDao.saveAreaIpCfg(cfg); - } - } - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + entity.setIsValid(0); + entity.setIsAudit(0); + // 设置SubscribeID域配置参数 + if (entity != null && entity.getNtcSubscribeIdCfgList() != null) { + for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) { + entity.setExprType(cfg.getExprType()); + entity.setIsHexbin(cfg.getIsHexbin()); + entity.setMatchMethod(cfg.getMatchMethod()); + entity.setCfgKeywords(cfg.getCfgKeywords()); + } + } + entity.initDefaultValue(); + appCfgDao.insertAppPolicyCfg(entity); + // 保存策略IP配置 + if (entity != null && entity.getIpPortList() != null) { + for (IpPortCfg cfg : entity.getIpPortList()) { + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); + appCfgDao.insertAppPolicyIpCfg(cfg); + } + } + // 保存关键字配置 + if (entity != null && entity.getNtcSubscribeIdCfgList() != null) { + for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) { + if (StringUtils.isNotBlank(cfg.getCfgKeywords())) { + entity.setCfgKeywords(cfg.getCfgKeywords()); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); + stringcfgDao.saveSubscribeIdCfg(cfg); + } + } + } + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } + + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.updateAppPolicyCfg(entity); - + // 设置SubscribeID域配置参数 + if (entity != null && entity.getNtcSubscribeIdCfgList() != null) { + for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) { + entity.setExprType(cfg.getExprType()); + entity.setIsHexbin(cfg.getIsHexbin()); + entity.setMatchMethod(cfg.getMatchMethod()); + } + } + appCfgDao.updateAppPolicyCfg(entity); + appCfgDao.deleteAppPolicyIpCfg(entity); - if(entity!=null&&entity.getNtcSubscribeIdCfgList()!=null&&entity.getNtcSubscribeIdCfgList().size()>0){ + if (entity != null && entity.getNtcSubscribeIdCfgList() != null + && entity.getNtcSubscribeIdCfgList().size() > 0) { for (NtcSubscribeIdCfg ntcSubscribeIdCfg : entity.getNtcSubscribeIdCfgList()) { ntcSubscribeIdCfg.setCompileId(entity.getCompileId()); stringcfgDao.deleteSubscribeIdCfg(ntcSubscribeIdCfg); } } - //删除旧的区域IP,新增新的区域IP + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); - + entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存策略IP配置 - if(entity.getIpPortList()!=null){ - for(IpPortCfg cfg:entity.getIpPortList()){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + // 保存策略IP配置 + if (entity.getIpPortList() != null) { + for (IpPortCfg cfg : entity.getIpPortList()) { + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); appCfgDao.insertAppPolicyIpCfg(cfg); } } - if(entity!=null&&entity.getNtcSubscribeIdCfgList()!=null){ - for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ - entity.setCfgKeywords(cfg.getCfgKeywords()); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - stringcfgDao.saveSubscribeIdCfg(cfg); + if (entity != null && entity.getNtcSubscribeIdCfgList() != null) { + for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) { + if (StringUtils.isNotBlank(cfg.getCfgKeywords())) { + entity.setCfgKeywords(cfg.getCfgKeywords()); + BeanUtils.copyProperties(entity, cfg, + new String[] { "cfgRegionCode", "cfgType", "exprType", "matchMethod", "isHexbin" }); + stringcfgDao.saveSubscribeIdCfg(cfg); } } } - - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } } - } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppIpCfg(AppIpCfg entity) throws Exception{ - //设置区域运营商信息 + } + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppIpCfg(AppIpCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - - if(entity.getCfgId()==null){ + + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -242,58 +303,60 @@ public class AppCfgService extends BaseService { entity.setCreatorId(entity.getCurrentUser().getId()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.insertAppIpCfg(entity); - - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + appCfgDao.insertAppIpCfg(entity); + + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); BeanUtils.copyProperties(entity, cfg, - new String[]{"cfgRegionCode","cfgType","ipType","isAreaEffective", - "areaEffectiveIds","protocol","portPattern","srcPort","destPort","direction", - "destIpAddress","srcIpAddress","ipPattern"}); + new String[] { "cfgRegionCode", "cfgType", "ipType", "isAreaEffective", + "areaEffectiveIds", "protocol", "portPattern", "srcPort", "destPort", + "direction", "destIpAddress", "srcIpAddress", "ipPattern" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppIpCfg(entity); - //删除旧的区域IP,新增新的区域IP + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","ipType","isAreaEffective", - "areaEffectiveIds","protocol","portPattern","srcPort","destPort","direction", - "destIpAddress","srcIpAddress","ipPattern"}); + BeanUtils.copyProperties(entity, cfg, + new String[] { "cfgRegionCode", "cfgType", "ipType", "isAreaEffective", "areaEffectiveIds", + "protocol", "portPattern", "srcPort", "destPort", "direction", "destIpAddress", + "srcIpAddress", "ipPattern" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } } - } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppHttpCfg(AppHttpCfg entity) throws Exception{ - //设置区域运营商信息 + } + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppHttpCfg(AppHttpCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - if(entity.getCfgId()==null){ + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -302,57 +365,58 @@ public class AppCfgService extends BaseService { entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.insertAppHttpCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); + areaIpCfgDao.saveAreaIpCfg(cfg); } } - - }catch (Exception e) { + + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppHttpCfg(entity); - - //删除旧的区域IP,新增新的区域IP + + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - + } - + } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppDomainCfg(AppDomainCfg entity) throws Exception{ - //设置区域运营商信息 + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppDomainCfg(AppDomainCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - - if(entity.getCfgId()==null){ + + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -360,52 +424,54 @@ public class AppCfgService extends BaseService { entity.setCreatorId(entity.getCurrentUser().getId()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.insertAppDomainCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + appCfgDao.insertAppDomainCfg(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppDomainCfg(entity); - //删除旧的区域IP,新增新的区域IP + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } } } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppByteCfg(AppByteCfg entity) throws Exception{ - //设置区域运营商信息 + + // 主题网站新增 修改 + public void saveOrUpdateAppTopicDomainCfg(AppTopicDomainCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - if(entity.getCfgId()==null){ + + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -413,52 +479,107 @@ public class AppCfgService extends BaseService { entity.setCreatorId(entity.getCurrentUser().getId()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.insertAppByteCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + appCfgDao.insertAppTopicDomainCfg(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); - appCfgDao.updateAppByteCfg(entity); - //删除旧的区域IP,新增新的区域IP + appCfgDao.updateAppTopicDomainCfg(entity); + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } } } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppSslCfg(AppSslCertCfg entity) throws Exception{ - //设置区域运营商信息 + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppByteCfg(AppByteCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - if(entity.getCfgId()==null){ + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { + compileId = idList.get(0); + } + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + entity.setIsValid(0); + entity.setIsAudit(0); + appCfgDao.insertAppByteCfg(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(e.getMessage()); + } + } else { + entity.setEditorId(entity.getCurrentUser().getId()); + entity.setEditTime(new Date()); + entity.setIsValid(0); + entity.setIsAudit(0); + appCfgDao.updateAppByteCfg(entity); + // 删除旧的区域IP,新增新的区域IP + AreaIpCfg area = new AreaIpCfg(); + area.setCompileId(entity.getCompileId()); + area.setFunctionId(entity.getFunctionId()); + areaIpCfgDao.deleteAreaIpCfg(area); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } + } + } + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppSslCfg(AppSslCertCfg entity) throws Exception { + // 设置区域运营商信息 + setAreaEffectiveIds(entity); + if (entity.getCfgId() == null) { + Integer compileId = 0; + try { + List idList = ConfigServiceUtil.getId(1, 1); + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -467,50 +588,103 @@ public class AppCfgService extends BaseService { entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.insertAppSslCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - - }catch (Exception e) { + + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppSslCfg(entity); - - //删除旧的区域IP,新增新的区域IP + + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - + } - + } - - public void auditAppPolicyCfg(AppPolicyCfg entity,Integer isAudit){ - String configType=entity.getConfigType(); - ToMaatBean maatBean = new ToMaatBean(); + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppTcpeCfg(AppTcpCfg entity) throws Exception { + // 设置区域运营商信息 + setAreaEffectiveIds(entity); + if (entity.getCfgId() == null) { + Integer compileId = 0; + try { + List idList = ConfigServiceUtil.getId(1, 1); + if (idList != null && idList.size() > 0) { + compileId = idList.get(0); + } + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + entity.setIsValid(0); + entity.setIsAudit(0); + appCfgDao.insertAppTcpCfg(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(e.getMessage()); + } + } else { + entity.setEditorId(entity.getCurrentUser().getId()); + entity.setEditTime(new Date()); + entity.setIsValid(0); + entity.setIsAudit(0); + appCfgDao.updateAppTcpCfg(entity); + // 删除旧的区域IP,新增新的区域IP + AreaIpCfg area = new AreaIpCfg(); + area.setCompileId(entity.getCompileId()); + area.setFunctionId(entity.getFunctionId()); + areaIpCfgDao.deleteAreaIpCfg(area); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } + } + } + + public void auditAppTcpCfg(AppTcpCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -518,87 +692,30 @@ public class AppCfgService extends BaseService { List strRegionList = new ArrayList(); List numRegionList = new ArrayList(); List digestRegionList = new ArrayList(); - List areaIpRegionList = new ArrayList(); - entity.setTableName(AppPolicyCfg.getTablename()); - List ntcList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + entity.setTableName(AppTcpCfg.getTablename()); appCfgDao.auditCfg(entity); - //更新关键字表状态 - if(entity.getCompileId()!=null){ - NtcSubscribeIdCfg ntc = new NtcSubscribeIdCfg(); - ntc.setCompileId(entity.getCompileId()); - ntc.setIsAudit(entity.getIsAudit()); - ntc.setIsValid(entity.getIsValid()); - ntc.setAuditorId(UserUtils.getUser().getId()); - ntc.setAuditTime(entity.getAuditTime()); - stringcfgDao.updateSubscribeIdCfg(ntc); - } - - if(isAudit==1){ - StringBuffer cfgKeywords=new StringBuffer(); - if(entity.getBehavCode()!=null){ - if(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { - cfgKeywords.append(Constants.APP_ID_REGION+"="+entity.getAppCode()); - }else if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)||Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { - cfgKeywords.append(Constants.PROTO_ID_REGION+"="+entity.getAppCode()); - } - cfgKeywords.append(Constants.KEYWORD_EXPR); - cfgKeywords.append(Constants.BEHAV_ID_REGION+"="+entity.getBehavCode()); -// entity.setCfgKeywords(entity.getAppCode()+Constants.KEYWORD_EXPR+entity.getBehavCode()); - }else{ - if(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { - cfgKeywords.append(Constants.APP_ID_REGION+"="+entity.getAppCode()); - }else if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)||Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { - cfgKeywords.append(Constants.PROTO_ID_REGION+"="+entity.getAppCode()); - } -// entity.setCfgKeywords(entity.getAppCode()+""); - } - entity.setCfgKeywords(cfgKeywords.toString()); - List list = new ArrayList(); + + if (isAudit == 1) { + List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,2,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(numRegionList, list, 4, entity, groupRelationList); + groupRelationList = map.get("groupList"); + numRegionList = map.get("dstList"); } - - //查询子配置并修改审核状态 - entity = this.getAppPolicyCfg(entity.getCfgId()); - if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){ - IpPortCfg cfg = new IpPortCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); - cfg.setTableName(IpPortCfg.getTablename()); - appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - ipRegionList=map.get("dstList"); - if(map.get("numRegionList")!=null){ - numRegionList.addAll(map.get("numRegionList")); - } - } - } - if(entity.getNtcSubscribeIdCfgList()!=null&&entity.getNtcSubscribeIdCfgList().size()>0){ - if(isAudit==1){ - Map ntcMap = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList); - groupRelationList=ntcMap.get("groupList"); - strRegionList=ntcMap.get("dstList"); - } - } - - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ - AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); - cfg.setTableName(AreaIpCfg.getTablename()); - appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); - } - } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + /* + * //保存区域IP信息 List + * areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); + * if(!StringUtil.isEmpty(areaIpCfgList)){ AreaIpCfg cfg = new AreaIpCfg(); + * BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + * cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); + * if(isAudit==1){ Map map = + * cfgConvert(areaIpRegionList,areaIpCfgList,4,entity,groupRelationList); + * groupRelationList=map.get("groupList"); areaIpRegionList=map.get("dstList"); + * } } + */ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -611,27 +728,169 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - String userRegion=null; - if(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { - //设置APP自定义域 - userRegion = Constants.APP_ID_REGION+"="+entity.getAppCode(); - if(entity.getBehavCode()!=null) { - userRegion += Constants.USER_REGION_SPLIT+Constants.BEHAV_ID_REGION+"="+entity.getBehavCode(); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); + maatCfg.setUserRegion(userRegion); + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(entity.getAuditTime()); + maatBean.setCreatorName(entity.getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.INSERT_ACTION); + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app SSL配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); + logger.info("app TCP配置下发响应信息:" + result.getMsg()); + + } else if (isAudit == 3) { + maatCfg.setCompileId(entity.getCompileId()); + maatCfg.setServiceId(entity.getServiceId()); + maatCfg.setIsValid(0);// 无效 + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(entity.getAuditTime()); + maatBean.setCreatorName(entity.getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.UPDATE_ACTION); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app TCP配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app TCP配置取消配置响应信息:" + result.getMsg()); + } + } + + public void auditAppPolicyCfg(AppPolicyCfg entity, Integer isAudit) { + String configType = entity.getConfigType(); + ToMaatBean maatBean = new ToMaatBean(); + MaatCfg maatCfg = new MaatCfg(); + List configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + entity.setTableName(AppPolicyCfg.getTablename()); + List ntcList = new ArrayList(); + appCfgDao.auditCfg(entity); + // 更新关键字表状态 + if (entity.getCompileId() != null) { + NtcSubscribeIdCfg ntc = new NtcSubscribeIdCfg(); + ntc.setCompileId(entity.getCompileId()); + ntc.setIsAudit(entity.getIsAudit()); + ntc.setIsValid(entity.getIsValid()); + ntc.setAuditorId(UserUtils.getUser().getId()); + ntc.setAuditTime(entity.getAuditTime()); + stringcfgDao.updateSubscribeIdCfg(ntc); + } + + if (isAudit == 1) { + StringBuffer cfgKeywords = new StringBuffer(); + if (entity.getBehavCode() != null) { + if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { + cfgKeywords.append(Constants.APP_ID_REGION + "=" + entity.getAppCode()); + } else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType) + || Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { + cfgKeywords.append(Constants.PROTO_ID_REGION + "=" + entity.getAppCode()); } - }else if(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { - userRegion = Constants.PROTO_ID_REGION+"="+entity.getAppCode(); - }else if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)) { - userRegion = Constants.PROTO_ID_REGION+"="+entity.getAppCode(); - if(entity.getBehavCode()!=null) { - userRegion += Constants.USER_REGION_SPLIT+Constants.BEHAV_ID_REGION+"="+entity.getBehavCode(); + cfgKeywords.append(Constants.KEYWORD_EXPR); + cfgKeywords.append(Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode()); + // entity.setCfgKeywords(entity.getAppCode()+Constants.KEYWORD_EXPR+entity.getBehavCode()); + } else { + if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { + cfgKeywords.append(Constants.APP_ID_REGION + "=" + entity.getAppCode()); + } else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType) + || Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { + cfgKeywords.append(Constants.PROTO_ID_REGION + "=" + entity.getAppCode()); } - + // entity.setCfgKeywords(entity.getAppCode()+""); } - //限速业务需要设置 + entity.setCfgKeywords(cfgKeywords.toString()); + List list = new ArrayList(); + list.add(entity); + Map map = cfgConvert(strRegionList, list, 2, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); + } + + // 查询子配置并修改审核状态 + entity = this.getAppPolicyCfg(entity.getCfgId()); + if (entity.getIpPortList() != null && entity.getIpPortList().size() > 0) { + IpPortCfg cfg = new IpPortCfg(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); + cfg.setTableName(IpPortCfg.getTablename()); + appCfgDao.auditCfg(cfg); + if (isAudit == 1) { + Map map = cfgConvert(ipRegionList, entity.getIpPortList(), 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + ipRegionList = map.get("dstList"); + if (map.get("numRegionList") != null) { + numRegionList.addAll(map.get("numRegionList")); + } + } + } + if (entity.getNtcSubscribeIdCfgList() != null && entity.getNtcSubscribeIdCfgList().size() > 0) { + if (isAudit == 1) { + Map ntcMap = cfgConvert(strRegionList, entity.getNtcSubscribeIdCfgList(), 2, entity, + groupRelationList); + groupRelationList = ntcMap.get("groupList"); + strRegionList = ntcMap.get("dstList"); + } + } + + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { + AreaIpCfg cfg = new AreaIpCfg(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); + cfg.setTableName(AreaIpCfg.getTablename()); + appCfgDao.auditCfg(cfg); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); + } + } + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { + maatCfg.initDefaultValue(); + BeanUtils.copyProperties(entity, maatCfg); + maatCfg.setAction(entity.getAction()); + maatCfg.setAuditTime(entity.getAuditTime()); + maatCfg.setIpRegionList(ipRegionList); + maatCfg.setStrRegionList(strRegionList); + maatCfg.setNumRegionList(numRegionList); + maatCfg.setDigestRegionList(digestRegionList); + maatCfg.setGroupRelationList(groupRelationList); + maatCfg.setGroupNum(groupRelationList.size()); + maatCfg.setAreaIpRegionList(areaIpRegionList); + maatCfg.setIsValid(entity.getIsValid()); + String userRegion = null; + if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) { + // 设置APP自定义域 + userRegion = Constants.APP_ID_REGION + "=" + entity.getAppCode(); + if (entity.getBehavCode() != null) { + userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode(); + } + } else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) { + userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode(); + } else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)) { + userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode(); + if (entity.getBehavCode() != null) { + userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode(); + } + + } + // 限速业务需要设置 String actionCode = DictUtils.getDictCode("SERVICE_ACTION", "action_ratelimit"); - if(!actionCode.equals("默认")){ - if(entity.getAction().equals(Integer.parseInt(actionCode))){ - userRegion += Constants.USER_REGION_SPLIT+Constants.RATE_LIMIT_REGION+"="+entity.getRatelimit(); + if (!actionCode.equals("默认")) { + if (entity.getAction().equals(Integer.parseInt(actionCode))) { + userRegion += Constants.USER_REGION_SPLIT + Constants.RATE_LIMIT_REGION + "=" + + entity.getRatelimit(); } } maatCfg.setUserRegion(userRegion); @@ -641,33 +900,34 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app策略配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app策略配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app策略配置下发响应信息:"+result.getMsg()); + logger.info("app策略配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app策略配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app策略配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app策略配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app策略配置取消配置响应信息:" + result.getMsg()); } } - public void auditAppIpCfg(AppIpCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppIpCfg(AppIpCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -678,28 +938,28 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppIpCfg.getTablename()); appCfgDao.auditCfg(entity); - if(isAudit==1){ + if (isAudit == 1) { List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(ipRegionList,list,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - ipRegionList=map.get("dstList"); + Map map = cfgConvert(ipRegionList, list, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + ipRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -712,8 +972,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -721,33 +981,34 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app协议IP配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app协议IP配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app协议IP配置下发响应信息:"+result.getMsg()); + logger.info("app协议IP配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app协议IP配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app协议IP配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app协议IP配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app协议IP配置取消配置响应信息:" + result.getMsg()); } } - public void auditAppHttpCfg(AppHttpCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppHttpCfg(AppHttpCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -758,29 +1019,29 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppHttpCfg.getTablename()); appCfgDao.auditCfg(entity); - - if(isAudit==1){ + + if (isAudit == 1) { List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,2,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 2, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -793,8 +1054,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -802,33 +1063,34 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app HTTP配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app HTTP配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app HTTP配置下发响应信息:"+result.getMsg()); + logger.info("app HTTP配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app HTTP配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app HTTP配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app HTTP配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app HTTP配置取消配置响应信息:" + result.getMsg()); } } - public void auditAppDomainCfg(AppDomainCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppDomainCfg(AppDomainCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -839,29 +1101,29 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppDomainCfg.getTablename()); appCfgDao.auditCfg(entity); - if(isAudit==1){ + if (isAudit == 1) { entity.setCfgKeywords(entity.getDomain()); List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,2,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 2, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -874,10 +1136,10 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode()+Constants.USER_REGION_SPLIT+ - "DOMAIN_ID="+entity.getCompileId()+Constants.USER_REGION_SPLIT+ - "DOMAIN_STR="+keywordsEscape(entity.getDomain()); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode() + Constants.USER_REGION_SPLIT + "DOMAIN_ID=" + + entity.getCompileId() + Constants.USER_REGION_SPLIT + "DOMAIN_STR=" + + keywordsEscape(entity.getDomain()); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -885,33 +1147,123 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app域名配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app域名配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app域名配置下发响应信息:"+result.getMsg()); + logger.info("app域名配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app域名配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app域名配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app域名配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app域名配置取消配置响应信息:" + result.getMsg()); } } - public void auditAppByteCfg(AppByteCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + // app主题网站配置审核 + public void auditAppTopicDomainCfg(AppTopicDomainCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); + MaatCfg maatCfg = new MaatCfg(); + List configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + entity.setTableName(AppTopicDomainCfg.getTablename()); + appCfgDao.auditCfg(entity); + // 域名为关键字 + if (isAudit == 1) { + entity.setCfgKeywords(entity.getDomain()); + List list = new ArrayList(); + list.add(entity); + Map map = cfgConvert(strRegionList, list, 2, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); + } + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { + AreaIpCfg cfg = new AreaIpCfg(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); + cfg.setTableName(AreaIpCfg.getTablename()); + appCfgDao.auditCfg(cfg); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); + } + } + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { + maatCfg.initDefaultValue(); + BeanUtils.copyProperties(entity, maatCfg); + maatCfg.setAction(entity.getAction()); + maatCfg.setAuditTime(entity.getAuditTime()); + maatCfg.setIpRegionList(ipRegionList); + maatCfg.setStrRegionList(strRegionList); + maatCfg.setNumRegionList(numRegionList); + maatCfg.setDigestRegionList(digestRegionList); + maatCfg.setGroupRelationList(groupRelationList); + maatCfg.setGroupNum(groupRelationList.size()); + maatCfg.setAreaIpRegionList(areaIpRegionList); + maatCfg.setIsValid(entity.getIsValid()); + + // 设置APP自定义域 + // "APP_ID="+entity.getAppCode()+Constants.USER_REGION_SPLIT+ + String userRegion = "DOMAIN_ID=" + entity.getCompileId() + Constants.USER_REGION_SPLIT + "DOMAIN_STR=" + + keywordsEscape(entity.getDomain()); + + maatCfg.setUserRegion(userRegion); + + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(entity.getAuditTime()); + maatBean.setCreatorName(entity.getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.INSERT_ACTION); + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app主题网站配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); + logger.info("app主题网站配置下发响应信息:" + result.getMsg()); + + } else if (isAudit == 3) { + maatCfg.setCompileId(entity.getCompileId()); + maatCfg.setServiceId(entity.getServiceId()); + maatCfg.setIsValid(0);// 无效 + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(entity.getAuditTime()); + maatBean.setCreatorName(entity.getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.UPDATE_ACTION); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app主题网站配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app主题网站配置取消配置响应信息:" + result.getMsg()); + } + } + + public void auditAppByteCfg(AppByteCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -922,30 +1274,30 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppByteCfg.getTablename()); appCfgDao.auditCfg(entity); - - if(isAudit==1){ + + if (isAudit == 1) { entity.setCfgKeywords(entity.getBytes()); List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,2,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 2, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -958,8 +1310,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置用户自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置用户自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -967,33 +1319,34 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app字节配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app字节配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app字节配置下发响应信息:"+result.getMsg()); + logger.info("app字节配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app字节配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app字节配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app字节配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app字节配置取消配置响应信息:" + result.getMsg()); } } - public void auditAppSslCfg(AppSslCertCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppSslCfg(AppSslCertCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -1004,29 +1357,29 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppSslCertCfg.getTablename()); appCfgDao.auditCfg(entity); - - if(isAudit==1){ + + if (isAudit == 1) { List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,3,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 3, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -1039,8 +1392,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -1048,35 +1401,36 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app SSL配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app SSL配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app SSL配置下发响应信息:"+result.getMsg()); + logger.info("app SSL配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app SSL配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app SSL配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app SSL配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app SSL配置取消配置响应信息:" + result.getMsg()); } } - public void updateAppPolicyCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId) { AppPolicyCfg entity = new AppPolicyCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1084,36 +1438,37 @@ public class AppCfgService extends BaseService { entity.setTableName(AppPolicyCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - - //查询子配置 + + // 查询子配置 entity = this.getAppPolicyCfg(Long.parseLong(id)); - if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){ + if (entity.getIpPortList() != null && entity.getIpPortList().size() > 0) { IpPortCfg cfg = new IpPortCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(IpPortCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - //删除关键字 - if(entity.getNtcSubscribeIdCfgList()!=null&&entity.getNtcSubscribeIdCfgList().size()>0){ + // 删除关键字 + if (entity.getNtcSubscribeIdCfgList() != null && entity.getNtcSubscribeIdCfgList().size() > 0) { NtcSubscribeIdCfg ntcSubscribeIdCfg = new NtcSubscribeIdCfg(); - BeanUtils.copyProperties(entity, ntcSubscribeIdCfg, new String[]{"cfgId"}); - stringcfgDao.deleteSubscribeIdCfg(ntcSubscribeIdCfg); + BeanUtils.copyProperties(entity, ntcSubscribeIdCfg, new String[] { "cfgId" }); + stringcfgDao.updateSubscribeIdCfg(ntcSubscribeIdCfg); } - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - public void updateAppIpCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppIpCfgValid(Integer isValid, String ids, Integer functionId) { AppIpCfg entity = new AppIpCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1121,21 +1476,45 @@ public class AppCfgService extends BaseService { entity.setTableName(AppIpCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - public void updateAppHttpCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppTcpCfgValid(Integer isValid, String ids, Integer functionId) { + AppTcpCfg entity = new AppTcpCfg(); + String[] idArray = ids.split(","); + for (String id : idArray) { + entity.setCfgId(Long.parseLong(id)); + entity.setIsValid(isValid); + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(new Date()); + entity.setTableName(AppTcpCfg.getTablename()); + entity.setFunctionId(functionId); + appCfgDao.updateCfgValid(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { + AreaIpCfg cfg = new AreaIpCfg(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); + cfg.setTableName(AreaIpCfg.getTablename()); + appCfgDao.updateCfgValid(cfg); + } + + } + + } + + public void updateAppHttpCfgValid(Integer isValid, String ids, Integer functionId) { AppHttpCfg entity = new AppHttpCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1143,21 +1522,22 @@ public class AppCfgService extends BaseService { entity.setTableName(AppHttpCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - public void updateAppDomainCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppDomainCfgValid(Integer isValid, String ids, Integer functionId) { AppDomainCfg entity = new AppDomainCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1165,21 +1545,46 @@ public class AppCfgService extends BaseService { entity.setTableName(AppDomainCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - public void updateAppByteCfgValid(Integer isValid,String ids,Integer functionId){ + + // 主题网站配置删除 + public void updateAppTopicDomainCfgValid(Integer isValid, String ids, Integer functionId) { + AppTopicDomainCfg entity = new AppTopicDomainCfg(); + String[] idArray = ids.split(","); + for (String id : idArray) { + entity.setCfgId(Long.parseLong(id)); + entity.setIsValid(isValid); + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(new Date()); + entity.setTableName(AppTopicDomainCfg.getTablename()); + entity.setFunctionId(functionId); + appCfgDao.updateCfgValid(entity); + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { + AreaIpCfg cfg = new AreaIpCfg(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); + cfg.setTableName(AreaIpCfg.getTablename()); + appCfgDao.updateCfgValid(cfg); + } + + } + + } + + public void updateAppByteCfgValid(Integer isValid, String ids, Integer functionId) { AppByteCfg entity = new AppByteCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1187,21 +1592,22 @@ public class AppCfgService extends BaseService { entity.setTableName(AppByteCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - public void updateAppSslCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppSslCfgValid(Integer isValid, String ids, Integer functionId) { AppSslCertCfg entity = new AppSslCertCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1209,21 +1615,22 @@ public class AppCfgService extends BaseService { entity.setTableName(AppSslCertCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } - public void updateAppHeaderCfgValid(Integer isValid,String ids,Integer functionId){ + + public void updateAppHeaderCfgValid(Integer isValid, String ids, Integer functionId) { AppHeaderCfg entity = new AppHeaderCfg(); String[] idArray = ids.split(","); - for(String id :idArray){ + for (String id : idArray) { entity.setCfgId(Long.parseLong(id)); entity.setIsValid(isValid); entity.setEditorId(UserUtils.getUser().getId()); @@ -1231,36 +1638,39 @@ public class AppCfgService extends BaseService { entity.setTableName(AppHeaderCfg.getTablename()); entity.setFunctionId(functionId); appCfgDao.updateCfgValid(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.updateCfgValid(cfg); } - + } - + } + public Page findAppHeaderList(Page page, AppHeaderCfg entity) { - entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); entity.setPage(page); List list = appCfgDao.findAppHeaderList(entity); page.setList(list); return page; } - public AppHeaderCfg getAppHeaderCfg(Long cfgId){ + + public AppHeaderCfg getAppHeaderCfg(Long cfgId) { return appCfgDao.getAppHeaderCfg(cfgId); } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateAppHeaderCfg(AppHeaderCfg entity) throws Exception{ - //设置区域运营商信息 + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppHeaderCfg(AppHeaderCfg entity) throws Exception { + // 设置区域运营商信息 setAreaEffectiveIds(entity); - if(entity.getCfgId()==null){ + if (entity.getCfgId() == null) { Integer compileId = 0; try { List idList = ConfigServiceUtil.getId(1, 1); - if(idList!=null && idList.size()>0){ + if (idList != null && idList.size() > 0) { compileId = idList.get(0); } entity.setCompileId(compileId); @@ -1269,48 +1679,49 @@ public class AppCfgService extends BaseService { entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.insertAppHeaderCfg(entity); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - - }catch (Exception e) { + + } catch (Exception e) { e.printStackTrace(); logger.info("获取编译ID出错"); throw new MaatConvertException(e.getMessage()); } - }else{ + } else { entity.setEditorId(entity.getCurrentUser().getId()); entity.setEditTime(new Date()); entity.setIsValid(0); entity.setIsAudit(0); appCfgDao.updateAppHeaderCfg(entity); - - //删除旧的区域IP,新增新的区域IP + + // 删除旧的区域IP,新增新的区域IP AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); areaIpCfgDao.deleteAreaIpCfg(area); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); - //保存区域IP信息 - if(entity.getAreaCfg()!=null){ - for(AreaIpCfg cfg:entity.getAreaCfg()){ + // 保存区域IP信息 + if (entity.getAreaCfg() != null) { + for (AreaIpCfg cfg : entity.getAreaCfg()) { cfg.initDefaultValue(); - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" }); areaIpCfgDao.saveAreaIpCfg(cfg); } } - + } - + } - public void auditAppHeaderCfg(AppHeaderCfg entity,Integer isAudit){ - ToMaatBean maatBean = new ToMaatBean(); + + public void auditAppHeaderCfg(AppHeaderCfg entity, Integer isAudit) { + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); List groupRelationList = new ArrayList(); @@ -1321,29 +1732,29 @@ public class AppCfgService extends BaseService { List areaIpRegionList = new ArrayList(); entity.setTableName(AppHeaderCfg.getTablename()); appCfgDao.auditCfg(entity); - - if(isAudit==1){ + + if (isAudit == 1) { List list = new ArrayList(); list.add(entity); - Map map = cfgConvert(strRegionList,list,3,entity,groupRelationList); - groupRelationList=map.get("groupList"); - strRegionList=map.get("dstList"); + Map map = cfgConvert(strRegionList, list, 3, entity, groupRelationList); + groupRelationList = map.get("groupList"); + strRegionList = map.get("dstList"); } - //保存区域IP信息 - List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); - if(!StringUtil.isEmpty(areaIpCfgList)){ + // 保存区域IP信息 + List areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId()); + if (!StringUtil.isEmpty(areaIpCfgList)) { AreaIpCfg cfg = new AreaIpCfg(); - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); cfg.setTableName(AreaIpCfg.getTablename()); appCfgDao.auditCfg(cfg); - if(isAudit==1){ - Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); - groupRelationList=map.get("groupList"); - areaIpRegionList=map.get("dstList"); + if (isAudit == 1) { + Map map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList); + groupRelationList = map.get("groupList"); + areaIpRegionList = map.get("dstList"); } } - //构造提交综合服务参数格式,一条配置提交一次综合服务 - if(isAudit==1){ + // 构造提交综合服务参数格式,一条配置提交一次综合服务 + if (isAudit == 1) { maatCfg.initDefaultValue(); BeanUtils.copyProperties(entity, maatCfg); maatCfg.setAction(entity.getAction()); @@ -1356,8 +1767,8 @@ public class AppCfgService extends BaseService { maatCfg.setGroupNum(groupRelationList.size()); maatCfg.setAreaIpRegionList(areaIpRegionList); maatCfg.setIsValid(entity.getIsValid()); - //设置APP自定义域 - String userRegion = "APP_ID="+entity.getAppCode(); + // 设置APP自定义域 + String userRegion = "APP_ID=" + entity.getAppCode(); maatCfg.setUserRegion(userRegion); configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); @@ -1365,29 +1776,29 @@ public class AppCfgService extends BaseService { maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - logger.info("app Header配置下发配置参数:"+json); - //调用服务接口下发配置 + // 调用服务接口下发配置数据 + String json = gsonToJson(maatBean); + logger.info("app Header配置下发配置参数:" + json); + // 调用服务接口下发配置 ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); - logger.info("app Header配置下发响应信息:"+result.getMsg()); + logger.info("app Header配置下发响应信息:" + result.getMsg()); - }else if(isAudit==3){ + } else if (isAudit == 3) { maatCfg.setCompileId(entity.getCompileId()); maatCfg.setServiceId(entity.getServiceId()); - maatCfg.setIsValid(0);//无效 + maatCfg.setIsValid(0);// 无效 configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口取消配置 - String json=gsonToJson(maatBean); - logger.info("app Header配置下发配置参数:"+json); - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,1); - logger.info("app Header配置取消配置响应信息:"+result.getMsg()); + // 调用服务接口取消配置 + String json = gsonToJson(maatBean); + logger.info("app Header配置下发配置参数:" + json); + // 调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json, 1); + logger.info("app Header配置取消配置响应信息:" + result.getMsg()); } } } diff --git a/src/main/java/com/nis/web/service/configuration/BgpCfgService.java b/src/main/java/com/nis/web/service/configuration/BgpCfgService.java index ba5fd87f8..43820e5f7 100644 --- a/src/main/java/com/nis/web/service/configuration/BgpCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/BgpCfgService.java @@ -135,10 +135,10 @@ public class BgpCfgService extends CrudService { areaIpCfgDao.saveAreaIpCfg(cfg); } } - } catch (Exception e) { + } catch (MaatConvertException e) { e.printStackTrace(); logger.info("获取编译ID出错"); - throw new MaatConvertException(":"+e.getMessage()); + throw new MaatConvertException(""); } }else{ @@ -146,9 +146,7 @@ public class BgpCfgService extends CrudService { //无效子配置后,再新增子配置 bgpCfgDao.deleteIpCfg(entity); bgpCfgDao.deleteBgpAsCfg(entity); - if(entity.getNtcSubscribeIdCfg()!=null){ - stringCfgDao.deleteSubscribeIdCfg(entity.getNtcSubscribeIdCfg()); - } + bgpCfgDao.deleteSubscribeIdCfg(entity); //TODO //bgpCfgDao.deleteDnsDomainCfg(entity); AreaIpCfg area = new AreaIpCfg(); diff --git a/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java b/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java index 09eb8ee34..f0b8dcabd 100644 --- a/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java @@ -378,6 +378,8 @@ public class FileTransferCfgService extends CrudService subscribeidList = fileTransferCfgDao.getFileDigestSubscribeidList(entity); + entity.setNtcSubscribeIdCfgList(subscribeidList); return entity; } @@ -402,18 +404,21 @@ public class FileTransferCfgService extends CrudService:"+null); - } + entity.setRawLen(result.getData().getRawLen()); + entity.setDigest(result.getData().getDigest()); + entity.setFileUrl(result.getData().getAccessUrl()); + mailCfgDao.saveMailFileDigestCfg(entity); + // 保存SubscribeId域配置信息 + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + fileTransferCfgDao.saveP2pSubscribeIdCfg(cfg); + } + } + } //保存区域IP信息 if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){ for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) { @@ -427,12 +432,26 @@ public class FileTransferCfgService extends CrudService ntcList = stringCfgDao.findSubscribeIdCfgList(ntcSubscribeIdCfg); + entity.setNtcSubscribeIdCfgList(ntcList); + } + return entity; + } + public Page getP2pList(Page page, CfgIndexInfo entity){ // 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL) entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a")); @@ -943,4 +973,5 @@ public class FileTransferCfgService extends CrudService httpReqBodyList = websiteCfgDao.getHttpReqBodyList(entity); entity.setCfgType(Constants.HTTP_REDIRECT_RES_BODY_REGION); List httpResBodyList = websiteCfgDao.getHttpResBodyList(entity); + List subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity); entity.setHttpReqBodyList(httpReqBodyList); entity.setHttpReqHdrList(httpReqHdrList); entity.setHttpResBodyList(httpResBodyList); entity.setHttpResHdrList(httpResHdrList); entity.setHttpUrlList(httpUrlList); entity.setIpPortList(ipPortCfgList); + entity.setNtcSubscribeIdCfgList(subscribeIdList); return entity; } @@ -152,6 +137,12 @@ public class HttpRedirectCfgService extends CrudService0)){ + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + websiteCfgDao.updateCfgValid(cfg); + } //保存区域IP信息 if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ AreaIpCfg cfg = new AreaIpCfg(); @@ -372,6 +379,19 @@ public class HttpRedirectCfgService extends CrudService0){ + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + websiteCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + } + } + //保存区域IP信息 List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); if(!StringUtil.isEmpty(areaIpCfgList)){ diff --git a/src/main/java/com/nis/web/service/configuration/XmppCfgService.java b/src/main/java/com/nis/web/service/configuration/XmppCfgService.java index 21d0a2aa7..0c6559524 100644 --- a/src/main/java/com/nis/web/service/configuration/XmppCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/XmppCfgService.java @@ -15,6 +15,7 @@ import com.nis.domain.configuration.AreaIpCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.NtcSubscribeIdCfg; import com.nis.domain.maat.MaatCfg; import com.nis.domain.maat.MaatCfg.DigestCfg; import com.nis.domain.maat.MaatCfg.GroupCfg; @@ -28,6 +29,7 @@ import com.nis.util.ConfigServiceUtil; import com.nis.util.Constants; import com.nis.util.StringUtil; import com.nis.web.dao.configuration.AreaIpCfgDao; +import com.nis.web.dao.configuration.StringCfgDao; import com.nis.web.dao.configuration.XmppCfgDao; import com.nis.web.security.UserUtils; import com.nis.web.service.CrudService; @@ -43,10 +45,19 @@ public class XmppCfgService extends CrudService { protected XmppCfgDao xmppCfgDao; @Autowired protected AreaIpCfgDao areaIpCfgDao; + @Autowired + protected StringCfgDao stringCfgDao; public CfgIndexInfo getXmppCfg(Long cfgId){ CfgIndexInfo entity = xmppCfgDao.getCfgIndexInfo(cfgId); List ipPortList = xmppCfgDao.getIpPortList(entity); + //设置关键字 + if(entity.getCompileId()!=null){ + NtcSubscribeIdCfg ntcSubscribeIdCfg = new NtcSubscribeIdCfg(); + ntcSubscribeIdCfg.setCompileId(entity.getCompileId()); + List ntcList = stringCfgDao.findSubscribeIdCfgList(ntcSubscribeIdCfg); + entity.setNtcSubscribeIdCfgList(ntcList); + } entity.setIpPortList(ipPortList); return entity; } @@ -68,6 +79,10 @@ public class XmppCfgService extends CrudService { if(idList!=null && idList.size()>0){ compileId = idList.get(0); } + } catch (MaatConvertException e) { + logger.info("获取编译ID出错"); + throw new MaatConvertException(""); + } entity.setCompileId(compileId); entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); @@ -78,6 +93,14 @@ public class XmppCfgService extends CrudService { xmppCfgDao.saveIpPortCfg(cfg); } } + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + stringCfgDao.saveSubscribeIdCfg(cfg); + } + } + } //保存区域IP信息 if(entity.getAreaCfg()!=null){ for(AreaIpCfg cfg:entity.getAreaCfg()){ @@ -86,16 +109,13 @@ public class XmppCfgService extends CrudService { areaIpCfgDao.saveAreaIpCfg(cfg); } } - } catch (Exception e) { - e.printStackTrace(); - logger.info("获取编译ID出错"); - throw new MaatConvertException(":"+e.getMessage()); - } + }else{ xmppCfgDao.updateCfgIndex(entity); //无效子配置后,再新增子配置 xmppCfgDao.deleteXmppIpCfg(entity); + stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity); AreaIpCfg area = new AreaIpCfg(); area.setCompileId(entity.getCompileId()); area.setFunctionId(entity.getFunctionId()); @@ -108,6 +128,14 @@ public class XmppCfgService extends CrudService { xmppCfgDao.saveIpPortCfg(cfg); } } + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + stringCfgDao.saveSubscribeIdCfg(cfg); + } + } + } //保存区域IP信息 if(entity.getAreaCfg()!=null){ for(AreaIpCfg cfg:entity.getAreaCfg()){ @@ -137,6 +165,13 @@ public class XmppCfgService extends CrudService { cfg.setTableName(IpPortCfg.getTablename()); xmppCfgDao.updateCfgValid(cfg); } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0) + { + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + xmppCfgDao.updateCfgValid(cfg); + } // if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0){ // HttpUrlCfg cfg = new HttpUrlCfg(); // BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); @@ -185,6 +220,17 @@ public class XmppCfgService extends CrudService { } } } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){ + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + xmppCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + } + } // if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0){ // HttpUrlCfg cfg = new HttpUrlCfg(); // BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); diff --git a/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java b/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java index 7d2815985..b66c34826 100644 --- a/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java +++ b/src/main/java/com/nis/web/service/specific/SpecificServiceCfgService.java @@ -12,6 +12,7 @@ import com.nis.domain.Page; import com.nis.domain.specific.ConfigGroupInfo; import com.nis.domain.specific.SpecificServiceCfg; import com.nis.util.ConfigServiceUtil; +import com.nis.util.Constants; import com.nis.web.dao.specific.SpecificServiceCfgDao; import com.nis.web.service.BaseService; @@ -89,6 +90,21 @@ public class SpecificServiceCfgService extends BaseService{ specificServiceCfg.setIsValid(1); specificServiceCfg.setOpTime(new Date()); + //用户添加的需要自增 + if(specificServiceCfg.getAddFlag()!=null) { + Integer serviceCode=specificServiceCfgDao.getMaxServiceCode(Constants.APP_SPEC_SERVICE_CODE_MAX_VAL,specificServiceCfg.getCfgType(),specificServiceCfg.getAddFlag()); + if(serviceCode==null) {//用户没有添加标签,获取最大的 + serviceCode=specificServiceCfgDao.getMaxServiceCode(Constants.APP_SPEC_SERVICE_CODE_MAX_VAL,specificServiceCfg.getCfgType(),null); + } + if(serviceCode==null) {//没有标签,取开始值 + serviceCode=Constants.APP_SPEC_SERVICE_CODE_MIN_VAL; + }else if(serviceCode>Constants.APP_SPEC_SERVICE_CODE_MAX_VAL){ + throw new RuntimeException("Get specific service code failed,specific service code is beyond the scope of application"); + }else if(serviceCode <%@ attribute name="checkedPS" type="java.lang.String" required="false" description="复选框选中时是否关联父子节点,ps关联父子,p关联父,s关联子,都不关联为空"%> <%@ attribute name="unCheckedPS" type="java.lang.String" required="false" description="复选框取消选中时是否关联父子节点,ps关联父子,p关联父,s关联子,都不关联为空"%> +<%@ attribute name="enableAddBtn" type="java.lang.Boolean" required="false" description="节点是否可编辑"%>
" data-msg-required="${dataMsgRequired}" placeholder="${empty value?labelValue:value}" @@ -45,7 +46,7 @@ return true; } // 正常打开 - top.$.jBox.open("iframe:${ctx}/tag/treeselect?url="+encodeURIComponent("${url}")+"&selectIds="+$("#${id}Id").val()+"&module=${module}&checked=${checked}&extId=${extId}&isAll=${isAll}&title=${title}", " ", 320, 420, { + top.$.jBox.open("iframe:${ctx}/tag/treeselect?url="+encodeURIComponent("${url}")+"&selectIds="+$("#${id}Id").val()+"&module=${module}&checked=${checked}&extId=${extId}&isAll=${isAll}&title=${title}&enableAddBtn=${enableAddBtn}", " ", 320, 420, { ajaxData:{selectIds: $("#${id}Id").val()},buttons:{"":"ok", "":"clear","":true}, submit:function(v, h, f){ if (v == "ok"){ var tree = h.find("iframe")[0].contentWindow.tree;//h.find("iframe").contents(); @@ -57,6 +58,7 @@ } //wx提示,c:if标签前加了//注释,c:if标签的判断条件仍会生效 for(var i=0; i if (nodes[i].isParent && "${checkedPS}"!=''){ continue; // 如果为复选框选择,并且父子节点有关联,则过滤掉父节点 diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgForm.jsp index e2d27aa66..facf44d90 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appByteCfgForm.jsp @@ -82,7 +82,7 @@ $(function(){
@@ -142,22 +142,13 @@ $(function(){
-
+ diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgForm.jsp index 77cd82995..9b8659eb9 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgForm.jsp @@ -142,22 +142,13 @@ $(function(){
-
+ diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appHeaderCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appHeaderCfgForm.jsp index 3eea1c739..c9c845482 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appHeaderCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appHeaderCfgForm.jsp @@ -171,22 +171,13 @@ $(function(){
-
+ diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgForm.jsp index 95ec2f585..fc3a2a519 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgForm.jsp @@ -170,22 +170,13 @@ $(function(){
-
+ diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgForm.jsp index c3b62f4f6..7f981a974 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgForm.jsp @@ -78,7 +78,7 @@ $(function(){
@@ -185,23 +185,14 @@ $(function(){
-
+
+ +
+
+
+ + + + + + + + + + + + +
+
+
+ + + @@ -212,6 +238,48 @@ + + + +

+ + +

+ + + + + + + +
+ <%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%> +
+ + +
+
+
+ + + + +
+ + + + +
+
+
+ +

diff --git a/src/main/webapp/WEB-INF/views/cfg/other/xmppList.jsp b/src/main/webapp/WEB-INF/views/cfg/other/xmppList.jsp index 151b2ff4d..5c17a4baf 100644 --- a/src/main/webapp/WEB-INF/views/cfg/other/xmppList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/other/xmppList.jsp @@ -9,7 +9,9 @@ //搜索框提示语初始化 if("${cfg.cfgDesc}"){ $("#intype").val("${cfg.cfgDesc}"); - }else{ + }else if("${cfg.compileId}"){ + $("#intype").val("${cfg.compileId}"); + } else{ $("#intype").attr("placeholder"," "+$("#seltype").find("option:selected").text()); } $("#seltype").change(function(){ @@ -30,6 +32,7 @@ $(".Wdate").attr("value",''); $("#level").attr("value",''); $("#searchForm")[0].reset(); + $("#intype").attr("placeholder"," "+$("#seltype").find("option:selected").text()); }); //异步获取voip相关信息 $("span[id^=open]").click(function(){ @@ -132,6 +135,7 @@ + <%-- @@ -305,8 +309,10 @@ + + @@ -329,6 +335,7 @@ + ${indexCfg.compileId } ${indexCfg.cfgDesc } @@ -337,6 +344,13 @@ + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/cfg/other/xmppSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/other/xmppSubList.jsp index e03edbf18..ee5700462 100644 --- a/src/main/webapp/WEB-INF/views/cfg/other/xmppSubList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/other/xmppSubList.jsp @@ -120,6 +120,60 @@ + + + + +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectForm.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectForm.jsp index 09ab8c2cc..8331f3d28 100644 --- a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectForm.jsp @@ -195,6 +195,31 @@ + + +
+
+
+ + + + + + + + + + + +
+
+
+ +
<%@include file="/WEB-INF/views/cfg/actionRegionForm.jsp"%>
@@ -289,6 +314,26 @@
+ + +
+ +

+ + +

+ + <%-- --%> + + +
hidden disabled " > + <%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%> +
+
+
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectList.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectList.jsp index fd7118941..297137cae 100644 --- a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectList.jsp @@ -516,7 +516,9 @@ - + + + @@ -601,7 +603,15 @@ ${indexCfg.userRegion2 } ${indexCfg.userRegion3 } - + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectSubList.jsp index 2ddfecefa..e651f3e15 100644 --- a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectSubList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectSubList.jsp @@ -53,6 +53,14 @@ + +
+ + +
+
+ @@ -406,5 +414,53 @@ + +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp index 80f5170c9..ecb78c464 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/dashBoardIndex.jsp @@ -8,6 +8,9 @@ 数据概览 + + + +
-
+
-
-
+ - -
+
-
-
-

活跃网站流量

-

15802

+ - -
+ <%--
-
-
-

热门网站流量

-

15802

-
-
-
-
-

互联网流量包数

-

15802

+
-
+
--%>
- +
@@ -175,41 +186,6 @@ Linux 0 - - 4 - DOS - 0 - - - 5 - windows - 0 - - - 6 - iOS - 0 - - - 7 - windows - 0 - - - 8 - windows - 0 - - - 9 - windows - 0 - - - 10 - windows - 0 -
@@ -254,41 +230,6 @@ Google 0 - - 4 - Yahoo - 0 - - - 5 - qq - 0 - - - 6 - Googleusercontent - 0 - - - 7 - Microsoftonline - 0 - - - 8 - Pornhub - 0 - - - 9 - Youtube - 0 - - - 10 - Facebook - 0 -
@@ -313,27 +254,15 @@ <%-- --%> - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
${entry.id }${entry.ipAddr }${entry.areaId }${entry.linkNum }${entry.c2sPktNum }${entry.s2cPktNum }${entry.c2sByteLen }${entry.s2cByteLen }
+
${page}
+
+
+

+  1 + +

+ + + + + + + + + + + + +
12131
241241
31412
34655
37457
33457
38468
3367
33456
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp index 8b8f6ca33..56e46263c 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp @@ -17,6 +17,9 @@

+ +
+
@@ -64,9 +67,72 @@
- - + + <%--解决ztree add小图标丢失 --%> + diff --git a/src/main/webapp/static/global/plugins/highcharts/css/common.css b/src/main/webapp/static/global/plugins/highcharts/css/common.css index 00631575a..0ee7ca2cc 100644 --- a/src/main/webapp/static/global/plugins/highcharts/css/common.css +++ b/src/main/webapp/static/global/plugins/highcharts/css/common.css @@ -1,7 +1,7 @@ *{ margin: 0; padding: 0; - font-family: PingFangSC-Light, 微软雅黑; + font-family: PingFangSC-Light, Microsoft YaHei; } body,html{ width: 100%; @@ -45,42 +45,7 @@ a { .fr{ float: right; } -/* header开始 */ -.header-title { - width: 100%; - height: 115px; - padding: 30px 0 35px 0; - box-sizing: border-box; -} -.header-title>.title-center { - width: 440px; - height: 40px; - box-sizing: border-box; - border-right: 5px solid #333333; - border-left: 5px solid #333333; -/* background: url(../img/title.png) no-repeat; */ -} -.header-title>.title-center>a { - margin-top: 1px; - margin-left: 130px; - color: #fff; - font-size: 30px; - font-weight: 600; - position: absolute; -} -.header-title>.title-left, .header-title>.title-right { - width: calc(50% - 220px); - height: 3px; - background: #333333; - margin-top: 10px; -} -.fl { - float: left; -} -.fr { - float: right; -} td a { color:#fff diff --git a/src/main/webapp/static/global/plugins/highcharts/css/data_text.css b/src/main/webapp/static/global/plugins/highcharts/css/data_text.css index 205bad8bb..3326ba7f9 100644 --- a/src/main/webapp/static/global/plugins/highcharts/css/data_text.css +++ b/src/main/webapp/static/global/plugins/highcharts/css/data_text.css @@ -1,53 +1,65 @@ + +/* 页面整体布局 */ .data_content{ /*overflow-x: hidden;*/ /* min-width: 1366px; */ background-color: #303030; - padding-top: 40px; + padding-top: 30px; padding-bottom: 10px; } -/* */ +/******************** info start *************************/ +p{ + margin: 10px +} .data_content .data_info{ - width: calc(100% - 30px); + width: calc(100% - 20px); margin-bottom: 40px; height: 110px; margin-left: 15px; text-align: center; } -.data_content .data_info .info_1{ - width: 40%; +.data_content .data_info .info_2{ + width: 60%; height: 110px; } -.data_content .data_info .fr{ - width: 40%; +.data_content .data_info .fr_fc{ + width: 155%; + height: 110px; + border: 1px solid #303030; + border-width: 0 1px; +} +.data_content .data_info .fr_fc .fl_fc{ + width: 100%; + height: 110px; border: 1px solid #303030; border-width: 0 1px; margin-left: 0px; } -.data_content .data_info .info_1>.text_1{ - width: calc(100% - 15px); +.data_content .data_info .info_2>.text_2{ + width: calc(100% - 10px); background-color: #3D3D3D; height: 110px; } -.data_content .data_info .info_2{ - width: 31%; +.data_content .data_info .info_1{ + width: 40%; height: 110px; } -.data_content .data_info .info_1 .fr:first-child{ +.data_content .data_info .info_2 .fr_fc:first-child{ border-left: none; } -.data_content .data_info .info_1 .fr:last-child{ +.data_content .data_info .info_2 .fr_fc:last-child{ border-right: none; } -.data_content .data_info .info_2>.text_2{ - width: calc(100% - 15px); +.data_content .data_info .info_1>.text_1{ + width: calc(100% - 1px); background-color: #3D3D3D; height: 110px; } -.data_content .data_info .info_3{ +/* .data_content .data_info .info_3{ width: 29%; height: 110px; } @@ -56,46 +68,81 @@ background-color: #3D3D3D; height: 110px; -} +} */ -.data_content .data_info>div.info_1>.text_1>div{ +.data_content .data_info>div.info_2>.text_2>div{ width: 33.333%; position: relative; } -.data_content .data_info>div.info_2>div>div, -.data_content .data_info>div.info_3>div>div{ +.data_content .data_info>div.info_1>div>div, +.data_content .data_info>div.info_2>div>div{ width: 50%; position: relative; } .data_content .data_info>div>div>div>div{ - margin-left:40px; + margin-left:10px; margin-top: 1px; } -.data_content .data_info>div.info_2>div>div>div{ - margin-left: 40px; +.data_content .data_info>div.info_1>div>div>div{ + margin-left: 10px; margin-top: 1px; } .data_content .data_info p:nth-child(1){ color:#fff; font-size: 12.8px; + text-align: center; } -.data_content .data_info p:nth-child(2){ +.data_content .data_info>div.info_1 p:nth-child(2){ font-weight: 600; - font-size: 28px; - color:#ffff43; + font-size: 16px; + color:#288dce; + margin-top: 2.1em; } -.data_content .data_info>div.info_2 p:nth-child(2){ +.data_content .data_info .info_2 .fr_fc .numberRun2{ font-weight: 600; - font-size: 28px; - color:#25f3e6; + font-size: 16px; + color:#288dce; + margin-top: 2.1em; } -.data_content .data_info>div.info_3 p:nth-child(2){ +.data_content .data_info .info_2 .fr_fc .numberRun3{ font-weight: 600; - font-size: 28px; - color:#ff4e4e; + font-size: 16px; + color:#288dce; + margin-top: 2.1em; } -/* info end */ +.data_content .data_info>div.info_2 .fl_fc .numberRun4{ + font-weight: 600; + font-size: 16px; + color:#288dce; + margin-top: 1px; +} +.data_content .data_info>div.info_2 .fl_fc .csNum{ + font-size: 5px; + color:#ff4e4e !important; + margin-top: 1px; +} +/* .data_info{ + float: right; + margin-right: 15px; +} */ +.fl_fc{ + float: left; +} +.fr_fc{ + float: left; +} +.clearfix:after,.clearfix:before{ + content:"."; + display: table; +} +.clearfix:after{ + clear: both; +} +.clearfix { + *zoom: 1; /*IE/7/6*/ +} +/************** info end ***********************/ .data_content .data_main{ width: calc(100% - 30px); diff --git a/src/main/webapp/static/global/plugins/highcharts/echart.js b/src/main/webapp/static/global/plugins/highcharts/echart.js index 92cccd123..4279316f1 100644 --- a/src/main/webapp/static/global/plugins/highcharts/echart.js +++ b/src/main/webapp/static/global/plugins/highcharts/echart.js @@ -28,7 +28,6 @@ }); }); - console.log(data) var chart = Highcharts.chart('chart_1', { chart: { type: 'pie', @@ -41,9 +40,6 @@ }, noData:{ - position:{ - align:'center' - }, style: {//设置字体颜色 color: '#fff', }, @@ -118,7 +114,7 @@ type: 'pie', innerSize: '70%',//圆环的大小 name: 'count', - data: [] + data: data }], drilldown:{ series:drillData, diff --git a/src/main/webapp/static/pages/css/dashboard.css b/src/main/webapp/static/pages/css/dashboard.css new file mode 100644 index 000000000..049cf7dbf --- /dev/null +++ b/src/main/webapp/static/pages/css/dashboard.css @@ -0,0 +1,5 @@ +/*数字滚动插件的CSS可调整样式*/ +.mt-number-animate{ font-family: 'Microsoft YaHei'; line-height:20px; height: 20px;/*设置数字显示高度*/; /*设置数字大小*/ overflow: hidden; display: inline-block; position: relative; } +.mt-number-animate .mt-number-animate-dot{ width: 10px;/*设置分割符宽度*/ line-height: 20px; float: left; text-align: center;} +.mt-number-animate .mt-number-animate-dom{ width: 10px;/*设置单个数字宽度*/ text-align: center; float: left; position: relative; top: 0;} +.mt-number-animate .mt-number-animate-dom .mt-number-animate-span{ width: 100%; float: left;} diff --git a/src/main/webapp/static/pages/scripts/dashboard.js b/src/main/webapp/static/pages/scripts/dashboard.js new file mode 100644 index 000000000..2f2dea9ab --- /dev/null +++ b/src/main/webapp/static/pages/scripts/dashboard.js @@ -0,0 +1,129 @@ +/** +* 数字滚动插件 v1.0 +*/ +(function($) { + $.fn.numberAnimate = function(setting) { + var defaults = { + speed : 1000,//动画速度 + num : "", //初始化值 + iniAnimate : true, //是否要初始化动画效果 + symbol : '',//默认的分割符号,千,万,千万 + dot : 0 //保留几位小数点 + } + //如果setting为空,就取default的值 + var setting = $.extend(defaults, setting); + + //如果对象有多个,提示出错 + if($(this).length > 1){ + alert("just only one obj!"); + return; + } + + //如果未设置初始化值。提示出错 + if(setting.num == ""){ + alert("must set a num!"); + return; + } + var nHtml = '
\ + 0\ + 1\ + 2\ + 3\ + 4\ + 5\ + 6\ + 7\ + 8\ + 9\ + .\ +
'; + + //数字处理 + var numToArr = function(num){ + num = parseFloat(num).toFixed(setting.dot); + if(typeof(num) == 'number'){ + var arrStr = num.toString().split(""); + }else{ + var arrStr = num.split(""); + } + //console.log(arrStr); + return arrStr; + } + + //设置DOM symbol:分割符号 + var setNumDom = function(arrStr){ + var shtml = '
'; + for(var i=0,len=arrStr.length; i'+nHtml.replace("{{num}}",arrStr[i]); + }else{ + shtml += nHtml.replace("{{num}}",arrStr[i]); + } + } + shtml += '
'; + return shtml; + } + + //执行动画 + var runAnimate = function($parent){ + $parent.find(".mt-number-animate-dom").each(function() { + var num = $(this).attr("data-num"); + num = (num=="."?10:num); + var spanHei = $(this).height()/11; //11为元素个数 + var thisTop = -num*spanHei+"px"; + if(thisTop != $(this).css("top")){ + if(setting.iniAnimate){ + //HTML5不支持 + if(!window.applicationCache){ + $(this).animate({ + top : thisTop + }, setting.speed); + }else{ + $(this).css({ + 'transform':'translateY('+thisTop+')', + '-ms-transform':'translateY('+thisTop+')', /* IE 9 */ + '-moz-transform':'translateY('+thisTop+')', /* Firefox */ + '-webkit-transform':'translateY('+thisTop+')', /* Safari 和 Chrome */ + '-o-transform':'translateY('+thisTop+')', + '-ms-transition':setting.speed/1000+'s', + '-moz-transition':setting.speed/1000+'s', + '-webkit-transition':setting.speed/1000+'s', + '-o-transition':setting.speed/1000+'s', + 'transition':setting.speed/1000+'s' + }); + } + }else{ + setting.iniAnimate = true; + $(this).css({ + top : thisTop + }); + } + } + }); + } + + //初始化 + var init = function($parent){ + //初始化 + $parent.html(setNumDom(numToArr(setting.num))); + runAnimate($parent); + }; + + //重置参数 + this.resetData = function(num){ + var newArr = numToArr(num); + var $dom = $(this).find(".mt-number-animate-dom"); + if($dom.length < newArr.length){ + $(this).html(setNumDom(numToArr(num))); + }else{ + $dom.each(function(index, el) { + $(this).attr("data-num",newArr[index]); + }); + } + runAnimate($(this)); + } + //init + init($(this)); + return this; + } +})(jQuery); \ No newline at end of file