|
|
@@ -35,12 +35,14 @@ import org.dromara.common.json.utils.JsonUtils;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
import org.dromara.common.redis.utils.RedisUtils;
|
|
|
+import org.dromara.system.domain.GameAthlete;
|
|
|
import org.dromara.system.domain.GameEvent;
|
|
|
import org.dromara.system.domain.GameEventGroup;
|
|
|
import org.dromara.system.domain.PdfEntry;
|
|
|
import org.dromara.system.domain.bo.*;
|
|
|
import org.dromara.system.domain.constant.GameEventConstant;
|
|
|
import org.dromara.system.domain.vo.*;
|
|
|
+import org.dromara.system.mapper.GameAthleteMapper;
|
|
|
import org.dromara.system.mapper.GameEventMapper;
|
|
|
import org.dromara.system.config.FileUploadConfig;
|
|
|
import org.dromara.system.service.*;
|
|
|
@@ -168,9 +170,9 @@ public class GameEventServiceImpl implements IGameEventService {
|
|
|
@Override
|
|
|
public TableDataInfo<GameEventVo> queryPageList(GameEventBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<GameEvent> lqw = buildQueryWrapper(bo);
|
|
|
- Page<GameEventVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ // Page<GameEventVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
// 使用带数据权限注解的方法
|
|
|
-// Page<GameEventVo> result = baseMapper.selectPageEventList(pageQuery.build(), lqw);
|
|
|
+ Page<GameEventVo> result = baseMapper.selectPageEventList(pageQuery.build(), lqw);
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
|
|
|
|
@@ -184,8 +186,8 @@ public class GameEventServiceImpl implements IGameEventService {
|
|
|
public List<GameEventVo> queryList(GameEventBo bo) {
|
|
|
LambdaQueryWrapper<GameEvent> lqw = buildQueryWrapper(bo);
|
|
|
// 使用带数据权限注解的方法
|
|
|
-// return baseMapper.selectEventList(lqw);
|
|
|
- return baseMapper.selectVoList(lqw);
|
|
|
+ return baseMapper.selectEventList(lqw);
|
|
|
+ // return baseMapper.selectVoList(lqw);
|
|
|
}
|
|
|
|
|
|
private LambdaQueryWrapper<GameEvent> buildQueryWrapper(GameEventBo bo) {
|
|
|
@@ -250,9 +252,6 @@ public class GameEventServiceImpl implements IGameEventService {
|
|
|
// 构建scene参数,包含赛事ID
|
|
|
String scene = "eventId=" + gameEvent.getEventId();
|
|
|
|
|
|
- // 页面路径,实际使用时需要替换为真实路径
|
|
|
-// String page = "pages/index/index";
|
|
|
-
|
|
|
// 调用微信接口生成小程序码
|
|
|
byte[] qrCodeBytes = getWxaCodeUnlimit(accessToken, scene, page);
|
|
|
if (qrCodeBytes == null) {
|
|
|
@@ -1179,36 +1178,41 @@ public class GameEventServiceImpl implements IGameEventService {
|
|
|
*/
|
|
|
@NotNull
|
|
|
private static String getQrDataStr(String eventName, String groupName, Map<Long, String> teamNameMap, Map<Long, String> projectMap, GameAthleteVo athlete) {
|
|
|
- //处理参加项目
|
|
|
- StringBuilder joinProject = new StringBuilder();
|
|
|
- StringJoiner joiner = new StringJoiner("、"); // 指定分隔符
|
|
|
- athlete.getProjectList().forEach(projectId -> {
|
|
|
- String projectName = projectMap.getOrDefault(Long.valueOf(projectId),"");
|
|
|
- if (projectName != null) {
|
|
|
- joiner.add(projectName);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- // 生成二维码
|
|
|
- String qrData = String.format(
|
|
|
- """
|
|
|
- {
|
|
|
- 赛事名称:%s,
|
|
|
- 运动员序号:%d,
|
|
|
- 运动员编号:%s,
|
|
|
- 参与项目:%s,
|
|
|
- 队伍名称:%s,
|
|
|
- 运动员姓名:%s,
|
|
|
- 性别:%s,
|
|
|
- 年龄:%d
|
|
|
- 组别:%s
|
|
|
- }
|
|
|
- """,
|
|
|
- eventName, athlete.getAthleteId(), athlete.getAthleteCode(),
|
|
|
- joinProject, teamNameMap.getOrDefault(athlete.getTeamId(),""), athlete.getName(),
|
|
|
- athlete.getGender(), athlete.getAge(), groupName
|
|
|
- );
|
|
|
- return qrData;
|
|
|
+ try {
|
|
|
+ // 处理参加项目
|
|
|
+ StringJoiner joiner = new StringJoiner("、"); // 指定分隔符
|
|
|
+ athlete.getProjectList().forEach(projectId -> {
|
|
|
+ String projectName = projectMap.getOrDefault(Long.valueOf(projectId),"");
|
|
|
+ if (projectName != null && !projectName.isEmpty()) {
|
|
|
+ joiner.add(projectName);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ String xiangmu = joiner.toString();
|
|
|
+
|
|
|
+ // 获取运动员姓名并进行URL编码
|
|
|
+ String encodedName = java.net.URLEncoder.encode(athlete.getName(), "UTF-8");
|
|
|
+
|
|
|
+ // 获取赛事ID(从athlete对象中获取)
|
|
|
+ Long shId = athlete.getEventId();
|
|
|
+
|
|
|
+ // 生成符合要求格式的URL查询参数字符串
|
|
|
+ String qrData = String.format(
|
|
|
+ "id=%s&name=%s&gender=%s&shId=%d&shName=%s&dwName=%s&xiangmu=%s",
|
|
|
+ athlete.getAthleteCode(), // 队员号码(唯一ID)
|
|
|
+ encodedName, // 队员姓名(URL编码)
|
|
|
+ athlete.getGender(), // 性别
|
|
|
+ shId, // 赛事ID
|
|
|
+ eventName, // 赛事名称
|
|
|
+ teamNameMap.getOrDefault(athlete.getTeamId(), ""), // 队伍名称
|
|
|
+ xiangmu // 参与项目
|
|
|
+ );
|
|
|
+
|
|
|
+ return qrData;
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 如果编码失败,返回基本信息
|
|
|
+ log.error("生成二维码数据失败(编码失败): {}", e.getMessage(), e);
|
|
|
+ return String.format("id=%s&name=%s", athlete.getAthleteCode(), athlete.getName());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 工具方法:添加文本
|
|
|
@@ -1829,7 +1833,7 @@ public class GameEventServiceImpl implements IGameEventService {
|
|
|
// 查询运动员数据
|
|
|
GameAthleteBo gameAthleteBo = new GameAthleteBo();
|
|
|
gameAthleteBo.setEventId(eventId);
|
|
|
- List<GameAthleteVo> athleteVoList = gameAthleteService.queryList(gameAthleteBo);
|
|
|
+ List<GameAthleteVo> athleteVoList = gameAthleteService.queryListNoPermission(gameAthleteBo);
|
|
|
|
|
|
if (CollectionUtil.isEmpty(athleteVoList)) {
|
|
|
gameBibTaskService.updateTaskStatus(taskId, "3", "当前赛事没有队员数据");
|
|
|
@@ -2043,72 +2047,58 @@ public class GameEventServiceImpl implements IGameEventService {
|
|
|
* 生成二维码数据
|
|
|
*/
|
|
|
private String generateQRCodeData(GameAthleteVo athlete) {
|
|
|
- StringBuilder joinProject = new StringBuilder();
|
|
|
- StringJoiner joiner = new StringJoiner(",");
|
|
|
-
|
|
|
- // 添加调试日志
|
|
|
- log.debug("生成二维码数据 - 运动员: {}, projectValue: {}, projectList: {}",
|
|
|
- athlete.getName(), athlete.getProjectValue(), athlete.getProjectList());
|
|
|
-
|
|
|
- // 检查projectList是否为null或空
|
|
|
- if (athlete.getProjectList() == null || athlete.getProjectList().isEmpty()) {
|
|
|
- log.warn("运动员 {} 的参与项目列表为空,projectValue: {}", athlete.getName(), athlete.getProjectValue());
|
|
|
- return String.format(
|
|
|
- """
|
|
|
- {
|
|
|
- 赛事名称:%s,
|
|
|
- 号码:%s,
|
|
|
- 姓名:%s,
|
|
|
- 性别:%s,
|
|
|
- 年龄:%d
|
|
|
- 队伍名称:%s,
|
|
|
- 参与项目:无项目,
|
|
|
- }
|
|
|
- """,
|
|
|
- athlete.getEventName(),
|
|
|
- athlete.getAthleteCode(),
|
|
|
- athlete.getName(),
|
|
|
- athlete.getGender(),
|
|
|
- athlete.getAge(),
|
|
|
- athlete.getTeamName() != null ? athlete.getTeamName() : "未知队伍");
|
|
|
- }
|
|
|
-
|
|
|
- Map<Long, String> projectMap = gameEventProjectService.queryNameByEventIdAndProjectIds(athlete.getEventId(), athlete.getProjectList());
|
|
|
- log.debug("项目映射结果: {}", projectMap);
|
|
|
-
|
|
|
- // 添加额外的null检查
|
|
|
- if (projectMap == null) {
|
|
|
- log.warn("项目映射结果为空,返回空字符串,逻辑上不可能为空,如果有空项目,应该在运动员表中删除");
|
|
|
- projectMap = new HashMap<>();
|
|
|
- }
|
|
|
-
|
|
|
- for (Long projectId : athlete.getProjectList()) {
|
|
|
- String projectName = projectMap.get(projectId) != null ? projectMap.get(projectId).toString() : "未知项目";
|
|
|
- joiner.add(projectName);
|
|
|
- }
|
|
|
-
|
|
|
- String projectNames = joiner.toString();
|
|
|
- log.debug("最终项目名称: {}", projectNames);
|
|
|
-
|
|
|
- return String.format(
|
|
|
- """
|
|
|
- {
|
|
|
- 赛事名称:%s,
|
|
|
- 号码:%s,
|
|
|
- 姓名:%s,
|
|
|
- 性别:%s,
|
|
|
- 年龄:%d
|
|
|
- 队伍名称:%s,
|
|
|
- 参与项目:%s,
|
|
|
+ try {
|
|
|
+ // 添加调试日志
|
|
|
+ log.debug("生成二维码数据 - 运动员: {}, projectValue: {}, projectList: {}",
|
|
|
+ athlete.getName(), athlete.getProjectValue(), athlete.getProjectList());
|
|
|
+
|
|
|
+ // 处理参加项目
|
|
|
+ StringJoiner joiner = new StringJoiner("、"); // 指定分隔符
|
|
|
+ if (athlete.getProjectList() != null && !athlete.getProjectList().isEmpty()) {
|
|
|
+ Map<Long, String> projectMap = gameEventProjectService.queryNameByEventIdAndProjectIds(athlete.getEventId(), athlete.getProjectList());
|
|
|
+ log.debug("项目映射结果: {}", projectMap);
|
|
|
+
|
|
|
+ // 添加额外的null检查
|
|
|
+ if (projectMap == null) {
|
|
|
+ log.warn("项目映射结果为空,返回空字符串,逻辑上不可能为空,如果有空项目,应该在运动员表中删除");
|
|
|
+ projectMap = new HashMap<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Long projectId : athlete.getProjectList()) {
|
|
|
+ String projectName = projectMap.getOrDefault(projectId, "未知项目");
|
|
|
+ joiner.add(projectName);
|
|
|
}
|
|
|
- """,
|
|
|
- athlete.getEventName(),
|
|
|
- athlete.getAthleteCode(),
|
|
|
- athlete.getName(),
|
|
|
- athlete.getGender(),
|
|
|
- athlete.getAge(),
|
|
|
- athlete.getTeamName() != null ? athlete.getTeamName() : "未知队伍",
|
|
|
- projectNames);
|
|
|
+ }
|
|
|
+ String xiangmu = joiner.toString();
|
|
|
+
|
|
|
+ // 获取运动员姓名并进行URL编码
|
|
|
+ String encodedName = java.net.URLEncoder.encode(athlete.getName(), "UTF-8");
|
|
|
+
|
|
|
+ // 获取赛事ID(从athlete对象中获取)
|
|
|
+ Long shId = athlete.getEventId();
|
|
|
+
|
|
|
+ // 获取赛事名称和队伍名称
|
|
|
+ String shName = athlete.getEventName();
|
|
|
+ String dwName = athlete.getTeamName() != null ? athlete.getTeamName() : "未知队伍";
|
|
|
+
|
|
|
+ // 生成符合要求格式的URL查询参数字符串
|
|
|
+ String qrData = String.format(
|
|
|
+ "id=%s&name=%s&gender=%s&shId=%d&shName=%s&dwName=%s&xiangmu=%s",
|
|
|
+ athlete.getAthleteCode(), // 队员号码(唯一ID)
|
|
|
+ encodedName, // 队员姓名(URL编码)
|
|
|
+ athlete.getGender(), // 性别
|
|
|
+ shId, // 赛事ID
|
|
|
+ shName, // 赛事名称
|
|
|
+ dwName, // 队伍名称
|
|
|
+ xiangmu // 参与项目
|
|
|
+ );
|
|
|
+
|
|
|
+ return qrData;
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 如果编码失败,返回基本信息
|
|
|
+ log.error("生成二维码数据失败(编码失败): {}", e.getMessage(), e);
|
|
|
+ return String.format("id=%s&name=%s", athlete.getAthleteCode(), athlete.getName());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|