Ver Fonte

Merge branch 'dev' of GameCenter/game-center into master

zhimo há 1 ano atrás
pai
commit
01e131bb77
39 ficheiros alterados com 1062 adições e 180 exclusões
  1. 13 3
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/component/DataPowerComponent.java
  2. 1 1
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/AdsGameServerController.java
  3. 74 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/ChoiceListController.java
  4. 0 36
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/GameListController.java
  5. 6 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/AdsOrderDetailListDTO.java
  6. 6 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/AdsOrderDetailTotalDTO.java
  7. 27 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/ChoiceListDTO.java
  8. 6 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/RoleRechargeRankingDTO.java
  9. 39 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/AccountListVO.java
  10. 39 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/AgentListVO.java
  11. 1 1
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GameServerSumDayVO.java
  12. 19 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/OverallSummaryVO.java
  13. 39 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/PitcherListVO.java
  14. 12 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IAccountListService.java
  15. 12 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IAgentListService.java
  16. 2 1
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IGameListService.java
  17. 12 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IPitcherListService.java
  18. 4 4
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AccountAgentDayServiceImpl.java
  19. 62 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AccountListServiceImpl.java
  20. 26 6
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AdsOrderDetailService.java
  21. 64 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AgentListServiceImpl.java
  22. 65 42
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameDataServiceImpl.java
  23. 30 4
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameListServiceImpl.java
  24. 3 7
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameServerServiceImpl.java
  25. 69 27
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/OverallSummaryServiceImpl.java
  26. 8 8
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PitcherDataServiceImpl.java
  27. 66 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PitcherListServiceImpl.java
  28. 119 33
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/RoleManageServiceImpl.java
  29. 4 1
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameUserRole.java
  30. 1 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/SDKApplication.java
  31. 82 3
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/config/KafkaConfig.java
  32. 5 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/constant/RedisKeyConstant.java
  33. 9 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/controller/UserController.java
  34. 6 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/param/GameUserRoleUpdateParam.java
  35. 31 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/param/MsgSceneCheckParam.java
  36. 21 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IMsgSceneCheckService.java
  37. 14 2
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameUserRoleServiceImpl.java
  38. 1 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/LoginServiceImpl.java
  39. 64 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/MsgSceneCheckServiceImpl.java

+ 13 - 3
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/component/DataPowerComponent.java

@@ -12,11 +12,13 @@ import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.module.util.exception.BaseException;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 @Slf4j
@@ -29,7 +31,9 @@ public class DataPowerComponent {
     @DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
     private GameAuthRpc gameAuthRpc;
 
-
+    public Tuple2<List<Long>, List<Long>> getPowerInfo() {
+        return getPowerInfo("ZX_ONE");
+    }
 
     /**
      * 获取当前登录用户有权限查看的用户列表
@@ -38,16 +42,22 @@ public class DataPowerComponent {
      * 2:投手组长:自己+组员+自然量
      * 3:管理员/超管:所有数据
      */
-    public Tuple2<List<Long>, List<Long>> getPowerInfo() {
+    public Tuple2<List<Long>, List<Long>> getPowerInfo(String sdk) {
+        if (StringUtils.isBlank(sdk)) {
+            sdk = "ZX_ONE";
+        }
         if (SecurityUtil.isAdmin()) {
             return Tuple2.with(null, null);
         }
+        Collection<Long> subUserIds = sysGameUserGroupRpc.memberUserIds(SecurityUtil.getCompanyId(), SecurityUtil.getUserId()).getData();
+        if(!"ZX_ONE".equals(sdk)) {
+            return Tuple2.with(new ArrayList<>(subUserIds), null);
+        }
         GameAuthUserVO userGameInfo = gameAuthRpc.getGameAuthByUserIds().getData();
         if(CollectionUtils.isEmpty(userGameInfo.getGameIdList())) {
             throw new BaseException("没有游戏查看权限,请联系管理员指派游戏权限");
         }
         GameAuthEnum gameAuth = userGameInfo.getGameAuthEnum();
-        Collection<Long> subUserIds = sysGameUserGroupRpc.memberUserIds(SecurityUtil.getCompanyId(), SecurityUtil.getUserId()).getData();
         if(CollectionUtils.isEmpty(subUserIds)) {
             throw new BaseException("服务异常,获取用户列表失败!!");
         }

+ 1 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/AdsGameServerController.java

@@ -50,7 +50,7 @@ public class AdsGameServerController {
     }
 
     @ApiOperation(value = "游戏区服每日数据")
-    //@PreAuthorize(permissionKey = "gameServer:GameServerSumDay:day")
+    @PreAuthorize(permissionKey = "gameServer:GameServerSumDay:day")
     @PostMapping("sum/day")
     public ResultVO<Page<GameServerSumDayVO>> getGameServerDataSumDay(@RequestBody GameServerSumDayDTO dto) {
         return ResultVO.ok(gameServerService.getGameServerDataSumDay(dto));

+ 74 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/ChoiceListController.java

@@ -0,0 +1,74 @@
+package com.zanxiang.game.data.serve.controller;
+
+import com.zanxiang.erp.security.annotation.PreAuthorize;
+import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
+import com.zanxiang.game.data.serve.pojo.vo.AccountListVO;
+import com.zanxiang.game.data.serve.pojo.vo.AgentListVO;
+import com.zanxiang.game.data.serve.pojo.vo.GameListVO;
+import com.zanxiang.game.data.serve.pojo.vo.PitcherListVO;
+import com.zanxiang.game.data.serve.service.IAccountListService;
+import com.zanxiang.game.data.serve.service.IAgentListService;
+import com.zanxiang.game.data.serve.service.IGameListService;
+import com.zanxiang.game.data.serve.service.IPitcherListService;
+import com.zanxiang.module.util.pojo.ResultVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description:  下拉选择列表
+ * @date 2023/11/3 15:33
+ */
+@Api(tags = {"下拉选择列表"})
+@RestController
+@RequestMapping("/choice")
+@Slf4j
+public class ChoiceListController {
+
+    @Autowired
+    private IGameListService gameListService;
+
+    @Autowired
+    private IAccountListService accountListService;
+
+    @Autowired
+    private IAgentListService agentListService;
+
+    @Autowired
+    private IPitcherListService pitcherListService;
+
+    @ApiOperation(value = "所有游戏列表")
+    @PreAuthorize(permissionKey = "gameData:choice:gameList")
+    @PostMapping("/game/list")
+    public ResultVO<GameListVO> getGameDataDay(@RequestBody ChoiceListDTO dto) {
+        return ResultVO.ok(gameListService.getGameList(dto));
+    }
+
+    @ApiOperation(value = "所有广告账号列表")
+    @PreAuthorize(permissionKey = "gameData:choice:accountList")
+    @PostMapping("/account/list")
+    public ResultVO<List<AccountListVO>> getAccountList(@RequestBody ChoiceListDTO dto) {
+        return ResultVO.ok(accountListService.getAccountList(dto));
+    }
+
+    @ApiOperation(value = "所有渠道列表")
+    @PreAuthorize(permissionKey = "gameData:choice:agentList")
+    @PostMapping("/agent/list")
+    public ResultVO<List<AgentListVO>> getAgentList(@RequestBody ChoiceListDTO dto) {
+        return ResultVO.ok(agentListService.getAgentList(dto));
+    }
+
+    @ApiOperation(value = "所有投手列表")
+    @PreAuthorize(permissionKey = "gameData:choice:pitcherList")
+    @PostMapping("/pitcher/list")
+    public ResultVO<List<PitcherListVO>> getPitcherList(@RequestBody ChoiceListDTO dto) {
+        return ResultVO.ok(pitcherListService.getPitcherList(dto));
+    }
+
+}

+ 0 - 36
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/GameListController.java

@@ -1,36 +0,0 @@
-package com.zanxiang.game.data.serve.controller;
-
-import com.zanxiang.erp.security.annotation.PreAuthorize;
-import com.zanxiang.game.data.serve.pojo.vo.GameListVO;
-import com.zanxiang.game.data.serve.service.IGameListService;
-import com.zanxiang.module.util.pojo.ResultVO;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author tianhua
- * @time 2023/9/25
- * @Description 游戏列表接口 查看所有游戏、父游戏、超父游戏列表(ZX_ONE)
- **/
-@Api(tags = {"游戏展示列表"})
-@RestController
-@RequestMapping("/gameList")
-@Slf4j
-public class GameListController {
-
-    @Autowired
-    private IGameListService gameListService;
-
-    @ApiOperation(value = "所有游戏列表")
-    @PreAuthorize(permissionKey = "gameData:gameList:game")
-    @GetMapping("/list")
-    public ResultVO<GameListVO> getGameDataDay() {
-        return ResultVO.ok(gameListService.getGameList());
-    }
-
-}

+ 6 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/AdsOrderDetailListDTO.java

@@ -222,4 +222,10 @@ public class AdsOrderDetailListDTO extends BasePage {
     @ApiModelProperty(notes = "广告ID")
     private String projectId;
 
+    /**
+     * 订单渠道类型
+     */
+    @ApiModelProperty(notes = "订单渠道类型:买量 -> buy ; 自然量 -> nature")
+    private String orderAgentType;
+
 }

+ 6 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/AdsOrderDetailTotalDTO.java

@@ -209,4 +209,10 @@ public class AdsOrderDetailTotalDTO {
     @ApiModelProperty(notes = "广告ID")
     private String projectId;
 
+    /**
+     * 订单渠道类型
+     */
+    @ApiModelProperty(notes = "订单渠道类型:买量 -> buy ; 自然量 -> nature")
+    private String orderAgentType;
+
 }

+ 27 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/ChoiceListDTO.java

@@ -0,0 +1,27 @@
+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;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: 专门给下拉列表的筛选条件实体类
+ * @date 2023/11/3 16:24
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class ChoiceListDTO {
+
+    /**
+     * SDK来源
+     */
+    @ApiModelProperty(value = "SDK来源")
+    private String sourceSystem;
+
+}

+ 6 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/RoleRechargeRankingDTO.java

@@ -171,4 +171,10 @@ public class RoleRechargeRankingDTO extends BasePage {
     @ApiModelProperty(notes = "是否退游:1->退游;0->未退游")
     private Integer isRemoveGame;
 
+    /**
+     * 是否退游(系统判定)
+     */
+    @ApiModelProperty(notes = "是否退游:1->退游;0->未退游(系统判定)")
+    private Integer isRemoveGameForSystem;
+
 }

+ 39 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/AccountListVO.java

@@ -0,0 +1,39 @@
+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;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: 广告账号实体类
+ * @date 2023/11/3 16:27
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class AccountListVO {
+
+    /**
+     * SDK来源
+     */
+    @ApiModelProperty(notes = "SDK来源")
+    private String sourceSystem;
+
+    /**
+     * 广告账号ID
+     */
+    @ApiModelProperty(notes = "广告账号ID")
+    private Long accountId;
+
+    /**
+     * 广告账号类型
+     */
+    @ApiModelProperty(notes = "广告账号类型")
+    private String accountType;
+
+}

+ 39 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/AgentListVO.java

@@ -0,0 +1,39 @@
+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;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: 渠道信息实体类
+ * @date 2023/11/3 16:27
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class AgentListVO {
+
+    /**
+     * SDK来源
+     */
+    @ApiModelProperty(notes = "SDK来源")
+    private String sourceSystem;
+
+    /**
+     * 渠道id
+     */
+    @ApiModelProperty(notes = "渠道ID")
+    private Long agentId;
+
+    /**
+     * 渠道名
+     */
+    @ApiModelProperty(notes = "渠道名")
+    private String agentName;
+
+}

+ 1 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GameServerSumDayVO.java

@@ -30,7 +30,7 @@ public class GameServerSumDayVO {
      * 区服ID
      */
     @ApiModelProperty(value = "区服ID")
-    private Long serverId;
+    private String serverId;
 
     /**
      * 区服名称

+ 19 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/OverallSummaryVO.java

@@ -85,6 +85,25 @@ public class OverallSummaryVO {
     @ApiModelProperty(value = "昨日账面充值")
     private BigDecimal yesterdayAmount;
 
+    /**
+     * 自然量累计充值(布谷用)
+     */
+    @ApiModelProperty(value = "自然量累计充值(布谷用)")
+    private BigDecimal totalAmountForBG;
+
+    /**
+     * 自然量今日账面充值(布谷用)
+     */
+    @ApiModelProperty(value = "自然量今日账面充值(布谷用)")
+    private BigDecimal todayAmountForBG;
+
+    /**
+     * 自然量昨日账面充值(布谷用)
+     */
+    @ApiModelProperty(value = "自然量昨日账面充值(布谷用)")
+    private BigDecimal yesterdayAmountForBG;
+
+
     /**
      * 总渠道数
      */

+ 39 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/PitcherListVO.java

@@ -0,0 +1,39 @@
+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;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: 投手信息实体类
+ * @date 2023/11/3 16:27
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class PitcherListVO {
+
+    /**
+     * SDK来源
+     */
+    @ApiModelProperty(notes = "SDK来源")
+    private String sourceSystem;
+
+    /**
+     * 投手ID
+     */
+    @ApiModelProperty(notes = "投手ID")
+    private Long pitcherId;
+
+    /**
+     * 投手名
+     */
+    @ApiModelProperty(notes = "投手名")
+    private String pitcherName;
+
+}

+ 12 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IAccountListService.java

@@ -0,0 +1,12 @@
+package com.zanxiang.game.data.serve.service;
+
+import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
+import com.zanxiang.game.data.serve.pojo.vo.AccountListVO;
+
+import java.util.List;
+
+public interface IAccountListService {
+
+    List<AccountListVO> getAccountList(ChoiceListDTO dto);
+
+}

+ 12 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IAgentListService.java

@@ -0,0 +1,12 @@
+package com.zanxiang.game.data.serve.service;
+
+import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
+import com.zanxiang.game.data.serve.pojo.vo.AgentListVO;
+
+import java.util.List;
+
+public interface IAgentListService {
+
+    List<AgentListVO> getAgentList(ChoiceListDTO dto);
+
+}

+ 2 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IGameListService.java

@@ -1,9 +1,10 @@
 package com.zanxiang.game.data.serve.service;
 
+import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
 import com.zanxiang.game.data.serve.pojo.vo.GameListVO;
 
 public interface IGameListService {
 
-    GameListVO getGameList();
+    GameListVO getGameList(ChoiceListDTO dto);
 
 }

+ 12 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IPitcherListService.java

@@ -0,0 +1,12 @@
+package com.zanxiang.game.data.serve.service;
+
+import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
+import com.zanxiang.game.data.serve.pojo.vo.PitcherListVO;
+
+import java.util.List;
+
+public interface IPitcherListService {
+
+    List<PitcherListVO> getPitcherList(ChoiceListDTO dto);
+
+}

+ 4 - 4
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AccountAgentDayServiceImpl.java

@@ -51,7 +51,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
 
     @Override
     public Page<GamePromoteDayVO> accountAgentDay(GamePromoteDayDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getSysUserId() == null ? poerInfo.first : Collections.singletonList(dto.getSysUserId());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
@@ -246,7 +246,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
 
     @Override
     public GamePromoteDayTotalVO accountAgentDayTotal(GamePromoteDayTotalDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getSysUserId() == null ? poerInfo.first : Collections.singletonList(dto.getSysUserId());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
@@ -454,7 +454,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
 
     @Override
     public Page<GamePromoteTotalVO> accountAgentTotal(GamePromoteTotalDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getSysUserId() == null ? poerInfo.first : Collections.singletonList(dto.getSysUserId());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         /*Long sysUserId = SecurityUtil.isAdmin() ? null : SecurityUtil.getUserId();
@@ -854,7 +854,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
 
     @Override
     public GamePromoteTotalSumVO accountAgentTotalSum(GamePromoteTotalSumDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getSysUserId() == null ? poerInfo.first : Collections.singletonList(dto.getSysUserId());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         /*Long sysUserId = SecurityUtil.isAdmin() ? null : SecurityUtil.getUserId();

+ 62 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AccountListServiceImpl.java

@@ -0,0 +1,62 @@
+package com.zanxiang.game.data.serve.service.impl;
+
+import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
+import com.zanxiang.game.data.serve.pojo.vo.AccountListVO;
+import com.zanxiang.game.data.serve.pojo.vo.AgentListVO;
+import com.zanxiang.game.data.serve.service.IAccountListService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.nutz.dao.Dao;
+import org.nutz.dao.Sqls;
+import org.nutz.dao.sql.Sql;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: 查询所有广告账号的方法逻辑层
+ * @date 2023/11/3 15:10
+ */
+@Service
+@Slf4j
+public class AccountListServiceImpl implements IAccountListService {
+
+    @Autowired
+    private Dao dao;
+
+    /**
+     * 获得所有广告账号
+     * @param dto ChoiceListDTO
+     * @return list
+     */
+    @Override
+    public List<AccountListVO> getAccountList(ChoiceListDTO dto) {
+
+        if (StringUtils.isBlank(dto.getSourceSystem())) {
+            //默认查询“ZX_ONE”数据
+            dto.setSourceSystem("ZX_ONE");
+        }
+
+        Sql sql = Sqls.create("""
+                SELECT
+                	source_system ,
+                	account_id ,
+                	MAX(account_type) as account_type
+                from dm_game_order.t_pitcher_agent
+                where ((account_type in('MP','GDT') and LENGTH(account_id)<= 10) or
+                (account_type = 'BYTE' and LENGTH(account_id)<= 17))
+                AND source_system = @source_system AND agent_name is not NULL
+                GROUP BY account_id ,source_system 
+                """);
+        sql.setParam("source_system", dto.getSourceSystem());
+        sql.setCallback(Sqls.callback.entities());
+        sql.setEntity(dao.getEntity(AccountListVO.class));
+        dao.execute(sql);
+
+        return sql.getList(AccountListVO.class);
+    }
+
+}

+ 26 - 6
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AdsOrderDetailService.java

@@ -43,14 +43,10 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
 
     @Override
     public Page<AdsOrderDetailVO> listOfPage(AdsOrderDetailListDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(Long.parseLong(dto.getPitcherId()));
         List<Long> gameIds = CollectionUtils.isEmpty(dto.getGameId()) ? poerInfo.second : dto.getGameId();
 
-        if (StringUtils.isBlank(dto.getPitcherId()) && !SecurityUtil.isManager()) {
-            // 只有管理员才能查看全部数据
-            dto.setPitcherId(SecurityUtil.getUserId().toString());
-        }
         Criteria cri = Cnd.cri();
         if (StringUtils.isNotBlank(dto.getSourceSystem())) {
             cri.where().andEquals("source_system", dto.getSourceSystem());
@@ -138,6 +134,18 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
             //广告ID
             cri.where().andEquals("project_id", dto.getProjectId());
         }
+        if (StringUtils.isNotBlank(dto.getOrderAgentType())) {
+            if ("buy".equals(dto.getOrderAgentType())) {
+                //查询买量数据
+                cri.where().andNotEquals("agent_id", 0);
+            } else if ("nature".equals(dto.getOrderAgentType())) {
+                //查询自然量数据
+                cri.where().andEquals("agent_id", 0);
+            }
+        }
+        //添加判断,除去BG的数据 BG的数据在我们这找不到用户以及渠道
+        cri.where().andNotIsNull("agent_name");
+        cri.where().andNotIsNull("username");
 
         //pager
         Pager pager = dto.toPage();
@@ -177,7 +185,7 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
 
     @Override
     public AdsOrderDetailTotalVO orderTotal(AdsOrderDetailTotalDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(Long.parseLong(dto.getPitcherId()));
         List<Long> gameIds = CollectionUtils.isEmpty(dto.getGameId()) ? poerInfo.second : dto.getGameId();
         Criteria cri = Cnd.cri();
@@ -267,6 +275,18 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
             //广告ID
             cri.where().andEquals("project_id", dto.getProjectId());
         }
+        if (StringUtils.isNotBlank(dto.getOrderAgentType())) {
+            if ("buy".equals(dto.getOrderAgentType())) {
+                //查询买量数据
+                cri.where().andNotEquals("agent_id", 0);
+            } else if ("nature".equals(dto.getOrderAgentType())) {
+                //查询自然量数据
+                cri.where().andEquals("agent_id", 0);
+            }
+        }
+        //添加判断,除去BG的数据 BG的数据在我们这找不到用户以及渠道
+        cri.where().andNotIsNull("agent_name");
+        cri.where().andNotIsNull("username");
 
         Sql sql = Sqls.create(getOrderDetailTotalSql() + cri);
         sql.setCallback(Sqls.callback.entity());

+ 64 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AgentListServiceImpl.java

@@ -0,0 +1,64 @@
+package com.zanxiang.game.data.serve.service.impl;
+
+import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
+import com.zanxiang.game.data.serve.pojo.vo.AgentListVO;
+import com.zanxiang.game.data.serve.service.IAgentListService;
+import lombok.extern.slf4j.Slf4j;
+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.sql.Criteria;
+import org.nutz.dao.sql.Sql;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: TODO
+ * @date 2023/11/3 16:50
+ */
+@Service
+@Slf4j
+public class AgentListServiceImpl implements IAgentListService {
+
+    @Autowired
+    private Dao dao;
+
+    /**
+     * 所有渠道列表
+     * @param dto ChoiceListDTO
+     * @return list
+     */
+    @Override
+    public List<AgentListVO> getAgentList(ChoiceListDTO dto) {
+
+        if (StringUtils.isBlank(dto.getSourceSystem())) {
+            //默认查询“ZX_ONE”数据
+            dto.setSourceSystem("ZX_ONE");
+        }
+
+        Sql sql = Sqls.create("""
+                SELECT
+                	source_system ,
+                	id as agent_id,
+                	MAX(agent_name) as agent_name
+                from dm_game_order.t_pitcher_agent
+                where ((account_type in('MP','GDT') and LENGTH(account_id)<= 10) or
+                (account_type = 'BYTE' and LENGTH(account_id)<= 17))
+                AND source_system = @source_system AND agent_name is not NULL
+                GROUP BY id, source_system
+                """);
+        sql.setParam("source_system", dto.getSourceSystem());
+        sql.setCallback(Sqls.callback.entities());
+        sql.setEntity(dao.getEntity(AgentListVO.class));
+        dao.execute(sql);
+
+        return sql.getList(AgentListVO.class);
+    }
+
+
+}

+ 65 - 42
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameDataServiceImpl.java

@@ -195,7 +195,7 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     @Override
     public Page<GameDataDayVO> getGameDataDay(GameDataDayDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         //默认查询 total 总量数据
@@ -264,7 +264,7 @@ public class GameDataServiceImpl implements IGameDataService {
      * @return 返回给前端的总计数据实体
      */
     public GameDataDayTotalVO getGameDataDayTotal(GameDataDayTotalDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         //默认查询 total 总量数据
@@ -316,7 +316,7 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     @Override
     public Page<GameDataTotalVO> getGameDataTotal(GameDataTotalDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getRegisteredBeginDate() == null || dto.getRegisteredEndDate() == null) {
@@ -438,7 +438,7 @@ public class GameDataServiceImpl implements IGameDataService {
      * @return 返回给前端额数据
      */
     public GameDataTotalTotalVO getGameDataTotalTotal(GameDataTotalTotalDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getRegisteredBeginDate() == null || dto.getRegisteredEndDate() == null) {
@@ -1066,7 +1066,7 @@ public class GameDataServiceImpl implements IGameDataService {
         }
         if (needGroupBy) {
             //拼接分组条件
-            cri.getGroupBy().groupBy("game_name", "game_id", "game_classify");
+            cri.getGroupBy().groupBy("game_id", "game_classify", "source_system");
         }
 
         return cri;
@@ -2264,8 +2264,9 @@ public class GameDataServiceImpl implements IGameDataService {
                         IFNULL(role_num, 0) role_num
                     FROM(
                         SELECT
+                            source_system,
                             game_id,
-                            game_name,
+                            MAX(game_name) as game_name,
                             game_classify,
                             sum(buy_reg_num) reg_num,
                             sum(cost) cost,
@@ -2303,8 +2304,9 @@ public class GameDataServiceImpl implements IGameDataService {
                          ) a
                     LEFT JOIN (
                         SELECT
+                            source_system as b_source_system,
                             game_id as b_game_id,
-                            game_name as b_game_name,
+                            MAX(game_name) as b_game_name,
                             IFNULL(sum(buy_amount_count), 0) amount_count,
                             IFNULL(sum(buy_amount), 0) amount,
                             round(if(sum(buy_amount_count) > 0, sum(buy_amount) / sum(buy_amount_count), 0), 2) avg_amount
@@ -2313,9 +2315,10 @@ public class GameDataServiceImpl implements IGameDataService {
                     """ + criB +
                     """
                         ) b
-                    ON a.game_id = b.b_game_id and a.game_name = b.b_game_name
+                    ON a.game_id = b.b_game_id and a.game_name = b.b_game_name and a.source_system = b.b_source_system
                     LEFT JOIN(
                         SELECT
+                            source_system as d_source_system,
                             game_id as d_game_id,
                             IFNULL(COUNT(DISTINCT user_id), 0) amount_num
                         FROM
@@ -2323,10 +2326,11 @@ public class GameDataServiceImpl implements IGameDataService {
                     """ + criAmount +
                     """
                             AND NOT agent_id = 0
-                        GROUP BY game_id) d
-                    ON a.game_id = d.d_game_id
+                        GROUP BY game_id, source_system) d
+                    ON a.game_id = d.d_game_id and a.source_system = d.d_source_system
                     LEFT JOIN (
                         SELECT
+                            source_system as f_source_system,
                             game_id as f_game_id,
                             COUNT(DISTINCT user_id) new_user_amount_num
                         FROM
@@ -2334,14 +2338,16 @@ public class GameDataServiceImpl implements IGameDataService {
                     """ + criNewUser +
                     """
                             AND NOT agent_id = 0
-                        GROUP BY game_id) f
-                    ON a.game_id = f.f_game_id
+                        GROUP BY game_id, source_system) f
+                    ON a.game_id = f.f_game_id and a.source_system = f.f_source_system
                     LEFT JOIN(
                         SELECT
+                            source_system as g_source_system,
                             game_id as g_game_id,
                             COUNT(tempA.num) as new_user_again_num
                         FROM (
                                 SELECT
+                                    source_system,
                                     game_id,
                                     COUNT(user_id) num
                                 FROM
@@ -2351,13 +2357,15 @@ public class GameDataServiceImpl implements IGameDataService {
                                     AND NOT agent_id = 0
                                 GROUP BY
                                     user_id,
-                                    game_id
+                                    game_id,
+                                    source_system
                                 HAVING
                                     COUNT(user_id) > 1 ) tempA
-                        GROUP BY tempA.game_id) g
-                    ON a.game_id = g.g_game_id
+                        GROUP BY tempA.game_id, tempA.source_system) g
+                    ON a.game_id = g.g_game_id and a.source_system = g.g_source_system
                     LEFT JOIN (
                         SELECT
+                            source_system as n_source_system,
                             user_game_id ,
                             COUNT(DISTINCT role_user_id) as role_num
                         FROM
@@ -2365,9 +2373,9 @@ public class GameDataServiceImpl implements IGameDataService {
                     """ + criRoleNum +
                     """
                             AND NOT user_agent_id = 0
-                        GROUP BY user_game_id
+                        GROUP BY user_game_id,source_system
                     ) n
-                    ON a.game_id = n.user_game_id
+                    ON a.game_id = n.user_game_id and a.source_system = n.n_source_system
                     """;
         } else if ("nature".equals(tableType)) {
             return """
@@ -2382,8 +2390,9 @@ public class GameDataServiceImpl implements IGameDataService {
                         IFNULL(role_num, 0) role_num
                     FROM(
                         SELECT
+                            source_system,
                             game_id,
-                            game_name,
+                            MAX(game_name) as game_name,
                             game_classify,
                             sum(nature_reg_num) reg_num,
                             sum(cost) cost,
@@ -2421,8 +2430,9 @@ public class GameDataServiceImpl implements IGameDataService {
                          ) a
                     LEFT JOIN (
                         SELECT
+                            source_system as b_source_system,
                             game_id as b_game_id,
-                            game_name as b_game_name,
+                            MAX(game_name) as b_game_name,
                             IFNULL(sum(nature_amount_count), 0) amount_count,
                             IFNULL(sum(nature_amount), 0) amount,
                             round(if(sum(nature_amount_count) > 0, sum(nature_amount) / sum(nature_amount_count), 0), 2) avg_amount
@@ -2431,9 +2441,10 @@ public class GameDataServiceImpl implements IGameDataService {
                     """ + criB +
                     """
                         ) b
-                    ON a.game_id = b.b_game_id and a.game_name = b.b_game_name
+                    ON a.game_id = b.b_game_id and a.game_name = b.b_game_name and a.source_system = b.b_source_system
                     LEFT JOIN (
                         SELECT
+                            source_system as e_source_system,
                             game_id as e_game_id,
                             IFNULL(COUNT(DISTINCT user_id), 0) amount_num
                         FROM
@@ -2441,10 +2452,11 @@ public class GameDataServiceImpl implements IGameDataService {
                     """ + criAmount +
                     """
                             AND agent_id = 0
-                        GROUP BY game_id ) e
-                    ON a.game_id = e.e_game_id
+                        GROUP BY game_id, source_system ) e
+                    ON a.game_id = e.e_game_id and a.source_system = e.e_source_system
                     LEFT JOIN(
                         SELECT
+                            source_system as h_source_system,
                             game_id as h_game_id,
                             COUNT(DISTINCT user_id) as new_user_amount_num
                         FROM
@@ -2452,14 +2464,16 @@ public class GameDataServiceImpl implements IGameDataService {
                     """ + criNewUser +
                     """
                             AND agent_id = 0
-                        GROUP BY game_id) h
-                    ON a.game_id = h.h_game_id
+                        GROUP BY game_id, source_system) h
+                    ON a.game_id = h.h_game_id and a.source_system = h.h_source_system
                     LEFT JOIN (
                         SELECT
+                            source_system as i_source_system,
                             game_id as i_game_id,
                             COUNT(tempB.num) as new_user_again_num
                         FROM (
                                 SELECT
+                                    source_system,
                                     game_id,
                                     COUNT(user_id) num
                                 FROM
@@ -2469,13 +2483,15 @@ public class GameDataServiceImpl implements IGameDataService {
                                     AND agent_id = 0
                                 GROUP BY
                                     user_id,
-                                    game_id
+                                    game_id,
+                                    source_system
                                 HAVING
                                     COUNT(user_id) > 1 ) tempB
-                            GROUP BY tempB.game_id ) i
-                    ON a.game_id = i.i_game_id
+                            GROUP BY tempB.game_id, tempB.source_system ) i
+                    ON a.game_id = i.i_game_id and a.source_system = i.i_source_system
                     LEFT JOIN (
                         SELECT
+                            source_system as m_source_system,
                             user_game_id ,
                             COUNT(DISTINCT role_user_id) as role_num
                         FROM
@@ -2483,9 +2499,9 @@ public class GameDataServiceImpl implements IGameDataService {
                     """ + criRoleNum +
                     """
                             AND user_agent_id = 0
-                        GROUP BY user_game_id
+                        GROUP BY user_game_id, source_system
                     ) m
-                    ON a.game_id = m.user_game_id
+                    ON a.game_id = m.user_game_id and a.source_system = m.m_source_system
                     """;
         }
         //总量
@@ -2501,8 +2517,9 @@ public class GameDataServiceImpl implements IGameDataService {
                   	IFNULL(role_num, 0) role_num
                 FROM(
                 	SELECT
+                	    source_system,
                 		game_id,
-                		game_name,
+                		MAX(game_name) as game_name,
                 		game_classify,
                 		sum(reg_num) reg_num,
                 		sum(cost) cost,
@@ -2540,8 +2557,9 @@ public class GameDataServiceImpl implements IGameDataService {
                      ) a
                 LEFT JOIN (
                     SELECT
+                        source_system as b_source_system,
                         game_id as b_game_id,
-                        game_name as b_game_name,
+                        MAX(game_name) as b_game_name,
                         IFNULL(sum(amount_count), 0) amount_count,
                         IFNULL(sum(amount), 0) amount,
                         round(if(sum(amount_count) > 0, sum(amount) / sum(amount_count), 0), 2) avg_amount
@@ -2550,20 +2568,21 @@ public class GameDataServiceImpl implements IGameDataService {
                 """ + criB +
                 """
                     ) b
-                ON a.game_id = b.b_game_id and a.game_name = b.b_game_name
+                ON a.game_id = b.b_game_id and a.game_name = b.b_game_name and a.source_system = b.b_source_system
                 LEFT JOIN (
                     SELECT
+                        source_system as c_source_system,
                         game_id as c_game_id,
                         IFNULL(COUNT(DISTINCT user_id), 0) amount_num
                     FROM
                         game_ads.ads_information
                 """ + criAmount +
                 """
-                    GROUP BY
-                        game_id) c
-                ON a.game_id = c.c_game_id
+                    GROUP BY game_id, source_system) c
+                ON a.game_id = c.c_game_id and a.source_system = c.c_source_system
                 LEFT JOIN (
                     SELECT
+                        source_system as j_source_system,
                         game_id as j_game_id,
                         COUNT(DISTINCT user_id) new_user_amount_num
                     FROM
@@ -2571,14 +2590,16 @@ public class GameDataServiceImpl implements IGameDataService {
                 """
                 + criNewUser +
                 """
-                    GROUP BY game_id) j
-                ON a.game_id = j.j_game_id
+                    GROUP BY game_id, source_system) j
+                ON a.game_id = j.j_game_id and a.source_system = j.j_source_system
                 LEFT JOIN (
                     SELECT
+                        source_system as k_source_system,
                         game_id as k_game_id,
                         COUNT(tempC.num) as new_user_again_num
                     FROM (
                             SELECT
+                                source_system,
                                 game_id,
                                 COUNT(user_id) num
                             FROM
@@ -2587,22 +2608,24 @@ public class GameDataServiceImpl implements IGameDataService {
                 """
                             GROUP BY
                                 user_id,
-                                game_id
+                                game_id,
+                                source_system
                             HAVING
                                 COUNT(user_id) > 1 ) tempC
-                        GROUP BY tempC.game_id ) k
-                ON a.game_id = k.k_game_id
+                        GROUP BY tempC.game_id, tempC.source_system ) k
+                ON a.game_id = k.k_game_id and a.source_system = k.k_source_system
                 LEFT JOIN (
                     SELECT
+                        source_system as l_source_system,
                         user_game_id ,
                         COUNT(DISTINCT role_user_id) as role_num
                     FROM
                         dw_create_role_detail
                 """ + criRoleNum +
                 """
-                    GROUP BY user_game_id
+                    GROUP BY user_game_id, source_system
                 ) l
-                ON a.game_id = l.user_game_id
+                ON a.game_id = l.user_game_id and a.source_system = l.l_source_system
                 """;
     }
 

+ 30 - 4
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameListServiceImpl.java

@@ -1,10 +1,14 @@
 package com.zanxiang.game.data.serve.service.impl;
 
+import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
 import com.zanxiang.game.data.serve.pojo.vo.GameListVO;
 import com.zanxiang.game.data.serve.service.IGameListService;
 import lombok.extern.slf4j.Slf4j;
+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.sql.Criteria;
 import org.nutz.dao.sql.Sql;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -23,11 +27,28 @@ public class GameListServiceImpl implements IGameListService {
     @Autowired
     private Dao dao;
 
+    /**
+     * 游戏列表接口 查看所有游戏、父游戏、超父游戏列表
+     * @param dto
+     * @return
+     */
     @Override
-    public GameListVO getGameList() {
+    public GameListVO getGameList(ChoiceListDTO dto) {
+
+        Criteria cri = Cnd.cri();
+        if (StringUtils.isBlank(dto.getSourceSystem())) {
+            //默认查询“ZX_ONE”数据
+            dto.setSourceSystem("ZX_ONE");
+        }
+        if (StringUtils.isNotBlank(dto.getSourceSystem())) {
+            //不同的数据源
+            cri.where().andEquals("source_system", dto.getSourceSystem());
+        }
+
         //查询游戏列表
         Sql gameListSql = Sqls.create("""
                 SELECT
+                    source_system,
                 	id,
                 	game_name,
                 	parent_game_id,
@@ -49,7 +70,8 @@ public class GameListServiceImpl implements IGameListService {
                 	LEFT JOIN dm_game_order.t_game_super c
                 	on a.source_system = c.source_system AND a.super_game_id = c.id
                 ) a
-                WHERE a.source_system = 'ZX_ONE'
+                """ + cri +
+                """
                 GROUP BY id, game_name, parent_game_id, source_system, parent_game_name, super_game_id, super_game_name;
                 """);
         gameListSql.setCallback(Sqls.callback.maps());
@@ -58,6 +80,7 @@ public class GameListServiceImpl implements IGameListService {
         //查询父游戏列表
         Sql parentGameListSql = Sqls.create("""
                 SELECT
+                    source_system,
                 	parent_game_id,
                 	parent_game_name,
                 	super_game_id,
@@ -75,7 +98,8 @@ public class GameListServiceImpl implements IGameListService {
                 	LEFT JOIN dm_game_order.t_game_super c
                 	on a.source_system = c.source_system AND a.super_game_id = c.id
                 ) a
-                WHERE a.source_system = 'ZX_ONE'
+                """ + cri +
+                """
                 GROUP BY parent_game_id, source_system, parent_game_name, super_game_id, super_game_name;
                 """);
         parentGameListSql.setCallback(Sqls.callback.maps());
@@ -84,6 +108,7 @@ public class GameListServiceImpl implements IGameListService {
         //查询超父游戏列表
         Sql superGameListSql = Sqls.create("""
                 SELECT
+                    source_system,
                 	super_game_id,
                 	super_game_name
                 FROM (
@@ -95,7 +120,8 @@ public class GameListServiceImpl implements IGameListService {
                 	LEFT JOIN dm_game_order.t_game_super b
                 	on a.source_system = b.source_system AND a.super_game_id = b.id
                 ) a
-                WHERE a.source_system = 'ZX_ONE'
+                """ + cri +
+                """
                 GROUP BY super_game_id, source_system, super_game_name;
                 """);
         superGameListSql.setCallback(Sqls.callback.maps());

+ 3 - 7
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameServerServiceImpl.java

@@ -317,17 +317,13 @@ public class GameServerServiceImpl implements IGameServerService {
     @Override
     public Page<GameServerSumDayVO> getGameServerDataSumDay(GameServerSumDayDTO dto) {
         //添加权限
-        /*com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
-        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());*/
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //创建查询条件
         Criteria cri = Cnd.cri();
-        /*if (gameIds != null) {
+        if (gameIds != null) {
             //拼接游戏ID查询条件
             cri.where().andInList("game_id", gameIds);
-        }*/
-        if (dto.getGameId() != null) {
-            //拼接游戏ID查询条件
-            cri.where().andEquals("game_id", dto.getGameId());
         }
         if (dto.getBeginDate() != null && dto.getEndDate() != null) {
             //拼接开服时间查询条件

+ 69 - 27
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/OverallSummaryServiceImpl.java

@@ -47,13 +47,18 @@ public class OverallSummaryServiceImpl implements IOverallSummaryService {
      */
     @Override
     public OverallSummaryVO getOverallSummaryTotalData(OverallSummaryDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         //创建返回给前端的对象
         OverallSummaryVO overallSummaryVO = new OverallSummaryVO();
 
+        //默认查询‘ZX_ONE’数据
+        if (StringUtils.isBlank(dto.getSourceSystem())) {
+            dto.setSourceSystem("ZX_ONE");
+        }
+
         //计算总计条件
         Condition totalCri = myCondition(userIds, gameIds, dto, true, false, -1);
         //计算今日数据条件
@@ -90,16 +95,37 @@ public class OverallSummaryServiceImpl implements IOverallSummaryService {
         overallSummaryVO.setYesterdayAgentCount(getResultBySql(1, "today_agent_count-ads_overall_summary_agent", yesterdayCri));
 
         //计算充值相关数据
-        //查询充值总计
-        overallSummaryVO.setTotalAmount(getResultBySql("today_amount-ads_overall_summary_amount", totalCri));
-        //查询今日账面
-        overallSummaryVO.setTodayAmount(getResultBySql("today_amount-ads_overall_summary_amount", todayCri));
-        //查询昨日账面
-        overallSummaryVO.setYesterdayAmount(getResultBySql("today_amount-ads_overall_summary_amount", yesterdayCri));
-        //查询今日新用户充值
-        overallSummaryVO.setTodayNewPlayerAmount(getResultBySql("today_new_user_amount-ads_overall_summary_amount", todayCri));
-        //查询昨日新用户充值(昨日的首日新用户充值)
-        overallSummaryVO.setYesterdayNewPlayerAmount(getResultBySql("today_first_new_user_amount-ads_overall_summary_amount", yesterdayCri));
+        //分source_system判断
+        if (dto.getSourceSystem().startsWith("BG_")) {
+            //查询充值总计(买量)
+            overallSummaryVO.setTotalAmount(getResultBySql("today_buy_amount-ads_overall_summary_amount", totalCri));
+            //查询今日账面(买量)
+            overallSummaryVO.setTodayAmount(getResultBySql("today_buy_amount-ads_overall_summary_amount", todayCri));
+            //查询昨日账面(买量)
+            overallSummaryVO.setYesterdayAmount(getResultBySql("today_buy_amount-ads_overall_summary_amount", yesterdayCri));
+            //查询今日新用户充值
+            overallSummaryVO.setTodayNewPlayerAmount(getResultBySql("today_new_user_amount-ads_overall_summary_amount", todayCri));
+            //查询昨日新用户充值(昨日的首日新用户充值)
+            overallSummaryVO.setYesterdayNewPlayerAmount(getResultBySql("today_first_new_user_amount-ads_overall_summary_amount", yesterdayCri));
+
+            //查询充值总计(自然量)
+            overallSummaryVO.setTotalAmountForBG(getResultBySql("today_nature_amount-ads_overall_summary_amount", totalCri));
+            //查询今日账面(自然量)
+            overallSummaryVO.setTodayAmountForBG(getResultBySql("today_nature_amount-ads_overall_summary_amount", todayCri));
+            //查询昨日账面(自然量)
+            overallSummaryVO.setYesterdayAmountForBG(getResultBySql("today_nature_amount-ads_overall_summary_amount", yesterdayCri));
+        } else {
+            //查询充值总计
+            overallSummaryVO.setTotalAmount(getResultBySql("today_amount-ads_overall_summary_amount", totalCri));
+            //查询今日账面
+            overallSummaryVO.setTodayAmount(getResultBySql("today_amount-ads_overall_summary_amount", todayCri));
+            //查询昨日账面
+            overallSummaryVO.setYesterdayAmount(getResultBySql("today_amount-ads_overall_summary_amount", yesterdayCri));
+            //查询今日新用户充值
+            overallSummaryVO.setTodayNewPlayerAmount(getResultBySql("today_new_user_amount-ads_overall_summary_amount", todayCri));
+            //查询昨日新用户充值(昨日的首日新用户充值)
+            overallSummaryVO.setYesterdayNewPlayerAmount(getResultBySql("today_first_new_user_amount-ads_overall_summary_amount", yesterdayCri));
+        }
 
         //计算消耗相关数据
         //查询消耗总计
@@ -110,9 +136,6 @@ public class OverallSummaryServiceImpl implements IOverallSummaryService {
         overallSummaryVO.setYesterdayTotalCost(getResultBySql("today_cost-ads_overall_summary_cost", yesterdayCri));
 
         //计算Roi相关数据
-        //计算总回本数据
-        overallSummaryVO.setTotalRoi(overallSummaryVO.getTotalCost().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
-                overallSummaryVO.getTotalAmount().divide(overallSummaryVO.getTotalCost(), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
         //计算总数据的首日Roi
         //计算所有的首日新用户充值
         BigDecimal totalFirstNewUserAmount = getResultBySql("today_first_new_user_amount-ads_overall_summary_amount", totalCri);
@@ -123,18 +146,37 @@ public class OverallSummaryServiceImpl implements IOverallSummaryService {
         BigDecimal todayFirstNewUserAmount = getResultBySql("today_first_new_user_amount-ads_overall_summary_amount", todayCri);
         overallSummaryVO.setFirstRoi(overallSummaryVO.getTodayTotalCost().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
                 todayFirstNewUserAmount.divide(overallSummaryVO.getTodayTotalCost(), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
-        //计算7日Roi
-        //计算7日账面充值和消耗
-        BigDecimal d7Amount = getResultBySql("today_amount-ads_overall_summary_amount", d7Cri);
-        BigDecimal d7Cost = getResultBySql("today_cost-ads_overall_summary_cost", d7Cri);
-        overallSummaryVO.setD7TotalRoi(d7Cost.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
-                d7Amount.divide(d7Cost, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
-        //计算30日Roi
-        //计算7日账面充值和消耗
-        BigDecimal d30Amount = getResultBySql("today_amount-ads_overall_summary_amount", d30Cri);
-        BigDecimal d30Cost = getResultBySql("today_cost-ads_overall_summary_cost", d30Cri);
-        overallSummaryVO.setD30TotalRoi(d30Cost.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
-                d30Amount.divide(d30Cost, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
+        //计算总回本数据
+        overallSummaryVO.setTotalRoi(overallSummaryVO.getTotalCost().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
+                overallSummaryVO.getTotalAmount().divide(overallSummaryVO.getTotalCost(), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
+        //布谷数据不同处理
+        if (dto.getSourceSystem().startsWith("BG_")) {
+            //计算7日Roi
+            //计算7日账面充值和消耗(布谷只算买量)
+            BigDecimal d7Amount = getResultBySql("today_buy_amount-ads_overall_summary_amount", d7Cri);
+            BigDecimal d7Cost = getResultBySql("today_cost-ads_overall_summary_cost", d7Cri);
+            overallSummaryVO.setD7TotalRoi(d7Cost.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
+                    d7Amount.divide(d7Cost, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
+            //计算30日Roi
+            //计算7日账面充值和消耗(布谷只算买量)
+            BigDecimal d30Amount = getResultBySql("today_buy_amount-ads_overall_summary_amount", d30Cri);
+            BigDecimal d30Cost = getResultBySql("today_cost-ads_overall_summary_cost", d30Cri);
+            overallSummaryVO.setD30TotalRoi(d30Cost.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
+                    d30Amount.divide(d30Cost, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
+        } else {
+            //计算7日Roi
+            //计算7日账面充值和消耗
+            BigDecimal d7Amount = getResultBySql("today_amount-ads_overall_summary_amount", d7Cri);
+            BigDecimal d7Cost = getResultBySql("today_cost-ads_overall_summary_cost", d7Cri);
+            overallSummaryVO.setD7TotalRoi(d7Cost.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
+                    d7Amount.divide(d7Cost, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
+            //计算30日Roi
+            //计算7日账面充值和消耗
+            BigDecimal d30Amount = getResultBySql("today_amount-ads_overall_summary_amount", d30Cri);
+            BigDecimal d30Cost = getResultBySql("today_cost-ads_overall_summary_cost", d30Cri);
+            overallSummaryVO.setD30TotalRoi(d30Cost.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
+                    d30Amount.divide(d30Cost, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
+        }
 
         return overallSummaryVO;
     }
@@ -147,7 +189,7 @@ public class OverallSummaryServiceImpl implements IOverallSummaryService {
      */
     @Override
     public Map<String, List> getOverallSummaryLineData(OverallSummaryDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 

+ 8 - 8
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PitcherDataServiceImpl.java

@@ -202,7 +202,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public Page<PitcherDataDayVO> getPitcherDataDay(PitcherDataDayDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //不传递时间,默认查询当天
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
@@ -261,7 +261,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public PitcherDataDayTotalVO getPitcherDataDayTotal(PitcherDataDayTotalDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //不传递时间,默认查询当天
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
@@ -303,7 +303,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public Page<PitcherDataTotalVO> getPitcherDataTotal(PitcherDataTotalDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
@@ -395,7 +395,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public PitcherDataTotalSumVO getPitcherDataTotalSum(PitcherDataTotalSumDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
@@ -486,7 +486,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public Page<PitcherGameDataDayVO> getPitcherGameDataDay(PitcherGameDataDayDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //不传递时间,默认查询当天
@@ -556,7 +556,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public PitcherGameDataDayTotalVO getPitcherGameDataDayTotal(PitcherGameDataDayTotalDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //不传递时间,默认查询当天
@@ -608,7 +608,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public Page<PitcherGameDataTotalVO> getPitcherGameDataTotal(PitcherGameDataTotalDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //如果注册时间参数为空,默认设置查询当天数据
@@ -707,7 +707,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public PitcherGameDataTotalSumVO getPitcherGameDataTotalSum(PitcherGameDataTotalSumDTO dto) {
-        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //如果注册时间参数为空,默认设置查询当天数据

+ 66 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PitcherListServiceImpl.java

@@ -0,0 +1,66 @@
+package com.zanxiang.game.data.serve.service.impl;
+
+import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
+import com.zanxiang.game.data.serve.pojo.vo.PitcherListVO;
+import com.zanxiang.game.data.serve.service.IPitcherListService;
+import lombok.extern.slf4j.Slf4j;
+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.sql.Criteria;
+import org.nutz.dao.sql.Sql;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: TODO
+ * @date 2023/11/3 16:51
+ */
+@Service
+@Slf4j
+public class PitcherListServiceImpl implements IPitcherListService {
+
+    @Autowired
+    private Dao dao;
+
+    /**
+     * 所有投手列表
+     * @param dto ChoiceListDTO
+     * @return list
+     */
+    @Override
+    public List<PitcherListVO> getPitcherList(ChoiceListDTO dto) {
+
+        Criteria cir = Cnd.cri();
+        if (StringUtils.isBlank(dto.getSourceSystem())) {
+            dto.setSourceSystem("ZX_ONE");
+        }
+        if (StringUtils.isNotBlank(dto.getSourceSystem())) {
+            cir.where().andEquals("source_system", dto.getSourceSystem());
+        }
+        //投手id、投手名为空排除掉
+        cir.where().andNotIsNull("zx_pitcher_id");
+        cir.where().andNotIsNull("zx_pitcher_name");
+        //查询投手信息
+        Sql sql = Sqls.create("""
+                SELECT
+                    source_system,
+                    zx_pitcher_id as pitcher_id,
+                    zx_pitcher_name as pitcher_name
+                FROM dm_game_order.t_pitcher_map
+                """ + cir);
+        //设置回传对象
+        sql.setCallback(Sqls.callback.entities());
+        sql.setEntity(dao.getEntity(PitcherListVO.class));
+        //执行sql
+        dao.execute(sql);
+        //返回结果
+        return sql.getList(PitcherListVO.class);
+    }
+
+}

+ 119 - 33
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/RoleManageServiceImpl.java

@@ -131,6 +131,10 @@ public class RoleManageServiceImpl implements IRoleManageService {
             //是否退游
             criA.where().andEquals("is_remove_game", dto.getIsRemoveGame());
         }
+        if (dto.getIsRemoveGameForSystem() != null) {
+            //是否退游
+            criA.where().andEquals("is_remove_game_for_system", dto.getIsRemoveGameForSystem());
+        }
         //给充值时间查询条件
         Criteria criTodayAmount = Cnd.cri();
         //查询充值成功的
@@ -785,7 +789,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 		a.association_user_id as association_user_id, -- 来源的用户id
                 		a.source_system as source_system, -- sdk来源
                 		a.role_id as role_id, -- 角色id
-                		a.role_name as role_name, -- 角色名
+                		u.role_name as role_name, -- 角色名
                 		a.create_time as role_create_time, -- 角色创建时间
                 		a.os as os, -- 角色操作系统
                 		b.role_level as role_level, -- 角色等级
@@ -848,9 +852,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 		j.add_corp_user_id as add_corp_user_id, -- 企微号
                 		j.user_wechat as user_wechat, -- 客户微信号
                 		j.user_phone as user_phone, -- 客户手机号
-                		IFNULL(j.is_remove_game,
-                  			IF(TIMESTAMPDIFF(HOUR, g.update_time, NOW()) > 72,
-                  				IF(TIMESTAMPDIFF(HOUR, f.pay_time, NOW()) < 72 , NULL, 1) , NULL)) as is_remove_game, -- 是否退游 1-是;0-否;NULL-未操作过的数据(也代表未退游)
+                		IF(TIMESTAMPDIFF(HOUR, g.update_time, NOW()) > 72,
+                        				IF(TIMESTAMPDIFF(HOUR, f.pay_time, NOW()) < 72 , 0, 1) , 0) as is_remove_game_for_system, -- 是否退游 1-是;0-否(系统判定)
+                        j.is_remove_game as is_remove_game, -- 是否退游 1-是;0-否;null-代表未操作数据
                 		j.is_wake_up as is_wake_up, -- 是否唤醒 1-是;0-否
                 		j.remark as remark, -- 备注
                 		j.gs_id as gs_id, -- GS_ID
@@ -1140,6 +1144,27 @@ public class RoleManageServiceImpl implements IRoleManageService {
                         FROM dm_game_order.t_game_server_merge
                         WHERE is_delete = 0
                     ) t on a.source_system = t.source_system AND a.server_id = t.server_id AND d.super_game_id = t.game_id
+                    LEFT JOIN(
+                		SELECT
+                			a.source_system,
+                			a.role_id,
+                			a.role_name,
+                			a.role_level,
+                			a.combat_num ,
+                			a.game_id ,
+                			b.parent_game_id,
+                			b.super_game_id ,
+                			ROW_NUMBER()over(partition by a.source_system , a.role_id, b.parent_game_id order by a.role_level desc,a.combat_num desc) as num
+                		FROM dm_game_order.t_game_user_role a
+                		LEFT JOIN (
+                			SELECT
+                				source_system,
+                				id,
+                				IFNULL(parent_id, id) as parent_game_id,
+                				IFNULL(super_game_id, id) as super_game_id
+                			FROM dm_game_order.t_game
+                		) b on a.source_system = b.source_system AND a.game_id = b.id
+                	) u on a.source_system = u.source_system AND a.role_id = u.role_id AND d.super_game_id = u.super_game_id AND u.num =1
                 ) a
                 """ + criA;
     }
@@ -1159,7 +1184,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
                         a.association_user_id as association_user_id, -- 来源的用户id
                         a.source_system as source_system, -- sdk来源
                         a.role_id as role_id, -- 角色id
-                        a.role_name as role_name, -- 角色名
+                        u.role_name as role_name, -- 角色名
                         a.create_time as role_create_time, -- 角色创建时间
                         a.os as os, -- 角色操作系统
                         b.role_level as role_level, -- 角色等级
@@ -1222,9 +1247,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
                         j.add_corp_user_id as add_corp_user_id, -- 企微号
                         j.user_wechat as user_wechat, -- 客户微信号
                         j.user_phone as user_phone, -- 客户手机号
-                        IFNULL(j.is_remove_game,
-                        			IF(TIMESTAMPDIFF(HOUR, g.update_time, NOW()) > 72,
-                        				IF(TIMESTAMPDIFF(HOUR, f.pay_time, NOW()) < 72 , NULL, 1) , NULL)) as is_remove_game, -- 是否退游 1-是;0-否;-1-未操作过的数据(也代表未退游)
+                        IF(TIMESTAMPDIFF(HOUR, g.update_time, NOW()) > 72,
+                                        IF(TIMESTAMPDIFF(HOUR, f.pay_time, NOW()) < 72 , 0, 1) , 0) as is_remove_game_for_system, -- 是否退游 1-是;0-否(系统判定)
+                        j.is_remove_game as is_remove_game, -- 是否退游 1-是;0-否;null-代表未操作数据
                         j.is_wake_up as is_wake_up, -- 是否唤醒 1-是;0-否
                         j.remark as remark, -- 备注
                         j.gs_id as gs_id, -- GS_ID
@@ -1514,6 +1539,27 @@ public class RoleManageServiceImpl implements IRoleManageService {
                         FROM dm_game_order.t_game_server_merge
                         WHERE is_delete = 0
                     ) t on a.source_system = t.source_system AND a.server_id = t.server_id AND d.super_game_id = t.game_id
+                    LEFT JOIN(
+                        SELECT
+                            a.source_system,
+                            a.role_id,
+                            a.role_name,
+                            a.role_level,
+                            a.combat_num ,
+                            a.game_id ,
+                            b.parent_game_id,
+                            b.super_game_id ,
+                            ROW_NUMBER()over(partition by a.source_system , a.role_id, b.parent_game_id order by a.role_level desc,a.combat_num desc) as num
+                        FROM dm_game_order.t_game_user_role a
+                        LEFT JOIN (
+                            SELECT
+                                source_system,
+                                id,
+                                IFNULL(parent_id, id) as parent_game_id,
+                                IFNULL(super_game_id, id) as super_game_id
+                            FROM dm_game_order.t_game
+                        ) b on a.source_system = b.source_system AND a.game_id = b.id
+                    ) u on a.source_system = u.source_system AND a.role_id = u.role_id AND d.super_game_id = u.super_game_id AND u.num =1
                 ) a
                 """ + criA;
     }
@@ -3143,18 +3189,18 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 	*
                 FROM (
                 	SELECT
-                		source_system ,
-                		server_id ,
-                		super_game_id ,
-                		dt,
-                		merge_time,
-                		role_id ,
-                		role_name,
-                		role_level ,
-                		role_vip ,
-                		total_amount ,
-                		combat_num ,
-                		ROW_NUMBER()over(partition by source_system ,server_id ,super_game_id order by combat_num desc) as rank_num
+                		a.source_system ,
+                		a.server_id ,
+                		a.super_game_id ,
+                		a.dt,
+                		a.merge_time,
+                		a.role_id ,
+                		b.role_name,
+                		a.role_level ,
+                		a.role_vip ,
+                		a.total_amount ,
+                		a.combat_num ,
+                		ROW_NUMBER()over(partition by a.source_system ,a.server_id ,a.super_game_id order by a.combat_num desc) as rank_num
                 	FROM (
                 		SELECT
                 			source_system ,
@@ -3180,7 +3226,27 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 		) b on a.source_system = b.b_source_system AND a.boss_server_id = b.b_server_id AND a.super_game_id = b.b_game_id
                 		WHERE b_is_merge = 0
                 		GROUP BY role_id , source_system ,super_game_id, server_id , boss_server_id
-                	) a
+                	) a LEFT JOIN(
+                		SELECT
+                			a.source_system,
+                			a.role_id,
+                			a.role_name,
+                			a.role_level,
+                			a.combat_num ,
+                			a.game_id ,
+                			b.parent_game_id,
+                			b.super_game_id ,
+                			ROW_NUMBER()over(partition by a.source_system , a.role_id, b.parent_game_id order by a.role_level desc,a.combat_num desc) as num
+                		FROM dm_game_order.t_game_user_role a
+                		LEFT JOIN (
+                			SELECT
+                				source_system,
+                				id,
+                				IFNULL(parent_id, id) as parent_game_id,
+                				IFNULL(super_game_id, id) as super_game_id
+                			FROM dm_game_order.t_game
+                		) b on a.source_system = b.source_system AND a.game_id = b.id
+                	) b on a.source_system = b.source_system AND a.role_id = b.role_id AND a.super_game_id = b.super_game_id AND b.num =1
                 ) a
                 """;
     }
@@ -3195,17 +3261,17 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 	*
                 FROM (
                 	SELECT
-                		source_system ,
-                		boss_server_id ,
-                		super_game_id ,
-                		merge_time,
-                		role_id ,
-                		role_name,
-                		role_level ,
-                		role_vip ,
-                		total_amount ,
-                		combat_num ,
-                		ROW_NUMBER()over(partition by source_system ,boss_server_id ,super_game_id order by combat_num desc) as rank_num
+                		a.source_system ,
+                		a.boss_server_id ,
+                		a.super_game_id ,
+                		a.merge_time,
+                		a.role_id ,
+                		b.role_name,
+                		a.role_level ,
+                		a.role_vip ,
+                		a.total_amount ,
+                		a.combat_num ,
+                		ROW_NUMBER()over(partition by a.source_system ,a.boss_server_id ,a.super_game_id order by a.combat_num desc) as rank_num
                 	FROM (
                 		SELECT
                 			source_system ,
@@ -3220,7 +3286,27 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 			MAX(combat_num) as combat_num
                 		FROM game_ads.ads_role_combat_num_ranking
                 		GROUP BY role_id , source_system ,super_game_id, boss_server_id
-                	) a
+                	) a LEFT JOIN(
+                		SELECT
+                			a.source_system,
+                			a.role_id,
+                			a.role_name,
+                			a.role_level,
+                			a.combat_num ,
+                			a.game_id ,
+                			b.parent_game_id,
+                			b.super_game_id ,
+                			ROW_NUMBER()over(partition by a.source_system , a.role_id, b.parent_game_id order by a.role_level desc,a.combat_num desc) as num
+                		FROM dm_game_order.t_game_user_role a
+                		LEFT JOIN (
+                			SELECT
+                				source_system,
+                				id,
+                				IFNULL(parent_id, id) as parent_game_id,
+                				IFNULL(super_game_id, id) as super_game_id
+                			FROM dm_game_order.t_game
+                		) b on a.source_system = b.source_system AND a.game_id = b.id
+                	) b on a.source_system = b.source_system AND a.role_id = b.role_id AND a.super_game_id = b.super_game_id AND b.num =1
                 ) a
                 """;
     }

+ 4 - 1
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameUserRole.java

@@ -125,5 +125,8 @@ public class GameUserRole implements Serializable {
      */
     private LocalDateTime updateTime;
 
-
+    /**
+     * 角色拓展属性
+     */
+    private String extra;
 }

+ 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服务启动成功 <壳包屏蔽省份22> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功 <SDK更新, 敏感词检测, 角色拓展属性, 战力时实更新控制频率> ( ´・・)ノ(._.`) \n" +
                 " ___________ _   __\n" +
                 "/  ___|  _  \\ | / /\n" +
                 "\\ `--.| | | | |/ / \n" +

+ 82 - 3
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/config/KafkaConfig.java

@@ -1,15 +1,24 @@
 package com.zanxiang.game.module.sdk.config;
 
 import lombok.extern.slf4j.Slf4j;
-import org.apache.kafka.clients.producer.KafkaProducer;
-import org.apache.kafka.clients.producer.ProducerConfig;
+import org.apache.kafka.clients.consumer.OffsetAndMetadata;
+import org.apache.kafka.clients.producer.*;
+import org.apache.kafka.common.Metric;
+import org.apache.kafka.common.MetricName;
+import org.apache.kafka.common.PartitionInfo;
+import org.apache.kafka.common.TopicPartition;
+import org.apache.kafka.common.errors.ProducerFencedException;
 import org.apache.kafka.common.serialization.StringSerializer;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
 import java.net.InetAddress;
+import java.time.Duration;
+import java.util.List;
+import java.util.Map;
 import java.util.Properties;
+import java.util.concurrent.Future;
 
 /**
  * @author : lingfeng
@@ -23,8 +32,14 @@ public class KafkaConfig {
     @Value("${spring.kafka.game-sdk.bootstrap-servers}")
     private String gameSdkKafkaSevers;
 
+    @Value("${server.domain}")
+    private String serverUrl;
+
     @Bean("gameSdkKafkaProducer")
-    public KafkaProducer<String, String> gameKafkaProducer() {
+    public Producer<String, String> gameKafkaProducer() {
+        if (this.serverUrl.contains("test")) {
+            return new TempKafkaProducer<>();
+        }
         String clientId = "UNKNOWN";
         try {
             clientId = InetAddress.getLocalHost().getHostAddress();
@@ -38,4 +53,68 @@ public class KafkaConfig {
         props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
         return new KafkaProducer<>(props);
     }
+
+    public static class TempKafkaProducer<K, V> implements Producer<K, V> {
+
+        @Override
+        public void initTransactions() {
+
+        }
+
+        @Override
+        public void beginTransaction() throws ProducerFencedException {
+
+        }
+
+        @Override
+        public void sendOffsetsToTransaction(Map<TopicPartition, OffsetAndMetadata> map, String s) throws ProducerFencedException {
+
+        }
+
+        @Override
+        public void commitTransaction() throws ProducerFencedException {
+
+        }
+
+        @Override
+        public void abortTransaction() throws ProducerFencedException {
+
+        }
+
+        @Override
+        public Future<RecordMetadata> send(ProducerRecord<K, V> producerRecord) {
+            return null;
+        }
+
+        @Override
+        public Future<RecordMetadata> send(ProducerRecord<K, V> producerRecord, Callback callback) {
+            return null;
+        }
+
+        @Override
+        public void flush() {
+
+        }
+
+        @Override
+        public List<PartitionInfo> partitionsFor(String s) {
+            return null;
+        }
+
+        @Override
+        public Map<MetricName, ? extends Metric> metrics() {
+            return null;
+        }
+
+        @Override
+        public void close() {
+
+        }
+
+        @Override
+        public void close(Duration duration) {
+
+        }
+    }
+
 }

+ 5 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/constant/RedisKeyConstant.java

@@ -32,6 +32,11 @@ public class RedisKeyConstant {
      */
     public static final String ROLE_UPDATE_KEY = RedisKeyConstant.REDIS_PREFIX + "role_update";
 
+    /**
+     * 角色信息更新
+     */
+    public static final String ROLE_LEVEL_UP = RedisKeyConstant.REDIS_PREFIX + "role_level_up_";
+
     /**
      * 小程序token
      */

+ 9 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/controller/UserController.java

@@ -47,6 +47,9 @@ public class UserController {
     @Autowired
     private IGameShellLogService gameShellLogService;
 
+    @Autowired
+    private IMsgSceneCheckService msgSceneCheckService;
+
     @ApiOperation(value = "游戏分享信息")
     @GetMapping("/share/game")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameShareVO.class)})
@@ -123,4 +126,10 @@ public class UserController {
         return ResultVO.ok(gameShellLogService.gameShellLogAdd(param, request));
     }
 
+    @ApiOperation(value = "敏感词检测")
+    @PostMapping("/msg/check")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = String.class)})
+    public ResultVO<String> msgCheck(@Validated @RequestBody MsgSceneCheckParam param, @ValidLogin UserData userData) {
+        return ResultVO.ok(msgSceneCheckService.msgCheck(param, userData));
+    }
 }

+ 6 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/param/GameUserRoleUpdateParam.java

@@ -99,4 +99,10 @@ public class GameUserRoleUpdateParam {
      */
     @ApiModelProperty("游戏在线时长")
     private Long totalOnlineTime;
+
+    /**
+     * 角色拓展属性
+     */
+    @ApiModelProperty("角色拓展属性")
+    private Object extra;
 }

+ 31 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/param/MsgSceneCheckParam.java

@@ -0,0 +1,31 @@
+package com.zanxiang.game.module.sdk.pojo.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-11-13
+ * @description : 消息检测参数
+ */
+@Data
+public class MsgSceneCheckParam {
+
+    /**
+     * 文本内容
+     */
+    @NotBlank(message = "文本内容不可为空")
+    @ApiModelProperty(notes = "文本内容")
+    private String content;
+
+    /**
+     * 场景
+     */
+    @NotNull(message = "场景值不可为空")
+    @ApiModelProperty(notes = "场景枚举值(1 资料;2 评论;3 论坛;4 社交日志)")
+    private Integer scene;
+
+}

+ 21 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IMsgSceneCheckService.java

@@ -0,0 +1,21 @@
+package com.zanxiang.game.module.sdk.service;
+
+import com.zanxiang.game.module.sdk.pojo.param.MsgSceneCheckParam;
+import com.zanxiang.game.module.sdk.pojo.param.UserData;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-11-13
+ * @description : 小程序安全检测
+ */
+public interface IMsgSceneCheckService {
+
+    /**
+     * 消息检测
+     *
+     * @param param    : 检测参数
+     * @param userData : 用户信息
+     * @return : 返回检测结果
+     */
+    String msgCheck(MsgSceneCheckParam param, UserData userData);
+}

+ 14 - 2
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameUserRoleServiceImpl.java

@@ -19,7 +19,7 @@ import com.zanxiang.module.redis.service.IDistributedLockComponent;
 import com.zanxiang.module.util.DateUtil;
 import com.zanxiang.module.util.JsonUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.clients.producer.Producer;
 import org.apache.kafka.clients.producer.ProducerRecord;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -61,9 +61,12 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
     @Value("${spring.kafka.game-sdk.gameRoleActiveTopic}")
     private String gameRoleActiveTopic;
 
+    @Value("${server.domain}")
+    private String serverUrl;
+
     @Autowired
     @Qualifier("gameSdkKafkaProducer")
-    private KafkaProducer<String, String> kafkaProducer;
+    private Producer<String, String> kafkaProducer;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -99,6 +102,10 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
         }
         //等级提升更新
         if (Objects.equals(dataType, DataTypeEnum.TYPE_LEVEL_UP.getDateType())) {
+            //更新频率限制, 20秒更新一次, 避免游戏实时战力高频上报
+            if (!distributedLockComponent.doLock(RedisKeyConstant.ROLE_LEVEL_UP + userData.getUserId(), 0L, 20L, TimeUnit.SECONDS)) {
+                return Boolean.TRUE;
+            }
             return super.update(new LambdaUpdateWrapper<GameUserRole>()
                     .set(GameUserRole::getRoleName, param.getRoleName())
                     .set(GameUserRole::getRoleLevel, param.getRoleLevel())
@@ -153,6 +160,7 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
                 .createTime(param.getRoleGradeUpdateTime() == null || param.getRoleGradeUpdateTime() <= 0 ? LocalDateTime.now() : DateUtil.secondToLocalDateTime(param.getRoleGradeUpdateTime()))
                 .updateTime(LocalDateTime.now())
                 .lastLoginTime(LocalDateTime.now())
+                .extra(param.getExtra() == null ? null : JsonUtil.toString(param.getExtra()))
                 .build();
         super.save(userRole);
         //更新玩家创角数
@@ -246,6 +254,10 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
             userTokenService.userTokenUpdateCheck(userData);
         } catch (Exception ignored) {
         }
+        //测试环境不使用kafka
+        if (this.serverUrl.contains("test")) {
+            return Boolean.TRUE;
+        }
         //活跃提交
         Map<String, Object> activeParamMap = new HashMap<>(6);
         activeParamMap.put("userId", userData.getUserId());

+ 1 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/LoginServiceImpl.java

@@ -106,6 +106,7 @@ public class LoginServiceImpl implements IRegisterLoginService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public ResultVO<UserLoginVO> loginWxCode(LoginVxCodeParam param, UserData userData, HttpServletRequest request) {
+        log.error("登录请求参数 , param : {}, userData : {}", JsonUtil.toString(param), JsonUtil.toString(userData));
         //验证登录ip是否封禁
         if (ipBanService.checkIpBan(userData)) {
             return ResultVO.fail(HttpStatusEnum.IP_HALT.getMsg());

+ 64 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/MsgSceneCheckServiceImpl.java

@@ -0,0 +1,64 @@
+package com.zanxiang.game.module.sdk.service.impl;
+
+import com.zanxiang.game.module.mybatis.entity.User;
+import com.zanxiang.game.module.sdk.pojo.dto.GameAppletDTO;
+import com.zanxiang.game.module.sdk.pojo.param.MsgSceneCheckParam;
+import com.zanxiang.game.module.sdk.pojo.param.UserData;
+import com.zanxiang.game.module.sdk.service.IGameAppletService;
+import com.zanxiang.game.module.sdk.service.IMsgSceneCheckService;
+import com.zanxiang.game.module.sdk.service.IUserService;
+import com.zanxiang.game.module.sdk.service.api.WxApiService;
+import com.zanxiang.module.util.JsonUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.UriComponentsBuilder;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-11-13
+ * @description : 小程序安全检测
+ */
+@Slf4j
+@Service
+public class MsgSceneCheckServiceImpl implements IMsgSceneCheckService {
+
+    @Autowired
+    private WxApiService wxApiService;
+
+    @Autowired
+    private IGameAppletService gameAppletService;
+
+    @Autowired
+    private IUserService userService;
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    @Override
+    public String msgCheck(MsgSceneCheckParam param, UserData userData) {
+        User user = userService.getById(userData.getUserId());
+        GameAppletDTO gameAppletDTO = gameAppletService.getByGameId(userData.getGameId());
+        String accessToken = wxApiService.getAccessToken(gameAppletDTO.getAppId(), gameAppletDTO.getAppSecret());
+        Map<String, Object> paramMap = new HashMap<>(4);
+        paramMap.put("content", param.getContent());
+        paramMap.put("version", 2);
+        paramMap.put("scene", param.getScene());
+        paramMap.put("openid", user.getOpenId());
+        URI uri = UriComponentsBuilder.fromHttpUrl("https://api.weixin.qq.com/wxa/msg_sec_check")
+                .queryParam("access_token", accessToken)
+                .build().toUri();
+        String result = null;
+        try {
+            result = restTemplate.postForObject(uri, paramMap, String.class);
+        } catch (Exception e) {
+            log.error("消息检测腾讯接口异常, param : {}, userData : {}", JsonUtil.toString(param), JsonUtil.toString(userData));
+        }
+        return result;
+    }
+}