|
@@ -1,19 +1,10 @@
|
|
|
package com.slibra.system.service.impl;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
-
|
|
|
-import com.slibra.business.domain.CAgent;
|
|
|
-import com.slibra.business.domain.CAgentMonitor;
|
|
|
-import com.slibra.business.domain.CHumanServiceMap;
|
|
|
-import com.slibra.business.domain.CPhone;
|
|
|
-import com.slibra.business.mapper.CAgentMapper;
|
|
|
-import com.slibra.business.mapper.CAgentMonitorMapper;
|
|
|
-import com.slibra.business.mapper.CHumanServiceMapMapper;
|
|
|
-import com.slibra.business.mapper.CPhoneMapper;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+import com.slibra.business.domain.*;
|
|
|
+import com.slibra.business.mapper.*;
|
|
|
+import com.slibra.common.utils.DateUtils;
|
|
|
import com.slibra.system.mapper.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -73,6 +64,9 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|
|
@Autowired
|
|
|
private CHumanServiceMapMapper cHumanServiceMapMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TZuoxiRecordMapper tzuoxiRecordMapper;
|
|
|
+
|
|
|
@Value("${SIP_SUFFIX}")
|
|
|
private String sipSuffix;
|
|
|
|
|
@@ -476,9 +470,18 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|
|
if(isZuoXi){
|
|
|
log.info("当前更新用户的时候,所携带的角色包含坐席的角色");
|
|
|
Long userId = user.getUserId();
|
|
|
+ String nickName = user.getNickName();
|
|
|
//先去判断在坐席里面,是否已经关联过用户了,如果关联过了,就不需要再增加
|
|
|
- if(!CollectionUtils.isEmpty(this.cAgentMapper.selectCAgentList(CAgent.builder().userId(userId).build()))){
|
|
|
+ List<CAgent> cAgents = this.cAgentMapper.selectCAgentList(CAgent.builder().userId(userId).build());
|
|
|
+ if(!CollectionUtils.isEmpty(cAgents)){
|
|
|
log.info("用户ID{}已经绑定过坐席了,无需重复添加", userId);
|
|
|
+ //2025年01月07日09:33:45 新增逻辑:如果用户的昵称改了,那么对应坐席中的用户的昵称也要修改
|
|
|
+ CAgent cAgent = cAgents.get(0);
|
|
|
+ if(!Objects.isNull(cAgent)){
|
|
|
+ cAgent.setAgentName(nickName);
|
|
|
+ cAgent.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ this.cAgentMapper.updateCAgent(cAgent);
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
//没有添加过 添加坐席和坐席监控,并在坐席里插入用户的ID、姓名、密码字段
|
|
@@ -486,7 +489,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|
|
String maxNum = this.cAgentMapper.selectMaxNum();
|
|
|
String agentNum = String.valueOf(Long.parseLong(maxNum) + 1);
|
|
|
//坐席对象
|
|
|
- CAgent cAgent = CAgent.builder().saasId(SAAS_ID).agentNum(agentNum).agentName(user.getNickName()).outId(agentNum).agentPwd(user.getPassword()).phoneNum(agentNum).userId(userId).build();
|
|
|
+ CAgent cAgent = CAgent.builder().saasId(SAAS_ID).agentNum(agentNum).agentName(nickName).outId(agentNum).agentPwd(user.getPassword()).phoneNum(agentNum).userId(userId).build();
|
|
|
//插入坐席
|
|
|
this.cAgentMapper.insertCAgent(cAgent);
|
|
|
//坐席监控对象
|
|
@@ -500,6 +503,25 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|
|
//2024年12月11日15:02:10 需要插入新的数据
|
|
|
CHumanServiceMap cHumanServiceMap = CHumanServiceMap.builder().saasId(SAAS_ID).agentId(agentNum).build();
|
|
|
cHumanServiceMapMapper.insertCHumanServiceMap(cHumanServiceMap);
|
|
|
+ //2025年01月08日13:34:02 新增逻辑,需要记录坐席用户,用于在通话记录查询的筛选客服列表查询
|
|
|
+ //先去查询是否已经存在了,存在就更新姓名,如果不存在,就插入数据即可
|
|
|
+ List<TZuoxiRecord> tZuoxiRecords = this.tzuoxiRecordMapper.selectTZuoxiRecordList(TZuoxiRecord.builder().userId(userId).build());
|
|
|
+ Date nowDate = DateUtils.getNowDate();
|
|
|
+ String username = SecurityUtils.getUsername();
|
|
|
+ if(!CollectionUtils.isEmpty(tZuoxiRecords)){
|
|
|
+ log.info("坐席用户已经存在了,这里只更新坐席的昵称");
|
|
|
+ TZuoxiRecord tZuoxiRecord = tZuoxiRecords.get(0);
|
|
|
+ tZuoxiRecord.setUserName(nickName);
|
|
|
+ tZuoxiRecord.setUpdateTime(nowDate);
|
|
|
+ tZuoxiRecord.setUpdateBy(username);
|
|
|
+ this.tzuoxiRecordMapper.updateTZuoxiRecord(tZuoxiRecord);
|
|
|
+ }else{
|
|
|
+ log.info("坐席用户已经不存在,插入坐席用户");
|
|
|
+ TZuoxiRecord tZuoxiRecord = TZuoxiRecord.builder().userId(userId).userName(nickName).build();
|
|
|
+ tZuoxiRecord.setCreateTime(nowDate);
|
|
|
+ tZuoxiRecord.setCreateBy(username);
|
|
|
+ this.tzuoxiRecordMapper.insertTZuoxiRecord(tZuoxiRecord);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|