Commit d47dbc6d by 谢海旭

v5.7.0版本 飞行督导

1 parent a08de2fb
......@@ -86,10 +86,26 @@ public class SupervisorEmployeeTrainingInfoService {
}
List<BeiSenEmployeeListResonseDTO> beiSenEmployeeList = supervisorLearningCenterService.listEmployeeInfoByStaffPhone(phoneList);
List<Integer> beiSenUserIdList = beiSenEmployeeList.stream().map(beiSenEmployeeListResonseDTO -> beiSenEmployeeListResonseDTO.getUserID()).collect(Collectors.toList());
// Bug修复:listEmployeeInfoByStaffPhone 可能返回 null,需做空判断,防止 NPE
if (CollectionUtils.isEmpty(beiSenEmployeeList)) {
log.warn("北森未找到对应员工信息,supervisorPhone={}", request.getSupervisorPhone());
return new ArrayList<>();
}
List<Integer> beiSenUserIdList = beiSenEmployeeList.stream()
.map(BeiSenEmployeeListResonseDTO::getUserID)
.filter(id -> id != null)
.collect(Collectors.toList());
Map<Integer, MapperQueryEmployeeTrainingInfoDTO> studyHoursMap = supervisorTaskInfoMapper.queryStudyHours(beiSenUserIdList, request.getStartDate(), request.getEndDate());
Map<Integer, MapperQueryEmployeeTrainingInfoDTO> completedCoursesMap = supervisorTaskInfoMapper.queryCompletedCourses(beiSenUserIdList, request.getStartDate(), request.getEndDate());
Map<Integer, MapperQueryEmployeeTrainingInfoDTO> studyHoursMap;
Map<Integer, MapperQueryEmployeeTrainingInfoDTO> completedCoursesMap;
// Bug修复:beiSenUserIdList 可能为空,避免传空列表到 SQL 的 IN 子句导致语法错误
if (CollectionUtils.isEmpty(beiSenUserIdList)) {
studyHoursMap = new java.util.HashMap<>();
completedCoursesMap = new java.util.HashMap<>();
} else {
studyHoursMap = supervisorTaskInfoMapper.queryStudyHours(beiSenUserIdList, request.getStartDate(), request.getEndDate());
completedCoursesMap = supervisorTaskInfoMapper.queryCompletedCourses(beiSenUserIdList, request.getStartDate(), request.getEndDate());
}
Map<String, MapperQueryEmployeeTrainingInfoDTO> coachingTimesMap = supervisorTaskInfoMapper.queryCoachingTimes(phoneList, request.getStartDate(), request.getEndDate());
List<EmployeeTrainingInfoDTO> employeeTrainingInfoList = beiSenEmployeeList.stream().map(beiSenEmployeeListResonseDTO -> {
......
......@@ -25,9 +25,10 @@ public class SupervisorEmployeeTrainingInfoServiceTest extends BaseServiceTest {
@Test
public void testGetAllEmployeeTrainingInfo() {
EmployeeTrainingInfoRequestDTO request = new EmployeeTrainingInfoRequestDTO();
request.setSupervisorPhone("13603070903");
request.setStartDate("2021-03-12");
request.setEndDate("2026-03-12");
request.setStoreManagerPhone("13132112126");
request.setStoreManagerPhone("13132112125");
request.setSortField(1);
request.setSortOrder(1);
List<EmployeeTrainingInfoDTO> trainingInfo = supervisorEmployeeTrainingInfoService.getAllEmployeeTrainingInfo(request);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!