(improvement) revise evaluation and fix null pointer (#715)

This commit is contained in:
mainmain
2024-02-04 20:16:07 +08:00
committed by GitHub
parent 75853a8e9e
commit da5e7b9b75
29 changed files with 431 additions and 122 deletions

View File

@@ -51,4 +51,4 @@ public class DimensionDO {
private String dataType;
private int isTag;
}
}

View File

@@ -81,4 +81,4 @@ public class DomainDO {
*/
private String viewOrg;
}
}

View File

@@ -80,17 +80,17 @@ public class MetricDO {
private String dataFormat;
/**
*
*
*/
private String alias;
/**
*
*
*/
private String tags;
/**
*
*
*/
private String relateDimensions;
@@ -103,4 +103,4 @@ public class MetricDO {
private String defineType;
}
}

View File

@@ -56,4 +56,4 @@ public class ModelDO {
private String sourceType;
}
}

View File

@@ -48,10 +48,11 @@ public class StatRepositoryImpl implements StatRepository {
statInfos.stream().forEach(stat -> {
String dimensions = stat.getDimensions();
String metrics = stat.getMetrics();
updateStatMapInfo(map, dimensions, TypeEnums.DIMENSION.name().toLowerCase(), stat.getModelId());
updateStatMapInfo(map, metrics, TypeEnums.METRIC.name().toLowerCase(), stat.getModelId());
if (Objects.nonNull(stat.getViewId())) {
updateStatMapInfo(map, dimensions, TypeEnums.DIMENSION.name().toLowerCase(), stat.getViewId());
updateStatMapInfo(map, metrics, TypeEnums.METRIC.name().toLowerCase(), stat.getViewId());
}
});
map.forEach((k, v) -> {
Long classId = Long.parseLong(k.split(AT_SYMBOL + AT_SYMBOL)[0]);
String type = k.split(AT_SYMBOL + AT_SYMBOL)[1];
@@ -68,13 +69,13 @@ public class StatRepositoryImpl implements StatRepository {
return statMapper.getStatInfo(itemUseCommend);
}
private void updateStatMapInfo(Map<String, Long> map, String dimensions, String type, Long modelId) {
private void updateStatMapInfo(Map<String, Long> map, String dimensions, String type, Long viewId) {
if (Strings.isNotEmpty(dimensions)) {
try {
List<String> dimensionList = mapper.readValue(dimensions, new TypeReference<List<String>>() {
});
dimensionList.stream().forEach(dimension -> {
String key = modelId + AT_SYMBOL + AT_SYMBOL + type + AT_SYMBOL + AT_SYMBOL + dimension;
String key = viewId + AT_SYMBOL + AT_SYMBOL + type + AT_SYMBOL + AT_SYMBOL + dimension;
if (map.containsKey(key)) {
map.put(key, map.get(key) + 1);
} else {
@@ -97,4 +98,4 @@ public class StatRepositoryImpl implements StatRepository {
}
}
}
}
}