diff --git a/src/main/java/com/nis/domain/restful/DkBehaviorLog.java b/src/main/java/com/nis/domain/restful/DkBehaviorLog.java index 1ae9d07..5322c01 100644 --- a/src/main/java/com/nis/domain/restful/DkBehaviorLog.java +++ b/src/main/java/com/nis/domain/restful/DkBehaviorLog.java @@ -16,43 +16,74 @@ public class DkBehaviorLog extends LogEntity { private static final long serialVersionUID = -589390375816690510L; @ApiModelProperty(value = "协议标签", required = true) protected Integer appLabel; - @ApiModelProperty(value = "c2s包数", required = true) - protected String c2sPktNum; - @ApiModelProperty(value = "s2c包数", required = true) - protected String s2cPktNum; - @ApiModelProperty(value = "c2s字节数", required = true) - protected String c2sByteNum; - @ApiModelProperty(value = "s2c字节数", required = true) - protected String s2cByteNum; + @ApiModelProperty(value = "发送c2s包数", required = true) + protected String c2sSendPktNum; + @ApiModelProperty(value = "发送s2c包数", required = true) + protected String s2cSendPktNum; + @ApiModelProperty(value = "发送c2s字节数", required = true) + protected String c2sSendByteNum; + @ApiModelProperty(value = "发送s2c字节数", required = true) + protected String s2cSendByteNum; + @ApiModelProperty(value = "接收c2s包数", required = true) + protected String c2sRecvSendPktNum; + @ApiModelProperty(value = "接收s2c包数", required = true) + protected String s2cRecvSendPktNum; + @ApiModelProperty(value = "接收c2s字节数", required = true) + protected String c2sRecvByteNum; + @ApiModelProperty(value = "接收s2c字节数", required = true) + protected String s2cRecvByteNum; public Integer getAppLabel() { return appLabel; } public void setAppLabel(Integer appLabel) { this.appLabel = appLabel; } - public String getC2sPktNum() { - return c2sPktNum; + public String getC2sSendPktNum() { + return c2sSendPktNum; } - public void setC2sPktNum(String c2sPktNum) { - this.c2sPktNum = c2sPktNum; + public void setC2sSendPktNum(String c2sSendPktNum) { + this.c2sSendPktNum = c2sSendPktNum; } - public String getS2cPktNum() { - return s2cPktNum; + public String getS2cSendPktNum() { + return s2cSendPktNum; } - public void setS2cPktNum(String s2cPktNum) { - this.s2cPktNum = s2cPktNum; + public void setS2cSendPktNum(String s2cSendPktNum) { + this.s2cSendPktNum = s2cSendPktNum; } - public String getC2sByteNum() { - return c2sByteNum; + public String getC2sSendByteNum() { + return c2sSendByteNum; } - public void setC2sByteNum(String c2sByteNum) { - this.c2sByteNum = c2sByteNum; + public void setC2sSendByteNum(String c2sSendByteNum) { + this.c2sSendByteNum = c2sSendByteNum; } - public String getS2cByteNum() { - return s2cByteNum; + public String getS2cSendByteNum() { + return s2cSendByteNum; } - public void setS2cByteNum(String s2cByteNum) { - this.s2cByteNum = s2cByteNum; + public void setS2cSendByteNum(String s2cSendByteNum) { + this.s2cSendByteNum = s2cSendByteNum; + } + public String getC2sRecvSendPktNum() { + return c2sRecvSendPktNum; + } + public void setC2sRecvSendPktNum(String c2sRecvSendPktNum) { + this.c2sRecvSendPktNum = c2sRecvSendPktNum; + } + public String getS2cRecvSendPktNum() { + return s2cRecvSendPktNum; + } + public void setS2cRecvSendPktNum(String s2cRecvSendPktNum) { + this.s2cRecvSendPktNum = s2cRecvSendPktNum; + } + public String getC2sRecvByteNum() { + return c2sRecvByteNum; + } + public void setC2sRecvByteNum(String c2sRecvByteNum) { + this.c2sRecvByteNum = c2sRecvByteNum; + } + public String getS2cRecvByteNum() { + return s2cRecvByteNum; + } + public void setS2cRecvByteNum(String s2cRecvByteNum) { + this.s2cRecvByteNum = s2cRecvByteNum; } - } diff --git a/src/main/java/com/nis/domain/restful/MmAvIpLog.java b/src/main/java/com/nis/domain/restful/MmAvIpLog.java new file mode 100644 index 0000000..f719336 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/MmAvIpLog.java @@ -0,0 +1,72 @@ +package com.nis.domain.restful; + +import com.nis.domain.LogEntity; +import com.wordnik.swagger.annotations.ApiModelProperty; + +/** + * @ClassName:MmAvIpLog + * @Description:TODO(这里用一句话描述这个类的作用) + * @author (zdx) + * @date 2018年7月16日 下午2:54:23 + * @version V1.0 + */ +public class MmAvIpLog extends LogEntity { + + private static final long serialVersionUID = -6177790560553329386L; + @ApiModelProperty(value="节目ID", required=true) + protected String pid; + @ApiModelProperty(value="节目访问地址", required=true) + protected String url; + @ApiModelProperty(value="封堵现场片段路径", required=true) + protected String logUri; + @ApiModelProperty(value="入口页面", required=true) + protected String refer; + @ApiModelProperty(value="有害级别", required=true) + protected Integer level; + @ApiModelProperty(value="封堵类型", required=true) + protected Integer fdType; + @ApiModelProperty(value="协议", required=true) + protected String protocol; + public String getPid() { + return pid; + } + public void setPid(String pid) { + this.pid = pid; + } + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + public String getLogUri() { + return logUri; + } + public void setLogUri(String logUri) { + this.logUri = logUri; + } + public String getRefer() { + return refer; + } + public void setRefer(String refer) { + this.refer = refer; + } + public Integer getLevel() { + return level; + } + public void setLevel(Integer level) { + this.level = level; + } + public Integer getFdType() { + return fdType; + } + public void setFdType(Integer fdType) { + this.fdType = fdType; + } + public String getProtocol() { + return protocol; + } + public void setProtocol(String protocol) { + this.protocol = protocol; + } +} diff --git a/src/main/java/com/nis/domain/restful/MmAvUrlLog.java b/src/main/java/com/nis/domain/restful/MmAvUrlLog.java new file mode 100644 index 0000000..142b16e --- /dev/null +++ b/src/main/java/com/nis/domain/restful/MmAvUrlLog.java @@ -0,0 +1,72 @@ +package com.nis.domain.restful; + +import com.nis.domain.LogEntity; +import com.wordnik.swagger.annotations.ApiModelProperty; + +/** + * @ClassName:MmAvUrlLog + * @Description:TODO(这里用一句话描述这个类的作用) + * @author (zdx) + * @date 2018年7月16日 下午3:11:42 + * @version V1.0 + */ +public class MmAvUrlLog extends LogEntity { + + private static final long serialVersionUID = 1446933545638550170L; + @ApiModelProperty(value="节目ID", required=true) + protected String pid; + @ApiModelProperty(value="节目访问地址", required=true) + protected String url; + @ApiModelProperty(value="封堵现场片段路径", required=true) + protected String logUri; + @ApiModelProperty(value="入口页面", required=true) + protected String refer; + @ApiModelProperty(value="有害级别", required=true) + protected Integer level; + @ApiModelProperty(value="封堵类型", required=true) + protected Integer fdType; + @ApiModelProperty(value="协议", required=true) + protected String protocol; + public String getPid() { + return pid; + } + public void setPid(String pid) { + this.pid = pid; + } + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + public String getLogUri() { + return logUri; + } + public void setLogUri(String logUri) { + this.logUri = logUri; + } + public String getRefer() { + return refer; + } + public void setRefer(String refer) { + this.refer = refer; + } + public Integer getLevel() { + return level; + } + public void setLevel(Integer level) { + this.level = level; + } + public Integer getFdType() { + return fdType; + } + public void setFdType(Integer fdType) { + this.fdType = fdType; + } + public String getProtocol() { + return protocol; + } + public void setProtocol(String protocol) { + this.protocol = protocol; + } +} diff --git a/src/main/java/com/nis/domain/restful/MmPicIpLog.java b/src/main/java/com/nis/domain/restful/MmPicIpLog.java new file mode 100644 index 0000000..5f03e02 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/MmPicIpLog.java @@ -0,0 +1,72 @@ +package com.nis.domain.restful; + +import com.nis.domain.LogEntity; +import com.wordnik.swagger.annotations.ApiModelProperty; + +/** + * @ClassName:MmPicIpLog + * @Description:TODO(这里用一句话描述这个类的作用) + * @author (zdx) + * @date 2018年7月16日 下午3:11:20 + * @version V1.0 + */ +public class MmPicIpLog extends LogEntity { + + private static final long serialVersionUID = -3097221323074572913L; + @ApiModelProperty(value="节目ID", required=true) + protected String pid; + @ApiModelProperty(value="节目访问地址", required=true) + protected String url; + @ApiModelProperty(value="封堵现场片段路径", required=true) + protected String logUri; + @ApiModelProperty(value="入口页面", required=true) + protected String refer; + @ApiModelProperty(value="有害级别", required=true) + protected Integer level; + @ApiModelProperty(value="封堵类型", required=true) + protected Integer fdType; + @ApiModelProperty(value="协议", required=true) + protected String protocol; + public String getPid() { + return pid; + } + public void setPid(String pid) { + this.pid = pid; + } + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + public String getLogUri() { + return logUri; + } + public void setLogUri(String logUri) { + this.logUri = logUri; + } + public String getRefer() { + return refer; + } + public void setRefer(String refer) { + this.refer = refer; + } + public Integer getLevel() { + return level; + } + public void setLevel(Integer level) { + this.level = level; + } + public Integer getFdType() { + return fdType; + } + public void setFdType(Integer fdType) { + this.fdType = fdType; + } + public String getProtocol() { + return protocol; + } + public void setProtocol(String protocol) { + this.protocol = protocol; + } +} diff --git a/src/main/java/com/nis/domain/restful/MmPicUrlLog.java b/src/main/java/com/nis/domain/restful/MmPicUrlLog.java new file mode 100644 index 0000000..2593c98 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/MmPicUrlLog.java @@ -0,0 +1,72 @@ +package com.nis.domain.restful; + +import com.nis.domain.LogEntity; +import com.wordnik.swagger.annotations.ApiModelProperty; + +/** + * @ClassName:MmPicUrlLog + * @Description:TODO(这里用一句话描述这个类的作用) + * @author (zdx) + * @date 2018年7月16日 下午3:11:03 + * @version V1.0 + */ +public class MmPicUrlLog extends LogEntity { + + private static final long serialVersionUID = 4660530265759121390L; + @ApiModelProperty(value="节目ID", required=true) + protected String pid; + @ApiModelProperty(value="节目访问地址", required=true) + protected String url; + @ApiModelProperty(value="封堵现场片段路径", required=true) + protected String logUri; + @ApiModelProperty(value="入口页面", required=true) + protected String refer; + @ApiModelProperty(value="有害级别", required=true) + protected Integer level; + @ApiModelProperty(value="封堵类型", required=true) + protected Integer fdType; + @ApiModelProperty(value="协议", required=true) + protected String protocol; + public String getPid() { + return pid; + } + public void setPid(String pid) { + this.pid = pid; + } + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + public String getLogUri() { + return logUri; + } + public void setLogUri(String logUri) { + this.logUri = logUri; + } + public String getRefer() { + return refer; + } + public void setRefer(String refer) { + this.refer = refer; + } + public Integer getLevel() { + return level; + } + public void setLevel(Integer level) { + this.level = level; + } + public Integer getFdType() { + return fdType; + } + public void setFdType(Integer fdType) { + this.fdType = fdType; + } + public String getProtocol() { + return protocol; + } + public void setProtocol(String protocol) { + this.protocol = protocol; + } +} diff --git a/src/main/java/com/nis/domain/restful/MmVoipLog.java b/src/main/java/com/nis/domain/restful/MmVoipLog.java new file mode 100644 index 0000000..b116e54 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/MmVoipLog.java @@ -0,0 +1,131 @@ +package com.nis.domain.restful; + +import com.nis.domain.LogEntity; +import com.wordnik.swagger.annotations.ApiModelProperty; + +/** + * @ClassName:MmVoipIpLog + * @Description:TODO(这里用一句话描述这个类的作用) + * @author (zdx) + * @date 2018年7月16日 下午2:57:12 + * @version V1.0 + */ +public class MmVoipLog extends LogEntity { + + private static final long serialVersionUID = -6131067803206270492L; +// @ApiModelProperty(value="VOIP接收时间", required=true) +// protected String recvTime; + @ApiModelProperty(value="VOIP通话时长(秒)", required=true) + protected String duation; + @ApiModelProperty(value="VOIP协议", required=true) + protected String protocol; + @ApiModelProperty(value="主叫VOIP账号", required=true) + protected String callingAccount; + @ApiModelProperty(value="被叫VOIP账号", required=true) + protected String calledAccount; + @ApiModelProperty(value="VOIP主叫电信号码", required=true) + protected String callingNumber; + @ApiModelProperty(value="VOIP被叫电信号码", required=true) + protected String calledNumber; + @ApiModelProperty(value="主叫VOIP语音文件存放服务器IP", required=true) + protected String fromToStoreIp; + @ApiModelProperty(value="主叫VOIP语音文件存放服务器URL", required=true) + protected String fromToStoreUrl; + @ApiModelProperty(value="被叫VOIP语音文件存放服务器IP", required=true) + protected String toFromStoreIp; + @ApiModelProperty(value="被叫VOIP语音文件存放服务器URL", required=true) + protected String toFromStoreUrl; + @ApiModelProperty(value="节目ID", required=true) + protected String pid; + @ApiModelProperty(value="节目访问地址", required=true) + protected String url; + @ApiModelProperty(value="封堵现场片段路径", required=true) + protected String logUri; + @ApiModelProperty(value="封堵类型", required=true) + protected Integer fdType; + + public String getPid() { + return pid; + } + public void setPid(String pid) { + this.pid = pid; + } + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + public String getLogUri() { + return logUri; + } + public void setLogUri(String logUri) { + this.logUri = logUri; + } + public Integer getFdType() { + return fdType; + } + public void setFdType(Integer fdType) { + this.fdType = fdType; + } + public String getProtocol() { + return protocol; + } + public void setProtocol(String protocol) { + this.protocol = protocol; + } + public String getDuation() { + return duation; + } + public void setDuation(String duation) { + this.duation = duation; + } + public String getCallingAccount() { + return callingAccount; + } + public void setCallingAccount(String callingAccount) { + this.callingAccount = callingAccount; + } + public String getCalledAccount() { + return calledAccount; + } + public void setCalledAccount(String calledAccount) { + this.calledAccount = calledAccount; + } + public String getCallingNumber() { + return callingNumber; + } + public void setCallingNumber(String callingNumber) { + this.callingNumber = callingNumber; + } + public String getCalledNumber() { + return calledNumber; + } + public void setCalledNumber(String calledNumber) { + this.calledNumber = calledNumber; + } + public String getFromToStoreIp() { + return fromToStoreIp; + } + public void setFromToStoreIp(String fromToStoreIp) { + this.fromToStoreIp = fromToStoreIp; + } + public String getFromToStoreUrl() { + return fromToStoreUrl; + } + public void setFromToStoreUrl(String fromToStoreUrl) { + this.fromToStoreUrl = fromToStoreUrl; + } + public String getToFromStoreIp() { + return toFromStoreIp; + } + public void setToFromStoreIp(String toFromStoreIp) { + this.toFromStoreIp = toFromStoreIp; + } + public String getToFromStoreUrl() { + return toFromStoreUrl; + } + public void setToFromStoreUrl(String toFromStoreUrl) { + this.toFromStoreUrl = toFromStoreUrl; + } +} diff --git a/src/main/java/com/nis/restful/RestBusinessCode.java b/src/main/java/com/nis/restful/RestBusinessCode.java index f1b1192..015fc02 100644 --- a/src/main/java/com/nis/restful/RestBusinessCode.java +++ b/src/main/java/com/nis/restful/RestBusinessCode.java @@ -350,6 +350,10 @@ public enum RestBusinessCode { * 配置的service与action关系不存在 */ Service2ActionIsNull(4002010, "配置的service与action关系不存在"), + /** + * 状态更新操作,所有配置的isValid值必须相同 + */ + IsValidNonUniq(4002011, "状态更新操作,所有配置的isValid值必须相同"), /** * 配置分组中同一groupId出现多次 diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index f1b434a..3688777 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -191,4 +191,9 @@ public final class Constants { public static final String DIGEST_GEN_TOOL_PATH = Configurations.getStringProperty("digest.gen.tool.path", "maat-redis/digest_gen"); + /** + * 样例文件存放目录 + */ + public static final String MM_SAMPLE_DST_PATH = Configurations.getStringProperty("mmSampleDstPath", "/home/mesasoft/{tableType}/full/{fileName}"); + } 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 7721c14..9e9d203 100644 --- a/src/main/java/com/nis/web/controller/restful/LogController.java +++ b/src/main/java/com/nis/web/controller/restful/LogController.java @@ -19,6 +19,11 @@ import org.springframework.web.bind.annotation.RestController; import com.nis.domain.LogEntity; import com.nis.domain.Page; import com.nis.domain.restful.DkBehaviorLog; +import com.nis.domain.restful.MmAvIpLog; +import com.nis.domain.restful.MmAvUrlLog; +import com.nis.domain.restful.MmPicIpLog; +import com.nis.domain.restful.MmPicUrlLog; +import com.nis.domain.restful.MmVoipLog; import com.nis.domain.restful.NtcAppLog; import com.nis.domain.restful.NtcAttrTypeReport; import com.nis.domain.restful.NtcDdosLog; @@ -885,15 +890,10 @@ public class LogController extends BaseRestController { logPage.setList(new ArrayList()); } else { List list = tableMapping.get("obj"); -// if (tableMapping.get("obj").size() > page.getPageSize()) { -// list = tableMapping.get("obj").subList(0, page.getPageSize()); -// } else { -// list = tableMapping.get("obj").subList(0, tableMapping.get("obj").size()); -// } if (list.size() > 0) { String jsonString = JsonMapper.toJsonString(list); List List = (java.util.List) JsonMapper.fromJsonList(jsonString, - NtcDdosLog.class); + DkBehaviorLog.class); logPage.setList(List); logPage.setCount(List.size()); @@ -913,6 +913,272 @@ public class LogController extends BaseRestController { return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "行为识别日志检索成功", logPage, 0); } + @RequestMapping(value = "/mmAvIpLogs", method = RequestMethod.GET) + @ApiOperation(value = "音视频IP日志查询", httpMethod = "GET", notes = "对日志功能“音视频IP日志”提供数据基础查询服务") + public Map mmAvIpLogs(Page page, MmAvIpLog mmAvIpLog, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + request, null); + + Page logPage = null; + try { + resetTime(mmAvIpLog); + testService.queryConditionCheck(auditLogThread, start, mmAvIpLog, MmAvIpLog.class, page); + logPage = new Page(); + logPage.setPageNo(page.getPageNo()); + logPage.setPageSize(page.getPageSize()); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(MmAvIpLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, mmAvIpLog, + Configurations.getStringProperty(MmAvIpLog.class.getSimpleName() + "HiveTable", "MM_AV_IP_LOG"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, MmAvIpLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + logPage.setList(new ArrayList()); + } else { + List list = tableMapping.get("obj"); + if (list.size() > 0) { + String jsonString = JsonMapper.toJsonString(list); + List List = (java.util.List) JsonMapper.fromJsonList(jsonString, + MmAvIpLog.class); + logPage.setList(List); + logPage.setCount(List.size()); + + } else { + logPage.setList(new ArrayList()); + } + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "音视频IP日志检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音视频IP日志检索成功", + logPage, 0); + } + @RequestMapping(value = "/mmAvUrlLogs", method = RequestMethod.GET) + @ApiOperation(value = "音视频URL日志查询", httpMethod = "GET", notes = "对日志功能“音视频URL日志”提供数据基础查询服务") + public Map mmAvUrlLogs(Page page, MmAvUrlLog mmAvUrlLog, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + request, null); + + Page logPage = null; + try { + resetTime(mmAvUrlLog); + testService.queryConditionCheck(auditLogThread, start, mmAvUrlLog, MmAvUrlLog.class, page); + logPage = new Page(); + logPage.setPageNo(page.getPageNo()); + logPage.setPageSize(page.getPageSize()); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(MmAvIpLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, mmAvUrlLog, + Configurations.getStringProperty(MmAvUrlLog.class.getSimpleName() + "HiveTable", "MM_AV_URL_LOG"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, MmAvIpLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + logPage.setList(new ArrayList()); + } else { + List list = tableMapping.get("obj"); + if (list.size() > 0) { + String jsonString = JsonMapper.toJsonString(list); + List List = (java.util.List) JsonMapper.fromJsonList(jsonString, + MmAvUrlLog.class); + logPage.setList(List); + logPage.setCount(List.size()); + + } else { + logPage.setList(new ArrayList()); + } + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "音视频URL日志检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音视频URL日志检索成功", + logPage, 0); + } + @RequestMapping(value = "/mmPicIpLogs", method = RequestMethod.GET) + @ApiOperation(value = "图片IP日志查询", httpMethod = "GET", notes = "对日志功能“图片IP日志”提供数据基础查询服务") + public Map mmPicIpLogs(Page page, MmPicIpLog mmPicIpLog, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + request, null); + + Page logPage = null; + try { + resetTime(mmPicIpLog); + testService.queryConditionCheck(auditLogThread, start, mmPicIpLog, MmPicIpLog.class, page); + logPage = new Page(); + logPage.setPageNo(page.getPageNo()); + logPage.setPageSize(page.getPageSize()); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(MmPicIpLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, mmPicIpLog, + Configurations.getStringProperty(MmPicIpLog.class.getSimpleName() + "HiveTable", "MM_PIC_IP_LOG"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, MmPicIpLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + logPage.setList(new ArrayList()); + } else { + List list = tableMapping.get("obj"); + if (list.size() > 0) { + String jsonString = JsonMapper.toJsonString(list); + List List = (java.util.List) JsonMapper.fromJsonList(jsonString, + MmPicIpLog.class); + logPage.setList(List); + logPage.setCount(List.size()); + + } else { + logPage.setList(new ArrayList()); + } + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "图片IP日志检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片IP日志检索成功", + logPage, 0); + } + @RequestMapping(value = "/mmPicUrlLogs", method = RequestMethod.GET) + @ApiOperation(value = "图片URL日志查询", httpMethod = "GET", notes = "对日志功能“图片URL日志”提供数据基础查询服务") + public Map mmPicUrlLogs(Page page, MmPicUrlLog mmPicUrlLog, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + request, null); + + Page logPage = null; + try { + resetTime(mmPicUrlLog); + testService.queryConditionCheck(auditLogThread, start, mmPicUrlLog, MmPicUrlLog.class, page); + logPage = new Page(); + logPage.setPageNo(page.getPageNo()); + logPage.setPageSize(page.getPageSize()); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(MmPicUrlLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, mmPicUrlLog, + Configurations.getStringProperty(MmPicUrlLog.class.getSimpleName() + "HiveTable", "MM_PIC_URL_LOG"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, MmPicUrlLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + logPage.setList(new ArrayList()); + } else { + List list = tableMapping.get("obj"); + if (list.size() > 0) { + String jsonString = JsonMapper.toJsonString(list); + List List = (java.util.List) JsonMapper.fromJsonList(jsonString, + MmPicUrlLog.class); + logPage.setList(List); + logPage.setCount(List.size()); + + } else { + logPage.setList(new ArrayList()); + } + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "图片URL日志检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片URL日志检索成功", + logPage, 0); + } + + @RequestMapping(value = "/mmVoipLogs", method = RequestMethod.GET) + @ApiOperation(value = "VOIP日志查询", httpMethod = "GET", notes = "对日志功能“VOIP日志”提供数据基础查询服务") + public Map mmVoipLogs(Page page, MmVoipLog mmVoipLog, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); + SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + request, null); + + Page logPage = null; + try { + resetTime(mmVoipLog); + testService.queryConditionCheck(auditLogThread, start, mmVoipLog, MmAvIpLog.class, page); + logPage = new Page(); + logPage.setPageNo(page.getPageNo()); + logPage.setPageSize(page.getPageSize()); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(MmVoipLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + ResultSet rs = HiveSqlService.getResultSet(page, mmVoipLog, + Configurations.getStringProperty(MmVoipLog.class.getSimpleName() + "HiveTable", "MM_VOIP_LOG"), + getCol2Col(), orderBy, null); + Map tableMapping = HiveJDBC.tableMapping(page, null, rs, MmVoipLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + logPage.setList(new ArrayList()); + } else { + List list = tableMapping.get("obj"); + if (list.size() > 0) { + String jsonString = JsonMapper.toJsonString(list); + List List = (java.util.List) JsonMapper.fromJsonList(jsonString, + MmVoipLog.class); + logPage.setList(List); + logPage.setCount(List.size()); + + } else { + logPage.setList(new ArrayList()); + } + } + } catch (Exception e) { + e.printStackTrace(); + auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "VOIP日志检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VOIP日志检索成功", + logPage, 0); + } @RequestMapping(value = "/ntcPzReport", method = RequestMethod.GET) @ApiOperation(value = "配置日志总量统计", httpMethod = "GET", notes = "配置命中日志数量实时统计报表,对外提供多种数据表现形式,具体可应用于界面配置命中总量业务、配置报表业务等") public Map ntcPzReport(Page page, NtcPzReport ntcPzReport, Model model, HttpServletRequest request, diff --git a/src/main/java/com/nis/web/dao/DfLogSearchDao.xml b/src/main/java/com/nis/web/dao/DfLogSearchDao.xml index b818b7a..514ed6d 100644 --- a/src/main/java/com/nis/web/dao/DfLogSearchDao.xml +++ b/src/main/java/com/nis/web/dao/DfLogSearchDao.xml @@ -373,10 +373,159 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java index e1c686b..fc26afb 100644 --- a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java +++ b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java @@ -3033,7 +3033,8 @@ public class ConfigSourcesService extends BaseService { String maatTableName = ServiceAndRDBIndexReal .getUnMaatTableName(Integer.valueOf(srcMap.get("service") .toString().trim())); - dstStr="/home/mesasoft/"+maatTableName.substring(maatTableName.lastIndexOf("_")+1)+"/full/"+dstStr.substring(dstStr.lastIndexOf("/")+1); + String dstPath = Constants.MM_SAMPLE_DST_PATH.replace("{tableType}", maatTableName.substring(maatTableName.lastIndexOf("_")+1)); + dstPath=dstPath.replace("{fileName}", dstStr.substring(dstStr.lastIndexOf("/")+1)); }else if ("file_id".equals(commonSourceFieldCfg .getDstName())) { dstStr= dstStr.substring(dstStr.indexOf("/group")); @@ -3253,6 +3254,8 @@ public class ConfigSourcesService extends BaseService { } // Map> cfgMap = new HashMap>(); + //所有状态更新的配置isValid的值必须相同 + Map validIdMap = new HashMap(); for (int i = 0; i < jsonObjectList.size(); i++) { JsonObject jsonObj = (JsonObject) jsonObjectList.get(i); Map srcMap = JSONObject.fromObject(JSONObject @@ -3265,6 +3268,7 @@ public class ConfigSourcesService extends BaseService { msg + sb.toString(), CompileVal.getBusinessCode()); } + validIdMap.put(srcMap.get("isValid").toString(), srcMap.get("isValid").toString()); Integer service = Integer.valueOf(srcMap.get("service").toString()); Long cfgId = Long.valueOf(srcMap.get("cfgId").toString()); if (cfgMap.containsKey(service)) { @@ -3276,6 +3280,13 @@ public class ConfigSourcesService extends BaseService { } } + if (validIdMap.size()>1) { + thread.setExceptionInfo(RestBusinessCode.IsValidNonUniq.getErrorReason()); + throw new RestServiceException(thread, + System.currentTimeMillis() - start, + RestBusinessCode.IsValidNonUniq.getErrorReason(), + RestBusinessCode.IsValidNonUniq.getValue()); + } Map>> restMap = new HashMap>>(); Iterator serviceIterator = cfgMap.keySet().iterator(); while (serviceIterator.hasNext()) { @@ -3302,7 +3313,8 @@ public class ConfigSourcesService extends BaseService { } } try { - configRedisService.delUnMaatConfig(restMap); + + configRedisService.delUnMaatConfig(restMap,validIdMap.containsKey("0")?true:false); } catch (Exception e) { // TODO: handle exception logger1.error(e.getMessage()); @@ -3343,10 +3355,12 @@ public class ConfigSourcesService extends BaseService { if (!StringUtil.isNumeric(service)) { CompileVal.setBusinessCode(RestBusinessCode.IsValidInWrongRange.getValue()); return RestBusinessCode.IsValidInWrongRange.getErrorReason(); - } else if (!isValid.equals("0")) { - CompileVal.setBusinessCode(RestBusinessCode.IsValidIsF.getValue()); - return RestBusinessCode.IsValidIsF.getErrorReason(); } + //配置取消改为状态更新(停/启用) +// else if (!isValid.equals("0")) { +// CompileVal.setBusinessCode(RestBusinessCode.IsValidIsF.getValue()); +// return RestBusinessCode.IsValidIsF.getErrorReason(); +// } } return "ok"; } diff --git a/src/main/resources/applicationConfig-rule.properties b/src/main/resources/applicationConfig-rule.properties index cda6abf..ea4cebe 100644 --- a/src/main/resources/applicationConfig-rule.properties +++ b/src/main/resources/applicationConfig-rule.properties @@ -35,7 +35,7 @@ service=1:128;2:128;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;26:16; #0x12 DNS阻断 18=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;15:NTC_DNS_REGION;18:NTC_IP_RANGE #0x13 SSL阻断 -19=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:NTC_SSL_SNI,NTC_SSL_SAN,NTC_SSL_CA,NTC_SSL_CA;18:NTC_IP_RANGE +19=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:NTC_SSL_SNI,NTC_SSL_SAN,NTC_SSL_CA;18:NTC_IP_RANGE #0x14 MAIL阻断 20=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;15:NTC_MAIL_HDR,NTC_MAIL_BODY;16:NTC_FILE_DIGEST;18:NTC_IP_RANGE #0x15 FTP阻断 @@ -69,7 +69,7 @@ service=1:128;2:128;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;26:16; #0x82 DNS监测 130=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;15:NTC_DNS_REGION;18:NTC_IP_RANGE #0x83 SSL监测 -131=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:NTC_SSL_SNI,NTC_SSL_SAN,NTC_SSL_CN,NTC_SSL_CA;18:NTC_IP_RANGE +131=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:NTC_SSL_SNI,NTC_SSL_SAN,NTC_SSL_CA;18:NTC_IP_RANGE #0x84 MAIL监测 132=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;15:NTC_MAIL_HDR,NTC_MAIL_BODY;16:NTC_FILE_DIGEST;18:NTC_IP_RANGE #0x85 FTP监测 diff --git a/src/main/resources/applicationLog-hive.properties b/src/main/resources/applicationLog-hive.properties index 52c3c4b..718d85b 100644 --- a/src/main/resources/applicationLog-hive.properties +++ b/src/main/resources/applicationLog-hive.properties @@ -13,10 +13,11 @@ NtcFtpLogHiveTable=NTC_FTP_LOG NtcAppLogHiveTable=NTC_APP_LOG NtcDdosLogHiveTable=NTC_DDOS_LOG DkBehaviorLogHiveTable=DK_BEHAVIOR_LOG - - - - +MmAvIpLogHiveTable=MM_AV_IP_LOG +MmAvUrlLogHiveTable=MM_AV_URL_LOG +MmPicIpLogHiveTable=MM_PIC_IP_LOG +MmPicUrlLogHiveTable=MM_PIC_URL_LOG +MmVoipIpLogHiveTable=MM_VOIP_LOG diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index 90b689b..18094d3 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -254,4 +254,6 @@ redisStatisticsReal=[COMPILE_ID];\t;[SERVICE];\t;[ACTION];\t;[CONT_TYPE];\t;[ATT redisStatisticsRealDBIndex=14 #maat测试程序输出日志的文件目录 -maatTestLogPath=c:/maat/mmat.log \ No newline at end of file +maatTestLogPath=c:/maat/mmat.log +#样例文件存放目录,{tableType}和{fileName}会替换成具体内容 +mmSampleDstPath=/home/mesasoft/{tableType}/full/{fileName} \ No newline at end of file