|
@@ -1,12 +1,22 @@
|
|
|
package com.slibra.business.service.impl;
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import com.slibra.common.exception.ServiceException;
|
|
|
import com.slibra.common.utils.DateUtils;
|
|
|
+import com.slibra.common.utils.SecurityUtils;
|
|
|
+import com.slibra.common.utils.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.slibra.business.mapper.TCallRecordMapper;
|
|
|
import com.slibra.business.domain.TCallRecord;
|
|
|
import com.slibra.business.service.ITCallRecordService;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
/**
|
|
|
* 通话记录Service业务层处理
|
|
@@ -17,6 +27,7 @@ import com.slibra.business.service.ITCallRecordService;
|
|
|
@Service
|
|
|
public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
{
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(TCallRecordServiceImpl.class);
|
|
|
@Autowired
|
|
|
private TCallRecordMapper tCallRecordMapper;
|
|
|
|
|
@@ -67,6 +78,19 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
public int updateTCallRecord(TCallRecord tCallRecord)
|
|
|
{
|
|
|
tCallRecord.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ //2024年11月18日10:23:18 由于前端不方便穿ID和name,这里由后台来操作
|
|
|
+ try {
|
|
|
+ tCallRecord.setUserId(SecurityUtils.getUserId());
|
|
|
+ tCallRecord.setUserName(SecurityUtils.getUsername());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("××××××跟新通话记录的时候,获取用户信息失败!");
|
|
|
+ }
|
|
|
+ //额外再查询曹永创的botrecords表,通过session获取intent,更新【业务类型】字段
|
|
|
+ String sessionId = tCallRecord.getSessionId();
|
|
|
+ if(StringUtils.isBlank(sessionId))
|
|
|
+ log.error("更新通话记录的时候,由于获取不到sessionId,导致无法更新曹永创的字段bussinessType【业务类型】");
|
|
|
+ else
|
|
|
+ tCallRecord.setBussinessType(this.tCallRecordMapper.getBusinessTypeBySessionId(sessionId));
|
|
|
return tCallRecordMapper.updateTCallRecord(tCallRecord);
|
|
|
}
|
|
|
|
|
@@ -93,4 +117,21 @@ public class TCallRecordServiceImpl implements ITCallRecordService
|
|
|
{
|
|
|
return tCallRecordMapper.deleteTCallRecordById(id);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TCallRecord getCallBySessionId(String sessionId) {
|
|
|
+ if(StringUtils.isBlank(sessionId))
|
|
|
+ throw new ServiceException("请输入sessionId");
|
|
|
+ List<TCallRecord> tCallRecords = this.tCallRecordMapper.selectTCallRecordList(TCallRecord.builder().sessionId(sessionId).build());
|
|
|
+ if(!CollectionUtils.isEmpty(tCallRecords)){
|
|
|
+ TCallRecord tCallRecord = tCallRecords.get(0);
|
|
|
+ tCallRecord.setCurrentCallRecords(this.tCallRecordMapper.getContentsBySessionId(sessionId));//[当前通话记录]
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<HashMap<String, Object>> getAgentList() {
|
|
|
+ return this.tCallRecordMapper.getAgentList();
|
|
|
+ }
|
|
|
}
|