1:新增url统计查询的接口

2:新增ASN通联关系(源,目的)查询接口
This commit is contained in:
renkaige
2018-12-16 11:10:25 +06:00
parent e9f838998b
commit 630be99456
11 changed files with 859 additions and 248 deletions

View File

@@ -0,0 +1,77 @@
package com.nis.domain.restful;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
*
* @ClassName:NtcAsnRecord
* @Description:TODO(这里用一句话描述这个类的作用)
* @author rkg
* @date 2018年12月12日 下午2:00:16
* @version V1.0
*/
public class NtcAsnRecord implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String bps;
private String pps;
private String sAsn;
private String dAsn;
private String searchFoundStartTime;// 开始发现时间
private String searchFoundEndTime;// 结束发现时间
public String getBps() {
return bps;
}
public void setBps(String bps) {
this.bps = bps;
}
public String getPps() {
return pps;
}
public void setPps(String pps) {
this.pps = pps;
}
public String getsAsn() {
return sAsn;
}
public void setsAsn(String sAsn) {
this.sAsn = sAsn;
}
public String getdAsn() {
return dAsn;
}
public void setdAsn(String dAsn) {
this.dAsn = dAsn;
}
@JsonIgnore
public String getSearchFoundStartTime() {
return searchFoundStartTime;
}
public void setSearchFoundStartTime(String searchFoundStartTime) {
this.searchFoundStartTime = searchFoundStartTime;
}
@JsonIgnore
public String getSearchFoundEndTime() {
return searchFoundEndTime;
}
public void setSearchFoundEndTime(String searchFoundEndTime) {
this.searchFoundEndTime = searchFoundEndTime;
}
}

View File

@@ -14,13 +14,16 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
*/ */
public class NtcConnRecordPercent implements Serializable { public class NtcConnRecordPercent implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String bps; private String bps;
private String bpsPercent; private String bpsPercent;
private String pps; private String pps;
private String ppsPercent; private String ppsPercent;
private String searchFoundStartTime;// 开始发现时间 private String searchFoundStartTime;// 开始发现时间
private String searchFoundEndTime;// 结束发现时间 private String searchFoundEndTime;// 结束发现时间
private String searchStreamDir;// 流类型
public String getBps() { public String getBps() {
return bps; return bps;
@@ -71,13 +74,4 @@ public class NtcConnRecordPercent implements Serializable {
public void setSearchFoundEndTime(String searchFoundEndTime) { public void setSearchFoundEndTime(String searchFoundEndTime) {
this.searchFoundEndTime = searchFoundEndTime; this.searchFoundEndTime = searchFoundEndTime;
} }
@JsonIgnore
public String getSearchStreamDir() {
return searchStreamDir;
}
public void setSearchStreamDir(String searchStreamDir) {
this.searchStreamDir = searchStreamDir;
}
} }

View File

@@ -0,0 +1,46 @@
package com.nis.domain.restful;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wordnik.swagger.annotations.ApiModelProperty;
public class NtcIpURLReport implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "日志数量", required = true)
private Long sum;
@ApiModelProperty(value = "ip地址", required = true)
private String ipAddr;
@ApiModelProperty(value = "url", required = true)
private String url;
public Long getSum() {
return sum;
}
public void setSum(Long sum) {
this.sum = sum;
}
public String getIpAddr() {
return ipAddr;
}
public void setIpAddr(String ipAddr) {
this.ipAddr = ipAddr;
}
@JsonIgnore
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}

View File

@@ -0,0 +1,58 @@
package com.nis.domain.restful;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wordnik.swagger.annotations.ApiModelProperty;
public class NtcURLReport extends NtcReportEntity<NtcURLReport> {
/**
*
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "url", required = true)
private String url;
@ApiModelProperty(value = "日志数量", required = true)
private Long urlCount;
@ApiModelProperty(value = "ip数量列表", required = true)
private List<NtcIpURLReport> dataList;
private String searchUrl;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Long getUrlCount() {
return urlCount;
}
public void setUrlCount(Long urlCount) {
this.urlCount = urlCount;
}
public List<NtcIpURLReport> getDataList() {
return dataList;
}
public void setDataList(List<NtcIpURLReport> dataList) {
this.dataList = dataList;
}
@JsonIgnore
public String getSearchUrl() {
return searchUrl;
}
public void setSearchUrl(String searchUrl) {
this.searchUrl = searchUrl;
}
}

View File

@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page; import com.nis.domain.Page;
import com.nis.domain.restful.NtcAppLog; import com.nis.domain.restful.NtcAppLog;
import com.nis.domain.restful.NtcAsnRecord;
import com.nis.domain.restful.NtcBgpLog; import com.nis.domain.restful.NtcBgpLog;
import com.nis.domain.restful.NtcCollectRadiusLog; import com.nis.domain.restful.NtcCollectRadiusLog;
import com.nis.domain.restful.NtcCollectVoipLog; import com.nis.domain.restful.NtcCollectVoipLog;
@@ -733,7 +734,7 @@ public class NtcLogSearchController extends BaseRestController {
if (!StringUtil.isBlank(ntcConnRecordPercent.getSearchFoundEndTime())) { if (!StringUtil.isBlank(ntcConnRecordPercent.getSearchFoundEndTime())) {
sdf.setLenient(false); sdf.setLenient(false);
sdf.parse(ntcConnRecordPercent.getSearchFoundEndTime()); sdf.parse(ntcConnRecordPercent.getSearchFoundEndTime());
}else { } else {
throw new RestServiceException("searchFoundEndTime参数不能为空", throw new RestServiceException("searchFoundEndTime参数不能为空",
RestBusinessCode.param_formate_error.getValue()); RestBusinessCode.param_formate_error.getValue());
} }
@@ -749,7 +750,7 @@ public class NtcLogSearchController extends BaseRestController {
if (!StringUtil.isBlank(ntcConnRecordPercent.getSearchFoundStartTime())) { if (!StringUtil.isBlank(ntcConnRecordPercent.getSearchFoundStartTime())) {
sdf.setLenient(false); sdf.setLenient(false);
sdf.parse(ntcConnRecordPercent.getSearchFoundStartTime()); sdf.parse(ntcConnRecordPercent.getSearchFoundStartTime());
}else { } else {
throw new RestServiceException("searchFoundStartTime参数不能为空", throw new RestServiceException("searchFoundStartTime参数不能为空",
RestBusinessCode.param_formate_error.getValue()); RestBusinessCode.param_formate_error.getValue());
} }
@@ -779,4 +780,70 @@ public class NtcLogSearchController extends BaseRestController {
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "通联关系日志百分比检索成功", return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "通联关系日志百分比检索成功",
ntcConnRecordPercent, 0); ntcConnRecordPercent, 0);
} }
@RequestMapping(value = "/ntcAsnRecord", method = RequestMethod.GET)
@ApiOperation(value = "ASN通联关系(源,目的)查询", httpMethod = "GET", notes = "对日志功能“ASN通联关系(源,目的)查询”提供数据基础查询服务")
public Map<String, ?> ntcAsnRecord(Page page, NtcAsnRecord ntcAsnRecord, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
try {
if (StringUtil.isEmpty(ntcAsnRecord.getSearchFoundStartTime())
&& StringUtil.isEmpty(ntcAsnRecord.getSearchFoundEndTime())) {
Map<String, String> map = DateUtils.getLocalTime(null, null, Constants.LOG_LOCAL_TIME, "minute");
ntcAsnRecord.setSearchFoundStartTime(map.get("startTime"));
ntcAsnRecord.setSearchFoundEndTime(map.get("endTime"));
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
if (!StringUtil.isBlank(ntcAsnRecord.getSearchFoundEndTime())) {
sdf.setLenient(false);
sdf.parse(ntcAsnRecord.getSearchFoundEndTime());
} else {
throw new RestServiceException("searchFoundEndTime参数不能为空",
RestBusinessCode.param_formate_error.getValue());
}
} catch (ParseException e) {
throw new RestServiceException("searchFoundEndTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
throw new RestServiceException("searchFoundEndTime参数错误",
RestBusinessCode.param_formate_error.getValue());
}
try {
if (!StringUtil.isBlank(ntcAsnRecord.getSearchFoundStartTime())) {
sdf.setLenient(false);
sdf.parse(ntcAsnRecord.getSearchFoundStartTime());
} else {
throw new RestServiceException("searchFoundStartTime参数不能为空",
RestBusinessCode.param_formate_error.getValue());
}
} catch (ParseException e) {
throw new RestServiceException("searchFoundStartTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
throw new RestServiceException("searchFoundStartTime参数错误",
RestBusinessCode.param_formate_error.getValue());
}
logDataService.getNtcAsnRecord(page, ntcAsnRecord);
} catch (Exception e) {
auditLogThread.setExceptionInfo("ASN通联关系(源,目的)日志检索失败:" + e.getMessage());
logger.error("ASN通联关系(源,目的)检索失败:" + ExceptionUtil.getExceptionMsg(e));
if (e instanceof RestServiceException) {
throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start,
"ASN通联关系(源,目的)检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
} else if (e instanceof ServiceRuntimeException) {
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"ASN通联关系(源,目的)检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode());
} else {
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
"ASN通联关系(源,目的)检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "ASN通联关系(源,目的)检索成功",
page, 0);
}
} }

View File

@@ -23,6 +23,7 @@ import com.nis.domain.restful.NtcReportEntity;
import com.nis.domain.restful.NtcServiceReport; import com.nis.domain.restful.NtcServiceReport;
import com.nis.domain.restful.NtcSrcipDomesticReport; import com.nis.domain.restful.NtcSrcipDomesticReport;
import com.nis.domain.restful.NtcTagReport; import com.nis.domain.restful.NtcTagReport;
import com.nis.domain.restful.NtcURLReport;
import com.nis.restful.RestBusinessCode; import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException; import com.nis.restful.RestServiceException;
import com.nis.restful.ServiceRuntimeException; import com.nis.restful.ServiceRuntimeException;
@@ -396,6 +397,69 @@ public class SingleDimensionReport extends BaseRestController {
0); 0);
} }
@RequestMapping(value = "/ntcURLReport", method = RequestMethod.GET)
@ApiOperation(value = "URL统计查询服务", httpMethod = "GET", notes = "URL统计查询服务")
public Map<String, ?> ntcURLReport(Page page, NtcURLReport urlReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<?> reportPage = null;
try {
resetReportTime(urlReport,false);
ntcReportService.queryReportConditionCheck(saveLogThread, start, urlReport, NtcURLReport.class,
page);
String orderBy = "";
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
orderBy = Page.getOrderBySql(NtcURLReport.class.getSimpleName(), page.getOrderBy());
} else {
orderBy = "report_time";
}
page.setOrderBy(orderBy);
reportPage = ntcReportService.findNtcURLReport(
new Page<NtcURLReport>(request, response, NtcURLReport.class), urlReport);
} catch (Exception e) {
saveLogThread.setExceptionInfo("URL统计查询失败:"+e.getMessage());
logger.error("URL统计查询失败:"+ExceptionUtil.getExceptionMsg(e));
if (e instanceof RestServiceException) {
throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start,
"URL统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
} else if (e instanceof ServiceRuntimeException) {
throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start,
"URL统计查询失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode());
} else {
throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start,
"URL统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
}
}
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "URL统计查询成功", reportPage,
0);
}
@RequestMapping(value = "/ntcRadiusReport", method = RequestMethod.GET) @RequestMapping(value = "/ntcRadiusReport", method = RequestMethod.GET)
@ApiOperation(value = "用户行为统计查询服务", httpMethod = "GET", notes = "用户行为统计查询服务基于用户名或接入IP维度聚合") @ApiOperation(value = "用户行为统计查询服务", httpMethod = "GET", notes = "用户行为统计查询服务基于用户名或接入IP维度聚合")
public Map<String, ?> ntcRadiusReport(NtcRadiusReport ntcRadiusReport, Model model, public Map<String, ?> ntcRadiusReport(NtcRadiusReport ntcRadiusReport, Model model,

View File

@@ -5,12 +5,14 @@ import java.util.List;
import com.nis.domain.restful.NtcAttrTypeReport; import com.nis.domain.restful.NtcAttrTypeReport;
import com.nis.domain.restful.NtcDestipCountryReport; import com.nis.domain.restful.NtcDestipCountryReport;
import com.nis.domain.restful.NtcEntranceReport; import com.nis.domain.restful.NtcEntranceReport;
import com.nis.domain.restful.NtcIpURLReport;
import com.nis.domain.restful.NtcLwhhReport; import com.nis.domain.restful.NtcLwhhReport;
import com.nis.domain.restful.NtcPzReport; import com.nis.domain.restful.NtcPzReport;
import com.nis.domain.restful.NtcRadiusReport; import com.nis.domain.restful.NtcRadiusReport;
import com.nis.domain.restful.NtcServiceReport; import com.nis.domain.restful.NtcServiceReport;
import com.nis.domain.restful.NtcSrcipDomesticReport; import com.nis.domain.restful.NtcSrcipDomesticReport;
import com.nis.domain.restful.NtcTagReport; import com.nis.domain.restful.NtcTagReport;
import com.nis.domain.restful.NtcURLReport;
/** /**
* *
@@ -30,6 +32,7 @@ public interface NtcReportDao extends CrudDao {
List<NtcSrcipDomesticReport> findNtcSrcipDomesticReport(NtcSrcipDomesticReport pz); List<NtcSrcipDomesticReport> findNtcSrcipDomesticReport(NtcSrcipDomesticReport pz);
List<NtcDestipCountryReport> findNtcDestipCountryReport(NtcDestipCountryReport pz); List<NtcDestipCountryReport> findNtcDestipCountryReport(NtcDestipCountryReport pz);
List<NtcEntranceReport> findNtcEntranceReport(NtcEntranceReport pz); List<NtcEntranceReport> findNtcEntranceReport(NtcEntranceReport pz);
List<NtcIpURLReport> findNtcIpURLReport(NtcURLReport pz);
List<NtcRadiusReport> findAccounList(NtcRadiusReport pz); List<NtcRadiusReport> findAccounList(NtcRadiusReport pz);
List<NtcRadiusReport> findNasIpList(NtcRadiusReport pz); List<NtcRadiusReport> findNasIpList(NtcRadiusReport pz);
List<NtcRadiusReport> findNtcRadiusReport(NtcRadiusReport pz); List<NtcRadiusReport> findNtcRadiusReport(NtcRadiusReport pz);

View File

@@ -1,73 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.NtcReportDao"> <mapper namespace="com.nis.web.dao.NtcReportDao">
<resultMap id="NtcPzReportMap" type="com.nis.domain.restful.NtcPzReport"> <resultMap id="NtcPzReportMap"
type="com.nis.domain.restful.NtcPzReport">
<result column="CFG_ID" jdbcType="BIGINT" property="cfgId" /> <result column="CFG_ID" jdbcType="BIGINT" property="cfgId" />
<result column="SERVICE" jdbcType="INTEGER" property="service" /> <result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SUM" jdbcType="BIGINT" property="sum" /> <result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" /> <result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap> </resultMap>
<resultMap id="NtcServiceReportMap" type="com.nis.domain.restful.NtcServiceReport"> <resultMap id="NtcServiceReportMap"
type="com.nis.domain.restful.NtcServiceReport">
<result column="SERVICE" jdbcType="INTEGER" property="service" /> <result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SUM" jdbcType="BIGINT" property="sum" /> <result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" /> <result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap> </resultMap>
<resultMap id="NtcTagReportMap" type="com.nis.domain.restful.NtcTagReport"> <resultMap id="NtcTagReportMap"
type="com.nis.domain.restful.NtcTagReport">
<result column="TAG" jdbcType="INTEGER" property="tag" /> <result column="TAG" jdbcType="INTEGER" property="tag" />
<result column="SERVICE" jdbcType="INTEGER" property="service" /> <result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SUM" jdbcType="BIGINT" property="sum" /> <result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" /> <result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap> </resultMap>
<resultMap id="NtcAttrTypeReportMap" type="com.nis.domain.restful.NtcAttrTypeReport"> <resultMap id="NtcAttrTypeReportMap"
<result column="ATTR_TYPE" jdbcType="INTEGER" property="attrType" /> type="com.nis.domain.restful.NtcAttrTypeReport">
<result column="ATTR_TYPE" jdbcType="INTEGER"
property="attrType" />
<result column="SERVICE" jdbcType="INTEGER" property="service" /> <result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SUM" jdbcType="BIGINT" property="sum" /> <result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" /> <result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap> </resultMap>
<resultMap id="NtcLwhhReportMap" type="com.nis.domain.restful.NtcLwhhReport"> <resultMap id="NtcLwhhReportMap"
type="com.nis.domain.restful.NtcLwhhReport">
<result column="LWHH" jdbcType="INTEGER" property="lwhh" /> <result column="LWHH" jdbcType="INTEGER" property="lwhh" />
<result column="SERVICE" jdbcType="INTEGER" property="service" /> <result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SUM" jdbcType="BIGINT" property="sum" /> <result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" /> <result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap> </resultMap>
<resultMap id="NtcSrcipDomesticReportMap" type="com.nis.domain.restful.NtcSrcipDomesticReport"> <resultMap id="NtcSrcipDomesticReportMap"
type="com.nis.domain.restful.NtcSrcipDomesticReport">
<result column="SERVICE" jdbcType="INTEGER" property="service" /> <result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" /> <result column="SRC_PROVINCE" jdbcType="VARCHAR"
property="srcProvince" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="srcCity" /> <result column="SRC_CITY" jdbcType="VARCHAR" property="srcCity" />
<result column="SUM" jdbcType="BIGINT" property="sum" /> <result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" /> <result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap> </resultMap>
<resultMap id="NtcDestipCountryReportMap" type="com.nis.domain.restful.NtcDestipCountryReport"> <resultMap id="NtcDestipCountryReportMap"
type="com.nis.domain.restful.NtcDestipCountryReport">
<result column="SERVICE" jdbcType="INTEGER" property="service" /> <result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="destCountry" /> <result column="DEST_COUNTRY" jdbcType="VARCHAR"
property="destCountry" />
<result column="SUM" jdbcType="BIGINT" property="sum" /> <result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" /> <result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap> </resultMap>
<resultMap id="NtcEntranceReportMap" type="com.nis.domain.restful.NtcEntranceReport"> <resultMap id="NtcEntranceReportMap"
type="com.nis.domain.restful.NtcEntranceReport">
<result column="SERVICE" jdbcType="INTEGER" property="service" /> <result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="ENTRANCE_ID" jdbcType="INTEGER" property="entranceId" /> <result column="ENTRANCE_ID" jdbcType="INTEGER"
property="entranceId" />
<result column="SUM" jdbcType="BIGINT" property="sum" /> <result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" /> <result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap> </resultMap>
<resultMap id="NtcRadiusReportMap" type="com.nis.domain.restful.NtcRadiusReport">
<resultMap id="NtcIpURLReportMap"
type="com.nis.domain.restful.NtcIpURLReport">
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="ip_addr" jdbcType="VARCHAR" property="ipAddr" />
</resultMap>
<resultMap id="NtcRadiusReportMap"
type="com.nis.domain.restful.NtcRadiusReport">
<result column="ACCOUNT" jdbcType="VARCHAR" property="account" /> <result column="ACCOUNT" jdbcType="VARCHAR" property="account" />
<result column="NAS_IP" jdbcType="VARCHAR" property="nasIp" /> <result column="NAS_IP" jdbcType="VARCHAR" property="nasIp" />
<result column="SUM" jdbcType="BIGINT" property="sum" /> <result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" /> <result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap> </resultMap>
<sql id="commonPorperty"> <sql id="commonPorperty">
SERVICE,SUM,REPORT_TIME SERVICE,SUM,REPORT_TIME
</sql> </sql>
<select id="findNtcPzReport" parameterType="com.nis.domain.restful.NtcPzReport" <select id="findNtcPzReport"
parameterType="com.nis.domain.restful.NtcPzReport"
resultMap="NtcPzReportMap"> resultMap="NtcPzReportMap">
SELECT SELECT
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
<choose> <choose>
<when test="page !=null and page.fields != null and page.fields != ''"> <when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields} ${page.fields}
</when> </when>
<otherwise> <otherwise>
@@ -79,7 +112,8 @@
</when> </when>
<otherwise> <otherwise>
<choose> <choose>
<when test="page !=null and page.fields != null and page.fields != ''"> <when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields} ${page.fields}
</when> </when>
<otherwise> <otherwise>
@@ -93,13 +127,16 @@
</choose> </choose>
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_PZ_STAT_HOUR NTC_PZ_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_PZ_STAT_DAILY NTC_PZ_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 5 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 5 ">
NTC_PZ_STAT_MONTH NTC_PZ_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -114,15 +151,18 @@
<if test="searchService != null and searchService !=''"> <if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]> <![CDATA[AND SERVICE in (${searchService})]]>
</if> </if>
<if test="searchReportStartTime != null and searchReportStartTime !=''"> <if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME > STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME > STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
<if test="searchReportEndTime != null and searchReportEndTime !=''"> <if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME <= STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME <= STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
</where> </where>
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
GROUP BY CFG_ID,SERVICE GROUP BY CFG_ID,SERVICE
) )
</when> </when>
@@ -133,13 +173,16 @@
</choose> </choose>
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_PZ_STAT_HOUR NTC_PZ_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_PZ_STAT_DAILY NTC_PZ_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 5 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 5 ">
NTC_PZ_STAT_MONTH NTC_PZ_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -147,16 +190,19 @@
</otherwise> </otherwise>
</choose> </choose>
<choose> <choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''"> <when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy} ORDER BY ${page.orderBy}
</when> </when>
</choose> </choose>
</select> </select>
<select id="findNtcServiceReport" parameterType="com.nis.domain.restful.NtcServiceReport" <select id="findNtcServiceReport"
parameterType="com.nis.domain.restful.NtcServiceReport"
resultMap="NtcServiceReportMap"> resultMap="NtcServiceReportMap">
SELECT SELECT
<choose> <choose>
<when test="page !=null and page.fields != null and page.fields != ''"> <when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields} ${page.fields}
</when> </when>
<otherwise> <otherwise>
@@ -167,13 +213,16 @@
FROM FROM
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_SERVICE_STAT_HOUR NTC_SERVICE_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_SERVICE_STAT_DAILY NTC_SERVICE_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_SERVICE_STAT_MONTH NTC_SERVICE_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -184,10 +233,12 @@
<if test="searchService != null and searchService !=''"> <if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]> <![CDATA[AND SERVICE in (${searchService})]]>
</if> </if>
<if test="searchReportStartTime != null and searchReportStartTime !=''"> <if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
<if test="searchReportEndTime != null and searchReportEndTime !=''"> <if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
</where> </where>
@@ -196,13 +247,16 @@
) )
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_SERVICE_STAT_HOUR NTC_SERVICE_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_SERVICE_STAT_DAILY NTC_SERVICE_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_SERVICE_STAT_MONTH NTC_SERVICE_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -210,17 +264,20 @@
</otherwise> </otherwise>
</choose> </choose>
<choose> <choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''"> <when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy} ORDER BY ${page.orderBy}
</when> </when>
</choose> </choose>
</select> </select>
<select id="findNtcTagReport" parameterType="com.nis.domain.restful.NtcTagReport" <select id="findNtcTagReport"
parameterType="com.nis.domain.restful.NtcTagReport"
resultMap="NtcTagReportMap"> resultMap="NtcTagReportMap">
SELECT SELECT
<choose> <choose>
<when test="page !=null and page.fields != null and page.fields != ''"> <when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields} ${page.fields}
</when> </when>
<otherwise> <otherwise>
@@ -232,13 +289,16 @@
FROM FROM
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_TAG_STAT_HOUR NTC_TAG_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_TAG_STAT_DAILY NTC_TAG_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_TAG_STAT_MONTH NTC_TAG_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -252,10 +312,12 @@
<if test="searchService != null and searchService !=''"> <if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]> <![CDATA[AND SERVICE in (${searchService})]]>
</if> </if>
<if test="searchReportStartTime != null and searchReportStartTime !=''"> <if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
<if test="searchReportEndTime != null and searchReportEndTime !=''"> <if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
</where> </where>
@@ -263,13 +325,16 @@
GROUP BY SERVICE,TAG,REPORT_TIME GROUP BY SERVICE,TAG,REPORT_TIME
) )
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_TAG_STAT_HOUR NTC_TAG_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_TAG_STAT_DAILY NTC_TAG_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_TAG_STAT_MONTH NTC_TAG_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -277,17 +342,20 @@
</otherwise> </otherwise>
</choose> </choose>
<choose> <choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''"> <when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy} ORDER BY ${page.orderBy}
</when> </when>
</choose> </choose>
</select> </select>
<select id="findNtcAttrTypeReport" parameterType="com.nis.domain.restful.NtcAttrTypeReport" <select id="findNtcAttrTypeReport"
parameterType="com.nis.domain.restful.NtcAttrTypeReport"
resultMap="NtcAttrTypeReportMap"> resultMap="NtcAttrTypeReportMap">
SELECT SELECT
<choose> <choose>
<when test="page !=null and page.fields != null and page.fields != ''"> <when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields} ${page.fields}
</when> </when>
<otherwise> <otherwise>
@@ -299,13 +367,16 @@
FROM FROM
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_ATTR_TYPE_STAT_HOUR NTC_ATTR_TYPE_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_ATTR_TYPE_STAT_DAILY NTC_ATTR_TYPE_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_ATTR_TYPE_STAT_MONTH NTC_ATTR_TYPE_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -319,10 +390,12 @@
<if test="searchService != null and searchService !=''"> <if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]> <![CDATA[AND SERVICE in (${searchService})]]>
</if> </if>
<if test="searchReportStartTime != null and searchReportStartTime !=''"> <if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
<if test="searchReportEndTime != null and searchReportEndTime !=''"> <if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
</where> </where>
@@ -331,13 +404,16 @@
) )
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_ATTR_TYPE_STAT_HOUR NTC_ATTR_TYPE_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_ATTR_TYPE_STAT_DAILY NTC_ATTR_TYPE_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_ATTR_TYPE_STAT_MONTH NTC_ATTR_TYPE_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -345,17 +421,20 @@
</otherwise> </otherwise>
</choose> </choose>
<choose> <choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''"> <when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy} ORDER BY ${page.orderBy}
</when> </when>
</choose> </choose>
</select> </select>
<select id="findNtcLwhhReport" parameterType="com.nis.domain.restful.NtcLwhhReport" <select id="findNtcLwhhReport"
parameterType="com.nis.domain.restful.NtcLwhhReport"
resultMap="NtcLwhhReportMap"> resultMap="NtcLwhhReportMap">
SELECT SELECT
<choose> <choose>
<when test="page !=null and page.fields != null and page.fields != ''"> <when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields} ${page.fields}
</when> </when>
<otherwise> <otherwise>
@@ -366,13 +445,16 @@
FROM (SELECT SERVICE,LWHH, SUM(SUM) SUM ,REPORT_TIME FROM (SELECT SERVICE,LWHH, SUM(SUM) SUM ,REPORT_TIME
FROM FROM
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_LWHH_STAT_HOUR NTC_LWHH_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_LWHH_STAT_DAILY NTC_LWHH_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_LWHH_STAT_MONTH NTC_LWHH_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -386,10 +468,12 @@
<if test="searchService != null and searchService !=''"> <if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]> <![CDATA[AND SERVICE in (${searchService})]]>
</if> </if>
<if test="searchReportStartTime != null and searchReportStartTime !=''"> <if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
<if test="searchReportEndTime != null and searchReportEndTime !=''"> <if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
</where> </where>
@@ -397,13 +481,16 @@
GROUP BY SERVICE,LWHH,REPORT_TIME GROUP BY SERVICE,LWHH,REPORT_TIME
) )
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_LWHH_STAT_HOUR NTC_LWHH_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_LWHH_STAT_DAILY NTC_LWHH_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_LWHH_STAT_MONTH NTC_LWHH_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -411,16 +498,19 @@
</otherwise> </otherwise>
</choose> </choose>
<choose> <choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''"> <when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy} ORDER BY ${page.orderBy}
</when> </when>
</choose> </choose>
</select> </select>
<select id="findNtcSrcipDomesticReport" parameterType="com.nis.domain.restful.NtcSrcipDomesticReport" <select id="findNtcSrcipDomesticReport"
parameterType="com.nis.domain.restful.NtcSrcipDomesticReport"
resultMap="NtcSrcipDomesticReportMap"> resultMap="NtcSrcipDomesticReportMap">
SELECT SELECT
<choose> <choose>
<when test="page !=null and page.fields != null and page.fields != ''"> <when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields} ${page.fields}
</when> </when>
<otherwise> <otherwise>
@@ -431,13 +521,16 @@
FROM (SELECT SERVICE,SRC_PROVINCE,SRC_CITY, SUM(SUM) SUM ,REPORT_TIME FROM (SELECT SERVICE,SRC_PROVINCE,SRC_CITY, SUM(SUM) SUM ,REPORT_TIME
FROM FROM
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_SRCIP_DOMESTIC_STAT_HOUR NTC_SRCIP_DOMESTIC_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_SRCIP_DOMESTIC_STAT_DAILY NTC_SRCIP_DOMESTIC_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_SRCIP_DOMESTIC_STAT_MONTH NTC_SRCIP_DOMESTIC_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -448,10 +541,12 @@
<if test="searchService != null and searchService !=''"> <if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]> <![CDATA[AND SERVICE in (${searchService})]]>
</if> </if>
<if test="searchReportStartTime != null and searchReportStartTime !=''"> <if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
<if test="searchReportEndTime != null and searchReportEndTime !=''"> <if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
</where> </where>
@@ -459,13 +554,16 @@
GROUP BY SERVICE,SRC_PROVINCE,SRC_CITY,REPORT_TIME GROUP BY SERVICE,SRC_PROVINCE,SRC_CITY,REPORT_TIME
) )
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_SRCIP_DOMESTIC_STAT_HOUR NTC_SRCIP_DOMESTIC_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_SRCIP_DOMESTIC_STAT_DAILY NTC_SRCIP_DOMESTIC_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_SRCIP_DOMESTIC_STAT_MONTH NTC_SRCIP_DOMESTIC_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -473,17 +571,20 @@
</otherwise> </otherwise>
</choose> </choose>
<choose> <choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''"> <when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy} ORDER BY ${page.orderBy}
</when> </when>
</choose> </choose>
</select> </select>
<select id="findNtcDestipCountryReport" parameterType="com.nis.domain.restful.NtcDestipCountryReport" <select id="findNtcDestipCountryReport"
parameterType="com.nis.domain.restful.NtcDestipCountryReport"
resultMap="NtcDestipCountryReportMap"> resultMap="NtcDestipCountryReportMap">
SELECT SELECT
<choose> <choose>
<when test="page !=null and page.fields != null and page.fields != ''"> <when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields} ${page.fields}
</when> </when>
<otherwise> <otherwise>
@@ -494,13 +595,16 @@
FROM (SELECT SERVICE,DEST_COUNTRY, SUM(SUM) SUM ,REPORT_TIME FROM (SELECT SERVICE,DEST_COUNTRY, SUM(SUM) SUM ,REPORT_TIME
FROM FROM
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_DESTIP_COUNTRY_STAT_HOUR NTC_DESTIP_COUNTRY_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_DESTIP_COUNTRY_STAT_DAILY NTC_DESTIP_COUNTRY_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_DESTIP_COUNTRY_STAT_MONTH NTC_DESTIP_COUNTRY_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -511,10 +615,12 @@
<if test="searchService != null and searchService !=''"> <if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]> <![CDATA[AND SERVICE in (${searchService})]]>
</if> </if>
<if test="searchReportStartTime != null and searchReportStartTime !=''"> <if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
<if test="searchReportEndTime != null and searchReportEndTime !=''"> <if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
</where> </where>
@@ -522,13 +628,16 @@
GROUP BY SERVICE,DEST_COUNTRY,REPORT_TIME GROUP BY SERVICE,DEST_COUNTRY,REPORT_TIME
) )
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_DESTIP_COUNTRY_STAT_HOUR NTC_DESTIP_COUNTRY_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_DESTIP_COUNTRY_STAT_DAILY NTC_DESTIP_COUNTRY_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_DESTIP_COUNTRY_STAT_MONTH NTC_DESTIP_COUNTRY_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -536,17 +645,20 @@
</otherwise> </otherwise>
</choose> </choose>
<choose> <choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''"> <when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy} ORDER BY ${page.orderBy}
</when> </when>
</choose> </choose>
</select> </select>
<select id="findNtcEntranceReport" parameterType="com.nis.domain.restful.NtcEntranceReport" <select id="findNtcEntranceReport"
parameterType="com.nis.domain.restful.NtcEntranceReport"
resultMap="NtcEntranceReportMap"> resultMap="NtcEntranceReportMap">
SELECT SELECT
<choose> <choose>
<when test="page !=null and page.fields != null and page.fields != ''"> <when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields} ${page.fields}
</when> </when>
<otherwise> <otherwise>
@@ -557,13 +669,16 @@
FROM (SELECT SERVICE,ENTRANCE_ID, SUM(SUM) SUM ,REPORT_TIME FROM (SELECT SERVICE,ENTRANCE_ID, SUM(SUM) SUM ,REPORT_TIME
FROM FROM
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_ENTRANCE_STAT_HOUR NTC_ENTRANCE_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_ENTRANCE_STAT_DAILY NTC_ENTRANCE_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_ENTRANCE_STAT_MONTH NTC_ENTRANCE_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -578,10 +693,12 @@
<if test="searchService != null and searchService !=''"> <if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]> <![CDATA[AND SERVICE in (${searchService})]]>
</if> </if>
<if test="searchReportStartTime != null and searchReportStartTime !=''"> <if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
<if test="searchReportEndTime != null and searchReportEndTime !=''"> <if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if> </if>
</where> </where>
@@ -589,13 +706,16 @@
GROUP BY SERVICE,ENTRANCE_ID,REPORT_TIME GROUP BY SERVICE,ENTRANCE_ID,REPORT_TIME
) )
<choose> <choose>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_ENTRANCE_STAT_HOUR NTC_ENTRANCE_STAT_HOUR
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_ENTRANCE_STAT_DAILY NTC_ENTRANCE_STAT_DAILY
</when> </when>
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 "> <when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_ENTRANCE_STAT_MONTH NTC_ENTRANCE_STAT_MONTH
</when> </when>
<otherwise> <otherwise>
@@ -603,18 +723,61 @@
</otherwise> </otherwise>
</choose> </choose>
<choose> <choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''"> <when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy} ORDER BY ${page.orderBy}
</when> </when>
</choose> </choose>
</select> </select>
<select id="findNasIpList" parameterType="com.nis.domain.restful.NtcRadiusReport" <select id="findNtcIpURLReport"
parameterType="com.nis.domain.restful.NtcURLReport"
resultMap="NtcIpURLReportMap">
SELECT
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
url, ip_addr,SUM
</otherwise>
</choose>
FROM (SELECT url, SUM(SUM) SUM ,ip_addr
FROM ntc_reject_url_statistic
<where>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND STAT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if>
<if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND STAT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if>
<if test="searchUrl != null and searchUrl !=''">
AND url = #{searchUrl}
</if>
</where>
GROUP BY url,ip_addr
) ntc_reject_url_statistic
<choose>
<when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findNasIpList"
parameterType="com.nis.domain.restful.NtcRadiusReport"
resultMap="NtcRadiusReportMap"> resultMap="NtcRadiusReportMap">
select nas_ip,sum(num) num from ntc_radius_report select nas_ip,sum(num) num from ntc_radius_report
<where> <where>
<choose> <choose>
<when test="searchReportStartTime != null and searchReportStartTime !=''"> <when
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</when> </when>
<otherwise> <otherwise>
@@ -625,12 +788,14 @@
</where> </where>
group by NAS_IP order by num desc group by NAS_IP order by num desc
</select> </select>
<select id="findAccounList" parameterType="com.nis.domain.restful.NtcRadiusReport" <select id="findAccounList"
parameterType="com.nis.domain.restful.NtcRadiusReport"
resultMap="NtcRadiusReportMap"> resultMap="NtcRadiusReportMap">
select account,sum(num) num from ntc_radius_report select account,sum(num) num from ntc_radius_report
<where> <where>
<choose> <choose>
<when test="searchReportStartTime != null and searchReportStartTime !=''"> <when
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</when> </when>
<otherwise> <otherwise>
@@ -642,20 +807,24 @@
group by account order by num desc group by account order by num desc
</select> </select>
<select id="findNtcRadiusReport" parameterType="com.nis.domain.restful.NtcRadiusReport" <select id="findNtcRadiusReport"
parameterType="com.nis.domain.restful.NtcRadiusReport"
resultMap="NtcRadiusReportMap"> resultMap="NtcRadiusReportMap">
SELECT SELECT
* *
FROM ntc_radius_report FROM ntc_radius_report
<where> <where>
<if test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 and searchAccount != null and searchAccount !=''"> <if
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 and searchAccount != null and searchAccount !=''">
<![CDATA[AND account =#{searchAccount}]]> <![CDATA[AND account =#{searchAccount}]]>
</if> </if>
<if test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 and searchNasIp != null and searchNasIp !=''"> <if
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 and searchNasIp != null and searchNasIp !=''">
<![CDATA[AND nas_ip =#{searchNasIp}]]> <![CDATA[AND nas_ip =#{searchNasIp}]]>
</if> </if>
<choose> <choose>
<when test="searchReportStartTime != null and searchReportStartTime !=''"> <when
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</when> </when>
<otherwise> <otherwise>

View File

@@ -13,6 +13,7 @@ import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -25,8 +26,10 @@ import org.springframework.stereotype.Repository;
import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSource;
import com.nis.domain.Page; import com.nis.domain.Page;
import com.nis.domain.restful.NtcAsnRecord;
import com.nis.domain.restful.NtcConnRecordPercent; import com.nis.domain.restful.NtcConnRecordPercent;
import com.nis.web.service.SpringContextHolder; import com.nis.web.service.SpringContextHolder;
import com.zdjizhi.utils.CommonUtil;
import com.zdjizhi.utils.StringUtil; import com.zdjizhi.utils.StringUtil;
/** /**
@@ -48,6 +51,9 @@ import com.zdjizhi.utils.StringUtil;
@Repository @Repository
public class LocalLogJDBCByDruid { public class LocalLogJDBCByDruid {
private final static Logger logger = LoggerFactory.getLogger(LocalLogJDBCByDruid.class); private final static Logger logger = LoggerFactory.getLogger(LocalLogJDBCByDruid.class);
static NumberFormat num = NumberFormat.getPercentInstance();
static DruidDataSource datasource = null; static DruidDataSource datasource = null;
Connection conn = null; Connection conn = null;
ResultSet rs = null; ResultSet rs = null;
@@ -111,6 +117,15 @@ public class LocalLogJDBCByDruid {
} }
} }
/**
* 获取单向,流量包数和流量字节数在总的流量包数和字节数的占比
*
* @param ntcConnRecordPercent
* @param sql
* @param isPersent
* @return
* @throws Exception
*/
public NtcConnRecordPercent getNtcConnRecordPercentData(NtcConnRecordPercent ntcConnRecordPercent, String sql, public NtcConnRecordPercent getNtcConnRecordPercentData(NtcConnRecordPercent ntcConnRecordPercent, String sql,
boolean isPersent) throws Exception { boolean isPersent) throws Exception {
try { try {
@@ -119,7 +134,6 @@ public class LocalLogJDBCByDruid {
st = conn.createStatement(); st = conn.createStatement();
logger.info("开始执行日志查询语句sql={}", sql); logger.info("开始执行日志查询语句sql={}", sql);
rs = st.executeQuery(sql); rs = st.executeQuery(sql);
NumberFormat num = NumberFormat.getPercentInstance();
num.setMinimumFractionDigits(2);// 保留两位小数 num.setMinimumFractionDigits(2);// 保留两位小数
while (rs.next()) { while (rs.next()) {
if (isPersent) { if (isPersent) {
@@ -127,7 +141,7 @@ public class LocalLogJDBCByDruid {
if (!allBps.equals("0")) { if (!allBps.equals("0")) {
ntcConnRecordPercent.setBpsPercent( ntcConnRecordPercent.setBpsPercent(
num.format(Double.valueOf(ntcConnRecordPercent.getBps()) / Double.valueOf(allBps))); num.format(Double.valueOf(ntcConnRecordPercent.getBps()) / Double.valueOf(allBps)));
ntcConnRecordPercent.setBps(num.format(Double.valueOf(ntcConnRecordPercent.getBps()))); ntcConnRecordPercent.setBps(subStr(ntcConnRecordPercent.getBps()));
} else { } else {
ntcConnRecordPercent.setBpsPercent("0%"); ntcConnRecordPercent.setBpsPercent("0%");
} }
@@ -135,7 +149,7 @@ public class LocalLogJDBCByDruid {
if (!allPps.equals("0")) { if (!allPps.equals("0")) {
ntcConnRecordPercent.setPpsPercent( ntcConnRecordPercent.setPpsPercent(
num.format(Double.valueOf(ntcConnRecordPercent.getPps()) / Double.valueOf(allPps))); num.format(Double.valueOf(ntcConnRecordPercent.getPps()) / Double.valueOf(allPps)));
ntcConnRecordPercent.setPps(num.format(Double.valueOf(ntcConnRecordPercent.getPps()))); ntcConnRecordPercent.setPps(subStr(ntcConnRecordPercent.getPps()));
} else { } else {
ntcConnRecordPercent.setPpsPercent("0%"); ntcConnRecordPercent.setPpsPercent("0%");
} }
@@ -144,6 +158,7 @@ public class LocalLogJDBCByDruid {
String pps = rs.getString("pps"); String pps = rs.getString("pps");
ntcConnRecordPercent.setBps(bps); ntcConnRecordPercent.setBps(bps);
ntcConnRecordPercent.setPps(pps); ntcConnRecordPercent.setPps(pps);
} }
} }
logger.info("执行日志查询语句成功,sql={}", sql); logger.info("执行日志查询语句成功,sql={}", sql);
@@ -153,6 +168,58 @@ public class LocalLogJDBCByDruid {
return ntcConnRecordPercent; return ntcConnRecordPercent;
} }
/**
* 获取asn,源目的的流量包数和字节数
*
* @param ntcAsnRecord
* @param sql
* @return
* @throws Exception
*/
public List<NtcAsnRecord> getNtcAsnRecordData(String sql) throws Exception {
List<NtcAsnRecord> list = new LinkedList<>();
try {
conn = getConnection();
logger.info("连接数据中心日志库成功--------------------------");
st = conn.createStatement();
logger.info("开始执行日志查询语句sql={}", sql);
rs = st.executeQuery(sql);
num.setMinimumFractionDigits(2);// 保留两位小数
while (rs.next()) {
NtcAsnRecord ntcAsnRecord = new NtcAsnRecord();
String bps = rs.getString("bps");
String pps = rs.getString("pps");
ntcAsnRecord.setBps(subStr(bps));
ntcAsnRecord.setPps(subStr(pps));
ntcAsnRecord.setdAsn(rs.getString("d_asn"));
ntcAsnRecord.setsAsn(rs.getString("s_asn"));
list.add(ntcAsnRecord);
}
logger.info("执行日志查询语句成功,sql={}", sql);
} finally {
closeConn();
}
return list;
}
/**
* 截取字符串后两位
*
* @param val
* @return
*/
public String subStr(String val) {
if (val != null && val.contains(".")) {
int length = val.indexOf(".") + 3;
if (val.length() > length) {
return val.substring(0, length);
}
}
return val;
}
/** /**
* 关闭数据库连接 * 关闭数据库连接
*/ */

View File

@@ -2,7 +2,6 @@ package com.nis.web.service;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@@ -19,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.nis.domain.Page; import com.nis.domain.Page;
import com.nis.domain.restful.NtcAsnRecord;
import com.nis.domain.restful.NtcConnRecordPercent; import com.nis.domain.restful.NtcConnRecordPercent;
import com.nis.restful.RestBusinessCode; import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException; import com.nis.restful.RestServiceException;
@@ -55,7 +55,6 @@ public class LogDataService {
} }
public NtcConnRecordPercent getNtcConnRecordPercent(NtcConnRecordPercent ntcConnRecordPercent) throws Exception { public NtcConnRecordPercent getNtcConnRecordPercent(NtcConnRecordPercent ntcConnRecordPercent) throws Exception {
long startTime = sdf.parse(ntcConnRecordPercent.getSearchFoundStartTime().toString().trim()).getTime() / 1000; long startTime = sdf.parse(ntcConnRecordPercent.getSearchFoundStartTime().toString().trim()).getTime() / 1000;
long endTime = sdf.parse(ntcConnRecordPercent.getSearchFoundEndTime().toString().trim()).getTime() / 1000; long endTime = sdf.parse(ntcConnRecordPercent.getSearchFoundEndTime().toString().trim()).getTime() / 1000;
if (endTime - startTime < 0) { if (endTime - startTime < 0) {
@@ -69,7 +68,7 @@ public class LogDataService {
sql.append(" AS pps , SUM(c2s_byte_num + s2c_byte_num)*8/"); sql.append(" AS pps , SUM(c2s_byte_num + s2c_byte_num)*8/");
sql.append(second); sql.append(second);
sql.append( sql.append(
" AS bps FROM tbs_ods_ntc_conn_record_log_local_1 t WHERE found_time IN ( SELECT DISTINCT found_time FROM tbs_ods_ntc_conn_record_log_local_1 WHERE found_time >= "); " AS bps 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(startTime);
sql.append(" and found_time< "); sql.append(" and found_time< ");
sql.append(endTime); sql.append(endTime);
@@ -82,6 +81,39 @@ public class LogDataService {
return ntcConnRecordPercent; return ntcConnRecordPercent;
} }
public void getNtcAsnRecord(Page page, NtcAsnRecord ntcAsnRecord) throws Exception {
long startTime = sdf.parse(ntcAsnRecord.getSearchFoundStartTime().toString().trim()).getTime() / 1000;
long endTime = sdf.parse(ntcAsnRecord.getSearchFoundEndTime().toString().trim()).getTime() / 1000;
if (endTime - startTime < 0) {
throw new RestServiceException("searchFoundStartTime() can not exceed searchFoundEndTime",
RestBusinessCode.param_formate_error.getValue());
}
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,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 >= ");
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)");
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());
localLogJDBCByDruid.getCount(page, countSql.toString());
page.setList(localLogJDBCByDruid.getNtcAsnRecordData(sql.toString()));
}
/** /**
* 根据类名加对应的标识获取hive或者clickhouse中对应的表名 * 根据类名加对应的标识获取hive或者clickhouse中对应的表名
* *

View File

@@ -14,12 +14,14 @@ import com.nis.domain.Page;
import com.nis.domain.restful.NtcAttrTypeReport; import com.nis.domain.restful.NtcAttrTypeReport;
import com.nis.domain.restful.NtcDestipCountryReport; import com.nis.domain.restful.NtcDestipCountryReport;
import com.nis.domain.restful.NtcEntranceReport; import com.nis.domain.restful.NtcEntranceReport;
import com.nis.domain.restful.NtcIpURLReport;
import com.nis.domain.restful.NtcLwhhReport; import com.nis.domain.restful.NtcLwhhReport;
import com.nis.domain.restful.NtcPzReport; import com.nis.domain.restful.NtcPzReport;
import com.nis.domain.restful.NtcRadiusReport; import com.nis.domain.restful.NtcRadiusReport;
import com.nis.domain.restful.NtcServiceReport; import com.nis.domain.restful.NtcServiceReport;
import com.nis.domain.restful.NtcSrcipDomesticReport; import com.nis.domain.restful.NtcSrcipDomesticReport;
import com.nis.domain.restful.NtcTagReport; import com.nis.domain.restful.NtcTagReport;
import com.nis.domain.restful.NtcURLReport;
import com.nis.web.dao.NtcReportDao; import com.nis.web.dao.NtcReportDao;
import com.nis.web.service.BaseLogService; import com.nis.web.service.BaseLogService;
@@ -53,7 +55,7 @@ public class NtcReportService extends BaseLogService {
pageTotal.setCount(restList.size()); pageTotal.setCount(restList.size());
pageTotal.setList(restList); pageTotal.setList(restList);
return pageTotal; return pageTotal;
} else{ } else {
return page; return page;
} }
@@ -106,40 +108,72 @@ public class NtcReportService extends BaseLogService {
return page; return page;
} }
public Page<NtcURLReport> findNtcURLReport(Page<NtcURLReport> page, NtcURLReport 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);
return page;
}
public List findNtcRadiusReport(NtcRadiusReport entity) throws Exception { public List findNtcRadiusReport(NtcRadiusReport entity) throws Exception {
List resultList = null; List resultList = null;
if ("1".equals(entity.getSearchBusinessType())) { if ("1".equals(entity.getSearchBusinessType())) {
resultList = new ArrayList<Map>(); resultList = new ArrayList<Map>();
Map<String, List<NtcRadiusReport>> restMap = new HashMap<String, List<NtcRadiusReport>>(); Map<String, List<NtcRadiusReport>> restMap = new HashMap<String, List<NtcRadiusReport>>();
List<NtcRadiusReport> accountList =dao.findAccounList(entity); List<NtcRadiusReport> accountList = dao.findAccounList(entity);
restMap.put("accountList", accountList); restMap.put("accountList", accountList);
List<NtcRadiusReport> nasIpList =dao.findNasIpList(entity); List<NtcRadiusReport> nasIpList = dao.findNasIpList(entity);
restMap.put("nasIpList", nasIpList); restMap.put("nasIpList", nasIpList);
resultList.add(restMap); resultList.add(restMap);
}else{ } else {
resultList = new ArrayList<NtcRadiusReport>(); resultList = new ArrayList<NtcRadiusReport>();
List<NtcRadiusReport> list = dao.findNtcRadiusReport(entity); List<NtcRadiusReport> list = dao.findNtcRadiusReport(entity);
String regionName = "nasIp"; String regionName = "nasIp";
if ("3".equals(entity.getSearchBusinessType())) { if ("3".equals(entity.getSearchBusinessType())) {
regionName="account"; regionName = "account";
} }
PropertyDescriptor pd= new PropertyDescriptor(regionName, NtcRadiusReport.class); PropertyDescriptor pd = new PropertyDescriptor(regionName, NtcRadiusReport.class);
Method method = pd.getReadMethod(); Method method = pd.getReadMethod();
NtcRadiusReport temp = null; NtcRadiusReport temp = null;
Object tempVal =null; Object tempVal = null;
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
if (i>0) { if (i > 0) {
NtcRadiusReport obj = list.get(i); NtcRadiusReport obj = list.get(i);
Object objVal = method.invoke(obj); Object objVal = method.invoke(obj);
if (objVal!=null && tempVal!=null && !objVal.toString().equals(tempVal.toString())) { if (objVal != null && tempVal != null && !objVal.toString().equals(tempVal.toString())) {
temp = obj; temp = obj;
tempVal = method.invoke(temp); tempVal = method.invoke(temp);
resultList.add(obj); resultList.add(obj);
} }
}else{ } else {
temp = list.get(i); temp = list.get(i);
tempVal = method.invoke(temp); tempVal = method.invoke(temp);
resultList.add(list.get(i)); resultList.add(list.get(i));