|
@@ -52,10 +52,15 @@ import java.util.stream.Collectors;
|
|
@Slf4j
|
|
@Slf4j
|
|
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;
|
|
static {
|
|
static {
|
|
Map<String, Field> fieldMap = new HashMap<>();
|
|
Map<String, Field> fieldMap = new HashMap<>();
|
|
|
|
+ Map<String, Field> fieldTotalMap = new HashMap<>();
|
|
List<Field> dayNFieldList = new ArrayList<>();
|
|
List<Field> dayNFieldList = new ArrayList<>();
|
|
|
|
+ List<Field> dayNTotalFieldList = new ArrayList<>();
|
|
Class<?> tempClazz = GameDataDayVO.class;
|
|
Class<?> tempClazz = GameDataDayVO.class;
|
|
|
|
+ Class<?> tempTotalClazz = GameDataDayTotalVO.class;
|
|
|
|
+
|
|
while (tempClazz != null) {
|
|
while (tempClazz != null) {
|
|
Field[] fields = tempClazz.getDeclaredFields();
|
|
Field[] fields = tempClazz.getDeclaredFields();
|
|
for (Field field : fields) {
|
|
for (Field field : fields) {
|
|
@@ -69,6 +74,21 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
}
|
|
}
|
|
tempClazz = tempClazz.getSuperclass();
|
|
tempClazz = tempClazz.getSuperclass();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ while (tempTotalClazz != null) {
|
|
|
|
+ Field[] fields = tempTotalClazz.getDeclaredFields();
|
|
|
|
+ for (Field field : fields) {
|
|
|
|
+ if (Modifier.isFinal(field.getModifiers()) || Modifier.isStatic(field.getModifiers())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ fieldTotalMap.put(field.getName(), field);
|
|
|
|
+ if (field.getType() == RechargeTrendVO.class) {
|
|
|
|
+ dayNTotalFieldList.add(field);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ tempTotalClazz = tempTotalClazz.getSuperclass();
|
|
|
|
+ }
|
|
|
|
+
|
|
if(dayNFieldList.isEmpty()) {
|
|
if(dayNFieldList.isEmpty()) {
|
|
dayNFieldMapList = Collections.emptyList();
|
|
dayNFieldMapList = Collections.emptyList();
|
|
} else {
|
|
} else {
|
|
@@ -82,6 +102,20 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(dayNTotalFieldList.isEmpty()) {
|
|
|
|
+ dayNTotalFieldMapList = Collections.emptyList();
|
|
|
|
+ } else {
|
|
|
|
+ dayNTotalFieldMapList = new ArrayList<>(dayNTotalFieldList.size());
|
|
|
|
+ for(Field dayNTotalField : dayNTotalFieldList) {
|
|
|
|
+ dayNTotalField.setAccessible(true);
|
|
|
|
+ Field sourceField = fieldMap.get(dayNTotalField.getName().replace("Trend", ""));
|
|
|
|
+ sourceField.setAccessible(true);
|
|
|
|
+ if(sourceField != null) {
|
|
|
|
+ dayNTotalFieldMapList.add(Tuples.of(sourceField, dayNTotalField));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -195,8 +229,10 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
gameDataDayTotalsql.setEntity(dao.getEntity(GameDataDayTotalVO.class));
|
|
gameDataDayTotalsql.setEntity(dao.getEntity(GameDataDayTotalVO.class));
|
|
//执行sql
|
|
//执行sql
|
|
dao.execute(gameDataDayTotalsql);
|
|
dao.execute(gameDataDayTotalsql);
|
|
-
|
|
|
|
- return gameDataDayTotalsql.getObject(GameDataDayTotalVO.class);
|
|
|
|
|
|
+ //得到每日总计对象
|
|
|
|
+ GameDataDayTotalVO vo = gameDataDayTotalsql.getObject(GameDataDayTotalVO.class);
|
|
|
|
+ //formatDayNTotal(vo);
|
|
|
|
+ return vo;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -874,6 +910,10 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 通过反射赋值每日趋势
|
|
|
|
+ * @param vo
|
|
|
|
+ */
|
|
private void formatDayN(GameDataDayVO vo) {
|
|
private void formatDayN(GameDataDayVO vo) {
|
|
if(CollectionUtils.isEmpty(dayNFieldMapList)) {
|
|
if(CollectionUtils.isEmpty(dayNFieldMapList)) {
|
|
return;
|
|
return;
|
|
@@ -895,46 +935,55 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 通过反射使用set方法 得到复充趋势的值
|
|
|
|
- *
|
|
|
|
- * @param vo 需要操作的对象
|
|
|
|
- * @param timeType D1-D30 , M1-M6
|
|
|
|
- * @param tableType buy、nature 总
|
|
|
|
|
|
+ * 通过反射赋值每日总计趋势
|
|
|
|
+ * @param vo
|
|
*/
|
|
*/
|
|
- private void setAgainContentByNum(GameDataDayVO vo, String timeType, String tableType) {
|
|
|
|
- try {
|
|
|
|
- //反射得到复充趋势数据字符串
|
|
|
|
- Field f;
|
|
|
|
- if (StringUtils.isNotBlank(tableType)) {
|
|
|
|
- f = vo.getClass().getDeclaredField(tableType + "Amount" + timeType);
|
|
|
|
- } else {
|
|
|
|
- f = vo.getClass().getDeclaredField("amount" + timeType);
|
|
|
|
- }
|
|
|
|
- f.setAccessible(true);
|
|
|
|
- //分割数据
|
|
|
|
- String[] strs = f.get(vo).toString().split("/");
|
|
|
|
-
|
|
|
|
- //反射得到set方法
|
|
|
|
- Field field;
|
|
|
|
- if (StringUtils.isNotBlank(tableType)) {
|
|
|
|
- field = vo.getClass().getDeclaredField(tableType + "Amount" + timeType + "Trend");
|
|
|
|
- } else {
|
|
|
|
- field = vo.getClass().getDeclaredField("amount" + timeType + "Trend");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- field.setAccessible(true);
|
|
|
|
- //赋值
|
|
|
|
- field.set(vo, RechargeTrendVO.builder()
|
|
|
|
- .rechargeMoney(new BigDecimal(strs[0]))
|
|
|
|
- .rechargeUserCount(Long.valueOf(strs[1]))
|
|
|
|
- .increase(new BigDecimal(strs[2]))
|
|
|
|
- .back(new BigDecimal(strs[3]))
|
|
|
|
- .multiples(new BigDecimal(strs[4]))
|
|
|
|
- .build());
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- throw new BaseException("get/set 方法出错,映射出错");
|
|
|
|
|
|
+ private void formatDayNTotal(GameDataDayTotalVO vo) {
|
|
|
|
+ if(CollectionUtils.isEmpty(dayNTotalFieldMapList)) {
|
|
|
|
+ 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 -> {
|
|
|
|
+ try {
|
|
|
|
+ String[] temps = ((String) dayNTotalFieldMap.getT1().get(vo)).split("/");
|
|
|
|
+ BigDecimal dNAmount = new BigDecimal(temps[0]);
|
|
|
|
+ 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(dNAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
|
|
|
|
+ .back(d1ToDNTotalAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
|
|
|
|
+ .multiples(d1ToDNTotalAmount.divide(buyAmountD1, 4, RoundingMode.HALF_UP))
|
|
|
|
+ .build());
|
|
|
|
+ } else if (temps.equals("nature")) {
|
|
|
|
+ dayNTotalFieldMap.getT2().set(vo, RechargeTrendVO.builder()
|
|
|
|
+ .rechargeMoney(dNAmount)
|
|
|
|
+ .rechargeUserCount(Long.valueOf(temps[2]))
|
|
|
|
+ .increase(dNAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
|
|
|
|
+ .back(d1ToDNTotalAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
|
|
|
|
+ .multiples(d1ToDNTotalAmount.divide(natureAmountD1, 4, RoundingMode.HALF_UP))
|
|
|
|
+ .build());
|
|
|
|
+ } else {
|
|
|
|
+ dayNTotalFieldMap.getT2().set(vo, RechargeTrendVO.builder()
|
|
|
|
+ .rechargeMoney(dNAmount)
|
|
|
|
+ .rechargeUserCount(Long.valueOf(temps[2]))
|
|
|
|
+ .increase(dNAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
|
|
|
|
+ .back(d1ToDNTotalAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
|
|
|
|
+ .multiples(d1ToDNTotalAmount.divide(amountD1, 4, RoundingMode.HALF_UP))
|
|
|
|
+ .build());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1313,7 +1362,16 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
SUM(buy_reg_num) buy_reg_num,
|
|
SUM(buy_reg_num) buy_reg_num,
|
|
SUM(nature_reg_num) nature_reg_num,
|
|
SUM(nature_reg_num) nature_reg_num,
|
|
SUM(reg_num) reg_num,
|
|
SUM(reg_num) reg_num,
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ """
|
|
|
|
+ + 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,
|
|
SUM(buy_first_new_user_amount_count) buy_first_new_user_amount_count,
|
|
SUM(buy_first_new_user_amount_count) buy_first_new_user_amount_count,
|
|
SUM(buy_first_new_user_amount_num) buy_first_new_user_amount_num,
|
|
SUM(buy_first_new_user_amount_num) buy_first_new_user_amount_num,
|
|
SUM(buy_first_new_user_amount) buy_first_new_user_amount,
|
|
SUM(buy_first_new_user_amount) buy_first_new_user_amount,
|
|
@@ -1339,6 +1397,15 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
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_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_amount_num) > 0, SUM(buy_amount) / SUM(buy_amount_num), 0), 2) buy_amount_arpu,
|
|
|
|
|
|
|
|
+ """
|
|
|
|
+ + 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,
|
|
SUM(nature_first_new_user_amount_count) nature_first_new_user_amount_count,
|
|
SUM(nature_first_new_user_amount_count) nature_first_new_user_amount_count,
|
|
SUM(nature_first_new_user_amount_num) nature_first_new_user_amount_num,
|
|
SUM(nature_first_new_user_amount_num) nature_first_new_user_amount_num,
|
|
SUM(nature_first_new_user_amount) nature_first_new_user_amount,
|
|
SUM(nature_first_new_user_amount) nature_first_new_user_amount,
|
|
@@ -1363,7 +1430,16 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
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_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_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_amount_num) > 0, SUM(nature_amount) / SUM(nature_amount_num), 0), 2) nature_amount_arpu,
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ """
|
|
|
|
+ + 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,
|
|
SUM(first_new_user_amount_count) first_new_user_amount_count,
|
|
SUM(first_new_user_amount_count) first_new_user_amount_count,
|
|
SUM(first_new_user_amount_num) first_new_user_amount_num,
|
|
SUM(first_new_user_amount_num) first_new_user_amount_num,
|
|
SUM(first_new_user_amount) first_new_user_amount,
|
|
SUM(first_new_user_amount) first_new_user_amount,
|
|
@@ -1396,6 +1472,54 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
""";
|
|
""";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 游戏每日总计趋势sql
|
|
|
|
+ * @param type 输入的参数表示选择表的类型
|
|
|
|
+ * @return String : Dn的充值金额 / D1-Dn的充值总金额 / Dn的充值人数
|
|
|
|
+ */
|
|
|
|
+ private String amountDay(String type){
|
|
|
|
+
|
|
|
|
+ //修改拼接字符串
|
|
|
|
+ String temp;
|
|
|
|
+ if (type.equals("buy_")) {
|
|
|
|
+ temp = "buy";
|
|
|
|
+ } else if (type.equals("nature")) {
|
|
|
|
+ temp = "nature";
|
|
|
|
+ } else {
|
|
|
|
+ temp = "total";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ StringBuilder trendDay = new StringBuilder(StringUtils.EMPTY);
|
|
|
|
+ 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(",");
|
|
|
|
+ }
|
|
|
|
+ return trendDay.toString();
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 游戏总数据SQL
|
|
* 游戏总数据SQL
|
|
*
|
|
*
|
|
@@ -1433,12 +1557,15 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
sum(a.new_user_total_amount_num) new_user_total_amount_num,
|
|
sum(a.new_user_total_amount_num) new_user_total_amount_num,
|
|
sum(a.new_user_total_amount) new_user_total_amount,
|
|
sum(a.new_user_total_amount) new_user_total_amount,
|
|
|
|
|
|
- round(if(sum(a.buy_reg_num) > 0 ,sum(a.buy_first_new_user_amount_num) / sum(a.buy_reg_num), 0), 4) buy_first_roi,
|
|
|
|
- round(if(sum(a.buy_reg_num) > 0, sum(a.buy_new_user_total_amount_num) / sum(a.buy_reg_num), 0), 4) buy_today_roi,
|
|
|
|
- round(if(sum(a.nature_reg_num) > 0 ,sum(a.nature_first_new_user_amount_num) / sum(a.nature_reg_num), 0), 4) nature_first_roi,
|
|
|
|
- round(if(sum(a.nature_reg_num) > 0, sum(a.nature_new_user_total_amount_num) / sum(a.nature_reg_num), 0), 4) nature_today_roi,
|
|
|
|
- round(if(sum(a.reg_num) > 0 ,sum(a.first_new_user_amount_num) / sum(a.reg_num), 0), 4) first_roi,
|
|
|
|
- round(if(sum(a.reg_num) > 0, sum(a.new_user_total_amount_num) / sum(a.reg_num), 0), 4) today_roi,
|
|
|
|
|
|
+ round(if(SUM(a.cost) > 0 , SUM(buy_first_new_user_amount) / SUM(a.cost) ,0), 4) buy_first_roi,
|
|
|
|
+ round(if(sum(a.buy_reg_num) > 0 ,sum(a.buy_first_new_user_amount_num) / sum(a.buy_reg_num), 0), 4) buy_first_amount_rate,
|
|
|
|
+ round(if(sum(a.buy_reg_num) > 0, sum(a.buy_new_user_total_amount_num) / sum(a.buy_reg_num), 0), 4) buy_today_amount_rate,
|
|
|
|
+ round(if(SUM(a.cost) > 0 , SUM(a.nature_first_new_user_amount) / SUM(a.cost) ,0), 4) nature_first_roi,
|
|
|
|
+ round(if(sum(a.nature_reg_num) > 0 ,sum(a.nature_first_new_user_amount_num) / sum(a.nature_reg_num), 0), 4) nature_first_amount_rate,
|
|
|
|
+ round(if(sum(a.nature_reg_num) > 0, sum(a.nature_new_user_total_amount_num) / sum(a.nature_reg_num), 0), 4) nature_today_amount_rate,
|
|
|
|
+ round(if(SUM(a.cost) > 0 , SUM(first_new_user_amount) / SUM(a.cost) ,0), 4) first_roi,
|
|
|
|
+ round(if(sum(a.reg_num) > 0 ,sum(a.first_new_user_amount_num) / sum(a.reg_num), 0), 4) first_amount_rate,
|
|
|
|
+ round(if(sum(a.reg_num) > 0, sum(a.new_user_total_amount_num) / sum(a.reg_num), 0), 4) today_amount_rate,
|
|
|
|
|
|
round(if(sum(a.buy_first_new_user_amount_count) > 0, sum(a.buy_first_new_user_amount) / sum(a.buy_first_new_user_amount_count), 0), 2) buy_first_avg_amount,
|
|
round(if(sum(a.buy_first_new_user_amount_count) > 0, sum(a.buy_first_new_user_amount) / sum(a.buy_first_new_user_amount_count), 0), 2) buy_first_avg_amount,
|
|
round(if(sum(a.buy_new_user_total_amount_count) > 0, sum(a.buy_new_user_total_amount) / sum(a.buy_new_user_total_amount_count), 0), 2) buy_today_avg_amount,
|
|
round(if(sum(a.buy_new_user_total_amount_count) > 0, sum(a.buy_new_user_total_amount) / sum(a.buy_new_user_total_amount_count), 0), 2) buy_today_avg_amount,
|