Browse Source

Merge remote-tracking branch 'origin/package' into package

wcc 1 year ago
parent
commit
de29b7cca3

+ 16 - 3
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/GameDataController.java

@@ -1,8 +1,11 @@
 package com.zanxiang.game.data.serve.controller;
 
+import com.zanxiang.erp.security.annotation.PreAuthorize;
+import com.zanxiang.game.data.serve.pojo.dto.GameDataAgainDayDTO;
 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.dto.GameDataWaterDTO;
+import com.zanxiang.game.data.serve.pojo.vo.GameDataAgainDayVO;
 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.vo.GameDataWaterVO;
@@ -20,6 +23,10 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.time.LocalDate;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @author tianhua
  * @time 2023/7/12
@@ -35,7 +42,7 @@ public class GameDataController {
     private IGameDataService gameDataService;
 
     @ApiOperation(value = "游戏每日数据")
-    //@PreAuthorize(permissionKey = "gameData:adsGameDay:day")
+    @PreAuthorize(permissionKey = "gameData:adsGameDay:day")
     @PostMapping("/day")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameDataDayVO.class)})
     public ResultVO<Page<GameDataDayVO>> getGameDataDay(@RequestBody GameDataDayDTO dto) {
@@ -44,7 +51,7 @@ public class GameDataController {
 
 
     @ApiOperation(value = "游戏总数据")
-    //@PreAuthorize(permissionKey = "gameData:adsGameDay:total")
+    @PreAuthorize(permissionKey = "gameData:adsGameDay:total")
     @PostMapping("/total")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameDataTotalVO.class)})
     public ResultVO<Page<GameDataTotalVO>> getGameDataTotal(@RequestBody GameDataTotalDTO dto) {
@@ -52,11 +59,17 @@ public class GameDataController {
     }
 
     @ApiOperation(value = "每日流水贡献")
-    //@PreAuthorize(permissionKey = "gameData:adsGameDay:water")
+    @PreAuthorize(permissionKey = "gameData:adsGameDay:water")
     @PostMapping("/water")
     public ResultVO<Page<GameDataWaterVO>> getGameDataWater(@RequestBody GameDataWaterDTO dto) {
         return ResultVO.ok(gameDataService.getGameDataWater(dto));
     }
 
+    @ApiOperation(value = "游戏每日复充数据")
+    @PreAuthorize(permissionKey = "gameData:adsGameDay:again")
+    @PostMapping("/again")
+    public ResultVO<Map<LocalDate, List<GameDataAgainDayVO>>> getGameDataAgainDay(@RequestBody GameDataAgainDayDTO dto) throws Exception {
+        return ResultVO.ok(gameDataService.getGameDataAgainDay(dto));
+    }
 
 }

+ 40 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GameDataAgainDayDTO.java

@@ -0,0 +1,40 @@
+package com.zanxiang.game.data.serve.pojo.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDate;
+
+/**
+ * @author tianhua
+ * @time 2023/7/18
+ * @Description 前端传递的游戏每日复充查询实体
+ **/
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class GameDataAgainDayDTO {
+
+    /**
+     * 游戏名称
+     */
+    @ApiModelProperty(value = "游戏名称")
+    private String gameName;
+
+    /**
+     * 查询开始时间
+     */
+    @ApiModelProperty(value = "查询开始时间")
+    private LocalDate beginDate;
+
+    /**
+     * 查询结束时间
+     */
+    @ApiModelProperty(value = "查询结束时间(前端不需要传递)")
+    private LocalDate endDate;
+
+}

+ 109 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/entity/AdsGameDayAgain.java

@@ -0,0 +1,109 @@
+package com.zanxiang.game.data.serve.pojo.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.nutz.dao.entity.annotation.Column;
+import org.nutz.dao.entity.annotation.PK;
+import org.nutz.dao.entity.annotation.Table;
+
+import java.math.BigInteger;
+import java.time.LocalDate;
+
+/**
+ * <p>
+ * 游戏每日复充数据表(总量)
+ * </p>
+ *
+ * @author tianhua
+ * @time 2023/7/11
+ * @Description
+ **/
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@Table(AdsGameDayAgain.TABLE_NAME)
+@PK({"dt","ddf","gameId","gameName"})
+public class AdsGameDayAgain {
+    private static final long serialVersionUID = 1L;
+    public static final String TABLE_NAME = "ads_game_day_again";
+
+    /**
+     * 日期
+     */
+    private LocalDate dt;
+
+    /**
+     * 复充日期
+     */
+    private LocalDate ddf;
+
+    /**
+     * 游戏ID
+     */
+    private BigInteger gameId;
+
+    /**
+     * 游戏名称
+     */
+    private String gameName;
+
+    /**
+     * 充值一次
+     */
+    @Column
+    private BigInteger c1;
+
+    /**
+     * 充值大于一次
+     */
+    @Column
+    private BigInteger c2;
+
+    /**
+     * 充值大于两次
+     */
+    @Column
+    private BigInteger c3;
+
+    /**
+     * 充值大于三次
+     */
+    @Column
+    private BigInteger c4;
+
+    /**
+     * 充值大于四次
+     */
+    @Column
+    private BigInteger c5;
+
+    /**
+     * 充值大于五次
+     */
+    @Column
+    private BigInteger c6;
+
+    /**
+     * 充值大于十次
+     */
+    @Column
+    private BigInteger c7;
+
+    /**
+     * 充值大于二十次
+     */
+    @Column
+    private BigInteger c8;
+
+    /**
+     * 充值大于一百次
+     */
+    @Column
+    private BigInteger c9;
+
+
+
+}

+ 109 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/entity/AdsGameDayAgainBuy.java

@@ -0,0 +1,109 @@
+package com.zanxiang.game.data.serve.pojo.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.nutz.dao.entity.annotation.Column;
+import org.nutz.dao.entity.annotation.PK;
+import org.nutz.dao.entity.annotation.Table;
+
+import java.math.BigInteger;
+import java.time.LocalDate;
+
+/**
+ * <p>
+ * 游戏每日复充数据表(买量)
+ * </p>
+ *
+ * @author tianhua
+ * @time 2023/7/11
+ * @Description
+ **/
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@Table(AdsGameDayAgainBuy.TABLE_NAME)
+@PK({"dt","ddf","gameId","gameName"})
+public class AdsGameDayAgainBuy {
+    private static final long serialVersionUID = 1L;
+    public static final String TABLE_NAME = "ads_game_day_again_buy";
+
+    /**
+     * 日期
+     */
+    private LocalDate dt;
+
+    /**
+     * 复充日期
+     */
+    private LocalDate ddf;
+
+    /**
+     * 游戏ID
+     */
+    private BigInteger gameId;
+
+    /**
+     * 游戏名称
+     */
+    private String gameName;
+
+    /**
+     * 充值一次
+     */
+    @Column
+    private BigInteger buyC1;
+
+    /**
+     * 充值大于一次
+     */
+    @Column
+    private BigInteger buyC2;
+
+    /**
+     * 充值大于两次
+     */
+    @Column
+    private BigInteger buyC3;
+
+    /**
+     * 充值大于三次
+     */
+    @Column
+    private BigInteger buyC4;
+
+    /**
+     * 充值大于四次
+     */
+    @Column
+    private BigInteger buyC5;
+
+    /**
+     * 充值大于五次
+     */
+    @Column
+    private BigInteger buyC6;
+
+    /**
+     * 充值大于十次
+     */
+    @Column
+    private BigInteger buyC7;
+
+    /**
+     * 充值大于二十次
+     */
+    @Column
+    private BigInteger buyC8;
+
+    /**
+     * 充值大于一百次
+     */
+    @Column
+    private BigInteger buyC9;
+
+
+
+}

+ 109 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/entity/AdsGameDayAgainNature.java

@@ -0,0 +1,109 @@
+package com.zanxiang.game.data.serve.pojo.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.nutz.dao.entity.annotation.Column;
+import org.nutz.dao.entity.annotation.PK;
+import org.nutz.dao.entity.annotation.Table;
+
+import java.math.BigInteger;
+import java.time.LocalDate;
+
+/**
+ * <p>
+ * 游戏每日复充数据表(自然量)
+ * </p>
+ *
+ * @author tianhua
+ * @time 2023/7/11
+ * @Description
+ **/
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@Table(AdsGameDayAgainNature.TABLE_NAME)
+@PK({"dt","ddf","gameId","gameName"})
+public class AdsGameDayAgainNature {
+    private static final long serialVersionUID = 1L;
+    public static final String TABLE_NAME = "ads_game_day_again_nature";
+
+    /**
+     * 日期
+     */
+    private LocalDate dt;
+
+    /**
+     * 复充日期
+     */
+    private LocalDate ddf;
+
+    /**
+     * 游戏ID
+     */
+    private BigInteger gameId;
+
+    /**
+     * 游戏名称
+     */
+    private String gameName;
+
+    /**
+     * 充值一次
+     */
+    @Column
+    private BigInteger natureC1;
+
+    /**
+     * 充值大于一次
+     */
+    @Column
+    private BigInteger natureC2;
+
+    /**
+     * 充值大于两次
+     */
+    @Column
+    private BigInteger natureC3;
+
+    /**
+     * 充值大于三次
+     */
+    @Column
+    private BigInteger natureC4;
+
+    /**
+     * 充值大于四次
+     */
+    @Column
+    private BigInteger natureC5;
+
+    /**
+     * 充值大于五次
+     */
+    @Column
+    private BigInteger natureC6;
+
+    /**
+     * 充值大于十次
+     */
+    @Column
+    private BigInteger natureC7;
+
+    /**
+     * 充值大于二十次
+     */
+    @Column
+    private BigInteger natureC8;
+
+    /**
+     * 充值大于一百次
+     */
+    @Column
+    private BigInteger natureC9;
+
+
+
+}

+ 113 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GameDataAgainDayVO.java

@@ -0,0 +1,113 @@
+package com.zanxiang.game.data.serve.pojo.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+/**
+ * @author tianhua
+ * @time 2023/7/18
+ * @Description 返回给前端的游戏每日复充数据对象实体
+ **/
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class GameDataAgainDayVO {
+
+    /**
+     * 原(总量)
+     */
+    @ApiModelProperty(value = "原(总量)")
+    private BigInteger original;
+
+    /**
+     * 现(总量)
+     */
+    @ApiModelProperty(value = "现(总量)")
+    private BigInteger present;
+
+    /**
+     * 增(总量)
+     */
+    @ApiModelProperty(value = "增(总量)")
+    private BigInteger increase;
+
+    /**
+     * 移(总量)
+     */
+    @ApiModelProperty(value = "移(总量)")
+    private BigInteger decrease;
+
+    /**
+     * 比(总量)
+     */
+    @ApiModelProperty(value = "比(总量)")
+    private BigDecimal rate;
+
+    /**
+     * 原(买量)
+     */
+    @ApiModelProperty(value = "原(买量)")
+    private BigInteger buyOriginal;
+
+    /**
+     * 现(买量)
+     */
+    @ApiModelProperty(value = "现(买量)")
+    private BigInteger buyPresent;
+
+    /**
+     * 增(买量)
+     */
+    @ApiModelProperty(value = "增(买量)")
+    private BigInteger buyIncrease;
+
+    /**
+     * 移(买量)
+     */
+    @ApiModelProperty(value = "移(买量)")
+    private BigInteger buyDecrease;
+
+    /**
+     * 比(买量)
+     */
+    @ApiModelProperty(value = "比(买量)")
+    private BigDecimal buyRate;
+
+    /**
+     * 原(自然量)
+     */
+    @ApiModelProperty(value = "原(自然量)")
+    private BigInteger natureOriginal;
+
+    /**
+     * 现(自然量)
+     */
+    @ApiModelProperty(value = "现(自然量)")
+    private BigInteger naturePresent;
+
+    /**
+     * 增(自然量)
+     */
+    @ApiModelProperty(value = "增(自然量)")
+    private BigInteger natureIncrease;
+
+    /**
+     * 移(自然量)
+     */
+    @ApiModelProperty(value = "移(自然量)")
+    private BigInteger natureDecrease;
+
+    /**
+     * 比(自然量)
+     */
+    @ApiModelProperty(value = "比(自然量)")
+    private BigDecimal natureRate;
+
+}

+ 19 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IGameDataService.java

@@ -1,13 +1,19 @@
 package com.zanxiang.game.data.serve.service;
 
+import com.zanxiang.game.data.serve.pojo.dto.GameDataAgainDayDTO;
 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.dto.GameDataWaterDTO;
+import com.zanxiang.game.data.serve.pojo.vo.GameDataAgainDayVO;
 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.vo.GameDataWaterVO;
 import com.zanxiang.game.data.serve.utils.Page;
 
+import java.time.LocalDate;
+import java.util.List;
+import java.util.Map;
+
 public interface IGameDataService {
 
     /**
@@ -24,5 +30,18 @@ public interface IGameDataService {
      */
     Page<GameDataTotalVO> getGameDataTotal(GameDataTotalDTO dto);
 
+    /**
+     * 游戏流水数据
+     * @param dto
+     * @return
+     */
     Page<GameDataWaterVO> getGameDataWater(GameDataWaterDTO dto);
+
+    /**
+     * 游戏每日复充数据
+     * @param dto
+     * @return
+     */
+    Map<LocalDate, List<GameDataAgainDayVO>> getGameDataAgainDay(GameDataAgainDayDTO dto) throws Exception;
+
 }

+ 526 - 189
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameDataServiceImpl.java

@@ -2,15 +2,20 @@ 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.GameDataAgainDayDTO;
 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.dto.GameDataWaterDTO;
 import com.zanxiang.game.data.serve.pojo.entity.AdsEverydayWater;
+import com.zanxiang.game.data.serve.pojo.entity.AdsGameDayAgain;
+import com.zanxiang.game.data.serve.pojo.entity.AdsGameDayAgainBuy;
+import com.zanxiang.game.data.serve.pojo.entity.AdsGameDayAgainNature;
 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;
+import com.zanxiang.module.util.exception.BaseException;
 import lombok.Builder;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
@@ -28,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.math.RoundingMode;
@@ -52,6 +58,7 @@ public class GameDataServiceImpl implements IGameDataService {
 
     /**
      * 游戏每日数据
+     *
      * @param dto 前端传递查询参数
      * @return 返回给前端的数据
      */
@@ -377,6 +384,7 @@ public class GameDataServiceImpl implements IGameDataService {
 
     /**
      * 游戏总数据
+     *
      * @param dto 前端传递的查询参数
      * @return 返回给前端的数据
      */
@@ -556,8 +564,420 @@ public class GameDataServiceImpl implements IGameDataService {
     }
 
     /**
-     * 游戏每日数据SQL
+     * 每日流水贡献
+     * @param dto 前端传递的查询参数
+     * @return 返回给前端的数据
+     */
+    @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);
+    }
+
+    /**
+     * 游戏每日复充数据
      *
+     * @param dto 前端传递查询参数实体
+     * @return 返回给前端的数据
+     */
+    @Override
+    public Map<LocalDate, List<GameDataAgainDayVO>> getGameDataAgainDay(GameDataAgainDayDTO dto) {
+
+        //如果查询时间不传递默认从今天开始查询
+        if (dto.getBeginDate() == null) {
+            dto.setBeginDate(LocalDate.now());
+        }
+        //判断开始时间后的30天是否超过当前日期
+        if (dto.getBeginDate().plusDays(30).isAfter(LocalDate.now())) {
+            //只查询到当前的数据
+            dto.setEndDate(LocalDate.now());
+        } else {
+            //只考虑30天的数据
+            dto.setEndDate(dto.getBeginDate().plusDays(30));
+        }
+        //拼接查询条件
+        Criteria cri = Cnd.cri();
+        if (StringUtils.isNotBlank(dto.getGameName())) {
+            cri.where().andEquals("game_name", dto.getGameName());
+        }
+        if (dto.getBeginDate() != null) {
+            cri.where().andEquals("dt", dto.getBeginDate());
+            cri.where().andBetween("ddf", dto.getBeginDate(), dto.getEndDate());
+        }
+        //按 "ddf" 升序排序
+        cri.getOrderBy().asc("ddf");
+
+        //获取三张表的查询结果
+        List<AdsGameDayAgain> list = getListByTableType("total", cri);
+        List<AdsGameDayAgainBuy> listBuy = getListByTableType("buy", cri);
+        List<AdsGameDayAgainNature> listNature = getListByTableType("nature", cri);
+
+        log.info("list长度:" + list.size());
+        log.info("listBuy长度:" + listBuy.size());
+        log.info("listNature长度:" + listNature.size());
+
+
+        //创建Map记录数据
+        Map<LocalDate, List<GameDataAgainDayVO>> map = new HashMap<>();
+        //有序存储每个list,每个list包含当天的所有充值次数的复充数据
+        List<List<GameDataAgainDayVO>> tempList = new ArrayList<>();
+        //记录查询出的记录条数
+        int count = list.size();
+        //初始化list
+        initList(tempList, count);
+
+        //外层循环8次 表示不同复充次数的数据
+        for (int i = 0; i < 8; i++) {
+            //用来计算Ci
+            int ci = i + 1;
+            //第一天的所有充值次数都是先计算的
+            GameDataAgainDayVO tempVO = tempList.get(0).get(i);
+            //"原": Ci
+            tempList.get(0).get(i).setOriginal(getCnByNum(list.get(0), ci));
+            tempList.get(0).get(i).setBuyOriginal(getCnByNum(listBuy.get(0), ci));
+            tempList.get(0).get(i).setNatureOriginal(getCnByNum(listNature.get(0), ci));
+            //"增":初始为 0
+            tempList.get(0).get(i).setIncrease(BigInteger.ZERO);
+            tempList.get(0).get(i).setBuyIncrease(BigInteger.ZERO);
+            tempList.get(0).get(i).setNatureIncrease(BigInteger.ZERO);
+            //"移":下一个充值次数的Ci 即C(i+1)
+            tempList.get(0).get(i).setDecrease(getCnByNum(list.get(0), ci + 1));
+            tempList.get(0).get(i).setBuyDecrease(getCnByNum(listBuy.get(0), ci + 1));
+            tempList.get(0).get(i).setNatureDecrease(getCnByNum(listNature.get(0), ci + 1));
+            //"现":公式计算 = 原 + 增 - 移
+            tempList.get(0).get(i).setPresent(
+                    tempVO.getOriginal().add(tempVO.getIncrease()).subtract(tempVO.getDecrease())
+            );
+            tempList.get(0).get(i).setBuyPresent(
+                    tempVO.getBuyOriginal().add(tempVO.getBuyIncrease()).subtract(tempVO.getBuyDecrease())
+            );
+            tempList.get(0).get(i).setNaturePresent(
+                    tempVO.getNatureOriginal().add(tempVO.getNatureIncrease()).subtract(tempVO.getNatureDecrease())
+            );
+            //"比"
+            tempList.get(0).get(i).setRate(getCnByNum(list.get(0), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO :
+                    BigDecimal.valueOf(tempVO.getPresent().doubleValue() / getCnByNum(list.get(0), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP)
+            );
+            tempList.get(0).get(i).setBuyRate(getCnByNum(listBuy.get(0), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO :
+                    BigDecimal.valueOf(tempVO.getBuyPresent().doubleValue() / getCnByNum(listBuy.get(0), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP)
+            );
+            tempList.get(0).get(i).setNatureRate(getCnByNum(listNature.get(0), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO :
+                    BigDecimal.valueOf(tempVO.getNaturePresent().doubleValue() / getCnByNum(listNature.get(0), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP)
+            );
+
+            //计算第2-n天的数据 复充次数i的数据
+            for (int j = 1; j < count; j++) {
+                //"原":前一天的"现"
+                tempList.get(j).get(i).setOriginal(tempList.get(j - 1).get(i).getPresent());
+                tempList.get(j).get(i).setBuyOriginal(tempList.get(j - 1).get(i).getBuyPresent());
+                tempList.get(j).get(i).setNatureOriginal(tempList.get(j - 1).get(i).getNaturePresent());
+                //"现":当天的Ci - 当天的C(i+1)
+                tempList.get(j).get(i).setPresent(
+                        getCnByNum(list.get(j), ci).subtract(getCnByNum(list.get(j), ci + 1)));
+                tempList.get(j).get(i).setBuyPresent(
+                        getCnByNum(listBuy.get(j), ci).subtract(getCnByNum(listBuy.get(j), ci + 1)));
+                tempList.get(j).get(i).setNaturePresent(
+                        getCnByNum(listNature.get(j), ci).subtract(getCnByNum(listNature.get(j), ci + 1)));
+                //"增":当天的Ci - 前一天的Ci
+                tempList.get(j).get(i).setIncrease(
+                        getCnByNum(list.get(j), ci).subtract(getCnByNum(list.get(j - 1), ci)));
+                tempList.get(j).get(i).setBuyIncrease(
+                        getCnByNum(listBuy.get(j), ci).subtract(getCnByNum(listBuy.get(j - 1), ci)));
+                tempList.get(j).get(i).setNatureIncrease(
+                        getCnByNum(listNature.get(j), ci).subtract(getCnByNum(listNature.get(j - 1), ci)));
+                //"移":当天的C(i+1) - 前一天的C(i+1)
+                tempList.get(j).get(i).setDecrease(
+                        getCnByNum(list.get(j), ci + 1).subtract(getCnByNum(list.get(j - 1), ci + 1)));
+                tempList.get(j).get(i).setBuyDecrease(
+                        getCnByNum(listBuy.get(j), ci + 1).subtract(getCnByNum(listBuy.get(j - 1), ci + 1)));
+                tempList.get(j).get(i).setNatureDecrease(
+                        getCnByNum(listNature.get(j), ci + 1).subtract(getCnByNum(listNature.get(j - 1), ci + 1)));
+                //"比":当天的现 / 前一天的C1
+                tempList.get(j).get(i).setRate(getCnByNum(list.get(j - 1), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO :
+                        BigDecimal.valueOf(tempList.get(j).get(i).getPresent().doubleValue() / getCnByNum(list.get(j - 1), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP));
+                tempList.get(j).get(i).setBuyRate(getCnByNum(listBuy.get(j - 1), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO :
+                        BigDecimal.valueOf(tempList.get(j).get(i).getBuyPresent().doubleValue() / getCnByNum(listBuy.get(j - 1), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP));
+                tempList.get(j).get(i).setNatureRate(getCnByNum(listNature.get(j - 1), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO :
+                        BigDecimal.valueOf(tempList.get(j).get(i).getNaturePresent().doubleValue() / getCnByNum(listNature.get(j - 1), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP));
+            }
+        }
+        //赋值时间数据
+        for (int i = 0; i < tempList.size(); i++) {
+            map.put(list.get(i).getDdf(), tempList.get(i));
+        }
+
+        //返回数据
+        return map;
+    }
+
+    /**
+     * 三张表共用的方法
+     * @param dayNMap 参数Map
+     * @param tableName 查询的表名
+     * @return DayN数据
+     */
+    private DayN getDayNByTableName(Map<String, Object> dayNMap, String tableName) {
+
+        //构架SQL语句,查询相关DayN表获取相关充值数据
+        Sql dayNSql = Sqls.create(
+                """
+                SELECT
+                    dayN
+                FROM
+                    $tableName
+                where
+                    dt between @registerBeginDate and @registerEndDate
+                    and game_id = @gameId
+                """
+        );
+        //sql语句传入参数
+        dayNSql.setParams(dayNMap);
+        //给定查询的表名
+        dayNSql.vars().set("tableName", tableName);
+        //设置回传
+        dayNSql.setCallback(Sqls.callback.strList());
+        //执行sql 获取数据到list中
+        dao.execute(dayNSql);
+
+        //将数据库中获取的所有结果封装到一个List中
+        List<String> dayNList = dayNSql.getList(String.class);
+        //构建一个内部类
+        DayN dayN = null;
+        //解析dayNList
+        if (!CollectionUtils.isEmpty(dayNList)) {
+            //将dayNList中json格式数据转换为 Map
+            Gson gson = new Gson();
+            List<Map<String, String>> jsonList = gson.fromJson(dayNList.toString(), ArrayList.class);
+            //用来存储数据的map
+            Map<String, String> resMap = new HashMap<>();
+            //对应的参数说明:  日期:每天充值金额-充值次数-充值人数-新用户复充人数
+            resMap.put("dayN", "0.00-0-0-0");
+            for (Map<String, String> jsonMap : jsonList) {
+                for (Map.Entry<String, String> entry : jsonMap.entrySet()) {
+                    //key是充值日期
+                    String key = entry.getKey();
+                    String value = entry.getValue();
+                    //将value按“-”分割
+                    String[] resValues = value.split("-");
+                    //判断充值日期 在充值日期内的数据进行计算
+                    if (DateUtil.parseLocalDate(key).compareTo((LocalDate) dayNMap.get("rechargeBeginDate")) >= 0
+                            && DateUtil.parseLocalDate(key).compareTo((LocalDate) dayNMap.get("rechargeEndDate")) <= 0) {
+                        //获取原先的dayN的值
+                        String[] oldValues = resMap.get("dayN").split("-");
+                        //充值的金额
+                        BigDecimal chargeMoney = new BigDecimal(oldValues[0]).add(new BigDecimal(resValues[0]));
+                        //充值的次数
+                        BigInteger count = new BigInteger(oldValues[1]).add(new BigInteger(resValues[1]));
+                        //充值的人数
+                        BigInteger num = new BigInteger(oldValues[2]).add(new BigInteger(resValues[2]));
+                        //新用户复充人数
+                        BigInteger againNum = new BigInteger(oldValues[3]).add(new BigInteger(resValues[3]));
+                        //合并成字符串 更新dayN的值
+                        String newValue = chargeMoney + "-" + count + "-" + num + "-" + againNum;
+                        resMap.put("dayN", newValue);
+                    }
+                }
+            }
+            //设置dayN的参数
+            if (!resMap.isEmpty() && !resMap.get("dayN").isEmpty()) {
+                String[] values = resMap.get("dayN").split("-");
+                dayN = DayN.builder()
+                        .rechargeMoney(new BigDecimal(values[0]))
+                        .rechargeCount(new BigInteger(values[1]))
+                        .rechargeNum(new BigInteger(values[2]))
+                        .rechargeAgainNum(new BigInteger(values[3]))
+                        .build();
+            }
+        }
+        return dayN;
+    }
+
+    /**
+     * 通过反射来获取Cn的值
+     * @param dto 数据库查询出来的原始数据对象实体
+     * @param num 1-9
+     * @return Cn
+     */
+    private BigInteger getCnByNum(Object dto, int num) {
+        try {
+            Method m1 = null;
+            //不同对象获取的方法不同
+            if (dto instanceof AdsGameDayAgain) {
+                m1 = AdsGameDayAgain.class.getDeclaredMethod(String.format("getC%s", num));
+            } else if (dto instanceof AdsGameDayAgainBuy) {
+                m1 = AdsGameDayAgainBuy.class.getDeclaredMethod(String.format("getBuyC%s", num));
+            } else if (dto instanceof AdsGameDayAgainNature) {
+                m1 = AdsGameDayAgainNature.class.getDeclaredMethod(String.format("getNatureC%s", num));
+            }
+            //返回对应的Cn值
+            return (BigInteger) m1.invoke(dto);
+        } catch (Exception e) {
+            throw new BaseException("发生错误");
+        }
+    }
+
+    /**
+     * 初始化List数据
+     * @param list 需要初始化的数据
+     * @param num 多少天的数据
+     */
+    private void initList(List<List<GameDataAgainDayVO>> list, Integer num) {
+        //外层循环 num 次 表示多少天的数据
+        for (int i = 0; i < num; i++) {
+            list.add(new ArrayList<>());
+            //内层循环8次 一共初始化8种复充次数数据对象
+            for (int j = 0; j < 8; j++) {
+                list.get(i).add(
+                        GameDataAgainDayVO.builder()
+                                .buyOriginal(BigInteger.ZERO)
+                                .buyPresent(BigInteger.ZERO)
+                                .buyIncrease(BigInteger.ZERO)
+                                .buyDecrease(BigInteger.ZERO)
+                                .buyRate(BigDecimal.ZERO)
+                                .natureOriginal(BigInteger.ZERO)
+                                .naturePresent(BigInteger.ZERO)
+                                .natureIncrease(BigInteger.ZERO)
+                                .natureDecrease(BigInteger.ZERO)
+                                .natureRate(BigDecimal.ZERO)
+                                .original(BigInteger.ZERO)
+                                .present(BigInteger.ZERO)
+                                .increase(BigInteger.ZERO)
+                                .decrease(BigInteger.ZERO)
+                                .rate(BigDecimal.ZERO)
+                                .build()
+                );
+            }
+        }
+    }
+
+    /**
+     * 不同表获取不同的list结果
+     * @param tableName 表明
+     * @param cri 查询条件
+     * @return 查询结果
+     */
+    private List getListByTableType(String tableName, Criteria cri) {
+        //创建sql语句
+        Sql againSql;
+        //查询的结果封装到list中
+        List list = null;
+        //判断具体查询哪张表
+        if (tableName.equals("total")) {
+            againSql = Sqls.create(adsGameDataAgainSql() + cri);
+            //自定义回传对象
+            againSql.setCallback(Sqls.callback.entities());
+            againSql.setEntity(dao.getEntity(AdsGameDayAgain.class));
+            //执行sql
+            dao.execute(againSql);
+            //得到查询的原始结果
+            list = againSql.getList(AdsGameDayAgain.class);
+        } else if (tableName.equals("buy")) {
+            againSql = Sqls.create(adsGameDataAgainBuySql() + cri);
+            //自定义回传对象
+            againSql.setCallback(Sqls.callback.entities());
+            againSql.setEntity(dao.getEntity(AdsGameDayAgainBuy.class));
+            //执行sql
+            dao.execute(againSql);
+            //得到查询的原始结果
+            list = againSql.getList(AdsGameDayAgainBuy.class);
+        } else if (tableName.equals("nature")) {
+            againSql = Sqls.create(adsGameDataAgainNatureSql() + cri);
+            //自定义回传对象
+            againSql.setCallback(Sqls.callback.entities());
+            againSql.setEntity(dao.getEntity(AdsGameDayAgainNature.class));
+            //执行sql
+            dao.execute(againSql);
+            //得到查询的原始结果
+            list = againSql.getList(AdsGameDayAgainNature.class);
+        }
+        //返回结果
+        return list;
+    }
+
+    /**
+     * 游戏每日数据SQL
      * @return String
      */
     private String gameDataDaySql() {
@@ -680,7 +1100,6 @@ public class GameDataServiceImpl implements IGameDataService {
 
     /**
      * 游戏总数据SQL
-     *
      * @return String
      */
     private String gameDataTotalSql() {
@@ -769,202 +1188,88 @@ public class GameDataServiceImpl implements IGameDataService {
                 """;
     }
 
-    /** 三张表共用的方法
-     * @param dayNMap 参数Map
-     * @param tableName 查询的表名
-     * @return DayN数据
+    /**
+     * 复充表sql(总量)
+     * @return String
      */
-    private DayN getDayNByTableName(Map<String, Object> dayNMap, String tableName) {
-
-        //构架SQL语句,查询相关DayN表获取相关充值数据
-        Sql dayNSql = Sqls.create(
-                """
-                   SELECT
-                        dayN
-                   FROM
-                        $tableName
-                   where
-                        dt between @registerBeginDate and @registerEndDate
-                        and game_id = @gameId
-                """
-        );
-        //sql语句传入参数
-        dayNSql.setParams(dayNMap);
-        //给定查询的表名
-        dayNSql.vars().set("tableName", tableName);
-        //设置回传
-        dayNSql.setCallback(Sqls.callback.strList());
-        //执行sql 获取数据到list中
-        dao.execute(dayNSql);
-
-        //将数据库中获取的所有结果封装到一个List中
-        List<String> dayNList = dayNSql.getList(String.class);
-        //构建一个内部类
-        DayN dayN = null;
-        //解析dayNList
-        if (!CollectionUtils.isEmpty(dayNList)) {
-            //将dayNList中json格式数据转换为 Map
-            Gson gson = new Gson();
-            List<Map<String, String>> jsonList = gson.fromJson(dayNList.toString(), ArrayList.class);
-            //用来存储数据的map
-            Map<String, String> resMap = new HashMap<>();
-            //对应的参数说明:  日期:每天充值金额-充值次数-充值人数-新用户复充人数
-            resMap.put("dayN", "0.00-0-0-0");
-            for (Map<String, String> jsonMap : jsonList) {
-                for (Map.Entry<String, String> entry : jsonMap.entrySet()) {
-                    //key是充值日期
-                    String key = entry.getKey();
-                    String value = entry.getValue();
-                    //将value按“-”分割
-                    String[] resValues = value.split("-");
-                    //判断充值日期 在充值日期内的数据进行计算
-                    if (DateUtil.parseLocalDate(key).compareTo((LocalDate) dayNMap.get("rechargeBeginDate")) >= 0
-                            && DateUtil.parseLocalDate(key).compareTo((LocalDate) dayNMap.get("rechargeEndDate")) <= 0) {
-                        //获取原先的dayN的值
-                        String[] oldValues = resMap.get("dayN").split("-");
-                        //充值的金额
-                        BigDecimal chargeMoney = new BigDecimal(oldValues[0]).add(new BigDecimal(resValues[0]));
-                        //充值的次数
-                        BigInteger count = new BigInteger(oldValues[1]).add(new BigInteger(resValues[1]));
-                        //充值的人数
-                        BigInteger num = new BigInteger(oldValues[2]).add(new BigInteger(resValues[2]));
-                        //新用户复充人数
-                        BigInteger againNum = new BigInteger(oldValues[3]).add(new BigInteger(resValues[3]));
-                        //合并成字符串 更新dayN的值
-                        String newValue = chargeMoney + "-" + count + "-" + num + "-" + againNum;
-                        resMap.put("dayN", newValue);
-                    }
-                }
-            }
-            //设置dayN的参数
-            if (!resMap.isEmpty() && !resMap.get("dayN").isEmpty()) {
-                String[] values = resMap.get("dayN").split("-");
-                dayN = DayN.builder()
-                        .rechargeMoney(new BigDecimal(values[0]))
-                        .rechargeCount(new BigInteger(values[1]))
-                        .rechargeNum(new BigInteger(values[2]))
-                        .rechargeAgainNum(new BigInteger(values[3]))
-                        .build();
-            }
-        }
-        return dayN;
+    private String adsGameDataAgainSql() {
+        return
+                """  
+                SELECT
+                    dt,
+                    ddf,
+                    game_id,
+                    game_name,
+                    c1,
+                    c2,
+                    c3,
+                    c4,
+                    c5,
+                    c6,
+                    c7,
+                    c8,
+                    c9
+                FROM
+                    ads_game_day_again
+                """;
     }
 
     /**
-     * DayN内部类
+     * 复充表sql(买量)
+     * @return String
      */
-    @Data
-    @Builder
-    public static class DayN {
-        /**
-         * 充值金额
-         */
-        private BigDecimal rechargeMoney;
-
-        /**
-         * 充值次数
-         */
-        private BigInteger rechargeCount;
-
-        /**
-         * 充值人数
-         */
-        private BigInteger rechargeNum;
-
-        /**
-         * 新用户复充人数
-         */
-        private BigInteger rechargeAgainNum;
+    private String adsGameDataAgainBuySql() {
+        return
+                """  
+                SELECT
+                    dt,
+                    ddf,
+                    game_id,
+                    game_name,
+                    buy_c1,
+                    buy_c2,
+                    buy_c3,
+                    buy_c4,
+                    buy_c5,
+                    buy_c6,
+                    buy_c7,
+                    buy_c8,
+                    buy_c9
+                FROM
+                    ads_game_day_again_buy
+                """;
     }
 
-    @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);
+    /**
+     * 复充表sql(自然量)
+     * @return String
+     */
+    private String adsGameDataAgainNatureSql() {
+        return
+                """  
+                SELECT
+                    dt,
+                    ddf,
+                    game_id,
+                    game_name,
+                    nature_c1,
+                    nature_c2,
+                    nature_c3,
+                    nature_c4,
+                    nature_c5,
+                    nature_c6,
+                    nature_c7,
+                    nature_c8,
+                    nature_c9
+                FROM
+                    ads_game_day_again_nature
+                """;
     }
 
+    /**
+     * 流水sql
+     * @return String
+     */
     private String waterSql() {
         return """
                 select
@@ -979,6 +1284,10 @@ public class GameDataServiceImpl implements IGameDataService {
                 """;
     }
 
+    /**
+     * 流水临时sql
+     * @return String
+     */
     private String waterTemplateSql() {
         return """
                 select
@@ -994,4 +1303,32 @@ public class GameDataServiceImpl implements IGameDataService {
                 from ads_everyday_water
                 """;
     }
+
+    /**
+     * DayN内部类
+     */
+    @Data
+    @Builder
+    public static class DayN {
+        /**
+         * 充值金额
+         */
+        private BigDecimal rechargeMoney;
+
+        /**
+         * 充值次数
+         */
+        private BigInteger rechargeCount;
+
+        /**
+         * 充值人数
+         */
+        private BigInteger rechargeNum;
+
+        /**
+         * 新用户复充人数
+         */
+        private BigInteger rechargeAgainNum;
+    }
+
 }

+ 1 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/SDKApplication.java

@@ -23,7 +23,7 @@ public class SDKApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(SDKApplication.class, args);
-        System.out.println("赞象SDK服务启动成功 <dubbo升级3.0, 回调CP异常处理> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功 <dubbo升级3.0, 取消自动客服消息> ( ´・・)ノ(._.`) \n" +
                 " ___________ _   __\n" +
                 "/  ___|  _  \\ | / /\n" +
                 "\\ `--.| | | | |/ / \n" +

+ 14 - 9
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameAppletServiceImpl.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zanxiang.game.module.base.pojo.dto.H5GameConfigDTO;
 import com.zanxiang.game.module.base.pojo.enums.HttpStatusEnum;
+import com.zanxiang.game.module.base.pojo.enums.PayDeviceEnum;
+import com.zanxiang.game.module.base.pojo.enums.PayWayEnum;
 import com.zanxiang.game.module.mybatis.entity.Game;
 import com.zanxiang.game.module.mybatis.entity.GameApplet;
 import com.zanxiang.game.module.mybatis.entity.GameExt;
@@ -110,10 +112,12 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
         UserDTO userDTO = userService.getUserByOpenId(gameAppletDTO.getGameId(), appletMsgDTO.getFromUserName());
         //客服支付
         if (Objects.equals(appletMsgDTO.getMsgType(), "text") && Objects.equals(appletMsgDTO.getContent(), "2")) {
-            //查询用户最新订单
+            //查询用户最新客服支付订单
             Order order = orderService.getOne(new LambdaQueryWrapper<Order>()
                     .eq(Order::getUserId, userDTO.getId())
                     .eq(Order::getStatus, OrderStateEnum.READY_PAY.getCode())
+                    .eq(Order::getPayWayId, PayWayEnum.WX_PAY.getPayWayId())
+                    .eq(Order::getPayDeviceId, PayDeviceEnum.CUSTOM_PAY.getPayDeviceId())
                     .orderByDesc(Order::getCreateTime)
                     .last("limit 1"));
             if (order != null) {
@@ -121,14 +125,15 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
                 return this.sendCustomMessage(gameAppletDTO, userDTO.getOpenId(), order);
             }
         }
-        //非客服支付, 回复通用消息
-        GameExt gameExt = gameExtService.getByGameId(userDTO.getGameId());
-        String text = "尊敬的玩家您好,请您用QQ添加:" + gameExt.getCustomerQq()
-                + ",联系官方客服哦,客服目前排队比较多,请您耐心等待,请您备注好区服角色,方便客服第一时间为您处理问题";
-        //客服消息参数构造
-        Map<String, Object> textMap = new HashMap<>(1);
-        textMap.put("content", text);
-        return this.sendCustomMessageApi(gameAppletDTO, userDTO.getOpenId(), "text", textMap);
+        return result;
+//        //非客服支付, 回复通用消息
+//        GameExt gameExt = gameExtService.getByGameId(userDTO.getGameId());
+//        String text = "尊敬的玩家您好,请您用QQ添加:" + gameExt.getCustomerQq()
+//                + ",联系官方客服哦,客服目前排队比较多,请您耐心等待,请您备注好区服角色,方便客服第一时间为您处理问题";
+//        //客服消息参数构造
+//        Map<String, Object> textMap = new HashMap<>(1);
+//        textMap.put("content", text);
+//        return this.sendCustomMessageApi(gameAppletDTO, userDTO.getOpenId(), "text", textMap);
     }
 
     private String sendCustomMessage(GameAppletDTO gameAppletDTO, String openId, Order order) {