Эх сурвалжийг харах

fix(game-event): 修复默认赛事 ID 类型转换问题

- 在多个服务实现类中,修复了从 Redis 获取默认赛事 ID 时的类型转换逻辑
-增加了对 Integer 和 Long 类型的判断和处理,确保正确转换为 Long 类型
-涉及到的类包括 GameAthleteServiceImpl、GameEventConfigServiceImpl、GameEventGroupServiceImpl 等多个服务实现类
zhou 2 долоо хоног өмнө
parent
commit
feffde579e

+ 1 - 10
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/controller/GameAthleteController.java

@@ -83,7 +83,7 @@ public class GameAthleteController extends BaseController {
         ExcelResult<GameAthleteVo> excelResult = null;
         try {
             // 从redis中获取默认参赛赛事
-            Long defaultEventId = Long.valueOf(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID_KEY).toString());
+            Long defaultEventId = Long.valueOf(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID).toString());
             excelResult = ExcelUtil.importExcel(file.getInputStream(), GameAthleteVo.class, true);
             List<GameAthlete> list = MapstructUtils.convert(excelResult.getList(), GameAthlete.class);
             Long finalDefaultEventId = defaultEventId;
@@ -167,13 +167,4 @@ public class GameAthleteController extends BaseController {
         return toAjax(gameAthleteService.deleteWithValidByIds(List.of(athleteIds), true));
     }
 
-
-    public static void main(String[] args) {
-        List<String> strings = List.of("1", "2", "3");
-        String str = JSONUtil.toJsonStr(strings);
-        System.out.println(str);
-        String s="["1","2","3"]"
-        List<String> list = JSONUtil.toList(str, String.class);
-        System.out.println(list);
-    }
 }

+ 28 - 8
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameAthleteServiceImpl.java

@@ -151,8 +151,13 @@ public class GameAthleteServiceImpl implements IGameAthleteService {
      */
     @Override
     public TableDataInfo<GameAthleteVo> queryPageList(GameAthleteBo bo, PageQuery pageQuery) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameAthlete> lqw = buildQueryWrapper(bo);
         Page<GameAthleteVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
@@ -191,8 +196,13 @@ public class GameAthleteServiceImpl implements IGameAthleteService {
      */
     @Override
     public List<GameAthleteVo> queryList(GameAthleteBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameAthlete> lqw = buildQueryWrapper(bo);
         return baseMapper.selectVoList(lqw);
@@ -253,8 +263,13 @@ public class GameAthleteServiceImpl implements IGameAthleteService {
      */
     @Override
     public Boolean insertByBo(GameAthleteBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameAthlete add = MapstructUtils.convert(bo, GameAthlete.class);
         validEntityBeforeSave(add);
@@ -273,8 +288,13 @@ public class GameAthleteServiceImpl implements IGameAthleteService {
      */
     @Override
     public Boolean updateByBo(GameAthleteBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameAthlete update = MapstructUtils.convert(bo, GameAthlete.class);
         validEntityBeforeSave(update);

+ 28 - 8
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameEventConfigServiceImpl.java

@@ -55,8 +55,13 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
      */
     @Override
     public TableDataInfo<GameEventConfigVo> queryPageList(GameEventConfigBo bo, PageQuery pageQuery) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameEventConfig> lqw = buildQueryWrapper(bo);
         Page<GameEventConfigVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
@@ -71,8 +76,13 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
      */
     @Override
     public List<GameEventConfigVo> queryList(GameEventConfigBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameEventConfig> lqw = buildQueryWrapper(bo);
         return baseMapper.selectVoList(lqw);
@@ -98,8 +108,13 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
      */
     @Override
     public Boolean insertByBo(GameEventConfigBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameEventConfig add = MapstructUtils.convert(bo, GameEventConfig.class);
         validEntityBeforeSave(add);
@@ -118,8 +133,13 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
      */
     @Override
     public Boolean updateByBo(GameEventConfigBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameEventConfig update = MapstructUtils.convert(bo, GameEventConfig.class);
         validEntityBeforeSave(update);

+ 28 - 8
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameEventGroupServiceImpl.java

@@ -61,8 +61,13 @@ public class GameEventGroupServiceImpl implements IGameEventGroupService {
      */
     @Override
     public TableDataInfo<GameEventGroupVo> queryPageList(GameEventGroupBo bo, PageQuery pageQuery) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameEventGroup> lqw = buildQueryWrapper(bo);
         Page<GameEventGroupVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
@@ -95,8 +100,13 @@ public class GameEventGroupServiceImpl implements IGameEventGroupService {
      */
     @Override
     public List<GameEventGroupVo> queryList(GameEventGroupBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameEventGroup> lqw = buildQueryWrapper(bo);
         return baseMapper.selectVoList(lqw);
@@ -124,8 +134,13 @@ public class GameEventGroupServiceImpl implements IGameEventGroupService {
      */
     @Override
     public Boolean insertByBo(GameEventGroupBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameEventGroup add = MapstructUtils.convert(bo, GameEventGroup.class);
         validEntityBeforeSave(add);
@@ -144,8 +159,13 @@ public class GameEventGroupServiceImpl implements IGameEventGroupService {
      */
     @Override
     public Boolean updateByBo(GameEventGroupBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameEventGroup update = MapstructUtils.convert(bo, GameEventGroup.class);
         validEntityBeforeSave(update);

+ 28 - 8
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameEventMenuServiceImpl.java

@@ -55,8 +55,13 @@ public class GameEventMenuServiceImpl implements IGameEventMenuService {
      */
     @Override
     public TableDataInfo<GameEventMenuVo> queryPageList(GameEventMenuBo bo, PageQuery pageQuery) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameEventMenu> lqw = buildQueryWrapper(bo);
         Page<GameEventMenuVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
@@ -71,8 +76,13 @@ public class GameEventMenuServiceImpl implements IGameEventMenuService {
      */
     @Override
     public List<GameEventMenuVo> queryList(GameEventMenuBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameEventMenu> lqw = buildQueryWrapper(bo);
         return baseMapper.selectVoList(lqw);
@@ -95,8 +105,13 @@ public class GameEventMenuServiceImpl implements IGameEventMenuService {
      */
     @Override
     public Boolean insertByBo(GameEventMenuBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameEventMenu add = MapstructUtils.convert(bo, GameEventMenu.class);
         validEntityBeforeSave(add);
@@ -115,8 +130,13 @@ public class GameEventMenuServiceImpl implements IGameEventMenuService {
      */
     @Override
     public Boolean updateByBo(GameEventMenuBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameEventMenu update = MapstructUtils.convert(bo, GameEventMenu.class);
         validEntityBeforeSave(update);

+ 7 - 2
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameEventProjectServiceImpl.java

@@ -66,8 +66,13 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
      */
     @Override
     public TableDataInfo<GameEventProjectVo> queryPageList(GameEventProjectBo bo, PageQuery pageQuery) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameEventProject> lqw = buildQueryWrapper(bo);
         Page<GameEventProjectVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);

+ 21 - 6
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameEventServiceImpl.java

@@ -73,8 +73,13 @@ public class GameEventServiceImpl implements IGameEventService {
      */
     @Override
     public List<GameEventVo> queryList(GameEventBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameEvent> lqw = buildQueryWrapper(bo);
         return baseMapper.selectVoList(lqw);
@@ -102,8 +107,13 @@ public class GameEventServiceImpl implements IGameEventService {
      */
     @Override
     public Long insertByBo(GameEventBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameEvent add = MapstructUtils.convert(bo, GameEvent.class);
         validEntityBeforeSave(add);
@@ -122,8 +132,13 @@ public class GameEventServiceImpl implements IGameEventService {
      */
     @Override
     public Boolean updateByBo(GameEventBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameEvent update = MapstructUtils.convert(bo, GameEvent.class);
         validEntityBeforeSave(update);

+ 29 - 8
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameRefereeServiceImpl.java

@@ -11,6 +11,7 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.dromara.common.redis.utils.RedisUtils;
 import org.dromara.system.domain.constant.GameEventConstant;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.stereotype.Service;
 import org.dromara.system.domain.bo.GameRefereeBo;
 import org.dromara.system.domain.vo.GameRefereeVo;
@@ -55,8 +56,13 @@ public class GameRefereeServiceImpl implements IGameRefereeService {
      */
     @Override
     public TableDataInfo<GameRefereeVo> queryPageList(GameRefereeBo bo, PageQuery pageQuery) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameReferee> lqw = buildQueryWrapper(bo);
         Page<GameRefereeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
@@ -71,8 +77,13 @@ public class GameRefereeServiceImpl implements IGameRefereeService {
      */
     @Override
     public List<GameRefereeVo> queryList(GameRefereeBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameReferee> lqw = buildQueryWrapper(bo);
         return baseMapper.selectVoList(lqw);
@@ -96,8 +107,13 @@ public class GameRefereeServiceImpl implements IGameRefereeService {
      */
     @Override
     public Boolean insertByBo(GameRefereeBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameReferee add = MapstructUtils.convert(bo, GameReferee.class);
         validEntityBeforeSave(add);
@@ -116,8 +132,13 @@ public class GameRefereeServiceImpl implements IGameRefereeService {
      */
     @Override
     public Boolean updateByBo(GameRefereeBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameReferee update = MapstructUtils.convert(bo, GameReferee.class);
         validEntityBeforeSave(update);

+ 28 - 8
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameScoreServiceImpl.java

@@ -55,8 +55,13 @@ public class GameScoreServiceImpl implements IGameScoreService {
      */
     @Override
     public TableDataInfo<GameScoreVo> queryPageList(GameScoreBo bo, PageQuery pageQuery) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameScore> lqw = buildQueryWrapper(bo);
         Page<GameScoreVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
@@ -71,8 +76,13 @@ public class GameScoreServiceImpl implements IGameScoreService {
      */
     @Override
     public List<GameScoreVo> queryList(GameScoreBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameScore> lqw = buildQueryWrapper(bo);
         return baseMapper.selectVoList(lqw);
@@ -99,8 +109,13 @@ public class GameScoreServiceImpl implements IGameScoreService {
      */
     @Override
     public Boolean insertByBo(GameScoreBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameScore add = MapstructUtils.convert(bo, GameScore.class);
         validEntityBeforeSave(add);
@@ -119,8 +134,13 @@ public class GameScoreServiceImpl implements IGameScoreService {
      */
     @Override
     public Boolean updateByBo(GameScoreBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameScore update = MapstructUtils.convert(bo, GameScore.class);
         validEntityBeforeSave(update);

+ 28 - 8
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameTeamServiceImpl.java

@@ -66,8 +66,13 @@ public class GameTeamServiceImpl implements IGameTeamService {
      */
     @Override
     public TableDataInfo<GameTeamVo> queryPageList(GameTeamBo bo, PageQuery pageQuery) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameTeam> lqw = buildQueryWrapper(bo);
         Page<GameTeamVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
@@ -127,8 +132,13 @@ public class GameTeamServiceImpl implements IGameTeamService {
      */
     @Override
     public List<GameTeamVo> queryList(GameTeamBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         LambdaQueryWrapper<GameTeam> lqw = buildQueryWrapper(bo);
         return baseMapper.selectVoList(lqw);
@@ -178,8 +188,13 @@ public class GameTeamServiceImpl implements IGameTeamService {
      */
     @Override
     public Boolean insertByBo(GameTeamBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameTeam add = MapstructUtils.convert(bo, GameTeam.class);
         validEntityBeforeSave(add);
@@ -198,8 +213,13 @@ public class GameTeamServiceImpl implements IGameTeamService {
      */
     @Override
     public Boolean updateByBo(GameTeamBo bo) {
-        if (bo.getEventId() == null){
-            bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
+        if (bo.getEventId() == null) {
+            Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
+            if (cacheObject instanceof Integer) {
+                bo.setEventId(((Integer) cacheObject).longValue());  // 显式转换为 Long 类型
+            } else if (cacheObject instanceof Long) {
+                bo.setEventId((Long) cacheObject);
+            }
         }
         GameTeam update = MapstructUtils.convert(bo, GameTeam.class);
         validEntityBeforeSave(update);