Commit 5ad6b319 by 王祖波

建联转化增加潜客分

parent cff5f4dc
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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}
......
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