Commit 4c1487ae by 王祖波

Merge branch 'feature-recommend3' into 'master'

Feature recommend3

See merge request !2997
parents b87a06cf e5ffdfd3
package com.gic.haoban.manage.api.constants;
import java.util.Date;
/**
* @author mozhu
* @date 2022/4/19 15:12
......@@ -25,4 +27,15 @@ public class Manage3Constants {
* 企微最大分页
*/
public static final Integer QW_LIMIT = 1000;
/**
* 建联未转化限制时间天数
*/
public static final Integer CONTACT_ORDER_LIMIT_DAY = 30;
/**
* 建联未转化时间调整发布时间
*/
public static final Date CONTACT_FIX_RELEASE_DATE = new Date("2025/06/18 23:00:00");
}
package com.gic.haoban.manage.api.dto.contact;
import java.io.Serializable;
import java.util.List;
public class ContactConfigDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 配置主键ID
*/
private Long configId;
/**
* 自动建联类型 10话务任务 20企微群发 30发送商品 40发送素材
*/
private List<Integer> contactAutoList;
/**
* 是否自动备注(0 否 1 是)
*/
private Integer remarkFlag;
/**
* 备注内容
*/
private List<String> remarkContentList;
/**
* 企业ID
*/
private String enterpriseId;
public Long getConfigId() {
return configId;
}
public void setConfigId(Long configId) {
this.configId = configId;
}
public Integer getRemarkFlag() {
return remarkFlag;
}
public void setRemarkFlag(Integer remarkFlag) {
this.remarkFlag = remarkFlag;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public List<Integer> getContactAutoList() {
return contactAutoList;
}
public void setContactAutoList(List<Integer> contactAutoList) {
this.contactAutoList = contactAutoList;
}
public List<String> getRemarkContentList() {
return remarkContentList;
}
public void setRemarkContentList(List<String> remarkContentList) {
this.remarkContentList = remarkContentList;
}
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ public class ContactFollowDTO implements Serializable {
private String clerkCode;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联 6自动建联 7营销素材
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType;
......
......@@ -60,6 +60,25 @@ public class ContactLogDTO implements Serializable {
*/
private Date potentialTime;
/**
* 来源日志id
*/
private Long sourceLogId;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private Integer sourceType;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private Integer bizType;
/**
* 跟进记录组
*/
private String followTypes;
/**
* 企业id
*/
private String enterpriseId;
......@@ -168,4 +187,35 @@ public class ContactLogDTO implements Serializable {
this.enterpriseId = enterpriseId;
}
public Long getSourceLogId() {
return sourceLogId;
}
public void setSourceLogId(Long sourceLogId) {
this.sourceLogId = sourceLogId;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getFollowTypes() {
return followTypes;
}
public void setFollowTypes(String followTypes) {
this.followTypes = followTypes;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.dto.send;
import com.gic.haoban.manage.api.dto.anaylsis.ClerkShareGoodsLogDTO;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created by wangzubo on 2025/3/25.
......@@ -60,6 +63,11 @@ public class DealQwSendDTO implements Serializable {
*/
private String enterpriseId;
/**
* 商品分享信息
*/
private List<ClerkShareGoodsLogDTO> shareGoodsList;
public FinishQwSendBO() {
}
......@@ -119,6 +127,14 @@ public class DealQwSendDTO implements Serializable {
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public List<ClerkShareGoodsLogDTO> getShareGoodsList() {
return shareGoodsList;
}
public void setShareGoodsList(List<ClerkShareGoodsLogDTO> shareGoodsList) {
this.shareGoodsList = shareGoodsList;
}
}
public static class QwSendMsgBO implements Serializable {
......
package com.gic.haoban.manage.api.enums.contact;
public enum ContactAutoTypeEnum {
// 自动建联类型 10话务任务 20企微群发 30发送商品 40发送素材
CALL_TASK(10, "专属导购通过话务任务成功触达客户"),
QW_TASK(20, "专属导购通过企微群发任务成功触达了客户"),
GOODS_RECOMMEND(30, "专属导购通过\"智能选款\"或\"意向客户\"给客户发送了商品"),
MATERIAL(40, "专属导购通过\"聊天工具栏\"或\"企微群发\"给客户发送了营销素材");
private final int code;
private final String description;
public int getCode() {
return code;
}
public String getDescription() {
return description;
}
ContactAutoTypeEnum(int code, String description) {
this.code = code;
this.description = description;
}
public static ContactAutoTypeEnum fromCode(int code) {
for (ContactAutoTypeEnum type : values()) {
if (type.code == code) {
return type;
}
}
return null;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.enums.contact;
import cn.hutool.core.date.DateUtil;
import com.gic.haoban.manage.api.dto.contact.ContactLogDTO;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
public enum ContactBizTypeEnum {
// 业务类型 1潜客(0001)2机会人群(0010)
POTENTIAL_CUSTOMER("10",1,"潜客"),
OPPORTUNITY_CUSTOMER("20",2,"机会人群");
private final String codePre;
private final int type;
private final String description;
public String getCodePre() {
return codePre;
}
public int getType() {
return type;
}
public String getDescription() {
return description;
}
public Long getEsClerkContactTime(Long contactTime) {
if (Objects.equals(contactTime, -1L)) {
return null;
}
return Long.parseLong(this.getCodePre() + contactTime);
}
public static List<Long> getEsClerkContactTimeList(List<ContactLogDTO> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
list = list.stream().sorted(Comparator.comparing(ContactLogDTO::getBizType))
.collect(Collectors.toList());
List<Long> clerkContactTimeList = Lists.newArrayList();
Long maxContactTime = null;
for (ContactLogDTO contactLogDTO : list) {
Date contactTime = contactLogDTO.getContactTime();
ContactBizTypeEnum bizTypeEnum = ContactBizTypeEnum.fromType(contactLogDTO.getBizType());
Long orginalContactTimeLong = Long.parseLong(DateUtil.format(contactTime, "yyyyMMddHHmmss"));
Long contactTimeLong = bizTypeEnum.getEsClerkContactTime(orginalContactTimeLong);
clerkContactTimeList.add(contactTimeLong);
if (maxContactTime == null || orginalContactTimeLong > maxContactTime) {
maxContactTime = orginalContactTimeLong;
}
}
if (maxContactTime != null) {
clerkContactTimeList.add(maxContactTime);
}
return clerkContactTimeList;
}
ContactBizTypeEnum(String codePre, int type, String description) {
this.codePre = codePre;
this.type = type;
this.description = description;
}
public static ContactBizTypeEnum fromCode(String code) {
for (ContactBizTypeEnum type : values()) {
if (Objects.equals(type.codePre,code)) {
return type;
}
}
return ContactBizTypeEnum.POTENTIAL_CUSTOMER;
}
public static ContactBizTypeEnum fromType(int type) {
for (ContactBizTypeEnum bizTypeEnum : values()) {
if (bizTypeEnum.type == type) {
return bizTypeEnum;
}
}
return ContactBizTypeEnum.POTENTIAL_CUSTOMER;
}
}
\ No newline at end of file
......@@ -4,20 +4,28 @@ import org.apache.commons.lang3.StringUtils;
public enum ContactFollowTypeEnum {
PRIVATE_PHONE(1, "私人电话","私人电话"),
WECHAT_SESSION(2, "企微会话","企微会话"),
PRODUCT(3, "发送商品","商品"),
WECHAT_GROUP_SEND(4, "企微群发","企微群发"),
CONTACT(5, "标记建联","标记了建联");
// 跟进表中不会有这两个类型
SMS(-1, "短信/彩信","系统向客户发送了营销短信/彩信",null),
AI(-2, "AI电话","客户接听了AI电话",null),
PRIVATE_PHONE(1, "私人电话","私人电话",null),
WECHAT_SESSION(2, "企微会话","企微会话",null),
PRODUCT(3, "发送商品","商品",ContactAutoTypeEnum.GOODS_RECOMMEND.getCode()),
WECHAT_GROUP_SEND(4, "企微群发","企微群发",null),
CONTACT(5, "标记建联","标记了建联",null),
AUTO_CONTACT(6, "系统自动标记","系统自动标记",null),
MATERIAL(7, "营销素材","营销素材",ContactAutoTypeEnum.MATERIAL.getCode());
private final int code;
private final String description;
private final String textMatch;
private final Integer contactAutoType;
ContactFollowTypeEnum(int code, String description,String textMatch) {
ContactFollowTypeEnum(int code, String description,String textMatch,Integer contactAutoType) {
this.code = code;
this.description = description;
this.textMatch = textMatch;
this.contactAutoType = contactAutoType;
}
public String getTextMatch() {
......@@ -32,6 +40,10 @@ public enum ContactFollowTypeEnum {
return description;
}
public Integer getContactAutoType() {
return contactAutoType;
}
public static ContactFollowTypeEnum fromCode(int code) {
for (ContactFollowTypeEnum type : values()) {
if (type.code == code) {
......
package com.gic.haoban.manage.api.qdto.contact;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
......@@ -21,15 +23,36 @@ public class ContactFollowBatchQDTO implements Serializable {
private String clerkId;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联 6自动建联 7营销素材
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType;
/**
* 业务id(建联日志id)
*/
private String bizId;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType = ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType();
/**
* 来源类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer sourceType;
/**
* 跟进记录
*/
private String followRemark;
/**
* 关联商品信息
*/
private List<String> goodsInfoList;
public String getEnterpriseId() {
return enterpriseId;
}
......@@ -62,6 +85,30 @@ public class ContactFollowBatchQDTO implements Serializable {
this.followType = followType;
}
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;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public String getFollowRemark() {
return followRemark;
}
......@@ -70,6 +117,14 @@ public class ContactFollowBatchQDTO implements Serializable {
this.followRemark = followRemark;
}
public List<String> getGoodsInfoList() {
return goodsInfoList;
}
public void setGoodsInfoList(List<String> goodsInfoList) {
this.goodsInfoList = goodsInfoList;
}
public static class MemberFollow implements Serializable{
/**
......@@ -78,6 +133,11 @@ public class ContactFollowBatchQDTO implements Serializable {
private String memberId;
/**
* 外部联系人id
*/
private String externalUserId;
/**
* 跟进时间
*/
private Date followTime;
......@@ -90,6 +150,12 @@ public class ContactFollowBatchQDTO implements Serializable {
this.followTime = followTime;
}
public MemberFollow(String memberId, String externalUserId, Date followTime) {
this.memberId = memberId;
this.externalUserId = externalUserId;
this.followTime = followTime;
}
public String getMemberId() {
return memberId;
}
......@@ -98,6 +164,14 @@ public class ContactFollowBatchQDTO implements Serializable {
this.memberId = memberId;
}
public String getExternalUserId() {
return externalUserId;
}
public void setExternalUserId(String externalUserId) {
this.externalUserId = externalUserId;
}
public Date getFollowTime() {
return followTime;
}
......
package com.gic.haoban.manage.api.qdto.contact;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
......@@ -19,10 +21,28 @@ public class ContactFollowQDTO implements Serializable {
*/
private String clerkCode;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联 6自动建联 7营销素材
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType;
/**
* 业务id(建联日志id)
*/
private String bizId;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType = ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType();
/**
* 来源类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer sourceType;
/**
* 跟进记录
*/
......@@ -76,6 +96,30 @@ public class ContactFollowQDTO implements Serializable {
this.followType = followType;
}
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;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public String getFollowRemark() {
return followRemark;
}
......
package com.gic.haoban.manage.api.qdto.contact;
import java.io.Serializable;
public class ContactLogCheckQDTO implements Serializable {
private static final long serialVersionUID = 973688857967269973L;
/**
* 会员id
*/
private String memberId;
/**
* 导购id
*/
private String clerkId;
/**
* 企业id
*/
private String enterpriseId;
/**
* 业务类型 1潜客(0001)2机会人群(0010)null为都校验
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType;
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.qdto.contact;
import com.gic.haoban.manage.api.enums.contact.ContactAutoTypeEnum;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class ContactLogQDTO implements Serializable {
private static final long serialVersionUID = 973688857967269973L;
......@@ -22,6 +27,64 @@ public class ContactLogQDTO implements Serializable {
*/
private String enterpriseId;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联 6自动建联 7营销素材
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType = ContactFollowTypeEnum.CONTACT.getCode();
/**
* 跟进记录
*/
private String followRemark;
/**
* 跟进上传素材,数组格式
*/
private List<String> followMaterialList;
/**
* 自动建联类型
* @see ContactAutoTypeEnum
*/
private Integer contactAutoType;
/**
* 是否同步建联
*/
private Integer syncContactType;
/**
* 同步建联时间
*/
private Date syncContactTime;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType = ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType();
/**
* 来源类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer sourceType;
/**
* 来源建联id
*/
private Long sourceLogId;
public ContactLogQDTO() {
}
public ContactLogQDTO(String enterpriseId,String memberId, String clerkId, String storeId, Integer contactAutoType) {
this.memberId = memberId;
this.clerkId = clerkId;
this.storeId = storeId;
this.enterpriseId = enterpriseId;
this.contactAutoType = contactAutoType;
}
public String getMemberId() {
return memberId;
}
......@@ -53,4 +116,76 @@ public class ContactLogQDTO implements Serializable {
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getFollowType() {
return followType;
}
public void setFollowType(Integer followType) {
this.followType = followType;
}
public String getFollowRemark() {
return followRemark;
}
public void setFollowRemark(String followRemark) {
this.followRemark = followRemark;
}
public List<String> getFollowMaterialList() {
return followMaterialList;
}
public void setFollowMaterialList(List<String> followMaterialList) {
this.followMaterialList = followMaterialList;
}
public Integer getContactAutoType() {
return contactAutoType;
}
public void setContactAutoType(Integer contactAutoType) {
this.contactAutoType = contactAutoType;
}
public Integer getSyncContactType() {
return syncContactType;
}
public void setSyncContactType(Integer syncContactType) {
this.syncContactType = syncContactType;
}
public Date getSyncContactTime() {
return syncContactTime;
}
public void setSyncContactTime(Date syncContactTime) {
this.syncContactTime = syncContactTime;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Long getSourceLogId() {
return sourceLogId;
}
public void setSourceLogId(Long sourceLogId) {
this.sourceLogId = sourceLogId;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.qdto.contact;
import cn.hutool.core.date.DateUtil;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import java.io.Serializable;
import java.util.Date;
......@@ -43,6 +44,12 @@ public class ContactOrderSearchQDTO implements Serializable {
*/
private Date endTime;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType = ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType();
public String getMemberId() {
return memberId;
}
......@@ -102,4 +109,12 @@ public class ContactOrderSearchQDTO implements Serializable {
this.endTime = DateUtil.endOfDay(endTime);
}
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.service.contact;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.contact.ContactConfigDTO;
public interface ContactConfigApiService {
/**
* 保存建联配置
*
* @param contactConfig
*/
ServiceResponse<Void> saveContactConfig(ContactConfigDTO contactConfig);
/**
* 获取建联配置
* @param enterpriseId
* @return
*/
ServiceResponse<ContactConfigDTO> getContactConfig(String enterpriseId);
}
......@@ -2,8 +2,11 @@ package com.gic.haoban.manage.api.service.contact;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.contact.ContactLogDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactLogCheckQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO;
import java.util.List;
public interface ContactLogApiService {
/**
......@@ -11,13 +14,37 @@ public interface ContactLogApiService {
* @param memberId
* @return
*/
@Deprecated
ServiceResponse<ContactLogDTO> getClerkContactTime(String memberId);
/**
* 获取每个业务最近一条有效建联记录
* @param memberId
* @return
*/
ServiceResponse<List<ContactLogDTO>> getClerkContactTimeList(String memberId);
/**
* 保存建联记录
* @param qdto
* @return
*/
ServiceResponse<Void> saveContactLog(ContactLogQDTO qdto);
/**
* 消息队列异步自动建联
* @param message
* @return
*/
ServiceResponse<Void> autoContactLogForMQ(String message);
/**
* 是否可以建联校验
* @param checkQDTO
* @return
*/
ServiceResponse<Boolean> contactCheck(ContactLogCheckQDTO checkQDTO) ;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace=".dao.TabContactConfigDao">
<resultMap type=".entity.TabContactConfig" id="TabContactConfigMap">
<result property="configId" column="config_id" jdbcType="INTEGER"/>
<result property="contactAuto" column="contact_auto" jdbcType="VARCHAR"/>
<result property="remarkFlag" column="remark_flag" jdbcType="INTEGER"/>
<result property="remarkContent" column="remark_content" jdbcType="VARCHAR"/>
<result property="enterpriseId" column="enterprise_id" jdbcType="VARCHAR"/>
<result property="deleteFlag" column="delete_flag" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="TabContactConfigMap">
select
config_idcontact_autoremark_flagremark_contententerprise_iddelete_flagcreate_timeupdate_time
from tab_contact_config
where config_id = #{configId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TabContactConfigMap">
select
config_idcontact_autoremark_flagremark_contententerprise_iddelete_flagcreate_timeupdate_time
from tab_contact_config
<where>
<if test="configId != null">
and config_id = #{configId}
</if>
<if test="contactAuto != null and contactAuto != ''">
and contact_auto = #{contactAuto}
</if>
<if test="remarkFlag != null">
and remark_flag = #{remarkFlag}
</if>
<if test="remarkContent != null and remarkContent != ''">
and remark_content = #{remarkContent}
</if>
<if test="enterpriseId != null and enterpriseId != ''">
and enterprise_id = #{enterpriseId}
</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}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from tab_contact_config
<where>
<if test="configId != null">
and config_id = #{configId}
</if>
<if test="contactAuto != null and contactAuto != ''">
and contact_auto = #{contactAuto}
</if>
<if test="remarkFlag != null">
and remark_flag = #{remarkFlag}
</if>
<if test="remarkContent != null and remarkContent != ''">
and remark_content = #{remarkContent}
</if>
<if test="enterpriseId != null and enterpriseId != ''">
and enterprise_id = #{enterpriseId}
</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>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="configId" useGeneratedKeys="true">
insert into
tab_contact_config(contact_autoremark_flagremark_contententerprise_iddelete_flagcreate_timeupdate_time)
values (#{contactAuto}#{remarkFlag}#{remarkContent}#{enterpriseId}#{deleteFlag}#{createTime}#{updateTime})
</insert>
<insert id="insertBatch" keyProperty="configId" useGeneratedKeys="true">
insert into
tab_contact_config(contact_autoremark_flagremark_contententerprise_iddelete_flagcreate_timeupdate_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.contactAuto}#{entity.remarkFlag}#{entity.remarkContent}#{entity.enterpriseId}#{entity.deleteFlag}#{entity.createTime}#{entity.updateTime})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="configId" useGeneratedKeys="true">
insert into
tab_contact_config(contact_autoremark_flagremark_contententerprise_iddelete_flagcreate_timeupdate_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.contactAuto}#{entity.remarkFlag}#{entity.remarkContent}#{entity.enterpriseId}#{entity.deleteFlag}#{entity.createTime}#{entity.updateTime})
</foreach>
on duplicate key update
contact_auto = values(contact_auto)remark_flag = values(remark_flag)remark_content =
values(remark_content)enterprise_id = values(enterprise_id)delete_flag = values(delete_flag)create_time =
values(create_time)update_time = values(update_time)
</insert>
<!--通过主键修改数据-->
<update id="update">
update tab_contact_config
<set>
<if test="contactAuto != null and contactAuto != ''">
contact_auto = #{contactAuto},
</if>
<if test="remarkFlag != null">
remark_flag = #{remarkFlag},
</if>
<if test="remarkContent != null and remarkContent != ''">
remark_content = #{remarkContent},
</if>
<if test="enterpriseId != null and enterpriseId != ''">
enterprise_id = #{enterpriseId},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
where config_id = #{configId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from tab_contact_config where config_id = #{configId}
</delete>
</mapper>
......@@ -93,6 +93,12 @@
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-app-performance-api</artifactId>
<version>${haoban-app-performance-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-api</artifactId>
<version>${gic-enterprise-api}</version>
<exclusions>
......@@ -142,6 +148,12 @@
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-marketing-pro-api</artifactId>
<version>${gic-marketing-pro-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-app-customer-api</artifactId>
<version>${haoban-app-customer-api}</version>
</dependency>
......
package com.gic.haoban.manage.service.dao.mapper.contact;
import com.gic.haoban.manage.service.entity.contact.TabContactConfig;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabContactConfigMapper {
/**
* 根据主键查询
*/
TabContactConfig queryById(@Param("configId") Long configId);
/**
* 根据 enterpriseId 查询配置
*/
TabContactConfig queryByEnterpriseId(@Param("enterpriseId") String enterpriseId);
/**
* 插入单条数据
*/
int insert(TabContactConfig tabContactConfig);
/**
* 批量插入
*/
int insertBatch(@Param("list") List<TabContactConfig> list);
/**
* 更新数据
*/
int update(TabContactConfig tabContactConfig);
/**
* 根据主键删除
*/
int deleteById(@Param("configId") Long configId);
}
\ No newline at end of file
......@@ -3,8 +3,10 @@ package com.gic.haoban.manage.service.dao.mapper.contact;
import com.gic.haoban.manage.api.qdto.chat.GroupChatActivitySearchQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO;
import com.gic.haoban.manage.service.entity.contact.TabContactFollow;
import com.gic.haoban.manage.service.pojo.bo.contact.listFollowCheckBO;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
......@@ -31,6 +33,8 @@ public interface TabContactFollowMapper {
List<TabContactFollow> pageFollow(@Param("enterpriseId") String enterpriseId,
@Param("search") ContactFollowSearchQDTO searchQDTO);
List<String> listFollowCheck(@Param("enterpriseId") String enterpriseId,
@Param("list")List<listFollowCheckBO> list);
/**
* 通过memberId查询最后一次跟进记录
* @param enterpriseId
......@@ -50,6 +54,21 @@ public interface TabContactFollowMapper {
List<TabContactFollow> queryByIds(@Param("followIds") List<Long> followIds);
/**
* 获取时间段内跟进类型
* @param enterpriseId
* @param clerkId
* @param memberId
* @param beginTime
* @param endTime
* @return
*/
String getFollowTypes(@Param("enterpriseId") String enterpriseId,
@Param("clerkId") String clerkId,
@Param("memberId") String memberId,
@Param("beginTime") Date beginTime,
@Param("endTime") Date endTime);
/**
* 统计总行数
*
* @param tabContactFollow 查询条件
......
......@@ -35,7 +35,7 @@ public interface TabContactLogMapper {
* @param clerkId
* @return
*/
TabContactLog queryLastLog(@Param("memberId")String memberId, @Param("clerkId")String clerkId, @Param("beginTime")Date beginTime, @Param("endTime")Date endTime);
List<TabContactLog> queryLastLog(@Param("memberId")String memberId, @Param("clerkId")String clerkId, @Param("beginTime")Date beginTime, @Param("endTime")Date endTime);
/**
* 统计总行数
......
package com.gic.haoban.manage.service.entity.contact;
import java.io.Serializable;
import java.util.Date;
/**
* 建联配置表(TabContactConfig)实体类
*
* @author TONGYI Lingma
* @since 2025-05-26 16:09:38
*/
public class TabContactConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 配置主键ID
*/
private Long configId;
/**
* 自动建联类型 10话务任务 20企微群发 30发送商品 40发送素材
*/
private String contactAuto;
/**
* 是否自动备注(0 否 1 是)
*/
private Integer remarkFlag;
/**
* 备注内容
*/
private String remarkContent;
/**
* 企业ID
*/
private String enterpriseId;
/**
* 是否删除(0 正常 1 删除)
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
public Long getConfigId() {
return configId;
}
public void setConfigId(Long configId) {
this.configId = configId;
}
public String getContactAuto() {
return contactAuto;
}
public void setContactAuto(String contactAuto) {
this.contactAuto = contactAuto;
}
public Integer getRemarkFlag() {
return remarkFlag;
}
public void setRemarkFlag(Integer remarkFlag) {
this.remarkFlag = remarkFlag;
}
public String getRemarkContent() {
return remarkContent;
}
public void setRemarkContent(String remarkContent) {
this.remarkContent = remarkContent;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ public class TabContactFollow implements Serializable {
*/
private String clerkCode;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联 6自动建联 7营销素材
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType;
......@@ -48,6 +48,22 @@ public class TabContactFollow implements Serializable {
* 跟进时间
*/
private Date followTime;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private Integer sourceType;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private Integer bizType;
/**
* 业务id(建联日志id)
*/
private String bizId;
/**
* 企业id
*/
......@@ -137,6 +153,30 @@ public class TabContactFollow implements Serializable {
this.followTime = followTime;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public String getEnterpriseId() {
return enterpriseId;
}
......
......@@ -59,6 +59,36 @@ public class TabContactLog implements Serializable {
* 成为潜客时间
*/
private Date potentialTime;
/**
* 潜客分
*/
private Integer potentialScore;
/**
* 来源日志id
*/
private Long sourceLogId;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private Integer sourceType;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private Integer bizType;
/**
* 业务冗余数据
*/
private String bizData;
/**
* 跟进记录组
*/
private String followTypes;
/**
* 企业id
*/
......@@ -172,6 +202,54 @@ public class TabContactLog implements Serializable {
this.potentialTime = potentialTime;
}
public Integer getPotentialScore() {
return potentialScore;
}
public void setPotentialScore(Integer potentialScore) {
this.potentialScore = potentialScore;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Long getSourceLogId() {
return sourceLogId;
}
public void setSourceLogId(Long sourceLogId) {
this.sourceLogId = sourceLogId;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getBizData() {
return bizData;
}
public void setBizData(String bizData) {
this.bizData = bizData;
}
public String getFollowTypes() {
return followTypes;
}
public void setFollowTypes(String followTypes) {
this.followTypes = followTypes;
}
public String getEnterpriseId() {
return enterpriseId;
}
......
......@@ -88,6 +88,19 @@ public class TabContactOrder implements Serializable {
*/
private Integer potentialScore;
/**
* 金字塔分层信息
*/
private String groupInfo;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private Integer sourceType;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private Integer bizType;
/**
* 是否删除
*/
private Integer deleteFlag;
......@@ -256,6 +269,30 @@ public class TabContactOrder implements Serializable {
this.potentialScore = potentialScore;
}
public String getGroupInfo() {
return groupInfo;
}
public void setGroupInfo(String groupInfo) {
this.groupInfo = groupInfo;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
......
package com.gic.haoban.manage.service.pojo.bo.contact;
import java.io.Serializable;
import java.util.Date;
public class listFollowCheckBO implements Serializable {
private static final long serialVersionUID = 973688857967269974L;
/**
* 会员id
*/
private String memberId;
/**
* 导购id
*/
private String clerkId;
/**
* 互动时间
*/
private Date followTime;
public listFollowCheckBO() {
}
public listFollowCheckBO(String memberId, String clerkId, Date followTime) {
this.memberId = memberId;
this.clerkId = clerkId;
this.followTime = followTime;
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public Date getFollowTime() {
return followTime;
}
public void setFollowTime(Date followTime) {
this.followTime = followTime;
}
}
\ No newline at end of file
......@@ -914,13 +914,17 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
if(qwDTO.needOpenUserId3th()) {
wxUserId = staff.getWxOpenUseId() ;
}
Long sendTimeSec = sendTime.getTime() / 1000;
// 发送到群
List<QywxGroupMessageInfoDTO> msgList = this.queryGroupMsg(groupMsgChatType,startTime, endTime, qwDTO, wxUserId);
if(CollectionUtils.isNotEmpty(msgList)) {
if(msgList.size()==0) {
return msgList.get(0).getMsgId() ;
}else {
return msgList.get(msgList.size()-1).getMsgId() ;
return msgList.stream()
.min(Comparator.comparingLong(msg -> Math.abs(msg.getCreateTime() - sendTimeSec)))
.map(QywxGroupMessageInfoDTO::getMsgId)
.orElse(null);
}
}
return null ;
......
package com.gic.haoban.manage.service.service.contact;
import com.gic.haoban.manage.api.dto.contact.ContactConfigDTO;
public interface ContactConfigService {
/**
* 保存建联配置
*
* @param contactConfig
*/
void saveContactConfig(ContactConfigDTO contactConfig);
/**
* 获取建联配置
* @param enterpriseId
* @return
*/
ContactConfigDTO getContactConfig(String enterpriseId);
}
package com.gic.haoban.manage.service.service.contact;
import com.gic.api.base.commons.BusinessException;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO;
import com.gic.haoban.manage.service.entity.contact.TabContactLog;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface ContactLogService {
/**
* 是否可以建联判断
* @param enterpriseId
* @param memberId
* @param clerkDTO
* @return
*/
Integer contactCheck(String enterpriseId, String memberId, ClerkDTO clerkDTO,Integer bizType) ;
/**
* 保存建联记录
......@@ -17,12 +28,24 @@ public interface ContactLogService {
void saveContactLog(ContactLogQDTO qdto) throws BusinessException;
/**
* 自动建联
* @param qdto
*/
void autoContactLog(ContactLogQDTO qdto);
/**
* 同步建联
* @param qdto
*/
void syncContactLog(ContactLogQDTO qdto);
/**
* 清除建联状态
*
* @param memberId
* @param clearType 1 消费清除 2 换绑主导购
*/
void clearContactLog(String memberId, Integer clearType,String clerkId);
void clearContactLog(String enterpriseId,String memberId, Integer clearType,String clerkId);
/**
* 获取最近一条有效建联记录
......@@ -33,10 +56,19 @@ public interface ContactLogService {
TabContactLog getClerkContactTime(String memberId);
/**
* 根据时间获取最近一条建联记录
* 获取每个业务最近一条有效建联记录
* @param memberId
* @return
*/
List<TabContactLog> getClerkContactTimeList(String memberId);
/**
* 获取最近一条建联记录
* @param memberId
* @param clerkId
* @param beginTime
* @param endTime
* @return
*/
TabContactLog getLastByTime(String memberId, Date beginTime,Date endTime);
Map<Integer,TabContactLog> getLastByTime(String memberId, String clerkId, Date beginTime, Date endTime);
}
......@@ -23,6 +23,7 @@ import com.gic.haoban.app.customer.dto.contact.ContactParamDTO;
import com.gic.haoban.app.customer.dto.contact.ContactSumDTO;
import com.gic.haoban.app.customer.service.api.service.CustomerApiService;
import com.gic.haoban.common.utils.DateUtil;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import com.gic.haoban.manage.service.dao.mapper.content.holo.HoloDataSource;
import com.gic.haoban.manage.service.pojo.bo.contact.ContactDataBO;
import com.gic.store.goods.dto.potential.PlatformPotentialCustomerOutDTO;
......@@ -178,6 +179,7 @@ public class ContactAdaptor {
ContactParamDTO contact = new ContactParamDTO();
contact.setRuleJSON(JSON.toJSONString(result));
contact.setContactType(0);
contact.setBizType(ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType());
params.setStoreId(storeId);
params.setClerkId(clerkId);
params.setClerkType(clerkTypeStr);
......
package com.gic.haoban.manage.service.service.contact.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.dto.contact.ContactConfigDTO;
import com.gic.haoban.manage.service.dao.mapper.contact.TabContactConfigMapper;
import com.gic.haoban.manage.service.entity.contact.TabContactConfig;
import com.gic.haoban.manage.service.service.contact.ContactConfigService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Service("contactConfigService")
public class ContactConfigServiceImpl implements ContactConfigService {
private static final Logger logger = LogManager.getLogger(ContactConfigService.class);
@Autowired
private TabContactConfigMapper contactConfigMapper;
@Override
public void saveContactConfig(ContactConfigDTO contactConfig) {
logger.info("保存联系配置信息:{}", JSON.toJSONString(contactConfig));
if (contactConfig.getContactAutoList() == null) {
contactConfig.setContactAutoList(Collections.emptyList());
}
if (contactConfig.getRemarkContentList() == null) {
contactConfig.setRemarkContentList(Collections.emptyList());
}
String enterpriseId = contactConfig.getEnterpriseId();
TabContactConfig config = contactConfigMapper.queryByEnterpriseId(enterpriseId);
if (config != null) {
config.setRemarkFlag(contactConfig.getRemarkFlag());
config.setContactAuto(contactConfig.getContactAutoList().stream().map(String::valueOf).collect(Collectors.joining(",")));
config.setRemarkContent(JSON.toJSONString(contactConfig.getRemarkContentList()));
contactConfigMapper.update(config);
}else {
config = EntityUtil.changeEntityNew(TabContactConfig.class, contactConfig);
config.setConfigId(UniqueIdUtils.uniqueLong());
config.setContactAuto(contactConfig.getContactAutoList().stream().map(String::valueOf).collect(Collectors.joining(",")));
config.setRemarkContent(JSON.toJSONString(contactConfig.getRemarkContentList()));
contactConfigMapper.insert(config);
}
}
@Override
public ContactConfigDTO getContactConfig(String enterpriseId) {
TabContactConfig config = contactConfigMapper.queryByEnterpriseId(enterpriseId);
if (config == null) {
return null;
}
ContactConfigDTO contactConfigDTO = EntityUtil.changeEntityNew(ContactConfigDTO.class, config);
List<Integer> contactAutoList = Optional.ofNullable(config.getContactAuto())
.filter(StringUtils::isNotBlank)
.map(s -> Arrays.stream(s.split(",")).map(Integer::valueOf).collect(Collectors.toList()))
.orElse(Collections.emptyList());
contactConfigDTO.setContactAutoList(contactAutoList);
List<String> remarkContentList = Optional.ofNullable(config.getRemarkContent())
.filter(StringUtils::isNotBlank)
.map(x -> JSONArray.parseArray(x, String.class))
.orElse(Collections.emptyList());
contactConfigDTO.setRemarkContentList(remarkContentList);
return contactConfigDTO;
}
}
......@@ -23,6 +23,9 @@ import com.gic.haoban.manage.service.service.ESMemberInfoService;
import com.gic.haoban.manage.service.service.contact.ContactLogService;
import com.gic.haoban.manage.service.service.contact.ContactOrderService;
import com.gic.member.api.dto.es.MemberDataDTO;
import com.gic.member.tag.api.dto.MemberTagGroupDetailDTO;
import com.gic.member.tag.api.dto.MemberTagGroupSimpleDTO;
import com.gic.member.tag.api.service.MemberTagGroupApiService;
import com.gic.order.api.dto.resp.OrderInfoResp;
import com.gic.order.api.dto.resp.OrderItemResp;
import com.github.pagehelper.PageHelper;
......@@ -49,6 +52,8 @@ public class ContactOrderServiceImpl implements ContactOrderService {
@Autowired
private ESMemberInfoService esMemberInfoService;
@Autowired
private MemberTagGroupApiService memberTagGroupApiService;
@Autowired
private StoreService storeService;
@Autowired
private ClerkService clerkService;
......@@ -70,6 +75,11 @@ public class ContactOrderServiceImpl implements ContactOrderService {
logger.info("订单不是销售单");
return false;
}
long noGiveCount = orderInfoResp.getOrderItems().stream().filter(x -> !Objects.equals(x.getProType(), 2)).count();
if (noGiveCount == 0) {
logger.info("都是赠品订单:{}", orderId);
return false;
}
String enterpriseId = orderInfoResp.getEnterpriseId();
String memberId = orderInfoResp.getMemberId();
logger.info("建联处理订单:{},memberId:{}", orderId,memberId);
......@@ -86,47 +96,79 @@ public class ContactOrderServiceImpl implements ContactOrderService {
contactBeginTime = DateUtil.offsetDay(receiptsDate, -1);
}
TabContactLog lastContactLog = contactLogService.getLastByTime(memberId, contactBeginTime,receiptsDate);
if (lastContactLog == null) {
Map<Integer, TabContactLog> contactMap = contactLogService.getLastByTime(memberId, null, contactBeginTime, receiptsDate);
if (contactMap == null || contactMap.isEmpty()) {
return false;
}
logger.info("建联转化订单建联信息:{}", JSON.toJSONString(lastContactLog));
TabContactOrder contactOrder = new TabContactOrder();
contactOrder.setOrderId(orderId);
contactOrder.setMemberId(memberId);
contactOrder.setOrderNumber(orderInfoResp.getOrderNo());
Double paidAmount = orderInfoResp.getPayAmount();
if (Objects.equals(PlatformChannelEnum.C_WECHAT_MINI.getChannelCode(), channelCode)) {
paidAmount = paidAmount + (Objects.isNull(orderInfoResp.getDeliveryPaymentAmount()) ? 0.0 : orderInfoResp.getDeliveryPaymentAmount());
}
contactOrder.setPaidAmount(paidAmount);
contactOrder.setProductCount(orderInfoResp.getGoodsCount());
contactOrder.setPayTime(orderInfoResp.getReceiptsDate());
contactOrder.setReceiptsDate(orderInfoResp.getReceiptsDate());
List<OrderItemResp> orderItems = orderInfoResp.getOrderItems();
if (CollectionUtils.isNotEmpty(orderItems)) {
List<ContactOrderGoodsInfoDTO> goodsInfoDTOS = JSONObject.parseArray(JSON.toJSONString(orderItems), ContactOrderGoodsInfoDTO.class);
contactOrder.setGoodsInfo(JSON.toJSONString(goodsInfoDTOS));
}
contactOrder.setChannelCode(channelCode);
contactOrder.setChannelType(channelType);
contactOrder.setClerkId(lastContactLog.getClerkId());
contactOrder.setClerkCode(lastContactLog.getClerkCode());
contactOrder.setClerkName(lastContactLog.getClerkName());
contactOrder.setStoreId(lastContactLog.getStoreId());
contactOrder.setContactLogId(lastContactLog.getLogId());
contactOrder.setContactTime(lastContactLog.getContactTime());
contactOrder.setPotentialTime(lastContactLog.getPotentialTime());
contactOrder.setEnterpriseId(lastContactLog.getEnterpriseId());
for (Map.Entry<Integer, TabContactLog> entry : contactMap.entrySet()) {
Integer key = entry.getKey();
TabContactLog lastContactLog = entry.getValue();
if (lastContactLog == null) {
continue;
}
logger.info("建联转化订单建联信息:{}", JSON.toJSONString(lastContactLog));
TabContactOrder contactOrder = new TabContactOrder();
contactOrder.setOrderId(orderId);
contactOrder.setMemberId(memberId);
contactOrder.setOrderNumber(orderInfoResp.getOrderNo());
Double paidAmount = orderInfoResp.getPayAmount();
if (Objects.equals(PlatformChannelEnum.C_WECHAT_MINI.getChannelCode(), channelCode)) {
paidAmount = paidAmount + (Objects.isNull(orderInfoResp.getDeliveryPaymentAmount()) ? 0.0 : orderInfoResp.getDeliveryPaymentAmount());
}
contactOrder.setPaidAmount(paidAmount);
contactOrder.setProductCount(orderInfoResp.getGoodsCount());
contactOrder.setPayTime(orderInfoResp.getReceiptsDate());
contactOrder.setReceiptsDate(orderInfoResp.getReceiptsDate());
List<OrderItemResp> orderItems = orderInfoResp.getOrderItems();
if (CollectionUtils.isNotEmpty(orderItems)) {
List<ContactOrderGoodsInfoDTO> goodsInfoDTOS = JSONObject.parseArray(JSON.toJSONString(orderItems), ContactOrderGoodsInfoDTO.class);
contactOrder.setGoodsInfo(JSON.toJSONString(goodsInfoDTOS));
}
contactOrder.setChannelCode(channelCode);
contactOrder.setChannelType(channelType);
contactOrder.setClerkId(lastContactLog.getClerkId());
contactOrder.setClerkCode(lastContactLog.getClerkCode());
contactOrder.setClerkName(lastContactLog.getClerkName());
contactOrder.setStoreId(lastContactLog.getStoreId());
contactOrder.setContactLogId(lastContactLog.getLogId());
contactOrder.setContactTime(lastContactLog.getContactTime());
contactOrder.setPotentialTime(lastContactLog.getPotentialTime());
contactOrder.setSourceType(lastContactLog.getSourceType());
contactOrder.setBizType(lastContactLog.getBizType());
contactOrder.setEnterpriseId(lastContactLog.getEnterpriseId());
JSONObject jsonObject = esMemberInfoService.queryDataSingle(enterpriseId, memberId, "potentialScore");
if (jsonObject != null && jsonObject.getInteger("potentialScore") != null) {
contactOrder.setPotentialScore(jsonObject.getInteger("potentialScore"));
JSONObject jsonObject = esMemberInfoService.queryDataSingle(enterpriseId, memberId, "potentialScore");
if (jsonObject != null && jsonObject.getInteger("potentialScore") != null) {
contactOrder.setPotentialScore(jsonObject.getInteger("potentialScore"));
}
String groupInfo = convertGroupInfo(enterpriseId, memberId);
contactOrder.setGroupInfo(groupInfo);
contactOrderMapper.insert(contactOrder);
}
contactOrderMapper.insert(contactOrder);
return true;
}
private String convertGroupInfo(String enterpriseId, String memberId) {
JSONObject jo = new JSONObject();
try {
MemberTagGroupDetailDTO memberTagGroupDetail = memberTagGroupApiService.getMemberTagGroupDetail(enterpriseId, memberId, "1");
if (memberTagGroupDetail == null) {
return jo.toJSONString();
}
MemberTagGroupSimpleDTO allChannelMemberGradeGroup = memberTagGroupDetail.getAllChannelMemberGradeGroup();
if (allChannelMemberGradeGroup != null) {
jo.put("allChannelMemberGradeGroup", allChannelMemberGradeGroup.getGroupName());
}
MemberTagGroupSimpleDTO memberGradeGroup = memberTagGroupDetail.getMemberGradeGroup();
if (memberGradeGroup != null) {
jo.put("memberGradeGroup", memberGradeGroup.getGroupName());
}
} catch (Exception e) {
logger.info("获取金字塔分层信息异常",e);
}
return jo.toJSONString();
}
@Override
public Page<ContactOrderDetailDTO> pageContactOrder(String enterpriseId, ContactOrderSearchQDTO searchQDTO, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo);
......
......@@ -6,6 +6,7 @@ import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto;
import com.gic.enterprise.api.dto.enterprise.EnterpriseUsingStatusDTO;
import com.gic.enterprise.api.service.EnterpriseUseForbidService;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import com.gic.redis.data.util.RedisUtil;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
......@@ -134,6 +135,17 @@ public class EnterpriseAdaptor {
return StringUtils.equals(cache, "1");
}
public boolean checkEnterpriseHasRightByContactBizType(String enterpriseId,Integer contactBizType) {
if (Objects.equals(contactBizType, ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType())) {
return checkEnterpriseHasRights(enterpriseId,Lists.newArrayList(EnterpriseServiceEnum.POTENTIAL.getRightMenuCode()));
} else if (Objects.equals(contactBizType, ContactBizTypeEnum.OPPORTUNITY_CUSTOMER.getType())) {
return checkEnterpriseHasRights(enterpriseId,Lists.newArrayList(EnterpriseServiceEnum.OBJECTIVES.getRightMenuCode()));
} else {
return checkEnterpriseHasRights(enterpriseId, Lists.newArrayList(EnterpriseServiceEnum.POTENTIAL.getRightMenuCode()))
|| checkEnterpriseHasRights(enterpriseId, Lists.newArrayList(EnterpriseServiceEnum.OBJECTIVES.getRightMenuCode()));
}
}
public boolean checkEnterpriseHasRight(String enterpriseId,String rightMenuCode) {
return checkEnterpriseHasRights(enterpriseId,Lists.newArrayList(rightMenuCode));
}
......
......@@ -32,7 +32,6 @@ import com.github.pagehelper.PageHelper;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......
......@@ -31,12 +31,13 @@ public class RouterApiServiceImpl implements RouterApiService {
return ServiceResponse.success();
}
ClerkAddEventParam clerkAddEventParam = JSONObject.parseObject(params, ClerkAddEventParam.class);
String enterpriseId = clerkAddEventParam.getEnterpriseId();
String memberId = clerkAddEventParam.getMemberId();
Integer changeType = clerkAddEventParam.getChangeType();
String clerkId = clerkAddEventParam.getClerkId();
if (Objects.equals(changeType, 1)) {
// 换绑主导购清除建联状态
contactLogService.clearContactLog(memberId, 2, clerkId);
contactLogService.clearContactLog(enterpriseId,memberId, 2, clerkId);
}
return ServiceResponse.success();
}
......
package com.gic.haoban.manage.service.service.out.impl.contact;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.contact.ContactConfigDTO;
import com.gic.haoban.manage.api.service.contact.ContactConfigApiService;
import com.gic.haoban.manage.service.service.contact.ContactConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("contactConfigApiService")
public class ContactConfigApiServiceImpl implements ContactConfigApiService {
@Autowired
private ContactConfigService contactConfigService;
@Override
public ServiceResponse<Void> saveContactConfig(ContactConfigDTO contactConfig) {
contactConfigService.saveContactConfig(contactConfig);
return ServiceResponse.success();
}
@Override
public ServiceResponse<ContactConfigDTO> getContactConfig(String enterpriseId) {
ContactConfigDTO config = contactConfigService.getContactConfig(enterpriseId);
return ServiceResponse.success(config);
}
}
......@@ -2,12 +2,14 @@ package com.gic.haoban.manage.service.service.out.impl.contact;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Constant;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import com.gic.haoban.manage.api.dto.contact.ContactFollowDTO;
import com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowBatchQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO;
......@@ -21,6 +23,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
......@@ -74,6 +77,7 @@ public class ContactFollowApiServiceImpl implements ContactFollowApiService {
followQDTO.setClerkCode(clerkDTO.getClerkCode());
followQDTO.setFollowRemark(clerkDTO.getClerkName() + qdto.getFollowRemark());
followQDTO.setFollowTime(x.getFollowTime());
followQDTO.setGoodsInfoList(qdto.getGoodsInfoList());
followQDTO.setEnterpriseId(clerkDTO.getEnterpriseId());
return followQDTO;
}).collect(Collectors.toList());
......
package com.gic.haoban.manage.service.service.out.impl.contact;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BusinessException;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.contact.ContactLogDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactLogCheckQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO;
import com.gic.haoban.manage.api.service.contact.ContactLogApiService;
import com.gic.haoban.manage.service.entity.contact.TabContactLog;
import com.gic.haoban.manage.service.service.contact.ContactLogService;
import com.gic.member.api.dto.MemberStoreClerkDTO;
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.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Created by wangzubo on 2022/11/1.
*/
@Slf4j
@Service("contactLogApiService")
public class ContactLogApiServiceImpl implements ContactLogApiService {
@Autowired
private ContactLogService contactLogService;
@Autowired
private ClerkService clerkService;
@Autowired
private MemberService memberService;
@Override
public ServiceResponse<ContactLogDTO> getClerkContactTime(String memberId) {
......@@ -28,6 +45,16 @@ public class ContactLogApiServiceImpl implements ContactLogApiService {
}
@Override
public ServiceResponse<List<ContactLogDTO>> getClerkContactTimeList(String memberId) {
List<TabContactLog> list = contactLogService.getClerkContactTimeList(memberId);
if (list == null) {
return ServiceResponse.success(new ArrayList<>());
}
List<ContactLogDTO> dtos = EntityUtil.changeEntityListNew(ContactLogDTO.class, list);
return ServiceResponse.success(dtos);
}
@Override
public ServiceResponse<Void> saveContactLog(ContactLogQDTO qdto) {
try {
contactLogService.saveContactLog(qdto);
......@@ -37,4 +64,38 @@ public class ContactLogApiServiceImpl implements ContactLogApiService {
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> autoContactLogForMQ(String message) {
if (StringUtils.isBlank(message)) {
return ServiceResponse.success();
}
ContactLogQDTO contactLogQDTO = JSONObject.parseObject(message, ContactLogQDTO.class);
Integer contactAutoType = contactLogQDTO.getContactAutoType();
if (contactAutoType != null) {
contactLogService.autoContactLog(contactLogQDTO);
}else {
contactLogService.syncContactLog(contactLogQDTO);
}
return ServiceResponse.success();
}
@Override
public ServiceResponse<Boolean> contactCheck(ContactLogCheckQDTO checkQDTO) {
ClerkDTO clerkDTO = clerkService.getclerkById(checkQDTO.getClerkId());
if (clerkDTO == null) {
return ServiceResponse.success(Boolean.FALSE);
}
MemberStoreClerkDTO memberStoreClerk = memberService.getMemberStoreClerk(checkQDTO.getMemberId());
if (memberStoreClerk == null) {
log.info("无专属导购无法建联");
return ServiceResponse.success(Boolean.FALSE);
}
String mainClerkId = memberStoreClerk.getClerkId();
if (!Objects.equals(mainClerkId, checkQDTO.getClerkId())) {
log.info("非专属导购无法建联");
return ServiceResponse.success(Boolean.FALSE);
}
Integer contactCheck = contactLogService.contactCheck(checkQDTO.getEnterpriseId(), checkQDTO.getMemberId(), clerkDTO, checkQDTO.getBizType());
return ServiceResponse.success(contactCheck != null);
}
}
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.constants.Manage3Constants;
import com.gic.haoban.manage.api.dto.contact.ContactOrderDetailDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactOrderQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactOrderSearchQDTO;
......@@ -47,12 +48,12 @@ public class ContactOrderApiServiceImpl implements ContactOrderApiService {
}
OrderInfoResp result = serviceResponse.getResult();
boolean clearFlag = CollectionUtils.isNotEmpty(result.getOrderItems()) && result.getPaidAmount() > 0
&& (result.getReceiptsDate() != null && DateUtil.compare(DateUtil.offsetDay(new Date(), -14), result.getReceiptsDate()) <= 0);
&& (result.getReceiptsDate() != null && DateUtil.compare(DateUtil.offsetDay(new Date(), -Manage3Constants.CONTACT_ORDER_LIMIT_DAY), result.getReceiptsDate()) <= 0);
log.info("获取订单时间,orderId:{},单据时间:{},应收:{}", result.getOrderId(),result.getReceiptsDate(),result.getPaidAmount());
boolean contactOrder = contactOrderService.saveContactOrder(result);
log.info("clearFlag:{},contactOrder:{}", clearFlag, contactOrder);
if (clearFlag || contactOrder) {
contactLogService.clearContactLog(memberId, 1,"");
contactLogService.clearContactLog(enterpriseId,memberId, 1,"");
}
return ServiceResponse.success();
}
......
......@@ -54,13 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
......@@ -281,11 +275,12 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
log.info("当前时间处于消息禁发时间, 忽略{}", cn.hutool.core.date.DateUtil.format(now, "yyyy-MM-dd HH:mm:ss"));
return ServiceResponse.success();
}
List<String> enterpriseIds = groupMessageService.hasMaterialRightEnterprise(EnterpriseAdaptor.MaterialLevel.LOW.getCode());
if (CollectionUtils.isEmpty(enterpriseIds)) {
Map<String, List<String>> map = groupMessageService.weekMonthEnterprise();
if (MapUtil.isEmpty(map)) {
log.info("开通内容权限的企业为空");
return ServiceResponse.success();
}
Set<String> enterpriseIds = map.keySet();
Date startTime = null;
// 如果是8点那次的执行 需要获取 23 ~ 8点的数据
if (checkIsTodayFirst(now)) {
......
......@@ -5,31 +5,36 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BusinessException;
import com.gic.api.base.commons.JSONResponse;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.content.api.utils.MqUtils;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.dto.anaylsis.ClerkShareGoodsLogDTO;
import com.gic.haoban.manage.api.dto.send.DealQwSendDTO;
import com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowBatchQDTO;
import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.api.service.MessageApiService;
import com.gic.haoban.manage.api.service.content.MaterialShareLogApiService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.send.QwSendLogMapper;
import com.gic.haoban.manage.service.dao.mapper.send.QwSendMsgMapper;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.entity.send.TabQwSendLog;
import com.gic.haoban.manage.service.entity.send.TabQwSendMsg;
import com.gic.haoban.manage.service.pojo.bo.send.FinishQwSendBO;
import com.gic.haoban.manage.service.pojo.bo.send.GroupSendResultBO;
import com.gic.haoban.manage.service.service.chat.GroupChatPlanService;
import com.gic.haoban.manage.service.service.content.impl.GroupMessageServiceImpl;
import com.gic.haoban.manage.service.service.send.QwSendMsgService;
import com.gic.member.api.constant.MemberExtKeyEnum;
import com.gic.member.api.dto.member.req.MemberExtraPropertyReq;
import com.gic.member.api.service.extra.MemberExtraPropertyApiService;
import com.google.common.collect.Lists;
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.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
......@@ -55,6 +60,10 @@ public class QwSendMsgServiceImpl implements QwSendMsgService {
private MemberUnionidRelatedApiService memberUnionidRelatedApiService;
@Autowired
private MessageApiService messageApiService;
@Autowired
private MaterialShareLogApiService materialShareLogApiService;
@Autowired
private MemberExtraPropertyApiService memberExtraPropertyApiService;
@Override
public void finishQwSend(DealQwSendDTO.FinishQwSendBO finishQwSendBO,Integer tryCount) {
......@@ -83,7 +92,8 @@ public class QwSendMsgServiceImpl implements QwSendMsgService {
dealQwSendDTO.setRefreshType(2);
DealQwSendDTO.QwSendMsgBO qwSendMsgBO = EntityUtil.changeEntityByJSON(DealQwSendDTO.QwSendMsgBO.class, qwSendMsg);
dealQwSendDTO.setQwSendMsg(qwSendMsgBO);
MqUtils.sendMessageToMQ("qwSendRefreshByMQ", JSON.toJSONString(dealQwSendDTO), 60);
dealQwSendDTO.setFinishQwSend(finishQwSendBO);
MqUtils.sendMessageToMQ("qwSendRefreshByMQ", JSON.toJSONString(dealQwSendDTO), 30);
}else {
if (tryCount != null && tryCount >= 5) {
return;
......@@ -166,9 +176,9 @@ public class QwSendMsgServiceImpl implements QwSendMsgService {
if (StringUtils.isBlank(log.getMemberId())) {
return;
}
memberList.add(new ContactFollowBatchQDTO.MemberFollow(log.getMemberId(), log.getSendTime()));
memberList.add(new ContactFollowBatchQDTO.MemberFollow(log.getMemberId(), log.getExternalUserId(), log.getSendTime()));
});
saveFollowMQ(qwSendMsg.getEnterpriseId(),qwSendMsg.getClerkId(), memberList);
saveFollowMQ(qwSendMsg.getEnterpriseId(),qwSendMsg.getClerkId(), memberList,dealQwSendDTO.getFinishQwSend());
}
entities.clear();
}
......@@ -245,16 +255,62 @@ public class QwSendMsgServiceImpl implements QwSendMsgService {
return EntityUtil.changeEntityListByJSON(GroupSendResultBO.class, list);
}
private void saveFollowMQ(String enterpriseId,String clerkId,List<ContactFollowBatchQDTO.MemberFollow> memberList) {
private void saveFollowMQ(String enterpriseId,String clerkId,List<ContactFollowBatchQDTO.MemberFollow> memberList,DealQwSendDTO.FinishQwSendBO finishQwSendBO) {
if (org.apache.commons.collections.CollectionUtils.isEmpty(memberList)) {
return;
}
if (finishQwSendBO == null) {
return;
}
Integer followType = null;
String followRemark = null;
Integer bizType = finishQwSendBO.getBizType();
List<ClerkShareGoodsLogDTO> shareGoodsList = finishQwSendBO.getShareGoodsList();
List<String> goodsInfoList = null;
if (Objects.equals(bizType, 1)) {
followType = ContactFollowTypeEnum.MATERIAL.getCode();
followRemark = "向客户发送了营销素材";
} else if (Objects.equals(bizType, 2)) {
followType = ContactFollowTypeEnum.PRODUCT.getCode();
followRemark = "向客户发送了" + shareGoodsList.size() + "款商品";
goodsInfoList = shareGoodsList.stream().map(ClerkShareGoodsLogDTO::getBizId).collect(Collectors.toList());
} else {
return;
}
ContactFollowBatchQDTO batchQDTO = new ContactFollowBatchQDTO();
batchQDTO.setEnterpriseId(enterpriseId);
batchQDTO.setMemberList(memberList);
batchQDTO.setClerkId(clerkId);
batchQDTO.setFollowType(ContactFollowTypeEnum.WECHAT_GROUP_SEND.getCode());
batchQDTO.setFollowRemark("通过企微群发向客户发送了消息");
batchQDTO.setFollowType(followType);
batchQDTO.setFollowRemark(followRemark);
batchQDTO.setGoodsInfoList(goodsInfoList);
MqUtils.sendMessageToMQ("saveBatchFollowForMQ", JSON.toJSONString(batchQDTO));
if (Objects.equals(bizType, 2)) {
saveShareMaterialLog(enterpriseId, shareGoodsList, memberList);
}
}
private void saveShareMaterialLog(String enterpriseId,List<ClerkShareGoodsLogDTO> shareGoodsList,List<ContactFollowBatchQDTO.MemberFollow> memberList) {
List<ClerkShareGoodsLogDTO> list = Lists.newArrayList();
for (ContactFollowBatchQDTO.MemberFollow memberInfo : memberList) {
for (ClerkShareGoodsLogDTO goodsLogDTO : shareGoodsList) {
ClerkShareGoodsLogDTO temp = EntityUtil.changeEntityByJSON(ClerkShareGoodsLogDTO.class, goodsLogDTO);
temp.setExternalUserId(memberInfo.getExternalUserId());
temp.setMemberId(memberInfo.getMemberId());
list.add(temp);
}
//更新会员推荐时间更新
MemberExtraPropertyReq memberExtraPropertyReq = new MemberExtraPropertyReq();
memberExtraPropertyReq.setEnterpriseId(enterpriseId);
memberExtraPropertyReq.setMemberId(memberInfo.getMemberId());
memberExtraPropertyReq.setExtraKey(MemberExtKeyEnum.MEMBER_GOODS_SUGGEST_TIME.key());
memberExtraPropertyReq.setExtraValue(memberInfo.getFollowTime().getTime());
try {
memberExtraPropertyApiService.updateMemberExtraProperty(memberExtraPropertyReq);
} catch (Exception e) {
log.info("更新会员推荐时间更新异常,", e);
}
}
materialShareLogApiService.saveClerkShareRecommendLog(list);
}
}
......@@ -147,6 +147,7 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.contact.ContactFollowApiService" ref="contactFollowApiService"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.contact.ContactLogApiService" ref="contactLogApiService"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.contact.ContactOrderApiService" ref="contactOrderApiService"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.contact.ContactConfigApiService" ref="contactConfigApiService"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.send.QwSendApiService" ref="qwSendApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/>
......@@ -179,6 +180,9 @@
<dubbo:reference id="customerApiService"
interface="com.gic.haoban.app.customer.service.api.service.CustomerApiService" timeout="10000"
retries="0" check="false"/>
<dubbo:reference id="objectivesManageApiService"
interface="com.gic.haoban.app.objectives.api.service.ObjectivesManageApiService" timeout="10000"
retries="0" check="false"/>
<dubbo:reference id="qywxTagSyncApiService"
interface="com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService" timeout="10000"
......@@ -208,6 +212,7 @@
<dubbo:reference interface="com.gic.marketing.api.service.SmsService" id="smsService" timeout="10000" retries="0"/>
<dubbo:reference interface="com.gic.marketing.api.service.AccountOverdueSmsSendService" id="accountOverdueSmsSendService" timeout="10000" retries="0"/>
<dubbo:reference interface="com.gic.marketing.api.service.CouponReferAlarmService" id="couponReferAlarmService" retries="0" check="false"/>
<dubbo:reference interface="com.gic.marketing.pro.api.service.ai.AiMemberLogApiService" id="aiMemberLogApiService" retries="0" check="false" timeout="10000"/>
<dubbo:reference interface="com.gic.thirdparty.api.service.VoiceService" id="voiceService" timeout="10000" retries="0"/>
<dubbo:reference interface="com.gic.thirdparty.api.service.CommunicationService" id="communicationService" timeout="10000" retries="0"/>
......@@ -256,6 +261,7 @@
<dubbo:reference interface="com.gic.clerk.api.service.MenuApiService" id="menuApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.member.ext.api.service.MemberGrowthWriteApiService" id="memberGrowthWriteApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.member.api.service.integral.IntegralWriteApiService" id="integralWriteApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference id="memberExtraPropertyApiService" interface="com.gic.member.api.service.extra.MemberExtraPropertyApiService" timeout="100000" retries="0" check="false" />
<dubbo:reference id="memberTagEsApiService" interface="com.gic.member.tag.api.service.MemberTagEsApiService" timeout="100000" retries="0" check="false"/>
<dubbo:reference id="memberCrowdApiService" interface="com.gic.member.ext.api.service.MemberCrowdApiService" timeout="10000" retries="0" check="false"/>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.contact.TabContactConfigMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.contact.TabContactConfig">
<id column="config_id" property="configId" />
<result column="contact_auto" property="contactAuto" />
<result column="remark_flag" property="remarkFlag" />
<result column="remark_content" property="remarkContent" />
<result column="enterprise_id" property="enterpriseId" />
<result column="delete_flag" property="deleteFlag" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
config_id, contact_auto, remark_flag, remark_content, enterprise_id, delete_flag, create_time, update_time
</sql>
<select id="queryById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM tab_contact_config
WHERE config_id = #{configId}
</select>
<select id="queryByEnterpriseId" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM tab_contact_config
WHERE enterprise_id = #{enterpriseId}
AND delete_flag = 0
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="configId">
INSERT INTO tab_contact_config (
config_id, contact_auto, remark_flag, remark_content, enterprise_id
)
VALUES (
#{configId}, #{contactAuto}, #{remarkFlag}, #{remarkContent}, #{enterpriseId}
)
</insert>
<insert id="insertBatch">
INSERT INTO tab_contact_config (
config_id, contact_auto, remark_flag, remark_content, enterprise_id, delete_flag, create_time, update_time
)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.configId}, #{item.contactAuto}, #{item.remarkFlag}, #{item.remarkContent}, #{item.enterpriseId}, #{item.deleteFlag}, #{item.createTime}, #{item.updateTime})
</foreach>
</insert>
<update id="update">
UPDATE tab_contact_config
<set>
<if test="contactAuto != null">contact_auto = #{contactAuto},</if>
<if test="remarkFlag != null">remark_flag = #{remarkFlag},</if>
<if test="remarkContent != null">remark_content = #{remarkContent},</if>
</set>
WHERE config_id = #{configId}
</update>
<delete id="deleteById">
DELETE FROM tab_contact_config
WHERE config_id = #{configId}
</delete>
</mapper>
\ No newline at end of file
......@@ -14,6 +14,9 @@
<result column="follow_material" property="followMaterial" />
<result column="goods_info" property="goodsInfo" />
<result column="follow_time" property="followTime" />
<result column="source_type" property="sourceType" />
<result column="biz_type" property="bizType" />
<result column="biz_id" property="bizId" />
<result column="enterprise_id" property="enterpriseId" />
<result column="delete_flag" property="deleteFlag" />
<result column="create_time" property="createTime" />
......@@ -21,10 +24,10 @@
</resultMap>
<sql id="Base_Column_List">
follow_id, member_id, clerk_id, clerk_code, follow_type,follow_remark, follow_material, goods_info, follow_time, enterprise_id, delete_flag, create_time, update_time
follow_id, member_id, clerk_id, clerk_code, follow_type,follow_remark, follow_material, goods_info, follow_time, source_type,biz_type,biz_id,enterprise_id, delete_flag, create_time, update_time
</sql>
<sql id="Alias_Base_Column_List">
t.follow_id, t.member_id, t.clerk_id, t.clerk_code, t.follow_type,t.follow_remark, t.follow_material, t.goods_info, t.follow_time, t.enterprise_id, t.delete_flag, t.create_time, t.update_time
t.follow_id, t.member_id, t.clerk_id, t.clerk_code, t.follow_type,t.follow_remark, t.follow_material, t.goods_info, t.follow_time,t.source_type,t.biz_type,t.biz_id, t.enterprise_id, t.delete_flag, t.create_time, t.update_time
</sql>
<select id="queryById" resultMap="BaseResultMap">
......@@ -44,6 +47,29 @@
</foreach>
</select>
<select id="getFollowTypes" resultType="java.lang.String">
SELECT
GROUP_CONCAT(DISTINCT follow_type)
FROM tab_contact_follow
<where>
enterprise_id = #{enterpriseId}
AND follow_type not in (5,6)
<if test="memberId != null">
AND member_id = #{memberId}
</if>
<if test="clerkId != null">
AND clerk_id = #{clerkId}
</if>
<if test="beginTime != null">
AND follow_time > #{beginTime}
</if>
<if test="endTime != null">
AND follow_time <![CDATA[<=]]> #{endTime}
</if>
</where>
group by member_id
</select>
<select id="count" resultType="long">
SELECT COUNT(*)
FROM tab_contact_follow
......@@ -79,6 +105,29 @@
ORDER BY follow_time DESC,follow_id DESC
</select>
<select id="listFollowCheck" resultType="java.lang.String">
SELECT
member_id
FROM tab_contact_follow
<where>
enterprise_id = #{enterpriseId}
AND delete_flag = 0
AND follow_time >= NOW() - INTERVAL 6 MONTH
<if test="list != null and list.size() > 0">
AND (
<foreach collection="list" item="item" separator=" OR ">
(
member_id = #{item.memberId}
AND follow_time = #{item.followTime}
AND clerk_id = #{item.clerkId}
AND follow_type = 4
)
</foreach>
)
</if>
</where>
</select>
<select id="lastFollowByMemberId" resultMap="BaseResultMap">
SELECT
<include refid="Alias_Base_Column_List" />
......@@ -109,16 +158,27 @@
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="followId">
INSERT INTO tab_contact_follow (member_id, clerk_id, clerk_code,follow_type, follow_remark, follow_material, goods_info, follow_time, enterprise_id, delete_flag, create_time, update_time)
VALUES (#{memberId}, #{clerkId}, #{clerkCode},#{followType}, #{followRemark}, #{followMaterial}, #{goodsInfo}, #{followTime}, #{enterpriseId}, #{deleteFlag}, #{createTime}, #{updateTime})
INSERT INTO tab_contact_follow (member_id, clerk_id, clerk_code,follow_type, follow_remark, follow_material, goods_info, follow_time, source_type,biz_type,biz_id,enterprise_id, delete_flag, create_time, update_time)
VALUES (#{memberId}, #{clerkId}, #{clerkCode},#{followType}, #{followRemark}, #{followMaterial}, #{goodsInfo}, #{followTime},#{sourceType},#{bizType},#{bizId}, #{enterpriseId}, #{deleteFlag}, #{createTime}, #{updateTime})
</insert>
<insert id="insertBatch">
INSERT INTO tab_contact_follow (follow_id,member_id, clerk_id, clerk_code,follow_type, follow_remark, follow_material, goods_info, follow_time, enterprise_id)
INSERT INTO tab_contact_follow (
follow_id, member_id, clerk_id, clerk_code,
follow_type, follow_remark, follow_material,
goods_info, follow_time, source_type, biz_type, biz_id, enterprise_id
)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.followId},#{item.memberId}, #{item.clerkId}, #{item.clerkCode}, #{item.followType},#{item.followRemark}, #{item.followMaterial}, #{item.goodsInfo}, #{item.followTime}, #{item.enterpriseId})
(#{item.followId}, #{item.memberId}, #{item.clerkId}, #{item.clerkCode},
#{item.followType}, #{item.followRemark}, #{item.followMaterial},
#{item.goodsInfo}, #{item.followTime}, #{item.sourceType}, #{item.bizType}, #{item.bizId}, #{item.enterpriseId})
</foreach>
ON DUPLICATE KEY UPDATE
biz_type = CASE
WHEN VALUES(biz_id) IS NOT NULL THEN biz_type + VALUES(biz_type)
ELSE biz_type
END
</insert>
<update id="update">
......@@ -132,6 +192,9 @@
<if test="followMaterial != null">follow_material = #{followMaterial},</if>
<if test="goodsInfo != null">goods_info = #{goodsInfo},</if>
<if test="followTime != null">follow_time = #{followTime},</if>
<if test="bizType != null">biz_type = #{bizType},</if>
<if test="bizId != null">biz_id = #{bizId},</if>
<if test="source_type != null">source_type = #{sourceType},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
update_time = #{updateTime}
......
......@@ -14,6 +14,12 @@
<result property="contactCycle" column="contact_cycle" jdbcType="INTEGER"/>
<result property="contactCycleFirst" column="contact_cycle_first" jdbcType="INTEGER"/>
<result property="potentialTime" column="potential_time" jdbcType="TIMESTAMP"/>
<result property="potentialScore" column="potential_score" jdbcType="INTEGER"/>
<result property="sourceType" column="source_type" jdbcType="INTEGER"/>
<result property="sourceLogId" column="source_log_id" jdbcType="BIGINT"/>
<result property="bizType" column="biz_type" jdbcType="INTEGER" />
<result property="bizData" column="biz_data" jdbcType="VARCHAR" />
<result property="followTypes" column="follow_types" jdbcType="VARCHAR" />
<result property="enterpriseId" column="enterprise_id" jdbcType="VARCHAR"/>
<result property="deleteFlag" column="delete_flag" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
......@@ -39,19 +45,41 @@
</select>
<select id="queryLastLog" resultMap="TabContactLogMap">
select *
from tab_contact_log
where delete_flag = 0 and member_id = #{memberId}
SELECT t1.*
FROM tab_contact_log t1
INNER JOIN (
SELECT biz_type, MAX(contact_time) AS max_contact_time
FROM tab_contact_log
WHERE delete_flag = 0
<if test="memberId != null">
AND member_id = #{memberId}
</if>
<if test="clerkId!=null and clerkId!=''">
AND clerk_id = #{clerkId}
</if>
<if test="beginTime != null">
AND contact_time >= #{beginTime}
</if>
<if test="endTime != null">
AND contact_time <![CDATA[<=]]> #{endTime}
</if>
GROUP BY biz_type
) t2
ON t1.biz_type = t2.biz_type AND t1.contact_time = t2.max_contact_time
WHERE t1.delete_flag = 0
<if test="memberId != null">
AND t1.member_id = #{memberId}
</if>
<if test="clerkId!=null and clerkId!=''">
and clerk_id = #{clerkId}
AND t1.clerk_id = #{clerkId}
</if>
<if test="beginTime!=null ">
and contact_time >= #{beginTime}
<if test="beginTime != null">
AND t1.contact_time >= #{beginTime}
</if>
<if test="endTime!=null ">
and contact_time <![CDATA[<=]]> #{endTime}
<if test="endTime != null">
AND t1.contact_time <![CDATA[<=]]> #{endTime}
</if>
order by contact_time desc,log_id desc limit 1
ORDER BY t1.biz_type ASC,t1.contact_time desc,t1.log_id desc
</select>
<!--查询列表-->
......@@ -128,6 +156,12 @@
contact_cycle,
contact_cycle_first,
potential_time,
potential_score,
source_type,
source_log_id,
biz_type,
biz_data,
follow_types,
enterprise_id
)
values (
......@@ -143,6 +177,12 @@
#{contactCycle},
#{contactCycleFirst},
#{potentialTime},
#{potentialScore},
#{sourceType},
#{sourceLogId},
#{bizType},
#{bizData},
#{followTypes},
#{enterpriseId})
</insert>
......@@ -183,6 +223,24 @@
<if test="potentialTime != null">
potential_time = #{potentialTime},
</if>
<if test="potentialScore != null">
potential_score = #{potentialScore},
</if>
<if test="sourceType != null">
source_type = #{sourceType},
</if>
<if test="sourceLogId != null">
source_log_id = #{sourceLogId},
</if>
<if test="bizType != null">
biz_type = #{bizType},
</if>
<if test="bizData != null">
biz_data = #{bizData},
</if>
<if test="followTypes != null">
follow_types = #{followTypes},
</if>
<if test="enterpriseId != null and enterpriseId != ''">
enterprise_id = #{enterpriseId},
</if>
......
......@@ -24,6 +24,9 @@
<result column="contact_time" property="contactTime" />
<result column="potential_time" property="potentialTime" />
<result column="potential_score" property="potentialScore" />
<result column="group_info" property="groupInfo" />
<result column="source_type" property="sourceType" />
<result column="biz_type" property="bizType" />
<result column="delete_flag" property="deleteFlag" />
<result column="enterprise_id" property="enterpriseId" />
<result column="create_time" property="createTime" />
......@@ -31,7 +34,7 @@
</resultMap>
<sql id="Base_Column_List">
id, order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time, potential_score, delete_flag, enterprise_id, create_time, update_time
id, order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time, potential_score,group_info,source_type,biz_type, delete_flag, enterprise_id, create_time, update_time
</sql>
<select id="queryById" resultMap="BaseResultMap">
......@@ -45,7 +48,7 @@
SELECT
<include refid="Base_Column_List" />
FROM tab_contact_order
WHERE order_id = #{orderId} and delete_flag = 0
WHERE order_id = #{orderId} and delete_flag = 0 limit 1
</select>
<select id="queryByIds" resultMap="BaseResultMap">
......@@ -74,6 +77,9 @@
<if test="search.channelType != null">
AND channel_type = #{search.channelType}
</if>
<if test="search.bizType != null">
AND biz_type = #{search.bizType}
</if>
<if test="search.storeIdList != null and search.storeIdList.size() > 0">
AND store_id IN
<foreach item="storeId" index="index" collection="search.storeIdList" open="(" separator="," close=")">
......@@ -109,8 +115,8 @@
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tab_contact_order (order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time,potential_score, enterprise_id)
VALUES (#{orderId}, #{memberId}, #{orderNumber}, #{paidAmount}, #{productCount}, #{goodsInfo}, #{payTime}, #{receiptsDate}, #{channelCode}, #{channelType}, #{clerkId}, #{clerkCode},#{clerkName}, #{storeId}, #{contactLogId}, #{contactTime}, #{potentialTime}, #{potentialScore}, #{enterpriseId})
INSERT INTO tab_contact_order (order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time,potential_score,group_info, source_type,biz_type,enterprise_id)
VALUES (#{orderId}, #{memberId}, #{orderNumber}, #{paidAmount}, #{productCount}, #{goodsInfo}, #{payTime}, #{receiptsDate}, #{channelCode}, #{channelType}, #{clerkId}, #{clerkCode},#{clerkName}, #{storeId}, #{contactLogId}, #{contactTime}, #{potentialTime}, #{potentialScore},#{groupInfo}, #{sourceType},#{bizType},#{enterpriseId})
</insert>
<update id="update">
......@@ -133,6 +139,9 @@
<if test="contactTime != null">contact_time = #{contactTime},</if>
<if test="potentialTime != null">potential_time = #{potentialTime},</if>
<if test="potentialScore != null">potential_score = #{potentialScore},</if>
<if test="groupInfo != null">group_info = #{groupInfo},</if>
<if test="bizType != null">biz_type = #{bizType},</if>
<if test="source_type != null">source_type = #{sourceType},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
update_time = #{updateTime}
......
......@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.contact.ContactConfigDTO;
import com.gic.haoban.manage.api.dto.contact.ContactFollowDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO;
......@@ -13,6 +14,7 @@ import com.gic.haoban.manage.api.qdto.contact.ContactOrderQDTO;
import com.gic.haoban.manage.api.service.contact.ContactOrderApiService;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.bo.potential.MemberLastInteractBO;
import com.gic.haoban.manage.service.service.contact.ContactConfigService;
import com.gic.haoban.manage.service.service.contact.ContactFollowService;
import com.gic.haoban.manage.service.service.contact.ContactLogService;
import com.gic.haoban.manage.service.service.contact.ContactOrderService;
......@@ -39,6 +41,8 @@ public class ContactTest {
@Autowired
private ContactLogService contactLogService;
@Autowired
private ContactConfigService contactConfigService;
@Autowired
private ContactOrderApiService contactOrderApiService;
@Autowired
private InteractRecordService interactRecordService;
......@@ -98,7 +102,7 @@ public class ContactTest {
@Test
public void clearContactLog() throws Exception {
contactLogService.clearContactLog(memberId, 1,"");
contactLogService.clearContactLog(eid,memberId, 1,"");
}
@Test
......@@ -129,4 +133,17 @@ public class ContactTest {
orderQDTO.setOnlineOrder(true);
contactOrderApiService.saveContactOrder(orderQDTO);
}
@Test
public void saveContactConfig() throws Exception {
ContactConfigDTO contactConfigDTO = new ContactConfigDTO();
contactConfigDTO.setRemarkFlag(1);
contactConfigDTO.setEnterpriseId(eid);
contactConfigDTO.setContactAutoList(Lists.newArrayList(10,20,30));
contactConfigDTO.setRemarkContentList(Lists.newArrayList("微信邀约了客户","电话邀约了客户"));
contactConfigService.saveContactConfig(contactConfigDTO);
ContactConfigDTO contactConfig = contactConfigService.getContactConfig(eid);
System.out.println(JSON.toJSONString(contactConfig));
}
}
package com.gic.haoban.manage.web.controller.contact;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.manage.api.dto.contact.ContactConfigDTO;
import com.gic.haoban.manage.api.service.contact.ContactConfigApiService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/**
* 建联配置
*/
@RestController
@RequestMapping("/contact")
public class ContactController {
private static Logger logger = LogManager.getLogger(ContactController.class);
@Autowired
private ContactConfigApiService contactConfigApiService;
/**
* 建联配置
*
* @return RestResponse
*/
@RequestMapping("get")
@ResponseBody
public RestResponse<ContactConfigDTO> get() {
WebLoginDTO user = AuthWebRequestUtil.getLoginUser();
ServiceResponse<ContactConfigDTO> response = contactConfigApiService.getContactConfig(user.getEnterpriseId());
if (!response.isSuccess()) {
return RestResponse.failure(response.getCode(), response.getMessage());
}
return RestResponse.successResult(response.getResult());
}
/**
* 保存建联配置
*
* @return RestResponse
*/
@RequestMapping("save")
@ResponseBody
public RestResponse<Void> save(@RequestBody ContactConfigDTO configDTO) {
WebLoginDTO user = AuthWebRequestUtil.getLoginUser();
configDTO.setEnterpriseId(user.getEnterpriseId());
ServiceResponse<Void> response = contactConfigApiService.saveContactConfig(configDTO);
if (!response.isSuccess()) {
return RestResponse.failure(response.getCode(), response.getMessage());
}
return RestResponse.successResult();
}
}
......@@ -144,6 +144,7 @@
<dubbo:reference id="appOrderApiService" interface="com.gic.haoban.manage.api.service.licence.AppOrderApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference id="couponCardService" interface="com.gic.marketing.api.service.CouponCardService" timeout="100000" retries="0" check="false" />
<dubbo:reference id="qwMomentApiService" interface="com.gic.haoban.manage.api.service.moment.QwMomentApiService" timeout="100000" retries="0" check="false" />
<dubbo:reference id="contactConfigApiService" interface="com.gic.haoban.manage.api.service.contact.ContactConfigApiService" timeout="10000" retries="0" check="false" />
</beans>
......@@ -130,21 +130,12 @@ public class ClerkMaterialShareController {
log.info("saveClerkShareMaterialLog 保存导购分享推荐商品日志 clerkId:{}, recommendShareLogQO{}", recommendShareLogQO.getClerkId(), JSON.toJSONString(recommendShareLogQO));
List<ClerkShareGoodsLogDTO> list = Lists.newArrayList();
List<String> memberIdList = Lists.newArrayList();
List<String> goodsIdList = recommendShareLogQO.getGoodsIdList();
List<RecommendShareLogQO.MemberInfo> externalUserIdList = recommendShareLogQO.getMemberInfoList();
for (RecommendShareLogQO.MemberInfo memberInfo : externalUserIdList) {
for (String goodsId : goodsIdList) {
for (String goodsId : goodsIdList) {
ClerkShareGoodsLogDTO temp = new ClerkShareGoodsLogDTO();
temp.setEnterpriseId(recommendShareLogQO.getEnterpriseId());
temp.setWxEnterpriseId(recommendShareLogQO.getWxEnterpriseId());
temp.setClerkId(recommendShareLogQO.getClerkId());
temp.setExternalUserId(memberInfo.getExternalUserId());
temp.setMemberId(memberInfo.getMemberId());
if(StringUtils.isNotEmpty(memberInfo.getMemberId())){
memberIdList.add(memberInfo.getMemberId());
}
temp.setBizId(goodsId);
temp.setBizType(ShareBizType.GOODS.getCode());
temp.setStoreId(recommendShareLogQO.getStoreId());
......@@ -152,25 +143,20 @@ public class ClerkMaterialShareController {
temp.setStaffId(recommendShareLogQO.getStaffId());
temp.setWxaLinkId(recommendShareLogQO.getWxaLinkId());
list.add(temp);
}
}
ServiceResponse<Long> serviceResponse = materialShareLogApiService.saveClerkShareRecommendLog(list);
// 改为查询企微是否真正发送成功
DealQwSendDTO.FinishQwSendBO finishQwSendBO = new DealQwSendDTO.FinishQwSendBO(
recommendShareLogQO.getClerkId(),
recommendShareLogQO.getStaffId(),
DateUtil.date(),
2,
recommendShareLogQO.getWxEnterpriseId(),
recommendShareLogQO.getEnterpriseId());
finishQwSendBO.setShareGoodsList(list);
dealQwSendMsg(finishQwSendBO);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure("-701", "系统异常");
}
//更新会员推荐时间更新
if(CollectionUtils.isNotEmpty(memberIdList)){
for (String memberId : memberIdList) {
MemberExtraPropertyReq memberExtraPropertyReq = new MemberExtraPropertyReq();
memberExtraPropertyReq.setEnterpriseId(recommendShareLogQO.getEnterpriseId());
memberExtraPropertyReq.setMemberId(memberId);
memberExtraPropertyReq.setExtraKey(MemberExtKeyEnum.MEMBER_GOODS_SUGGEST_TIME.key());
memberExtraPropertyReq.setExtraValue(new Date().getTime());
memberExtraPropertyApiService.updateMemberExtraProperty(memberExtraPropertyReq);
}
}
if (StringUtils.isNotBlank(recommendShareLogQO.getWxaLinkId())) {
enterpriseWxaLinkService.updateTimeById(recommendShareLogQO.getWxaLinkId());
}
......@@ -179,7 +165,6 @@ public class ClerkMaterialShareController {
}
private void dealQwSendMsg(DealQwSendDTO.FinishQwSendBO finishQwSend) {
// 商品分享暂时不记,记录的是发送商品的类型而不是企微群发
DealQwSendDTO dealQwSendDTO = new DealQwSendDTO();
dealQwSendDTO.setEnterpriseId(finishQwSend.getEnterpriseId());
dealQwSendDTO.setRefreshType(1);
......
......@@ -7,16 +7,17 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.manage.api.dto.contact.ContactConfigDTO;
import com.gic.haoban.manage.api.dto.contact.ContactFollowDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactLogCheckQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO;
import com.gic.haoban.manage.api.service.contact.ContactConfigApiService;
import com.gic.haoban.manage.api.service.contact.ContactFollowApiService;
import com.gic.haoban.manage.api.service.contact.ContactLogApiService;
import com.gic.haoban.manage.web.qo.contact.ContactFollowPageQO;
import com.gic.haoban.manage.web.qo.contact.ContactFollowQO;
import com.gic.haoban.manage.web.qo.contact.ContactLastFollowQO;
import com.gic.haoban.manage.web.qo.contact.ContactLogQO;
import com.gic.haoban.manage.web.qo.contact.*;
import com.gic.haoban.manage.web.vo.contact.ContactLogCheckVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -40,6 +41,8 @@ public class ContactController {
private ContactFollowApiService contactFollowApiService;
@Autowired
private ContactLogApiService contactLogApiService;
@Autowired
private ContactConfigApiService contactConfigApiService;
/**
* 添加跟进记录
......@@ -117,6 +120,7 @@ public class ContactController {
@RequestMapping(path = "/log")
public RestResponse<Void> saveLog(@RequestBody ContactLogQO contactLogQO) {
ContactLogQDTO logQDTO = EntityUtil.changeEntityNew(ContactLogQDTO.class, contactLogQO);
logQDTO.setSourceType(contactLogQO.getBizType());
ServiceResponse<Void> serviceResponse = contactLogApiService.saveContactLog(logQDTO);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
......@@ -124,4 +128,33 @@ public class ContactController {
return RestResponse.successResult();
}
/**
* 是否可以建联校验
* @param contactLogCheckQO
* @return
*/
@RequestMapping(path = "/check")
public RestResponse<ContactLogCheckVO> check(@RequestBody ContactLogCheckQO contactLogCheckQO) {
ContactLogCheckQDTO logCheckQDTO = EntityUtil.changeEntityNew(ContactLogCheckQDTO.class, contactLogCheckQO);
ServiceResponse<Boolean> serviceResponse = contactLogApiService.contactCheck(logCheckQDTO);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
return RestResponse.successResult(new ContactLogCheckVO(serviceResponse.getResult()));
}
/**
* 建联配置
* @param enterpriseId
* @return
*/
@RequestMapping(path = "/config")
public RestResponse<ContactConfigDTO> config(String enterpriseId) {
ServiceResponse<ContactConfigDTO> serviceResponse = contactConfigApiService.getContactConfig(enterpriseId);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
return RestResponse.successResult(serviceResponse.getResult());
}
}
......@@ -18,7 +18,7 @@ public class ContactFollowQO {
private String clerkId;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联 6自动建联 7营销素材
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType;
......
package com.gic.haoban.manage.web.qo.contact;
import java.io.Serializable;
public class ContactLogCheckQO implements Serializable {
private static final long serialVersionUID = 973688857967269973L;
/**
* 会员id
*/
private String memberId;
/**
* 导购id
*/
private String clerkId;
/**
* 企业id
*/
private String enterpriseId;
/**
* 业务类型 1潜客(0001)2机会人群(0010)null为都校验
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType;
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
}
\ No newline at end of file
package com.gic.haoban.manage.web.qo.contact;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import java.io.Serializable;
import java.util.List;
public class ContactLogQO implements Serializable {
private static final long serialVersionUID = 973688857967269973L;
......@@ -21,6 +24,21 @@ public class ContactLogQO implements Serializable {
*/
private String enterpriseId;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType = ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType();
/**
* 跟进记录
*/
private String followRemark;
/**
* 跟进上传素材,数组格式
*/
private List<String> followMaterialList;
public String getMemberId() {
return memberId;
}
......@@ -52,4 +70,28 @@ public class ContactLogQO implements Serializable {
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getFollowRemark() {
return followRemark;
}
public void setFollowRemark(String followRemark) {
this.followRemark = followRemark;
}
public List<String> getFollowMaterialList() {
return followMaterialList;
}
public void setFollowMaterialList(List<String> followMaterialList) {
this.followMaterialList = followMaterialList;
}
}
\ No newline at end of file
package com.gic.haoban.manage.web.vo.contact;
import lombok.Data;
import java.io.Serializable;
@Data
public class ContactLogCheckVO implements Serializable {
private static final long serialVersionUID = 973688857967269973L;
/**
* 是否可以建联
*/
private Boolean check;
public ContactLogCheckVO() {
}
public ContactLogCheckVO(Boolean check) {
this.check = check;
}
}
\ No newline at end of file
......@@ -141,6 +141,7 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.contact.ContactFollowApiService" id="contactFollowApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.haoban.manage.api.service.contact.ContactLogApiService" id="contactLogApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.haoban.manage.api.service.contact.ContactOrderApiService" id="contactOrderApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.haoban.manage.api.service.contact.ContactConfigApiService" id="contactConfigApiService" timeout="10000" 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" />
......
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