1:修改通联关系百分比流量返回gps

2:修改iprange接口添加searchip查询条件及desc查询条件
This commit is contained in:
renkaige
2018-12-18 00:57:45 +06:00
parent 9f8fb67584
commit a1c72f4545
6 changed files with 91 additions and 23 deletions

View File

@@ -1,14 +1,10 @@
package com.nis.domain.restful;
import java.io.Serializable;
import java.util.Map;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.poi.ss.formula.functions.T;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
public class NtcIpRangeReport<T> implements Serializable {
@@ -24,10 +20,18 @@ public class NtcIpRangeReport<T> implements Serializable {
private Long ipEndNum;
private String ipSub;
private String country;
private Integer areaType;
private String searchType;
private String searchCountry;
private String desc;
private String searchDesc;// 界面上的desc查询条件
private String searchIp;// 界面上的ip查询条件
private String searchType;// 界面上的境内,境外查询条件
private String searchCountry;// 界面上的城市查询条件
/**
* 当前实体分页对象
*/
protected Page<T> page;
public String getIpStart() {
return ipStart;
@@ -103,4 +107,43 @@ public class NtcIpRangeReport<T> implements Serializable {
this.searchCountry = searchCountry;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
@JsonIgnore
public String getSearchDesc() {
return searchDesc;
}
public void setSearchDesc(String searchDesc) {
this.searchDesc = searchDesc;
}
@JsonIgnore
public String getSearchIp() {
return searchIp;
}
public void setSearchIp(String searchIp) {
this.searchIp = searchIp;
}
@JsonIgnore
@XmlTransient
public Page<T> getPage() {
if (page == null) {
page = new Page<T>();
}
return page;
}
public Page<T> setPage(Page<T> page) {
this.page = page;
return page;
}
}

View File

@@ -1,5 +1,6 @@
package com.nis.web.controller.restful;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -490,14 +491,29 @@ public class SingleDimensionReport extends BaseRestController {
AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
try {
// List<NtcIpRangeReport> list=new ArrayList<>();
// ntcIpRangeReport.setIpStart("192.168.10.121");
// ntcIpRangeReport.setIpEnd("192.168.10.122");
// ntcIpRangeReport.setIpEndNum(3232238202l);
// ntcIpRangeReport.setIpStartNum(3232238201l);
// ntcIpRangeReport.setIpSub("255.255.255.252");
// list.add(ntcIpRangeReport);
page.setList( ntcReportService.findNtcIpRangeReport(ntcIpRangeReport));
try {
if (!StringUtil.isBlank(ntcIpRangeReport.getSearchIp())) {
ntcIpRangeReport.setSearchIp(IPUtil.getIpHostDesimal(ntcIpRangeReport.getSearchIp()) + "");
}
} catch (Exception e) {
throw new RestServiceException("searchIp参数错误", RestBusinessCode.param_formate_error.getValue());
}
try {
if (!StringUtil.isBlank(ntcIpRangeReport.getSearchType())) {
if (!ntcIpRangeReport.getSearchType().trim().equals("1")
&& !ntcIpRangeReport.getSearchType().trim().equals("2")) {
throw new RestServiceException("searchType参数错误",
RestBusinessCode.param_formate_error.getValue());
}
}
} catch (Exception e) {
throw new RestServiceException("searchType参数错误,值只能为1(境内)或2(境外)",
RestBusinessCode.param_formate_error.getValue());
}
ntcReportService.findNtcIpRangeReport(page, ntcIpRangeReport);
} catch (Exception e) {
saveLogThread.setExceptionInfo("ip范围段统计查询失败:" + e.getMessage());
logger.error("ip范围段统计查询失败:" + ExceptionUtil.getExceptionMsg(e));

View File

@@ -98,6 +98,8 @@
property="ipEndNum" />
<result column="ip_sub" jdbcType="VARCHAR" property="ipSub" />
<result column="country" jdbcType="VARCHAR" property="country" />
<result column="area_type" jdbcType="VARCHAR" property="areaType" />
<result column="desc" jdbcType="VARCHAR" property="desc" />
</resultMap>
@@ -856,7 +858,7 @@
<select id="findNtcIpRangeReport"
parameterType="com.nis.domain.restful.NtcIpRangeReport"
resultMap="NtcIpRangeReportMap">
SELECT ip_start,ip_end,ip_start_num,ip_end_num,ip_sub
SELECT ip_start,ip_end,ip_start_num,ip_end_num,ip_sub,country,area_type,desc
FROM
traffic_ip_identify
<where>
@@ -866,6 +868,12 @@
<if test="searchCountry != null and searchCountry !=''">
<![CDATA[AND country= #{searchCountry ]]>
</if>
<if test="searchIp != null and searchIp !=''">
<![CDATA[AND ip_start_num>= #{searchIp} and ip_end_num<=#{searchIp}]]>
</if>
<if test="searchDesc != null and searchDesc !=''">
<![CDATA[AND desc= #{searchDesc ]]>
</if>
</where>
</select>

View File

@@ -149,7 +149,9 @@ public class LocalLogJDBCByDruid {
if (!allPps.equals("0")) {
ntcConnRecordPercent.setPpsPercent(
num.format(Double.valueOf(ntcConnRecordPercent.getPps()) / Double.valueOf(allPps)));
ntcConnRecordPercent.setPps(subStr(ntcConnRecordPercent.getPps()));
int idx = ntcConnRecordPercent.getPps().lastIndexOf(".");//查找小数点的位置
String strNum = ntcConnRecordPercent.getPps().substring(0,idx);//截取从字符串开始到小数点位置的字符串,就是整数部分
ntcConnRecordPercent.setPps(strNum);
} else {
ntcConnRecordPercent.setPpsPercent("0%");
}

View File

@@ -66,7 +66,7 @@ public class LogDataService {
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(" AS pps , SUM(c2s_byte_num + s2c_byte_num)*8/1024/1024/1024/");
sql.append(second);
sql.append(
" 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 >= ");

View File

@@ -156,11 +156,10 @@ public class NtcReportService extends BaseLogService {
}
public List<NtcIpRangeReport> findNtcIpRangeReport(NtcIpRangeReport entity) throws Exception {
List<NtcIpRangeReport> list = dao.findNtcIpRangeReport(entity);
return list;
public Page<NtcIpRangeReport> findNtcIpRangeReport(Page page, NtcIpRangeReport entity) throws Exception {
entity.setPage(page);
page.setList(dao.findNtcIpRangeReport(entity));
return page;
}
}