|
@@ -136,16 +136,16 @@ public class BytedanceAdvertiserHourlyReportServiceImpl extends ServiceImpl<Byte
|
|
//转化成本 = 总花费 / 转化数
|
|
//转化成本 = 总花费 / 转化数
|
|
int converNum = list.stream().mapToInt(ReportCostVo::getConvertNum).sum();
|
|
int converNum = list.stream().mapToInt(ReportCostVo::getConvertNum).sum();
|
|
double conver = cost / converNum;
|
|
double conver = cost / converNum;
|
|
- map.put("conver", String.format("%.2f", conver));
|
|
|
|
|
|
+ map.put("conver",Double.isNaN(conver) ? "0" : String.format("%.2f", conver));
|
|
map.put("converNum", converNum);
|
|
map.put("converNum", converNum);
|
|
//转化率 = 转化数 / 点击数 * 100
|
|
//转化率 = 转化数 / 点击数 * 100
|
|
int clickNum = list.stream().mapToInt(ReportCostVo::getClick).sum();
|
|
int clickNum = list.stream().mapToInt(ReportCostVo::getClick).sum();
|
|
double click = Double.valueOf(converNum) / Double.valueOf(clickNum) * 100;
|
|
double click = Double.valueOf(converNum) / Double.valueOf(clickNum) * 100;
|
|
- map.put("converRate", String.format("%.2f", click));
|
|
|
|
|
|
+ map.put("converRate", Double.isNaN(click) ? "0" : String.format("%.2f", click));
|
|
// 平均千次展显费用 = 总花费/展示数 * 1000
|
|
// 平均千次展显费用 = 总花费/展示数 * 1000
|
|
int showNum = list.stream().mapToInt(ReportCostVo::getShowNum).sum();
|
|
int showNum = list.stream().mapToInt(ReportCostVo::getShowNum).sum();
|
|
double show = (cost / showNum) * 1000 ;
|
|
double show = (cost / showNum) * 1000 ;
|
|
- map.put("averageShow", String.format("%.2f", show));
|
|
|
|
|
|
+ map.put("averageShow", Double.isNaN(show) ? "0" : String.format("%.2f", show));
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -157,18 +157,18 @@ public class BytedanceAdvertiserHourlyReportServiceImpl extends ServiceImpl<Byte
|
|
//转化成本 = 总花费 / 转化数
|
|
//转化成本 = 总花费 / 转化数
|
|
int converNum = reportCostVo.getConvertNum();
|
|
int converNum = reportCostVo.getConvertNum();
|
|
double conver = cost / converNum;
|
|
double conver = cost / converNum;
|
|
- reportCostVo.setConver(String.format("%.2f", conver));
|
|
|
|
|
|
+ reportCostVo.setConver(converNum == 0 ? "0" : String.format("%.2f", conver));
|
|
reportCostVo.setConvertNum(converNum);
|
|
reportCostVo.setConvertNum(converNum);
|
|
|
|
|
|
//转化率 = 转化数 / 点击数 * 100
|
|
//转化率 = 转化数 / 点击数 * 100
|
|
int clickNum = reportCostVo.getClick();
|
|
int clickNum = reportCostVo.getClick();
|
|
double click = Double.valueOf(converNum) / Double.valueOf(clickNum) * 100;
|
|
double click = Double.valueOf(converNum) / Double.valueOf(clickNum) * 100;
|
|
- reportCostVo.setConverRate(String.format("%.2f", click));
|
|
|
|
|
|
+ reportCostVo.setConverRate(clickNum == 0 ? "0" : String.format("%.2f", click));
|
|
|
|
|
|
// 平均千次展显费用 = 总花费/展示数 * 1000
|
|
// 平均千次展显费用 = 总花费/展示数 * 1000
|
|
int showNum = reportCostVo.getShowNum();
|
|
int showNum = reportCostVo.getShowNum();
|
|
double show = (cost / showNum) * 1000 ;
|
|
double show = (cost / showNum) * 1000 ;
|
|
- reportCostVo.setAverageShow(String.format("%.2f", show));
|
|
|
|
|
|
+ reportCostVo.setAverageShow( showNum == 0 ? "0" : String.format("%.2f", show));
|
|
});
|
|
});
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|