|
@@ -1,6 +1,8 @@
|
|
|
package org.dromara.system.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
@@ -10,24 +12,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.dromara.system.domain.GameEventProject;
|
|
|
-import org.dromara.system.domain.GameScore;
|
|
|
-import org.dromara.system.domain.GameTeam;
|
|
|
-import org.dromara.system.domain.vo.AthleteScoreVo;
|
|
|
-import org.dromara.system.domain.vo.GameEventProjectVo;
|
|
|
-import org.dromara.system.domain.vo.GameEventVo;
|
|
|
+import org.dromara.system.domain.*;
|
|
|
+import org.dromara.system.domain.bo.GameEventBo;
|
|
|
+import org.dromara.system.domain.bo.GameEventGroupBo;
|
|
|
+import org.dromara.system.domain.bo.GameTeamBo;
|
|
|
+import org.dromara.system.domain.vo.*;
|
|
|
import org.dromara.system.mapper.GameEventProjectMapper;
|
|
|
import org.dromara.system.mapper.GameScoreMapper;
|
|
|
import org.dromara.system.mapper.GameTeamMapper;
|
|
|
-import org.dromara.system.service.IGameEventProjectService;
|
|
|
-import org.dromara.system.service.IGameEventService;
|
|
|
+import org.dromara.system.service.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.dromara.system.domain.bo.GameAthleteBo;
|
|
|
-import org.dromara.system.domain.vo.GameAthleteVo;
|
|
|
-import org.dromara.system.domain.GameAthlete;
|
|
|
import org.dromara.system.mapper.GameAthleteMapper;
|
|
|
-import org.dromara.system.service.IGameAthleteService;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -56,6 +53,8 @@ public class GameAthleteServiceImpl implements IGameAthleteService {
|
|
|
|
|
|
private final IGameEventService gameEventService;
|
|
|
|
|
|
+ private final IGameTeamService gameTeamService;
|
|
|
+
|
|
|
/**
|
|
|
* 根据赛事ID查询参赛者积分信息列表
|
|
|
*
|
|
@@ -153,20 +152,23 @@ public class GameAthleteServiceImpl implements IGameAthleteService {
|
|
|
LambdaQueryWrapper<GameAthlete> lqw = buildQueryWrapper(bo);
|
|
|
Page<GameAthleteVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
result.getRecords().stream()
|
|
|
- .filter(vo -> StringUtils.isNotBlank(vo.getProjectValue())) // 过滤null和空字符串
|
|
|
.map(vo -> {
|
|
|
- String[] projectIds = vo.getProjectValue().split(",");
|
|
|
- List<GameEventProjectVo> projects =
|
|
|
- gameEventProjectService.listProjectsByEventIdAndProjectIndex(
|
|
|
- vo.getEventId(),
|
|
|
- projectIds);
|
|
|
- String projectNames = projects.stream()
|
|
|
- .map(GameEventProjectVo::getProjectName)
|
|
|
- .filter(StringUtils::isNotBlank) // 过滤项目名为空的情况
|
|
|
- .collect(Collectors.joining(","));
|
|
|
- vo.setProjectValue(projectNames);
|
|
|
- GameEventVo gameEventVo = gameEventService.queryById(vo.getEventId());
|
|
|
- vo.setEventName(gameEventVo.getEventName());
|
|
|
+ if(StringUtils.isNotBlank(vo.getProjectValue())) {
|
|
|
+ String[] projectIds = vo.getProjectValue().split(",");
|
|
|
+ List<GameEventProjectVo> projects =
|
|
|
+ gameEventProjectService.listProjectsByEventIdAndProjectIndex(
|
|
|
+ vo.getEventId(),
|
|
|
+ projectIds);
|
|
|
+ String projectNames = projects.stream()
|
|
|
+ .map(GameEventProjectVo::getProjectName)
|
|
|
+ .filter(StringUtils::isNotBlank) // 过滤项目名为空的情况
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ vo.setProjectValue(projectNames);
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isNotEmpty(vo.getEventId())){
|
|
|
+ GameEventVo gameEventVo = gameEventService.queryById(vo.getEventId());
|
|
|
+ vo.setEventName(gameEventVo.getEventName());
|
|
|
+ }
|
|
|
return vo;
|
|
|
})
|
|
|
.collect(Collectors.toList()); // 收集结果
|
|
@@ -190,11 +192,45 @@ public class GameAthleteServiceImpl implements IGameAthleteService {
|
|
|
LambdaQueryWrapper<GameAthlete> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.orderByAsc(GameAthlete::getAthleteId);
|
|
|
lqw.eq(bo.getEventId() != null, GameAthlete::getEventId, bo.getEventId());
|
|
|
+
|
|
|
+ // 通过名称模糊查询
|
|
|
+ if (StringUtils.isNotBlank(bo.getEventName())) {
|
|
|
+ GameEventBo gameEventBo = new GameEventBo();
|
|
|
+ gameEventBo.setEventName(bo.getEventName());
|
|
|
+ List<GameEventVo> vos = gameEventService.queryList(gameEventBo);
|
|
|
+ List<Long> ids = vos.stream()
|
|
|
+ .map(GameEventVo::getEventId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(ids)) {
|
|
|
+ lqw.in(GameAthlete::getEventId, ids);
|
|
|
+ } else {
|
|
|
+ lqw.apply("1=0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
lqw.eq(bo.getTeamId() != null, GameAthlete::getTeamId, bo.getTeamId());
|
|
|
+
|
|
|
+ // 通过名称模糊查询
|
|
|
+ if (StringUtils.isNotBlank(bo.getTeamName())) {
|
|
|
+ GameTeamBo gameTeamBo = new GameTeamBo();
|
|
|
+ gameTeamBo.setTeamName(bo.getTeamName());
|
|
|
+ List<GameTeamVo> vos = gameTeamService.queryList(gameTeamBo);
|
|
|
+ List<Long> ids = vos.stream()
|
|
|
+ .map(GameTeamVo::getTeamId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(ids)) {
|
|
|
+ lqw.in(GameAthlete::getTeamId, ids);
|
|
|
+ } else {
|
|
|
+ lqw.apply("1=0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getAthleteCode()), GameAthlete::getAthleteCode, bo.getAthleteCode());
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getName()), GameAthlete::getName, bo.getName());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getGroupType()), GameAthlete::getGroupType, bo.getGroupType());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), GameAthlete::getStatus, bo.getStatus());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getPhone()), GameAthlete::getPhone, bo.getPhone());
|
|
|
+ lqw.like(StringUtils.isNotBlank(bo.getLocation()), GameAthlete::getLocation, bo.getLocation());
|
|
|
return lqw;
|
|
|
}
|
|
|
|