Przeglądaj źródła

refactor(game-event): 重构赛事实体和裁判端功能

- 移除 GameAppEvent 的继承关系,改为实现 Serializable 接口
- 简化 GameAppEvent 实体类字段,移除多余属性保留核心字段
- 在 GameEventMapper 中新增裁判端赛事列表查询方法
- 更新手持端项目规则判断逻辑,调整计分规则显示方式
- 优化裁判端赛事列表获取服务,直接调用 Mapper 查询减少转换步骤
- 移除冗余的字典类型查询,修改排名数据显示格式为中括号包围
zhou 1 tydzień temu
rodzic
commit
680c6c9fae

+ 6 - 73
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/domain/GameAppEvent.java

@@ -1,14 +1,9 @@
 package org.dromara.system.domain;
 package org.dromara.system.domain;
 
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.dromara.common.tenant.core.TenantEntity;
 
 
 import java.io.Serial;
 import java.io.Serial;
+import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 
 
 /**
 /**
@@ -18,8 +13,7 @@ import java.util.Date;
  * @date 2025-07-30
  * @date 2025-07-30
  */
  */
 @Data
 @Data
-@EqualsAndHashCode(callSuper = true)
-public class GameAppEvent extends TenantEntity {
+public class GameAppEvent implements Serializable {
 
 
     @Serial
     @Serial
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
@@ -40,75 +34,14 @@ public class GameAppEvent extends TenantEntity {
     private String name;
     private String name;
 
 
     /**
     /**
-     * 赛事类型
+     * 创建时间
      */
      */
-    private String eventType;
+    private Date createTime;
 
 
     /**
     /**
-     * 举办地点
+     * 上传成绩路径
      */
      */
-    private String location;
-
-    /**
-     * 用途
-     */
-    private String purpose;
-
-    /**
-     * 开始时间
-     */
-    private Date startTime;
-
-    /**
-     * 结束时间
-     */
-    private Date endTime;
-
-    /**
-     * 每人限报项目数
-     */
-    private Integer limitApplication;
-
-    /**
-     * 赛事链接
-     */
-    private String eventUrl;
-
-    /**
-     * 裁判码
-     */
-    private String refereeUrl;
-
-    /**
-     * 签到码
-     */
-    private String registerUrl;
-
-    /**
-     * 举办单位
-     */
-    private String unit;
-
-    /**
-     * 是否默认赛事
-     */
-    private String isDefault;
-
-    /**
-     * 状态(0正常 1停用)
-     */
-    private String status;
-
-    /**
-     * 删除标志(0代表存在 1代表删除)
-     */
-    @TableLogic
-    private String delFlag;
-
-    /**
-     * 备注
-     */
-    private String remark;
+    private String ServerUrl;
 
 
 
 
 }
 }

+ 11 - 2
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/mapper/GameEventMapper.java

@@ -1,12 +1,12 @@
 package org.dromara.system.mapper;
 package org.dromara.system.mapper;
 
 
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.dromara.common.mybatis.annotation.DataColumn;
 import org.dromara.common.mybatis.annotation.DataColumn;
 import org.dromara.common.mybatis.annotation.DataPermission;
 import org.dromara.common.mybatis.annotation.DataPermission;
+import org.dromara.system.domain.GameAppEvent;
 import org.dromara.system.domain.GameEvent;
 import org.dromara.system.domain.GameEvent;
 import org.dromara.system.domain.vo.GameEventVo;
 import org.dromara.system.domain.vo.GameEventVo;
 import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
 import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
@@ -51,4 +51,13 @@ public interface GameEventMapper extends BaseMapperPlus<GameEvent, GameEventVo>
        return this.selectVoList(queryWrapper);
        return this.selectVoList(queryWrapper);
    }
    }
 
 
+   /**
+    * 手持端获取该裁判负责的赛事列表
+     */
+   @Select("SELECT e.event_id as id,e.event_code as bianhao,e.event_name as name,e.create_time,ec.config_value as ServerUrl " +
+       "FROM game_event e " +
+       "left join game_event_config ec on ec.event_id = e.event_id " +
+       "WHERE e.event_id in (select event_id from game_referee where referee_id = #{refereeId}) and e.del_flag = '0' " +
+       "and ec.config_key = 'upload_path' ")
+    List<GameAppEvent> selectRefereeEventList(Long refereeId);
 }
 }

+ 3 - 14
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/app/ToClientServiceImpl.java

@@ -195,18 +195,7 @@ public class ToClientServiceImpl implements IToClientService {
      */
      */
     @Override
     @Override
     public List<GameAppEvent> getEventList(Long refereeId) {
     public List<GameAppEvent> getEventList(Long refereeId) {
-        List<GameEvent> res = gameEventMapper.selectList(Wrappers.lambdaQuery(GameEvent.class)
-                .orderByDesc(GameEvent::getCreateTime)
-                .apply("event_id in (select event_id from game_referee where referee_id = {0})", refereeId)
-                .select(GameEvent::getEventId, GameEvent::getEventCode, GameEvent::getEventName,
-                        GameEvent::getCreateTime));
-        return res.isEmpty() ? new ArrayList<>() : res.stream().map(e -> {
-            GameAppEvent appEvent = BeanUtil.copyProperties(e, GameAppEvent.class);
-            appEvent.setId(e.getEventId());
-            appEvent.setBianhao(e.getEventCode());
-            appEvent.setName(e.getEventName());
-            return appEvent;
-        }).toList();
+        return gameEventMapper.selectRefereeEventList(refereeId);
     }
     }
 
 
     /**
     /**
@@ -260,12 +249,12 @@ public class ToClientServiceImpl implements IToClientService {
 
 
         // 批量查询字典数据,避免多次调用 Redis/MySQL 交互
         // 批量查询字典数据,避免多次调用 Redis/MySQL 交互
         Map<String, List<SysDictDataVo>> dictMap = dictService.selectDictDataByTypes(List.of(
         Map<String, List<SysDictDataVo>> dictMap = dictService.selectDictDataByTypes(List.of(
-                "game_project_type", "game_score_type", "game_order_type",
+                "game_project_type", "game_score_type",
                 "sys_group_sex", "game_stage", "game_round"));
                 "sys_group_sex", "game_stage", "game_round"));
 
 
         vo.setType(getDictLabelFromMap(dictMap, "game_project_type", vo.getType()));
         vo.setType(getDictLabelFromMap(dictMap, "game_project_type", vo.getType()));
         vo.setChengjiType(getDictLabelFromMap(dictMap, "game_score_type", vo.getChengjiType()));
         vo.setChengjiType(getDictLabelFromMap(dictMap, "game_score_type", vo.getChengjiType()));
-        vo.setPaiMing(getDictLabelFromMap(dictMap, "game_order_type", vo.getPaiMing()));
+        vo.setPaiMing(String.format("[%s]", vo.getPaiMing()));
         vo.setSex(getDictLabelFromMap(dictMap, "sys_group_sex", vo.getSex()));
         vo.setSex(getDictLabelFromMap(dictMap, "sys_group_sex", vo.getSex()));
         vo.setJieduan(getDictLabelFromMap(dictMap, "game_stage", vo.getJieduan()));
         vo.setJieduan(getDictLabelFromMap(dictMap, "game_stage", vo.getJieduan()));
         vo.setLunci(getDictLabelFromMap(dictMap, "game_round", vo.getLunci()));
         vo.setLunci(getDictLabelFromMap(dictMap, "game_round", vo.getLunci()));

+ 1 - 1
ruoyi-modules/ruoyi-game-event/src/main/resources/mapper/system/app/ToClientMapper.xml

@@ -22,7 +22,7 @@
                     AND (JSON_CONTAINS(p.referee_group, JSON_ARRAY(referee_id))
                     AND (JSON_CONTAINS(p.referee_group, JSON_ARRAY(referee_id))
                              OR JSON_CONTAINS(p.referee_group, JSON_ARRAY(CAST(referee_id AS CHAR))))
                              OR JSON_CONTAINS(p.referee_group, JSON_ARRAY(CAST(referee_id AS CHAR))))
             ) as caipan,
             ) as caipan,
-            (CASE WHEN p.timing_format IS NOT NULL THEN p.timing_format ELSE p.count_unit END) as guize,
+            (CASE WHEN p.score_rule in ('3', '4') THEN p.count_unit ELSE p.timing_format END) as guize,
             (SELECT config_value FROM game_event_config WHERE event_id = p.event_id
             (SELECT config_value FROM game_event_config WHERE event_id = p.event_id
                                                           AND config_key = 'event_tip' AND del_flag = '0' LIMIT 1) as eventTip,
                                                           AND config_key = 'event_tip' AND del_flag = '0' LIMIT 1) as eventTip,
             IFNULL((SELECT COUNT(DISTINCT a.athlete_id) FROM game_athlete a
             IFNULL((SELECT COUNT(DISTINCT a.athlete_id) FROM game_athlete a