|
@@ -6,16 +6,14 @@ import com.baomidou.mybatisplus.extension.toolkit.Db;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
-import org.dromara.system.domain.GameEvent;
|
|
|
|
|
-import org.dromara.system.domain.GameEventConfig;
|
|
|
|
|
-import org.dromara.system.domain.GameEventProject;
|
|
|
|
|
-import org.dromara.system.domain.GameRankGroup;
|
|
|
|
|
|
|
+import org.dromara.system.domain.*;
|
|
|
import org.dromara.system.domain.bo.ClientProjectSaveBo;
|
|
import org.dromara.system.domain.bo.ClientProjectSaveBo;
|
|
|
import org.dromara.system.domain.bo.GameRankGroupBo;
|
|
import org.dromara.system.domain.bo.GameRankGroupBo;
|
|
|
import org.dromara.system.mapper.GameEventMapper;
|
|
import org.dromara.system.mapper.GameEventMapper;
|
|
|
import org.dromara.system.mapper.GameEventProjectMapper;
|
|
import org.dromara.system.mapper.GameEventProjectMapper;
|
|
|
import org.dromara.system.service.IGameRankGroupService;
|
|
import org.dromara.system.service.IGameRankGroupService;
|
|
|
import org.dromara.system.service.app.IToClientService;
|
|
import org.dromara.system.service.app.IToClientService;
|
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
@@ -122,6 +120,69 @@ public class ToClientServiceImpl implements IToClientService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public void removeEvent(Long eventId) {
|
|
|
|
|
+ // 先验证赛事是否存在
|
|
|
|
|
+ GameEvent event = gameEventMapper.selectById(eventId);
|
|
|
|
|
+ if (event == null) {
|
|
|
|
|
+ throw new RuntimeException("赛事不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 异步执行删除操作
|
|
|
|
|
+ asyncRemoveEventData(eventId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 异步删除赛事关联数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @Async
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public void asyncRemoveEventData(Long eventId) {
|
|
|
|
|
+ log.info("开始异步删除赛事数据,eventId: {}", eventId);
|
|
|
|
|
+ long startTime = System.currentTimeMillis();
|
|
|
|
|
+ try{
|
|
|
|
|
+ // 删除关联的组别
|
|
|
|
|
+ Db.remove(Wrappers.lambdaQuery(GameRankGroup.class)
|
|
|
|
|
+ .eq(GameRankGroup::getEventId, eventId)
|
|
|
|
|
+ );
|
|
|
|
|
+ // 删除关联的配置信息
|
|
|
|
|
+ Db.remove(Wrappers.lambdaQuery(GameEventConfig.class)
|
|
|
|
|
+ .eq(GameEventConfig::getEventId, eventId)
|
|
|
|
|
+ );
|
|
|
|
|
+ // 删除关联的成绩信息
|
|
|
|
|
+ Db.remove(Wrappers.lambdaQuery(GameScore.class)
|
|
|
|
|
+ .eq(GameScore::getEventId, eventId)
|
|
|
|
|
+ );
|
|
|
|
|
+ // 删除关联的项目
|
|
|
|
|
+ int projectCount = projectMapper.delete(Wrappers.lambdaQuery(GameEventProject.class)
|
|
|
|
|
+ .eq(GameEventProject::getEventId, eventId));
|
|
|
|
|
+ log.info("删除项目完成,eventId: {}, 删除数量: {}", eventId, projectCount);
|
|
|
|
|
+ // 删除赛事
|
|
|
|
|
+ gameEventMapper.deleteById(eventId);
|
|
|
|
|
+ long endTime = System.currentTimeMillis();
|
|
|
|
|
+ log.info("赛事数据删除完成,eventId: {}, 耗时: {}ms", eventId, (endTime - startTime));
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("异步删除赛事数据失败,eventId: {}", eventId, e);
|
|
|
|
|
+ throw new RuntimeException("删除赛事数据失败: " + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<GameEvent> getEventList() {
|
|
|
|
|
+ return gameEventMapper.selectList(Wrappers.lambdaQuery(GameEvent.class)
|
|
|
|
|
+ .orderByDesc(GameEvent::getCreateTime)
|
|
|
|
|
+ .select(GameEvent::getEventId, GameEvent::getEventCode, GameEvent::getEventName, GameEvent::getCreateTime)
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<GameEventProject> getProjectList(Long eventId) {
|
|
|
|
|
+ return projectMapper.selectList(Wrappers.lambdaQuery(GameEventProject.class)
|
|
|
|
|
+ .eq(GameEventProject::getEventId, eventId)
|
|
|
|
|
+ .select(GameEventProject::getProjectId, GameEventProject::getProjectType, GameEventProject::getClassification, GameEventProject::getProjectName)
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 批量保存配置信息
|
|
* 批量保存配置信息
|
|
|
*/
|
|
*/
|