Browse Source

增加cid短信记录查询相关代码

zyy 3 days ago
parent
commit
ac5eb73bd6

+ 25 - 14
fs-company/src/main/java/com/fs/company/controller/company/CompanyVoiceRoboticCallLogSendmsgController.java

@@ -4,6 +4,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import com.fs.company.service.ICompanyVoiceRoboticCallLogCallphoneService;
+import com.fs.company.vo.CompanyVoiceRoboticCallLogCount;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogSendmsgVO;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -40,14 +41,14 @@ public class CompanyVoiceRoboticCallLogSendmsgController extends BaseController
     @Autowired
     private ICompanyVoiceRoboticCallLogCallphoneService companyVoiceRoboticCallLogCallphoneService;
     /**
-     * 查询调用日志_发送短信列表
+     * 查询调用日志_发送短信列表(按照任务id分组,任务id-任务名称-查询总任务数量-成功数量)
      */
     @PreAuthorize("@ss.hasPermi('company:sendmsglog:list')")
     @GetMapping("/list")
     public TableDataInfo list(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg)
     {
         startPage();
-        List<CompanyVoiceRoboticCallLogSendmsg> list = companyVoiceRoboticCallLogSendmsgService.selectCompanyVoiceRoboticCallLogSendmsgList(companyVoiceRoboticCallLogSendmsg);
+        List<CompanyVoiceRoboticCallLogSendmsg> list = companyVoiceRoboticCallLogSendmsgService.selectCompanyVoiceRoboticCallLogSendmsgGroupList(companyVoiceRoboticCallLogSendmsg);
         return getDataTable(list);
     }
 
@@ -75,21 +76,31 @@ public class CompanyVoiceRoboticCallLogSendmsgController extends BaseController
             List<CompanyVoiceRoboticCallLogSendmsgVO> list = companyVoiceRoboticCallLogSendmsgService.listByCallerIdAndRoboticId(companyVoiceRoboticCallLogSendmsg);
             return getDataTable(list);
         }
+    }
 
+    /**
+     * 查询调用日志_发送短信列表统计数据
+     */
+    @PreAuthorize("@ss.hasPermi('company:sendmsglog:list')")
+    @GetMapping("/count")
+    public AjaxResult selectCompanyVoiceRoboticCallLogSendMsgCount()
+    {
+        CompanyVoiceRoboticCallLogCount companyVoiceRoboticCallLogCount = companyVoiceRoboticCallLogSendmsgService.selectCompanyVoiceRoboticCallLogSendMsgCount();
+        return AjaxResult.success(companyVoiceRoboticCallLogCount);
     }
 
-//    /**
-//     * 导出调用日志_发送短信列表
-//     */
-//    @PreAuthorize("@ss.hasPermi('company:sendmsglog:export')")
-//    @Log(title = "调用日志_发送短信", businessType = BusinessType.EXPORT)
-//    @GetMapping("/export")
-//    public AjaxResult export(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg)
-//    {
-//        List<CompanyVoiceRoboticCallLogSendmsg> list = companyVoiceRoboticCallLogSendmsgService.selectCompanyVoiceRoboticCallLogSendmsgList(companyVoiceRoboticCallLogSendmsg);
-//        ExcelUtil<CompanyVoiceRoboticCallLogSendmsg> util = new ExcelUtil<CompanyVoiceRoboticCallLogSendmsg>(CompanyVoiceRoboticCallLogSendmsg.class);
-//        return util.exportExcel(list, "调用日志_发送短信数据");
-//    }
+    /**
+     * 导出调用日志_发送短信列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:sendmsglog:export')")
+    @Log(title = "调用日志_发送短信", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg)
+    {
+        List<CompanyVoiceRoboticCallLogSendmsg> list = companyVoiceRoboticCallLogSendmsgService.selectCompanyVoiceRoboticCallLogSendmsgList(companyVoiceRoboticCallLogSendmsg);
+        ExcelUtil<CompanyVoiceRoboticCallLogSendmsg> util = new ExcelUtil<CompanyVoiceRoboticCallLogSendmsg>(CompanyVoiceRoboticCallLogSendmsg.class);
+        return util.exportExcel(list, "调用日志_发送短信数据");
+    }
 //
 //    /**
 //     * 获取调用日志_发送短信详细信息

+ 15 - 1
fs-service/src/main/java/com/fs/company/domain/CompanyVoiceRoboticCallLogSendmsg.java

@@ -49,7 +49,7 @@ public class CompanyVoiceRoboticCallLogSendmsg extends BaseEntity{
     private String result;
 
     /** 执行状态:1、执行中,2、执行成功,3、执行失败 */
-    @Excel(name = "执行状态:1、执行中,2、执行成功,3、执行失败")
+    @Excel(name = "执行状态", readConverterExp = "1=执行中,2=执行成功,3=执行失败")
     private Integer status;
 
     /** 公司id */
@@ -80,6 +80,20 @@ public class CompanyVoiceRoboticCallLogSendmsg extends BaseEntity{
 
     private String callbackUuid;
 
+    private String name;
+
+    private Integer totalRecordCount;
+
+    private Integer successCount;
+
+    private Integer failCount;
+
+    private Integer runningCount;
+
+    private String phone;
+
+
+
     public static CompanyVoiceRoboticCallLogSendmsg initCallLog( String runParam, Long keyId, Long taskId,Long companyId,Long companyUserId,Long tempId) {
         CompanyVoiceRoboticCallLogSendmsg log = new CompanyVoiceRoboticCallLogSendmsg();
         log.callerId = keyId;

+ 5 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyVoiceRoboticCallLogSendmsgMapper.java

@@ -3,6 +3,7 @@ package com.fs.company.mapper;
 import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.company.domain.CompanyVoiceRoboticCallLogSendmsg;
+import com.fs.company.vo.CompanyVoiceRoboticCallLogCount;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogSendmsgVO;
 
 /**
@@ -28,6 +29,8 @@ public interface CompanyVoiceRoboticCallLogSendmsgMapper extends BaseMapper<Comp
      */
     List<CompanyVoiceRoboticCallLogSendmsg> selectCompanyVoiceRoboticCallLogSendmsgList(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg);
 
+    List<CompanyVoiceRoboticCallLogSendmsg> selectCompanyVoiceRoboticCallLogSendmsgGroupList(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg);
+
     /**
      * 新增调用日志_发送短信
      * 
@@ -61,4 +64,6 @@ public interface CompanyVoiceRoboticCallLogSendmsgMapper extends BaseMapper<Comp
     int deleteCompanyVoiceRoboticCallLogSendmsgByLogIds(Long[] logIds);
 
     List<CompanyVoiceRoboticCallLogSendmsgVO> listByCallerIdAndRoboticId(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg);
+
+    CompanyVoiceRoboticCallLogCount selectCompanyVoiceRoboticCallLogSendMsgCount();
 }

+ 5 - 0
fs-service/src/main/java/com/fs/company/service/ICompanyVoiceRoboticCallLogSendmsgService.java

@@ -3,6 +3,7 @@ package com.fs.company.service;
 import java.util.List;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.company.domain.CompanyVoiceRoboticCallLogSendmsg;
+import com.fs.company.vo.CompanyVoiceRoboticCallLogCount;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogSendmsgVO;
 
 /**
@@ -28,6 +29,8 @@ public interface ICompanyVoiceRoboticCallLogSendmsgService extends IService<Comp
      */
     List<CompanyVoiceRoboticCallLogSendmsg> selectCompanyVoiceRoboticCallLogSendmsgList(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg);
 
+    List<CompanyVoiceRoboticCallLogSendmsg> selectCompanyVoiceRoboticCallLogSendmsgGroupList(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg);
+
     /**
      * 新增调用日志_发送短信
      * 
@@ -61,4 +64,6 @@ public interface ICompanyVoiceRoboticCallLogSendmsgService extends IService<Comp
     int deleteCompanyVoiceRoboticCallLogSendmsgByLogId(Long logId);
 
     List<CompanyVoiceRoboticCallLogSendmsgVO> listByCallerIdAndRoboticId(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg);
+
+    CompanyVoiceRoboticCallLogCount selectCompanyVoiceRoboticCallLogSendMsgCount();
 }

+ 11 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanyVoiceRoboticCallLogSendmsgServiceImpl.java

@@ -6,6 +6,7 @@ import com.fs.common.utils.DateUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.company.domain.CompanyVoiceRoboticCallLogCallphone;
 import com.fs.company.mapper.CompanyVoiceRoboticBusinessMapper;
+import com.fs.company.vo.CompanyVoiceRoboticCallLogCount;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogSendmsgVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +40,11 @@ public class CompanyVoiceRoboticCallLogSendmsgServiceImpl extends ServiceImpl<Co
         return baseMapper.selectCompanyVoiceRoboticCallLogSendmsgByLogId(logId);
     }
 
+    @Override
+    public List<CompanyVoiceRoboticCallLogSendmsg> selectCompanyVoiceRoboticCallLogSendmsgGroupList(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg) {
+        return baseMapper.selectCompanyVoiceRoboticCallLogSendmsgGroupList(companyVoiceRoboticCallLogSendmsg);
+    }
+
     /**
      * 查询调用日志_发送短信列表
      * 
@@ -119,4 +125,9 @@ public class CompanyVoiceRoboticCallLogSendmsgServiceImpl extends ServiceImpl<Co
     public List<CompanyVoiceRoboticCallLogSendmsgVO> listByCallerIdAndRoboticId(CompanyVoiceRoboticCallLogSendmsg companyVoiceRoboticCallLogSendmsg){
         return baseMapper.listByCallerIdAndRoboticId(companyVoiceRoboticCallLogSendmsg);
     }
+
+    @Override
+    public CompanyVoiceRoboticCallLogCount selectCompanyVoiceRoboticCallLogSendMsgCount() {
+        return baseMapper.selectCompanyVoiceRoboticCallLogSendMsgCount();
+    }
 }

+ 30 - 0
fs-service/src/main/java/com/fs/company/vo/CompanyVoiceRoboticCallLogCount.java

@@ -0,0 +1,30 @@
+package com.fs.company.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author ZhuanZ(无密码)
+ */
+@Data
+public class CompanyVoiceRoboticCallLogCount {
+
+    /**
+     * 总记录数
+     */
+    private Integer recordCount;
+    /**
+     * 发送成功记录数
+     */
+    private Integer successRecordCount;
+    /**
+     * 今日发送数
+     */
+    private Integer todayCount;
+    /**
+     * 今日发送成功数
+     */
+    private Integer todaySuccessCount;
+
+}

+ 3 - 0
fs-service/src/main/java/com/fs/company/vo/CompanyVoiceRoboticCallLogSendmsgVO.java

@@ -70,4 +70,7 @@ public class CompanyVoiceRoboticCallLogSendmsgVO {
 
     @Excel(name = "短信模板名称")
     private String smsTempName;
+
+    @Excel(name = "发送手机号")
+    private String phone;
 }

+ 45 - 3
fs-service/src/main/resources/mapper/company/CompanyVoiceRoboticCallLogSendmsgMapper.xml

@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectCompanyVoiceRoboticCallLogSendmsgList" parameterType="CompanyVoiceRoboticCallLogSendmsg" resultMap="CompanyVoiceRoboticCallLogSendmsgResult">
         <include refid="selectCompanyVoiceRoboticCallLogSendmsgVo"/>
-        <where>  
+        <where>
             <if test="roboticId != null "> and robotic_id = #{roboticId}</if>
             <if test="callerId != null "> and caller_id = #{callerId}</if>
             <if test="runTime != null "> and run_time = #{runTime}</if>
@@ -40,6 +40,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="contentLen != null "> and content_len = #{contentLen}</if>
         </where>
     </select>
+
+    <select id="selectCompanyVoiceRoboticCallLogSendmsgGroupList" parameterType="CompanyVoiceRoboticCallLogSendmsg" resultType="com.fs.company.domain.CompanyVoiceRoboticCallLogSendmsg">
+        select
+        robotic_id,
+        cvr.name,
+        count(1) as totalRecordCount,
+        sum(case when status = 1 then 1 else 0 end) as runningCount,
+        sum(case when status = 2 then 1 else 0 end) as successCount,
+        sum(case when status = 3 then 1 else 0 end) as failCount
+        from company_voice_robotic_call_log_sendmsg msg
+        left join company_voice_robotic cvr on cvr.id = msg.robotic_id
+        <where>
+            <if test="roboticId != null">and robotic_id = #{roboticId}</if>
+            <if test="callerId != null">and caller_id = #{callerId}</if>
+            <if test="runTime != null">and run_time = #{runTime}</if>
+            <if test="runParam != null and runParam != ''">and run_param = #{runParam}</if>
+            <if test="result != null and result != ''">and result = #{result}</if>
+            <if test="status != null">and status = #{status}</if>
+            <if test="companyId != null">and company_id = #{companyId}</if>
+            <if test="companyUserId != null">and company_user_id = #{companyUserId}</if>
+            <if test="tempId != null">and temp_id = #{tempId}</if>
+            <if test="cost != null">and cost = #{cost}</if>
+            <if test="contentLen != null">and content_len = #{contentLen}</if>
+        </where>
+        group by robotic_id
+    </select>
     
     <select id="selectCompanyVoiceRoboticCallLogSendmsgByLogId" parameterType="Long" resultMap="CompanyVoiceRoboticCallLogSendmsgResult">
         <include refid="selectCompanyVoiceRoboticCallLogSendmsgVo"/>
@@ -113,20 +139,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             t1.*,
             t2.company_name,
             t3.nick_name as companyUserName,
-            t4.title as smsTempName
+            t4.title as smsTempName,
+            cc.phone
         FROM company_voice_robotic_call_log_sendmsg t1
+                 left join company_voice_robotic_callees cc on cc.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
                  left join company_sms_temp t4 on t4.temp_id = t1.temp_id
         where 1=1
         <if test="roboticId != null">and t1.robotic_id = #{roboticId}</if>
         <if test="callerId != null">and t1.caller_id = #{callerId}</if>
-        <if test="callerIds != null">
+        <if test="callerIds != null and callerIds.size() > 0">
             AND t1.caller_id IN
             <foreach collection='callerIds' item='item' open='(' separator=',' close=')'>
                 #{item}
             </foreach>
         </if>
+        <if test="phone != null and phone != ''">
+            and cc.phone like concat('%', #{phone}, '%')
+        </if>
+
+    </select>
+
+
+    <select id="selectCompanyVoiceRoboticCallLogSendMsgCount" resultType="com.fs.company.vo.CompanyVoiceRoboticCallLogCount">
+        select
+            count(1) as recordCount,
+            sum(case when status = 2 then 1 else 0 end) as successRecordCount,
+            sum(case when run_time &gt;= CURDATE() and run_time &lt; DATE_ADD(CURDATE(), INTERVAL 1 DAY) then 1 else 0 end) as todayCount,
+            sum(case when status = 2 and run_time &gt;= CURDATE() and run_time &lt; DATE_ADD(CURDATE(), INTERVAL 1 DAY) then 1 else 0 end) as todaySuccessCount
+        from company_voice_robotic_call_log_sendmsg msg
     </select>
 
 </mapper>