Commit 7d7f4d03 authored by 刘基明's avatar 刘基明

表名修改

parent 56e2b869
......@@ -5,6 +5,9 @@ import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
/**
* <p>
......@@ -15,6 +18,9 @@ import io.swagger.annotations.ApiModelProperty;
* @since 2021-07-28
*/
@TableName("visit_log")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="VisitLogEntity对象", description="浏览记录")
public class VisitLogEntity implements Serializable {
......
package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
/**
* <p>
* 浏览记录
* </p>
*
* @author xudong
* @since 2021-07-22
*/
@TableName("visit_summary")
@ApiModel(value="VisitSummaryEntity对象", description="浏览记录")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class VisitSummaryEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "session_id")
private String ident;
@ApiModelProperty(value = "浏览者id")
private String visitorId;
@ApiModelProperty(value = "作者id")
private String authorId;
@ApiModelProperty(value = "关联目标ID")
private String refId;
@ApiModelProperty(value = "关联目标类型 1:进入话题页 2:进入主题正文 3、用户查看首页-关注")
private Integer refType;
@ApiModelProperty(value = "浏览时间 单位秒")
private Integer duration;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private Integer deleteTag;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getIdent() {
return ident;
}
public void setIdent(String ident) {
this.ident = ident;
}
public String getVisitorId() {
return visitorId;
}
public void setVisitorId(String visitorId) {
this.visitorId = visitorId;
}
public String getAuthorId() {
return authorId;
}
public void setAuthorId(String authorId) {
this.authorId = authorId;
}
public String getRefId() {
return refId;
}
public void setRefId(String refId) {
this.refId = refId;
}
public Integer getRefType() {
return refType;
}
public void setRefType(Integer refType) {
this.refType = refType;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public Integer getDeleteTag() {
return deleteTag;
}
public void setDeleteTag(Integer deleteTag) {
this.deleteTag = deleteTag;
}
@Override
public String toString() {
return "VisitSummaryEntity{" +
"id=" + id +
", ident=" + ident +
", visitorId=" + visitorId +
", authorId=" + authorId +
", refId=" + refId +
", refType=" + refType +
", duration=" + duration +
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
}
}
package com.tanpu.community.dao.mapper.community;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.tanpu.community.dao.entity.community.TimesCountEntity;
import com.tanpu.community.dao.entity.community.VisitLogEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.Date;
import java.util.List;
/**
* <p>
......@@ -12,5 +21,18 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @since 2021-07-28
*/
public interface VisitLogMapper extends BaseMapper<VisitLogEntity> {
@Select("select * from visit_log where ident=#{ident}")
VisitLogEntity selectByIdent(@Param("ident") String ident);
@Update("update visit_log set duration=duration+#{duration} where ident=#{ident}")
void updateDurByIdent(@Param("duration") Integer dur, @Param("ident") String ident);
@Select("select ref_id from visit_log where visitor_id=#{visitorId} and ref_id in (#{refIds})")
List<String> selectRefIdByUserId(@Param("visitorId") String visitorId, @Param("refIds") String refIds);
@Select("select ref_id as id, count(1) as times from visit_log ${ew.customSqlSegment}")
List<TimesCountEntity> selectCountByThemeIds(@Param(Constants.WRAPPER) LambdaQueryWrapper wrapper);
@Select("select ref_id from visit_log where visitor_id=#{visitorId} and date(create_time) between #{startDate} and #{endDate}")
List<String> selectRefIdByUserIdAndCreateBetween(@Param("visitorId") String visitorId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
}
package com.tanpu.community.dao.mapper.community;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.tanpu.community.dao.entity.community.TimesCountEntity;
import com.tanpu.community.dao.entity.community.VisitSummaryEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
* <p>
* 浏览记录 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-07-22
*/
public interface VisitSummaryMapper extends BaseMapper<VisitSummaryEntity> {
@Select("select * from visit_summary where ident=#{ident}")
VisitSummaryEntity selectByIdent(@Param("ident") String ident);
@Update("update visit_summary set duration=duration+#{duration} where ident=#{ident}")
void updateDurByIdent(@Param("duration") Integer dur, @Param("ident") String ident);
@Select("select ref_id from visit_summary where visitor_id=#{visitorId} and ref_id in (#{refIds})")
List<String> selectRefIdByUserId(@Param("visitorId") String visitorId, @Param("refIds") String refIds);
@Select("select ref_id as id, count(1) as times from visit_summary ${ew.customSqlSegment}")
List<TimesCountEntity> selectCountByThemeIds(@Param(Constants.WRAPPER)LambdaQueryWrapper wrapper);
@Select("select ref_id from visit_summary where visitor_id=#{visitorId} and date(create_time) between #{startDate} and #{endDate}")
List<String> selectRefIdByUserIdAndCreateBetween(@Param("visitorId") String visitorId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
}
......@@ -2,7 +2,7 @@ package com.tanpu.community.manager;
import com.tanpu.community.service.RankService;
import com.tanpu.community.service.RedisService;
import com.tanpu.community.service.VisitSummaryService;
import com.tanpu.community.service.VisitLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
......@@ -15,7 +15,7 @@ import org.springframework.stereotype.Service;
public class ConJobManager {
@Autowired
private VisitSummaryService visitSummaryService;
private VisitLogService visitLogService;
@Autowired
private RedisService redisService;
......@@ -29,7 +29,7 @@ public class ConJobManager {
@Scheduled(cron = "*/10 * * * * ?")
public void topicVisitorStats() {
String topicId = "123";
Integer detailVisitTimes = visitSummaryService.queryTopicDetailVisit(topicId);
Integer detailVisitTimes = visitLogService.queryTopicDetailVisit(topicId);
redisService.set("topicVisitorStats", detailVisitTimes);
}
......
......@@ -69,7 +69,7 @@ public class ThemeManager {
private BatchFeignCallService batchFeignCallService;
@Autowired
private VisitSummaryService visitSummaryService;
private VisitLogService visitLogService;
@Autowired
private ReportLogService reportLogService;
......@@ -201,7 +201,7 @@ public class ThemeManager {
if (ThemeListTypeEnum.RECOMMEND.getCode().equals(req.getType())) {
//推荐
// 需要筛掉用户访问过详情的 & 最近出现在列表页过的.
List<String> visitedIds = visitSummaryService.queryUserRecentVisited(userId);
List<String> visitedIds = visitLogService.queryUserRecentVisited(userId);
List<String> excludes = ListUtils.union(req.excludeIds, visitedIds);
List<String> recmdIds = recommendService.getRecommendThemes(pageStart, querySize, userId, excludes);
......@@ -212,7 +212,7 @@ public class ThemeManager {
} else if (ThemeListTypeEnum.FOLLOW.getCode().equals(req.getType())) {
// TODO 临时埋点,接入新埋点后删除
if (CollectionUtils.isEmpty(req.getExcludeIds())) {
visitSummaryService.addPageView(userId, userId, VisitTypeEnum.FOLLOW_THEME_VIEW);
visitLogService.addPageView(userId, userId, VisitTypeEnum.FOLLOW_THEME_VIEW);
}
// 根据关注列表查询,按时间倒序
List<String> fansList = followRelService.queryFansByFollowerId(userId);
......@@ -327,7 +327,7 @@ public class ThemeManager {
// 查询正文
public ThemeQo getThemeDetail(String themeId, String userId) {
//TODO 临时埋点,接入新埋点后删除
visitSummaryService.addPageView(userId, themeId, VisitTypeEnum.THEME_PAGE_VIEW);
visitLogService.addPageView(userId, themeId, VisitTypeEnum.THEME_PAGE_VIEW);
// 查询详情
ThemeQo themeQo = redisCache.getObject(StringUtils.joinWith("_", CACHE_THEME_ID, themeId), 60,
() -> this.getDetailCommon(themeId), ThemeQo.class);
......@@ -384,7 +384,7 @@ public class ThemeManager {
//关注用户是否有更新
public Integer getFollowUpdateCount(String userId) {
LocalDateTime lastViewTime = visitSummaryService.queryLatestViewFollow(userId);
LocalDateTime lastViewTime = visitLogService.queryLatestViewFollow(userId);
List<String> fansList = followRelService.queryFansByFollowerId(userId);
return themeService.queryCountFromLastTime(fansList, lastViewTime);
}
......
......@@ -7,7 +7,7 @@ import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
import com.tanpu.community.api.enums.VisitTypeEnum;
import com.tanpu.community.service.RankService;
import com.tanpu.community.service.TopicService;
import com.tanpu.community.service.VisitSummaryService;
import com.tanpu.community.service.VisitLogService;
import com.tanpu.community.util.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -18,11 +18,9 @@ import java.util.List;
@Service
public class TopicManager {
@Autowired
private TopicService topicService;
@Autowired
private VisitSummaryService visitSummaryService;
private VisitLogService visitLogService;
@Autowired
private RankService rankService;
......@@ -46,7 +44,7 @@ public class TopicManager {
// 话题详情页
public TopicRankQo getDetail(String topicId) {
//TODO 临时埋点,接入新埋点后删除
visitSummaryService.addPageView(userHolder.getUserId(), topicId, VisitTypeEnum.TOPIC_PAGE_VIEW);
visitLogService.addPageView(userHolder.getUserId(), topicId, VisitTypeEnum.TOPIC_PAGE_VIEW);
return rankService.getTopicDetail(topicId);
}
......
......@@ -2,8 +2,8 @@ package com.tanpu.community.manager;
import com.alibaba.fastjson.JSON;
import com.tanpu.community.api.beans.vo.KafkaDurationUptMsg;
import com.tanpu.community.dao.entity.community.VisitSummaryEntity;
import com.tanpu.community.service.VisitSummaryService;
import com.tanpu.community.dao.entity.community.VisitLogEntity;
import com.tanpu.community.service.VisitLogService;
import com.tanpu.community.util.ConvertUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -21,7 +21,7 @@ public class VisitSummaryManager {
private KafkaTemplate<String, String> kafkaTemplate;
@Autowired
private VisitSummaryService visitSummaryService;
private VisitLogService visitLogService;
@KafkaListener(topics = kafakTopic)
......@@ -29,7 +29,7 @@ public class VisitSummaryManager {
log.info("receive kafka msg: {}", message);
KafkaDurationUptMsg msg = JSON.parseObject(message, KafkaDurationUptMsg.class);
// ident在每次进入新页面 & 回退 的时候都会随机生成一个,所以用ident做唯一key即可。
VisitSummaryEntity vs = ConvertUtil.convertFromKafka(msg);
visitSummaryService.insertOrUpdateDur(vs);
VisitLogEntity vs = ConvertUtil.convertFromKafka(msg);
visitLogService.insertOrUpdateDur(vs);
}
}
......@@ -33,7 +33,7 @@ public class RankService {
@Autowired
private TopicService topicService;
@Autowired
private VisitSummaryService visitSummaryService;
private VisitLogService visitLogService;
@Autowired
private FeignService feignService;
......@@ -57,7 +57,7 @@ public class RankService {
public void rankThemes() {
//7天内所有主题进行热度值排序
List<ThemeEntity> themeEntities = themeService.queryRecentdays(7);
if (CollectionUtils.isEmpty(themeEntities)){
if (CollectionUtils.isEmpty(themeEntities)) {
return;
}
List<ThemeAnalysDO> themeAnalysDOS = ConvertUtil.themeEntityToAnalysDOs(themeEntities);
......@@ -67,15 +67,15 @@ public class RankService {
Map<String, Integer> bookCountMap = collectionService.getCountMapByType(themeIds, CollectionTypeEnum.COLLECT_THEME);
Map<String, Integer> commentCountMap = commentService.getCountMapByThemeIds(themeIds);
Map<String, Integer> forwardCountMap = themeService.getForwardCountMap(themeIds);
Map<String, Integer> visitCountMap = visitSummaryService.getCountMapByTargetIds(themeIds, VisitTypeEnum.THEME_PAGE_VIEW);
Map<String, Integer> visitCountMap = visitLogService.getCountMapByTargetIds(themeIds, VisitTypeEnum.THEME_PAGE_VIEW);
for (ThemeAnalysDO theme : themeAnalysDOS) {
String themeId = theme.getThemeId();
theme.setCommentCount(commentCountMap.getOrDefault(themeId,0));
theme.setCommentCount(commentCountMap.getOrDefault(themeId, 0));
theme.setLikeCount(likeCountMap.getOrDefault(themeId, 0));
theme.setForwardCount(forwardCountMap.getOrDefault(themeId,0));
theme.setCollectCount(bookCountMap.getOrDefault(themeId,0));
theme.setViewCount(visitCountMap.getOrDefault(themeId,0));
theme.setForwardCount(forwardCountMap.getOrDefault(themeId, 0));
theme.setCollectCount(bookCountMap.getOrDefault(themeId, 0));
theme.setViewCount(visitCountMap.getOrDefault(themeId, 0));
//查询用户质量
String authorId = theme.getAuthorId();
UserInfoNew authorInfo = redisCache.getObject(StringUtils.joinWith("_", CACHE_FEIGN_USER_INFO, authorId),
......@@ -109,17 +109,17 @@ public class RankService {
}
List<TopicRankQo> topicRankQos = ConvertUtil.topicEntityToHotQos(topicEntities);
List<String> topicIds = topicRankQos.stream().map(TopicRankQo::getTopicId).collect(Collectors.toList());
Map<String, Integer> countMapByTargetIds = visitSummaryService.getCountMapByTargetIds(topicIds, VisitTypeEnum.TOPIC_PAGE_VIEW);
Map<String, Integer> countMapByTargetIds = visitLogService.getCountMapByTargetIds(topicIds, VisitTypeEnum.TOPIC_PAGE_VIEW);
for (TopicRankQo topic : topicRankQos) {
List<String> themeIds = themeService.queryThemeIdsByTopic(topic.getTopicId());
if (CollectionUtils.isEmpty(themeIds)) {
topic.setViewCount(countMapByTargetIds.getOrDefault(topic.getTopicId(),0));
topic.setViewCount(countMapByTargetIds.getOrDefault(topic.getTopicId(), 0));
topic.setDisscussCount(0);
continue;
}
// 浏览量
Integer topicPV = countMapByTargetIds.getOrDefault(topic.getTopicId(),0);
Integer themePV = visitSummaryService.queryThemeVisit(themeIds);
Integer topicPV = countMapByTargetIds.getOrDefault(topic.getTopicId(), 0);
Integer themePV = visitLogService.queryThemeVisit(themeIds);
topic.setViewCount(topicPV + themePV);
//讨论数=发布主题贴数+回复总数
Integer commentCount = commentService.getTotalCountByThemeIds(themeIds);
......
......@@ -42,7 +42,7 @@ public class RecommendService {
private ThemeService themeService;
@Autowired
private VisitSummaryService visitSummaryService;
private VisitLogService visitLogService;
// 最新
private List<ThemeAnalysDO> recentThemeList = new ArrayList<>();
......
......@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.VisitTypeEnum;
import com.tanpu.community.dao.entity.community.TimesCountEntity;
import com.tanpu.community.dao.entity.community.VisitSummaryEntity;
import com.tanpu.community.dao.mapper.community.VisitSummaryMapper;
import com.tanpu.community.dao.entity.community.VisitLogEntity;
import com.tanpu.community.dao.mapper.community.VisitLogMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
......@@ -23,16 +23,16 @@ import java.util.stream.Collectors;
@Slf4j
@Service
public class VisitSummaryService {
public class VisitLogService {
@Resource
private VisitSummaryMapper visitSummaryMapper;
private VisitLogMapper visitLogMapper;
// 获取用户7天内访问过的
public List<String> queryUserRecentVisited(String userId) {
Date endDate = new Date();
Date startDate = DateUtils.addDays(endDate, -7);
List<String> visited = visitSummaryMapper.selectRefIdByUserIdAndCreateBetween(userId, startDate, endDate);
List<String> visited = visitLogMapper.selectRefIdByUserIdAndCreateBetween(userId, startDate, endDate);
return visited;
}
......@@ -41,33 +41,33 @@ public class VisitSummaryService {
if (refIds.isEmpty()) {
return refIds;
}
List<String> visited = visitSummaryMapper.selectList(new LambdaQueryWrapper<VisitSummaryEntity>()
.eq(VisitSummaryEntity::getVisitorId, userId)
.in(VisitSummaryEntity::getRefId, refIds))
.stream().map(VisitSummaryEntity::getRefId).distinct().collect(Collectors.toList());
List<String> visited = visitLogMapper.selectList(new LambdaQueryWrapper<VisitLogEntity>()
.eq(VisitLogEntity::getVisitorId, userId)
.in(VisitLogEntity::getRefId, refIds))
.stream().map(VisitLogEntity::getRefId).distinct().collect(Collectors.toList());
return ListUtils.subtract(refIds, visited);
}
public List<String> queryUserVisited(String userId) {
List<String> visited = visitSummaryMapper.selectList(new LambdaQueryWrapper<VisitSummaryEntity>()
.eq(VisitSummaryEntity::getVisitorId, userId))
.stream().map(VisitSummaryEntity::getRefId).distinct().collect(Collectors.toList());
List<String> visited = visitLogMapper.selectList(new LambdaQueryWrapper<VisitLogEntity>()
.eq(VisitLogEntity::getVisitorId, userId))
.stream().map(VisitLogEntity::getRefId).distinct().collect(Collectors.toList());
return visited;
}
@Transactional
public void insertOrUpdateDur(VisitSummaryEntity vs) {
if (visitSummaryMapper.selectByIdent(vs.getIdent()) == null) {
visitSummaryMapper.insert(vs);
public void insertOrUpdateDur(VisitLogEntity vs) {
if (visitLogMapper.selectByIdent(vs.getIdent()) == null) {
visitLogMapper.insert(vs);
} else {
visitSummaryMapper.updateDurByIdent(vs.getDuration(), vs.getIdent());
visitLogMapper.updateDurByIdent(vs.getDuration(), vs.getIdent());
}
}
@Transactional
//TODO 临时埋点,接入新埋点后删除
public void addPageView(String userId, String targetId, VisitTypeEnum type) {
visitSummaryMapper.insert(VisitSummaryEntity.builder()
visitLogMapper.insert(VisitLogEntity.builder()
.visitorId(userId)
.refId(targetId)
.refType(type.getCode())
......@@ -77,16 +77,16 @@ public class VisitSummaryService {
// 查询话题 详细页面 浏览量
public Integer queryTopicDetailVisit(String topicId) {
return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>()
.eq(VisitSummaryEntity::getRefId, topicId)
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.TOPIC_PAGE_VIEW.getCode()));
return visitLogMapper.selectCount(new LambdaQueryWrapper<VisitLogEntity>()
.eq(VisitLogEntity::getRefId, topicId)
.eq(VisitLogEntity::getRefType, VisitTypeEnum.TOPIC_PAGE_VIEW.getCode()));
}
// 查询主题 浏览量
public Integer queryThemeVisit(String theme) {
return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>()
.eq(VisitSummaryEntity::getRefId, theme)
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.THEME_PAGE_VIEW.getCode()));
return visitLogMapper.selectCount(new LambdaQueryWrapper<VisitLogEntity>()
.eq(VisitLogEntity::getRefId, theme)
.eq(VisitLogEntity::getRefType, VisitTypeEnum.THEME_PAGE_VIEW.getCode()));
}
// 查询主题 浏览量
......@@ -94,16 +94,16 @@ public class VisitSummaryService {
if (CollectionUtils.isEmpty(themes)){
return 0;
}
return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>()
.in(VisitSummaryEntity::getRefId, themes)
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.THEME_PAGE_VIEW.getCode()));
return visitLogMapper.selectCount(new LambdaQueryWrapper<VisitLogEntity>()
.in(VisitLogEntity::getRefId, themes)
.eq(VisitLogEntity::getRefType, VisitTypeEnum.THEME_PAGE_VIEW.getCode()));
}
public LocalDateTime queryLatestViewFollow(String userId) {
List<VisitSummaryEntity> visitSummaryEntities = visitSummaryMapper.selectList(new LambdaQueryWrapper<VisitSummaryEntity>()
.eq(VisitSummaryEntity::getVisitorId, userId)
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.FOLLOW_THEME_VIEW.getCode())
.orderByDesc(VisitSummaryEntity::getCreateTime));
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 {
......@@ -116,12 +116,12 @@ public class VisitSummaryService {
if (CollectionUtils.isEmpty(refIds)){
return new HashMap<>();
}
LambdaQueryWrapper<VisitSummaryEntity> wrapper = (new LambdaQueryWrapper<VisitSummaryEntity>()
.in(VisitSummaryEntity::getRefId,refIds))
.eq(VisitSummaryEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED)
.eq(VisitSummaryEntity::getRefType,type.getCode())
.groupBy(VisitSummaryEntity::getRefId);
return visitSummaryMapper.selectCountByThemeIds(wrapper).stream()
LambdaQueryWrapper<VisitLogEntity> wrapper = (new LambdaQueryWrapper<VisitLogEntity>()
.in(VisitLogEntity::getRefId,refIds))
.eq(VisitLogEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED)
.eq(VisitLogEntity::getRefType,type.getCode())
.groupBy(VisitLogEntity::getRefId);
return visitLogMapper.selectCountByThemeIds(wrapper).stream()
.collect(Collectors.toMap(TimesCountEntity::getId, TimesCountEntity::getTimes));
}
}
......@@ -120,8 +120,8 @@ public class ConvertUtil {
/**
* VISIT_SUMMARY
*/
public static VisitSummaryEntity convertFromKafka(KafkaDurationUptMsg msg) {
VisitSummaryEntity vs = new VisitSummaryEntity();
public static VisitLogEntity convertFromKafka(KafkaDurationUptMsg msg) {
VisitLogEntity vs = new VisitLogEntity();
vs.setAuthorId(msg.pidUserId);
vs.setDeleteTag(DeleteTagEnum.NOT_DELETED.ordinal());
vs.setDuration(1);
......
<?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.tanpu.community.dao.mapper.community.VisitSummaryMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.VisitSummaryEntity">
<id column="id" property="id" />
<result column="ident" property="ident" />
<result column="visitor_id" property="visitorId" />
<result column="author_id" property="authorId" />
<result column="ref_id" property="refId" />
<result column="ref_type" property="refType" />
<result column="duration" property="duration" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
</mapper>
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