修复磁盘NPE
This commit is contained in:
@@ -240,11 +240,16 @@ public class MessageHandler {
|
||||
String province = locationInfo.get("province");
|
||||
|
||||
// 过滤本地省份和空值
|
||||
if (province != null && operator != null
|
||||
&& (!localProvince.equals(province) || !localIsp.equals(operator))) {
|
||||
String key = province + operator; // 根据图片格式,省份和运营商之间没有空格
|
||||
double currentCount = v4StatMap.getOrDefault(key, 0.0);
|
||||
v4StatMap.put(key, currentCount + tcpdumpVo.getCount());
|
||||
if (province != null && operator != null) {
|
||||
// 标准化运营商名称
|
||||
String stdLocalIsp = localIsp != null ? localIsp.replace("中国", "") : "";
|
||||
String stdOperator = operator.replace("中国", "");
|
||||
// 省不一样或者省一样但运营商不一样
|
||||
if (!localProvince.equals(province) || !stdLocalIsp.equals(stdOperator)) {
|
||||
String key = province + operator; // 根据图片格式,省份和运营商之间没有空格
|
||||
double currentCount = v4StatMap.getOrDefault(key, 0.0);
|
||||
v4StatMap.put(key, currentCount + tcpdumpVo.getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,11 +285,16 @@ public class MessageHandler {
|
||||
String province = locationInfo.get("province");
|
||||
|
||||
// 过滤本地省份和空值
|
||||
if (province != null && operator != null
|
||||
&& (!localProvince.equals(province) || !localIsp.equals(operator))) {
|
||||
String key = province + operator; // 根据图片格式,省份和运营商之间没有空格
|
||||
double currentCount = v6StatMap.getOrDefault(key, 0.0);
|
||||
v6StatMap.put(key, currentCount + tcpdumpVo.getCount());
|
||||
if (province != null && operator != null) {
|
||||
// 标准化运营商名称
|
||||
String stdLocalIsp = localIsp != null ? localIsp.replace("中国", "") : "";
|
||||
String stdOperator = operator.replace("中国", "");
|
||||
// 省不一样或者省一样但运营商不一样
|
||||
if (!localProvince.equals(province) || !stdLocalIsp.equals(stdOperator)) {
|
||||
String key = province + operator; // 根据图片格式,省份和运营商之间没有空格
|
||||
double currentCount = v6StatMap.getOrDefault(key, 0.0);
|
||||
v6StatMap.put(key, currentCount + tcpdumpVo.getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -279,7 +279,11 @@ public class InitialDiskInfoServiceImpl implements IInitialDiskInfoService
|
||||
if(list != null && !list.isEmpty()){
|
||||
Long totalUsedSpace = 0L;
|
||||
for (InitialDiskInfo diskInfo : list) {
|
||||
totalUsedSpace += diskInfo.getUsedSpace();
|
||||
// 处理 null 值
|
||||
Long usedSpace = diskInfo.getUsedSpace();
|
||||
if (usedSpace != null) {
|
||||
totalUsedSpace += usedSpace;
|
||||
}
|
||||
}
|
||||
Long avgUsedSpace = totalUsedSpace/list.size();
|
||||
unit = SpeedUtils.determineUnitByValue(avgUsedSpace);
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
group by name
|
||||
</select>
|
||||
<select id="getDiskTotal" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult">
|
||||
select sum(t2.total) as total
|
||||
select sum(IFNULL(t2.total,0)) as total
|
||||
from ${tableName} t2
|
||||
inner join (
|
||||
select client_id, type, max(create_time) as latest_time
|
||||
@@ -225,7 +225,7 @@
|
||||
and t2.create_time = t1.latest_time
|
||||
</select>
|
||||
<select id="sumDistInfoByCondition" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult">
|
||||
select sum(used_space) used_space,create_time
|
||||
select SUM(IFNULL(used_space, 0)) AS used_space,create_time
|
||||
from ${tableName}
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
|
||||
Reference in New Issue
Block a user