|
@@ -0,0 +1,98 @@
|
|
|
|
|
+package org.dromara.system.service.impl.app;
|
|
|
|
|
+
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.dromara.system.domain.GameEvent;
|
|
|
|
|
+import org.dromara.system.domain.GameEventProject;
|
|
|
|
|
+import org.dromara.system.domain.LargeScreenAPI.*;
|
|
|
|
|
+import org.dromara.system.domain.constant.ProjectClassification;
|
|
|
|
|
+import org.dromara.system.mapper.GameEventMapper;
|
|
|
|
|
+import org.dromara.system.mapper.GameEventProjectMapper;
|
|
|
|
|
+import org.dromara.system.mapper.app.LargeScreenMapper;
|
|
|
|
|
+import org.dromara.system.service.app.ILargeScreenService;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
+
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+@RequiredArgsConstructor
|
|
|
|
|
+@Service
|
|
|
|
|
+public class LargeScreenServiceImpl implements ILargeScreenService {
|
|
|
|
|
+
|
|
|
|
|
+ private final GameEventMapper gameEventMapper;
|
|
|
|
|
+ private final GameEventProjectMapper projectMapper;
|
|
|
|
|
+ private final LargeScreenMapper baseMapper;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 大屏全局基础信息接口
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public GlobalConfigVo getGlobalConfig(Long tournamentId) {
|
|
|
|
|
+ GameEvent event = gameEventMapper.selectOne(Wrappers.lambdaQuery(GameEvent.class)
|
|
|
|
|
+ .eq(GameEvent::getEventId, tournamentId)
|
|
|
|
|
+ .select(GameEvent::getUnit, GameEvent::getRegisterUrl, GameEvent::getEventName)
|
|
|
|
|
+ );
|
|
|
|
|
+ if (event != null) {
|
|
|
|
|
+ GlobalConfigVo vo = new GlobalConfigVo();
|
|
|
|
|
+ vo.setOrg_name(event.getUnit());
|
|
|
|
|
+ vo.setTournament_name(event.getEventName());
|
|
|
|
|
+ vo.setLogo_url(event.getRegisterUrl());
|
|
|
|
|
+ return vo;
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 赛事项目列表接口
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public ProjectListVo getProjectList(Long tournamentId) {
|
|
|
|
|
+ List<GameEventProject> projectList = projectMapper.selectList(Wrappers.lambdaQuery(GameEventProject.class)
|
|
|
|
|
+ .eq(GameEventProject::getEventId, tournamentId)
|
|
|
|
|
+ .orderByDesc(GameEventProject::getStartTime, GameEventProject::getCreateTime)
|
|
|
|
|
+ .select(GameEventProject::getProjectId, GameEventProject::getProjectName, GameEventProject::getClassification, GameEventProject::getLocation)
|
|
|
|
|
+ );
|
|
|
|
|
+ /** 组装数据解构 */
|
|
|
|
|
+ ProjectListVo vo = new ProjectListVo();
|
|
|
|
|
+ vo.setTotal_events(projectList.size());
|
|
|
|
|
+ if (!projectList.isEmpty()){
|
|
|
|
|
+ AtomicInteger indexCounter = new AtomicInteger(1);
|
|
|
|
|
+ vo.setList(projectList.stream().map(project -> {
|
|
|
|
|
+ ProjectVo projectVo = new ProjectVo();
|
|
|
|
|
+ projectVo.setEvent_id(project.getProjectId().toString());
|
|
|
|
|
+ projectVo.setEvent_name(project.getProjectName());
|
|
|
|
|
+ projectVo.setType(ProjectClassification.TEAM.getValue().equals(project.getClassification()) ? "team" : "personal");
|
|
|
|
|
+ projectVo.setInfo(project.getLocation());
|
|
|
|
|
+ projectVo.setSession_index(indexCounter.getAndIncrement());
|
|
|
|
|
+ return projectVo;
|
|
|
|
|
+ }).toList());
|
|
|
|
|
+ }
|
|
|
|
|
+ return vo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 赛事成绩接口--个人
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public PersonalResultListVo getAthleteScore(Long tournamentId, Long eventId) {
|
|
|
|
|
+ PersonalResultListVo vo = new PersonalResultListVo();
|
|
|
|
|
+ List<PersonalResultVo> results = baseMapper.getAthleteScore(tournamentId, eventId);
|
|
|
|
|
+ vo.setResults(results != null ? results : List.of());
|
|
|
|
|
+ return vo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 赛事成绩接口--团队
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public TeamResultListVo getTeamScore(Long tournamentId, Long eventId) {
|
|
|
|
|
+ TeamResultListVo vo = new TeamResultListVo();
|
|
|
|
|
+ List<TeamResultVo> results = baseMapper.getTeamScore(tournamentId, eventId);
|
|
|
|
|
+ vo.setResults(results != null ? results : List.of());
|
|
|
|
|
+ return vo;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|