通话记录跟进日志处理

This commit is contained in:
zhangchenbiao
2023-08-16 13:52:37 +08:00
parent b71fd6c8bb
commit 49936eacb2
7 changed files with 63 additions and 10 deletions

View File

@@ -3,6 +3,8 @@ package com.cool.store.mapper;
import com.cool.store.entity.CallRecordDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-08-11 01:03
@@ -26,4 +28,11 @@ public interface CallRecordMapper {
int updateByTransNoSelective(CallRecordDO record);
CallRecordDO selectByTransNo(String transNo);
/**
* 批量获取
* @param transNos
* @return
*/
List<CallRecordDO> selectByTransNos(@Param("transNos") List<String> transNos);
}

View File

@@ -239,4 +239,13 @@
from call_record
where trans_no = #{transNo}
</select>
<select id="selectByTransNos" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from
call_record
where
trans_no in <foreach collection="transNos" open="(" close=")" separator="," item="transNo">#{transNo}</foreach>
</select>
</mapper>

View File

@@ -2,6 +2,7 @@ package com.cool.store.vo.follow;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.log.LogFieldDTO;
import com.cool.store.entity.CallRecordDO;
import com.cool.store.entity.HyFollowTaskDO;
import com.cool.store.entity.HyPartnerTaskInfoLogDO;
import com.cool.store.enums.OperateLogFieldValueEnum;
@@ -13,10 +14,7 @@ import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -50,11 +48,12 @@ public class FollowTaskLogVO {
@ApiModelProperty("操作内容")
private List<LogFieldVO> operateContent;
public static List<FollowTaskLogVO> convertVO(List<HyPartnerTaskInfoLogDO> list, List<HyFollowTaskDO> followTaskList){
public static List<FollowTaskLogVO> convertVO(List<HyPartnerTaskInfoLogDO> list, List<HyFollowTaskDO> followTaskList, List<CallRecordDO> callRecordList){
if(CollectionUtils.isEmpty(list)){
return Lists.newArrayList();
}
Map<Long, HyFollowTaskDO> taskMap = ListUtils.emptyIfNull(followTaskList).stream().collect(Collectors.toMap(k -> k.getId(), Function.identity(), (k1, k2) -> k1));
Map<String, CallRecordDO> callRecordMap = ListUtils.emptyIfNull(callRecordList).stream().collect(Collectors.toMap(k -> k.getTransNo(), Function.identity(), (k1, k2) -> k1));
List<FollowTaskLogVO> resultList = new ArrayList<>();
for (HyPartnerTaskInfoLogDO log : list) {
FollowTaskLogVO result = new FollowTaskLogVO();
@@ -68,8 +67,18 @@ public class FollowTaskLogVO {
if(OperateTypeEnum.ADD_FOLLOW_TASK.getCode().equals(log.getOperateType())){
Long taskId = Long.valueOf(logFieldList.stream().filter(o -> OperateLogFieldValueEnum.FOLLOW_TASK_ID.getCode().equals(o.getCode())).map(LogFieldVO::getValue).findFirst().get().toString());
HyFollowTaskDO hyFollowTask = taskMap.get(taskId);
if(Objects.isNull(hyFollowTask)){
continue;
}
logFieldList.addAll(LogFieldVO.convertLogField(hyFollowTask));
}
if(OperateTypeEnum.CALL_UP.getCode().equals(log.getOperateType())){
String transNo = logFieldList.stream().filter(o -> OperateLogFieldValueEnum.CALL_TRANS_NO.getCode().equals(o.getCode())).map(LogFieldVO::getValue).findFirst().get().toString();
CallRecordDO callRecord = callRecordMap.get(transNo);
if(Objects.isNull(callRecord)){
continue;
}
logFieldList.addAll(LogFieldVO.convertLogField(callRecord));
}
result.setOperateContent(logFieldList);
resultList.add(result);

View File

@@ -1,10 +1,13 @@
package com.cool.store.service;
import com.cool.store.entity.CallRecordDO;
import com.cool.store.exception.ApiException;
import com.cool.store.request.CallFinishBackReq;
import com.cool.store.request.CallRecordBackReq;
import com.cool.store.request.CallUpReq;
import java.util.List;
/**
* @Author: young.yu
* @Date: 2023-08-10 18:56
@@ -14,4 +17,11 @@ public interface CallService {
String callUp(CallUpReq request) throws ApiException;
void callFinishBack(CallFinishBackReq request) throws ApiException;
void callRecordBack(CallRecordBackReq request) throws ApiException;
/**
* 批量获取通话记录
* @para transNos
* @return
*/
List<CallRecordDO> getCallRecordByTransNos(List<String> transNos);
}

View File

@@ -24,12 +24,15 @@ import com.cool.store.request.CallUpReq;
import com.cool.store.service.CallService;
import com.cool.store.service.LogService;
import com.cool.store.utils.CoolDateUtils;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @Author: young.yu
@@ -129,4 +132,12 @@ public class CallServiceImpl implements CallService {
callRecordDO.setUpdateTime(new Date());
callRecordMapper.updateByTransNoSelective(callRecordDO);
}
@Override
public List<CallRecordDO> getCallRecordByTransNos(List<String> transNos) {
if(CollectionUtils.isEmpty(transNos)){
return Lists.newArrayList();
}
return callRecordMapper.selectByTransNos(transNos);
}
}

View File

@@ -13,6 +13,7 @@ import com.cool.store.dto.log.LineLogInfo;
import com.cool.store.dto.log.LogFieldDTO;
import com.cool.store.dto.message.SendCardMessageDTO;
import com.cool.store.dto.partner.PartnerSimpleInfoDTO;
import com.cool.store.entity.CallRecordDO;
import com.cool.store.entity.HyFollowTaskDO;
import com.cool.store.entity.HyPartnerLineInfoDO;
import com.cool.store.entity.HyPartnerTaskInfoLogDO;
@@ -24,6 +25,7 @@ import com.cool.store.request.follow.AddFollowLogRequest;
import com.cool.store.request.follow.AddFollowTaskRequest;
import com.cool.store.request.follow.FollowTaskIdRequest;
import com.cool.store.request.follow.UpdateFollowTaskRequest;
import com.cool.store.service.CallService;
import com.cool.store.service.FollowTaskService;
import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.RedisUtilPool;
@@ -62,6 +64,8 @@ public class FollowTaskServiceImpl implements FollowTaskService {
@Resource
private EnterpriseUserDAO enterpriseUserDAO;
@Resource
private CallService callService;
@Resource
private RedisUtilPool redisUtilPool;
@Resource
private ISVHttpRequest isvHttpRequest;
@@ -98,11 +102,12 @@ public class FollowTaskServiceImpl implements FollowTaskService {
return Long.valueOf(value);
}).collect(Collectors.toList());
List<HyFollowTaskDO> followTaskList = hyFollowTaskDAO.getFollowTaskList(taskIds);
List<String> callIds = logPage.stream().filter(o->OperateTypeEnum.ADD_FOLLOW_TASK.getCode().equals(o.getOperateType())).map(o->{
List<String> callTransNos = logPage.stream().filter(o->OperateTypeEnum.CALL_UP.getCode().equals(o.getOperateType())).map(o->{
List<LogFieldDTO> logField = JSONObject.parseArray(o.getFieldCopy(), LogFieldDTO.class);
return logField.stream().filter(f -> f.getCode().equals(OperateLogFieldValueEnum.FOLLOW_TASK_ID.getCode())).findFirst().get().getValue();
return logField.stream().filter(f -> f.getCode().equals(OperateLogFieldValueEnum.CALL_TRANS_NO.getCode())).findFirst().get().getValue();
}).collect(Collectors.toList());
resultList = FollowTaskLogVO.convertVO(logPage, followTaskList);
List<CallRecordDO> callRecordList = callService.getCallRecordByTransNos(callTransNos);
resultList = FollowTaskLogVO.convertVO(logPage, followTaskList, callRecordList);
}
PageInfo resultPage = new PageInfo(logPage);
resultPage.setList(resultList);

View File

@@ -46,7 +46,7 @@ public class LineHighSeasServiceImpl implements LineHighSeasService {
@Value("${oss.excelFile.dir:null}")
private String dir;
@Value("${manual.channel.id}")
@Value("${manual.channel.id:null}")
private Integer manual;