|
|
|
@ -186,6 +186,7 @@ public class TelephoneCallServiceImpl implements TelephoneCallService {
|
|
|
|
|
//获取分机号
|
|
|
|
|
ExtensionNumber extensionNumber = extensionNumberRepository.selectByMemberId(telephoneCallReqDTO.getMemberId());
|
|
|
|
|
if (extensionNumber == null) {
|
|
|
|
|
log.error("未配置分机号");
|
|
|
|
|
return CommonResponse.createByErrorMessage("未配置分机号");
|
|
|
|
|
}
|
|
|
|
|
telephoneCallReqDTO.setTelA(String.valueOf(extensionNumber.getNumber()));
|
|
|
|
@ -193,6 +194,7 @@ public class TelephoneCallServiceImpl implements TelephoneCallService {
|
|
|
|
|
//获取线索号
|
|
|
|
|
Clue body = sourceClueClient.queryDetails(Long.parseLong(telephoneCallReqDTO.getUserData())).getBody();
|
|
|
|
|
if (ObjectUtil.isNull(body) || StrUtil.isEmpty(body.getNid())) {
|
|
|
|
|
log.error("未获取到号码");
|
|
|
|
|
return CommonResponse.createByErrorMessage("未获取到号码");
|
|
|
|
|
}
|
|
|
|
|
telephoneCallReqDTO.setTelB(body.getNid());
|
|
|
|
@ -201,6 +203,7 @@ public class TelephoneCallServiceImpl implements TelephoneCallService {
|
|
|
|
|
if (StrUtil.isNotBlank(reqId)) {
|
|
|
|
|
if (StrUtil.isNotBlank(reqId)) {
|
|
|
|
|
AllCallInfo allCallInfo = new AllCallInfo();
|
|
|
|
|
allCallInfo.setSessionId(requestId);
|
|
|
|
|
allCallInfo.setRequestId(requestId);
|
|
|
|
|
allCallInfo.setClueId(Long.parseLong(telephoneCallReqDTO.getUserData()));
|
|
|
|
|
allCallInfo.setMemberId(telephoneCallReqDTO.getMemberId());
|
|
|
|
@ -226,17 +229,23 @@ public class TelephoneCallServiceImpl implements TelephoneCallService {
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void rollCallBack(RollCallBackDTO rollCallBackDTO) {
|
|
|
|
|
String reqId = rollCallBackDTO.getReqid();
|
|
|
|
|
AllCallInfo allCallInfo = allCallInfoRepository.findByRequestId(reqId);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(allCallInfo)) {
|
|
|
|
|
if (StrUtil.isBlank(rollCallBackDTO.getDuration())) {
|
|
|
|
|
//表示接通
|
|
|
|
|
callClueRepository.updateByStatus(DefaultNumberConstants.TWO_NUMBER, allCallInfo.getClueId());
|
|
|
|
|
String sessionId = rollCallBackDTO.getSessionid();
|
|
|
|
|
String otherLeg = rollCallBackDTO.getOtherLeg();
|
|
|
|
|
|
|
|
|
|
allCallInfo.setStatus(DefaultNumberConstants.TWO_NUMBER);
|
|
|
|
|
allCallInfo.setDuration(Integer.valueOf(rollCallBackDTO.getDuration()));
|
|
|
|
|
AllCallInfo allCallInfo = allCallInfoRepository.findBySessionId(sessionId);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(allCallInfo)) {
|
|
|
|
|
//相同说明是分机号的回调
|
|
|
|
|
if (sessionId.equals(otherLeg)) {
|
|
|
|
|
allCallInfo.setRecordFlag(DefaultNumberConstants.ONE_NUMBER);
|
|
|
|
|
allCallInfo.setRecordFileDownloadUrl(rollCallBackDTO.getRecord_file_url());
|
|
|
|
|
} else {
|
|
|
|
|
//拨打线索号的回调
|
|
|
|
|
if (StrUtil.isNotBlank(rollCallBackDTO.getCallee_answer_time())) {
|
|
|
|
|
//表示接通
|
|
|
|
|
callClueRepository.updateByStatus(DefaultNumberConstants.TWO_NUMBER, allCallInfo.getClueId());
|
|
|
|
|
allCallInfo.setStatus(DefaultNumberConstants.TWO_NUMBER);
|
|
|
|
|
allCallInfo.setDuration(Integer.valueOf(rollCallBackDTO.getDuration()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
allCallInfoRepository.save(allCallInfo);
|
|
|
|
|
}
|
|
|
|
|