通联关系增加:

1、增加展示列:APP、Protocol、web
2、增加查询条件:SASN 、DASN、app、web、protocol
3、app protocol website 支持多查询,每个条件限制10个
4、serverLocate、clientLocate支持模糊查询
This commit is contained in:
dongxiaoyan
2019-01-06 13:48:53 +08:00
parent 9cd61f11ca
commit 568072f3fe
6 changed files with 211 additions and 1 deletions

View File

@@ -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());

View File

@@ -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>

View File

@@ -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 {

View File

@@ -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());
}
}