Преглед изворни кода

feat(physical): 添加赛事最初开始时间字段

- 在 PhysicalTournamentRuntime 实体类中新增 tournamentBeginTime 字段
- 更新数据库映射文件中的 INSERT、UPDATE 和 SELECT 语句
- 在 PhysicalTournamentRuntimeVo 视图对象中添加对应字段
- 在 TournamentTask 定时任务中设置赛事开始时间
- 为定时任务方法添加监控注释说明
fugui001 пре 2 недеља
родитељ
комит
5c764d0800

+ 3 - 3
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/job/business/TournamentTask.java

@@ -64,8 +64,7 @@ public class TournamentTask {
             LocalDateTime startTime = tournament.getStartTime().toInstant()
                 .atZone(java.time.ZoneId.systemDefault())
                 .toLocalDateTime();
-
-             // 比较时间 当前比赛时间是 十一点开始  十一点十分在来跑到这个job  比赛则不能开始了
+            // 比较时间 当前比赛时间是 十一点开始  十一点十分在来跑到这个job  比赛则不能开始了
             if (startTime.equals(LocalDateTime.now().withSecond(0).withNano(0))) {
                 //操作级别历史记录
                 PhysicalTournamentLevelHistory history=new PhysicalTournamentLevelHistory();
@@ -76,6 +75,7 @@ public class TournamentTask {
                 physicalTournamentRuntime.setCurrentLevelStartTime(new Date());
                 physicalTournamentRuntime.setLastLevelSwitchTime(new Date());
                 physicalTournamentRuntime.setPauseStatus(0L);
+                physicalTournamentRuntime.setTournamentBeginTime(new Date());
                 if(tournamentBlindStructuresVo!=null){
                     List<PhysicalBlindLevelsVo> physicalBlindLevelsVoList = physicalBlindLevelsMapper.selectPhysicalBlindLevelsInfoObj(tournamentBlindStructuresVo.getBlindStructureId());
                     if(physicalBlindLevelsVoList!=null && physicalBlindLevelsVoList.size()>0){
@@ -128,6 +128,7 @@ public class TournamentTask {
      */
     @Scheduled(fixedRate = 5000)
     public void generateTournamentUpdateLevelAndStatusMaxNewTask() {
+        // todo 监控当前赛事是否到达指定级别的截止时间 到了则进行状态记录  是否需要增加字段  是否截止报名记录
        List<PhysicalTournamentRuntimeVo> physicalTournamentRuntimeVoList = physicalTournamentRuntimeMapper.selectPhysicalTournamentRuntimeAllList("ONGOING");
        for (PhysicalTournamentRuntimeVo runtime : physicalTournamentRuntimeVoList) {
         // 跳过暂停赛事
@@ -135,7 +136,6 @@ public class TournamentTask {
            Long currentLevelId = runtime.getCurrentLevelId();
            PhysicalBlindLevelsVo currentLevel = physicalBlindLevelsMapper.selectPhysicalBlindLevelById(currentLevelId);
            if(currentLevel!= null){
-
                 PhysicalTournamentLevelAdjustmentVo adjustment=physicalTournamentLevelAdjustmentMapper.findByTournamentIdAndLevelId(runtime.getTournamentId(),runtime.getCurrentLevelId());
                 Long effectiveDurationMinutes;
                     if (adjustment != null) {

+ 5 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/physical/domain/PhysicalTournamentRuntime.java

@@ -69,5 +69,10 @@ public class PhysicalTournamentRuntime extends BaseEntity {
      */
     private Date updatedAt;
 
+    /**
+     * 赛事最初开始时间
+     */
+    private Date tournamentBeginTime;
+
 
 }

+ 7 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/physical/domain/vo/PhysicalTournamentRuntimeVo.java

@@ -88,4 +88,11 @@ public class PhysicalTournamentRuntimeVo implements Serializable {
     private Date updatedAt;
 
 
+
+    /**
+     * 赛事最初开始时间
+     */
+    private Date tournamentBeginTime;
+
+
 }

+ 15 - 6
ruoyi-modules/ruoyi-system/src/main/resources/mapper/physical/PhysicalTournamentRuntimeMapper.xml

@@ -13,7 +13,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             pause_status,
             pause_start_time,
             status,
-            last_level_switch_time
+            last_level_switch_time,
+            tournament_begin_time
         ) VALUES (
             #{tournamentId},
             #{currentLevelId},
@@ -21,7 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{pauseStatus},
             #{pauseStartTime},
             #{status},
-            #{lastLevelSwitchTime}
+            #{lastLevelSwitchTime},
+            #{tournamentBeginTime}
         )
     </insert>
 
@@ -44,6 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null">
                 status = #{status, jdbcType=VARCHAR},
             </if>
+            <if test="status != null">
+                tournament_begin_time = #{tournamentBeginTime},
+            </if>
             <if test="lastLevelSwitchTime != null">
                 last_level_switch_time = #{lastLevelSwitchTime, jdbcType=TIMESTAMP},
             </if>
@@ -76,7 +81,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             status,
             last_level_switch_time,
             created_at,
-            updated_at
+            updated_at,
+            tournament_begin_time
         FROM physical_tournament_runtime
         WHERE tournament_id = #{tournamentId, jdbcType=INTEGER}
         AND tournament_id IS NOT NULL <!-- 确保ID非空 -->
@@ -95,7 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             status,
             last_level_switch_time,
             created_at,
-            updated_at
+            updated_at,
+            tournament_begin_time
         FROM physical_tournament_runtime  ${ew.customSqlSegment}
     </select>
 
@@ -110,7 +117,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             status,
             last_level_switch_time,
             created_at,
-            updated_at
+            updated_at,
+            tournament_begin_time
         FROM physical_tournament_runtime  ${ew.customSqlSegment}
     </select>
 
@@ -129,7 +137,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             status,
             last_level_switch_time,
             created_at,
-            updated_at
+            updated_at,
+            tournament_begin_time
         FROM physical_tournament_runtime
         WHERE
         tournament_id IS NOT NULL