|
@@ -153,9 +153,38 @@ public class BossDataExhibitionServiceImpl implements IBossDataExhibitionService
|
|
|
*/
|
|
|
@Override
|
|
|
public Result getAccountDataByMediaType() {
|
|
|
+ Map<String,Object> resultMap = new HashMap<>();
|
|
|
//获取当前月份第一天
|
|
|
Integer firstDay = DateUtils.getFirstDayByMonth();
|
|
|
- return Result.successMsg("分媒体投放数据查询成功。",bossDataExhibitionMapper.getMediaTypeAccountData(firstDay));
|
|
|
+ List<Map<String,Object>> resultList = bossDataExhibitionMapper.getMediaTypeAccountData(firstDay);
|
|
|
+ if (Check.isNull(resultList)){
|
|
|
+ return Result.error("分媒体投放数据暂无");
|
|
|
+ }
|
|
|
+
|
|
|
+ //图表数据组装
|
|
|
+ List<Object> timeList = resultList.stream().map(map -> map.get("time")).collect(Collectors.toList());
|
|
|
+ //时间格式转换 20220120 -->>> 01-20
|
|
|
+ List<Object> resultTimeList = new ArrayList<>();
|
|
|
+ if (!Check.isNull(timeList)){
|
|
|
+ timeList.forEach(obj -> {
|
|
|
+ resultTimeList.add(DateUtils.intDateToString(obj.toString()));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //头条数据 坐标轴左侧 加 “-” 变为负数
|
|
|
+ List<Object> bytedanceList = resultList.stream().map(map -> map.get("bytedanceCost")).collect(Collectors.toList());
|
|
|
+ List<Object> resultBytedanceList = new ArrayList<>();
|
|
|
+ if (!Check.isNull(bytedanceList)){
|
|
|
+ bytedanceList.forEach(obj ->{
|
|
|
+ resultBytedanceList.add(new StringBuilder().append("-").append(obj));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //快手数据 坐标轴右侧 正数
|
|
|
+ List<Object> kuaishouList = resultList.stream().map(map -> map.get("kuaishouCost")).collect(Collectors.toList());
|
|
|
+
|
|
|
+ resultMap.put("time",resultTimeList);
|
|
|
+ resultMap.put("bytedance",resultBytedanceList);
|
|
|
+ resultMap.put("kuaishou",kuaishouList);
|
|
|
+ return Result.successMsg("分媒体投放数据查询成功。",resultMap);
|
|
|
}
|
|
|
|
|
|
/**
|