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

feat(business): 增加比赛盲注级别查询功能并优化手牌历史查询

- 新增根据比赛 ID 查询盲注级别的接口和相关方法
- 优化手牌历史查询,增加盲注级别和人数信息
- 添加 HandJsonVo 类用于解析手牌详情- 更新 HandHistoryVo 类,增加盲注级别和人数相关字段
fugui001 4 сар өмнө
parent
commit
61dc5a8cb4

+ 7 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/controller/BlindLevelsController.java

@@ -162,4 +162,11 @@ public class BlindLevelsController extends BaseController {
     }
 
 
+    @GetMapping("/selectBlindLevelsByTournament/{tournamentId}")
+    public R<List<BlindLevelsVo>> selectBlindLevelsByTournament(@NotNull(message = "比赛不能为空")
+                                                        @PathVariable Long tournamentId) {
+        return R.ok(blindLevelsService.selectBlindLevelsByTournament(tournamentId));
+    }
+
+
 }

+ 6 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/bo/HandHistoryBo.java

@@ -93,4 +93,10 @@ public class HandHistoryBo extends BaseEntity {
 
     private String playerNameOrId;
 
+    private String endLateRegistrationLevel;
+
+    private String startLateRegistrationLevel;
+
+    private Long blindStructureId;
+
 }

+ 24 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/vo/HandHistoryVo.java

@@ -112,5 +112,29 @@ public class HandHistoryVo implements Serializable {
      */
     private Long tableId;
 
+    /**
+     * 盲注结构
+     */
+    private Long blindStructureId;
+
+
+    /**
+     * 盲注级别
+     */
+    private Long blindLevel;
+
+    /**
+     * 盲注级别拼装
+     */
+    private String blindLevelIds;
+
+    /**
+     * 开始人数信息
+     */
+    private String beginPeopleIds;
+    /**
+     * 结束人数信息
+     */
+    private String endPeopleIds;
 
 }

+ 41 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/vo/HandJsonVo.java

@@ -0,0 +1,41 @@
+package org.dromara.business.domain.vo;
+
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import cn.idev.excel.annotation.ExcelProperty;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import org.dromara.business.domain.Items;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 道具视图对象 items
+ *
+ * @author Lion Li
+ * @date 2025-06-26
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = Items.class)
+public class HandJsonVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+
+    private Long handAfterTotal;
+
+
+    private Long handAfterRemain;
+
+
+    private Long handBeforeTotal;
+
+
+    private Long handBeforeRemain;
+
+
+}

+ 5 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/BlindLevelsMapper.java

@@ -46,5 +46,10 @@ public interface BlindLevelsMapper extends BaseMapperPlus<BlindLevels, BlindLeve
     @InterceptorIgnore(tenantLine = "true")
     List<BlindLevelsVo> selectBlindLevelsById(Long blindStructureId);
 
+    @InterceptorIgnore(tenantLine = "true")
+    List<BlindLevelsVo> selectBlindLevelsByTournament(Long tournamentId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    BlindLevelsVo selectBlindLevelsInfo(Long blindStructureId, Long blindLevel);
 
 }

+ 4 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/HandHistoryMapper.java

@@ -19,7 +19,10 @@ import java.util.List;
 public interface HandHistoryMapper extends BaseMapperPlus<HandHistory, HandHistoryVo> {
 
      @InterceptorIgnore(tenantLine = "true")
-     HandHistoryVo selectAllHandHistory(@Param("tournamentId") Long tournamentId,@Param("historyId") Long historyId,@Param("handId") String handId);
+     HandHistoryVo selectAllHandHistory(@Param("tournamentId") Long tournamentId,
+                                        @Param("historyId") Long historyId,@Param("handId") String handId,
+                                        @Param("blindStructureId") Long blindStructureId,
+                                        @Param("startLateRegistrationLevel") String startLateRegistrationLevel,@Param("endLateRegistrationLevel") String endLateRegistrationLevel);
 
      @InterceptorIgnore(tenantLine = "true")
      List<HandHistoryVo> selectAllHandZhuoCi(@Param("tournamentId") Long tournamentId,@Param("playerId") Long playerId);

+ 4 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/IBlindLevelsService.java

@@ -80,4 +80,8 @@ public interface IBlindLevelsService {
     List<BlindLevelsVo> selectBlindLevelsById(Long blindStructureId);
 
 
+    List<BlindLevelsVo> selectBlindLevelsByTournament(Long tournamentId);
+
+
+
 }

+ 5 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/impl/BlindLevelsServiceImpl.java

@@ -146,4 +146,9 @@ public class BlindLevelsServiceImpl implements IBlindLevelsService {
         return baseMapper.selectBlindLevelsById(blindStructureId);
     }
 
+    @Override
+    public List<BlindLevelsVo> selectBlindLevelsByTournament(Long tournamentId) {
+        return baseMapper.selectBlindLevelsByTournament(tournamentId);
+    }
+
 }

+ 24 - 6
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/impl/HandHistoryServiceImpl.java

@@ -4,9 +4,8 @@ import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.dromara.business.domain.HandHistory;
 import org.dromara.business.domain.bo.HandHistoryBo;
-import org.dromara.business.domain.vo.ActionVo;
-import org.dromara.business.domain.vo.HandHistoryVo;
-import org.dromara.business.domain.vo.UserVo;
+import org.dromara.business.domain.vo.*;
+import org.dromara.business.mapper.BlindLevelsMapper;
 import org.dromara.business.mapper.HandHistoryMapper;
 import org.dromara.business.mapper.UserMapper;
 import org.dromara.business.service.IHandHistoryService;
@@ -46,6 +45,8 @@ public class HandHistoryServiceImpl implements IHandHistoryService {
 
     private final UserMapper userMapper;
 
+    private final BlindLevelsMapper blindLevelsMapper;
+
     /**
      * 查询【请填写功能名称】
      *
@@ -160,23 +161,40 @@ public class HandHistoryServiceImpl implements IHandHistoryService {
        /* if(bo.getHistoryId()==null || StringUtils.isEmpty(bo.getHandId())){
             return TableDataInfo.build();
         }*/
-        HandHistoryVo handHistoryVo = baseMapper.selectAllHandHistory(bo.getTournamentId(), bo.getHistoryId(),bo.getHandId());
+        HandHistoryVo handHistoryVo = baseMapper.selectAllHandHistory(bo.getTournamentId(), bo.getHistoryId(),bo.getHandId(),bo.getBlindStructureId(),bo.getStartLateRegistrationLevel(),bo.getEndLateRegistrationLevel());
         if(handHistoryVo!=null){
+            String levelIds="";
+            BlindLevelsVo blindLevelsVos = blindLevelsMapper.selectBlindLevelsInfo(handHistoryVo.getBlindStructureId(),handHistoryVo.getBlindLevel());
+            if(blindLevelsVos!=null){
+                int bigBlind = blindLevelsVos.getBigBlind().intValue();
+                int smallBlind = blindLevelsVos.getSmallBlind().intValue();
+                Long ante = blindLevelsVos.getAnte();
+                Long blindLevel = handHistoryVo.getBlindLevel();
+                levelIds= blindLevel+" "+smallBlind+"/"+bigBlind+"("+ante+")";
+            }
             //过程操作记录
             String handDetails = handHistoryVo.getHandDetails();
             try {
                 List<String> actionsToChineseList = ActionParserUtils.parseActionsToChineseList(handDetails);
+                HandJsonVo parseGameDetail = ActionParserUtils.parseGameDetail(handDetails);
                 List<HandHistoryVo> handHistoryVoList=new ArrayList<>();
                 for (String s : actionsToChineseList) {
                     HandHistoryVo handHistoryVo1 = new HandHistoryVo();
                     handHistoryVo1.setOperateText(s);
-
+                    handHistoryVo1.setHandStartTime(handHistoryVo.getHandStartTime());
+                    handHistoryVo1.setHandEndTime(handHistoryVo.getHandEndTime());
+                    handHistoryVo1.setBlindLevel(handHistoryVo.getBlindLevel());
+                    handHistoryVo1.setBlindLevelIds(levelIds);
                     List<String> parseBoardCards = PokerCardParserUtils.parseBoardCards(handHistoryVo.getBoardCards());
                     if(parseBoardCards.size()>0){
                         String result = parseBoardCards.stream().collect(Collectors.joining(" "));
                         handHistoryVo1.setPublicBrand(result);
                     }
-                   /* String parseBlindsInfo = ActionParserUtils.parseBlindsInfo(handDetails);
+                    if(parseGameDetail!=null){
+                        handHistoryVo1.setEndPeopleIds(parseGameDetail.getHandAfterRemain()+"/"+parseGameDetail.getHandAfterTotal());
+                        handHistoryVo1.setBeginPeopleIds(parseGameDetail.getHandBeforeRemain()+"/"+parseGameDetail.getHandBeforeTotal());
+                    }
+                    /* String parseBlindsInfo = ActionParserUtils.parseBlindsInfo(handDetails);
                     handHistoryVo1.setParseBlindsInfo(parseBlindsInfo);*/
                     handHistoryVoList.add(handHistoryVo1);
                 }

+ 14 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/utils/ActionParserUtils.java

@@ -2,6 +2,7 @@ package org.dromara.business.utils;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import org.dromara.business.domain.vo.HandJsonVo;
 
 import java.util.*;
 
@@ -228,4 +229,17 @@ public class ActionParserUtils {
     }
 
 
+
+
+    public static HandJsonVo parseGameDetail(String json) throws Exception {
+        ObjectMapper mapper = new ObjectMapper();
+        JsonNode rootNode = mapper.readTree(json);
+        // 获取gameDetail节点
+        JsonNode gameDetailNode = rootNode.get("gameDetail");
+
+        // 将gameDetail节点映射到GameDetail对象
+        return mapper.treeToValue(gameDetailNode, HandJsonVo.class);
+
+    }
+
 }

+ 8 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/BlindLevelsMapper.xml

@@ -154,4 +154,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             blind_levels WHERE blind_structure_id =  #{blindStructureId}
     </select>
 
+    <select id="selectBlindLevelsByTournament" resultType="org.dromara.business.domain.vo.BlindLevelsVo">
+        select * from blind_levels where blind_structure_id = (select blind_structure_id from tournament_blind_structures where tournament_id = #{tournamentId})
+    </select>
+
+    <select id="selectBlindLevelsInfo" resultType="org.dromara.business.domain.vo.BlindLevelsVo">
+        select * from blind_levels where blind_structure_id = #{blindStructureId} and level_number = #{blindLevel}
+    </select>
+
 </mapper>

+ 16 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/HandHistoryMapper.xml

@@ -17,7 +17,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             hand_start_time,
             hand_end_time,
             hand_details,
-            created_at
+            created_at,
+            blind_level,
+            table_id,
+            blind_structure_id
         FROM hand_history
         WHERE 1=1
         <if test="tournamentId != null and tournamentId != ''">
@@ -29,6 +32,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="handId != null and handId != ''">
             AND hand_id = #{handId}
         </if>
+        <if test="blindStructureId != null and blindStructureId != ''">
+            AND blind_structure_id = #{blindStructureId}
+        </if>
+
+        <!-- 可选:如果只想查某个等级以上或以下 -->
+        <if test="startLateRegistrationLevel != null">
+            AND blind_level &gt;= #{startLateRegistrationLevel}
+        </if>
+        <if test="endLateRegistrationLevel != null">
+            AND blind_level &lt;= #{endLateRegistrationLevel}
+        </if>
+
     </select>