From f3b73ddde8210f35262722f1d7691689b4d52784 Mon Sep 17 00:00:00 2001 From: wujingtao Date: Wed, 16 Feb 2022 14:07:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=82=B9=E5=91=BC=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/TelephoneCallController.java | 2 +- .../dao/AllCallInfoRepository.java | 3 --- .../entity/dto/RollCallBackDTO.java | 1 + .../impl/TelephoneCallServiceImpl.java | 25 +++++++++++++------ 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/api/TelephoneCallController.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/api/TelephoneCallController.java index 5460d186..f703656e 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/api/TelephoneCallController.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/api/TelephoneCallController.java @@ -120,12 +120,12 @@ public class TelephoneCallController { @PostMapping("/roll/cdrUrl") @ApiOperation("点呼系统回调话单") public CommonResponse rollCallBack(@RequestBody String json) { - log.info("点呼回调:{}", json); try { RollCallBackDTO rollCallBackDTO = JSONUtil.toBean(json, RollCallBackDTO.class); if (ObjectUtil.isEmpty(rollCallBackDTO) || StrUtil.isEmpty(rollCallBackDTO.getSessionid())) { return CommonResponse.createByErrorMessage("参数为空"); } + log.info("点呼回调:{}", rollCallBackDTO); telephoneCallService.rollCallBack(rollCallBackDTO); } catch (Exception e) { log.error("点呼回调话单错误 参数 :{}", json); diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/dao/AllCallInfoRepository.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/dao/AllCallInfoRepository.java index 3e5e1889..c31fc565 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/dao/AllCallInfoRepository.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/dao/AllCallInfoRepository.java @@ -1,7 +1,6 @@ package com.baiye.modules.telemarkting.dao; import com.baiye.modules.telemarkting.entity.AllCallInfo; -import com.baiye.modules.telemarkting.entity.CallClueInfo; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Modifying; @@ -25,8 +24,6 @@ public interface AllCallInfoRepository extends JpaRepository, */ AllCallInfo findBySessionId(String sessionId); - AllCallInfo findByRequestId(String requestId); - /** * 通过条件查询记录 * diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/entity/dto/RollCallBackDTO.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/entity/dto/RollCallBackDTO.java index 31252f50..d53dd0f9 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/entity/dto/RollCallBackDTO.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/entity/dto/RollCallBackDTO.java @@ -27,4 +27,5 @@ public class RollCallBackDTO { private String extval1; private String extval2; private String extval3; + private String otherLeg; } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/service/impl/TelephoneCallServiceImpl.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/service/impl/TelephoneCallServiceImpl.java index 35ffab70..e795acf1 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/service/impl/TelephoneCallServiceImpl.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/service/impl/TelephoneCallServiceImpl.java @@ -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); }