|
|
@@ -4,7 +4,9 @@ import cn.hutool.json.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
|
|
import org.dromara.business.domain.enums.GameStatus;
|
|
|
+import org.dromara.business.domain.vo.ItemsVo;
|
|
|
import org.dromara.business.domain.vo.TournamentBlindStructuresVo;
|
|
|
+import org.dromara.business.mapper.ItemsMapper;
|
|
|
import org.dromara.business.utils.RedisKeys;
|
|
|
import org.dromara.business.utils.RedisUtil;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
@@ -65,6 +67,8 @@ public class PhysicalTournamentsServiceImpl implements IPhysicalTournamentsServi
|
|
|
|
|
|
private final PhysicalTournamentJudgeMapper physicalTournamentJudgeMapper;;
|
|
|
|
|
|
+ private final ItemsMapper itemsMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
RedisUtil redisUtil;
|
|
|
|
|
|
@@ -83,11 +87,23 @@ public class PhysicalTournamentsServiceImpl implements IPhysicalTournamentsServi
|
|
|
}
|
|
|
Long tournamentId = physicalTournamentsVo.getId();
|
|
|
//赛事报名条件
|
|
|
- PhysicalTournamentEntryConditionsVo tournamentEntryConditionsVo = physicalTournamentEntryConditionsMapper.selectPhysicalConditionsByTournamentId(tournamentId);
|
|
|
+ List<PhysicalTournamentEntryConditionsVo> tournamentEntryConditionsVo = physicalTournamentEntryConditionsMapper.selectPhysicalConditionsByTournamentId(tournamentId);
|
|
|
if(tournamentEntryConditionsVo!=null){
|
|
|
- physicalTournamentsVo.setItemsId(tournamentEntryConditionsVo.getItemId());
|
|
|
+ /*physicalTournamentsVo.setItemsId(tournamentEntryConditionsVo.getItemId());
|
|
|
physicalTournamentsVo.setItemsNum(tournamentEntryConditionsVo.getRequiredQuantity());
|
|
|
- physicalTournamentsVo.setItemsName(tournamentEntryConditionsVo.getItemsName());
|
|
|
+ physicalTournamentsVo.setItemsName(tournamentEntryConditionsVo.getItemsName());*/
|
|
|
+ List<PhysicalItemsPrizeDto> itemsConditionList=new ArrayList<>();
|
|
|
+ for (PhysicalTournamentEntryConditionsVo physicalTournamentEntryConditionsVo : tournamentEntryConditionsVo) {
|
|
|
+ PhysicalItemsPrizeDto itemsPrizeBo = new PhysicalItemsPrizeDto();
|
|
|
+ itemsPrizeBo.setItemId(physicalTournamentEntryConditionsVo.getItemId());
|
|
|
+ itemsPrizeBo.setQuantity(physicalTournamentEntryConditionsVo.getRequiredQuantity());
|
|
|
+ ItemsVo itemsVo = itemsMapper.selectVoByIdInfo(physicalTournamentEntryConditionsVo.getItemId());
|
|
|
+ if(itemsVo!=null){
|
|
|
+ itemsPrizeBo.setItemsName(itemsVo.getName());
|
|
|
+ itemsConditionList.add(itemsPrizeBo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ physicalTournamentsVo.setItemsConditionList(itemsConditionList);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -152,14 +168,21 @@ public class PhysicalTournamentsServiceImpl implements IPhysicalTournamentsServi
|
|
|
|
|
|
Long tournamentId = physicalTournamentsVo.getId();
|
|
|
//赛事报名条件
|
|
|
- PhysicalTournamentEntryConditionsVo tournamentEntryConditionsVo = physicalTournamentEntryConditionsMapper.selectPhysicalConditionsByTournamentId(tournamentId);
|
|
|
+ List<PhysicalTournamentEntryConditionsVo> tournamentEntryConditionsVo = physicalTournamentEntryConditionsMapper.selectPhysicalConditionsByTournamentId(tournamentId);
|
|
|
if(tournamentEntryConditionsVo!=null){
|
|
|
- physicalTournamentsVo.setItemsId(tournamentEntryConditionsVo.getItemId());
|
|
|
- physicalTournamentsVo.setItemsNum(tournamentEntryConditionsVo.getRequiredQuantity());
|
|
|
- physicalTournamentsVo.setItemsName(tournamentEntryConditionsVo.getItemsName());
|
|
|
+ List<PhysicalItemsPrizeDto> itemsConditionList=new ArrayList<>();
|
|
|
+ for (PhysicalTournamentEntryConditionsVo physicalTournamentEntryConditionsVo : tournamentEntryConditionsVo) {
|
|
|
+ PhysicalItemsPrizeDto itemsPrizeBo = new PhysicalItemsPrizeDto();
|
|
|
+ itemsPrizeBo.setItemId(physicalTournamentEntryConditionsVo.getItemId());
|
|
|
+ itemsPrizeBo.setQuantity(physicalTournamentEntryConditionsVo.getRequiredQuantity());
|
|
|
+ ItemsVo itemsVo = itemsMapper.selectVoByIdInfo(physicalTournamentEntryConditionsVo.getItemId());
|
|
|
+ if(itemsVo!=null){
|
|
|
+ itemsPrizeBo.setItemsName(itemsVo.getName());
|
|
|
+ itemsConditionList.add(itemsPrizeBo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ physicalTournamentsVo.setItemsConditionList(itemsConditionList);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
//绑定的盲注信息
|
|
|
TournamentBlindStructuresVo tournamentBlindStructuresVo = physicalTournamentBlindStructuresMapper.selectPhysicalTournamentBlindStructureByTournamentId(tournamentId);
|
|
|
if(tournamentBlindStructuresVo!=null){
|
|
|
@@ -221,16 +244,28 @@ public class PhysicalTournamentsServiceImpl implements IPhysicalTournamentsServi
|
|
|
LambdaQueryWrapper<PhysicalTournaments> lqw = buildQueryWrapper(bo);
|
|
|
List<PhysicalTournamentsVo> resultRecords = baseMapper.selectPhysicalTournamentsVoList(lqw);
|
|
|
for (PhysicalTournamentsVo physicalTournamentsVo : resultRecords) {
|
|
|
- String tournamentCondition="";
|
|
|
+ String tournamentCondition = "";
|
|
|
Long tournamentId = physicalTournamentsVo.getId();
|
|
|
- //赛事报名条件
|
|
|
- PhysicalTournamentEntryConditionsVo tournamentEntryConditionsVo = physicalTournamentEntryConditionsMapper.selectPhysicalConditionsByTournamentId(tournamentId);
|
|
|
- if(tournamentEntryConditionsVo!=null){
|
|
|
- physicalTournamentsVo.setItemsId(tournamentEntryConditionsVo.getItemId());
|
|
|
- physicalTournamentsVo.setItemsNum(tournamentEntryConditionsVo.getRequiredQuantity());
|
|
|
- physicalTournamentsVo.setItemsName(tournamentEntryConditionsVo.getItemsName());
|
|
|
- tournamentCondition=tournamentEntryConditionsVo.getItemsName()+"*"+tournamentEntryConditionsVo.getRequiredQuantity();
|
|
|
+ //赛事报名条件
|
|
|
+ List<PhysicalTournamentEntryConditionsVo> tournamentEntryConditionsVo = physicalTournamentEntryConditionsMapper.selectPhysicalConditionsByTournamentId(tournamentId);
|
|
|
+ if(tournamentEntryConditionsVo != null && !tournamentEntryConditionsVo.isEmpty()){
|
|
|
+ StringBuilder conditionBuilder = new StringBuilder();
|
|
|
+ for (int i = 0; i < tournamentEntryConditionsVo.size(); i++) {
|
|
|
+ PhysicalTournamentEntryConditionsVo condition = tournamentEntryConditionsVo.get(i);
|
|
|
+ if (i > 0) {
|
|
|
+ conditionBuilder.append(","); // 使用逗号分隔多个条件
|
|
|
+ }
|
|
|
+ ItemsVo itemsVo = itemsMapper.selectVoByIdInfo(condition.getItemId());
|
|
|
+ if(itemsVo!=null){
|
|
|
+ condition.setItemsName(itemsVo.getName());
|
|
|
+ conditionBuilder.append(condition.getItemsName())
|
|
|
+ .append("*")
|
|
|
+ .append(condition.getRequiredQuantity());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tournamentCondition = conditionBuilder.toString();
|
|
|
}
|
|
|
+
|
|
|
physicalTournamentsVo.setTournamentCondition(tournamentCondition);
|
|
|
//绑定的盲注信息
|
|
|
TournamentBlindStructuresVo tournamentBlindStructuresVo = physicalTournamentBlindStructuresMapper.selectPhysicalTournamentBlindStructureByTournamentId(tournamentId);
|
|
|
@@ -369,11 +404,16 @@ public class PhysicalTournamentsServiceImpl implements IPhysicalTournamentsServi
|
|
|
try {
|
|
|
// 解析 itemsPrizeList JSON 字符串
|
|
|
List<PhysicalItemsPrizeDto> prizeList = bo.getItemsPrizeList();
|
|
|
-
|
|
|
if (CollectionUtils.isEmpty(prizeList)) {
|
|
|
log.error("奖励列表为空");
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ List<PhysicalItemsPrizeDto> conditionList = bo.getItemsConditionList();
|
|
|
+ if (CollectionUtils.isEmpty(conditionList)) {
|
|
|
+ log.error("报名条件为空");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
Long userId = LoginHelper.getUserId();
|
|
|
add.setCreateUserId(userId);
|
|
|
// 处理开始时间
|
|
|
@@ -397,7 +437,7 @@ public class PhysicalTournamentsServiceImpl implements IPhysicalTournamentsServi
|
|
|
bindBlindStructure(tournamentId, bo.getBlindStructureId());
|
|
|
|
|
|
// 添加报名条件
|
|
|
- addEntryCondition(tournamentId, bo.getItemsId(), bo.getItemsNum());
|
|
|
+ addEntryCondition2(tournamentId, conditionList);
|
|
|
|
|
|
// 处理奖励分布
|
|
|
processPrizeDistributions(tournamentId, prizeList);
|
|
|
@@ -450,6 +490,13 @@ public class PhysicalTournamentsServiceImpl implements IPhysicalTournamentsServi
|
|
|
log.error("奖励列表为空");
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ List<PhysicalItemsPrizeDto> conditionList = bo.getItemsConditionList();
|
|
|
+ if (CollectionUtils.isEmpty(conditionList)) {
|
|
|
+ log.error("报名条件为空");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
//取出对应盲注 本级别持续时间
|
|
|
List<PhysicalBlindLevelsVo> blindLevelsVosList = physicalBlindLevelsService.selectPhysicalBlindLevelsInfoObj(bo.getBlindStructureId());
|
|
|
if(blindLevelsVosList.size()>0){
|
|
|
@@ -470,12 +517,17 @@ public class PhysicalTournamentsServiceImpl implements IPhysicalTournamentsServi
|
|
|
|
|
|
// 绑定盲注结构
|
|
|
bindBlindStructure(tournamentId, bo.getBlindStructureId());
|
|
|
- // 修改报名条件
|
|
|
- PhysicalTournamentEntryConditions tournamentEntryConditions=new PhysicalTournamentEntryConditions();
|
|
|
- tournamentEntryConditions.setItemId(bo.getItemsId());
|
|
|
- tournamentEntryConditions.setRequiredQuantity(bo.getItemsNum());
|
|
|
- tournamentEntryConditions.setTournamentId(tournamentId);
|
|
|
- physicalTournamentEntryConditionsMapper.updatePhysicalTournamentEntryConditionsId(tournamentEntryConditions);
|
|
|
+
|
|
|
+
|
|
|
+ List<PhysicalTournamentEntryConditionsVo> physicalTournamentEntryConditionsVos = physicalTournamentEntryConditionsMapper.selectPhysicalTournamentEntryConditionsByTournamentId(tournamentId);
|
|
|
+ for (PhysicalTournamentEntryConditionsVo physicalTournamentEntryConditionsVo : physicalTournamentEntryConditionsVos) {
|
|
|
+ // 修改报名条件
|
|
|
+ PhysicalTournamentEntryConditions tournamentEntryConditions=new PhysicalTournamentEntryConditions();
|
|
|
+ tournamentEntryConditions.setItemId(physicalTournamentEntryConditionsVo.getItemId());
|
|
|
+ tournamentEntryConditions.setRequiredQuantity(physicalTournamentEntryConditionsVo.getRequiredQuantity());
|
|
|
+ tournamentEntryConditions.setTournamentId(tournamentId);
|
|
|
+ physicalTournamentEntryConditionsMapper.updatePhysicalTournamentEntryConditionsId(tournamentEntryConditions);
|
|
|
+ }
|
|
|
|
|
|
//删除奖励排名 同时删除奖励对应信息
|
|
|
List<PhysicalPrizeDistributionsVo> prizeDistributionsVos = physicalPrizeDistributionsMapper.selectPhysicalPrizeDistributionByTournamentId(tournamentId);
|
|
|
@@ -540,7 +592,15 @@ public class PhysicalTournamentsServiceImpl implements IPhysicalTournamentsServi
|
|
|
structure.setBlindStructureId(blindStructureId);
|
|
|
physicalTournamentBlindStructuresMapper.insertPhysicalTournamentBlindStructure(structure);
|
|
|
}
|
|
|
-
|
|
|
+ private void addEntryCondition2(Long tournamentId, List<PhysicalItemsPrizeDto> itemsConditionList) {
|
|
|
+ for (PhysicalItemsPrizeDto physicalItemsPrizeDto : itemsConditionList) {
|
|
|
+ PhysicalTournamentEntryConditions condition = new PhysicalTournamentEntryConditions();
|
|
|
+ condition.setTournamentId(tournamentId);
|
|
|
+ condition.setItemId(physicalItemsPrizeDto.getItemId());
|
|
|
+ condition.setRequiredQuantity(physicalItemsPrizeDto.getQuantity());
|
|
|
+ physicalTournamentEntryConditionsMapper.insertPhysicalTournamentEntryConditions(condition);
|
|
|
+ }
|
|
|
+ }
|
|
|
private void addEntryCondition(Long tournamentId, Long itemId, Long requiredQuantity) {
|
|
|
PhysicalTournamentEntryConditions condition = new PhysicalTournamentEntryConditions();
|
|
|
condition.setTournamentId(tournamentId);
|