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

Conflicts:
	src/main/java/com/nis/util/Constants.java
	src/main/resources/messages/message_en.properties
	src/main/resources/messages/message_ru.properties
	src/main/resources/messages/message_zh_CN.properties
	src/main/resources/nis.properties
This commit is contained in:
duandongmei
2018-07-06 17:20:23 +08:00
57 changed files with 2030 additions and 280 deletions

View File

@@ -8,6 +8,8 @@
*/
package com.nis.domain.configuration;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.util.excel.ExcelField;
@@ -38,17 +40,20 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
@Expose
@ExcelField(title="expression_type")
@SerializedName("exprType")
protected Integer exprType ;
private Integer exprType ;
@Expose
@ExcelField(title="match_method")
@SerializedName("matchMethod")
protected Integer matchMethod ;
private Integer matchMethod ;
@Expose
@ExcelField(title="whether_hexbinary")
@SerializedName("isHexbin")
protected Integer isHexbin;
private Integer isHexbin;
private List<IpPortCfg> ipPortList;
private IpPortCfg ipPort;
public Integer getExprType() {
return exprType;
@@ -134,5 +139,21 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
public void setBehavCode(Integer behavCode) {
this.behavCode = behavCode;
}
public List<IpPortCfg> getIpPortList() {
return ipPortList;
}
public void setIpPortList(List<IpPortCfg> ipPortList) {
this.ipPortList = ipPortList;
}
public IpPortCfg getIpPort() {
return ipPort;
}
public void setIpPort(IpPortCfg ipPort) {
this.ipPort = ipPort;
}
}

View File

@@ -31,6 +31,16 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
protected String showName;//表在界面上展示的名称
protected String seltype;//选中类型,页面搜索用
protected String tableName;
@ExcelField(title="userregion1")
protected String userRegion1;
@ExcelField(title="userregion2")
protected String userRegion2;
@ExcelField(title="userregion3")
protected String userRegion3;
@ExcelField(title="userregion4")
protected String userRegion4;
@ExcelField(title="userregion5")
protected String userRegion5;
/**
* 编译id
*/
@@ -786,4 +796,35 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
public void setAreaType(Integer areaType) {
this.areaType = areaType;
}
public String getUserRegion1() {
return userRegion1;
}
public void setUserRegion1(String userRegion1) {
this.userRegion1 = userRegion1;
}
public String getUserRegion2() {
return userRegion2;
}
public void setUserRegion2(String userRegion2) {
this.userRegion2 = userRegion2;
}
public String getUserRegion3() {
return userRegion3;
}
public void setUserRegion3(String userRegion3) {
this.userRegion3 = userRegion3;
}
public String getUserRegion4() {
return userRegion4;
}
public void setUserRegion4(String userRegion4) {
this.userRegion4 = userRegion4;
}
public String getUserRegion5() {
return userRegion5;
}
public void setUserRegion5(String userRegion5) {
this.userRegion5 = userRegion5;
}
}

View File

@@ -8,12 +8,6 @@
*/
package com.nis.domain.configuration;
import java.util.Date;
import org.apache.commons.lang3.StringEscapeUtils;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.util.excel.ExcelField;
/**
@@ -53,7 +47,82 @@ public class IpCfgTemplate {
private Integer ratelimit;//21
private Integer dnsStrategyId;//22
private Integer irType;//23
private String userRegion1;//77
private String userRegion2;//78
private String userRegion3;//79
private String userRegion4;//80
private String userRegion5;//81
/**
* userRegion1
* @return userRegion1
*/
@ExcelField(title="userregion1",align=2,sort=77)
public String getUserRegion1() {
return userRegion1;
}
/**
* @param userRegion1 the userRegion1 to set
*/
public void setUserRegion1(String userRegion1) {
this.userRegion1 = userRegion1;
}
/**
* userRegion2
* @return userRegion2
*/
@ExcelField(title="userregion2",align=2,sort=78)
public String getUserRegion2() {
return userRegion2;
}
/**
* @param userRegion2 the userRegion2 to set
*/
public void setUserRegion2(String userRegion2) {
this.userRegion2 = userRegion2;
}
/**
* userRegion3
* @return userRegion3
*/
@ExcelField(title="userregion3",align=2,sort=79)
public String getUserRegion3() {
return userRegion3;
}
/**
* @param userRegion3 the userRegion3 to set
*/
public void setUserRegion3(String userRegion3) {
this.userRegion3 = userRegion3;
}
/**
* userRegion4
* @return userRegion4
*/
@ExcelField(title="userregion4",align=2,sort=80)
public String getUserRegion4() {
return userRegion4;
}
/**
* @param userRegion4 the userRegion4 to set
*/
public void setUserRegion4(String userRegion4) {
this.userRegion4 = userRegion4;
}
/**
* userRegion5
* @return userRegion5
*/
@ExcelField(title="userregion5",align=2,sort=81)
public String getUserRegion5() {
return userRegion5;
}
/**
* @param userRegion5 the userRegion5 to set
*/
public void setUserRegion5(String userRegion5) {
this.userRegion5 = userRegion5;
}
/**
* ratelimit
* @return ratelimit

View File

@@ -0,0 +1,75 @@
/**
*@Title: BaseReportLog.java
*@Package com.nis.domain.log
*@Description TODO
*@author dell
*@date 2018年7月5日 上午11:12:48
*@version 版本号
*/
package com.nis.domain.log;
import java.util.Date;
import com.nis.domain.BaseEntity;
/**
* @ClassName: BaseReportLog.java
* @Description: 报表接口返回的公共字段
* @author (wx)
* @date 2018年7月5日 上午11:12:48
* @version V1.0
*/
public class BaseReportLog<T> extends BaseEntity<T> {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private static final long serialVersionUID = -6190203013788730697L;
protected Long sum;
protected Integer service;
protected Date reportTime;
/**
* sum
* @return sum
*/
public Long getSum() {
return sum;
}
/**
* @param sum the sum to set
*/
public void setSum(Long sum) {
this.sum = sum;
}
/**
* service
* @return service
*/
public Integer getService() {
return service;
}
/**
* @param service the service to set
*/
public void setService(Integer service) {
this.service = service;
}
/**
* reportTime
* @return reportTime
*/
public Date getReportTime() {
return reportTime;
}
/**
* @param reportTime the reportTime to set
*/
public void setReportTime(Date reportTime) {
this.reportTime = reportTime;
}
}

View File

@@ -10,8 +10,6 @@ package com.nis.domain.log;
import java.util.Date;
import com.nis.domain.BaseEntity;
/**
* @ClassName: ReportLog.java
* @Description: TODO
@@ -19,7 +17,7 @@ import com.nis.domain.BaseEntity;
* @date 2018年6月13日 下午2:21:04
* @version V1.0
*/
public class ReportLog extends BaseEntity<ReportLog>{
public class ReportLog extends BaseReportLog<ReportLog>{
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*

View File

@@ -8,12 +8,21 @@
*/
package com.nis.domain.log;
import java.util.Date;
import java.util.List;
import java.util.Map.Entry;
import com.nis.domain.BaseEntity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.nis.domain.Page;
import com.nis.domain.RestfulResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.StringUtils;
import com.nis.util.httpclient.ClientUtil;
/**
* @ClassName: ReportResultLog.java
@@ -22,9 +31,9 @@ import com.nis.domain.RestfulResult;
* @date 2018年6月11日 下午2:04:09
* @version V1.0
*/
public class ReportResultLog extends RestfulResult{
public class ReportResultLog<T extends BaseReportLog> extends RestfulResult{
private Integer logSource;
private Page<ReportLog> data;
private Page<T> data;
/**
* logSource
* @return logSource
@@ -44,14 +53,50 @@ public class ReportResultLog extends RestfulResult{
* @return data
*/
public Page<ReportLog> getData() {
public Page<T> getData() {
return data;
}
/**
* @param data the data to set
*/
public void setData(Page<ReportLog> data) {
public void setData(Page<T> data) {
this.data = data;
}
public ReportResultLog<T> getReport(String reportUrl,SearchReport searchCondition) throws MaatConvertException{
if(StringUtils.isBlank(searchCondition.getSearchService())){
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
String result = null;
ReportResultLog<T> bean = null;
StringBuffer url=new StringBuffer(reportUrl+"?");
url.append("searchBusinessType=").append(searchCondition.getSearchBusinessType())
.append("&searchService=").append(searchCondition.getSearchService());
if(searchCondition.getSearchCondition()!=null){
for(Entry<String, Object> e:searchCondition.getSearchCondition().entrySet()){
url.append("&").append(e.getKey()).append("=").append((String)e.getValue());
}
}
if(StringUtils.isNotBlank(searchCondition.getSearchReportStartTime())){
url.append("&searchReportStartTime=").append(searchCondition.getSearchReportStartTime());
}
if(StringUtils.isNotBlank(searchCondition.getSearchReportEndTime())){
url.append("&searchReportEndTime=").append(searchCondition.getSearchReportEndTime());
}
//创建连接
WebTarget wt = ClientUtil.getWebTarger(url.toString());
Builder header = wt.request(MediaType.APPLICATION_JSON);
Response response= header.get();
if( response.getStatus() == 200){
result= response.readEntity(String.class);
Gson gson=Constants.gsonbuilder.create();
bean = gson.fromJson(result, new TypeToken<ReportResultLog<T>>(){
private static final long serialVersionUID = 7963055764864141968L;}.getType());
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
}
return bean;
}
public static void main(String[] args) {
}
}

View File

@@ -0,0 +1,191 @@
/**
*@Title: SearchReport.java
*@Package com.nis.domain.log
*@Description TODO
*@author dell
*@date 2018年7月5日 下午12:30:44
*@version 版本号
*/
package com.nis.domain.log;
import java.util.HashMap;
import com.nis.domain.BaseEntity;
/**
* @ClassName: SearchReport.java
* @Description: TODO
* @author (wx)
* @date 2018年7月5日 下午12:30:44
* @version V1.0
*/
public class SearchReport extends BaseEntity<SearchReport>{
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private static final long serialVersionUID = 1L;
private Integer functionId;
private String cfgName;
private Integer action;
private Integer reportType;
private String searchBusinessType;
private String searchReportStartTime;
private String searchReportEndTime;
private String searchService;
private HashMap<String,Object> searchCondition;
public static final String searchConditionSplitor=",";
public int searchConditionLimit;
/**
* reportType
* @return reportType
*/
public Integer getReportType() {
return reportType;
}
/**
* @param reportType the reportType to set
*/
public void setReportType(Integer reportType) {
this.reportType = reportType;
}
/**
* functionId
* @return functionId
*/
public Integer getFunctionId() {
return functionId;
}
/**
* @param functionId the functionId to set
*/
public void setFunctionId(Integer functionId) {
this.functionId = functionId;
}
/**
* cfgName
* @return cfgName
*/
public String getCfgName() {
return cfgName;
}
/**
* @param cfgName the cfgName to set
*/
public void setCfgName(String cfgName) {
this.cfgName = cfgName;
}
/**
* action
* @return action
*/
public Integer getAction() {
return action;
}
/**
* @param action the action to set
*/
public void setAction(Integer action) {
this.action = action;
}
/**
* searchBusinessType
* @return searchBusinessType
*/
public String getSearchBusinessType() {
return searchBusinessType;
}
/**
* @param searchBusinessType the searchBusinessType to set
*/
public void setSearchBusinessType(String searchBusinessType) {
this.searchBusinessType = searchBusinessType;
}
/**
* searchReportStartTime
* @return searchReportStartTime
*/
public String getSearchReportStartTime() {
return searchReportStartTime;
}
/**
* @param searchReportStartTime the searchReportStartTime to set
*/
public void setSearchReportStartTime(String searchReportStartTime) {
this.searchReportStartTime = searchReportStartTime;
}
/**
* searchReportEndTime
* @return searchReportEndTime
*/
public String getSearchReportEndTime() {
return searchReportEndTime;
}
/**
* @param searchReportEndTime the searchReportEndTime to set
*/
public void setSearchReportEndTime(String searchReportEndTime) {
this.searchReportEndTime = searchReportEndTime;
}
/**
* searchService
* @return searchService
*/
public String getSearchService() {
return searchService;
}
/**
* @param searchService the searchService to set
*/
public void setSearchService(String searchService) {
this.searchService = searchService;
}
/**
* searchCondition
* @return searchCondition
*/
public HashMap<String, Object> getSearchCondition() {
return searchCondition;
}
/**
* @param searchCondition the searchCondition to set
*/
public void setSearchCondition(HashMap<String, Object> searchCondition) {
this.searchCondition = searchCondition;
}
/**
* searchConditionLimit
* @return searchConditionLimit
*/
public int getSearchConditionLimit() {
return searchConditionLimit;
}
/**
* @param searchConditionLimit the searchConditionLimit to set
*/
public void setSearchConditionLimit(int searchConditionLimit) {
this.searchConditionLimit = searchConditionLimit;
}
/**
* searchconditionsplitor
* @return searchconditionsplitor
*/
public static String getSearchconditionsplitor() {
return searchConditionSplitor;
}
}

View File

@@ -1,32 +1,31 @@
package com.nis.util;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.nis.domain.log.ReportLog;
import com.nis.domain.log.ReportResultLog;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.httpclient.ClientUtil;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
public class ConfigServiceUtil {
private static Logger logger = LoggerFactory.getLogger(ConfigServiceUtil.class);
/*public static class MapTypeAdapter extends TypeAdapter<Object> {
@@ -310,12 +309,12 @@ public class ConfigServiceUtil {
* @exception
* @since 1.0.0
*/
public static ReportResultLog getReport(int type,String ids,String serviceIds,String searchReportStartTime,String searchReportEndTime) throws MaatConvertException{
public static ReportResultLog<ReportLog> getReport(int type,String ids,String serviceIds,String searchReportStartTime,String searchReportEndTime) throws MaatConvertException{
if(StringUtils.isBlank(ids)||StringUtils.isBlank(serviceIds)){
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
String result = null;
ReportResultLog bean = null;
ReportResultLog<ReportLog> bean = null;
StringBuffer url=new StringBuffer(Constants.SERVICE_URL+Constants.NTC_PZ_REPORT+"?");
url.append("searchBusinessType=").append(type)
.append("&searchService=").append(serviceIds).append("&searchCfgId=").append(ids);
@@ -331,8 +330,9 @@ public class ConfigServiceUtil {
Response response= header.get();
if( response.getStatus() == 200){
result= response.readEntity(String.class);
JSONObject resObject = JSONObject.fromObject(result);
bean = (ReportResultLog) JSONObject.toBean(resObject,ReportResultLog.class);
Gson gson=Constants.gsonbuilder.create();
bean = gson.fromJson(result, new TypeToken<ReportResultLog<ReportLog>>(){
private static final long serialVersionUID = 7963055764864141968L;}.getType());
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
}

View File

@@ -40,6 +40,7 @@ import com.nis.domain.configuration.IpCfgTemplate;
import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.configuration.StringCfgTemplate;
import com.nis.domain.log.BaseLogEntity;
import com.nis.domain.log.SearchReport;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Configurations;
//import com.nis.main.ConvertTool;
@@ -329,6 +330,20 @@ public class BaseController {
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(cfg.getFunctionId());
model.addAttribute("serviceList", serviceList);
}
protected void initReportCondition(Model model,SearchReport report){
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
model.addAttribute("requestInfos", requestInfos);
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
model.addAttribute("fls", fls);
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
model.addAttribute("xzs", xzs);
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
model.addAttribute("lables", lables);
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(report.getFunctionId());
model.addAttribute("regionList", regionList);
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(report.getFunctionId());
model.addAttribute("serviceList", serviceList);
}
protected void initFormCondition(Model model){
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
model.addAttribute("requestInfos", requestInfos);

View File

@@ -1,6 +1,8 @@
package com.nis.web.controller.configuration;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -19,6 +21,9 @@ import com.nis.domain.configuration.AppDomainCfg;
import com.nis.domain.configuration.AppHttpCfg;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.web.controller.BaseController;
@@ -52,6 +57,31 @@ public class AppCfgController extends BaseController {
initPageCondition(model,cfg);
return "/cfg/app/appPolicyCfgList";
}
/**
* 查询APP策略IP子配置
* @param model
* @param cfgId
* @param index
* @return
*/
@RequestMapping(value = {"ajaxAppPolicyIpList"})
public String ajaxSslSubList(Model model,Long cfgId,Integer index) {
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(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();
}
}
}
model.addAttribute("_cfg", cfg);
model.addAttribute("index", index);
model.addAttribute("tabList", tabList);
return "/cfg/app/appPolicyIpList";
}
/**
* 策略配置表单
* @param model

View File

@@ -11,7 +11,6 @@ package com.nis.web.controller.configuration;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -20,16 +19,12 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.datanucleus.store.types.wrappers.backed.Set;
import org.springframework.beans.BeanUtils;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.SysUser;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.HttpUrlCfg;
@@ -223,7 +218,7 @@ public class CommonController extends BaseController {
try {
ImportExcel ei = new ImportExcel(file, 0, 0);
List<IpCfgTemplate> list = ei.getDataList(IpCfgTemplate.class);
this.checkIpCfg(list);
this.checkIpCfg(ipCfg.getFunctionId(),list);
List<BaseIpCfg> ipList = new ArrayList<>();
Date date=new Date();
for(IpCfgTemplate cfg : list){
@@ -251,7 +246,7 @@ public class CommonController extends BaseController {
}
//ip配置导出
public void _exportIp(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
try {
//获取国际化配置
Properties msgProp = getMsgProp();

View File

@@ -35,7 +35,7 @@ import com.nis.web.security.UserUtils;
public class BgpCfgController extends BaseController{
@RequestMapping(value = {"bgpList"})
@RequiresPermissions(value={"other:bgp:config"})
// @RequiresPermissions(value={"other:bgp:config"})
public String httpList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg
,HttpServletRequest request,HttpServletResponse response
,RedirectAttributes redirectAttributes) {

View File

@@ -47,7 +47,7 @@ import com.nis.web.security.UserUtils;
@RequestMapping("${adminPath}/ntc/fileTransfer/")
public class FileTransferCfgController extends BaseController{
@RequestMapping(value = {"ftpList"})
@RequiresPermissions(value={"fileTransfer:ftp:config"})
// @RequiresPermissions(value={"fileTransfer:ftp:config"})
public String ftpList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = fileTransferCfgService.getFtpList(searchPage, cfg);
@@ -131,7 +131,7 @@ public class FileTransferCfgController extends BaseController{
}
@RequestMapping(value = {"fileDigestList"})
@RequiresPermissions(value={"fileTransfer:fileDigest:config"})
// @RequiresPermissions(value={"fileTransfer:fileDigest:config"})
public String fileDigestList(Model model,@ModelAttribute("cfg")FileDigestCfg cfg
,HttpServletRequest request,HttpServletResponse response
,RedirectAttributes redirectAttributes) {

View File

@@ -45,7 +45,7 @@ import com.nis.web.security.UserUtils;
@RequestMapping("${adminPath}/ntc/mail/")
public class MailCfgController extends BaseController{
@RequestMapping(value = {"mailList"})
@RequiresPermissions(value={"mail:config"})
// @RequiresPermissions(value={"mail:config"})
public String mailList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = mailCfgService.getMailList(searchPage, cfg);

View File

@@ -48,7 +48,7 @@ import com.nis.web.security.UserUtils;
public class WebsiteController extends BaseController{
@RequestMapping(value = {"httpList"})
@RequiresPermissions(value={"website:http:config"})
// @RequiresPermissions(value={"website:http:config"})
public String httpList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = websiteCfgService.getWebsiteList(searchPage, cfg);
@@ -57,7 +57,7 @@ public class WebsiteController extends BaseController{
return "/cfg/website/httpList";
}
@RequestMapping(value = {"dnsList"})
@RequiresPermissions(value={"website:dns:config"})
// @RequiresPermissions(value={"website:dns:config"})
public String dnsList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = websiteCfgService.getWebsiteList(searchPage, cfg);
@@ -207,7 +207,7 @@ public class WebsiteController extends BaseController{
return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+functionId;
}
@RequestMapping(value = {"sslList"})
@RequiresPermissions(value={"website:ssl:config"})
// @RequiresPermissions(value={"website:ssl:config"})
public String sslList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = websiteCfgService.getWebsiteList(searchPage, cfg);

View File

@@ -14,6 +14,9 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
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;
@@ -22,7 +25,7 @@ import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.web.controller.BaseController;
import com.nis.web.controller.configuration.CommonController;
/**
* 白名单
@@ -31,9 +34,9 @@ import com.nis.web.controller.BaseController;
*/
@Controller
@RequestMapping("${adminPath}/ntc/whitelist")
public class WhiteListController extends BaseController{
public class WhiteListController extends CommonController{
@RequestMapping(value = {"ipList"})
@RequestMapping(value = {"ip/list"})
@RequiresPermissions(value={"whitelist:ip:config","whitelist:ip:audit"},logical=Logical.OR)
public String ipList(Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
cfg.setTableName(IpPortCfg.getTablename());
@@ -43,7 +46,7 @@ public class WhiteListController extends BaseController{
initPageCondition(model,cfg);
return "/cfg/whitelist/ipList";
}
@RequestMapping(value = {"domainList"})
@RequestMapping(value = {"domain/list"})
@RequiresPermissions(value={"whitelist:domain:config","whitelist:domain:audit"},logical=Logical.OR)
public String domainList(Model model,@ModelAttribute("cfg")HttpUrlCfg cfg,HttpServletRequest request,HttpServletResponse response) {
cfg.setTableName(HttpUrlCfg.getTablename());
@@ -53,7 +56,7 @@ public class WhiteListController extends BaseController{
initPageCondition(model,cfg);
return "/cfg/whitelist/domainList";
}
@RequestMapping(value = {"ipForm"})
@RequestMapping(value = {"ip/form"})
@RequiresPermissions(value={"whitelist:ip:config"})
public String ipForm(Model model,String ids,BaseIpCfg entity) {
if(StringUtils.isNotBlank(ids)){
@@ -72,7 +75,7 @@ public class WhiteListController extends BaseController{
return "/cfg/whitelist/ipForm";
}
@RequestMapping(value = {"domainForm"})
@RequestMapping(value = {"domain/form"})
@RequiresPermissions(value={"whitelist:domain:config"})
public String domainForm(Model model,String ids,HttpUrlCfg entity) {
if(StringUtils.isNotBlank(ids)){
@@ -90,7 +93,7 @@ public class WhiteListController extends BaseController{
return "/cfg/whitelist/domainForm";
}
@RequestMapping(value = {"saveOrUpdateIp"})
@RequestMapping(value = {"ip/saveOrUpdate"})
public String saveOrUpdateIp(RedirectAttributes model, IpPortCfg cfg) {
cfg.setTableName(IpPortCfg.getTablename());
logger.info("saveOrUpdateIp loaded");
@@ -112,9 +115,9 @@ public class WhiteListController extends BaseController{
logger.error("保存失败",e);
addMessage(model,"save_failed");
}
return "redirect:" + adminPath +"/ntc/whitelist/ipList?functionId="+cfg.getFunctionId();
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"saveOrUpdateDomain"})
@RequestMapping(value = {"domain/saveOrUpdate"})
public String saveOrUpdateDomain(RedirectAttributes model, HttpUrlCfg cfg) {
cfg.setTableName(HttpUrlCfg.getTablename());
logger.info("saveOrUpdateIp loaded");
@@ -136,10 +139,10 @@ public class WhiteListController extends BaseController{
logger.error("保存失败",e);
addMessage(model,"save_failed");
}
return "redirect:" + adminPath +"/ntc/whitelist/domainList?functionId="+cfg.getFunctionId();
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"deleteIp"})
@RequestMapping(value = {"ip/delete"})
@RequiresPermissions("whitelist:ip:config")
public String deleteIp(String ids,Integer functionId,RedirectAttributes model) {
try{
@@ -149,9 +152,9 @@ public class WhiteListController extends BaseController{
logger.error("删除失败", e);
addMessage(model,"delete_failed");
}
return "redirect:" + adminPath +"/ntc/whitelist/ipList?functionId="+functionId;
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+functionId;
}
@RequestMapping(value = {"deleteDomain"})
@RequestMapping(value = {"domain/delete"})
@RequiresPermissions("whitelist:domain:config")
public String deleteDomain(String ids,Integer functionId,RedirectAttributes model) {
try{
@@ -161,10 +164,10 @@ public class WhiteListController extends BaseController{
logger.error("删除失败", e);
addMessage(model,"delete_failed");
}
return "redirect:" + adminPath +"/ntc/whitelist/domainList?functionId="+functionId;
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
}
@RequestMapping(value = {"auditIp"})
@RequiresPermissions("whitelist:ip:aduit")
@RequestMapping(value = {"ip/audit"})
@RequiresPermissions("whitelist:ip:audit")
public String auditIp(String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
try{
for(String id:ids.split(",")){
@@ -183,15 +186,15 @@ public class WhiteListController extends BaseController{
addMessage(redirectAttributes,"audit_success");
}catch(MaatConvertException e){
logger.error("审核失败", e);
addMessage(redirectAttributes, e.getPrefix()+e.getResult().getReason());
addMessage(redirectAttributes, e.getMessage());
}catch(Exception e){
logger.error("审核失败", e);
addMessage(redirectAttributes, "audit_failed");
}
return "redirect:" + adminPath +"/ntc/whitelist/ipList?functionId="+cfg.getFunctionId();
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"auditDomain"})
@RequiresPermissions("whitelist:domain:aduit")
@RequestMapping(value = {"domain/audit"})
@RequiresPermissions("whitelist:domain:audit")
public String auditDomain(String ids,HttpUrlCfg cfg,RedirectAttributes redirectAttributes) {
try{
List<HttpUrlCfg> beans=domainService.getListByCfgId(ids);
@@ -209,11 +212,30 @@ public class WhiteListController extends BaseController{
addMessage(redirectAttributes,"audit_success");
}catch(MaatConvertException e){
logger.error("审核失败", e);
addMessage(redirectAttributes, e.getPrefix()+e.getResult().getReason());
addMessage(redirectAttributes, e.getMessage());
}catch(Exception e){
logger.error("审核失败", e);
addMessage(redirectAttributes, "audit_failed");
}
return "redirect:" + adminPath +"/ntc/whitelist/domainList?functionId="+cfg.getFunctionId();
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+cfg.getFunctionId();
}
//ip配置导入
@RequestMapping(value = "ip/import", method=RequestMethod.POST)
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
this._importIp(cfgName,redirectAttributes, file,cfg);
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+cfg.getFunctionId();
}
//ip模板下载
@RequestMapping(value = "ip/import/template")
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
}
//ip配置导出
@RequestMapping(value = "ip/export")
public void exportIp(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
this._exportIp(model, request, response, entity, ids, redirectAttributes);
}
}

View File

@@ -8,7 +8,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -17,18 +16,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpBodyCfg;
import com.nis.domain.configuration.HttpReqHeadCfg;
import com.nis.domain.configuration.HttpResHeadCfg;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;

View File

@@ -0,0 +1,22 @@
package com.nis.web.controller.report;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.nis.domain.log.SearchReport;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/report")
public class ReportController extends BaseController {
@RequestMapping("/list")
public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
initReportCondition(model, bean);
return "/report/list";
}
}

View File

@@ -0,0 +1,29 @@
/**
*@Title: TestBean.java
*@Package com.nis.web.controller.report
*@Description TODO
*@author dell
*@date 2018年7月6日 上午9:20:48
*@version 版本号
*/
package com.nis.web.controller.report;
import com.nis.domain.log.BaseReportLog;
/**
* @ClassName: TestBean.java
* @Description: TODO
* @author (dell)
* @date 2018年7月6日 上午9:20:48
* @version V1.0
*/
public class TestBean extends BaseReportLog<TestBean> {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private static final long serialVersionUID = -8794587413327741665L;
}

View File

@@ -0,0 +1,32 @@
package com.nis.web.controller.report;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.nis.domain.Page;
import com.nis.domain.log.SearchReport;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/report/test")
public class TestController extends BaseController {
@RequestMapping("list")
public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
Page<TestBean> page=new Page<TestBean>(request, response);
List<TestBean> list=new ArrayList<>();
list.add(new TestBean());
page.setList(list);
model.addAttribute("page", page);
model.addAttribute("bean", bean);
return "/report/test";
}
}

View File

@@ -18,6 +18,7 @@ import com.nis.domain.configuration.AppStringCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@@ -32,8 +33,13 @@ public interface AppCfgDao {
//app策略配置增删改查
public List<AppPolicyCfg> findAppPolicyList(AppPolicyCfg entity) ;
public AppPolicyCfg getAppPolicyCfg(Long cfgId) ;
public IpPortCfg getAppPolicyIpCfg(AppPolicyCfg entity) ;
public List<IpPortCfg> getAppPolicyIpList(AppPolicyCfg entity);
public int insertAppPolicyCfg(AppPolicyCfg entity);
public int updateAppPolicyCfg(AppPolicyCfg entity);
public int insertAppPolicyIpCfg(IpPortCfg entity);
public int deleteAppPolicyIpCfg(AppPolicyCfg entity);
//app协议IP配置增删改查
public List<AppIpCfg> findAppIpList(AppIpCfg entity) ;
public AppIpCfg getAppIpCfg(Long cfgId) ;

View File

@@ -189,6 +189,41 @@
<result column="function_id" property="functionId" jdbcType="INTEGER" />
</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="AppPolicyCfg_Column" >
r.CFG_ID, r.APP_CODE,r.BEHAV_CODE,r.SPEC_SERVICE_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT,
r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME,
@@ -248,6 +283,15 @@
#{areaEffectiveIds,jdbcType=VARCHAR},#{ratelimit,jdbcType=INTEGER},#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}
</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>
<!-- <sql id="AppCfg_Column_List_with_id_alias" >
<choose>
<when test="page !=null and page.alias != null and page.alias != ''">
@@ -397,7 +441,25 @@
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="ipPort!=null">
AND r.compile_id in (select t.compile_id from ip_port_cfg t
<where>
and t.protocol_id=21
<if test="ipPort.srcIpAddress != null and ipPort.srcIpAddress != ''">
and t.src_ip_address =#{(ipPort.srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="ipPort.srcPort != null and ipPort.srcPort != ''">
and t.src_port =#{ipPort.srcPort,jdbcType=VARCHAR}
</if>
<if test="ipPort.destIpAddress != null and ipPort.destIpAddress != ''">
and t.dest_ip_address =#{(ipPort.destIpAddress,jdbcType=VARCHAR}
</if>
<if test="ipPort.destPort != null and ipPort.destPort != ''">
and t.dest_port =#{ipPort.destPort,jdbcType=VARCHAR}
</if>
</where>
)
</if>
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -1011,6 +1073,78 @@
)
</insert>
<!-- insert ip_port_cfg表信息 -->
<insert id="insertAppPolicyIpCfg" 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
)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}
)
</insert>
<update id="updateAppPolicyCfg" parameterType="com.nis.domain.configuration.AppPolicyCfg" >
update app_policy_cfg
<set >
@@ -1525,4 +1659,15 @@
</trim>
</update>
<!-- 删除APP策略IP子配置 -->
<delete id="deleteAppPolicyIpCfg" >
delete from ip_port_cfg where compile_id=#{compileId} and protocol_id=21 and function_id=#{functionId}
</delete>
<!-- 查询APP策略IP子配置 -->
<select id="getAppPolicyIpList" 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>
</mapper>

View File

@@ -37,6 +37,11 @@
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<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" />
<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="BaseIpMapWithUser" type="com.nis.domain.configuration.BaseIpCfg" extends="BaseIpMap" >
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
@@ -50,14 +55,14 @@
DIRECTION,PROTOCOL,PROTOCOL_ID,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,RATELIMIT,DNS_STRATEGY_ID,IR_TYPE
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,FUNCTION_ID,RATELIMIT,DNS_STRATEGY_ID,IR_TYPE,USER_REGION1,USER_REGION2,USER_REGION3,USER_REGION4,USER_REGION5
</sql>
<sql id="BaseIpCfg_Column_List_with_id_name" >
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,
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,RATELIMIT,DNS_STRATEGY_ID,IR_TYPE
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,FUNCTION_ID,RATELIMIT,DNS_STRATEGY_ID,IR_TYPE,USER_REGION1,USER_REGION2,USER_REGION3,USER_REGION4,USER_REGION5
</sql>
<sql id="BaseIpCfg_Column_List_with_id_alias" >
<choose>
@@ -68,7 +73,12 @@
${page.alias}.CREATOR_ID as creatorId,${page.alias}.CREATE_TIME AS createTime,${page.alias}.EDITOR_ID as editorId,${page.alias}.EDIT_TIME AS editTime,${page.alias}.AUDITOR_ID as auditorId,${page.alias}.AUDIT_TIME AS auditTime,
${page.alias}.SERVICE_ID as serviceId,${page.alias}.REQUEST_ID AS requestId,${page.alias}.COMPILE_ID AS compileId,${page.alias}.IS_AREA_EFFECTIVE as isAreaEffective,${page.alias}.classify,
${page.alias}.ATTRIBUTE AS attribute,${page.alias}.LABLE AS lable,${page.alias}.AREA_EFFECTIVE_IDS AS areaEffectiveIds,${page.alias}.FUNCTION_ID AS functionId,${page.alias}.RATELIMIT AS ratelimit,
${page.alias}.DNS_STRATEGY_ID AS dnsStrategyId,${page.alias}.IR_TYPE AS irType
${page.alias}.DNS_STRATEGY_ID AS dnsStrategyId,${page.alias}.IR_TYPE AS irType,
${page.alias}.USER_REGION1 AS userRegion1,
${page.alias}.USER_REGION2 AS userRegion2,
${page.alias}.USER_REGION3 AS userRegion3,
${page.alias}.USER_REGION4 AS userRegion4,
${page.alias}.USER_REGION5 AS userRegion5
</when>
<otherwise>
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc,r.CFG_REGION_CODE as cfgRegionCode,r.CFG_TYPE as cfgType, r.IP_TYPE as ipType,
@@ -77,7 +87,12 @@
r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime,
r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify,
r.ATTRIBUTE AS attribute,r.LABLE AS lable,r.AREA_EFFECTIVE_IDS AS areaEffectiveIds,r.FUNCTION_ID as functionId,r.RATELIMIT AS ratelimit,
r.DNS_STRATEGY_ID AS dnsStrategyId,r.IR_TYPE AS irType
r.DNS_STRATEGY_ID AS dnsStrategyId,r.IR_TYPE AS irType,
r.USER_REGION1 AS userRegion1,
r.USER_REGION2 AS userRegion2,
r.USER_REGION3 AS userRegion3,
r.USER_REGION4 AS userRegion4,
r.USER_REGION5 AS userRegion5
</otherwise>
</choose>
</sql>
@@ -92,7 +107,7 @@
REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,
CLASSIFY,ATTRIBUTE,LABLE,
AREA_EFFECTIVE_IDS,FUNCTION_ID,RATELIMIT,
DNS_STRATEGY_ID,IR_TYPE
DNS_STRATEGY_ID,IR_TYPE,USER_REGION1,USER_REGION2,USER_REGION3,USER_REGION4,USER_REGION5
</sql>
<sql id="BaseIpCfg_Value_List" >
#{cfgDesc,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},#{cfgType,jdbcType=VARCHAR},
@@ -105,7 +120,12 @@
#{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},
#{dnsStrategyId,jdbcType=INTEGER},#{irType,jdbcType=INTEGER}
#{dnsStrategyId,jdbcType=INTEGER},#{irType,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
</sql>
<select id="getById" resultMap="BaseIpMap" parameterType="java.lang.Long" >
SELECT
@@ -282,6 +302,21 @@
<if test="irType != null">
AND ${page.alias}.IR_TYPE=#{irType,jdbcType=INTEGER}
</if>
<if test="userRegion1 != null">
AND ${page.alias}.USER_REGION1=#{userRegion1,jdbcType=VARCHAR}
</if>
<if test="userRegion2 != null">
AND ${page.alias}.USER_REGION2=#{userRegion2,jdbcType=VARCHAR}
</if>
<if test="userRegion3 != null">
AND ${page.alias}.USER_REGION3=#{userRegion3,jdbcType=VARCHAR}
</if>
<if test="userRegion4 != null">
AND ${page.alias}.USER_REGION4=#{userRegion4,jdbcType=VARCHAR}
</if>
<if test="userRegion5 != null">
AND ${page.alias}.USER_REGION5=#{userRegion5,jdbcType=VARCHAR}
</if>
</when>
<otherwise>
<if test="cfgId != null">
@@ -392,6 +427,21 @@
<if test="irType != null">
AND r.IR_TYPE=#{irType,jdbcType=INTEGER}
</if>
<if test="userRegion1 != null">
AND r.USER_REGION1=#{userRegion1,jdbcType=VARCHAR}
</if>
<if test="userRegion2 != null">
AND r.USER_REGION2=#{userRegion2,jdbcType=VARCHAR}
</if>
<if test="userRegion3 != null">
AND r.USER_REGION3=#{userRegion3,jdbcType=VARCHAR}
</if>
<if test="userRegion4 != null">
AND r.USER_REGION4=#{userRegion4,jdbcType=VARCHAR}
</if>
<if test="userRegion5 != null">
AND r.USER_REGION5=#{userRegion5,jdbcType=VARCHAR}
</if>
</otherwise>
</choose>
<!-- 数据范围过滤 -->
@@ -547,6 +597,21 @@
<if test="irType != null">
IR_TYPE=#{irType,jdbcType=INTEGER},
</if>
<if test="userRegion1 != null">
USER_REGION1=#{userRegion1,jdbcType=VARCHAR},
</if>
<if test="userRegion2 != null">
USER_REGION2=#{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null">
USER_REGION3=#{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null">
USER_REGION4=#{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null">
USER_REGION5=#{userRegion5,jdbcType=VARCHAR},
</if>
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
@@ -595,7 +660,7 @@
r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime,
r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify,
r.ATTRIBUTE AS attribute,r.LABLE AS lable,r.AREA_EFFECTIVE_IDS AS areaEffectiveIds,r.FUNCTION_ID as functionId,r.RATELIMIT AS ratelimit,
r.DNS_STRATEGY_ID AS dnsStrategyId,r.IR_TYPE AS irType
r.DNS_STRATEGY_ID AS dnsStrategyId,r.IR_TYPE AS irType,r.USER_REGION1 AS userRegion1,r.USER_REGION2 AS userRegion2,r.USER_REGION3 AS userRegion3,r.USER_REGION4 AS userRegion4,r.USER_REGION5 AS userRegion5
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName,po.group_name as group_name
from ${tableName} r

View File

@@ -25,6 +25,11 @@
<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="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" />
@@ -123,7 +128,8 @@
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.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
</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
@@ -392,7 +398,12 @@
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
dns_strategy_id
dns_strategy_id,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -413,7 +424,12 @@
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{dnsStrategyId,jdbcType=INTEGER}
#{dnsStrategyId,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<!-- insert ip_port_cfg表信息 -->
@@ -518,7 +534,12 @@
cfg_region_code,
expr_type,
match_method,
is_hexbin
is_hexbin,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -545,7 +566,12 @@
#{cfgRegionCode,jdbcType=INTEGER},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER}
#{isHexbin,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
@@ -580,7 +606,12 @@
cfg_region_code,
expr_type,
match_method,
is_hexbin
is_hexbin,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -607,7 +638,12 @@
#{cfgRegionCode,jdbcType=INTEGER},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER}
#{isHexbin,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
@@ -641,7 +677,12 @@
cfg_region_code,
expr_type,
match_method,
is_hexbin
is_hexbin,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -667,7 +708,12 @@
#{cfgRegionCode,jdbcType=INTEGER},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER}
#{isHexbin,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<!-- insert http_url_cfg表信息 -->
@@ -700,7 +746,12 @@
cfg_region_code,
expr_type,
match_method,
is_hexbin
is_hexbin,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -726,7 +777,12 @@
#{cfgRegionCode,jdbcType=INTEGER},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER}
#{isHexbin,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" >
@@ -778,6 +834,21 @@
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="userRegion1 != null and userRegion1 != ''" >
user_region1 = #{userRegion1,jdbcType=VARCHAR},
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
user_region2 = #{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''" >
user_region3 = #{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''" >
user_region4 = #{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''" >
user_region5 = #{userRegion5,jdbcType=VARCHAR},
</if>
dns_strategy_id = #{dnsStrategyId,jdbcType=INTEGER},
</trim>

View File

@@ -390,7 +390,12 @@ public abstract class BaseService {
if(srcIp.getSrcIpAddress().indexOf("/")!=-1){
if(srcIp.getIpType()==4 || srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
if(srcMaskNum==0){
dstIp.setSrcIpMask("0.0.0.0");
}else{
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
}
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
}else if(srcIp.getIpType()==6|| srcIp.getIpType()==64){//64表示源ip为ipv6目的ip为ipv4
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getSrcIpAddress());
@@ -413,27 +418,31 @@ public abstract class BaseService {
}else{
if(srcIp.getIpType()==4|| srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("0.0.0.0");
dstIp.setSrcIpMask("255.255.255.255");
}else if(srcIp.getIpType()==6|| srcIp.getIpType()==64){//64表示源ip为ipv6目的ip为ipv4
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("::");
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
}
}else{
if(srcIp.getIpType()==4|| srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("0.0.0.0");
dstIp.setSrcIpMask("255.255.255.255");
}else if(srcIp.getIpType()==6|| srcIp.getIpType()==64){//64表示源ip为ipv6目的ip为ipv4
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("::");
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
}
if(srcIp.getDestIpAddress()!=null){
if(srcIp.getDestIpAddress().indexOf("/")!=-1){
if(srcIp.getIpType()==4|| srcIp.getIpType()==64){//64表示源ip为ipv6目的ip为ipv4
Integer dstMaskNum = Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]);
dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));
if(dstMaskNum==0){
dstIp.setDstIpMask("0.0.0.0");
}else{
dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));;
}
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
}else if(srcIp.getIpType()==6|| srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getDestIpAddress());
@@ -456,20 +465,20 @@ public abstract class BaseService {
}else{
if(srcIp.getIpType()==4|| srcIp.getIpType()==64){//64表示源ip为ipv6目的ip为ipv4
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("0.0.0.0");
dstIp.setDstIpMask("255.255.255.255");
}else if(srcIp.getIpType()==6|| srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("::");
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
}
}else{
if(srcIp.getIpType()==4|| srcIp.getIpType()==64){//64表示源ip为ipv6目的ip为ipv4
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("0.0.0.0");
dstIp.setDstIpMask("255.255.255.255");
}else if(srcIp.getIpType()==6|| srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("::");
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
}
if(srcIp.getSrcPort()!=null){
@@ -479,11 +488,11 @@ public abstract class BaseService {
dstIp.setSrcPort(srcIp.getSrcPort().split("/")[0]);
}else{
dstIp.setSrcPort(srcIp.getSrcPort());
dstIp.setSrcPortMask("0");
dstIp.setSrcPortMask("65535");
}
}else{
dstIp.setSrcPort("0");
dstIp.setSrcPortMask("0");
dstIp.setSrcPortMask("65535");
}
if(srcIp.getDestPort()!=null){
if(srcIp.getDestPort().indexOf("/")!=-1){
@@ -492,11 +501,11 @@ public abstract class BaseService {
dstIp.setDstPort(srcIp.getDestPort().split("/")[0]);
}else{
dstIp.setDstPort(srcIp.getDestPort());
dstIp.setDstPortMask("0");
dstIp.setDstPortMask("65535");
}
}else{
dstIp.setDstPort("0");
dstIp.setDstPortMask("0");
dstIp.setDstPortMask("65535");
}
return dstIp;
}

View File

@@ -17,6 +17,7 @@ import com.nis.domain.configuration.AppHttpCfg;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.ToMaatBean;
import com.nis.domain.maat.ToMaatResult;
@@ -84,7 +85,10 @@ public class AppCfgService extends BaseService {
return page;
}
public AppPolicyCfg getAppPolicyCfg(Long cfgId){
return appCfgDao.getAppPolicyCfg(cfgId);
AppPolicyCfg policy = appCfgDao.getAppPolicyCfg(cfgId);
List<IpPortCfg> ipPortList = appCfgDao.getAppPolicyIpList(policy);
policy.setIpPortList(ipPortList);
return policy;
}
public AppIpCfg getAppIpCfg(Long cfgId){
return appCfgDao.getAppIpCfg(cfgId);
@@ -116,6 +120,13 @@ public class AppCfgService extends BaseService {
entity.setIsValid(0);
entity.setIsAudit(0);
appCfgDao.insertAppPolicyCfg(entity);
//保存策略IP配置
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
appCfgDao.insertAppPolicyIpCfg(cfg);
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
@@ -134,15 +145,25 @@ public class AppCfgService extends BaseService {
entity.setEditTime(new Date());
entity.setIsValid(0);
entity.setIsAudit(0);
appCfgDao.updateAppPolicyCfg(entity);
appCfgDao.updateAppPolicyCfg(entity);
appCfgDao.deleteAppPolicyIpCfg(entity);
//删除旧的区域IP新增新的区域IP
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
areaIpCfgDao.deleteAreaIpCfg(area);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
//保存策略IP配置
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
appCfgDao.insertAppPolicyIpCfg(cfg);
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
@@ -390,19 +411,37 @@ public class AppCfgService extends BaseService {
List<IpCfg> areaIpRegionList = new ArrayList();
entity.setTableName(AppPolicyCfg.getTablename());
appCfgDao.auditCfg(entity);
if(isAudit==1){
if(entity.getBehavCode()!=null){
entity.setCfgKeywords(entity.getAppCode()+"&"+entity.getBehavCode());
}else{
entity.setCfgKeywords(entity.getAppCode()+"");
}
List<AppPolicyCfg> list = new ArrayList();
list.add(entity);
Map<String,List> map = cfgConvert(strRegionList,list,2,entity,groupRelationList);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
//查询子配置并修改审核状态
entity = this.getAppPolicyCfg(entity.getCfgId());
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(IpPortCfg.getTablename());
appCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<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"));
}
}
}
//保存区域IP信息
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
if(!StringUtil.isEmpty(areaIpCfgList)){
@@ -810,6 +849,15 @@ public class AppCfgService extends BaseService {
entity.setTableName(AppPolicyCfg.getTablename());
entity.setFunctionId(functionId);
appCfgDao.updateCfgValid(entity);
//查询子配置
entity = this.getAppPolicyCfg(Long.parseLong(id));
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(IpPortCfg.getTablename());
appCfgDao.updateCfgValid(cfg);
}
//保存区域IP信息
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
AreaIpCfg cfg = new AreaIpCfg();

View File

@@ -366,40 +366,19 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
maatCfg.setIsValid(entity.getIsValid());
//判断http配置是否需要设置自定义域参数
String actionValue = DictUtils.getDictCode("SERVICE_ACTION", "action_monit");
String userRegion = "";
//只有监测业务,并且头域的匹配区域不匹配字典中的信息时需要设置
if(!actionValue.equals("默认") && entity.getAction().equals(Integer.parseInt(actionValue))){
//请求头域
if(entity.getHttpReqHdrList()!=null && entity.getHttpReqHdrList().size()>0){
for(ComplexkeywordCfg head:entity.getHttpReqHdrList()){
String dictValue = DictUtils.getDictCode("REQUEST_HEADER_DISTRICT", head.getDistrict());
if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){
if(userRegion.equals("")){
userRegion += "HTTP_HEADER="+head.getDistrict();
}else{
userRegion += Constants.USER_REGION_SPLIT+"HTTP_HEADER="+head.getDistrict();
}
}
}
if(!StringUtil.isEmpty(entity.getUserRegion1())){
if(entity.getUserRegion1().startsWith(Constants.REDIRECT_RESPONSE_CODE_STARTWITH)){
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+entity.getUserRegion1()+
Constants.USER_REGION_SPLIT+
Constants.REDIRECT_URL_KEY+"="+entity.getUserRegion2();
}else{
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+entity.getUserRegion1()+
Constants.USER_REGION_SPLIT+
Constants.REDIRECT_CONTENT_KEY+"="+entity.getUserRegion2();
}
//应答头域
if(entity.getHttpResHdrList()!=null && entity.getHttpResHdrList().size()>0){
for(ComplexkeywordCfg head:entity.getHttpResHdrList()){
String dictValue = DictUtils.getDictCode("RESPONSE_HEADER_DISTRICT", head.getDistrict());
if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){
if(userRegion.equals("")){
userRegion += "HTTP_HEADER="+head.getDistrict();
}else{
userRegion += Constants.USER_REGION_SPLIT+"HTTP_HEADER="+head.getDistrict();
}
}
}
}
maatCfg.setUserRegion(userRegion);
}
maatCfg.setUserRegion(userRegion);
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(entity.getAuditTime());

View File

@@ -4,12 +4,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.jets3t.service.ServiceException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -20,7 +16,6 @@ import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.callback.InlineIp;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.IpCfgTemplate;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.MaatCfg.DigestCfg;
@@ -233,6 +228,19 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
}else if(Constants.SERVICE_IP_RATELIMIT==cfg.getServiceId().intValue()){
maatCfg.setUserRegion(Constants.USERREGION_RATE_LIMIT+"="+cfg.getRatelimit());
}
if(!StringUtil.isEmpty(cfg.getUserRegion1())){
String userRegion = "";
if(cfg.getUserRegion1().startsWith(Constants.REDIRECT_RESPONSE_CODE_STARTWITH)){
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+cfg.getUserRegion1()+
Constants.USER_REGION_SPLIT+
Constants.REDIRECT_URL_KEY+"="+cfg.getUserRegion2();
}else{
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+cfg.getUserRegion1()+
Constants.USER_REGION_SPLIT+
Constants.REDIRECT_CONTENT_KEY+"="+cfg.getUserRegion2();
}
maatCfg.setUserRegion(userRegion);
}
configCompileList.add(maatCfg);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setConfigCompileList(configCompileList);