Explorar o código

feat : 生产测试pro

bilingfeng hai 10 meses
pai
achega
38dbd02eb1

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java

@@ -23,7 +23,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 < (生产测试03・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 < (生产测试pro・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 0 - 7
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/PushMsgSendLogServiceImpl.java

@@ -11,7 +11,6 @@ import com.zanxiang.game.module.mybatis.entity.GameUserRole;
 import com.zanxiang.game.module.mybatis.entity.PushMsgSendLog;
 import com.zanxiang.game.module.mybatis.entity.PushMsgSendResult;
 import com.zanxiang.game.module.mybatis.mapper.PushMsgSendLogMapper;
-import com.zanxiang.module.util.JsonUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -58,16 +57,10 @@ public class PushMsgSendLogServiceImpl extends ServiceImpl<PushMsgSendLogMapper,
         //保存发送记录
         PushMsgSendLog pushMsgSendLog = this.transform(msgId, gameId, strategyId, text, gameUserRoleList.size());
         super.save(pushMsgSendLog);
-        log.error("消息推保存日志, gameId : {}, strategyId : {}, text : {}, gameUserRoleList : {}",
-                gameId, strategyId, text, JsonUtil.toString(gameUserRoleList));
         //角色信息按区服分组
         Map<String, List<GameUserRole>> serverIdRoleMap = gameUserRoleList.stream()
                 .collect(Collectors.groupingBy(GameUserRole::getServerId));
         serverIdRoleMap.forEach((serverId, roleList) -> {
-
-            log.error("消息推送单组执行, gameId : {}, strategyId : {}, text : {}, serverId : {}, roleList : {}",
-                    gameId, strategyId, text, serverId, JsonUtil.toString(roleList));
-
             List<String> serverRoleIdList = roleList.stream().map(GameUserRole::getRoleId).collect(Collectors.toList());
             try {
                 CpSendMsgResultDTO result = cpSendMsgLogService.cpSendMsgApi(gameSupper, msgId, serverId, text, serverRoleIdList);

+ 55 - 82
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/PushMsgStrategyServiceImpl.java

@@ -9,7 +9,6 @@ import com.zanxiang.game.module.manage.pojo.dto.UserDTO;
 import com.zanxiang.game.module.manage.service.*;
 import com.zanxiang.game.module.mybatis.entity.*;
 import com.zanxiang.game.module.mybatis.mapper.PushMsgStrategyMapper;
-import com.zanxiang.module.util.JsonUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.logging.log4j.util.Strings;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -60,119 +59,93 @@ public class PushMsgStrategyServiceImpl extends ServiceImpl<PushMsgStrategyMappe
         ) <= 0) {
             return;
         }
-        log.error("消息推送执行策略, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
         //查询玩家
         UserDTO userDTO = userService.getById(param.getUserId());
         //不存在等级策略, 或者玩家为空
         if (userDTO == null) {
-            log.error("消息推送玩家信息为空, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
             return;
         }
-
-        log.error("查询到的用户信息, userDTO : {}", JsonUtil.toString(userDTO));
-
         //判断是否满足策略执行条件
         if (!this.strategyCheck(pushMsgStrategy, param, userDTO)) {
-            log.error("消息推送不满足策略条件, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
             return;
         }
-
-        log.error("策略条件判断完成, 判断通过!!!!");
-
         //查询策略执行角色
         GameUserRole gameUserRole = gameUserRoleService.getOne(new LambdaQueryWrapper<GameUserRole>()
                 .eq(GameUserRole::getGameId, param.getGameId())
                 .eq(GameUserRole::getUserId, param.getUserId())
                 .eq(GameUserRole::getRoleId, param.getRoleId()));
-
-        log.error("查询执行策略的角色, gameUserRole : {}", JsonUtil.toString(gameUserRole));
-
         //查询策略执行文本
         String strategyText = pushMsgTextStrategy.getStrategyText(gameUserRole);
-        log.error("消息推送查询到文本, param : {}, strategyText : {}", JsonUtil.toString(param), strategyText);
         if (Strings.isBlank(strategyText)) {
-            log.error("消息推送文本内容为空, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
             return;
         }
         //执行发送
-        log.error("执行消息推送, param : {}", JsonUtil.toString(param));
         pushMsgSendLogService.pushMsg(param.getGameId(), pushMsgStrategy.getId(), strategyText, Collections.singletonList(gameUserRole));
     }
 
     private boolean strategyCheck(PushMsgStrategy pushMsgStrategy, PushMsgParam param, UserDTO userDTO) {
-        try {
-            //渠道限制不为空, 且不是全渠道
-            if (pushMsgStrategy.getAgentType() != null
-                    && !Objects.equals(pushMsgStrategy.getAgentType(), PushMsgAgentTypeEnum.PUSH_MSG_AGENT_ALL.getValue())) {
-                //只允许自然量
-                if (Objects.equals(pushMsgStrategy.getAgentType(), PushMsgAgentTypeEnum.PUSH_MSG_AGENT_DEFAULT.getValue())
-                        && !Objects.equals(userDTO.getAgentId(), Agent.DEFAULT_AGENT)) {
-                    return Boolean.FALSE;
-                }
-                //只允许非自然量
-                if (Objects.equals(pushMsgStrategy.getAgentType(), PushMsgAgentTypeEnum.PUSH_MSG_AGENT_UN_DEFAULT.getValue())
-                        && Objects.equals(userDTO.getAgentId(), Agent.DEFAULT_AGENT)) {
-                    return Boolean.FALSE;
-                }
-            }
-            log.error("1. 渠道判断结束");
-            //判断注册时间, 是否在最大限制之内
-            if (pushMsgStrategy.getRegDayMax() != null
-                    && userDTO.getCreateTime().plusDays(pushMsgStrategy.getRegDayMax()).isBefore(LocalDateTime.now())) {
+        //渠道限制不为空, 且不是全渠道
+        if (pushMsgStrategy.getAgentType() != null
+                && !Objects.equals(pushMsgStrategy.getAgentType(), PushMsgAgentTypeEnum.PUSH_MSG_AGENT_ALL.getValue())) {
+            //只允许自然量
+            if (Objects.equals(pushMsgStrategy.getAgentType(), PushMsgAgentTypeEnum.PUSH_MSG_AGENT_DEFAULT.getValue())
+                    && !Objects.equals(userDTO.getAgentId(), Agent.DEFAULT_AGENT)) {
                 return Boolean.FALSE;
             }
-            log.error("2. 判断注册时间结束");
-            //首个角色限制
-            if (Objects.equals(pushMsgStrategy.getFirstRoleSwitch(), Boolean.TRUE)) {
-                GameUserRole gameUserRole = gameUserRoleService.getOne(new LambdaQueryWrapper<GameUserRole>()
-                        .eq(GameUserRole::getUserId, param.getUserId())
-                        .eq(GameUserRole::getGameId, param.getGameId())
-                        .orderByAsc(GameUserRole::getCreateTime)
-                        .last("limit 1"));
-                if (gameUserRole == null || !Objects.equals(gameUserRole.getRoleId(), param.getRoleId())) {
-                    return Boolean.FALSE;
-                }
+            //只允许非自然量
+            if (Objects.equals(pushMsgStrategy.getAgentType(), PushMsgAgentTypeEnum.PUSH_MSG_AGENT_UN_DEFAULT.getValue())
+                    && Objects.equals(userDTO.getAgentId(), Agent.DEFAULT_AGENT)) {
+                return Boolean.FALSE;
             }
-            log.error("3. 首个角色限制结束");
-            //判断最小充值金额
-            if (pushMsgStrategy.getRechargeMoneyMin() != null) {
-                GameUserRole gameUserRole = gameUserRoleService.getOne(new LambdaQueryWrapper<GameUserRole>()
-                        .eq(GameUserRole::getUserId, param.getUserId())
-                        .eq(GameUserRole::getGameId, param.getGameId())
-                        .eq(GameUserRole::getRoleId, param.getRoleId()));
-                if (gameUserRole.getRechargeMoney() == null
-                        || gameUserRole.getRechargeMoney().longValue() < pushMsgStrategy.getRechargeMoneyMin()) {
-                    return Boolean.FALSE;
-                }
+        }
+        //判断注册时间, 是否在最大限制之内
+        if (pushMsgStrategy.getRegDayMax() != null
+                && userDTO.getCreateTime().plusDays(pushMsgStrategy.getRegDayMax()).isBefore(LocalDateTime.now())) {
+            return Boolean.FALSE;
+        }
+        //首个角色限制
+        if (Objects.equals(pushMsgStrategy.getFirstRoleSwitch(), Boolean.TRUE)) {
+            GameUserRole gameUserRole = gameUserRoleService.getOne(new LambdaQueryWrapper<GameUserRole>()
+                    .eq(GameUserRole::getUserId, param.getUserId())
+                    .eq(GameUserRole::getGameId, param.getGameId())
+                    .orderByAsc(GameUserRole::getCreateTime)
+                    .last("limit 1"));
+            if (gameUserRole == null || !Objects.equals(gameUserRole.getRoleId(), param.getRoleId())) {
+                return Boolean.FALSE;
             }
-            log.error("4. 首个角色限制结束");
-            //判断是否已加企微
-            if (Objects.equals(pushMsgStrategy.getExcludeAddWechat(), Boolean.TRUE)) {
-                RoleOperate roleOperate = roleOperateService.getOne(new LambdaQueryWrapper<RoleOperate>()
-                        .eq(RoleOperate::getUserId, param.getUserId())
-                        .eq(RoleOperate::getGameId, param.getGameId())
-                        .eq(RoleOperate::getServerId, param.getServerId())
-                        .eq(RoleOperate::getRoleId, param.getRoleId()));
-                if (Objects.equals(roleOperate.getIsAddCorpWechat(), 1)) {
-                    return Boolean.FALSE;
-                }
+        }
+        //判断最小充值金额
+        if (pushMsgStrategy.getRechargeMoneyMin() != null) {
+            GameUserRole gameUserRole = gameUserRoleService.getOne(new LambdaQueryWrapper<GameUserRole>()
+                    .eq(GameUserRole::getUserId, param.getUserId())
+                    .eq(GameUserRole::getGameId, param.getGameId())
+                    .eq(GameUserRole::getRoleId, param.getRoleId()));
+            if (gameUserRole.getRechargeMoney() == null
+                    || gameUserRole.getRechargeMoney().longValue() < pushMsgStrategy.getRechargeMoneyMin()) {
+                return Boolean.FALSE;
             }
-            log.error("5. 首个角色限制结束");
-            //单策略推送次数
-            if (pushMsgStrategy.getSendCountMax() != null && pushMsgSendResultService.count(new LambdaQueryWrapper<PushMsgSendResult>()
-                    .eq(PushMsgSendResult::getGameId, param.getGameId())
-                    .eq(PushMsgSendResult::getStrategyId, pushMsgStrategy.getId())
-                    .eq(PushMsgSendResult::getServerId, param.getServerId())
-                    .eq(PushMsgSendResult::getRoleId, param.getRoleId())
-                    .eq(PushMsgSendResult::getSendStatus, CpSendRoleResultEnum.CP_SEND_ROLE_RESULT_SUCCESS.getValue())
-            ) >= pushMsgStrategy.getSendCountMax()) {
+        }
+        //判断是否已加企微
+        if (Objects.equals(pushMsgStrategy.getExcludeAddWechat(), Boolean.TRUE)) {
+            RoleOperate roleOperate = roleOperateService.getOne(new LambdaQueryWrapper<RoleOperate>()
+                    .eq(RoleOperate::getUserId, param.getUserId())
+                    .eq(RoleOperate::getGameId, param.getGameId())
+                    .eq(RoleOperate::getServerId, param.getServerId())
+                    .eq(RoleOperate::getRoleId, param.getRoleId()));
+            if (roleOperate != null && Objects.equals(roleOperate.getIsAddCorpWechat(), 1)) {
                 return Boolean.FALSE;
             }
-            log.error("6. 单策略推送次数结束");
-            return Boolean.TRUE;
-        } catch (Exception e) {
-            log.error("123, e : {}", e.getMessage(), e);
-            throw new RuntimeException("策略判断出现异常" + e.getMessage());
         }
+        //单策略推送次数
+        if (pushMsgStrategy.getSendCountMax() != null && pushMsgSendResultService.count(new LambdaQueryWrapper<PushMsgSendResult>()
+                .eq(PushMsgSendResult::getGameId, param.getGameId())
+                .eq(PushMsgSendResult::getStrategyId, pushMsgStrategy.getId())
+                .eq(PushMsgSendResult::getServerId, param.getServerId())
+                .eq(PushMsgSendResult::getRoleId, param.getRoleId())
+                .eq(PushMsgSendResult::getSendStatus, CpSendRoleResultEnum.CP_SEND_ROLE_RESULT_SUCCESS.getValue())
+        ) >= pushMsgStrategy.getSendCountMax()) {
+            return Boolean.FALSE;
+        }
+        return Boolean.TRUE;
     }
 }