|  | @@ -53,7 +53,8 @@ import java.util.stream.Collectors;
 | 
											
												
													
														|  |  public class GameDataServiceImpl implements IGameDataService {
 |  |  public class GameDataServiceImpl implements IGameDataService {
 | 
											
												
													
														|  |      private static final List<Tuple2<Field, Field>> dayNFieldMapList;
 |  |      private static final List<Tuple2<Field, Field>> dayNFieldMapList;
 | 
											
												
													
														|  |      private static final List<Tuple2<Field, Field>> dayNTotalFieldMapList;
 |  |      private static final List<Tuple2<Field, Field>> dayNTotalFieldMapList;
 | 
											
												
													
														|  | -    static  {
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    static {
 | 
											
												
													
														|  |          Map<String, Field> fieldMap = new HashMap<>();
 |  |          Map<String, Field> fieldMap = new HashMap<>();
 | 
											
												
													
														|  |          Map<String, Field> fieldTotalMap = new HashMap<>();
 |  |          Map<String, Field> fieldTotalMap = new HashMap<>();
 | 
											
												
													
														|  |          List<Field> dayNFieldList = new ArrayList<>();
 |  |          List<Field> dayNFieldList = new ArrayList<>();
 | 
											
										
											
												
													
														|  | @@ -89,29 +90,29 @@ public class GameDataServiceImpl implements IGameDataService {
 | 
											
												
													
														|  |              tempTotalClazz = tempTotalClazz.getSuperclass();
 |  |              tempTotalClazz = tempTotalClazz.getSuperclass();
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        if(dayNFieldList.isEmpty()) {
 |  | 
 | 
											
												
													
														|  | -            dayNFieldMapList  = Collections.emptyList();
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (dayNFieldList.isEmpty()) {
 | 
											
												
													
														|  | 
 |  | +            dayNFieldMapList = Collections.emptyList();
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
												
													
														|  |              dayNFieldMapList = new ArrayList<>(dayNFieldList.size());
 |  |              dayNFieldMapList = new ArrayList<>(dayNFieldList.size());
 | 
											
												
													
														|  | -            for(Field dayNField : dayNFieldList) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +            for (Field dayNField : dayNFieldList) {
 | 
											
												
													
														|  |                  dayNField.setAccessible(true);
 |  |                  dayNField.setAccessible(true);
 | 
											
												
													
														|  |                  Field sourceField = fieldMap.get(dayNField.getName().replace("Trend", ""));
 |  |                  Field sourceField = fieldMap.get(dayNField.getName().replace("Trend", ""));
 | 
											
												
													
														|  |                  sourceField.setAccessible(true);
 |  |                  sourceField.setAccessible(true);
 | 
											
												
													
														|  | -                if(sourceField != null) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +                if (sourceField != null) {
 | 
											
												
													
														|  |                      dayNFieldMapList.add(Tuples.of(sourceField, dayNField));
 |  |                      dayNFieldMapList.add(Tuples.of(sourceField, dayNField));
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        if(dayNTotalFieldList.isEmpty()) {
 |  | 
 | 
											
												
													
														|  | -            dayNTotalFieldMapList  = Collections.emptyList();
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (dayNTotalFieldList.isEmpty()) {
 | 
											
												
													
														|  | 
 |  | +            dayNTotalFieldMapList = Collections.emptyList();
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
												
													
														|  |              dayNTotalFieldMapList = new ArrayList<>(dayNTotalFieldList.size());
 |  |              dayNTotalFieldMapList = new ArrayList<>(dayNTotalFieldList.size());
 | 
											
												
													
														|  | -            for(Field dayNTotalField : dayNTotalFieldList) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +            for (Field dayNTotalField : dayNTotalFieldList) {
 | 
											
												
													
														|  |                  dayNTotalField.setAccessible(true);
 |  |                  dayNTotalField.setAccessible(true);
 | 
											
												
													
														|  |                  Field sourceField = fieldTotalMap.get(dayNTotalField.getName().replace("Trend", ""));
 |  |                  Field sourceField = fieldTotalMap.get(dayNTotalField.getName().replace("Trend", ""));
 | 
											
												
													
														|  |                  sourceField.setAccessible(true);
 |  |                  sourceField.setAccessible(true);
 | 
											
												
													
														|  | -                if(sourceField != null) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +                if (sourceField != null) {
 | 
											
												
													
														|  |                      dayNTotalFieldMapList.add(Tuples.of(sourceField, dayNTotalField));
 |  |                      dayNTotalFieldMapList.add(Tuples.of(sourceField, dayNTotalField));
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
										
											
												
													
														|  | @@ -474,11 +475,82 @@ public class GameDataServiceImpl implements IGameDataService {
 | 
											
												
													
														|  |       * @return 返回给前端额数据
 |  |       * @return 返回给前端额数据
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      public GameDataTotalTotalVO getGameDataTotalTotal(GameDataTotalTotalDTO dto) {
 |  |      public GameDataTotalTotalVO getGameDataTotalTotal(GameDataTotalTotalDTO dto) {
 | 
											
												
													
														|  | 
 |  | +        //如果注册时间参数为空,默认设置查询当天数据
 | 
											
												
													
														|  | 
 |  | +        if (dto.getRegisteredBeginDate() == null || dto.getRegisteredEndDate() == null) {
 | 
											
												
													
														|  | 
 |  | +            dto.setRegisteredBeginDate(LocalDate.now());
 | 
											
												
													
														|  | 
 |  | +            dto.setRegisteredEndDate(LocalDate.now());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        //如果充值时间参数为空,默认设置查询当天数据
 | 
											
												
													
														|  | 
 |  | +        if (dto.getRechargeBeginDate() == null || dto.getRechargeEndDate() == null) {
 | 
											
												
													
														|  | 
 |  | +            dto.setRechargeBeginDate(LocalDate.now());
 | 
											
												
													
														|  | 
 |  | +            dto.setRechargeEndDate(LocalDate.now());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        //根据传入的dto拼接查询参数
 | 
											
												
													
														|  | 
 |  | +        Criteria cri = Cnd.cri();
 | 
											
												
													
														|  | 
 |  | +        if (StringUtils.isNotBlank(dto.getGameName())) {
 | 
											
												
													
														|  | 
 |  | +            //拼接游戏名称查询条件
 | 
											
												
													
														|  | 
 |  | +            cri.where().andEquals("game_name", dto.getGameName());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        if (dto.getGameId() != null) {
 | 
											
												
													
														|  | 
 |  | +            //拼接游戏id查询条件
 | 
											
												
													
														|  | 
 |  | +            cri.where().andEquals("game_id", dto.getGameId());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        if (dto.getGameClassify() != null) {
 | 
											
												
													
														|  | 
 |  | +            //拼接游戏类型查询条件
 | 
											
												
													
														|  | 
 |  | +            cri.where().andEquals("game_classify", dto.getGameClassify());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        if (dto.getRegisteredBeginDate() != null && dto.getRegisteredEndDate() != null) {
 | 
											
												
													
														|  | 
 |  | +            //拼接注册日期查询条件
 | 
											
												
													
														|  | 
 |  | +            cri.where().andBetween("dt", dto.getRegisteredBeginDate(), dto.getRegisteredEndDate());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        if (StringUtils.isNotBlank(dto.getSourceSystem())) {
 | 
											
												
													
														|  | 
 |  | +            //拼接SDK来源
 | 
											
												
													
														|  | 
 |  | +            cri.where().andEquals("source_system", dto.getSourceSystem());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +        Sql gameDataTotalTotalSql = Sqls.create(gameDataTotalTotalSql() + cri);
 | 
											
												
													
														|  | 
 |  | +        //设置回传对象
 | 
											
												
													
														|  | 
 |  | +        gameDataTotalTotalSql.setCallback(Sqls.callback.entity());
 | 
											
												
													
														|  | 
 |  | +        gameDataTotalTotalSql.setEntity(dao.getEntity(GameDataTotalTotalVO.class));
 | 
											
												
													
														|  | 
 |  | +        //执行sql
 | 
											
												
													
														|  | 
 |  | +        dao.execute(gameDataTotalTotalSql);
 | 
											
												
													
														|  | 
 |  | +        //得到查询出的结果
 | 
											
												
													
														|  | 
 |  | +        GameDataTotalTotalVO vo = gameDataTotalTotalSql.getObject(GameDataTotalTotalVO.class);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +        //查询充值时间相关数据
 | 
											
												
													
														|  | 
 |  | +        //查询条件
 | 
											
												
													
														|  | 
 |  | +        Criteria criRc = Cnd.cri();
 | 
											
												
													
														|  | 
 |  | +        if (StringUtils.isNotBlank(dto.getGameName())) {
 | 
											
												
													
														|  | 
 |  | +            //拼接游戏名称查询条件
 | 
											
												
													
														|  | 
 |  | +            criRc.where().andEquals("game_name", dto.getGameName());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        if (dto.getGameClassify() != null) {
 | 
											
												
													
														|  | 
 |  | +            //拼接游戏类型查询条件
 | 
											
												
													
														|  | 
 |  | +            criRc.where().andEquals("game_classify", dto.getGameClassify());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        if (dto.getGameId() != null) {
 | 
											
												
													
														|  | 
 |  | +            //拼接游戏id查询条件
 | 
											
												
													
														|  | 
 |  | +            criRc.where().andEquals("game_id", dto.getGameId());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        if (dto.getRechargeBeginDate() != null && dto.getRechargeEndDate() != null) {
 | 
											
												
													
														|  | 
 |  | +            //拼接充值日期查询条件
 | 
											
												
													
														|  | 
 |  | +            criRc.where().andBetween("dt", dto.getRechargeBeginDate(), dto.getRechargeEndDate());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        if (StringUtils.isNotBlank(dto.getSourceSystem())) {
 | 
											
												
													
														|  | 
 |  | +            //拼接SDK来源
 | 
											
												
													
														|  | 
 |  | +            criRc.where().andEquals("source_system", dto.getSourceSystem());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        //创建sql语句
 | 
											
												
													
														|  | 
 |  | +        Sql sqlWithRechargeDate = Sqls.create(gameDataTotalSqlRecharge() + criRc);
 | 
											
												
													
														|  | 
 |  | +        //设置回传对象
 | 
											
												
													
														|  | 
 |  | +        sqlWithRechargeDate.setCallback(Sqls.callback.entity());
 | 
											
												
													
														|  | 
 |  | +        sqlWithRechargeDate.setEntity(dao.getEntity(GameDataTotalTotalVO.class));
 | 
											
												
													
														|  | 
 |  | +        dao.execute(sqlWithRechargeDate);
 | 
											
												
													
														|  | 
 |  | +        GameDataTotalTotalVO tempVO = sqlWithRechargeDate.getObject(GameDataTotalTotalVO.class);
 | 
											
												
													
														|  | 
 |  | +        //将两个对象内的数据合并
 | 
											
												
													
														|  | 
 |  | +        copyNullProperties(tempVO, vo);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        return null;
 |  | 
 | 
											
												
													
														|  | 
 |  | +        return vo;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
										
											
												
													
														|  | @@ -942,10 +1014,11 @@ public class GameDataServiceImpl implements IGameDataService {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 通过反射赋值每日趋势
 |  |       * 通过反射赋值每日趋势
 | 
											
												
													
														|  | 
 |  | +     *
 | 
											
												
													
														|  |       * @param vo
 |  |       * @param vo
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      private void formatDayN(GameDataDayVO vo) {
 |  |      private void formatDayN(GameDataDayVO vo) {
 | 
											
												
													
														|  | -        if(CollectionUtils.isEmpty(dayNFieldMapList)) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (CollectionUtils.isEmpty(dayNFieldMapList)) {
 | 
											
												
													
														|  |              return;
 |  |              return;
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          dayNFieldMapList.forEach(dayNFieldMap -> {
 |  |          dayNFieldMapList.forEach(dayNFieldMap -> {
 | 
											
										
											
												
													
														|  | @@ -966,58 +1039,36 @@ public class GameDataServiceImpl implements IGameDataService {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 通过反射赋值每日总计趋势
 |  |       * 通过反射赋值每日总计趋势
 | 
											
												
													
														|  | 
 |  | +     *
 | 
											
												
													
														|  |       * @param vo
 |  |       * @param vo
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      private void formatDayNTotal(GameDataDayTotalVO vo) {
 |  |      private void formatDayNTotal(GameDataDayTotalVO vo) {
 | 
											
												
													
														|  | -        if(CollectionUtils.isEmpty(dayNTotalFieldMapList)) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (CollectionUtils.isEmpty(dayNTotalFieldMapList)) {
 | 
											
												
													
														|  |              return;
 |  |              return;
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        //D1的充值金额(买量、自然量、总量)
 |  | 
 | 
											
												
													
														|  | -        BigDecimal amountD1 = new BigDecimal(vo.getAmountD1().split("/")[0]);
 |  | 
 | 
											
												
													
														|  | -        BigDecimal buyAmountD1 = new BigDecimal(vo.getBuyAmountD1().split("/")[0]);
 |  | 
 | 
											
												
													
														|  | -        BigDecimal natureAmountD1 = new BigDecimal(vo.getNatureAmountD1().split("/")[0]);
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |          dayNTotalFieldMapList.forEach(dayNTotalFieldMap -> {
 |  |          dayNTotalFieldMapList.forEach(dayNTotalFieldMap -> {
 | 
											
												
													
														|  |              try {
 |  |              try {
 | 
											
												
													
														|  | 
 |  | +                //得到需要计算的值
 | 
											
												
													
														|  |                  String[] temps = ((String) dayNTotalFieldMap.getT1().get(vo)).split("/");
 |  |                  String[] temps = ((String) dayNTotalFieldMap.getT1().get(vo)).split("/");
 | 
											
												
													
														|  | 
 |  | +                //dn的金额总计
 | 
											
												
													
														|  |                  BigDecimal dNAmount = new BigDecimal(temps[0]);
 |  |                  BigDecimal dNAmount = new BigDecimal(temps[0]);
 | 
											
												
													
														|  | 
 |  | +                //d1-dn的金额总计
 | 
											
												
													
														|  |                  BigDecimal d1ToDNTotalAmount = new BigDecimal(temps[1]);
 |  |                  BigDecimal d1ToDNTotalAmount = new BigDecimal(temps[1]);
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -                if (temps[3].equals("buy")) {
 |  | 
 | 
											
												
													
														|  | -                    dayNTotalFieldMap.getT2().set(vo, RechargeTrendVO.builder()
 |  | 
 | 
											
												
													
														|  | -                            .rechargeMoney(dNAmount)
 |  | 
 | 
											
												
													
														|  | -                            .rechargeUserCount(Long.valueOf(temps[2]))
 |  | 
 | 
											
												
													
														|  | -                            .increase(vo.getCost().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 |  | 
 | 
											
												
													
														|  | -                                    dNAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
 |  | 
 | 
											
												
													
														|  | -                            .back(vo.getCost().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 |  | 
 | 
											
												
													
														|  | -                                    d1ToDNTotalAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
 |  | 
 | 
											
												
													
														|  | -                            .multiples(buyAmountD1.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 |  | 
 | 
											
												
													
														|  | -                                    d1ToDNTotalAmount.divide(buyAmountD1, 4, RoundingMode.HALF_UP))
 |  | 
 | 
											
												
													
														|  | -                            .build());
 |  | 
 | 
											
												
													
														|  | -                } else if (temps[3].equals("nature")) {
 |  | 
 | 
											
												
													
														|  | -                    dayNTotalFieldMap.getT2().set(vo, RechargeTrendVO.builder()
 |  | 
 | 
											
												
													
														|  | -                            .rechargeMoney(dNAmount)
 |  | 
 | 
											
												
													
														|  | -                            .rechargeUserCount(Long.valueOf(temps[2]))
 |  | 
 | 
											
												
													
														|  | -                            .increase(vo.getCost().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 |  | 
 | 
											
												
													
														|  | -                                    dNAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
 |  | 
 | 
											
												
													
														|  | -                            .back(vo.getCost().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 |  | 
 | 
											
												
													
														|  | -                                    d1ToDNTotalAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
 |  | 
 | 
											
												
													
														|  | -                            .multiples(natureAmountD1.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 |  | 
 | 
											
												
													
														|  | -                                    d1ToDNTotalAmount.divide(natureAmountD1, 4, RoundingMode.HALF_UP))
 |  | 
 | 
											
												
													
														|  | -                            .build());
 |  | 
 | 
											
												
													
														|  | -                } else {
 |  | 
 | 
											
												
													
														|  | -                    dayNTotalFieldMap.getT2().set(vo, RechargeTrendVO.builder()
 |  | 
 | 
											
												
													
														|  | -                            .rechargeMoney(dNAmount)
 |  | 
 | 
											
												
													
														|  | -                            .rechargeUserCount(Long.valueOf(temps[2]))
 |  | 
 | 
											
												
													
														|  | -                            .increase(vo.getCost().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 |  | 
 | 
											
												
													
														|  | -                                    dNAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
 |  | 
 | 
											
												
													
														|  | -                            .back(vo.getCost().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 |  | 
 | 
											
												
													
														|  | -                                    d1ToDNTotalAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
 |  | 
 | 
											
												
													
														|  | -                            .multiples(amountD1.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 |  | 
 | 
											
												
													
														|  | -                                    d1ToDNTotalAmount.divide(amountD1, 4, RoundingMode.HALF_UP))
 |  | 
 | 
											
												
													
														|  | -                            .build());
 |  | 
 | 
											
												
													
														|  | -                }
 |  | 
 | 
											
												
													
														|  | 
 |  | +                //d1-dn的消耗总计(排除了未到时间的cost)
 | 
											
												
													
														|  | 
 |  | +                BigDecimal d1ToDNTotalCost = new BigDecimal(temps[3]);
 | 
											
												
													
														|  | 
 |  | +                //d1的金额总计(排除了未到时间的d1)
 | 
											
												
													
														|  | 
 |  | +                BigDecimal d1Amount = new BigDecimal(temps[4]);
 | 
											
												
													
														|  | 
 |  | +                //赋值
 | 
											
												
													
														|  | 
 |  | +                dayNTotalFieldMap.getT2().set(vo, RechargeTrendVO.builder()
 | 
											
												
													
														|  | 
 |  | +                        .rechargeMoney(dNAmount)
 | 
											
												
													
														|  | 
 |  | +                        .rechargeUserCount(Long.valueOf(temps[2]))
 | 
											
												
													
														|  | 
 |  | +                        .increase(d1ToDNTotalCost.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 | 
											
												
													
														|  | 
 |  | +                                dNAmount.divide(d1ToDNTotalCost, 4, RoundingMode.HALF_UP))
 | 
											
												
													
														|  | 
 |  | +                        .back(d1ToDNTotalCost.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 | 
											
												
													
														|  | 
 |  | +                                d1ToDNTotalAmount.divide(d1ToDNTotalCost, 4, RoundingMode.HALF_UP))
 | 
											
												
													
														|  | 
 |  | +                        .multiples(d1Amount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 | 
											
												
													
														|  | 
 |  | +                                d1ToDNTotalAmount.divide(d1Amount, 4, RoundingMode.HALF_UP))
 | 
											
												
													
														|  | 
 |  | +                        .build());
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              } catch (IllegalAccessException e) {
 |  |              } catch (IllegalAccessException e) {
 | 
											
												
													
														|  |                  throw new RuntimeException(e);
 |  |                  throw new RuntimeException(e);
 | 
											
										
											
												
													
														|  | @@ -1266,6 +1317,17 @@ public class GameDataServiceImpl implements IGameDataService {
 | 
											
												
													
														|  |                      buy_reg_cost,
 |  |                      buy_reg_cost,
 | 
											
												
													
														|  |                      buy_first_amount_cost as buy_first_new_user_recharge_cost,
 |  |                      buy_first_amount_cost as buy_first_new_user_recharge_cost,
 | 
											
												
													
														|  |                      buy_total_amount_cost as buy_total_recharge_cost,
 |  |                      buy_total_amount_cost as buy_total_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                    buy_hundred_user_num,
 | 
											
												
													
														|  | 
 |  | +                    buy_hundred_user_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    buy_first_role_num,
 | 
											
												
													
														|  | 
 |  | +                    buy_role_num,
 | 
											
												
													
														|  | 
 |  | +                    buy_new_user_total_role_num,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(buy_first_role_num > 0, cost / buy_first_role_num, 0), 2) buy_first_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(buy_role_num > 0, cost / buy_role_num, 0), 2) buy_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(buy_new_user_total_role_num >0, cost / buy_new_user_total_role_num, 0), 2) buy_new_user_total_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(buy_reg_num >0, buy_first_role_num / buy_reg_num, 0), 4) buy_first_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(buy_reg_num >0, buy_role_num / buy_reg_num, 0), 4) buy_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(buy_reg_num >0, buy_new_user_total_role_num / buy_reg_num, 0), 4) buy_new_user_total_role_num_rate,
 | 
											
												
													
														|  |                          
 |  |                          
 | 
											
												
													
														|  |                      nature_first_new_user_amount_count,
 |  |                      nature_first_new_user_amount_count,
 | 
											
												
													
														|  |                      nature_first_new_user_amount_num,
 |  |                      nature_first_new_user_amount_num,
 | 
											
										
											
												
													
														|  | @@ -1330,6 +1392,17 @@ public class GameDataServiceImpl implements IGameDataService {
 | 
											
												
													
														|  |                      nature_reg_cost,
 |  |                      nature_reg_cost,
 | 
											
												
													
														|  |                      nature_first_amount_cost as nature_first_new_user_recharge_cost,
 |  |                      nature_first_amount_cost as nature_first_new_user_recharge_cost,
 | 
											
												
													
														|  |                      nature_total_amount_cost as nature_total_recharge_cost,
 |  |                      nature_total_amount_cost as nature_total_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                    nature_hundred_user_num,
 | 
											
												
													
														|  | 
 |  | +                    nature_hundred_user_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    nature_first_role_num,
 | 
											
												
													
														|  | 
 |  | +                    nature_role_num,
 | 
											
												
													
														|  | 
 |  | +                    nature_new_user_total_role_num,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(nature_first_role_num > 0, cost / nature_first_role_num, 0), 2) nature_first_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(nature_role_num > 0, cost / nature_role_num, 0), 2) nature_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(nature_new_user_total_role_num >0, cost / nature_new_user_total_role_num, 0), 2) nature_new_user_total_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(nature_reg_num >0, nature_first_role_num / nature_reg_num, 0), 4) nature_first_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(nature_reg_num >0, nature_role_num / nature_reg_num, 0), 4) nature_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(nature_reg_num >0, nature_new_user_total_role_num / nature_reg_num, 0), 4) nature_new_user_total_role_num_rate,
 | 
											
												
													
														|  |                          
 |  |                          
 | 
											
												
													
														|  |                      first_new_user_amount_count,
 |  |                      first_new_user_amount_count,
 | 
											
												
													
														|  |                      first_new_user_amount_num,
 |  |                      first_new_user_amount_num,
 | 
											
										
											
												
													
														|  | @@ -1393,7 +1466,18 @@ public class GameDataServiceImpl implements IGameDataService {
 | 
											
												
													
														|  |                      amount_sum,
 |  |                      amount_sum,
 | 
											
												
													
														|  |                      reg_cost,
 |  |                      reg_cost,
 | 
											
												
													
														|  |                      first_amount_cost as first_new_user_recharge_cost,
 |  |                      first_amount_cost as first_new_user_recharge_cost,
 | 
											
												
													
														|  | -                    total_amount_cost as total_recharge_cost
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    total_amount_cost as total_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                    hundred_user_num,
 | 
											
												
													
														|  | 
 |  | +                    hundred_user_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    first_role_num,
 | 
											
												
													
														|  | 
 |  | +                    role_num,
 | 
											
												
													
														|  | 
 |  | +                    new_user_total_role_num,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(first_role_num > 0, cost / first_role_num, 0), 2) first_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(role_num > 0, cost / role_num, 0), 2) role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(new_user_total_role_num >0, cost / new_user_total_role_num, 0), 2) new_user_total_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(reg_num >0, first_role_num / reg_num, 0), 4) first_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(reg_num >0, role_num / reg_num, 0), 4) role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(reg_num >0, new_user_total_role_num / reg_num, 0), 4) new_user_total_role_num_rate
 | 
											
												
													
														|  |                      
 |  |                      
 | 
											
												
													
														|  |                  FROM
 |  |                  FROM
 | 
											
												
													
														|  |                      ads_game_day
 |  |                      ads_game_day
 | 
											
										
											
												
													
														|  | @@ -1413,173 +1497,290 @@ public class GameDataServiceImpl implements IGameDataService {
 | 
											
												
													
														|  |                  IFNULL(SUM(buy_reg_num), 0) buy_reg_num,
 |  |                  IFNULL(SUM(buy_reg_num), 0) buy_reg_num,
 | 
											
												
													
														|  |                  IFNULL(SUM(nature_reg_num), 0) nature_reg_num,
 |  |                  IFNULL(SUM(nature_reg_num), 0) nature_reg_num,
 | 
											
												
													
														|  |                  IFNULL(SUM(reg_num), 0) reg_num,
 |  |                  IFNULL(SUM(reg_num), 0) reg_num,
 | 
											
												
													
														|  | -                
 |  | 
 | 
											
												
													
														|  | 
 |  | +                                
 | 
											
												
													
														|  |                  """
 |  |                  """
 | 
											
												
													
														|  |                  + amountDay("buy_") +
 |  |                  + amountDay("buy_") +
 | 
											
												
													
														|  |                  """
 |  |                  """
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(buy_amount_m1 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m1, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m1, '/', 2) AS BIGINT)),'/buy') AS buy_amount_m1,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(buy_amount_m2 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m2, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m2, '/', 2) AS BIGINT)),'/buy') AS buy_amount_m2,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(buy_amount_m3 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m3, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m3, '/', 2) AS BIGINT)),'/buy') AS buy_amount_m3,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(buy_amount_m6 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m6, '/', 2) AS BIGINT)),'/buy') AS buy_amount_m6,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(buy_amount_y1 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_y1, '/', 2) AS BIGINT)),'/buy') AS buy_amount_y1,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(buy_amount_sum , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_sum, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_sum, '/', 2) AS BIGINT)),'/buy') AS buy_amount_sum,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_first_new_user_amount_count), 0) buy_first_new_user_amount_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_first_new_user_amount_num), 0) buy_first_new_user_amount_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_first_new_user_amount), 0) buy_first_new_user_amount,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_old_user_count), 0) buy_old_user_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_old_user_num), 0) buy_old_user_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_old_user_amount), 0) buy_old_user_amount,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_amount_count), 0) buy_amount_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_amount_num), 0) buy_amount_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_amount), 0) buy_amount,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_new_user_total_amount_count), 0) buy_new_user_total_amount_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_new_user_total_amount_num), 0) buy_new_user_total_amount_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(buy_new_user_total_amount), 0) buy_new_user_total_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(cost) > 0 , SUM(buy_first_new_user_amount) / SUM(cost) ,0), 4) buy_first_roi,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_reg_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_reg_num) ,0), 4) buy_first_amount_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount_num) / SUM(buy_reg_num), 0) ,4) buy_today_amount_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_amount_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_amount_num) ,0), 4) buy_new_user_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_first_new_user_amount_count) > 0, SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_count), 0), 2) buy_first_avg_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_new_user_total_amount_count) > 0, SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_count), 0), 2) buy_today_avg_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_amount_count) > 0, SUM(buy_amount) / SUM(buy_amount_count), 0), 2) buy_avg_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(buy_reg_order_user_again) / SUM(buy_new_user_total_amount_num), 0), 4) buy_user_again_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount) / SUM(buy_reg_num), 0), 2) buy_reg_user_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_first_new_user_amount_num) > 0 , SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_num), 0), 2) buy_first_amount_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_new_user_total_amount_num) > 0 , SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_num), 0), 2) buy_today_amount_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_amount_num) > 0, SUM(buy_amount) / SUM(buy_amount_num), 0), 2) buy_amount_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_reg_num) > 0, SUM(cost) / SUM(buy_reg_num), 0), 2) buy_reg_cost,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_first_new_user_amount_num) > 0, SUM(cost) / SUM(buy_first_new_user_amount_num), 0), 2) buy_first_new_user_recharge_cost,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(cost) / SUM(buy_new_user_total_amount_num), 0), 2) buy_total_recharge_cost,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(cost) > 0, SUM(buy_new_user_total_amount) / SUM(cost), 0), 4) buy_total_roi,
 |  | 
 | 
											
												
													
														|  | -                
 |  | 
 | 
											
												
													
														|  | -                """
 |  | 
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now() , CAST(SPLIT_PART(buy_amount_m1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_m1, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_m1, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS buy_amount_m1,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now() , CAST(SPLIT_PART(buy_amount_m2 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_m2, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_m2, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS buy_amount_m2,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now() , CAST(SPLIT_PART(buy_amount_m3 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_m3, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_m3, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS buy_amount_m3,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now() , CAST(SPLIT_PART(buy_amount_m6 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_m6, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_m6, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS buy_amount_m6,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now() , CAST(SPLIT_PART(buy_amount_y1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_y1, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_y1, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS buy_amount_y1,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(CAST(SPLIT_PART(buy_amount_sum , '/', 1) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_sum, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_sum, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(cost), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)))
 | 
											
												
													
														|  | 
 |  | +                            ) AS buy_amount_sum,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_first_new_user_amount_count), 0) buy_first_new_user_amount_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_first_new_user_amount_num), 0) buy_first_new_user_amount_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_first_new_user_amount), 0) buy_first_new_user_amount,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_old_user_count), 0) buy_old_user_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_old_user_num), 0) buy_old_user_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_old_user_amount), 0) buy_old_user_amount,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_amount_count), 0) buy_amount_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_amount_num), 0) buy_amount_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_amount), 0) buy_amount,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_new_user_total_amount_count), 0) buy_new_user_total_amount_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_new_user_total_amount_num), 0) buy_new_user_total_amount_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(buy_new_user_total_amount), 0) buy_new_user_total_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(cost) > 0 , SUM(buy_first_new_user_amount) / SUM(cost) ,0), 4) buy_first_roi,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_reg_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_reg_num) ,0), 4) buy_first_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount_num) / SUM(buy_reg_num), 0) ,4) buy_today_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_amount_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_amount_num) ,0), 4) buy_new_user_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_first_new_user_amount_count) > 0, SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_count), 0), 2) buy_first_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_new_user_total_amount_count) > 0, SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_count), 0), 2) buy_today_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_amount_count) > 0, SUM(buy_amount) / SUM(buy_amount_count), 0), 2) buy_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(buy_reg_order_user_again) / SUM(buy_new_user_total_amount_num), 0), 4) buy_user_again_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount) / SUM(buy_reg_num), 0), 2) buy_reg_user_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_first_new_user_amount_num) > 0 , SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_num), 0), 2) buy_first_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_new_user_total_amount_num) > 0 , SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_num), 0), 2) buy_today_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_amount_num) > 0, SUM(buy_amount) / SUM(buy_amount_num), 0), 2) buy_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_reg_num) > 0, SUM(cost) / SUM(buy_reg_num), 0), 2) buy_reg_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_first_new_user_amount_num) > 0, SUM(cost) / SUM(buy_first_new_user_amount_num), 0), 2) buy_first_new_user_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(cost) / SUM(buy_new_user_total_amount_num), 0), 2) buy_total_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(cost) > 0, SUM(buy_new_user_total_amount) / SUM(cost), 0), 4) buy_total_roi,
 | 
											
												
													
														|  | 
 |  | +                        SUM(buy_hundred_user_num) buy_hundred_user_num,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(buy_hundred_user_num) > 0, SUM(cost) / SUM(buy_hundred_user_num), 0), 2) buy_hundred_user_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        SUM(buy_first_role_num) buy_first_role_num,
 | 
											
												
													
														|  | 
 |  | +                        SUM(buy_role_num) buy_role_num,
 | 
											
												
													
														|  | 
 |  | +                        SUM(buy_new_user_total_role_num) buy_new_user_total_role_num,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(buy_first_role_num) > 0, SUM(cost) / SUM(buy_first_role_num), 0), 2) buy_first_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(buy_role_num) > 0, SUM(cost) / SUM(buy_role_num), 0), 2) buy_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(buy_new_user_total_role_num) >0, SUM(cost) / SUM(buy_new_user_total_role_num), 0), 2) buy_new_user_total_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(buy_reg_num) >0, SUM(buy_first_role_num) / SUM(buy_reg_num), 0), 4) buy_first_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(buy_reg_num) >0, SUM(buy_role_num) / SUM(buy_reg_num), 0), 4) buy_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(buy_reg_num) >0, SUM(buy_new_user_total_role_num) / SUM(buy_reg_num), 0), 4) buy_new_user_total_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                                        
 | 
											
												
													
														|  | 
 |  | +                        """
 | 
											
												
													
														|  |                  + amountDay("nature_") +
 |  |                  + amountDay("nature_") +
 | 
											
												
													
														|  |                  """
 |  |                  """
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(nature_amount_m1 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m1, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m1, '/', 2) AS BIGINT)),'/nature') AS nature_amount_m1,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(nature_amount_m2 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m2, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m2, '/', 2) AS BIGINT)),'/nature') AS nature_amount_m2,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(nature_amount_m3 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m3, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m3, '/', 2) AS BIGINT)),'/nature') AS nature_amount_m3,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(nature_amount_m6 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m6, '/', 2) AS BIGINT)),'/nature') AS nature_amount_m6,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(nature_amount_y1 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_y1, '/', 2) AS BIGINT)),'/nature') AS nature_amount_y1,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(nature_amount_sum , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_sum, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_sum, '/', 2) AS BIGINT)),'/nature') AS nature_amount_sum,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_first_new_user_amount_count), 0) nature_first_new_user_amount_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_first_new_user_amount_num), 0) nature_first_new_user_amount_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_first_new_user_amount), 0) nature_first_new_user_amount,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_old_user_count), 0) nature_old_user_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_old_user_num), 0) nature_old_user_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_old_user_amount), 0) nature_old_user_amount,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_amount_count), 0) nature_amount_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_amount_num), 0) nature_amount_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_amount), 0) nature_amount,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_new_user_total_amount_count), 0) nature_new_user_total_amount_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_new_user_total_amount_num), 0) nature_new_user_total_amount_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(nature_new_user_total_amount), 0) nature_new_user_total_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(cost) > 0 , SUM(nature_first_new_user_amount) / SUM(cost) ,0), 4) nature_first_roi,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_reg_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_reg_num) ,0), 4) nature_first_amount_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount_num) / SUM(nature_reg_num), 0) ,4) nature_today_amount_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_amount_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_amount_num) ,0), 4) nature_new_user_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_first_new_user_amount_count) > 0, SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_count), 0), 2) nature_first_avg_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_new_user_total_amount_count) > 0, SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_count), 0), 2) nature_today_avg_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_amount_count) > 0, SUM(nature_amount) / SUM(nature_amount_count), 0), 2) nature_avg_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(nature_reg_order_user_again) / SUM(nature_new_user_total_amount_num), 0), 4) nature_user_again_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount) / SUM(nature_reg_num), 0), 2) nature_reg_user_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_first_new_user_amount_num) > 0 , SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_num), 0), 2) nature_first_amount_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_new_user_total_amount_num) > 0 , SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_num), 0), 2) nature_today_amount_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_amount_num) > 0, SUM(nature_amount) / SUM(nature_amount_num), 0), 2) nature_amount_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_reg_num) > 0, SUM(cost) / SUM(nature_reg_num), 0), 2) nature_reg_cost,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_first_new_user_amount_num) > 0, SUM(cost) / SUM(nature_first_new_user_amount_num), 0), 2) nature_first_new_user_recharge_cost,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(cost) / SUM(nature_new_user_total_amount_num), 0), 2) nature_total_recharge_cost,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(cost) > 0, SUM(nature_new_user_total_amount) / SUM(cost), 0), 4) nature_total_roi,
 |  | 
 | 
											
												
													
														|  | -                
 |  | 
 | 
											
												
													
														|  | -                """
 |  | 
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now() , CAST(SPLIT_PART(nature_amount_m1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_m1, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_m1, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS nature_amount_m1,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now() , CAST(SPLIT_PART(nature_amount_m2 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_m2, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_m2, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS nature_amount_m2,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now() , CAST(SPLIT_PART(nature_amount_m3 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_m3, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_m3, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS nature_amount_m3,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now() , CAST(SPLIT_PART(nature_amount_m6 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_m6, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_m6, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS nature_amount_m6,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now() , CAST(SPLIT_PART(nature_amount_y1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_y1, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_y1, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS nature_amount_y1,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(CAST(SPLIT_PART(nature_amount_sum , '/', 1) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_sum, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_sum, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(cost), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)))
 | 
											
												
													
														|  | 
 |  | +                            ) AS nature_amount_sum,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_first_new_user_amount_count), 0) nature_first_new_user_amount_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_first_new_user_amount_num), 0) nature_first_new_user_amount_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_first_new_user_amount), 0) nature_first_new_user_amount,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_old_user_count), 0) nature_old_user_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_old_user_num), 0) nature_old_user_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_old_user_amount), 0) nature_old_user_amount,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_amount_count), 0) nature_amount_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_amount_num), 0) nature_amount_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_amount), 0) nature_amount,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_new_user_total_amount_count), 0) nature_new_user_total_amount_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_new_user_total_amount_num), 0) nature_new_user_total_amount_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(nature_new_user_total_amount), 0) nature_new_user_total_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(cost) > 0 , SUM(nature_first_new_user_amount) / SUM(cost) ,0), 4) nature_first_roi,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_reg_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_reg_num) ,0), 4) nature_first_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount_num) / SUM(nature_reg_num), 0) ,4) nature_today_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_amount_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_amount_num) ,0), 4) nature_new_user_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_first_new_user_amount_count) > 0, SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_count), 0), 2) nature_first_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_new_user_total_amount_count) > 0, SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_count), 0), 2) nature_today_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_amount_count) > 0, SUM(nature_amount) / SUM(nature_amount_count), 0), 2) nature_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(nature_reg_order_user_again) / SUM(nature_new_user_total_amount_num), 0), 4) nature_user_again_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount) / SUM(nature_reg_num), 0), 2) nature_reg_user_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_first_new_user_amount_num) > 0 , SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_num), 0), 2) nature_first_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_new_user_total_amount_num) > 0 , SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_num), 0), 2) nature_today_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_amount_num) > 0, SUM(nature_amount) / SUM(nature_amount_num), 0), 2) nature_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_reg_num) > 0, SUM(cost) / SUM(nature_reg_num), 0), 2) nature_reg_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_first_new_user_amount_num) > 0, SUM(cost) / SUM(nature_first_new_user_amount_num), 0), 2) nature_first_new_user_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(cost) / SUM(nature_new_user_total_amount_num), 0), 2) nature_total_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(cost) > 0, SUM(nature_new_user_total_amount) / SUM(cost), 0), 4) nature_total_roi,
 | 
											
												
													
														|  | 
 |  | +                        SUM(nature_hundred_user_num) nature_hundred_user_num,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(nature_hundred_user_num) > 0, SUM(cost) / SUM(nature_hundred_user_num), 0), 2) nature_hundred_user_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        SUM(nature_first_role_num) nature_first_role_num,
 | 
											
												
													
														|  | 
 |  | +                        SUM(nature_role_num) nature_role_num,
 | 
											
												
													
														|  | 
 |  | +                        SUM(nature_new_user_total_role_num) nature_new_user_total_role_num,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(nature_first_role_num) > 0, SUM(cost) / SUM(nature_first_role_num), 0), 2) nature_first_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(nature_role_num) > 0, SUM(cost) / SUM(nature_role_num), 0), 2) nature_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(nature_new_user_total_role_num) >0, SUM(cost) / SUM(nature_new_user_total_role_num), 0), 2) nature_new_user_total_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(nature_reg_num) >0, SUM(nature_first_role_num) / SUM(nature_reg_num), 0), 4) nature_first_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(nature_reg_num) >0, SUM(nature_role_num) / SUM(nature_reg_num), 0), 4) nature_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(nature_reg_num) >0, SUM(nature_new_user_total_role_num) / SUM(nature_reg_num), 0), 4) nature_new_user_total_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                                        
 | 
											
												
													
														|  | 
 |  | +                        """
 | 
											
												
													
														|  |                  + amountDay("") +
 |  |                  + amountDay("") +
 | 
											
												
													
														|  |                  """
 |  |                  """
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(amount_m1 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m1, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m1, '/', 2) AS BIGINT)),'/total') AS amount_m1,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(amount_m2 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m2, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m2, '/', 2) AS BIGINT)),'/total') AS amount_m2,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(amount_m3 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m3, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m3, '/', 2) AS BIGINT)),'/total') AS amount_m3,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(amount_m6 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m6, '/', 2) AS BIGINT)),'/total') AS amount_m6,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(amount_y1 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_y1, '/', 2) AS BIGINT)),'/total') AS amount_y1,
 |  | 
 | 
											
												
													
														|  | -                CONCAT(SUM(CAST(SPLIT_PART(amount_sum , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_sum, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_sum, '/', 2) AS BIGINT)),'/total') AS amount_sum,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(first_new_user_amount_count), 0) first_new_user_amount_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(first_new_user_amount_num), 0) first_new_user_amount_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(first_new_user_amount), 0) first_new_user_amount,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(old_user_count), 0) old_user_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(old_user_num), 0) old_user_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(old_user_amount), 0) old_user_amount,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(amount_count), 0) amount_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(amount_num), 0) amount_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(amount), 0) amount,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(new_user_total_amount_count), 0) new_user_total_amount_count,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(new_user_total_amount_num), 0) new_user_total_amount_num,
 |  | 
 | 
											
												
													
														|  | -                IFNULL(SUM(new_user_total_amount), 0) new_user_total_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(cost) > 0 , SUM(first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(reg_num) > 0 , SUM(first_new_user_amount_num) / SUM(reg_num) ,0), 4) first_amount_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(reg_num) > 0, SUM(new_user_total_amount_num) / SUM(reg_num), 0) ,4) today_amount_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(amount_num) > 0 , SUM(first_new_user_amount_num) / SUM(amount_num) ,0), 4) new_user_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(first_new_user_amount_count) > 0, SUM(first_new_user_amount) / SUM(first_new_user_amount_count), 0), 2) first_avg_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(new_user_total_amount_count) > 0, SUM(new_user_total_amount) / SUM(new_user_total_amount_count), 0), 2) today_avg_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(amount_count) > 0, SUM(amount) / SUM(amount_count), 0), 2) avg_amount,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(new_user_total_amount_num) > 0, SUM(reg_order_user_again) / SUM(new_user_total_amount_num), 0), 4) user_again_rate,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(reg_num) > 0, SUM(new_user_total_amount) / SUM(reg_num), 0), 2) reg_user_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(first_new_user_amount_num) > 0 , SUM(first_new_user_amount) / SUM(first_new_user_amount_num), 0), 2) first_amount_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(new_user_total_amount_num) > 0 , SUM(new_user_total_amount) / SUM(new_user_total_amount_num), 0), 2) today_amount_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(amount_num) > 0, SUM(amount) / SUM(amount_num), 0), 2) amount_arpu,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(reg_num) > 0, SUM(cost) / SUM(reg_num), 0), 2) reg_cost,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(first_new_user_amount_num) > 0, SUM(cost) / SUM(first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(new_user_total_amount_num) > 0, SUM(cost) / SUM(new_user_total_amount_num), 0), 2) total_recharge_cost,
 |  | 
 | 
											
												
													
														|  | -                round(if(SUM(cost) > 0, SUM(new_user_total_amount) / SUM(cost), 0), 4) total_roi
 |  | 
 | 
											
												
													
														|  | -                                
 |  | 
 | 
											
												
													
														|  | -                FROM
 |  | 
 | 
											
												
													
														|  | -                ads_game_day
 |  | 
 | 
											
												
													
														|  | -                 
 |  | 
 | 
											
												
													
														|  | -                                
 |  | 
 | 
											
												
													
														|  | -                """;
 |  | 
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now() , CAST(SPLIT_PART(amount_m1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_m1, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_m1, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS amount_m1,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now() , CAST(SPLIT_PART(amount_m2 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_m2, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_m2, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS amount_m2,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now() , CAST(SPLIT_PART(amount_m3 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_m3, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_m3, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS amount_m3,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now() , CAST(SPLIT_PART(amount_m6 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_m6, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_m6, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS amount_m6,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now() , CAST(SPLIT_PART(amount_y1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_y1, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_y1, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), cost, 0)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                            ) AS amount_y1,
 | 
											
												
													
														|  | 
 |  | +                        CONCAT(
 | 
											
												
													
														|  | 
 |  | +                        	SUM(CAST(SPLIT_PART(amount_sum , '/', 1) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_sum, '/', 6) AS DECIMAL(10, 2))), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_sum, '/', 2) AS BIGINT)), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(cost), '/',
 | 
											
												
													
														|  | 
 |  | +                            SUM(CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)))
 | 
											
												
													
														|  | 
 |  | +                            ) AS amount_sum,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(first_new_user_amount_count), 0) first_new_user_amount_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(first_new_user_amount_num), 0) first_new_user_amount_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(first_new_user_amount), 0) first_new_user_amount,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(old_user_count), 0) old_user_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(old_user_num), 0) old_user_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(old_user_amount), 0) old_user_amount,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(amount_count), 0) amount_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(amount_num), 0) amount_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(amount), 0) amount,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(new_user_total_amount_count), 0) new_user_total_amount_count,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(new_user_total_amount_num), 0) new_user_total_amount_num,
 | 
											
												
													
														|  | 
 |  | +                        IFNULL(SUM(new_user_total_amount), 0) new_user_total_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(cost) > 0 , SUM(first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(reg_num) > 0 , SUM(first_new_user_amount_num) / SUM(reg_num) ,0), 4) first_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(reg_num) > 0, SUM(new_user_total_amount_num) / SUM(reg_num), 0) ,4) today_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(amount_num) > 0 , SUM(first_new_user_amount_num) / SUM(amount_num) ,0), 4) new_user_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(first_new_user_amount_count) > 0, SUM(first_new_user_amount) / SUM(first_new_user_amount_count), 0), 2) first_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(new_user_total_amount_count) > 0, SUM(new_user_total_amount) / SUM(new_user_total_amount_count), 0), 2) today_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(amount_count) > 0, SUM(amount) / SUM(amount_count), 0), 2) avg_amount,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(new_user_total_amount_num) > 0, SUM(reg_order_user_again) / SUM(new_user_total_amount_num), 0), 4) user_again_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(reg_num) > 0, SUM(new_user_total_amount) / SUM(reg_num), 0), 2) reg_user_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(first_new_user_amount_num) > 0 , SUM(first_new_user_amount) / SUM(first_new_user_amount_num), 0), 2) first_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(new_user_total_amount_num) > 0 , SUM(new_user_total_amount) / SUM(new_user_total_amount_num), 0), 2) today_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(amount_num) > 0, SUM(amount) / SUM(amount_num), 0), 2) amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(reg_num) > 0, SUM(cost) / SUM(reg_num), 0), 2) reg_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(first_new_user_amount_num) > 0, SUM(cost) / SUM(first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(new_user_total_amount_num) > 0, SUM(cost) / SUM(new_user_total_amount_num), 0), 2) total_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(if(SUM(cost) > 0, SUM(new_user_total_amount) / SUM(cost), 0), 4) total_roi,
 | 
											
												
													
														|  | 
 |  | +                        SUM(hundred_user_num) hundred_user_num,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(hundred_user_num) > 0, SUM(cost) / SUM(hundred_user_num), 0), 2) hundred_user_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        SUM(first_role_num) first_role_num,
 | 
											
												
													
														|  | 
 |  | +                        SUM(role_num) role_num,
 | 
											
												
													
														|  | 
 |  | +                        SUM(new_user_total_role_num) new_user_total_role_num,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(first_role_num) > 0, SUM(cost) / SUM(first_role_num), 0), 2) first_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(role_num) > 0, SUM(cost) / SUM(role_num), 0), 2) role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(new_user_total_role_num) >0, SUM(cost) / SUM(new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(reg_num) >0, SUM(first_role_num) / SUM(reg_num), 0), 4) first_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(reg_num) >0, SUM(role_num) / SUM(reg_num), 0), 4) role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                        round(IF(SUM(reg_num) >0, SUM(new_user_total_role_num) / SUM(reg_num), 0), 4) new_user_total_role_num_rate
 | 
											
												
													
														|  | 
 |  | +                                        
 | 
											
												
													
														|  | 
 |  | +                        FROM
 | 
											
												
													
														|  | 
 |  | +                        ads_game_day
 | 
											
												
													
														|  | 
 |  | +                         
 | 
											
												
													
														|  | 
 |  | +                                        
 | 
											
												
													
														|  | 
 |  | +                        """;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 游戏每日总计趋势sql
 |  |       * 游戏每日总计趋势sql
 | 
											
												
													
														|  | 
 |  | +     *
 | 
											
												
													
														|  |       * @param type 输入的参数表示选择表的类型
 |  |       * @param type 输入的参数表示选择表的类型
 | 
											
												
													
														|  | -     * @return String : Dn的充值金额 / D1-Dn的充值总金额 / Dn的充值人数
 |  | 
 | 
											
												
													
														|  | 
 |  | +     * @return String : Dn的充值金额 / D1-Dn的充值总金额 / Dn的充值人数 /当前消耗(剔除不存在的天数数据) /D1充值金额总和(剔除不存在的天数数据)/type
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    private String amountDay(String type){
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        //修改拼接字符串
 |  | 
 | 
											
												
													
														|  | -        String temp;
 |  | 
 | 
											
												
													
														|  | -        if (type.equals("buy_")) {
 |  | 
 | 
											
												
													
														|  | -            temp = "buy";
 |  | 
 | 
											
												
													
														|  | -        } else if (type.equals("nature_")) {
 |  | 
 | 
											
												
													
														|  | -            temp = "nature";
 |  | 
 | 
											
												
													
														|  | -        } else {
 |  | 
 | 
											
												
													
														|  | -            temp = "total";
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private String amountDay(String type) {
 | 
											
												
													
														|  | 
 |  | +        //拼接查询条件
 | 
											
												
													
														|  |          StringBuilder trendDay = new StringBuilder(StringUtils.EMPTY);
 |  |          StringBuilder trendDay = new StringBuilder(StringUtils.EMPTY);
 | 
											
												
													
														|  |          for (int day = 1; day <= 29; day++) {
 |  |          for (int day = 1; day <= 29; day++) {
 | 
											
												
													
														|  | -            trendDay.append("CONCAT(")
 |  | 
 | 
											
												
													
														|  | -                    .append("SUM(CAST(SPLIT_PART(")
 |  | 
 | 
											
												
													
														|  | -                    .append(type)
 |  | 
 | 
											
												
													
														|  | -                    .append("amount_d")
 |  | 
 | 
											
												
													
														|  | -                    .append(day)
 |  | 
 | 
											
												
													
														|  | -                    .append(" , '/', 1) AS DECIMAL(10, 2))), ")
 |  | 
 | 
											
												
													
														|  | -                    .append("'/', ")
 |  | 
 | 
											
												
													
														|  | -                    .append("SUM(CAST(SPLIT_PART(")
 |  | 
 | 
											
												
													
														|  | -                    .append(type)
 |  | 
 | 
											
												
													
														|  | -                    .append("amount_d")
 |  | 
 | 
											
												
													
														|  | -                    .append(day)
 |  | 
 | 
											
												
													
														|  | -                    .append(", '/', 6) AS DECIMAL(10, 2))), ")
 |  | 
 | 
											
												
													
														|  | -                    .append("'/', ")
 |  | 
 | 
											
												
													
														|  | -                    .append("SUM(CAST(SPLIT_PART(")
 |  | 
 | 
											
												
													
														|  | -                    .append(type)
 |  | 
 | 
											
												
													
														|  | -                    .append("amount_d")
 |  | 
 | 
											
												
													
														|  | -                    .append(day)
 |  | 
 | 
											
												
													
														|  | -                    .append(", '/', 2) AS BIGINT))")
 |  | 
 | 
											
												
													
														|  | -                    .append(",'/")
 |  | 
 | 
											
												
													
														|  | -                    .append(temp)
 |  | 
 | 
											
												
													
														|  | -                    .append("'")
 |  | 
 | 
											
												
													
														|  | -                    .append(") AS ")
 |  | 
 | 
											
												
													
														|  | -                    .append(type)
 |  | 
 | 
											
												
													
														|  | -                    .append("amount_d")
 |  | 
 | 
											
												
													
														|  | -                    .append(day).append(",");
 |  | 
 | 
											
												
													
														|  | 
 |  | +            trendDay.append("""
 | 
											
												
													
														|  | 
 |  | +                    CONCAT(
 | 
											
												
													
														|  | 
 |  | +                    SUM(IF( DATE_ADD(dt, INTERVAL %s day) <= LocalDate.now()  , CAST(SPLIT_PART(%samount_d%s , '/', 1) AS DECIMAL(10, 2)), 0 )),'/',
 | 
											
												
													
														|  | 
 |  | +                    SUM(CAST(SPLIT_PART( %samount_d%s, '/', 6) AS DECIMAL(10, 2))),'/',
 | 
											
												
													
														|  | 
 |  | +                    SUM(CAST(SPLIT_PART(%samount_d%s, '/', 2) AS BIGINT)),'/',
 | 
											
												
													
														|  | 
 |  | +                    SUM(IF( DATE_ADD(dt, INTERVAL %s day) <= LocalDate.now(),  cost, 0)),'/',
 | 
											
												
													
														|  | 
 |  | +                    SUM(IF( DATE_ADD(dt, INTERVAL %s day) <= LocalDate.now(),  CAST(SPLIT_PART(%samount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
 | 
											
												
													
														|  | 
 |  | +                    ) AS %samount_d%s ,
 | 
											
												
													
														|  | 
 |  | +                       """.formatted(day - 1, type, day, type, day, type, day, day - 1, day - 1, type, type, day));
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          return trendDay.toString();
 |  |          return trendDay.toString();
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -1670,13 +1871,139 @@ public class GameDataServiceImpl implements IGameDataService {
 | 
											
												
													
														|  |                      
 |  |                      
 | 
											
												
													
														|  |                      round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(cost) / SUM(buy_new_user_total_amount_num), 0), 2) buy_total_recharge_cost,
 |  |                      round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(cost) / SUM(buy_new_user_total_amount_num), 0), 2) buy_total_recharge_cost,
 | 
											
												
													
														|  |                      round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(cost) / SUM(nature_new_user_total_amount_num), 0), 2) nature_total_recharge_cost,
 |  |                      round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(cost) / SUM(nature_new_user_total_amount_num), 0), 2) nature_total_recharge_cost,
 | 
											
												
													
														|  | -                    round(if(SUM(new_user_total_amount_num) > 0, SUM(cost) / SUM(new_user_total_amount_num), 0), 2) total_recharge_cost
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(new_user_total_amount_num) > 0, SUM(cost) / SUM(new_user_total_amount_num), 0), 2) total_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    SUM(buy_hundred_user_num) buy_hundred_user_num,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(buy_hundred_user_num) > 0, SUM(cost) / SUM(buy_hundred_user_num), 0), 2) buy_hundred_user_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    SUM(buy_first_role_num) buy_first_role_num,
 | 
											
												
													
														|  | 
 |  | +                    SUM(buy_role_num) buy_role_num,
 | 
											
												
													
														|  | 
 |  | +                    SUM(buy_new_user_total_role_num) buy_new_user_total_role_num,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(buy_first_role_num) > 0, SUM(cost) / SUM(buy_first_role_num), 0), 2) buy_first_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(buy_role_num) > 0, SUM(cost) / SUM(buy_role_num), 0), 2) buy_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(buy_new_user_total_role_num) >0, SUM(cost) / SUM(buy_new_user_total_role_num), 0), 2) buy_new_user_total_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(buy_reg_num) >0, SUM(buy_first_role_num) / SUM(buy_reg_num), 0), 4) buy_first_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(buy_reg_num) >0, SUM(buy_role_num) / SUM(buy_reg_num), 0), 4) buy_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(buy_reg_num) >0, SUM(buy_new_user_total_role_num) / SUM(buy_reg_num), 0), 4) buy_new_user_total_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    SUM(nature_hundred_user_num) nature_hundred_user_num,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(nature_hundred_user_num) > 0, SUM(cost) / SUM(nature_hundred_user_num), 0), 2) nature_hundred_user_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    SUM(nature_first_role_num) nature_first_role_num,
 | 
											
												
													
														|  | 
 |  | +                    SUM(nature_role_num) nature_role_num,
 | 
											
												
													
														|  | 
 |  | +                    SUM(nature_new_user_total_role_num) nature_new_user_total_role_num,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(nature_first_role_num) > 0, SUM(cost) / SUM(nature_first_role_num), 0), 2) nature_first_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(nature_role_num) > 0, SUM(cost) / SUM(nature_role_num), 0), 2) nature_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(nature_new_user_total_role_num) >0, SUM(cost) / SUM(nature_new_user_total_role_num), 0), 2) nature_new_user_total_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(nature_reg_num) >0, SUM(nature_first_role_num) / SUM(nature_reg_num), 0), 4) nature_first_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(nature_reg_num) >0, SUM(nature_role_num) / SUM(nature_reg_num), 0), 4) nature_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(nature_reg_num) >0, SUM(nature_new_user_total_role_num) / SUM(nature_reg_num), 0), 4) nature_new_user_total_role_num_rate,
 | 
											
												
													
														|  |                     
 |  |                     
 | 
											
												
													
														|  | 
 |  | +                    SUM(hundred_user_num) hundred_user_num,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(hundred_user_num) > 0, SUM(cost) / SUM(hundred_user_num), 0), 2) hundred_user_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    SUM(first_role_num) first_role_num,
 | 
											
												
													
														|  | 
 |  | +                    SUM(role_num) role_num,
 | 
											
												
													
														|  | 
 |  | +                    SUM(new_user_total_role_num) new_user_total_role_num,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(first_role_num) > 0, SUM(cost) / SUM(first_role_num), 0), 2) first_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(role_num) > 0, SUM(cost) / SUM(role_num), 0), 2) role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(new_user_total_role_num) >0, SUM(cost) / SUM(new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(reg_num) >0, SUM(first_role_num) / SUM(reg_num), 0), 4) first_role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(reg_num) >0, SUM(role_num) / SUM(reg_num), 0), 4) role_num_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(IF(SUM(reg_num) >0, SUM(new_user_total_role_num) / SUM(reg_num), 0), 4) new_user_total_role_num_rate
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  |                  FROM
 |  |                  FROM
 | 
											
												
													
														|  |                      ads_game_day a
 |  |                      ads_game_day a
 | 
											
												
													
														|  |                  """;
 |  |                  """;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 游戏总数据总计一栏sql
 | 
											
												
													
														|  | 
 |  | +     *
 | 
											
												
													
														|  | 
 |  | +     * @return String
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    private String gameDataTotalTotalSql() {
 | 
											
												
													
														|  | 
 |  | +        return """
 | 
											
												
													
														|  | 
 |  | +                SELECT
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(buy_reg_num), 0) buy_reg_num,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(nature_reg_num), 0) nature_reg_num,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(reg_num), 0) reg_num,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(cost), 0) cost,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(buy_first_new_user_amount_count), 0) buy_first_new_user_amount_count,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(buy_first_new_user_amount_num), 0) buy_first_new_user_amount_num,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(buy_first_new_user_amount), 0) buy_first_new_user_amount,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(nature_first_new_user_amount_count), 0) nature_first_new_user_amount_count,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(nature_first_new_user_amount_num), 0) nature_first_new_user_amount_num,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(nature_first_new_user_amount), 0) nature_first_new_user_amount,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(first_new_user_amount_count), 0) first_new_user_amount_count,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(first_new_user_amount_num), 0) first_new_user_amount_num,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(first_new_user_amount), 0) first_new_user_amount,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(buy_new_user_total_amount_count), 0) buy_new_user_total_amount_count,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(buy_new_user_total_amount_num), 0) buy_new_user_total_amount_num,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(buy_new_user_total_amount), 0) buy_new_user_total_amount,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(nature_new_user_total_amount_count), 0) nature_new_user_total_amount_count,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(nature_new_user_total_amount_num), 0) nature_new_user_total_amount_num,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(nature_new_user_total_amount), 0) nature_new_user_total_amount,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(new_user_total_amount_count), 0) new_user_total_amount_count,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(new_user_total_amount_num), 0) new_user_total_amount_num,
 | 
											
												
													
														|  | 
 |  | +                    IFNULL(sum(new_user_total_amount), 0) new_user_total_amount,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(cost) > 0 , SUM(buy_first_new_user_amount) / SUM(cost) ,0), 4) buy_first_roi,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(buy_reg_num) > 0 ,sum(buy_first_new_user_amount_num) / sum(buy_reg_num), 0), 4) buy_first_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(buy_reg_num) > 0, sum(buy_new_user_total_amount_num) / sum(buy_reg_num), 0), 4) buy_today_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(cost) > 0 , SUM(nature_first_new_user_amount) / SUM(cost) ,0), 4) nature_first_roi,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(nature_reg_num) > 0 ,sum(nature_first_new_user_amount_num) / sum(nature_reg_num), 0), 4) nature_first_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(nature_reg_num) > 0, sum(nature_new_user_total_amount_num) / sum(nature_reg_num), 0), 4) nature_today_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(cost) > 0 , SUM(first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(reg_num) > 0 ,sum(first_new_user_amount_num) / sum(reg_num), 0), 4) first_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(reg_num) > 0, sum(new_user_total_amount_num) / sum(reg_num), 0), 4) today_amount_rate,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(buy_first_new_user_amount_count) > 0, sum(buy_first_new_user_amount) / sum(buy_first_new_user_amount_count), 0), 2) buy_first_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(buy_new_user_total_amount_count) > 0, sum(buy_new_user_total_amount) / sum(buy_new_user_total_amount_count), 0), 2) buy_today_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(nature_first_new_user_amount_count) > 0, sum(nature_first_new_user_amount) / sum(nature_first_new_user_amount_count), 0), 2) nature_first_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(nature_new_user_total_amount_count) > 0, sum(nature_new_user_total_amount) / sum(nature_new_user_total_amount_count), 0), 2) nature_today_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(first_new_user_amount_count) > 0, sum(first_new_user_amount) / sum(first_new_user_amount_count), 0), 2) first_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(new_user_total_amount_count) > 0, sum(new_user_total_amount) / sum(new_user_total_amount_count), 0), 2) today_avg_amount,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(buy_new_user_total_amount_num) > 0 , sum(buy_reg_order_user_again) / sum(buy_new_user_total_amount_num), 0), 4) buy_today_again_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(nature_new_user_total_amount_num) > 0 , sum(nature_reg_order_user_again) / sum(nature_new_user_total_amount_num), 0), 4) nature_today_again_rate,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(new_user_total_amount_num) > 0 , sum(reg_order_user_again) / sum(new_user_total_amount_num), 0), 4) today_again_rate,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(buy_reg_num) > 0 , sum(buy_new_user_total_amount) / sum(buy_reg_num), 0), 2) buy_reg_user_arpu,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(buy_first_new_user_amount_num) > 0 , sum(buy_first_new_user_amount) / sum(buy_first_new_user_amount_num), 0), 2) buy_first_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(buy_new_user_total_amount_num) > 0 , sum(buy_new_user_total_amount) / sum(buy_new_user_total_amount_num), 0), 2) buy_today_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(nature_reg_num) > 0 , sum(nature_new_user_total_amount) / sum(nature_reg_num), 0), 2) nature_reg_user_arpu,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(nature_first_new_user_amount_num) > 0 , sum(nature_first_new_user_amount) / sum(nature_first_new_user_amount_num), 0), 2) nature_first_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(nature_new_user_total_amount_num) > 0 , sum(nature_new_user_total_amount) / sum(nature_new_user_total_amount_num), 0), 2) nature_today_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(reg_num) > 0 , sum(new_user_total_amount) / sum(reg_num), 0), 2) reg_user_arpu,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(first_new_user_amount_num) > 0 , sum(first_new_user_amount) / sum(first_new_user_amount_num), 0), 2) first_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                    round(if(sum(new_user_total_amount_num) > 0 , sum(new_user_total_amount) / sum(new_user_total_amount_num), 0), 2) today_amount_arpu,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(buy_reg_num) > 0, SUM(cost) / SUM(buy_reg_num), 0), 2) buy_reg_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(nature_reg_num) > 0, SUM(cost) / SUM(nature_reg_num), 0), 2) nature_reg_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(reg_num) > 0, SUM(cost) / SUM(reg_num), 0), 2) reg_cost,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(cost) > 0 , SUM(buy_new_user_total_amount) / SUM(cost), 0), 4) buy_total_roi,
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(cost) > 0 , SUM(nature_new_user_total_amount) / SUM(cost), 0), 4) nature_total_roi,
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(cost) > 0 , SUM(new_user_total_amount) / SUM(cost), 0), 4) total_roi,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(buy_first_new_user_amount_num) > 0, SUM(cost) / SUM(buy_first_new_user_amount_num), 0), 2) buy_first_new_user_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(nature_first_new_user_amount_num) > 0, SUM(cost) / SUM(nature_first_new_user_amount_num), 0), 2) nature_first_new_user_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(first_new_user_amount_num) > 0, SUM(cost) / SUM(first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(cost) / SUM(buy_new_user_total_amount_num), 0), 2) buy_total_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(cost) / SUM(nature_new_user_total_amount_num), 0), 2) nature_total_recharge_cost,
 | 
											
												
													
														|  | 
 |  | +                    round(if(SUM(new_user_total_amount_num) > 0, SUM(cost) / SUM(new_user_total_amount_num), 0), 2) total_recharge_cost
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                FROM
 | 
											
												
													
														|  | 
 |  | +                    game_ads.ads_game_day
 | 
											
												
													
														|  | 
 |  | +                """;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 和充值时间有关的sql
 |  |       * 和充值时间有关的sql
 | 
											
												
													
														|  |       *
 |  |       *
 |