修改点呼回调逻辑

master
wujingtao 2 years ago
parent 1bee99b8ed
commit b7347839fc

@ -29,6 +29,27 @@ public interface AllCallInfoRepository extends JpaRepository<AllCallInfo, Long>,
@Query(value = "update AllCallInfo d set d.status =?1 where d.sessionId = ?2")
void updateByStatus(Integer status, String sessionId);
/**
*
* @param recordFlag
* @param recordFileDownloadUrl
* @param id
*/
@Modifying
@Query(value = "update AllCallInfo d set d.recordFlag =?1 , d.recordFileDownloadUrl = ?2 where d.id =?3")
void updateByRecord(Integer recordFlag, String recordFileDownloadUrl,Long id);
/**
*
* @param status
* @param duration
* @param id
*/
@Modifying
@Query(value = "update AllCallInfo d set d.status =?1 , d.duration = ?2 where d.id =?3")
void updateByDurationAndStatus(Integer status, Integer duration,Long id);
/**
* id线
*

@ -5,6 +5,7 @@ import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.exception.BadRequestException;
import com.baiye.feign.SourceClueClient;
@ -249,11 +250,13 @@ public class TelephoneCallServiceImpl implements TelephoneCallService {
String otherLeg = rollCallBackDTO.getOtherLeg();
AllCallInfo allCallInfo = allCallInfoRepository.findBySessionId(otherLeg);
if (ObjectUtil.isNotEmpty(allCallInfo)) {
//相同说明是分机号的回调
if (sessionId.equals(otherLeg) && StrUtil.isNotBlank(rollCallBackDTO.getRecord_file_url())) {
allCallInfo.setRecordFlag(DefaultNumberConstants.ONE_NUMBER);
allCallInfo.setRecordFileDownloadUrl(rollCallBackDTO.getRecord_file_url());
allCallInfoRepository.updateByRecord(DefaultNumberConstants.ONE_NUMBER, rollCallBackDTO.getRecord_file_url(), allCallInfo.getId());
} else {
//拨打线索号的回调
if (StrUtil.isNotBlank(rollCallBackDTO.getCallee_answer_time())) {
@ -261,6 +264,7 @@ public class TelephoneCallServiceImpl implements TelephoneCallService {
callClueRepository.updateByStatus(DefaultNumberConstants.TWO_NUMBER, allCallInfo.getClueId());
allCallInfo.setStatus(DefaultNumberConstants.TWO_NUMBER);
allCallInfo.setDuration(Integer.valueOf(rollCallBackDTO.getDuration()));
allCallInfoRepository.updateByDurationAndStatus(DefaultNumberConstants.TWO_NUMBER, Integer.valueOf(rollCallBackDTO.getDuration()), allCallInfo.getId());
//更新资源通话状态
CompletableFuture.runAsync(() -> {
updateSourceCallStatus(allCallInfo.getClueId(), DefaultNumberConstants.TWO_NUMBER);
@ -272,7 +276,6 @@ public class TelephoneCallServiceImpl implements TelephoneCallService {
});
}
}
allCallInfoRepository.save(allCallInfo);
}
}

Loading…
Cancel
Save