Kaynağa Gözat

cid新增统计外呼,修复龙虾引擎报错代码

lmx 1 gün önce
ebeveyn
işleme
0da3cced3e
17 değiştirilmiş dosya ile 329 ekleme ve 17 silme
  1. 26 0
      fs-company/src/main/java/com/fs/company/controller/company/CompanyVoiceRoboticCallLogCallphoneController.java
  2. 14 0
      fs-company/src/main/java/com/fs/company/controller/company/CompanyVoiceRoboticController.java
  3. 9 4
      fs-company/src/main/java/com/fs/company/controller/crm/CrmCustomerController.java
  4. 12 0
      fs-company/src/main/java/com/fs/company/controller/crm/CustomerAllController.java
  5. 17 0
      fs-service/src/main/java/com/fs/company/domain/CompanyVoiceRoboticCallLogCallphone.java
  6. 12 0
      fs-service/src/main/java/com/fs/company/domain/CrmCustomerCallLog.java
  7. 5 0
      fs-service/src/main/java/com/fs/company/mapper/CompanyVoiceRoboticCallLogCallphoneMapper.java
  8. 7 0
      fs-service/src/main/java/com/fs/company/service/ICompanyVoiceRoboticCallLogCallphoneService.java
  9. 47 0
      fs-service/src/main/java/com/fs/company/service/impl/CompanyVoiceRoboticCallLogCallphoneServiceImpl.java
  10. 1 1
      fs-service/src/main/java/com/fs/company/service/impl/CompanyWorkflowLobsterServiceImpl.java
  11. 3 0
      fs-service/src/main/java/com/fs/company/vo/CompanyVoiceRoboticCallLogCallPhoneVO.java
  12. 24 0
      fs-service/src/main/java/com/fs/company/vo/CompanyVoiceRoboticCallLogDetailSummary.java
  13. 4 0
      fs-service/src/main/java/com/fs/crm/param/CrmCustomeRecoverParam.java
  14. 2 0
      fs-service/src/main/java/com/fs/crm/service/ICrmCustomerService.java
  15. 33 0
      fs-service/src/main/java/com/fs/crm/service/impl/CrmCustomerServiceImpl.java
  16. 105 12
      fs-service/src/main/resources/mapper/company/CompanyVoiceRoboticCallLogCallphoneMapper.xml
  17. 8 0
      fs-service/src/main/resources/mapper/company/CrmCustomerCallLogMapper.xml

+ 26 - 0
fs-company/src/main/java/com/fs/company/controller/company/CompanyVoiceRoboticCallLogCallphoneController.java

@@ -77,6 +77,30 @@ public class CompanyVoiceRoboticCallLogCallphoneController extends BaseControlle
 
 
     }
     }
 
 
+    /**
+     * AI外呼记录明细列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:callphoneDetail:list')")
+    @GetMapping("/detailList")
+    public TableDataInfo detailList(CompanyVoiceRoboticCallLogCallphone param) {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        companyVoiceRoboticCallLogCallphoneService.prepareDetailListQuery(param, loginUser.getCompany().getCompanyId());
+        startPage();
+        List<CompanyVoiceRoboticCallLogCallPhoneVO> list = companyVoiceRoboticCallLogCallphoneService.selectDetailList(param);
+        return getDataTable(list);
+    }
+
+    /**
+     * AI外呼记录明细统计
+     */
+    @PreAuthorize("@ss.hasPermi('company:callphoneDetail:list')")
+    @GetMapping("/detailSummary")
+    public AjaxResult detailSummary(CompanyVoiceRoboticCallLogCallphone param) {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        companyVoiceRoboticCallLogCallphoneService.prepareDetailListQuery(param, loginUser.getCompany().getCompanyId());
+        return AjaxResult.success(companyVoiceRoboticCallLogCallphoneService.selectDetailSummary(param));
+    }
+
 
 
     /**
     /**
      * 查询调用日志_发送短信列表(按照任务id分组,任务id-任务名称-查询总任务数量-成功数量)
      * 查询调用日志_发送短信列表(按照任务id分组,任务id-任务名称-查询总任务数量-成功数量)
@@ -184,6 +208,8 @@ public class CompanyVoiceRoboticCallLogCallphoneController extends BaseControlle
     @GetMapping("/exportDetailPhone")
     @GetMapping("/exportDetailPhone")
     public AjaxResult exportDetailPhone(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone)
     public AjaxResult exportDetailPhone(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone)
     {
     {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        companyVoiceRoboticCallLogCallphoneService.prepareDetailListQuery(companyVoiceRoboticCallLogCallphone, loginUser.getCompany().getCompanyId());
         List<CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO> list =
         List<CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO> list =
                 companyVoiceRoboticCallLogCallphoneService.listDecryptPhoneExport(companyVoiceRoboticCallLogCallphone);
                 companyVoiceRoboticCallLogCallphoneService.listDecryptPhoneExport(companyVoiceRoboticCallLogCallphone);
         ExcelUtil<CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO> util =
         ExcelUtil<CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO> util =

+ 14 - 0
fs-company/src/main/java/com/fs/company/controller/company/CompanyVoiceRoboticController.java

@@ -115,6 +115,20 @@ public class CompanyVoiceRoboticController extends BaseController
         companyVoiceRobotic.setCompanyId(loginUser.getCompany().getCompanyId());
         companyVoiceRobotic.setCompanyId(loginUser.getCompany().getCompanyId());
         return R.ok().put("data", companyVoiceRoboticService.selectCompanyVoiceRoboticListCompany(companyVoiceRobotic));
         return R.ok().put("data", companyVoiceRoboticService.selectCompanyVoiceRoboticListCompany(companyVoiceRobotic));
     }
     }
+
+    /**
+     * 外呼任务下拉选项(分页 + 名称模糊搜索,按当前登录公司过滤)
+     */
+    @PreAuthorize("@ss.hasPermi('company:callphoneDetail:list')")
+    @GetMapping("/selectOptions")
+    public TableDataInfo selectOptions(CompanyVoiceRobotic companyVoiceRobotic) {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        companyVoiceRobotic.setCompanyId(loginUser.getCompany().getCompanyId());
+        startPage();
+        List<CompanyVoiceRobotic> list = companyVoiceRoboticService.selectCompanyVoiceRoboticListCompany(companyVoiceRobotic);
+        return getDataTable(list);
+    }
+
     @PreAuthorize("@ss.hasPermi('system:companyVoiceRobotic:list')")
     @PreAuthorize("@ss.hasPermi('system:companyVoiceRobotic:list')")
     @GetMapping("/calleesList")
     @GetMapping("/calleesList")
     public TableDataInfo calleesList(Long id){
     public TableDataInfo calleesList(Long id){

+ 9 - 4
fs-company/src/main/java/com/fs/company/controller/crm/CrmCustomerController.java

@@ -565,11 +565,16 @@ public class CrmCustomerController extends BaseController
     public AjaxResult queryPhone(@PathVariable("customerId") Long customerId)
     public AjaxResult queryPhone(@PathVariable("customerId") Long customerId)
     {
     {
         CrmCustomer customer = crmCustomerService.selectCrmCustomerById(customerId);
         CrmCustomer customer = crmCustomerService.selectCrmCustomerById(customerId);
-        String mobile = customer.getMobile();
-        if (mobile != null && mobile.length() > 11) {
-            mobile = PhoneUtil.decryptPhone(mobile);
+        if(null != customer){
+            String mobile = customer.getMobile();
+            if (mobile != null && mobile.length() > 11) {
+                mobile = PhoneUtil.decryptPhone(mobile);
+            }
+
+            return AjaxResult.success().put("mobile", mobile);
         }
         }
-        return AjaxResult.success().put("mobile", mobile);
+
+        return AjaxResult.error("数据缺失,请联系管理员");
     }
     }
 
 
     @ApiOperation("动态数据字典查询")
     @ApiOperation("动态数据字典查询")

+ 12 - 0
fs-company/src/main/java/com/fs/company/controller/crm/CustomerAllController.java

@@ -66,4 +66,16 @@ public class CustomerAllController extends BaseController {
         param.setCompanyUserId(loginUser.getUser().getUserId());
         param.setCompanyUserId(loginUser.getUser().getUserId());
         return crmCustomerService.recover(param, operName);
         return crmCustomerService.recover(param, operName);
     }
     }
+
+    @ApiOperation("批量回收公海")
+    @PreAuthorize("@ss.hasPermi('crm:customer:recover')")
+    @PostMapping("/batchRecover")
+    public R batchRecover(@RequestBody CrmCustomeRecoverParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String operName = loginUser.getUsername();
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        param.setCompanyUserId(loginUser.getUser().getUserId());
+        return crmCustomerService.batchRecover(param, operName);
+    }
 }
 }

+ 17 - 0
fs-service/src/main/java/com/fs/company/domain/CompanyVoiceRoboticCallLogCallphone.java

@@ -182,6 +182,23 @@ public class CompanyVoiceRoboticCallLogCallphone extends BaseEntity{
     @TableField(exist = false)
     @TableField(exist = false)
     private Integer runningCount;
     private Integer runningCount;
 
 
+    /** 详情筛选-运行时间起(yyyy-MM-dd) */
+    @TableField(exist = false)
+    private String beginRunTime;
+
+    /** 详情筛选-运行时间止(yyyy-MM-dd) */
+    @TableField(exist = false)
+    private String endRunTime;
+
+    /** 详情筛选-客户类型为「无」 */
+    @TableField(exist = false)
+    private Boolean intentionEmpty;
+
+    /**
+     * 重试次数
+     */
+    private Integer retryCount;
+
     public static CompanyVoiceRoboticCallLogCallphone initCallLog( String runParam, Long keyId, Long taskId,Long companyId) {
     public static CompanyVoiceRoboticCallLogCallphone initCallLog( String runParam, Long keyId, Long taskId,Long companyId) {
         CompanyVoiceRoboticCallLogCallphone log = new CompanyVoiceRoboticCallLogCallphone();
         CompanyVoiceRoboticCallLogCallphone log = new CompanyVoiceRoboticCallLogCallphone();
         log.callerId = keyId;
         log.callerId = keyId;

+ 12 - 0
fs-service/src/main/java/com/fs/company/domain/CrmCustomerCallLog.java

@@ -175,6 +175,18 @@ public class CrmCustomerCallLog extends BaseEntity {
      */
      */
     private Long maxCallTime;
     private Long maxCallTime;
 
 
+    /**
+     * 查询条件:呼叫开始时间-起(yyyy-MM-dd)
+     * 非持久化字段
+     */
+    private String callBeginTime;
+
+    /**
+     * 查询条件:呼叫开始时间-止(yyyy-MM-dd)
+     * 非持久化字段
+     */
+    private String callEndTime;
+
     /**
     /**
      * 计费分钟数
      * 计费分钟数
      */
      */

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

@@ -6,6 +6,7 @@ import com.fs.company.domain.CompanyVoiceRoboticCallees;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneDecryptQueryVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneDecryptQueryVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCount;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCount;
+import com.fs.company.vo.CompanyVoiceRoboticCallLogDetailSummary;
 import com.fs.crm.vo.CustomerCallStatVO;
 import com.fs.crm.vo.CustomerCallStatVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
@@ -90,6 +91,10 @@ public interface CompanyVoiceRoboticCallLogCallphoneMapper extends BaseMapper<Co
 
 
     List<CompanyVoiceRoboticCallLogCallPhoneVO> listByRoboticId(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
     List<CompanyVoiceRoboticCallLogCallPhoneVO> listByRoboticId(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
 
 
+    List<CompanyVoiceRoboticCallLogCallPhoneVO> selectDetailList(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
+
+    CompanyVoiceRoboticCallLogDetailSummary selectDetailSummary(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
+
     List<CompanyVoiceRoboticCallLogCallPhoneDecryptQueryVO> listDecryptPhoneExport(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
     List<CompanyVoiceRoboticCallLogCallPhoneDecryptQueryVO> listDecryptPhoneExport(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
 
 
     /**
     /**

+ 7 - 0
fs-service/src/main/java/com/fs/company/service/ICompanyVoiceRoboticCallLogCallphoneService.java

@@ -5,6 +5,7 @@ import com.fs.company.domain.CompanyVoiceRoboticCallLogCallphone;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCount;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCount;
+import com.fs.company.vo.CompanyVoiceRoboticCallLogDetailSummary;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -84,6 +85,12 @@ public interface ICompanyVoiceRoboticCallLogCallphoneService extends IService<Co
 
 
     List<CompanyVoiceRoboticCallLogCallPhoneVO> listByRoboticId(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
     List<CompanyVoiceRoboticCallLogCallPhoneVO> listByRoboticId(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
 
 
+    void prepareDetailListQuery(CompanyVoiceRoboticCallLogCallphone query, Long companyId);
+
+    List<CompanyVoiceRoboticCallLogCallPhoneVO> selectDetailList(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
+
+    CompanyVoiceRoboticCallLogDetailSummary selectDetailSummary(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
+
     List<CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO> listDecryptPhoneExport(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
     List<CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO> listDecryptPhoneExport(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
 
 
     List<CompanyVoiceRoboticCallLogCallphone> selectManualAnsweredList(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);
     List<CompanyVoiceRoboticCallLogCallphone> selectManualAnsweredList(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone);

+ 47 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanyVoiceRoboticCallLogCallphoneServiceImpl.java

@@ -28,6 +28,7 @@ import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneDecryptQueryVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneDecryptQueryVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCallPhoneVO;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCount;
 import com.fs.company.vo.CompanyVoiceRoboticCallLogCount;
+import com.fs.company.vo.CompanyVoiceRoboticCallLogDetailSummary;
 import com.fs.company.vo.easycall.EasyCallCallPhoneVO;
 import com.fs.company.vo.easycall.EasyCallCallPhoneVO;
 import com.fs.core.config.TenantConfigContext;
 import com.fs.core.config.TenantConfigContext;
 import com.fs.crm.service.ICrmCustomerPropertyService;
 import com.fs.crm.service.ICrmCustomerPropertyService;
@@ -582,6 +583,46 @@ public class CompanyVoiceRoboticCallLogCallphoneServiceImpl extends ServiceImpl<
         return baseMapper.listByRoboticId(companyVoiceRoboticCallLogCallphone);
         return baseMapper.listByRoboticId(companyVoiceRoboticCallLogCallphone);
     }
     }
 
 
+    @Override
+    public void prepareDetailListQuery(CompanyVoiceRoboticCallLogCallphone query, Long companyId) {
+        query.setCompanyId(companyId);
+        prepareDetailPhoneQuery(query);
+    }
+
+    @Override
+    public List<CompanyVoiceRoboticCallLogCallPhoneVO> selectDetailList(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone) {
+        List<CompanyVoiceRoboticCallLogCallPhoneVO> list = baseMapper.selectDetailList(companyVoiceRoboticCallLogCallphone);
+        if (list == null || list.isEmpty()) {
+            return list;
+        }
+        for (CompanyVoiceRoboticCallLogCallPhoneVO vo : list) {
+            if (StringUtils.isNotEmpty(vo.getCallerNum())) {
+                vo.setCallerNum(PhoneUtil.decryptPhoneMk(vo.getCallerNum()));
+            }
+        }
+        return list;
+    }
+
+    @Override
+    public CompanyVoiceRoboticCallLogDetailSummary selectDetailSummary(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone) {
+        CompanyVoiceRoboticCallLogDetailSummary summary = baseMapper.selectDetailSummary(companyVoiceRoboticCallLogCallphone);
+        if (summary == null) {
+            summary = new CompanyVoiceRoboticCallLogDetailSummary();
+            summary.setTotalCount(0L);
+            summary.setSuccessCount(0L);
+            summary.setFailCount(0L);
+            summary.setConnectedCount(0L);
+            summary.setTotalBillingMinute(0L);
+        }
+        if (summary.getTotalBillingMinute() == null) {
+            summary.setTotalBillingMinute(0L);
+        }
+        long total = summary.getTotalCount() == null ? 0L : summary.getTotalCount();
+        long connected = summary.getConnectedCount() == null ? 0L : summary.getConnectedCount();
+        summary.setConnectRate(total > 0 ? (int) Math.round(connected * 100.0 / total) : 0);
+        return summary;
+    }
+
     @Override
     @Override
     public List<CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO> listDecryptPhoneExport(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone) {
     public List<CompanyVoiceRoboticCallLogCallPhoneDecryptExportVO> listDecryptPhoneExport(CompanyVoiceRoboticCallLogCallphone companyVoiceRoboticCallLogCallphone) {
         prepareDetailPhoneQuery(companyVoiceRoboticCallLogCallphone);
         prepareDetailPhoneQuery(companyVoiceRoboticCallLogCallphone);
@@ -628,6 +669,12 @@ public class CompanyVoiceRoboticCallLogCallphoneServiceImpl extends ServiceImpl<
         if (StringUtils.isNotEmpty(query.getPhone())) {
         if (StringUtils.isNotEmpty(query.getPhone())) {
             query.setEncryptedPhone(PhoneUtil.encryptPhone(query.getPhone()));
             query.setEncryptedPhone(PhoneUtil.encryptPhone(query.getPhone()));
         }
         }
+        if (StringUtils.isNotEmpty(query.getIntention()) && "0".equals(query.getIntention())) {
+            query.setIntentionEmpty(true);
+            query.setIntention(null);
+        } else {
+            query.setIntentionEmpty(null);
+        }
     }
     }
     /**
     /**
      * 判断整数
      * 判断整数

+ 1 - 1
fs-service/src/main/java/com/fs/company/service/impl/CompanyWorkflowLobsterServiceImpl.java

@@ -127,7 +127,7 @@ public class CompanyWorkflowLobsterServiceImpl implements ICompanyWorkflowLobste
         return null;
         return null;
     }
     }
 
 
-    private R callAiService(String requestParam, Long logId, String appKey) {
+    public R callAiService(String requestParam, Long logId, String appKey) {
         ChatParam param = new ChatParam();
         ChatParam param = new ChatParam();
         param.setChatId(logId.toString());
         param.setChatId(logId.toString());
         param.setStream(false);
         param.setStream(false);

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

@@ -87,4 +87,7 @@ public class CompanyVoiceRoboticCallLogCallPhoneVO {
 
 
     /** 是否警告(0否 1是)用于敏感词 */
     /** 是否警告(0否 1是)用于敏感词 */
     private Integer isWarning;
     private Integer isWarning;
+
+    /** 计费分钟数:通话时长向上取整,未满1分钟按1分钟 */
+    private Integer billingMinute;
 }
 }

+ 24 - 0
fs-service/src/main/java/com/fs/company/vo/CompanyVoiceRoboticCallLogDetailSummary.java

@@ -0,0 +1,24 @@
+package com.fs.company.vo;
+
+import lombok.Data;
+
+/**
+ * AI外呼记录明细统计
+ */
+@Data
+public class CompanyVoiceRoboticCallLogDetailSummary {
+
+    private Long totalCount;
+
+    private Long successCount;
+
+    private Long failCount;
+
+    private Long connectedCount;
+
+    /** 接通率(百分比,整数) */
+    private Integer connectRate;
+
+    /** 计费分钟合计(未满1分钟按1分钟计) */
+    private Long totalBillingMinute;
+}

+ 4 - 0
fs-service/src/main/java/com/fs/crm/param/CrmCustomeRecoverParam.java

@@ -3,6 +3,8 @@ package com.fs.crm.param;
 
 
 import lombok.Data;
 import lombok.Data;
 
 
+import java.util.List;
+
 @Data
 @Data
 public class CrmCustomeRecoverParam extends BaseQueryParam
 public class CrmCustomeRecoverParam extends BaseQueryParam
 {
 {
@@ -10,6 +12,8 @@ public class CrmCustomeRecoverParam extends BaseQueryParam
 
 
     private Long customerUserId;
     private Long customerUserId;
 
 
+    private List<Long> customerUserIds;
+
     private Long companyUserId;
     private Long companyUserId;
 
 
     private Long companyId;
     private Long companyId;

+ 2 - 0
fs-service/src/main/java/com/fs/crm/service/ICrmCustomerService.java

@@ -109,6 +109,8 @@ public interface ICrmCustomerService
 
 
     R recover(CrmCustomeRecoverParam param, String operName);
     R recover(CrmCustomeRecoverParam param, String operName);
 
 
+    R batchRecover(CrmCustomeRecoverParam param, String operName);
+
     R assignUser(CrmCustomeAssignUserParam param, String operName);
     R assignUser(CrmCustomeAssignUserParam param, String operName);
 
 
     Integer selectCrmCustomerCountByType(Long companyId, int type);
     Integer selectCrmCustomerCountByType(Long companyId, int type);

+ 33 - 0
fs-service/src/main/java/com/fs/crm/service/impl/CrmCustomerServiceImpl.java

@@ -508,6 +508,39 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu
         return R.ok();
         return R.ok();
     }
     }
 
 
+    @Override
+    public R batchRecover(CrmCustomeRecoverParam param, String operName) {
+        if (param.getCustomerUserIds() == null || param.getCustomerUserIds().isEmpty()) {
+            return R.error("请选择要回收的客户");
+        }
+        int successCount = 0;
+        int failCount = 0;
+        StringBuilder failMsg = new StringBuilder();
+        for (Long customerUserId : param.getCustomerUserIds()) {
+            CrmCustomeRecoverParam recoverParam = new CrmCustomeRecoverParam();
+            recoverParam.setCustomerUserId(customerUserId);
+            recoverParam.setCompanyId(param.getCompanyId());
+            recoverParam.setCompanyUserId(param.getCompanyUserId());
+            R result = recover(recoverParam, operName);
+            if (Integer.valueOf(200).equals(result.get("code"))) {
+                successCount++;
+            } else {
+                failCount++;
+                if (failMsg.length() > 0) {
+                    failMsg.append(";");
+                }
+                failMsg.append(result.get("msg"));
+            }
+        }
+        if (failCount == 0) {
+            return R.ok("成功回收" + successCount + "个客户");
+        }
+        if (successCount == 0) {
+            return R.error("回收失败:" + failMsg);
+        }
+        return R.ok("成功回收" + successCount + "个客户,失败" + failCount + "个:" + failMsg);
+    }
+
     @Override
     @Override
     public R assignUser(CrmCustomeAssignUserParam param, String operName) {
     public R assignUser(CrmCustomeAssignUserParam param, String operName) {
         CompanyUser companyUser = companyUserMapper.selectCompanyUserById(param.getCompanyUserId());
         CompanyUser companyUser = companyUserMapper.selectCompanyUserById(param.getCompanyUserId());

+ 105 - 12
fs-service/src/main/resources/mapper/company/CompanyVoiceRoboticCallLogCallphoneMapper.xml

@@ -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 &gt; 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 &gt;= #{minCallTime}
+        </if>
+        <if test="maxCallTime != null">
+            and t1.call_time &lt;= #{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 &gt; 0
             and t1.call_time &gt; 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 &lt;= #{maxCallTime}
             and t1.call_time &lt;= #{maxCallTime}
         </if>
         </if>
+        <if test="beginRunTime != null and beginRunTime != ''">
+            and date_format(t1.run_time,'%Y-%m-%d') &gt;= #{beginRunTime}
+        </if>
+        <if test="endRunTime != null and endRunTime != ''">
+            and date_format(t1.run_time,'%Y-%m-%d') &lt;= #{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 &gt; 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 &gt; 0 then 1 else 0 end) as connectedCount,
+        sum(case when t1.call_time is not null and t1.call_time &gt; 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 &gt; 0
             and t1.call_time &gt; 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 &lt;= #{maxCallTime}
             and t1.call_time &lt;= #{maxCallTime}
         </if>
         </if>
+        <if test="beginRunTime != null and beginRunTime != ''">
+            and date_format(t1.run_time,'%Y-%m-%d') &gt;= #{beginRunTime}
+        </if>
+        <if test="endRunTime != null and endRunTime != ''">
+            and date_format(t1.run_time,'%Y-%m-%d') &lt;= #{endRunTime}
+        </if>
         order by t1.run_time desc
         order by t1.run_time desc
     </select>
     </select>
 
 

+ 8 - 0
fs-service/src/main/resources/mapper/company/CrmCustomerCallLogMapper.xml

@@ -42,6 +42,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND date_format(create_time,'%Y-%m-%d') &gt;= #{beginTime}
                 AND date_format(create_time,'%Y-%m-%d') &gt;= #{beginTime}
                 AND date_format(create_time,'%Y-%m-%d') &lt;= #{endTime}
                 AND date_format(create_time,'%Y-%m-%d') &lt;= #{endTime}
             </if>
             </if>
+            <if test="callBeginTime != null and callBeginTime != '' and callEndTime != null and callEndTime != ''">
+                AND FROM_UNIXTIME(call_create_time / 1000, '%Y-%m-%d') &gt;= #{callBeginTime}
+                AND FROM_UNIXTIME(call_create_time / 1000, '%Y-%m-%d') &lt;= #{callEndTime}
+            </if>
         </where>
         </where>
         order by create_time desc
         order by create_time desc
     </select>
     </select>
@@ -118,6 +122,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND date_format(create_time,'%Y-%m-%d') &gt;= #{beginTime}
                 AND date_format(create_time,'%Y-%m-%d') &gt;= #{beginTime}
                 AND date_format(create_time,'%Y-%m-%d') &lt;= #{endTime}
                 AND date_format(create_time,'%Y-%m-%d') &lt;= #{endTime}
             </if>
             </if>
+            <if test="callBeginTime != null and callBeginTime != '' and callEndTime != null and callEndTime != ''">
+                AND FROM_UNIXTIME(call_create_time / 1000, '%Y-%m-%d') &gt;= #{callBeginTime}
+                AND FROM_UNIXTIME(call_create_time / 1000, '%Y-%m-%d') &lt;= #{callEndTime}
+            </if>
         </where>
         </where>
     </select>
     </select>