Commit 3e8f2122 by shenjunjie

修复平台分布统计bug

parent 6419ab60
......@@ -427,7 +427,7 @@ public class MarkDataServiceImpl implements MarkDataService {
}
result.put("negTopTitle", topTitle);
// 舆情库默认contendId为0
List<JSONObject> articlePlatformProportion = getMarkPlatformProportion(startTime, endTime, projectId, linkedGroupId, Constant.PRIMARY_CONTEND_ID, true);
List<JSONObject> articlePlatformProportion = getMarkPlatformProportion(startTime, endTime, projectId, Constant.PRIMARY_CONTEND_ID, null, true);
result.put("platformRank", articlePlatformProportion.stream().filter(articlePlatform -> articlePlatform.getLongValue("count") > 0).sorted((o1, o2) -> o2.getLong("count").compareTo(o1.getLong("count"))).collect(Collectors.toList()));
redisUtil.setExpire(redisKey, JSON.toJSONString(result));
return result;
......@@ -1115,7 +1115,7 @@ public class MarkDataServiceImpl implements MarkDataService {
result.put("days", new Period(dto.getStartTime(), dto.getEndTime(), PeriodType.days()).getDays());
result.put("priName", project.getBrandName());
// 获取时间段主品牌在每个平台传播量占比
List<JSONObject> primaryPlatformsProportion = getMarkPlatformProportion(dto.getStartTime(), dto.getEndTime(), dto.getProjectId(), dto.getLinkedGroupId(), Constant.PRIMARY_CONTEND_ID, true);
List<JSONObject> primaryPlatformsProportion = getMarkPlatformProportion(dto.getStartTime(), dto.getEndTime(), dto.getProjectId(), Constant.PRIMARY_CONTEND_ID, null, true);
// 获取时间段主品牌总传播量
long primaryTotalCount = primaryPlatformsProportion.stream().mapToLong(platform -> platform.getLongValue("count")).sum();
result.put("priNorTotal", primaryTotalCount);
......@@ -1128,7 +1128,7 @@ public class MarkDataServiceImpl implements MarkDataService {
result.put("conName", brandName);
// 获取时间段竞品在每个平台传播量
String contendLinkedGroupId = projectService.getProjectByContendId(dto.getProjectId(), dto.getContendId()).getBrandLinkedGroupId();
List<JSONObject> contendPlatformsProportion = getMarkPlatformProportion(dto.getStartTime(), dto.getEndTime(), dto.getProjectId(), contendLinkedGroupId, dto.getContendId(), true);
List<JSONObject> contendPlatformsProportion = getMarkPlatformProportion(dto.getStartTime(), dto.getEndTime(), dto.getProjectId(), dto.getContendId(), null, true);
// 获取时间段竞品总传播量
long contendTotalCount = contendPlatformsProportion.stream().mapToLong(platform -> platform.getLongValue("count")).sum();
result.put("conNorTotal", contendTotalCount);
......@@ -1793,7 +1793,7 @@ public class MarkDataServiceImpl implements MarkDataService {
}
private List<JSONObject> getMarkPlatformProportion(Long startTime, Long endTime, String projectId, String contendId, String emotion, boolean cache) throws IOException {
String redisKey = RedisKeyPrefix.MARK_PLATFORM_PROPORTION + Tools.concat(projectId, contendId, startTime, endTime);
String redisKey = RedisKeyPrefix.MARK_PLATFORM_PROPORTION + Tools.concat(projectId, contendId, emotion, startTime, endTime);
String resultStr;
if (cache && StringUtils.isNotEmpty(resultStr = redisUtil.get(redisKey))) {
return JSON.parseArray(resultStr, JSONObject.class);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment