|
@@ -1,10 +1,13 @@
|
|
|
package com.zanxiang.game.data.serve.service.impl;
|
|
|
|
|
|
+import com.google.common.base.CaseFormat;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.zanxiang.game.data.serve.pojo.dto.GameDataDayDTO;
|
|
|
import com.zanxiang.game.data.serve.pojo.dto.GameDataTotalDTO;
|
|
|
-import com.zanxiang.game.data.serve.pojo.vo.GameDataDayVO;
|
|
|
-import com.zanxiang.game.data.serve.pojo.vo.GameDataTotalVO;
|
|
|
+import com.zanxiang.game.data.serve.pojo.dto.GameDataWaterDTO;
|
|
|
+import com.zanxiang.game.data.serve.pojo.entity.AdsEverydayWater;
|
|
|
+import com.zanxiang.game.data.serve.pojo.enums.OrderByEnum;
|
|
|
+import com.zanxiang.game.data.serve.pojo.vo.*;
|
|
|
import com.zanxiang.game.data.serve.service.IGameDataService;
|
|
|
import com.zanxiang.game.data.serve.utils.Page;
|
|
|
import com.zanxiang.module.util.DateUtil;
|
|
@@ -15,9 +18,12 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.nutz.dao.Cnd;
|
|
|
import org.nutz.dao.Dao;
|
|
|
import org.nutz.dao.Sqls;
|
|
|
+import org.nutz.dao.entity.Entity;
|
|
|
import org.nutz.dao.pager.Pager;
|
|
|
import org.nutz.dao.sql.Criteria;
|
|
|
import org.nutz.dao.sql.Sql;
|
|
|
+import org.nutz.dao.util.Daos;
|
|
|
+import org.nutz.dao.util.cri.SimpleCriteria;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -44,6 +50,11 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
@Autowired
|
|
|
private Dao dao;
|
|
|
|
|
|
+ /**
|
|
|
+ * 游戏每日数据
|
|
|
+ * @param dto 前端传递查询参数
|
|
|
+ * @return 返回给前端的数据
|
|
|
+ */
|
|
|
@Override
|
|
|
public Page<GameDataDayVO> getGameDataDay(GameDataDayDTO dto) {
|
|
|
|
|
@@ -83,10 +94,292 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
//设置查询总数
|
|
|
pager.setRecordCount(list.size());
|
|
|
|
|
|
+ List<GameDataDayVO> gameDataDayVOList = list.stream().map(vo -> {
|
|
|
+ //买量数据
|
|
|
+ String[] buyAmountD1 = vo.getBuyAmountD1().split("/");
|
|
|
+ vo.setBuyAmountD1Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(buyAmountD1[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(buyAmountD1[1]))
|
|
|
+ .increase(new BigDecimal(buyAmountD1[2]))
|
|
|
+ .back(new BigDecimal(buyAmountD1[3]))
|
|
|
+ .multiples(new BigDecimal(buyAmountD1[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] buyAmountD3 = vo.getBuyAmountD3().split("/");
|
|
|
+ vo.setBuyAmountD3Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(buyAmountD3[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(buyAmountD3[1]))
|
|
|
+ .increase(new BigDecimal(buyAmountD3[2]))
|
|
|
+ .back(new BigDecimal(buyAmountD3[3]))
|
|
|
+ .multiples(new BigDecimal(buyAmountD3[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] buyAmountD5 = vo.getBuyAmountD5().split("/");
|
|
|
+ vo.setBuyAmountD5Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(buyAmountD5[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(buyAmountD5[1]))
|
|
|
+ .increase(new BigDecimal(buyAmountD5[2]))
|
|
|
+ .back(new BigDecimal(buyAmountD5[3]))
|
|
|
+ .multiples(new BigDecimal(buyAmountD5[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] buyAmountD7 = vo.getBuyAmountD7().split("/");
|
|
|
+ vo.setBuyAmountD7Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(buyAmountD7[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(buyAmountD7[1]))
|
|
|
+ .increase(new BigDecimal(buyAmountD7[2]))
|
|
|
+ .back(new BigDecimal(buyAmountD7[3]))
|
|
|
+ .multiples(new BigDecimal(buyAmountD7[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] buyAmountD15 = vo.getBuyAmountD15().split("/");
|
|
|
+ vo.setBuyAmountD15Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(buyAmountD15[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(buyAmountD15[1]))
|
|
|
+ .increase(new BigDecimal(buyAmountD15[2]))
|
|
|
+ .back(new BigDecimal(buyAmountD15[3]))
|
|
|
+ .multiples(new BigDecimal(buyAmountD15[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] buyAmountM1 = vo.getBuyAmountM1().split("/");
|
|
|
+ vo.setBuyAmountM1Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(buyAmountM1[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(buyAmountM1[1]))
|
|
|
+ .increase(new BigDecimal(buyAmountM1[2]))
|
|
|
+ .back(new BigDecimal(buyAmountM1[3]))
|
|
|
+ .multiples(new BigDecimal(buyAmountM1[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] buyAmountM2 = vo.getBuyAmountM2().split("/");
|
|
|
+ vo.setBuyAmountM2Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(buyAmountM2[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(buyAmountM2[1]))
|
|
|
+ .increase(new BigDecimal(buyAmountM2[2]))
|
|
|
+ .back(new BigDecimal(buyAmountM2[3]))
|
|
|
+ .multiples(new BigDecimal(buyAmountM2[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] buyAmountM3 = vo.getBuyAmountM3().split("/");
|
|
|
+ vo.setBuyAmountM3Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(buyAmountM3[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(buyAmountM3[1]))
|
|
|
+ .increase(new BigDecimal(buyAmountM3[2]))
|
|
|
+ .back(new BigDecimal(buyAmountM3[3]))
|
|
|
+ .multiples(new BigDecimal(buyAmountM3[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] buyAmountM6 = vo.getBuyAmountM6().split("/");
|
|
|
+ vo.setBuyAmountM6Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(buyAmountM6[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(buyAmountM6[1]))
|
|
|
+ .increase(new BigDecimal(buyAmountM6[2]))
|
|
|
+ .back(new BigDecimal(buyAmountM6[3]))
|
|
|
+ .multiples(new BigDecimal(buyAmountM6[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] buyAmountSum = vo.getBuyAmountSum().split("/");
|
|
|
+ vo.setBuyAmountSumTrend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(buyAmountSum[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(buyAmountSum[1]))
|
|
|
+ .increase(new BigDecimal(buyAmountSum[2]))
|
|
|
+ .back(new BigDecimal(buyAmountSum[3]))
|
|
|
+ .multiples(new BigDecimal(buyAmountSum[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ //自然量数据
|
|
|
+ String[] natureAmountD1 = vo.getNatureAmountD1().split("/");
|
|
|
+ vo.setNatureAmountD1Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(natureAmountD1[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(natureAmountD1[1]))
|
|
|
+ .increase(new BigDecimal(natureAmountD1[2]))
|
|
|
+ .back(new BigDecimal(natureAmountD1[3]))
|
|
|
+ .multiples(new BigDecimal(natureAmountD1[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] natureAmountD3 = vo.getNatureAmountD3().split("/");
|
|
|
+ vo.setNatureAmountD3Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(natureAmountD3[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(natureAmountD3[1]))
|
|
|
+ .increase(new BigDecimal(natureAmountD3[2]))
|
|
|
+ .back(new BigDecimal(natureAmountD3[3]))
|
|
|
+ .multiples(new BigDecimal(natureAmountD3[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] natureAmountD5 = vo.getNatureAmountD5().split("/");
|
|
|
+ vo.setNatureAmountD5Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(natureAmountD5[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(natureAmountD5[1]))
|
|
|
+ .increase(new BigDecimal(natureAmountD5[2]))
|
|
|
+ .back(new BigDecimal(natureAmountD5[3]))
|
|
|
+ .multiples(new BigDecimal(natureAmountD5[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] natureAmountD7 = vo.getNatureAmountD7().split("/");
|
|
|
+ vo.setNatureAmountD7Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(natureAmountD7[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(natureAmountD7[1]))
|
|
|
+ .increase(new BigDecimal(natureAmountD7[2]))
|
|
|
+ .back(new BigDecimal(natureAmountD7[3]))
|
|
|
+ .multiples(new BigDecimal(natureAmountD7[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] natureAmountD15 = vo.getNatureAmountD15().split("/");
|
|
|
+ vo.setNatureAmountD15Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(natureAmountD15[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(natureAmountD15[1]))
|
|
|
+ .increase(new BigDecimal(natureAmountD15[2]))
|
|
|
+ .back(new BigDecimal(natureAmountD15[3]))
|
|
|
+ .multiples(new BigDecimal(natureAmountD15[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] natureAmountM1 = vo.getNatureAmountM1().split("/");
|
|
|
+ vo.setNatureAmountM1Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(natureAmountM1[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(natureAmountM1[1]))
|
|
|
+ .increase(new BigDecimal(natureAmountM1[2]))
|
|
|
+ .back(new BigDecimal(natureAmountM1[3]))
|
|
|
+ .multiples(new BigDecimal(natureAmountM1[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] natureAmountM2 = vo.getNatureAmountM2().split("/");
|
|
|
+ vo.setNatureAmountM2Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(natureAmountM2[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(natureAmountM2[1]))
|
|
|
+ .increase(new BigDecimal(natureAmountM2[2]))
|
|
|
+ .back(new BigDecimal(natureAmountM2[3]))
|
|
|
+ .multiples(new BigDecimal(natureAmountM2[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] natureAmountM3 = vo.getNatureAmountM3().split("/");
|
|
|
+ vo.setNatureAmountM3Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(natureAmountM3[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(natureAmountM3[1]))
|
|
|
+ .increase(new BigDecimal(natureAmountM3[2]))
|
|
|
+ .back(new BigDecimal(natureAmountM3[3]))
|
|
|
+ .multiples(new BigDecimal(natureAmountM3[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] natureAmountM6 = vo.getNatureAmountM6().split("/");
|
|
|
+ vo.setNatureAmountM6Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(natureAmountM6[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(natureAmountM6[1]))
|
|
|
+ .increase(new BigDecimal(natureAmountM6[2]))
|
|
|
+ .back(new BigDecimal(natureAmountM6[3]))
|
|
|
+ .multiples(new BigDecimal(natureAmountM6[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] natureAmountSum = vo.getNatureAmountSum().split("/");
|
|
|
+ vo.setNatureAmountSumTrend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(natureAmountSum[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(natureAmountSum[1]))
|
|
|
+ .increase(new BigDecimal(natureAmountSum[2]))
|
|
|
+ .back(new BigDecimal(natureAmountSum[3]))
|
|
|
+ .multiples(new BigDecimal(natureAmountSum[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ //总量数据
|
|
|
+ String[] amountD1 = vo.getAmountD1().split("/");
|
|
|
+ vo.setAmountD1Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(amountD1[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(amountD1[1]))
|
|
|
+ .increase(new BigDecimal(amountD1[2]))
|
|
|
+ .back(new BigDecimal(amountD1[3]))
|
|
|
+ .multiples(new BigDecimal(amountD1[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] amountD3 = vo.getAmountD3().split("/");
|
|
|
+ vo.setAmountD3Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(amountD3[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(amountD3[1]))
|
|
|
+ .increase(new BigDecimal(amountD3[2]))
|
|
|
+ .back(new BigDecimal(amountD3[3]))
|
|
|
+ .multiples(new BigDecimal(amountD3[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] amountD5 = vo.getAmountD5().split("/");
|
|
|
+ vo.setAmountD5Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(amountD5[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(amountD5[1]))
|
|
|
+ .increase(new BigDecimal(amountD5[2]))
|
|
|
+ .back(new BigDecimal(amountD5[3]))
|
|
|
+ .multiples(new BigDecimal(amountD5[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] amountD7 = vo.getAmountD7().split("/");
|
|
|
+ vo.setAmountD7Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(amountD7[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(amountD7[1]))
|
|
|
+ .increase(new BigDecimal(amountD7[2]))
|
|
|
+ .back(new BigDecimal(amountD7[3]))
|
|
|
+ .multiples(new BigDecimal(amountD7[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] amountD15 = vo.getAmountD15().split("/");
|
|
|
+ vo.setAmountD15Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(amountD15[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(amountD15[1]))
|
|
|
+ .increase(new BigDecimal(amountD15[2]))
|
|
|
+ .back(new BigDecimal(amountD15[3]))
|
|
|
+ .multiples(new BigDecimal(amountD15[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] amountM1 = vo.getAmountM1().split("/");
|
|
|
+ vo.setAmountM1Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(amountM1[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(amountM1[1]))
|
|
|
+ .increase(new BigDecimal(amountM1[2]))
|
|
|
+ .back(new BigDecimal(amountM1[3]))
|
|
|
+ .multiples(new BigDecimal(amountM1[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] amountM2 = vo.getAmountM2().split("/");
|
|
|
+ vo.setAmountM2Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(amountM2[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(amountM2[1]))
|
|
|
+ .increase(new BigDecimal(amountM2[2]))
|
|
|
+ .back(new BigDecimal(amountM2[3]))
|
|
|
+ .multiples(new BigDecimal(amountM2[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] amountM3 = vo.getAmountM3().split("/");
|
|
|
+ vo.setAmountM3Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(amountM3[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(amountM3[1]))
|
|
|
+ .increase(new BigDecimal(amountM3[2]))
|
|
|
+ .back(new BigDecimal(amountM3[3]))
|
|
|
+ .multiples(new BigDecimal(amountM3[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] amountM6 = vo.getAmountM6().split("/");
|
|
|
+ vo.setAmountM6Trend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(amountM6[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(amountM6[1]))
|
|
|
+ .increase(new BigDecimal(amountM6[2]))
|
|
|
+ .back(new BigDecimal(amountM6[3]))
|
|
|
+ .multiples(new BigDecimal(amountM6[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] amountSum = vo.getAmountSum().split("/");
|
|
|
+ vo.setAmountSumTrend(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(amountSum[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(amountSum[1]))
|
|
|
+ .increase(new BigDecimal(amountSum[2]))
|
|
|
+ .back(new BigDecimal(amountSum[3]))
|
|
|
+ .multiples(new BigDecimal(amountSum[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
//返回list结果 封装到page对象里
|
|
|
- return new Page<>(list, pager);
|
|
|
+ return new Page<>(gameDataDayVOList, pager);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 游戏总数据
|
|
|
+ * @param dto 前端传递的查询参数
|
|
|
+ * @return 返回给前端的数据
|
|
|
+ */
|
|
|
@Override
|
|
|
public Page<GameDataTotalVO> getGameDataTotal(GameDataTotalDTO dto) {
|
|
|
//如果注册时间参数为空,默认设置查询当天数据
|
|
@@ -584,5 +877,121 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
private BigInteger rechargeAgainNum;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Page<GameDataWaterVO> getGameDataWater(GameDataWaterDTO dto) {
|
|
|
+ if (null == dto.getRechargeDate()) {
|
|
|
+ dto.setRechargeDate(LocalDate.now());
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(dto.getSortFiled())) {
|
|
|
+ dto.setSortFiled("amount");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(dto.getSortType())) {
|
|
|
+ dto.setSortType(OrderByEnum.DESC.getOrderType());
|
|
|
+ }
|
|
|
+ Pager pager = dao.createPager(dto.getPageNum(), dto.getPageSize());
|
|
|
+ // 创建一个 Criteria 接口实例
|
|
|
+ SimpleCriteria cri = Cnd.cri();
|
|
|
+ if (StringUtils.isNotBlank(dto.getGameName())) {
|
|
|
+ cri.where().andLike("game_name", dto.getGameName());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(dto.getGameClassify())) {
|
|
|
+ cri.where().andEquals("game_classify", dto.getGameClassify());
|
|
|
+ }
|
|
|
+ cri.where().and("dt", "=", dto.getRechargeDate());
|
|
|
+ cri.groupBy("game_id");
|
|
|
+ cri.orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
|
|
|
+ Sql sql = Sqls.queryEntity(waterSql() + "$condition");
|
|
|
+ sql.setPager(pager);
|
|
|
+ Entity<GameDataWaterVO> entity = dao.getEntity(GameDataWaterVO.class);
|
|
|
+ sql.setEntity(entity).setCondition(cri);
|
|
|
+ dao.execute(sql);
|
|
|
+
|
|
|
+ Sql sqlCount = Sqls.queryEntity("select count(*) from ads_everyday_water " + "$condition");
|
|
|
+ sqlCount.setCondition(cri);
|
|
|
+ pager.setRecordCount((int) Daos.queryCount(dao, sqlCount));
|
|
|
+
|
|
|
+ List<Long> gameIds = sql.getList(GameDataWaterVO.class).stream()
|
|
|
+ .map(GameDataWaterVO::getGameId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isEmpty(gameIds)) {
|
|
|
+ return new Page<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ SimpleCriteria templateCri = Cnd.cri();
|
|
|
+ templateCri.where().and("dt", "=", dto.getRechargeDate());
|
|
|
+ templateCri.where().andInList("game_id", gameIds);
|
|
|
+ Sql templateSql = Sqls.queryEntity(waterTemplateSql() + "$condition");
|
|
|
+ Entity<AdsEverydayWater> everydayWaterEntity = dao.getEntity(AdsEverydayWater.class);
|
|
|
+ templateSql.setEntity(everydayWaterEntity).setCondition(templateCri);
|
|
|
+ dao.execute(templateSql);
|
|
|
+
|
|
|
+ Map<Long, List<AdsEverydayWater>> collect = templateSql.getList(AdsEverydayWater.class).stream().collect(Collectors.groupingBy(AdsEverydayWater::getGameId));
|
|
|
+ List<GameDataWaterVO> result = sql.getList(GameDataWaterVO.class).stream()
|
|
|
+ .map(item -> {
|
|
|
+ List<AdsEverydayWater> adsEverydayWaters = collect.get(item.getGameId());
|
|
|
+ if (!CollectionUtils.isEmpty(adsEverydayWaters)) {
|
|
|
+ List<RechargeTemplateVO> rechargeTemplateVOList = new ArrayList<>(10);
|
|
|
+
|
|
|
+ List<PlayerTemplateVO> playerTemplateVOS = new ArrayList<>(10);
|
|
|
+ adsEverydayWaters.forEach(adsEverydayWater -> {
|
|
|
+ if (StringUtils.isNotBlank(adsEverydayWater.getAmountOrderBy())) {
|
|
|
+ rechargeTemplateVOList.add(RechargeTemplateVO.builder()
|
|
|
+ .amountCount(adsEverydayWater.getAmountCount())
|
|
|
+ .amountNum(adsEverydayWater.getAmountNum())
|
|
|
+ .amountOrderBy(adsEverydayWater.getAmountOrderBy())
|
|
|
+ .amountPost(adsEverydayWater.getAmountPost())
|
|
|
+ .build());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(adsEverydayWater.getUserOrderBy())) {
|
|
|
+ playerTemplateVOS.add(PlayerTemplateVO.builder()
|
|
|
+ .userId(adsEverydayWater.getUserId())
|
|
|
+ .userAmount(adsEverydayWater.getUserAmount())
|
|
|
+ .userOrderBy(adsEverydayWater.getUserOrderBy())
|
|
|
+ .userName(adsEverydayWater.getUserName())
|
|
|
+ .proportion(
|
|
|
+ item.getAmount().compareTo(BigDecimal.ZERO) == 0 ?
|
|
|
+ BigDecimal.ZERO :
|
|
|
+ adsEverydayWater.getUserAmount().divide(item.getAmount(), 4, RoundingMode.DOWN)
|
|
|
+ )
|
|
|
+ .build());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ item.setRechargeTemplateVOList(rechargeTemplateVOList);
|
|
|
+ item.setPlayerTemplateVOS(playerTemplateVOS);
|
|
|
+ }
|
|
|
+ return item;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ return new Page<>(result, pager);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String waterSql() {
|
|
|
+ return """
|
|
|
+ select
|
|
|
+ game_id as id,
|
|
|
+ game_id,
|
|
|
+ max(game_name) as game_name,
|
|
|
+ max(game_classify) as game_classify,
|
|
|
+ max(amount) as amount,
|
|
|
+ max(buy_amount) as buy_amount,
|
|
|
+ max(nature_amount) as nature_amount
|
|
|
+ from ads_everyday_water
|
|
|
+ """;
|
|
|
+ }
|
|
|
|
|
|
+ private String waterTemplateSql() {
|
|
|
+ return """
|
|
|
+ select
|
|
|
+ game_id,
|
|
|
+ user_order_by,
|
|
|
+ user_id,
|
|
|
+ user_name,
|
|
|
+ user_amount,
|
|
|
+ amount_order_by,
|
|
|
+ amount_post,
|
|
|
+ amount_count,
|
|
|
+ amount_num
|
|
|
+ from ads_everyday_water
|
|
|
+ """;
|
|
|
+ }
|
|
|
}
|