1:更新642的表达式结构,及添加opTime字段
2:为0x401 APP载荷特征表添加数值类表APP_TCP_SESSION_BYTE 3:更新urlreport接口 4:更新asnreport接口 5:添加iprange统计入库 6:修改配置入库时,先打印错误信息在回滚事务 7:修改配置入库打印的日志信息 8:更改通联关系app_label的数据类型为varchar 9:提交洪庆发来的trafficIpActiveStatisticDao.xml
This commit is contained in:
@@ -2,6 +2,7 @@ package com.nis.web.service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -80,6 +81,58 @@ public class LogDataService {
|
||||
localLogJDBCByDruid.getNtcConnRecordPercentData(ntcConnRecordPercent, totalSql.toString(), true);
|
||||
return ntcConnRecordPercent;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws ParseException {
|
||||
String asn = "s_asn ";
|
||||
|
||||
long startTime = sdf.parse("2018-12-17 21:30:00").getTime() / 1000;
|
||||
long endTime = sdf.parse("2018-12-17 21:50:00").getTime() / 1000;
|
||||
|
||||
long second = 200l;
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("SELECT SUM(s2c_pkt_num + s2c_pkt_num)*8/");
|
||||
sql.append(second);
|
||||
sql.append(" AS pps , SUM(c2s_byte_num + s2c_byte_num)*8/");
|
||||
sql.append(second);
|
||||
sql.append(" AS bps,");
|
||||
sql.append(asn);
|
||||
sql.append(
|
||||
" asn FROM tbs_ods_ntc_conn_record_log_local t WHERE found_time IN ( SELECT DISTINCT found_time FROM tbs_ods_ntc_conn_record_log_local WHERE found_time >= ");
|
||||
sql.append(startTime);
|
||||
sql.append(" and found_time< ");
|
||||
sql.append(endTime);
|
||||
StringBuffer countSql = new StringBuffer();
|
||||
countSql.append("select count(1) from (");
|
||||
countSql.append(sql);
|
||||
countSql.append(" ) group by ");
|
||||
countSql.append(asn+")");
|
||||
|
||||
Integer startNum =0;
|
||||
Integer limitCount = startNum + 20;
|
||||
|
||||
sql.append(" limit " + limitCount + " ) group by "+asn+" limit " + startNum + "," + 20);
|
||||
|
||||
|
||||
System.out.println(sql);
|
||||
System.out.println(countSql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void getNtcAsnRecord(Page page, NtcAsnRecord ntcAsnRecord) throws Exception {
|
||||
long startTime = sdf.parse(ntcAsnRecord.getSearchFoundStartTime().toString().trim()).getTime() / 1000;
|
||||
@@ -88,26 +141,36 @@ public class LogDataService {
|
||||
throw new RestServiceException("searchFoundStartTime() can not exceed searchFoundEndTime",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
String asn = "s_asn ";
|
||||
if (ntcAsnRecord.getSearchAsnType().trim().equals("1")) {
|
||||
asn = "d_asn ";
|
||||
}
|
||||
|
||||
long second = endTime - startTime;
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("SELECT SUM(s2c_pkt_num + s2c_pkt_num)*8/");
|
||||
sql.append(second);
|
||||
sql.append(" AS pps , SUM(c2s_byte_num + s2c_byte_num)*8/");
|
||||
sql.append(second);
|
||||
sql.append(" AS bps,");
|
||||
sql.append(asn);
|
||||
sql.append(
|
||||
" AS bps,d_asn,s_asn FROM tbs_ods_ntc_conn_record_log_local t WHERE found_time IN ( SELECT DISTINCT found_time FROM tbs_ods_ntc_conn_record_log_local WHERE found_time >= ");
|
||||
" asn FROM tbs_ods_ntc_conn_record_log_local t WHERE found_time IN ( SELECT DISTINCT found_time FROM tbs_ods_ntc_conn_record_log_local WHERE found_time >= ");
|
||||
sql.append(startTime);
|
||||
sql.append(" and found_time< ");
|
||||
sql.append(endTime);
|
||||
StringBuffer countSql = new StringBuffer();
|
||||
countSql.append("select count(1) from (");
|
||||
countSql.append(sql);
|
||||
countSql.append(" ) group by s_asn,d_asn)");
|
||||
|
||||
countSql.append(" ) group by ");
|
||||
countSql.append(asn+")");
|
||||
Integer startNum = (page.getPageNo() - 1) * page.getPageSize();
|
||||
Integer limitCount = startNum + page.getPageSize();
|
||||
|
||||
sql.append(" limit " + limitCount + " ) group by s_asn,d_asn limit " + startNum + "," + page.getPageSize());
|
||||
sql.append(" limit " + limitCount + " ) group by "+asn+" limit " + startNum + "," + page.getPageSize());
|
||||
|
||||
localLogJDBCByDruid.getCount(page, countSql.toString());
|
||||
|
||||
@@ -228,7 +291,7 @@ public class LogDataService {
|
||||
String type = filedsType.get(key).trim();
|
||||
if (type.equals("java.lang.String")) {
|
||||
String field = filedAndColumnMap.get(key).toLowerCase();
|
||||
if (field.equals("url")||field.equals("website")) {
|
||||
if (field.equals("url") || field.equals("website")) {
|
||||
whereSB.append(" and " + field + " like '" + value.toString().trim() + "%'");
|
||||
} else {
|
||||
whereSB.append(" and " + field + "='"
|
||||
|
||||
@@ -160,9 +160,9 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.CannotConnectionRedis.getValue());
|
||||
|
||||
} catch (Exception e) {
|
||||
transaction.discard();
|
||||
String error = "保存非maat类配置发生了异常," + e.getMessage();
|
||||
logger.error(error + " " + ExceptionUtil.getExceptionMsg(e));
|
||||
transaction.discard();
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.SaveDataInError.getValue());
|
||||
} finally {
|
||||
// 释放连接到连接池
|
||||
@@ -500,9 +500,9 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
logger.error(error + " " + ExceptionUtil.getExceptionMsg(e));
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.CannotConnectionRedis.getValue());
|
||||
} catch (Exception e) {
|
||||
transaction.discard();
|
||||
String error = "保存maat类配置发生了异常" + e.getMessage();
|
||||
logger.error(error + " " + ExceptionUtil.getExceptionMsg(e));
|
||||
transaction.discard();
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.SaveDataInError.getValue());
|
||||
} finally {
|
||||
// 释放连接到连接池
|
||||
@@ -879,9 +879,9 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
logger.error(error + " " + ExceptionUtil.getExceptionMsg(e));
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.CannotConnectionRedis.getValue());
|
||||
} catch (Exception e) {
|
||||
transaction.discard();
|
||||
String error = "删除非maat类配置发生了异常," + e.getMessage();
|
||||
logger.error(error + " " + ExceptionUtil.getExceptionMsg(e));
|
||||
transaction.discard();
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.DeleteDataInError.getValue());
|
||||
} finally {
|
||||
// 释放连接到连接池
|
||||
@@ -993,12 +993,13 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.CannotConnectionRedis.getValue());
|
||||
|
||||
} catch (Exception e) {
|
||||
transaction.discard();
|
||||
|
||||
int businessCode = RestBusinessCode.service_runtime_error.getValue();
|
||||
if (e instanceof ServiceRuntimeException) {
|
||||
businessCode = ((ServiceRuntimeException) e).getErrorCode();
|
||||
}
|
||||
logger.error("删除maat配置发生了异常" + ExceptionUtil.getExceptionMsg(e));
|
||||
transaction.discard();
|
||||
throw new ServiceRuntimeException("删除maat配置发生了异常," + e.getMessage(), businessCode);
|
||||
} finally {
|
||||
// 释放连接到连接池
|
||||
@@ -1643,9 +1644,10 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
logger.error(error + " " + ExceptionUtil.getExceptionMsg(e));
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.CannotConnectionRedis.getValue());
|
||||
} catch (Exception e) {
|
||||
transaction.discard();
|
||||
|
||||
String error = "保存分组复用maat类域配置发生了异常" + e.getMessage();
|
||||
logger.error(error + " " + ExceptionUtil.getExceptionMsg(e));
|
||||
transaction.discard();
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.SaveDataInError.getValue());
|
||||
} finally {
|
||||
// 释放连接到连接池
|
||||
@@ -1936,10 +1938,10 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||
logger.error(error + " " + ExceptionUtil.getExceptionMsg(e));
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.CannotConnectionRedis.getValue());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
transaction.discard();
|
||||
|
||||
String error = "删除分组复用maat类域配置发生了异常" + e.getMessage();
|
||||
logger.error(error + " " + ExceptionUtil.getExceptionMsg(e));
|
||||
transaction.discard();
|
||||
throw new ServiceRuntimeException(error, RestBusinessCode.SaveDataInError.getValue());
|
||||
} finally {
|
||||
// 释放连接到连接池
|
||||
|
||||
@@ -15,14 +15,13 @@ import com.nis.domain.restful.NtcAttrTypeReport;
|
||||
import com.nis.domain.restful.NtcDestipCountryReport;
|
||||
import com.nis.domain.restful.NtcEntranceReport;
|
||||
import com.nis.domain.restful.NtcIpRangeReport;
|
||||
import com.nis.domain.restful.NtcIpURLReport;
|
||||
import com.nis.domain.restful.NtcLwhhReport;
|
||||
import com.nis.domain.restful.NtcPzReport;
|
||||
import com.nis.domain.restful.NtcRadiusReport;
|
||||
import com.nis.domain.restful.NtcServiceReport;
|
||||
import com.nis.domain.restful.NtcSrcipDomesticReport;
|
||||
import com.nis.domain.restful.NtcTagReport;
|
||||
import com.nis.domain.restful.NtcURLReport;
|
||||
import com.nis.domain.restful.NtcURLIpReport;
|
||||
import com.nis.web.dao.NtcReportDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
@@ -109,37 +108,9 @@ public class NtcReportService extends BaseLogService {
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<NtcURLReport> findNtcURLReport(Page<NtcURLReport> page, NtcURLReport entity) throws Exception {
|
||||
public Page<NtcURLIpReport> findNtcURLReport(Page<NtcURLIpReport> page, NtcURLIpReport entity) throws Exception {
|
||||
entity.setPage(page);
|
||||
Map<String, List<NtcIpURLReport>> map = new HashMap<>();
|
||||
List<NtcURLReport> list = new ArrayList<>();
|
||||
|
||||
List<NtcIpURLReport> findNtcIpURLReport = dao.findNtcIpURLReport(entity);
|
||||
for (NtcIpURLReport ntcIpURLReport : findNtcIpURLReport) {
|
||||
String url = ntcIpURLReport.getUrl();
|
||||
if (map.containsKey(url)) {
|
||||
map.get(url).add(ntcIpURLReport);
|
||||
|
||||
} else {
|
||||
List<NtcIpURLReport> ipUrlList = new ArrayList<>();
|
||||
ipUrlList.add(ntcIpURLReport);
|
||||
map.put(url, ipUrlList);
|
||||
}
|
||||
}
|
||||
|
||||
for (String url : map.keySet()) {
|
||||
NtcURLReport ntcURLReport = new NtcURLReport();
|
||||
ntcURLReport.setUrl(url);
|
||||
long count = 0l;
|
||||
List<NtcIpURLReport> list2 = map.get(url);
|
||||
for (NtcIpURLReport ntcIpURLReport : list2) {
|
||||
count += ntcIpURLReport.getSum();
|
||||
}
|
||||
ntcURLReport.setUrlCount(count);
|
||||
ntcURLReport.setDataList(list2);
|
||||
list.add(ntcURLReport);
|
||||
}
|
||||
page.setList(list);
|
||||
page.setList(dao.findNtcIpURLReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user