Commit 22f111f6 by songyinghui

feat: 销售线索与互动记录

parent ad359422
......@@ -32,6 +32,15 @@ public class PotentialCustomerDTO implements Serializable {
private String memberId;
/**
* 销售线索-业务id
*/
private String bizId;
/**
* 业务类型 1 素材
*/
private Integer bizType;
/**
* 最后访问时间
*/
private Date lastAccessTime;
......@@ -197,4 +206,20 @@ public class PotentialCustomerDTO implements Serializable {
public void setDurationTime(Integer durationTime) {
this.durationTime = durationTime;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
}
package com.gic.haoban.manage.api.dto.qdto.content;
import com.gic.api.base.commons.BasePageInfo;
/**
* @Author MUSI
* @Date 2023/3/29 1:11 PM
* @Description
* @Version
**/
public class InteractRecordQDTO extends BasePageInfo {
/**
* 导购id
*/
private String clerkId;
/**
* 会员id
*/
private String memberId;
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
}
package com.gic.haoban.manage.api.enums.content;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/29 1:08 PM
* @Description
* @Version
**/
public class InteractRecordExtendInfoDTO implements Serializable {
private static final long serialVersionUID = 1577766149535235456L;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单创建时间
*/
private Date orderCreateTime;
/**
* 订单商品项总数
*/
private Integer orderTotalNum;
/**
* 订单应付
*/
private BigDecimal orderPay;
/**
* 订单实付
*/
private BigDecimal realPay;
/**
* 失效商品数量
*/
private Integer invalidGoodsNum;
/**
* 素材扩展商品信息
*/
private List<ExtendGoodsInfo> extendGoodsInfos;
public static class ExtendGoodsInfo {
/**
* 商品名称
*/
private String goodsName;
/**
* 商品主图
*/
private String goodsImageUrl;
/**
* 商品货号
*/
private String goodsCode;
/**
* 商品规格 红色,S; 白色,S
*/
private String goodsNorm;
/**
* 订单项数量
*/
private Integer orderNum;
/**
* 商品单价
*/
private BigDecimal salePrice;
public String getGoodsName() {
return goodsName;
}
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
public String getGoodsImageUrl() {
return goodsImageUrl;
}
public void setGoodsImageUrl(String goodsImageUrl) {
this.goodsImageUrl = goodsImageUrl;
}
public String getGoodsCode() {
return goodsCode;
}
public void setGoodsCode(String goodsCode) {
this.goodsCode = goodsCode;
}
public String getGoodsNorm() {
return goodsNorm;
}
public void setGoodsNorm(String goodsNorm) {
this.goodsNorm = goodsNorm;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public BigDecimal getSalePrice() {
return salePrice;
}
public void setSalePrice(BigDecimal salePrice) {
this.salePrice = salePrice;
}
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public Date getOrderCreateTime() {
return orderCreateTime;
}
public void setOrderCreateTime(Date orderCreateTime) {
this.orderCreateTime = orderCreateTime;
}
public Integer getOrderTotalNum() {
return orderTotalNum;
}
public void setOrderTotalNum(Integer orderTotalNum) {
this.orderTotalNum = orderTotalNum;
}
public BigDecimal getOrderPay() {
return orderPay;
}
public void setOrderPay(BigDecimal orderPay) {
this.orderPay = orderPay;
}
public BigDecimal getRealPay() {
return realPay;
}
public void setRealPay(BigDecimal realPay) {
this.realPay = realPay;
}
public Integer getInvalidGoodsNum() {
return invalidGoodsNum;
}
public void setInvalidGoodsNum(Integer invalidGoodsNum) {
this.invalidGoodsNum = invalidGoodsNum;
}
public List<ExtendGoodsInfo> getExtendGoodsInfos() {
return extendGoodsInfos;
}
public void setExtendGoodsInfos(List<ExtendGoodsInfo> extendGoodsInfos) {
this.extendGoodsInfos = extendGoodsInfos;
}
}
package com.gic.haoban.manage.api.enums.content;
import java.io.Serializable;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/29 12:46 PM
* @Description
* @Version
**/
public class InteractRecordInfoDTO implements Serializable {
private static final long serialVersionUID = -170525928535773136L;
/**
* 互动记录id
*/
private Long interactRecordId;
/**
* 记录描述
* 通过XXX访问XXXX
*/
private String recordDesc;
/**
* 第几次访问
*/
private Integer times;
/**
* 停留时长 单位秒
*/
private Integer durationTime;
/**
* 记录生成时间
*/
private Date createTime;
/**
* 记录事件类型
* 1浏览素材;2 查看商品; 3 购买商品
* 通过此类型区分 弹窗提示
*/
private Integer eventType;
/**
* 业务id
*/
private String bizId;
/**
* 扩展信息
*/
private InteractRecordExtendInfoDTO extendInfo;
public Long getInteractRecordId() {
return interactRecordId;
}
public void setInteractRecordId(Long interactRecordId) {
this.interactRecordId = interactRecordId;
}
public String getRecordDesc() {
return recordDesc;
}
public void setRecordDesc(String recordDesc) {
this.recordDesc = recordDesc;
}
public Integer getTimes() {
return times;
}
public void setTimes(Integer times) {
this.times = times;
}
public Integer getDurationTime() {
return durationTime;
}
public void setDurationTime(Integer durationTime) {
this.durationTime = durationTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getEventType() {
return eventType;
}
public void setEventType(Integer eventType) {
this.eventType = eventType;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public InteractRecordExtendInfoDTO getExtendInfo() {
return extendInfo;
}
public void setExtendInfo(InteractRecordExtendInfoDTO extendInfo) {
this.extendInfo = extendInfo;
}
}
package com.gic.haoban.manage.api.enums.content;
/**
* @Author MUSI
* @Date 2023/3/29 2:00 PM
* @Description
* @Version
* 素材分享记录 枚举
**/
public enum MaterialInteractRecordEventType {
VISIT_MATERIAL(1, "浏览了你分享的素材"),
VISIT_PRODUCT(2, "浏览了你分享的素材,并查看了关联商品"),
ORDER(3, "浏览了你分享的素材,并购买了商品");
MaterialInteractRecordEventType(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public static MaterialInteractRecordEventType getInstance(Integer code) {
if (code == null) {
return null;
}
for (MaterialInteractRecordEventType value : values()) {
if (value.code.equals(code)) {
return value;
}
}
return null;
}
private Integer code;
private String desc;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package com.gic.haoban.manage.api.enums.content;
import java.util.Arrays;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/19 10:06 PM
......@@ -11,11 +14,28 @@ public enum TriggerCustomerChannelType {
PYQ(1, "朋友圈"),
CUSTOMER_GROUP(2, "客户群"),
DIALOG_BOX(3, "对话框/群发给客户"),
DIALOG_BOX(3, "对话框"),
CONTENT_COPY(4, "复制文案"),
CONTENT_DOWNLOAD(5, "下载素材")
;
/**
* 展示文案的渠道类型
* @return
*/
public static List<Integer> showDescChannel(){
return Arrays.asList(PYQ.code, CUSTOMER_GROUP.code, DIALOG_BOX.code);
}
public static TriggerCustomerChannelType getInstance(Integer code) {
for (TriggerCustomerChannelType customerChannelType : values()) {
if (customerChannelType.code.equals(code)) {
return customerChannelType;
}
}
return null;
}
TriggerCustomerChannelType(Integer code, String desc) {
this.code = code;
this.desc = desc;
......
package com.gic.haoban.manage.api.service.content;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.qdto.content.InteractRecordQDTO;
import com.gic.haoban.manage.api.enums.content.InteractRecordInfoDTO;
/**
* @Author MUSI
* @Date 2023/3/29 12:45 PM
* @Description
* @Version
* 互动记录
**/
public interface InteractRecordApiService {
/**
* 查询互动记录
* @param interactRecordQDTO
* @return
*/
ServiceResponse<Page<InteractRecordInfoDTO>> queryInteractRecordList(InteractRecordQDTO interactRecordQDTO);
}
package com.gic.haoban.manage.api.service.content;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.content.PotentialCustomerDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerMarkRecordDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerQDTO;
......
......@@ -180,6 +180,12 @@
<artifactId>gic-sharding-sdk</artifactId>
<version>4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-store-goods-api</artifactId>
<version>${gic-store-goods-api}</version>
</dependency>
</dependencies>
<build>
......
......@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.dao.mapper.content;
import com.gic.haoban.manage.service.entity.content.TabHaobanInteractRecord;
import com.gic.haoban.manage.service.entity.content.TabHaobanPotentialCustomer;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
......@@ -89,5 +90,12 @@ public interface TabHaobanInteractRecordMapper {
*/
TabHaobanInteractRecord queryWithEnterpriseIdAndTraceId(@Param("enterpriseId") String enterpriseId, @Param("traceId") String traceId);
/**
* 查询互动记录列表
* @param interactRecordQO
* @return
*/
List<TabHaobanInteractRecord> queryInteractRecordList(InteractRecordQO interactRecordQO);
}
......@@ -21,16 +21,15 @@ public interface TabHaobanPotentialCustomerMapper {
* @param id 主键
* @return 实例对象
*/
TabHaobanPotentialCustomer queryById(Long id);
TabHaobanPotentialCustomer queryById(@Param("id") Long id, @Param("clerkId") String clerkId);
/**
* 查询指定行数据
*
* @param tabHaobanPotentialCustomer 查询条件
* @param pageable 分页对象
* @return 对象列表
* 查询销售线索
* @param clerkId
* @param memberId
* @return
*/
List<TabHaobanPotentialCustomer> queryAllByLimit(TabHaobanPotentialCustomer tabHaobanPotentialCustomer, @Param("pageable") Pageable pageable);
TabHaobanPotentialCustomer queryWithClerkIdAndMemberId(@Param("clerkId") String clerkId, @Param("memberId") String memberId);
/**
* 统计总行数
......@@ -86,9 +85,7 @@ public interface TabHaobanPotentialCustomerMapper {
* @param potentialCustomerQO
* @return
*/
TabHaobanPotentialCustomer queryPotentialCustomerList(PotentialCustomerQO potentialCustomerQO);
List<TabHaobanPotentialCustomer> queryPotentialCustomerList(PotentialCustomerQO potentialCustomerQO);
}
package com.gic.haoban.manage.service.pojo.bo.content;
import com.gic.haoban.manage.api.enums.content.InteractRecordExtendInfoDTO;
import lombok.Data;
import java.util.Date;
......@@ -15,9 +16,7 @@ import java.util.Date;
public class InteractRecordBO {
private Long id;
/**
* 企业id
*/
private String enterpriseId;
/**
* 会员id
......@@ -32,6 +31,10 @@ public class InteractRecordBO {
*/
private String clerkId;
/**
* 埋点traceId
*/
private String traceId;
/**
* 销售线索-业务id
*/
private String bizId;
......@@ -48,57 +51,37 @@ public class InteractRecordBO {
*/
private Integer channelSource;
/**
* 事件类型 1访问素材;2访问商品; 3购买商品;
* 事件类型 1浏览商品;2浏览并点击; 3浏览并查看; 4 浏览并购买; 5查看并购买
*/
private Integer eventType;
/**
* 停留时长 单位秒
*/
private Integer durationTime;
/**
* 访问次数
* 第几次访问
*/
private Integer times;
/**
* 会员名称
*/
private String memberName;
/**
* 会员昵称
*/
private String memberNickName;
/**
* 会员手机号
*/
private String memberPhone;
/**
* 成交数量
*/
private Integer dealRecordNum;
/**
* 是否导购星标客户 1是; 0否
*/
private Integer starFlag;
/**
* 是否看过 1 看过; 0未看过
*/
private Integer seeFlag;
/**
* 最新访问时间
*/
private Date lastAccessTime;
/**
* 状态 1 删除; 0正常
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
private Date updateTime;
/**
* 更新时间
* 记录描述
* 通过XXX访问XXXX
*/
private Date updateTime;
private String recordDesc;
/**
* 扩展信息
*/
private InteractRecordExtendInfoBO extendInfo;
}
package com.gic.haoban.manage.service.pojo.bo.content;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/29 2:27 PM
* @Description
* @Version
**/
@Data
public class InteractRecordExtendInfoBO implements Serializable {
/**
* 浏览的商品id
*/
private List<String> goodsIds;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单创建时间
*/
private Date orderCreateTime;
/**
* 订单商品项总数
*/
private Integer orderTotalNum;
/**
* 订单应付
*/
private BigDecimal orderPay;
/**
* 订单实付
*/
private BigDecimal realPay;
/**
* 失效商品数量
*/
private Integer invalidGoodsNum;
/**
* 素材扩展商品信息
*/
private List<ExtendGoodsInfo> extendGoodsInfos;
@Data
public static class ExtendGoodsInfo {
/**
* 商品名称
*/
private String goodsName;
/**
* 商品主图
*/
private String goodsImageUrl;
/**
* 商品货号
*/
private String goodsCode;
/**
* 商品规格 红色,S; 白色,S
*/
private String goodsNorm;
/**
* 订单项数量
*/
private Integer orderNum;
/**
* 商品单价
*/
private BigDecimal salePrice;
}
public static InteractRecordExtendInfoBO empty() {
InteractRecordExtendInfoBO temp = new InteractRecordExtendInfoBO();
// 后续有操作 此处使用可修改类型
temp.setGoodsIds(new ArrayList<>());
return temp;
}
}
package com.gic.haoban.manage.service.pojo.bo.content.context;
import cn.hutool.crypto.digest.MD5;
import com.gic.haoban.manage.api.enums.content.ShareBizType;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordExtendInfoBO;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/29 3:23 PM
* @Description
* @Version
**/
@Data
public class InteractRecordMessageContext {
private InteractRecordMessageBO interactRecordMessageBO;
/**
* 访问次数
*/
private Integer times;
/**
* 冗余的会员信息
*/
private MemberInfo memberInfo;
/**
* 成交过订单
*/
private boolean hasDeal;
public static InteractRecordMessageContext create(InteractRecordMessageBO interactRecordMessageBO) {
InteractRecordMessageContext context = new InteractRecordMessageContext();
context.setInteractRecordMessageBO(interactRecordMessageBO);
return context;
}
/**
* 构建唯一key
*
* @return
*/
public String buildRecordKey() {
String customerId = StringUtils.isNotBlank(interactRecordMessageBO.getMemberId()) ? interactRecordMessageBO.getMemberId() : interactRecordMessageBO.getUnionId();
String key = interactRecordMessageBO.getBusinessUUId() + interactRecordMessageBO.getClerkId() + interactRecordMessageBO.getMaterialId() + customerId;
return MD5.create().digestHex(key);
}
/**
* 获取客户id
*
* @return
*/
public String getCustomerId() {
if (StringUtils.isNotBlank(this.interactRecordMessageBO.getMemberId())) {
return this.interactRecordMessageBO.getMemberId();
}
return this.interactRecordMessageBO.getUnionId();
}
public InteractRecordBO build() {
if (this.interactRecordMessageBO == null) {
return null;
}
InteractRecordBO temp = new InteractRecordBO();
temp.setEnterpriseId(this.interactRecordMessageBO.getEnterpriseId());
temp.setMemberId(this.interactRecordMessageBO.getMemberId());
temp.setUnionId(this.interactRecordMessageBO.getUnionId());
temp.setClerkId(this.interactRecordMessageBO.getClerkId());
temp.setStoreId(this.interactRecordMessageBO.getStoreId());
temp.setChannelSource(this.interactRecordMessageBO.getChannelSource());
temp.setEventType(this.interactRecordMessageBO.getEventType());
temp.setDurationTime(this.interactRecordMessageBO.getDurationTime());
temp.setBizType(ShareBizType.MATERIAL.getCode());
temp.setBizId(this.interactRecordMessageBO.getMaterialId() + "");
temp.setTimes(this.times);
temp.setTraceId(this.buildRecordKey());
temp.setDeleteFlag(0);
temp.setCreateTime(new Date());
temp.setUpdateTime(new Date());
temp.setExtendInfo(InteractRecordExtendInfoBO.empty());
return temp;
}
/**
* 构建销售线索
*/
public PotentialCustomerBO buildPotentialCustomerBo(InteractRecordBO interactRecordBO){
PotentialCustomerBO temp = new PotentialCustomerBO();
BeanUtils.copyProperties(interactRecordBO, temp);
temp.setDeleteFlag(0);
temp.setCreateTime(new Date());
temp.setUpdateTime(new Date());
temp.setStarFlag(0);
temp.setDealRecordNum(this.hasDeal ? 1 : 0);
temp.setLastAccessTime(new Date(this.interactRecordMessageBO.getLastAccessTime()));
if (this.memberInfo != null) {
temp.setMemberName(this.memberInfo.memberName);
temp.setMemberNickName(this.memberInfo.memberNickName);
temp.setMemberPhone(this.memberInfo.memberPhone);
}
return temp;
}
@Data
@AllArgsConstructor
public static class MemberInfo {
private String memberName;
private String memberNickName;
private String memberPhone;
}
}
......@@ -12,7 +12,7 @@ import java.util.List;
* @Version
**/
@Data
public class InteractRecordBO implements Serializable {
public class InteractRecordMessageBO implements Serializable {
/**
......@@ -65,4 +65,9 @@ public class InteractRecordBO implements Serializable {
* 业务唯一标识
*/
private String businessUUId;
/**
* 访问时间
* 时间戳
*/
private Long lastAccessTime;
}
package com.gic.haoban.manage.service.pojo.qo.content;
import com.gic.api.base.commons.BasePageInfo;
import lombok.Data;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/29 12:33 PM
* @Description
* @Version
**/
@Data
public class InteractRecordQO extends BasePageInfo {
/**
* 导购id
*/
private String clerkId;
/**
* 会员id
*/
private String memberId;
/**
*
*/
private String unionId;
/**
* 开始时间
*/
private Date startTime;
}
......@@ -29,6 +29,11 @@ public class PotentialCustomerQO extends BasePageInfo {
private String clerkId;
/**
* 会员id
*/
private String memberId;
/**
* 搜索字段
*/
private String search;
......
package com.gic.haoban.manage.service.service.content;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
/**
* 互动记录明细(TabHaobanInteractRecord)表服务接口
......@@ -16,5 +18,26 @@ public interface InteractRecordService {
* @param traceId
* @return
*/
InteractRecordBO queryInteractInfo(String enterpriseId, String traceId);
InteractRecordBO queryWithInteractInfo(String enterpriseId, String traceId);
/**
* 互动记录查询
* @param interactRecordQO
* @return
*/
Page<InteractRecordBO> queryInteractRecordPage(InteractRecordQO interactRecordQO);
/**
* 统计总数
* @param interactRecordQO
* @return
*/
Integer countInteractRecord(InteractRecordQO interactRecordQO);
/**
* 保存互动记录
* @param interactRecordBO
* @return
*/
Long saveOrUpdateInteractRecord(InteractRecordBO interactRecordBO);
}
......@@ -18,4 +18,34 @@ public interface PotentialCustomerService {
* @return
*/
Page<PotentialCustomerBO> queryPotentialCustomerPage(PotentialCustomerQO potentialCustomerQO);
/**
* 查询详情
* @param clerkId
* @param potentialCustomerId
* @return
*/
PotentialCustomerBO queryPotentialCustomerInfo(String clerkId, Long potentialCustomerId);
/**
* 根据导购和会员id查询销售线索
* @param clerkId
* @param memberId
* @return
*/
PotentialCustomerBO queryPotentialCustomerInfo(String clerkId, String memberId);
/**
* 修改销售线索
* @param potentialCustomerBO
*/
void markPotentialCustomer(PotentialCustomerBO potentialCustomerBO);
/**
* 更新保存
* @param potentialCustomerBO
* @return
*/
Long saveOrUpdatePotentialCustomer(PotentialCustomerBO potentialCustomerBO);
}
package com.gic.haoban.manage.service.service.content.adaptor;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.enums.content.MaterialInteractRecordEventType;
import com.gic.haoban.manage.api.enums.content.TriggerCustomerChannelType;
import com.gic.haoban.manage.service.entity.content.TabHaobanInteractRecord;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordExtendInfoBO;
import com.gic.store.goods.dto.goods.GoodsInfoSimpleDTO;
import com.gic.store.goods.dto.qdto.ErpGoodsInfoQDTO;
import com.gic.store.goods.enums.GoodsStatusEnum;
import com.gic.store.goods.service.GoodsInfoOutApiService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author MUSI
* @Date 2023/3/29 2:49 PM
* @Description
* @Version
**/
@Slf4j
@Component
public class InteractRecordBuilder {
@Autowired
private GoodsInfoOutApiService goodsInfoOutApiService;
/**
* 互动记录描述
*
* @param interactRecord
* @return
*/
public String buildDesc(TabHaobanInteractRecord interactRecord) {
StringBuilder stringBuilder = new StringBuilder();
if (TriggerCustomerChannelType.showDescChannel().contains(interactRecord.getChannelSource())) {
TriggerCustomerChannelType channelType = TriggerCustomerChannelType.getInstance(interactRecord.getChannelSource());
if (channelType != null) {
stringBuilder.append(String.format("通过[%s]", channelType.getDesc()));
}
}
MaterialInteractRecordEventType instance = MaterialInteractRecordEventType.getInstance(interactRecord.getEventType());
if (instance != null) {
stringBuilder.append(instance.getDesc());
}
return stringBuilder.toString();
}
/**
* 互动记录转换扩展信息
*
* @param interactRecord
* @return
*/
public InteractRecordExtendInfoBO convertExtendInfo(TabHaobanInteractRecord interactRecord) {
if (interactRecord == null) {
log.info("互动记录为空");
return null;
}
if (StringUtils.isBlank(interactRecord.getExtendInfo())) {
log.info("互动记录扩展信息为空 {}", interactRecord.getId());
return null;
}
if (MaterialInteractRecordEventType.VISIT_MATERIAL.getCode().equals(interactRecord.getEventType())) {
// 浏览素材事件无扩展信息
log.info("浏览素材事件无扩展信息 {}", interactRecord.getId());
return null;
}
InteractRecordExtendInfoBO extendInfo = JSON.parseObject(interactRecord.getExtendInfo(), new TypeReference<InteractRecordExtendInfoBO>() {
});
if (MaterialInteractRecordEventType.VISIT_PRODUCT.getCode().equals(interactRecord.getEventType())) {
// 浏览商品事件
List<String> visitGoodsIds = extendInfo.getGoodsIds();
if (CollectionUtils.isEmpty(visitGoodsIds)) {
return null;
}
// 拼接商品信息
List<InteractRecordExtendInfoBO.ExtendGoodsInfo> extendGoodsInfos = this.convertGoodsInfo(visitGoodsIds, interactRecord.getEnterpriseId());
extendInfo.setExtendGoodsInfos(extendGoodsInfos);
extendInfo.setInvalidGoodsNum(visitGoodsIds.size() - extendGoodsInfos.size());
return extendInfo;
}
return extendInfo;
}
private List<InteractRecordExtendInfoBO.ExtendGoodsInfo> convertGoodsInfo(List<String> visitGoodsIds, String enterpriseId) {
ErpGoodsInfoQDTO search = new ErpGoodsInfoQDTO();
search.setEnterpriseId(enterpriseId);
search.setGoodsIds(visitGoodsIds);
search.setExcludeStatus(Arrays.asList(GoodsStatusEnum.DELETED.getCode(), GoodsStatusEnum.BACK.getCode()));
ServiceResponse<List<GoodsInfoSimpleDTO>> serviceResponse =
goodsInfoOutApiService.queryErpGoodsInfoWithIds(search);
if (!serviceResponse.isSuccess()) {
return Collections.emptyList();
}
return serviceResponse.getResult()
.stream()
.map(item -> {
InteractRecordExtendInfoBO.ExtendGoodsInfo extendGoodsInfo = new InteractRecordExtendInfoBO.ExtendGoodsInfo();
extendGoodsInfo.setGoodsName(item.getGoodsName());
extendGoodsInfo.setGoodsCode(item.getGoodsCode());
extendGoodsInfo.setGoodsImageUrl(item.getGoodsImageUrl());
// todo 商品价格 待订单迭代上线后再调整
// extendGoodsInfo.setSalePrice(item.getStatus());
return extendGoodsInfo;
})
.collect(Collectors.toList());
}
}
package com.gic.haoban.manage.service.service.content.adaptor;
import com.gic.haoban.manage.service.pojo.bo.content.context.InteractRecordMessageContext;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @Author MUSI
* @Date 2023/3/29 3:48 PM
* @Description
* @Version
**/
@Slf4j
@Component
public class InteractRecordMessageBuilder {
@Autowired
private InteractRecordService interactRecordService;
@Autowired
private MemberService memberService;
/**
* 计算互动记录的访问次数
* // 通过clerkId、memberId、materialId 查询之前存在的记录总数,本次是第几次访问 在之前的记录总数上加1
*
* @param context
*/
public void calcCustomerVisitTimes(InteractRecordMessageContext context) {
InteractRecordQO searchQo = new InteractRecordQO();
searchQo.setClerkId(context.getInteractRecordMessageBO().getClerkId());
searchQo.setMemberId(context.getInteractRecordMessageBO().getMemberId());
if (StringUtils.isBlank(searchQo.getMemberId())) {
searchQo.setUnionId(context.getInteractRecordMessageBO().getUnionId());
}
searchQo.setPageSize(1);
Integer count = interactRecordService.countInteractRecord(searchQo);
context.setTimes(count + 1);
}
/**
* 冗余会员信息
* @param context
*/
public void redundantMemberInfo(InteractRecordMessageContext context) {
String memberId = context.getInteractRecordMessageBO().getMemberId();
if (StringUtils.isBlank(memberId)) {
log.info("互动记录冗余会员信息 会员不存在");
return;
}
MemberDTO memberDTO = memberService.queryMember(memberId);
if (memberDTO == null) {
log.info("查询会员信息为空 {}", memberId);
return;
}
InteractRecordMessageContext.MemberInfo memberInfo = new InteractRecordMessageContext
.MemberInfo(memberDTO.getMemberName(), memberDTO.getThirdNickname(), memberDTO.getPhoneNumber());
context.setMemberInfo(memberInfo);
}
/**
* 计算会员是否有过订单
* @param context
*/
public void calcHaveOrderNum(InteractRecordMessageContext context) {
String memberId = context.getInteractRecordMessageBO().getMemberId();
if (StringUtils.isBlank(memberId)) {
log.info("互动记录冗余会员信息 会员id不存在");
return;
}
// 查询会员全渠道订单
}
}
package com.gic.haoban.manage.service.service.content.impl;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.service.dao.mapper.content.TabHaobanInteractRecordMapper;
import com.gic.haoban.manage.service.entity.content.TabHaobanInteractRecord;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.haoban.manage.service.service.content.adaptor.InteractRecordBuilder;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 互动记录明细(TabHaobanInteractRecord)表服务实现类
......@@ -23,6 +35,8 @@ public class InteractRecordServiceImpl implements InteractRecordService {
@Resource
private TabHaobanInteractRecordMapper tabHaobanInteractRecordMapper;
@Autowired
private InteractRecordBuilder interactRecordBuilder;
/**
* 查询互动记录
......@@ -32,7 +46,7 @@ public class InteractRecordServiceImpl implements InteractRecordService {
* @return
*/
@Override
public InteractRecordBO queryInteractInfo(String enterpriseId, String traceId) {
public InteractRecordBO queryWithInteractInfo(String enterpriseId, String traceId) {
if (StringUtils.isAnyBlank(enterpriseId, traceId)) {
return null;
......@@ -46,4 +60,84 @@ public class InteractRecordServiceImpl implements InteractRecordService {
BeanUtils.copyProperties(interactRecord, temp);
return temp;
}
/**
* 互动记录查询
*
* @param interactRecordQO
* @return
*/
@Override
public Page<InteractRecordBO> queryInteractRecordPage(InteractRecordQO interactRecordQO) {
// 默认查最近一年内的的数据
if (StringUtils.isBlank(interactRecordQO.getClerkId())) {
log.info("queryInteractRecordPage 参数缺失");
return new Page<>();
}
interactRecordQO.setStartTime(DateUtil.addNumForYear(new Date(), -1));
PageHelper.startPage(interactRecordQO.getPageNum(), interactRecordQO.getPageSize());
com.github.pagehelper.Page<TabHaobanInteractRecord> pageResult =
(com.github.pagehelper.Page<TabHaobanInteractRecord>) tabHaobanInteractRecordMapper.queryInteractRecordList(interactRecordQO);
if (pageResult == null || CollectionUtils.isEmpty(pageResult)) {
log.info("查询互动记录数据为空 {}", JSON.toJSONString(interactRecordQO));
return new Page<>();
}
Page<InteractRecordBO> result = new Page<>();
result.setTotalCount((int) pageResult.getTotal());
List<InteractRecordBO> recordBos = pageResult.getResult()
.stream()
.map(item -> {
InteractRecordBO temp = new InteractRecordBO();
BeanUtils.copyProperties(item, temp);
temp.setRecordDesc(this.interactRecordBuilder.buildDesc(item));
temp.setExtendInfo(interactRecordBuilder.convertExtendInfo(item));
return temp;
})
.collect(Collectors.toList());
result.setResult(recordBos);
return result;
}
/**
* 统计总数
*
* @param interactRecordQO
* @return
*/
@Override
public Integer countInteractRecord(InteractRecordQO interactRecordQO) {
interactRecordQO.setPageNum(1);
interactRecordQO.setPageSize(1);
PageHelper.startPage(interactRecordQO.getPageNum(), interactRecordQO.getPageSize());
com.github.pagehelper.Page<TabHaobanInteractRecord> pageResult =
(com.github.pagehelper.Page<TabHaobanInteractRecord>) tabHaobanInteractRecordMapper.queryInteractRecordList(interactRecordQO);
if (pageResult == null || CollectionUtils.isEmpty(pageResult)) {
log.info("查询互动记录数据为空 {}", JSON.toJSONString(interactRecordQO));
return 0;
}
return (int)pageResult.getTotal();
}
/**
* 保存互动记录
*
* @param interactRecordBO
* @return
*/
@Override
public Long saveOrUpdateInteractRecord(InteractRecordBO interactRecordBO) {
TabHaobanInteractRecord temp = new TabHaobanInteractRecord();
BeanUtils.copyProperties(interactRecordBO, temp);
if (interactRecordBO.getExtendInfo() != null) {
temp.setExtendInfo(JSON.toJSONString(interactRecordBO.getExtendInfo()));
}
if (interactRecordBO.getId() == null) {
temp.setId(UniqueIdUtils.uniqueLong());
tabHaobanInteractRecordMapper.insert(temp);
}else {
tabHaobanInteractRecordMapper.update(temp);
}
return temp.getId();
}
}
package com.gic.haoban.manage.service.service.content.impl;
import com.gic.api.base.commons.Page;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.service.dao.mapper.content.TabHaobanPotentialCustomerMapper;
import com.gic.haoban.manage.service.entity.content.TabHaobanPotentialCustomer;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.qo.content.PotentialCustomerQO;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
/**
* 销售线索(TabHaobanPotentialCustomer)表服务实现类
......@@ -23,7 +29,7 @@ import javax.annotation.Resource;
public class PotentialCustomerServiceImpl implements PotentialCustomerService {
@Resource
private TabHaobanPotentialCustomerMapper tabHaobanPotentialCustomerMapper;
private TabHaobanPotentialCustomerMapper potentialCustomerMapper;
/**
......@@ -39,8 +45,87 @@ public class PotentialCustomerServiceImpl implements PotentialCustomerService {
log.info("参数缺失 {}", potentialCustomerQO.getClerkId());
return new Page<>();
}
PageHelper.startPage(potentialCustomerQO.getPageNum(), potentialCustomerQO.getPageSize());
com.github.pagehelper.Page<TabHaobanPotentialCustomer> pageResult =
(com.github.pagehelper.Page<TabHaobanPotentialCustomer>) potentialCustomerMapper.queryPotentialCustomerList(potentialCustomerQO);
return PageUtil.changePageHelperToCurrentPage(pageResult, PotentialCustomerBO.class);
}
/**
* 查询详情
*
* @param clerkId
* @param potentialCustomerId
* @return
*/
@Override
public PotentialCustomerBO queryPotentialCustomerInfo(String clerkId, Long potentialCustomerId) {
if (StringUtils.isBlank(clerkId)) {
return null;
}
TabHaobanPotentialCustomer haobanPotentialCustomer = potentialCustomerMapper.queryById(potentialCustomerId, clerkId);
if (haobanPotentialCustomer == null) {
return null;
}
PotentialCustomerBO temp = new PotentialCustomerBO();
BeanUtils.copyProperties(haobanPotentialCustomer, temp);
return temp;
}
/**
* 根据导购和会员id查询销售线索
*
* @param clerkId
* @param memberId
* @return
*/
@Override
public PotentialCustomerBO queryPotentialCustomerInfo(String clerkId, String memberId) {
TabHaobanPotentialCustomer potentialCustomer = potentialCustomerMapper.queryWithClerkIdAndMemberId(clerkId, memberId);
if (potentialCustomer == null) {
return null;
}
PotentialCustomerBO temp = new PotentialCustomerBO();
BeanUtils.copyProperties(potentialCustomer, temp);
return temp;
}
/**
* 标记销售线索为已读 或 星标客户
*
* @param potentialCustomerBO
*/
@Override
public void markPotentialCustomer(PotentialCustomerBO potentialCustomerBO) {
if (potentialCustomerBO.getId() == null) {
log.info("参数缺失");
return;
}
TabHaobanPotentialCustomer temp = new TabHaobanPotentialCustomer();
temp.setId(potentialCustomerBO.getId());
temp.setStarFlag(potentialCustomerBO.getStarFlag());
temp.setSeeFlag(potentialCustomerBO.getSeeFlag());
potentialCustomerMapper.update(temp);
}
/**
* 更新保存
*
* @param potentialCustomerBO
* @return
*/
@Override
public Long saveOrUpdatePotentialCustomer(PotentialCustomerBO potentialCustomerBO) {
TabHaobanPotentialCustomer temp = new TabHaobanPotentialCustomer();
BeanUtils.copyProperties(potentialCustomerBO, temp);
temp.setUpdateTime(new Date());
if (temp.getId() == null) {
temp.setId(UniqueIdUtils.uniqueLong());
potentialCustomerMapper.insert(temp);
}else {
potentialCustomerMapper.update(temp);
}
return temp.getId();
}
}
package com.gic.haoban.manage.service.service.content.message;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordBO;
import com.gic.haoban.manage.api.enums.content.MaterialInteractRecordEventType;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordExtendInfoBO;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.bo.content.context.InteractRecordMessageContext;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import com.gic.haoban.manage.service.service.content.adaptor.InteractRecordMessageBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Optional;
/**
* @Author MUSI
* @Date 2023/3/28 2:50 PM
* @Description
* @Version
* 互动记录消息处理器
* @Version 互动记录消息处理器
**/
@Slf4j
@Component
public class InteractRecordMessageService {
@Autowired
InteractRecordService interactRecordService;
@Autowired
InteractRecordMessageBuilder interactRecordMessageBuilder;
@Autowired
PotentialCustomerService potentialCustomerService;
/**
* 处理互动记录
* @param interactRecordBO
*
* @param interactRecordMessageBO
*/
public void dealRecord(InteractRecordBO interactRecordBO) {
public void dealRecord(InteractRecordMessageBO interactRecordMessageBO) {
InteractRecordMessageContext context = InteractRecordMessageContext.create(interactRecordMessageBO);
// 参数是否完整
// 根据businessId clerkId memberId materialId 构建唯一标识key
String recordKey = context.buildRecordKey();
// 根据key 查询是否存在记录
String key = this.buildRecordKey(interactRecordBO);
InteractRecordBO interactRecordBO = interactRecordService.queryWithInteractInfo(interactRecordMessageBO.getEnterpriseId(), recordKey);
if (interactRecordBO == null) {
// 新增
// 通过clerkId、memberId、materialId 查询之前存在的记录总数,本次是第几次访问 在之前的记录总数上加1
// 编辑
// 合并时间类型
//
// 冗余会员信息
interactRecordMessageBuilder.redundantMemberInfo(context);
// 查询会员是否有过成交 (是否存在订单)
interactRecordMessageBuilder.calcHaveOrderNum(context);
// 计算访问次数
interactRecordMessageBuilder.calcCustomerVisitTimes(context);
interactRecordBO = context.build();
} else {
// 该key已存在 需要对之前的进行合并
// 修改访问类型
interactRecordBO.setUpdateTime(new Date());
Integer durationTime = Optional.ofNullable(interactRecordBO.getDurationTime()).orElse(0);
interactRecordBO.setDurationTime(durationTime + Optional.ofNullable(interactRecordMessageBO.getDurationTime()).orElse(0));
// 事件类型
if (interactRecordBO.getEventType() < interactRecordBO.getEventType()) {
interactRecordBO.setEventType(interactRecordMessageBO.getEventType());
}
}
// 组装扩展信息
if (MaterialInteractRecordEventType.VISIT_PRODUCT.getCode().equals(interactRecordMessageBO.getEventType())) {
// 浏览商品
if (CollectionUtils.isNotEmpty(interactRecordMessageBO.getGoodsIds())) {
if (interactRecordBO.getExtendInfo() == null){
interactRecordBO.setExtendInfo(InteractRecordExtendInfoBO.empty());
}
interactRecordBO.getExtendInfo().getGoodsIds().addAll(interactRecordMessageBO.getGoodsIds());
}
}
/**
* 构建唯一key
* @param interactRecordBO
* @return
*/
private String buildRecordKey(InteractRecordBO interactRecordBO) {
String customerId = StringUtils.isNotBlank(interactRecordBO.getMemberId()) ? interactRecordBO.getMemberId() : interactRecordBO.getUnionId();
return interactRecordBO.getBusinessUUId() + interactRecordBO.getClerkId() + interactRecordBO.getMaterialId() + customerId;
if (MaterialInteractRecordEventType.ORDER.getCode().equals(interactRecordMessageBO.getEventType())) {
// 下单
// 查询订单信息
String orderId = interactRecordMessageBO.getOrderId();
}
interactRecordService.saveOrUpdateInteractRecord(interactRecordBO);
// 更新销售线索
if (StringUtils.isNotBlank(interactRecordMessageBO.getMemberId())) {
// 查询销售线索
PotentialCustomerBO potentialCustomerBO = potentialCustomerService.queryPotentialCustomerInfo(interactRecordMessageBO.getClerkId(), interactRecordMessageBO.getMemberId());
if (potentialCustomerBO == null) {
potentialCustomerBO = context.buildPotentialCustomerBo(interactRecordBO);
}
// 最近访问时间
if (potentialCustomerBO.getLastAccessTime().before(new Date(interactRecordMessageBO.getLastAccessTime()))) {
potentialCustomerBO.setLastAccessTime(new Date(interactRecordMessageBO.getLastAccessTime()));
}
// 标记为未读
potentialCustomerBO.setSeeFlag(0);
//
potentialCustomerBO.setStoreId(interactRecordBO.getStoreId());
potentialCustomerBO.setBizId(interactRecordBO.getBizId());
potentialCustomerBO.setEventType(interactRecordBO.getEventType());
potentialCustomerBO.setChannelSource(interactRecordBO.getChannelSource());
potentialCustomerBO.setEventType(interactRecordBO.getEventType());
potentialCustomerBO.setDurationTime(interactRecordBO.getDurationTime());
potentialCustomerBO.setTimes(interactRecordBO.getTimes());
potentialCustomerService.saveOrUpdatePotentialCustomer(potentialCustomerBO);
// 累计 该导购 + 时间段内 未读数量
}
}
}
package com.gic.haoban.manage.service.service.out.impl.content;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
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.service.content.InteractRecordApiService;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author MUSI
* @Date 2023/3/29 1:12 PM
* @Description
* @Version
**/
@Slf4j
@Component("interactRecordApiService")
public class InteractRecordApiServiceImpl implements InteractRecordApiService {
@Autowired
private InteractRecordService interactRecordService;
/**
* 查询互动记录
*
* @param interactRecordQDTO
* @return
*/
@Override
public ServiceResponse<Page<InteractRecordInfoDTO>> queryInteractRecordList(InteractRecordQDTO interactRecordQDTO) {
Page<InteractRecordInfoDTO> result = new Page<>();
result.setTotalCount(0);
result.setResult(Collections.emptyList());
InteractRecordQO searchQo = new InteractRecordQO();
BeanUtils.copyProperties(interactRecordQDTO, searchQo);
Page<InteractRecordBO> pageResult = interactRecordService.queryInteractRecordPage(searchQo);
if (pageResult == null || CollectionUtils.isEmpty(pageResult.getResult())) {
log.info("查询结果为空 {}", JSON.toJSONString(interactRecordQDTO));
return ServiceResponse.success(result);
}
// 拼接描述
// 组装扩展信息
List<InteractRecordInfoDTO> recordInfos = pageResult.getResult()
.stream()
.map(item -> {
InteractRecordInfoDTO temp = new InteractRecordInfoDTO();
BeanUtils.copyProperties(item, temp);
temp.setInteractRecordId(item.getId());
if (item.getExtendInfo() != null) {
InteractRecordExtendInfoDTO extendInfo = new InteractRecordExtendInfoDTO();
BeanUtils.copyProperties(item.getExtendInfo(), extendInfo);
temp.setExtendInfo(extendInfo);
}
return temp;
})
.collect(Collectors.toList());
result.setTotalCount(pageResult.getTotalCount());
result.setResult(recordInfos);
return ServiceResponse.success(result);
}
}
package com.gic.haoban.manage.service.service.out.impl.content;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.content.PotentialCustomerDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerMarkRecordDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerQDTO;
import com.gic.haoban.manage.api.service.content.PotentialCustomerApiService;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.qo.content.PotentialCustomerQO;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author MUSI
* @Date 2023/3/29 10:00 AM
......@@ -30,7 +37,24 @@ public class PotentialCustomerApiServiceImpl implements PotentialCustomerApiServ
*/
@Override
public ServiceResponse<Page<PotentialCustomerDTO>> queryPotentialCustomer(PotentialCustomerQDTO potentialCustomerQDTO) {
return null;
PotentialCustomerQO searchQO = new PotentialCustomerQO();
BeanUtils.copyProperties(potentialCustomerQDTO, searchQO);
Page<PotentialCustomerBO> customerPage = potentialCustomerService.queryPotentialCustomerPage(searchQO);
if (CollectionUtils.isEmpty(customerPage.getResult())) {
return ServiceResponse.success(new Page<>());
}
Page<PotentialCustomerDTO> resultPage = new Page<>();
resultPage.setTotalCount(customerPage.getTotalCount());
List<PotentialCustomerDTO> customerDTOS = customerPage.getResult()
.stream()
.map(item -> {
PotentialCustomerDTO temp = new PotentialCustomerDTO();
BeanUtils.copyProperties(item, temp);
return temp;
})
.collect(Collectors.toList());
resultPage.setResult(customerDTOS);
return ServiceResponse.success(resultPage);
}
/**
......@@ -41,6 +65,12 @@ public class PotentialCustomerApiServiceImpl implements PotentialCustomerApiServ
*/
@Override
public ServiceResponse<Long> markPotentialCustomer(PotentialCustomerMarkRecordDTO potentialCustomerMarkRecordDTO) {
return null;
PotentialCustomerBO potentialCustomerBO = potentialCustomerService.queryPotentialCustomerInfo(potentialCustomerMarkRecordDTO.getClerkId(), potentialCustomerMarkRecordDTO.getPotentialCustomerId());
if (potentialCustomerBO == null) {
return ServiceResponse.failure("-701", "数据不存在");
}
potentialCustomerService.markPotentialCustomer(potentialCustomerBO);
return ServiceResponse.success(potentialCustomerBO.getId());
}
}
......@@ -8,7 +8,7 @@
<import resource="classpath*:kafka-setting.xml"/>
<import resource="classpath:dubbo-haoban-manage-service.xml" />
<import resource="classpath:dubbo-setting-test.xml"/>
<!-- <import resource="classpath:jdbc-haoban-manage-service.xml" />-->
<import resource="classpath*:jdbc-haoban-manage-service-sharding.xml" />
<import resource="classpath:jdbc-haoban-manage-service.xml" />
<!-- <import resource="classpath*:jdbc-haoban-manage-service-sharding.xml" />-->
<import resource="classpath*:log-record-init.xml" />
</beans>
\ No newline at end of file
......@@ -210,5 +210,9 @@
ref="qywxGroupMsgTaskApiServiceImpl" timeout="10000" />
<dubbo:service interface="com.gic.haoban.manage.api.service.content.PotentialCustomerApiService"
ref="potentialCustomerApiService" timeout="10000" />
<dubbo:service interface="com.gic.haoban.manage.api.service.content.InteractRecordApiService"
ref="interactRecordApiService" timeout="10000" />
<dubbo:reference interface="com.gic.store.goods.service.GoodsInfoOutApiService" id="goodsInfoOutApiService" timeout="10000" retries="0" check="false"/>
</beans>
\ No newline at end of file
......@@ -257,5 +257,20 @@
where enterprise_id = #{enterpriseId} and trace_id = #{traceId}
</select>
<select id="queryInteractRecordList" resultMap="TabHaobanInteractRecordMap">
select <include refid="baseSql"/>
from tab_haoban_interact_record
<where>
clerk_id = #{clerkId} and delete_flag = 0
<if test="memberId != null and memberId != ''">
and member_id = #{memberId}
</if>
<if test="startTime != null">
and create_time >= #{startTime}
</if>
</where>
order by id desc
</select>
</mapper>
......@@ -77,82 +77,7 @@
create_time,
update_time
from tab_haoban_potential_customer
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TabHaobanPotentialCustomerMap">
select
id, enterprise_id, member_id, union_id, clerk_id, biz_id, biz_type, store_id, channel_source, event_type,
duration_time, member_name, member_nick_name, member_phone, deal_record_num, star_flag, see_flag,
last_access_time, delete_flag, create_time, update_time
from tab_haoban_potential_customer
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="enterpriseId != null and enterpriseId != ''">
and enterprise_id = #{enterpriseId}
</if>
<if test="memberId != null and memberId != ''">
and member_id = #{memberId}
</if>
<if test="unionId != null and unionId != ''">
and union_id = #{unionId}
</if>
<if test="clerkId != null and clerkId != ''">
and clerk_id = #{clerkId}
</if>
<if test="bizId != null and bizId != ''">
and biz_id = #{bizId}
</if>
<if test="bizType != null">
and biz_type = #{bizType}
</if>
<if test="storeId != null and storeId != ''">
and store_id = #{storeId}
</if>
<if test="channelSource != null">
and channel_source = #{channelSource}
</if>
<if test="eventType != null">
and event_type = #{eventType}
</if>
<if test="durationTime != null">
and duration_time = #{durationTime}
</if>
<if test="memberName != null and memberName != ''">
and member_name = #{memberName}
</if>
<if test="memberNickName != null and memberNickName != ''">
and member_nick_name = #{memberNickName}
</if>
<if test="memberPhone != null and memberPhone != ''">
and member_phone = #{memberPhone}
</if>
<if test="dealRecordNum != null">
and deal_record_num = #{dealRecordNum}
</if>
<if test="starFlag != null">
and star_flag = #{starFlag}
</if>
<if test="seeFlag != null">
and see_flag = #{seeFlag}
</if>
<if test="lastAccessTime != null">
and last_access_time = #{lastAccessTime}
</if>
<if test="deleteFlag != null">
and delete_flag = #{deleteFlag}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
where id = #{id} and clerk_id = #{clerkId} and delete_flag = 0
</select>
<!--统计总行数-->
......@@ -228,24 +153,24 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tab_haoban_potential_customer(enterprise_id, member_id, union_id, clerk_id, biz_id, biz_type,
store_id, channel_source, event_type, duration_time, member_name,
insert into tab_haoban_potential_customer(id, enterprise_id, member_id, union_id, clerk_id, biz_id, biz_type,
store_id, channel_source, event_type, duration_time, times, member_name,
member_nick_name, member_phone, deal_record_num, star_flag, see_flag,
last_access_time, delete_flag, create_time, update_time)
values (#{enterpriseId}, #{memberId}, #{unionId}, #{clerkId}, #{bizId}, #{bizType}, #{storeId},
#{channelSource}, #{eventType}, #{durationTime}, #{memberName}, #{memberNickName}, #{memberPhone},
values (#{id}, #{enterpriseId}, #{memberId}, #{unionId}, #{clerkId}, #{bizId}, #{bizType}, #{storeId},
#{channelSource}, #{eventType}, #{durationTime}, #{times},#{memberName}, #{memberNickName}, #{memberPhone},
#{dealRecordNum}, #{starFlag}, #{seeFlag}, #{lastAccessTime}, #{deleteFlag}, #{createTime},
#{updateTime})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tab_haoban_potential_customer(enterprise_id, member_id, union_id, clerk_id, biz_id, biz_type,
store_id, channel_source, event_type, duration_time, member_name, member_nick_name, member_phone,
store_id, channel_source, event_type, duration_time, times, member_name, member_nick_name, member_phone,
deal_record_num, star_flag, see_flag, last_access_time, delete_flag, create_time, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.enterpriseId}, #{entity.memberId}, #{entity.unionId}, #{entity.clerkId}, #{entity.bizId},
#{entity.bizType}, #{entity.storeId}, #{entity.channelSource}, #{entity.eventType}, #{entity.durationTime},
#{entity.bizType}, #{entity.storeId}, #{entity.channelSource}, #{entity.eventType}, #{entity.durationTime},#{entity.times},
#{entity.memberName}, #{entity.memberNickName}, #{entity.memberPhone}, #{entity.dealRecordNum},
#{entity.starFlag}, #{entity.seeFlag}, #{entity.lastAccessTime}, #{entity.deleteFlag}, #{entity.createTime},
#{entity.updateTime})
......@@ -254,12 +179,12 @@
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into tab_haoban_potential_customer(enterprise_id, member_id, union_id, clerk_id, biz_id, biz_type,
store_id, channel_source, event_type, duration_time, member_name, member_nick_name, member_phone,
store_id, channel_source, event_type, duration_time, times, member_name, member_nick_name, member_phone,
deal_record_num, star_flag, see_flag, last_access_time, delete_flag, create_time, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.enterpriseId}, #{entity.memberId}, #{entity.unionId}, #{entity.clerkId}, #{entity.bizId},
#{entity.bizType}, #{entity.storeId}, #{entity.channelSource}, #{entity.eventType}, #{entity.durationTime},
#{entity.bizType}, #{entity.storeId}, #{entity.channelSource}, #{entity.eventType}, #{entity.durationTime}, #{times},
#{entity.memberName}, #{entity.memberNickName}, #{entity.memberPhone}, #{entity.dealRecordNum},
#{entity.starFlag}, #{entity.seeFlag}, #{entity.lastAccessTime}, #{entity.deleteFlag}, #{entity.createTime},
#{entity.updateTime})
......@@ -275,6 +200,7 @@
channel_source = values(channel_source),
event_type = values(event_type),
duration_time = values(duration_time),
times = #{times},
member_name = values(member_name),
member_nick_name = values(member_nick_name),
member_phone = values(member_phone),
......@@ -321,6 +247,9 @@
<if test="durationTime != null">
duration_time = #{durationTime},
</if>
<if test="times != null">
times = #{times},
</if>
<if test="memberName != null and memberName != ''">
member_name = #{memberName},
</if>
......@@ -362,7 +291,7 @@
where id = #{id}
</delete>
<sql id="queryPotentialCustomerSql">
<select id="queryPotentialCustomerList" resultMap="TabHaobanPotentialCustomerMap">
select customer.*
from tab_haoban_potential_customer customer
<if test="hasMemberRelation != null">
......@@ -394,11 +323,12 @@
and customer.member_phone is not null
</if>
</where>
</sql>
<select id="queryPotentialCustomerList" resultMap="TabHaobanPotentialCustomerMap">
</select>
<select id="queryWithClerkIdAndMemberId" resultMap="TabHaobanPotentialCustomerMap">
select <include refid="baseSql"/>
from tab_haoban_potential_customer
where clerk_id = #{clerkId} and delete_flag = 0 and member_id = #{memberId}
</select>
</mapper>
......
import cn.hutool.crypto.digest.MD5;
import com.gic.haoban.manage.api.enums.content.MaterialInteractRecordEventType;
import com.gic.haoban.manage.api.enums.content.TriggerCustomerChannelType;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.haoban.manage.service.service.content.message.InteractRecordMessageService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Collections;
import java.util.Date;
import java.util.UUID;
/**
* @Author MUSI
* @Date 2023/3/29 3:16 PM
* @Description
* @Version
**/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class InteractRecordTest {
@Autowired
private InteractRecordService interactRecordService;
@Autowired
private InteractRecordMessageService interactRecordMessageService;
String eid = "ff8080815dacd3a2015dacd3ef5c0000";
String wxEid = "ca66a01b79474c40b3e7c7f93daf1a3b";
String staffId = "e608b51b267e4943b87e222a343b4f25";
String clerkId = "fbc508e395f846ef9005852c420e1c4f";
String memberId = "ff8080818147efc8018148d1759903c8";
@Test
public void queryInteractPageTest(){
InteractRecordQO interactRecordQO = new InteractRecordQO();
interactRecordQO.setClerkId(staffId);
interactRecordService.queryInteractRecordPage(interactRecordQO);
}
@Test
public void dealRecordTest(){
String businessId = "UUID.randomUUID().toString()";
InteractRecordMessageBO message = new InteractRecordMessageBO();
message.setClerkId(clerkId);
message.setEnterpriseId(eid);
message.setMemberId(memberId);
message.setUnionId(memberId);
message.setStoreId("ff8080818499a54801849ce85f9f003f");
message.setMaterialId("1232139123912");
message.setChannelSource(TriggerCustomerChannelType.PYQ.getCode());
message.setEventType(MaterialInteractRecordEventType.VISIT_PRODUCT.getCode());
message.setGoodsIds(Collections.singletonList("fbc508e395f846ef9005852c420e1c23"));
message.setDurationTime(2000);
message.setBusinessUUId(businessId);
message.setLastAccessTime(new Date().getTime());
interactRecordMessageService.dealRecord(message);
}
@Test
public void test(){
for (int i = 0; i < 10; i++) {
System.out.println(MD5.create().digestHex("song"));
}
}
}
package com.gic.haoban.manage.web.controller.content;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.content.api.dto.material.ContentMaterialBaseDTO;
import com.gic.haoban.manage.api.dto.qdto.content.InteractRecordQDTO;
import com.gic.haoban.manage.api.enums.content.InteractRecordInfoDTO;
import com.gic.haoban.manage.api.service.content.InteractRecordApiService;
import com.gic.haoban.manage.web.controller.content.adaptor.ContentMaterialAdaptor;
import com.gic.haoban.manage.web.qo.content.InteractRecordQO;
import com.gic.haoban.manage.web.vo.content.ContentMaterialInfoVO;
import com.gic.haoban.manage.web.vo.content.InteractRecordVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 好办-互动记录
**/
......@@ -17,13 +30,65 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping(path = "/interact/record")
public class InteractRecordController {
@Autowired
InteractRecordApiService interactRecordApiService;
@Autowired
ContentMaterialAdaptor contentMaterialAdaptor;
/**
* 会员互动记录列表
*
* @return
*/
@RequestMapping(path = "/list")
public RestResponse<Page<InteractRecordVO>> queryInteractRecordList(@RequestBody InteractRecordQO interactRecordQO){
return RestResponse.successResult();
public RestResponse<Page<InteractRecordVO>> queryInteractRecordList(InteractRecordQO interactRecordQO) {
InteractRecordQDTO searchQdto = new InteractRecordQDTO();
BeanUtils.copyProperties(interactRecordQO, searchQdto);
ServiceResponse<Page<InteractRecordInfoDTO>> serviceResponse = interactRecordApiService.queryInteractRecordList(searchQdto);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
if (CollectionUtils.isEmpty(serviceResponse.getResult().getResult())) {
return RestResponse.successResult(new Page<>());
}
List<Long> materialIds = serviceResponse.getResult()
.getResult()
.stream()
.map(item -> Long.parseLong(item.getBizId()))
.distinct()
.collect(Collectors.toList());
Map<Long, ContentMaterialBaseDTO> materialBaseMap =
contentMaterialAdaptor.queryMaterialInfoMap(interactRecordQO.getEnterpriseId(), materialIds);
List<InteractRecordVO> interactRecordVos = serviceResponse.getResult()
.getResult()
.stream()
.map(item -> {
InteractRecordVO interactRecordVO = new InteractRecordVO();
BeanUtils.copyProperties(interactRecordVO, interactRecordVO);
ContentMaterialBaseDTO materialBaseInfo = materialBaseMap.get(Long.parseLong(item.getBizId()));
if (materialBaseInfo != null) {
ContentMaterialInfoVO temp = new ContentMaterialInfoVO();
BeanUtils.copyProperties(materialBaseInfo, item);
interactRecordVO.setContentMaterialInfoVO(temp);
}
return interactRecordVO;
})
.collect(Collectors.toList());
Page<InteractRecordVO> result = new Page<>();
result.setTotalCount(serviceResponse.getResult().getTotalCount());
result.setResult(interactRecordVos);
return RestResponse.successResult(result);
}
// /**
// * 查询互动记录扩展信息
// * @param interactRecordQO
// * @return
// */
// @RequestMapping(path = "/relation/extend/info")
// public RestResponse<InteractRecordExtendInfoVO> queryInteractRecordRelationGoods(InteractRecordQO interactRecordQO) {
// return RestResponse.successResult();
// }
}
......@@ -16,6 +16,7 @@ import com.gic.haoban.manage.web.qo.content.ContentMaterialBaseQO;
import com.gic.haoban.manage.web.qo.content.statistics.MaterialAnalyzeDataQO;
import com.gic.haoban.manage.web.qo.content.statistics.MaterialReportQO;
import com.gic.haoban.manage.web.qo.content.statistics.MaterialStatisticsBaseQO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialAreaUsedDataVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialClerkUsedDataVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialDataOverviewVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialIndexDataVO;
......@@ -253,7 +254,7 @@ public class MaterialDataStaticsController {
* @return
*/
@RequestMapping(path = "/content/material/area/used/data")
public RestResponse<MaterialStoreUsedDataVO> queryMaterialAreaUseReport(@RequestBody MaterialReportQO materialReportQO) {
public RestResponse<MaterialAreaUsedDataVO> queryMaterialAreaUseReport(@RequestBody MaterialReportQO materialReportQO) {
List<String> storeIds = new ArrayList<>();
if (StringUtils.isBlank(materialReportQO.getStoreId())) {
storeIds = clerkStoreAdaptor.queryClerkStoreIds(materialReportQO.getClerkId(), materialReportQO.getWxEnterpriseId());
......@@ -261,7 +262,7 @@ public class MaterialDataStaticsController {
storeIds.add(materialReportQO.getStoreId());
}
MaterialStoreUsedDataVO materialStoreUsedDataVO = materialDataAdaptor.queryMaterialAreaOverviewData(materialReportQO.getEnterpriseId(), materialReportQO.getClerkId(), materialReportQO.getReportType(), storeIds);
return RestResponse.successResult(materialStoreUsedDataVO);
return RestResponse.successResult();
}
......
package com.gic.haoban.manage.web.controller.content;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.content.api.dto.material.ContentMaterialBaseDTO;
import com.gic.haoban.manage.api.dto.content.PotentialCustomerDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerMarkRecordDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerQDTO;
import com.gic.haoban.manage.api.enums.content.ShareBizType;
import com.gic.haoban.manage.api.service.content.PotentialCustomerApiService;
import com.gic.haoban.manage.web.controller.content.adaptor.ContentMaterialAdaptor;
import com.gic.haoban.manage.web.qo.content.potential.PotentialCustomerMarkRecordVO;
import com.gic.haoban.manage.web.qo.content.potential.PotentialCustomerQO;
import com.gic.haoban.manage.web.vo.content.ContentMaterialInfoVO;
import com.gic.haoban.manage.web.vo.content.potential.PotentialCustomerVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 好办小程序-销售线索
**/
......@@ -18,6 +33,10 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping(path = "/potential/customer")
public class PotentialCustomerController {
@Autowired
private PotentialCustomerApiService potentialCustomerApiService;
@Autowired
ContentMaterialAdaptor contentMaterialAdaptor;
/**
* 销售线索列表
*
......@@ -26,8 +45,44 @@ public class PotentialCustomerController {
*/
@RequestMapping(path = "/list")
public RestResponse<Page<PotentialCustomerVO>> queryPotentialCustomerList(@RequestBody PotentialCustomerQO potentialCustomerQO) {
return RestResponse.successResult();
PotentialCustomerQDTO searchQDTO = new PotentialCustomerQDTO();
BeanUtils.copyProperties(potentialCustomerQO, searchQDTO);
ServiceResponse<Page<PotentialCustomerDTO>> serviceResponse =
potentialCustomerApiService.queryPotentialCustomer(searchQDTO);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
List<PotentialCustomerDTO> customerDTOS = serviceResponse.getResult().getResult();
List<Long> materialIds = customerDTOS
.stream()
.filter(item -> ShareBizType.MATERIAL.getCode().equals(item.getBizType()))
.map(item -> Long.parseLong(item.getBizId()))
.collect(Collectors.toList());
Map<Long, ContentMaterialBaseDTO> materialInfoMap = contentMaterialAdaptor.queryMaterialInfoMap(potentialCustomerQO.getEnterpriseId(), materialIds);
List<PotentialCustomerVO> customerVOS = customerDTOS
.stream()
.map(item -> {
PotentialCustomerVO temp = new PotentialCustomerVO();
BeanUtils.copyProperties(item, temp);
temp.setPotentialCustomerId(item.getPotentialCustomerId());
ContentMaterialBaseDTO contentMaterialBaseDTO = materialInfoMap.get(Long.parseLong(item.getBizId()));
if (contentMaterialBaseDTO != null) {
ContentMaterialInfoVO contentMaterialInfoVO = new ContentMaterialInfoVO();
BeanUtils.copyProperties(contentMaterialBaseDTO, contentMaterialInfoVO);
temp.setContentMaterialInfoVO(contentMaterialInfoVO);
}
return temp;
})
.collect(Collectors.toList());
Page<PotentialCustomerVO> result = new Page<>();
result.setTotalCount(serviceResponse.getResult().getTotalCount());
result.setResult(customerVOS);
return RestResponse.successResult(result);
}
/**
* 标记销售线索为已看
......@@ -37,6 +92,12 @@ public class PotentialCustomerController {
@RequestMapping(path = "/mark/record/see")
public RestResponse<?> markRecordSee(@RequestBody PotentialCustomerMarkRecordVO potentialCustomerMarkRecordVO) {
PotentialCustomerMarkRecordDTO markRecord = new PotentialCustomerMarkRecordDTO();
BeanUtils.copyProperties(potentialCustomerMarkRecordVO, markRecord);
ServiceResponse<Long> serviceResponse = potentialCustomerApiService.markPotentialCustomer(markRecord);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
return RestResponse.successResult();
}
......@@ -47,6 +108,12 @@ public class PotentialCustomerController {
*/
@RequestMapping(path = "/mark/member/star")
public RestResponse<?> markMemberStar(@RequestBody PotentialCustomerMarkRecordVO potentialCustomerMarkRecordVO) {
PotentialCustomerMarkRecordDTO markRecord = new PotentialCustomerMarkRecordDTO();
BeanUtils.copyProperties(potentialCustomerMarkRecordVO, markRecord);
ServiceResponse<Long> serviceResponse = potentialCustomerApiService.markPotentialCustomer(markRecord);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
return RestResponse.successResult();
}
}
package com.gic.haoban.manage.web.controller.content.adaptor;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.content.api.dto.material.ContentMaterialBaseDTO;
import com.gic.content.api.service.ContentMaterialApiService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Author MUSI
* @Date 2023/3/29 11:39 AM
* @Description
* @Version
**/
@Slf4j
@Component
public class ContentMaterialAdaptor {
@Autowired
private ContentMaterialApiService contentMaterialApiService;
/**
* 查询素材基本信息
* @param enterpriseId
* @param materialIds
* @return
*/
public Map<Long, ContentMaterialBaseDTO> queryMaterialInfoMap(String enterpriseId, List<Long> materialIds) {
ServiceResponse<List<ContentMaterialBaseDTO>> serviceResponse = contentMaterialApiService.listMaterialIdByMaterialIdList(enterpriseId, materialIds, null);
if (!serviceResponse.isSuccess()) {
return Collections.emptyMap();
}
if (CollectionUtils.isEmpty(serviceResponse.getResult())) {
return Collections.emptyMap();
}
return serviceResponse
.getResult()
.stream()
.collect(Collectors.toMap(ContentMaterialBaseDTO::getContentMaterialId, Function.identity()));
}
}
......@@ -219,7 +219,7 @@ public class MaterialDataAdaptor {
public Page<MaterialPersonalUsedDataVO> queryMaterialClerkUsedReport(String enterpriseId, String clerkId,
Integer reportType, List<String> storeIds,
Integer pageNo, Integer pageSize,
String orderField, Integer order) {
String orderField, String order) {
// 获取当前时间周期
DateTime startTime = null;
DateTime endTime = null;
......@@ -284,7 +284,7 @@ public class MaterialDataAdaptor {
public Page<MaterialStoreUsedDataVO> queryMaterialStoreUseReport(String enterpriseId, String clerkId,
Integer reportType, List<String> storeIds,
Integer pageNo, Integer pageSize,
String orderField, Integer order) {
String orderField, String order) {
// 获取当前时间周期
DateTime startTime = null;
......@@ -316,7 +316,7 @@ public class MaterialDataAdaptor {
inlineParams.put("storeId", StringUtils.join(storeIds, ","));
}
if (StringUtils.isNotBlank(orderField)) {
String orderStr = new Integer(1).equals(order) ? " asc " : " desc ";
String orderStr = " " + order;
inlineParams.put("orderByField", orderField + orderStr);
}
Map<String, Object> result = this.doHttp(JSON.toJSONString(params), apolloKey);
......
......@@ -31,4 +31,9 @@ public class InteractRecordQO extends BasePageInfo {
* 导购id
*/
private String clerkId;
/**
* 互动记录id
*/
private Long interactRecordId;
}
......@@ -29,8 +29,8 @@ public class MaterialReportQO extends MaterialStatisticsBaseQO {
private String orderByField;
/**
* 1 生序
* 0 降序
* asc
* desc
*/
private Integer order;
private String order;
}
package com.gic.haoban.manage.web.vo.content;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/29 12:53 PM
* @Description
* @Version
**/
@Data
public class InteractRecordExtendInfoVO implements Serializable {
private static final long serialVersionUID = 799914036029100258L;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单创建时间
*/
private Date orderCreateTime;
/**
* 订单商品项总数
*/
private Integer orderTotalNum;
/**
* 订单应付
*/
private BigDecimal orderPay;
/**
* 订单实付
*/
private BigDecimal realPay;
/**
* 失效商品数量
*/
private Integer invalidGoodsNum;
/**
* 素材扩展商品信息
*/
private List<ExtendGoodsInfo> extendGoodsInfos;
@Data
public static class ExtendGoodsInfo {
/**
* 商品名称
*/
private String goodsName;
/**
* 商品主图
*/
private String goodsImageUrl;
/**
* 商品货号
*/
private String goodsCode;
/**
* 商品规格 红色,S; 白色,S
*/
private String goodsNorm;
/**
* 订单项数量
*/
private Integer orderNum;
/**
* 商品单价
*/
private BigDecimal salePrice;
}
}
......@@ -3,7 +3,6 @@ package com.gic.haoban.manage.web.vo.content;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
......@@ -16,6 +15,12 @@ import java.util.List;
@Data
public class InteractRecordVO implements Serializable {
/**
* 互动记录id
*/
private Long interactRecordId;
/**
* 记录描述
* 通过XXX访问XXXX
......@@ -40,6 +45,7 @@ public class InteractRecordVO implements Serializable {
/**
* 记录事件类型
* 1浏览素材;2 查看商品; 3 购买商品
* 通过此类型区分 弹窗提示
*/
private Integer eventType;
......@@ -50,79 +56,7 @@ public class InteractRecordVO implements Serializable {
private ContentMaterialInfoVO contentMaterialInfoVO;
/**
* 记录关联的商品信息
*/
private List<SimpleGoodsInfoVO> relationGoodsInfo;
/**
* 订单信息
*/
private OrderInfo orderInfo;
@Data
public static class OrderInfo {
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单创建时间
*/
private Date orderCreateTime;
/**
* 订单商品项总数
*/
private Integer orderTotalNum;
/**
* 订单应付
*/
private BigDecimal orderPay;
/**
* 订单实付
*/
private BigDecimal realPay;
/**
* 订单商品信息
*/
private List<OrderItemGoodsInfo> orderItemGoodsInfos;
}
@Data
public static class OrderItemGoodsInfo {
/**
* 商品名称
*/
private String goodsName;
/**
* 商品主图
*/
private String goodsImageUrl;
/**
* 商品货号
*/
private String goodsCode;
/**
* 商品规格
*/
private String goodsNorm;
/**
* 订单项数量
*/
private Integer orderNum;
/**
* 订单项单价
* 扩展信息
*/
private BigDecimal orderItemPrice;
}
private InteractRecordExtendInfoVO extendInfo;
}
......@@ -49,7 +49,7 @@ public class SimpleGoodsInfoVO implements Serializable {
private String brandName;
/**
* 商品销售价格
* 商品价格
*/
private String salePrice;
......
package com.gic.haoban.manage.web.vo.content.statistics;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -10,6 +12,7 @@ import java.math.BigDecimal;
* @Version
* 门店纬度使用数据
**/
@Data
public class MaterialAreaUsedDataVO implements Serializable {
private static final long serialVersionUID = -6389925840088323751L;
......@@ -19,10 +22,20 @@ public class MaterialAreaUsedDataVO implements Serializable {
private Integer dayAvgUseMatlNum;
/**
* | 日均使用素材导购数环比 |
*/
private BigDecimal dayAvgUseMatlNumRatio;
/**
* 日均导购使用占比
*/
private BigDecimal dayAvgUseRate;
/***
* 日均使用导购占比环比
*/
private BigDecimal dayAvgUseBindProportionRatio;
/**
* 点击客户数
*/
......@@ -72,100 +85,4 @@ public class MaterialAreaUsedDataVO implements Serializable {
* 门店名称
*/
private String storeName;
public Integer getDayAvgUseMatlNum() {
return dayAvgUseMatlNum;
}
public void setDayAvgUseMatlNum(Integer dayAvgUseMatlNum) {
this.dayAvgUseMatlNum = dayAvgUseMatlNum;
}
public BigDecimal getDayAvgUseRate() {
return dayAvgUseRate;
}
public void setDayAvgUseRate(BigDecimal dayAvgUseRate) {
this.dayAvgUseRate = dayAvgUseRate;
}
public Integer getClickUserNum() {
return clickUserNum;
}
public void setClickUserNum(Integer clickUserNum) {
this.clickUserNum = clickUserNum;
}
public Integer getConvUserNum() {
return convUserNum;
}
public void setConvUserNum(Integer convUserNum) {
this.convUserNum = convUserNum;
}
public BigDecimal getConvSalesNmt() {
return convSalesNmt;
}
public void setConvSalesNmt(BigDecimal convSalesNmt) {
this.convSalesNmt = convSalesNmt;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public BigDecimal getUserClickNumRatio() {
return userClickNumRatio;
}
public void setUserClickNumRatio(BigDecimal userClickNumRatio) {
this.userClickNumRatio = userClickNumRatio;
}
public BigDecimal getConvUserNumRatio() {
return convUserNumRatio;
}
public void setConvUserNumRatio(BigDecimal convUserNumRatio) {
this.convUserNumRatio = convUserNumRatio;
}
public Integer getConvSalesAmtRank() {
return convSalesAmtRank;
}
public void setConvSalesAmtRank(Integer convSalesAmtRank) {
this.convSalesAmtRank = convSalesAmtRank;
}
public BigDecimal getConvSalesAmtRatio() {
return convSalesAmtRatio;
}
public void setConvSalesAmtRatio(BigDecimal convSalesAmtRatio) {
this.convSalesAmtRatio = convSalesAmtRatio;
}
}
......@@ -23,11 +23,21 @@ public class MaterialStoreUsedDataVO implements Serializable {
private Integer dayAvgUseMatlNum;
/**
* 日均导购使用占比
* 日均使用导购数环比
*/
private BigDecimal dayAvgUseMatlNumRatio;
/**
* 日均使用素材导购占比
*/
private BigDecimal dayAvgUseRate;
/**
* 日均使用素材导购占比环比
*/
private BigDecimal dayAvgUseBindProportionRatio;
/**
* 点击客户数
*/
private Integer clickUserNum;
......@@ -98,6 +108,11 @@ public class MaterialStoreUsedDataVO implements Serializable {
private String clerkName;
/**
* 导购code
*/
private String clerkCode;
/**
* 导购头像
*/
private String imageUrl;
......
......@@ -129,4 +129,6 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.content.MaterialShareLogApiService" id="materialShareLogApiService" timeout="100000" retries="0" check="false" />
<dubbo:reference interface="com.gic.haoban.manage.api.service.content.PotentialCustomerApiService" id="potentialCustomerApiService" timeout="100000" retries="0" check="false" />
<dubbo:reference interface="com.gic.haoban.manage.api.service.content.InteractRecordApiService" id="interactRecordApiService" timeout="100000" retries="0" check="false" />
</beans>
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