|
@@ -565,8 +565,10 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
String value = (String) field.get(vo);
|
|
|
String rData;
|
|
|
if (rDataList != null && rDataList.size() >= i + 1) {
|
|
|
+ //累计的充值人数,为了/r数据
|
|
|
+ String[] split = value.split("/");
|
|
|
GSGameServerDayRVO gsGameServerDayRVO = rDataList.get(i);
|
|
|
- rData = getRDataStr(gsGameServerDayRVO, vo);
|
|
|
+ rData = getRDataStr(gsGameServerDayRVO,Long.valueOf(split[split.length-1]));
|
|
|
} else {
|
|
|
rData = "0/0/0/0/0/0/0/0";
|
|
|
}
|
|
@@ -578,14 +580,14 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
.PaidRetentionRate(split[1])
|
|
|
.totalRegNum(split[2])
|
|
|
.totalAmountNum(split[3])
|
|
|
- .smallR(split[4])
|
|
|
- .mediumR(split[5])
|
|
|
- .largeR(split[6])
|
|
|
- .superR(split[7])
|
|
|
- .smallRNum(split[8])
|
|
|
- .mediumRNum(split[9])
|
|
|
- .largeRNum(split[10])
|
|
|
- .superRNum(split[11])
|
|
|
+ .smallR(split[5])
|
|
|
+ .mediumR(split[6])
|
|
|
+ .largeR(split[7])
|
|
|
+ .superR(split[8])
|
|
|
+ .smallRNum(split[9])
|
|
|
+ .mediumRNum(split[10])
|
|
|
+ .largeRNum(split[11])
|
|
|
+ .superRNum(split[12])
|
|
|
.build();
|
|
|
fieldObjectList.get(i).set(vo, retentionVO);
|
|
|
} catch (IllegalAccessException e) {
|
|
@@ -667,9 +669,10 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
Field field = fieldList.get(i);
|
|
|
try {
|
|
|
String value = (String) field.get(vo);
|
|
|
+ //总的累计数据
|
|
|
+ String[] split1 = value.split("/");
|
|
|
GSGameServerDayRVO gsGameServerDayRVO = dayRVOMap.get(i);
|
|
|
- String rData = getRDataStr(gsGameServerDayRVO, vo);
|
|
|
-
|
|
|
+ String rData = getRDataStr(gsGameServerDayRVO, Long.valueOf(split1[split1.length-1]));
|
|
|
value += "/" + rData;
|
|
|
String[] split = value.split("/");
|
|
|
GSServerRetentionVO retentionVO = GSServerRetentionVO.builder()
|
|
@@ -677,14 +680,14 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
.PaidRetentionRate(split[1])
|
|
|
.totalRegNum(split[2])
|
|
|
.totalAmountNum(split[3])
|
|
|
- .smallR(split[4])
|
|
|
- .mediumR(split[5])
|
|
|
- .largeR(split[6])
|
|
|
- .superR(split[7])
|
|
|
- .smallRNum(split[8])
|
|
|
- .mediumRNum(split[9])
|
|
|
- .largeRNum(split[10])
|
|
|
- .superRNum(split[11])
|
|
|
+ .smallR(split[5])
|
|
|
+ .mediumR(split[6])
|
|
|
+ .largeR(split[7])
|
|
|
+ .superR(split[8])
|
|
|
+ .smallRNum(split[9])
|
|
|
+ .mediumRNum(split[10])
|
|
|
+ .largeRNum(split[11])
|
|
|
+ .superRNum(split[12])
|
|
|
.build();
|
|
|
fieldObjectList.get(i).set(vo, retentionVO);
|
|
|
// field.set(vo, value + "/" + rData);
|
|
@@ -728,23 +731,20 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
* 拼接R留存率 (R/充值总人数)
|
|
|
*
|
|
|
* @param rvo
|
|
|
- * @param vo
|
|
|
* @return
|
|
|
*/
|
|
|
- private String getRDataStr(GSGameServerDayRVO rvo, GSGameServerDayVO vo) {
|
|
|
- if (rvo != null && vo.getTotalAmountNum() != null && vo.getTotalAmountNum() != 0) {
|
|
|
- //充值总人数
|
|
|
- BigDecimal totalAmountNum = new BigDecimal(vo.getTotalAmountNum());
|
|
|
+ private String getRDataStr(GSGameServerDayRVO rvo,Long totalNum) {
|
|
|
+ if (rvo != null && totalNum != null && totalNum != 0) {
|
|
|
//R人数
|
|
|
Long smallRCount = rvo.getSmallR();
|
|
|
Long mediumRCount = rvo.getMediumR();
|
|
|
Long largeRCont = rvo.getLargeR();
|
|
|
Long superRCount = rvo.getSuperR();
|
|
|
//R留存率
|
|
|
- BigDecimal smallR = new BigDecimal(smallRCount).divide(totalAmountNum, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
|
|
|
- BigDecimal mediumR = new BigDecimal(mediumRCount).divide(totalAmountNum, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
|
|
|
- BigDecimal largeR = new BigDecimal(largeRCont).divide(totalAmountNum, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
|
|
|
- BigDecimal superR = new BigDecimal(superRCount).divide(totalAmountNum, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
|
|
|
+ BigDecimal smallR = new BigDecimal(smallRCount).divide(new BigDecimal(totalNum), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
|
|
|
+ BigDecimal mediumR = new BigDecimal(mediumRCount).divide(new BigDecimal(totalNum), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
|
|
|
+ BigDecimal largeR = new BigDecimal(largeRCont).divide(new BigDecimal(totalNum), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
|
|
|
+ BigDecimal superR = new BigDecimal(superRCount).divide(new BigDecimal(totalNum), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
|
|
|
return smallR + "/" + mediumR + "/" + largeR + "/" + superR + "/" + smallRCount + "/" + mediumRCount + "/" + largeRCont + "/" + superRCount;
|
|
|
} else {
|
|
|
return "0/0/0/0/0/0/0/0";
|
|
@@ -863,13 +863,14 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
|
|
|
/**
|
|
|
* 获取每天活跃留存率/付费留存率的sql
|
|
|
+ *
|
|
|
*/
|
|
|
private String getRemainDaySql() {
|
|
|
StringBuilder sql = new StringBuilder(StringUtils.EMPTY);
|
|
|
for (int i = 1; i <= 90; i++) {
|
|
|
sql.append("""
|
|
|
- concat(a.da%d,'/',IFNULL(c.da%d_role_num,0),'/',IFNULL(c.da%d_num,0)) as da_str%d,
|
|
|
- """.formatted(i, i, i, i));
|
|
|
+ concat(a.da%d,'/',IFNULL(c.da%d_role_num,0),'/',IFNULL(c.da%d_num,0),'/',IFNULL(c.da%d_total_num,0)) as da_str%d,
|
|
|
+ """.formatted(i, i, i, i,i));
|
|
|
|
|
|
}
|
|
|
return sql.toString();
|
|
@@ -882,8 +883,8 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
StringBuilder sql = new StringBuilder(StringUtils.EMPTY);
|
|
|
for (int i = 1; i <= 90; i++) {
|
|
|
sql.append("""
|
|
|
- concat(ifnull(round(SUM(c.da%d_active_num) / SUM(e.new_da%d_total_num) ,4),0),'/',ifnull(round(sum(c.da%d_num)/sum(c.da%d_total_num),4),0),'/',IFNULL(SUM(c.da%d_role_num),0),'/',IFNULL(SUM(c.da%d_num),0)) as da_str%d,
|
|
|
- """.formatted(i, i, i, i, i, i, i));
|
|
|
+ concat(ifnull(round(SUM(c.da%d_active_num) / SUM(e.new_da%d_total_num) ,4),0),'/',ifnull(round(sum(c.da%d_num)/sum(c.da%d_total_num),4),0),'/',IFNULL(SUM(c.da%d_role_num),0),'/',IFNULL(SUM(c.da%d_num),0),'/',IFNULL(sum(c.da%d_total_num),0)) as da_str%d,
|
|
|
+ """.formatted(i, i, i, i, i, i, i,i));
|
|
|
}
|
|
|
return sql.toString();
|
|
|
}
|