From 3c75728eaade0a1ebd24f3fc5228c9377ae5ac5f Mon Sep 17 00:00:00 2001 From: wujingtao Date: Fri, 17 Jun 2022 17:06:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E9=95=BF=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=EF=BC=8Cs->m?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CallCostServiceImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/settlement/service/impl/CallCostServiceImpl.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/settlement/service/impl/CallCostServiceImpl.java index e2dec729..c535b5de 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/settlement/service/impl/CallCostServiceImpl.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/settlement/service/impl/CallCostServiceImpl.java @@ -85,14 +85,15 @@ public class CallCostServiceImpl implements CallCostService { log.info(" 用户 {} ,没有通话记录", userId); continue; } - long durationTotal = list.stream().mapToLong(UserReport::getBreatheTotalDuration).sum(); + //s->m + long durationTotal = list.stream().mapToLong(UserReport::getBreatheTotalDuration).sum() / 60; //今天的通话记录 List userReports = list.stream().filter(c -> DateTimeUtil.betweenByDay(c.getCreateTime(), DateUtil.date())).collect(Collectors.toList()); if (durationTotal > callDuration && userReports.size() > 0) { - //今天得通话时长 - long durationToday = userReports.get(0).getBreatheTotalDuration(); + //今天得通话时长(s->m) + long durationToday = userReports.get(0).getBreatheTotalDuration() / 60; //账户余额 CompanyDto companyById = companyService.findCompanyById(companyId); @@ -219,7 +220,11 @@ public class CallCostServiceImpl implements CallCostService { sumTimes++; } } - return NumberUtil.mul((double) (sumScore / sumTimes), price.doubleValue()); + double estimateAmountToDay = 0.00; + if (sumTimes > 0) { + estimateAmountToDay = (double) sumScore / sumTimes / 60; + } + return NumberUtil.mul(estimateAmountToDay, price.doubleValue()); } }