1、接口date类型去掉时区,并将日期格式设置为yyyy-MM-dd HH:mm:ss;

2、添加配置日志总量统计服务接口示例;
3、为DNS响应策略配置(service=65)和DNS欺骗地址(service=65)添加配置文件;
This commit is contained in:
zhangdongxu
2018-06-22 10:48:53 +08:00
parent 2185421a3b
commit ec90d8867b
21 changed files with 560 additions and 159 deletions

View File

@@ -11,6 +11,7 @@ package com.nis.domain.restful;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.nis.util.JsonDateSerializer;
@@ -29,6 +30,7 @@ public abstract class ConfigCommonSource implements Serializable {
private static final long serialVersionUID = 152715081015545848L;
protected String version;//默认版本1.0
protected String operator;//操作人员
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
protected Date opTime;//操作时间
protected Integer opAction;//操作行为 1-插入 2-更新 3-删除 4-查询(暂无)
/**

View File

@@ -12,9 +12,7 @@ import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.nis.util.JsonDateSerializer;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wordnik.swagger.annotations.ApiModelProperty;
/**
@@ -52,9 +50,11 @@ public class ConfigCompile implements Serializable {
private Integer doLog;
@ApiModelProperty(value = "生效范围", required = true)
private String effectiveRange;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "开始时间", required = true)
private Date startTime;
@ApiModelProperty(value = "结束时间", required = true)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date endTime;
@ApiModelProperty(value = "用户自定义域", required = true)
private String userRegion;
@@ -65,6 +65,7 @@ public class ConfigCompile implements Serializable {
@ApiModelProperty(value = "父配置ID", required = true)
private Long fatherCfgId;
@ApiModelProperty(value = "操作时间", required = true)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date opTime;
@ApiModelProperty(value = "编译分组关系列表", required = true)
@@ -196,7 +197,6 @@ public class ConfigCompile implements Serializable {
/**
* @return startTime
*/
@JsonSerialize(using=JsonDateSerializer.class)
public Date getStartTime() {
return startTime;
}
@@ -212,7 +212,6 @@ public class ConfigCompile implements Serializable {
/**
* @return endTime
*/
@JsonSerialize(using=JsonDateSerializer.class)
public Date getEndTime() {
return endTime;
}
@@ -288,7 +287,6 @@ public class ConfigCompile implements Serializable {
/**
* @return opTime
*/
@JsonSerialize(using=JsonDateSerializer.class)
public Date getOpTime() {
return opTime;
}

View File

@@ -11,9 +11,7 @@ package com.nis.domain.restful;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.nis.util.JsonDateSerializer;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wordnik.swagger.annotations.ApiModelProperty;
/**
@@ -36,6 +34,7 @@ public class ConfigGroupRelation implements Serializable {
@ApiModelProperty(value = "有效标志", required = true)
private Integer isValid;
@ApiModelProperty(value = "操作时间", required = true)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date opTime;
@@ -87,7 +86,6 @@ public class ConfigGroupRelation implements Serializable {
/**
* @return opTime
*/
@JsonSerialize(using = JsonDateSerializer.class)
public Date getOpTime() {
return opTime;
}

View File

@@ -11,7 +11,9 @@ package com.nis.domain.restful;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.nis.util.JsonDateDeserializer;
import com.nis.util.JsonDateSerializer;
/**
@@ -82,6 +84,7 @@ public class ConfigSource extends ConfigCommonSource{
/**
* @param opTime 要设置的 opTime
*/
@JsonDeserialize(using=JsonDateDeserializer.class)
public void setOpTime(Date opTime) {
this.opTime = opTime;
}

View File

@@ -3,6 +3,8 @@ package com.nis.domain.restful;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
public class DigestRegion implements Serializable{
/**
@@ -16,6 +18,7 @@ public class DigestRegion implements Serializable{
private String digest;
private Integer cfdsLevel;
private int isValid ;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date opTime = new Date();
public Long getRegionId() {
return regionId;
@@ -59,9 +62,17 @@ public class DigestRegion implements Serializable{
public void setIsValid(int isValid) {
this.isValid = isValid;
}
/**
* @return opTime
*/
public Date getOpTime() {
return opTime;
}
/**
* @param opTime 要设置的 opTime
*/
public void setOpTime(Date opTime) {
this.opTime = opTime;
}

View File

@@ -11,9 +11,8 @@ package com.nis.domain.restful;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.nis.util.JsonDateSerializer;
import com.wordnik.swagger.annotations.ApiModelProperty;
/**
@@ -62,6 +61,7 @@ public class IpRegion implements Serializable {
@ApiModelProperty(value="有效标志", required=true)
private Integer isValid;
@ApiModelProperty(value="操作时间", required=true)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date opTime;
@ApiModelProperty(value="版本序列号", required=true)
private Long procSeq;
@@ -286,7 +286,6 @@ public class IpRegion implements Serializable {
/**
* @return opTime
*/
@JsonSerialize(using=JsonDateSerializer.class)
public Date getOpTime() {
return opTime;
}

View File

@@ -10,48 +10,21 @@ public class NtcHttpLog extends LogEntity {
private static final long serialVersionUID = 2553033624540656138L;
@ApiModelProperty(value="TCP初始序列号", required=true)
protected Long c2sIsn;
@ApiModelProperty(value="是否HTTP代理标志", required=true)
protected Long httpProxyFlag;
@ApiModelProperty(value="HTTP会话序列号", required=true)
protected Long httpSeq;
@ApiModelProperty(value="url地址", required=true)
protected String url;
@ApiModelProperty(value="请求", required=true)
protected String reqLine;
@ApiModelProperty(value="请求头转储文件", required=true)
protected String reqHdrFile;
@ApiModelProperty(value="应答行", required=true)
protected String resLine;
@ApiModelProperty(value="请求体转储文件", required=true)
protected String reqBodyFile;
@ApiModelProperty(value="应答头转储文件", required=true)
protected String resHdrFile;
public Long getC2sIsn() {
return c2sIsn;
}
@ApiModelProperty(value="应答体转储文件", required=true)
protected String resBodyFile;
public void setC2sIsn(Long c2sIsn) {
this.c2sIsn = c2sIsn;
}
public Long getHttpProxyFlag() {
return httpProxyFlag;
}
public void setHttpProxyFlag(Long httpProxyFlag) {
this.httpProxyFlag = httpProxyFlag;
}
public Long getHttpSeq() {
return httpSeq;
}
public void setHttpSeq(Long httpSeq) {
this.httpSeq = httpSeq;
}
public String getUrl() {
return url;
@@ -61,19 +34,36 @@ public class NtcHttpLog extends LogEntity {
this.url = url;
}
public String getReqLine() {
return reqLine;
public String getReqHdrFile() {
return reqHdrFile;
}
public void setReqLine(String reqLine) {
this.reqLine = reqLine;
public void setReqHdrFile(String reqHdrFile) {
this.reqHdrFile = reqHdrFile;
}
public String getResLine() {
return resLine;
public String getReqBodyFile() {
return reqBodyFile;
}
public void setResLine(String resLine) {
this.resLine = resLine;
public void setReqBodyFile(String reqBodyFile) {
this.reqBodyFile = reqBodyFile;
}
public String getResHdrFile() {
return resHdrFile;
}
public void setResHdrFile(String resHdrFile) {
this.resHdrFile = resHdrFile;
}
public String getResBodyFile() {
return resBodyFile;
}
public void setResBodyFile(String resBodyFile) {
this.resBodyFile = resBodyFile;
}
}

View File

@@ -0,0 +1,180 @@
package com.nis.domain.restful;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
import javax.xml.bind.annotation.XmlTransient;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.util.JsonDateSerializer;
import com.wordnik.swagger.annotations.ApiModelProperty;
public class NtcPzReport implements Serializable{
private static final long serialVersionUID = 987165268916441272L;
@ApiModelProperty(value="配置ID", required=true)
protected Long cfgId;
@ApiModelProperty(value="业务类型", required=true)
protected Integer service;
@ApiModelProperty(value="日志数量", required=true)
protected Long sum;
@ApiModelProperty(value="统计时间", required=true)
protected Date reportTime;
/**
* 业务类型1:配置命中总量业务 2:配置报表业务
*/
protected String searchBusinessType = "1";
protected String searchReportStartTime;
protected String searchReportEndTime;
protected Long searchReportStartTimeCluster;
protected Long searchReportEndTimeCluster;
protected String searchService;
protected String searchCfgId;
protected Page<NtcPzReport> page;
/**
* 自定义SQLSQL标识SQL内容
*/
protected Map<String, String> sqlMap;
/**
*
*/
public NtcPzReport() {
super();
// TODO Auto-generated constructor stub
}
/**
* @param cfgId
* @param service
*/
public NtcPzReport(Long cfgId, Long sum) {
super();
this.cfgId = cfgId;
this.sum = sum;
}
public Long getCfgId() {
return cfgId;
}
public void setCfgId(Long cfgId) {
this.cfgId = cfgId;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Long getSum() {
return sum;
}
public void setSum(Long sum) {
this.sum = sum;
}
@JsonSerialize(using=JsonDateSerializer.class)
public Date getReportTime() {
return reportTime;
}
public void setReportTime(Date reportTime) {
this.reportTime = reportTime;
}
@JsonIgnore
public String getSearchBusinessType() {
return searchBusinessType;
}
public void setSearchBusinessType(String searchBusinessType) {
this.searchBusinessType = searchBusinessType;
}
@JsonIgnore
public String getSearchReportStartTime() {
return searchReportStartTime;
}
public void setSearchReportStartTime(String searchReportStartTime) {
this.searchReportStartTime = searchReportStartTime;
}
@JsonIgnore
public String getSearchReportEndTime() {
return searchReportEndTime;
}
public void setSearchReportEndTime(String searchReportEndTime) {
this.searchReportEndTime = searchReportEndTime;
}
@JsonIgnore
public Long getSearchReportStartTimeCluster() {
return searchReportStartTimeCluster;
}
public void setSearchReportStartTimeCluster(Long searchReportStartTimeCluster) {
this.searchReportStartTimeCluster = searchReportStartTimeCluster;
}
@JsonIgnore
public Long getSearchReportEndTimeCluster() {
return searchReportEndTimeCluster;
}
public void setSearchReportEndTimeCluster(Long searchReportEndTimeCluster) {
this.searchReportEndTimeCluster = searchReportEndTimeCluster;
}
@JsonIgnore
public String getSearchService() {
return searchService;
}
public void setSearchService(String searchService) {
this.searchService = searchService;
}
@JsonIgnore
public String getSearchCfgId() {
return searchCfgId;
}
public void setSearchCfgId(String searchCfgId) {
this.searchCfgId = searchCfgId;
}
@JsonIgnore
@XmlTransient
public Page<NtcPzReport> getPage() {
if (page == null){
page = new Page<NtcPzReport>();
}
return page;
}
public Page<NtcPzReport> setPage(Page<NtcPzReport> page) {
this.page = page;
return page;
}
@JsonIgnore
@XmlTransient
public Map<String, String> getSqlMap() {
if (sqlMap == null){
sqlMap = Maps.newHashMap();
}
return sqlMap;
}
public void setSqlMap(Map<String, String> sqlMap) {
this.sqlMap = sqlMap;
}
}

View File

@@ -11,9 +11,8 @@ package com.nis.domain.restful;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.nis.util.JsonDateSerializer;
import com.wordnik.swagger.annotations.ApiModelProperty;
/**
@@ -45,6 +44,7 @@ public class NumRegion implements Serializable{
@ApiModelProperty(value="是否有效", required=true)
private int isValid;
@ApiModelProperty(value="操作时间", required=true)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date opTime;
@ApiModelProperty(value="版本序列号", required=true)
private Long procSeq;
@@ -145,7 +145,6 @@ public class NumRegion implements Serializable{
/**
* @return opTime
*/
@JsonSerialize(using=JsonDateSerializer.class)
public Date getOpTime() {
return opTime;
}

View File

@@ -11,9 +11,8 @@ package com.nis.domain.restful;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.nis.util.JsonDateSerializer;
import com.wordnik.swagger.annotations.ApiModelProperty;
/**
@@ -48,6 +47,7 @@ public class StrRegion implements Serializable {
@ApiModelProperty(value="是否有效", required=true)
private int isValid;
@ApiModelProperty(value="操作时间", required=true)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date opTime;
@ApiModelProperty(value="版本序列号", required=true)
private Long procSeq;
@@ -172,7 +172,6 @@ public class StrRegion implements Serializable {
/**
* @return opTime
*/
@JsonSerialize(using=JsonDateSerializer.class)
public Date getOpTime() {
return opTime;
}

View File

@@ -4,9 +4,7 @@
package com.nis.util;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -22,7 +20,7 @@ import com.fasterxml.jackson.databind.JsonDeserializer;
*/
public class JsonDateDeserializer extends JsonDeserializer<Date> {
private static final SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// private static final SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/* (non-Javadoc)
* @see com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext)
*/
@@ -31,10 +29,8 @@ public class JsonDateDeserializer extends JsonDeserializer<Date> {
throws IOException, JsonProcessingException {
// TODO Auto-generated method stub
Date date = null;
try {
date = sdf.parse(p.getText());
} catch (Exception e) {
// TODO: handle exception
if (null!=p&&!"".equals(p.getText())) {
date = DateUtil.convertStringToDate(p.getText(), DateUtil.YYYY_MM_DD_HH24_MM_SS);
}
return date;
}

View File

@@ -11,6 +11,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONObject;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -19,7 +21,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.nis.domain.restful.ConfigCompile;
import com.nis.domain.restful.ConfigSource;
@@ -44,8 +45,6 @@ import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import net.sf.json.JSONObject;
/**
* @ClassName: ConfigSourcesController
* @Description: 配置存储服务
@@ -339,6 +338,7 @@ public class ConfigSourcesController extends BaseRestController {
validateConfigSource(thread, start, configSource);
Long benginTime = System.currentTimeMillis();
String msg = configSourcesService.saveMaatConfig(thread, start, configSource.getConfigCompileList(), sb);
// String msg = "";
if ("error".equals(msg)) {
Exception exception = ConfigSourcesService.getMsgList().get(0);
throw new RestServiceException(thread, System.currentTimeMillis() - start,
@@ -635,7 +635,7 @@ public class ConfigSourcesController extends BaseRestController {
}
JSONObject jsonObj = new JSONObject();
// jsonObj.put("accessUrl", filePath.substring(filePath.indexOf("group")));
jsonObj.put("accessUrl", "filePath");
jsonObj.put("accessUrl", filePath);
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "文件上传成功", jsonObj);
}
@@ -647,7 +647,6 @@ public class ConfigSourcesController extends BaseRestController {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
file, null);
// JSONArray fileArray=new JSONArray();
if (file == null) {
thread.setExceptionInfo("请上传获取摘要的文件到file");
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请上传获取摘要的文件到file参数",
@@ -681,21 +680,24 @@ public class ConfigSourcesController extends BaseRestController {
// resultObject.put("path", filePath.substring(filePath.indexOf("group")));
resultObject.put("path", filePath);
}
String tempFilePath = request.getRealPath(File.separator) + "upload" + File.separator
+ (new Date()).getTime() + file.getOriginalFilename();
file.transferTo(new File(tempFilePath));
System.out.println("------------" + tempFilePath);
String digestStr = configSourcesService.getDigestGen(request.getRealPath(File.separator), tempFilePath);
resultObject.put("digest", digestStr);
resultObject.put("rawLen", file.getSize());
FileUtils.deleteFile(tempFilePath);
} catch (IOException e) {
// TODO Auto-generated catch block
logger.error("文件上传过程中出现异常");
thread.setExceptionInfo("文件上传过程中出现异常");
throw new RestServiceException(thread, System.currentTimeMillis() - start, "文件上传过程中出现异常",
RestBusinessCode.unknow_error.getValue());
}
try {
String tempFilePath = request.getRealPath(File.separator) + "upload" + File.separator
+ (new Date()).getTime() + file.getOriginalFilename();
file.transferTo(new File(tempFilePath));
//System.out.println("------------" + tempFilePath);
System.out.println("摘要获取开始:---------------");
String digestStr = configSourcesService.getDigestGen(request.getRealPath(File.separator), tempFilePath);
System.out.println("摘要获取结束:---------------:"+digestStr);
resultObject.put("digest", digestStr);
resultObject.put("rawLen", file.getSize());
FileUtils.deleteFile(tempFilePath);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();

View File

@@ -1,7 +1,29 @@
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page;
import com.nis.domain.restful.*;
import com.nis.domain.restful.NtcDnsLog;
import com.nis.domain.restful.NtcFtpLog;
import com.nis.domain.restful.NtcHttpLog;
import com.nis.domain.restful.NtcIpLog;
import com.nis.domain.restful.NtcIpsecLog;
import com.nis.domain.restful.NtcL2tpLog;
import com.nis.domain.restful.NtcMailLog;
import com.nis.domain.restful.NtcOpenvpnLog;
import com.nis.domain.restful.NtcPptpLog;
import com.nis.domain.restful.NtcPzReport;
import com.nis.domain.restful.NtcSshLog;
import com.nis.domain.restful.NtcSslLog;
import com.nis.util.Constants;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
@@ -9,15 +31,6 @@ import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.LogTestService;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* Created by darnell on 2018/6/10.
@@ -112,7 +125,7 @@ public class LogController extends BaseRestController{
}
@RequestMapping(value = "/ntcSSLLogs", method = RequestMethod.GET)
@RequestMapping(value = "/ntcSslLogs", method = RequestMethod.GET)
@ApiOperation(value = "SSL日志查询", httpMethod = "GET", notes = "对应配置为“网站管理-SSL”存储动作为阻断与监测的命中日志。对日志功能“网站管理-SSL”提供数据基础查询服务。")
public Map<String, ?> ntcSslLogs(Page page, NtcSslLog ntcSslLog, Model model, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
@@ -251,7 +264,21 @@ public class LogController extends BaseRestController{
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "FTP日志检索成功", ntcFtpLogPage, 0);
}
@RequestMapping(value = "/ntcPzReport", method = RequestMethod.GET)
@ApiOperation(value = "配置日志总量统计", httpMethod = "GET", notes = "配置命中日志数量实时统计报表,对外提供多种数据表现形式,具体可应用于界面配置命中总量业务、配置报表业务等")
public Map<String, ?> ntcPzReport(Page page, NtcPzReport ntcPzReport, Model model, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
Page<?> ntcPzReportPage = new Page<>();
try {
ntcPzReportPage = testService.findNtcPzReport(new Page<NtcPzReport>(request, response,NtcPzReport.class), ntcPzReport);
} catch(Exception e) {
e.printStackTrace();
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "配置总量统计成功", ntcPzReportPage, 0);
}
}

View File

@@ -13,7 +13,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.CountDownLatch;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -99,7 +98,7 @@ public class ConfigSourcesService extends BaseService {
@Autowired
private StrRegionDao strRegionDao;
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Autowired
ConfigRedisService configRedisService;
@@ -1640,7 +1639,7 @@ public class ConfigSourcesService extends BaseService {
}
private String convertToTimeStamp16(Date date){
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
// sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
return date.getTime()+"000";
}
@@ -2509,7 +2508,7 @@ public class ConfigSourcesService extends BaseService {
break;
case "Date":
try {
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
// sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
System.out.println("--------------------TimeZone:"+sdf.getTimeZone());
Date date = sdf.parse(dstStr);
dstStr = date.getTime()+"000";
@@ -2542,12 +2541,26 @@ public class ConfigSourcesService extends BaseService {
//range取值范围验证
if(!StringUtil.isEmpty(commonSourceFieldCfg.getRange())){
String [] range= commonSourceFieldCfg.getRange().split("-");
Boolean flag = false;
if (range.length==2) {
if(!(Long.valueOf(range[0]).compareTo(Long.valueOf(dstStr))<=0&&Long.valueOf(range[1]).compareTo(Long.valueOf(dstStr))>=0)){
logger1.error(commonSourceFieldCfg.getSrcName()+"参数不在有效范围");
thread.setExceptionInfo(commonSourceFieldCfg.getSrcName()+"参数不在有效范围");
throw new RestServiceException(thread, System.currentTimeMillis() - start, commonSourceFieldCfg.getSrcName()+"参数不在有效范围",
RestBusinessCode.wrong_range.getValue());
flag = true;
}
}else if (commonSourceFieldCfg.getRange().startsWith("-")) {//只有最大值限制
if(Long.valueOf(range[0]).compareTo(Long.valueOf(dstStr))<=0){
flag = true;
}
}else if (commonSourceFieldCfg.getRange().endsWith("-")) {//只有最小值限制
if(Long.valueOf(range[0]).compareTo(Long.valueOf(dstStr))>=0){
flag = true;
}
}
if (flag) {
logger1.error(commonSourceFieldCfg.getSrcName()+"参数不在有效范围("+ commonSourceFieldCfg.getRange()+")");
thread.setExceptionInfo(commonSourceFieldCfg.getSrcName()+"参数不在有效范围("+ commonSourceFieldCfg.getRange()+")");
throw new RestServiceException(thread, System.currentTimeMillis() - start, commonSourceFieldCfg.getSrcName()+"参数不在有效范围("+ commonSourceFieldCfg.getRange()+")",
RestBusinessCode.wrong_range.getValue());
}
}
//regexp 特殊格式正则验证
@@ -2560,9 +2573,9 @@ public class ConfigSourcesService extends BaseService {
if (valFlag) {
dstMap.put(commonSourceFieldCfg.getDstName(),dstStr);
}else{
logger1.error(commonSourceFieldCfg.getSrcName()+"参数格式与正则不匹配");
thread.setExceptionInfo(commonSourceFieldCfg.getSrcName()+"参数格式与正则不匹配");
throw new RestServiceException(thread, System.currentTimeMillis() - start, commonSourceFieldCfg.getSrcName()+"参数格式不正确或数据不在有效范围",
logger1.error(commonSourceFieldCfg.getSrcName()+"参数格式与正则("+commonSourceFieldCfg.getRegexp()+")不匹配");
thread.setExceptionInfo(commonSourceFieldCfg.getSrcName()+"参数格式与正则("+commonSourceFieldCfg.getRegexp()+")不匹配");
throw new RestServiceException(thread, System.currentTimeMillis() - start,commonSourceFieldCfg.getSrcName()+"参数格式与正则("+commonSourceFieldCfg.getRegexp()+")不匹配",
RestBusinessCode.param_formate_error.getValue());
}
}
@@ -2731,10 +2744,10 @@ public class ConfigSourcesService extends BaseService {
String content="";
String digestGenToolPath=Constants.DIGEST_GEN_TOOL_PATH;
String chmodCommond="chmod +x "+realPath+digestGenToolPath;//执行权限命令
System.out.println("----------------chmodCommod:"+chmodCommond);
// System.out.println("----------------chmodCommod:"+chmodCommond);
String commondStr=realPath+digestGenToolPath+" -f "+filePath; //执行
//执行摘要获取命令 digest -f /home/aa.txt
System.out.println("------------commondStr:"+commondStr);
// System.out.println("------------commondStr:"+commondStr);
Runtime.getRuntime().exec(chmodCommond);
Process p=Runtime.getRuntime().exec(commondStr);
byte[] b=new byte[1024];
@@ -2746,7 +2759,7 @@ public class ConfigSourcesService extends BaseService {
if (!StringUtil.isBlank(content)) {
content = StringUtil.stripAll(content);
}
System.out.println("-------------------->>"+content);
// System.out.println("-------------------->>"+content);
String[] digestGenReslt=content.split(" ");
if(digestGenReslt.length >=4 && !StringUtil.isEmpty(digestGenReslt[3])){
return digestGenReslt[3];

View File

@@ -1,18 +1,30 @@
package com.nis.web.service.restful;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.LogEntity;
import com.nis.domain.Page;
import com.nis.domain.restful.*;
import com.nis.util.Constants;
import com.nis.domain.restful.NtcDnsLog;
import com.nis.domain.restful.NtcFtpLog;
import com.nis.domain.restful.NtcHttpLog;
import com.nis.domain.restful.NtcIpLog;
import com.nis.domain.restful.NtcIpsecLog;
import com.nis.domain.restful.NtcL2tpLog;
import com.nis.domain.restful.NtcMailLog;
import com.nis.domain.restful.NtcOpenvpnLog;
import com.nis.domain.restful.NtcPptpLog;
import com.nis.domain.restful.NtcPzReport;
import com.nis.domain.restful.NtcSshLog;
import com.nis.domain.restful.NtcSslLog;
import com.nis.web.service.BaseLogService;
import org.apache.log4j.Logger;
import org.apache.twill.api.logging.LogEntry;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by darnell on 2018/6/10.
@@ -101,12 +113,11 @@ public class LogTestService extends BaseLogService {
ntcHttpLog.setCfgId(1532L);
ntcHttpLog.setServiceType(17);
ntcHttpLog.setUserRegion("1532");
ntcHttpLog.setC2sIsn(19034211L);
ntcHttpLog.setHttpProxyFlag(211L);
ntcHttpLog.setHttpSeq(1L);
ntcHttpLog.setUrl("http://jd.com/get/api/json");
ntcHttpLog.setReqLine("Get jd.com");
ntcHttpLog.setResLine("response line content");
ntcHttpLog.setReqHdrFile("reqHdrFile1532.txt");
ntcHttpLog.setReqBodyFile("reqBodyFile1532");
ntcHttpLog.setResHdrFile("resHdrFile1532.txt");
ntcHttpLog.setResBodyFile("resBodyFile1532");
ntcHttpLogs.add(ntcHttpLog);
@@ -116,14 +127,11 @@ public class LogTestService extends BaseLogService {
ntcHttpLog.setCfgId(1533L);
ntcHttpLog.setServiceType(129);
ntcHttpLog.setUserRegion("1533");
ntcHttpLog.setC2sIsn(19034211L);
ntcHttpLog.setHttpProxyFlag(211L);
ntcHttpLog.setC2sIsn(190342112L);
ntcHttpLog.setHttpProxyFlag(212L);
ntcHttpLog.setHttpSeq(2L);
ntcHttpLog.setUrl("http://jd.com/get/api/json/abc");
ntcHttpLog.setReqLine("Get jd.com");
ntcHttpLog.setResLine("response line content");
ntcHttpLog.setReqHdrFile("reqHdrFile1533.txt");
ntcHttpLog.setReqBodyFile("reqBodyFile1533");
ntcHttpLog.setResHdrFile("resHdrFile1533.txt");
ntcHttpLog.setResBodyFile("resBodyFile1533");
ntcHttpLogs.add(ntcHttpLog);
@@ -561,9 +569,92 @@ public class LogTestService extends BaseLogService {
return page;
}
/**
* FTP 日志检索测试方法
* @param page
* @param entity
* @return
* @throws Exception
*/
public Page<?> findNtcPzReport(Page<NtcPzReport> page, NtcPzReport entity) throws Exception {
if ("1".equals(entity.getSearchBusinessType())) {
Page<Map> page1 = new Page<Map>();
page1.setPageNo(page.getPageNo());
page1.setPageSize(page.getPageSize());
List<Map> restList = new ArrayList<Map>();
Map<String, Long> restMap = new HashMap<String, Long>();
restMap.put("cfgId", 20l);
restMap.put("sum", 1000l);
restList.add(restMap);
Map<String, Long> restMap2 = new HashMap<String, Long>();
restMap2.put("cfgId", 30l);
restMap2.put("sum", 1001l);
restList.add(restMap2);
page1.setCount(restList.size());
page1.setList(restList);
return page1;
}else if ("2".equals(entity.getSearchBusinessType())){
List<NtcPzReport> ntcPzReports = Lists.newArrayList();
Date date = new Date();
NtcPzReport ntcPzReport = new NtcPzReport();
ntcPzReport.setCfgId(20l);
ntcPzReport.setSum(400l);
ntcPzReport.setService(1);
ntcPzReport.setReportTime(date);
ntcPzReports.add(ntcPzReport);
NtcPzReport ntcPzReport3 = new NtcPzReport();
ntcPzReport3.setCfgId(30l);
ntcPzReport3.setSum(351l);
ntcPzReport3.setService(1);
ntcPzReport3.setReportTime(date);
ntcPzReports.add(ntcPzReport3);
Date date1 = new Date();
date1.setMinutes(date1.getMinutes()+5);
NtcPzReport ntcPzReport1 = new NtcPzReport();
ntcPzReport1.setCfgId(20l);
ntcPzReport1.setSum(400l);
ntcPzReport1.setService(1);
ntcPzReport1.setReportTime(date1);
ntcPzReports.add(ntcPzReport1);
NtcPzReport ntcPzReport4 = new NtcPzReport();
ntcPzReport4.setCfgId(30l);
ntcPzReport4.setSum(500l);
ntcPzReport4.setService(1);
ntcPzReport4.setReportTime(date1);
ntcPzReports.add(ntcPzReport4);
Date date2 = new Date();
date2.setMinutes(date2.getMinutes()+10);
NtcPzReport ntcPzReport2 = new NtcPzReport();
ntcPzReport2.setCfgId(20l);
ntcPzReport2.setSum(200l);
ntcPzReport2.setService(1);
ntcPzReport2.setReportTime(date2);
ntcPzReports.add(ntcPzReport2);
NtcPzReport ntcPzReport5 = new NtcPzReport();
ntcPzReport5.setCfgId(30l);
ntcPzReport5.setSum(150l);
ntcPzReport5.setService(1);
ntcPzReport5.setReportTime(date2);
ntcPzReports.add(ntcPzReport5);
page.setCount(ntcPzReports.size());
page.setList(ntcPzReports);
return page;
}
return null;
}
private Object createTestData(LogEntity logEntity) {

View File

@@ -4,6 +4,7 @@
xsi:schemaLocation="http://www.w3school.com.cn commonSourcesSchema.xsd">
<t:commonSource serviceIds="3,4,25,28,29">
<t:field fieldType="String" srcName="service" dstName="service" isRequired="true"/>
<t:field fieldType="Number" srcName="action" dstName="action" isRequired="true"/>
<t:field fieldType="Number" srcName="cfgId" dstName="cfg_id" isRequired="true" />
<t:field fieldType="Number" srcName="addrType" dstName="addr_type" isRequired="true" regexp="[4|6]"/>
<t:field fieldType="IP" srcName="srcIp" dstName="src_ip" isRequired="true"/>
@@ -21,6 +22,7 @@
</t:commonSource>
<t:commonSource serviceIds="261,262,263,264,389,390,391,392">
<t:field fieldType="String" srcName="service" dstName="service" isRequired="true"/>
<t:field fieldType="Number" srcName="action" dstName="action" isRequired="true"/>
<t:field fieldType="Number" srcName="cfgId" dstName="cfg_id" isRequired="true" />
<t:field fieldType="String" srcName="dstFile" dstName="dst_file" isRequired="true"/>
<t:field fieldType="String" srcName="dstFileMd5" dstName="dst_file_md5" isRequired="true"/>
@@ -31,6 +33,7 @@
</t:commonSource>
<t:commonSource serviceIds="265,266,393,394">
<t:field fieldType="String" srcName="service" dstName="service" isRequired="true"/>
<t:field fieldType="Number" srcName="action" dstName="action" isRequired="true"/>
<t:field fieldType="Number" srcName="cfgId" dstName="cfg_id" isRequired="true" />
<t:field fieldType="String" srcName="description" dstName="description" isRequired="true"/>
<t:field fieldType="Number" srcName="level" dstName="level" range="0-100" defaultVal="0"/>
@@ -48,6 +51,45 @@
<t:field fieldType="Number" srcName="isValid" dstName="is_valid" isRequired="true" range="0-1"/>
<t:field fieldType="Date" srcName="opTime" dstName="op_time" isRequired="true"/>
</t:commonSource>
<t:commonSource serviceIds="64">
<t:field fieldType="String" srcName="service" dstName="service" isRequired="true"/>
<t:field fieldType="Number" srcName="action" dstName="action" isRequired="true"/>
<t:field fieldType="Number" srcName="cfgId" dstName="cfg_id" isRequired="true" />
<t:field fieldType="Number" srcName="policyGroup" dstName="policy_group" isRequired="true" defaultVal="0"/>
<t:field fieldType="Number" srcName="addrType" dstName="addr_type" isRequired="true" regexp="[4|6]"/>
<t:field fieldType="IP" srcName="srcIp" dstName="src_ip" isRequired="true"/>
<t:field fieldType="IP" srcName="maskSrcIp" dstName="mask_src_ip" isRequired="true"/>
<t:field fieldType="Port" srcName="srcPort" dstName="src_port" isRequired="true" range="0-65535"/>
<t:field fieldType="Port" srcName="maskSrcPort" dstName="mask_src_port" isRequired="true" range="0-65535"/>
<t:field fieldType="IP" srcName="dstIp" dstName="dst_ip" isRequired="true"/>
<t:field fieldType="IP" srcName="maskDstIp" dstName="mask_dst_ip" isRequired="true"/>
<t:field fieldType="Port" srcName="dstPort" dstName="dst_port" isRequired="true" range="0-65535"/>
<t:field fieldType="Port" srcName="maskDstPort" dstName="mask_dst_port" isRequired="true" range="0-65535"/>
<t:field fieldType="Number" srcName="protocol" dstName="protocol" isRequired="true" regexp="[0|6|17]"/>
<t:field fieldType="Number" srcName="direction" dstName="direction" isRequired="true" range="0-1"/>
<t:field fieldType="Number" srcName="isValid" dstName="is_valid" isRequired="true" range="0-1"/>
<t:field fieldType="Date" srcName="opTime" dstName="op_time" isRequired="true"/>
</t:commonSource>
<t:commonSource serviceIds="65">
<t:field fieldType="String" srcName="service" dstName="service" isRequired="true"/>
<t:field fieldType="Number" srcName="action" dstName="action" isRequired="true"/>
<t:field fieldType="Number" srcName="cfgId" dstName="cfg_id" isRequired="true" />
<t:field fieldType="Number" srcName="reqStrateId" dstName="req_strate_id" isRequired="true" range="100-"/>
<t:field fieldType="String" srcName="strateName" dstName="strate_name" isRequired="true"/>
<t:field fieldType="Number" srcName="resGroup1Id" dstName="res_group_1_id" defaultVal="0"/>
<t:field fieldType="Number" srcName="resGroup1Num" dstName="res_group_1_num" defaultVal="0"/>
<t:field fieldType="Number" srcName="resGroup2Id" dstName="res_group_2_id" defaultVal="0"/>
<t:field fieldType="Number" srcName="resGroup2Num" dstName="res_group_2_num" defaultVal="0"/>
<t:field fieldType="Number" srcName="resGroup3Id" dstName="res_group_3_id" defaultVal="0"/>
<t:field fieldType="Number" srcName="resGroup3Num" dstName="res_group_3_num" defaultVal="0"/>
<t:field fieldType="Number" srcName="resGroup4Id" dstName="res_group_4_id" defaultVal="0"/>
<t:field fieldType="Number" srcName="resGroup4Num" dstName="res_group_4_num" defaultVal="0"/>
<t:field fieldType="Number" srcName="resGroup5Id" dstName="res_group_5_id" defaultVal="0"/>
<t:field fieldType="Number" srcName="resGroup5Num" dstName="res_group_5_num" defaultVal="0"/>
<t:field fieldType="Number" srcName="minTtl" dstName="min_ttl" isRequired="true"/>
<t:field fieldType="Number" srcName="maxTtl" dstName="max_ttl" isRequired="true"/>
<t:field fieldType="Number" srcName="isValid" dstName="is_valid" isRequired="true" range="0-1"/>
</t:commonSource>
</t:commonSources>

View File

@@ -11,19 +11,26 @@
<xs:complexType>
<xs:attribute name="srcName" type="xs:string" use="required">
<xs:annotation>
<xs:documentation><![CDATA[源字段名]]>
<xs:documentation><![CDATA[源字段名接口传入json串中的Key]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="dstName" type="xs:string" use="required">
<xs:annotation>
<xs:documentation><![CDATA[目的字段名]]>
<xs:documentation><![CDATA[目的字段名需要传给服务接口中的Key]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="fieldType" use="required">
<xs:annotation>
<xs:documentation><![CDATA[字段类型]]>
<xs:documentation>
<![CDATA[字段类型目前只有String、Date、Number、IP、Port多种类型
其中Date、Number、IP、Port有格式验证,具体验证内容如下:
Date:格式为yyyy-MM-dd HH:mm:ss;
Number:value必须为数值类型;
IP:根据指定的addrType(4|6)来验证IP是否与类型是否一致如果未指定IP类型不验证与ipType是否一致,仅验证是否是ip格式;
Port:必须是合法的端口取值范围为0-65535。
]]>
</xs:documentation>
</xs:annotation>
<xs:simpleType>
@@ -31,14 +38,15 @@
<xs:enumeration value="String"></xs:enumeration>
<xs:enumeration value="Date"></xs:enumeration>
<xs:enumeration value="Number"></xs:enumeration>
<xs:enumeration value="IP"></xs:enumeration>
<xs:enumeration value="IP">
</xs:enumeration>
<xs:enumeration value="Port"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="range" type="xs:string">
<xs:annotation>
<xs:documentation><![CDATA[取值范围]]>
<xs:documentation><![CDATA[取值范围,最小值-最大值可以单独指定最大或最小值最小值为100 range="100-"]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>

View File

@@ -9,11 +9,11 @@ jdbc.devlop.password=/+7+DgxK++ZaD1nIcRRmDg==
jdbc.product.driver=oracle.jdbc.driver.OracleDriver
#jdbc.product.url=jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.17)(PORT = 1521))(LOAD_BALANCE = yes)(CONNECT_DATA =(SERVICE_NAME = ORCL)(FAILOVER_MODE =(TYPE = select)(METHOD = basic)(RETRIES = 180)(DELAY = 180))))
#jdbc.product.url=jdbc:oracle:thin:@10.0.6.212:1523:app
jdbc.product.url=jdbc:oracle:thin:@10.0.6.165:1521:orcl
jdbc.product.url=jdbc:oracle:thin:@10.0.6.104:1521:orcl
#jdbc.product.url=jdbc:oracle:thin:@10.0.6.104:1521:orcl
#jdbc.product.url=jdbc:oracle:thin:@10.174.196.20:1521:orcl
jdbc.product.username=kaz_maat
#jdbc.product.username=zdx
#jdbc.product.username=kaz_maat
jdbc.product.username=zdx
#jdbc.product.username=dfxj_2015
#jdbc.product.username=gk_pz
#jdbc.product.username=z2_5x9pz
@@ -21,31 +21,31 @@ jdbc.product.key=3X3ZBejyxS7lkVsHVm9KTw==
jdbc.product.password=sHqDBZIUS0hYZCbC+1xN3A==
jdbc.log.driver=oracle.jdbc.driver.OracleDriver
jdbc.log.url=jdbc:oracle:thin:@10.0.6.212:1523:app
jdbc.log.url=jdbc:oracle:thin:@10.0.6.104:1521:orcl
#jdbc.log.url=jdbc:oracle:thin:@10.174.196.22:1521:orcl
jdbc.log.username=gk_log
jdbc.log.username=zdx
#jdbc.log.username=z2_5x9logb
jdbc.log.key=pHl+0udycGQWNZcN68Sv9A==
jdbc.log.password=Z/pVMDXcWNxzVGAX0yRp3Q==
jdbc.logA.driver=oracle.jdbc.driver.OracleDriver
jdbc.logA.url=jdbc:oracle:thin:@10.0.6.212:1523:app
jdbc.logA.url=jdbc:oracle:thin:@10.0.6.104:1521:orcl
#jdbc.logA.url=jdbc:oracle:thin:@10.174.196.21:1521:orcl
jdbc.logA.username=gk_log_a
jdbc.logA.username=zdx
#jdbc.logA.username=z2_5x9loga
jdbc.logA.key=SXHfLUwzPw0cQEc1wzwM4w==
jdbc.logA.password=auvtDoVZpGP6P4OqfBrWAg==
jdbc.logC.driver=oracle.jdbc.driver.OracleDriver
jdbc.logC.url=jdbc:oracle:thin:@10.0.6.212:1523:app
jdbc.logC.username=gk_log_c
jdbc.logC.url=jdbc:oracle:thin:@10.0.6.104:1521:orcl
jdbc.logC.username=zdx
jdbc.logC.key=MvwfUIYP0nLyiQeprHB/5A==
jdbc.logC.password=3HXvsqpbOoNBIkHDS5c9Aw==
jdbc.jk.driver=oracle.jdbc.driver.OracleDriver
jdbc.jk.url=jdbc:oracle:thin:@10.0.6.212:1523:app
jdbc.jk.url=jdbc:oracle:thin:@10.0.6.104:1521:orcl
#jdbc.jk.url=jdbc:oracle:thin:@10.174.196.20:1521:orcl
jdbc.jk.username=gk_jk
jdbc.jk.username=zdx
#jdbc.jk.username=z2_5x9jk
jdbc.jk.key=+FaavsHgQ0qBSebsAoochw==
jdbc.jk.password=wBrNar7gX/iQR7IyCSHuSg==

View File

@@ -48,7 +48,7 @@
<p:maatType service="3;4;25;28;29">
<p:expressions>
<p:keyExpression>EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id]</p:keyExpression>
<p:valueExpression>[cfg_id];\t;[addr_type];\t;[src_ip];\t;[mask_src_ip];\t;[src_port];\t;[mask_src_port];\t;[dst_ip];\t;[mask_dst_ip];\t;[dst_port];\t;[mask_dst_port];\t;[protocol];\t;[direction];\t;[is_valid];\t;[op_time]</p:valueExpression>
<p:valueExpression>[cfg_id];\t;[service];\t;[action];\t;[addr_type];\t;[src_ip];\t;[mask_src_ip];\t;[src_port];\t;[mask_src_port];\t;[dst_ip];\t;[mask_dst_ip];\t;[dst_port];\t;[mask_dst_port];\t;[protocol];\t;[direction];\t;[is_valid];\t;[op_time]</p:valueExpression>
</p:expressions>
<p:sequences>
<p:operation>1</p:operation>
@@ -66,10 +66,51 @@
</p:expressions>
</p:maatType>
<p:maatType service="64">
<p:expressions>
<p:keyExpression>EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id]</p:keyExpression>
<p:valueExpression>[cfg_id];\t;[service];\t;[action];\t;[policyGroup];\t;[addr_type];\t;[src_ip];\t;[mask_src_ip];\t;[src_port];\t;[mask_src_port];\t;[dst_ip];\t;[mask_dst_ip];\t;[dst_port];\t;[mask_dst_port];\t;[protocol];\t;[direction];\t;[is_valid];\t;[op_time]</p:valueExpression>
</p:expressions>
<p:sequences>
<p:operation>1</p:operation>
<p:sequenceKey>MAAT_VERSION</p:sequenceKey>
</p:sequences>
<p:expressions>
<p:keyExpression>MAAT_UPDATE_STATUS</p:keyExpression>
</p:expressions>
<p:expressions>
<p:keyExpression>MAAT_RULE_TIMER</p:keyExpression>
</p:expressions>
<p:expressions>
<p:keyExpression>MAAT_VERSION_TIMER</p:keyExpression>
</p:expressions>
</p:maatType>
<p:maatType service="65">
<p:expressions>
<p:keyExpression>EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id]</p:keyExpression>
<p:valueExpression>[cfg_id];\t;[service];\t;[action];\t;[req_strate_id];\t;[strate_name];\t;[res_group_1_id];\t;[res_group_1_num];\t;[res_group_2_id];\t;[res_group_2_num];\t;[res_group_3_id];\t;[res_group_3_num];\t;[res_group_4_id];\t;[res_group_4_num];\t;[res_group_5_id];\t;[res_group_5_num];\t;[min_ttl];\t;[max_ttl];\t;[is_valid]</p:valueExpression>
</p:expressions>
<p:sequences>
<p:operation>1</p:operation>
<p:sequenceKey>MAAT_VERSION</p:sequenceKey>
</p:sequences>
<p:expressions>
<p:keyExpression>MAAT_UPDATE_STATUS</p:keyExpression>
</p:expressions>
<p:expressions>
<p:keyExpression>MAAT_RULE_TIMER</p:keyExpression>
</p:expressions>
<p:expressions>
<p:keyExpression>MAAT_VERSION_TIMER</p:keyExpression>
</p:expressions>
</p:maatType>
<p:maatType service="832">
<p:expressions>
<p:keyExpression>EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id]</p:keyExpression>
<p:valueExpression>[cfg_id];\t;[service];\t;[action];\t;[policy_group];\t;[addr_type];\t;[ip];\t;[port];\t;[user_region];\t;[location];\t;[is_valid];\t;[op_time
<p:valueExpression>[cfg_id];\t;[service];\t;[action];\t;[policy_group];\t;[addr_type];\t;[ip];\t;[port];\t;[user_region];\t;[location];\t;[is_valid];\t;[op_time]
</p:valueExpression>
</p:expressions>
<p:sequences>

View File

@@ -80,13 +80,15 @@ service=1:128;2:128;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;26:16;
1057=10:LIMIT_COMPILE;11:LIMIT_GROUP;12:LIMIT_IP;18:NTC_IP_RANGE
1058=10:LIMIT_COMPILE;11:LIMIT_GROUP;14:LIMIT_DOMAIN;18:NTC_IP_RANGE
unMaatService=3:32;4:96;25:32;28:32;29:32;261:16;262:16;263:16;264:16;265:16;266:16;389:1;390:1;391:1;392:1;393:1;394:1;832:96;
unMaatService=3:32;4:96;25:32;28:32;29:32;64:16;65:16;261:16;262:16;263:16;264:16;265:16;266:16;389:1;390:1;391:1;392:1;393:1;394:1;832:96;
3=0:INLINE_IP_CB
4=0:INLINE_IP_CB
25=0:INLINE_IP_CB
28=0:INLINE_IP_CB
29=0:INLINE_IP_CB
64=0:NTC_DNS_FAKE_IP_CB
65=0:NTC_DNS_RES_STRATEGY
261=0:MM_SAMPLE_AUDIO
262=0:MM_SAMPLE_VIDEO
263=0:MM_SAMPLE_PIC
@@ -105,7 +107,7 @@ unMaatService=3:32;4:96;25:32;28:32;29:32;261:16;262:16;263:16;264:16;265:16;266
##各业务类型对应的redisdb,业务类型:redisdb,多个业务以“;”分隔,多个db以“,”数量不能超过6个
#系统简称对应的redisDBIndex: NTC(1-255):2 MM(256-511):3 PXY(512-767):4 IR(768-1023):5 DK(1024-1279):6 阀门:7
#APP 0x400-0x420 目前配置入到NTC系统对应的库中
serviceDBIndex=1:2,3,4,6;2:2,3,4,6;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;141:2;143:2;144:2;256:3;257:3;258:3;259:3;260:3;384:3;385:3;386:3;387:3;388:3;512:4;513:4,2;528:4;529:4;544:4;545:4;560:4;561:4;3:2,7;4:2,7;25:2;28:2;29:2;261:3;262:3;263:3;264:3;265:3;266:3;389:3;390:3;391:3;392:3;393:3;394:3;832:5,7;768:4;1024:2,6;1040:2,6;1041:2,6;1056:2,6;1057:6;1058:6,2
serviceDBIndex=1:2,3,4,6;2:2,3,4,6;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;141:2;143:2;144:2;256:3;257:3;258:3;259:3;260:3;384:3;385:3;386:3;387:3;388:3;512:4;513:4,2;528:4;529:4;544:4;545:4;560:4;561:4;3:2,7;4:2,7;25:2;28:2;29:2;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;389:3;390:3;391:3;392:3;393:3;394:3;832:5,7;768:4;1024:2,6;1040:2,6;1041:2,6;1056:2,6;1057:6;1058:6,2

View File

@@ -4,6 +4,7 @@
package com.nis.test;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -30,7 +31,6 @@ import org.apache.http.util.EntityUtils;
import org.junit.Test;
import com.nis.restful.RestConstants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
/**
@@ -46,14 +46,14 @@ public class RestTest {
public void testFileUpload() {
CloseableHttpResponse response = null;
try {
File file = new File("C:/Users/dell/Desktop/Cal.java");
File file = new File("C:/Users/dell/Desktop/ssl_test.txt");
// String md5 = DigestUtils.md5Hex(file);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addBinaryBody("file", file);
HttpPost request = new HttpPost(
"http://10.0.6.201:8090/galaxy/service/cfg/v1/fileDigestSources");
"http://10.0.6.242:8080/galaxy/service/cfg/v1/fileDigestSources");
//galaxy/service/cfg/v1/fileUploadSources
request.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 600000);
request.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 600000);
@@ -64,7 +64,7 @@ public class RestTest {
jsonObject.put("fileName", "1.png");
//jsonObject.put("checksum", "d99f9aa4f3748fa48aa6e350c628c67f");
jsonObject.put("checksum", "fa7f24ab0f449f5d805bdcf51d476074");
jsonObject.put("checksum", DigestUtils.md5Hex(new FileInputStream(file)));
request.setHeader("File-Desc", jsonObject.toString());
HttpEntity entity = builder.build();
request.setEntity(entity);