Commit 49dcc6e0 authored by gaoyuan's avatar gaoyuan

4.9.3需求

parent e7df3614
......@@ -245,6 +245,11 @@ public class CustomerEntity extends DomainObject {
@Length(max = 45, message = "长度需要大于0且小于45")
private String creater;
/**
* 创建人Id
*/
private Integer createrId;
/**
* 购房意向-CRM
*/
......@@ -381,6 +386,9 @@ public class CustomerEntity extends DomainObject {
// 是否星标客户
private int starCustomer;
// 是否标星平台用户
private int starPtCustomer;
private int isActive;
private Date activeTime;
......@@ -469,6 +477,23 @@ public class CustomerEntity extends DomainObject {
return createTimeStr;
}
public int getStarPtCustomer() {
return starPtCustomer;
}
public void setStarPtCustomer(int starPtCustomer) {
this.starPtCustomer = starPtCustomer;
}
public Integer getCreaterId() {
return createrId;
}
public void setCreaterId(Integer createrId) {
this.createrId = createrId;
}
/**
* 设置创建日期字符串格式
*
......
......@@ -88,6 +88,8 @@ public class CustomerListVO extends DomainObject {
private String creater;
private Integer createrId;
private Integer hasReport;
private String createSource;
......@@ -196,6 +198,14 @@ public class CustomerListVO extends DomainObject {
this.platCustomerStatus = platCustomerStatus;
}
public Integer getCreaterId() {
return createrId;
}
public void setCreaterId(Integer createrId) {
this.createrId = createrId;
}
public CustomerListVO(
Integer id, String name, String phone, Integer sex, String actSource, Integer status, Date createTime,
String buyIntention, Date lastVisitTime, Date lastCallTime, Integer managerId, String managerName,
......
......@@ -3094,4 +3094,57 @@ public class CustomerController extends BaseController {
return getAutoUrl("seaCustomerInfo");
}
/**
* 获取批量转移客户人员列表
* @param model
* @param request
* @return
*/
@RequestMapping(value = "transferCreator", method = RequestMethod.GET)
public String transferCreator(Model model, HttpServletRequest request) {
UserEntity userEntity = (UserEntity) request.getSession().getAttribute(SessionConstants.THREAD_USER_KEY);
String customerCount = request.getParameter("customerCount") == null ? "0" : request.getParameter(
"customerCount");
String deptUrlPath = userEntity.getDeptUrlPath();
//重写查询用户列表提升性能
Map<String, Object> searchMap = new HashMap<>(10);
searchMap.put("order", 1);
List<UserEntity> userList = user.queryByConditions(searchMap);
//当前操作人所在用户分组的所有用户以及所在用户分组的所有子用户
List<UserEntity> transferUsers = new ArrayList<>();
for (UserEntity userTmp:userList) {
if(userTmp.getDeptUrlPath().startsWith(deptUrlPath))
transferUsers.add(userTmp);
}
model.addAttribute("users", deptUrlPath.split( "/" ).length == 2 ? userList : transferUsers);
model.addAttribute("customerCount", customerCount);
return getAutoUrl("transferCreator");
}
/**
* 批量转移平台客户创建人
* @param request
* @return
*/
@RequestMapping(value = "batchTransferCreator", method = RequestMethod.GET)
@ResponseBody
public House365RestResponse batchTransferCreator(HttpServletRequest request){
House365RestResponse restResponse = new House365RestResponse();
restResponse.setResult("1");
UserEntity userEntity = (UserEntity) request.getSession().getAttribute(SessionConstants.THREAD_USER_KEY);
String type = request.getParameter("type") == null ? "" : request.getParameter("type");
String userIds = request.getParameter("userIds");
String customerIds = request.getParameter("customerIds") == null ? "" : request.getParameter("customerIds");
String[] customerIdArray = customerIds.split(",");
String[] userIdArray = userIds.split(",");
try {
} catch (Exception e) {
restResponse.setResult("0");
restResponse.setMsg(e.getMessage());
logger.error(e.getMessage(), e);
}
return restResponse;
}
}
......@@ -5,12 +5,16 @@ import com.house365.beans.entity.*;
import com.house365.beans.system.Page;
import com.house365.beans.vo.CustomerListVO;
import com.house365.beans.vo.CustomerVo;
import com.house365.rest.exception.ServiceRunException;
import com.house365.rest.parameter.House365RestResponse;
import com.house365.web.system.controller.BaseController;
import com.house365.web.util.*;
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 com.house365.ws.system.ReturnAppResult;
import net.sf.json.JSONObject;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -136,7 +140,19 @@ public class PlatformManagementController extends BaseController {
searchParams.put("EQ_customTimeTypeSix", "1");
}
}
// 星标
String isStar = String.valueOf(searchParams.get("EQ_isPtStar"));
if ("2".equals(isStar)) {
// 有星标
searchParams.remove("EQ_isNotPtStar");
} else if ("3".equals(isStar)) {
// 无星标
searchParams.remove("EQ_isPtStar");
searchParams.put("EQ_isNotPtStar", "3");
} else {
searchParams.remove("EQ_isPtStar");
searchParams.remove("EQ_isNotPtStar");
}
StringBuilder sortColumn = new StringBuilder();
//时间排序
boolean daoxuFlag = false;
......@@ -319,6 +335,10 @@ public class PlatformManagementController extends BaseController {
UserUtil.showPlatCustomerStatus(customerEntity, cpMap);
}
//客户标新
String star = "off";
//获取star
star = customerEntity.getStarPtCustomer() ==1 ? "on" : "off";
CustomerListVO customerListVO = new CustomerListVO(customerEntity.getId(), customerEntity.getName(),
customerEntity.getPhone(), customerEntity.getSex(),
customerEntity.getActSource(),
......@@ -329,7 +349,7 @@ public class PlatformManagementController extends BaseController {
customerEntity.getLastCallTime(),
customerEntity.getManagerId(),
customerEntity.getManagerName(),
customerEntity.getTraceStatus(), null, userId4Star,
customerEntity.getTraceStatus(), star, userId4Star,
hasCustomerProjects, hasNewCustomerProjects,
customerEntity.getBelongToday(),
customerEntity.getBelongYestoday(),
......@@ -341,6 +361,7 @@ public class PlatformManagementController extends BaseController {
customerEntity.getSingupTime(), countdownTime, customerEntity.getIsPeer(), isPrivate,
customerEntity.getStarCustomer(), customerEntity.getMarkedLabelId(), null, "", customerEntity.getPlatCustomerStatus(), customerEntity.getCreater()
);
customerListVO.setCreaterId(customerEntity.getCreaterId());
customers.add(customerListVO);
}
}
......@@ -985,4 +1006,31 @@ public class PlatformManagementController extends BaseController {
return result;
}
/**
* 平台客户标星
* @param request
* @param flag
* @return
* @throws ServiceRunException
*/
@RequestMapping(value = "starToggle", method = RequestMethod.GET)
@ResponseBody
public Object starToggle(HttpServletRequest request, String flag,Integer customerId) throws ServiceRunException {
// 取得所需参数
House365RestResponse<CustomerEntity> response = new House365RestResponse<>();
try {
int star = "on".equalsIgnoreCase(flag) ? 1 : 0;
customer.updatePtCustomerStar(customerId,star);
response.setResult( ReturnAppResult.APP_SUCCESS.getResultCode());
response.setMsg(ReturnAppResult.APP_SUCCESS.getResultMessage());
} catch (Exception e) {
logger.error(e.getMessage());
response.setResult(ReturnAppResult.APP_FAIL.getResultCode());
response.setMsg((ReturnAppResult.APP_FAIL.getResultMessage() + ":" + e.getMessage()));
}
String result = JSONObject.fromObject(response).toString();
logger.debug("===starToggle==result===:{}", result);
return result;
}
}
......@@ -432,9 +432,9 @@
</option>
</select>
平台人:<input style="width: 8rem;border: 1px solid #d5d5d5;" type="text" id="search_LIKE_creater"
name="search_LIKE_creater" value="${param['search_LIKE_creater']}"
class="m-wrap small" placeholder="请输入添加人姓名">&nbsp;
<%-- 平台人:<input style="width: 8rem;border: 1px solid #d5d5d5;" type="text" id="search_LIKE_createrName"--%>
<%-- name="search_LIKE_createrName" value="${param['search_LIKE_createrName']}"--%>
<%-- class="m-wrap small" placeholder="请输入添加人姓名">&nbsp;--%>
<div style="float: right">
<button type="button" class="btn btn-default"
onclick="$('#filterForm').submit();">搜索
......@@ -635,7 +635,7 @@
<div class="mangerItem__border"></div>
</td>
<td class="mangerItem mangerCollect ${customer.star}"
onclick="toggleCollect(this,'${customer.id}', '${customer.starUserId}', '${customer.star}', '${customer.managerId}')">
onclick="toggleCollect(this,'${customer.id}','${customer.createrId}','${customer.star}')">
<div class="mangerItem__border"></div>
</td>
<td class="mangerItem mangerOperate" style="display: table;padding: 0;overflow:visible;">
......@@ -990,16 +990,15 @@
/**
* 客户标星
* @param _this
* @param _customerId
* @param userId
* @param userId 创建人id
* @param star
* @param managerId
* @returns {boolean}
*/
function toggleCollect(_this, _customerId, userId, star, managerId) {
function toggleCollect(_this, _customerId,userId, star) {
debugger;
setCookie("lastChoseCustomerId", _customerId);
var currentUserId = $("#currentUserId").val();
if (star == 'on' && managerId != currentUserId) {
if (star == 'on' && userId != currentUserId) {
alert("其他人的星标客户不能取消哦");
return false;
}
......@@ -1007,10 +1006,6 @@
alert("不能为其他客户添加星标哦");
return false;
}
if (star == 'off' && userId == '' && managerId != currentUserId) {
alert("不能为其他客户添加星标哦");
return false;
}
//收藏
var flag = "off";
if ($(_this).hasClass('on')) {
......@@ -1022,13 +1017,13 @@
$(_this).parents("tr").addClass("table-star");
}
/*$.ajax({
url: "${ctx}/customermanagement/starToggle",
data: {flag: flag, 'customerId': _customerId},
$.ajax({
url: "${ctx}/platformmanagement/starToggle",
data: {flag: flag,customerId:_customerId},
success: function (data) {
window.location.reload();
}
});*/
});
}
......@@ -1146,6 +1141,7 @@
$("#search_GTE_createTimeStart").val('');
$("#search_LTE_createTimeEnd").val('');
$("#search_LIKE_sourceName").val('');
$("#search_LIKE_createrName").val('');
// 下拉框自定义时间
$("#search_EQ_customTimeType").val('1');
$("#search_GTE_customTimeStart").val('');
......@@ -1167,8 +1163,8 @@
$("#search_EQ_buyIntention").val("all");
$("#search_EQ_buyIntention").trigger('chosen:updated');
// 重置是否星标下拉框
$("#search_EQ_isStar").val("1");
$("#search_EQ_isStar").trigger('chosen:updated');
$("#search_EQ_isPtStar").val("1");
$("#search_EQ_isPtStar").trigger('chosen:updated');
// 重置添加时间 近7天 开始时间结束时间
createTimeClick('0');
......
......@@ -242,6 +242,8 @@ public interface ICustomer extends IService {
void updateOldCustomerStar(int customerId, int starCustomer);
void updatePtCustomerStar(int customerId,int starPtCustomer);
int queryCount(Map<String, Object> map);
MapListResponse successList(MapListRequest listRequest, UserEntity userEntity);
......
......@@ -94,4 +94,5 @@ public interface CustomerMapper {
int updateIdList(List<Integer> idList);
void updatePtCustomerStar(Map<String, Object> map);
}
......@@ -2683,6 +2683,14 @@ public class CustomerImpl implements ICustomer {
customerMapper.updateOldCustomerStar(map);
}
@Override
public void updatePtCustomerStar(int customerId, int starPtCustomer) {
Map<String, Object> map = new HashMap<>(10);
map.put("id", customerId);
map.put("star", starPtCustomer);
customerMapper.updatePtCustomerStar(map);
}
@Override
public void updateOldCustomers(String phone, Integer managerId, Integer operId) {
Map<String, Object> map = new HashMap<>(10);
......
......@@ -55,6 +55,7 @@
<result property="isHandover" column="isHandover"/>
<result property="isRecycled" column="isRecycled"/>
<result property="isActive" column="is_active"/>
<result property="starPtCustomer" column="star_pt_customer"/>
</resultMap>
<!-- 用于select查询公用抽取的列 -->
......@@ -65,7 +66,7 @@
create_time, creater, buy_intention, last_visit_time, last_call_time, manager_id, manager_name,
update_time, updater, cityCode,cityName, biz_port,crmId,act_source_id, trace_status, remark, crm_sync,
hotline_call_time,hotline_call_spend,ocean_date,is_delete,last_manager,bind_time, customer_source_type,
customer_rel_id, isWaitCall, singupTime,marketActId, marketActName,is_peer, starCustomer, isHandover, isRecycled,is_active
customer_rel_id, isWaitCall, singupTime,marketActId, marketActName,is_peer, starCustomer, isHandover, isRecycled,is_active,star_pt_customer
]]>
</sql>
......@@ -1530,6 +1531,17 @@
starCustomer = 0
]]>
</isNotEmpty>
<isNotEmpty prepend="AND" property="searchFilters.isPtStar">
<![CDATA[
star_pt_customer = 1
]]>
</isNotEmpty>
<isNotEmpty prepend="AND" property="searchFilters.isNotPtStar">
<![CDATA[
star_pt_customer = 0
]]>
</isNotEmpty>
<isNotEmpty prepend="AND" property="searchFilters.starCustomer">
<![CDATA[
starCustomer $searchFilters.starCustomer.operation$ #searchFilters.starCustomer.value#
......@@ -1650,6 +1662,8 @@
( SELECT ct.NAME FROM customer ct WHERE ct.id = c.id ))) NAME,
c.phone,
(select u2.realName from user u2 where u2.id = c.creater) creater,
c.creater AS createrId,
c.star_pt_customer AS starPtCustomer,
(
IFNULL((SELECT min( ct.create_time ) FROM customer ct WHERE ct.phone = c.phone AND ct.manager_id = c.manager_id AND ct.cityCode = #searchFilters.cityCode.value# AND ct.is_delete = 0 AND ct.STATUS IN ( 11, 0, 99 )),
(SELECT ct.create_time FROM customer ct WHERE ct.id = c.id))
......@@ -1684,7 +1698,6 @@
) bindTime
FROM customer c
<include refid="customer.queryManagementPage"/>
group by c.manager_id, c.phone
<isNotEmpty prepend="ORDER BY" property="searchFilters.orderBy">
<![CDATA[
......
......@@ -720,6 +720,13 @@
WHERE id = #{id}
</update>
<update id="updatePtCustomerStar" parameterType="map">
UPDATE customer
SET
star_pt_customer = #{star}
WHERE id = #{id}
</update>
<select id="queryForAddHot" resultMap="infoMap" parameterType="map">
SELECT id,phone FROM (
SELECT
......
......@@ -55,6 +55,7 @@
<result property="isHandover" column="isHandover"/>
<result property="isRecycled" column="isRecycled"/>
<result property="isActive" column="is_active"/>
<result property="starPtCustomer" column="star_pt_customer"/>
</resultMap>
<!-- 用于select查询公用抽取的列 -->
......@@ -65,7 +66,7 @@
create_time, creater, buy_intention, last_visit_time, last_call_time, manager_id, manager_name,
update_time, updater, cityCode,cityName, biz_port,crmId,act_source_id, trace_status, remark, crm_sync,
hotline_call_time,hotline_call_spend,ocean_date,is_delete,last_manager,bind_time, customer_source_type,
customer_rel_id, isWaitCall, singupTime,marketActId, marketActName,is_peer, starCustomer, isHandover, isRecycled,is_active
customer_rel_id, isWaitCall, singupTime,marketActId, marketActName,is_peer, starCustomer, isHandover, isRecycled,is_active,star_pt_customer
]]>
</sql>
......@@ -1530,6 +1531,17 @@
starCustomer = 0
]]>
</isNotEmpty>
<isNotEmpty prepend="AND" property="searchFilters.isPtStar">
<![CDATA[
star_pt_customer = 1
]]>
</isNotEmpty>
<isNotEmpty prepend="AND" property="searchFilters.isNotPtStar">
<![CDATA[
star_pt_customer = 0
]]>
</isNotEmpty>
<isNotEmpty prepend="AND" property="searchFilters.starCustomer">
<![CDATA[
starCustomer $searchFilters.starCustomer.operation$ #searchFilters.starCustomer.value#
......@@ -1650,6 +1662,8 @@
( SELECT ct.NAME FROM customer ct WHERE ct.id = c.id ))) NAME,
c.phone,
(select u2.realName from user u2 where u2.id = c.creater) creater,
c.creater AS createrId,
c.star_pt_customer AS starPtCustomer,
(
IFNULL((SELECT min( ct.create_time ) FROM customer ct WHERE ct.phone = c.phone AND ct.manager_id = c.manager_id AND ct.cityCode = #searchFilters.cityCode.value# AND ct.is_delete = 0 AND ct.STATUS IN ( 11, 0, 99 )),
(SELECT ct.create_time FROM customer ct WHERE ct.id = c.id))
......@@ -1684,7 +1698,6 @@
) bindTime
FROM customer c
<include refid="customer.queryManagementPage"/>
group by c.manager_id, c.phone
<isNotEmpty prepend="ORDER BY" property="searchFilters.orderBy">
<![CDATA[
......
......@@ -64,7 +64,7 @@
<select id="queryById" resultMap="infoMap" parameterType="int">
SELECT
*
*
FROM customer
WHERE
id = #{id}
......@@ -86,26 +86,26 @@
<select id="queryCount" resultType="java.util.HashMap" parameterType="map">
SELECT
cityCode,
phone,
manager_id as managerId,
manager_name as managerName,
COUNT(*) as count
cityCode,
phone,
manager_id as managerId,
manager_name as managerName,
COUNT(*) as count
FROM
customer
customer
WHERE
manager_id IS NOT NULL
AND is_delete = 0
manager_id IS NOT NULL
AND is_delete = 0
GROUP BY manager_id
</select>
<select id="queryByManagerId" resultType="java.util.HashMap" parameterType="map">
SELECT
phone,
manager_id,
manager_name
phone,
manager_id,
manager_name
FROM
customer
customer
WHERE
manager_id IS NOT NULL
AND is_delete = 0
......@@ -152,7 +152,7 @@
<select id="queryCustomerLogCount" resultType="Integer" parameterType="map">
SELECT
COUNT(DISTINCT(c.phone))
COUNT(DISTINCT(c.phone))
FROM customer_callback_log cl
LEFT JOIN customer c ON c.id = cl.customer_id
WHERE c.manager_id IS NOT NULL
......@@ -218,7 +218,7 @@
<select id="queryCustomerByStatusCount" resultType="Integer" parameterType="map">
SELECT
COUNT(DISTINCT(c.phone))
COUNT(DISTINCT(c.phone))
FROM customer_status_log cl
INNER JOIN customer c ON c.id = cl.customer_id
WHERE customerManagerId IS NOT NULL
......@@ -587,20 +587,20 @@
<select id="backToSeaCustomer" resultMap="infoMap" parameterType="Map">
select t.* from (
SELECT
c1.id,c1.manager_id,c1.manager_name,c1.phone,max(c2.create_time) create_time
FROM
customer c1 left join customer_callback_log c2 on c2.customer_id = c1.id
left join (select customer_id from customer_project cp) cp2 on c1.id=cp2.customer_id
where 1=1
and c1.cityCode=#{city}
AND c1.is_delete = 0
AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
AND c1.manager_id IS NOT NULL
AND c1.STATUS IN ( 11, 0, 99 )
group by c1.manager_id,c1.phone
order by create_time desc
SELECT
c1.id,c1.manager_id,c1.manager_name,c1.phone,max(c2.create_time) create_time
FROM
customer c1 left join customer_callback_log c2 on c2.customer_id = c1.id
left join (select customer_id from customer_project cp) cp2 on c1.id=cp2.customer_id
where 1=1
and c1.cityCode=#{city}
AND c1.is_delete = 0
AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
AND c1.manager_id IS NOT NULL
AND c1.STATUS IN ( 11, 0, 99 )
group by c1.manager_id,c1.phone
order by create_time desc
) t
where DATEDIFF(NOW(), t.create_time) >=#{days}
limit 500
......@@ -690,25 +690,25 @@
<select id="queryByOverTime" parameterType="map" resultMap="infoMap">
SELECT
id, name, phone, bak_phone1, bak_phone2, bak_phone3, sex, customer_type, act_source,
first_source, latest_source, crm_latest_call, crm_latest_call_result, status, create_source,
create_time, creater, buy_intention, last_visit_time, last_call_time, manager_id, manager_name,
update_time, updater, cityCode,cityName, biz_port,crmId,act_source_id, trace_status, remark, crm_sync,
hotline_call_time,hotline_call_spend,ocean_date,is_delete,last_manager,bind_time, customer_source_type,
customer_rel_id, isWaitCall, singupTime,marketActId, marketActName,is_peer, starCustomer, isHandover, isRecycled,is_active
id, name, phone, bak_phone1, bak_phone2, bak_phone3, sex, customer_type, act_source,
first_source, latest_source, crm_latest_call, crm_latest_call_result, status, create_source,
create_time, creater, buy_intention, last_visit_time, last_call_time, manager_id, manager_name,
update_time, updater, cityCode,cityName, biz_port,crmId,act_source_id, trace_status, remark, crm_sync,
hotline_call_time,hotline_call_spend,ocean_date,is_delete,last_manager,bind_time, customer_source_type,
customer_rel_id, isWaitCall, singupTime,marketActId, marketActName,is_peer, starCustomer, isHandover, isRecycled,is_active
FROM
customer
WHERE id IN
(SELECT
customerId
FROM
market_customer a
WHERE a.active_id IN
(SELECT
id
FROM
marketing_activity
WHERE finish_time BETWEEN #{date} AND NOW())
WHERE id IN
(SELECT
customerId
FROM
market_customer a
WHERE a.active_id IN
(SELECT
id
FROM
marketing_activity
WHERE finish_time BETWEEN #{date} AND NOW())
)
AND manager_id IS NOT NULL AND isWaitCall = 1
</select>
......@@ -720,6 +720,13 @@
WHERE id = #{id}
</update>
<update id="updatePtCustomerStar" parameterType="map">
UPDATE customer
SET
star_pt_customer = #{star}
WHERE id = #{id}
</update>
<select id="queryForAddHot" resultMap="infoMap" parameterType="map">
SELECT id,phone FROM (
SELECT
......@@ -772,9 +779,9 @@
<select id="querySeaList" parameterType="map" resultType="java.util.HashMap">
SELECT
id, name, phone, act_source AS actSource,buy_intention AS buyIntention,manager_id AS managerId,
manager_name AS managerName,create_source AS createSource,last_manager AS lastManager,ocean_date AS oceanDate,
create_time AS createTime
id, name, phone, act_source AS actSource,buy_intention AS buyIntention,manager_id AS managerId,
manager_name AS managerName,create_source AS createSource,last_manager AS lastManager,ocean_date AS oceanDate,
create_time AS createTime
FROM customer
where cityCode = #{city} AND is_delete = 0 AND manager_id IS NULL
<if test="phone != null and phone !='' ">
......@@ -815,7 +822,7 @@
<select id="querySeaCount" resultType="Integer" parameterType="map">
SELECT
count(*)
count(*)
FROM customer
where cityCode = #{city} AND is_delete = 0 AND manager_id IS NULL
<if test="phone != null and phone !='' ">
......
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