Commit 092128a1 authored by jay's avatar jay

私客查询分页修改

parent 8f6bf474
...@@ -564,7 +564,6 @@ public class CustomerManagementController extends BaseController { ...@@ -564,7 +564,6 @@ public class CustomerManagementController extends BaseController {
if (StringUtils.isBlank(managerId)) { if (StringUtils.isBlank(managerId)) {
searchParams.put("EQ_userId", userEntity.getId()); searchParams.put("EQ_userId", userEntity.getId());
} else { } else {
// searchParams.put("EQ_managerId", managerId);
searchParams.put("EQ_userId", managerId); searchParams.put("EQ_userId", managerId);
} }
searchParams.put("EQ_cityCode", cityCode); searchParams.put("EQ_cityCode", cityCode);
......
...@@ -388,5 +388,11 @@ ...@@ -388,5 +388,11 @@
version="${dubbo.app.version}" version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/> timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--获取Im accId信息接口-->
<dubbo:reference id="getImUserInfo" interface="com.house365.ws.interfaces.rest.IGetImUserInfo"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans> </beans>
...@@ -385,5 +385,10 @@ ...@@ -385,5 +385,10 @@
version="${dubbo.app.version}" version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/> timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--获取Im accId信息接口-->
<dubbo:reference id="getImUserInfo" interface="com.house365.ws.interfaces.rest.IGetImUserInfo"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans> </beans>
...@@ -385,5 +385,10 @@ ...@@ -385,5 +385,10 @@
version="${dubbo.app.version}" version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/> timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--获取Im accId信息接口-->
<dubbo:reference id="getImUserInfo" interface="com.house365.ws.interfaces.rest.IGetImUserInfo"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans> </beans>
package com.house365.ws.interfaces.rest;
import com.house365.rest.context.IService;
/**
* @author Created by 365 on 2021/1/8.
*/
public interface IGetImUserInfo extends IService {
}
...@@ -539,7 +539,6 @@ public class CustomerImpl implements ICustomer { ...@@ -539,7 +539,6 @@ public class CustomerImpl implements ICustomer {
map.put("pageSize", request.getPaging().getPageSize()); map.put("pageSize", request.getPaging().getPageSize());
map.put("labelIdList", labelIdList); map.put("labelIdList", labelIdList);
List<String> createSourceList = new ArrayList<>(); List<String> createSourceList = new ArrayList<>();
// for (int i = 0; i < paramMap.size(); i++) {
Set<Map.Entry<String, Object>> entrySet = paramMap.entrySet(); Set<Map.Entry<String, Object>> entrySet = paramMap.entrySet();
Iterator<Map.Entry<String, Object>> it2 = entrySet.iterator(); Iterator<Map.Entry<String, Object>> it2 = entrySet.iterator();
while (it2.hasNext()) { while (it2.hasNext()) {
...@@ -552,33 +551,8 @@ public class CustomerImpl implements ICustomer { ...@@ -552,33 +551,8 @@ public class CustomerImpl implements ICustomer {
if (key2.contains("_")) { if (key2.contains("_")) {
key2 = key2.split("_")[1]; key2 = key2.split("_")[1];
} }
// if("createSource".equals(key2)){
// createSourceList = Arrays.asList(value2);
// if(createSourceList.size() == 1){
// map.put("createSourceList3", createSourceList.get(0));
// }else{
// map.put("createSourceList1", createSourceList.get(0));
// map.put("createSourceList2", createSourceList.get(1));
// }
// continue;
//// createSourceList.add((String)Arrays.asList(value2).get(0));
//// createSourceList.add((String)Arrays.asList(value2).get(1));
//// String paramValue1 = Arrays.asList(value2).get(0).toString();
//// String paramValue2 = Arrays.asList(value2).get(1).toString();
//// paramValue1 = paramValue1.substring(1,paramValue1.length()-1);
//// paramValue2 = paramValue2.substring(1,paramValue2.length()-1);
////
//// map.put("createSourceList2", paramValue2);
// }
// else if("createSource".equals(key2) && !"MANUAL".equals(value2) && Arrays.asList(value2).size()==1){
//// createSourceList.add((String)Arrays.asList(value2).get(0));
// String paramValue = Arrays.asList(value2).get(0).toString();
// paramValue = paramValue.substring(1,paramValue.length()-1);
// map.put("createSourceList3", paramValue);
// }
map.put(key2, value2); map.put(key2, value2);
} }
// }
Object vvv = map.get("createSourceList3"); Object vvv = map.get("createSourceList3");
if (map.containsKey("createSource") && map.get("createSource") != null && !"".equals(map.get("createSource"))) { if (map.containsKey("createSource") && map.get("createSource") != null && !"".equals(map.get("createSource"))) {
...@@ -595,14 +569,9 @@ public class CustomerImpl implements ICustomer { ...@@ -595,14 +569,9 @@ public class CustomerImpl implements ICustomer {
map.remove("isBack"); map.remove("isBack");
} }
List<CustomerEntity> customers = customermergemapper.getCustomerManagementList4Label(map); List<CustomerEntity> customers = customermergemapper.getCustomerManagementList4Label(map);
// List<CustomerVo> customers = (List<CustomerVo>)resultList.get(0);
// int count2 = ((List<Integer>) resultList.get(1)).get(0);
Integer customersCount = customermergemapper.getCustomerManagementList4LabelCount(map); Integer customersCount = customermergemapper.getCustomerManagementList4LabelCount(map);
if (CollectionUtils.isNotEmpty(customers)) { if (CollectionUtils.isNotEmpty(customers)) {
// int count = customers.get(0).getTotalNum();
// int count2 = ((List<Integer>) customers.get(1)).get(0);
int finalPages = customersCount % 100 == 0 ? customersCount / 100 : customersCount / 100 + 1; int finalPages = customersCount % 100 == 0 ? customersCount / 100 : customersCount / 100 + 1;
// int finalPages = customers.get(0).getTotalNum() % 100 == 0 ? customers.get(0).getTotalNum()/100 : customers.get(0).getTotalNum()/100 + 1;
queryParams.getPaging().setPages(finalPages); queryParams.getPaging().setPages(finalPages);
queryParams.getPaging().setRecords(customersCount); queryParams.getPaging().setRecords(customersCount);
} }
......
package com.house365.ws.interfaces.rest;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Strings;
import com.house365.beans.entity.KefuEntity;
import com.house365.beans.entity.UserEntity;
import com.house365.beans.entity.UserMessageEntity;
import com.house365.commons.system.HttpClientUtil;
import com.house365.rest.context.Parameter;
import com.house365.rest.exception.ServiceRunException;
import com.house365.rest.parameter.House365RestObject;
import com.house365.rest.parameter.House365RestResponse;
import com.house365.web.util.MemoryPropertyPlaceholderConfigurer;
import com.house365.ws.dao.mapper.KefuMapper;
import com.house365.ws.dao.mapper.UserMapper;
import com.house365.ws.dao.mapper.UserMessageMapper;
import com.house365.ws.system.ReturnAppResult;
import net.sf.json.JSONObject;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* IM 统一返回accId信息接口
* IM规则调整之后统一封装的接口,区分南京站和其他站
*
* @author Created by 365 on 2021/1/8.
*/
@Service("getImUserInfo")
public class GetImUserInfoImpl implements IGetImUserInfo {
private static final Logger logger = LoggerFactory.getLogger(GetImUserInfoImpl.class);
@Autowired
private UserMapper userMapper;
@Autowired
private UserMessageMapper messageMapper;
@Autowired
private KefuMapper kefumapper;
@Override
public Object exectue(Parameter parameter) throws ServiceRunException {
// 取得所需参数
Map<String, Object> map = parameter.getArgs();
House365RestResponse<Map<String, Object>> response = new House365RestResponse<>();
// 业务层统一处理
try {
House365RestObject<Map<String, Object>> data = new House365RestObject<>();
Map<String, Object> putMap = new HashMap<>(5);
String projectId = getMapValueByKey("houseId", map, "");
String channel = getMapValueByKey("channel", map, "");
String city = getMapValueByKey("city", map, "");
String tfId = getMapValueByKey("tfId", map, "");
if (StringUtils.isBlank(city)) {
response.setResult(ReturnAppResult.APP_FAIL.getResultCode());
response.setMsg("城市参数不全");
return JSONObject.fromObject(response).toString();
}
//南京站跟其他站不同的逻辑
if ("nj".equals(city)) {
if (StringUtils.isBlank(tfId)) {
response.setResult(ReturnAppResult.APP_FAIL.getResultCode());
response.setMsg("接口参数不全");
return JSONObject.fromObject(response).toString();
}
//查询在线客服list
Map<String, Object> queryMap = new HashMap<>(5);
//测试临时新加部门,上线需要调整
queryMap.put("deptUrlPath", "/1/2/69/70/71/72/77");
queryMap.put("onlineStatus", 1);
List<UserEntity> userList = userMapper.queryByConditions(queryMap);
Map<String, Object> searchMap = new HashMap<>(5);
searchMap.put("sender", tfId);
searchMap.put("order", 1);
List<UserMessageEntity> messList = messageMapper.queryByConditions(searchMap);
String accId;
//判断该淘房用户是否聊过天
if (CollectionUtils.isNotEmpty(messList)) {
UserMessageEntity messageEntity = messList.get(0);
queryMap.put("accId", messageEntity.getReceiver());
List<UserEntity> userListNew = userMapper.queryByConditions(queryMap);
if (CollectionUtils.isNotEmpty(userListNew)) {
accId = messageEntity.getReceiver();
} else {
//有在线房博士,随机分配一个,没有则默认组长
accId = getAccId(userList);
}
putMap.put("accId", accId);
data.setEntity(putMap);
} else {
//有在线房博士,随机分配一个,没有则默认组长
accId = getAccId(userList);
putMap.put("accId", accId);
data.setEntity(putMap);
}
} else {
if (StringUtils.isBlank(projectId) || StringUtils.isBlank(channel)) {
response.setResult(ReturnAppResult.APP_FAIL.getResultCode());
response.setMsg("接口参数不全");
return JSONObject.fromObject(response).toString();
}
String accId;
KefuEntity kefuEntity = kefumapper.getKefuInfo(city);
if (null != kefuEntity && "1".equals(kefuEntity.getSetKefu())) {
accId = kefuEntity.getKefuAccid();
} else {
//判断是否直卖楼盘
//调用淘房汇绑定直销人员list
List<NameValuePair> param = new ArrayList<>();
param.add(new BasicNameValuePair("serviceCode", "TaoFangHui"));
param.add(new BasicNameValuePair("serviceName", "getBindInfo"));
param.add(new BasicNameValuePair("city", city));
param.add(new BasicNameValuePair("projectId", projectId));
param.add(new BasicNameValuePair("channel", channel));
String result = HttpClientUtil.doGet(MemoryPropertyPlaceholderConfigurer.getContextProperty("tangfanghui.server.url"), param, 4000, null);
if (result != null) {
//根据条件查不到楼盘信息的情况下
if ("".equals(result)) {
return null;
}
ObjectMapper objectMapper = new ObjectMapper();
Map<String, Map<String, Map>> webMap = objectMapper.readValue(result, Map.class);
List<Map<String, Object>> list = (List<Map<String, Object>>) webMap.get("data").get("entity").get("list");
if (CollectionUtils.isNotEmpty(list)) {
for (Map<String, Object> l : list) {
int userId = Integer.parseInt(l.get("userId").toString());
UserEntity userEntity = userMapper.getById(userId);
}
}
}
}
}
response.setResult(ReturnAppResult.APP_FAIL.getResultCode());
response.setMsg("查询成功");
response.setData(data);
} catch (Exception e) {
logger.error(e.getMessage(), e);
response.setResult(ReturnAppResult.APP_FAIL.getResultCode());
response.setMsg((ReturnAppResult.APP_FAIL.getResultMessage() + ":" + e.getMessage()));
}
return JSONObject.fromObject(response).toString();
}
private String getAccId(List<UserEntity> userList) {
String accId;
//南京站兜底accId qlt_527
String defaultId = "qlt_527";
//有在线房博士,随机分配一个,没有则默认组长
if (CollectionUtils.isNotEmpty(userList)) {
int pick = getRandom(userList.size());
accId = userList.get(pick).getAccId();
} else {
//没有聊天 取默认值组长的的id
accId = defaultId;
}
return accId;
}
/**
* 获取随机数
*
* @param bound 范围 0 - bound-1
* @return
*/
private int getRandom(int bound) {
Random random = new Random();
return random.nextInt(bound);
}
/**
* 获取map中的值
*
* @param key key
* @param map map
* @param defaultValue 默认值
* @return value
*/
private String getMapValueByKey(String key, Map<String, Object> map, String defaultValue) {
String value = "";
if (map.containsKey(key) && map.get(key) != null && !Strings.isNullOrEmpty(((String[]) map.get(key))[0])) {
value = ((String[]) map.get(key))[0];
}
if (Strings.isNullOrEmpty(value)) {
value = defaultValue;
}
return value;
}
@Override
public boolean isControlService() {
return false;
}
@Override
public boolean isLogService() {
return false;
}
@Override
public boolean isMonitorService() {
return false;
}
@Override
public Object rollback() {
return null;
}
@Override
public void commit() {
}
}
...@@ -82,9 +82,6 @@ public class SaveNewMessage implements ISaveNewMessage { ...@@ -82,9 +82,6 @@ public class SaveNewMessage implements ISaveNewMessage {
response.setResult(ReturnAppResult.APP_SUCCESS.getResultCode()); response.setResult(ReturnAppResult.APP_SUCCESS.getResultCode());
response.setMsg("同步message成功"); response.setMsg("同步message成功");
} }
} else {
response.setResult(ReturnAppResult.APP_SUCCESS.getResultCode());
response.setMsg("同步message成功");
} }
} else { } else {
response.setResult(ReturnAppResult.APP_FAIL.getResultCode()); response.setResult(ReturnAppResult.APP_FAIL.getResultCode());
...@@ -92,7 +89,7 @@ public class SaveNewMessage implements ISaveNewMessage { ...@@ -92,7 +89,7 @@ public class SaveNewMessage implements ISaveNewMessage {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
logger.error("同步信息失败", e); logger.error("同步IM信息失败", e);
response.setResult(ReturnAppResult.APP_FAIL.getResultCode()); response.setResult(ReturnAppResult.APP_FAIL.getResultCode());
response.setMsg((ReturnAppResult.APP_FAIL.getResultMessage() + ":" + e.getMessage())); response.setMsg((ReturnAppResult.APP_FAIL.getResultMessage() + ":" + e.getMessage()));
} }
......
...@@ -383,4 +383,9 @@ ...@@ -383,4 +383,9 @@
version="${dubbo.app.version}" version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/> timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--获取Im accId信息接口-->
<dubbo:service ref="getImUserInfo" interface="com.house365.ws.interfaces.rest.IGetImUserInfo"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans> </beans>
...@@ -376,4 +376,9 @@ ...@@ -376,4 +376,9 @@
version="${dubbo.app.version}" version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/> timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--获取Im accId信息接口-->
<dubbo:service ref="getImUserInfo" interface="com.house365.ws.interfaces.rest.IGetImUserInfo"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans> </beans>
...@@ -451,9 +451,8 @@ ...@@ -451,9 +451,8 @@
</select> </select>
<select id="getCustomerManagementList4LabelCount" resultType="Integer" parameterType="map"> <select id="getCustomerManagementList4LabelCount" resultType="Integer" parameterType="map">
select count(distinct t.id ) from (
SELECT SELECT
c.id count(c.id)
FROM customer_merge c FROM customer_merge c
<if test='tabType =="9" || (callbackLog != null and callbackLog != "") || (customerSourceType2 != null and customerSourceType2 != "" )'> <if test='tabType =="9" || (callbackLog != null and callbackLog != "") || (customerSourceType2 != null and customerSourceType2 != "" )'>
inner join ( inner join (
...@@ -472,9 +471,9 @@ ...@@ -472,9 +471,9 @@
</if> </if>
<if test="customerSourceType2 != null and customerSourceType2 != '' "> <if test="customerSourceType2 != null and customerSourceType2 != '' ">
and EXISTS ( and EXISTS (
select customer_source_type from customer c8 select customer_source_type from customer c8
where c8.manager_id=c3.manager_id and c8.phone=c3.phone where c8.manager_id=c3.manager_id and c8.phone=c3.phone
and c8.customer_source_type=#{customerSourceType2} and c8.customer_source_type=#{customerSourceType2}
) )
</if> </if>
<if test="callbackLog != null and callbackLog != '' "> <if test="callbackLog != null and callbackLog != '' ">
...@@ -498,6 +497,7 @@ ...@@ -498,6 +497,7 @@
AND (c1.phone LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone1 LIKE CONCAT('%', #{phone},'%') OR AND (c1.phone LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone1 LIKE CONCAT('%', #{phone},'%') OR
c1.bak_phone2 LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone3 LIKE CONCAT('%', #{phone},'%') ) c1.bak_phone2 LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone3 LIKE CONCAT('%', #{phone},'%') )
</if> </if>
group by c1.manager_id,c1.phone
)t2 on c.manager_id = t2.manager_id AND c.phone = t2.phone )t2 on c.manager_id = t2.manager_id AND c.phone = t2.phone
</if> </if>
<if test="labelIdList != null and labelIdList.size() > 0 "> <if test="labelIdList != null and labelIdList.size() > 0 ">
...@@ -626,8 +626,7 @@ ...@@ -626,8 +626,7 @@
<if test="userId != null and userId != '' "> <if test="userId != null and userId != '' ">
AND ( AND (
c.manager_id = #{userId} c.manager_id = #{userId}
OR c.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM OR c.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) )
user WHERE id = #{userId} ) )
) )
</if> </if>
<if test="bindTimeStart != null and bindTimeStart != '' "> <if test="bindTimeStart != null and bindTimeStart != '' ">
...@@ -636,8 +635,6 @@ ...@@ -636,8 +635,6 @@
<if test="bindTimeEnd != null and bindTimeEnd != '' "> <if test="bindTimeEnd != null and bindTimeEnd != '' ">
AND c.bind_time &lt;=#{bindTimeEnd} AND c.bind_time &lt;=#{bindTimeEnd}
</if> </if>
<if test="isNotBackFour != null and isNotBackFour != '' "> <if test="isNotBackFour != null and isNotBackFour != '' ">
and datediff( CURRENT_DATE, c.last_call_time ) &gt;= 3 and datediff( CURRENT_DATE, c.last_call_time ) &gt;= 3
AND datediff( CURRENT_DATE, c.last_call_time ) &lt;= 7 AND datediff( CURRENT_DATE, c.last_call_time ) &lt;= 7
...@@ -655,131 +652,16 @@ ...@@ -655,131 +652,16 @@
<if test="isNotBackEight != null and isNotBackEight != '' "> <if test="isNotBackEight != null and isNotBackEight != '' ">
and datediff( CURRENT_DATE, c.last_call_time ) &gt;= 50 and datediff( CURRENT_DATE, c.last_call_time ) &gt;= 50
</if> </if>
<if test="customTimeTypeOne != null and customTimeTypeOne != '' ">
<!--<if test="customTimeTypeTwo != null and customTimeTypeTwo != '' ">--> AND c.last_call_time &gt;=#{customTimeStart}
<!--AND exists (--> AND c.last_call_time &lt;=#{customTimeEnd}
<!--select 1 from (--> </if>
<!--select-->
<!--c.manager_id,-->
<!--c.phone-->
<!--from-->
<!--customer c inner join (-->
<!--select customer_id,count(1)-->
<!--from customer_status_log-->
<!--where is_delete = 0 and to_status_id = 1-->
<!--<if test="customTimeStart != null and customTimeStart != '' ">-->
<!--AND create_time &gt;=#{customTimeStart}-->
<!--</if>-->
<!--<if test="customTimeEnd != null and customTimeEnd != '' ">-->
<!--AND create_time &lt;=#{customTimeEnd}-->
<!--</if>-->
<!--group by customer_id-->
<!--) t on c.id = t.customer_id and c.is_delete='0'-->
<!--)t where c.manager_id = t.manager_id and c.phone = t.phone-->
<!--)-->
<!--</if>-->
<!--<if test="customTimeTypeThree != null and customTimeTypeThree != '' ">-->
<!--AND exists (-->
<!--select 1 from (-->
<!--select-->
<!--c.manager_id,-->
<!--c.phone-->
<!--from-->
<!--customer c inner join (-->
<!--select customer_id,count(1)-->
<!--from customer_status_log-->
<!--where is_delete = 0 and to_status_id = 2-->
<!--<if test="customTimeStart != null and customTimeStart != '' ">-->
<!--AND occur_time &gt;=#{customTimeStart}-->
<!--</if>-->
<!--<if test="customTimeEnd != null and customTimeEnd != '' ">-->
<!--AND occur_time &lt;=#{customTimeEnd}-->
<!--</if>-->
<!--group by customer_id-->
<!--) t on c.id = t.customer_id and c.is_delete='0'-->
<!--)t where c.manager_id = t.manager_id and c.phone = t.phone-->
<!--)-->
<!--</if>-->
<!--<if test="customTimeTypeFour != null and customTimeTypeFour != '' ">-->
<!--AND exists (-->
<!--select 1 from (-->
<!--select-->
<!--c.manager_id,-->
<!--c.phone-->
<!--from-->
<!--customer c inner join (-->
<!--select customer_id,count(1)-->
<!--from customer_status_log-->
<!--where is_delete = 0 and to_status_id = 3-->
<!--<if test="customTimeStart != null and customTimeStart != '' ">-->
<!--AND occur_time &gt;=#{customTimeStart}-->
<!--</if>-->
<!--<if test="customTimeEnd != null and customTimeEnd != '' ">-->
<!--AND occur_time &lt;=#{customTimeEnd}-->
<!--</if>-->
<!--group by customer_id-->
<!--) t on c.id = t.customer_id and c.is_delete='0'-->
<!--)t where c.manager_id = t.manager_id and c.phone = t.phone-->
<!--)-->
<!--</if>-->
<!--<if test="customTimeTypeFive != null and customTimeTypeFive != '' ">-->
<!--AND exists (-->
<!--select 1 from (-->
<!--select-->
<!--c.manager_id,-->
<!--c.phone-->
<!--from-->
<!--customer c inner join (-->
<!--select customer_id,count(1)-->
<!--from customer_status_log-->
<!--where is_delete = 0 and to_status_id = 4-->
<!--<if test="customTimeStart != null and customTimeStart != '' ">-->
<!--AND occur_time &gt;=#{customTimeStart}-->
<!--</if>-->
<!--<if test="customTimeEnd != null and customTimeEnd != '' ">-->
<!--AND occur_time &lt;=#{customTimeEnd}-->
<!--</if>-->
<!--group by customer_id-->
<!--) t on c.id = t.customer_id and c.is_delete='0'-->
<!--)t where c.manager_id = t.manager_id and c.phone = t.phone-->
<!--)-->
<!--</if>-->
<!--<if test="customTimeTypeSix != null and customTimeTypeSix != '' ">-->
<!--AND exists (-->
<!--select 1 from (-->
<!--select-->
<!--c.manager_id,-->
<!--c.phone-->
<!--from-->
<!--customer c inner join (-->
<!--select customer_id,count(1)-->
<!--from customer_status_log-->
<!--where is_delete = 0 and to_status_id = 5-->
<!--<if test="customTimeStart != null and customTimeStart != '' ">-->
<!--AND occur_time &gt;=#{customTimeStart}-->
<!--</if>-->
<!--<if test="customTimeEnd != null and customTimeEnd != '' ">-->
<!--AND occur_time &lt;=#{customTimeEnd}-->
<!--</if>-->
<!--group by customer_id-->
<!--) t on c.id = t.customer_id and c.is_delete='0'-->
<!--)t where c.manager_id = t.manager_id and c.phone = t.phone-->
<!--)-->
<!--</if>-->
<if test="isStar != null and isStar != '' "> <if test="isStar != null and isStar != '' ">
AND c.starCustomer =1 AND c.starCustomer =1
</if> </if>
<if test="isNotStar != null and isNotStar != '' "> <if test="isNotStar != null and isNotStar != '' ">
AND c.starCustomer =0 AND c.starCustomer =0
</if> </if>
<if test="starCustomer != null and starCustomer != '' "> <if test="starCustomer != null and starCustomer != '' ">
AND c.starCustomer =#{starCustomer} AND c.starCustomer =#{starCustomer}
</if> </if>
...@@ -790,7 +672,9 @@ ...@@ -790,7 +672,9 @@
<if test="isActive != null and isActive != '' "> <if test="isActive != null and isActive != '' ">
AND c.is_active = 1 AND c.is_active = 1
</if> </if>
<if test="isRecycled != null and isRecycled != '' ">
AND c.isRecycled =#{isRecycled}
</if>
<if test='tabType =="8"'> <if test='tabType =="8"'>
AND ( c.is_active = 1 ) AND ( c.is_active = 1 )
</if> </if>
...@@ -806,17 +690,10 @@ ...@@ -806,17 +690,10 @@
<if test='tabType =="2"'> <if test='tabType =="2"'>
and c.trace_status = 1 and c.trace_status = 1
</if> </if>
<if test='tabType =="0"'> <if test='tabType =="0"'>
AND ( SELECT count( * ) FROM customer_callback_log ccl WHERE ccl.customer_id = c.id ) = 0 AND ( SELECT count( * ) FROM customer_callback_log ccl WHERE ccl.customer_id = c.id ) = 0
AND ( SELECT count( * ) FROM customer_status_log csl WHERE csl.customer_id = c.id ) = 0 AND ( SELECT count( * ) FROM customer_status_log csl WHERE csl.customer_id = c.id ) = 0
</if> </if>
<if test="isRecycled != null and isRecycled != '' ">
AND c.isRecycled =#{isRecycled}
</if>
) t
</select> </select>
<insert id="saveCustomerMerge" parameterType="com.house365.beans.entity.CustomerEntity"> <insert id="saveCustomerMerge" parameterType="com.house365.beans.entity.CustomerEntity">
......
...@@ -385,4 +385,9 @@ ...@@ -385,4 +385,9 @@
version="${dubbo.app.version}" version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/> timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
<!--获取Im accId信息接口-->
<dubbo:service ref="getImUserInfo" interface="com.house365.ws.interfaces.rest.IGetImUserInfo"
version="${dubbo.app.version}"
timeout="${dubbo.app.timeout}" retries="${dubbo.app.retries}"/>
</beans> </beans>
...@@ -451,9 +451,8 @@ ...@@ -451,9 +451,8 @@
</select> </select>
<select id="getCustomerManagementList4LabelCount" resultType="Integer" parameterType="map"> <select id="getCustomerManagementList4LabelCount" resultType="Integer" parameterType="map">
select count(distinct t.id ) from (
SELECT SELECT
c.id count(c.id)
FROM customer_merge c FROM customer_merge c
<if test='tabType =="9" || (callbackLog != null and callbackLog != "") || (customerSourceType2 != null and customerSourceType2 != "" )'> <if test='tabType =="9" || (callbackLog != null and callbackLog != "") || (customerSourceType2 != null and customerSourceType2 != "" )'>
inner join ( inner join (
...@@ -498,6 +497,7 @@ ...@@ -498,6 +497,7 @@
AND (c1.phone LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone1 LIKE CONCAT('%', #{phone},'%') OR AND (c1.phone LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone1 LIKE CONCAT('%', #{phone},'%') OR
c1.bak_phone2 LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone3 LIKE CONCAT('%', #{phone},'%') ) c1.bak_phone2 LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone3 LIKE CONCAT('%', #{phone},'%') )
</if> </if>
group by c1.manager_id,c1.phone
)t2 on c.manager_id = t2.manager_id AND c.phone = t2.phone )t2 on c.manager_id = t2.manager_id AND c.phone = t2.phone
</if> </if>
<if test="labelIdList != null and labelIdList.size() > 0 "> <if test="labelIdList != null and labelIdList.size() > 0 ">
...@@ -626,8 +626,7 @@ ...@@ -626,8 +626,7 @@
<if test="userId != null and userId != '' "> <if test="userId != null and userId != '' ">
AND ( AND (
c.manager_id = #{userId} c.manager_id = #{userId}
OR c.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM OR c.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) )
user WHERE id = #{userId} ) )
) )
</if> </if>
<if test="bindTimeStart != null and bindTimeStart != '' "> <if test="bindTimeStart != null and bindTimeStart != '' ">
...@@ -636,8 +635,6 @@ ...@@ -636,8 +635,6 @@
<if test="bindTimeEnd != null and bindTimeEnd != '' "> <if test="bindTimeEnd != null and bindTimeEnd != '' ">
AND c.bind_time &lt;=#{bindTimeEnd} AND c.bind_time &lt;=#{bindTimeEnd}
</if> </if>
<if test="isNotBackFour != null and isNotBackFour != '' "> <if test="isNotBackFour != null and isNotBackFour != '' ">
and datediff( CURRENT_DATE, c.last_call_time ) &gt;= 3 and datediff( CURRENT_DATE, c.last_call_time ) &gt;= 3
AND datediff( CURRENT_DATE, c.last_call_time ) &lt;= 7 AND datediff( CURRENT_DATE, c.last_call_time ) &lt;= 7
...@@ -655,131 +652,16 @@ ...@@ -655,131 +652,16 @@
<if test="isNotBackEight != null and isNotBackEight != '' "> <if test="isNotBackEight != null and isNotBackEight != '' ">
and datediff( CURRENT_DATE, c.last_call_time ) &gt;= 50 and datediff( CURRENT_DATE, c.last_call_time ) &gt;= 50
</if> </if>
<if test="customTimeTypeOne != null and customTimeTypeOne != '' ">
<!--<if test="customTimeTypeTwo != null and customTimeTypeTwo != '' ">--> AND c.last_call_time &gt;=#{customTimeStart}
<!--AND exists (--> AND c.last_call_time &lt;=#{customTimeEnd}
<!--select 1 from (--> </if>
<!--select-->
<!--c.manager_id,-->
<!--c.phone-->
<!--from-->
<!--customer c inner join (-->
<!--select customer_id,count(1)-->
<!--from customer_status_log-->
<!--where is_delete = 0 and to_status_id = 1-->
<!--<if test="customTimeStart != null and customTimeStart != '' ">-->
<!--AND create_time &gt;=#{customTimeStart}-->
<!--</if>-->
<!--<if test="customTimeEnd != null and customTimeEnd != '' ">-->
<!--AND create_time &lt;=#{customTimeEnd}-->
<!--</if>-->
<!--group by customer_id-->
<!--) t on c.id = t.customer_id and c.is_delete='0'-->
<!--)t where c.manager_id = t.manager_id and c.phone = t.phone-->
<!--)-->
<!--</if>-->
<!--<if test="customTimeTypeThree != null and customTimeTypeThree != '' ">-->
<!--AND exists (-->
<!--select 1 from (-->
<!--select-->
<!--c.manager_id,-->
<!--c.phone-->
<!--from-->
<!--customer c inner join (-->
<!--select customer_id,count(1)-->
<!--from customer_status_log-->
<!--where is_delete = 0 and to_status_id = 2-->
<!--<if test="customTimeStart != null and customTimeStart != '' ">-->
<!--AND occur_time &gt;=#{customTimeStart}-->
<!--</if>-->
<!--<if test="customTimeEnd != null and customTimeEnd != '' ">-->
<!--AND occur_time &lt;=#{customTimeEnd}-->
<!--</if>-->
<!--group by customer_id-->
<!--) t on c.id = t.customer_id and c.is_delete='0'-->
<!--)t where c.manager_id = t.manager_id and c.phone = t.phone-->
<!--)-->
<!--</if>-->
<!--<if test="customTimeTypeFour != null and customTimeTypeFour != '' ">-->
<!--AND exists (-->
<!--select 1 from (-->
<!--select-->
<!--c.manager_id,-->
<!--c.phone-->
<!--from-->
<!--customer c inner join (-->
<!--select customer_id,count(1)-->
<!--from customer_status_log-->
<!--where is_delete = 0 and to_status_id = 3-->
<!--<if test="customTimeStart != null and customTimeStart != '' ">-->
<!--AND occur_time &gt;=#{customTimeStart}-->
<!--</if>-->
<!--<if test="customTimeEnd != null and customTimeEnd != '' ">-->
<!--AND occur_time &lt;=#{customTimeEnd}-->
<!--</if>-->
<!--group by customer_id-->
<!--) t on c.id = t.customer_id and c.is_delete='0'-->
<!--)t where c.manager_id = t.manager_id and c.phone = t.phone-->
<!--)-->
<!--</if>-->
<!--<if test="customTimeTypeFive != null and customTimeTypeFive != '' ">-->
<!--AND exists (-->
<!--select 1 from (-->
<!--select-->
<!--c.manager_id,-->
<!--c.phone-->
<!--from-->
<!--customer c inner join (-->
<!--select customer_id,count(1)-->
<!--from customer_status_log-->
<!--where is_delete = 0 and to_status_id = 4-->
<!--<if test="customTimeStart != null and customTimeStart != '' ">-->
<!--AND occur_time &gt;=#{customTimeStart}-->
<!--</if>-->
<!--<if test="customTimeEnd != null and customTimeEnd != '' ">-->
<!--AND occur_time &lt;=#{customTimeEnd}-->
<!--</if>-->
<!--group by customer_id-->
<!--) t on c.id = t.customer_id and c.is_delete='0'-->
<!--)t where c.manager_id = t.manager_id and c.phone = t.phone-->
<!--)-->
<!--</if>-->
<!--<if test="customTimeTypeSix != null and customTimeTypeSix != '' ">-->
<!--AND exists (-->
<!--select 1 from (-->
<!--select-->
<!--c.manager_id,-->
<!--c.phone-->
<!--from-->
<!--customer c inner join (-->
<!--select customer_id,count(1)-->
<!--from customer_status_log-->
<!--where is_delete = 0 and to_status_id = 5-->
<!--<if test="customTimeStart != null and customTimeStart != '' ">-->
<!--AND occur_time &gt;=#{customTimeStart}-->
<!--</if>-->
<!--<if test="customTimeEnd != null and customTimeEnd != '' ">-->
<!--AND occur_time &lt;=#{customTimeEnd}-->
<!--</if>-->
<!--group by customer_id-->
<!--) t on c.id = t.customer_id and c.is_delete='0'-->
<!--)t where c.manager_id = t.manager_id and c.phone = t.phone-->
<!--)-->
<!--</if>-->
<if test="isStar != null and isStar != '' "> <if test="isStar != null and isStar != '' ">
AND c.starCustomer =1 AND c.starCustomer =1
</if> </if>
<if test="isNotStar != null and isNotStar != '' "> <if test="isNotStar != null and isNotStar != '' ">
AND c.starCustomer =0 AND c.starCustomer =0
</if> </if>
<if test="starCustomer != null and starCustomer != '' "> <if test="starCustomer != null and starCustomer != '' ">
AND c.starCustomer =#{starCustomer} AND c.starCustomer =#{starCustomer}
</if> </if>
...@@ -790,7 +672,9 @@ ...@@ -790,7 +672,9 @@
<if test="isActive != null and isActive != '' "> <if test="isActive != null and isActive != '' ">
AND c.is_active = 1 AND c.is_active = 1
</if> </if>
<if test="isRecycled != null and isRecycled != '' ">
AND c.isRecycled =#{isRecycled}
</if>
<if test='tabType =="8"'> <if test='tabType =="8"'>
AND ( c.is_active = 1 ) AND ( c.is_active = 1 )
</if> </if>
...@@ -806,17 +690,10 @@ ...@@ -806,17 +690,10 @@
<if test='tabType =="2"'> <if test='tabType =="2"'>
and c.trace_status = 1 and c.trace_status = 1
</if> </if>
<if test='tabType =="0"'> <if test='tabType =="0"'>
AND ( SELECT count( * ) FROM customer_callback_log ccl WHERE ccl.customer_id = c.id ) = 0 AND ( SELECT count( * ) FROM customer_callback_log ccl WHERE ccl.customer_id = c.id ) = 0
AND ( SELECT count( * ) FROM customer_status_log csl WHERE csl.customer_id = c.id ) = 0 AND ( SELECT count( * ) FROM customer_status_log csl WHERE csl.customer_id = c.id ) = 0
</if> </if>
<if test="isRecycled != null and isRecycled != '' ">
AND c.isRecycled =#{isRecycled}
</if>
) t
</select> </select>
<insert id="saveCustomerMerge" parameterType="com.house365.beans.entity.CustomerEntity"> <insert id="saveCustomerMerge" parameterType="com.house365.beans.entity.CustomerEntity">
......
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