Commit 4fc3c576 by songyinghui

feat: 互动记录访问时间

parent 48573527
......@@ -78,6 +78,11 @@ public class TabHaobanInteractRecord implements Serializable {
private Date updateTime;
/**
* 最新访问时间
*/
private Date lastAccessTime;
public Long getId() {
return id;
......@@ -215,5 +220,12 @@ public class TabHaobanInteractRecord implements Serializable {
this.updateTime = updateTime;
}
public Date getLastAccessTime() {
return lastAccessTime;
}
public void setLastAccessTime(Date lastAccessTime) {
this.lastAccessTime = lastAccessTime;
}
}
......@@ -94,4 +94,9 @@ public class InteractRecordBO {
* 下单的商品数量
*/
private Integer orderGoodsNum;
/**
* 最新访问时间
*/
private Date lastAccessTime;
}
......@@ -101,6 +101,7 @@ public class InteractRecordMessageContext {
temp.setDeleteFlag(0);
temp.setCreateTime(new Date());
temp.setUpdateTime(new Date());
temp.setLastAccessTime(new Date(this.interactRecordMessageBO.getLastAccessTime()));
temp.setExtendInfo(InteractRecordExtendInfoBO.empty());
return temp;
}
......
......@@ -93,6 +93,10 @@ public class InteractRecordMessageService {
interactRecordBO.setEventType(interactRecordMessageBO.getEventType());
}
}
// 更新互动记录的最新访问时间
if (interactRecordBO.getLastAccessTime().before(new Date(interactRecordMessageBO.getLastAccessTime()))) {
interactRecordBO.setLastAccessTime(new Date(interactRecordMessageBO.getLastAccessTime()));
}
if (!MaterialInteractRecordEventType.VISIT_MATERIAL.getCode().equals(interactRecordMessageBO.getEventType())
&& null == interactRecordBO.getExtendInfo()) {
......
......@@ -64,6 +64,9 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService {
.map(item -> {
InteractRecordInfoDTO temp = new InteractRecordInfoDTO();
BeanUtils.copyProperties(item, temp);
if (item.getLastAccessTime() != null) {
temp.setCreateTime(item.getLastAccessTime());
}
temp.setInteractRecordId(item.getId());
if (item.getExtendInfo() != null) {
InteractRecordExtendInfoDTO extendInfo = new InteractRecordExtendInfoDTO();
......
......@@ -20,6 +20,7 @@
<result property="extendInfo" column="extend_info" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="lastAccessTime" column="last_access_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="baseSql">
......@@ -39,7 +40,8 @@
delete_flag,
extend_info,
create_time,
update_time
update_time,
last_access_time
</sql>
<!--查询单个-->
......@@ -60,7 +62,8 @@
delete_flag,
extend_info,
create_time,
update_time
update_time,
last_access_time
from tab_haoban_interact_record
where id = #{id}
</select>
......@@ -69,7 +72,7 @@
<select id="queryAllByLimit" resultMap="TabHaobanInteractRecordMap">
select
id, enterprise_id, member_id, union_id, clerk_id, trace_id, biz_id, biz_type, store_id, channel_source,
event_type, duration_time, times, delete_flag, extend_info, create_time, update_time
event_type, duration_time, times, delete_flag, extend_info, create_time, update_time,last_access_time
from tab_haoban_interact_record
<where>
<if test="clerkId != null and clerkId != ''">
......@@ -141,21 +144,21 @@
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tab_haoban_interact_record(id, enterprise_id, member_id, union_id, clerk_id, trace_id, biz_id, biz_type,
store_id, channel_source, event_type, duration_time, times, delete_flag,
extend_info, create_time, update_time)
extend_info, create_time, update_time, last_access_time)
values (#{id}, #{enterpriseId}, #{memberId}, #{unionId}, #{clerkId}, #{traceId}, #{bizId}, #{bizType}, #{storeId},
#{channelSource}, #{eventType}, #{durationTime}, #{times}, #{deleteFlag}, #{extendInfo}, #{createTime},
#{updateTime})
#{updateTime}, #{lastAccessTime})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tab_haoban_interact_record(enterprise_id, member_id, union_id, clerk_id, trace_id, biz_id, biz_type,
store_id, channel_source, event_type, duration_time, times, delete_flag, extend_info, create_time, update_time)
store_id, channel_source, event_type, duration_time, times, delete_flag, extend_info, create_time, update_time, last_access_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.enterpriseId}, #{entity.memberId}, #{entity.unionId}, #{entity.clerkId}, #{entity.traceId},
#{entity.bizId}, #{entity.bizType}, #{entity.storeId}, #{entity.channelSource}, #{entity.eventType},
#{entity.durationTime}, #{entity.times}, #{entity.deleteFlag}, #{entity.extendInfo}, #{entity.createTime},
#{entity.updateTime})
#{entity.updateTime}, #{entity.lastAccessTime})
</foreach>
</insert>
......@@ -240,6 +243,9 @@
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="lastAccessTime != null">
last_access_time = #{lastAccessTime}
</if>
</set>
where id = #{id}
</update>
......@@ -262,6 +268,9 @@
from tab_haoban_interact_record
<where>
delete_flag = 0
<if test="enterpriseId != null and enterpriseId != ''">
and enterprise_id = #{enterpriseId}
</if>
<if test="clerkId != null and clerkId != ''">
and clerk_id = #{clerkId}
</if>
......@@ -281,7 +290,7 @@
and biz_id = #{bizId}
</if>
</where>
order by id desc
order by last_access_time desc, id desc
</select>
<select id="staticsClerkInteractRecordNew" resultType="com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerStaticsBO">
......
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