Merge branch 'develop' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop

This commit is contained in:
zhangwei
2019-01-17 10:51:08 +06:00
10 changed files with 88 additions and 64 deletions

View File

@@ -109,7 +109,7 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
@SerializedName("isHexbin")
private Integer isHexbin;
@ExcelField(title="log_total",sort=31)
@ExcelField(title="log_total",sort=43)
private Long totalLogs;
private List<IpPortCfg> ipPortList;

View File

@@ -204,7 +204,7 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
/**
* 是否区域gk
*/
@ExcelField(title="whether_area_block",dictType="WHETHER_AREA_BLOCK",sort=40)
@ExcelField(title="whether_area_block",dictType="WHETHER_AREA_BLOCK",sort=45)
protected Integer isAreaEffective;
/**
* 分类
@@ -270,9 +270,9 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
/**
* do_log属性在界面do_log:0不需要1记录所有日志2只记录结构化日志。默认是2
*/
@ExcelField(title="do_log",dictType="DO_LOG",sort=30)
@ExcelField(title="do_log",dictType="DO_LOG",sort=40)
protected Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
@ExcelField(title="do_blacklist",dictType="DO_BLACKLIST",sort=31)
@ExcelField(title="do_blacklist",dictType="DO_BLACKLIST",sort=41)
protected Integer doBlackList=Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT;
protected Integer groupId;//仅用于copy属性使用
protected Integer regionId;//仅用于copy属性使用

View File

@@ -86,12 +86,8 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
private String country;
private String detail;
private List<AsnKeywordCfg> asnKeywords;
@ExcelField(title="log_total",sort=31)
@ExcelField(title="log_total",sort=42)
private Long totalLogs;
@ExcelField(title="is_audit",dictType="AUDIT_STATUS",sort=20)
private Integer isAudit;
@ExcelField(title="do_log",dictType="DO_LOG",sort=27)
private Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
/*private CachePolicyUserRegion cachePolicyUserRegion;//缓存策略用户自定义域参数
@@ -102,19 +98,6 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
}
}*/
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Integer getDoLog() {
return doLog;
}
public void setDoLog(Integer doLog) {
this.doLog = doLog;
}
public String getOrganization() {
return organization;
}

View File

@@ -218,7 +218,7 @@ public class DnsIpCfgController extends BaseController {
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), DnsIpCfg.class);
String cfgIndexInfoNoExport = ",whether_area_block,client_ip,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
String cfgIndexInfoNoExport = ",log_total,whether_area_block,client_ip,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {

View File

@@ -500,12 +500,14 @@ public class WhiteListController extends CommonController {
for (Integer id : set) {
serviceIds.append(id+",");
}
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
//获取日志总量
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
logTotals.addAll(logs);
if(serviceIds.length()>1&&compileIds.length()>1){
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
//获取日志总量
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
logTotals.addAll(logs);
}
}
titleList.add(entity.getMenuNameCode());
titleList.add("NTC_HTTP_URL");

View File

@@ -3,9 +3,11 @@ package com.nis.web.controller.configuration.proxy;
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;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -273,6 +275,35 @@ public class InterceptController extends CommonController {
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
ipLists = page.getList();
}
//日志总量
List<Map<String,Object>> logTotals=new ArrayList<Map<String,Object>>();
StringBuilder compileIds=new StringBuilder(",");//配置ids
Set<Integer> set=new HashSet<Integer>();//服务ids
for (CfgIndexInfo cfg : ipLists) {
if(cfg.getIsAudit()!=0){
set.add(cfg.getServiceId());
compileIds.append(cfg.getCompileId()+",");
}else{
Map<String,Object> logTotal=new HashMap<String,Object>();
logTotal.put("compileId", cfg.getCompileId()+"");
logTotal.put("sum",0L);
logTotals.add(logTotal);
}
}
StringBuilder serviceIds=new StringBuilder(",");
for (Integer id : set) {
serviceIds.append(id+",");
}
if(serviceIds.length()>1&&compileIds.length()>1){
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
//获取日志总量
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
logTotals.addAll(logs);
}
}
// 获取证书信息
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
if (entity.getFunctionId().equals(200)) {
@@ -325,6 +356,12 @@ public class InterceptController extends CommonController {
List<BaseStringCfg> httpUrlList = new ArrayList<BaseStringCfg>();
List<BaseStringCfg> pktBinList = new ArrayList<BaseStringCfg>();
for (CfgIndexInfo cfg : ipLists) {
for (Map<String,Object> logTotal : logTotals) {
if(cfg.getCompileId().equals(Integer.parseInt((String) logTotal.get("compileId")))){
cfg.setTotalLogs((Long)logTotal.get("sum"));
break;
}
}
Map<String, List> maps = interceptCfgService.exportIpInfo(cfg);
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
ipList.addAll(maps.get("PXY_INTERCEPT_IP"));
@@ -346,7 +383,7 @@ public class InterceptController extends CommonController {
httpUrlList = BaseStringCfg.baseHexList(httpUrlList);
dataMap.put(entity.getMenuNameCode(), ipLists);
if (entity.getFunctionId() == 212) { // IP Payload
cfgIndexInfoNoExport = ",do_log,log_total,policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
cfgIndexInfoNoExport = ",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
titleList.add("PXY_INTERCEPT_IP");
titleList.add("PXY_INTERCEPT_PKT_BIN");
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);

View File

@@ -0,0 +1,2 @@
--->->IP白名单
INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1241', '1240', '0,1,152,1240,', 'ip_whitelist', 'IP White List', '1', '/log/ntc/ipWhiteList', '', '', '1', '', '1', '2019-01-16 14:52:55', '1', '2019-01-16 17:27:31', '', '1', NULL, '0', '0', '3');

View File

@@ -332,12 +332,12 @@
<th column="config_describe" class="sort-column r.cfg_desc"><spring:message code="config_describe"/></th>
<th column="block_type" class="sort-column r.action"><spring:message code="block_type"/></th>
<th column="group" ><spring:message code="group"/></th>
<th column="is_audit" ><spring:message code="is_audit"/></th>
<th column="ip_type" ><spring:message code="ip_type"/></th>
<th column="IP" ><spring:message code="IP"/></th>
<%-- <th column="port" ><spring:message code="port"/></th> --%>
<th column="ip_pattern" ><spring:message code="ip_pattern"/></th>
<th column="IP" ><spring:message code="IP"/></th>
<%-- <th column="port_pattern" ><spring:message code="port_pattern"/></th> --%>
<th column="is_audit" ><spring:message code="is_audit"/></th>
<th column="letter" ><spring:message code="letter"/></th>
<th column="classification" ><spring:message code="classification"/></th>
<th column="attribute" ><spring:message code="attribute"/></th>
@@ -371,12 +371,19 @@
<spring:message code="default_group"/>
</c:if>
</td>
<td>
<c:choose>
<c:when test="${cfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
<c:when test="${cfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
<c:when test="${cfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
<c:when test="${cfg.isAudit eq '3'}"><span indexTable="${cfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon="&#xe01e;"> <spring:message code="cancel_approved"/></span></c:when>
</c:choose>
</td>
<td>
<c:forEach items="${fns:getDictList('IP_TYPE')}" var="ipTypeC">
<c:if test="${cfg.ipType==ipTypeC.itemCode}"><spring:message code="${ipTypeC.itemValue }"/></c:if>
</c:forEach>
</td>
<td title="${cfg.destIpAddress }">${fns:abbr(cfg.destIpAddress, 42)}</td>
<%-- <td>${cfg.destPort }</td> --%>
<td>
<c:forEach items="${fns:getDictList('IP_PATTERN')}" var="ipPatternC">
@@ -388,14 +395,7 @@
<c:if test="${cfg.portPattern eq portPatternC.itemCode}"><spring:message code="${portPatternC.itemValue }"/></c:if>
</c:forEach>
</td> --%>
<td>
<c:choose>
<c:when test="${cfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
<c:when test="${cfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
<c:when test="${cfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
<c:when test="${cfg.isAudit eq '3'}"><span indexTable="${cfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon="&#xe01e;"> <spring:message code="cancel_approved"/></span></c:when>
</c:choose>
</td>
<td title="${cfg.destIpAddress }">${fns:abbr(cfg.destIpAddress, 42)}</td>
<td>${cfg.requestName }</td>
<td >
<c:set var="classify"></c:set>

View File

@@ -409,14 +409,14 @@
<th column="userregion1" ><spring:message code="intercept_intensity"/></th>
</c:if> --%>
<th column="is_audit" ><spring:message code="is_audit"/></th>
<th column="do_log" ><spring:message code="do_log"/></th>
<th column="log_total" ><spring:message code="log_total"/></th>
<th column="whether_area_block" ><spring:message code="whether_area_block"/></th>
<th column="letter" ><spring:message code="letter"/></th>
<th column="classification" ><spring:message code="classification"/></th>
<th column="attribute" ><spring:message code="attribute"/></th>
<th column="label" ><spring:message code="label"/></th>
<th column="valid_identifier" class="sort-column a.is_valid"><spring:message code="valid_identifier"/></th>
<th column="do_log" ><spring:message code="do_log"/></th>
<th column="log_total" ><spring:message code="log_total"/></th>
<th column="creator" ><spring:message code="creator"/></th>
<th column="config_time" class="sort-column a.create_time"><spring:message code="config_time"/></th>
<th column="editor" ><spring:message code="editor"/></th>
@@ -552,6 +552,14 @@
<c:when test="${indexCfg.isAudit eq '3'}"><span indexTable="${indexCfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon="&#xe01e;"> <spring:message code="cancel_approved"/></span></c:when>
</c:choose>
</td>
<td>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.doLog and indexCfg.action!=64 }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td audit="${indexCfg.isAudit}" functionId="${indexCfg.functionId}" compileId="${indexCfg.compileId}" action="${indexCfg.action}"><div class="loading-total"></div></td>
<td>
<c:if test="${indexCfg.isAreaEffective==0}"><spring:message code="all"/></c:if>
<c:if test="${indexCfg.isAreaEffective==1}">
@@ -624,14 +632,6 @@
<c:if test="${indexCfg.isValid==1}"><spring:message code="yes"/></c:if>
<c:if test="${indexCfg.isValid==-1}"><spring:message code="deleted"/></c:if>
</td>
<td>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.doLog and indexCfg.action!=64 }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</td>
<td audit="${indexCfg.isAudit}" functionId="${indexCfg.functionId}" compileId="${indexCfg.compileId}" action="${indexCfg.action}"><div class="loading-total"></div></td>
<td>${indexCfg.creatorName }</td>
<td><fmt:formatDate value="${indexCfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
<td>${indexCfg.editorName }</td>

View File

@@ -375,9 +375,9 @@
<th column="label" ><spring:message code="label"/></th> --%>
<th column="is_audit" ><spring:message code="is_audit"/></th>
<th column="valid_identifier" class="sort-column a.is_valid"><spring:message code="valid_identifier"/></th>
<th column="do_log" ><spring:message code="do_log"/></th>
<th column="log_total" ><spring:message code="log_total"/></th>
<th column="valid_identifier" class="sort-column a.is_valid"><spring:message code="valid_identifier"/></th>
<th column="creator" ><spring:message code="creator"/></th>
<th column="config_time" class="sort-column a.create_time"><spring:message code="config_time"/></th>
<th column="editor" ><spring:message code="editor"/></th>
@@ -477,11 +477,6 @@
<c:when test="${indexCfg.isAudit eq '3'}"><span class="label label-warning"><spring:message code="cancel_approved"></spring:message></span></c:when>
</c:choose>
</td>
<td>
<c:if test="${indexCfg.isValid==0}"><spring:message code="no"/></c:if>
<c:if test="${indexCfg.isValid==1}"><spring:message code="yes"/></c:if>
<c:if test="${indexCfg.isValid==-1}"><spring:message code="deleted"/></c:if>
</td>
<td>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.doLog }">
@@ -490,6 +485,11 @@
</c:forEach>
</td>
<td audit="${indexCfg.isAudit}" functionId="${indexCfg.functionId}" compileId="${indexCfg.compileId}" action="${indexCfg.action}" serviceId="${indexCfg.serviceId}"><div class="loading-total"></div></td>
<td>
<c:if test="${indexCfg.isValid==0}"><spring:message code="no"/></c:if>
<c:if test="${indexCfg.isValid==1}"><spring:message code="yes"/></c:if>
<c:if test="${indexCfg.isValid==-1}"><spring:message code="deleted"/></c:if>
</td>
<td>${indexCfg.creatorName }</td>
<td><fmt:formatDate value="${indexCfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
<td>${indexCfg.editorName }</td>