Commit 66780d9b1a009eba803ceff62b47a408f8b51b7b

Authored by YunaiV
1 parent 053a100f

test(mes): 补充单白班未配置倒班参数的排班回归测试

yudao-module-mes/src/test/java/cn/iocoder/yudao/module/mes/service/cal/team/MesCalTeamShiftServiceImplTest.java
... ... @@ -97,6 +97,30 @@ public class MesCalTeamShiftServiceImplTest extends BaseDbUnitTest {
97 97 assertRecord(records.get(8), LocalDateTime.of(2026, 4, 3, 0, 0), 3, 101L, 13L);
98 98 }
99 99  
  100 + @Test
  101 + public void testGenerateTeamShiftRecords_singleWithoutRotation() {
  102 + Long planId = 3002L;
  103 + LocalDateTime start = LocalDateTime.of(2026, 9, 21, 0, 0);
  104 + when(planService.getPlan(planId)).thenReturn(MesCalPlanDO.builder()
  105 + .id(planId).code("SINGLE-001").name("单白班")
  106 + .calendarType(1).startDate(start).endDate(start.plusDays(1))
  107 + .shiftType(MesCalShiftTypeEnum.SINGLE.getType())
  108 + .shiftMethod(null).shiftCount(null).build());
  109 + when(planShiftService.getPlanShiftListByPlanId(planId)).thenReturn(ListUtil.of(
  110 + MesCalPlanShiftDO.builder().id(11L).planId(planId).sort(1).name("白班")
  111 + .startTime("08:00").endTime("16:00").build()));
  112 + when(planTeamService.getPlanTeamListByPlanId(planId)).thenReturn(ListUtil.of(
  113 + MesCalPlanTeamDO.builder().id(21L).planId(planId).teamId(101L).build()));
  114 +
  115 + teamShiftService.generateTeamShiftRecords(planId);
  116 +
  117 + List<MesCalTeamShiftDO> records = teamShiftMapper.selectListByPlanId(planId);
  118 + records.sort(Comparator.comparing(MesCalTeamShiftDO::getDay));
  119 + assertEquals(2, records.size());
  120 + assertRecord(records.get(0), start, 1, 101L, 11L);
  121 + assertRecord(records.get(1), start.plusDays(1), 1, 101L, 11L);
  122 + }
  123 +
100 124 private static void assertRecord(MesCalTeamShiftDO actual, LocalDateTime day, Integer sort,
101 125 Long teamId, Long shiftId) {
102 126 assertEquals(day, actual.getDay());
... ...