|
@@ -275,9 +275,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="callerNum != null and callerNum != ''">
|
|
<if test="callerNum != null and callerNum != ''">
|
|
|
and t1.caller_num like concat('%', #{callerNum}, '%')
|
|
and t1.caller_num like concat('%', #{callerNum}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="intention != null and intention != ''">
|
|
|
|
|
- and t1.intention = #{intention}
|
|
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="intentionEmpty != null and intentionEmpty">
|
|
|
|
|
+ and (t1.intention is null or t1.intention = '' or t1.intention = '0')
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test="intention != null and intention != ''">
|
|
|
|
|
+ and t1.intention = #{intention}
|
|
|
|
|
+ </when>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ <if test="isConnected != null and isConnected == 1">
|
|
|
|
|
+ and t1.call_time > 0
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="isConnected != null and isConnected == 0">
|
|
|
|
|
+ and (t1.call_time is null or t1.call_time = 0)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="minCallTime != null">
|
|
|
|
|
+ and t1.call_time >= #{minCallTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="maxCallTime != null">
|
|
|
|
|
+ and t1.call_time <= #{maxCallTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <sql id="detailListWhere">
|
|
|
|
|
+ FROM company_voice_robotic_call_log_callphone t1
|
|
|
|
|
+ inner join company_voice_robotic cvr on cvr.id = t1.robotic_id
|
|
|
|
|
+ left join company_voice_robotic_callees ce on ce.id = t1.caller_id
|
|
|
|
|
+ left join company t2 on t1.company_id = t2.company_id
|
|
|
|
|
+ left join company_user t3 on t3.user_id = t1.company_user_id
|
|
|
|
|
+ where cvr.company_id = #{companyId}
|
|
|
|
|
+ <if test="roboticId != null">and t1.robotic_id = #{roboticId}</if>
|
|
|
|
|
+ <if test="status != null">and t1.status = #{status}</if>
|
|
|
|
|
+ <if test="phone != null and phone != ''">
|
|
|
|
|
+ and (t1.caller_num like concat('%', #{phone}, '%') or ce.phone = #{encryptedPhone})
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="intentionEmpty != null and intentionEmpty">
|
|
|
|
|
+ and (t1.intention is null or t1.intention = '' or t1.intention = '0')
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test="intention != null and intention != ''">
|
|
|
|
|
+ and t1.intention = #{intention}
|
|
|
|
|
+ </when>
|
|
|
|
|
+ </choose>
|
|
|
<if test="isConnected != null and isConnected == 1">
|
|
<if test="isConnected != null and isConnected == 1">
|
|
|
and t1.call_time > 0
|
|
and t1.call_time > 0
|
|
|
</if>
|
|
</if>
|
|
@@ -290,7 +330,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="maxCallTime != null">
|
|
<if test="maxCallTime != null">
|
|
|
and t1.call_time <= #{maxCallTime}
|
|
and t1.call_time <= #{maxCallTime}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="beginRunTime != null and beginRunTime != ''">
|
|
|
|
|
+ and date_format(t1.run_time,'%Y-%m-%d') >= #{beginRunTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endRunTime != null and endRunTime != ''">
|
|
|
|
|
+ and date_format(t1.run_time,'%Y-%m-%d') <= #{endRunTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </sql>
|
|
|
|
|
|
|
|
|
|
+ <select id="selectDetailList" resultType="com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneVO" parameterType="com.fs.company.domain.CompanyVoiceRoboticCallLogCallphone">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ t1.log_id as logId,
|
|
|
|
|
+ t1.robotic_id as roboticId,
|
|
|
|
|
+ t1.caller_id as callerId,
|
|
|
|
|
+ t1.run_time as runTime,
|
|
|
|
|
+ t1.run_param as runParam,
|
|
|
|
|
+ t1.result as result,
|
|
|
|
|
+ t1.status as status,
|
|
|
|
|
+ t1.company_id as companyId,
|
|
|
|
|
+ t1.company_user_id as companyUserId,
|
|
|
|
|
+ COALESCE(NULLIF(TRIM(t1.caller_num), ''), ce.phone) as callerNum,
|
|
|
|
|
+ t1.callee_num as calleeNum,
|
|
|
|
|
+ t1.intention as intention,
|
|
|
|
|
+ t1.call_time as callTime,
|
|
|
|
|
+ t1.record_path as recordPath,
|
|
|
|
|
+ t1.content_list as contentList,
|
|
|
|
|
+ t1.cost as cost,
|
|
|
|
|
+ t1.call_type as callType,
|
|
|
|
|
+ t1.is_warning as isWarning,
|
|
|
|
|
+ CASE WHEN t1.call_time IS NOT NULL AND t1.call_time > 0 THEN CEILING(t1.call_time / 60.0) ELSE NULL END AS billingMinute,
|
|
|
|
|
+ t2.company_name as companyName,
|
|
|
|
|
+ t3.nick_name as companyUserName,
|
|
|
|
|
+ cvr.name as roboticName,
|
|
|
|
|
+ ce.user_id as customerId
|
|
|
|
|
+ <include refid="detailListWhere"/>
|
|
|
|
|
+ order by t1.run_time desc
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="selectDetailSummary" resultType="com.fs.company.vo.CompanyVoiceRoboticCallLogDetailSummary" parameterType="com.fs.company.domain.CompanyVoiceRoboticCallLogCallphone">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ count(1) as totalCount,
|
|
|
|
|
+ sum(case when t1.status = 2 then 1 else 0 end) as successCount,
|
|
|
|
|
+ sum(case when t1.status = 3 then 1 else 0 end) as failCount,
|
|
|
|
|
+ sum(case when t1.call_time is not null and t1.call_time > 0 then 1 else 0 end) as connectedCount,
|
|
|
|
|
+ sum(case when t1.call_time is not null and t1.call_time > 0 then ceiling(t1.call_time / 60.0) else 0 end) as totalBillingMinute
|
|
|
|
|
+ <include refid="detailListWhere"/>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="listDecryptPhoneExport" resultType="com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneDecryptQueryVO" parameterType="com.fs.company.domain.CompanyVoiceRoboticCallLogCallphone">
|
|
<select id="listDecryptPhoneExport" resultType="com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneDecryptQueryVO" parameterType="com.fs.company.domain.CompanyVoiceRoboticCallLogCallphone">
|
|
@@ -300,9 +384,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
t1.intention as intention,
|
|
t1.intention as intention,
|
|
|
ce.phone as phone
|
|
ce.phone as phone
|
|
|
FROM company_voice_robotic_call_log_callphone t1
|
|
FROM company_voice_robotic_call_log_callphone t1
|
|
|
|
|
+ inner join company_voice_robotic cvr on cvr.id = t1.robotic_id
|
|
|
left join company_voice_robotic_callees ce on ce.id = t1.caller_id
|
|
left join company_voice_robotic_callees ce on ce.id = t1.caller_id
|
|
|
- left join company_voice_robotic cvr on cvr.id = t1.robotic_id
|
|
|
|
|
- where 1=1
|
|
|
|
|
|
|
+ where cvr.company_id = #{companyId}
|
|
|
<if test="roboticId != null">and t1.robotic_id = #{roboticId}</if>
|
|
<if test="roboticId != null">and t1.robotic_id = #{roboticId}</if>
|
|
|
<if test="callerId != null">and t1.caller_id = #{callerId}</if>
|
|
<if test="callerId != null">and t1.caller_id = #{callerId}</if>
|
|
|
<if test="callerIds != null and callerIds.size() > 0">
|
|
<if test="callerIds != null and callerIds.size() > 0">
|
|
@@ -311,15 +395,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
#{item}
|
|
#{item}
|
|
|
</foreach>
|
|
</foreach>
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="callerNum != null and callerNum != ''">
|
|
|
|
|
- and t1.caller_num like concat('%', #{callerNum}, '%')
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="encryptedPhone != null and encryptedPhone != ''">
|
|
|
|
|
- and ce.phone = #{encryptedPhone}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="intention != null and intention != ''">
|
|
|
|
|
- and t1.intention = #{intention}
|
|
|
|
|
|
|
+ <if test="status != null">and t1.status = #{status}</if>
|
|
|
|
|
+ <if test="phone != null and phone != ''">
|
|
|
|
|
+ and (t1.caller_num like concat('%', #{phone}, '%') or ce.phone = #{encryptedPhone})
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="intentionEmpty != null and intentionEmpty">
|
|
|
|
|
+ and (t1.intention is null or t1.intention = '' or t1.intention = '0')
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test="intention != null and intention != ''">
|
|
|
|
|
+ and t1.intention = #{intention}
|
|
|
|
|
+ </when>
|
|
|
|
|
+ </choose>
|
|
|
<if test="isConnected != null and isConnected == 1">
|
|
<if test="isConnected != null and isConnected == 1">
|
|
|
and t1.call_time > 0
|
|
and t1.call_time > 0
|
|
|
</if>
|
|
</if>
|
|
@@ -332,6 +419,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="maxCallTime != null">
|
|
<if test="maxCallTime != null">
|
|
|
and t1.call_time <= #{maxCallTime}
|
|
and t1.call_time <= #{maxCallTime}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="beginRunTime != null and beginRunTime != ''">
|
|
|
|
|
+ and date_format(t1.run_time,'%Y-%m-%d') >= #{beginRunTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endRunTime != null and endRunTime != ''">
|
|
|
|
|
+ and date_format(t1.run_time,'%Y-%m-%d') <= #{endRunTime}
|
|
|
|
|
+ </if>
|
|
|
order by t1.run_time desc
|
|
order by t1.run_time desc
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|