|
@@ -556,7 +556,7 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
public HomeCountResp homeScreenCount() {
|
|
|
HomeCountResp build = HomeCountResp.builder().build();
|
|
|
//获取7天前的日期
|
|
|
- String lastDate = DateUtils.plusDate(-DEFAULT_DAYS_QUERY_COUNT, DateUtils.getNowDate(), YYYY_MM_DD);
|
|
|
+ /*String lastDate = DateUtils.plusDate(-DEFAULT_DAYS_QUERY_COUNT, DateUtils.getNowDate(), YYYY_MM_DD);
|
|
|
//查询说明: type未空是查询所有呼入的 0:成功接通的
|
|
|
int inTotal = this.tCallRecordMapper.getRecentCallRecordAfterSomeDay(null, lastDate);
|
|
|
build.setInTotal(inTotal);
|
|
@@ -567,24 +567,34 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
build.setInTimes(inTimes);
|
|
|
if(inTotalSuccess > 0)
|
|
|
build.setInTimesAvg(inTimes/inTotalSuccess);
|
|
|
- build.setTotalTimes(this.tCallRecordMapper.getRecentCallTimes(null));
|
|
|
+ build.setTotalTimes(this.tCallRecordMapper.getRecentCallTimes(null));*/
|
|
|
build.setTotalCounts(this.tCallRecordMapper.getRecentCallRecordAfterSomeDay(null, null));
|
|
|
//近七日呼入电话量趋势
|
|
|
List<DayAndCountRes> recent7DayAndCounts = new ArrayList<>();
|
|
|
- List<DayAndCountRes> recent7DayAndCountsLastYear = new ArrayList<>();
|
|
|
+// List<DayAndCountRes> recent7DayAndCountsLastYear = new ArrayList<>();
|
|
|
+ //近7日AI处理情况
|
|
|
+ List<DayAndAiCountRes> ai7DayAndCounts = new ArrayList<>();
|
|
|
Date nowDate = DateUtils.getNowDate();
|
|
|
String nowDateStr = DateUtils.getDate();
|
|
|
String sevenDaysAgo = DateUtils.plusDate(-DEFAULT_DAYS_QUERY_COUNT, nowDate, YYYY_MM_DD);
|
|
|
List<String> allDatesInRangeStr = DateUtils.getAllDatesInRangeStr(sevenDaysAgo, nowDateStr);
|
|
|
- for (String todayYearDate : allDatesInRangeStr) {
|
|
|
+ for (String someDay : allDatesInRangeStr) {
|
|
|
DayAndCountRes dayAndCountRes = new DayAndCountRes();
|
|
|
- dayAndCountRes.setDate(todayYearDate);
|
|
|
- dayAndCountRes.setCount(this.tCallRecordMapper.getCallInEqualsDay(todayYearDate, null, null));
|
|
|
+ dayAndCountRes.setDate(someDay);
|
|
|
+ int someDayTotalCounts = this.tCallRecordMapper.getCallInEqualsDay(someDay, null, null);
|
|
|
+ dayAndCountRes.setCount(someDayTotalCounts);
|
|
|
recent7DayAndCounts.add(dayAndCountRes);
|
|
|
+ //下面是处理 近7日AI处理情况
|
|
|
+ DayAndAiCountRes dayAndAiCountRes = new DayAndAiCountRes();
|
|
|
+ dayAndAiCountRes.setDate(someDay);
|
|
|
+ dayAndAiCountRes.setTotalCounts(someDayTotalCounts);
|
|
|
+ dayAndAiCountRes.setAiCounts(this.tCallRecordMapper.getCallInEqualsDay(someDay, 3, null));
|
|
|
+ ai7DayAndCounts.add(dayAndAiCountRes);
|
|
|
}
|
|
|
build.setRecent7DayAndCounts(recent7DayAndCounts);
|
|
|
+ build.setAi7DayAndCounts(ai7DayAndCounts);
|
|
|
//近七日呼入电话量趋势--去年数据
|
|
|
- String dateLastYear = DateUtils.getNYearSameDay(nowDateStr, 1);
|
|
|
+ /*String dateLastYear = DateUtils.getNYearSameDay(nowDateStr, 1);
|
|
|
String sevenDaysAgoLastYear = DateUtils.getNYearSameDay(sevenDaysAgo, 1);
|
|
|
List<String> allDatesInRangeStrLastYear = DateUtils.getAllDatesInRangeStr(sevenDaysAgoLastYear, dateLastYear);
|
|
|
for (String lastYearDate : allDatesInRangeStrLastYear) {
|
|
@@ -618,7 +628,9 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
dayAndCountRes.setCount(this.tCallRecordMapper.getCallInEqualsMonth(lastYearMonth));
|
|
|
recent7MonthAndCountsLastYear.add(dayAndCountRes);
|
|
|
}
|
|
|
- build.setRecent7MonthAndCountsLastYear(recent7MonthAndCountsLastYear);
|
|
|
+ build.setRecent7MonthAndCountsLastYear(recent7MonthAndCountsLastYear);*/
|
|
|
+ //获取当前的月份
|
|
|
+ String nowMonth = DateUtils.parseDateToStr(DateUtils.YYYY_MM, nowDate);
|
|
|
//本月业务类型 top7 处理
|
|
|
List<Top7Res> top7ResList = this.tCallRecordMapper.getTop7ResListByMonthAndSize(nowMonth, DEFAULT_DAYS_QUERY_COUNT+1);
|
|
|
//处理展示数据
|
|
@@ -636,7 +648,7 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
//今日机器人坐席情况
|
|
|
//type 0人工 1机器人 2转人工 通过service_category区分:0:0人工坐席 1:1机器人坐席 + 2机器人转人工 2:2机器人转人工
|
|
|
//status 0未接听 1已接通 不传,默认所有
|
|
|
- build.setRobotInTotal(this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, 1, null));
|
|
|
+ /*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);
|
|
|
//获取今日已接听的机器人坐席总呼入量
|
|
@@ -644,7 +656,7 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
if(callInTodaySuccess > 0)
|
|
|
build.setRobotTimesAvg(robotInTimes/callInTodaySuccess);
|
|
|
build.setTransfer2Human(this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, 2, null));
|
|
|
- build.setRobotQueue(-1);//todo 逻辑如何处理
|
|
|
+ build.setRobotQueue(-1);
|
|
|
TBucketRecord bucketRecord = this.bucketRecordMapper.selectNewest();
|
|
|
if(!Objects.isNull(bucketRecord)){
|
|
|
build.setRobotStreamRate(bucketRecord.getAiPercent());
|
|
@@ -659,7 +671,42 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
if(callInTodaySuccessHuman > 0)
|
|
|
build.setHumanTimesAvg(humanInTimes/callInTodaySuccessHuman);
|
|
|
build.setOnlineTotal(this.tCallRecordMapper.getPersonCountByState(2));
|
|
|
- build.setHumanQueue(-1);//todo 逻辑如何处理
|
|
|
+ build.setHumanQueue(-1);*/
|
|
|
+ //2025年02月18日15:13:32 下面开始处理新增的单个字段逻辑
|
|
|
+ int todayInTotal = this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, null, null);
|
|
|
+ build.setTodayInTotal(todayInTotal);
|
|
|
+ int todayAiTotal = this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, 3, null);
|
|
|
+ build.setTodayAiTotal(todayAiTotal);
|
|
|
+ long totalTimes = this.tCallRecordMapper.getRecentCallTimes(nowDateStr);
|
|
|
+ build.setTotalTimes(totalTimes);
|
|
|
+ build.setRobotCounts(DEFAULT_ROBOT_COUNTS);
|
|
|
+ build.setOnlineUserCounts(this.tCallRecordMapper.getPersonCountByState(2));
|
|
|
+ int todayHumanTotal = this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, 4, 1);
|
|
|
+ build.setTodayHumanTotal(todayHumanTotal);
|
|
|
+ int todaySuccessCounts = this.tCallRecordMapper.getCallInEqualsDay(nowDateStr, null, 1);
|
|
|
+ build.setTodaySuccessCounts(todaySuccessCounts);
|
|
|
+ if(todayInTotal > 0){
|
|
|
+ build.setTodayInTimesAvg(totalTimes/todayInTotal);
|
|
|
+ build.setTodayAiRate(DecimalUtils.getNLengthHalfUp(new BigDecimal(todayAiTotal/(double)todayInTotal).multiply(BigDecimal_100), INT_2));
|
|
|
+ build.setTodayHumanRate(DecimalUtils.getNLengthHalfUp(new BigDecimal(todayHumanTotal/(double)todayInTotal).multiply(BigDecimal_100), INT_2));
|
|
|
+ build.setTodaySuccessRate(DecimalUtils.getNLengthHalfUp(new BigDecimal(todaySuccessCounts/(double)todayInTotal).multiply(BigDecimal_100), INT_2));
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取昨日的日期
|
|
|
+ String yesterdayDate = DateUtils.plusDate(-YESTERDAY_DAYS_QUERY_COUNT, nowDate, YYYY_MM_DD);
|
|
|
+ int yesterdayInTotal = this.tCallRecordMapper.getCallInEqualsDay(yesterdayDate, null, null);
|
|
|
+ build.setYesterdayInTotal(yesterdayInTotal);
|
|
|
+ int yesterdayAiTotal = this.tCallRecordMapper.getCallInEqualsDay(yesterdayDate, 3, null);
|
|
|
+ build.setYesterdayAiTotal(yesterdayAiTotal);
|
|
|
+ int yesterdayHumanTotal = this.tCallRecordMapper.getCallInEqualsDay(yesterdayDate, 4, 1);
|
|
|
+ build.setYesterdayHumanTotal(yesterdayHumanTotal);
|
|
|
+ int yesterdaySuccessCounts = this.tCallRecordMapper.getCallInEqualsDay(yesterdayDate, null, 1);
|
|
|
+ build.setYesterdaySuccessCounts(yesterdaySuccessCounts);
|
|
|
+ if(yesterdayInTotal > 0){
|
|
|
+ build.setYesterdayAiRate(DecimalUtils.getNLengthHalfUp(new BigDecimal(yesterdayAiTotal/(double)yesterdayInTotal).multiply(BigDecimal_100), INT_2));
|
|
|
+ build.setYesterdayHumanRate(DecimalUtils.getNLengthHalfUp(new BigDecimal(yesterdayHumanTotal/(double)yesterdayInTotal).multiply(BigDecimal_100), INT_2));
|
|
|
+ build.setYesterdaySuccessRate(DecimalUtils.getNLengthHalfUp(new BigDecimal(yesterdaySuccessCounts/(double)yesterdayInTotal).multiply(BigDecimal_100), INT_2));
|
|
|
+ }
|
|
|
return build;
|
|
|
}
|
|
|
|