Эх сурвалжийг харах

更新用户信息的时候 如果是坐席,同时把坐席中对应的昵称进行更改

王苗苗 2 сар өмнө
parent
commit
8784dc5316

+ 11 - 1
slibra-system/src/main/java/com/slibra/system/service/impl/SysUserServiceImpl.java

@@ -2,6 +2,7 @@ package com.slibra.system.service.impl;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 import javax.validation.Validator;
 
@@ -13,6 +14,7 @@ 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 com.slibra.common.utils.DateUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -349,8 +351,16 @@ public class SysUserServiceImpl implements ISysUserService
             log.info("当前更新用户的时候,所携带的角色包含坐席的角色");
             Long userId = user.getUserId();
             //先去判断在坐席里面,是否已经关联过用户了,如果关联过了,就不需要再增加
-            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(user.getNickName());
+                    cAgent.setUpdateTime(DateUtils.getNowDate());
+                    this.cAgentMapper.updateCAgent(cAgent);
+                }
                 return;
             }
             //没有添加过 添加坐席和坐席监控,并在坐席里插入用户的ID、姓名、密码字段

+ 0 - 1
slibra-system/src/main/resources/mapper/business/CAgentMapper.xml

@@ -103,7 +103,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="userId != null">user_id = #{userId},</if>
         </trim>
-        ,revision = revision + 1
         where id = #{id}
     </update>