fix(log):日志检索模块,删除历史activesys ,修改logSource数据类型为int。增加NTC_IP_LOG 日志检索测试服务接口。后续删除历史遗留日志检索功能及其相关对象
This commit is contained in:
@@ -48,12 +48,10 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
protected Date foundTime;
|
||||
@ApiModelProperty(value="接收时间", required=true)
|
||||
protected Date recvTime;
|
||||
/*@ApiModelProperty(value="外层嵌套关联信息ID", required=true)
|
||||
protected Long overId;*/
|
||||
@ApiModelProperty(value="外层嵌套关联信息ID", required=true)
|
||||
protected String overId;
|
||||
@ApiModelProperty(value="协议类型", required=true)
|
||||
protected String protocol;
|
||||
@ApiModelProperty(value="IP地址类型", required=true)
|
||||
protected Integer addrType;
|
||||
@ApiModelProperty(value="服务端ip地址", required=true)
|
||||
protected String serverIp;
|
||||
@ApiModelProperty(value="客户端ip地址", required=true)
|
||||
@@ -62,29 +60,25 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
protected Integer serverPort;
|
||||
@ApiModelProperty(value="客户端端口", required=true)
|
||||
protected Integer clientPort;
|
||||
@ApiModelProperty(value="嵌套协议类型", required=true)
|
||||
protected String nestProtocol;
|
||||
@ApiModelProperty(value="嵌套服务端ip地址", required=true)
|
||||
protected String nestServerIp;
|
||||
@ApiModelProperty(value="嵌套客户端ip地址", required=true)
|
||||
protected String nestClientIp;
|
||||
@ApiModelProperty(value="嵌套服务端端口", required=true)
|
||||
protected Integer nestServerPort;
|
||||
@ApiModelProperty(value="嵌套客户端端口", required=true)
|
||||
protected Integer nestClientPort;
|
||||
@ApiModelProperty(value="业务类型", required=true)
|
||||
protected Integer serviceType;
|
||||
@ApiModelProperty(value="串联设备编号", required=true)
|
||||
protected Integer deviceId;
|
||||
@ApiModelProperty(value="传输方向", required=true, notes = "0:域内->域外,1:域外->域内,描述的是CLIENT_IP信息")
|
||||
protected Integer direction;
|
||||
@ApiModelProperty(value="流类型", required=true, notes = "0:c2s,1:s2c;2;double")
|
||||
protected Integer streamType;
|
||||
@ApiModelProperty(value="出入口编号", required=true)
|
||||
protected Long entranceId;
|
||||
@ApiModelProperty(value="处理机IP", required=true)
|
||||
protected String cljIp;
|
||||
@ApiModelProperty(value="封堵包记录文件", required=true)
|
||||
protected String injectedPktFile;
|
||||
|
||||
@ApiModelProperty(value="存放现场日志文件的URL地址", required=true)
|
||||
protected String sceneFile;
|
||||
@ApiModelProperty(value="管控动作", required=true)
|
||||
protected Integer action;
|
||||
@ApiModelProperty(value="用户嵌套地址列表", required=true)
|
||||
protected String nestAddrList;
|
||||
|
||||
@ApiModelProperty(value="用户自定义域", required=true)
|
||||
private String userRegion;
|
||||
|
||||
@ApiModelProperty(value="服务端地址定位信息", required=true)
|
||||
protected String serverLocate;
|
||||
@ApiModelProperty(value="客户端地址定位信息", required=true)
|
||||
@@ -96,19 +90,19 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
|
||||
|
||||
|
||||
|
||||
protected String searchCfgId;
|
||||
protected String searchFoundStartTime;
|
||||
protected String searchFoundEndTime;
|
||||
protected Long searchFoundStartTimeCluster;
|
||||
protected Long searchFoundEndTimeCluster;
|
||||
protected String searchCfgId;
|
||||
protected String searchProtocol;
|
||||
protected String searchServiceType;
|
||||
protected String searchServerIp;
|
||||
protected String searchClientIp;
|
||||
protected Integer searchDirection;
|
||||
protected String searchServiceType;
|
||||
protected String searchEntranceId;
|
||||
protected String searchCljIp;
|
||||
protected String tableName;//神通数据库根据A/B版,动态切换表名
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
public Long getFoundTimeCluster() {
|
||||
@@ -139,19 +133,7 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
public void setSearchFoundEndTimeCluster(Long searchFoundEndTimeCluster) {
|
||||
this.searchFoundEndTimeCluster = searchFoundEndTimeCluster;
|
||||
}
|
||||
@JsonIgnore
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
public String getOverId() {
|
||||
return overId;
|
||||
}
|
||||
public void setOverId(String overId) {
|
||||
this.overId = overId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前实体分页对象
|
||||
*/
|
||||
@@ -165,19 +147,12 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
/**
|
||||
* @Title:
|
||||
* @Description: TODO
|
||||
* @param 入参
|
||||
* @param
|
||||
*/
|
||||
public LogEntity() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getInjectedPktFile() {
|
||||
return injectedPktFile;
|
||||
}
|
||||
|
||||
public void setInjectedPktFile(String injectedPktFile) {
|
||||
this.injectedPktFile = injectedPktFile;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -268,26 +243,6 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return overId
|
||||
*/
|
||||
/*public Long getOverId() {
|
||||
return overId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
*//**
|
||||
* @param overId 要设置的 overId
|
||||
*//*
|
||||
public void setOverId(Long overId) {
|
||||
this.overId = overId;
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return protocol
|
||||
*/
|
||||
@@ -388,105 +343,6 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return nestProtocol
|
||||
*/
|
||||
public String getNestProtocol() {
|
||||
return nestProtocol;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param nestProtocol 要设置的 nestProtocol
|
||||
*/
|
||||
public void setNestProtocol(String nestProtocol) {
|
||||
this.nestProtocol = nestProtocol;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return nestServerIp
|
||||
*/
|
||||
public String getNestServerIp() {
|
||||
return nestServerIp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param nestServerIp 要设置的 nestServerIp
|
||||
*/
|
||||
public void setNestServerIp(String nestServerIp) {
|
||||
this.nestServerIp = nestServerIp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return nestClientIp
|
||||
*/
|
||||
public String getNestClientIp() {
|
||||
return nestClientIp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param nestClientIp 要设置的 nestClientIp
|
||||
*/
|
||||
public void setNestClientIp(String nestClientIp) {
|
||||
this.nestClientIp = nestClientIp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return nestServerPort
|
||||
*/
|
||||
public Integer getNestServerPort() {
|
||||
return nestServerPort;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param nestServerPort 要设置的 nestServerPort
|
||||
*/
|
||||
public void setNestServerPort(Integer nestServerPort) {
|
||||
this.nestServerPort = nestServerPort;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return nestClientPort
|
||||
*/
|
||||
public Integer getNestClientPort() {
|
||||
return nestClientPort;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param nestClientPort 要设置的 nestClientPort
|
||||
*/
|
||||
public void setNestClientPort(Integer nestClientPort) {
|
||||
this.nestClientPort = nestClientPort;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return serviceType
|
||||
@@ -742,8 +598,6 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param searchClientIp 要设置的 searchClientIp
|
||||
*/
|
||||
@@ -763,8 +617,6 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param searchEntranceId 要设置的 searchEntranceId
|
||||
*/
|
||||
@@ -795,8 +647,6 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return searchServiceType
|
||||
*/
|
||||
@@ -805,9 +655,6 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
return searchServiceType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param searchServiceType 要设置的 searchServiceType
|
||||
*/
|
||||
@@ -815,23 +662,62 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
this.searchServiceType = searchServiceType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getSceneFile() {
|
||||
return sceneFile;
|
||||
}
|
||||
public void setSceneFile(String sceneFile) {
|
||||
this.sceneFile = sceneFile;
|
||||
public Integer getAddrType() {
|
||||
return addrType;
|
||||
}
|
||||
|
||||
public Integer getAction() {
|
||||
return action;
|
||||
}
|
||||
public void setAction(Integer action) {
|
||||
this.action = action;
|
||||
public void setAddrType(Integer addrType) {
|
||||
this.addrType = addrType;
|
||||
}
|
||||
|
||||
public Integer getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(Integer deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public Integer getStreamType() {
|
||||
return streamType;
|
||||
}
|
||||
|
||||
public void setStreamType(Integer streamType) {
|
||||
this.streamType = streamType;
|
||||
}
|
||||
|
||||
public String getNestAddrList() {
|
||||
return nestAddrList;
|
||||
}
|
||||
|
||||
public void setNestAddrList(String nestAddrList) {
|
||||
this.nestAddrList = nestAddrList;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Integer getSearchDirection() {
|
||||
return searchDirection;
|
||||
}
|
||||
|
||||
public void setSearchDirection(Integer searchDirection) {
|
||||
this.searchDirection = searchDirection;
|
||||
}
|
||||
|
||||
public String getUserRegion() {
|
||||
return userRegion;
|
||||
}
|
||||
|
||||
public void setUserRegion(String userRegion) {
|
||||
this.userRegion = userRegion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
12
src/main/java/com/nis/domain/restful/NtcIpLog.java
Normal file
12
src/main/java/com/nis/domain/restful/NtcIpLog.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import com.nis.domain.LogEntity;
|
||||
|
||||
/**
|
||||
* Created by darnell on 2018/6/10.
|
||||
*/
|
||||
public class NtcIpLog extends LogEntity<NtcIpLog> {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1325588394265592830L;
|
||||
}
|
||||
@@ -40,14 +40,7 @@ public class DefaultRestErrorResolver implements RestErrorResolver,InitializingB
|
||||
RestResult error = new RestResult();
|
||||
error.setStatus(this.getHttpStatusByEx(ex));// 设置http状态
|
||||
//获取日志源[只有日志需要返回日志源和ActiveSys]
|
||||
String logSource = ((RestServiceException) ex).getLogSource();
|
||||
String activeSys = ((RestServiceException) ex).getActiveSys();
|
||||
if(logSource != null ){
|
||||
error.setLogSource(logSource);
|
||||
}
|
||||
if(activeSys != null ){
|
||||
error.setActiveSys(activeSys);
|
||||
}
|
||||
int logSource = ((RestServiceException) ex).getLogSource();
|
||||
|
||||
//RestServiceException 包含有错误code
|
||||
if(ex instanceof RestServiceException){
|
||||
@@ -71,8 +64,9 @@ public class DefaultRestErrorResolver implements RestErrorResolver,InitializingB
|
||||
if(this.exceptionMappingDefinitions.containsKey(ex.getClass().getName())){
|
||||
return HttpStatus.valueOf(Integer.parseInt(this.exceptionMappingDefinitions.get(ex.getClass()
|
||||
.getName())));
|
||||
} else {
|
||||
return HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
else return HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class RestResult {
|
||||
/**
|
||||
* 日志数据来源本地:0 数据中心:1
|
||||
*/
|
||||
private String logSource;
|
||||
private Integer logSource;
|
||||
|
||||
/**
|
||||
* 追踪状态码
|
||||
@@ -59,14 +59,13 @@ public class RestResult {
|
||||
|
||||
}
|
||||
|
||||
public RestResult(HttpStatus status, RestBusinessCode businessCode, String msg,String fromUri,String activeSys,String fromSign,String traceCode) {
|
||||
public RestResult(HttpStatus status, RestBusinessCode businessCode, String msg, String fromUri, Integer logSource,String traceCode) {
|
||||
super();
|
||||
this.status = status;
|
||||
this.businessCode = businessCode;
|
||||
this.msg = msg;
|
||||
this.fromUri = fromUri;
|
||||
this.activeSys=activeSys;
|
||||
this.logSource=logSource;
|
||||
this.logSource= logSource;
|
||||
this.traceCode=traceCode;
|
||||
}
|
||||
|
||||
@@ -137,10 +136,11 @@ public class RestResult {
|
||||
this.activeSys = activeSys;
|
||||
}
|
||||
|
||||
public String getLogSource() {
|
||||
public Integer getLogSource() {
|
||||
return logSource;
|
||||
}
|
||||
public void setLogSource(String logSource) {
|
||||
|
||||
public void setLogSource(Integer logSource) {
|
||||
this.logSource = logSource;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,9 @@ public class RestResult {
|
||||
this.traceCode = traceCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
return new StringBuilder().append("HttpStatus:").append(getStatus().value())
|
||||
.append(" errorcode:")
|
||||
.append(this.getBusinessCode().getValue())
|
||||
|
||||
@@ -8,9 +8,7 @@ public class RestServiceException extends RuntimeException{
|
||||
|
||||
private int errorCode;
|
||||
|
||||
private String logSource;
|
||||
|
||||
private String activeSys;
|
||||
private int logSource;
|
||||
|
||||
private String traceCode;
|
||||
/**
|
||||
@@ -33,8 +31,10 @@ public class RestServiceException extends RuntimeException{
|
||||
this.traceCode = thread.getTraceCode();
|
||||
thread.setConsumerTime(time);
|
||||
thread.setBusinessCode(this.getErrorCode());
|
||||
if(StringUtils.isEmpty(thread.getExceptionInfo()))
|
||||
if(StringUtils.isEmpty(thread.getExceptionInfo())) {
|
||||
thread.setExceptionInfo(message);
|
||||
}
|
||||
|
||||
new Thread(thread).start();
|
||||
}
|
||||
|
||||
@@ -48,8 +48,10 @@ public class RestServiceException extends RuntimeException{
|
||||
this.traceCode = thread.getTraceCode();
|
||||
thread.setConsumerTime(time);
|
||||
thread.setBusinessCode(this.getErrorCode());
|
||||
if(StringUtils.isEmpty(thread.getExceptionInfo()))
|
||||
if(StringUtils.isEmpty(thread.getExceptionInfo())) {
|
||||
thread.setExceptionInfo(message);
|
||||
}
|
||||
|
||||
new Thread(thread).start();
|
||||
}
|
||||
|
||||
@@ -62,18 +64,13 @@ public class RestServiceException extends RuntimeException{
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public String getLogSource() {
|
||||
public int getLogSource() {
|
||||
return logSource;
|
||||
}
|
||||
public void setLogSource(String logSource) {
|
||||
|
||||
public void setLogSource(int logSource) {
|
||||
this.logSource = logSource;
|
||||
}
|
||||
public String getActiveSys() {
|
||||
return activeSys;
|
||||
}
|
||||
public void setActiveSys(String activeSys) {
|
||||
this.activeSys = activeSys;
|
||||
}
|
||||
|
||||
public String getTraceCode() {
|
||||
return traceCode;
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.nis.util.JsonMapper;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
@@ -107,10 +108,9 @@ public class HttpClientUtil {
|
||||
}
|
||||
public static void main(String[] args) throws ClientProtocolException, IOException {
|
||||
HttpClientUtil hd = new HttpClientUtil();
|
||||
hd.get("http://10.0.6.115:9200/_sql?sql=select * from dfipportlog-2016-09-07-15 limit 1 10");
|
||||
Map<String,String> map = new HashMap();
|
||||
map.put("id","1");
|
||||
hd.post("http://localhost:8080/springMVC/menu/getChildren.do",map);
|
||||
String result = hd.get("http://10.0.6.104:8080/galaxy/service/cfg/v1/configPzIdSources");
|
||||
Object mapResult = JsonMapper.fromJsonString(result,Map.class);
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -219,9 +219,18 @@ public class BaseRestController {
|
||||
return convert(restResult);
|
||||
}
|
||||
|
||||
public Map serviceResponse(SaveRequestLogThread thread, long time, HttpServletRequest request,
|
||||
HttpServletResponse response, String msg, Object data, String activeSys, String logSource) {
|
||||
logger.info("结果集处理开始----" + System.currentTimeMillis());
|
||||
/**
|
||||
* 日志结果响应格式规范
|
||||
* @param auditLogThread
|
||||
* @param executedTime
|
||||
* @param request
|
||||
* @param msg
|
||||
* @param data
|
||||
* @param logSource
|
||||
* @return
|
||||
*/
|
||||
public Map serviceLogResponse(SaveRequestLogThread auditLogThread, long executedTime, HttpServletRequest request,
|
||||
String msg, Object data, Integer logSource) {
|
||||
RestResult restResult = new RestResult();
|
||||
String requestMethod = request.getMethod();
|
||||
if (requestMethod.equals(RequestMethod.GET.name())) {
|
||||
@@ -240,12 +249,11 @@ public class BaseRestController {
|
||||
restResult.setFromUri(request.getRequestURI());
|
||||
restResult.setData(data);
|
||||
restResult.setMsg(msg);
|
||||
restResult.setActiveSys(activeSys);
|
||||
restResult.setLogSource(logSource);
|
||||
restResult.setTraceCode(thread.getTraceCode());
|
||||
thread.setConsumerTime(time);
|
||||
thread.setBusinessCode(restResult.getBusinessCode().getValue());
|
||||
new Thread(thread).start();
|
||||
restResult.setTraceCode(auditLogThread.getTraceCode());
|
||||
auditLogThread.setConsumerTime(executedTime);
|
||||
auditLogThread.setBusinessCode(restResult.getBusinessCode().getValue());
|
||||
new Thread(auditLogThread).start();
|
||||
return convert(restResult);
|
||||
}
|
||||
|
||||
@@ -264,7 +272,6 @@ public class BaseRestController {
|
||||
}
|
||||
successMap.put(RestConstants.TRACE_CODE, re.getTraceCode());
|
||||
successMap.put(RestConstants.REST_SERVICE_DATA, re.getData());
|
||||
logger.info("结果集处理结束----" + System.currentTimeMillis());
|
||||
return successMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DfKeyConvertUrlController extends BaseRestController{
|
||||
@Autowired
|
||||
protected ServicesRequestLogService servicesRequestLogService;
|
||||
|
||||
protected String logSource = "0";
|
||||
protected int logSource = 0;
|
||||
|
||||
@RequestMapping(value="/dfKeyConvertUrlSources", method = RequestMethod.GET)
|
||||
@ApiOperation(value="关键字业务转换URL日志信息获取" , httpMethod = "GET", notes="get log list")
|
||||
@@ -61,7 +61,9 @@ public class DfKeyConvertUrlController extends BaseRestController{
|
||||
|
||||
if(!Constants.ACTIVESYS_A.equals(searchActiveSys)
|
||||
&& !Constants.ACTIVESYS_C.equals(searchActiveSys)
|
||||
) searchActiveSys=Constants.ACTIVESYS_B;
|
||||
) {
|
||||
searchActiveSys=Constants.ACTIVESYS_B;
|
||||
}
|
||||
|
||||
long start=System.currentTimeMillis();
|
||||
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
|
||||
@@ -80,11 +82,10 @@ public class DfKeyConvertUrlController extends BaseRestController{
|
||||
if (!(e instanceof RestServiceException)) {
|
||||
e = new RestServiceException(thread, System.currentTimeMillis() - start, "关键字业务转换URL日志信息检索失败");
|
||||
}
|
||||
((RestServiceException) e).setActiveSys(searchActiveSys);
|
||||
((RestServiceException) e).setLogSource(logSource);
|
||||
throw ((RestServiceException) e);
|
||||
}
|
||||
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "关键字业务转换URL日志信息检索成功",dfKeyConvertUrlPage
|
||||
,searchActiveSys, logSource);
|
||||
return serviceLogResponse(thread, System.currentTimeMillis()-start, request, "关键字业务转换URL日志信息检索成功",dfKeyConvertUrlPage
|
||||
, logSource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DfKeyMailAddController extends BaseRestController {
|
||||
@Autowired
|
||||
protected DfKeyMailAddService dfKeyMailAddService;
|
||||
|
||||
protected String logSource = "0";
|
||||
protected int logSource = 0;
|
||||
|
||||
@RequestMapping(value = "/dfKeyMailAddSources", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "关键字业务转换邮件地址日志信息获取", httpMethod = "GET", notes = "get log list")
|
||||
@@ -61,7 +61,9 @@ public class DfKeyMailAddController extends BaseRestController {
|
||||
|
||||
if(!Constants.ACTIVESYS_A.equals(searchActiveSys)
|
||||
&& !Constants.ACTIVESYS_C.equals(searchActiveSys)
|
||||
) searchActiveSys=Constants.ACTIVESYS_B;
|
||||
) {
|
||||
searchActiveSys=Constants.ACTIVESYS_B;
|
||||
}
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
|
||||
@@ -81,11 +83,11 @@ public class DfKeyMailAddController extends BaseRestController {
|
||||
if (!(e instanceof RestServiceException)) {
|
||||
e = new RestServiceException(thread, System.currentTimeMillis() - start, "关键字业务转换邮件地址日志信息检索失败");
|
||||
}
|
||||
((RestServiceException) e).setActiveSys(searchActiveSys);
|
||||
|
||||
((RestServiceException) e).setLogSource(logSource);
|
||||
throw ((RestServiceException) e);
|
||||
}
|
||||
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "关键字业务转换邮件地址日志信息检索成功",
|
||||
dfKeyMailAddPage,searchActiveSys, logSource);
|
||||
return serviceLogResponse(thread, System.currentTimeMillis() - start, request, "关键字业务转换邮件地址日志信息检索成功",
|
||||
dfKeyMailAddPage, logSource);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -50,7 +50,7 @@ public class IntervalTimeSearchController extends BaseRestController{
|
||||
@Autowired
|
||||
protected ServicesRequestLogService servicesRequestLogService;
|
||||
|
||||
protected String logSource = "0";
|
||||
protected Integer logSource = 0;
|
||||
|
||||
@RequestMapping(value="/djFlowControlStopSources", method = RequestMethod.GET)
|
||||
@ApiOperation(value="监测规则流控信息获取" , httpMethod = "GET", notes="get log list")
|
||||
@@ -59,9 +59,12 @@ public class IntervalTimeSearchController extends BaseRestController{
|
||||
Page page, DjFlowControlStop flowControlStop, HttpServletRequest request,
|
||||
HttpServletResponse response, Model model) {
|
||||
|
||||
if(!Constants.ACTIVESYS_A.equals(searchActiveSys)
|
||||
if (!Constants.ACTIVESYS_A.equals(searchActiveSys)
|
||||
&& !Constants.ACTIVESYS_C.equals(searchActiveSys)
|
||||
)searchActiveSys=Constants.ACTIVESYS_B;
|
||||
) {
|
||||
searchActiveSys=Constants.ACTIVESYS_B;
|
||||
|
||||
}
|
||||
|
||||
long start=System.currentTimeMillis();
|
||||
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
|
||||
@@ -79,11 +82,10 @@ public class IntervalTimeSearchController extends BaseRestController{
|
||||
if (!(e instanceof RestServiceException)) {
|
||||
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测规则流控信息检索失败");
|
||||
}
|
||||
((RestServiceException) e).setActiveSys(searchActiveSys);
|
||||
((RestServiceException) e).setLogSource(logSource);
|
||||
throw ((RestServiceException) e);
|
||||
}
|
||||
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测规则流控信息检索成功",flowControlStopPage
|
||||
,searchActiveSys, logSource);
|
||||
return serviceLogResponse(thread, System.currentTimeMillis()-start,request, "监测规则流控信息检索成功", flowControlStopPage
|
||||
, logSource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.nis.web.controller.restful;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.NtcIpLog;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseRestController;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
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.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("${servicePath}/log/v1")
|
||||
@Api(value = "LogController", description = "配置命中日志基本服务接口")
|
||||
public class LogController extends BaseRestController{
|
||||
@Autowired
|
||||
public LogTestService testService;
|
||||
|
||||
@Autowired
|
||||
protected ServicesRequestLogService servicesRequestLogService;
|
||||
|
||||
@RequestMapping(value = "/ntcIpLogs", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "IP地址日志查询", httpMethod = "GET", notes = "对应配置为IP地址管理,存储动作为阻断与监测的命中日志。对日志功能IP地址提供数据基础查询服务")
|
||||
public Map<String, ?> ntcIpLogs(Page page, NtcIpLog ntcIpLog, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
|
||||
|
||||
Page<NtcIpLog> ntcIpLogPage = new Page<>();
|
||||
try {
|
||||
ntcIpLogPage = testService.findNtcIpLogPage(
|
||||
new Page<NtcIpLog>(request, response, NtcIpLog.class), ntcIpLog);
|
||||
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IP地址日志检索成功", ntcIpLogPage, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -219,7 +219,7 @@ public abstract class BaseLogService {
|
||||
/**
|
||||
* wx 报表查询条件检查
|
||||
*
|
||||
* @param className
|
||||
* @param clazz
|
||||
* 需要检验的实体名称[需要保证resultMap的id命名方式为[className]Map]
|
||||
* @param page
|
||||
* 需要校验的page对象
|
||||
|
||||
@@ -19,8 +19,9 @@ import org.apache.log4j.Logger;
|
||||
import com.nis.datasource.CustomerContextHolder;
|
||||
|
||||
/**
|
||||
* 审计日志工作线程
|
||||
* @ClassName: SaveLogThread.java
|
||||
* @Description: TODO
|
||||
* @Description: 用于记录业务操作日志,后期用于审计及相关联调验证工作
|
||||
* @author (dell)
|
||||
* @date 2016年10月14日 下午6:26:41
|
||||
* @version V1.0
|
||||
@@ -66,7 +67,6 @@ public class SaveRequestLogThread implements Runnable {
|
||||
* 创建一个新的实例 SaveRequestLogThread.
|
||||
*
|
||||
* @param service
|
||||
* @param requestAddr
|
||||
* @param requestURI
|
||||
* @param queryString
|
||||
* @param contextPath
|
||||
|
||||
@@ -67,9 +67,6 @@ public class ServicesRequestLogService {
|
||||
* request中的参数
|
||||
* @param contextPath
|
||||
* request中的参数
|
||||
* @param request
|
||||
* 请求
|
||||
* @param response
|
||||
* 响应
|
||||
* @param operator
|
||||
* 操作人
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfIpPortLog;
|
||||
import com.nis.domain.restful.NtcIpLog;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by darnell on 2018/6/10.
|
||||
* 日志测试业务类,用于接口或临时验证测试使用
|
||||
*/
|
||||
@Service
|
||||
public class LogTestService extends BaseLogService {
|
||||
|
||||
protected final Logger logger = Logger.getLogger(this.getClass());
|
||||
|
||||
|
||||
/**
|
||||
* IP地址日志检索测试业务方法
|
||||
* @param page
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<NtcIpLog> findNtcIpLogPage(Page<NtcIpLog> page, NtcIpLog entity) throws Exception{
|
||||
List<NtcIpLog> ntcIpLogs = Lists.newArrayList();
|
||||
NtcIpLog ntcIpLog = new NtcIpLog();
|
||||
ntcIpLog.setId(35L);
|
||||
ntcIpLog.setCfgId(531L);
|
||||
ntcIpLog.setServiceType(16);
|
||||
ntcIpLog.setFoundTime(new Date());
|
||||
ntcIpLog.setRecvTime(new Date());
|
||||
ntcIpLog.setAddrType(4);
|
||||
ntcIpLog.setProtocol("IPv4_TCP");
|
||||
ntcIpLog.setClientIp("192.168.10.106");
|
||||
ntcIpLog.setClientPort(80);
|
||||
ntcIpLog.setServerIp("202.106.0.20");
|
||||
ntcIpLog.setServerPort(8443);
|
||||
ntcIpLog.setCljIp("10.0.6.240");
|
||||
ntcIpLog.setDeviceId(1356981);
|
||||
ntcIpLog.setDirection(0);
|
||||
ntcIpLog.setStreamType(0);
|
||||
ntcIpLog.setEntranceId(21L);
|
||||
ntcIpLog.setUserRegion("531");
|
||||
ntcIpLog.setClientLocate("本地地址");
|
||||
ntcIpLog.setServerLocate("中国 北京 电信宽带光纤");
|
||||
ntcIpLogs.add(ntcIpLog);
|
||||
|
||||
ntcIpLog = new NtcIpLog();
|
||||
ntcIpLog.setId(36L);
|
||||
ntcIpLog.setCfgId(532L);
|
||||
ntcIpLog.setServiceType(128);
|
||||
ntcIpLog.setFoundTime(new Date());
|
||||
ntcIpLog.setRecvTime(new Date());
|
||||
ntcIpLog.setAddrType(4);
|
||||
ntcIpLog.setProtocol("IPv4_TCP");
|
||||
ntcIpLog.setClientIp("192.168.10.106");
|
||||
ntcIpLog.setClientPort(80);
|
||||
ntcIpLog.setServerIp("202.106.0.20");
|
||||
ntcIpLog.setServerPort(8443);
|
||||
ntcIpLog.setCljIp("10.0.6.240");
|
||||
ntcIpLog.setDeviceId(1356981);
|
||||
ntcIpLog.setDirection(0);
|
||||
ntcIpLog.setStreamType(0);
|
||||
ntcIpLog.setEntranceId(21L);
|
||||
ntcIpLog.setUserRegion("531");
|
||||
ntcIpLog.setClientLocate("本地地址");
|
||||
ntcIpLog.setServerLocate("中国 北京 电信宽带光纤");
|
||||
ntcIpLogs.add(ntcIpLog);
|
||||
page.setCount(ntcIpLogs.size());
|
||||
|
||||
page.setList(ntcIpLogs);
|
||||
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user