Commit 0c208b8e authored by 刘基明's avatar 刘基明

visit log fix

parent efbe8b2f
......@@ -24,8 +24,8 @@ public interface VisitLogMapper extends BaseMapper<VisitLogEntity> {
@Select("select * from visit_log where ident=#{ident} and ref_id=#{refId} and ref_type=#{refType}")
VisitLogEntity selectByIdentAndRefId(@Param("ident") String ident, @Param("refId") String refId, @Param("refType") String refType);
@Update("update visit_log set duration=duration+#{duration} where ident=#{ident}")
void updateDurByIdent(@Param("duration") Integer dur, @Param("ident") String ident);
@Update("update visit_log set duration=duration+#{duration} where ident=#{ident} and ref_id=#{refId} and ref_type=#{refType}")
void updateDurByIdent(@Param("duration") Integer dur, @Param("ident") String ident, @Param("refId") String refId, @Param("refType") String refType);
@Select("select ref_id as id, count(1) as times from visit_log ${ew.customSqlSegment}")
List<TimesCountEntity> selectCountByThemeIds(@Param(Constants.WRAPPER) LambdaQueryWrapper wrapper);
......
......@@ -71,12 +71,17 @@ public class VisitLogService {
if (visitLogMapper.selectByIdentAndRefId(vs.getIdent(), vs.getRefId(), vs.getRefType()) == null) {
visitLogMapper.insert(vs);
} else {
visitLogMapper.updateDurByIdent(vs.getDuration(), vs.getIdent());
visitLogMapper.updateDurByIdent(vs.getDuration(), vs.getIdent(), vs.getRefId(), vs.getRefType());
}
// 如果执行超时,会删除别的实例的key
redisCache.evict(key);
return;
}
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
......@@ -119,17 +124,6 @@ public class VisitLogService {
.eq(VisitLogEntity::getRefType, PageEnum.COMM_VISIT_THEME.getId()));
}
// public LocalDateTime queryLatestViewFollow(String userId) {
// List<VisitLogEntity> visitSummaryEntities = visitLogMapper.selectList(new LambdaQueryWrapper<VisitLogEntity>()
// .eq(VisitLogEntity::getVisitorId, userId)
// .eq(VisitLogEntity::getRefType, VisitTypeEnum.FOLLOW_THEME_VIEW.getCode())
// .orderByDesc(VisitLogEntity::getCreateTime));
// if (CollectionUtils.isEmpty(visitSummaryEntities)) {
// return null;
// } else {
// return visitSummaryEntities.get(0).getCreateTime();
// }
// }
//统计行为集合的浏览量
public Map<String, Integer> getCountMapByTargetIds(List<String> refIds, String refType) {
......
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