refactor: Phase 5 - Clean up Orchestrator, remove deprecated methods
- Remove deprecated wrapper methods (generateTimeSlots, autoGroupParticipants, etc.) - Update autoArrange() to call services directly - Final class size: 288 lines (75% reduction from original 1148 lines) - All 438 tests passing Closes #11 - God Class refactoring complete
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4
-58
@@ -108,16 +108,16 @@ public class MartialScheduleArrangeServiceImpl implements IMartialScheduleArrang
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 5. 生成时间段网格
|
// 5. 生成时间段网格
|
||||||
List<TimeSlot> timeSlots = generateTimeSlots(competition);
|
List<TimeSlot> timeSlots = timeSlotGenerator.generate(competition);
|
||||||
|
|
||||||
// 6. 自动分组
|
// 6. 自动分组
|
||||||
List<ScheduleGroupData> groups = autoGroupParticipants(athletes);
|
List<ScheduleGroupData> groups = participantGroupingService.autoGroup(athletes);
|
||||||
|
|
||||||
// 7. 验证容量是否足够
|
// 7. 验证容量是否足够
|
||||||
validateCapacity(groups, venues, timeSlots);
|
venueAllocationService.validateCapacity(groups, venues, timeSlots);
|
||||||
|
|
||||||
// 8. 分配场地和时间段(轮询均匀分配)
|
// 8. 分配场地和时间段(轮询均匀分配)
|
||||||
assignVenueAndTimeSlot(groups, venues, timeSlots);
|
venueAllocationService.allocate(groups, venues, timeSlots);
|
||||||
|
|
||||||
// 8. 清空旧的编排数据
|
// 8. 清空旧的编排数据
|
||||||
clearOldScheduleData(competitionId);
|
clearOldScheduleData(competitionId);
|
||||||
@@ -202,60 +202,6 @@ public class MartialScheduleArrangeServiceImpl implements IMartialScheduleArrang
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate time slots for competition
|
|
||||||
* @deprecated Use TimeSlotGenerator.generate() directly
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
private List<TimeSlot> generateTimeSlots(MartialCompetition competition) {
|
|
||||||
return timeSlotGenerator.generate(competition);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取项目的分组类别名称
|
|
||||||
* @param project 项目
|
|
||||||
* @return 分组类别名称: 男子/女子/混合/团体
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto group participants
|
|
||||||
* @deprecated Use ParticipantGroupingService.autoGroup() directly
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
private List<ScheduleGroupData> autoGroupParticipants(List<MartialAthlete> athletes) {
|
|
||||||
return participantGroupingService.autoGroup(athletes);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证时间窗口容量是否足够容纳所有分组
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Validate capacity
|
|
||||||
* @deprecated Use VenueAllocationService.validateCapacity() directly
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
private void validateCapacity(List<ScheduleGroupData> groups,
|
|
||||||
List<MartialVenue> venues,
|
|
||||||
List<TimeSlot> timeSlots) {
|
|
||||||
venueAllocationService.validateCapacity(groups, venues, timeSlots);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assign venue and time slot
|
|
||||||
* @deprecated Use VenueAllocationService.allocate() directly
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
private void assignVenueAndTimeSlot(List<ScheduleGroupData> groups,
|
|
||||||
List<MartialVenue> venues,
|
|
||||||
List<TimeSlot> timeSlots) {
|
|
||||||
venueAllocationService.allocate(groups, venues, timeSlots);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void clearOldScheduleData(Long competitionId) {
|
private void clearOldScheduleData(Long competitionId) {
|
||||||
// 删除旧的编排数据
|
// 删除旧的编排数据
|
||||||
LambdaQueryWrapper<MartialScheduleGroup> groupWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MartialScheduleGroup> groupWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user