Merge branch 'develop' of http://10.0.6.99/gwall/gwall.git into develop

Conflicts:
	src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js
	src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js
This commit is contained in:
fangshunjian
2018-08-27 20:08:13 +08:00
191 changed files with 4999 additions and 1857 deletions

View File

@@ -28,7 +28,7 @@ public class AppDomainCfg extends BaseCfg<AppDomainCfg> {
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
private String ratelimit;
private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
@@ -92,11 +92,11 @@ public class AppDomainCfg extends BaseCfg<AppDomainCfg> {
return tableName;
}
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public Integer getAppCode() {

View File

@@ -27,7 +27,7 @@ public class AppHeaderCfg extends BaseCfg<AppHeaderCfg> {
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
private String ratelimit;
private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
@@ -92,11 +92,11 @@ public class AppHeaderCfg extends BaseCfg<AppHeaderCfg> {
return tableName;
}
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public Integer getAppCode() {

View File

@@ -28,7 +28,7 @@ public class AppHttpCfg extends BaseCfg<AppHttpCfg> {
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
private String ratelimit;
private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
@@ -93,11 +93,11 @@ public class AppHttpCfg extends BaseCfg<AppHttpCfg> {
return tableName;
}
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public Integer getAppCode() {

View File

@@ -28,7 +28,7 @@ public class AppInnerRuleCfg extends BaseCfg<AppInnerRuleCfg> {
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
private String ratelimit;
private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
@@ -92,11 +92,11 @@ public class AppInnerRuleCfg extends BaseCfg<AppInnerRuleCfg> {
return tableName;
}
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public Integer getAppCode() {

View File

@@ -20,7 +20,7 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
private String ratelimit;
private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
@@ -213,11 +213,11 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
return tableName;
}
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public Integer getAppCode() {

View File

@@ -34,7 +34,7 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
private String ratelimit;
private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
@@ -145,11 +145,11 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
return tableName;
}
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public Integer getAppCode() {

View File

@@ -27,7 +27,7 @@ public class AppSslCertCfg extends BaseCfg<AppSslCertCfg> {
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
private String ratelimit;
private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
@@ -92,11 +92,11 @@ public class AppSslCertCfg extends BaseCfg<AppSslCertCfg> {
return tableName;
}
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public Integer getAppCode() {

View File

@@ -30,7 +30,7 @@ public class AppStringCfg extends BaseStringCfg<AppStringCfg> {
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
private String ratelimit;
/* (non-Javadoc)
* @see com.nis.domain.configuration.BaseCfg#initDefaultValue()
@@ -53,11 +53,11 @@ public class AppStringCfg extends BaseStringCfg<AppStringCfg> {
return tableName;
}
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}

View File

@@ -27,7 +27,7 @@ public class AppTcpCfg extends BaseCfg<AppTcpCfg> {
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
private String ratelimit;
private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
@@ -121,11 +121,11 @@ public class AppTcpCfg extends BaseCfg<AppTcpCfg> {
return tableName;
}
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public Integer getAppCode() {

View File

@@ -26,7 +26,7 @@ public class AppTopicDomainCfg extends BaseCfg<AppTopicDomainCfg> {
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
private String ratelimit;
// private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
@@ -101,11 +101,11 @@ public class AppTopicDomainCfg extends BaseCfg<AppTopicDomainCfg> {
return tableName;
}
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
// public Integer getAppCode() {

View File

@@ -109,20 +109,20 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
/**
* 限速比例
*/
protected Integer ratelimit ;
protected String ratelimit ;
/**
* ratelimit
* @return ratelimit
*/
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
/**
* @param ratelimit the ratelimit to set
*/
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
/**

View File

@@ -10,10 +10,6 @@ package com.nis.domain.configuration;
import java.util.List;
import com.nis.domain.SysRole;
import com.nis.util.excel.ExcelField;
import com.nis.util.excel.fieldtype.RoleListType;
/**
* @ClassName: CfgIndexInfo.java

View File

@@ -20,19 +20,19 @@ import com.nis.util.Constants;
*/
public class HttpUrlCfg extends BaseStringCfg<HttpUrlCfg> {
private static final String tableName="http_url_cfg";
private Integer ratelimit;
private String ratelimit;
/**
* ratelimit
* @return ratelimit
*/
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
/**
* @param ratelimit the ratelimit to set
*/
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
/**

View File

@@ -22,7 +22,7 @@ public class IpAddrTemplate extends IpCfgTemplate {
}
@Override
public Integer getRatelimit() {
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}

View File

@@ -44,7 +44,7 @@ public class IpCfgTemplate {
private String attributeName;//18
private String lableName;//19
private String areaEffectiveIds;//20
private Integer ratelimit;//21
private String ratelimit;//21
private Integer dnsStrategyId;//22
private Integer irType;//23
private String userRegion1;//77
@@ -128,13 +128,13 @@ public class IpCfgTemplate {
* @return ratelimit
*/
@ExcelField(title="ratelimit",align=2,sort=74)
public Integer getRatelimit() {
public String getRatelimit() {
return ratelimit;
}
/**
* @param ratelimit the ratelimit to set
*/
public void setRatelimit(Integer ratelimit) {
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
/**

View File

@@ -28,7 +28,7 @@ public class IpMultiplexPolicyTemplate extends IpCfgTemplate {
}
@Override
public Integer getRatelimit() {
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}

View File

@@ -22,7 +22,7 @@ public class IpsecTemplate extends IpCfgTemplate {
}
@Override
public Integer getRatelimit() {
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}

View File

@@ -22,7 +22,7 @@ public class TunnelIpTemplate extends IpCfgTemplate {
}
@Override
public Integer getRatelimit() {
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}

View File

@@ -57,7 +57,7 @@ public class WhiteListIpTemplate extends IpCfgTemplate {
}
@Override
public Integer getRatelimit() {
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}

View File

@@ -31,6 +31,7 @@ public class SearchReport extends BaseEntity<SearchReport>{
private Integer functionId;
private String cfgName;
private Integer action;
private String services;//service日志总量统计使用
private Integer reportType;//小时报,日报,月报
//标签性质来文函号境内源Ip,各国目的IP运营商局点
private String reportBusinessType;
@@ -50,6 +51,13 @@ public class SearchReport extends BaseEntity<SearchReport>{
//界面查询的时间
private String reportTime;
public String getServices() {
return services;
}
public void setServices(String services) {
this.services = services;
}
/**
* reportStartTime
* @return reportStartTime

View File

@@ -25,21 +25,14 @@ public class NtcPzReport extends BaseReport<NtcPzReport>{
*/
private static final long serialVersionUID = 7079305499220977782L;
private Long configId;
private Long cfgId;
private Date statTime;
/**
* configId
* @return configId
*/
public Long getConfigId() {
return configId;
public Long getCfgId() {
return cfgId;
}
/**
* @param configId the configId to set
*/
public void setConfigId(Long configId) {
this.configId = configId;
public void setCfgId(Long cfgId) {
this.cfgId = cfgId;
}
/**
* statTime

View File

@@ -54,7 +54,6 @@ import com.nis.util.DictUtils;
import com.nis.util.JsonMapper;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExportExcel;
import com.nis.web.dao.configuration.InterceptCfgDao;
import com.nis.web.service.ArchiveServcie;
import com.nis.web.service.AreaService;
import com.nis.web.service.DictService;
@@ -1064,13 +1063,18 @@ public class BaseController {
}
}
if("ipratelimit".equals(specialItem)) {
Integer ratelimit=value.getRatelimit();
String ratelimit=value.getRatelimit();
if(ratelimit==null) {
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("ratelimit"))+";");
}else {
if(ratelimit.intValue()<0||ratelimit.intValue()>100) {
errInfo.append(prop.getProperty("ratelimit_limit")+";");
try {
if(Double.parseDouble(ratelimit)<0||Double.parseDouble(ratelimit)>1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("ratelimit_limit"))+";");
}
}catch (Exception e) {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("ratelimit_limit"))+";");
}
}
}
//attribute check end

View File

@@ -131,9 +131,11 @@ public class AvController extends BaseController {
entity.setResultPath(resultFileAllPath);
File uploadSrcFile = new File(srcFileAllPath);
File uploadSampleFile = new File(sampleFileAllPath);
// File uploadSampleFile = new File(sampleFileAllPath);
FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);//保存源文件
String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
entity.setSrcUrl("");
entity.setSampleUrl("");
/*String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
String srcUrl = host+srcFilePath.substring(srcFilePath.indexOf(Constants.AV_FILE_PATH)+Constants.AV_FILE_PATH.length()-1)+sep+uploadSrcFile.getName();
String sampleUrl = host+sampleFilePath.substring(sampleFilePath.indexOf(Constants.AV_FILE_PATH)+Constants.AV_FILE_PATH.length()-1)+sep+uploadSampleFile.getName();
srcUrl = srcUrl.replace("\\", "/");
@@ -141,7 +143,7 @@ public class AvController extends BaseController {
logger.info("srcUrl:"+srcUrl);
logger.info("sampleUrl:"+sampleUrl);
entity.setSrcUrl(srcUrl);
entity.setSampleUrl(sampleUrl);
entity.setSampleUrl(sampleUrl);*/
// File uploadSrcFile = new File(srcFilePath);
// FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);
@@ -209,10 +211,10 @@ public class AvController extends BaseController {
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
String oldSrcUrl = entity.getSrcPath();
String oldSampleUrl = entity.getSamplePath();
// String oldSrcUrl = entity.getSrcPath();
// String oldSampleUrl = entity.getSamplePath();
try {
if(isAudit==1){
/*if(isAudit==1){
Date creatTime = entity.getCreateTime();
//音视频文件上传接口调用
File srcFile = new File(oldSrcUrl);
@@ -254,15 +256,15 @@ public class AvController extends BaseController {
// entity.setSamplePath("");
}
}
}*/
avCfgService.auditAvFileSample(entity,isAudit);
//删除本地源文件和样例文件
if(!oldSrcUrl.equals(entity.getSrcUrl())){
/*if(!oldSrcUrl.equals(entity.getSrcUrl())){
FileUtils.deleteFile(oldSrcUrl);
}
if(!oldSampleUrl.equals(entity.getSampleUrl())){
FileUtils.deleteFile(oldSampleUrl);
}
}*/
}catch(Exception e){
e.printStackTrace();
if(e instanceof MaatConvertException) {

View File

@@ -1,10 +1,13 @@
package com.nis.web.controller.configuration.ntc;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -15,15 +18,18 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.configuration.template.IpAddrTemplate;
import com.nis.domain.configuration.template.IpsecTemplate;
import com.nis.domain.configuration.template.TunnelIpTemplate;
import com.nis.util.Constants;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.DictUtils;
import com.nis.web.controller.configuration.CommonController;
import com.nis.web.security.UserUtils;
/**
* IP相关配置控制类
@@ -35,54 +41,87 @@ import com.nis.web.controller.configuration.CommonController;
public class IpController extends CommonController{
@RequestMapping(value = {"list"})
// @RequiresPermissions(value={"iplist:config","iplist:confirm"},logical=Logical.OR)
public String list(String cfgName,Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
this._ipList(cfgName, model, cfg, request, response);
model.addAttribute("urlPrefix","/ntc/iplist");
model.addAttribute("requiresPermissionPrefix","iplist");
return "/cfg/common/ipList";
public String list(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(searchPage, cfg);
model.addAttribute("page", page);
initPageCondition(model,cfg);
return "/cfg/ipaddr/ipList";
}
@RequestMapping(value = {"form"})
@RequiresPermissions(value={"iplist:config"})
public String form(String cfgName,Model model,String ids,Integer functionId,BaseIpCfg entity) {
this._ipForm(cfgName, model, ids, functionId, entity);
List<SysDataDictionaryItem> specialFunctionIdList = DictUtils.getDictList("SPECIAL_FUNCTION_ID");
String specialFunctionId=null;
for(SysDataDictionaryItem item:specialFunctionIdList) {
if(Integer.parseInt(item.getItemCode())==entity.getFunctionId().intValue()) {
specialFunctionId= item.getItemValue();
break;
}
public String form(Model model,String ids,CfgIndexInfo entity) {
if(StringUtils.isNotBlank(ids)){
entity = ipCfgService.getIpPortCfg(Long.parseLong(ids));
initUpdateFormCondition(model,entity);
}else{
initFormCondition(model,entity);
}
model.addAttribute("dropAction",Constants.DROP_ACTION);
model.addAttribute("urlPrefix","/ntc/iplist");
model.addAttribute("requiresPermissionPrefix","iplist");
// if(specialFunctionId!=null && "ipsec".equals(specialFunctionId)) {
// return "/cfg/ipsec/ipForm";
// }else if(specialFunctionId!=null && "ipaddr".equals(specialFunctionId)) {
// return "/cfg/ipaddr/ipForm";
// }
return "/cfg/common/ipForm";
model.addAttribute("_cfg", entity);
return "/cfg/ipaddr/ipForm";
}
@RequestMapping(value = {"saveOrUpdate"})
public String saveOrUpdate(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
this._saveOrUpdateIp(cfgName, model, cfg);
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+cfg.getFunctionId();
public String saveOrUpdate(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
ipCfgService.saveIpCfg(entity);
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}
@RequestMapping(value = {"delete"})
@RequestMapping(value = {"ajaxSubList"})
public String ajaxIpPortSubList(Model model,Long cfgId,Integer index) {
CfgIndexInfo cfg = ipCfgService.getIpPortCfg(cfgId);
/*List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(cfg.getFunctionId());
model.addAttribute("regionList", regionList);*/
List<String[]> tabList = new ArrayList();
if(cfg.getIpPortList()!=null){
String cfgType = null;
for(IpPortCfg ip:cfg.getIpPortList()){
if(!ip.getCfgType().equals(cfgType)){
tabList.add(new String[]{"1",ip.getCfgType()});
cfgType = ip.getCfgType();
}
}
}
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);
return "/cfg/ipaddr/ipSubList";
}
@RequestMapping(value = {"updateValid"})
@RequiresPermissions("iplist:config")
public String delete(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
this._deleteIp(cfgName, ids, compileIds, functionId, model);
model.addAttribute("urlPrefix","/ntc/iplist");
model.addAttribute("requiresPermissionPrefix","iplist");
public String updateIpPortCfgValid(Integer isValid,String ids,Integer functionId) {
ipCfgService.updateIpCfgValid(isValid, ids, functionId);
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+functionId;
}
@RequestMapping(value = {"audit"})
@RequiresPermissions("iplist:confirm")
public String audit(String cfgName,String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
this._auditIp(cfgName, ids, cfg, redirectAttributes);
redirectAttributes.addAttribute("urlPrefix","/ntc/iplist");
redirectAttributes.addAttribute("requiresPermissionPrefix","iplist");
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+cfg.getFunctionId();
public String audit(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = ipCfgService.getIpPortCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
ipCfgService.auditIpCfg(entity,isAudit);
} catch (MaatConvertException e) {
e.printStackTrace();
logger.info("ssl配置下发失败"+e.getMessage());
addMessage(redirectAttributes, e.getMessage());
}
}
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+functionId;
}
//ip配置导入
@RequestMapping(value = "import", method=RequestMethod.POST)

View File

@@ -180,7 +180,7 @@ public class WebsiteController extends BaseController{
@RequestMapping(value = {"saveHttpCfg"})
@RequiresPermissions(value={"website:http:config"})
public String saveHttpCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
public String saveHttpCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
websiteCfgService.saveHttpCfg(entity);
return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId();
}
@@ -242,7 +242,7 @@ public class WebsiteController extends BaseController{
}
@RequestMapping(value = {"saveSslCfg"})
@RequiresPermissions(value={"website:ssl:config"})
public String saveSslCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
public String saveSslCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
websiteCfgService.saveSslCfg(entity);
return "redirect:" + adminPath +"/ntc/website/sslList?functionId="+entity.getFunctionId();
}
@@ -330,7 +330,7 @@ public class WebsiteController extends BaseController{
}
@RequestMapping(value = {"saveDnsCfg"})
@RequiresPermissions(value={"website:dns:config"})
public String saveDnsCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
public String saveDnsCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
websiteCfgService.saveDnsCfg(entity);
return "redirect:" + adminPath +"/ntc/website/dnsList?functionId="+entity.getFunctionId();
}

View File

@@ -1,5 +1,6 @@
package com.nis.web.controller.configuration.ntc;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -8,7 +9,6 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -19,13 +19,14 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.configuration.template.WhiteListIpTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.web.controller.configuration.CommonController;
import com.nis.web.security.UserUtils;
/**
* 白名单
@@ -38,121 +39,145 @@ public class WhiteListController extends CommonController{
@RequestMapping(value = {"ip/list"})
//@RequiresPermissions(value={"whitelist:ip:config","whitelist:ip:confirm","whitelist:ip:aduit"},logical=Logical.OR)
public String ipList(Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
cfg.setTableName(IpPortCfg.getTablename());
Page<BaseIpCfg> searchPage=new Page<BaseIpCfg>(request,response,"r");
Page<BaseIpCfg> page = ipCfgService.findPage(searchPage, cfg);
public String ipList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(searchPage, cfg);
model.addAttribute("page", page);
initPageCondition(model,cfg);
return "/cfg/whitelist/ipList";
}
@RequestMapping(value = {"ajaxIpSubList"})
public String ajaxIpSubList(Model model,Long cfgId,Integer index) {
CfgIndexInfo cfg = ipCfgService.getIpPortCfg(cfgId);
List<String[]> tabList = new ArrayList();
if(cfg.getIpPortList()!=null){
String cfgType = null;
for(IpPortCfg ip:cfg.getIpPortList()){
if(!ip.getCfgType().equals(cfgType)){
tabList.add(new String[]{"1",ip.getCfgType()});
cfgType = ip.getCfgType();
}
}
}
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);
return "/cfg/whitelist/ipSubList";
}
@RequestMapping(value = {"ip/form"})
@RequiresPermissions(value={"whitelist:ip:config"})
public String ipForm(Model model,String ids,CfgIndexInfo entity) {
if(StringUtils.isNotBlank(ids)){
entity = this.ipCfgService.getIpPortCfg(Long.parseLong(ids));
initUpdateFormCondition(model,entity);
}else{
initFormCondition(model,entity);
}
model.addAttribute("_cfg", entity);
return "/cfg/whitelist/ipForm";
}
@RequestMapping(value = {"ip/save"})
public String saveIpCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
ipCfgService.saveIpCfg(entity);
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+entity.getFunctionId();
}
@RequestMapping(value = {"ip/audit"})
@RequiresPermissions("whitelist:ip:confirm")
public String auditIp(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = ipCfgService.getIpPortCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
ipCfgService.auditIpCfg(entity,isAudit);
} catch (MaatConvertException e) {
e.printStackTrace();
logger.info("ip配置下发失败"+e.getMessage());
addMessage(redirectAttributes, e.getMessage());
}
}
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+entity.getFunctionId();
}
@RequestMapping(value = {"updateIpValid"})
@RequiresPermissions(value={"whitelist:ip:config"})
public String updateIpCfgValid(Integer isValid,String ids,Integer functionId) {
ipCfgService.updateIpCfgValid(isValid,ids,functionId);
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+functionId;
}
@RequestMapping(value = {"domain/list"})
//@RequiresPermissions(value={"whitelist:domain:config","whitelist:domain:confirm","whitelist:domain:aduit"},logical=Logical.OR)
public String domainList(Model model,@ModelAttribute("cfg")HttpUrlCfg cfg,HttpServletRequest request,HttpServletResponse response) {
cfg.setTableName(HttpUrlCfg.getTablename());
Page<HttpUrlCfg> searchPage=new Page<HttpUrlCfg>(request,response,"r");
Page<HttpUrlCfg> page = domainService.findPage(searchPage, cfg);
public String domainList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = domainService.getDomainList(searchPage, cfg);
model.addAttribute("page", page);
initPageCondition(model,cfg);
return "/cfg/whitelist/domainList";
}
@RequestMapping(value = {"ip/form"})
@RequiresPermissions(value={"whitelist:ip:config"})
public String ipForm(Model model,String ids,BaseIpCfg entity) {
if(StringUtils.isNotBlank(ids)){
entity = ipCfgService.getIpCfgById(IpPortCfg.getTablename(),Long.parseLong(ids));
}
initFormCondition(model,entity);
if(entity.getCfgId()!=null){
model.addAttribute("_cfg", entity);
}else{
IpPortCfg cfg=new IpPortCfg();
cfg.initDefaultValueImpl();
cfg.setFunctionId(entity.getFunctionId());
cfg.setProtocolId(entity.getProtocolId());
model.addAttribute("_cfg", cfg);
}
return "/cfg/whitelist/ipForm";
}
@RequestMapping(value = {"domain/form"})
@RequiresPermissions(value={"whitelist:domain:config"})
public String domainForm(Model model,String ids,HttpUrlCfg entity) {
public String domainForm(Model model,String ids,CfgIndexInfo entity) {
if(StringUtils.isNotBlank(ids)){
entity = domainService.getStringCfgById(Long.parseLong(ids));
}
initFormCondition(model,entity);
if(entity.getCfgId()!=null){
model.addAttribute("_cfg", entity);
entity = domainService.getDomainCfg(Long.parseLong(ids));
initUpdateFormCondition(model,entity);
}else{
HttpUrlCfg cfg=new HttpUrlCfg();
cfg.initDefaultValue();
cfg.setFunctionId(entity.getFunctionId());
model.addAttribute("_cfg", cfg);
initFormCondition(model,entity);
}
model.addAttribute("_cfg", entity);
return "/cfg/whitelist/domainForm";
}
@RequestMapping(value = {"ip/saveOrUpdate"})
public String saveOrUpdateIp(RedirectAttributes model, IpPortCfg cfg) {
cfg.setTableName(IpPortCfg.getTablename());
logger.info("saveOrUpdateIp loaded");
try{
Date date=new Date();
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
if(cfg.getCfgId()==null){//新增
cfg.setCreatorId(cfg.getCurrentUser().getId());
cfg.setCreateTime(date);
ipCfgService.addIpCfg(cfg);
}else{//修改
cfg.setEditorId(cfg.getCurrentUser().getId());
cfg.setEditTime(new Date());
ipCfgService.updateIpCfg(cfg);
}
addMessage(model,"save_success");
}catch(Exception e){
logger.error("保存失败",e);
addMessage(model,"save_failed");
}
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+cfg.getFunctionId();
@RequestMapping(value = {"domain/save"})
public String saveOrUpdateDomain(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
domainService.saveDomainCfg(entity);
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+entity.getFunctionId();
}
@RequestMapping(value = {"domain/saveOrUpdate"})
public String saveOrUpdateDomain(RedirectAttributes model, HttpUrlCfg cfg) {
cfg.setTableName(HttpUrlCfg.getTablename());
logger.info("saveOrUpdateIp loaded");
try{
Date date=new Date();
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
if(cfg.getCfgId()==null){//新增
cfg.setCreatorId(cfg.getCurrentUser().getId());
cfg.setCreateTime(date);
domainService.addStringCfg(cfg);
}else{//修改
cfg.setEditorId(cfg.getCurrentUser().getId());
cfg.setEditTime(new Date());
domainService.updateStringCfg(cfg);
}
addMessage(model,"save_success");
}catch(Exception e){
logger.error("保存失败",e);
addMessage(model,"save_failed");
@RequestMapping(value = {"domain/ajaxSubList"})
public String ajaxDomainSubList(Model model,Long cfgId,Integer index) {
CfgIndexInfo cfg = domainService.getDomainCfg(cfgId);
List<String[]> tabList = new ArrayList();
if(cfg.getHttpUrlList()!=null){
String cfgType = null;
for(BaseStringCfg keyword:cfg.getHttpUrlList()){
if(!keyword.getCfgType().equals(cfgType)){
tabList.add(new String[]{"2",keyword.getCfgType()});
cfgType = keyword.getCfgType();
}
}
}
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+cfg.getFunctionId();
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);
return "/cfg/whitelist/domianSubList";
}
@RequestMapping(value = {"ip/delete"})
@RequiresPermissions("whitelist:ip:config")
public String deleteIp(String ids,Integer functionId,RedirectAttributes model) {
try{
ipCfgService.deleteIp(ids,null,functionId.intValue());
addMessage(model,"delete_success");
}catch(Exception e){
logger.error("删除失败", e);
addMessage(model,"delete_failed");
}
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+functionId;
@RequestMapping(value = {"domain/updateValid"})
@RequiresPermissions(value={"whitelist:domain:config"})
public String updateDomainValid(Integer isValid,String ids,Integer functionId) {
domainService.updateDomainCfgValid(isValid,ids,functionId);
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
}
@RequestMapping(value = {"domain/delete"})
@RequiresPermissions("whitelist:domain:config")
@@ -166,58 +191,28 @@ public class WhiteListController extends CommonController{
}
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
}
@RequestMapping(value = {"ip/audit"})
@RequiresPermissions("whitelist:ip:confirm")
public String auditIp(String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
try{
for(String id:ids.split(",")){
Long.parseLong(id);
}
List<BaseIpCfg> beans=ipCfgService.getListByCfgId(IpPortCfg.getTablename(),cfg.getFunctionId().intValue(),ids);
Date date=new Date();
for(BaseIpCfg bean:beans){
bean.setTableName(IpPortCfg.getTablename());
bean.setAuditorId(bean.getCurrentUser().getId());
bean.setAuditTime(date);
bean.setIsAudit(cfg.getIsAudit());
bean.setIsValid(cfg.getIsValid());
ipCfgService.auditWhiteIp(bean);
}
addMessage(redirectAttributes,"audit_success");
}catch(MaatConvertException e){
logger.error("审核失败", e);
addMessage(redirectAttributes, e.getMessage());
}catch(Exception e){
logger.error("审核失败", e);
addMessage(redirectAttributes, "audit_failed");
}
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"domain/audit"})
@RequiresPermissions("whitelist:domain:confirm")
public String auditDomain(String ids,HttpUrlCfg cfg,RedirectAttributes redirectAttributes) {
try{
List<HttpUrlCfg> beans=domainService.getListByCfgId(ids);
Date date=new Date();
for(HttpUrlCfg bean:beans){
HttpUrlCfg domain=new HttpUrlCfg();
BeanUtils.copyProperties(bean, domain);
domain.setTableName(HttpUrlCfg.getTablename());
domain.setAuditorId(bean.getCurrentUser().getId());
domain.setAuditTime(date);
domain.setIsAudit(cfg.getIsAudit());
domain.setIsValid(cfg.getIsValid());
domainService.auditWhiteDomain(domain);
public String auditDomain(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = domainService.getDomainCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
domainService.auditDomainCfg(entity,isAudit);
} catch (MaatConvertException e) {
e.printStackTrace();
logger.info("domain配置下发失败"+e.getMessage());
addMessage(redirectAttributes, e.getMessage());
}
addMessage(redirectAttributes,"audit_success");
}catch(MaatConvertException e){
logger.error("审核失败", e);
addMessage(redirectAttributes, e.getMessage());
}catch(Exception e){
logger.error("审核失败", e);
addMessage(redirectAttributes, "audit_failed");
}
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+cfg.getFunctionId();
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
}
//ip配置导入
@RequestMapping(value = "ip/import", method=RequestMethod.POST)

View File

@@ -50,30 +50,46 @@ import net.sf.json.JsonConfig;
public class NtcPzReportController extends BaseController{
@RequestMapping(value="ajaxGetLogTotal",method=RequestMethod.POST)
@ResponseBody
public Map<String, Object> ajaxGetLogTotal(Model model,long endTime,int action,Integer functionId,Integer compileId){
Map<String, Object> data=new HashMap<String, Object>();
public List<Map<String, Object>> ajaxGetLogTotal(Model model,long endTime,String actions,Integer functionId,String compileIds){
List<Map<String, Object>> dataList=new ArrayList<>();
SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
int interval=Constants.LOG_TIME_RANGE;
Date endDate=new Date(endTime);
Date startDate=new Date(endTime-interval);
int serviceId=0;
String serviceIdsStr="";
StringBuffer serviceIds=new StringBuffer();
List<FunctionServiceDict> serviceList=DictUtils.getFunctionServiceDictList(functionId.intValue());
for(FunctionServiceDict service:serviceList){
if(service.getAction().intValue()==action){
serviceId=service.getServiceId().intValue();
break;
for(String action:actions.split(",")) {
for(FunctionServiceDict service:serviceList){
if(service.getAction().intValue()==Integer.parseInt(action)){
serviceIds.append(service.getServiceId().intValue());
serviceIds.append(",");
}
}
}
data.put("compileId", compileId.intValue());
String json=ConfigServiceUtil.getReport(Constants.BUSINESSTYPE_CONFIG, String.valueOf(compileId), String.valueOf(serviceId), sdf.format(startDate), sdf.format(endDate));
if(serviceIds.toString().endsWith(",")) {
serviceIdsStr=serviceIds.toString().substring(0,serviceIds.toString().lastIndexOf(","));
}
String json=ConfigServiceUtil.getReport(Constants.BUSINESSTYPE_CONFIG, compileIds, serviceIdsStr, sdf.format(startDate), sdf.format(endDate));
List<NtcPzReport> list=getList(json);
if(list!=null&&list.size()>0){
data.put("sum",list.get(0).getSum().longValue());
String[] idArr=compileIds.split(",");
if(list!=null&&(list.size()>0)){
for(NtcPzReport report:list) {
Map<String, Object> data=new HashMap<String, Object>();
data.put("compileId", report.getCfgId().longValue());
data.put("sum",report.getSum().longValue());
dataList.add(data);
}
}else {
data.put("sum", 0);
for(String id:idArr) {
Map<String, Object> data=new HashMap<String, Object>();
data.put("compileId", id);
data.put("sum",0);
dataList.add(data);
}
}
return data;
return dataList;
}
@RequestMapping("/ntcPzReport")
public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {

View File

@@ -5,10 +5,12 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -32,17 +34,13 @@ import net.sf.json.JsonConfig;
public class NtcServiceReportController extends BaseController {
@RequestMapping("/ajaxNtcServiceReport")
@ResponseBody
public Map<String, Long> report(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
Map<String, Long> datas=new HashMap<>();
public List<Map<String, Object>> report(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
List<Map<String, Object>> datas=new ArrayList<Map<String, Object>>();
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(bean.getFunctionId());
if(bean.getAction()!=null){
for(FunctionServiceDict service:serviceList){
if(service.getAction().intValue()==bean.getAction().intValue()){
bean.setSearchService(service.getServiceId().toString());
}
}
StringBuffer serviceId=new StringBuffer();
if(StringUtils.isNotBlank(bean.getServices())){
serviceId.append(bean.getServices());
}else{
StringBuffer serviceId=new StringBuffer();
for(int i=0;i<serviceList.size();i++){
if(i==0){
serviceId.append(serviceList.get(i).getServiceId().toString());
@@ -50,8 +48,8 @@ public class NtcServiceReportController extends BaseController {
serviceId.append(","+serviceList.get(i).getServiceId().toString());
}
}
bean.setSearchService(serviceId.toString());
}
bean.setSearchService(serviceId.toString());
bean.setSearchBusinessType("1");
bean.setPageSize(-1);
try {
@@ -64,13 +62,20 @@ public class NtcServiceReportController extends BaseController {
try {
String json=ConfigServiceUtil.getReport(url.toString(), bean);
List<NtcServiceReport> data=getList(json);
Map<Integer, Long> dataMap=new HashMap<>();
for(NtcServiceReport report:data){
if(datas.containsKey(report.getService().toString())){
datas.put(report.getService().toString(), datas.get(report.getService().toString())+report.getSum().longValue());
if(dataMap.containsKey(report.getService())){
dataMap.put(report.getService(), dataMap.get(report.getService())+report.getSum().longValue());
}else{
datas.put(report.getService().toString(),report.getSum().longValue());
dataMap.put(report.getService(),report.getSum().longValue());
}
}
for(Entry<Integer, Long> e:dataMap.entrySet()) {
Map<String, Object> _data=new HashMap<>();
_data.put("service", e.getKey());
_data.put("sum", e.getValue());
datas.add(_data);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();

View File

@@ -93,4 +93,5 @@ public interface AppCfgDao {
public void auditCfg(BaseCfg entity);
//修改配置状态
public void updateCfgValid(BaseCfg entity);
public void deleteSubscribeIdCfg(AppPolicyCfg entity);
}

View File

@@ -27,7 +27,7 @@
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
@@ -69,7 +69,7 @@
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
@@ -102,7 +102,7 @@
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
@@ -133,7 +133,7 @@
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
@@ -164,7 +164,7 @@
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
@@ -195,7 +195,7 @@
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
@@ -226,7 +226,7 @@
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
</resultMap>
@@ -292,7 +292,7 @@
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
@@ -324,7 +324,7 @@
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
@@ -352,11 +352,8 @@
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
@@ -366,7 +363,7 @@
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.low_boundary,r.up_boundary as upBoundary,r.do_log
</sql>
@@ -435,7 +432,7 @@
#{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},
#{areaEffectiveIds,jdbcType=VARCHAR},#{ratelimit,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}
</sql>
<sql id="AppTopicCommonCfg_Value_List" >
@@ -446,7 +443,7 @@
#{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},
#{areaEffectiveIds,jdbcType=VARCHAR},#{ratelimit,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}
</sql>
@@ -1650,11 +1647,11 @@
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
low_boundary,up_boundary,DO_LOG
)values (
<include refid="AppCommonCfg_Value_List" />,
#{lowBoundary,jdbcType=INTEGER},#{upBoundary,jdbcType=INTEGER},
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER}
#{doLog,jdbcType=INTEGER}
)
</insert>
<insert id="insertAppPolicyCfg" parameterType="com.nis.domain.configuration.AppPolicyCfg" >
@@ -1951,7 +1948,7 @@
function_id = #{functionId,jdbcType=INTEGER},
<!-- </if>
<if test="ratelimit != null"> -->
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
RATELIMIT=#{ratelimit,jdbcType=VARCHAR},
<!-- </if>
<if test="cfgRegionCode != null"> -->
CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER},
@@ -2060,7 +2057,7 @@
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="ratelimit != null">
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
RATELIMIT=#{ratelimit,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null">
CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER},
@@ -2173,7 +2170,7 @@
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="ratelimit != null">
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
RATELIMIT=#{ratelimit,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null">
CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER},
@@ -2274,7 +2271,7 @@
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="ratelimit != null">
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
RATELIMIT=#{ratelimit,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null">
CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER},
@@ -2373,7 +2370,7 @@
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="ratelimit != null">
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
RATELIMIT=#{ratelimit,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null">
CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER},
@@ -2472,7 +2469,7 @@
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="ratelimit != null">
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
RATELIMIT=#{ratelimit,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null">
CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER},
@@ -2584,7 +2581,7 @@
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="ratelimit != null">
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
RATELIMIT=#{ratelimit,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null">
CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER},
@@ -2685,7 +2682,7 @@
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="ratelimit != null">
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
RATELIMIT=#{ratelimit,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null">
CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER},
@@ -2806,7 +2803,7 @@
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="ratelimit != null">
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
RATELIMIT=#{ratelimit,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null">
CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER},
@@ -2820,15 +2817,6 @@
<if test="upBoundary != null and upBoundary != ''">
up_boundary=#{upBoundary,jdbcType=INTEGER},
</if>
<if test="exprType != null">
expr_type=#{exprType,jdbcType=INTEGER},
</if>
<if test="matchMethod != null">
match_method=#{matchMethod,jdbcType=INTEGER},
</if>
<if test="isHexbin != null">
is_hexbin=#{isHexbin,jdbcType=INTEGER},
</if>
<if test="doLog != null">
do_log=#{doLog,jdbcType=INTEGER},
</if>
@@ -2840,6 +2828,10 @@
<!-- 删除APP策略IP子配置 -->
<delete id="deleteAppPolicyIpCfg" >
delete from ip_port_cfg where compile_id=#{compileId} and function_id=#{functionId}
</delete>
<!-- 删除SubscribeId子配置 -->
<delete id="deleteSubscribeIdCfg" >
delete from ntc_subscribe_id_cfg where compile_id=#{compileId} and function_id=#{functionId}
</delete>
<!-- 查询APP策略IP子配置 -->
<select id="getAppPolicyIpList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">

View File

@@ -64,6 +64,7 @@
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
<sql id="AvFileSample_Column" >
a.CFG_ID, a.SRC_URL,a.SAMPLE_URL, a.SRC_MD5,a.SAMPLE_MD5,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
@@ -77,7 +78,7 @@
a.CFG_ID, a.description,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.cfg_type,a.cfg_region_code,a.LEVEL
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,a.LEVEL,a.do_log
</sql>
<select id="getAvFileSampleById" resultMap="AvFileSampleMap" parameterType="java.lang.Long" >
@@ -321,7 +322,7 @@
description,LEVEL,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,function_id,cfg_type,cfg_region_code
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,function_id,cfg_type,cfg_region_code,do_log
)values (
#{description,jdbcType=VARCHAR},#{level,jdbcType=INTEGER},#{cfgDesc,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
0,0,#{creatorId,jdbcType=INTEGER},
@@ -330,7 +331,8 @@
#{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},
#{doLog,jdbcType=INTEGER}
)
</insert>
@@ -481,6 +483,9 @@
<if test="level != null" >
level = #{level,jdbcType=INTEGER},
</if>
<if test="doLog != null" >
do_log = #{doLog,jdbcType=INTEGER},
</if>
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}

View File

@@ -122,6 +122,7 @@
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
<resultMap id="BaseStringCfgMap" type="com.nis.domain.configuration.BaseStringCfg" >
@@ -152,6 +153,7 @@
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
<sql id="AvVoip_Column" >
@@ -180,13 +182,13 @@
,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.function_id,r.cfg_region_code
,r.area_effective_ids,r.function_id,r.cfg_region_code,r.do_log
</sql>
<sql id="BaseStringCfg_Column" >
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.cfg_type,
r.action,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id,r.edit_time, r.auditor_id,
r.audit_time,r.service_id,r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,r.cfg_region_code
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,r.cfg_region_code,r.do_log
</sql>
<!-- voip IP条件查询列表信息 -->
<select id="findVoipList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
@@ -1285,7 +1287,8 @@
dest_port,
dest_ip_address,
cfg_type,
cfg_region_code
cfg_region_code,
do_log
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -1317,7 +1320,9 @@
#{destPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER}
#{cfgRegionCode,jdbcType=INTEGER},
#{doLog,jdbcType=INTEGER}
)
</insert>
<!-- update av_cont_ip_cfg表信息 -->
@@ -1411,6 +1416,9 @@
</if>
<if test="cfgRegionCode != null " >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="doLog != null " >
do_log = #{doLog,jdbcType=INTEGER},
</if>
</trim>
</set>
@@ -1585,7 +1593,8 @@
match_method,
is_hexbin,
cfg_type,
cfg_region_code
cfg_region_code,
do_log
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -1611,7 +1620,8 @@
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER}
#{cfgRegionCode,jdbcType=INTEGER},
#{doLog,jdbcType=INTEGER}
)
</insert>
@@ -1688,6 +1698,9 @@
</if>
<if test="cfgRegionCode != null " >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="doLog != null " >
do_log = #{doLog,jdbcType=INTEGER},
</if>
</trim>
</set>

View File

@@ -28,7 +28,7 @@
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="BaseStringMapWithUser" type="com.nis.domain.configuration.HttpUrlCfg" extends="BaseStringMap">
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
@@ -77,7 +77,7 @@
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER},
#{areaEffectiveIds,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER},#{cfgRegionCode,jdbcType=INTEGER}
,#{ratelimit,jdbcType=INTEGER}
,#{ratelimit,jdbcType=VARCHAR}
</sql>
<select id="getById" resultMap="BaseStringMap" parameterType="java.lang.Long" >
SELECT
@@ -210,7 +210,7 @@
AND ${page.alias}.CFG_REGION_CODE =#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="ratelimit != null">
AND ${page.alias}.RATELIMIT =#{ratelimit,jdbcType=INTEGER}
AND ${page.alias}.RATELIMIT =#{ratelimit,jdbcType=VARCHAR}
</if>
</when>
<otherwise>
@@ -296,7 +296,7 @@
AND r.CFG_REGION_CODE =#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="ratelimit != null">
AND r.RATELIMIT =#{ratelimit,jdbcType=INTEGER}
AND r.RATELIMIT =#{ratelimit,jdbcType=VARCHAR}
</if>
</otherwise>
</choose>
@@ -427,7 +427,7 @@
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="ratelimit != null" >
ratelimit = #{ratelimit,jdbcType=INTEGER},
ratelimit = #{ratelimit,jdbcType=VARCHAR},
</if>
</trim>
</set>

View File

@@ -4,7 +4,10 @@ import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@@ -31,4 +34,16 @@ public interface IpCfgDao extends CrudDao<BaseIpCfg>{
public int getIsAudit(BaseIpCfg entity);
public int deleteByCompileId(BaseIpCfg entity);
public int deleteByCompileIds(@Param("user")long user,@Param("tableName")String tableName,@Param("compileIds")String compileIds);
/******************************new ***********************************/
public CfgIndexInfo getCfgIndexInfo(Long id);
public List<IpPortCfg> getIpPortList(CfgIndexInfo entity);
public void saveCfgIndex(CfgIndexInfo entity);
public void saveIpPortCfg(IpPortCfg entity);
public void updateCfgIndex(CfgIndexInfo entity);
public void deleteIpCfg(CfgIndexInfo entity);
public void updateCfgValid(BaseCfg entity);
public void auditCfg(BaseCfg entity);
public List<CfgIndexInfo> getIpCfgList(CfgIndexInfo entity);
}

View File

@@ -34,7 +34,7 @@
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="INTEGER" />
<result column="ir_type" property="irType" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
@@ -43,13 +43,77 @@
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="BaseIpMapWithUser" type="com.nis.domain.configuration.BaseIpCfg" extends="BaseIpMap" >
<resultMap id="BaseIpMapWithUser" type="com.nis.domain.configuration.BaseIpCfg" extends="BaseIpMap" >
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
</resultMap>
<!--new -->
<resultMap id="CfgIndexInfoMap" type="com.nis.domain.configuration.CfgIndexInfo" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="INTEGER" />
<result column="dns_strategy_name" property="dnsStrategyName" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<sql id="BaseIpCfg_Column_List_with_id" >
CFG_ID, CFG_DESC,CFG_REGION_CODE,CFG_TYPE, IP_TYPE, IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS, PORT_PATTERN,SRC_PORT,DEST_PORT,
DIRECTION,PROTOCOL,PROTOCOL_ID,ACTION,IS_VALID,IS_AUDIT,
@@ -119,7 +183,7 @@
#{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}, #{functionId,jdbcType=INTEGER}, #{ratelimit,jdbcType=INTEGER},
#{areaEffectiveIds,jdbcType=VARCHAR}, #{functionId,jdbcType=INTEGER}, #{ratelimit,jdbcType=VARCHAR},
#{dnsStrategyId,jdbcType=INTEGER},#{irType,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
@@ -127,6 +191,22 @@
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
</sql>
<!-- new -->
<sql id="ConfigIndex_Column" >
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.dns_strategy_id,a.user_region1,
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,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.cfg_region_code
</sql>
<select id="getById" resultMap="BaseIpMap" parameterType="java.lang.Long" >
SELECT
<include refid="BaseIpCfg_Column_List_with_id" />
@@ -294,7 +374,7 @@
AND ${page.alias}.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="ratelimit != null">
AND ${page.alias}.RATELIMIT=#{ratelimit,jdbcType=INTEGER}
AND ${page.alias}.RATELIMIT=#{ratelimit,jdbcType=VARCHAR}
</if>
<if test="dnsStrategyId != null">
AND ${page.alias}.DNS_STRATEGY_ID=#{dnsStrategyId,jdbcType=INTEGER}
@@ -419,7 +499,7 @@
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="ratelimit != null">
AND r.RATELIMIT=#{ratelimit,jdbcType=INTEGER}
AND r.RATELIMIT=#{ratelimit,jdbcType=VARCHAR}
</if>
<if test="dnsStrategyId != null">
AND r.DNS_STRATEGY_ID=#{dnsStrategyId,jdbcType=INTEGER}
@@ -589,7 +669,7 @@
FUNCTION_ID=#{functionId,jdbcType=INTEGER},
</if>
<if test="ratelimit != null">
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
RATELIMIT=#{ratelimit,jdbcType=VARCHAR},
</if>
<if test="dnsStrategyId != null">
DNS_STRATEGY_ID=#{dnsStrategyId,jdbcType=INTEGER},
@@ -671,4 +751,338 @@
left join policy_group_info po on r.dns_strategy_id=po.group_id
WHERE r.CFG_ID in (${ids}) AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</select>
<!-- new -->
<select id="getCfgIndexInfo" resultMap="CfgIndexInfoMap" parameterType="java.lang.Long">
SELECT
<include refid="ConfigIndex_Column" />
FROM cfg_index_info a where cfg_id=#{cfgId}
</select>
<select id="getIpPortList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpCfg_Column" />
FROM ip_port_cfg a where compile_id=#{compileId} and function_id=#{functionId}
</select>
<!-- insert cfgIndexInfox -->
<insert id="saveCfgIndex" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cfg_index_info(
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,
function_id,
dns_strategy_id,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5,
do_log
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{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},
#{functionId,jdbcType=INTEGER},
#{dnsStrategyId,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR},
#{doLog,jdbcType=INTEGER}
)
</insert>
<!-- insert ip_port_cfg表信息 -->
<insert id="saveIpPortCfg" parameterType="com.nis.domain.configuration.IpPortCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ip_port_cfg (
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,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_port,
protocol,
protocol_id,
direction,
dest_port,
dest_ip_address,
cfg_type,
cfg_region_code,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{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},
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
#{destPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<update id="updateCfgIndex" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
update cfg_index_info
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="doLog != null" >
do_log = #{doLog,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
edit_time = #{editTime,jdbcType=TIMESTAMP},
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
user_region1 = #{userRegion1,jdbcType=VARCHAR},
user_region2 = #{userRegion2,jdbcType=VARCHAR},
user_region3 = #{userRegion3,jdbcType=VARCHAR},
user_region4 = #{userRegion4,jdbcType=VARCHAR},
user_region5 = #{userRegion5,jdbcType=VARCHAR},
dns_strategy_id = #{dnsStrategyId,jdbcType=INTEGER},
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<delete id="deleteIpCfg" >
delete from ip_port_cfg where compile_id=#{compileId} and function_id=#{functionId}
</delete>
<update id="updateCfgValid" parameterType="com.nis.domain.configuration.BaseCfg">
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER},
editor_id = #{editorId,jdbcType=INTEGER} ,
edit_time = #{editTime,jdbcType=TIMESTAMP}
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId !=null ">
AND cfg_id = #{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId !=null ">
AND compile_id = #{compileId,jdbcType=INTEGER}
</if>
and function_id=#{functionId,jdbcType=INTEGER}
</trim>
</update>
<update id="auditCfg" parameterType="com.nis.domain.configuration.BaseCfg">
update ${tableName} set is_audit = #{isAudit,jdbcType=INTEGER},
auditor_id = #{auditorId,jdbcType=INTEGER},
audit_time = #{auditTime,jdbcType=TIMESTAMP}
<if test="isValid != null" >
,is_valid = #{isValid,jdbcType=INTEGER}
</if>
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId !=null ">
AND cfg_id = #{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId !=null ">
AND compile_id = #{compileId,jdbcType=INTEGER}
</if>
and function_id=#{functionId,jdbcType=INTEGER}
</trim>
</update>
<select id="getIpCfgList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
SELECT
<include refid="ConfigIndex_Column" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName,dns.cfg_desc as dns_strategy_name
</trim>
FROM cfg_index_info a
left join dns_res_strategy dns on a.dns_strategy_id=dns.cfg_id
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.CFG_ID desc
</otherwise>
</choose>
</select>
</mapper>

View File

@@ -28,7 +28,7 @@
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="BaseStringMapWithUser" type="com.nis.domain.configuration.BaseStringCfg" extends="BaseStringMap">
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
@@ -120,7 +120,7 @@
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER},
#{areaEffectiveIds,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER},#{cfgRegionCode,jdbcType=INTEGER}
,#{ratelimit,jdbcType=INTEGER}
,#{ratelimit,jdbcType=VARCHAR}
</sql>
<select id="getById" resultMap="BaseStringMap" parameterType="java.lang.Long" >
SELECT
@@ -253,7 +253,7 @@
AND ${page.alias}.CFG_REGION_CODE =#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="ratelimit != null">
AND ${page.alias}.RATELIMIT =#{ratelimit,jdbcType=INTEGER}
AND ${page.alias}.RATELIMIT =#{ratelimit,jdbcType=VARCHAR}
</if>
</when>
<otherwise>
@@ -339,7 +339,7 @@
AND r.CFG_REGION_CODE =#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="ratelimit != null">
AND r.RATELIMIT =#{ratelimit,jdbcType=INTEGER}
AND r.RATELIMIT =#{ratelimit,jdbcType=VARCHAR}
</if>
</otherwise>
</choose>
@@ -468,7 +468,7 @@
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="ratelimit != null" >
ratelimit = #{ratelimit,jdbcType=INTEGER},
ratelimit = #{ratelimit,jdbcType=VARCHAR},
</if>
</trim>
</set>

View File

@@ -633,7 +633,7 @@ public abstract class BaseService {
proxyObjKeyring.setCrl(cfg.getCrl());
proxyObjKeyring.setExpireAfter(cfg.getExpireAfter());
proxyObjKeyring.setKeyringId(cfg.getCompileId());
proxyObjKeyring.setKeyringName(cfg.getCfgDesc());
proxyObjKeyring.setKeyringName(keywordsEscape(cfg.getCfgDesc()));
proxyObjKeyring.setKeyringType(cfg.getKeyringType());
proxyObjKeyring.setPrivateKeyFile(cfg.getPrivateKeyFile());
proxyObjKeyring.setPublicKeyAlgo(cfg.getPublicKeyAlgo());

View File

@@ -240,15 +240,11 @@ public class AppCfgService extends BaseService {
}
}
appCfgDao.updateAppPolicyCfg(entity);
// 先删后加 各域配置
appCfgDao.deleteAppPolicyIpCfg(entity);
if (entity != null && entity.getNtcSubscribeIdCfgList() != null
&& entity.getNtcSubscribeIdCfgList().size() > 0) {
for (NtcSubscribeIdCfg ntcSubscribeIdCfg : entity.getNtcSubscribeIdCfgList()) {
ntcSubscribeIdCfg.setCompileId(entity.getCompileId());
stringcfgDao.deleteSubscribeIdCfg(ntcSubscribeIdCfg);
}
}
appCfgDao.deleteSubscribeIdCfg(entity);
// 删除旧的区域IP新增新的区域IP
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
@@ -1449,9 +1445,9 @@ public class AppCfgService extends BaseService {
}
// 删除关键字
if (entity.getNtcSubscribeIdCfgList() != null && entity.getNtcSubscribeIdCfgList().size() > 0) {
NtcSubscribeIdCfg ntcSubscribeIdCfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, ntcSubscribeIdCfg, new String[] { "cfgId" });
stringcfgDao.updateSubscribeIdCfg(ntcSubscribeIdCfg);
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
stringcfgDao.updateSubscribeIdCfg(cfg);
}
// 保存区域IP信息
if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) {

View File

@@ -20,11 +20,13 @@ import com.nis.domain.Page;
import com.nis.domain.configuration.AvFileSampleCfg;
import com.nis.domain.configuration.AvSignSampleCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
import com.nis.exceptions.CallExternalProceduresException;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AvCfgDao;
import com.nis.web.security.UserUtils;
@@ -181,16 +183,62 @@ public class AvCfgService extends BaseService{
Integer fileId = resObject.getInt("fileId");
if(state==1 && fileSize>0){//成功
entity.setIsSampleCreated(1);//样例文件创建成功
if(fileId.equals(entity.getCfgId().intValue())){
File uploadSampleFile = new File(entity.getSamplePath());
String sampleMd5 = FileUtils.getFileMD5(uploadSampleFile);
entity.setSampleMd5(sampleMd5);
}else{
logger.error("调用外部程序返回fileId错误,输入的fileId为"+entity.getCfgId()+",输出的fileId为"+fileId);
throw new CallExternalProceduresException();
}
//文件上传至综合服务
Date creatTime = entity.getCreateTime();
//音视频文件上传接口调用
File srcFile = new File(entity.getSrcPath());
Map<String,Object> srcMap = new HashMap();
srcMap.put("filetype", FileUtils.getSuffix(srcFile.getName(), false));
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
srcMap.put("createTime",creatTime);
srcMap.put("key",FileUtils.getPrefix(srcFile.getName(), false));
srcMap.put("fileName", srcFile.getName());
srcMap.put("checksum", entity.getSrcMd5());
ToMaatResult result1 = ConfigServiceUtil.postFileCfg(null, srcFile, JsonMapper.toJsonString(srcMap));
logger.info("音视频源文件上传响应信息:"+result1.toString());
//获取文件上传响应信息(新的文件访问路径)
String srcAccessUrl = null;
if(!StringUtil.isEmpty(result1)){
ResponseData data = result1.getData();
srcAccessUrl=data.getAccessUrl();
entity.setSrcUrl(srcAccessUrl);
}
File sampleFile = new File(entity.getSamplePath());
Map<String,Object> sampleMap = new HashMap();
sampleMap.put("filetype", FileUtils.getSuffix(sampleFile.getName(), false));
sampleMap.put("datatype", "fileSystem");//样例文件存入fastdfs
sampleMap.put("createTime", creatTime);
sampleMap.put("key",FileUtils.getPrefix(sampleFile.getName(), false));
sampleMap.put("fileName", sampleFile.getName());
sampleMap.put("checksum", entity.getSampleMd5());
ToMaatResult result2 = ConfigServiceUtil.postFileCfg(null, sampleFile, JsonMapper.toJsonString(sampleMap));
logger.info("音视频样例文件上传响应信息:"+result2.toString());
//获取文件上传响应信息(新的文件访问路径)
String sampleAccessUrl = null;
if(!StringUtil.isEmpty(result2)){
ResponseData data = result2.getData();
sampleAccessUrl = data.getAccessUrl();
entity.setSampleUrl(sampleAccessUrl);
}
//删除本地源文件和样例文件
FileUtils.deleteFile(entity.getSrcPath());
FileUtils.deleteFile(entity.getSamplePath());
}else{
entity.setIsSampleCreated(-1);//样例文件创建失败
logger.error("样例文件生成失败");
throw new CallExternalProceduresException();
}
if(fileId.equals(entity.getCfgId().intValue())){
File uploadSampleFile = new File(entity.getSamplePath());
String sampleMd5 = FileUtils.getFileMD5(uploadSampleFile);
entity.setSampleMd5(sampleMd5);
}else{
logger.info("调用外部程序返回fileId错误,输入的fileId为"+entity.getCfgId()+",输出的fileId为"+fileId);
}
}else{
throw new CallExternalProceduresException();
}

View File

@@ -11,9 +11,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.Page;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpUrlCfg;
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;
@@ -29,6 +32,8 @@ import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.DomainDao;
import com.nis.web.dao.configuration.StringCfgDao;
import com.nis.web.dao.configuration.WebsiteCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.CrudService;
/**
@@ -43,6 +48,8 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
@Autowired
protected StringCfgDao stringCfgDao;
@Autowired
protected WebsiteCfgDao websiteCfgDao;
@Autowired
protected AreaIpCfgDao areaIpCfgDao;
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
@@ -408,4 +415,247 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
// TODO Auto-generated method stub
return domainDao.getListByCfgId(ids);
}
public CfgIndexInfo getDomainCfg(Long cfgId) {
CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId);
List<HttpUrlCfg> httpUrlList = websiteCfgDao.getHttpUrlList(entity);
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
entity.setHttpUrlList(httpUrlList);
entity.setNtcSubscribeIdCfgList(subscribeIdList);
return entity;
}
public void saveDomainCfg(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
entity.setIsValid(0);
entity.setIsAudit(0);
if(entity.getCfgId()==null){
Integer compileId = 0;
try {
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
if(idList!=null && idList.size()>0){
compileId = idList.get(0);
}
} catch (MaatConvertException e) {
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
websiteCfgDao.saveCfgIndex(entity);
if(entity.getHttpUrlList()!=null){
for(HttpUrlCfg cfg:entity.getHttpUrlList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveHttpUrlCfg(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()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}else{
entity.setEditTime(new Date());
entity.setEditorId(entity.getCurrentUser().getId());
websiteCfgDao.updateCfgIndex(entity);
//无效子配置后,再新增子配置
websiteCfgDao.deleteHttpUrlCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
areaIpCfgDao.deleteAreaIpCfg(area);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
if(entity.getHttpUrlList()!=null){
for(HttpUrlCfg cfg:entity.getHttpUrlList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveHttpUrlCfg(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()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}
}
public void updateDomainCfgValid(Integer isValid,String ids,Integer functionId){
CfgIndexInfo entity = new CfgIndexInfo();
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(CfgIndexInfo.getTablename());
entity.setFunctionId(functionId);
websiteCfgDao.updateCfgValid(entity);
//查询子配置
entity = this.getDomainCfg(Long.parseLong(id));
if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0)
{
HttpUrlCfg cfg = new HttpUrlCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(HttpUrlCfg.getTablename());
websiteCfgDao.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());
websiteCfgDao.updateCfgValid(cfg);
}
//保存区域IP信息
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
websiteCfgDao.updateCfgValid(cfg);
}
}
}
public void auditDomainCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
// TODO Auto-generated method stub
//修改数据库审核状态信息
entity.setTableName(CfgIndexInfo.getTablename());
websiteCfgDao.auditCfg(entity);
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
List<IpCfg> ipRegionList = new ArrayList();
List<StringCfg> strRegionList = new ArrayList();
List<NumBoundaryCfg> numRegionList = new ArrayList();
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
//查询子配置并修改审核状态
entity = this.getDomainCfg(entity.getCfgId());
if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0){
HttpUrlCfg cfg = new HttpUrlCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(HttpUrlCfg.getTablename());
websiteCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(strRegionList,entity.getHttpUrlList(),2,entity,groupRelationList);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
}
if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(NtcSubscribeIdCfg.getTablename());
websiteCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
}
//保存区域IP信息
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
if(!StringUtil.isEmpty(areaIpCfgList)){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
websiteCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> 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());
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("domain配置下发配置参数"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("domain配置下发响应信息"+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("domain配置下发配置参数"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.put(json,1);
logger.info("domain配置取消配置响应信息"+result.getMsg());
}
}
public Page<CfgIndexInfo> getDomainList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
// 生成数据权限过滤条件dsf为dataScopeFilter的简写在xml中使用 ${sqlMap.dsf}调用权限SQL
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
entity.setPage(page);
List<CfgIndexInfo> list = websiteCfgDao.getWebsiteList(entity);
page.setList(list);
return page;
}
}

View File

@@ -501,8 +501,13 @@ public class FileTransferCfgService extends CrudService<FileTransferCfgDao,CfgIn
entity.setFunctionId(functionId);
fileTransferCfgDao.updateFileDigestCfg(entity);
entity = fileTransferCfgDao.getFileDigest(Long.parseLong(id));
entity = this.getFileDigestCfg(Long.parseLong(id));
// 修改子域配置状态
if((entity.getNtcSubscribeIdCfgList() != null) && (entity.getNtcSubscribeIdCfgList().size() > 0)) {
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, cfg, new String[] {"cfgId"});
stringCfgDao.updateSubscribeIdCfg(cfg);
}
AreaIpCfg areaIpCfg=new AreaIpCfg();
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
@@ -522,20 +527,24 @@ public class FileTransferCfgService extends CrudService<FileTransferCfgDao,CfgIn
entity.setAuditTime(auditTime);
fileTransferCfgDao.updateFileDigestCfg(entity);
entity = fileTransferCfgDao.getFileDigest(Long.parseLong(id));
entity = this.getFileDigestCfg(Long.parseLong(id));
// 修改域配置审核状态
if((entity.getNtcSubscribeIdCfgList() != null) && (entity.getNtcSubscribeIdCfgList().size() > 0)) {
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, cfg, new String[] {"cfgId"});
stringCfgDao.updateSubscribeIdCfg(cfg);
}
List list=new ArrayList();
list.add(entity);
AreaIpCfg areaIpCfg=new AreaIpCfg();
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"cfgId"
});
areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg);
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();

View File

@@ -14,10 +14,13 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.Page;
import com.nis.domain.callback.InlineIp;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
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;
@@ -34,6 +37,8 @@ import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.IpCfgDao;
import com.nis.web.dao.configuration.StringCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.CrudService;
/**
@@ -46,6 +51,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
@Autowired
protected IpCfgDao ipCfgDao;
@Autowired
protected StringCfgDao stringCfgDao;
@Autowired
protected AreaIpCfgDao areaIpCfgDao;
/**
*
@@ -90,6 +97,126 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
}
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveIpCfg(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
entity.setIsValid(0);
entity.setIsAudit(0);
if(entity.getCfgId()==null){
Integer compileId = 0;
try {
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
if(idList!=null && idList.size()>0){
compileId = idList.get(0);
}
} catch (MaatConvertException e) {
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
ipCfgDao.saveCfgIndex(entity);
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
ipCfgDao.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()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}else{
entity.setEditTime(new Date());
entity.setEditorId(entity.getCurrentUser().getId());
ipCfgDao.updateCfgIndex(entity);
//无效子配置后,再新增子配置
ipCfgDao.deleteIpCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
areaIpCfgDao.deleteAreaIpCfg(area);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
ipCfgDao.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()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}
}
public void updateIpCfgValid(Integer isValid,String ids,Integer functionId){
CfgIndexInfo entity = new CfgIndexInfo();
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(CfgIndexInfo.getTablename());
entity.setFunctionId(functionId);
ipCfgDao.updateCfgValid(entity);
//查询子配置
entity = this.getIpPortCfg(Long.parseLong(id));
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(IpPortCfg.getTablename());
ipCfgDao.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());
ipCfgDao.updateCfgValid(cfg);
}
//保存区域IP信息
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
ipCfgDao.updateCfgValid(cfg);
}
}
}
/**
*
* updateIpCfg(更新IP类配置)
@@ -369,7 +496,166 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
}
}
}
public void auditIpCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
Properties props=this.getMsgProp();
//修改数据库审核状态信息
entity.setTableName(CfgIndexInfo.getTablename());
ipCfgDao.auditCfg(entity);
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
List<IpCfg> ipRegionList = new ArrayList();
List<StringCfg> strRegionList = new ArrayList();
List<NumBoundaryCfg> numRegionList = new ArrayList();
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
//获取region
List<FunctionRegionDict> dictList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
int maatType=0;
//查询子配置并修改审核状态
entity = this.getIpPortCfg(entity.getCfgId());
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
//判断下发类型是走maat还是callback
String regionValue=entity.getIpPortList().get(0).getCfgType();
if(regionValue!=null) {
for(FunctionRegionDict region:dictList) {
if(regionValue.equals(region.getConfigRegionValue())) {
maatType=region.getIsMaat();
break;
}
}
}
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(IpPortCfg.getTablename());
ipCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> 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){
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(NtcSubscribeIdCfg.getTablename());
ipCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
}
//保存区域IP信息
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
if(!StringUtil.isEmpty(areaIpCfgList)){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
ipCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
groupRelationList=map.get("groupList");
areaIpRegionList=map.get("dstList");
}
}
//构造提交综合服务参数格式,一条配置提交一次综合服务
if(isAudit==1){
if(maatType==Constants.CALLBACK_TYPE){
List<InlineIp> ipList=new ArrayList<>();
for(IpPortCfg cfg :entity.getIpPortList()) {
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
InlineIp ip=convertCallBackIp(cfg,null);
ipList.add(ip);
}
//调用服务接口下发配置数据
String json=gsonToJson(ipList);
logger.info("IP配置下发配置参数"+json);
//调用服务接口下发配置
try {
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
if(result!=null){
logger.info("IP配置配置下发响应信息"+result.getMsg());
}
} catch (Exception e) {
logger.error("IP配置配置下发失败",e);
throw e;
}
}else if(maatType==Constants.MAAT_TYPE){
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());
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("ip配置下发配置参数"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("ip配置下发响应信息"+result.getMsg());
}else {
throw new RuntimeException("<spring:message code=\"request_service_failed\"/>:"+props.getProperty("unknown_cfg_type"));
}
}else if(isAudit==3){
if(maatType==Constants.CALLBACK_TYPE){
List<InlineIp> ipList=new ArrayList<>();
for(IpPortCfg cfg :entity.getIpPortList()) {
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
InlineIp ip=convertCallBackIp(cfg,null);
ipList.add(ip);
}
//调用服务接口下发配置数据
String json=gsonToJson(ipList);
logger.info("IP配置下发配置参数"+json);
//调用服务接口下发配置
try {
ToMaatResult result = ConfigServiceUtil.put(json, 2);
if(result!=null){
logger.info("IP配置配置下发响应信息"+result.getMsg());
}
} catch (Exception e) {
logger.error("IP配置配置下发失败",e);
throw e;
}
}else if(maatType==Constants.MAAT_TYPE){
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("ip配置下发配置参数"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.put(json,1);
logger.info("ip配置取消配置响应信息"+result.getMsg());
}else {
throw new RuntimeException("<spring:message code=\"request_service_failed\"/>:"+props.getProperty("unknown_cfg_type"));
}
}
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void deleteIp(String ids,String compileIds,int functionId){
if(StringUtils.isNotBlank(compileIds)){
@@ -431,6 +717,14 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
public BaseIpCfg getIpCfgById(BaseIpCfg baseIpCfg){
return ipCfgDao.getById(baseIpCfg.getTableName(), baseIpCfg.getCfgId());
}
public CfgIndexInfo getIpPortCfg(Long cfgId){
CfgIndexInfo entity = ipCfgDao.getCfgIndexInfo(cfgId);
List<IpPortCfg> ipPortList = ipCfgDao.getIpPortList(entity);
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
entity.setIpPortList(ipPortList);
entity.setNtcSubscribeIdCfgList(subscribeIdList);
return entity;
}
public BaseIpCfg getIpCfgById(String tableName,long id){
return ipCfgDao.getById(tableName, id);
}
@@ -507,4 +801,11 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
}
return msgProp;
}
public Page<CfgIndexInfo> getIpCfgList(Page<CfgIndexInfo> page, CfgIndexInfo entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
entity.setPage(page);
List<CfgIndexInfo> list = ipCfgDao.getIpCfgList(entity);
page.setList(list);
return page;
}
}