Commit 9be5cda1 by 王祖波

Merge branch 'feature-recommend2' into 'master'

Feature recommend2

See merge request !2914
parents 0ef5e146 10e50bb0
......@@ -18,6 +18,12 @@ public class ContactFollowDTO implements Serializable {
* 导购code
*/
private String clerkCode;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType;
/**
* 跟进记录
*/
......@@ -63,6 +69,14 @@ public class ContactFollowDTO implements Serializable {
this.clerkCode = clerkCode;
}
public Integer getFollowType() {
return followType;
}
public void setFollowType(Integer followType) {
this.followType = followType;
}
public String getFollowRemark() {
return followRemark;
}
......
package com.gic.haoban.manage.api.enums.contact;
import org.apache.commons.lang3.StringUtils;
public enum ContactFollowTypeEnum {
PRIVATE_PHONE(1, "私人电话","私人电话"),
WECHAT_SESSION(2, "企微会话","企微会话"),
PRODUCT(3, "发送商品","商品"),
WECHAT_GROUP_SEND(4, "企微群发","企微群发"),
CONTACT(5, "标记建联","标记了建联");
private final int code;
private final String description;
private final String textMatch;
ContactFollowTypeEnum(int code, String description,String textMatch) {
this.code = code;
this.description = description;
this.textMatch = textMatch;
}
public String getTextMatch() {
return textMatch;
}
public int getCode() {
return code;
}
public String getDescription() {
return description;
}
public static ContactFollowTypeEnum fromCode(int code) {
for (ContactFollowTypeEnum type : values()) {
if (type.code == code) {
return type;
}
}
return null;
}
public static ContactFollowTypeEnum fromTextMatch(String textMatch) {
if (StringUtils.isBlank(textMatch)) {
return null;
}
for (ContactFollowTypeEnum type : values()) {
if (textMatch.contains(type.textMatch)) {
return type;
}
}
return null;
}
}
\ No newline at end of file
......@@ -19,6 +19,12 @@ public class ContactFollowBatchQDTO implements Serializable {
* 导购id
*/
private String clerkId;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType;
/**
* 跟进记录
*/
......@@ -48,6 +54,14 @@ public class ContactFollowBatchQDTO implements Serializable {
this.clerkId = clerkId;
}
public Integer getFollowType() {
return followType;
}
public void setFollowType(Integer followType) {
this.followType = followType;
}
public String getFollowRemark() {
return followRemark;
}
......
......@@ -19,6 +19,11 @@ public class ContactFollowQDTO implements Serializable {
*/
private String clerkCode;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType;
/**
* 跟进记录
*/
private String followRemark;
......@@ -63,6 +68,14 @@ public class ContactFollowQDTO implements Serializable {
this.clerkCode = clerkCode;
}
public Integer getFollowType() {
return followType;
}
public void setFollowType(Integer followType) {
this.followType = followType;
}
public String getFollowRemark() {
return followRemark;
}
......
......@@ -28,6 +28,11 @@ public class TabContactFollow implements Serializable {
*/
private String clerkCode;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType;
/**
* 跟进记录
*/
private String followRemark;
......@@ -92,6 +97,14 @@ public class TabContactFollow implements Serializable {
this.clerkCode = clerkCode;
}
public Integer getFollowType() {
return followType;
}
public void setFollowType(Integer followType) {
this.followType = followType;
}
public String getFollowRemark() {
return followRemark;
}
......
......@@ -84,6 +84,10 @@ public class TabContactOrder implements Serializable {
*/
private Date potentialTime;
/**
* 潜客分值
*/
private Integer potentialScore;
/**
* 是否删除
*/
private Integer deleteFlag;
......@@ -244,6 +248,14 @@ public class TabContactOrder implements Serializable {
this.potentialTime = potentialTime;
}
public Integer getPotentialScore() {
return potentialScore;
}
public void setPotentialScore(Integer potentialScore) {
this.potentialScore = potentialScore;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
......
......@@ -12,6 +12,7 @@ import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.dto.contact.ContactFollowDTO;
import com.gic.haoban.manage.api.dto.contact.ContactFollowGoodsDTO;
import com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO;
import com.gic.haoban.manage.service.dao.mapper.contact.TabContactFollowMapper;
......@@ -74,6 +75,13 @@ public class ContactFollowServiceImpl implements ContactFollowService {
if (CollectionUtils.isNotEmpty(follow.getGoodsInfoList())) {
contactFollow.setGoodsInfo(JSON.toJSONString(follow.getGoodsInfoList()));
}
// 兼容不传followType的老版本
Integer followType = contactFollow.getFollowType();
if (followType == null) {
ContactFollowTypeEnum followTypeEnum = ContactFollowTypeEnum.fromTextMatch(contactFollow.getFollowRemark());
followType = Optional.ofNullable(followTypeEnum).map(ContactFollowTypeEnum::getCode).orElse(ContactFollowTypeEnum.CONTACT.getCode());
contactFollow.setFollowType(followType);
}
return contactFollow;
}).filter(Objects::nonNull).collect(Collectors.toList());
contactFollowMapper.insertBatch(followList);
......
......@@ -143,11 +143,10 @@ public class ContactLogServiceImpl implements ContactLogService {
DynamicDocDTO dynamicDocDTO = new DynamicDocDTO();
dynamicDocDTO.setEnterpriseId(enterpriseId);
dynamicDocDTO.setColumnCategoryCode("member");
MemberDataDTO memberDataDTO = new MemberDataDTO();
memberDataDTO.setMemberId(memberId);
memberDataDTO.setId(memberId);
memberDataDTO.setClerkContactTime(contactTime);
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(memberDataDTO));
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", memberId);
jsonObject.put("memberId", memberId);
jsonObject.put("clerkContactTime", contactTime);
dynamicDocDTO.setDocJson(jsonObject);
dynamicDocDTO.setRefresh(Constant.FLAG_TRUE);
ESResponse res = esDataDynamicOperationApiService.updateDataSingle(dynamicDocDTO, false);
......
......@@ -60,16 +60,19 @@ public class ContactOrderServiceImpl implements ContactOrderService {
if (platformChannelEnum == null) {
return false;
}
TabContactOrder oldContactOrder = contactOrderMapper.queryByOrderId(orderInfoResp.getOrderId());
String orderId = orderInfoResp.getOrderId();
TabContactOrder oldContactOrder = contactOrderMapper.queryByOrderId(orderId);
if (oldContactOrder != null) {
logger.info("订单已处理,订单id:{}", orderInfoResp.getOrderId());
logger.info("订单已处理,订单id:{}", orderId);
return false;
}
if (orderInfoResp.getOrderStatus() == null || orderInfoResp.getOrderStatus() != 1) {
logger.info("订单不是销售单");
return false;
}
logger.info("建联处理订单:{}", orderInfoResp.getOrderId());
String enterpriseId = orderInfoResp.getEnterpriseId();
String memberId = orderInfoResp.getMemberId();
logger.info("建联处理订单:{},memberId:{}", orderId,memberId);
Date receiptsDate = orderInfoResp.getReceiptsDate();
Date contactBeginTime = null;
String channelCode = platformChannelEnum.getChannelCode();
......@@ -83,14 +86,14 @@ public class ContactOrderServiceImpl implements ContactOrderService {
contactBeginTime = DateUtil.offsetDay(receiptsDate, -1);
}
TabContactLog lastContactLog = contactLogService.getLastByTime(orderInfoResp.getMemberId(), contactBeginTime,receiptsDate);
TabContactLog lastContactLog = contactLogService.getLastByTime(memberId, contactBeginTime,receiptsDate);
if (lastContactLog == null) {
return false;
}
logger.info("建联转化订单建联信息:{}", JSON.toJSONString(lastContactLog));
TabContactOrder contactOrder = new TabContactOrder();
contactOrder.setOrderId(orderInfoResp.getOrderId());
contactOrder.setMemberId(orderInfoResp.getMemberId());
contactOrder.setOrderId(orderId);
contactOrder.setMemberId(memberId);
contactOrder.setOrderNumber(orderInfoResp.getOrderNo());
Double paidAmount = orderInfoResp.getPayAmount();
if (Objects.equals(PlatformChannelEnum.C_WECHAT_MINI.getChannelCode(), channelCode)) {
......@@ -115,6 +118,11 @@ public class ContactOrderServiceImpl implements ContactOrderService {
contactOrder.setContactTime(lastContactLog.getContactTime());
contactOrder.setPotentialTime(lastContactLog.getPotentialTime());
contactOrder.setEnterpriseId(lastContactLog.getEnterpriseId());
JSONObject jsonObject = esMemberInfoService.queryDataSingle(enterpriseId, memberId, "potentialScore");
if (jsonObject != null && jsonObject.getInteger("potentialScore") != null) {
contactOrder.setPotentialScore(jsonObject.getInteger("potentialScore"));
}
contactOrderMapper.insert(contactOrder);
return true;
}
......
......@@ -33,15 +33,9 @@ public class ContactFollowApiServiceImpl implements ContactFollowApiService {
private ContactFollowService contactFollowService;
@Autowired
private ClerkService clerkService;
@Autowired
private EnterpriseAdaptor enterpriseAdaptor;
@Override
public ServiceResponse<Void> saveFollow(ContactFollowQDTO qdto) {
boolean hasRight = enterpriseAdaptor.checkEnterpriseHasRight(qdto.getEnterpriseId(), EnterpriseServiceEnum.POTENTIAL.getRightMenuCode());
if (!hasRight) {
return ServiceResponse.success();
}
contactFollowService.saveFollow(qdto);
return ServiceResponse.success();
}
......@@ -51,10 +45,6 @@ public class ContactFollowApiServiceImpl implements ContactFollowApiService {
if (CollectionUtils.isEmpty(list)) {
return ServiceResponse.success();
}
boolean hasRight = enterpriseAdaptor.checkEnterpriseHasRight(list.get(0).getEnterpriseId(), EnterpriseServiceEnum.POTENTIAL.getRightMenuCode());
if (!hasRight) {
return ServiceResponse.success();
}
contactFollowService.saveBatchFollow(list);
return ServiceResponse.success();
}
......@@ -65,10 +55,6 @@ public class ContactFollowApiServiceImpl implements ContactFollowApiService {
return ServiceResponse.success();
}
ContactFollowBatchQDTO qdto = JSONObject.parseObject(message, ContactFollowBatchQDTO.class);
boolean hasRight = enterpriseAdaptor.checkEnterpriseHasRight(qdto.getEnterpriseId(), EnterpriseServiceEnum.POTENTIAL.getRightMenuCode());
if (!hasRight) {
return ServiceResponse.success();
}
List<ContactFollowBatchQDTO.MemberFollow> memberList = qdto.getMemberList();
if (CollectionUtils.isEmpty(memberList)) {
return ServiceResponse.success();
......
......@@ -23,8 +23,6 @@ public class QwSendApiServiceImpl implements QwSendApiService {
@Autowired
private QwSendMsgService qwSendMsgService;
@Autowired
private EnterpriseAdaptor enterpriseAdaptor;
@Override
public ServiceResponse<Void> qwSendRefreshByMQ(String message) {
......@@ -32,17 +30,13 @@ public class QwSendApiServiceImpl implements QwSendApiService {
return ServiceResponse.success();
}
DealQwSendDTO dealQwSendDTO = JSONObject.parseObject(message, DealQwSendDTO.class);
boolean hasRight = enterpriseAdaptor.checkEnterpriseHasRight(dealQwSendDTO.getEnterpriseId(), EnterpriseServiceEnum.POTENTIAL.getRightMenuCode());
if (!hasRight) {
return ServiceResponse.success();
}
Integer refreshType = dealQwSendDTO.getRefreshType();
log.info("刷新企微发送记录:{}", message);
if (Objects.equals(refreshType,1)) {
qwSendMsgService.finishQwSend(dealQwSendDTO.getFinishQwSend(),dealQwSendDTO.getTryCount());
} else if (Objects.equals(refreshType, 2)) {
qwSendMsgService.refreshQwSendLog(dealQwSendDTO.getQwSendMsg());
qwSendMsgService.refreshQwSendLog(dealQwSendDTO);
}
return ServiceResponse.success();
}
......
......@@ -20,8 +20,8 @@ public interface QwSendMsgService {
/**
* 刷新企微群结果
* @param qwSendMsg
* @param dealQwSendDTO
*/
void refreshQwSendLog(DealQwSendDTO.QwSendMsgBO qwSendMsg);
void refreshQwSendLog(DealQwSendDTO dealQwSendDTO);
}
......@@ -9,6 +9,7 @@ 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.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;
......@@ -101,11 +102,30 @@ public class QwSendMsgServiceImpl implements QwSendMsgService {
}
@Override
public void refreshQwSendLog(DealQwSendDTO.QwSendMsgBO qwSendMsg) {
public void refreshQwSendLog(DealQwSendDTO dealQwSendDTO) {
DealQwSendDTO.QwSendMsgBO qwSendMsg = dealQwSendDTO.getQwSendMsg();
List<GroupSendResultBO> sendResultList = getSendResultList(qwSendMsg);
if (CollectionUtils.isEmpty(sendResultList)) {
return;
}
//判断是否已经发送
List<GroupSendResultBO> noSendList = sendResultList.stream().filter(dto -> Objects.equals(dto.getStatus(), 0))
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(noSendList)) {
Integer tryCount = dealQwSendDTO.getTryCount();
if (tryCount != null && tryCount >= 10) {
log.info("查询超过次数限制:{}",qwSendMsg.getMsgId());
return;
}
if (tryCount == null) {
tryCount = 0;
}
// 重新刷新
dealQwSendDTO.setRefreshType(2);
dealQwSendDTO.setTryCount(++tryCount);
MqUtils.sendMessageToMQ("qwSendRefreshByMQ", JSON.toJSONString(dealQwSendDTO), 60);
return;
}
log.info("刷新企微群发结果:{}", qwSendMsg.getMsgId());
List<TabQwSendLog> entities;
List<List<GroupSendResultBO>> partition = Lists.partition(sendResultList, 1000);
......@@ -162,10 +182,7 @@ public class QwSendMsgServiceImpl implements QwSendMsgService {
log.error("未查询到userid");
return Collections.emptyList();
}
List<GroupSendResultBO> sendResultList = getSendResult(qwSendMsg.getWxEnterpriseId(), qwSendMsg.getMsgId(), newWxUserId);
//判断是否已经发送
return sendResultList.stream().filter(dto -> !Objects.equals(dto.getStatus(), 0))
.collect(Collectors.toList());
return getSendResult(qwSendMsg.getWxEnterpriseId(), qwSendMsg.getMsgId(), newWxUserId);
}
public List<GroupSendResultBO> getSendResult(String wxEnterpriseId, String msgId, String userId) {
......@@ -236,6 +253,7 @@ public class QwSendMsgServiceImpl implements QwSendMsgService {
batchQDTO.setEnterpriseId(enterpriseId);
batchQDTO.setMemberList(memberList);
batchQDTO.setClerkId(clerkId);
batchQDTO.setFollowType(ContactFollowTypeEnum.WECHAT_GROUP_SEND.getCode());
batchQDTO.setFollowRemark("通过企微群发向客户发送了消息");
MqUtils.sendMessageToMQ("saveBatchFollowForMQ", JSON.toJSONString(batchQDTO));
}
......
......@@ -9,6 +9,7 @@
<result column="member_id" property="memberId" />
<result column="clerk_id" property="clerkId" />
<result column="clerk_code" property="clerkCode" />
<result column="follow_type" property="followType" />
<result column="follow_remark" property="followRemark" />
<result column="follow_material" property="followMaterial" />
<result column="goods_info" property="goodsInfo" />
......@@ -20,10 +21,10 @@
</resultMap>
<sql id="Base_Column_List">
follow_id, member_id, clerk_id, clerk_code, 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, 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_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.enterprise_id, t.delete_flag, t.create_time, t.update_time
</sql>
<select id="queryById" resultMap="BaseResultMap">
......@@ -64,7 +65,7 @@
<include refid="Base_Column_List" />
FROM tab_contact_follow
<where>
enterprise_id = #{enterpriseId} and delete_flag = 0
enterprise_id = #{enterpriseId} and delete_flag = 0 and follow_time >= now() - interval 6 month
<if test="search.clerkId != null and search.clerkId != ''">
AND clerk_id = #{search.clerkId}
</if>
......@@ -86,6 +87,7 @@
INNER JOIN ( SELECT clerk_id, member_id, MAX( follow_time ) AS max_follow_time FROM tab_contact_follow WHERE
enterprise_id = #{enterpriseId}
and delete_flag = 0
and follow_time >= now() - interval 6 month
and member_id IN
<foreach item="item" index="index" collection="memberIdList" open="(" separator="," close=")">
#{item}
......@@ -95,7 +97,7 @@
AND t.member_id = latest.member_id
AND t.follow_time = latest.max_follow_time
where t.enterprise_id = #{enterpriseId}
and t.delete_flag = 0
and t.delete_flag = 0 and t.follow_time >= now() - interval 6 month
<if test="clerkId!=null and clerkId!=''">
and t.clerk_id = #{clerkId}
</if>
......@@ -107,15 +109,15 @@
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="followId">
INSERT INTO tab_contact_follow (member_id, clerk_id, clerk_code, follow_remark, follow_material, goods_info, follow_time, enterprise_id, delete_flag, create_time, update_time)
VALUES (#{memberId}, #{clerkId}, #{clerkCode}, #{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, enterprise_id, delete_flag, create_time, update_time)
VALUES (#{memberId}, #{clerkId}, #{clerkCode},#{followType}, #{followRemark}, #{followMaterial}, #{goodsInfo}, #{followTime}, #{enterpriseId}, #{deleteFlag}, #{createTime}, #{updateTime})
</insert>
<insert id="insertBatch">
INSERT INTO tab_contact_follow (follow_id,member_id, clerk_id, clerk_code, 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, enterprise_id)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.followId},#{item.memberId}, #{item.clerkId}, #{item.clerkCode}, #{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.enterpriseId})
</foreach>
</insert>
......@@ -125,6 +127,7 @@
<if test="memberId != null">member_id = #{memberId},</if>
<if test="clerkId != null">clerk_id = #{clerkId},</if>
<if test="clerkCode != null">clerk_code = #{clerkCode},</if>
<if test="followType != null">follow_type = #{followType},</if>
<if test="followRemark != null">follow_remark = #{followRemark},</if>
<if test="followMaterial != null">follow_material = #{followMaterial},</if>
<if test="goodsInfo != null">goods_info = #{goodsInfo},</if>
......
......@@ -23,6 +23,7 @@
<result column="contact_log_id" property="contactLogId" />
<result column="contact_time" property="contactTime" />
<result column="potential_time" property="potentialTime" />
<result column="potential_score" property="potentialScore" />
<result column="delete_flag" property="deleteFlag" />
<result column="enterprise_id" property="enterpriseId" />
<result column="create_time" property="createTime" />
......@@ -30,7 +31,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, 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, delete_flag, enterprise_id, create_time, update_time
</sql>
<select id="queryById" resultMap="BaseResultMap">
......@@ -108,8 +109,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, enterprise_id)
VALUES (#{orderId}, #{memberId}, #{orderNumber}, #{paidAmount}, #{productCount}, #{goodsInfo}, #{payTime}, #{receiptsDate}, #{channelCode}, #{channelType}, #{clerkId}, #{clerkCode},#{clerkName}, #{storeId}, #{contactLogId}, #{contactTime}, #{potentialTime}, #{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, enterprise_id)
VALUES (#{orderId}, #{memberId}, #{orderNumber}, #{paidAmount}, #{productCount}, #{goodsInfo}, #{payTime}, #{receiptsDate}, #{channelCode}, #{channelType}, #{clerkId}, #{clerkCode},#{clerkName}, #{storeId}, #{contactLogId}, #{contactTime}, #{potentialTime}, #{potentialScore}, #{enterpriseId})
</insert>
<update id="update">
......@@ -131,6 +132,7 @@
<if test="contactLogId != null">contact_log_id = #{contactLogId},</if>
<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="deleteFlag != null">delete_flag = #{deleteFlag},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
update_time = #{updateTime}
......
......@@ -15,14 +15,18 @@ 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.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -63,6 +67,29 @@ public class ContactController {
}
/**
* 会员最后一次跟进记录
* @param contactLastFollowQO
* @return
*/
@RequestMapping(path = "/last-follow")
public RestResponse<ContactFollowDTO> lastFollow(@RequestBody ContactLastFollowQO contactLastFollowQO) {
String memberId = contactLastFollowQO.getMemberId();
String enterpriseId = contactLastFollowQO.getEnterpriseId();
if (StringUtils.isAnyBlank(memberId,enterpriseId)) {
return RestResponse.successResult();
}
ServiceResponse<Map<String, ContactFollowDTO>> serviceResponse = contactFollowApiService.mapMemberLastFollow(enterpriseId,null, Lists.newArrayList(memberId));
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
if (serviceResponse.getResult() == null) {
return RestResponse.successResult();
}
ContactFollowDTO contactFollowDTO = serviceResponse.getResult().get(memberId);
return RestResponse.successResult(contactFollowDTO);
}
/**
* 分页查询跟进记录
* @param contactFollowPageQO
* @return
......
......@@ -76,6 +76,7 @@ public class PotentialDataController {
String enterpriseId = contactOrderPageQO.getEnterpriseId();
String clerkId = contactOrderPageQO.getClerkId();
String storeId = contactOrderPageQO.getStoreId();
String memberId = contactOrderPageQO.getMemberId();
List<String> storeIds = new ArrayList<>();
if (StringUtils.isNotBlank(clerkId)) {
ClerkDTO clerkDTO = clerkService.getclerkById(clerkId);
......@@ -102,6 +103,7 @@ public class PotentialDataController {
searchQDTO.setBeginTime(contactOrderPageQO.getBeginTime());
searchQDTO.setEndTime(contactOrderPageQO.getEndTime());
searchQDTO.setChannelType(contactOrderPageQO.getChannelType());
searchQDTO.setMemberId(memberId);
BasePageInfo basePageInfo = contactOrderPageQO.getBasePageInfo();
ServiceResponse<Page<ContactOrderDetailDTO>> serviceResponse = contactOrderApiService.pageContactOrder(enterpriseId,searchQDTO,basePageInfo);
if (!serviceResponse.isSuccess()) {
......
......@@ -194,6 +194,8 @@ public class PotentialDataAdaptor {
Integer reportType = potentialOverviewQO.getReportType();
String bizDate = potentialOverviewQO.getBizDate();
Integer potGroup = potentialOverviewQO.getPotGroup();
String clerkQuery = potentialOverviewQO.getClerkQuery();
String storeQuery = potentialOverviewQO.getStoreQuery();
Map<String, Object> inlineParams = getOverviewBaseParams(potentialOverviewQO, storeIds);
Pair<String, String> dateParam = getDateParam(reportType, bizDate);
String startDate = dateParam.getKey();
......@@ -211,6 +213,12 @@ public class PotentialDataAdaptor {
if (reportType != null) {
inlineParams.put("reportType", reportType);
}
if (StringUtils.isNotBlank(clerkQuery)) {
inlineParams.put("clerkQuery", clerkQuery);
}
if (StringUtils.isNotBlank(storeQuery)) {
inlineParams.put("storeQuery", storeQuery);
}
return inlineParams;
}
......@@ -252,6 +260,9 @@ public class PotentialDataAdaptor {
if (reportType == null) {
return new Pair<>("", "");
}
if (StringUtils.isBlank(bizDate)) {
return new Pair<>("", "");
}
String endDate = bizDate;
String beginDate = bizDate;
if (MaterialReportType.MONTH.getCode().equals(reportType)) {
......
......@@ -18,6 +18,12 @@ public class ContactFollowQO {
private String clerkId;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType;
/**
* 跟进记录
*/
private String followRemark;
......@@ -50,6 +56,14 @@ public class ContactFollowQO {
this.clerkId = clerkId;
}
public Integer getFollowType() {
return followType;
}
public void setFollowType(Integer followType) {
this.followType = followType;
}
public String getFollowRemark() {
return followRemark;
}
......
package com.gic.haoban.manage.web.qo.contact;
import lombok.Data;
/**
* Created by wangzubo on 2025/3/15.
*/
@Data
public class ContactLastFollowQO {
/**
* 会员id列表
*/
private String memberId;
/**
* 企业id
*/
private String enterpriseId;
}
......@@ -22,6 +22,11 @@ public class ContactOrderPageQO extends PageQo {
private String storeId;
/**
* 会员id
*/
private String memberId;
/**
* 1 线上; 2 线下
*/
private Integer channelType;
......@@ -64,6 +69,14 @@ public class ContactOrderPageQO extends PageQo {
this.storeId = storeId;
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public Integer getChannelType() {
return channelType;
}
......
......@@ -35,6 +35,16 @@ public class PotentialStatisticsBaseQO extends BasePageInfo {
private String storeId;
/**
* 导购搜索
*/
private String clerkQuery;
/**
* 门店搜索
*/
private String storeQuery;
/**
* 门店id列表
*/
private List<String> storeIdList;
......
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