RosteringServiceImpl.java
1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.pipihelper.project.rostering.service.impl;
import com.pipihelper.project.rostering.model.DateRuleModel;
import com.pipihelper.project.rostering.model.RosteringModel;
import com.pipihelper.project.rostering.model.ShiftRuleModel;
import com.pipihelper.project.rostering.model.StaffRuleModel;
import com.pipihelper.project.rostering.service.RosteringService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @description:
* @author: zsw
* @create: 2022-10-14 16:51
**/
@Service
public class RosteringServiceImpl implements RosteringService {
@Override
public List<RosteringModel> gen(List<String> staffs,
List<String> shifts,
List<ShiftRuleModel> shiftRuleModels,
List<StaffRuleModel> staffRuleModels,
List<DateRuleModel> dateRuleModels) {
//校验
verify(staffs, shifts, shiftRuleModels, staffRuleModels);
return null;
}
private void verify(List<String> staffs,
List<String> shifts,
List<ShiftRuleModel> shiftRuleModels,
List<StaffRuleModel> staffRuleModels) {
if (shiftRuleModels.stream().noneMatch(e -> shifts.contains(e.getName()))) {
throw new RuntimeException("班次配置不合法");
}
if (staffRuleModels.stream().noneMatch(e -> staffs.contains(e.getName()))) {
throw new RuntimeException("员工配置不合法");
}
}
}