|
|
@@ -554,9 +554,19 @@ public class ApiController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //去重,对同一个任务重复录入号码筛选
|
|
|
+ List<String> duplicateList = ccCallPhoneService.isDuplicateEntry(batchId, commonCallListModel.getPhoneList());
|
|
|
+ if (!CollectionUtils.isEmpty(duplicateList)) {
|
|
|
+ commonCallListModel.setPhoneList(commonCallListModel.getPhoneList().stream()
|
|
|
+ .filter(p -> !duplicateList.contains(p.getPhoneNum()))
|
|
|
+ .collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isEmpty(commonCallListModel.getPhoneList())) {
|
|
|
+ throw new RuntimeException("过滤重复数据后无有效数据,重复号码:" + String.join(",", duplicateList));
|
|
|
+ }
|
|
|
|
|
|
// 追加名单
|
|
|
- Integer successCount = 0;
|
|
|
+ int successCount = 0;
|
|
|
List<CcCallPhone> callPhoneList = new ArrayList<>();
|
|
|
for (CommonPhoneModel commonPhoneModel : commonCallListModel.getPhoneList()) {
|
|
|
String phoneNum = commonPhoneModel.getPhoneNum();
|
|
|
@@ -572,7 +582,7 @@ public class ApiController extends BaseController {
|
|
|
callPhoneList = new ArrayList<>();
|
|
|
}
|
|
|
}
|
|
|
- if (callPhoneList.size() > 0) {
|
|
|
+ if (!callPhoneList.isEmpty()) {
|
|
|
ccCallPhoneService.batchInsertCcCallPhone(callPhoneList);
|
|
|
}
|
|
|
log.info("成功追加" + successCount + "个名单");
|
|
|
@@ -1256,4 +1266,143 @@ public class ApiController extends BaseController {
|
|
|
}
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通话记录查询接口(返回完整的数据表格式)
|
|
|
+ */
|
|
|
+ @PostMapping("/call/phone/records")
|
|
|
+ @ResponseBody
|
|
|
+ public TableDataInfo getcallPhoneRecords(HttpServletRequest req, @RequestBody ApiCallRecordQueryParams queryParams)
|
|
|
+ {
|
|
|
+ TableDataInfo tableDataInfo;
|
|
|
+ // 校验请求方ip是否合法
|
|
|
+ if (!ClientIpCheck.checkIp(req)) {
|
|
|
+ tableDataInfo = new TableDataInfo();
|
|
|
+ tableDataInfo.setTotal(0);
|
|
|
+ tableDataInfo.setCode(AjaxResult.Type.NO_AUTH.value());
|
|
|
+ tableDataInfo.setMsg("未授权,请联系系统管理员添加ip白名单!");
|
|
|
+ return tableDataInfo;
|
|
|
+ }
|
|
|
+ // 分页参数处理
|
|
|
+ if (null == queryParams.getPageNum()
|
|
|
+ && null == queryParams.getPageSize()) {
|
|
|
+ queryParams.setPageNum(1);
|
|
|
+ queryParams.setPageSize(200000);
|
|
|
+ }
|
|
|
+ if (null == queryParams.getPageNum()) {
|
|
|
+ queryParams.setPageNum(1);
|
|
|
+ }
|
|
|
+ if (null == queryParams.getPageSize()) {
|
|
|
+ queryParams.setPageSize(20);
|
|
|
+ }
|
|
|
+ // 类型(01:呼入, 02:AI外呼, 03:人工外呼)
|
|
|
+ String callType = queryParams.getCallType();
|
|
|
+ if (StringUtils.isBlank(callType)) {
|
|
|
+ tableDataInfo = new TableDataInfo();
|
|
|
+ tableDataInfo.setTotal(0);
|
|
|
+ tableDataInfo.setCode(AjaxResult.Type.INVALID_PARAM.value());
|
|
|
+ tableDataInfo.setMsg("callType不能为空!");
|
|
|
+ return tableDataInfo;
|
|
|
+ }
|
|
|
+ // 校验参数
|
|
|
+ if (StringUtils.isNotEmpty(queryParams.getCalloutTimeStart())
|
|
|
+ && !DateValidatorUtils.isYmdHms(queryParams.getCalloutTimeStart())) {
|
|
|
+ tableDataInfo = new TableDataInfo();
|
|
|
+ tableDataInfo.setTotal(0);
|
|
|
+ tableDataInfo.setCode(AjaxResult.Type.INVALID_PARAM.value());
|
|
|
+ tableDataInfo.setMsg("calloutTimeStart格式不正确,请使用'yyyy-MM-dd HH:mm:ss'格式!");
|
|
|
+ return tableDataInfo;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(queryParams.getCalloutTimeEnd())
|
|
|
+ && !DateValidatorUtils.isYmdHms(queryParams.getCalloutTimeEnd())) {
|
|
|
+ tableDataInfo = new TableDataInfo();
|
|
|
+ tableDataInfo.setTotal(0);
|
|
|
+ tableDataInfo.setCode(AjaxResult.Type.INVALID_PARAM.value());
|
|
|
+ tableDataInfo.setMsg("calloutTimeStart格式不正确,请使用'yyyy-MM-dd HH:mm:ss'格式!");
|
|
|
+ return tableDataInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 01:呼入, 02:AI外呼, 03:人工外呼
|
|
|
+ if ("01".equals(callType)) {
|
|
|
+ return getInboundRecords(queryParams);
|
|
|
+ } else if ("02".equals(callType)) {
|
|
|
+ return getAiCallRecordsTable(queryParams);
|
|
|
+ } else if ("03".equals(callType)) {
|
|
|
+ return getOutboundRecordsTable(queryParams);
|
|
|
+ } else {
|
|
|
+ tableDataInfo = new TableDataInfo();
|
|
|
+ tableDataInfo.setTotal(0);
|
|
|
+ tableDataInfo.setCode(AjaxResult.Type.INVALID_PARAM.value());
|
|
|
+ tableDataInfo.setMsg("callType参数不合法,呼入请输入01,AI外呼请输入02,手工外呼请输入03!");
|
|
|
+ return tableDataInfo;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //ai外呼记录查询
|
|
|
+ private TableDataInfo getAiCallRecordsTable(ApiCallRecordQueryParams queryParams) {
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("calloutTimeStart", queryParams.getCalloutTimeStart());
|
|
|
+ params.put("calloutTimeEnd", queryParams.getCalloutTimeEnd());
|
|
|
+ if (null != queryParams.getTimeLenStart()) {
|
|
|
+ params.put("timeLenSecondStart", queryParams.getTimeLenStart().toString());
|
|
|
+ }
|
|
|
+ if (null != queryParams.getTimeLenEnd()) {
|
|
|
+ params.put("timeLenSecondEnd", queryParams.getTimeLenEnd().toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ startPage(queryParams.getPageNum(), queryParams.getPageSize());
|
|
|
+ CcCallPhone ccCallPhone = new CcCallPhone();
|
|
|
+ if (null != queryParams.getBatchId() && queryParams.getBatchId() > 0) {
|
|
|
+ ccCallPhone.setBatchId(queryParams.getBatchId());
|
|
|
+ }
|
|
|
+ ccCallPhone.setUuid(queryParams.getUuid());
|
|
|
+ ccCallPhone.setTelephone(queryParams.getTelephone());
|
|
|
+ ccCallPhone.setAcdOpnum(queryParams.getExtnum());
|
|
|
+ ccCallPhone.setCallstatus(queryParams.getCallstatus());
|
|
|
+ ccCallPhone.setCallerNumber(queryParams.getCallerNumber());
|
|
|
+ ccCallPhone.setParams(params);
|
|
|
+ List<CcCallPhone> list = ccCallPhoneService.selectCcCallPhoneList(ccCallPhone);
|
|
|
+ list.forEach(callPhoneRecord -> {
|
|
|
+ if(StringUtils.isNotBlank(callPhoneRecord.getWavfile())){
|
|
|
+ if (callPhoneRecord.getWavfile().startsWith("/")) {
|
|
|
+ callPhoneRecord.setWavfile("/recordings/files?filename=" + callPhoneRecord.getWavfile().substring(1));
|
|
|
+ }else{
|
|
|
+ callPhoneRecord.setWavfile("/recordings/files?filename=" + callPhoneRecord.getWavfile());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+ //人工外呼记录查询
|
|
|
+ private TableDataInfo getOutboundRecordsTable(ApiCallRecordQueryParams queryParams) {
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("calloutTimeStart", queryParams.getCalloutTimeStart());
|
|
|
+ params.put("calloutTimeEnd", queryParams.getCalloutTimeEnd());
|
|
|
+ if (null != queryParams.getTimeLenStart()) {
|
|
|
+ params.put("timeLenSecondStart", queryParams.getTimeLenStart().toString());
|
|
|
+ }
|
|
|
+ if (null != queryParams.getTimeLenEnd()) {
|
|
|
+ params.put("timeLenSecondEnd", queryParams.getTimeLenEnd().toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ startPage(queryParams.getPageNum(), queryParams.getPageSize());
|
|
|
+ CcOutboundCdr outboundCdr = new CcOutboundCdr();
|
|
|
+ outboundCdr.setUuid(queryParams.getUuid());
|
|
|
+ outboundCdr.setCaller(queryParams.getTelephone());
|
|
|
+ outboundCdr.setOpnum(queryParams.getExtnum());
|
|
|
+ outboundCdr.setParams(params);
|
|
|
+ List<CcOutboundCdr> list = outboundCdrService.selectCcOutboundCdrList(outboundCdr);
|
|
|
+ list.forEach(callPhoneRecord -> {
|
|
|
+ if(StringUtils.isNotBlank(callPhoneRecord.getRecordFilename())){
|
|
|
+ if (callPhoneRecord.getRecordFilename().startsWith("/")) {
|
|
|
+ callPhoneRecord.setRecordFilename("/recordings/files?filename=" + callPhoneRecord.getRecordFilename().substring(1));
|
|
|
+ }else{
|
|
|
+ callPhoneRecord.setWavFileUrl("/recordings/files?filename=" + callPhoneRecord.getRecordFilename());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|