|
|
@@ -19,6 +19,8 @@ import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.mapper.CompanyDeptMapper;
|
|
|
import com.fs.company.mapper.CompanyMapper;
|
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
|
+import com.fs.company.mapper.CompanyVoiceRoboticCallLogCallphoneMapper;
|
|
|
+import com.fs.company.mapper.CrmCustomerCallLogMapper;
|
|
|
import com.fs.crm.domain.*;
|
|
|
import com.fs.crm.dto.CrmCustomerAssignCompanyDTO;
|
|
|
import com.fs.crm.dto.CrmCustomerAssignUserDTO;
|
|
|
@@ -93,6 +95,12 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu
|
|
|
@Autowired
|
|
|
private IWxSopExecuteService wxSopExecuteService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CrmCustomerCallLogMapper crmCustomerCallLogMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CompanyVoiceRoboticCallLogCallphoneMapper companyVoiceRoboticCallLogCallphoneMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询客户
|
|
|
*
|
|
|
@@ -303,6 +311,57 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu
|
|
|
return crmCustomerMapper.selectCrmCustomerListQueryParam(crmCustomer);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void fillCallStats(List<CrmCustomerListVO> list) {
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<Long> customerIds = list.stream()
|
|
|
+ .map(CrmCustomerListVO::getCustomerId)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (customerIds.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<Long, CustomerCallStatVO> manualToday = toStatMap(crmCustomerCallLogMapper.selectManualCallStatToday(customerIds));
|
|
|
+ Map<Long, CustomerCallStatVO> manualTotal = toStatMap(crmCustomerCallLogMapper.selectManualCallStatTotal(customerIds));
|
|
|
+ Map<Long, CustomerCallStatVO> aiToday = toStatMap(companyVoiceRoboticCallLogCallphoneMapper.selectAiCallStatToday(customerIds));
|
|
|
+ Map<Long, CustomerCallStatVO> aiTotal = toStatMap(companyVoiceRoboticCallLogCallphoneMapper.selectAiCallStatTotal(customerIds));
|
|
|
+
|
|
|
+ for (CrmCustomerListVO vo : list) {
|
|
|
+ Long id = vo.getCustomerId();
|
|
|
+ CustomerCallStatVO mt = id == null ? null : manualToday.get(id);
|
|
|
+ vo.setTodayManualTotalCount(mt == null || mt.getTotalCount() == null ? 0 : mt.getTotalCount());
|
|
|
+ vo.setTodayManualConnectCount(mt == null || mt.getConnectCount() == null ? 0 : mt.getConnectCount());
|
|
|
+
|
|
|
+ CustomerCallStatVO ml = id == null ? null : manualTotal.get(id);
|
|
|
+ vo.setTotalManualTotalCount(ml == null || ml.getTotalCount() == null ? 0 : ml.getTotalCount());
|
|
|
+ vo.setTotalManualConnectCount(ml == null || ml.getConnectCount() == null ? 0 : ml.getConnectCount());
|
|
|
+
|
|
|
+ CustomerCallStatVO at = id == null ? null : aiToday.get(id);
|
|
|
+ vo.setTodayAiTotalCount(at == null || at.getTotalCount() == null ? 0 : at.getTotalCount());
|
|
|
+ vo.setTodayAiConnectCount(at == null || at.getConnectCount() == null ? 0 : at.getConnectCount());
|
|
|
+
|
|
|
+ CustomerCallStatVO al = id == null ? null : aiTotal.get(id);
|
|
|
+ vo.setTotalAiTotalCount(al == null || al.getTotalCount() == null ? 0 : al.getTotalCount());
|
|
|
+ vo.setTotalAiConnectCount(al == null || al.getConnectCount() == null ? 0 : al.getConnectCount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<Long, CustomerCallStatVO> toStatMap(List<CustomerCallStatVO> stats) {
|
|
|
+ if (stats == null || stats.isEmpty()) {
|
|
|
+ return Collections.emptyMap();
|
|
|
+ }
|
|
|
+ Map<Long, CustomerCallStatVO> map = new HashMap<>(stats.size() * 2);
|
|
|
+ for (CustomerCallStatVO s : stats) {
|
|
|
+ if (s.getCustomerId() != null) {
|
|
|
+ map.put(s.getCustomerId(), s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<CrmMyCustomerListQueryVO> selectCrmMyCustomerListQuery(CrmMyCustomerListQueryParam param) {
|
|
|
return crmCustomerMapper.selectCrmMyCustomerListQuery(param);
|