Commit 3079ace7 authored by huagnxiner's avatar huagnxiner

添加回访统计代码以及放开crm拉取99客户

parent d54ae4a9
......@@ -33,6 +33,12 @@ public class ManagerVO {
String callYesterday;
String allCallToday;
String allCallYesterday;
//回访客户数
String callCount;
//云迹派工数
String cloudSent;
//云迹数据待回访数
String cloudWait;
public String getIsClear() {
return isClear;
......@@ -145,4 +151,28 @@ public class ManagerVO {
public void setAllCallYesterday(String allCallYesterday) {
this.allCallYesterday = allCallYesterday;
}
public String getCallCount() {
return callCount;
}
public void setCallCount(String callCount) {
this.callCount = callCount;
}
public String getCloudSent() {
return cloudSent;
}
public void setCloudSent(String cloudSent) {
this.cloudSent = cloudSent;
}
public String getCloudWait() {
return cloudWait;
}
public void setCloudWait(String cloudWait) {
this.cloudWait = cloudWait;
}
}
......@@ -251,10 +251,10 @@ public class CrmSourceController extends BaseController {
String[] choseIdArray = choseIds.split(",");
Set choseIdsSet = new HashSet();
Collections.addAll(choseIdsSet, choseIdArray);
//南京站新需求 过滤400来电562 和房博士im咨询99
if (CollectionUtils.isNotEmpty(models) && "nj".equals(city)) {
models.removeIf(m -> m.getSourceId() == 99 || m.getSourceId() == 562);
}
//南京站新需求 过滤400来电562 和房博士im咨询99 //CRM已经限制,全链条无需限制
// if (CollectionUtils.isNotEmpty(models) && "nj".equals(city)) {
// models.removeIf(m -> m.getSourceId() == 99 || m.getSourceId() == 562);
// }
JSONArray sources = new JSONArray();
for (CrmSourceEntity model : models) {
JSONObject source = new JSONObject();
......
......@@ -11,6 +11,7 @@ import com.house365.beans.po.ProjectSrouceRePo;
import com.house365.beans.system.Page;
import com.house365.beans.system.QueryParams;
import com.house365.beans.vo.LocalReportFormVo;
import com.house365.beans.vo.ManagerVO;
import com.house365.beans.vo.ReportMarketingFormVo;
import com.house365.web.system.controller.BaseController;
import com.house365.web.util.*;
......@@ -92,6 +93,14 @@ public class StatisticController extends BaseController {
@Autowired
private ICloudActivityInterface activityInterface;
@Autowired
private ICustomer customer;
@Autowired
private IUserStar userStar;
@Autowired
private IStatisticReport iStatisticReport;
@SuppressWarnings("deprecation")
public static void main(String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyww");
......@@ -3573,4 +3582,119 @@ public class StatisticController extends BaseController {
}
return getAutoUrl();
}
/**
* 回访跟进统计
*
* @param model
* @param request
* @return
*/
@RequestMapping(value = "/callBackTraceStatistic")
public String callBackTraceStatistic(Integer number, Integer pageSize,Model model, HttpServletRequest request) {
UserEntity userEntity = (UserEntity) request.getSession().getAttribute(SessionConstants.THREAD_USER_KEY);
boolean isDirector = user.isDirector(userEntity.getId());
List<DepartmentEntity> departmentEntities = user.getChildDepartList(userEntity.getDeptId());
if (departmentEntities != null && departmentEntities.isEmpty()) {
model.addAttribute("departments", departmentEntities);
return getAutoUrl();
}
//get user list
Page page = new Page(pageSize == null ? 20 : pageSize);
if (null != number) {
page.setCurrentPage(number);
}
//默认返回合肥的数据,只有合肥(deptid=243)需要这个报表
DepartmentEntity depet = null;
for (DepartmentEntity dep : departmentEntities) {
if (dep.getId() == 243) {
depet = dep;
}
}
if (depet == null) {
model.addAttribute("department", null);
return getAutoUrl();
}
// 获取查询条件
String startTime = request.getParameter("startTime");
String endTime = request.getParameter("endTime");
model.addAttribute("startTime", startTime);
model.addAttribute("endTime", endTime);
if (StringUtils.isBlank(startTime) && StringUtils.isBlank(endTime)) {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
Date d = cal.getTime();
SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
//获取昨天日期
String yesterday = sp.format(d);
startTime = yesterday + " 00:00:00";
endTime = yesterday + " 23:59:59";
} else {
startTime = startTime + " 00:00:00";
endTime = endTime + " 23:59:59";
}
Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
UserListResponse ulr = user.getUserListByDept(depet, searchParams, page);
List<UserEntity> userEntities = ulr.getObjectList();
if (searchParams.containsKey("LIKE_realName") && StringUtils.isNotBlank(String.valueOf(searchParams.get("LIKE_realName")))) {
if (userEntity.getRealName().contains(searchParams.get("LIKE_realName").toString())) {
userEntities.add(userEntity);
}
} else {
userEntities.add(userEntity);
}
page = ulr.getPaging();
//填充数据
List<ManagerVO> managerVOS = new ArrayList<>();
for (UserEntity ue : userEntities) {
ManagerVO vo = new ManagerVO();
vo.setManagerId(ue.getId());
vo.setManagerName(ue.getRealName());
//total:累计客户; waitCount:待回访客户; callCount:回访客户; cloudSent:云迹派工数; cloudWait:云迹数据待回访数
Map<String, Object> map = iStatisticReport.getStatisticSummary(ue.getId().toString(), startTime, endTime);
vo.setTotal(String.valueOf(map.get("allCount")));
vo.setWaitCount(String.valueOf(map.get("waitCount")));
vo.setCallCount(String.valueOf(map.get("callCount")));
vo.setCloudSent(String.valueOf(map.get("cloudSent")));
vo.setCloudWait(String.valueOf(map.get("cloudWait")));
Map<String, Object> search = new HashMap<>(10);
search.put("EQ_starUserId", ue.getId());
search.put("EQ_userId", userEntity.getId());
UserStarListRequest cul = new UserStarListRequest();
cul.setPaging(new Page(1));
cul.setSearchParams(search);
UserStarListResponse res = userStar.getUserStarList(cul);
if (res.getObjectList() != null && !res.getObjectList().isEmpty()) {
UserStarEntity entity = res.getObjectList().get(0);
vo.setStar(entity.getStar() == 1 ? "on" : "off");
} else {
vo.setStar("off");
}
Map<String, Object> managerIdMap = new HashMap<>(10);
managerIdMap.put("managerId", ue.getId());
Integer customers = customer.getCustomersById(managerIdMap);
if (customers > 0) {
vo.setIsClear("1");//0:无客户,1:有客户
} else {
vo.setIsClear("0");//0:无客户,1:有客户
}
managerVOS.add(vo);
}
if (isDirector) {
model.addAttribute("isDirector", "1");//1:是主管
} else {
model.addAttribute("isDirector", "0");//0:普通顾问
}
model.addAttribute("deptId", depet.getId());
model.addAttribute("list", managerVOS);
model.addAttribute("page", page);
// model.addAttribute("departments", departmentEntities);
model.addAttribute("department", depet);
model.addAttribute("searchParams", Servlets.encodeParameterStringWithPrefix(searchParams, "search_"));
return getAutoUrl();
}
}
......@@ -402,5 +402,9 @@
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--根据经纪人获取统计信息接口-->
<dubbo:reference id="StatisticReport" interface="com.house365.ws.interfaces.server.IStatisticReport"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans>
......@@ -398,5 +398,10 @@
<dubbo:reference id="getHeadImgByUserId" interface="com.house365.ws.interfaces.rest.IGetHeadImgByUserId"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--根据经纪人获取统计信息接口-->
<dubbo:reference id="StatisticReport" interface="com.house365.ws.interfaces.server.IStatisticReport"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans>
......@@ -398,5 +398,10 @@
<dubbo:reference id="getHeadImgByUserId" interface="com.house365.ws.interfaces.rest.IGetHeadImgByUserId"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--根据经纪人获取统计信息接口-->
<dubbo:reference id="StatisticReport" interface="com.house365.ws.interfaces.server.IStatisticReport"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans>
......@@ -68,6 +68,9 @@
<li>
<a tabindex="-1" href="${ctx}/statistic/cloudCusReport/">云迹数据统计表</a>
</li>
<%-- <li>--%>
<%-- <a tabindex="-1" href="${ctx}/statistic/callBackTraceStatistic/">回访跟进统计</a>--%>
<%-- </li>--%>
</ul>
</li>
</shiro:hasPermission>
......
/**
* Description: AppBrand业务接口
* Copyright: Copyright (c)2016
* Company: 江苏三六五网络股份有限公司
*
* @author: 江苏三六五网络股份有限公司
* @version: 1.0
* Create at: 2016-06-27 下午 13:16:36
* <p>
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* 2016-06-27 江苏三六五网络股份有限公司 1.0 Initial
*/
package com.house365.ws.interfaces.server;
import java.util.Map;
/**
* AppBrand业务接口<br>
*
* @author 江苏三六五网络股份有限公司
* @version 1.0, 2016-06-27
* @see
* @since 1.0
*/
public interface IStatisticReport{
Map<String, Object> getStatisticSummary(String managerId,String startTime,String endTime);
}
package com.house365.ws.dao.mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Map;
/**
* @author Created by Administrator on 2019/1/9.
*/
@Repository
public interface StatisticReportMapper {
Map<String, Object> getStatisticSummary(@Param("managerId") String managerId, @Param("startTime")String startTime, @Param("endTime")String endTime);
}
package com.house365.ws.interfaces.impl;
import com.house365.ws.dao.mapper.StatisticReportMapper;
import com.house365.ws.interfaces.server.IStatisticReport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @author huang xiner
* @version 1.0
* @date 2021/11/11 17:35
*/
@Service("StatisticReport")
public class StatisticReportImpl implements IStatisticReport {
private static final Logger logger = LoggerFactory.getLogger(StatisticReportImpl.class);
@Autowired
private StatisticReportMapper statisticReportMapper;
@Override
public Map<String, Object> getStatisticSummary(String managerId,String startTime,String endTime) {
return statisticReportMapper.getStatisticSummary(managerId,startTime,endTime);
}
}
......@@ -397,5 +397,9 @@
<dubbo:service ref="getHeadImgByUserId" interface="com.house365.ws.interfaces.rest.IGetHeadImgByUserId"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--根据经纪人获取统计信息接口-->
<dubbo:service ref="StatisticReport" interface="com.house365.ws.interfaces.server.IStatisticReport"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.house365.ws.dao.mapper.StatisticReportMapper">
<!-- <select id="getStatisticSummary" resultType="java.util.HashMap">-->
<!-- <![CDATA[-->
<!-- SELECT (-->
<!-- SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and isWaitCall = 1 and c.is_delete = 0 and (manager_id in ($managerId$))) as waitCount,-->
<!-- (SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and (manager_id in ($managerId$))) as allCount,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callYesterday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallYesterday-->
<!-- ]]>-->
<!-- </select>-->
<select id="getStatisticSummary" resultType="java.util.HashMap">
<![CDATA[
SELECT(
SELECT FORMAT(count(id),0) from customer_merge as c where c.is_delete = 0 AND c.STATUS in(11,0,99) and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime} and (c.isWaitCall=0 OR c.isWaitCall IS NULL)) as allCount,
(SELECT FORMAT(count(id),0) from customer as c where c.STATUS in(11,0,99) and isWaitCall = 1 and c.is_delete = 0 and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime}) as waitCount,
(SELECT FORMAT(count(id),0) FROM customer_merge c inner join (select customer_id,count((substr(ccl.manager_name,1,5)!='CRM用户' and ccl.manager_id!=0) or null) as count
from customer_callback_log ccl group by customer_id having count>0) n on c.id=n.customer_id where 1=1
and manager_id = #{managerId} and c.create_time>=#{startTime} and c.create_time<=#{endTime}
AND c.last_call_time is not null AND c.is_delete = 0 AND c.STATUS IN ( 11, 0, 99)
AND ( c.isWaitCall = 0 OR c.isWaitCall IS NULL)) as callCount,
(SELECT FORMAT(count(id),0) from customer_merge as c where c.is_delete = 0 and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime} and (c.isWaitCall = 0 OR c.isWaitCall IS NULL)
AND c.STATUS IN ( 11, 0, 99 ) and c.customer_source_type=7) as cloudSent,
(select FORMAT(count(id),0) FROM customer_merge c inner join (select m.customer_id from customer_callback_log m inner join
(select customer_id,count(*) as count from customer_callback_log group by customer_id) n
on n.count=1 and m.customer_id=n.customer_id and m.manager_id=0) c2 on c.id=c2.customer_id
where 1=1 AND c.is_delete = 0 and manager_id = #{managerId} and c.create_time>=#{startTime} and c.create_time<=#{endTime}
AND c.STATUS IN ( 11, 0, 99 ) and c.customer_source_type=7) as cloudWait
]]>
</select>
</mapper>
\ No newline at end of file
......@@ -389,4 +389,9 @@
<dubbo:service ref="getHeadImgByUserId" interface="com.house365.ws.interfaces.rest.IGetHeadImgByUserId"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--根据经纪人获取统计信息接口-->
<dubbo:service ref="StatisticReport" interface="com.house365.ws.interfaces.server.IStatisticReport"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.house365.ws.dao.mapper.StatisticReportMapper">
<!-- <select id="getStatisticSummary" resultType="java.util.HashMap">-->
<!-- <![CDATA[-->
<!-- SELECT (-->
<!-- SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and isWaitCall = 1 and c.is_delete = 0 and (manager_id in ($managerId$))) as waitCount,-->
<!-- (SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and (manager_id in ($managerId$))) as allCount,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callYesterday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallYesterday-->
<!-- ]]>-->
<!-- </select>-->
<select id="getStatisticSummary" resultType="java.util.HashMap">
<![CDATA[
SELECT(
SELECT FORMAT(count(id),0) from customer_merge as c where c.is_delete = 0 AND c.STATUS in(11,0,99) and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime} and (c.isWaitCall=0 OR c.isWaitCall IS NULL)) as allCount,
(SELECT FORMAT(count(id),0) from customer as c where c.STATUS in(11,0,99) and isWaitCall = 1 and c.is_delete = 0 and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime}) as waitCount,
(SELECT FORMAT(count(id),0) FROM customer_merge c inner join (select customer_id,count((substr(ccl.manager_name,1,5)!='CRM用户' and ccl.manager_id!=0) or null) as count
from customer_callback_log ccl group by customer_id having count>0) n on c.id=n.customer_id where 1=1
and manager_id = #{managerId} and c.create_time>=#{startTime} and c.create_time<=#{endTime}
AND c.last_call_time is not null AND c.is_delete = 0 AND c.STATUS IN ( 11, 0, 99)
AND ( c.isWaitCall = 0 OR c.isWaitCall IS NULL)) as callCount,
(SELECT FORMAT(count(id),0) from customer_merge as c where c.is_delete = 0 and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime} and (c.isWaitCall = 0 OR c.isWaitCall IS NULL)
AND c.STATUS IN ( 11, 0, 99 ) and c.customer_source_type=7) as cloudSent,
(select FORMAT(count(id),0) FROM customer_merge c inner join (select m.customer_id from customer_callback_log m inner join
(select customer_id,count(*) as count from customer_callback_log group by customer_id) n
on n.count=1 and m.customer_id=n.customer_id and m.manager_id=0) c2 on c.id=c2.customer_id
where 1=1 AND c.is_delete = 0 and manager_id = #{managerId} and c.create_time>=#{startTime} and c.create_time<=#{endTime}
AND c.STATUS IN ( 11, 0, 99 ) and c.customer_source_type=7) as cloudWait
]]>
</select>
</mapper>
\ No newline at end of file
......@@ -399,4 +399,9 @@
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--根据经纪人获取统计信息接口-->
<dubbo:service ref="StatisticReport" interface="com.house365.ws.interfaces.server.IStatisticReport"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.house365.ws.dao.mapper.StatisticReportMapper">
<!-- <select id="getStatisticSummary" resultType="java.util.HashMap">-->
<!-- <![CDATA[-->
<!-- SELECT (-->
<!-- SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and isWaitCall = 1 and c.is_delete = 0 and (manager_id in ($managerId$))) as waitCount,-->
<!-- (SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and (manager_id in ($managerId$))) as allCount,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callYesterday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallYesterday-->
<!-- ]]>-->
<!-- </select>-->
<select id="getStatisticSummary" resultType="java.util.HashMap">
<![CDATA[
SELECT(
SELECT FORMAT(count(id),0) from customer_merge as c where c.is_delete = 0 AND c.STATUS in(11,0,99) and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime} and (c.isWaitCall=0 OR c.isWaitCall IS NULL)) as allCount,
(SELECT FORMAT(count(id),0) from customer as c where c.STATUS in(11,0,99) and isWaitCall = 1 and c.is_delete = 0 and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime}) as waitCount,
(SELECT FORMAT(count(id),0) FROM customer_merge c inner join (select customer_id,count((substr(ccl.manager_name,1,5)!='CRM用户' and ccl.manager_id!=0) or null) as count
from customer_callback_log ccl group by customer_id having count>0) n on c.id=n.customer_id where 1=1
and manager_id = #{managerId} and c.create_time>=#{startTime} and c.create_time<=#{endTime}
AND c.last_call_time is not null AND c.is_delete = 0 AND c.STATUS IN ( 11, 0, 99)
AND ( c.isWaitCall = 0 OR c.isWaitCall IS NULL)) as callCount,
(SELECT FORMAT(count(id),0) from customer_merge as c where c.is_delete = 0 and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime} and (c.isWaitCall = 0 OR c.isWaitCall IS NULL)
AND c.STATUS IN ( 11, 0, 99 ) and c.customer_source_type=7) as cloudSent,
(select FORMAT(count(id),0) FROM customer_merge c inner join (select m.customer_id from customer_callback_log m inner join
(select customer_id,count(*) as count from customer_callback_log group by customer_id) n
on n.count=1 and m.customer_id=n.customer_id and m.manager_id=0) c2 on c.id=c2.customer_id
where 1=1 AND c.is_delete = 0 and manager_id = #{managerId} and c.create_time>=#{startTime} and c.create_time<=#{endTime}
AND c.STATUS IN ( 11, 0, 99 ) and c.customer_source_type=7) as cloudWait
]]>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment