Merge remote-tracking branch 'origin/dev/feat/partner1.3_20230828' into dev/feat/partner1.3_20230828

This commit is contained in:
俞扬
2023-08-16 15:01:40 +08:00
10 changed files with 92 additions and 14 deletions

View File

@@ -66,6 +66,7 @@ public class HyPartnerTaskInfoLogDAO {
operateTypes.add(OperateTypeEnum.ADD_FOLLOW_TASK.getCode()); operateTypes.add(OperateTypeEnum.ADD_FOLLOW_TASK.getCode());
operateTypes.add(OperateTypeEnum.ADD_FOLLOW_LOG.getCode()); operateTypes.add(OperateTypeEnum.ADD_FOLLOW_LOG.getCode());
operateTypes.add(OperateTypeEnum.ADD_TAGS.getCode()); operateTypes.add(OperateTypeEnum.ADD_TAGS.getCode());
operateTypes.add(OperateTypeEnum.CALL_UP.getCode());
return hyPartnerTaskInfoLogMapper.getLogPageByLineId(partnerLineId, operateTypes); return hyPartnerTaskInfoLogMapper.getLogPageByLineId(partnerLineId, operateTypes);
} }

View File

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

View File

@@ -239,4 +239,13 @@
from call_record from call_record
where trans_no = #{transNo} where trans_no = #{transNo}
</select> </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> </mapper>

View File

@@ -284,7 +284,13 @@
</select> </select>
<select id="getUserListByDeptLeader" resultMap="BaseResultMap"> <select id="getUserListByDeptLeader" resultMap="BaseResultMap">
select user_id, leader_dept_ids from enterprise_user where leader_dept_ids like concat("%", #{regionId}, "%") and deleted = 0 select
<include refid="Base_Column_List"/>,
<include refid="Blob_Column_List"/>
from
enterprise_user
where
leader_dept_ids like concat("%", #{regionId}, "%") and deleted = 0
</select> </select>
<select id="getUserListByDeptLeaders" resultMap="BaseResultMap"> <select id="getUserListByDeptLeaders" resultMap="BaseResultMap">

View File

@@ -2,8 +2,10 @@ package com.cool.store.vo.follow;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.log.LogFieldDTO; import com.cool.store.dto.log.LogFieldDTO;
import com.cool.store.entity.CallRecordDO;
import com.cool.store.entity.HyFollowTaskDO; import com.cool.store.entity.HyFollowTaskDO;
import com.cool.store.entity.HyPartnerTaskInfoLogDO; import com.cool.store.entity.HyPartnerTaskInfoLogDO;
import com.cool.store.enums.CallStatusEnum;
import com.cool.store.enums.OperateLogFieldValueEnum; import com.cool.store.enums.OperateLogFieldValueEnum;
import com.cool.store.enums.OperateTypeEnum; import com.cool.store.enums.OperateTypeEnum;
import com.cool.store.vo.log.LogFieldVO; import com.cool.store.vo.log.LogFieldVO;
@@ -13,10 +15,7 @@ import lombok.Data;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -50,11 +49,12 @@ public class FollowTaskLogVO {
@ApiModelProperty("操作内容") @ApiModelProperty("操作内容")
private List<LogFieldVO> operateContent; 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)){ if(CollectionUtils.isEmpty(list)){
return Lists.newArrayList(); return Lists.newArrayList();
} }
Map<Long, HyFollowTaskDO> taskMap = ListUtils.emptyIfNull(followTaskList).stream().collect(Collectors.toMap(k -> k.getId(), Function.identity(), (k1, k2) -> k1)); 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<>(); List<FollowTaskLogVO> resultList = new ArrayList<>();
for (HyPartnerTaskInfoLogDO log : list) { for (HyPartnerTaskInfoLogDO log : list) {
FollowTaskLogVO result = new FollowTaskLogVO(); FollowTaskLogVO result = new FollowTaskLogVO();
@@ -68,8 +68,21 @@ public class FollowTaskLogVO {
if(OperateTypeEnum.ADD_FOLLOW_TASK.getCode().equals(log.getOperateType())){ 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()); 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); HyFollowTaskDO hyFollowTask = taskMap.get(taskId);
if(Objects.isNull(hyFollowTask)){
continue;
}
logFieldList.addAll(LogFieldVO.convertLogField(hyFollowTask)); 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;
}
if(CallStatusEnum.CALL_ANSWERED.getCode() != callRecord.getCallStatus()){
callRecord.setCallStatus(CallStatusEnum.CALL_FAILED.getCode());
}
logFieldList.addAll(LogFieldVO.convertLogField(callRecord));
} }
result.setOperateContent(logFieldList); result.setOperateContent(logFieldList);
resultList.add(result); resultList.add(result);

View File

@@ -1,10 +1,13 @@
package com.cool.store.service; package com.cool.store.service;
import com.cool.store.entity.CallRecordDO;
import com.cool.store.exception.ApiException; import com.cool.store.exception.ApiException;
import com.cool.store.request.CallFinishBackReq; import com.cool.store.request.CallFinishBackReq;
import com.cool.store.request.CallRecordBackReq; import com.cool.store.request.CallRecordBackReq;
import com.cool.store.request.CallUpReq; import com.cool.store.request.CallUpReq;
import java.util.List;
/** /**
* @Author: young.yu * @Author: young.yu
* @Date: 2023-08-10 18:56 * @Date: 2023-08-10 18:56
@@ -14,4 +17,11 @@ public interface CallService {
String callUp(CallUpReq request) throws ApiException; String callUp(CallUpReq request) throws ApiException;
void callFinishBack(CallFinishBackReq request) throws ApiException; void callFinishBack(CallFinishBackReq request) throws ApiException;
void callRecordBack(CallRecordBackReq 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.CallService;
import com.cool.store.service.LogService; import com.cool.store.service.LogService;
import com.cool.store.utils.CoolDateUtils; import com.cool.store.utils.CoolDateUtils;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @Author: young.yu * @Author: young.yu
@@ -129,4 +132,12 @@ public class CallServiceImpl implements CallService {
callRecordDO.setUpdateTime(new Date()); callRecordDO.setUpdateTime(new Date());
callRecordMapper.updateByTransNoSelective(callRecordDO); callRecordMapper.updateByTransNoSelective(callRecordDO);
} }
@Override
public List<CallRecordDO> getCallRecordByTransNos(List<String> transNos) {
if(CollectionUtils.isEmpty(transNos)){
return Lists.newArrayList();
}
return callRecordMapper.selectByTransNos(transNos);
}
} }

View File

@@ -242,7 +242,7 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
Multimap<String, String> leaderDeptMap = ArrayListMultimap.create(); Multimap<String, String> leaderDeptMap = ArrayListMultimap.create();
RegionDO region = SysDepartmentDTO.convertRegionDO(departmentDetail, leaderDeptMap, parentRegionInfo); RegionDO region = SysDepartmentDTO.convertRegionDO(departmentDetail, leaderDeptMap, parentRegionInfo);
regionDAO.batchInsertOrUpdate(Arrays.asList(region)); regionDAO.batchInsertOrUpdate(Arrays.asList(region));
dealUserLeaderDept(leaderDeptMap); dealUserLeaderDept(departmentDetail.getId(), leaderDeptMap);
break; break;
case DEPARTMENT_UPDATED: case DEPARTMENT_UPDATED:
if(param.getIsChangeParent()){ if(param.getIsChangeParent()){
@@ -252,7 +252,7 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
Multimap<String, String> updateLeaderDeptMap = ArrayListMultimap.create(); Multimap<String, String> updateLeaderDeptMap = ArrayListMultimap.create();
RegionDO updateRegion = SysDepartmentDTO.convertRegionDO(departmentDetail, updateLeaderDeptMap); RegionDO updateRegion = SysDepartmentDTO.convertRegionDO(departmentDetail, updateLeaderDeptMap);
regionDAO.batchInsertOrUpdate(Arrays.asList(updateRegion)); regionDAO.batchInsertOrUpdate(Arrays.asList(updateRegion));
dealUserLeaderDept(updateLeaderDeptMap); dealUserLeaderDept(departmentDetail.getId(), updateLeaderDeptMap);
break; break;
case DEPARTMENT_DELETED: case DEPARTMENT_DELETED:
boolean leafNode = regionDAO.isLeafNode(departmentDetail.getId()); boolean leafNode = regionDAO.isLeafNode(departmentDetail.getId());
@@ -283,8 +283,22 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
* 处理用户负责部门信息 * 处理用户负责部门信息
* @param leaderDeptMap * @param leaderDeptMap
*/ */
public void dealUserLeaderDept(Multimap<String, String> leaderDeptMap){ public void dealUserLeaderDept(String deptId, Multimap<String, String> leaderDeptMap){
if(leaderDeptMap.isEmpty()){ if(leaderDeptMap.isEmpty()){
//删除用户存在的部门主管
List<EnterpriseUserDO> userList = enterpriseUserDAO.getUserListByDeptLeader(deptId);
for (EnterpriseUserDO enterpriseUser : userList) {
String leaderDeptIds = enterpriseUser.getLeaderDeptIds();
List<String> existDeptIds = JSONObject.parseArray(leaderDeptIds).stream().map(String::valueOf).collect(Collectors.toList());
//取并集
existDeptIds.remove(deptId);
List<String> allDeptIds = existDeptIds.stream().distinct().collect(Collectors.toList());
if(CollectionUtils.isEmpty(allDeptIds)){
enterpriseUser.setIsLeader(Boolean.FALSE);
}
enterpriseUser.setLeaderDeptIds(JSONObject.toJSONString(allDeptIds));
}
enterpriseUserDAO.batchInsertOrUpdate(userList);
return; return;
} }
List<String> userIds = leaderDeptMap.keys().stream().collect(Collectors.toList()); List<String> userIds = leaderDeptMap.keys().stream().collect(Collectors.toList());

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.log.LogFieldDTO;
import com.cool.store.dto.message.SendCardMessageDTO; import com.cool.store.dto.message.SendCardMessageDTO;
import com.cool.store.dto.partner.PartnerSimpleInfoDTO; import com.cool.store.dto.partner.PartnerSimpleInfoDTO;
import com.cool.store.entity.CallRecordDO;
import com.cool.store.entity.HyFollowTaskDO; import com.cool.store.entity.HyFollowTaskDO;
import com.cool.store.entity.HyPartnerLineInfoDO; import com.cool.store.entity.HyPartnerLineInfoDO;
import com.cool.store.entity.HyPartnerTaskInfoLogDO; 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.AddFollowTaskRequest;
import com.cool.store.request.follow.FollowTaskIdRequest; import com.cool.store.request.follow.FollowTaskIdRequest;
import com.cool.store.request.follow.UpdateFollowTaskRequest; import com.cool.store.request.follow.UpdateFollowTaskRequest;
import com.cool.store.service.CallService;
import com.cool.store.service.FollowTaskService; import com.cool.store.service.FollowTaskService;
import com.cool.store.utils.CoolDateUtils; import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.RedisUtilPool; import com.cool.store.utils.RedisUtilPool;
@@ -62,6 +64,8 @@ public class FollowTaskServiceImpl implements FollowTaskService {
@Resource @Resource
private EnterpriseUserDAO enterpriseUserDAO; private EnterpriseUserDAO enterpriseUserDAO;
@Resource @Resource
private CallService callService;
@Resource
private RedisUtilPool redisUtilPool; private RedisUtilPool redisUtilPool;
@Resource @Resource
private ISVHttpRequest isvHttpRequest; private ISVHttpRequest isvHttpRequest;
@@ -98,11 +102,12 @@ public class FollowTaskServiceImpl implements FollowTaskService {
return Long.valueOf(value); return Long.valueOf(value);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
List<HyFollowTaskDO> followTaskList = hyFollowTaskDAO.getFollowTaskList(taskIds); 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); 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()); }).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); PageInfo resultPage = new PageInfo(logPage);
resultPage.setList(resultList); resultPage.setList(resultList);

View File

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