diff --git a/admin/src/main/java/com/baiye/modules/distribute/service/impl/DistributeReportServiceImpl.java b/admin/src/main/java/com/baiye/modules/distribute/service/impl/DistributeReportServiceImpl.java index 576b187..61634f6 100644 --- a/admin/src/main/java/com/baiye/modules/distribute/service/impl/DistributeReportServiceImpl.java +++ b/admin/src/main/java/com/baiye/modules/distribute/service/impl/DistributeReportServiceImpl.java @@ -87,8 +87,7 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl distributeReportUserList = distributeReportUserMapper.selectList(null); for (DistributeReportUserEntity distributeReportUserEntity : distributeReportUserList) { ReportFlowVO reportFlowVO = new ReportFlowVO(); @@ -118,15 +117,14 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl distributeReportUserList = distributeReportUserMapper - .selectList(wrapperUser); + .selectList(wrapperUser); if (CollUtil.isNotEmpty(distributeReportUserList)) { for (DistributeReportUserEntity distributeReportUserEntity : distributeReportUserList) { yesterdayImportNum += distributeReportUserEntity.getTodayNum(); yesterdayDistributeNum += distributeReportUserEntity.getDistributeNum(); } } - } - else { + } else { if (userId == null) { throw new BadRequestException("参数异常"); } @@ -155,15 +153,20 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl collect = allRecordInTodayList.stream() - .map(ClueRecordEntity::getCreateBy) - .collect(Collectors.toSet()); + .map(ClueRecordEntity::getCreateBy) + .collect(Collectors.toSet()); Map userNameList = getUserName(collect); // 1.按公司分组 Map> recordByUserMap = allRecordInTodayList.stream() - .collect(Collectors.groupingBy(ClueRecordEntity::getCreateBy)); + .collect(Collectors.groupingBy(ClueRecordEntity::getCreateBy)); if (ObjectUtil.isEmpty(recordByUserMap)) { return; } @@ -171,8 +174,9 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl().select(DistributeReportUserEntity::getTotalNum)); - int sum = allRecordInTodayList.stream().mapToInt(ClueRecordEntity::getSuccessNum).sum(); + int totalAll = historyTotal.intValue() + sum; + // 记录之前得统计id List ids = new ArrayList<>(); for (Map.Entry> entry : recordByUserMap.entrySet()) { @@ -182,8 +186,8 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl() - .eq(DistributeReportUserEntity::getUserId, userId)); + .selectOne(new LambdaQueryWrapper() + .eq(DistributeReportUserEntity::getUserId, userId)); int yesterdayNum = 0; int yesterdayTotalNum = 0; if (distributeReportUserByYesterday != null) { @@ -195,17 +199,16 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl c.getAllocationStatus() == 1) - .mapToInt(ClueRecordEntity::getSuccessNum) - .sum(); + .filter(c -> c.getAllocationStatus() == 1) + .mapToInt(ClueRecordEntity::getSuccessNum) + .sum(); double ratio; ratio = NumberUtil.div(totalNum, totalAll); double ratioDay = 0.0; @@ -227,13 +230,13 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl clueRecordByUserList, Long userId, Integer totalNumByUser, - String userName) { + String userName) { List list = new ArrayList<>(); List distributeReportEntityList = new ArrayList<>(); // .按渠道分组 Map> recordByChannelMap = clueRecordByUserList.stream() - .filter(c -> StrUtil.isNotBlank(c.getChannelIdentifying())) - .collect(Collectors.groupingBy(ClueRecordEntity::getChannelIdentifying)); + .filter(c -> StrUtil.isNotBlank(c.getChannelIdentifying())) + .collect(Collectors.groupingBy(ClueRecordEntity::getChannelIdentifying)); if (ObjectUtil.isEmpty(recordByChannelMap)) { return; } @@ -244,9 +247,9 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl() - .eq(DistributeReportChannelEntity::getUserId, userId) - .eq(DistributeReportChannelEntity::getChannel, channel)); + .selectOne(new LambdaQueryWrapper() + .eq(DistributeReportChannelEntity::getUserId, userId) + .eq(DistributeReportChannelEntity::getChannel, channel)); int yesterdayNum = 0; int yesterdayTotalNum = 0; if (distributeReportUserByYesterday != null) { @@ -256,15 +259,14 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl c.getAllocationStatus() == 1) - .mapToInt(ClueRecordEntity::getSuccessNum) - .sum(); + .filter(c -> c.getAllocationStatus() == 1) + .mapToInt(ClueRecordEntity::getSuccessNum) + .sum(); double ratio = NumberUtil.div(totalNum, totalNumByUser.intValue()); double ratioDay = 0.0; if (yesterdayNum > 0) { @@ -287,7 +289,7 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl getReportFlowList(List distributeReportEntityList, - Date beginTime, Date endTime) { + Date beginTime, Date endTime) { Map callMap = new HashMap<>(8); for (DistributeReportEntity reportDeduct : distributeReportEntityList) { callMap.put(reportDeduct.getCreateTime().toString(), reportDeduct); @@ -302,8 +304,7 @@ public class DistributeReportServiceImpl extends ExtendServiceImpl