|
|
@@ -66,9 +66,13 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService {
|
|
|
if (as !=null){
|
|
|
if (as.getCallSum()!=null)adminStatisticsBo.setCallSum(as.getCallSum());
|
|
|
if (as.getCallDurationSum()!=null)adminStatisticsBo.setCallDurationSum(as.getCallDurationSum());
|
|
|
+ if (as.getConnectSum()!=null)adminStatisticsBo.setConnectSum(as.getConnectSum());
|
|
|
+ if (as.getValidSum()!=null)adminStatisticsBo.setValidSum(as.getValidSum());
|
|
|
}else {
|
|
|
adminStatisticsBo.setCallSum(0);
|
|
|
adminStatisticsBo.setCallDurationSum(BigDecimal.ZERO);
|
|
|
+ adminStatisticsBo.setConnectSum(0);
|
|
|
+ adminStatisticsBo.setValidSum(0);
|
|
|
}
|
|
|
//添加销售团队数据
|
|
|
statisticsSalesTeam(adminStatisticsBo,aid,startTime,endTime);
|
|
|
@@ -96,16 +100,23 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService {
|
|
|
}
|
|
|
Set<String> set = new HashSet<>(list);
|
|
|
int teamCallSum=0;
|
|
|
+ int teamConnectSum=0;
|
|
|
+ int teamValidSum=0;
|
|
|
BigDecimal teamCallDurationSum=BigDecimal.ZERO;
|
|
|
for (String s : set) {
|
|
|
AdminStatisticsBo as=callLogMapper.selectAdminCallSum(s,startTime,endTime);
|
|
|
if (as != null) {
|
|
|
if (as.getCallSum()!= null) teamCallSum = teamCallSum + as.getCallSum();
|
|
|
if (as.getCallDurationSum()!= null) teamCallDurationSum = teamCallDurationSum.add(as.getCallDurationSum());
|
|
|
+ if (as.getConnectSum() !=null) teamConnectSum = teamConnectSum + as.getConnectSum();
|
|
|
+ if (as.getValidSum()!=null) teamValidSum = teamValidSum + as.getValidSum();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
res.setTeamPeopleSum(set.size());
|
|
|
res.setTeamCallSum(teamCallSum);
|
|
|
+ res.setTeamConnectSum(teamConnectSum);
|
|
|
+ res.setTeamValidSum(teamValidSum);
|
|
|
res.setTeamCallDurationSum(teamCallDurationSum);
|
|
|
|
|
|
}
|
|
|
@@ -336,16 +347,21 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService {
|
|
|
@Override
|
|
|
@Cacheable(value = "salesTeam#600", key = "'key:'+#aid+'_'+#startTime+'-'+#endTime")
|
|
|
public Object salesTeam(String aid,String startTime, String endTime) {
|
|
|
+ endTime=endTime+" 23:59:59";
|
|
|
List<SalesTeamBo> resList=new ArrayList<>();
|
|
|
List<SalesTeam> salesTeams = salesTeamMapper.queryByAid(aid);
|
|
|
//如果不是团队负责人,所有数据都为null
|
|
|
int teamCallSum=0;
|
|
|
+ int teamConnectSum=0;
|
|
|
+ int teamValidSum=0;
|
|
|
BigDecimal teamCallDurationSum=BigDecimal.ZERO;
|
|
|
//先计算负责人
|
|
|
AdminStatisticsBo ab=callLogMapper.selectAdminCallSum(aid,startTime,endTime);
|
|
|
if (ab!= null) {
|
|
|
if (ab.getCallSum()!= null) teamCallSum = teamCallSum + ab.getCallSum();
|
|
|
if (ab.getCallDurationSum()!= null) teamCallDurationSum = teamCallDurationSum.add(ab.getCallDurationSum());
|
|
|
+ if (ab.getConnectSum()!= null) teamConnectSum = teamConnectSum + ab.getConnectSum();
|
|
|
+ if (ab.getValidSum()!= null) teamValidSum = teamValidSum + ab.getValidSum();
|
|
|
}
|
|
|
if (!salesTeams.isEmpty()){
|
|
|
//先获取顶层再迭代获取每一层
|
|
|
@@ -358,11 +374,15 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService {
|
|
|
if (as != null) {
|
|
|
if (as.getCallSum()!= null) teamCallSum = teamCallSum + as.getCallSum();
|
|
|
if (as.getCallDurationSum()!= null) teamCallDurationSum = teamCallDurationSum.add(as.getCallDurationSum());
|
|
|
+ if (as.getConnectSum()!= null) teamConnectSum = teamConnectSum + as.getConnectSum();
|
|
|
+ if (as.getValidSum()!= null) teamValidSum = teamValidSum + as.getValidSum();
|
|
|
}
|
|
|
}
|
|
|
salesTeamBo.setTeamCallSum(teamCallSum);
|
|
|
salesTeamBo.setTeamCallDurationSum(teamCallDurationSum);
|
|
|
salesTeamBo.setTeamPeopleSum(admins.size());
|
|
|
+ salesTeamBo.setTeamConnectSum(teamConnectSum);
|
|
|
+ salesTeamBo.setTeamValidSum(teamValidSum);
|
|
|
resList.add(salesTeamBo);
|
|
|
addSonTeam(resList,salesTeamBo,startTime,endTime);
|
|
|
}
|
|
|
@@ -385,12 +405,16 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService {
|
|
|
for (SalesTeam e : salesTeams) {
|
|
|
SalesTeamBo salesTeamBo2 = new SalesTeamBo(e);
|
|
|
int teamCallSum=0;
|
|
|
+ int teamConnectSum=0;
|
|
|
+ int teamValidSum=0;
|
|
|
BigDecimal teamCallDurationSum=BigDecimal.ZERO;
|
|
|
//先计算负责人
|
|
|
AdminStatisticsBo ab=callLogMapper.selectAdminCallSum(e.getAid(),startTime,endTime);
|
|
|
if (ab!= null) {
|
|
|
if (ab.getCallSum()!= null) teamCallSum = teamCallSum + ab.getCallSum();
|
|
|
if (ab.getCallDurationSum()!= null) teamCallDurationSum = teamCallDurationSum.add(ab.getCallDurationSum());
|
|
|
+ if (ab.getConnectSum()!= null) teamConnectSum = teamConnectSum + ab.getConnectSum();
|
|
|
+ if (ab.getValidSum()!= null) teamValidSum = teamValidSum + ab.getValidSum();
|
|
|
}
|
|
|
List<Admin> admins = adminMapper.queryByTeamId(e.getId());
|
|
|
for (Admin admin : admins) {
|
|
|
@@ -398,16 +422,22 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService {
|
|
|
if (as!= null) {
|
|
|
if (as.getCallSum()!= null) teamCallSum = teamCallSum + as.getCallSum();
|
|
|
if (as.getCallDurationSum()!= null) teamCallDurationSum = teamCallDurationSum.add(as.getCallDurationSum());
|
|
|
+ if (as.getConnectSum()!= null) teamConnectSum = teamConnectSum + as.getConnectSum();
|
|
|
+ if (as.getValidSum()!= null) teamValidSum = teamValidSum + as.getValidSum();
|
|
|
}
|
|
|
}
|
|
|
salesTeamBo2.setTeamCallSum(teamCallSum);
|
|
|
salesTeamBo2.setTeamCallDurationSum(teamCallDurationSum);
|
|
|
+ salesTeamBo2.setTeamConnectSum(teamConnectSum);
|
|
|
+ salesTeamBo2.setTeamValidSum(teamValidSum);
|
|
|
salesTeamBo2.setTeamPeopleSum(admins.size());
|
|
|
//迭代计算并赋值给上一层
|
|
|
addSonTeam(list,salesTeamBo2,startTime,endTime);
|
|
|
if (salesTeamBo2.getTeamPeopleSum()!=null)salesTeamBo.setTeamPeopleSum(salesTeamBo.getTeamPeopleSum() + salesTeamBo2.getTeamPeopleSum());
|
|
|
if (salesTeamBo2.getTeamCallSum()!=null)salesTeamBo.setTeamCallSum(salesTeamBo.getTeamCallSum()+salesTeamBo2.getTeamCallSum());
|
|
|
if (salesTeamBo2.getTeamCallDurationSum()!=null)salesTeamBo.setTeamCallDurationSum(salesTeamBo.getTeamCallDurationSum().add(salesTeamBo2.getTeamCallDurationSum()));
|
|
|
+ if (salesTeamBo2.getTeamConnectSum()!=null)salesTeamBo.setTeamConnectSum(salesTeamBo.getTeamConnectSum()+salesTeamBo2.getTeamConnectSum());
|
|
|
+ if (salesTeamBo2.getTeamValidSum()!=null)salesTeamBo.setTeamValidSum(salesTeamBo.getTeamValidSum()+salesTeamBo2.getTeamValidSum());
|
|
|
list.add(salesTeamBo2);
|
|
|
}
|
|
|
}
|