浏览代码

人工客服和机器人客服统计 新增累计统计

王苗苗 2 月之前
父节点
当前提交
840a6cb040

+ 3 - 0
slibra-common/src/main/java/com/slibra/common/DecimalUtils.java

@@ -73,7 +73,10 @@ public class DecimalUtils {
         List<Integer> arr = new ArrayList<>();
         arr.add(1);
         arr.add(2);
+        arr.add(3);
         OptionalDouble average = arr.stream().mapToInt(Integer::intValue).average();
         System.out.println(average.getAsDouble());
+        int sum = arr.stream().mapToInt(Integer::intValue).sum();
+        System.out.println(sum);
     }
 }

+ 27 - 0
slibra-system/src/main/java/com/slibra/business/service/impl/TCallRecordServiceImpl.java

@@ -3,6 +3,7 @@ package com.slibra.business.service.impl;
 import java.io.File;
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.stream.Collectors;
 
 import com.alibaba.fastjson2.JSON;
 import com.slibra.business.domain.TCutOffWater;
@@ -326,6 +327,10 @@ public class TCallRecordServiceImpl implements ITCallRecordService
         return callRecordCount;
     }
 
+    /**
+     * 2024年12月31日14:07:53  新增累计统计
+     * @return
+     */
     @Override
     public List<CallUserCountInfo> userCallCount() {
         //先获取所有的人工信息 再查状态 再统计数据
@@ -348,6 +353,14 @@ public class TCallRecordServiceImpl implements ITCallRecordService
                 }
             }
         }
+        CallUserCountInfo callUserCountInfo = new CallUserCountInfo();
+        callUserCountInfo.setUserName("累计");
+        callUserCountInfo.setTotalTimes(result.stream().map(CallUserCountInfo::getTotalTimes).mapToLong(Long::longValue).sum());
+        callUserCountInfo.setInTodayCount(result.stream().map(CallUserCountInfo::getInTodayCount).mapToInt(Integer::intValue).sum());
+        callUserCountInfo.setInAllCount(result.stream().map(CallUserCountInfo::getInAllCount).mapToInt(Integer::intValue).sum());
+        callUserCountInfo.setOutTodayCount(result.stream().map(CallUserCountInfo::getOutTodayCount).mapToInt(Integer::intValue).sum());
+        callUserCountInfo.setOutAllCount(result.stream().map(CallUserCountInfo::getOutAllCount).mapToInt(Integer::intValue).sum());
+        result.add(callUserCountInfo);
         return result;
     }
 
@@ -367,6 +380,10 @@ public class TCallRecordServiceImpl implements ITCallRecordService
     }
 
 
+    /**
+     * 2024年12月31日14:07:53  新增累计统计
+     * @return
+     */
     @Override
     public List<CallUserCountInfo> robotCallCount() {
         //先获取所有的机器人信息 再查状态 再统计数据
@@ -391,6 +408,16 @@ public class TCallRecordServiceImpl implements ITCallRecordService
                 }
             }
         }
+        CallUserCountInfo callUserCountInfo = new CallUserCountInfo();
+        callUserCountInfo.setUserName("累计");
+//        callUserCountInfo.setTotalTimes(result.stream().map(CallUserCountInfo::getTotalTimes).mapToLong(Long::longValue).sum());
+        callUserCountInfo.setInTodayCount(result.stream().map(CallUserCountInfo::getInTodayCount).mapToInt(Integer::intValue).sum());
+        callUserCountInfo.setInAllCount(result.stream().map(CallUserCountInfo::getInAllCount).mapToInt(Integer::intValue).sum());
+//        callUserCountInfo.setOutTodayCount(result.stream().map(CallUserCountInfo::getOutTodayCount).mapToInt(Integer::intValue).sum());
+//        callUserCountInfo.setOutAllCount(result.stream().map(CallUserCountInfo::getOutAllCount).mapToInt(Integer::intValue).sum());
+        callUserCountInfo.setTodayTransferCount(result.stream().map(CallUserCountInfo::getTodayTransferCount).mapToInt(Integer::intValue).sum());
+        callUserCountInfo.setTotalTransferCount(result.stream().map(CallUserCountInfo::getTotalTransferCount).mapToInt(Integer::intValue).sum());
+        result.add(callUserCountInfo);
         return result;
     }