1、接口date类型去掉时区,并将日期格式设置为yyyy-MM-dd HH:mm:ss;
2、添加配置日志总量统计服务接口示例; 3、为DNS响应策略配置(service=65)和DNS欺骗地址(service=65)添加配置文件;
This commit is contained in:
@@ -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-查询(暂无)
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@ApiModelProperty(value="应答体转储文件", required=true)
|
||||
protected String resBodyFile;
|
||||
|
||||
public Long getC2sIsn() {
|
||||
return c2sIsn;
|
||||
}
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
public void setResLine(String resLine) {
|
||||
this.resLine = resLine;
|
||||
}
|
||||
}
|
||||
|
||||
180
src/main/java/com/nis/domain/restful/NtcPzReport.java
Normal file
180
src/main/java/com/nis/domain/restful/NtcPzReport.java
Normal 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;
|
||||
|
||||
/**
|
||||
* 自定义SQL(SQL标识,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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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("-");
|
||||
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()+"参数不在有效范围",
|
||||
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)){
|
||||
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];
|
||||
|
||||
@@ -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,7 +569,90 @@ 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user