|
@@ -23,6 +23,7 @@ import java.math.BigDecimal;
|
|
|
import java.math.BigInteger;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -46,11 +47,11 @@ public class AdsOverallSummaryServiceImpl implements IAdsOverallSummaryService {
|
|
|
String totalDataConString = totalDataCon.toSql(dao.getEntity(AdsOverallSummary.class));
|
|
|
//自定义sql语句
|
|
|
Sql totalDataSql = Sqls.create("SELECT \n" +
|
|
|
- "SUM(x.today_player_count) total_players ,\n" +
|
|
|
- "SUM(x.today_total_cost) total_cost ,\n" +
|
|
|
- "SUM(x.today_amount) total_amount ,\n" +
|
|
|
- "SUM(x.today_agent_count) total_agent_count ,\n" +
|
|
|
- "SUM(x.today_game_count) total_game_count ,\n" +
|
|
|
+ "IFNULL(SUM(x.today_player_count),0) total_players ,\n" +
|
|
|
+ "IFNULL(SUM(x.today_total_cost),0) total_cost ,\n" +
|
|
|
+ "IFNULL(SUM(x.today_amount),0) total_amount ,\n" +
|
|
|
+ "IFNULL(SUM(x.today_agent_count),0) total_agent_count ,\n" +
|
|
|
+ "IFNULL(SUM(x.today_game_count),0) total_game_count ,\n" +
|
|
|
"IFNULL(SUM(x.today_new_player_amount)/SUM(x.today_total_cost),0) total_roi \n" +
|
|
|
"FROM ads_overall_summary x " + totalDataConString);
|
|
|
|
|
@@ -146,7 +147,7 @@ public class AdsOverallSummaryServiceImpl implements IAdsOverallSummaryService {
|
|
|
* @param param 前端传递的查询参数实体
|
|
|
* @param needLocalDate 是否拼接日期查询条件
|
|
|
* @param queryDays 拼接需要查询数据的天数条件(给今日昨日、首日Roi、7日Roi以及30日Roi使用)
|
|
|
- * @return Condition
|
|
|
+ * @return Condition 查询条件
|
|
|
*/
|
|
|
private Condition myCondition(AdsOverallSummaryParam param, Boolean needLocalDate, Integer queryDays) {
|
|
|
|
|
@@ -248,11 +249,17 @@ public class AdsOverallSummaryServiceImpl implements IAdsOverallSummaryService {
|
|
|
* 检查前端查询日期内的数据是否在数据库中都存在
|
|
|
* 不存在要设置默认值 0
|
|
|
*
|
|
|
- * @param list 返回给前端的折线图数据 list
|
|
|
+ * @param list 需要判断的list
|
|
|
* @param param 前端传递的查询参数实体
|
|
|
+ * @return 返回给前端的折线图数据 list
|
|
|
*/
|
|
|
private List<AdsOverallSummaryLineDataVO> checkAllDateData(List<AdsOverallSummaryLineDataVO> list, AdsOverallSummaryParam param) {
|
|
|
|
|
|
+ //先判断是否缺少数据 不少数据直接返回
|
|
|
+ if ((list.size() - 1) == param.getBeginDate().until(param.getEndDate(), ChronoUnit.DAYS)) {
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
//创建一个Map用来存储日期数据
|
|
|
Map<LocalDate, Integer> map = new HashMap<>();
|
|
|
//添加日期数据
|