Commit f0d9efa6 by 谢海旭

v5.7.0版本 飞行督导

1 parent 64740ed3
...@@ -44,7 +44,12 @@ public class SupervisorLearningCenterService { ...@@ -44,7 +44,12 @@ public class SupervisorLearningCenterService {
private MerchantStaffRemote merchantStaffRemote; private MerchantStaffRemote merchantStaffRemote;
public Page<CoursePageInfo> allCourse(RpcPagination<CourseSearchDTO> pagination) { public Page<CoursePageInfo> allCourse(RpcPagination<CourseSearchDTO> pagination) {
CourseSearchDTO condition= pagination.getCondition(); CourseSearchDTO condition = pagination.getCondition();
// Bug修复:condition 可能为 null,需初始化避免 NPE
if (condition == null) {
condition = new CourseSearchDTO();
pagination.setCondition(condition);
}
condition.setCourseStatus(BeisenCourseStatusEnum.RELEASED.getCode()); condition.setCourseStatus(BeisenCourseStatusEnum.RELEASED.getCode());
//分页查询 //分页查询
Page<CoursePageInfo> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize()); Page<CoursePageInfo> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
...@@ -65,8 +70,14 @@ public class SupervisorLearningCenterService { ...@@ -65,8 +70,14 @@ public class SupervisorLearningCenterService {
return false; return false;
} }
List<String> phoneList = coursePushList.stream().map(CoursePushDTO::getStoreManagerPhone).distinct().collect(Collectors.toList()); List<String> phoneList = coursePushList.stream()
List<BeiSenEmployeeListResonseDTO> employeeList = listEmployeeInfoByStaffPhone(phoneList); .map(CoursePushDTO::getStoreManagerPhone)
// Bug修复:过滤掉 null 和空字符串的手机号,防止传入 listEmployeeInfoByStaffPhone 后引发断言异常
.filter(phone -> phone != null && !phone.isEmpty())
.distinct()
.collect(Collectors.toList());
List<BeiSenEmployeeListResonseDTO> employeeList = org.apache.commons.collections4.CollectionUtils.isEmpty(phoneList)
? null : listEmployeeInfoByStaffPhone(phoneList);
Map<String, Integer> phoneUserIdMap = Collections.EMPTY_MAP; Map<String, Integer> phoneUserIdMap = Collections.EMPTY_MAP;
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(employeeList)) { if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(employeeList)) {
//构建map //构建map
......
...@@ -211,6 +211,10 @@ public class SupervisorTaskInfoService { ...@@ -211,6 +211,10 @@ public class SupervisorTaskInfoService {
req.setEndDate(DateUtil.endOfMonth(new Date()).toDateStr()); req.setEndDate(DateUtil.endOfMonth(new Date()).toDateStr());
req.setMerchantIds(merchantIdList); req.setMerchantIds(merchantIdList);
List<EmployeeRanking> rawEmployeeData = supervisorDashboardService.getDashboardMetrics(req); List<EmployeeRanking> rawEmployeeData = supervisorDashboardService.getDashboardMetrics(req);
// Bug修复:rawEmployeeData 可能为 null,直接 .stream() 会 NPE
if (rawEmployeeData == null) {
return BigDecimal.ZERO;
}
BigDecimal monthlyOutput = rawEmployeeData.stream() BigDecimal monthlyOutput = rawEmployeeData.stream()
.map(EmployeeRanking::getPersonalOutput) .map(EmployeeRanking::getPersonalOutput)
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
...@@ -766,6 +770,11 @@ public class SupervisorTaskInfoService { ...@@ -766,6 +770,11 @@ public class SupervisorTaskInfoService {
req.setEndDate(request.getEndDate()); req.setEndDate(request.getEndDate());
req.setNeedAiAnalysis(false); req.setNeedAiAnalysis(false);
SupervisorDashboardVO dashboardData = supervisorDashboardService.getDashboardData(req); SupervisorDashboardVO dashboardData = supervisorDashboardService.getDashboardData(req);
// Bug修复:dashboardData 可能为 null,需做空判断,防止 NPE
if (dashboardData == null) {
log.warn("获取Dashboard数据为null,supervisorPhone={}", supervisorPhone);
return new SupervisorDetailSummaryDTO();
}
DashboardMetrics metrics = dashboardData.getMetrics(); DashboardMetrics metrics = dashboardData.getMetrics();
SupervisorDetailSummaryDTO summary = new SupervisorDetailSummaryDTO(); SupervisorDetailSummaryDTO summary = new SupervisorDetailSummaryDTO();
...@@ -822,6 +831,11 @@ public class SupervisorTaskInfoService { ...@@ -822,6 +831,11 @@ public class SupervisorTaskInfoService {
req.setEndDate(request.getEndDate()); req.setEndDate(request.getEndDate());
req.setNeedAiAnalysis(false); req.setNeedAiAnalysis(false);
SupervisorDashboardVO dashboardData = supervisorDashboardService.getDashboardData(req); SupervisorDashboardVO dashboardData = supervisorDashboardService.getDashboardData(req);
// Bug修复:dashboardData 可能为 null,需做空判断,防止 NPE
if (dashboardData == null) {
log.warn("获取Dashboard数据为null,supervisorPhone={}", request.getSupervisorPhone());
return result;
}
List<EmployeeRanking> employeeList = dashboardData.getEmployeeList(); List<EmployeeRanking> employeeList = dashboardData.getEmployeeList();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!