通联关系增加:
1、增加展示列:APP、Protocol、web 2、增加查询条件:SASN 、DASN、app、web、protocol 3、app protocol website 支持多查询,每个条件限制10个 4、serverLocate、clientLocate支持模糊查询
This commit is contained in:
@@ -109,6 +109,26 @@ public abstract class LogEntity<T> implements Serializable {
|
||||
protected String searchCapIp;//处理机IP
|
||||
protected String searchFoundStartTime;//开始发现时间
|
||||
protected String searchFoundEndTime;//结束发现时间
|
||||
|
||||
//add by dxy 2019-01-05 仅限于NtcConnRecordLog需求,考虑以后可能会放开其他日志查询,所以放到公共类
|
||||
protected String searchServerLocate;//serverLocate
|
||||
protected String searchClientLocate;//clientLocate
|
||||
|
||||
public String getSearchServerLocate() {
|
||||
return searchServerLocate;
|
||||
}
|
||||
|
||||
public void setSearchServerLocate(String searchServerLocate) {
|
||||
this.searchServerLocate = searchServerLocate;
|
||||
}
|
||||
|
||||
public String getSearchClientLocate() {
|
||||
return searchClientLocate;
|
||||
}
|
||||
|
||||
public void setSearchClientLocate(String searchClientLocate) {
|
||||
this.searchClientLocate = searchClientLocate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前实体分页对象
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.LogEntity;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -28,7 +29,23 @@ public class NtcConnRecordLog extends LogEntity<NtcConnRecordLog> {
|
||||
protected String c2sByteNum;
|
||||
@ApiModelProperty(value = "", required = true)
|
||||
protected String s2cByteNum;
|
||||
|
||||
@ApiModelProperty(value = "", required = true)
|
||||
protected Long protoId;
|
||||
@ApiModelProperty(value = "", required = true)
|
||||
protected Long appId;
|
||||
@ApiModelProperty(value = "", required = true)
|
||||
protected Long webId;
|
||||
|
||||
protected String searchSAsn;//sAsn
|
||||
protected String searchDAsn;//dAsn
|
||||
protected String searchAppId;//app
|
||||
protected String searchWebId;//web
|
||||
protected String searchProtoId;//proto
|
||||
//protected String searchServerLocate;//serverLocate
|
||||
//protected String searchClientLocate;//clientLocate
|
||||
|
||||
@JsonIgnore
|
||||
public String getAppLabel() {
|
||||
return appLabel;
|
||||
}
|
||||
@@ -69,4 +86,76 @@ public class NtcConnRecordLog extends LogEntity<NtcConnRecordLog> {
|
||||
this.s2cByteNum = s2cByteNum;
|
||||
}
|
||||
|
||||
public Long getProtoId() {
|
||||
return protoId;
|
||||
}
|
||||
|
||||
public void setProtoId(Long protoId) {
|
||||
this.protoId = protoId;
|
||||
}
|
||||
|
||||
public Long getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(Long appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public Long getWebId() {
|
||||
return webId;
|
||||
}
|
||||
|
||||
public void setWebId(Long webId) {
|
||||
this.webId = webId;
|
||||
}
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchSAsn() {
|
||||
return searchSAsn;
|
||||
}
|
||||
|
||||
public void setSearchSAsn(String searchSAsn) {
|
||||
this.searchSAsn = searchSAsn;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchDAsn() {
|
||||
return searchDAsn;
|
||||
}
|
||||
|
||||
public void setSearchDAsn(String searchDAsn) {
|
||||
this.searchDAsn = searchDAsn;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchAppId() {
|
||||
return searchAppId;
|
||||
}
|
||||
|
||||
public void setSearchAppId(String searchAppId) {
|
||||
this.searchAppId = searchAppId;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchWebId() {
|
||||
return searchWebId;
|
||||
}
|
||||
|
||||
public void setSearchWebId(String searchWebId) {
|
||||
this.searchWebId = searchWebId;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchProtoId() {
|
||||
return searchProtoId;
|
||||
}
|
||||
|
||||
public void setSearchProtoId(String searchProtoId) {
|
||||
this.searchProtoId = searchProtoId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -696,6 +696,7 @@ public class NtcLogSearchController extends BaseRestController {
|
||||
ntcConnRecordLog.setSearchFoundEndTime(map.get("endTime"));
|
||||
}
|
||||
ntcLogService.queryConditionCheck(auditLogThread, start, ntcConnRecordLog, NtcConnRecordLog.class, page);
|
||||
ntcLogService.ntcConnRecordLogsQueryConditionCheck(auditLogThread, start, ntcConnRecordLog, NtcConnRecordLog.class, page);
|
||||
logDataService.getData(page, ntcConnRecordLog);
|
||||
} catch (Exception e) {
|
||||
auditLogThread.setExceptionInfo("通联关系日志检索失败:" + e.getMessage());
|
||||
|
||||
@@ -1523,6 +1523,15 @@
|
||||
<result column="c2s_byte_num" jdbcType="VARCHAR" property="c2sByteNum" />
|
||||
<result column="s2c_byte_num" jdbcType="VARCHAR" property="s2cByteNum" />
|
||||
|
||||
<result column="proto_id" jdbcType="BIGINT" property="protoId" />
|
||||
<result column="app_id" jdbcType="BIGINT" property="appId" />
|
||||
<result column="web_id" jdbcType="BIGINT" property="webId" />
|
||||
<!--
|
||||
<result column="os_id" jdbcType="BIGINT" property="osId" />
|
||||
<result column="bs_id" jdbcType="BIGINT" property="bsId" />
|
||||
<result column="behav_id" jdbcType="BIGINT" property="behavId" />
|
||||
-->
|
||||
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@@ -251,13 +251,15 @@ public class LogDataService {
|
||||
if (type.equals("java.lang.String")) {
|
||||
if (field.equals("url") || field.equals("website")) {
|
||||
whereSB.append(" and " + field + " like '" + StringEscapeUtils.unescapeHtml4(value.toString().trim()) + "%'");
|
||||
} else if (field.equals("client_locate") || field.equals("server_locate") ) {
|
||||
whereSB.append(" and " + field + " like '%" + StringEscapeUtils.unescapeHtml4(value.toString().trim()) + "%'");
|
||||
} else {
|
||||
whereSB.append(" and " + field + "='"
|
||||
+ StringEscapeUtils.unescapeHtml4(value.toString().trim()) + "'");
|
||||
}
|
||||
} else if (type.equals("java.lang.Integer") || type.equals("int")
|
||||
|| type.equals("java.lang.Long") || type.equals("long")) {
|
||||
if(field.equals("cfg_id")) {
|
||||
if(field.equals("cfg_id") || field.equals("web_id") || field.equals("app_id") || field.equals("proto_id")) {
|
||||
whereSB.append(" and " + filedAndColumnMap.get(key).toLowerCase() + " in("
|
||||
+ value.toString().trim()+")");
|
||||
}else {
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.NtcConnRecordLog;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.web.service.AuditLogThread;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
|
||||
/**
|
||||
* @Description:TODO(这里用一句话描述这个类的作用)
|
||||
@@ -13,4 +21,85 @@ import com.nis.web.service.BaseLogService;
|
||||
@Service
|
||||
public class NtcLogService extends BaseLogService {
|
||||
|
||||
/**
|
||||
* 验证日志查询条件格式是否正确
|
||||
*
|
||||
* @param thread
|
||||
* @param start
|
||||
* @param entity
|
||||
* @param clazz
|
||||
* @param page
|
||||
*/
|
||||
public void ntcConnRecordLogsQueryConditionCheck(AuditLogThread thread, long start, NtcConnRecordLog entity, Class clazz, Page page) {
|
||||
logger.info("ntcConnRecordLogsQueryConditionCheck start----" + System.currentTimeMillis());
|
||||
|
||||
//app protocol website
|
||||
if (!StringUtil.isBlank(entity.getSearchAppId())) {
|
||||
String[] split = org.apache.commons.lang.StringUtils.split(entity.getSearchAppId(), ",");
|
||||
if (split.length > 10) {
|
||||
throw new RestServiceException("searchAppId max(10)",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
for (String appId : split) {
|
||||
try {
|
||||
Long.parseLong(appId);
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchAppId error", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isBlank(entity.getSearchProtoId())) {
|
||||
String[] split = org.apache.commons.lang.StringUtils.split(entity.getSearchProtoId(), ",");
|
||||
if (split.length > 10) {
|
||||
throw new RestServiceException("searchProtoId max(10)",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
for (String protoId : split) {
|
||||
try {
|
||||
Long.parseLong(protoId);
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchAppId error", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isBlank(entity.getSearchWebId())) {
|
||||
String[] split = org.apache.commons.lang.StringUtils.split(entity.getSearchWebId(), ",");
|
||||
if (split.length > 10) {
|
||||
throw new RestServiceException("searchWebId max(10)",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
for (String appId : split) {
|
||||
try {
|
||||
Long.parseLong(appId);
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchWebId 参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchDirection())) {
|
||||
Integer.parseInt(entity.getSearchDirection());
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RestServiceException("getSearchDirection参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("getSearchDirection参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchEntranceId())) {
|
||||
Long.parseLong(entity.getSearchEntranceId());
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RestServiceException("searchEntranceId参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchEntranceId参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
logger.info("ntcConnRecordLogsQueryConditionCheck end----" + System.currentTimeMillis());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user