|
|
@@ -53,60 +53,111 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
total_cost, billing_status, caller_number, ivr_dtmf_digits, manual_answered_time, manual_answered_time_len from cc_call_phone
|
|
|
</sql>
|
|
|
|
|
|
+ <sql id="ccCallPhoneListWhere">
|
|
|
+ <if test="uuid != null and uuid != '' "> and cp.uuid = #{uuid}</if>
|
|
|
+ <if test="telephone != null and telephone != ''"> and cp.telephone = #{telephone}</if>
|
|
|
+ <if test="custName != null and custName != ''"> and cp.cust_name = #{custName}</if>
|
|
|
+ <if test="callstatus != null "> and cp.callstatus = #{callstatus}</if>
|
|
|
+ <if test="params.calloutTimeStart != null and params.calloutTimeStart != ''"><!-- 开始时间检索 -->
|
|
|
+ AND cp.callout_time >= #{params.calloutTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="params.calloutTimeEnd != null and params.calloutTimeEnd != ''"><!-- 结束时间检索 -->
|
|
|
+ AND cp.callout_time <= #{params.calloutTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="params.callEndTimeStart != null and params.callEndTimeStart != ''"><!-- 开始时间检索 -->
|
|
|
+ AND cp.call_end_time >= #{params.callEndTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="params.callEndTimeEnd != null and params.callEndTimeEnd != ''"><!-- 结束时间检索 -->
|
|
|
+ AND cp.call_end_time <= #{params.callEndTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="params.timeLenStart != null and params.timeLenStart != ''"><!-- 开始时间检索 -->
|
|
|
+ AND cp.time_len >= #{params.timeLenStart}
|
|
|
+ </if>
|
|
|
+ <if test="params.timeLenEnd != null and params.timeLenEnd != ''"><!-- 结束时间检索 -->
|
|
|
+ AND cp.time_len <= #{params.timeLenEnd}
|
|
|
+ </if>
|
|
|
+ <if test="params.connectedTimeStart != null and params.connectedTimeStart != ''"><!-- 开始时间检索 -->
|
|
|
+ AND cp.connected_time >= #{params.connectedTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="params.connectedTimeEnd != null and params.connectedTimeEnd != ''"><!-- 结束时间检索 -->
|
|
|
+ AND cp.connected_time <= #{params.connectedTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="params.answeredTimeStart != null and params.answeredTimeStart != ''"><!-- 开始时间检索 -->
|
|
|
+ AND cp.answered_time >= #{params.answeredTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="params.answeredTimeEnd != null and params.answeredTimeEnd != ''"><!-- 结束时间检索 -->
|
|
|
+ AND cp.answered_time <= #{params.answeredTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="batchId != null">
|
|
|
+ AND cp.batch_id = #{batchId}
|
|
|
+ </if>
|
|
|
+ <if test="params.batchIds != null and params.batchIds.size() > 0">
|
|
|
+ AND cp.batch_id IN
|
|
|
+ <foreach collection="params.batchIds" item="bid" open="(" separator="," close=")">
|
|
|
+ #{bid}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="batchName != null and batchName != ''">
|
|
|
+ AND EXISTS (
|
|
|
+ SELECT 1 FROM cc_call_task ct
|
|
|
+ WHERE ct.batch_id = cp.batch_id
|
|
|
+ AND ct.batch_name like concat('%', #{batchName}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="intent != null and intent != ''">
|
|
|
+ AND cp.intent = #{intent}
|
|
|
+ </if>
|
|
|
+ <if test="billingStatus != null ">
|
|
|
+ and cp.billing_status = #{billingStatus}
|
|
|
+ </if>
|
|
|
+ <if test="callerNumber != null and callerNumber != '' ">
|
|
|
+ and cp.caller_number = #{callerNumber}
|
|
|
+ </if>
|
|
|
+ AND cp.callstatus >= 3 AND cp.call_end_time > 0
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 列表完整查询(导出/API/计费等仍可用,含大字段) -->
|
|
|
<select id="selectCcCallPhoneList" parameterType="CcCallPhone" resultMap="CcCallPhoneResult">
|
|
|
- select cp.*,ct.batch_name as batchName from cc_call_phone cp left join cc_call_task ct on cp.batch_id = ct.batch_id
|
|
|
+ select cp.*, ct.batch_name as batchName
|
|
|
+ from cc_call_phone cp
|
|
|
+ left join cc_call_task ct on cp.batch_id = ct.batch_id
|
|
|
<where>
|
|
|
- <if test="uuid != null and uuid != '' "> and cp.uuid = #{uuid}</if>
|
|
|
- <if test="telephone != null and telephone != ''"> and cp.telephone = #{telephone}</if>
|
|
|
- <if test="custName != null and custName != ''"> and cp.cust_name = #{custName}</if>
|
|
|
- <if test="callstatus != null "> and cp.callstatus = #{callstatus}</if>
|
|
|
- <if test="params.calloutTimeStart != null and params.calloutTimeStart != ''"><!-- 开始时间检索 -->
|
|
|
- AND cp.callout_time >= #{params.calloutTimeStart}
|
|
|
- </if>
|
|
|
- <if test="params.calloutTimeEnd != null and params.calloutTimeEnd != ''"><!-- 结束时间检索 -->
|
|
|
- AND cp.callout_time <= #{params.calloutTimeEnd}
|
|
|
- </if>
|
|
|
- <if test="params.callEndTimeStart != null and params.callEndTimeStart != ''"><!-- 开始时间检索 -->
|
|
|
- AND cp.call_end_time >= #{params.callEndTimeStart}
|
|
|
- </if>
|
|
|
- <if test="params.callEndTimeEnd != null and params.callEndTimeEnd != ''"><!-- 结束时间检索 -->
|
|
|
- AND cp.call_end_time <= #{params.callEndTimeEnd}
|
|
|
- </if>
|
|
|
- <if test="params.timeLenStart != null and params.timeLenStart != ''"><!-- 开始时间检索 -->
|
|
|
- AND cp.time_len >= #{params.timeLenStart}
|
|
|
- </if>
|
|
|
- <if test="params.timeLenEnd != null and params.timeLenEnd != ''"><!-- 结束时间检索 -->
|
|
|
- AND cp.time_len <= #{params.timeLenEnd}
|
|
|
- </if>
|
|
|
- <if test="params.connectedTimeStart != null and params.connectedTimeStart != ''"><!-- 开始时间检索 -->
|
|
|
- AND cp.connected_time >= #{params.connectedTimeStart}
|
|
|
- </if>
|
|
|
- <if test="params.connectedTimeEnd != null and params.connectedTimeEnd != ''"><!-- 结束时间检索 -->
|
|
|
- AND cp.connected_time <= #{connectedTimeEnd}
|
|
|
- </if>
|
|
|
- <if test="params.answeredTimeStart != null and params.answeredTimeStart != ''"><!-- 开始时间检索 -->
|
|
|
- AND cp.answered_time >= #{params.answeredTimeStart}
|
|
|
- </if>
|
|
|
- <if test="params.answeredTimeEnd != null and params.answeredTimeEnd != ''"><!-- 结束时间检索 -->
|
|
|
- AND cp.answered_time <= #{params.answeredTimeEnd}
|
|
|
- </if>
|
|
|
- <if test="batchId != null and batchId != ''">
|
|
|
- AND cp.batch_id = #{batchId}
|
|
|
- </if>
|
|
|
- <if test="intent != null and intent != ''">
|
|
|
- AND cp.intent = #{intent}
|
|
|
- </if>
|
|
|
- <if test="billingStatus != null ">
|
|
|
- and cp.billing_status = #{billingStatus}
|
|
|
- </if>
|
|
|
- <if test="callerNumber != null and callerNumber != '' ">
|
|
|
- and cp.caller_number = #{callerNumber}
|
|
|
- </if>
|
|
|
- AND cp.callstatus >= 3 AND cp.call_end_time > 0
|
|
|
+ <include refid="ccCallPhoneListWhere"/>
|
|
|
</where>
|
|
|
order by cp.call_end_time desc
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 列表加速第1步:仅查 id,避免分页/COUNT 触碰 TEXT 大字段 -->
|
|
|
+ <select id="selectCcCallPhoneIds" parameterType="CcCallPhone" resultType="java.lang.String">
|
|
|
+ select cp.id
|
|
|
+ from cc_call_phone cp
|
|
|
+ <where>
|
|
|
+ <include refid="ccCallPhoneListWhere"/>
|
|
|
+ </where>
|
|
|
+ order by cp.call_end_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 列表加速第2步:按 id 回表列表展示字段(不含 dialogue/biz_json/tts_text) -->
|
|
|
+ <select id="selectCcCallPhoneLiteByIds" resultMap="CcCallPhoneResult">
|
|
|
+ select
|
|
|
+ cp.id, cp.batch_id, cp.telephone, cp.cust_name, cp.createtime, cp.callstatus,
|
|
|
+ cp.callout_time, cp.callcount, cp.call_end_time, cp.time_len, cp.valid_time_len,
|
|
|
+ cp.uuid, cp.connected_time, cp.hangup_cause, cp.answered_time,
|
|
|
+ cp.wavfile, cp.record_server_url, cp.dialogue_count, cp.acd_opnum,
|
|
|
+ cp.acd_queue_time, cp.acd_wait_time, cp.intent, cp.caller_number,
|
|
|
+ cp.ivr_dtmf_digits, cp.manual_answered_time, cp.manual_answered_time_len
|
|
|
+ from cc_call_phone cp
|
|
|
+ where cp.id in
|
|
|
+ <foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ order by field(cp.id,
|
|
|
+ <foreach collection="ids" item="id" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getCustIntentionList" parameterType="CcCallPhone" resultMap="CcCallPhoneResult">
|
|
|
<include refid="selectCcCallPhoneVo"/>
|
|
|
where intent = '' AND callstatus >= 3 AND call_end_time > 0 limit 100
|
|
|
@@ -227,6 +278,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
WHERE batch_id = #{batchId}
|
|
|
</select>
|
|
|
|
|
|
+ <select id="statByBatchIds" resultType="com.ruoyi.aicall.model.CallTaskStatModel">
|
|
|
+ SELECT batch_id AS batchId,
|
|
|
+ COUNT(1) AS phoneCount,
|
|
|
+ SUM(CASE WHEN callout_time > 0 THEN 1 ELSE 0 END) AS callCount,
|
|
|
+ SUM(CASE WHEN answered_time > 0 THEN 1 ELSE 0 END) AS connectCount
|
|
|
+ FROM cc_call_phone
|
|
|
+ WHERE batch_id IN
|
|
|
+ <foreach collection="batchIds" item="batchId" open="(" separator="," close=")">
|
|
|
+ #{batchId}
|
|
|
+ </foreach>
|
|
|
+ GROUP BY batch_id
|
|
|
+ </select>
|
|
|
+
|
|
|
<insert id="batchInsertCcCallPhone" parameterType="java.util.List">
|
|
|
INSERT INTO cc_call_phone (
|
|
|
id, batch_id, telephone, cust_name, createtime, callstatus,
|