Commit 4d981269 authored by 张辰's avatar 张辰

id int->bigint

parent 1a2f5fdb
......@@ -6,6 +6,13 @@ import java.time.LocalDate;
@Data
public class KafkaDurationUptMsg {
private String ident;
private Long durMillsInc;
public String ident;
public long durMillsInc;
public String pidUuid;
public String pidUserId;
public String visitorId;
public String faId;
public String pageId;
public String refId;
public LocalDate localDate;
}
package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
......@@ -18,12 +14,9 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
@TableName("black_list")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="BlackListEntity对象", description="黑名单")
public class BlackListEntity implements Serializable {
......@@ -31,7 +24,7 @@ public class BlackListEntity implements Serializable {
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Long id;
@ApiModelProperty(value = "屏蔽发起人")
private String blocker;
......@@ -51,11 +44,11 @@ public class BlackListEntity implements Serializable {
private Integer deleteTag;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
......
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;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
......@@ -16,12 +12,9 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
@TableName("collection")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="CollectionEntity对象", description="收藏/点赞")
public class CollectionEntity implements Serializable {
......@@ -30,7 +23,7 @@ public class CollectionEntity implements Serializable {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "类型 1:点赞,2:收藏")
@ApiModelProperty(value = "类型 1:点赞主题,2:收藏主题 3、点赞评论")
private Integer collectionType;
@ApiModelProperty(value = "用户id")
......
package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
......@@ -18,12 +14,9 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
@TableName("comment")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="CommentEntity对象", description="评论")
public class CommentEntity implements Serializable {
......@@ -31,12 +24,12 @@ public class CommentEntity implements Serializable {
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Long id;
@ApiModelProperty(value = "uuid")
@ApiModelProperty(value = "评论主键Id")
private String commentId;
@ApiModelProperty(value = "类型")
@ApiModelProperty(value = "类型 1:评论")
private Integer commentType;
@ApiModelProperty(value = "文本内容")
......@@ -54,8 +47,11 @@ public class CommentEntity implements Serializable {
@ApiModelProperty(value = "回复评论id")
private String replyId;
@ApiModelProperty(value = "是否屏蔽")
private Integer isBlock;
@ApiModelProperty(value = "是否通过 0:初始值 1:已通过(管理后台使用)")
private Integer isPass;
@ApiModelProperty(value = "举报状态 0:未被举报 1:被举报 2:已处理")
private Integer reportStatus;
private LocalDateTime createTime;
......@@ -64,11 +60,11 @@ public class CommentEntity implements Serializable {
private Integer deleteTag;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
......@@ -128,12 +124,20 @@ public class CommentEntity implements Serializable {
this.replyId = replyId;
}
public Integer getIsBlock() {
return isBlock;
public Integer getIsPass() {
return isPass;
}
public void setIsPass(Integer isPass) {
this.isPass = isPass;
}
public Integer getReportStatus() {
return reportStatus;
}
public void setIsBlock(Integer isBlock) {
this.isBlock = isBlock;
public void setReportStatus(Integer reportStatus) {
this.reportStatus = reportStatus;
}
public LocalDateTime getCreateTime() {
......@@ -171,7 +175,8 @@ public class CommentEntity implements Serializable {
", themeId=" + themeId +
", parentId=" + parentId +
", replyId=" + replyId +
", isBlock=" + isBlock +
", isPass=" + isPass +
", reportStatus=" + reportStatus +
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
......
package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
......@@ -18,12 +14,9 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-12
* @since 2021-07-22
*/
@TableName("follow_rel")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="FollowRelEntity对象", description="粉丝关系")
public class FollowRelEntity implements Serializable {
......@@ -31,7 +24,7 @@ public class FollowRelEntity implements Serializable {
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Long id;
@ApiModelProperty(value = "被关注的人id")
private String followUserId;
......@@ -52,11 +45,11 @@ public class FollowRelEntity implements Serializable {
private Integer deleteTag;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
......
package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
......@@ -18,12 +14,9 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
@TableName("home_page")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="HomePageEntity对象", description="个人主页")
public class HomePageEntity implements Serializable {
......@@ -31,7 +24,7 @@ public class HomePageEntity implements Serializable {
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Long id;
@ApiModelProperty(value = "用户id")
private String userId;
......@@ -58,11 +51,11 @@ public class HomePageEntity implements Serializable {
private Integer deleteTag;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
......
package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
* 举报记录
* </p>
*
* @author xudong
* @since 2021-07-22
*/
@TableName("report_log")
@ApiModel(value="ReportLogEntity对象", description="举报记录")
public class ReportLogEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "举报发起人")
private String userId;
@ApiModelProperty(value = "举报类型,1:主题,2:评论 3、用户")
private Integer reportType;
@ApiModelProperty(value = "举报对象id")
private String targetId;
@ApiModelProperty(value = "举报对象作者id")
private String targetUserId;
private String reportReason;
@ApiModelProperty(value = "上报时间")
private LocalDateTime reportTime;
@ApiModelProperty(value = "处理结果 0:无操作 1:屏蔽 2:删除 ")
private Integer dealResult;
@ApiModelProperty(value = "处理管理员")
private Integer dealUserId;
@ApiModelProperty(value = "处理时间")
private LocalDateTime dealTime;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private Integer deleteTag;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Integer getReportType() {
return reportType;
}
public void setReportType(Integer reportType) {
this.reportType = reportType;
}
public String getTargetId() {
return targetId;
}
public void setTargetId(String targetId) {
this.targetId = targetId;
}
public String getTargetUserId() {
return targetUserId;
}
public void setTargetUserId(String targetUserId) {
this.targetUserId = targetUserId;
}
public String getReportReason() {
return reportReason;
}
public void setReportReason(String reportReason) {
this.reportReason = reportReason;
}
public LocalDateTime getReportTime() {
return reportTime;
}
public void setReportTime(LocalDateTime reportTime) {
this.reportTime = reportTime;
}
public Integer getDealResult() {
return dealResult;
}
public void setDealResult(Integer dealResult) {
this.dealResult = dealResult;
}
public Integer getDealUserId() {
return dealUserId;
}
public void setDealUserId(Integer dealUserId) {
this.dealUserId = dealUserId;
}
public LocalDateTime getDealTime() {
return dealTime;
}
public void setDealTime(LocalDateTime dealTime) {
this.dealTime = dealTime;
}
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 "ReportLogEntity{" +
"id=" + id +
", userId=" + userId +
", reportType=" + reportType +
", targetId=" + targetId +
", targetUserId=" + targetUserId +
", reportReason=" + reportReason +
", reportTime=" + reportTime +
", dealResult=" + dealResult +
", dealUserId=" + dealUserId +
", dealTime=" + dealTime +
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
}
}
package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
......@@ -18,12 +14,9 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
@TableName("theme")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="ThemeEntity对象", description="主题内容")
public class ThemeEntity implements Serializable {
......@@ -31,41 +24,48 @@ public class ThemeEntity implements Serializable {
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Long id;
@ApiModelProperty(value = "UUID")
@ApiModelProperty(value = "主题主键Id")
private String themeId;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "类型")
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发")
private Integer themeType;
@ApiModelProperty(value = "文本内容")
@ApiModelProperty(value = "文本内容(json),type:附件类型(8:文本,88:产品 3:直播 6:短视频 300:课程,9:图片 10:多图),productType:基金类型(0 公募,1 私募,2 白名单,3 私有)")
private String content;
@ApiModelProperty(value = "作者id")
private String authorId;
@ApiModelProperty(value = "转发的主题")
@ApiModelProperty(value = "转发的主题")
private String formerThemeId;
@ApiModelProperty(value = "所属的话题")
private String topicId;
@ApiModelProperty(value = "是否通过 0:初始值 1:已通过(管理后台使用)")
private Integer isPass;
@ApiModelProperty(value = "举报状态 0:未被举报 1:被举报 2:已处理")
private Integer reportStatus;
private LocalDateTime createTime;
private LocalDateTime updateTime;
@ApiModelProperty(value = "1:删除")
private Integer deleteTag;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
......@@ -125,6 +125,22 @@ public class ThemeEntity implements Serializable {
this.topicId = topicId;
}
public Integer getIsPass() {
return isPass;
}
public void setIsPass(Integer isPass) {
this.isPass = isPass;
}
public Integer getReportStatus() {
return reportStatus;
}
public void setReportStatus(Integer reportStatus) {
this.reportStatus = reportStatus;
}
public LocalDateTime getCreateTime() {
return createTime;
}
......@@ -160,6 +176,8 @@ public class ThemeEntity implements Serializable {
", authorId=" + authorId +
", formerThemeId=" + formerThemeId +
", topicId=" + topicId +
", isPass=" + isPass +
", reportStatus=" + reportStatus +
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
......
package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
......@@ -18,12 +14,9 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
@TableName("topic")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="TopicEntity对象", description="话题")
public class TopicEntity implements Serializable {
......@@ -31,9 +24,9 @@ public class TopicEntity implements Serializable {
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Long id;
@ApiModelProperty(value = "uuid")
@ApiModelProperty(value = "话题主键Id")
private String topicId;
@ApiModelProperty(value = "话题名称")
......@@ -45,7 +38,7 @@ public class TopicEntity implements Serializable {
@ApiModelProperty(value = "是否隐藏")
private Integer isConceal;
@ApiModelProperty(value = "浏览量调整")
@ApiModelProperty(value = "浏览量调整基数")
private Long viewCntAdjust;
private LocalDateTime createTime;
......@@ -55,11 +48,11 @@ public class TopicEntity implements Serializable {
private Integer deleteTag;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
......@@ -95,12 +88,12 @@ public class TopicEntity implements Serializable {
this.isConceal = isConceal;
}
public Long getviewCntAdjust() {
public Long getViewCntAdjust() {
return viewCntAdjust;
}
public void setViewAmountModify(Long viewAmountModify) {
this.viewCntAdjust = viewAmountModify;
public void setViewCntAdjust(Long viewCntAdjust) {
this.viewCntAdjust = viewCntAdjust;
}
public LocalDateTime getCreateTime() {
......@@ -135,7 +128,7 @@ public class TopicEntity implements Serializable {
", topicTitle=" + topicTitle +
", isTop=" + isTop +
", isConceal=" + isConceal +
", viewAmountModify=" + viewCntAdjust +
", viewCntAdjust=" + viewCntAdjust +
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
......
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;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
......@@ -16,19 +12,16 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-19
* @since 2021-07-22
*/
@TableName("visit_summary")
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel(value="VisitSummaryEntity对象", description="浏览记录")
public class VisitSummaryEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
private Long id;
@ApiModelProperty(value = "session_id")
private String ident;
......@@ -55,11 +48,11 @@ public class VisitSummaryEntity implements Serializable {
private Integer deleteTag;
public String getId() {
public Long getId() {
return id;
}
public void setId(String id) {
public void setId(Long id) {
this.id = id;
}
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
public interface BlackListMapper extends BaseMapper<BlackListEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
public interface CollectionMapper extends BaseMapper<CollectionEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
public interface CommentMapper extends BaseMapper<CommentEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
public interface FollowRelMapper extends BaseMapper<FollowRelEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
public interface HomePageMapper extends BaseMapper<HomePageEntity> {
......
package com.tanpu.community.dao.mapper.community;
import com.tanpu.community.dao.entity.community.ReportLogEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 举报记录 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-07-22
*/
public interface ReportLogMapper extends BaseMapper<ReportLogEntity> {
}
......@@ -2,10 +2,6 @@ package com.tanpu.community.dao.mapper.community;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* <p>
......@@ -13,7 +9,7 @@ import java.util.List;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
public interface ThemeMapper extends BaseMapper<ThemeEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-22
*/
public interface TopicMapper extends BaseMapper<TopicEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-07-19
* @since 2021-07-22
*/
public interface VisitSummaryMapper extends BaseMapper<VisitSummaryEntity> {
......
package com.tanpu.community.manager;
import com.alibaba.fastjson.JSON;
import com.tanpu.community.api.beans.vo.KafkaDurationUptMsg;
import com.tanpu.community.service.VisitSummaryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class KafkaManager {
@Autowired
private KafkaTemplate<String, String> kafkaTemplate;
@Autowired
private VisitSummaryService visitSummaryService;
// public void sendMessage(String message) {
// System.out.println("#### send " + message);
// this.kafkaTemplate.send("users", message);
// }
// todo topic
@KafkaListener(topics = "newCommunityVisitor")
public void consumeVisitorHis(String message) {
System.out.println("#### receive " + message);
}
// todo topic
@KafkaListener(topics = "newCommunityVisitor")
public void consumeDurationUpdate(String message) {
KafkaDurationUptMsg msg = JSON.parseObject(message, KafkaDurationUptMsg.class);
visitSummaryService.updateDurByIdent(msg.getIdent(), msg.getDurMillsInc().intValue());
}
}
package com.tanpu.community.manager;
import com.alibaba.fastjson.JSON;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.community.api.beans.vo.KafkaDurationUptMsg;
import com.tanpu.community.api.enums.VisitTypeEnum;
import com.tanpu.community.dao.entity.community.VisitSummaryEntity;
import com.tanpu.community.service.VisitSummaryService;
import com.tanpu.community.util.ConvertUtil;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.common.recycler.Recycler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Slf4j
@Service
public class VisitSummaryManager {
@Resource
private static final String kafakTopic = "tp_new_community_queue_ubr_dur_upd";
@Autowired
private KafkaTemplate<String, String> kafkaTemplate;
@Autowired
private VisitSummaryService visitSummaryService;
@Autowired
private UserHolder userHolder;
@KafkaListener(topics = kafakTopic)
public void updateVisitSummary(String message) {
KafkaDurationUptMsg msg = JSON.parseObject(message, KafkaDurationUptMsg.class);
// ident在每次进入新页面 & 回退 的时候都会随机生成一个,所以用ident做唯一key即可。
VisitSummaryEntity vs = ConvertUtil.convertFromKafka(msg);
}
public void addTopicPageView(String topicId) {
String userId = userHolder.getUserId();
visitSummaryService.addPageView(userId, topicId, VisitTypeEnum.TOPIC_PAGE_VIEW);
......@@ -31,5 +58,4 @@ public class VisitSummaryManager {
String userId = userHolder.getUserId();
visitSummaryService.addPageView(userId, userId, VisitTypeEnum.FOLLOW_THEME_VIEW);
}
}
......@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.resp.FileUploadResp;
import com.tanpu.community.api.beans.vo.ImagesDTO;
import com.tanpu.community.api.beans.vo.KafkaDurationUptMsg;
import com.tanpu.community.api.beans.vo.TopicDTO;
import com.tanpu.community.api.beans.qo.*;
import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
......@@ -13,6 +14,7 @@ import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.api.enums.TopicStatusEnum;
import com.tanpu.community.dao.entity.community.*;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import org.elasticsearch.common.recycler.Recycler;
import org.springframework.beans.BeanUtils;
import org.springframework.util.StringUtils;
......@@ -27,6 +29,9 @@ import java.util.stream.Collectors;
public class ConvertUtil {
/**
* THEME
*/
public static ThemeQo themeEntityToQo(ThemeEntity themeEntity) {
if (themeEntity == null) {
return null;
......@@ -88,6 +93,9 @@ public class ConvertUtil {
}
/**
* TOPIC
*/
public static TopicDTO topicEntityToDTO(TopicEntity topicEntity) {
TopicDTO topicDTO = new TopicDTO();
BeanUtils.copyProperties(topicEntity, topicDTO);
......@@ -163,6 +171,22 @@ public class ConvertUtil {
}
}
/**
* VISIT_SUMMARY
*/
public static VisitSummaryEntity convertFromKafka(KafkaDurationUptMsg msg) {
VisitSummaryEntity vs = new VisitSummaryEntity();
vs.setAuthorId(msg.pidUserId);
vs.setDeleteTag(DeleteTagEnum.NOT_DELETED.ordinal());
vs.setDuration(1);
vs.setIdent(msg.ident);
vs.setRefId(msg.refId);
// todo
vs.setRefType(-1);
vs.setVisitorId(msg.visitorId);
return vs;
}
/**
* 解析 List<ThemeContentReq>为Attachment列表
*
......
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