Commit 9df15cf1 authored by 徐州's avatar 徐州

新增客戶查詢需求

parent fc143b23
......@@ -34,8 +34,10 @@ import com.house365.ws.beans.request.*;
import com.house365.ws.beans.response.*;
import com.house365.ws.beans.util.HResult;
import com.house365.ws.interfaces.server.*;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.CollectionUtils;
import org.apache.http.util.TextUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -3167,6 +3169,100 @@ public class CustomerController extends BaseController {
return getAutoUrl("transferCreator");
}
/**
* 获取批量转移客户人员列表
* @param model
* @param request
* @return
*/
@RequestMapping(value = "batchQuery", method = RequestMethod.GET)
public String batchQuery(Model model, HttpServletRequest request) {
UserEntity userEntity = (UserEntity) request.getSession().getAttribute(SessionConstants.THREAD_USER_KEY);
String mobilesStr = request.getParameter("mobiles");
if(TextUtils.isEmpty(mobilesStr)) {
return getAutoUrl();
}
String[] mobiles = mobilesStr.split("\r\n");
System.out.println(mobilesStr + "----------------------------" + mobiles.length);
List<String> phoneList = Arrays.stream(mobiles).filter(i -> !TextUtils.isEmpty(i)).collect(Collectors.toList());
/**
* 公海
*/
// List<String> ghPhones = customer.getExistByPhone(phoneList,0);
List<String> ghPhones = new ArrayList<>();
/**
* 待派
*/
List<String> dpPhones = new ArrayList<>();
//待派1:客户营销
// List<String> dpKhyx = marketCustomer.getExistPhone(phoneList);
// dpPhones.addAll(dpKhyx);
//待派2:云迹
// List<String> dpYj = cloudCustomerInterface.getExistByPhone(phoneList,0);
// dpPhones.addAll(dpYj);
// 待派3:公海CRM导入
List<String> dpGh = customer.getExistByPhone(phoneList,1);
dpPhones.addAll(dpGh);
/**
* 私客
*/
List<String> skPhones = new ArrayList<>();
// skPhones.addAll(customer.getExistByPhone(phoneList,3));
// 待回访
skPhones.addAll(customer.getExistByPhone(phoneList,2));
if(dpPhones != null) {
StringBuilder dpSb = new StringBuilder();
dpPhones.stream().forEach(i-> {
dpSb.append(i).append("\r\n");
});
phoneList.removeAll(dpPhones);
model.addAttribute("dpPhones",dpSb.toString());
}
if(skPhones != null) {
StringBuilder skSb = new StringBuilder();
skPhones.stream().forEach(i-> {
skSb.append(i).append("\r\n");
});
phoneList.removeAll(skPhones);
model.addAttribute("skPhones",skSb.toString());
}
if(ghPhones != null) {
StringBuilder ghSb = new StringBuilder();
ghPhones.stream().forEach(i-> {
ghSb.append(i).append("\r\n");
});
phoneList.removeAll(ghPhones);
model.addAttribute("ghPhones",ghSb.toString());
}
if(phoneList != null) {
StringBuilder qtSb = new StringBuilder();
phoneList.stream().forEach(i-> {
qtSb.append(i).append("\r\n");
});
model.addAttribute("qtPhones",qtSb.toString());
}
model.addAttribute("mobiles", mobilesStr);
model.addAttribute("dpSize",dpPhones == null ? 0 : dpPhones.size());
model.addAttribute("skSize",skPhones == null ? 0 : skPhones.size());
model.addAttribute("ghSize",ghPhones == null ? 0 : ghPhones.size());
model.addAttribute("qtSize",phoneList.size());
return getAutoUrl();
}
/**
* 批量转移平台客户创建人
* @param request
......
......@@ -85,6 +85,9 @@
<shiro:hasPermission name="ZYBG">
<li><a href="${ctx}/propertyreport/list">我的置业报告</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="ZYBG">
<li><a href="${ctx}/customer/batchQuery">客户查询</a></li>
</shiro:hasPermission>
</ul>
</li>
</shiro:hasPermission>
......
<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
<title>客户查询</title>
</head>
<body>
<div class="container" style="width: 1200px;">
<form id="input_form" class="form-horizontal valid"
action="${ctx}/customer/batchQuery"
method="get">
<house365:flushMessage/>
<div class="row${fluid}">
<div>
<div class="form-horizontal house365Page">
<div class="house365Border">
<!-- 片段头 begin -->
<div class="sectionTitle">
<h5>客户查询</h5>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">手机号:</label>
<div class="controls">
<textarea rows="10" cols="200" id="mobiles" style="width: 200%" placeholder="请输入手机号码,一行一个"
name="mobiles" class="required">${mobiles}</textarea>
</div>
</div>
</div>
<button class="btn blue" type="submit"><i
class="icon-search"></i>&nbsp;查询
</div>
</div>
</div>
</div>
</form>
<br/>
<div class="row${fluid}">
<div>
<div class="form-horizontal house365Page">
<div class="house365Border">
<!-- 片段头 begin -->
<div class="sectionTitle">
<h5>查询结果</h5>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">公海(${ghSize}):</label>
<div class="controls">
<textarea rows="5" id="ghmobiles" style="width: 200%"
name="ghmobiles" class="required">${ghPhones}</textarea>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">私客池(${skSize}):</label>
<div class="controls">
<textarea rows="5" id="skmobiles" style="width: 200%"
name="skmobiles" class="required">${skPhones}</textarea>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">待派工(${dpSize}):</label>
<div class="controls">
<textarea rows="5" id="tpmobiles" style="width: 200%"
name="tpmobiles" class="required">${dpPhones}</textarea>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">其他(${qtSize}):<br/>未进入系统的用户</label>
<div class="controls">
<textarea rows="5" id="qtmobiles" style="width: 200%"
name="qtmobiles" class="required">${qtPhones}</textarea>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function batchQuery() {
/* var $form = $("#input_form");
$.ajax({
url: $form.attr("action")+"?222=111",
type: "GET",
data: $form.serialize(),
success: function (data) {
alert(111);
}
}); */
}
</script>
</div>
</body>
</html>
......@@ -23,4 +23,11 @@ public interface ICloudCustomerInterface {
HResult judgeCustomer(int id);
void updateById(int customerId, UserEntity userEntity);
/**
* 查询给定手机号是不是云迹数据
* @param phoneList
* @return
*/
List<String> getExistByPhone(List<String> phoneList,int status);
}
......@@ -273,4 +273,6 @@ public interface ICustomer extends IService {
void batchTransferCreator(String[] customerIds, String[] userIds, UserEntity userEntity, int type) throws Exception;
int queryCountById(Integer userId);
List<String> getExistByPhone(List<String> phoneList,int type);
}
......@@ -13,6 +13,7 @@
*/
package com.house365.ws.interfaces.server;
import com.house365.beans.entity.MarketCustomerEntity;
import com.house365.rest.context.IService;
import com.house365.rest.parameter.House365RestResponse;
import com.house365.ws.beans.request.MarketCustomerListRequest;
......@@ -21,6 +22,8 @@ import com.house365.ws.beans.response.MarketCustomerListResponse;
import com.house365.ws.beans.response.MarketCustomerResponse;
import com.house365.ws.beans.util.HResult;
import java.util.List;
/**
* 客户信息WS接口<br>
......@@ -89,4 +92,6 @@ public interface IMarketCustomer extends IService{
HResult judgeCustomer(int id);
List<String> getExistPhone(List<String> phoneList);
}
......@@ -23,4 +23,6 @@ public interface CloudCustomerMapper {
int queryCount(Map<String, Object> map);
void update(CloudCustomerEntity entity);
List<String> getExistByPhone(Map<String, Object> map);
}
......@@ -101,4 +101,6 @@ public interface CustomerMapper {
void updatePtCustomerCreaterMerge(Map<String, Object> map);
int queryCountById(Integer userId);
List<String> getExistByPhone(Map<String, Object> map);
}
......@@ -82,5 +82,7 @@ public interface CustomerMergeMapper {
List<CustomerEntity> getAllCustomer3(Map<String, Object> map);
List<CustomerEntity> getAllCustomer4(Map<String, Object> map);
List<String> getExistByPhone(Map<String, Object> map);
}
package com.house365.ws.dao.mapper;
import com.house365.beans.entity.MarketCustomerEntity;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
......@@ -12,4 +14,6 @@ import java.util.Map;
public interface MarketCustomerMapper {
void updateCustomerId(Map<String,Object> map);
List<String> getExistByPhone(Map<String,Object> map);
}
......@@ -370,4 +370,12 @@ public class CloudCustomerImpl implements ICloudCustomerInterface {
}
}
@Override
public List<String> getExistByPhone(List<String> phoneList, int status) {
Map<String, Object> map = new HashMap<>();
map.put("phoneList",phoneList);
map.put("status",status);
return mapper.getExistByPhone(map);
}
}
......@@ -3226,4 +3226,41 @@ public class CustomerImpl implements ICustomer {
@Override
public void commit() {
}
/**
* 判断手机号是都在表里
* @param phoneList
* @param type 0,【公海】
* 1,【待派】待派CRM
* 2,【私客】待回访
* 3,【私客】customer_merge表
* @return
*/
@Override
public List<String> getExistByPhone(List<String> phoneList, int type) {
Map<String, Object> map = new HashMap<>( 10 );
map.put("phoneList",phoneList);
map.put("is_delete",0);
if(type == 0) {
map.put("manager_id",0);//不能有manager_id
} else if (type == 1) {
// CRM导入
map.put( "createSource", "CRM导入" );
map.put( "isRecycled", 0 );
map.put( "notBuyIntention", "5" );
map.put("manager_id",0);
} else if(type == 2) {
map.put("hotlone",0);
map.put("isWaitCall",1);
map.put("manager_id",1);
}
if(type == 3) {
Map<String,Object> param = new HashMap<>();
param.put("phoneList",phoneList);
return customermergemapper.getExistByPhone(param);
}
return customerMapper.getExistByPhone(map);
}
}
......@@ -334,4 +334,9 @@ public class MarketCustomerImpl implements IMarketCustomer {
@Override
public void commit() {
}
@Override
public List<String> getExistPhone(List<String> phoneList) {
return marketCustomerService.getExistPhone(phoneList);
}
}
......@@ -26,6 +26,7 @@ import com.house365.ws.dao.interfaces.ICustomerDao;
import com.house365.ws.dao.interfaces.IMarketCustomerDao;
import com.house365.ws.dao.interfaces.IMarketingActivityDao;
import com.house365.ws.dao.mapper.CustomerMapper;
import com.house365.ws.dao.mapper.MarketCustomerMapper;
import com.house365.ws.dao.mapper.UserMapper;
import com.house365.ws.interfaces.impl.CustomerImpl;
import com.house365.ws.service.interfaces.IMarketCustomerService;
......@@ -70,6 +71,8 @@ public class MarketCustomerServiceImpl<T extends MarketCustomerEntity> extends D
private UserMapper userMapper;
@Autowired
private OperateLogUtils logUtils;
@Autowired
private MarketCustomerMapper marketCustomerMapper;
@Override
protected Dao<T> getDao() {
......@@ -166,4 +169,11 @@ public class MarketCustomerServiceImpl<T extends MarketCustomerEntity> extends D
}
}
@Override
public List<String> getExistPhone(List<String> phones){
Map<String,Object> map = new HashMap<>();
map.put("phoneList",phones);
List<String> list = marketCustomerMapper.getExistByPhone(map);
return list;
}
}
......@@ -205,4 +205,7 @@ public class MarketingActivityServiceImpl<T extends MarketingActivityEntity> ext
marketingActivityDao.addBughtCount(id);
}
}
......@@ -46,4 +46,6 @@ public interface IMarketCustomerService<T extends MarketCustomerEntity> extends
void removeCustomer(CustomerEntity custmerId, Integer userId) throws ServiceRunException;
List<String> getExistPhone(List<String> phones);
}
......@@ -384,4 +384,16 @@
</if>
</select>
<select id="getExistByPhone" parameterType="map" resultType="String">
SELECT DISTINCT phone FROM cloud_customer where is_delete = 0 and status = #{status}
<if test="phoneList != null and phoneList.size() > 0 ">
and phone IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -890,4 +890,40 @@
and customer_source_type=8
and creater=#{userId}
</select>
<select id="getExistByPhone" parameterType="map" resultType="String">
SELECT DISTINCT phone FROM customer where 1=1
<if test="status != null and status != '' ">
AND status = #{status}
</if>
<if test="manager_id != null and manager_id == 0">
AND manager_id IS NULL
</if>
<if test="manager_id != null and manager_id == 1">
AND manager_id IS NOT NULL
</if>
<if test="createSource != null and createSource != '' ">
AND create_source = #{createSource}
</if>
<if test="isRecycled != null and isRecycled >=0">
AND isRecycled = #{isRecycled}
</if>
<if test="notBuyIntention != null and notBuyIntention != ''">
AND buy_intention != #{notBuyIntention}
</if>
<if test="hotlone != null and hotlone != ''">
AND status in (11,0,99)
</if>
<if test="isWaitCall != null and isWaitCall != ''">
AND isWaitCall = #{isWaitCall}
</if>
<if test="phoneList != null and phoneList.size() > 0 ">
and phone IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -1232,4 +1232,35 @@
</if>
</select>
<select id="getExistByPhone" parameterType="map" resultType="String">
SELECT DISTINCT phone FROM customer_merge where is_delete = 0 and
STATUS IN ( 11, 0, 99 ) AND
( isWaitCall = 0 OR isWaitCall IS NULL )
<if test="phoneList != null and phoneList.size() > 0 ">
and (
phone IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
OR bak_phone1 IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
OR bak_phone2 IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
OR bak_phone3 IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
</select>
</mapper>
......@@ -67,4 +67,14 @@
WHERE id = #{id}
</update>
<select id="getExistByPhone" parameterType="map" resultType="String">
SELECT DISTINCT phone FROM market_customer where (a.manager_id is null or a.manager_id = '')
<if test="phoneList != null and phoneList.size() > 0 ">
and phone IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -384,4 +384,17 @@
</if>
</select>
<select id="getExistByPhone" parameterType="map" resultType="String">
SELECT DISTINCT phone FROM cloud_customer where is_delete = 0 and status = #{status}
<if test="phoneList != null and phoneList.size() > 0 ">
and phone IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -868,4 +868,39 @@
and customer_source_type=8
and creater=#{userId}
</select>
<select id="getExistByPhone" parameterType="map" resultType="String">
SELECT DISTINCT phone FROM customer where 1=1
<if test="status != null and status != '' ">
AND status = #{status}
</if>
<if test="manager_id != null and manager_id == 0">
AND manager_id IS NULL
</if>
<if test="manager_id != null and manager_id == 1">
AND manager_id IS NOT NULL
</if>
<if test="createSource != null and createSource != '' ">
AND create_source = #{createSource}
</if>
<if test="isRecycled != null and isRecycled >=0">
AND isRecycled = #{isRecycled}
</if>
<if test="notBuyIntention != null and notBuyIntention != ''">
AND buy_intention != #{notBuyIntention}
</if>
<if test="hotlone != null and hotlone != ''">
AND status in (11,0,99)
</if>
<if test="isWaitCall != null and isWaitCall != ''">
AND isWaitCall = #{isWaitCall}
</if>
<if test="phoneList != null and phoneList.size() > 0 ">
and phone IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -1235,4 +1235,34 @@
</if>
</select>
<select id="getExistByPhone" parameterType="map" resultType="String">
SELECT DISTINCT phone FROM customer_merge where is_delete = 0 and
STATUS IN ( 11, 0, 99 ) AND
( isWaitCall = 0 OR isWaitCall IS NULL )
<if test="phoneList != null and phoneList.size() > 0 ">
and (
phone IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
OR bak_phone1 IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
OR bak_phone2 IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
OR bak_phone3 IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
</select>
</mapper>
......@@ -66,5 +66,14 @@
customerId = #{customerId}
WHERE id = #{id}
</update>
<select id="getExistByPhone" parameterType="map" resultType="String">
SELECT DISTINCT phone FROM market_customer where (a.manager_id is null or a.manager_id = '')
<if test="phoneList != null and phoneList.size() > 0 ">
and phone IN
<foreach collection="phoneList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</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