Commit bcfbd8dc authored by 张辰's avatar 张辰

Merge branch 'dev' into 'master'

Dev

See merge request !3
......@@ -20,4 +20,7 @@ public final class CommunityConstant {
public static final String OSS_PREFIX_FOLDER ="community/";
//图片压缩比例:50%
public static final String OSS_RESIZE_RATIO = "?x-oss-process=image/resize,p_50";
}
......@@ -22,8 +22,6 @@ public class ThemeAnalysDO {
@ApiModelProperty(value = "作者id")
private String authorId;
@ApiModelProperty(value = "被转发的主题")
private String formerThemeId;
@ApiModelProperty(value = "所属的话题")
private String topicId;
......@@ -44,18 +42,12 @@ public class ThemeAnalysDO {
private Integer viewCount;
@ApiModelProperty(value = "距今时间")
private Long minuteTillNow;
private Long minutesTillNow;
@ApiModelProperty(value = "用户质量")
private Double userWeight = 0.0;
public Double getRank() {
// 质量=帖子质量+用户质量
double w = (double) (viewCount * 0.1 + forwardCount * 3 + commentCount * 2 + likeCount * 1 + collectCount * 3) + userWeight;
double i = 1;//初试权重
double t = Double.valueOf(minuteTillNow) / 60;
double g = 0.1;//时间系数
return (w + i) / Math.pow(t + 1, g);
}
private Double score=0.0;
}
......@@ -56,8 +56,6 @@ public class ThemeQo implements Serializable {
@ApiModelProperty(value = "当前用户是否关注该作者")
public boolean follow;
@ApiModelProperty(value = "认证机构")
private String authOrg;
......
......@@ -38,21 +38,7 @@ public class TopicRankQo {
@ApiModelProperty(value = "话题下的帖子权重")
private Double themeWeight;
private Integer hoursTillNow;
/**
* 热度计算算法
*
* @return
*/
public Double getRank() {
double g = 0.3;//时间系数
//顶置话题
if (isTop > 0) {
return Double.MAX_VALUE;
}
Double socre = ((disscussCount * 3 + viewCount) / Math.pow(hoursTillNow + 1, g)) + themeWeight;
return socre;
}
private Integer minutesTillNow;
private Double score;
}
......@@ -10,11 +10,11 @@ import lombok.Data;
public class QueryFollowReq {
@ApiModelProperty(value = "用户Id")
private String userId;
public String userId;
@ApiModelProperty(value = "查询类型,1:粉丝 2:关注")
private Integer queryType;
public Integer queryType;
@ApiModelProperty(value = "分页")
private Pageable page;
public Pageable page;
}
......@@ -22,6 +22,9 @@ public class ImagesDTO {
@ApiModelProperty("图片url")
private String remark;
@ApiModelProperty("压缩图片url")
private String resizeUrl;
@ApiModelProperty("图片宽度")
private Integer imgHeight;
......
......@@ -19,9 +19,8 @@ import java.io.Serializable;
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "用户信息 首席投顾专用信息")
public class UserInfoNewChief implements Serializable {
public class UserInfoNewChief {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "用户id")
private String userId;
......@@ -57,4 +56,7 @@ public class UserInfoNewChief implements Serializable {
@ApiModelProperty(value = "头像url")
private String headImageUrl;
@ApiModelProperty(value = "首席投顾数量")
private Long chiefCount;
}
\ No newline at end of file
package com.tanpu.community.api.beans.vo.feign.fatools;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
......@@ -20,44 +22,11 @@ import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "用户信息 机构")
public class UserInfoNewOrg implements Serializable {
private static final long serialVersionUID = 1L;
public class UserInfoNewOrg {
//↓↓↓↓ 机构 ↓↓↓↓
// @ApiModelProperty(value = "申请用户id")
// private String applyUserId;
// @ApiModelProperty(value = "机构id")
// private String userIdOrg;
// @ApiModelProperty(value = "公司名称")
// private String companyName;
// @ApiModelProperty(value = "公司全称")
// private String companyFullName;
// @ApiModelProperty(value = "营业执照账号")
// private String businessLicenseNumber;
// @ApiModelProperty(value = "营业执照 图片url")
// private String businessLicenseImageUrl;
// @ApiModelProperty(value = "机构用户身份公函 url")
// private String identityLetterUrl;
// @ApiModelProperty(value = "机构认证信息登记表 url")
// private String orgAuthInfoFormUrl;
// @ApiModelProperty(value = "运营人员 职位")
// private String position;
// @ApiModelProperty(value = "审核状态 1初始提交 2审核不通过 3审核通过")
// private Integer auditStatus;
// @ApiModelProperty(value = "认证名称")
// private String certName;
// @ApiModelProperty(value = "是否匹配现有基金公司 0不匹配 1匹配")
// private Integer isExistOrg;
// @ApiModelProperty(value = "所属基金公司id")
// private String belongOrgId;
// @ApiModelProperty(value = "所属基金公司类型 0公募 1私募")
// private Integer belongOrgType;
@ApiModelProperty(value = "机构id")
private String corpId;
@ApiModelProperty(value = "公司简称")
private String corpShortName;
@ApiModelProperty(value = "公司全称")
private String corpName;
@ApiModelProperty(value = "营业执照账号")
......@@ -73,6 +42,8 @@ public class UserInfoNewOrg implements Serializable {
@ApiModelProperty(value = "审核状态 0待审核 1通过 2驳回")
private Integer auditStatus;
@ApiModelProperty(value = "审核时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date auditTime;
@ApiModelProperty(value = "运营人员姓名")
private String operatorName;
......
......@@ -2,8 +2,10 @@ package com.tanpu.community.api.beans.vo.feign.fatools;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 机构人员信息
......@@ -12,6 +14,8 @@ import lombok.Data;
**/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "用户信息 机构人员信息")
public class UserInfoOrg {
......
......@@ -37,8 +37,8 @@ public class UserInfoResp {
@ApiModelProperty("基金数")
private Integer fundNumber = 0;
@ApiModelProperty("成立时间")
private long founded;
@ApiModelProperty("成立时间 yyyy-MM-dd")
private String founded;
@ApiModelProperty("备案编号")
private String recordNumber = "-";
@ApiModelProperty("团队成员")
......
......@@ -2,32 +2,12 @@ package com.tanpu.community.api.constants;
public class RedisKeyConstant {
//话题页浏览量
public static final String TOPIC_PAGE_VIEW_COUNT_ ="TOPIC_PAGE_VIEW_COUNT_";
//话题总浏览量=总浏览量+带这个话题的帖子量
public static final String TOPIC_TOTAL_VIEW_COUNT_="TOPIC_TOTAL_VIEW_COUNT_";
//点赞量
public static final String TOPIC_LIKE_COUNT_="TOPIC_LIKE_COUNT_";
public static final String THEME_LIKE_COUNT ="THEME_LIKE_COUNT_";
//收藏量
public static final String TOPIC_BOOK_COUNT_="TOPIC_BOOK_COUNT_";
//用户数
public static final String TOPIC_USER_COUNT_="TOPIC_USER_COUNT_";
public static final String THEME_COMMENT_COUNT ="THEME_COMMENT_COUNT_";
//讨论量=发布主题贴数+回复总数
public static final String TOPIC_DISCUSS_COUNT_="TOPIC_DISCUSS_COUNT_";
//发帖数
public static final String TOPIC_THEME_COUNT_="TOPIC_THEME_COUNT_";
//回帖数
public static final String TOPIC_COMMENT_COUNT_="TOPIC_COMMENT_COUNT_";
//总用户数=访问话题页+发帖+回帖(去重)
public static final String TOPIC_TOTAL_USER_COUNT_ ="TOPIC_TOTAL_USER_COUNT_";
//访问话题人数
public static final String TOPIC_USER_VIEW_COUNT_="TOPIC_USER_VIEW_COUNT_";
//发帖人数
public static final String TOPIC_POST_USER_COUNT_ ="TOPIC_POST_USER_COUNT_";
//回帖人数
public static final String TOPIC_COMMENT_USER_COUNT_ ="TOPIC_COMMENT_USER_COUNT_";
// 出现在用户的搜索列表中的主题id
public static final String THEME_APPEAR_IN_SEARCH_LIST = "THEME_APPEAR_IN_SEARCH_LIST_";
public static final String THEME_FORWARD_COUNT ="THEME_FORWARD_COUNT_";
// feign 查询用户信息
public static final String CACHE_FEIGN_USER_INFO = "CACHE_FEIGN_USER_INFO_";
......@@ -38,12 +18,9 @@ public class RedisKeyConstant {
// 主题本身
public static final String CACHE_THEME_ID = "CACHE_THEME_ID_";
// 转发主题本身
public static final String CACHE_FORMER_THEME_ID = "CACHE_FORMER_THEME_ID_";
public static final String CACHE_FORWARD_THEME_ID = "CACHE_FORWARD_THEME_ID_";
// 关注的人,上次浏览的最新主题last id
public static final String CACHE_IDOL_THEME_LAST_ID = "CACHE_IDOL_THEME_LAST_ID_";
public static final String THEME_VIEW_COUNT_="THEME_VIEW_COUNT_";
public static final String THEME_LIKE_COUNT_="THEME_LIKE_COUNT_";
public static final String THEME_BOOK_COUNT_="THEME_BOOK_COUNT_";
}
......@@ -9,7 +9,7 @@ public enum FileTypeEnum {
IMAGE(1,"图片类型"),QUERY_IDOLS(2,"查询关注");
public static final HashSet<String> imageTypeSet = SetUtils.hashSet("jpg", "jpeg", "png");
public static final HashSet<String> ossTypeSet = SetUtils.hashSet("jpg", "jpeg", "png", "txt");
private Integer code;
private String type;
......
package com.tanpu.community.api.enums;
import org.apache.commons.collections4.SetUtils;
import java.util.HashSet;
public enum ThemeRecordTypeEnum {
PUBLISH_LIST(1,"发布列表"),
COMMENT_LIST(2,"评论列表"),
LIKE_LIST(3,"点赞"),
COLLECT_LIST(4,"收藏");
public static final HashSet<String> imageTypeSet = SetUtils.hashSet("jpg", "jpeg", "png");
private Integer code;
private String type;
ThemeRecordTypeEnum(Integer code, String type) {
this.code = code;
this.type = type;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
......@@ -10,6 +10,7 @@ import com.tanpu.community.api.beans.resp.FileUploadResp;
import com.tanpu.community.api.enums.OssDirEnum;
import com.tanpu.community.cache.RedisCache;
import com.tanpu.community.manager.FileManager;
import com.tanpu.community.service.RankLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.caffeine.CaffeineCacheManager;
......@@ -28,6 +29,9 @@ public class FileController {
@Autowired
private FileManager fileManager;
@Autowired
private RankLogService rankLogService;
@Resource
private UserHolder userHolder;
......@@ -47,28 +51,16 @@ public class FileController {
return CommonResp.success(fileManager.uploadFile(file, OssDirEnum.Theme_Pic, userId));
}
@GetMapping("/test")
public String test() {
// redisCache.put("11111", JsonUtil.toJson(list), 60);
//
// String v = redisCache.get("11111");
// System.out.println(v);
// System.out.println(JsonUtil.toJson(JsonUtil.toBean(v, new TypeReference<List<String>>() {
// })));
@GetMapping("/clearRankLog")
public String clearRankLog() {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
rankLogService.clearRankLog();
}
});
// localCache.getCache("local").put("999", "6666666");
// System.out.println((String) localCache.getCache("local").get("999").get());
//
//
// for (int i = 0; i < 30; i++) {
// System.out.println(fileManager.getId("" + i / 2));
// }
//
// for (int i = 30; i > 0; i--) {
// System.out.println(fileManager.getId("" + i / 2));
// }
return "";
t.start();
return "success";
}
}
......@@ -78,6 +78,7 @@ public class HomePageController {
@PostMapping(value = "/addIdol")
@ApiOperation("关注/取消关注他人")
@ResponseBody
@AuthLogin
public CommonResp addIdol(@RequestBody FollowRelReq req) {
String userId = userHolder.getUserId();
homePageManager.addFollowRel(req, userId);
......
......@@ -52,7 +52,7 @@ public class ThemeController {
@ResponseBody
public CommonResp<ThemeQo> getDetail(@RequestParam(value = "themeId") String themeId) {
String userId = userHolder.getUserId();
return CommonResp.success(themeManager.getThemeDetail(themeId, userId));
return themeManager.getThemeDetail(themeId, userId);
}
@AuthLogin
......
......@@ -31,7 +31,7 @@ public class TopicController {
@PostMapping(value = "/list")
@ApiOperation("APP全部话题页面,可搜索")
@ResponseBody
public CommonResp<Page<TopicRankQo>> getTopicBriefInfoList(@RequestBody TopicSearchReq req){
public CommonResp<Page<TopicRankQo>> getTopicList(@RequestBody TopicSearchReq req){
return CommonResp.success(topicManager.getAllTopicBriefInfo(req));
}
......@@ -39,15 +39,15 @@ public class TopicController {
@GetMapping(value = "/detailPage")
@ApiOperation("话题详情页顶部")
@ResponseBody
public CommonResp<TopicRankQo> gethotThemes(@RequestParam String topicId){
return CommonResp.success(topicManager.getDetail(topicId));
public CommonResp<TopicRankQo> getDetail(@RequestParam String topicId){
return topicManager.getDetail(topicId);
}
@GetMapping(value = "/titleList")
@ApiOperation("首页顶部话题标题列")
@ResponseBody
public CommonResp<List<TopicRankQo>> getTitleList(){
public CommonResp<List<TopicRankQo>> getTop4Topic(){
return CommonResp.success(topicManager.getTop4TopicTitles());
}
......
package com.tanpu.community.dao;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.tanpu.community.api.CommunityConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
/**
* created by xd on 2021/6/3
*/
@Configuration
@Slf4j
@MapperScan(basePackages = CommunityConstant.PACKAGE_BASE + ".dao.mapper.user", sqlSessionTemplateRef = "userSqlSessionTemplate")
public class UserDataSourceConfig {
@ConfigurationProperties(prefix = "spring.datasource.user")
@Bean(name = "userDataSource")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "userSqlSessionFactory")
public SqlSessionFactory sqlSessionFactory(@Qualifier("userDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(
"classpath*:mapper/user/*.xml"));
return bean.getObject();
}
@Bean(name = "userTransactionManager")
public DataSourceTransactionManager userTransactionManager(@Qualifier("userDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean(name = "userSqlSessionTemplate")
public SqlSessionTemplate userSqlSessionTemplate(@Qualifier("userSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
package com.tanpu.community.dao;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.tanpu.community.api.CommunityConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
/**
* created by xd on 2021/6/3
*/
@Configuration
@Slf4j
@MapperScan(basePackages = CommunityConstant.PACKAGE_BASE + ".dao.mapper.zhibo", sqlSessionTemplateRef = "zhiboSqlSessionTemplate")
public class ZhiboDataSourceConfig {
@ConfigurationProperties(prefix = "spring.datasource.zhibo")
@Bean(name = "zhiboDataSource")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "zhiboSqlSessionFactory")
public SqlSessionFactory sqlSessionFactory(@Qualifier("zhiboDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(
"classpath*:mapper/zhibo/*.xml"));
return bean.getObject();
}
@Bean(name = "zhiboTransactionManager")
public DataSourceTransactionManager zhiboTransactionManager(@Qualifier("zhiboDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean(name = "zhiboSqlSessionTemplate")
public SqlSessionTemplate zhiboSqlSessionTemplate(@Qualifier("zhiboSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
......@@ -54,6 +54,8 @@ public class RankLogEntity implements Serializable {
@ApiModelProperty(value = "排序时间")
private LocalDateTime rankTime;
private Long round;
private LocalDateTime createTime;
private LocalDateTime updateTime;
......@@ -125,6 +127,14 @@ public class RankLogEntity implements Serializable {
this.rankTime = rankTime;
}
public Long getRound() {
return round;
}
public void setRound(Long round) {
this.round = round;
}
public LocalDateTime getCreateTime() {
return createTime;
}
......
package com.tanpu.community.dao.entity.user;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author xudong
* @since 2021-07-20
*/
@TableName("user_info")
@ApiModel(value="UserInfoEntity对象", description="")
public class UserInfoEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "唯一主键")
private String id;
@ApiModelProperty(value = "账户类型 1普通账号 2机构账号 3机构人员")
private Integer userType;
@ApiModelProperty(value = "微信openId")
private String uiOpenid;
@ApiModelProperty(value = "unionId")
@TableField("ui_unionId")
private String uiUnionid;
@ApiModelProperty(value = "手机号")
private String uiTelphone;
@ApiModelProperty(value = "登录密码")
private String uiPwd;
@ApiModelProperty(value = "昵称")
private String uiNickname;
@ApiModelProperty(value = "头像")
private String uiHeadimg;
@ApiModelProperty(value = "姓名")
private String uiUsername;
@ApiModelProperty(value = "性别 0:男 1:女")
private String uiSex;
@ApiModelProperty(value = "生日")
private LocalDateTime uiBirthday;
@ApiModelProperty(value = "个人介绍")
private String uiIntroduction;
@ApiModelProperty(value = "名片样式 0:小名片 1:大名片")
private String uiTypeMp;
@ApiModelProperty(value = "名片头像")
private String uiHeadimgMp;
@ApiModelProperty(value = "名片姓名")
private String uiUsernameMp;
@ApiModelProperty(value = "名片电话")
private String uiTelphoneMp;
@ApiModelProperty(value = "手机")
private String uiMobilephoneMp;
@ApiModelProperty(value = "名片公司名称")
private String uiCompanyMp;
@ApiModelProperty(value = "名片公司地址")
private String uiCompanyAddressMp;
@ApiModelProperty(value = "名片职位")
private String uiPositionMp;
@ApiModelProperty(value = "行业")
private String uiIndustryMp;
@ApiModelProperty(value = "名片邮箱")
private String uiEmailMp;
@ApiModelProperty(value = "名片个人介绍")
private String uiIntroductionMp;
@ApiModelProperty(value = "微信个人二维码名片")
private String uiWechatQrcode;
@ApiModelProperty(value = "小程序二维码")
private String uiWechatXcxQrcode;
@ApiModelProperty(value = "类型 0:app注册 1:平台添加")
private String uiType;
@ApiModelProperty(value = "用户身份 0:普通用户 1:种子用户 2:超级用户")
private String uiShenfen;
@ApiModelProperty(value = "认证状态 0:未认证 1:已认证")
private Integer uiRzstatus;
@ApiModelProperty(value = "机构Id")
private String orgId;
@ApiModelProperty(value = "团队Id")
private String teamId;
@ApiModelProperty(value = "加入团队时间")
private LocalDateTime joinTime;
@ApiModelProperty(value = "员工工号")
private String staffNo;
@ApiModelProperty(value = "合格投资者认证状态")
private Integer investorCertifiedStatus;
@ApiModelProperty(value = "合格投资者认证时间")
private LocalDateTime investorCertifiedTime;
@ApiModelProperty(value = "对外合作权限")
private String toPartner;
@ApiModelProperty(value = "等级")
private String uiGrade;
@ApiModelProperty(value = "内容审核")
private Integer contentReview;
@ApiModelProperty(value = "所获荣誉")
private String uiHonor;
@ApiModelProperty(value = "海报扫码关注公众号引流人")
private String uiHbUserid;
private String staffRegion;
private String branchName;
private String subBranchName;
private String branchNetworkName;
private String uiGradeName;
private String uiTargetGradeName;
private String uiSource;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createtime;
@ApiModelProperty(value = "创建人")
private String createby;
@ApiModelProperty(value = "修改时间")
private LocalDateTime updatetime;
@ApiModelProperty(value = "修改人")
private String updateby;
@ApiModelProperty(value = "删除标识")
private String deletetag;
@ApiModelProperty(value = "前端角色")
private String frontRoles;
@ApiModelProperty(value = "名片检查")
private Integer uiCheckStatus;
private String city;
private String province;
private String country;
private String uiInviter;
private String uiInviterPhone;
private Integer uiAge;
private String uiRegion;
private String uiWecaht;
private LocalDateTime uiInviterTime;
@ApiModelProperty(value = "微信unionId")
private String unionid;
@ApiModelProperty(value = "0游客,1注册用户,2理财师")
private Integer level;
@ApiModelProperty(value = "0游客,1注册用户,20探普理顾 30:探普专家理顾 40:交易理财师")
private Integer levelGrade;
@ApiModelProperty(value = "年龄")
private Integer age;
@ApiModelProperty(value = "区县")
private String district;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "学历:0: 未知,1:专科,2:本科,3:211本科,4:硕士及以上")
private Integer education;
@ApiModelProperty(value = "微信号")
private String wechat;
@ApiModelProperty(value = "高净值客户数(0:无,1:10人一下,2:10-30人,3:30-50人,4:50以上)")
private Integer highWorthCustomerNum;
@ApiModelProperty(value = "高净值客户资产配置:(0:无,1:100万一下,2:100-200万,3:200-400万,4:400-600万,5:600万以上)")
private Integer customerAsset;
@ApiModelProperty(value = "自身是否是理财师")
private Integer financialPlanner;
@ApiModelProperty(value = "会员到期时间")
private LocalDateTime vipEndTime;
private LocalDateTime uiRegisterTime;
@ApiModelProperty(value = "权限集 以英文;分割(S1-基础营)")
private String uiAuth;
private String uiChannel;
@ApiModelProperty(value = "审核时间")
private LocalDateTime reviewTime;
@ApiModelProperty(value = "苹果授权用户id")
private String uiAppleUserid;
@ApiModelProperty(value = "理财师编号")
private String ifaNo;
@ApiModelProperty(value = "真实姓名,禁用于运营维护")
private String realname;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
public String getUiOpenid() {
return uiOpenid;
}
public void setUiOpenid(String uiOpenid) {
this.uiOpenid = uiOpenid;
}
public String getUiUnionid() {
return uiUnionid;
}
public void setUiUnionid(String uiUnionid) {
this.uiUnionid = uiUnionid;
}
public String getUiTelphone() {
return uiTelphone;
}
public void setUiTelphone(String uiTelphone) {
this.uiTelphone = uiTelphone;
}
public String getUiPwd() {
return uiPwd;
}
public void setUiPwd(String uiPwd) {
this.uiPwd = uiPwd;
}
public String getUiNickname() {
return uiNickname;
}
public void setUiNickname(String uiNickname) {
this.uiNickname = uiNickname;
}
public String getUiHeadimg() {
return uiHeadimg;
}
public void setUiHeadimg(String uiHeadimg) {
this.uiHeadimg = uiHeadimg;
}
public String getUiUsername() {
return uiUsername;
}
public void setUiUsername(String uiUsername) {
this.uiUsername = uiUsername;
}
public String getUiSex() {
return uiSex;
}
public void setUiSex(String uiSex) {
this.uiSex = uiSex;
}
public LocalDateTime getUiBirthday() {
return uiBirthday;
}
public void setUiBirthday(LocalDateTime uiBirthday) {
this.uiBirthday = uiBirthday;
}
public String getUiIntroduction() {
return uiIntroduction;
}
public void setUiIntroduction(String uiIntroduction) {
this.uiIntroduction = uiIntroduction;
}
public String getUiTypeMp() {
return uiTypeMp;
}
public void setUiTypeMp(String uiTypeMp) {
this.uiTypeMp = uiTypeMp;
}
public String getUiHeadimgMp() {
return uiHeadimgMp;
}
public void setUiHeadimgMp(String uiHeadimgMp) {
this.uiHeadimgMp = uiHeadimgMp;
}
public String getUiUsernameMp() {
return uiUsernameMp;
}
public void setUiUsernameMp(String uiUsernameMp) {
this.uiUsernameMp = uiUsernameMp;
}
public String getUiTelphoneMp() {
return uiTelphoneMp;
}
public void setUiTelphoneMp(String uiTelphoneMp) {
this.uiTelphoneMp = uiTelphoneMp;
}
public String getUiMobilephoneMp() {
return uiMobilephoneMp;
}
public void setUiMobilephoneMp(String uiMobilephoneMp) {
this.uiMobilephoneMp = uiMobilephoneMp;
}
public String getUiCompanyMp() {
return uiCompanyMp;
}
public void setUiCompanyMp(String uiCompanyMp) {
this.uiCompanyMp = uiCompanyMp;
}
public String getUiCompanyAddressMp() {
return uiCompanyAddressMp;
}
public void setUiCompanyAddressMp(String uiCompanyAddressMp) {
this.uiCompanyAddressMp = uiCompanyAddressMp;
}
public String getUiPositionMp() {
return uiPositionMp;
}
public void setUiPositionMp(String uiPositionMp) {
this.uiPositionMp = uiPositionMp;
}
public String getUiIndustryMp() {
return uiIndustryMp;
}
public void setUiIndustryMp(String uiIndustryMp) {
this.uiIndustryMp = uiIndustryMp;
}
public String getUiEmailMp() {
return uiEmailMp;
}
public void setUiEmailMp(String uiEmailMp) {
this.uiEmailMp = uiEmailMp;
}
public String getUiIntroductionMp() {
return uiIntroductionMp;
}
public void setUiIntroductionMp(String uiIntroductionMp) {
this.uiIntroductionMp = uiIntroductionMp;
}
public String getUiWechatQrcode() {
return uiWechatQrcode;
}
public void setUiWechatQrcode(String uiWechatQrcode) {
this.uiWechatQrcode = uiWechatQrcode;
}
public String getUiWechatXcxQrcode() {
return uiWechatXcxQrcode;
}
public void setUiWechatXcxQrcode(String uiWechatXcxQrcode) {
this.uiWechatXcxQrcode = uiWechatXcxQrcode;
}
public String getUiType() {
return uiType;
}
public void setUiType(String uiType) {
this.uiType = uiType;
}
public String getUiShenfen() {
return uiShenfen;
}
public void setUiShenfen(String uiShenfen) {
this.uiShenfen = uiShenfen;
}
public Integer getUiRzstatus() {
return uiRzstatus;
}
public void setUiRzstatus(Integer uiRzstatus) {
this.uiRzstatus = uiRzstatus;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getTeamId() {
return teamId;
}
public void setTeamId(String teamId) {
this.teamId = teamId;
}
public LocalDateTime getJoinTime() {
return joinTime;
}
public void setJoinTime(LocalDateTime joinTime) {
this.joinTime = joinTime;
}
public String getStaffNo() {
return staffNo;
}
public void setStaffNo(String staffNo) {
this.staffNo = staffNo;
}
public Integer getInvestorCertifiedStatus() {
return investorCertifiedStatus;
}
public void setInvestorCertifiedStatus(Integer investorCertifiedStatus) {
this.investorCertifiedStatus = investorCertifiedStatus;
}
public LocalDateTime getInvestorCertifiedTime() {
return investorCertifiedTime;
}
public void setInvestorCertifiedTime(LocalDateTime investorCertifiedTime) {
this.investorCertifiedTime = investorCertifiedTime;
}
public String getToPartner() {
return toPartner;
}
public void setToPartner(String toPartner) {
this.toPartner = toPartner;
}
public String getUiGrade() {
return uiGrade;
}
public void setUiGrade(String uiGrade) {
this.uiGrade = uiGrade;
}
public Integer getContentReview() {
return contentReview;
}
public void setContentReview(Integer contentReview) {
this.contentReview = contentReview;
}
public String getUiHonor() {
return uiHonor;
}
public void setUiHonor(String uiHonor) {
this.uiHonor = uiHonor;
}
public String getUiHbUserid() {
return uiHbUserid;
}
public void setUiHbUserid(String uiHbUserid) {
this.uiHbUserid = uiHbUserid;
}
public String getStaffRegion() {
return staffRegion;
}
public void setStaffRegion(String staffRegion) {
this.staffRegion = staffRegion;
}
public String getBranchName() {
return branchName;
}
public void setBranchName(String branchName) {
this.branchName = branchName;
}
public String getSubBranchName() {
return subBranchName;
}
public void setSubBranchName(String subBranchName) {
this.subBranchName = subBranchName;
}
public String getBranchNetworkName() {
return branchNetworkName;
}
public void setBranchNetworkName(String branchNetworkName) {
this.branchNetworkName = branchNetworkName;
}
public String getUiGradeName() {
return uiGradeName;
}
public void setUiGradeName(String uiGradeName) {
this.uiGradeName = uiGradeName;
}
public String getUiTargetGradeName() {
return uiTargetGradeName;
}
public void setUiTargetGradeName(String uiTargetGradeName) {
this.uiTargetGradeName = uiTargetGradeName;
}
public String getUiSource() {
return uiSource;
}
public void setUiSource(String uiSource) {
this.uiSource = uiSource;
}
public LocalDateTime getCreatetime() {
return createtime;
}
public void setCreatetime(LocalDateTime createtime) {
this.createtime = createtime;
}
public String getCreateby() {
return createby;
}
public void setCreateby(String createby) {
this.createby = createby;
}
public LocalDateTime getUpdatetime() {
return updatetime;
}
public void setUpdatetime(LocalDateTime updatetime) {
this.updatetime = updatetime;
}
public String getUpdateby() {
return updateby;
}
public void setUpdateby(String updateby) {
this.updateby = updateby;
}
public String getDeletetag() {
return deletetag;
}
public void setDeletetag(String deletetag) {
this.deletetag = deletetag;
}
public String getFrontRoles() {
return frontRoles;
}
public void setFrontRoles(String frontRoles) {
this.frontRoles = frontRoles;
}
public Integer getUiCheckStatus() {
return uiCheckStatus;
}
public void setUiCheckStatus(Integer uiCheckStatus) {
this.uiCheckStatus = uiCheckStatus;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getUiInviter() {
return uiInviter;
}
public void setUiInviter(String uiInviter) {
this.uiInviter = uiInviter;
}
public String getUiInviterPhone() {
return uiInviterPhone;
}
public void setUiInviterPhone(String uiInviterPhone) {
this.uiInviterPhone = uiInviterPhone;
}
public Integer getUiAge() {
return uiAge;
}
public void setUiAge(Integer uiAge) {
this.uiAge = uiAge;
}
public String getUiRegion() {
return uiRegion;
}
public void setUiRegion(String uiRegion) {
this.uiRegion = uiRegion;
}
public String getUiWecaht() {
return uiWecaht;
}
public void setUiWecaht(String uiWecaht) {
this.uiWecaht = uiWecaht;
}
public LocalDateTime getUiInviterTime() {
return uiInviterTime;
}
public void setUiInviterTime(LocalDateTime uiInviterTime) {
this.uiInviterTime = uiInviterTime;
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getLevelGrade() {
return levelGrade;
}
public void setLevelGrade(Integer levelGrade) {
this.levelGrade = levelGrade;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getEducation() {
return education;
}
public void setEducation(Integer education) {
this.education = education;
}
public String getWechat() {
return wechat;
}
public void setWechat(String wechat) {
this.wechat = wechat;
}
public Integer getHighWorthCustomerNum() {
return highWorthCustomerNum;
}
public void setHighWorthCustomerNum(Integer highWorthCustomerNum) {
this.highWorthCustomerNum = highWorthCustomerNum;
}
public Integer getCustomerAsset() {
return customerAsset;
}
public void setCustomerAsset(Integer customerAsset) {
this.customerAsset = customerAsset;
}
public Integer getFinancialPlanner() {
return financialPlanner;
}
public void setFinancialPlanner(Integer financialPlanner) {
this.financialPlanner = financialPlanner;
}
public LocalDateTime getVipEndTime() {
return vipEndTime;
}
public void setVipEndTime(LocalDateTime vipEndTime) {
this.vipEndTime = vipEndTime;
}
public LocalDateTime getUiRegisterTime() {
return uiRegisterTime;
}
public void setUiRegisterTime(LocalDateTime uiRegisterTime) {
this.uiRegisterTime = uiRegisterTime;
}
public String getUiAuth() {
return uiAuth;
}
public void setUiAuth(String uiAuth) {
this.uiAuth = uiAuth;
}
public String getUiChannel() {
return uiChannel;
}
public void setUiChannel(String uiChannel) {
this.uiChannel = uiChannel;
}
public LocalDateTime getReviewTime() {
return reviewTime;
}
public void setReviewTime(LocalDateTime reviewTime) {
this.reviewTime = reviewTime;
}
public String getUiAppleUserid() {
return uiAppleUserid;
}
public void setUiAppleUserid(String uiAppleUserid) {
this.uiAppleUserid = uiAppleUserid;
}
public String getIfaNo() {
return ifaNo;
}
public void setIfaNo(String ifaNo) {
this.ifaNo = ifaNo;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
@Override
public String toString() {
return "UserInfoEntity{" +
"id=" + id +
", userType=" + userType +
", uiOpenid=" + uiOpenid +
", uiUnionid=" + uiUnionid +
", uiTelphone=" + uiTelphone +
", uiPwd=" + uiPwd +
", uiNickname=" + uiNickname +
", uiHeadimg=" + uiHeadimg +
", uiUsername=" + uiUsername +
", uiSex=" + uiSex +
", uiBirthday=" + uiBirthday +
", uiIntroduction=" + uiIntroduction +
", uiTypeMp=" + uiTypeMp +
", uiHeadimgMp=" + uiHeadimgMp +
", uiUsernameMp=" + uiUsernameMp +
", uiTelphoneMp=" + uiTelphoneMp +
", uiMobilephoneMp=" + uiMobilephoneMp +
", uiCompanyMp=" + uiCompanyMp +
", uiCompanyAddressMp=" + uiCompanyAddressMp +
", uiPositionMp=" + uiPositionMp +
", uiIndustryMp=" + uiIndustryMp +
", uiEmailMp=" + uiEmailMp +
", uiIntroductionMp=" + uiIntroductionMp +
", uiWechatQrcode=" + uiWechatQrcode +
", uiWechatXcxQrcode=" + uiWechatXcxQrcode +
", uiType=" + uiType +
", uiShenfen=" + uiShenfen +
", uiRzstatus=" + uiRzstatus +
", orgId=" + orgId +
", teamId=" + teamId +
", joinTime=" + joinTime +
", staffNo=" + staffNo +
", investorCertifiedStatus=" + investorCertifiedStatus +
", investorCertifiedTime=" + investorCertifiedTime +
", toPartner=" + toPartner +
", uiGrade=" + uiGrade +
", contentReview=" + contentReview +
", uiHonor=" + uiHonor +
", uiHbUserid=" + uiHbUserid +
", staffRegion=" + staffRegion +
", branchName=" + branchName +
", subBranchName=" + subBranchName +
", branchNetworkName=" + branchNetworkName +
", uiGradeName=" + uiGradeName +
", uiTargetGradeName=" + uiTargetGradeName +
", uiSource=" + uiSource +
", createtime=" + createtime +
", createby=" + createby +
", updatetime=" + updatetime +
", updateby=" + updateby +
", deletetag=" + deletetag +
", frontRoles=" + frontRoles +
", uiCheckStatus=" + uiCheckStatus +
", city=" + city +
", province=" + province +
", country=" + country +
", uiInviter=" + uiInviter +
", uiInviterPhone=" + uiInviterPhone +
", uiAge=" + uiAge +
", uiRegion=" + uiRegion +
", uiWecaht=" + uiWecaht +
", uiInviterTime=" + uiInviterTime +
", unionid=" + unionid +
", level=" + level +
", levelGrade=" + levelGrade +
", age=" + age +
", district=" + district +
", address=" + address +
", education=" + education +
", wechat=" + wechat +
", highWorthCustomerNum=" + highWorthCustomerNum +
", customerAsset=" + customerAsset +
", financialPlanner=" + financialPlanner +
", vipEndTime=" + vipEndTime +
", uiRegisterTime=" + uiRegisterTime +
", uiAuth=" + uiAuth +
", uiChannel=" + uiChannel +
", reviewTime=" + reviewTime +
", uiAppleUserid=" + uiAppleUserid +
", ifaNo=" + ifaNo +
", realname=" + realname +
"}";
}
}
package com.tanpu.community.dao.entity.zhibo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
* 直播间信息表
* </p>
*
* @author xudong
* @since 2021-06-23
*/
@TableName("zhibo_theme")
@ApiModel(value="ZhiboThemeEntity对象", description="直播间信息表")
public class ZhiboThemeEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "唯一主键")
private String id;
@ApiModelProperty(value = "主题名称")
private String ztName;
@ApiModelProperty(value = "开播时间")
private LocalDateTime ztStarttime;
@ApiModelProperty(value = "结束时间")
private LocalDateTime ztEndtime;
@ApiModelProperty(value = "描述")
private String ztDesc;
@ApiModelProperty(value = "(废弃)")
private String ztRoomnum;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "创建人")
private String createBy;
@ApiModelProperty(value = "修改时间")
private LocalDateTime updateTime;
@ApiModelProperty(value = "修改人")
private String updateBy;
@ApiModelProperty(value = "删除标识 0:正常,1: 删除 2:草稿")
private String deletetag;
@ApiModelProperty(value = "直播间状态 1未开始,2直播中,3已结束")
private String ztStatus;
@ApiModelProperty(value = "列表缩略图")
private String ztBackimg;
@ApiModelProperty(value = "分享模式")
private Integer sharePattern;
@ApiModelProperty(value = "详情背景图")
private String ztImg;
@ApiModelProperty(value = "最新大图")
private String bigImg;
@ApiModelProperty(value = "是否含直播")
private String ztIszhibo;
@ApiModelProperty(value = "关联产品")
private String ztProid;
@ApiModelProperty(value = "培训人")
private String ztUname;
@ApiModelProperty(value = "参与人开放标识")
private String ztFlag;
@ApiModelProperty(value = "机构ID")
private String orgId;
@ApiModelProperty(value = "密码")
private String ztPassword;
@ApiModelProperty(value = "直播标签")
private String ztLabel;
@ApiModelProperty(value = "参与人")
private String ztUserids;
@ApiModelProperty(value = "是否禁言 0:否 1:是")
private String ztMute;
@ApiModelProperty(value = "直播类型 1探普之夜,2探普八点半")
private String ztType;
private Integer ztAppointmentNums;
private String ztInfo;
private String ztQrcode;
private String ztFuli;
@ApiModelProperty(value = "直播基数")
private Integer ztCardinal;
@ApiModelProperty(value = "是否可分享")
private String ztIsshare;
@ApiModelProperty(value = "是否收集用户信息,1收集,0不收集")
private String ztIscollectUserinfo;
@ApiModelProperty(value = "是否开启手机号验证")
private String ztIsverificationPhone;
private String ztExamid;
@ApiModelProperty(value = "母直播间id")
private String parentId;
@ApiModelProperty(value = "直播间类型 1母直播间,2子直播间")
private Integer roomType;
@ApiModelProperty(value = "视屏类型 1视频,2音频")
private Integer videoType;
@ApiModelProperty(value = "直播时长 显示 单位小时")
private Double durationSecondShow;
@ApiModelProperty(value = "实际开始时间")
private LocalDateTime realStartTime;
@ApiModelProperty(value = "真实结束时间")
private LocalDateTime realEndTime;
@ApiModelProperty(value = "直播实际时长")
private Integer realDurationSecond;
@ApiModelProperty(value = "是否可预约 1:需要预约 0:不需要预约")
private Integer reservation;
@ApiModelProperty(value = "可转播设置 1:可转播 0:不可转播")
private Integer canBroadcast;
@ApiModelProperty(value = "转播积分")
private Integer broadcastScore;
@ApiModelProperty(value = "转播数量")
private Integer broadcastNum;
@ApiModelProperty(value = "探普云参与权限0:所有人,1仅注册用户,2仅探普会员可进入,3需要密码,4仅基础营人员可进入")
private Integer participationRigth;
@ApiModelProperty(value = "回放设置 0:不录制 1:录制")
private Integer replay;
@ApiModelProperty(value = "开场白")
private String openingRemarks;
@ApiModelProperty(value = "直播间头衔")
private String userTitle;
@ApiModelProperty(value = "访客问候语")
private String guestGreetings;
@ApiModelProperty(value = "是否给访客发送名片(0不发送 1发送) (-针对理财师)")
private String guestCard;
@ApiModelProperty(value = "是否给访客发送微店(0不发送 1发送) (-针对理财师)")
private String guestWeShop;
@ApiModelProperty(value = "一级好友问候语")
private String friendGreetings;
@ApiModelProperty(value = "是否给好友发送微店(0不发送 1发送) (-针对理财师)")
private String friendCard;
@ApiModelProperty(value = "是否给好友发送微店(0不发送 1发送) (-针对理财师)")
private String friendWeShop;
@ApiModelProperty(value = "推荐到微店首页 1:可推荐 0:不可推荐")
private Integer recommendHomePage;
@ApiModelProperty(value = "推荐到首页的时间")
private LocalDateTime recommendTime;
@ApiModelProperty(value = "参与人数")
private Integer participantsNum;
@ApiModelProperty(value = "在线人数")
private Integer onlineNum;
@ApiModelProperty(value = "预约人数")
private Integer reservationNum;
@ApiModelProperty(value = "已填信息表人数")
private Integer informationSheetNum;
@ApiModelProperty(value = "回放人数")
private Integer replayNum;
@ApiModelProperty(value = "短信模板id")
private String smsTemplateId;
@ApiModelProperty(value = "主讲人描述,用于直播间主讲人描述")
private String managerName;
@ApiModelProperty(value = "推荐到探普学堂首页 1:推荐 0:不推荐")
private Integer recommendHomeTanpu;
@ApiModelProperty(value = "推荐首页(探普学堂)推荐时间")
private LocalDateTime recommendTimeTanpu;
@ApiModelProperty(value = "参数人次 统计pv")
private Integer participantsPv;
@ApiModelProperty(value = "子直播间参与人次累加")
private Integer participantsChildPv;
@ApiModelProperty(value = "是否隐私直播间 0否 1是")
@TableField("isPrivacy")
private Integer isprivacy;
@ApiModelProperty(value = "群组状态 1:已创建 2:已销毁")
private Integer iscreateGroupSuccess;
@ApiModelProperty(value = "在线人数峰值")
private Integer maxOnlineNum;
@ApiModelProperty(value = "标签")
private String tags;
@ApiModelProperty(value = "说明")
private String explain;
@ApiModelProperty(value = "讲师id")
private String managerId;
@ApiModelProperty(value = "0:不使用 1:使用讲师图")
private Integer bgStatus;
@ApiModelProperty(value = "背景图地址")
private String bgImg;
@ApiModelProperty(value = "0:没有试看 1:有试看")
private Integer seeStatus;
@ApiModelProperty(value = "试看时长 单位 m")
private Integer seeLength;
@ApiModelProperty(value = "方图")
private String squareImg;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getZtName() {
return ztName;
}
public void setZtName(String ztName) {
this.ztName = ztName;
}
public LocalDateTime getZtStarttime() {
return ztStarttime;
}
public void setZtStarttime(LocalDateTime ztStarttime) {
this.ztStarttime = ztStarttime;
}
public LocalDateTime getZtEndtime() {
return ztEndtime;
}
public void setZtEndtime(LocalDateTime ztEndtime) {
this.ztEndtime = ztEndtime;
}
public String getZtDesc() {
return ztDesc;
}
public void setZtDesc(String ztDesc) {
this.ztDesc = ztDesc;
}
public String getZtRoomnum() {
return ztRoomnum;
}
public void setZtRoomnum(String ztRoomnum) {
this.ztRoomnum = ztRoomnum;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public String getDeletetag() {
return deletetag;
}
public void setDeletetag(String deletetag) {
this.deletetag = deletetag;
}
public String getZtStatus() {
return ztStatus;
}
public void setZtStatus(String ztStatus) {
this.ztStatus = ztStatus;
}
public String getZtBackimg() {
return ztBackimg;
}
public void setZtBackimg(String ztBackimg) {
this.ztBackimg = ztBackimg;
}
public Integer getSharePattern() {
return sharePattern;
}
public void setSharePattern(Integer sharePattern) {
this.sharePattern = sharePattern;
}
public String getZtImg() {
return ztImg;
}
public void setZtImg(String ztImg) {
this.ztImg = ztImg;
}
public String getBigImg() {
return bigImg;
}
public void setBigImg(String bigImg) {
this.bigImg = bigImg;
}
public String getZtIszhibo() {
return ztIszhibo;
}
public void setZtIszhibo(String ztIszhibo) {
this.ztIszhibo = ztIszhibo;
}
public String getZtProid() {
return ztProid;
}
public void setZtProid(String ztProid) {
this.ztProid = ztProid;
}
public String getZtUname() {
return ztUname;
}
public void setZtUname(String ztUname) {
this.ztUname = ztUname;
}
public String getZtFlag() {
return ztFlag;
}
public void setZtFlag(String ztFlag) {
this.ztFlag = ztFlag;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getZtPassword() {
return ztPassword;
}
public void setZtPassword(String ztPassword) {
this.ztPassword = ztPassword;
}
public String getZtLabel() {
return ztLabel;
}
public void setZtLabel(String ztLabel) {
this.ztLabel = ztLabel;
}
public String getZtUserids() {
return ztUserids;
}
public void setZtUserids(String ztUserids) {
this.ztUserids = ztUserids;
}
public String getZtMute() {
return ztMute;
}
public void setZtMute(String ztMute) {
this.ztMute = ztMute;
}
public String getZtType() {
return ztType;
}
public void setZtType(String ztType) {
this.ztType = ztType;
}
public Integer getZtAppointmentNums() {
return ztAppointmentNums;
}
public void setZtAppointmentNums(Integer ztAppointmentNums) {
this.ztAppointmentNums = ztAppointmentNums;
}
public String getZtInfo() {
return ztInfo;
}
public void setZtInfo(String ztInfo) {
this.ztInfo = ztInfo;
}
public String getZtQrcode() {
return ztQrcode;
}
public void setZtQrcode(String ztQrcode) {
this.ztQrcode = ztQrcode;
}
public String getZtFuli() {
return ztFuli;
}
public void setZtFuli(String ztFuli) {
this.ztFuli = ztFuli;
}
public Integer getZtCardinal() {
return ztCardinal;
}
public void setZtCardinal(Integer ztCardinal) {
this.ztCardinal = ztCardinal;
}
public String getZtIsshare() {
return ztIsshare;
}
public void setZtIsshare(String ztIsshare) {
this.ztIsshare = ztIsshare;
}
public String getZtIscollectUserinfo() {
return ztIscollectUserinfo;
}
public void setZtIscollectUserinfo(String ztIscollectUserinfo) {
this.ztIscollectUserinfo = ztIscollectUserinfo;
}
public String getZtIsverificationPhone() {
return ztIsverificationPhone;
}
public void setZtIsverificationPhone(String ztIsverificationPhone) {
this.ztIsverificationPhone = ztIsverificationPhone;
}
public String getZtExamid() {
return ztExamid;
}
public void setZtExamid(String ztExamid) {
this.ztExamid = ztExamid;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public Integer getRoomType() {
return roomType;
}
public void setRoomType(Integer roomType) {
this.roomType = roomType;
}
public Integer getVideoType() {
return videoType;
}
public void setVideoType(Integer videoType) {
this.videoType = videoType;
}
public Double getDurationSecondShow() {
return durationSecondShow;
}
public void setDurationSecondShow(Double durationSecondShow) {
this.durationSecondShow = durationSecondShow;
}
public LocalDateTime getRealStartTime() {
return realStartTime;
}
public void setRealStartTime(LocalDateTime realStartTime) {
this.realStartTime = realStartTime;
}
public LocalDateTime getRealEndTime() {
return realEndTime;
}
public void setRealEndTime(LocalDateTime realEndTime) {
this.realEndTime = realEndTime;
}
public Integer getRealDurationSecond() {
return realDurationSecond;
}
public void setRealDurationSecond(Integer realDurationSecond) {
this.realDurationSecond = realDurationSecond;
}
public Integer getReservation() {
return reservation;
}
public void setReservation(Integer reservation) {
this.reservation = reservation;
}
public Integer getCanBroadcast() {
return canBroadcast;
}
public void setCanBroadcast(Integer canBroadcast) {
this.canBroadcast = canBroadcast;
}
public Integer getBroadcastScore() {
return broadcastScore;
}
public void setBroadcastScore(Integer broadcastScore) {
this.broadcastScore = broadcastScore;
}
public Integer getBroadcastNum() {
return broadcastNum;
}
public void setBroadcastNum(Integer broadcastNum) {
this.broadcastNum = broadcastNum;
}
public Integer getParticipationRigth() {
return participationRigth;
}
public void setParticipationRigth(Integer participationRigth) {
this.participationRigth = participationRigth;
}
public Integer getReplay() {
return replay;
}
public void setReplay(Integer replay) {
this.replay = replay;
}
public String getOpeningRemarks() {
return openingRemarks;
}
public void setOpeningRemarks(String openingRemarks) {
this.openingRemarks = openingRemarks;
}
public String getUserTitle() {
return userTitle;
}
public void setUserTitle(String userTitle) {
this.userTitle = userTitle;
}
public String getGuestGreetings() {
return guestGreetings;
}
public void setGuestGreetings(String guestGreetings) {
this.guestGreetings = guestGreetings;
}
public String getGuestCard() {
return guestCard;
}
public void setGuestCard(String guestCard) {
this.guestCard = guestCard;
}
public String getGuestWeShop() {
return guestWeShop;
}
public void setGuestWeShop(String guestWeShop) {
this.guestWeShop = guestWeShop;
}
public String getFriendGreetings() {
return friendGreetings;
}
public void setFriendGreetings(String friendGreetings) {
this.friendGreetings = friendGreetings;
}
public String getFriendCard() {
return friendCard;
}
public void setFriendCard(String friendCard) {
this.friendCard = friendCard;
}
public String getFriendWeShop() {
return friendWeShop;
}
public void setFriendWeShop(String friendWeShop) {
this.friendWeShop = friendWeShop;
}
public Integer getRecommendHomePage() {
return recommendHomePage;
}
public void setRecommendHomePage(Integer recommendHomePage) {
this.recommendHomePage = recommendHomePage;
}
public LocalDateTime getRecommendTime() {
return recommendTime;
}
public void setRecommendTime(LocalDateTime recommendTime) {
this.recommendTime = recommendTime;
}
public Integer getParticipantsNum() {
return participantsNum;
}
public void setParticipantsNum(Integer participantsNum) {
this.participantsNum = participantsNum;
}
public Integer getOnlineNum() {
return onlineNum;
}
public void setOnlineNum(Integer onlineNum) {
this.onlineNum = onlineNum;
}
public Integer getReservationNum() {
return reservationNum;
}
public void setReservationNum(Integer reservationNum) {
this.reservationNum = reservationNum;
}
public Integer getInformationSheetNum() {
return informationSheetNum;
}
public void setInformationSheetNum(Integer informationSheetNum) {
this.informationSheetNum = informationSheetNum;
}
public Integer getReplayNum() {
return replayNum;
}
public void setReplayNum(Integer replayNum) {
this.replayNum = replayNum;
}
public String getSmsTemplateId() {
return smsTemplateId;
}
public void setSmsTemplateId(String smsTemplateId) {
this.smsTemplateId = smsTemplateId;
}
public String getManagerName() {
return managerName;
}
public void setManagerName(String managerName) {
this.managerName = managerName;
}
public Integer getRecommendHomeTanpu() {
return recommendHomeTanpu;
}
public void setRecommendHomeTanpu(Integer recommendHomeTanpu) {
this.recommendHomeTanpu = recommendHomeTanpu;
}
public LocalDateTime getRecommendTimeTanpu() {
return recommendTimeTanpu;
}
public void setRecommendTimeTanpu(LocalDateTime recommendTimeTanpu) {
this.recommendTimeTanpu = recommendTimeTanpu;
}
public Integer getParticipantsPv() {
return participantsPv;
}
public void setParticipantsPv(Integer participantsPv) {
this.participantsPv = participantsPv;
}
public Integer getParticipantsChildPv() {
return participantsChildPv;
}
public void setParticipantsChildPv(Integer participantsChildPv) {
this.participantsChildPv = participantsChildPv;
}
public Integer getIsprivacy() {
return isprivacy;
}
public void setIsprivacy(Integer isprivacy) {
this.isprivacy = isprivacy;
}
public Integer getIscreateGroupSuccess() {
return iscreateGroupSuccess;
}
public void setIscreateGroupSuccess(Integer iscreateGroupSuccess) {
this.iscreateGroupSuccess = iscreateGroupSuccess;
}
public Integer getMaxOnlineNum() {
return maxOnlineNum;
}
public void setMaxOnlineNum(Integer maxOnlineNum) {
this.maxOnlineNum = maxOnlineNum;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public String getExplain() {
return explain;
}
public void setExplain(String explain) {
this.explain = explain;
}
public String getManagerId() {
return managerId;
}
public void setManagerId(String managerId) {
this.managerId = managerId;
}
public Integer getBgStatus() {
return bgStatus;
}
public void setBgStatus(Integer bgStatus) {
this.bgStatus = bgStatus;
}
public String getBgImg() {
return bgImg;
}
public void setBgImg(String bgImg) {
this.bgImg = bgImg;
}
public Integer getSeeStatus() {
return seeStatus;
}
public void setSeeStatus(Integer seeStatus) {
this.seeStatus = seeStatus;
}
public Integer getSeeLength() {
return seeLength;
}
public void setSeeLength(Integer seeLength) {
this.seeLength = seeLength;
}
public String getSquareImg() {
return squareImg;
}
public void setSquareImg(String squareImg) {
this.squareImg = squareImg;
}
@Override
public String toString() {
return "ZhiboThemeEntity{" +
"id=" + id +
", ztName=" + ztName +
", ztStarttime=" + ztStarttime +
", ztEndtime=" + ztEndtime +
", ztDesc=" + ztDesc +
", ztRoomnum=" + ztRoomnum +
", createTime=" + createTime +
", createBy=" + createBy +
", updateTime=" + updateTime +
", updateBy=" + updateBy +
", deletetag=" + deletetag +
", ztStatus=" + ztStatus +
", ztBackimg=" + ztBackimg +
", sharePattern=" + sharePattern +
", ztImg=" + ztImg +
", bigImg=" + bigImg +
", ztIszhibo=" + ztIszhibo +
", ztProid=" + ztProid +
", ztUname=" + ztUname +
", ztFlag=" + ztFlag +
", orgId=" + orgId +
", ztPassword=" + ztPassword +
", ztLabel=" + ztLabel +
", ztUserids=" + ztUserids +
", ztMute=" + ztMute +
", ztType=" + ztType +
", ztAppointmentNums=" + ztAppointmentNums +
", ztInfo=" + ztInfo +
", ztQrcode=" + ztQrcode +
", ztFuli=" + ztFuli +
", ztCardinal=" + ztCardinal +
", ztIsshare=" + ztIsshare +
", ztIscollectUserinfo=" + ztIscollectUserinfo +
", ztIsverificationPhone=" + ztIsverificationPhone +
", ztExamid=" + ztExamid +
", parentId=" + parentId +
", roomType=" + roomType +
", videoType=" + videoType +
", durationSecondShow=" + durationSecondShow +
", realStartTime=" + realStartTime +
", realEndTime=" + realEndTime +
", realDurationSecond=" + realDurationSecond +
", reservation=" + reservation +
", canBroadcast=" + canBroadcast +
", broadcastScore=" + broadcastScore +
", broadcastNum=" + broadcastNum +
", participationRigth=" + participationRigth +
", replay=" + replay +
", openingRemarks=" + openingRemarks +
", userTitle=" + userTitle +
", guestGreetings=" + guestGreetings +
", guestCard=" + guestCard +
", guestWeShop=" + guestWeShop +
", friendGreetings=" + friendGreetings +
", friendCard=" + friendCard +
", friendWeShop=" + friendWeShop +
", recommendHomePage=" + recommendHomePage +
", recommendTime=" + recommendTime +
", participantsNum=" + participantsNum +
", onlineNum=" + onlineNum +
", reservationNum=" + reservationNum +
", informationSheetNum=" + informationSheetNum +
", replayNum=" + replayNum +
", smsTemplateId=" + smsTemplateId +
", managerName=" + managerName +
", recommendHomeTanpu=" + recommendHomeTanpu +
", recommendTimeTanpu=" + recommendTimeTanpu +
", participantsPv=" + participantsPv +
", participantsChildPv=" + participantsChildPv +
", isprivacy=" + isprivacy +
", iscreateGroupSuccess=" + iscreateGroupSuccess +
", maxOnlineNum=" + maxOnlineNum +
", tags=" + tags +
", explain=" + explain +
", managerId=" + managerId +
", bgStatus=" + bgStatus +
", bgImg=" + bgImg +
", seeStatus=" + seeStatus +
", seeLength=" + seeLength +
", squareImg=" + squareImg +
"}";
}
}
......@@ -2,6 +2,10 @@ package com.tanpu.community.dao.mapper.community;
import com.tanpu.community.dao.entity.community.RankLogEntity;
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,4 +17,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface RankLogMapper extends BaseMapper<RankLogEntity> {
@Select("select max(round) from rank_log where type = #{type}")
Long selectMaxRound(@Param("type") Integer type);
@Select("select * from rank_log where type = #{type} order by id asc limit #{batchSize}")
List<RankLogEntity> selectByTypeLimit(@Param("type") Integer type, @Param("batchSize") Integer batchSize);
}
\ No newline at end of file
......@@ -21,8 +21,8 @@ import java.util.List;
* @since 2021-07-28
*/
public interface VisitLogMapper extends BaseMapper<VisitLogEntity> {
@Select("select * from visit_log where ident=#{ident} and ref_id=#{refId}")
VisitLogEntity selectByIdentAndRefId(@Param("ident") String ident, @Param("refId") String refId);
@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);
......
package com.tanpu.community.dao.mapper.zhibo;
import com.tanpu.community.dao.entity.zhibo.ZhiboThemeEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 直播间信息表 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-06-23
*/
public interface ZhiboThemeMapper extends BaseMapper<ZhiboThemeEntity> {
}
......@@ -52,6 +52,14 @@ public class CommentManager {
// 评论(对主题)
// 发表评论(对主题)
public void comment(CreateCommentReq req, String userId) {
if (StringUtils.isEmpty(req.getComment())) {
throw new IllegalArgumentException("评论内容不能为空");
}
if (req.getComment().length()>500){
throw new IllegalArgumentException("评论内容不能超过500字");
}
CommentEntity commentEntity = CommentEntity.builder()
.themeId(req.getThemeId())
.parentId(req.getParentId())
......
package com.tanpu.community.manager;
import com.tanpu.community.service.RankService;
import com.tanpu.community.service.RedisService;
import com.tanpu.community.service.VisitLogService;
import com.tanpu.community.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
......@@ -23,6 +21,12 @@ public class ConJobManager {
@Autowired
private RankService rankService;
@Autowired
private RankLogService rankLogService;
@Autowired
private RecommendService recommendService;
/**
* 定时统计 话题 访问数据,并刷到redis
*/
......@@ -36,9 +40,25 @@ public class ConJobManager {
/**
* 定时统计主题、话题排行
*/
@Scheduled(cron = "0 */2 * * * ?")
@Scheduled(cron = "*/30 * * * * ?")
public void themeRank() {
rankService.rankThemes();
rankService.rankTopics();
}
/**
* 定时统计主题、话题排行
*/
@Scheduled(cron = "*/5 * * * * ?")
public void getThemeNewest() {
recommendService.refreshNewestThemes();
}
/**
* 定时把rank_log的日志拿出来,清理数据库
*/
@Scheduled(cron = "0 0 0 ? * 1")
public void clearRankLog() {
rankLogService.clearRankLog();
}
}
......@@ -6,6 +6,7 @@ import com.tanpu.biz.common.enums.user.UserTypeEnum;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.constant.BizStatus;
import com.tanpu.common.exception.BizException;
import com.tanpu.common.util.DateUtils;
import com.tanpu.community.api.beans.qo.FollowQo;
import com.tanpu.community.api.beans.req.homepage.FollowRelReq;
import com.tanpu.community.api.beans.req.homepage.QueryFollowReq;
......@@ -58,7 +59,8 @@ public class HomePageManager {
//查询 个人中心 相关信息
public UserInfoResp queryUsersInfo(String userIdMyself, String userId) {
CommonResp<UserInfoResp> queryUsersListNew = feignClientForFatools.queryUsersListNew(StringUtils.isNotBlank(userId) ? userId : userIdMyself);
if (queryUsersListNew.isNotSuccess() || !ObjectUtils.anyNotNull(queryUsersListNew.getData())) throw new BizException("内部接口调用失败");
if (queryUsersListNew.isNotSuccess() || !ObjectUtils.anyNotNull(queryUsersListNew.getData()))
throw new BizException("内部接口调用失败");
UserInfoResp userInfoNew = queryUsersListNew.getData();
if (StringUtils.isNotBlank(userId) && !StringUtils.equals(userIdMyself, userId)) { //查询别人的个人主页
......@@ -92,6 +94,13 @@ public class HomePageManager {
userInfoNew.getUserInfoNewChief().setClientId(null);
}
}
// 查询首席投顾数量
CommonResp<Page<UserInfoNewChief>> pageCommonResp = feignClientForFatools.queryChiefFinancialAdviserList(1, 1);
if (pageCommonResp.isSuccess()) {
userInfoNew.getUserInfoNewChief().setChiefCount(pageCommonResp.getData().getTotalSize());
} else {
userInfoNew.getUserInfoNewChief().setChiefCount(0L);
}
} else if (UserTypeEnum.USER_ORG.getCode() == userInfoNew.getUserType()) {
......@@ -105,7 +114,7 @@ public class HomePageManager {
CommonResp<FundCompanySimpleVO> fundCompanyInfoSimple = feignForPublicFund.getFundCompanyInfoSimple(userInfoNew.getUserInfoNewOrg().getRelationFundCompanyId());
if (fundCompanyInfoSimple.isSuccess()) {
FundCompanySimpleVO data = fundCompanyInfoSimple.getData();
userInfoNew.setFounded(data.getEstablishDate());
userInfoNew.setFounded(data.getEstablishDate() > 0 ? DateUtils.formatYMD(new Date(data.getEstablishDate())) : null);
userInfoNew.setRecordNumber(data.getRegisterNumber());
}
}
......@@ -114,7 +123,7 @@ public class HomePageManager {
CommonResp<FundCompanySimpleVO> fundCompanyInfoSimple = feignForFund.getFundCompanyInfoSimple(userInfoNew.getUserInfoNewOrg().getRelationFundCompanyId());
if (fundCompanyInfoSimple.isSuccess()) {
FundCompanySimpleVO data = fundCompanyInfoSimple.getData();
userInfoNew.setFounded(data.getEstablishDate());
userInfoNew.setFounded(data.getEstablishDate() > 0 ? DateUtils.formatYMD(new Date(data.getEstablishDate())) : null);
userInfoNew.setRecordNumber(data.getRegisterNumber());
}
// 设置 基金数
......@@ -128,8 +137,8 @@ public class HomePageManager {
// 设置关注列表
List<String> collect = userInfoOrgs.stream().map(UserInfoOrg::getUserId).collect(Collectors.toList());
List<FollowRelEntity> followRelEntities = followRelMapper.selectList(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getIdolId, userId)
.in(FollowRelEntity::getFansId, collect)
.in(FollowRelEntity::getIdolId, collect)
.eq(FollowRelEntity::getFansId, userIdMyself)
.eq(FollowRelEntity::getDeleteTag, BizStatus.DeleteTag.tag_init));
Map<String, FollowRelEntity> collect1 = followRelEntities.stream().collect(Collectors.toMap(FollowRelEntity::getIdolId, Function.identity()));
userInfoOrgs.forEach(userInfoOrg -> {
......@@ -171,25 +180,34 @@ public class HomePageManager {
}
//获取用户关注、粉丝列表
/**
* 用户关注列表
*
* @param req 目标用户
* @param userId 当前用户
* @return
*/
public Page<FollowQo> queryFollow(QueryFollowReq req, String userId) {
//TODO 数据库分页
List<String> userIds = QueryFollowTypeEnum.QUERY_FANS.getCode().equals(req.getQueryType()) ?
followRelService.queryFansByIdolId(req.getUserId()) : followRelService.queryIdolsByFollowerId(req.getUserId());
//数据库分页
Integer pageSize = req.page.pageSize;
Integer pageNumber = req.page.pageNumber;
Page<String> userIdsPage = QueryFollowTypeEnum.QUERY_FANS.getCode().equals(req.getQueryType()) ?
followRelService.queryFansByIdolId(req.userId, pageNumber, pageSize)
: followRelService.queryIdolsByFansId(req.userId, pageNumber, pageSize);
List<FollowQo> followQos = new ArrayList<>();
if (!CollectionUtils.isEmpty(userIds)) {
List<UserInfoResp> userInfoNews = feignClientForFatools.queryUserListNew(userIds);
if (!CollectionUtils.isEmpty(userIdsPage.getContent())) {
List<UserInfoResp> userInfoNews = feignClientForFatools.queryUserListNew(userIdsPage.getContent());
List<FollowQo> collect = userInfoNews.stream().map(ConvertUtil::userInfoNew2FollowQo).collect(Collectors.toList());
followQos = judgeFollowed(collect, userId);
}
//分页
return PageUtils.page(req.getPage(), followQos);
return PageUtils.page(userIdsPage,followQos);
}
//判断返回列表中的用户是否被当前用户关注
public List<FollowQo> judgeFollowed(List<FollowQo> followQos, String followerId) {
Set<String> idolSet = new HashSet<>(followRelService.queryIdolsByFollowerId(followerId));
Set<String> idolSet = new HashSet<>(followRelService.queryIdolsByFansId(followerId));
return followQos.stream().map(o -> {
if (idolSet.contains(o.getUserId())) {
o.setFollowed(true);
......
......@@ -14,17 +14,24 @@ import com.tanpu.community.api.beans.qo.FormerThemeQo;
import com.tanpu.community.api.beans.qo.ThemeContentQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.theme.*;
import com.tanpu.community.api.beans.req.theme.CollectThemeReq;
import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ForwardThemeReq;
import com.tanpu.community.api.beans.req.theme.LikeThemeReq;
import com.tanpu.community.api.beans.req.theme.ReportThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeContentReq;
import com.tanpu.community.api.beans.req.theme.ThemeListReq;
import com.tanpu.community.api.beans.resp.CreateThemeResp;
import com.tanpu.community.api.beans.resp.ThemeFullSearchResp;
import com.tanpu.community.api.beans.resp.ThemeListResp;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp;
import com.tanpu.community.api.enums.BlockTypeEnum;
import com.tanpu.community.api.enums.OperationTypeEnum;
import com.tanpu.community.api.enums.ThemeListTypeEnum;
import com.tanpu.community.api.enums.ThemeTypeEnum;
import com.tanpu.community.api.enums.*;
import com.tanpu.community.cache.RedisCache;
import com.tanpu.community.dao.entity.community.*;
import com.tanpu.community.dao.entity.community.BlackListEntity;
import com.tanpu.community.dao.entity.community.CollectionEntity;
import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.entity.community.ThemeAttachmentEntity;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.service.*;
import com.tanpu.community.service.base.ESService;
......@@ -32,6 +39,7 @@ import com.tanpu.community.util.BizUtils;
import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.util.RankUtils;
import com.tanpu.community.util.TencentcloudUtils;
import com.tanpu.community.util.TimeUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
......@@ -43,7 +51,13 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static com.tanpu.community.api.constants.RedisKeyConstant.*;
......@@ -143,6 +157,10 @@ public class ThemeManager {
*/
@Transactional
public CreateThemeResp publishTheme(CreateThemeReq req, String userId) {
if (CollectionUtils.isEmpty(req.getContent())) {
throw new BizException("正文内容不能为空");
}
// 保存主题表
ThemeEntity themeEntity = new ThemeEntity();
BeanUtils.copyProperties(req, themeEntity);
......@@ -154,13 +172,14 @@ public class ThemeManager {
//附件校验
checkAttachment(req.getContent());
if (StringUtils.isEmpty(req.getEditThemeId())) {
if (StringUtils.isBlank(req.getEditThemeId())) {
// 新建
themeService.insertTheme(themeEntity);
} else {
// 修改
themeService.update(themeEntity, req.getEditThemeId());
themeEntity.setThemeId(req.getEditThemeId());
this.evictThemeCache(req.getEditThemeId());
}
// 保存附件表
List<ThemeAttachmentEntity> themeAttachments = ConvertUtil.themeReqToAttachmentList(req, themeEntity.getThemeId());
......@@ -201,7 +220,6 @@ public class ThemeManager {
// 转发主题
public CreateThemeResp forward(ForwardThemeReq req, String userId) {
ThemeEntity targetTheme = themeService.queryByThemeId(req.getFormerThemeId());
ThemeEntity themeEntity = ThemeEntity.builder()
.content(JsonUtil.toJson(req.getContent()))
.topicId(req.getTopicId())
......@@ -210,13 +228,14 @@ public class ThemeManager {
.themeType(ThemeTypeEnum.FORWARD.getCode())
.build();
if (StringUtils.isEmpty(req.getEditThemeId()) || req.getEditThemeId().equals(req.getFormerThemeId())) {
if (StringUtils.isBlank(req.getEditThemeId()) || req.getEditThemeId().equals(req.getFormerThemeId())) {
// 新建
themeService.insertTheme(themeEntity);
} else {
// 修改
themeService.update(themeEntity, req.getEditThemeId());
themeEntity.setThemeId(req.getEditThemeId());
this.evictThemeCache(req.getEditThemeId());
}
try {
......@@ -224,13 +243,16 @@ public class ThemeManager {
} catch (Exception e) {
log.error("error in save theme to ES. themeId:{}, error:{}", themeEntity.getThemeId(), ExceptionUtils.getStackTrace(e));
}
//失效缓存
redisCache.evict(StringUtils.joinWith("_", THEME_FORWARD_COUNT, themeEntity.getThemeId()));
return CreateThemeResp.builder().themeId(themeEntity.getThemeId()).build();
}
/**
* 推荐:由最热,最新和python推荐三个部分组成,比例为6,3,1
* 查询主题列表:推荐/关注/热门/最新
*
*/
// 查询主题列表:推荐/关注/热门/最新
public ThemeListResp queryList(ThemeListReq req, String userId) {
......@@ -247,21 +269,23 @@ public class ThemeManager {
Integer pageSize = req.page.pageSize;
List<ThemeEntity> themes = new ArrayList<>();
// 推荐:由最新,最热和python推荐三个部分组成,默认比例为6,3,1,可在配置文件中配置
if (ThemeListTypeEnum.RECOMMEND.getCode().equals(req.getType())) {
// 推荐
// 需要筛掉用户访问过详情的 & 最近出现在列表页过的.
List<String> visitedIds = visitLogService.queryUserRecentVisited(userId);
List<String> excludes = ListUtils.union(excludeIds, visitedIds);
List<String> recmdIds = recommendService.getRecommendThemes(pageStart, pageSize, userId, excludes);
themes = themeService.queryByThemeIds(recmdIds);
//排序并去重
themes = RankUtils.sortThemeEntityByIds(themes, recmdIds).stream().limit(pageSize).collect(Collectors.toList());
} else if (ThemeListTypeEnum.FOLLOW.getCode().equals(req.getType())) {
// 根据关注列表查询,按时间倒序
List<String> fansList = followRelService.queryIdolsByFollowerId(userId);
List<String> fansList = followRelService.queryIdolsByFansId(userId);
themes = themeService.queryByUserIdsCreateDesc(fansList, pageStart, pageSize);
if (CollectionUtils.isEmpty(excludeIds) && !themes.isEmpty()) {
......@@ -323,13 +347,21 @@ public class ThemeManager {
private void buildThemeQoExtraInfo(ThemeQo themeQo) {
String themeId = themeQo.getThemeId();
// 封装转发对象
FormerThemeQo former = redisCache.getObject(StringUtils.joinWith("_", CACHE_FORMER_THEME_ID, themeId), 60,
FormerThemeQo former = redisCache.getObject(StringUtils.joinWith("_", CACHE_FORWARD_THEME_ID, themeQo.getFormerThemeId()), 60,
() -> this.getFormerTheme(themeQo.getFormerThemeId()), FormerThemeQo.class);
themeQo.setFormerTheme(former);
// 点赞,收藏,转发
Integer likeCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME);
Integer commentCount = commentService.getCommentCountByThemeId(themeId);
Integer forwardCount = themeService.getForwardCountById(themeId);
Integer likeCount = redisCache.getObject(StringUtils.joinWith("_", THEME_LIKE_COUNT, themeId), 60,
() -> collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME), Integer.class);
Integer commentCount = redisCache.getObject(StringUtils.joinWith("_", THEME_COMMENT_COUNT, themeId), 60,
() -> commentService.getCommentCountByThemeId(themeId), Integer.class);
Integer forwardCount = redisCache.getObject(StringUtils.joinWith("_", THEME_FORWARD_COUNT, themeId), 60,
() -> themeService.getForwardCountById(themeId), Integer.class);
themeQo.setCommentCount(commentCount);
themeQo.setLikeCount(likeCount);
themeQo.setForwardCount(forwardCount);
......@@ -341,12 +373,12 @@ public class ThemeManager {
// 是否关注作者
themeQo.setFollow(followRelService.checkFollow(themeQo.getAuthorId(), userId));
// 是否点赞
CollectionEntity likeEntity = collectionService.getTarget(themeId, userId, CollectionTypeEnum.LIKE_THEME);
CollectionEntity likeEntity = collectionService.queryCollection(themeId, userId, CollectionTypeEnum.LIKE_THEME);
themeQo.setHasLiked(likeEntity != null);
// 是否转发
themeQo.setHasForward(themeService.judgeForwardByUser(themeId, userId));
// 是否收藏
CollectionEntity collectionEntity = collectionService.getTarget(themeId, userId, CollectionTypeEnum.COLLECT_THEME);
CollectionEntity collectionEntity = collectionService.queryCollection(themeId, userId, CollectionTypeEnum.COLLECT_THEME);
themeQo.setHasCollect(collectionEntity != null);
}
......@@ -354,7 +386,7 @@ public class ThemeManager {
private void buildThemeExtraInfoByUser(String userId, List<ThemeQo> themeQos) {
// 批量查询
List<String> themeIds = themeQos.stream().map(ThemeQo::getThemeId).collect(Collectors.toList());
Set<String> idolSet = new HashSet<>(followRelService.queryIdolsByFollowerId(userId));
Set<String> idolSet = new HashSet<>(followRelService.queryIdolsByFansId(userId));
Set<String> likeSet = collectionService.getTargets(themeIds, userId, CollectionTypeEnum.LIKE_THEME);
Set<String> bookSet = collectionService.getTargets(themeIds, userId, CollectionTypeEnum.COLLECT_THEME);
Set<String> forwardUsers = themeService.getForwardUsers(themeIds);
......@@ -367,39 +399,45 @@ public class ThemeManager {
}
}
// 返回用户发布、回复、点赞、收藏的主题列表
/**
* 返回用户发布、回复、点赞、收藏的主题列表
*
* @param req 查询用户
* @param userId 当前用户
* @return
*/
public List<ThemeQo> queryThemesByUser(QueryRecordThemeReq req, String userId) {
List<ThemeEntity> themeEntities = Collections.emptyList();
switch (req.getRecordType()) {
case 1://发布
themeEntities = themeService.queryThemesByUserId(req.getUserId(), req.getLastId(), req.getPageSize());
themeEntities = themeService.queryThemesByUserIdCreateDesc(req.getUserId(), req.getLastId(), req.getPageSize());
break;
case 2://回复
List<ThemeQo> commentThemeList = getCommentThemeQos(req, userId);
return commentThemeList;
case 3://点赞
List<String> likeThemeIds = collectionService.getListByUser(req.getUserId(), CollectionTypeEnum.LIKE_THEME);
themeEntities = themeService.queryByThemeIds(likeThemeIds, req.getLastId(), req.getPageSize());
List<String> likeThemeIds = collectionService.getListByUser(req.getUserId(), CollectionTypeEnum.LIKE_THEME, req.getLastId(), req.getPageSize());
themeEntities = themeService.queryByThemeIds(likeThemeIds);
themeEntities = RankUtils.sortThemeEntityByIds(themeEntities, likeThemeIds);
break;
case 4://收藏
List<String> collectThemeIds = collectionService.getListByUser(req.getUserId(), CollectionTypeEnum.COLLECT_THEME);
List<String> collectThemeIds = collectionService.getListByUser(req.getUserId(), CollectionTypeEnum.COLLECT_THEME, req.getLastId(), req.getPageSize());
themeEntities = themeService.queryByThemeIds(collectThemeIds, req.getLastId(), req.getPageSize());
themeEntities = RankUtils.sortThemeEntityByIds(themeEntities, collectThemeIds);
break;
}
List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId);
if (userId.equals(req.getUserId())) {
//如果用户是查询自己的帖子,需要实时查询用户自己的个人信息,防止数据不一致
if (userId.equals(req.getUserId()) && !ThemeRecordTypeEnum.COLLECT_LIST.getCode().equals(req.getRecordType())) {
//如果用户是查询自己的帖子,需要实时查询用户自己的个人信息,防止数据不一致(非收藏类型)
CommonResp<UserInfoResp> userInfoNewCommonResp = feignClientForFatools.queryUsersListNew(userId);
if (userInfoNewCommonResp.isNotSuccess()) {
throw new BizException("内部接口调用失败");
}
UserInfoResp user = userInfoNewCommonResp.getData();
themeQos.stream().forEach(o->reBuildAuthorInfo(o,user));
themeQos.stream().forEach(o -> reBuildAuthorInfo(o, user));
redisCache.put(StringUtils.joinWith("_", CACHE_FEIGN_USER_INFO, userId), user, 60);
}
......@@ -408,21 +446,15 @@ public class ThemeManager {
// 查询正文
public ThemeQo getThemeDetail(String themeId, String userId) {
// 查询详情
ThemeQo themeQo = redisCache.getObject(StringUtils.joinWith("_", CACHE_THEME_ID, themeId), 60,
() -> this.getDetailCommon(themeId), ThemeQo.class);
// 添加用户相关信息
buildThemeExtraInfoByUser(userId, themeQo);
return themeQo;
}
// 正文通用信息,与用户无关,可使用缓存
private ThemeQo getDetailCommon(String themeId) {
ThemeEntity themeEntity = themeService.queryByThemeId(themeId);
public CommonResp<ThemeQo> getThemeDetail(String themeId, String userId) {
ThemeEntity themeEntity = themeService.queryByThemeIdIgnoreDelete(themeId);
if (themeEntity == null) {
throw new BizException("找不到帖子id:" + themeId);
}
if (themeEntity.getDeleteTag().equals(DeleteTagEnum.DELETED.getCode())) {
return CommonResp.error(ErrorCodeConstant.UNREACHABLE, null);
}
ThemeQo themeQo = ConvertUtil.themeEntityToQo(themeEntity);
//附件
batchFeignCallService.getAttachDetail(themeQo);
......@@ -430,10 +462,13 @@ public class ThemeManager {
//转发、收藏、点赞
buildThemeQoExtraInfo(themeQo);
return themeQo;
//时间重制
themeQo.setUpToNowTime(TimeUtils.format(themeEntity.getCreateTime()));
// 添加用户相关信息
buildThemeExtraInfoByUser(userId, themeQo);
return CommonResp.success(themeQo);
}
// 点赞/取消点赞
public void like(LikeThemeReq req, String userId) {
if (OperationTypeEnum.CONFIRM.getCode().equals(req.getType())) {
......@@ -441,6 +476,8 @@ public class ThemeManager {
} else if (OperationTypeEnum.CANCEL.getCode().equals(req.getType())) {
collectionService.delete(req.getThemeId(), userId, CollectionTypeEnum.LIKE_THEME);
}
//失效缓存
redisCache.evict(StringUtils.joinWith("_", THEME_LIKE_COUNT, req.getThemeId()));
}
......@@ -468,7 +505,7 @@ public class ThemeManager {
public Integer getFollowUpdateCount(String userId) {
String lastIdStr = redisCache.get(CACHE_IDOL_THEME_LAST_ID + userId);
Long lastId = StringUtils.isBlank(lastIdStr) ? 0L : Long.parseLong(lastIdStr);
List<String> fansList = followRelService.queryIdolsByFollowerId(userId);
List<String> fansList = followRelService.queryIdolsByFansId(userId);
return themeService.queryCountFromLastId(fansList, lastId);
}
......@@ -483,7 +520,7 @@ public class ThemeManager {
//返回被转发主题
private FormerThemeQo getFormerTheme(String formerThemeId) {
if (StringUtils.isNotEmpty(formerThemeId)) {
if (StringUtils.isNotBlank(formerThemeId)) {
ThemeQo formerTheme = ConvertUtil.themeEntityToQo(themeService.queryByThemeId(formerThemeId));
if (formerTheme != null) {
batchFeignCallService.getAttachDetail(formerTheme);
......@@ -499,6 +536,8 @@ public class ThemeManager {
// 逻辑删除主题,校验用户
public void delete(String themeId, String userId) {
themeService.deleteById(themeId, userId);
this.evictThemeCache(themeId);
}
......@@ -508,6 +547,11 @@ public class ThemeManager {
* @param req
*/
private void checkContent(CreateThemeReq req) {
if (ThemeTypeEnum.LONG_TEXT.getCode().equals(req.getThemeType()) && req.getTitle().length() > 50) {
throw new IllegalArgumentException("长文标题不能超过50字");
}
StringBuilder sb = new StringBuilder();
for (ThemeContentReq themeContentReq : req.getContent()) {
if (RelTypeEnum.TEXT.type.equals(themeContentReq.getType())) {
......@@ -518,12 +562,12 @@ public class ThemeManager {
// 腾讯云接口最多支持5000文字校验
// 检查内容是否涉黄违法
boolean b;
while (content.length()>5000){
while (content.length() > 5000) {
b = TencentcloudUtils.textModeration(content.substring(0, 5000));
if (!b) {
throw new BizException(ErrorCodeConstant.CONTENT_ILLEGAL);
}
content=content.substring(5000);
content = content.substring(5000);
}
b = TencentcloudUtils.textModeration(content);
if (!b) {
......@@ -626,7 +670,7 @@ public class ThemeManager {
return userInfoNewCommonResp.getData();
}
private void reBuildAuthorInfo(ThemeQo themeQo,UserInfoResp userInfo){
private void reBuildAuthorInfo(ThemeQo themeQo, UserInfoResp userInfo) {
themeQo.setNickName(userInfo.getNickName());
themeQo.setUserImg(userInfo.getHeadImageUrl());
themeQo.setUserIntroduction(userInfo.getIntroduction());
......@@ -642,4 +686,9 @@ public class ThemeManager {
themeQo.setWorkshopIntroduction(userInfo.getWorkshopIntroduction());
}
private void evictThemeCache(String themeId){
redisCache.evict(StringUtils.joinWith("_", CACHE_FORWARD_THEME_ID, themeId));
redisCache.evict(StringUtils.joinWith("_", CACHE_THEME_ID, themeId));
}
}
package com.tanpu.community.manager;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.constant.ErrorCodeConstant;
import com.tanpu.community.api.beans.qo.TopicRankQo;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.service.RankService;
import com.tanpu.community.service.TopicService;
import com.tanpu.community.service.VisitLogService;
import com.tanpu.community.util.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import static com.tanpu.biz.common.enums.clue.PageEnum.COMM_VISIT_TOPIC_DETAIL;
@Service
public class TopicManager {
@Autowired
private VisitLogService visitLogService;
private TopicService topicService;
@Autowired
private RankService rankService;
@Resource
private UserHolder userHolder;
// 首页-话题标签
......@@ -43,11 +39,12 @@ public class TopicManager {
}
// 话题详情页
public TopicRankQo getDetail(String topicId) {
//TODO 临时埋点,接入新埋点后删除
visitLogService.addPageView(userHolder.getUserId(), topicId, COMM_VISIT_TOPIC_DETAIL);
return rankService.getTopicDetail(topicId);
public CommonResp<TopicRankQo> getDetail(String topicId) {
TopicEntity topicEntity = topicService.queryById(topicId);
if (topicEntity==null){
return CommonResp.error(ErrorCodeConstant.TOPIC_NOT_FOUND.getCode(), "抱歉!该话题已下线。");
}
return CommonResp.success(rankService.getTopicDetail(topicId));
}
......
......@@ -31,7 +31,7 @@ public class VisitSummaryManager {
@KafkaListener(topics = kafakTopic)
public void updateVisitSummary(String message) {
// {"durMillsInc":10000,"ident":"AD7B8CE8-2DA4-4FB4-907F-C551B926BA5C","localDate":"2021-08-02","pageId":"p13503","refId":"88737580570230824","visitorId":"275321532031467520"}
log.info("receive kafka msg: {}", message);
// log.info("receive kafka msg: {}", message);
KafkaDurationUptMsg msg = JSON.parseObject(message, KafkaDurationUptMsg.class);
// ident在每次进入新页面 & 回退 的时候都会随机生成一个,所以用ident做唯一key即可。
......
......@@ -7,6 +7,7 @@ import com.tanpu.biz.common.enums.user.UserLevelEnum;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.enums.fund.ProductTypeEnum;
import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.CommunityConstant;
import com.tanpu.community.api.beans.qo.AttachmentDetailVo;
import com.tanpu.community.api.beans.qo.ThemeContentQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
......@@ -258,10 +259,10 @@ public class BatchFeignCallService {
Set<String> ifaFundIds,
Set<String> notNetFundIds,
Map<String, FundInfoBaseResp> fundMap) {
Map<String, FundInfoBaseResp> tampFundMap = null;
Map<String, FundInfoBaseResp> privateFundMap = null;
Map<String, FundInfoBaseResp> publicFundMap = null;
Map<String, FundInfoBaseResp> ifaFundMap = null;
Map<String, FundInfoBaseResp> tampFundMap;
Map<String, FundInfoBaseResp> privateFundMap;
Map<String, FundInfoBaseResp> publicFundMap;
Map<String, FundInfoBaseResp> ifaFundMap;
Map<String, FundInfoBaseResp> notNetFundMap = null;
if (!CollectionUtils.isEmpty(tanpuFundIds)) {
// ProductListReq productListReq = ProductListReq.builder()
......@@ -276,7 +277,7 @@ public class BatchFeignCallService {
}).collect(Collectors.toList());
tampFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
if (tampFundMap != null && tampFundMap.size() > 0) {
if (tampFundMap.size() > 0) {
fundMap.putAll(tampFundMap);
}
}
......@@ -291,7 +292,7 @@ public class BatchFeignCallService {
}).collect(Collectors.toList());
privateFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
if (privateFundMap != null && privateFundMap.size() > 0) {
if (privateFundMap.size() > 0) {
fundMap.putAll(privateFundMap);
}
}
......@@ -307,7 +308,7 @@ public class BatchFeignCallService {
ifaFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
if (ifaFundMap != null && ifaFundMap.size() > 0) {
if (ifaFundMap.size() > 0) {
fundMap.putAll(ifaFundMap);
}
}
......@@ -322,7 +323,7 @@ public class BatchFeignCallService {
}).collect(Collectors.toList());
publicFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
if (publicFundMap != null && publicFundMap.size() > 0) {
if (publicFundMap.size() > 0) {
fundMap.putAll(publicFundMap);
}
}
......@@ -427,23 +428,26 @@ public class BatchFeignCallService {
//单图封装到imglist列表中
if (imgUrlMap.containsKey(themeContent.getValue())) {
FileRecordEntity imgEntity = imgUrlMap.get(themeContent.getValue());
String extInfo = imgEntity.getExtInfo();
if (!StringUtils.isEmpty(extInfo)) {
Map<String, Object> extMap = JsonUtil.toMap(extInfo);
if (imgEntity!=null && !StringUtils.isEmpty(imgEntity.getExtInfo())) {
Map<String, Object> extMap = JsonUtil.toMap(imgEntity.getExtInfo());
ImagesDTO imagesDTO = ImagesDTO.builder().imgHeight((Integer) extMap.get("height"))
.imgWidth((Integer) extMap.get("width"))
.remark(imgEntity.getUrl())
.relId(imgEntity.getFileId())
//压缩图片
.resizeUrl(imgEntity.getUrl() + CommunityConstant.OSS_RESIZE_RATIO)
.build();
themeContent.setImgList(Collections.singletonList(imagesDTO));
}
}
} else if (themeContent.getType().equals(RelTypeEnum.MULTIPLE_IMAGE.type)) {
//多图写入图片宽高
//多图写入图片宽高,压缩图片url
List<ImagesDTO> imgList = themeContent.getImgList();
for (ImagesDTO imagesDTO : imgList) {
//压缩图片地址
imagesDTO.setResizeUrl(imagesDTO.getRemark() + CommunityConstant.OSS_RESIZE_RATIO);
if (imgUrlMap.containsKey(imagesDTO.getRelId())) {
FileRecordEntity imgEntity = imgUrlMap.get(themeContent.getValue());
FileRecordEntity imgEntity = imgUrlMap.get(imagesDTO.getRelId());
String extInfo = imgEntity.getExtInfo();
if (!StringUtils.isEmpty(extInfo)) {
Map<String, Object> extMap = JsonUtil.toMap(extInfo);
......
......@@ -7,12 +7,18 @@ import com.tanpu.community.dao.entity.community.CollectionEntity;
import com.tanpu.community.dao.entity.community.TimesCountEntity;
import com.tanpu.community.dao.mapper.community.CollectionMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
......@@ -48,7 +54,7 @@ public class CollectionService {
//根据用户、主题、类型查询未删除对象
public CollectionEntity getTarget(String targetId, String userId, CollectionTypeEnum type) {
public CollectionEntity queryCollection(String targetId, String userId, CollectionTypeEnum type) {
LambdaQueryWrapper<CollectionEntity> queryWrapper = new LambdaQueryWrapper<CollectionEntity>()
.eq(CollectionEntity::getCollectionType, type.getCode())
.eq(CollectionEntity::getUserId, userId)
......@@ -57,6 +63,15 @@ public class CollectionService {
return collectionMapper.selectOne(queryWrapper);
}
//根据用户、主题、类型查询未删除对象
public CollectionEntity queryIncludeDelete(String targetId, String userId, CollectionTypeEnum type) {
LambdaQueryWrapper<CollectionEntity> queryWrapper = new LambdaQueryWrapper<CollectionEntity>()
.eq(CollectionEntity::getCollectionType, type.getCode())
.eq(CollectionEntity::getUserId, userId)
.eq(CollectionEntity::getTargetId, targetId);
return collectionMapper.selectOne(queryWrapper);
}
//根据用户、主题、类型查询未删除对象
public Set<String> getTargets(List<String> targetIds, String userId, CollectionTypeEnum type) {
if (CollectionUtils.isEmpty(targetIds)){
......@@ -91,6 +106,27 @@ public class CollectionService {
.stream().map(CollectionEntity::getTargetId).collect(Collectors.toList());
}
// 根据用户id和行为type获取target_id列表
public List<String> getListByUser(String userId, CollectionTypeEnum type,String lastId,Integer pageSize) {
LambdaQueryWrapper<CollectionEntity> queryWrapper = new LambdaQueryWrapper<CollectionEntity>()
.eq(CollectionEntity::getUserId, userId)
.eq(CollectionEntity::getCollectionType, type.getCode())
.eq(CollectionEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode())
.orderByDesc(CollectionEntity::getCollectionTime);
if (StringUtils.isNotEmpty(lastId)) {
CollectionEntity target = queryIncludeDelete(lastId, userId, type);
if (target == null) return Collections.emptyList();
queryWrapper.lt(CollectionEntity::getCollectionTime, target.getCollectionTime());
}
if (pageSize != null) {
queryWrapper.last("limit " + pageSize);
}
return collectionMapper.selectList(queryWrapper)
.stream().map(CollectionEntity::getTargetId).collect(Collectors.toList());
}
// 统计单个对象(主题、评论)的数量(点赞、收藏)
public Integer getCountByTypeAndId(String targetId, CollectionTypeEnum type) {
......@@ -105,7 +141,9 @@ public class CollectionService {
if (CollectionUtils.isEmpty(targetIds)) {
return new HashMap<>();
}
LambdaQueryWrapper<CollectionEntity> queryWrapper = new LambdaQueryWrapper<CollectionEntity>().eq(CollectionEntity::getCollectionType, 1)
LambdaQueryWrapper<CollectionEntity> queryWrapper = new LambdaQueryWrapper<CollectionEntity>()
.eq(CollectionEntity::getCollectionType, type.getCode())
.eq(CollectionEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode())
.in(CollectionEntity::getTargetId, targetIds).groupBy(CollectionEntity::getTargetId);
return collectionMapper.selectCountByTargetIds(queryWrapper).stream()
.collect(Collectors.toMap(TimesCountEntity::getId, TimesCountEntity::getTimes));
......@@ -123,7 +161,7 @@ public class CollectionService {
//逻辑删除,修改delete_tag
@Transactional
public void delete(String themeId, String userId, CollectionTypeEnum type) {
CollectionEntity queryCollection = getTarget(themeId, userId, type);
CollectionEntity queryCollection = queryCollection(themeId, userId, type);
if (queryCollection != null) {
queryCollection.setDeleteTag(DeleteTagEnum.DELETED.getCode());
queryCollection.setUncollectionTime(LocalDateTime.now());
......
......@@ -40,13 +40,11 @@ public class CommentService {
@Transactional
public void insertComment(CommentEntity commentEntity) {
commentEntity.setCommentId(uuidGenHelper.getUuidStr());
if (commentEntity.getContent().length()>500){
throw new IllegalArgumentException("评论内容超过500字");
}
commentMapper.insert(commentEntity);
//失效缓存
evictThemeCache(commentEntity.getThemeId());
}
......@@ -112,7 +110,7 @@ public class CommentService {
CommentEntity commentEntity = commentMapper.selectOne(new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getCommentId, lastId));
if (commentEntity == null) throw new BizException("评论未找到,id:" + lastId);
queryWrapper.lt(CommentEntity::getUpdateTime, commentEntity.getCreateTime());
queryWrapper.lt(CommentEntity::getCreateTime, commentEntity.getCreateTime());
}
if (pageSize != null) {
queryWrapper.last("limit " + pageSize);
......@@ -148,8 +146,12 @@ public class CommentService {
// 失效关联主题缓存
private void evictThemeCache(String themeId){
// 评论内容
redisCache.evict(StringUtils.joinWith("_", CACHE_COMMENT_THEMEID, themeId));
// 主题内容
redisCache.evict(StringUtils.joinWith("_", CACHE_THEME_ID, themeId));
// 评论数
redisCache.evict(StringUtils.joinWith("_", THEME_COMMENT_COUNT, themeId));
}
}
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.constant.BizStatus;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.dao.entity.community.FollowRelEntity;
import com.tanpu.community.dao.mapper.community.FollowRelMapper;
......@@ -21,7 +23,7 @@ public class FollowRelService {
@Resource
private FollowRelMapper followRelMapper;
public List<String> queryIdolsByFollowerId(String followerId) {
public List<String> queryIdolsByFansId(String followerId) {
return followRelMapper.selectList(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFansId, followerId)
.eq(FollowRelEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()))
......@@ -29,19 +31,55 @@ public class FollowRelService {
.collect(Collectors.toList());
}
// @Cacheable(value = "tempCache", keyGenerator = "communityKeyGenerator")
public List<String> queryFansByIdolId(String idolId) {
public Page<String> queryIdolsByFansId(String fansId, Integer pageNum, Integer pageSize) {
Integer pageStart = (pageNum - 1) * pageSize;
List<FollowRelEntity> idols = followRelMapper.selectList(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFansId, fansId)
.last("limit " + pageStart + ", " + pageSize)
.eq(FollowRelEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()));
List<String> list = idols.stream().map(FollowRelEntity::getIdolId)
.collect(Collectors.toList());
Integer totalSize = followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>().eq(FollowRelEntity::getFansId,fansId)
.eq(FollowRelEntity::getDeleteTag, BizStatus.DeleteTag.tag_init));
Page<String> tPage = new Page<>(pageNum, pageSize, (long) totalSize, 0, list);
int totalPage = list.size() / pageSize;
if (list.size() % pageSize == 0) {
tPage.setTotalPages(totalPage);
} else {
tPage.setTotalPages(totalPage + 1);
}
return tPage;
}
public Page<String> queryFansByIdolId(String idolId, Integer pageNum, Integer pageSize) {
Integer pageStart = (pageNum - 1) * pageSize;
LambdaQueryWrapper<FollowRelEntity> queryWrapper = new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getIdolId, idolId)
.last("limit " + pageStart + ", " + pageSize)
.eq(FollowRelEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
return followRelMapper.selectList(queryWrapper)
List<String> list = followRelMapper.selectList(queryWrapper)
.stream().map(FollowRelEntity::getFansId).collect(Collectors.toList());
// 分页
Integer totalSize = followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>().eq(FollowRelEntity::getIdolId, idolId)
.eq(FollowRelEntity::getDeleteTag, BizStatus.DeleteTag.tag_init));
Page<String> tPage = new Page<>(pageNum, pageSize, (long) totalSize, 0, list);
int totalPage = list.size() / pageSize;
if (list.size() % pageSize == 0) {
tPage.setTotalPages(totalPage);
} else {
tPage.setTotalPages(totalPage + 1);
}
return tPage;
}
@Transactional
public void addFollowRel(String idolId, String followerId) {
FollowRelEntity searchResult = queryRecord(idolId, followerId);
if (searchResult==null){
if (searchResult == null) {
FollowRelEntity entity = FollowRelEntity.builder()
.idolId(idolId)
.fansId(followerId)
......@@ -49,7 +87,7 @@ public class FollowRelService {
.build();
followRelMapper.insert(entity);
}else {
} else {
searchResult.setFollowTime(LocalDateTime.now());
searchResult.setDeleteTag(DeleteTagEnum.NOT_DELETED.getCode());
followRelMapper.updateById(searchResult);
......@@ -59,13 +97,14 @@ public class FollowRelService {
/**
* 逻辑删除关注关系
*
* @param idolId
* @param followerId
*/
@Transactional
public void deleteFollowRel(String idolId, String followerId) {
FollowRelEntity searchResult = queryRecord(idolId, followerId);
if (searchResult==null){
if (searchResult == null) {
throw new BizException("未找到关注关系");
}
searchResult.setUnfollowTime(LocalDateTime.now());
......@@ -73,18 +112,18 @@ public class FollowRelService {
followRelMapper.updateById(searchResult);
}
public FollowRelEntity queryRecord(String idolId, String followerId){
public FollowRelEntity queryRecord(String idolId, String followerId) {
return followRelMapper.selectOne(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getIdolId,idolId)
.eq(FollowRelEntity::getFansId,followerId));
.eq(FollowRelEntity::getIdolId, idolId)
.eq(FollowRelEntity::getFansId, followerId));
}
public boolean checkFollow(String idolId,String followerId){
public boolean checkFollow(String idolId, String followerId) {
return followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getIdolId,idolId)
.eq(FollowRelEntity::getFansId,followerId)
.eq(FollowRelEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode()))
>0;
.eq(FollowRelEntity::getIdolId, idolId)
.eq(FollowRelEntity::getFansId, followerId)
.eq(FollowRelEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()))
> 0;
}
......
......@@ -8,7 +8,6 @@ import com.tanpu.common.util.JsonUtil;
import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.api.CommunityConstant;
import com.tanpu.community.api.enums.FileTypeEnum;
import com.tanpu.community.api.enums.OssRelType;
import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.dao.mapper.community.FileRecordMapper;
import lombok.extern.slf4j.Slf4j;
......@@ -67,7 +66,6 @@ public class OSSFileService {
public FileRecordEntity uploadFile(byte[] data, String fileName, String fileSuffix, String dirPrefix) {
String[] arr = StringUtils.split(fileName, ".");
String suffix = arr[arr.length - 1];
if (FileTypeEnum.imageTypeSet.contains(suffix)) {
//上传
String id = uuidGenHelper.getUuidStr();
String key = CommunityConstant.OSS_PREFIX_FOLDER + dirPrefix + id + "." + suffix;
......@@ -88,11 +86,14 @@ public class OSSFileService {
fileRecordMapper.insert(record);
return record;
}else {
throw new BizException("文件格式暂不支持:"+suffix);
}
public void uploadFileNoRecord(byte[] data, String fileName, String fileSuffix, String dirPrefix) {
String[] arr = StringUtils.split(fileName, ".");
String suffix = arr[arr.length - 1];
//上传
String key = CommunityConstant.OSS_PREFIX_FOLDER + dirPrefix + suffix;
ossHelper.writeFile(bucketName, key, data, fileSuffix);
}
private HashMap<String, Integer> getStringIntegerHashMap(byte[] data) {
......
package com.tanpu.community.service;
import com.alibaba.fastjson.JSON;
import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.qo.ThemeAnalysDO;
import com.tanpu.community.api.beans.qo.TopicRankQo;
......@@ -7,16 +8,28 @@ import com.tanpu.community.api.enums.RankLogTypeEnum;
import com.tanpu.community.dao.entity.community.RankLogEntity;
import com.tanpu.community.dao.mapper.community.RankLogMapper;
import com.tanpu.community.util.BizUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.ByteArrayOutputStream;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
public class RankLogService {
@Autowired
private OSSFileService ossFileService;
@Resource
private RankLogMapper rankLogMapper;
......@@ -25,10 +38,15 @@ public class RankLogService {
//话题排序日志
@Transactional
public void logTopicRank(List<TopicRankQo> rankList, LocalDateTime logTime, Long cost) {
if (CollectionUtils.isEmpty(rankList)) {
return;
}
Long round = rankLogMapper.selectMaxRound(RankLogTypeEnum.TOPIC.getCode());
round = round == null ? 0L : round + 1;
//分页插入
for (int i = 0; i * pageSize < rankList.size(); i++) {
int pageStart = i * pageSize;
......@@ -40,16 +58,22 @@ public class RankLogService {
.content(JsonUtil.toJson(sublist))
.pageNumber(i + 1)
.pageSize(sublist.size())
.round(round)
.build();
rankLogMapper.insert(entity);
}
}
//主题排序日志
@Transactional
public void logThemeRank(List<ThemeAnalysDO> themeList, LocalDateTime logTime, Long cost) {
if (CollectionUtils.isEmpty(themeList)) {
return;
}
Long round = rankLogMapper.selectMaxRound(RankLogTypeEnum.THEME.getCode());
round = round == null ? 0L : round + 1;
//分页插入
for (int i = 0; i * pageSize < themeList.size(); i++) {
int pageStart = i * pageSize;
......@@ -61,8 +85,46 @@ public class RankLogService {
.content(JsonUtil.toJson(sublist))
.pageNumber(i + 1)
.pageSize(sublist.size())
.round(round)
.build();
rankLogMapper.insert(entity);
}
}
// 定时清除ranklog,并上传到oss
public void clearRankLog() {
LocalDateTime t = LocalDateTime.now().minusDays(7L);
String d = t.format(DateTimeFormatter.BASIC_ISO_DATE);
log.info("start clearRankLog job before {}", d);
for (RankLogTypeEnum type : RankLogTypeEnum.values()) {
int idx = 0;
while (true) {
List<RankLogEntity> logs = rankLogMapper.selectByTypeLimit(type.getCode(), 100);
if (logs.isEmpty() || logs.get(0).getRankTime().isAfter(t)) {
break;
}
try {
String fileName = "ranklog_" + type.getCode() + "_" + idx;
ByteArrayOutputStream os = new ByteArrayOutputStream();
IOUtils.writeLines(logs.stream().map(JSON::toJSONString).collect(Collectors.toList()), null, os);
ossFileService.uploadFileNoRecord(os.toByteArray(), fileName, ".txt", "rankLog/");
Thread.sleep(1000);
} catch (Exception e) {
log.error("error in clearRankLog", e);
throw new RuntimeException(e);
}
// delete
List<Long> ids = logs.stream().map(RankLogEntity::getId).collect(Collectors.toList());
rankLogMapper.deleteBatchIds(ids);
idx++;
}
}
}
}
......@@ -15,6 +15,7 @@ import com.tanpu.community.util.TimeUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -29,6 +30,38 @@ import static com.tanpu.community.api.constants.RedisKeyConstant.CACHE_FEIGN_USE
@Service
public class RankService {
@Value("${rank.theme.viewRate:0.1}")
public Double viewRate;
@Value("${rank.theme.forwardRate:3}")
public Double forwardRate;
@Value("${rank.theme.commentRate:2}")
public Double commentRate;
@Value("${rank.theme.likeRaten:3}")
public Double likeRaten;
@Value("${rank.theme.collectRate:3}")
public Double collectRate;
//用户质量权重
@Value("${rank.theme.userWeightRate:0.9}")
public Double userWeightRate;
//初始质量
@Value("${rank.theme.initialWeight:1.0}")
public Double initialWeight;
//时间系数
@Value("${rank.theme.timeRate:0.2}")
public Double timeRate;
@Value("${rank.topic.viewRate:1}")
public Double topicViewRate;
@Value("${rank.topic.discussRate:3}")
public Double topicDiscussRate;
@Value("${rank.topic.themeRate:1}")
public Double topicThemeRate;
//时间系数
@Value("${rank.theme.timeRate:1}")
public Double topicTimeRate;
@Autowired
private ThemeService themeService;
@Autowired
......@@ -94,9 +127,11 @@ public class RankService {
theme.setUserWeight(authorInfo.getLevelGrade() * 1.0);
}
}
//打分
Map<ThemeAnalysDO, Double> map = themeAnalysDOS.stream().collect(Collectors.toMap(o -> o, ThemeAnalysDO::getRank));
this.calculateThemeScore(theme);
}
//排序
Map<ThemeAnalysDO, Double> map = themeAnalysDOS.stream().collect(Collectors.toMap(o -> o, ThemeAnalysDO::getScore));
//排序
hotestThemes = map.entrySet().stream()
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
......@@ -126,10 +161,7 @@ public class RankService {
topic.setViewCount(topicViewMap.getOrDefault(topic.getTopicId(), 0));
topic.setDisscussCount(0);
topic.setThemeWeight(0.0);
topic.setFormatViewCount(BizUtils.formatCountNumber(topic.getViewCount()));
topic.setFormatDisscussCount(BizUtils.formatCountNumber(topic.getDisscussCount()));
continue;
}
} else {
// 浏览量
Integer topicPV = topicViewMap.getOrDefault(topic.getTopicId(), 0);
Integer themePV = visitLogService.queryThemeVisit(themeIds);
......@@ -139,14 +171,19 @@ public class RankService {
topic.setDisscussCount(themeIds.size() + commentCount);
//帖子权重,求和
double themeSum = getHotestThemes().stream().filter(o -> topic.getTopicId().equals(o.getTopicId()))
.mapToDouble(ThemeAnalysDO::getRank)
.mapToDouble(ThemeAnalysDO::getScore)
.sum();
topic.setThemeWeight(themeSum);
//格式化浏览量、讨论量
}
// 打分
calculateTopicScore(topic);
// 格式化浏览量、讨论量
topic.setFormatViewCount(BizUtils.formatCountNumber(topic.getViewCount()));
topic.setFormatDisscussCount(BizUtils.formatCountNumber(topic.getDisscussCount()));
}
Map<TopicRankQo, Double> map = topicRankQos.stream().collect(Collectors.toMap(o -> o, TopicRankQo::getRank));
// 排序
Map<TopicRankQo, Double> map = topicRankQos.stream().collect(Collectors.toMap(o -> o, TopicRankQo::getScore));
List<TopicRankQo> rankList = map.entrySet().stream()
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
.map(Map.Entry::getKey)
......@@ -158,7 +195,6 @@ public class RankService {
//落库
rankLogService.logTopicRank(rankList, start, TimeUtils.calMillisTillNow(start));
return;
}
/**
......@@ -214,4 +250,30 @@ public class RankService {
.collect(Collectors.toList());
}
// todo 这里用户层面只考虑了用户的gradelevel,后续可以为用户的历史贴子打分。根据用户发表的历史帖子的质量,为用户评分。例如,历史帖子的关注度,用户的粉丝数量。
// todo 可以考虑一下话题的热度。
private void calculateThemeScore(ThemeAnalysDO theme) {
// 质量=帖子质量+用户质量
double w = theme.getViewCount() * viewRate
+ theme.getForwardCount() * forwardRate
+ theme.getCommentCount() * commentRate
+ theme.getLikeCount() * likeRaten
+ theme.getCollectCount() * collectRate
+ Math.pow(theme.getUserWeight(), userWeightRate);
double score = (w + initialWeight) / Math.pow(theme.getMinutesTillNow() + 1, timeRate);
theme.setScore(score);
}
public void calculateTopicScore(TopicRankQo topic) {
//顶置话题
if (topic.getIsTop() > 0) {
topic.setScore(Double.MAX_VALUE);
}
Double socre = ((topic.getDisscussCount() * topicDiscussRate + topic.getViewCount() * topicViewRate)
/ Math.pow(topic.getMinutesTillNow() + 1, topicTimeRate))
+ topic.getThemeWeight() * topicThemeRate;
topic.setScore(socre);
}
}
......@@ -129,26 +129,28 @@ public class RecommendService {
int newTimes = newRatio;
int recTimes = pythonRatio;
String id;
while (hotTimes > 0 && hotThemeIds.size() > hotIdx) {
id = hotThemeIds.get(hotIdx);
while (newTimes > 0 && newThemeIds.size() > newIdx) {
id = newThemeIds.get(newIdx);
if (!set.contains(id)) {
result.add(id);
set.add(id);
}
hotIdx++;
hotTimes--;
newIdx++;
newTimes--;
}
while (newTimes > 0 && newThemeIds.size() > newIdx) {
id = newThemeIds.get(newIdx);
while (hotTimes > 0 && hotThemeIds.size() > hotIdx) {
id = hotThemeIds.get(hotIdx);
if (!set.contains(id)) {
result.add(id);
set.add(id);
}
newIdx++;
newTimes--;
hotIdx++;
hotTimes--;
}
while (recTimes > 0 && recThemeIds.size() > recIdx) {
id = recThemeIds.get(recIdx);
if (!set.contains(id)) {
......@@ -167,19 +169,18 @@ public class RecommendService {
// 按照 6,3,1的比例
private List<String> mergeRecommend(List<String> hotIds, List<String> newestIds, List<String> recmdIds) {
List<String> retList = new ArrayList<>();
int round = 0;
while (true) {
int hotStart = round * 6;
int newestStart = round * 3;
int recmdStart = round;
int newestStart = round * newRatio;
int hotStart = round * hotRatio;
int recmdStart = round * pythonRatio;
if (hotStart >= hotIds.size() && newestStart >= newestIds.size() && recmdStart >= recmdIds.size()) {
break;
}
retList.addAll(BizUtils.subList(hotIds, hotStart, hotStart + 6));
retList.addAll(BizUtils.subList(newestIds, newestStart, newestStart + 3));
retList.addAll(BizUtils.subList(recmdIds, recmdStart, recmdStart + 1));
retList.addAll(BizUtils.subList(newestIds, newestStart, newRatio));
retList.addAll(BizUtils.subList(hotIds, hotStart, hotRatio));
retList.addAll(BizUtils.subList(recmdIds, recmdStart, pythonRatio));
round++;
}
......
......@@ -18,8 +18,12 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
......@@ -72,16 +76,22 @@ public class ThemeService {
.eq(ThemeEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()));
}
//根据id返回主题详情(未删)
public ThemeEntity queryByThemeIdIgnoreDelete(String themeId) {
return themeMapper.selectOne(new LambdaQueryWrapper<ThemeEntity>()
.eq(ThemeEntity::getThemeId, themeId));
}
//根据用户id查询主题list
public List<ThemeEntity> queryThemesByUserId(String userId, String lastId, Integer pageSize) {
public List<ThemeEntity> queryThemesByUserIdCreateDesc(String userId, String lastId, Integer pageSize) {
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.eq(ThemeEntity::getAuthorId, userId)
.eq(ThemeEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode())
.orderByDesc(ThemeEntity::getId);
.orderByDesc(ThemeEntity::getCreateTime);
if (StringUtils.isNotEmpty(lastId)) {
ThemeEntity lastEntity = queryByThemeId(lastId);
if (lastEntity == null) throw new BizException("主题未找到,id:" + lastId);
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getCreateTime());
queryWrapper.lt(ThemeEntity::getCreateTime, lastEntity.getCreateTime());
}
if (pageSize != null) {
queryWrapper.last("limit " + pageSize);
......@@ -100,7 +110,7 @@ public class ThemeService {
if (StringUtils.isNotEmpty(lastId)) {
ThemeEntity lastEntity = queryByThemeId(lastId);
if (lastEntity == null) throw new BizException("主题未找到,id:" + lastId);
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getCreateTime());
queryWrapper.lt(ThemeEntity::getCreateTime, lastEntity.getCreateTime());
}
if (pageSize != null) {
queryWrapper.last("limit " + pageSize);
......@@ -126,67 +136,6 @@ public class ThemeService {
}
/**
* 查询非传入作者的主题(可分页)
*
* @param lastId
* @param pageSize
* @param userId
* @return
*/
public List<ThemeEntity> selectExcludeUser(String userId, String lastId, Integer pageSize) {
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<>();
if (!StringUtils.isEmpty(userId)) {
queryWrapper.ne(ThemeEntity::getAuthorId, userId);
}
if (StringUtils.isNotEmpty(lastId)) {
ThemeEntity lastEntity = queryByThemeId(lastId);
if (lastEntity == null) throw new BizException("主题未找到,id:" + lastId);
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getCreateTime());
}
if (pageSize != null) {
queryWrapper.last("limit " + pageSize);
}
queryWrapper.orderByDesc(ThemeEntity::getId);
queryWrapper.orderByDesc(ThemeEntity::getCreateTime);
queryWrapper.eq(ThemeEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
return themeMapper.selectList(queryWrapper);
}
/**
* 查询非传入作者的主题(可分页)
*
* @param lastId
* @param pageSize
* @param userId
* @return
*/
public List<ThemeEntity> queryByThemeIdsExcludeUser(List<String> themeIds, String userId, String lastId, Integer pageSize) {
if (CollectionUtils.isEmpty(themeIds)) {
return Collections.emptyList();
}
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.in(ThemeEntity::getThemeId, themeIds);
if (!StringUtils.isEmpty(userId)) {
queryWrapper.ne(ThemeEntity::getAuthorId, userId);
}
if (StringUtils.isNotEmpty(lastId)) {
ThemeEntity lastEntity = queryByThemeId(lastId);
if (lastEntity == null) throw new BizException("主题未找到,id:" + lastId);
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getCreateTime());
}
if (pageSize != null) {
queryWrapper.last("limit " + pageSize);
}
queryWrapper.orderByDesc(ThemeEntity::getId);
queryWrapper.orderByDesc(ThemeEntity::getCreateTime);
queryWrapper.eq(ThemeEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
return themeMapper.selectList(queryWrapper);
}
/**
......@@ -230,7 +179,6 @@ public class ThemeService {
if (CollectionUtils.isEmpty(userIds)){
return Collections.emptyList();
}
//TODO 索引优化
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.in(ThemeEntity::getAuthorId, userIds)
.last("limit " + pageStart + ", " + pageSize)
......@@ -280,7 +228,7 @@ public class ThemeService {
* 查询更新节点后的用户新建主题数
*
* @param userIds 用户ids
* @param lastViewTime 更新时间节点
* @param lastId 更新时间节点
* @return
*/
public Integer queryCountFromLastId(List<String> userIds, Long lastId) {
......
......@@ -75,7 +75,10 @@ public class TopicService {
}
public TopicEntity queryById(String topicId) {
return topicMapper.selectOne(new LambdaQueryWrapper<TopicEntity>().eq(TopicEntity::getTopicId, topicId));
return topicMapper.selectOne(new LambdaQueryWrapper<TopicEntity>()
.eq(TopicEntity::getTopicId, topicId)
.eq(TopicEntity::getIsConceal, StatusEnum.FALSE)
.eq(TopicEntity::getDeleteTag, StatusEnum.FALSE));
}
public List<TopicEntity> queryByIds(List<String> topicIds) {
......
......@@ -48,6 +48,7 @@ public class VisitLogService {
.stream().map(VisitLogEntity::getRefId).distinct().collect(Collectors.toList());
return ListUtils.subtract(refIds, visited);
}
public List<String> queryUserVisited(String userId) {
List<String> visited = visitLogMapper.selectList(new LambdaQueryWrapper<VisitLogEntity>()
.eq(VisitLogEntity::getVisitorId, userId))
......@@ -58,7 +59,7 @@ public class VisitLogService {
@Transactional
public void insertOrUpdateDur(VisitLogEntity vs) {
if (visitLogMapper.selectByIdentAndRefId(vs.getIdent(), vs.getRefId()) == null) {
if (visitLogMapper.selectByIdentAndRefId(vs.getIdent(), vs.getRefId(), vs.getRefType()) == null) {
visitLogMapper.insert(vs);
} else {
visitLogMapper.updateDurByIdent(vs.getDuration(), vs.getIdent());
......@@ -92,7 +93,7 @@ public class VisitLogService {
// 查询主题 浏览量
public Integer queryThemeVisit(List<String> themes) {
if (CollectionUtils.isEmpty(themes)){
if (CollectionUtils.isEmpty(themes)) {
return 0;
}
return visitLogMapper.selectCount(new LambdaQueryWrapper<VisitLogEntity>()
......@@ -114,11 +115,11 @@ public class VisitLogService {
//统计行为集合的浏览量
public Map<String, Integer> getCountMapByTargetIds(List<String> refIds, String refType) {
if (CollectionUtils.isEmpty(refIds)){
if (CollectionUtils.isEmpty(refIds)) {
return new HashMap<>();
}
LambdaQueryWrapper<VisitLogEntity> wrapper = (new LambdaQueryWrapper<VisitLogEntity>()
.in(VisitLogEntity::getRefId,refIds))
.in(VisitLogEntity::getRefId, refIds))
.eq(VisitLogEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED)
.eq(VisitLogEntity::getRefType, refType)
.groupBy(VisitLogEntity::getRefId);
......
......@@ -47,7 +47,7 @@ public class ConvertUtil {
}
ThemeAnalysDO themeAnalysDO = new ThemeAnalysDO();
BeanUtils.copyProperties(themeEntity, themeAnalysDO);
themeAnalysDO.setMinuteTillNow(TimeUtils.calMinuteTillNow(themeEntity.getCreateTime()));
themeAnalysDO.setMinutesTillNow(TimeUtils.calMinuteTillNow(themeEntity.getCreateTime()));
return themeAnalysDO;
}
......@@ -64,7 +64,8 @@ public class ConvertUtil {
BeanUtils.copyProperties(entity, qo);
// 抽取文本内容
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(entity.getContent(), new TypeReference<List<ThemeContentQo>>() {});
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(entity.getContent(), new TypeReference<List<ThemeContentQo>>() {
});
StringBuilder sb = new StringBuilder();
themeContentQos.stream().filter(q -> RelTypeEnum.TEXT.type.equals(q.getType())).forEach(q -> {
sb.append(q.getValue());
......@@ -88,15 +89,15 @@ public class ConvertUtil {
TopicRankQo topicRankQo = new TopicRankQo();
BeanUtils.copyProperties(topicEntity, topicRankQo);
//2小时内发帖,添加新话题标签
if(TimeUtils.calMinuteTillNow(topicEntity.getCreateTime())<120){
if (TimeUtils.calMinuteTillNow(topicEntity.getCreateTime()) < 120) {
topicRankQo.setType(TopicStatusEnum.NEWEST.getCode());
}
topicRankQo.setHoursTillNow((int) TimeUtils.calHoursTillNow(topicEntity.getCreateTime()));
topicRankQo.setMinutesTillNow((int) TimeUtils.calMinuteTillNow(topicEntity.getCreateTime()));
return topicRankQo;
}
public static List<TopicRankQo> topicEntityToHotQos(List<TopicEntity> topicEntities) {
if (topicEntities==null){
if (topicEntities == null) {
return Collections.emptyList();
}
return topicEntities.stream().map(ConvertUtil::topicEntityToHotQo).collect(Collectors.toList());
......@@ -153,13 +154,13 @@ public class ConvertUtil {
.build());
}
} else if ((content.getType().equals(RelTypeEnum.SINGLE_IMG.type))) {
if (StringUtils.isEmpty(content.getValue())){
if (StringUtils.isEmpty(content.getValue())) {
list.add(ThemeAttachmentEntity.builder()
.attachType(Integer.valueOf(content.getType()))
.attachId(content.getValue())
.themeId(themeId)
.build());
}else {
} else {
List<ImagesDTO> imgList = content.getImgList();
for (ImagesDTO imagesDTO : imgList) {
list.add(ThemeAttachmentEntity.builder()
......@@ -211,9 +212,9 @@ public class ConvertUtil {
.build();
}
public static FileUploadResp fileRecordEntity2Resp(FileRecordEntity entity){
public static FileUploadResp fileRecordEntity2Resp(FileRecordEntity entity) {
FileUploadResp resp = new FileUploadResp();
BeanUtils.copyProperties(entity,resp);
BeanUtils.copyProperties(entity, resp);
String extInfo = entity.getExtInfo();
if (!StringUtils.isEmpty(extInfo)) {
Map<String, Object> extMap = JsonUtil.toMap(extInfo);
......@@ -224,5 +225,4 @@ public class ConvertUtil {
}
}
......@@ -12,12 +12,14 @@ import java.util.List;
* @email: zhoupeng@wealthgrow.cn
*/
public class PageUtils {
public static <T> Page<T> page(Pageable pageable, List<T> list) {
if (CollectionUtils.isEmpty(list)) {
if(pageable==null){
return new Page<T>(1,0, (long)list.size(),1, list);
}
return new Page<>(pageable, 0L, new ArrayList<>());
return new Page<T>(pageable, 0L, new ArrayList<>());
} else {
if(pageable==null){
return new Page<T>(1,list.size(), (long)list.size(),1, list);
......@@ -64,4 +66,8 @@ public class PageUtils {
}
}
}
public static <T> Page<T> page(Page<String> o, List<T> list) {
return new Page<>(o.getPageNum(),o.getPageSize(),o.getTotalSize(),o.getTotalPages(),list);
}
}
......@@ -11,7 +11,7 @@ public class RankUtils {
/**
* 根据id排序主题对象
* 根据id排序主题对象(同时去重)
* @param list 主题
* @param ids 主题Id,list中可重复
* @return
......
......@@ -37,6 +37,11 @@ public class TimeUtils {
return start.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
}
//格式化时间
public static String format(LocalDateTime start) {
return start.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
}
//计算迄今分钟
public static long calMinuteTillNow(LocalDateTime start) {
Duration between = Duration.between(start, LocalDateTime.now());
......@@ -55,7 +60,7 @@ public class TimeUtils {
return between.toDays();
}
//计算迄今
//计算迄今小时
public static long calHoursTillNow(LocalDateTime start) {
Duration between = Duration.between(start, LocalDateTime.now());
return between.toHours();
......
......@@ -14,19 +14,19 @@ server:
spring.datasource:
community:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_community?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
username: tamp_admin
password: '@imeng123'
maxActive: 2
minIdle: 2
initialSize: 2
user:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_user?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
password: '@imeng123'
jdbc-url: jdbc:mysql://rm-uf6lqwk9969zao53uro.mysql.rds.aliyuncs.com:3306/tamp_community?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
username: dev
password: 'qimeng123'
maxActive: 2
minIdle: 2
initialSize: 2
# user:
# driver-class-name: com.mysql.cj.jdbc.Driver
# jdbc-url: jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_user?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
# password: '@imeng123'
# maxActive: 2
# minIdle: 2
# initialSize: 2
spring.redis:
host: 118.190.63.109
......@@ -64,8 +64,11 @@ spring.kafka:
spring:
sleuth:
enabled: false
sampler.probability: 1.0
zipkin:
enabled: false
base-url: http://tracing-analysis-dc-sh.aliyuncs.com/adapt_f582gdhpd0@141b989b3abcccb_f582gdhpd0@53df7ad2afe8301_prod
sender.type: web
aliyun:
oss:
......@@ -95,3 +98,19 @@ recommend:
python:
enable: false
url: http://172.168.0.164:9000/api/get_recommend?user_id=2431614397151511
rank:
theme:
viewRate: 0.1
forwardRate: 3
commentRate: 2
likeRaten: 1
collectRate: 3
userWeightRate: 0.9
initialWeight: 1.0
timeRate: 0.2
topic:
viewRate: 2
discussRate: 3
themeRate: 3
timeRate: 1
......@@ -15,7 +15,7 @@ server:
spring.datasource:
community:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://rm-uf6r22t3d798q4kmk.mysql.rds.aliyuncs.com:3306/tamp_community?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
jdbc-url: jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_community?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
username: tamp_admin
password: '@imeng123'
maxActive: 2
......@@ -23,7 +23,8 @@ spring.datasource:
initialSize: 2
user:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://rm-uf6r22t3d798q4kmk.mysql.rds.aliyuncs.com:3306/tamp_user?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
jdbc-url: jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_user?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
username: tamp_admin
password: '@imeng123'
maxActive: 2
minIdle: 2
......@@ -80,6 +81,7 @@ es:
port: 9200
userName: 1
userPasswd: 2
index: test
tencent:
cloud:
......
......@@ -2,83 +2,87 @@
CREATE TABLE `black_list` (
`id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'id',
`blocker` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '屏蔽发起人',
`blocker` varchar(64) NOT NULL COMMENT '屏蔽发起人',
`blocked_type` int(4) NOT NULL COMMENT '屏蔽类型,1:用户,2:内容',
`blocked_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '被屏蔽的',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
`blocked_id` varchar(64) NOT NULL COMMENT '被屏蔽的',
`create_by` varchar(64) DEFAULT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `uk_blocker` (`blocker`),
KEY `uk_blocked` (`blocked_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='黑名单';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='黑名单';
-- tamp_community.collection definition
CREATE TABLE `collection` (
`id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id',
`id` varchar(64) NOT NULL COMMENT 'id',
`collection_type` int(4) NOT NULL COMMENT '类型 1:点赞主题,2:收藏主题 3、点赞评论',
`user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户id',
`target_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '目标id',
`user_id` varchar(64) NOT NULL COMMENT '用户id',
`target_id` varchar(64) NOT NULL COMMENT '目标id',
`collection_time` datetime DEFAULT NULL COMMENT '收藏时间',
`uncollection_time` datetime DEFAULT NULL COMMENT '取消收藏时间',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_author` (`user_id`),
KEY `idx_target` (`target_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='收藏/点赞';
KEY `idx_target_id_and_type` (`target_id`,`collection_time`) USING BTREE,
KEY `idx_create_time` (`create_time`) USING BTREE,
KEY `idx_user_type` (`user_id`,`collection_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='收藏/点赞';
-- tamp_community.comment definition
CREATE TABLE `comment` (
`id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'id',
`comment_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评论主键Id',
`comment_id` varchar(64) NOT NULL COMMENT '评论主键Id',
`comment_type` int(4) NOT NULL COMMENT '类型 1:评论',
`content` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文本内容',
`author_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者id',
`theme_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '主题id',
`parent_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '一级评论id',
`reply_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '回复评论id',
`review_status` int(4) NOT NULL DEFAULT '0' COMMENT '是否通过 0:初始值 1:已通过(管理后台使用)',
`content` varchar(1024) NOT NULL DEFAULT '' COMMENT '文本内容',
`author_id` varchar(64) NOT NULL COMMENT '作者id',
`theme_id` varchar(64) NOT NULL COMMENT '主题id',
`parent_id` varchar(64) NOT NULL DEFAULT '' COMMENT '一级评论id',
`reply_id` varchar(64) NOT NULL DEFAULT '' COMMENT '回复评论id',
`review_status` int(4) NOT NULL DEFAULT '0' COMMENT '审核状态 0:初始值 1:已通过(管理后台使用)',
`report_status` int(4) NOT NULL DEFAULT '0' COMMENT '举报状态 0:未被举报 1:被举报 2:已处理',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_author` (`author_id`),
KEY `idx_target` (`reply_id`)
) ENGINE=InnoDB AUTO_INCREMENT=134 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='评论';
UNIQUE KEY `uk_comment` (`comment_id`) USING BTREE,
KEY `idx_author` (`author_id`) USING BTREE,
KEY `idx_target` (`reply_id`) USING BTREE,
KEY `idx_theme` (`theme_id`)
) ENGINE=InnoDB AUTO_INCREMENT=153 DEFAULT CHARSET=utf8mb4 COMMENT='评论';
-- tamp_community.file_record definition
CREATE TABLE `file_record` (
`id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'id',
`file_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件主键Id',
`file_id` varchar(64) NOT NULL COMMENT '文件主键Id',
`file_type` int(4) NOT NULL COMMENT '类型:1:图片',
`file_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件名称',
`file_oss_key` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '阿里云key',
`preview_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '预签名预览url',
`file_name` varchar(64) NOT NULL COMMENT '文件名称',
`file_oss_key` varchar(64) NOT NULL COMMENT '阿里云key',
`preview_url` varchar(512) NOT NULL DEFAULT '' COMMENT '预签名预览url',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
`ext_info` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`ext_info` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_logic` (`file_oss_key`)
) ENGINE=InnoDB AUTO_INCREMENT=168 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='上传文件';
UNIQUE KEY `uk_logic` (`file_oss_key`) USING BTREE,
KEY `idx_file` (`file_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='上传文件';
-- tamp_community.follow_rel definition
CREATE TABLE `follow_rel` (
`id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'id',
`idol_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '被关注的人id',
`fans_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '粉丝id',
`idol_id` varchar(64) NOT NULL COMMENT '被关注的人id',
`fans_id` varchar(64) NOT NULL COMMENT '粉丝id',
`follow_time` datetime DEFAULT NULL COMMENT '关注时间',
`unfollow_time` datetime DEFAULT NULL COMMENT '取消关注时间',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
......@@ -87,98 +91,98 @@ CREATE TABLE `follow_rel` (
PRIMARY KEY (`id`),
UNIQUE KEY `uk_idol_follower` (`idol_id`,`fans_id`),
KEY `idx_follower` (`fans_id`)
) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='粉丝关系';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='粉丝关系';
-- tamp_community.home_page definition
-- tamp_community.rank_log definition
CREATE TABLE `home_page` (
CREATE TABLE `rank_log` (
`id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'id',
`user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户id',
`head_img` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '头像url',
`nick_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '昵称',
`introduction` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '个人简介',
`sex` int(3) DEFAULT NULL COMMENT '性别',
`location` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '地址',
`type` int(4) NOT NULL COMMENT '1:话题 2:主题',
`total_count` int(11) NOT NULL COMMENT '总排序数量',
`page_number` int(11) NOT NULL COMMENT '页码',
`page_size` int(11) NOT NULL COMMENT '页面大小',
`content` text COMMENT '排序内容',
`rank_cost` bigint(20) NOT NULL DEFAULT '0' COMMENT '花费间隔,单位毫秒',
`rank_time` datetime DEFAULT NULL COMMENT '排序时间',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_userId` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='个人主页';
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='话题排序日志记录’';
-- tamp_community.report_log definition
CREATE TABLE `report_log` (
`id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'id',
`user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '举报发起人',
`user_id` varchar(64) NOT NULL COMMENT '举报发起人',
`report_type` int(4) NOT NULL COMMENT '举报类型,1:主题,2:评论 3、用户',
`target_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '举报对象id',
`target_user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '举报对象作者id',
`report_reason` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`report_time` datetime NOT NULL COMMENT '上报时间',
`deal_result` int(4) DEFAULT NULL COMMENT '处理结果 0:无操作 1:屏蔽 2:删除 ',
`deal_user_id` int(4) DEFAULT NULL COMMENT '处理管理员',
`deal_time` datetime DEFAULT NULL COMMENT '处理时间',
`target_id` varchar(64) NOT NULL COMMENT '举报对象id',
`target_user_id` varchar(64) NOT NULL COMMENT '举报对象作者id',
`report_reason` varchar(64) NOT NULL DEFAULT '' COMMENT '举报理由',
`report_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '上报时间',
`review_result` int(4) DEFAULT NULL COMMENT '处理结果 0:无操作 1:屏蔽 2:删除 ',
`review_user_id` varchar(64) NOT NULL DEFAULT '' COMMENT '处理管理员',
`review_time` datetime DEFAULT NULL COMMENT '处理时间',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `uk_user` (`user_id`),
KEY `uk_report_target_id` (`target_id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='举报记录';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='举报记录';
-- tamp_community.theme definition
CREATE TABLE `theme` (
`id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'id',
`theme_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主题主键Id',
`title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '标题',
`theme_id` varchar(64) NOT NULL COMMENT '主题主键Id',
`title` varchar(128) NOT NULL DEFAULT '' COMMENT '标题',
`theme_type` int(4) NOT NULL COMMENT '类型 1:讨论无标题 2:长文有标题 3:转发',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '文本内容(json),type:附件类型(108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,304: 新版课程-音频,109:单图(长文) 110:多图(讨论)),productType:基金类型(0 公募,1 私募,2 白名单,3 私有)',
`discuss_content` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '讨论中的文本',
`author_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者id',
`former_theme_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '转发的主题',
`topic_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属的话题',
`review_status` int(4) NOT NULL DEFAULT '0' COMMENT '是否通过 0:初始值 1:已通过(管理后台使用)',
`content` longtext COMMENT '文本内容(json),type:附件类型(108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,304: 新版课程-音频,109:单图(长文) 110:多图(讨论)),productType:基金类型(0 公募,1 私募,2 白名单,3 私有)',
`author_id` varchar(64) NOT NULL COMMENT '作者id',
`former_theme_id` varchar(64) DEFAULT NULL COMMENT '转发的主题',
`topic_id` varchar(64) DEFAULT NULL COMMENT '所属的话题',
`review_status` int(4) NOT NULL DEFAULT '0' COMMENT '审核状态 0:未审核 1:审核通过(管理后台使用)',
`report_status` int(4) NOT NULL DEFAULT '0' COMMENT '举报状态 0:未被举报 1:被举报 2:已处理',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0' COMMENT '1:删除',
PRIMARY KEY (`id`),
KEY `idx_thmee_id` (`theme_id`),
KEY `idx_author` (`author_id`),
KEY `idx_former` (`former_theme_id`),
KEY `idx_topic` (`topic_id`)
) ENGINE=InnoDB AUTO_INCREMENT=326 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='主题内容';
KEY `idx_create_time` (`create_time`) USING BTREE,
KEY `idx_topic_id_create_time` (`topic_id`,`create_time`) USING BTREE,
KEY `idx_theme_id_createTime` (`theme_id`,`create_time`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='主题内容';
-- tamp_community.theme_attachment definition
CREATE TABLE `theme_attachment` (
`id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id',
`theme_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主题ID',
`attach_type` int(4) NOT NULL COMMENT '附件类型:1:产品 2:直播 3:短视频 4:课程 5图片',
`attach_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '附件对应的ID',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
`id` varchar(64) NOT NULL COMMENT 'id',
`theme_id` varchar(64) NOT NULL COMMENT '主题ID',
`attach_type` int(4) NOT NULL COMMENT '附件类型:108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,304: 新版课程-音频,109:单图(长文) 110:多图(讨论))',
`attach_id` varchar(64) NOT NULL COMMENT '附件对应的ID',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
`ext_info` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`ext_info` varchar(128) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `theme_id` (`theme_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='主题附件';
KEY `theme_id` (`theme_id`) USING BTREE,
KEY `uk_attach_type` (`attach_id`,`attach_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='主题附件';
-- tamp_community.topic definition
CREATE TABLE `topic` (
`id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'id',
`topic_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '话题主键Id',
`topic_title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '话题名称',
`topic_id` varchar(64) NOT NULL COMMENT '话题主键Id',
`topic_title` varchar(64) NOT NULL COMMENT '话题名称',
`is_top` int(4) NOT NULL DEFAULT '0' COMMENT '是否置顶',
`is_conceal` int(4) NOT NULL DEFAULT '0' COMMENT '是否隐藏',
`view_cnt_adjust` int(11) NOT NULL DEFAULT '0' COMMENT '浏览量调整基数',
......@@ -186,73 +190,57 @@ CREATE TABLE `topic` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_title` (`topic_title`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='话题';
-- tamp_community.topic_rank_log definition
CREATE TABLE `topic_rank_log` (
`id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT 'id',
`total_count` int(11) NOT NULL COMMENT '总排序数量',
`page_number` int(11) NOT NULL COMMENT '页码',
`page_size` int(11) NOT NULL COMMENT '页面大小',
`content` text COMMENT '排序内容',
`rank_cost` bigint(20) DEFAULT NULL COMMENT '花费时间',
`rank_time` datetime DEFAULT NULL COMMENT '排序时间',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='话题排序日志记录’';
UNIQUE KEY `uk_title` (`topic_title`),
UNIQUE KEY `uk_topicId` (`topic_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='话题';
-- tamp_community.user_visit_statistics definition
CREATE TABLE `user_visit_statistics` (
`id` bigint(32) unsigned NOT NULL AUTO_INCREMENT,
`visitor_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`ref_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`visitor_id` varchar(64) DEFAULT NULL,
`ref_id` varchar(64) DEFAULT NULL,
`ref_type` int(8) DEFAULT NULL,
`total_duration` bigint(20) DEFAULT NULL,
`first_visit_time` datetime DEFAULT NULL,
`last_visit_time` datetime DEFAULT NULL,
`total_visit` int(16) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- tamp_community.visit_log definition
CREATE TABLE `visit_log` (
`id` bigint(32) NOT NULL COMMENT 'id',
`ident` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'session_id',
`visitor_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '浏览者id',
`author_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '作者id',
`ref_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '关联目标ID',
`ref_type` int(8) NOT NULL COMMENT '关联目标类型 1:进入话题页 2:进入主题正文 3、用户查看首页-关注',
`duration` int(16) DEFAULT NULL COMMENT '浏览时间 单位秒',
`ident` varchar(64) NOT NULL DEFAULT '' COMMENT 'session_id',
`visitor_id` varchar(64) NOT NULL DEFAULT '' COMMENT '浏览者id',
`author_id` varchar(64) NOT NULL DEFAULT '' COMMENT '作者id',
`ref_id` varchar(64) NOT NULL DEFAULT '' COMMENT '关联目标ID',
`ref_type` varchar(16) NOT NULL DEFAULT '' COMMENT '关联目标类型 :p13508:进入话题页 p13503:进入主题正文 3、用户查看首页-关注',
`duration` int(16) NOT NULL DEFAULT '0' COMMENT '浏览时间 单位秒',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`delete_tag` int(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_session` (`ident`),
KEY `idx_ref` (`ref_id`),
KEY `idx_visitor` (`visitor_id`),
KEY `idx_author` (`author_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='浏览记录';
KEY `idx_session` (`ident`) USING BTREE,
KEY `idx_visitor` (`visitor_id`) USING BTREE,
KEY `idx_author` (`author_id`) USING BTREE,
KEY `idx_ref_id_and_type` (`ref_id`,`ref_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='浏览记录';
-- tamp_community.worker_node definition
CREATE TABLE `worker_node` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'auto increment id',
`host_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'host name',
`port` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'port',
`type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'node type: realhost or container',
`host_name` varchar(64) NOT NULL COMMENT 'host name',
`port` varchar(64) NOT NULL COMMENT 'port',
`type` varchar(32) NOT NULL COMMENT 'node type: realhost or container',
`launch_date` date NOT NULL COMMENT 'launch date',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'created time',
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'modified time',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_host_name_port` (`host_name`,`port`)
) ENGINE=InnoDB AUTO_INCREMENT=2117 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='分布式唯一ID生成,DB WorkerID Assigner for UID Generator';
\ No newline at end of file
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='分布式唯一ID生成,DB WorkerID Assigner for UID Generator';
\ No newline at end of file
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