|
@ -70,6 +70,8 @@ public class SynergyManageService extends BaseJpaService {
|
|
|
private TownDao townDao;
|
|
|
@Autowired
|
|
|
private FastDFSUtil fastDFSUtil;
|
|
|
@Autowired
|
|
|
private ManageCustomerOnlineRecordDao manageCustomerOnlineRecordDao;
|
|
|
|
|
|
/**
|
|
|
* 根据服务编码获取工单
|
|
@ -1217,18 +1219,59 @@ public class SynergyManageService extends BaseJpaService {
|
|
|
return jdbcTemplate.update(sql);
|
|
|
}
|
|
|
|
|
|
public void customerIndex(String userCode){
|
|
|
public Map<String,Object> customerIndex(String userCode){
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
String today = DateUtil.dateToStrShort(new Date());
|
|
|
String callSql ="SELECT * FROM manage_call_record WHERE user_code='"+userCode+"' and create_time>='"+today+" 00:00:00' and create_time<='"+today+" 23:59:59'";
|
|
|
//今日外呼量
|
|
|
//--------------今日外呼量-----------------//
|
|
|
List<CallRecord> waihudList = jdbcTemplate.query(callSql+" and type=2",new BeanPropertyRowMapper<>(CallRecord.class));
|
|
|
int customerNoCount = 0;
|
|
|
for(CallRecord callRecord : waihudList){
|
|
|
//获取客户未接通数量
|
|
|
if(callRecord.getAnswerStatus()==3){
|
|
|
customerNoCount++;
|
|
|
}
|
|
|
}
|
|
|
//求总时长
|
|
|
int seconds = totalTaklTime(waihudList);
|
|
|
//求平均时长
|
|
|
map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
|
|
|
map.put("waihuCount",waihudList.size());
|
|
|
map.put("waihuCustomerNoCount",customerNoCount);
|
|
|
|
|
|
//--------------今日在线时长-----------------//
|
|
|
String startTime=today+" 00:00:00";
|
|
|
String endTime = today+" 23:59:59";
|
|
|
List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
|
|
|
String onLineTime = manageCustomerOnlineRecordDOList.get(0).getTotalOnlineTime();
|
|
|
for (ManageCustomerOnlineRecordDO customerOnlineRecordDO : manageCustomerOnlineRecordDOList){
|
|
|
|
|
|
}
|
|
|
|
|
|
//--------------今日接入量-----------------//
|
|
|
List<CallRecord> jieruList = jdbcTemplate.query(callSql+" and type=1",new BeanPropertyRowMapper<>(CallRecord.class));
|
|
|
//求总时长
|
|
|
int jieruTotalSecond = totalTaklTime(jieruList);
|
|
|
//求平均时长
|
|
|
map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
|
|
|
map.put("jieruCount",jieruList.size());
|
|
|
|
|
|
//--------------今日协同任务外呼数-----------------//
|
|
|
|
|
|
return map;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 返回总的秒数
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
public int totalTaklTime(List<CallRecord> list){
|
|
|
int hours = 0;
|
|
|
int minutes = 0;
|
|
|
int seconds = 0;
|
|
|
for(CallRecord callRecord : waihudList){
|
|
|
//求总时长
|
|
|
for(CallRecord callRecord : list){
|
|
|
if (callRecord.getAnswerStatus()==1){
|
|
|
String talkTime = callRecord.getTalkTime();
|
|
|
String[] talkTimeStr = talkTime.split(":");
|
|
@ -1244,29 +1287,26 @@ public class SynergyManageService extends BaseJpaService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//获取客户未接通数量
|
|
|
if(callRecord.getAnswerStatus()==3){
|
|
|
customerNoCount++;
|
|
|
}
|
|
|
}
|
|
|
String avgTalkTime = "";
|
|
|
seconds = hours*3600+minutes*60+seconds;
|
|
|
avgTalkTime =seconds/3600+"时";
|
|
|
if (seconds%3600==0){
|
|
|
avgTalkTime +="0分0秒";
|
|
|
return seconds;
|
|
|
}
|
|
|
|
|
|
public String getAvgTime(int totalSeconds,int count){
|
|
|
int avgSeconds = totalSeconds/count;
|
|
|
String avgTalkTime = "";
|
|
|
avgTalkTime =avgSeconds/3600+"时";
|
|
|
if (avgSeconds%3600==0){
|
|
|
avgTalkTime +="0分0秒";
|
|
|
}else {
|
|
|
if (seconds%3600%60==0){
|
|
|
avgTalkTime +=seconds%3600/60+"分0秒";
|
|
|
}else {
|
|
|
avgTalkTime +=seconds%3600/60+"分"+seconds%3600%60+"秒";
|
|
|
}
|
|
|
if (avgSeconds%3600%60==0){
|
|
|
avgTalkTime +=avgSeconds%3600/60+"分0秒";
|
|
|
}else {
|
|
|
avgTalkTime +=avgSeconds%3600/60+"分"+avgSeconds%3600%60+"秒";
|
|
|
}
|
|
|
}
|
|
|
map.put("waihuCount",waihudList.size());
|
|
|
map.put("waihuCustomerNoCount",customerNoCount);
|
|
|
map.put("waihuAvgTalkTime",avgTalkTime);
|
|
|
|
|
|
return avgTalkTime;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 添加客户操作记录
|
|
|
* @param workorderCode
|
|
@ -1303,4 +1343,49 @@ public class SynergyManageService extends BaseJpaService {
|
|
|
byte[] bb =FastDFSUtil.download(groupName,remoteFileName);
|
|
|
|
|
|
}
|
|
|
|
|
|
public Map<String,Object> adminIndex(String userCode){
|
|
|
List<User> userList = userDao.findByType(4);
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
String today = DateUtil.dateToStrShort(new Date());
|
|
|
String callSql ="SELECT" +
|
|
|
" r.*" +
|
|
|
" FROM" +
|
|
|
" manage_call_record r" +
|
|
|
" LEFT JOIN wlyy_user u ON r.user_code = u.`code`" +
|
|
|
" WHERE" +
|
|
|
" u.type = 4" +
|
|
|
" AND r.create_time >= '"+today+" 00:00:00'" +
|
|
|
" AND r.create_time <= '"+today+" 23:59:59'";
|
|
|
//--------------今日外呼量-----------------//
|
|
|
List<CallRecord> waihudList = jdbcTemplate.query(callSql+" and r.type=2",new BeanPropertyRowMapper<>(CallRecord.class));
|
|
|
//求总时长
|
|
|
int seconds = totalTaklTime(waihudList);
|
|
|
//求平均时长
|
|
|
map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
|
|
|
map.put("waihuCount",waihudList.size());
|
|
|
|
|
|
//--------------今日在线时长-----------------//
|
|
|
String startTime=today+" 00:00:00";
|
|
|
String endTime = today+" 23:59:59";
|
|
|
List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
|
|
|
String onLineTime = manageCustomerOnlineRecordDOList.get(0).getTotalOnlineTime();
|
|
|
for (ManageCustomerOnlineRecordDO customerOnlineRecordDO : manageCustomerOnlineRecordDOList){
|
|
|
|
|
|
}
|
|
|
|
|
|
//--------------今日接入量-----------------//
|
|
|
List<CallRecord> jieruList = jdbcTemplate.query(callSql+" and r.type=1",new BeanPropertyRowMapper<>(CallRecord.class));
|
|
|
//求总时长
|
|
|
int jieruTotalSecond = totalTaklTime(jieruList);
|
|
|
//求平均时长
|
|
|
map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
|
|
|
map.put("jieruCount",jieruList.size());
|
|
|
|
|
|
//--------------今日协同任务外呼数-----------------//
|
|
|
|
|
|
return map;
|
|
|
|
|
|
}
|
|
|
}
|