浏览代码

分配坐席角色的时候 同时增加坐席、坐席监控状态和分机号3个表的数据

王苗苗 3 月之前
父节点
当前提交
d5ede5e8e6

二进制
.DS_Store


+ 1 - 0
slibra-admin/src/main/resources/application.yml

@@ -248,4 +248,5 @@ NLS_APP_KEY: OKt6jogp6fRjHQVp
 WS_URL: wss://nls-gateway-cn-shanghai.aliyuncs.com/ws/v1
 DOMAIN: https://pbx.fuxicarbon.com/voice/
 URL_DISK_PREFIX: /root/aibot/dm/voice/
+SIP_SUFFIX: @pbx.fuxicarbon.com:5060
 

+ 1 - 0
slibra-common/src/main/java/com/slibra/common/constant/MyConstants.java

@@ -117,6 +117,7 @@ public class MyConstants {
 
     //坐席的分区标识
     public static final String SAAS_ID = "mdj";
+    public static final String SIP_PREFIX = "sip:";
 
 
     public static final String WARNING_TEMPLATE = "您有#个报警信息,请解决";

+ 57 - 0
slibra-system/src/main/java/com/slibra/business/domain/CPhone.java

@@ -0,0 +1,57 @@
+package com.slibra.business.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.slibra.common.annotation.Excel;
+import com.slibra.common.core.domain.BaseEntity;
+
+/**
+ * 分机信息对象 c_phone
+ * 
+ * @author slibra
+ * @date 2024-12-02
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class CPhone
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private String id;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String saasId;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String phoneNum;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String phonePwd;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String sipServer;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String wssServer;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String iceServer;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Long isDelete;
+
+}

+ 61 - 0
slibra-system/src/main/java/com/slibra/business/mapper/CPhoneMapper.java

@@ -0,0 +1,61 @@
+package com.slibra.business.mapper;
+
+import java.util.List;
+import com.slibra.business.domain.CPhone;
+
+/**
+ * 分机信息Mapper接口
+ * 
+ * @author slibra
+ * @date 2024-12-02
+ */
+public interface CPhoneMapper 
+{
+    /**
+     * 查询分机信息
+     * 
+     * @param id 分机信息主键
+     * @return 分机信息
+     */
+    public CPhone selectCPhoneById(String id);
+
+    /**
+     * 查询分机信息列表
+     * 
+     * @param cPhone 分机信息
+     * @return 分机信息集合
+     */
+    public List<CPhone> selectCPhoneList(CPhone cPhone);
+
+    /**
+     * 新增分机信息
+     * 
+     * @param cPhone 分机信息
+     * @return 结果
+     */
+    public int insertCPhone(CPhone cPhone);
+
+    /**
+     * 修改分机信息
+     * 
+     * @param cPhone 分机信息
+     * @return 结果
+     */
+    public int updateCPhone(CPhone cPhone);
+
+    /**
+     * 删除分机信息
+     * 
+     * @param id 分机信息主键
+     * @return 结果
+     */
+    public int deleteCPhoneById(String id);
+
+    /**
+     * 批量删除分机信息
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteCPhoneByIds(String[] ids);
+}

+ 61 - 0
slibra-system/src/main/java/com/slibra/business/service/ICPhoneService.java

@@ -0,0 +1,61 @@
+package com.slibra.business.service;
+
+import java.util.List;
+import com.slibra.business.domain.CPhone;
+
+/**
+ * 分机信息Service接口
+ * 
+ * @author slibra
+ * @date 2024-12-02
+ */
+public interface ICPhoneService 
+{
+    /**
+     * 查询分机信息
+     * 
+     * @param id 分机信息主键
+     * @return 分机信息
+     */
+    public CPhone selectCPhoneById(String id);
+
+    /**
+     * 查询分机信息列表
+     * 
+     * @param cPhone 分机信息
+     * @return 分机信息集合
+     */
+    public List<CPhone> selectCPhoneList(CPhone cPhone);
+
+    /**
+     * 新增分机信息
+     * 
+     * @param cPhone 分机信息
+     * @return 结果
+     */
+    public int insertCPhone(CPhone cPhone);
+
+    /**
+     * 修改分机信息
+     * 
+     * @param cPhone 分机信息
+     * @return 结果
+     */
+    public int updateCPhone(CPhone cPhone);
+
+    /**
+     * 批量删除分机信息
+     * 
+     * @param ids 需要删除的分机信息主键集合
+     * @return 结果
+     */
+    public int deleteCPhoneByIds(String[] ids);
+
+    /**
+     * 删除分机信息信息
+     * 
+     * @param id 分机信息主键
+     * @return 结果
+     */
+    public int deleteCPhoneById(String id);
+}

+ 96 - 0
slibra-system/src/main/java/com/slibra/business/service/impl/CPhoneServiceImpl.java

@@ -0,0 +1,96 @@
+package com.slibra.business.service.impl;
+
+import java.util.List;
+import com.slibra.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.slibra.business.mapper.CPhoneMapper;
+import com.slibra.business.domain.CPhone;
+import com.slibra.business.service.ICPhoneService;
+
+/**
+ * 分机信息Service业务层处理
+ * 
+ * @author slibra
+ * @date 2024-12-02
+ */
+@Service
+public class CPhoneServiceImpl implements ICPhoneService 
+{
+    @Autowired
+    private CPhoneMapper cPhoneMapper;
+
+    /**
+     * 查询分机信息
+     * 
+     * @param id 分机信息主键
+     * @return 分机信息
+     */
+    @Override
+    public CPhone selectCPhoneById(String id)
+    {
+        return cPhoneMapper.selectCPhoneById(id);
+    }
+
+    /**
+     * 查询分机信息列表
+     * 
+     * @param cPhone 分机信息
+     * @return 分机信息
+     */
+    @Override
+    public List<CPhone> selectCPhoneList(CPhone cPhone)
+    {
+        return cPhoneMapper.selectCPhoneList(cPhone);
+    }
+
+    /**
+     * 新增分机信息
+     * 
+     * @param cPhone 分机信息
+     * @return 结果
+     */
+    @Override
+    public int insertCPhone(CPhone cPhone)
+    {
+        cPhone.setCreateTime(DateUtils.getNowDate());
+        return cPhoneMapper.insertCPhone(cPhone);
+    }
+
+    /**
+     * 修改分机信息
+     * 
+     * @param cPhone 分机信息
+     * @return 结果
+     */
+    @Override
+    public int updateCPhone(CPhone cPhone)
+    {
+        cPhone.setUpdateTime(DateUtils.getNowDate());
+        return cPhoneMapper.updateCPhone(cPhone);
+    }
+
+    /**
+     * 批量删除分机信息
+     * 
+     * @param ids 需要删除的分机信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCPhoneByIds(String[] ids)
+    {
+        return cPhoneMapper.deleteCPhoneByIds(ids);
+    }
+
+    /**
+     * 删除分机信息信息
+     * 
+     * @param id 分机信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCPhoneById(String id)
+    {
+        return cPhoneMapper.deleteCPhoneById(id);
+    }
+}

+ 14 - 2
slibra-system/src/main/java/com/slibra/system/service/impl/SysUserServiceImpl.java

@@ -7,11 +7,14 @@ import javax.validation.Validator;
 
 import com.slibra.business.domain.CAgent;
 import com.slibra.business.domain.CAgentMonitor;
+import com.slibra.business.domain.CPhone;
 import com.slibra.business.mapper.CAgentMapper;
 import com.slibra.business.mapper.CAgentMonitorMapper;
+import com.slibra.business.mapper.CPhoneMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -35,8 +38,7 @@ import com.slibra.system.mapper.SysUserRoleMapper;
 import com.slibra.system.service.ISysConfigService;
 import com.slibra.system.service.ISysUserService;
 
-import static com.slibra.common.constant.MyConstants.LOGIN_TYPE_APPEND;
-import static com.slibra.common.constant.MyConstants.SAAS_ID;
+import static com.slibra.common.constant.MyConstants.*;
 
 /**
  * 用户 业务层处理
@@ -75,6 +77,12 @@ public class SysUserServiceImpl implements ISysUserService
     @Autowired
     private CAgentMonitorMapper cagentMonitorMapper;
 
+    @Autowired
+    private CPhoneMapper cPhoneMapper;
+
+    @Value("${SIP_SUFFIX}")
+    private String sipSuffix;
+
     /**
      * 根据条件分页查询用户列表
      * 
@@ -350,6 +358,10 @@ public class SysUserServiceImpl implements ISysUserService
             CAgentMonitor cAgentMonitor = CAgentMonitor.builder().saasId(SAAS_ID).agentNum(agentNum).outId(agentNum).build();
             //插入坐席监控
             this.cagentMonitorMapper.insertCAgentMonitor(cAgentMonitor);
+            //分机信息对象
+            CPhone cPhone = CPhone.builder().saasId(SAAS_ID).phoneNum(agentNum).sipServer(SIP_PREFIX + agentNum + sipSuffix).build();
+            //插入分机信息
+            this.cPhoneMapper.insertCPhone(cPhone);
         }
 
     }

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

@@ -123,7 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <!-- 2024年11月25日11:03:19 下面是新增的SQL,不允许覆盖 -->
     <select id="selectMaxNum" resultType="string">
         SELECT
-            IFNULL( MAX( agent_num ), '1000' )
+            IFNULL( MAX( agent_num ), '1101' )
         FROM
             c_agent
         WHERE is_delete = 0

+ 99 - 0
slibra-system/src/main/resources/mapper/business/CPhoneMapper.xml

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.slibra.business.mapper.CPhoneMapper">
+    
+    <resultMap type="CPhone" id="CPhoneResult">
+        <result property="id"    column="id"    />
+        <result property="saasId"    column="saas_id"    />
+        <result property="phoneNum"    column="phone_num"    />
+        <result property="phonePwd"    column="phone_pwd"    />
+        <result property="sipServer"    column="sip_server"    />
+        <result property="wssServer"    column="wss_server"    />
+        <result property="iceServer"    column="ice_server"    />
+        <result property="isDelete"    column="is_delete"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="createTime"    column="create_time"    />
+    </resultMap>
+
+    <sql id="selectCPhoneVo">
+        select id, saas_id, phone_num, phone_pwd, sip_server, wss_server, ice_server, is_delete, update_time, create_time from c_phone
+    </sql>
+
+    <select id="selectCPhoneList" parameterType="CPhone" resultMap="CPhoneResult">
+        <include refid="selectCPhoneVo"/>
+        <where>
+            1 = 1
+            <if test="saasId != null  and saasId != ''"> and saas_id = #{saasId}</if>
+            <if test="phoneNum != null  and phoneNum != ''"> and phone_num = #{phoneNum}</if>
+            <if test="phonePwd != null  and phonePwd != ''"> and phone_pwd = #{phonePwd}</if>
+            <if test="sipServer != null  and sipServer != ''"> and sip_server = #{sipServer}</if>
+            <if test="wssServer != null  and wssServer != ''"> and wss_server = #{wssServer}</if>
+            <if test="iceServer != null  and iceServer != ''"> and ice_server = #{iceServer}</if>
+            <if test="isDelete != null "> and is_delete = #{isDelete}</if>
+        </where>
+        and del_flag = 0 order by id desc
+    </select>
+    
+    <select id="selectCPhoneById" parameterType="String" resultMap="CPhoneResult">
+        <include refid="selectCPhoneVo"/>
+        where id = #{id} and del_flag = 0
+    </select>
+        
+    <insert id="insertCPhone" parameterType="CPhone" useGeneratedKeys="true" keyProperty="id">
+        insert into c_phone
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="saasId != null and saasId != ''">saas_id,</if>
+            <if test="phoneNum != null and phoneNum != ''">phone_num,</if>
+            <if test="phonePwd != null and phonePwd != ''">phone_pwd,</if>
+            <if test="sipServer != null and sipServer != ''">sip_server,</if>
+            <if test="wssServer != null and wssServer != ''">wss_server,</if>
+            <if test="iceServer != null and iceServer != ''">ice_server,</if>
+            <if test="isDelete != null">is_delete,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="createTime != null">create_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="saasId != null and saasId != ''">#{saasId},</if>
+            <if test="phoneNum != null and phoneNum != ''">#{phoneNum},</if>
+            <if test="phonePwd != null and phonePwd != ''">#{phonePwd},</if>
+            <if test="sipServer != null and sipServer != ''">#{sipServer},</if>
+            <if test="wssServer != null and wssServer != ''">#{wssServer},</if>
+            <if test="iceServer != null and iceServer != ''">#{iceServer},</if>
+            <if test="isDelete != null">#{isDelete},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCPhone" parameterType="CPhone">
+        update c_phone
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="saasId != null and saasId != ''">saas_id = #{saasId},</if>
+            <if test="phoneNum != null and phoneNum != ''">phone_num = #{phoneNum},</if>
+            <if test="phonePwd != null and phonePwd != ''">phone_pwd = #{phonePwd},</if>
+            <if test="sipServer != null and sipServer != ''">sip_server = #{sipServer},</if>
+            <if test="wssServer != null and wssServer != ''">wss_server = #{wssServer},</if>
+            <if test="iceServer != null and iceServer != ''">ice_server = #{iceServer},</if>
+            <if test="isDelete != null">is_delete = #{isDelete},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+        </trim>
+        ,revision = revision + 1
+        where id = #{id}
+    </update>
+
+    
+
+    <delete id="deleteCPhoneById" parameterType="String">
+        update c_phone set del_flag = 2,revision = revision + 1 where del_flag = 0 and id = #{id}
+    </delete>
+
+    <delete id="deleteCPhoneByIds" parameterType="String">
+        update c_phone set del_flag = 2,revision = revision + 1 where del_flag = 0 and id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>