|
|
@@ -175,7 +175,7 @@ public class ScheduleConfigServiceImpl implements IScheduleConfigService {
|
|
|
|
|
|
// 1. 查询创建方案
|
|
|
CreationSchemeVo scheme = schemeRepo.selectAllCreationSchemesInfo(dto.getCreationSchemeCode());
|
|
|
- if (scheme == null) throw new IllegalArgumentException("Invalid scheme code: " + dto.getCreationSchemeCode());
|
|
|
+ if (scheme == null) throw new IllegalArgumentException("无效的创建方案 Invalid scheme code: " + dto.getCreationSchemeCode());
|
|
|
|
|
|
// 2. 计算开始和结束日期
|
|
|
LocalDate startDate = calculateStartDate(dto.getCreationSchemeCode());
|
|
|
@@ -465,23 +465,23 @@ public class ScheduleConfigServiceImpl implements IScheduleConfigService {
|
|
|
|
|
|
public R<String> updateScheduleConfig(Long configId, ScheduleConfigRequestBo dto) {
|
|
|
|
|
|
- if(dto.getExecTimes().size()<=0){
|
|
|
+ if(dto.getExecTimes().isEmpty()){
|
|
|
return R.fail("时间设置为空");
|
|
|
}
|
|
|
- if(dto.getRepeatTypes().size()<=0){
|
|
|
+ if(dto.getRepeatTypes().isEmpty()){
|
|
|
return R.fail("重复设置为空");
|
|
|
}
|
|
|
|
|
|
- int selectByScheduleRelationExit = scheduleTournamentsReletionMapper.selectByScheduleRelationExit(dto.getTemplateId());
|
|
|
+ /* int selectByScheduleRelationExit = scheduleTournamentsReletionMapper.selectByScheduleRelationExit(dto.getTemplateId());
|
|
|
if(selectByScheduleRelationExit>0){
|
|
|
//已经生成过赛事数据
|
|
|
return R.fail("该配置已经分配过赛事!");
|
|
|
- }
|
|
|
-
|
|
|
+ }*/
|
|
|
// 1. 检查配置是否存在
|
|
|
ScheduleConfigVo existingConfig = baseMapper.selectScheduleConfigById(configId);
|
|
|
if (existingConfig == null) {
|
|
|
- throw new IllegalArgumentException("Schedule config not found for id: " + configId);
|
|
|
+ log.info("Schedule config not found for id: {}", configId);
|
|
|
+ return R.fail("该配置不存在!");
|
|
|
}
|
|
|
CreationSchemeVo scheme = schemeRepo.selectAllCreationSchemesInfo(dto.getCreationSchemeCode());
|
|
|
|
|
|
@@ -544,14 +544,14 @@ public class ScheduleConfigServiceImpl implements IScheduleConfigService {
|
|
|
// 1. 检查配置是否存在
|
|
|
ScheduleConfigVo existingConfig = baseMapper.selectScheduleConfigById(configId);
|
|
|
|
|
|
- int selectByScheduleRelationExit = scheduleTournamentsReletionMapper.selectByScheduleRelationExit(existingConfig.getTemplateId());
|
|
|
+ /* int selectByScheduleRelationExit = scheduleTournamentsReletionMapper.selectByScheduleRelationExit(existingConfig.getTemplateId());
|
|
|
if(selectByScheduleRelationExit>0){
|
|
|
//已经生成过赛事数据
|
|
|
return R.fail("该配置已经分配过赛事!禁止删除!");
|
|
|
- }
|
|
|
-
|
|
|
+ }*/
|
|
|
if (existingConfig == null) {
|
|
|
- throw new IllegalArgumentException("Schedule config not found for id: " + configId);
|
|
|
+ log.info("Schedule config not found for id: {}", configId);
|
|
|
+ return R.fail("该配置不存在!禁止删除!");
|
|
|
}
|
|
|
try {
|
|
|
// 2. 🔴 按依赖顺序删除关联数据
|
|
|
@@ -573,6 +573,10 @@ public class ScheduleConfigServiceImpl implements IScheduleConfigService {
|
|
|
baseMapper.deleteScheduleConfig(ids);
|
|
|
log.info("Deleted schedule config with id: {}", configId);
|
|
|
|
|
|
+ //4 删除 赛事分配的模版关系表
|
|
|
+ scheduleTournamentsReletionMapper.deleteByConfigId(configId);
|
|
|
+ log.info("Deleted schedule_tournaments_reletion config with id: {}", configId);
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
log.error("Error deleting schedule config and its associations, configId: {}", configId, e);
|
|
|
throw e; // 事务会回滚
|