Commit 025355b4 by 王祖波

销售线索查询

parent 739897bb
......@@ -20,6 +20,33 @@ public class InteractRecordQDTO extends BasePageInfo {
*/
private String memberId;
/**
* 企业id
*/
private String enterpriseId;
/**
* 线索来源
* @see com.gic.haoban.manage.api.enums.content.InteractRecordChannelSourceType
*/
private Integer channelSource;
/**
* 业务类型 1 素材 2 商品
*/
private Integer bizTypeAggs;
/**
* 事件类型
* @see com.gic.haoban.manage.api.enums.content.InteractRecordEventType
*/
private Integer eventTypeAggs;
/**
* 是否过滤空数据
*/
private Integer filterNull;
public String getClerkId() {
return clerkId;
......@@ -36,4 +63,44 @@ public class InteractRecordQDTO extends BasePageInfo {
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getChannelSource() {
return channelSource;
}
public void setChannelSource(Integer channelSource) {
this.channelSource = channelSource;
}
public Integer getBizTypeAggs() {
return bizTypeAggs;
}
public void setBizTypeAggs(Integer bizTypeAggs) {
this.bizTypeAggs = bizTypeAggs;
}
public Integer getEventTypeAggs() {
return eventTypeAggs;
}
public void setEventTypeAggs(Integer eventTypeAggs) {
this.eventTypeAggs = eventTypeAggs;
}
public Integer getFilterNull() {
return filterNull;
}
public void setFilterNull(Integer filterNull) {
this.filterNull = filterNull;
}
}
package com.gic.haoban.manage.api.enums.content;
import java.util.Objects;
public enum InteractRecordChannelSourceType {
OTHER(0, "其他"),
FRIEND_CIRCLE(1, "朋友圈"),
CUSTOMER_GROUP(2, "客户群"),
CHAT_WINDOW(3, "对话框");
private final Integer code;
private final String description;
InteractRecordChannelSourceType(Integer code, String description) {
this.code = code;
this.description = description;
}
public Integer getCode() {
return code;
}
public String getDescription() {
return description;
}
public static InteractRecordChannelSourceType fromCode(Integer code) {
for (InteractRecordChannelSourceType source : values()) {
if (Objects.equals(source.code,code)) {
return source;
}
}
return OTHER;
}
}
package com.gic.haoban.manage.api.enums.content;
public enum InteractRecordEventType {
MATERIAL(1, "访问素材详情页"),
PRODUCT(2, "访问分享商品"),
ORDER(3, "下单购买"),
ADD_SHOPPING_CART(4, "加购");
InteractRecordEventType(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public static InteractRecordEventType getInstance(Integer code) {
if (code == null) {
return null;
}
for (InteractRecordEventType value : values()) {
if (value.code.equals(code)) {
return value;
}
}
return null;
}
private Integer code;
private String desc;
public Integer getCode() {
return code;
}
public String getDesc() {
return desc;
}
}
......@@ -61,6 +61,12 @@ public class InteractRecordInfoDTO implements Serializable {
private Integer eventType;
/**
* 聚合的事件类型
* @see InteractRecordEventType
*/
private Integer eventTypeAggs;
/**
* 业务id
*/
private String bizId;
......@@ -73,6 +79,11 @@ public class InteractRecordInfoDTO implements Serializable {
private Integer bizType;
/**
* 聚合的业务类型
*/
private Integer bizTypeAggs;
/**
* 浏览的商品数量
*/
private Integer visitGoodsNum;
......@@ -198,4 +209,20 @@ public class InteractRecordInfoDTO implements Serializable {
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public Integer getEventTypeAggs() {
return eventTypeAggs;
}
public void setEventTypeAggs(Integer eventTypeAggs) {
this.eventTypeAggs = eventTypeAggs;
}
public Integer getBizTypeAggs() {
return bizTypeAggs;
}
public void setBizTypeAggs(Integer bizTypeAggs) {
this.bizTypeAggs = bizTypeAggs;
}
}
......@@ -4,6 +4,7 @@ import com.gic.api.base.commons.BasePageInfo;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @Author MUSI
......@@ -46,4 +47,26 @@ public class InteractRecordQO extends BasePageInfo {
*/
private String bizId;
/**
* 是否过滤空数据
*/
private Integer filterNull;
/**
* 线索来源
* @see com.gic.haoban.manage.api.enums.content.InteractRecordChannelSourceType
*/
private List<Integer> channelSourceList;
/**
* 业务类型 1 素材 2 商品 3 多商品页
* @see com.gic.haoban.manage.api.enums.content.ShareBizType
*/
private List<Integer> bizTypeList;
/**
* 事件类型
*/
private List<Integer> eventTypeList;
}
......@@ -2,14 +2,14 @@ package com.gic.haoban.manage.service.service.out.impl.content;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Constant;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.content.MemberLastInteractDTO;
import com.gic.haoban.manage.api.dto.qdto.content.InteractRecordQDTO;
import com.gic.haoban.manage.api.enums.content.InteractRecordExtendInfoDTO;
import com.gic.haoban.manage.api.enums.content.InteractRecordInfoDTO;
import com.gic.haoban.manage.api.enums.content.*;
import com.gic.haoban.manage.api.service.content.InteractRecordApiService;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.bo.content.MemberAttrChangeBO;
......@@ -29,6 +29,7 @@ import com.gic.order.api.dto.OrderSaveNotifyDTO;
import com.gic.order.api.dto.resp.OrderInfoResp;
import com.gic.order.api.service.member.MemberOrderReadApiService;
import com.gic.haoban.manage.service.util.EventUtils;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -60,6 +61,60 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService {
@Autowired
private MemberOrderReadApiService memberOrderReadApiService;
private InteractRecordQO convertParam(InteractRecordQDTO interactRecordQDTO) {
InteractRecordQO searchQo = EntityUtil.changeEntityNew(InteractRecordQO.class, interactRecordQDTO);
Integer bizType = interactRecordQDTO.getBizTypeAggs();
if (bizType != null) {
if (Objects.equals(bizType, ShareBizType.MATERIAL.getCode())) {
searchQo.setBizTypeList(Lists.newArrayList(bizType));
} else if (Objects.equals(bizType, ShareBizType.GOODS.getCode())) {
searchQo.setBizTypeList(Lists.newArrayList(bizType, ShareBizType.MULTIPLE_GOODS.getCode()));
}
}
Integer channelSource = interactRecordQDTO.getChannelSource();
if (channelSource != null) {
searchQo.setChannelSourceList(Lists.newArrayList(channelSource));
}
Integer eventType = interactRecordQDTO.getEventTypeAggs();
if (eventType != null) {
if (Objects.equals(eventType, InteractRecordEventType.MATERIAL.getCode())) {
searchQo.setEventTypeList(Lists.newArrayList(MaterialInteractRecordEventType.VISIT_MATERIAL.getCode(),MaterialInteractRecordEventType.VISIT_PRODUCT.getCode()));
List<Integer> bizTypeList = Optional.ofNullable(searchQo.getBizTypeList()).orElse(new ArrayList<>());
bizTypeList.add(ShareBizType.MATERIAL.getCode());
searchQo.setBizTypeList(bizTypeList);
} else if (Objects.equals(bizType, ShareBizType.GOODS.getCode())) {
searchQo.setEventTypeList(Lists.newArrayList(MaterialInteractRecordEventType.VISIT_MATERIAL.getCode(),MaterialInteractRecordEventType.VISIT_PRODUCT.getCode()));
List<Integer> bizTypeList = Optional.ofNullable(searchQo.getBizTypeList()).orElse(new ArrayList<>());
bizTypeList.add(ShareBizType.GOODS.getCode());
bizTypeList.add(ShareBizType.MULTIPLE_GOODS.getCode());
searchQo.setBizTypeList(bizTypeList);
}else {
searchQo.setEventTypeList(Lists.newArrayList(eventType));
}
}
return searchQo;
}
private void convertResult(InteractRecordInfoDTO recordInfoDTO) {
Integer bizType = recordInfoDTO.getBizType();
Integer eventType = recordInfoDTO.getEventType();
if (Objects.equals(bizType, ShareBizType.MATERIAL.getCode())) {
recordInfoDTO.setBizTypeAggs(bizType);
} else {
recordInfoDTO.setBizTypeAggs(ShareBizType.GOODS.getCode());
}
if (Objects.equals(eventType, MaterialInteractRecordEventType.VISIT_MATERIAL.getCode())
|| Objects.equals(eventType, MaterialInteractRecordEventType.VISIT_PRODUCT.getCode())) {
if (Objects.equals(bizType, ShareBizType.MATERIAL.getCode())) {
recordInfoDTO.setEventTypeAggs(InteractRecordEventType.MATERIAL.getCode());
} else {
recordInfoDTO.setEventTypeAggs(InteractRecordEventType.PRODUCT.getCode());
}
}else {
recordInfoDTO.setEventTypeAggs(eventType);
}
}
/**
* 查询互动记录
*
......@@ -71,8 +126,7 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService {
Page<InteractRecordInfoDTO> result = new Page<>();
result.setTotalCount(0);
result.setResult(Collections.emptyList());
InteractRecordQO searchQo = new InteractRecordQO();
BeanUtils.copyProperties(interactRecordQDTO, searchQo);
InteractRecordQO searchQo = convertParam(interactRecordQDTO);
Page<InteractRecordBO> pageResult = interactRecordService.queryInteractRecordPage(searchQo);
if (pageResult == null || CollectionUtils.isEmpty(pageResult.getResult())) {
log.info("查询结果为空 {}", JSON.toJSONString(interactRecordQDTO));
......@@ -104,6 +158,7 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService {
BeanUtils.copyProperties(item.getExtendInfo(), extendInfo);
temp.setExtendInfo(extendInfo);
}
convertResult(temp);
return temp;
}
......
......@@ -284,6 +284,11 @@
from tab_haoban_interact_record
<where>
delete_flag = 0
<if test="filterNull != null and filterNull == 1 ">
and member_id != '' and member_id is not null and member_id != '-1'
and store_id != '' and store_id is not null and store_id != '-1'
and clerk_id != '' and clerk_id is not null and clerk_id != '-1'
</if>
<if test="enterpriseId != null and enterpriseId != ''">
and enterprise_id = #{enterpriseId}
</if>
......@@ -305,6 +310,24 @@
<if test="bizId != null and bizId != ''">
and biz_id = #{bizId}
</if>
<if test="channelSourceList != null and channelSourceList.size > 0">
AND channel_source IN
<foreach collection="channelSourceList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="bizTypeList != null and bizTypeList.size > 0">
AND biz_type IN
<foreach collection="bizTypeList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="eventTypeList != null and eventTypeList.size > 0">
AND event_type IN
<foreach collection="eventTypeList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
order by last_access_time desc, id desc
</select>
......
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