Browse Source

fix:生成号码布调整

wenkai 3 days ago
parent
commit
a4ed374fd9

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

@@ -1,5 +1,6 @@
 package org.dromara.system.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.img.FontUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -578,6 +579,9 @@ public class GameEventServiceImpl implements IGameEventService {
         Long defaultEventId = Long.valueOf(cacheObject.toString());
         gameAthleteBo.setEventId(defaultEventId);
         List<GameAthleteVo> athleteVoList = gameAthleteService.queryList(gameAthleteBo);
+        if(CollectionUtil.isEmpty(athleteVoList)){
+            throw new ServiceException("当前赛事没有队员数据,无法生成号码布");
+        }
         //2.提前查询队员队伍名称缓存
         Set<Long> teamIds = athleteVoList.stream()
             .map(GameAthleteVo::getTeamId)
@@ -638,11 +642,6 @@ public class GameEventServiceImpl implements IGameEventService {
                 logoBytes = logo.getBytes();
             }
 
-            // 设置响应头(返回 ZIP 压缩包)
-            response.reset();
-            response.setContentType("application/zip");
-            response.setHeader("Content-Disposition", "attachment; filename=\"athlete_bibs.zip\"");
-
             try (java.util.zip.ZipOutputStream zos = new java.util.zip.ZipOutputStream(response.getOutputStream())) {
 
                 for (GameAthleteVo athlete : athleteList) {