|
@@ -5,8 +5,10 @@ import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
+import com.slibra.business.domain.TBucketRecord;
|
|
|
import com.slibra.business.domain.TCutOffWater;
|
|
|
import com.slibra.business.domain.TUserInfo;
|
|
|
+import com.slibra.business.mapper.TBucketRecordMapper;
|
|
|
import com.slibra.business.mapper.TCutOffWaterMapper;
|
|
|
import com.slibra.business.mapper.TUserInfoMapper;
|
|
|
import com.slibra.business.res.*;
|
|
@@ -75,6 +77,10 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
|
|
|
@Autowired
|
|
|
private SysUserMapper sysUserMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TBucketRecordMapper bucketRecordMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询通话记录
|
|
|
*
|
|
@@ -553,24 +559,24 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
List<DayAndCountRes> recent7DayAndCounts = new ArrayList<>();
|
|
|
List<DayAndCountRes> recent7DayAndCountsLastYear = new ArrayList<>();
|
|
|
Date nowDate = DateUtils.getNowDate();
|
|
|
- String date = DateUtils.getDate();
|
|
|
+ String nowDateStr = DateUtils.getDate();
|
|
|
String sevenDaysAgo = DateUtils.plusDate(-DEFAULT_DAYS_QUERY_COUNT, nowDate, YYYY_MM_DD);
|
|
|
- List<String> allDatesInRangeStr = DateUtils.getAllDatesInRangeStr(sevenDaysAgo, date);
|
|
|
+ List<String> allDatesInRangeStr = DateUtils.getAllDatesInRangeStr(sevenDaysAgo, nowDateStr);
|
|
|
for (String todayYearDate : allDatesInRangeStr) {
|
|
|
DayAndCountRes dayAndCountRes = new DayAndCountRes();
|
|
|
dayAndCountRes.setDate(todayYearDate);
|
|
|
- dayAndCountRes.setCount(this.tCallRecordMapper.getCallInEqualsDay(todayYearDate));
|
|
|
+ dayAndCountRes.setCount(this.tCallRecordMapper.getCallInEqualsDay(todayYearDate, null, null));
|
|
|
recent7DayAndCounts.add(dayAndCountRes);
|
|
|
}
|
|
|
build.setRecent7DayAndCounts(recent7DayAndCounts);
|
|
|
//近七日呼入电话量趋势--去年数据
|
|
|
- String dateLastYear = DateUtils.getNYearSameDay(date, 1);
|
|
|
+ String dateLastYear = DateUtils.getNYearSameDay(nowDateStr, 1);
|
|
|
String sevenDaysAgoLastYear = DateUtils.getNYearSameDay(sevenDaysAgo, 1);
|
|
|
List<String> allDatesInRangeStrLastYear = DateUtils.getAllDatesInRangeStr(sevenDaysAgoLastYear, dateLastYear);
|
|
|
for (String lastYearDate : allDatesInRangeStrLastYear) {
|
|
|
DayAndCountRes dayAndCountRes = new DayAndCountRes();
|
|
|
dayAndCountRes.setDate(lastYearDate);
|
|
|
- dayAndCountRes.setCount(this.tCallRecordMapper.getCallInEqualsDay(lastYearDate));
|
|
|
+ dayAndCountRes.setCount(this.tCallRecordMapper.getCallInEqualsDay(lastYearDate, null, null));
|
|
|
recent7DayAndCountsLastYear.add(dayAndCountRes);
|
|
|
}
|
|
|
build.setRecent7DayAndCountsLastYear(recent7DayAndCountsLastYear);
|
|
@@ -614,8 +620,32 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
}
|
|
|
build.setBusinessTop7(top7ResList);
|
|
|
//今日机器人坐席情况
|
|
|
-
|
|
|
+ //type 0人工 1机器人 2转人工 通过service_category区分:0:0人工坐席 1:1机器人坐席 + 2机器人转人工 2:2机器人转人工
|
|
|
+ //status 0未接听 1已接通 不传,默认所有
|
|
|
+ build.setRobotInTotal(this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, 1, null));
|
|
|
+ long robotInTimes = this.tCallRecordMapper.getCallTimesEqualsDay(nowDateStr, 1);//0人工 1机器人 2转人工 通过service_category区分:0:0人工坐席 1:1机器人坐席 + 2机器人转人工 2:2机器人转人工
|
|
|
+ build.setRobotInTimes(robotInTimes);
|
|
|
+ //获取今日已接听的机器人坐席总呼入量
|
|
|
+ int callInTodaySuccess = this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, 1, 1);
|
|
|
+ if(callInTodaySuccess > 0)
|
|
|
+ build.setRobotTimesAvg(robotInTimes/callInTodaySuccess);
|
|
|
+ build.setTransfer2Human(this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, 2, null));
|
|
|
+ build.setRobotQueue(-1);//todo 逻辑如何处理
|
|
|
+ TBucketRecord bucketRecord = this.bucketRecordMapper.selectNewest();
|
|
|
+ if(!Objects.isNull(bucketRecord)){
|
|
|
+ build.setRobotStreamRate(bucketRecord.getAiPercent());
|
|
|
+ build.setHumanStreamRate(bucketRecord.getTraditionPercent());
|
|
|
+ }
|
|
|
//今日人工坐席情况
|
|
|
+ build.setHumanInTotal(this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, 0, null));
|
|
|
+ long humanInTimes = this.tCallRecordMapper.getCallTimesEqualsDay(nowDateStr, 0);
|
|
|
+ build.setHumanInTimes(humanInTimes);
|
|
|
+ //获取今日已接听的人工坐席总呼入量
|
|
|
+ int callInTodaySuccessHuman = this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, 0, 1);
|
|
|
+ if(callInTodaySuccessHuman > 0)
|
|
|
+ build.setHumanTimesAvg(humanInTimes/callInTodaySuccessHuman);
|
|
|
+ build.setOnlineTotal(this.tCallRecordMapper.getPersonCountByState(2));
|
|
|
+ build.setHumanQueue(-1);//todo 逻辑如何处理
|
|
|
return build;
|
|
|
}
|
|
|
|