diff --git a/src/main/java/com/nis/domain/restful/PolicyEventLog.java b/src/main/java/com/nis/domain/restful/PolicyEventLog.java new file mode 100644 index 0000000..06f3a1f --- /dev/null +++ b/src/main/java/com/nis/domain/restful/PolicyEventLog.java @@ -0,0 +1,950 @@ +package com.nis.domain.restful; + +import java.io.Serializable; +import java.util.Date; + +import javax.xml.bind.annotation.XmlTransient; + +import org.apache.poi.ss.formula.functions.T; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.nis.domain.LogEntity; +import com.nis.domain.Page; +import com.wordnik.swagger.annotations.ApiModelProperty; + +/** + * + * @ClassName: PolicyEventLog + * @Description:策略事件日志 + * @author A.Chen + * @date: 2019/05/29 + */ +public class PolicyEventLog implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "策略ID", required = true, notes = "库中字段为policyId,返回compileId") + private int compileId; + + @ApiModelProperty(value = "动作", required = true) + private int action; + + @ApiModelProperty(value = "服务端IP地址", required = true) + private String serverIp; + + @ApiModelProperty(value = "客户端IP地址", required = true) + private String clientIp; + + @ApiModelProperty(value = "服务端端口", required = true) + private String serverPort; + + @ApiModelProperty(value = "客户端端口", required = true) + private String clientPort; + + @ApiModelProperty(value = "运营商", required = true) + private String isp; + + @ApiModelProperty(value = "服务端ASN", required = true) + private String serverAsn; + + @ApiModelProperty(value = "客户端ASN", required = true) + private String clientAsn; + + @ApiModelProperty(value = "通信时长", required = true) + private Integer conDurationMs; + + @ApiModelProperty(value = "访问URL", required = true) + private String url; + + @ApiModelProperty(value = "主机地址", required = true) + private String host; + + @ApiModelProperty(value = "域名", required = true) + private String domain; + + @ApiModelProperty(value = "分类", required = true) + private String category; + + @ApiModelProperty(value = "请求行", required = true) + private String reqLine; + + @ApiModelProperty(value = "应答行", required = true) + private String resLine; + + @ApiModelProperty(value = "Cookie值", required = true) + private String cookie; + + @ApiModelProperty(value = "Referer值", required = true) + private String referer; + + @ApiModelProperty(value = "UA值", required = true) + private String userAgent; + + @ApiModelProperty(value = "Content-Length值", required = true) + private String contentLen; + + @ApiModelProperty(value = "Content-Type值", required = true) + private String contentType; + + @ApiModelProperty(value = "set-Cookie值", required = true) + private String setCookie; + + @ApiModelProperty(value = "原始请求头", required = true) + private String reqHeader; + + @ApiModelProperty(value = "原始应答头", required = true) + private String respHeader; + + @ApiModelProperty(value = "请求体转储文件KEY", required = true) + private String reqBodyKey; + + @ApiModelProperty(value = "原始请求体", required = true) + private String reqBody; + + @ApiModelProperty(value = "应答体转储文件KEY", required = true) + private String resBodyKey; + + @ApiModelProperty(value = "原始应答体", required = true) + private String respBody; + + @ApiModelProperty(value = "版本", required = true) + private String version; + + @ApiModelProperty(value = "sni", required = true) + private String sni; + + @ApiModelProperty(value = "san", required = true) + private String san; + + @ApiModelProperty(value = "cn", required = true) + private String cn; + + @ApiModelProperty(value = "app", required = true) + private Integer appId; + + @ApiModelProperty(value = "Protocol", required = true) + private Integer protocolId; + + @ApiModelProperty(value = "握手延迟", required = true) + private Integer conLatencyMs; + + @ApiModelProperty(value = "pinning状态", required = true) + private Integer pinningst; + + @ApiModelProperty(value = "c2s包数", required = true) + private Integer c2sPktNum; + + @ApiModelProperty(value = "s2c包数", required = true) + private Integer s2cPktNum; + + @ApiModelProperty(value = "c2s字节数", required = true) + private Integer c2sByteNum; + + @ApiModelProperty(value = "s2c字节数", required = true) + private Integer s2cByteNum; + + @ApiModelProperty(value = "ISN接入的IP", required = true) + private String nasIp; + + @ApiModelProperty(value = "用户IP地址", required = true) + private String framedIp; + + @ApiModelProperty(value = "用户名", required = true) + private String account; + + @ApiModelProperty(value = "报文类型", required = true, notes = "1- Access-Request 2- Access-Accept 3- Access-Reject 4- Accounting-Request(账户授权) 5- Accounting-Response 11-Access-Challenge") + private Integer packetType; + + @ApiModelProperty(value = "应用协议类型", required = true, notes = "http1/http2") + private String appProto; + + @ApiModelProperty(value = "会话创建时间", required = true) + private long startTime; + + @ApiModelProperty(value = "会话结束时间", required = true) + private long endTime; + + @ApiModelProperty(value = "客户端用户名", required = true) + private String subscribeId; + + @ApiModelProperty(value = "接收时间", required = true) + private long recvTime; + + @ApiModelProperty(value = "协议类型", required = true) + private String transProto; + + @ApiModelProperty(value = "IP地址类型", required = true) + private Integer addrType; + + @ApiModelProperty(value = "业务类型", required = true) + private Integer service; + + @ApiModelProperty(value = "出入口编号", required = true) + private Long entranceId; + + @ApiModelProperty(value = "串联设备编号", required = true) + private Integer deviceId; + + @ApiModelProperty(value = "传输方向", required = true, notes = "0:域内->域外,1:域外->域内,描述的是CLIENT_IP信息") + private Integer direction; + + @ApiModelProperty(value = "流类型", required = true, notes = "0:c2s,1:s2c;2;double") + private Integer streamDir; + + @ApiModelProperty(value = "处理机IP", required = true) + private String capIp; + + @ApiModelProperty(value = "嵌套地址列表", required = true) + private String addrList; + + @ApiModelProperty(value = "服务端地址定位信息", required = true) + private String serverLocation; + + @ApiModelProperty(value = "串联设备链路号", required = true) + private Long linkId; + + @ApiModelProperty(value = "原始二层封装格式", required = true) + private Integer encapType; + + @ApiModelProperty(value = "客户端地址定位信息", required = true) + private String clientLocation; + + private Page page; + + // 请求参数属性(不返回 ) + private String searchFields;// 指定查询某些字段 + private Integer searchCompileId;// 策略ID + private Integer searchAction;// 动作 + private Integer searchStartRecvTime;// 开始时间 时间戳 + private Integer searchEndRecvTime;// 结束时间 时间戳 + private String searchTransProto;// 协议类型 + private Integer searchAddrType;// 地址类型 + private String searchServerIp;// 服务端IP地址 + private String searchClientIp;// 客户端IP地址 + private String searchIsp;// 运营商 + private Integer searchDirection;// 方向 + private String searchCapIp;// 处理机IP + private String searchServerLocation;// 服务端地址定位信息 + private String searchClientLocation;// 客户端地址定位信息 + private String searchHost;// 主机地址 + private String searchDomain;// 域名 + private String searchSni;// sni + private String searchSan;// san + private String searchCn;// cn + private Integer searchAppId;// app + private Integer searchProtocolId;// Protocol + private String searchUrl;// url + private Integer searchEntranceId; + + @JsonIgnore + @XmlTransient + public Page getPage() { + if (page == null) { + page = new Page(); + } + return page; + } + + public Page setPage(Page page) { + this.page = page; + return page; + } + public int getCompileId() { + return compileId; + } + + public void setCompileId(int compileId) { + this.compileId = compileId; + } + public int getAction() { + return action; + } + + public void setAction(int action) { + this.action = action; + } + public String getServerIp() { + return serverIp; + } + + public void setServerIp(String serverIp) { + this.serverIp = serverIp; + } + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } + public String getServerPort() { + return serverPort; + } + + public void setServerPort(String serverPort) { + this.serverPort = serverPort; + } + + public String getClientPort() { + return clientPort; + } + + public void setClientPort(String clientPort) { + this.clientPort = clientPort; + } + + public String getIsp() { + return isp; + } + + public void setIsp(String isp) { + this.isp = isp; + } + + public String getServerAsn() { + return serverAsn; + } + + public void setServerAsn(String serverAsn) { + this.serverAsn = serverAsn; + } + + public String getClientAsn() { + return clientAsn; + } + + public void setClientAsn(String clientAsn) { + this.clientAsn = clientAsn; + } + + public Integer getConDurationMs() { + return conDurationMs; + } + + public void setConDurationMs(Integer conDurationMs) { + this.conDurationMs = conDurationMs; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getReqLine() { + return reqLine; + } + + public void setReqLine(String reqLine) { + this.reqLine = reqLine; + } + + public String getResLine() { + return resLine; + } + + public void setResLine(String resLine) { + this.resLine = resLine; + } + + public String getCookie() { + return cookie; + } + + public void setCookie(String cookie) { + this.cookie = cookie; + } + + public String getReferer() { + return referer; + } + + public void setReferer(String referer) { + this.referer = referer; + } + + public String getUserAgent() { + return userAgent; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public String getContentLen() { + return contentLen; + } + + public void setContentLen(String contentLen) { + this.contentLen = contentLen; + } + + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getSetCookie() { + return setCookie; + } + + public void setSetCookie(String setCookie) { + this.setCookie = setCookie; + } + + public String getReqHeader() { + return reqHeader; + } + + public void setReqHeader(String reqHeader) { + this.reqHeader = reqHeader; + } + + public String getRespHeader() { + return respHeader; + } + + public void setRespHeader(String respHeader) { + this.respHeader = respHeader; + } + + public String getReqBodyKey() { + return reqBodyKey; + } + + public void setReqBodyKey(String reqBodyKey) { + this.reqBodyKey = reqBodyKey; + } + + public String getReqBody() { + return reqBody; + } + + public void setReqBody(String reqBody) { + this.reqBody = reqBody; + } + + public String getResBodyKey() { + return resBodyKey; + } + + public void setResBodyKey(String resBodyKey) { + this.resBodyKey = resBodyKey; + } + + public String getRespBody() { + return respBody; + } + + public void setRespBody(String respBody) { + this.respBody = respBody; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getSni() { + return sni; + } + + public void setSni(String sni) { + this.sni = sni; + } + + public String getSan() { + return san; + } + + public void setSan(String san) { + this.san = san; + } + + public String getCn() { + return cn; + } + + public void setCn(String cn) { + this.cn = cn; + } + + public Integer getAppId() { + return appId; + } + + public void setAppId(Integer appId) { + this.appId = appId; + } + + public Integer getProtocolId() { + return protocolId; + } + + public void setProtocolId(Integer protocolId) { + this.protocolId = protocolId; + } + + public Integer getConLatencyMs() { + return conLatencyMs; + } + + public void setConLatencyMs(Integer conLatencyMs) { + this.conLatencyMs = conLatencyMs; + } + + public Integer getPinningst() { + return pinningst; + } + + public void setPinningst(Integer pinningst) { + this.pinningst = pinningst; + } + + public Integer getC2sPktNum() { + return c2sPktNum; + } + + public void setC2sPktNum(Integer c2sPktNum) { + this.c2sPktNum = c2sPktNum; + } + + public Integer getS2cPktNum() { + return s2cPktNum; + } + + public void setS2cPktNum(Integer s2cPktNum) { + this.s2cPktNum = s2cPktNum; + } + + public Integer getC2sByteNum() { + return c2sByteNum; + } + + public void setC2sByteNum(Integer c2sByteNum) { + this.c2sByteNum = c2sByteNum; + } + + public Integer getS2cByteNum() { + return s2cByteNum; + } + + public void setS2cByteNum(Integer s2cByteNum) { + this.s2cByteNum = s2cByteNum; + } + + public String getNasIp() { + return nasIp; + } + + public void setNasIp(String nasIp) { + this.nasIp = nasIp; + } + + public String getFramedIp() { + return framedIp; + } + + public void setFramedIp(String framedIp) { + this.framedIp = framedIp; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public Integer getPacketType() { + return packetType; + } + + public void setPacketType(Integer packetType) { + this.packetType = packetType; + } + + public String getAppProto() { + return appProto; + } + + public void setAppProto(String appProto) { + this.appProto = appProto; + } + + public long getStartTime() { + return startTime; + } + + public void setStartTime(long startTime) { + this.startTime = startTime; + } + + public long getEndTime() { + return endTime; + } + + public void setEndTime(long endTime) { + this.endTime = endTime; + } + + public String getSubscribeId() { + return subscribeId; + } + + public void setSubscribeId(String subscribeId) { + this.subscribeId = subscribeId; + } + + @JsonIgnore + public String getSearchFields() { + return searchFields; + } + + public void setSearchFields(String searchFields) { + this.searchFields = searchFields; + } + + @JsonIgnore + public Integer getSearchCompileId() { + return searchCompileId; + } + + public void setSearchCompileId(Integer searchCompileId) { + this.searchCompileId = searchCompileId; + } + + @JsonIgnore + public Integer getSearchAction() { + return searchAction; + } + + public void setSearchAction(Integer searchAction) { + this.searchAction = searchAction; + } + + @JsonIgnore + public Integer getSearchStartRecvTime() { + return searchStartRecvTime; + } + + public void setSearchStartRecvTime(Integer searchStartRecvTime) { + this.searchStartRecvTime = searchStartRecvTime; + } + + @JsonIgnore + public Integer getSearchEndRecvTime() { + return searchEndRecvTime; + } + + public void setSearchEndRecvTime(Integer searchEndRecvTime) { + this.searchEndRecvTime = searchEndRecvTime; + } + + @JsonIgnore + public Integer getSearchAddrType() { + return searchAddrType; + } + + public void setSearchAddrType(Integer searchAddrType) { + this.searchAddrType = searchAddrType; + } + + @JsonIgnore + public String getSearchServerIp() { + return searchServerIp; + } + + public void setSearchServerIp(String searchServerIp) { + this.searchServerIp = searchServerIp; + } + + @JsonIgnore + public String getSearchClientIp() { + return searchClientIp; + } + + public void setSearchClientIp(String searchClientIp) { + this.searchClientIp = searchClientIp; + } + + @JsonIgnore + public String getSearchHost() { + return searchHost; + } + + public void setSearchHost(String searchHost) { + this.searchHost = searchHost; + } + + @JsonIgnore + public String getSearchDomain() { + return searchDomain; + } + + public void setSearchDomain(String searchDomain) { + this.searchDomain = searchDomain; + } + + @JsonIgnore + public String getSearchSni() { + return searchSni; + } + + public void setSearchSni(String searchSni) { + this.searchSni = searchSni; + } + + @JsonIgnore + public String getSearchSan() { + return searchSan; + } + + public void setSearchSan(String searchSan) { + this.searchSan = searchSan; + } + + @JsonIgnore + public String getSearchCn() { + return searchCn; + } + + public void setSearchCn(String searchCn) { + this.searchCn = searchCn; + } + + @JsonIgnore + public Integer getSearchAppId() { + return searchAppId; + } + + public void setSearchAppId(Integer searchAppId) { + this.searchAppId = searchAppId; + } + + @JsonIgnore + public Integer getSearchProtocolId() { + return searchProtocolId; + } + + public void setSearchProtocolId(Integer searchProtocolId) { + this.searchProtocolId = searchProtocolId; + } + + @JsonIgnore + public String getSearchUrl() { + return searchUrl; + } + + public void setSearchUrl(String searchUrl) { + this.searchUrl = searchUrl; + } + + public long getRecvTime() { + return recvTime; + } + + public void setRecvTime(long recvTime) { + this.recvTime = recvTime; + } + + public String getTransProto() { + return transProto; + } + + public void setTransProto(String transProto) { + this.transProto = transProto; + } + + public Integer getAddrType() { + return addrType; + } + + public void setAddrType(Integer addrType) { + this.addrType = addrType; + } + + public Integer getService() { + return service; + } + + public void setService(Integer service) { + this.service = service; + } + + public Long getEntranceId() { + return entranceId; + } + + public void setEntranceId(Long entranceId) { + this.entranceId = entranceId; + } + + 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 getStreamDir() { + return streamDir; + } + + public void setStreamDir(Integer streamDir) { + this.streamDir = streamDir; + } + + public String getCapIp() { + return capIp; + } + + public void setCapIp(String capIp) { + this.capIp = capIp; + } + + public String getAddrList() { + return addrList; + } + + public void setAddrList(String addrList) { + this.addrList = addrList; + } + + + public Long getLinkId() { + return linkId; + } + + public void setLinkId(Long linkId) { + this.linkId = linkId; + } + + public Integer getEncapType() { + return encapType; + } + + public void setEncapType(Integer encapType) { + this.encapType = encapType; + } + + public String getServerLocation() { + return serverLocation; + } + + public void setServerLocation(String serverLocation) { + this.serverLocation = serverLocation; + } + + public String getClientLocation() { + return clientLocation; + } + + public void setClientLocation(String clientLocation) { + this.clientLocation = clientLocation; + } + + @JsonIgnore + public String getSearchTransProto() { + return searchTransProto; + } + + public void setSearchTransProto(String searchTransProto) { + this.searchTransProto = searchTransProto; + } + @JsonIgnore + public String getSearchIsp() { + return searchIsp; + } + + public void setSearchIsp(String searchIsp) { + this.searchIsp = searchIsp; + } + @JsonIgnore + public Integer getSearchDirection() { + return searchDirection; + } + + public void setSearchDirection(Integer searchDirection) { + this.searchDirection = searchDirection; + } + @JsonIgnore + public String getSearchCapIp() { + return searchCapIp; + } + + public void setSearchCapIp(String searchCapIp) { + this.searchCapIp = searchCapIp; + } + @JsonIgnore + public String getSearchServerLocation() { + return searchServerLocation; + } + + public void setSearchServerLocation(String searchServerLocation) { + this.searchServerLocation = searchServerLocation; + } + @JsonIgnore + public String getSearchClientLocation() { + return searchClientLocation; + } + + public void setSearchClientLocation(String searchClientLocation) { + this.searchClientLocation = searchClientLocation; + } + + @JsonIgnore + public Integer getSearchEntranceId() { + return searchEntranceId; + } + + public void setSearchEntranceId(Integer searchEntranceId) { + this.searchEntranceId = searchEntranceId; + } + +} diff --git a/src/main/java/com/nis/util/PropertyPlaceholderConfigurerCrypt.java b/src/main/java/com/nis/util/PropertyPlaceholderConfigurerCrypt.java index 3469fe5..d87d315 100644 --- a/src/main/java/com/nis/util/PropertyPlaceholderConfigurerCrypt.java +++ b/src/main/java/com/nis/util/PropertyPlaceholderConfigurerCrypt.java @@ -44,6 +44,15 @@ public class PropertyPlaceholderConfigurerCrypt extends PropertyPlaceholderConfi + String ckLocalNewPassword = props.getProperty("jdbc.ckLocalNew.password"); + String ckLocalNewScretKey = props.getProperty("jdbc.ckLocalNew.key"); + if (null != ckLocalPassword) { + props.setProperty("jdbc.ckLocalNew.password", + new String(AESUtil.decrypt(Base64.decodeBase64(ckLocalNewPassword), ckLocalNewScretKey))); + } + + + // hive String hivePassword = props.getProperty("jdbc.hive.password"); String hiveScretKey = props.getProperty("jdbc.hive.key"); diff --git a/src/main/java/com/nis/web/controller/restful/LogController.java b/src/main/java/com/nis/web/controller/restful/LogController.java index 6296be7..3bcab7c 100644 --- a/src/main/java/com/nis/web/controller/restful/LogController.java +++ b/src/main/java/com/nis/web/controller/restful/LogController.java @@ -11,8 +11,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import com.nis.datasource.CustomerContextHolder; import com.nis.domain.Page; import com.nis.domain.restful.DkBehaviorLog; +import com.nis.domain.restful.PolicyEventLog; import com.nis.domain.restful.PxyHttpLog; import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; @@ -22,6 +24,7 @@ import com.nis.util.ExceptionUtil; import com.nis.web.controller.BaseRestController; import com.nis.web.service.AuditLogThread; import com.nis.web.service.LogDataService; +import com.nis.web.service.NtcLogServiceNew; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.NtcLogService; import com.wordnik.swagger.annotations.Api; @@ -54,6 +57,8 @@ public class LogController extends BaseRestController { protected NtcLogService ntcLogService; @Autowired private LogDataService logDataService; + @Autowired + private NtcLogServiceNew ntcLogServiceNew; @RequestMapping(value = "/dkBehaviorLogs", method = RequestMethod.GET) @ApiOperation(value = "行为识别日志查询", httpMethod = "GET", notes = "对日志功能“行为识别”提供数据基础查询服务") @@ -112,5 +117,38 @@ public class LogController extends BaseRestController { return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "PXY HTTP日志检索成功", page, 0); } + + @RequestMapping(value = "/policyevent", method = RequestMethod.GET) + @ApiOperation(value = "策略事件日志查询", httpMethod = "GET", notes = "对日志功能“国家代理”-“HTTP(s)操控”提供数据基础查询服务") + public Map policyEvent(Page page, PolicyEventLog policyEventLog, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, + null); + + try { + //切换数据源为C + CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_C); +// resetTime(policyEventLog); + ntcLogService.policyEventConditionCheck(auditLogThread, start, policyEventLog, PxyHttpLog.class, page); + ntcLogServiceNew.getPolicyEventLog(policyEventLog, page); + } catch (Exception e) { + auditLogThread.setExceptionInfo("PXY HTTP日志检索失败:"+e.getMessage()); + logger.error("策略事件日志检索失败:"+ExceptionUtil.getExceptionMsg(e)); + if (e instanceof RestServiceException) { + throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start, + "策略事件日志检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); + } else if (e instanceof ServiceRuntimeException) { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "策略事件日志检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode()); + } else { + throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start, + "策略事件日志检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue()); + } + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "策略事件日志检索成功", page, + 0); + } + } diff --git a/src/main/java/com/nis/web/dao/NtcLogDaoNew.java b/src/main/java/com/nis/web/dao/NtcLogDaoNew.java new file mode 100644 index 0000000..4036e2f --- /dev/null +++ b/src/main/java/com/nis/web/dao/NtcLogDaoNew.java @@ -0,0 +1,12 @@ +package com.nis.web.dao; + +import java.util.List; + +import com.nis.domain.restful.PolicyEventLog; + +@MyBatisDao +public interface NtcLogDaoNew { + + List getPolicyEventLog(PolicyEventLog policyEventLog); + +} diff --git a/src/main/java/com/nis/web/dao/NtcLogDaoNew.xml b/src/main/java/com/nis/web/dao/NtcLogDaoNew.xml new file mode 100644 index 0000000..2595afe --- /dev/null +++ b/src/main/java/com/nis/web/dao/NtcLogDaoNew.xml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + policy_id,action,start_time,end_time,recv_time,trans_proto, + app_proto,addr_type,server_ip,client_ip,server_port,client_port, + service,entrance_id,device_id,link_id,isp,encap_type,direction,stream_dir, + cap_ip,addr_list,server_location,client_location,client_asn,server_asn, + subscribe_id,con_duration_ms,url,host,domain,category,req_line, + res_line,cookie,referer,user_agent,content_len,content_type,set_cookie, + req_header,resp_header,req_body_key,req_body,res_body_key,resp_body,version, + sni,san,cn,app_id,protocol_id,con_latency_ms,pinningst,c2s_pkt_num,s2c_pkt_num, + c2s_byte_num,s2c_byte_num,nas_ip,framed_ip,account,packet_type + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/BaseLogService.java b/src/main/java/com/nis/web/service/BaseLogService.java index b9fbe69..b1bb367 100644 --- a/src/main/java/com/nis/web/service/BaseLogService.java +++ b/src/main/java/com/nis/web/service/BaseLogService.java @@ -21,6 +21,7 @@ import com.nis.domain.Page; import com.nis.domain.restful.NtcCollectVoipLog; import com.nis.domain.restful.NtcRadiusReport; import com.nis.domain.restful.NtcReportEntity; +import com.nis.domain.restful.PolicyEventLog; import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; import com.nis.restful.ServiceRuntimeException; @@ -257,6 +258,29 @@ public abstract class BaseLogService { logger.info("请求参数校验结束----" + System.currentTimeMillis()); } + + public void policyEventConditionCheck(AuditLogThread thread, long start, PolicyEventLog entity, Class clazz, + Page page) { + logger.info("请求参数校验开始----" + System.currentTimeMillis()); + try { + if (null!=entity.getSearchCompileId()) { + Integer.valueOf(entity.getSearchCompileId()); + } + } catch (Exception e) { + throw new RestServiceException("SearchCfgId参数错误", RestBusinessCode.param_formate_error.getValue()); + } + + try { + checkCloumnIsExist(thread, start, clazz, page); + } catch (RestServiceException e) { + throw e; + } catch (Exception e) { + throw new ServiceRuntimeException(ExceptionUtil.getExceptionMsg(e), + RestBusinessCode.service_runtime_error.getValue()); + } + logger.info("请求参数校验结束----" + System.currentTimeMillis()); + + } /** * diff --git a/src/main/java/com/nis/web/service/NtcLogServiceNew.java b/src/main/java/com/nis/web/service/NtcLogServiceNew.java new file mode 100644 index 0000000..fc18c85 --- /dev/null +++ b/src/main/java/com/nis/web/service/NtcLogServiceNew.java @@ -0,0 +1,33 @@ +package com.nis.web.service; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.nis.domain.Page; +import com.nis.domain.restful.PolicyEventLog; +import com.nis.restful.RestBusinessCode; +import com.nis.restful.RestServiceException; +import com.nis.web.dao.NtcLogDaoNew; +import com.zdjizhi.utils.DateUtils; +import com.zdjizhi.utils.StringUtil; +import com.zdjizhi.utils.TimeConstants; + +@Service +public class NtcLogServiceNew { + + + @Autowired + NtcLogDaoNew ntcLogDaoNew; + + public Page getPolicyEventLog(PolicyEventLog policyEventLog,Page page){ + policyEventLog.setPage(page); + List list = ntcLogDaoNew.getPolicyEventLog(policyEventLog); + page.setList(list); + if (page.getLast() > 100) { + page.setLast(100); + } + return page; + } +} diff --git a/src/main/resources/applicationContext-mybatis.xml b/src/main/resources/applicationContext-mybatis.xml index de071b3..5f76e2f 100644 --- a/src/main/resources/applicationContext-mybatis.xml +++ b/src/main/resources/applicationContext-mybatis.xml @@ -243,12 +243,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index 7860686..3df1bfc 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -98,19 +98,26 @@ jdbc.clickhouse.driver=ru.yandex.clickhouse.ClickHouseDriver #华严账号密码同元辰鑫 #jdbc.clickhouse.url=jdbc:clickhouse://192.168.10.77:8123/k18_ods?socket_timeout=90000 #元辰鑫账号密码同华严 -jdbc.clickhouse.url=jdbc:clickhouse://192.168.10.192:8123/k18_ods?socket_timeout=90000 +jdbc.clickhouse.url=jdbc:clickhouse://192.168.10.193:8123/k18_ods?socket_timeout=90000 jdbc.clickhouse.username=default jdbc.clickhouse.key=aUkjs+fcwf6p4rDqHiC+ng== jdbc.clickhouse.password=jOA3tbfJiJlPci6XUHIbVg== #本地的clickhouse地址,新增的TBS_ODS_NTC_CONN_RECORD_LOG_LOCAL在本地 -jdbc.ckLocal.url=jdbc:clickhouse://192.168.10.192:8123/k18_ods?socket_timeout=90000 +jdbc.ckLocal.url=jdbc:clickhouse://192.168.10.193:8123/k18_galaxy_service?socket_timeout=90000 jdbc.ckLocal.username=default #实际密码ceiec2018 jdbc.ckLocal.key=aUkjs+fcwf6p4rDqHiC+ng== jdbc.ckLocal.password=jOA3tbfJiJlPci6XUHIbVg== +#本地的clickhouse新地址, +jdbc.ckLocalNew.url=jdbc:clickhouse://192.168.10.193:8123/tsg_galaxy?socket_timeout=90000 +jdbc.ckLocalNew.username=default +#实际密码ceiec2018 +jdbc.ckLocalNew.key=aUkjs+fcwf6p4rDqHiC+ng== +jdbc.ckLocalNew.password=jOA3tbfJiJlPci6XUHIbVg== + #########################配置日志查询使用druid连接池#########################################