Commit f1e0cc67 authored by 张辰's avatar 张辰

Merge branch 'dev' of http://47.100.44.39:10001/tp-backend/tanpu-community into dev

# Conflicts:
#	community-service/src/main/java/com/tanpu/community/dao/entity/community/CommentEntity.java
#	community-service/src/main/java/com/tanpu/community/dao/entity/community/ReportLogEntity.java
#	community-service/src/main/java/com/tanpu/community/dao/entity/community/ThemeEntity.java
#	community-service/src/main/java/com/tanpu/community/dao/mapper/community/CommentMapper.java
#	community-service/src/main/java/com/tanpu/community/dao/mapper/community/ReportLogMapper.java
#	community-service/src/main/java/com/tanpu/community/dao/mapper/community/ThemeMapper.java
parents 4d981269 882a4927
...@@ -40,4 +40,16 @@ public class CommentQo { ...@@ -40,4 +40,16 @@ public class CommentQo {
@ApiModelProperty(value = "2级评论") @ApiModelProperty(value = "2级评论")
private List<CommentLv2Qo> commentLv2Qos; private List<CommentLv2Qo> commentLv2Qos;
//认证标签相关
@ApiModelProperty("认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾")
private Integer levelGrade;
@ApiModelProperty("认证标签用-当levelGrade=10有值 1投资萌新 2投资达人")
private String userInvestorType;
@ApiModelProperty("认证标签用-用户类型 1普通账号 2机构账号 3机构人员")
private Integer userType;
@ApiModelProperty("认证标签用-所属机构id")
private String belongUserOrgId;
@ApiModelProperty("认证标签用-所属机构名")
private String belongUserOrgName;
} }
...@@ -29,4 +29,16 @@ public class FollowQo { ...@@ -29,4 +29,16 @@ public class FollowQo {
@ApiModelProperty(value = "是否关注") @ApiModelProperty(value = "是否关注")
private boolean followed; private boolean followed;
//认证标签相关
@ApiModelProperty("认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾")
private Integer levelGrade;
@ApiModelProperty("认证标签用-当levelGrade=10有值 1投资萌新 2投资达人")
private String userInvestorType;
@ApiModelProperty("认证标签用-用户类型 1普通账号 2机构账号 3机构人员")
private Integer userType;
@ApiModelProperty("认证标签用-所属机构id")
private String belongUserOrgId;
@ApiModelProperty("认证标签用-所属机构名")
private String belongUserOrgName;
} }
...@@ -46,11 +46,12 @@ public class ThemeAnalysDO { ...@@ -46,11 +46,12 @@ public class ThemeAnalysDO {
@ApiModelProperty(value = "距今时间") @ApiModelProperty(value = "距今时间")
private Long minuteTillNow; private Long minuteTillNow;
public Double getRank(){ public Double getScore() {
double p = (double) (viewCount + forwardCount + commentCount + likeCount + collectCount); double w = (double) (viewCount + forwardCount + commentCount + likeCount + collectCount);
double t = Double.valueOf(minuteTillNow); double i = 10;//初试权重
double g =1.8; double t = Double.valueOf(minuteTillNow) / 60;
double rank=(p)/Math.pow(t+2,g); double g = 1.2;//时间系数
double rank = (w + i) / Math.pow(t + 2, g);
return rank; return rank;
} }
......
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class ThemeContentQo { public class ThemeContentQo {
@ApiModelProperty(value = "RelTypeEnum类型,108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,新版课程-音频,109:单图(长文) 110:多图(讨论)") @ApiModelProperty(value = "RelTypeEnum类型,108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,304: 新版课程-音频,109:单图(长文) 110:多图(讨论)")
private String type; private String type;
@ApiModelProperty(value = "文本的值是内容,附件的值为id") @ApiModelProperty(value = "文本的值是内容,附件的值为id")
......
...@@ -57,8 +57,7 @@ public class ThemeQo implements Serializable { ...@@ -57,8 +57,7 @@ public class ThemeQo implements Serializable {
@ApiModelProperty(value = "当前用户是否关注该作者") @ApiModelProperty(value = "当前用户是否关注该作者")
public boolean follow; public boolean follow;
@ApiModelProperty(value = "作者认证")
private Integer authLabel;
@ApiModelProperty(value = "认证机构") @ApiModelProperty(value = "认证机构")
private String authOrg; private String authOrg;
...@@ -97,4 +96,24 @@ public class ThemeQo implements Serializable { ...@@ -97,4 +96,24 @@ public class ThemeQo implements Serializable {
public Long updateTime; public Long updateTime;
//认证标签相关
@ApiModelProperty("认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾")
private Integer levelGrade;
@ApiModelProperty("认证标签用-当levelGrade=10有值 1投资萌新 2投资达人")
private String userInvestorType;
@ApiModelProperty("认证标签用-用户类型 1普通账号 2机构账号 3机构人员")
private Integer userType;
@ApiModelProperty("认证标签用-所属机构id")
private String belongUserOrgId;
@ApiModelProperty("认证标签用-所属机构名")
private String belongUserOrgName;
//工作室相关
@ApiModelProperty("工作室展示状态 1不展示 2展示(未认证) 3展示(已认证)")
private Integer workshopStatus = 1;//工作室展示状态
@ApiModelProperty("工作室名")
private String workshopName;//工作室名
@ApiModelProperty("工作室简介")
private String workshopIntroduction;//工作室简介
} }
...@@ -6,7 +6,7 @@ import lombok.Data; ...@@ -6,7 +6,7 @@ import lombok.Data;
@Data @Data
@ApiModel("热点话题对象") @ApiModel("热点话题对象")
public class TopicHotQo { public class TopicRankQo {
@ApiModelProperty(value = "话题ID") @ApiModelProperty(value = "话题ID")
private String topicId; private String topicId;
......
...@@ -14,7 +14,7 @@ public class CreateThemeReq { ...@@ -14,7 +14,7 @@ public class CreateThemeReq {
@NotNull(message = "类型不能为空") @NotNull(message = "类型不能为空")
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发") @ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题")
private Integer themeType; private Integer themeType;
......
...@@ -22,8 +22,6 @@ public class UserInfoNew implements Serializable { ...@@ -22,8 +22,6 @@ public class UserInfoNew implements Serializable {
@ApiModelProperty("主页等级 1普通主页 2首席投顾主页 3机构主页") @ApiModelProperty("主页等级 1普通主页 2首席投顾主页 3机构主页")
private Integer personalCenterType; private Integer personalCenterType;
@ApiModelProperty("是否显示关注按钮 0不显示 1显示")
private Integer isShowFollowButton;
@ApiModelProperty("关注按钮状态 0未关注 1已关注") @ApiModelProperty("关注按钮状态 0未关注 1已关注")
private Integer showFollowStatus; private Integer showFollowStatus;
...@@ -62,8 +60,10 @@ public class UserInfoNew implements Serializable { ...@@ -62,8 +60,10 @@ public class UserInfoNew implements Serializable {
private Integer levelGrade; private Integer levelGrade;
@ApiModelProperty("当levelGrade=10有值 1投资萌新 2投资达人") @ApiModelProperty("当levelGrade=10有值 1投资萌新 2投资达人")
private String userInvestorType; private String userInvestorType;
@ApiModelProperty("用户类型 1普通账号 2机构账号 3机构人员") @ApiModelProperty("用户类型 1普通个人 2机构账号 3机构人员")
private Integer userType; private Integer userType;
@ApiModelProperty("是否为投顾 0不是 1是(user_type=3时有意义)")
private Integer isUserFinancialPractitioner;
@ApiModelProperty("专家投顾 认证信息") @ApiModelProperty("专家投顾 认证信息")
private String certInfo; private String certInfo;
...@@ -71,14 +71,14 @@ public class UserInfoNew implements Serializable { ...@@ -71,14 +71,14 @@ public class UserInfoNew implements Serializable {
// 机构人员 // 机构人员
@ApiModelProperty("认证职位") @ApiModelProperty("认证职位")
private String certPosition; private String certPosition;
@ApiModelProperty("名片是否已通过上传(是否展示工作室入口) 0不通过 1通过")
private Integer ocrStatus;
@ApiModelProperty("所属机构id") @ApiModelProperty("所属机构id")
private String belongUserOrgId; private String belongUserOrgId;
@ApiModelProperty("所属机构名") @ApiModelProperty("所属机构名")
private String belongUserOrgName; private String belongUserOrgName;
//工作室相关 //工作室相关
@ApiModelProperty("工作室展示状态 1不展示 2展示(未认证) 3展示(已认证)")
private Integer workshopStatus = 1;//工作室展示状态
@ApiModelProperty("工作室名") @ApiModelProperty("工作室名")
private String workshopName;//工作室名 private String workshopName;//工作室名
@ApiModelProperty("工作室简介") @ApiModelProperty("工作室简介")
......
...@@ -76,7 +76,7 @@ public enum RelTypeEnum { ...@@ -76,7 +76,7 @@ public enum RelTypeEnum {
/** /**
* 新版课程 * 新版课程
*/ */
NEW_COURSE_SECTION_VIDEO(304, "新版课程 - 小节 - 视频", 303), NEW_COURSE_SECTION_VIDEO(304, "新版课程 - 小节 - 视频", 304),
/** /**
* 新版课程附件 * 新版课程附件
......
...@@ -167,6 +167,13 @@ ...@@ -167,6 +167,13 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!--腾讯云内容校验-->
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java</artifactId>
<version>4.0.11</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -40,16 +40,16 @@ public class HomePageController { ...@@ -40,16 +40,16 @@ public class HomePageController {
@ApiOperation(value = "个人中心 查询") @ApiOperation(value = "个人中心 查询")
@GetMapping(value = "/queryUserInfoNew") @GetMapping(value = "/queryUserInfoNew")
@AuthLogin @AuthLogin
public CommonResp<UserInfoNew> queryUsersListNew(@RequestParam("userId") String userId){ public CommonResp<UserInfoNew> queryUsersListNew(@RequestParam(value = "userId", required = false) String userId) {
String userIdMyself = userHolder.getUserId(); String userIdMyself = userHolder.getUserId();
return CommonResp.success(homePageManager.queryUsersListNew(userIdMyself,userId)); return CommonResp.success(homePageManager.queryUsersListNew(userIdMyself, userId));
} }
// 理财师客户列表查询 (供圈子服务调用) // 理财师客户列表查询 (供圈子服务调用)
@ApiOperation(value = "个人中心 理财师客户列表查询") @ApiOperation(value = "个人中心 理财师客户列表查询")
@GetMapping(value = "/queryUserCustomerList") @GetMapping(value = "/queryUserCustomerList")
@AuthLogin @AuthLogin
public CommonResp<List<Customer>> queryUserCustomerList(){ public CommonResp<List<Customer>> queryUserCustomerList() {
String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryUserCustomerList(userId)); return CommonResp.success(homePageManager.queryUserCustomerList(userId));
} }
...@@ -61,7 +61,7 @@ public class HomePageController { ...@@ -61,7 +61,7 @@ public class HomePageController {
@AuthLogin @AuthLogin
public CommonResp<Page<FollowQo>> queryFollowList(@RequestBody QueryFollowReq req) { public CommonResp<Page<FollowQo>> queryFollowList(@RequestBody QueryFollowReq req) {
String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryFollow(req,userId)); return CommonResp.success(homePageManager.queryFollow(req, userId));
} }
@PostMapping(value = "/addIdol") @PostMapping(value = "/addIdol")
...@@ -69,7 +69,7 @@ public class HomePageController { ...@@ -69,7 +69,7 @@ public class HomePageController {
@ResponseBody @ResponseBody
public CommonResp addIdol(@RequestBody FollowRelReq req) { public CommonResp addIdol(@RequestBody FollowRelReq req) {
String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
homePageManager.addFollowRel(req,userId); homePageManager.addFollowRel(req, userId);
return CommonResp.success(); return CommonResp.success();
} }
...@@ -77,9 +77,9 @@ public class HomePageController { ...@@ -77,9 +77,9 @@ public class HomePageController {
@ApiOperation("用户的帖子列表") @ApiOperation("用户的帖子列表")
@ResponseBody @ResponseBody
@AuthLogin @AuthLogin
public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req){ public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req) {
String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
return CommonResp.success(themeManager.queryThemesByUser(req,userId)); return CommonResp.success(themeManager.queryThemesByUser(req, userId));
} }
} }
...@@ -34,13 +34,12 @@ public class ThemeController { ...@@ -34,13 +34,12 @@ public class ThemeController {
@PostMapping(value = "/publish") @PostMapping(value = "/publish")
@ResponseBody @ResponseBody
public CommonResp<CreateThemeResp> publishTheme(@Validated @RequestBody CreateThemeReq req) { public CommonResp<CreateThemeResp> publishTheme(@Validated @RequestBody CreateThemeReq req) {
// String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
String userId = "4444";
return CommonResp.success(themeManager.publishTheme(req, userId)); return CommonResp.success(themeManager.publishTheme(req, userId));
} }
@AuthLogin @AuthLogin
@ApiOperation("圈子首页-推荐/关注/热门/最新") @ApiOperation("主题列表-推荐/关注/热门/最新")
@PostMapping(value = "/list") @PostMapping(value = "/list")
@ResponseBody @ResponseBody
public CommonResp<List<ThemeQo>> selectInterestList(@Validated @RequestBody ThemeListReq req) { public CommonResp<List<ThemeQo>> selectInterestList(@Validated @RequestBody ThemeListReq req) {
......
...@@ -2,9 +2,7 @@ package com.tanpu.community.controller; ...@@ -2,9 +2,7 @@ package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.UserHolder; import com.tanpu.common.auth.UserHolder;
import com.tanpu.community.api.beans.qo.TopicDetailQo; import com.tanpu.community.api.beans.qo.TopicRankQo;
import com.tanpu.community.api.beans.qo.TopicHotQo;
import com.tanpu.community.api.beans.qo.TopicTitileQo;
import com.tanpu.community.api.beans.req.page.Page; import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.req.topic.TopicSearchReq; import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
import com.tanpu.community.manager.TopicManager; import com.tanpu.community.manager.TopicManager;
...@@ -30,25 +28,23 @@ public class TopicController { ...@@ -30,25 +28,23 @@ public class TopicController {
@PostMapping(value = "/list") @PostMapping(value = "/list")
@ApiOperation("APP全部话题页面,可搜索") @ApiOperation("APP全部话题页面,可搜索")
@ResponseBody @ResponseBody
public CommonResp<Page<TopicTitileQo>> getTopicBriefInfoList(@RequestBody TopicSearchReq req){ public CommonResp<Page<TopicRankQo>> getTopicBriefInfoList(@RequestBody TopicSearchReq req){
Page<TopicTitileQo> allTopic = topicManager.getAllTopicBriefInfo(req); return CommonResp.success(topicManager.getAllTopicBriefInfo(req));
return CommonResp.success(allTopic);
} }
@GetMapping(value = "/detailPage") @GetMapping(value = "/detailPage")
@ApiOperation("话题详情页顶部") @ApiOperation("话题详情页顶部")
@ResponseBody @ResponseBody
public CommonResp<TopicDetailQo> gethotThemes(@RequestParam String topicId){ public CommonResp<TopicRankQo> gethotThemes(@RequestParam String topicId){
TopicDetailQo detail = topicManager.getDetail(topicId); return CommonResp.success(topicManager.getDetail(topicId));
return CommonResp.success(detail);
} }
@GetMapping(value = "/titleList") @GetMapping(value = "/titleList")
@ApiOperation("首页顶部话题标题列") @ApiOperation("首页顶部话题标题列")
@ResponseBody @ResponseBody
public CommonResp<List<TopicHotQo>> getTitleList(){ public CommonResp<List<TopicRankQo>> getTitleList(){
return CommonResp.success(topicManager.getHotTopicTitles()); return CommonResp.success(topicManager.getTop4TopicTitles());
} }
......
...@@ -22,7 +22,7 @@ public class CodeAutoGenerator { ...@@ -22,7 +22,7 @@ public class CodeAutoGenerator {
String mysqlUserName = "dev"; String mysqlUserName = "dev";
String mysqlPassword = "qimeng123"; String mysqlPassword = "qimeng123";
String jdbcUrl = "jdbc:mysql://47.101.189.151:31931/tamp_community"; String jdbcUrl = "jdbc:mysql://47.101.189.151:31931/tamp_community";
String[] tables = new String[]{"visit_summary"}; String[] tables = new String[]{"comment"};
// String[] tables = new String[]{"follow_rel", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"}; // String[] tables = new String[]{"follow_rel", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"};
String basePackage = "com.tanpu.community"; String basePackage = "com.tanpu.community";
String mapperPackage = "dao.mapper.community"; String mapperPackage = "dao.mapper.community";
......
package com.tanpu.community.dao.entity.user;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
* 定价表
* </p>
*
* @author xudong
* @since 2021-06-24
*/
@TableName("curriculum_price")
@ApiModel(value="CurriculumPriceEntity对象", description="定价表")
public class CurriculumPriceEntity implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
@ApiModelProperty(value = "关联id")
private String relId;
@ApiModelProperty(value = "付费模式 1:免费 2:积分 3:现金")
private Integer chargeMode;
@ApiModelProperty(value = "价格")
private Long price;
@ApiModelProperty(value = "划线价")
private Long crossedPrice;
@ApiModelProperty(value = "是否促销 0:否 1 :是 ")
private Integer promo;
@ApiModelProperty(value = "促销价格")
private Long promoPrice;
@ApiModelProperty(value = "促销开始日期")
private LocalDateTime promoStartTime;
@ApiModelProperty(value = "促销结束日期")
private LocalDateTime promoEndTime;
@ApiModelProperty(value = "使用积分 0:不使用 1:使用 (保留字段)")
private Integer useScore;
@ApiModelProperty(value = "积分")
private Integer score;
@ApiModelProperty(value = "是否有角色价 0:没有 1:有")
private Integer isRolePrice;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "创建人")
private String createBy;
@ApiModelProperty(value = "更新时间")
private LocalDateTime updateTime;
@ApiModelProperty(value = "删除")
private Integer deleteTag;
@ApiModelProperty(value = "更新人")
private String updateBy;
@ApiModelProperty(value = "机构id")
private String orgId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRelId() {
return relId;
}
public void setRelId(String relId) {
this.relId = relId;
}
public Integer getChargeMode() {
return chargeMode;
}
public void setChargeMode(Integer chargeMode) {
this.chargeMode = chargeMode;
}
public Long getPrice() {
return price;
}
public void setPrice(Long price) {
this.price = price;
}
public Long getCrossedPrice() {
return crossedPrice;
}
public void setCrossedPrice(Long crossedPrice) {
this.crossedPrice = crossedPrice;
}
public Integer getPromo() {
return promo;
}
public void setPromo(Integer promo) {
this.promo = promo;
}
public Long getPromoPrice() {
return promoPrice;
}
public void setPromoPrice(Long promoPrice) {
this.promoPrice = promoPrice;
}
public LocalDateTime getPromoStartTime() {
return promoStartTime;
}
public void setPromoStartTime(LocalDateTime promoStartTime) {
this.promoStartTime = promoStartTime;
}
public LocalDateTime getPromoEndTime() {
return promoEndTime;
}
public void setPromoEndTime(LocalDateTime promoEndTime) {
this.promoEndTime = promoEndTime;
}
public Integer getUseScore() {
return useScore;
}
public void setUseScore(Integer useScore) {
this.useScore = useScore;
}
public Integer getScore() {
return score;
}
public void setScore(Integer score) {
this.score = score;
}
public Integer getIsRolePrice() {
return isRolePrice;
}
public void setIsRolePrice(Integer isRolePrice) {
this.isRolePrice = isRolePrice;
}
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 Integer getDeleteTag() {
return deleteTag;
}
public void setDeleteTag(Integer deleteTag) {
this.deleteTag = deleteTag;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
@Override
public String toString() {
return "CurriculumPriceEntity{" +
"id=" + id +
", relId=" + relId +
", chargeMode=" + chargeMode +
", price=" + price +
", crossedPrice=" + crossedPrice +
", promo=" + promo +
", promoPrice=" + promoPrice +
", promoStartTime=" + promoStartTime +
", promoEndTime=" + promoEndTime +
", useScore=" + useScore +
", score=" + score +
", isRolePrice=" + isRolePrice +
", createTime=" + createTime +
", createBy=" + createBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
", updateBy=" + updateBy +
", orgId=" + orgId +
"}";
}
}
package com.tanpu.community.dao.entity.user;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
* 课程资源
* </p>
*
* @author xudong
* @since 2021-06-23
*/
@TableName("curriculum_res")
@ApiModel(value="CurriculumResEntity对象", description="课程资源")
public class CurriculumResEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private String id;
@ApiModelProperty(value = "课程名称")
private String title;
@ApiModelProperty(value = "课程音视频")
private String audio;
@ApiModelProperty(value = "音/视频类型 1:音频 2:视频 3:小视频")
private Integer audioType;
@ApiModelProperty(value = "讲师id")
private String teacherId;
@ApiModelProperty(value = "讲师姓名")
private String teacherName;
@ApiModelProperty(value = "文稿内容")
private String content;
@ApiModelProperty(value = "时长")
private Integer duration;
@ApiModelProperty(value = "文件大小KB")
private Integer fileSize;
@ApiModelProperty(value = "组织id")
private String orgId;
@ApiModelProperty(value = "房间密码")
private String roomPwd;
@ApiModelProperty(value = "白名单 1:白名单 2:黑名单")
private Integer whiteList;
@ApiModelProperty(value = "创建人")
private String createBy;
@ApiModelProperty(value = "阅读数")
private Integer readNum;
@ApiModelProperty(value = "阅读基础数")
private Integer readBaseNum;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新人")
private String updateBy;
@ApiModelProperty(value = "更新时间")
private LocalDateTime updateTime;
@ApiModelProperty(value = "删除标识")
private Integer deleteTag;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "简介")
private String info;
@ApiModelProperty(value = "封面")
private String cover;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAudio() {
return audio;
}
public void setAudio(String audio) {
this.audio = audio;
}
public Integer getAudioType() {
return audioType;
}
public void setAudioType(Integer audioType) {
this.audioType = audioType;
}
public String getTeacherId() {
return teacherId;
}
public void setTeacherId(String teacherId) {
this.teacherId = teacherId;
}
public String getTeacherName() {
return teacherName;
}
public void setTeacherName(String teacherName) {
this.teacherName = teacherName;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public Integer getFileSize() {
return fileSize;
}
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getRoomPwd() {
return roomPwd;
}
public void setRoomPwd(String roomPwd) {
this.roomPwd = roomPwd;
}
public Integer getWhiteList() {
return whiteList;
}
public void setWhiteList(Integer whiteList) {
this.whiteList = whiteList;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Integer getReadNum() {
return readNum;
}
public void setReadNum(Integer readNum) {
this.readNum = readNum;
}
public Integer getReadBaseNum() {
return readBaseNum;
}
public void setReadBaseNum(Integer readBaseNum) {
this.readBaseNum = readBaseNum;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public Integer getDeleteTag() {
return deleteTag;
}
public void setDeleteTag(Integer deleteTag) {
this.deleteTag = deleteTag;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
@Override
public String toString() {
return "CurriculumResEntity{" +
"id=" + id +
", title=" + title +
", audio=" + audio +
", audioType=" + audioType +
", teacherId=" + teacherId +
", teacherName=" + teacherName +
", content=" + content +
", duration=" + duration +
", fileSize=" + fileSize +
", orgId=" + orgId +
", roomPwd=" + roomPwd +
", whiteList=" + whiteList +
", createBy=" + createBy +
", readNum=" + readNum +
", readBaseNum=" + readBaseNum +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
", status=" + status +
", sort=" + sort +
", info=" + info +
", cover=" + cover +
"}";
}
}
package com.tanpu.community.dao.entity.user;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
*
* </p>
*
* @author xudong
* @since 2021-06-24
*/
@TableName("order_flow")
@ApiModel(value="OrderFlowEntity对象", description="")
public class OrderFlowEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "唯一主键")
private String id;
@ApiModelProperty(value = "订单号")
private String abOrdernum;
@ApiModelProperty(value = "产品价格")
private Long abPrice;
@ApiModelProperty(value = "积分")
private Long abScore;
@ApiModelProperty(value = "积分抵扣")
private Long abScoreDeduct;
@ApiModelProperty(value = "账户余额抵扣")
private Long abAccountDeduct;
@ApiModelProperty(value = "支付通道付款金额")
private Long abPayment;
@ApiModelProperty(value = "支付方式 1:免费 2:积分 3现金")
private String abPayMode;
@ApiModelProperty(value = "订单总额")
private Long abTotalMoney;
@ApiModelProperty(value = "产品类型")
private String abType;
@ApiModelProperty(value = "产品ID")
private String abProid;
@ApiModelProperty(value = "产品规格ID")
private String abProSiid;
@ApiModelProperty(value = "产品规格类型")
private String abSiType;
@ApiModelProperty(value = "产品规格规格名称")
private String abSiName;
@ApiModelProperty(value = "产品规格规格编码")
private String abSiCode;
@ApiModelProperty(value = "产品规格定价模式")
private String abSiPattern;
@ApiModelProperty(value = "状态 WAIT:待支付 SUCCESS:支付成功 FAIL:支付失败 CANCEL:取消交易")
private String abStatus;
@ApiModelProperty(value = "权益分配状态")
private String abRightsStatus;
@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 = "微信unionid")
private String unionid;
@ApiModelProperty(value = "交易流水号")
private String transactionSerialNo;
@ApiModelProperty(value = "付款时间")
private LocalDateTime payTime;
@ApiModelProperty(value = "完成时间")
private LocalDateTime completeTime;
@ApiModelProperty(value = "机构id")
private String orgId;
@ApiModelProperty(value = "注册手机号")
private String registerPhone;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAbOrdernum() {
return abOrdernum;
}
public void setAbOrdernum(String abOrdernum) {
this.abOrdernum = abOrdernum;
}
public Long getAbPrice() {
return abPrice;
}
public void setAbPrice(Long abPrice) {
this.abPrice = abPrice;
}
public Long getAbScore() {
return abScore;
}
public void setAbScore(Long abScore) {
this.abScore = abScore;
}
public Long getAbScoreDeduct() {
return abScoreDeduct;
}
public void setAbScoreDeduct(Long abScoreDeduct) {
this.abScoreDeduct = abScoreDeduct;
}
public Long getAbAccountDeduct() {
return abAccountDeduct;
}
public void setAbAccountDeduct(Long abAccountDeduct) {
this.abAccountDeduct = abAccountDeduct;
}
public Long getAbPayment() {
return abPayment;
}
public void setAbPayment(Long abPayment) {
this.abPayment = abPayment;
}
public String getAbPayMode() {
return abPayMode;
}
public void setAbPayMode(String abPayMode) {
this.abPayMode = abPayMode;
}
public Long getAbTotalMoney() {
return abTotalMoney;
}
public void setAbTotalMoney(Long abTotalMoney) {
this.abTotalMoney = abTotalMoney;
}
public String getAbType() {
return abType;
}
public void setAbType(String abType) {
this.abType = abType;
}
public String getAbProid() {
return abProid;
}
public void setAbProid(String abProid) {
this.abProid = abProid;
}
public String getAbProSiid() {
return abProSiid;
}
public void setAbProSiid(String abProSiid) {
this.abProSiid = abProSiid;
}
public String getAbSiType() {
return abSiType;
}
public void setAbSiType(String abSiType) {
this.abSiType = abSiType;
}
public String getAbSiName() {
return abSiName;
}
public void setAbSiName(String abSiName) {
this.abSiName = abSiName;
}
public String getAbSiCode() {
return abSiCode;
}
public void setAbSiCode(String abSiCode) {
this.abSiCode = abSiCode;
}
public String getAbSiPattern() {
return abSiPattern;
}
public void setAbSiPattern(String abSiPattern) {
this.abSiPattern = abSiPattern;
}
public String getAbStatus() {
return abStatus;
}
public void setAbStatus(String abStatus) {
this.abStatus = abStatus;
}
public String getAbRightsStatus() {
return abRightsStatus;
}
public void setAbRightsStatus(String abRightsStatus) {
this.abRightsStatus = abRightsStatus;
}
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 getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid;
}
public String getTransactionSerialNo() {
return transactionSerialNo;
}
public void setTransactionSerialNo(String transactionSerialNo) {
this.transactionSerialNo = transactionSerialNo;
}
public LocalDateTime getPayTime() {
return payTime;
}
public void setPayTime(LocalDateTime payTime) {
this.payTime = payTime;
}
public LocalDateTime getCompleteTime() {
return completeTime;
}
public void setCompleteTime(LocalDateTime completeTime) {
this.completeTime = completeTime;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getRegisterPhone() {
return registerPhone;
}
public void setRegisterPhone(String registerPhone) {
this.registerPhone = registerPhone;
}
@Override
public String toString() {
return "OrderFlowEntity{" +
"id=" + id +
", abOrdernum=" + abOrdernum +
", abPrice=" + abPrice +
", abScore=" + abScore +
", abScoreDeduct=" + abScoreDeduct +
", abAccountDeduct=" + abAccountDeduct +
", abPayment=" + abPayment +
", abPayMode=" + abPayMode +
", abTotalMoney=" + abTotalMoney +
", abType=" + abType +
", abProid=" + abProid +
", abProSiid=" + abProSiid +
", abSiType=" + abSiType +
", abSiName=" + abSiName +
", abSiCode=" + abSiCode +
", abSiPattern=" + abSiPattern +
", abStatus=" + abStatus +
", abRightsStatus=" + abRightsStatus +
", createtime=" + createtime +
", createby=" + createby +
", updatetime=" + updatetime +
", updateby=" + updateby +
", deletetag=" + deletetag +
", unionid=" + unionid +
", transactionSerialNo=" + transactionSerialNo +
", payTime=" + payTime +
", completeTime=" + completeTime +
", orgId=" + orgId +
", registerPhone=" + registerPhone +
"}";
}
}
package com.tanpu.community.dao.entity.user; package com.tanpu.community.dao.entity.user;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
/** /**
* <p> * <p>
* *
* </p> * </p>
* *
* @author xudong * @author xudong
* @since 2021-07-14 * @since 2021-07-20
*/ */
@TableName("user_info") @TableName("user_info")
@ApiModel(value="UserInfoEntity对象", description="") @ApiModel(value="UserInfoEntity对象", description="")
...@@ -24,6 +25,9 @@ public class UserInfoEntity implements Serializable { ...@@ -24,6 +25,9 @@ public class UserInfoEntity implements Serializable {
@ApiModelProperty(value = "唯一主键") @ApiModelProperty(value = "唯一主键")
private String id; private String id;
@ApiModelProperty(value = "账户类型 1普通账号 2机构账号 3机构人员")
private Integer userType;
@ApiModelProperty(value = "微信openId") @ApiModelProperty(value = "微信openId")
private String uiOpenid; private String uiOpenid;
...@@ -253,6 +257,14 @@ public class UserInfoEntity implements Serializable { ...@@ -253,6 +257,14 @@ public class UserInfoEntity implements Serializable {
this.id = id; this.id = id;
} }
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
public String getUiOpenid() { public String getUiOpenid() {
return uiOpenid; return uiOpenid;
} }
...@@ -889,6 +901,7 @@ public class UserInfoEntity implements Serializable { ...@@ -889,6 +901,7 @@ public class UserInfoEntity implements Serializable {
public String toString() { public String toString() {
return "UserInfoEntity{" + return "UserInfoEntity{" +
"id=" + id + "id=" + id +
", userType=" + userType +
", uiOpenid=" + uiOpenid + ", uiOpenid=" + uiOpenid +
", uiUnionid=" + uiUnionid + ", uiUnionid=" + uiUnionid +
", uiTelphone=" + uiTelphone + ", uiTelphone=" + uiTelphone +
......
package com.tanpu.community.dao.mapper.user;
import com.tanpu.community.dao.entity.user.CurriculumPriceEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 定价表 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-06-24
*/
public interface CurriculumPriceMapper extends BaseMapper<CurriculumPriceEntity> {
}
package com.tanpu.community.dao.mapper.user;
import com.tanpu.community.dao.entity.user.CurriculumResEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 课程资源 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-06-23
*/
public interface CurriculumResMapper extends BaseMapper<CurriculumResEntity> {
}
package com.tanpu.community.dao.mapper.user;
import com.tanpu.community.dao.entity.user.FinProResEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author xudong
* @since 2021-06-23
*/
public interface FinProResMapper extends BaseMapper<FinProResEntity> {
}
package com.tanpu.community.dao.mapper.user;
import com.tanpu.community.dao.entity.user.OrderFlowEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author xudong
* @since 2021-06-24
*/
public interface OrderFlowMapper extends BaseMapper<OrderFlowEntity> {
}
...@@ -42,6 +42,10 @@ public interface FeignClientForFatools { ...@@ -42,6 +42,10 @@ public interface FeignClientForFatools {
@GetMapping(value = "/queryUserInfoNew") @GetMapping(value = "/queryUserInfoNew")
CommonResp<UserInfoNew> queryUsersListNew(@RequestParam("userId") String userId); CommonResp<UserInfoNew> queryUsersListNew(@RequestParam("userId") String userId);
@ApiOperation(value = "批量查询查询基本信息")
@GetMapping(value = "/queryUserBaseInfoList")
List<UserInfoNew> queryUserListNew(@RequestParam("userIds") List<String> userIds);
@ApiOperation(value = "根据机构用户id 查询旗下机构用户信息") @ApiOperation(value = "根据机构用户id 查询旗下机构用户信息")
@GetMapping(value = "/getUsetInfoByOrgUserId") @GetMapping(value = "/getUsetInfoByOrgUserId")
CommonResp<List<UserInfoOrg>> getUsetInfoByOrgUserId(@RequestParam("orgUserId") String orgUserId); CommonResp<List<UserInfoOrg>> getUsetInfoByOrgUserId(@RequestParam("orgUserId") String orgUserId);
......
...@@ -10,6 +10,7 @@ import feign.hystrix.FallbackFactory; ...@@ -10,6 +10,7 @@ import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -51,6 +52,12 @@ public class FeignbackForFatools implements FallbackFactory<FeignClientForFatool ...@@ -51,6 +52,12 @@ public class FeignbackForFatools implements FallbackFactory<FeignClientForFatool
return CommonResp.error(); return CommonResp.error();
} }
@Override
public List<UserInfoNew> queryUserListNew(List<String> userIds) {
log.info("FeignbackForFatools.queryUserListNew", throwable);
return Collections.emptyList();
}
@Override @Override
public CommonResp<List<UserInfoOrg>> getUsetInfoByOrgUserId(String orgUserId) { public CommonResp<List<UserInfoOrg>> getUsetInfoByOrgUserId(String orgUserId) {
log.info("FeignbackForFatools.getUsetInfoByOrgUserId", throwable); log.info("FeignbackForFatools.getUsetInfoByOrgUserId", throwable);
......
package com.tanpu.community.manager; package com.tanpu.community.manager;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.qo.CommentQo; import com.tanpu.community.api.beans.qo.CommentQo;
import com.tanpu.community.api.beans.req.comment.CreateCommentReq; import com.tanpu.community.api.beans.req.comment.CreateCommentReq;
import com.tanpu.community.api.beans.req.comment.LikeCommentReq; import com.tanpu.community.api.beans.req.comment.LikeCommentReq;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew;
import com.tanpu.community.api.enums.CollectionTypeEnum; import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.CommentTypeEnum; import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.api.enums.OperationTypeEnum; import com.tanpu.community.api.enums.OperationTypeEnum;
import com.tanpu.community.dao.entity.community.CommentEntity; import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.entity.user.UserInfoEntity; import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.service.CollectionService; import com.tanpu.community.service.CollectionService;
import com.tanpu.community.service.CommentService; import com.tanpu.community.service.CommentService;
import com.tanpu.community.service.HomePageService;
import com.tanpu.community.service.UserInfoService; import com.tanpu.community.service.UserInfoService;
import com.tanpu.community.util.ConvertUtil; import com.tanpu.community.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
@Service @Service
public class CommentManager { public class CommentManager {
...@@ -27,7 +31,7 @@ public class CommentManager { ...@@ -27,7 +31,7 @@ public class CommentManager {
private CommentService commentService; private CommentService commentService;
@Autowired @Autowired
private HomePageService homePageService; private FeignClientForFatools feignClientForFatools;
@Autowired @Autowired
private CollectionService collectionService; private CollectionService collectionService;
...@@ -61,18 +65,23 @@ public class CommentManager { ...@@ -61,18 +65,23 @@ public class CommentManager {
for (CommentQo commentQo : commentQos) { for (CommentQo commentQo : commentQos) {
//用户信息 //用户信息
String authorId = commentQo.getAuthorId(); String authorId = commentQo.getAuthorId();
UserInfoEntity userInfo = userInfoService.queryUserById(authorId); CommonResp<UserInfoNew> userInfoNewCommonResp = feignClientForFatools.queryUsersListNew(authorId);
if (userInfoNewCommonResp.isNotSuccess()) {
throw new BizException("内部接口调用失败");
}
UserInfoNew userInfo = userInfoNewCommonResp.getData();
if (userInfo != null) { if (userInfo != null) {
commentQo.setUserImg(userInfo.getUiHeadimgMp()); commentQo.setUserImg(userInfo.getHeadImageUrl());
commentQo.setNickName(userInfo.getUiUsernameMp()); commentQo.setNickName(userInfo.getNickName());
commentQo.setUserType(userInfo.getUserType());
commentQo.setLevelGrade(userInfo.getLevelGrade());
commentQo.setUserInvestorType(userInfo.getUserInvestorType());
commentQo.setBelongUserOrgId(userInfo.getBelongUserOrgId());
commentQo.setBelongUserOrgName(userInfo.getBelongUserOrgName());
} }
//是否点赞及点赞数 //是否点赞及点赞数
String commentId = commentQo.getCommentId(); String commentId = commentQo.getCommentId();
if (likeCommentList.contains(commentId)) { commentQo.setHasLiked(likeCommentList.contains(commentId));
commentQo.setHasLiked(true);
} else {
commentQo.setHasLiked(false);
}
Integer countByTypeAndId = collectionService.getCountByTypeAndId(commentId, CollectionTypeEnum.LIKE_COMMENT); Integer countByTypeAndId = collectionService.getCountByTypeAndId(commentId, CollectionTypeEnum.LIKE_COMMENT);
commentQo.setLikeCount(countByTypeAndId); commentQo.setLikeCount(countByTypeAndId);
...@@ -81,8 +90,10 @@ public class CommentManager { ...@@ -81,8 +90,10 @@ public class CommentManager {
// List<CommentLv2Qo> commentLv2Qos = ConvertUtil.commentLv2Entity2Qos(CommentLv2Entities); // List<CommentLv2Qo> commentLv2Qos = ConvertUtil.commentLv2Entity2Qos(CommentLv2Entities);
// commentQo.setCommentLv2Qos(commentLv2Qos); // commentQo.setCommentLv2Qos(commentLv2Qos);
} }
//排序:点赞降序+时间降序
return commentQos; return commentQos.stream().sorted(Comparator.comparing(CommentQo::getLikeCount, Comparator.reverseOrder()).
thenComparing(CommentQo::getUpdateTime, Comparator.reverseOrder()))
.collect(Collectors.toList());
} }
//点赞评论/取消点赞 //点赞评论/取消点赞
......
...@@ -18,7 +18,6 @@ import com.tanpu.community.dao.entity.fund.CompanyInfo; ...@@ -18,7 +18,6 @@ import com.tanpu.community.dao.entity.fund.CompanyInfo;
import com.tanpu.community.dao.entity.fund.FundInfo; import com.tanpu.community.dao.entity.fund.FundInfo;
import com.tanpu.community.dao.entity.jydb.MfAdvisorscalerank; import com.tanpu.community.dao.entity.jydb.MfAdvisorscalerank;
import com.tanpu.community.dao.entity.jydb.MfInvestadvisoroutline; import com.tanpu.community.dao.entity.jydb.MfInvestadvisoroutline;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.dao.mapper.community.FollowRelMapper; import com.tanpu.community.dao.mapper.community.FollowRelMapper;
import com.tanpu.community.dao.mapper.fund.CompanyInfoMapper; import com.tanpu.community.dao.mapper.fund.CompanyInfoMapper;
import com.tanpu.community.dao.mapper.fund.FundInfoMapper; import com.tanpu.community.dao.mapper.fund.FundInfoMapper;
...@@ -35,9 +34,7 @@ import com.tanpu.community.util.PageUtils; ...@@ -35,9 +34,7 @@ import com.tanpu.community.util.PageUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
...@@ -75,19 +72,18 @@ public class HomePageManager { ...@@ -75,19 +72,18 @@ public class HomePageManager {
CommonResp<UserInfoNew> queryUsersListNew = feignClientForFatools.queryUsersListNew(StringUtils.isNotBlank(userId) ? userId : userIdMyself); CommonResp<UserInfoNew> queryUsersListNew = feignClientForFatools.queryUsersListNew(StringUtils.isNotBlank(userId) ? userId : userIdMyself);
if (queryUsersListNew.isNotSuccess()) new BizException("内部接口调用失败"); if (queryUsersListNew.isNotSuccess()) new BizException("内部接口调用失败");
UserInfoNew userInfoNew = queryUsersListNew.getData(); UserInfoNew userInfoNew = queryUsersListNew.getData();
if (StringUtils.isNotBlank(userId) && !StringUtils.equals(userIdMyself, userId)) { //查询别人的个人主页
// 关注 按钮的显示逻辑 // 关注 按钮的显示逻辑
if (StringUtils.isNotBlank(userId)) { //查询别人的个人主页
userInfoNew.setIsShowFollowButton(0);
//是否已关注
FollowRelEntity followRelEntity = followRelService.queryRecord(userId, userIdMyself); FollowRelEntity followRelEntity = followRelService.queryRecord(userId, userIdMyself);
if (ObjectUtils.allNotNull(followRelEntity) && BizStatus.DeleteTag.tag_init == followRelEntity.getDeleteTag()){ if (ObjectUtils.allNotNull(followRelEntity) && BizStatus.DeleteTag.tag_init == followRelEntity.getDeleteTag()){
userInfoNew.setShowFollowStatus(1); // 已关注 userInfoNew.setShowFollowStatus(1); // 已关注
} else { } else {
userInfoNew.setShowFollowStatus(0); // 未关注 userInfoNew.setShowFollowStatus(0); // 未关注
} }
if (userInfoNew.getWorkshopStatus() == 2) userInfoNew.setWorkshopStatus(1); //别人的主页不需要展示 工作室
} else { } else {
// 查询自己的主页 // 查询自己的主页
userInfoNew.setIsShowFollowButton(1);
userId = userIdMyself; userId = userIdMyself;
} }
//设置粉丝数 关注数 //设置粉丝数 关注数
...@@ -95,8 +91,8 @@ public class HomePageManager { ...@@ -95,8 +91,8 @@ public class HomePageManager {
// 主页类型 显示逻辑 // 主页类型 显示逻辑
if (50 == userInfoNew.getLevelGrade()){ if (50 == userInfoNew.getLevelGrade()){
// 首席投顾
userInfoNew.setPersonalCenterType(2); userInfoNew.setPersonalCenterType(2);
// 首席投顾 添加专栏信息 (前端自己取)
// 成功案例客户 // 成功案例客户
// 默认显示该投顾管理的客户里,总资产最高的客户 // 默认显示该投顾管理的客户里,总资产最高的客户
if (StringUtils.isBlank(userInfoNew.getUserInfoNewChief().getClientId())) { if (StringUtils.isBlank(userInfoNew.getUserInfoNewChief().getClientId())) {
...@@ -163,9 +159,9 @@ public class HomePageManager { ...@@ -163,9 +159,9 @@ public class HomePageManager {
} }
private void getFansNUmAndFollowNum(UserInfoNew userInfoNew) { private void getFansNUmAndFollowNum(UserInfoNew userInfoNew) {
Integer followNumber = followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>().eq(FollowRelEntity::getFollowUserId, userInfoNew.getUserId()) Integer fansNumber = followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>().eq(FollowRelEntity::getFollowUserId, userInfoNew.getUserId())
.eq(FollowRelEntity::getDeleteTag, BizStatus.DeleteTag.tag_init)); .eq(FollowRelEntity::getDeleteTag, BizStatus.DeleteTag.tag_init));
Integer fansNumber = followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>().eq(FollowRelEntity::getFollowerId, userInfoNew.getUserId()) Integer followNumber = followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>().eq(FollowRelEntity::getFollowerId, userInfoNew.getUserId())
.eq(FollowRelEntity::getDeleteTag, BizStatus.DeleteTag.tag_init)); .eq(FollowRelEntity::getDeleteTag, BizStatus.DeleteTag.tag_init));
userInfoNew.setFollowNumber(followNumber); userInfoNew.setFollowNumber(followNumber);
userInfoNew.setFansNumber(fansNumber); userInfoNew.setFansNumber(fansNumber);
...@@ -183,10 +179,9 @@ public class HomePageManager { ...@@ -183,10 +179,9 @@ public class HomePageManager {
followRelService.queryFansByIdolId(req.getUserId()) : followRelService.queryFansByFollowerId(req.getUserId()); followRelService.queryFansByIdolId(req.getUserId()) : followRelService.queryFansByFollowerId(req.getUserId());
List<FollowQo> followQos = new ArrayList<>(); List<FollowQo> followQos = new ArrayList<>();
if (!CollectionUtils.isEmpty(userIds)) { if (!CollectionUtils.isEmpty(userIds)) {
List<UserInfoEntity> userInfos = userInfoService.queryUserByIds(userIds); List<UserInfoNew> userInfoNews = feignClientForFatools.queryUserListNew(userIds);
List<FollowQo> collect = userInfos.stream().map(ConvertUtil::userInfoEntity2FollowQo).collect(Collectors.toList()); List<FollowQo> collect = userInfoNews.stream().map(ConvertUtil::userInfoNew2FollowQo).collect(Collectors.toList());
followQos = judgeFollowed(collect, userId); followQos = judgeFollowed(collect, userId);
} }
//分页 //分页
return PageUtils.page(req.getPage(), followQos); return PageUtils.page(req.getPage(), followQos);
......
package com.tanpu.community.manager; package com.tanpu.community.manager;
import com.tanpu.common.exception.BizException; import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.qo.TopicDetailQo; import com.tanpu.community.api.beans.qo.TopicRankQo;
import com.tanpu.community.api.beans.qo.TopicHotQo;
import com.tanpu.community.api.beans.qo.TopicTitileQo;
import com.tanpu.community.api.beans.req.page.Page; import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.req.topic.TopicSearchReq; import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
import com.tanpu.community.api.beans.vo.TopicDTO;
import com.tanpu.community.api.beans.vo.TopicDataAnalysDTO; import com.tanpu.community.api.beans.vo.TopicDataAnalysDTO;
import com.tanpu.community.api.constants.RedisKeyConstant; import com.tanpu.community.api.constants.RedisKeyConstant;
import com.tanpu.community.api.enums.CollectionTypeEnum; import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.dao.entity.community.TopicEntity; import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.service.*; import com.tanpu.community.service.*;
import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.util.PageUtils; import com.tanpu.community.util.PageUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -49,71 +43,29 @@ public class TopicManager { ...@@ -49,71 +43,29 @@ public class TopicManager {
//新增话题 //新增话题
public void insertTopic(String topicTitle, String userId) { public void insertTopic(String topicTitle, String userId) {
if (topicService.queryByTitile(topicTitle) == null) { if (topicService.queryByTitile(topicTitle) == null) {
topicService.addTopic(topicTitle, userId); throw new BizException("话题名称已存在:"+topicTitle);
} }
return; topicService.addTopic(topicTitle, userId);
} }
//话题详情列表 //首页-话题标签
public List<TopicDTO> getAllTopicDetail() { public List<TopicRankQo> getTop4TopicTitles() {
return ConvertUtil.topicEntitiesToDTOs(topicService.queryAll()); return rankService.getRankTopicListTop4();
} }
//话题简介列表 //话题搜索列表
public Page<TopicTitileQo> getAllTopicBriefInfo(TopicSearchReq req) { public Page<TopicRankQo> getAllTopicBriefInfo(TopicSearchReq req) {
List<TopicEntity> allTopic = topicService.queryByKeyword(req.getSearchKeyword()); return PageUtils.page(req.getPage(), rankService.getRankTopicList());
List<TopicTitileQo> topicTitileQos = ConvertUtil.topicEntitiesToBriefDTOs(allTopic);
for (TopicTitileQo topicQo : topicTitileQos) {
//讨论数=发布主题贴数+回复总数
List<String> themeIds = themeService.queryThemeIdsByTopic(topicQo.getTopicId());
Integer commentCount = commentService.getCommentCountByThemeIds(themeIds);
topicQo.setDiscussionCount(String.valueOf(themeIds.size() + commentCount));
//浏览量
Integer topicPV = visitSummaryService.queryTopicDetailVisit(topicQo.getTopicId());
Integer themePV = visitSummaryService.queryThemeVisit(themeIds);
topicQo.setViewCount(String.valueOf(topicPV + themePV));
}
//TODO 判断顶置
return PageUtils.page(req.getPage(), topicTitileQos);
} }
//话题详情页 //话题详情页
public TopicDetailQo getDetail(String topicId) { public TopicRankQo getDetail(String topicId) {
TopicEntity topicEntity = topicService.queryById(topicId); return rankService.getTopicDetail(topicId);
if (topicEntity == null) {
throw new BizException("找不到话题,id:" + topicId);
}
TopicDetailQo topicDetailQo = new TopicDetailQo();
BeanUtils.copyProperties(topicEntity, topicDetailQo);
List<String> themeIds = themeService.queryThemeIdsByTopic(topicId);
if (CollectionUtils.isEmpty(themeIds)) {
topicDetailQo.setViewCount(visitSummaryService.queryTopicDetailVisit(topicId));
topicDetailQo.setDisscussCount(0);
return topicDetailQo;
}
//浏览量
Integer topicPV = visitSummaryService.queryTopicDetailVisit(topicId);
Integer themePV = visitSummaryService.queryThemeVisit(themeIds);
topicDetailQo.setViewCount(topicPV + themePV);
//讨论数=发布主题贴数+回复总数
Integer commentCount = commentService.getCommentCountByThemeIds(themeIds);
topicDetailQo.setDisscussCount(themeIds.size() + commentCount);
return topicDetailQo;
} }
public List<TopicHotQo> getHotTopicTitles() {
List<TopicHotQo> rankTopicList = rankService.rankTopicList;
if (rankTopicList.size()==0){
rankService.rankTopics();
}
return rankService.rankTopicList;
}
public void setTopTopic(String topicId, boolean setTop) { public void setTopTopic(String topicId, boolean setTop) {
TopicEntity topicEntity = topicService.queryById(topicId); TopicEntity topicEntity = topicService.queryById(topicId);
if (topicEntity == null) { if (topicEntity == null) {
......
...@@ -11,13 +11,13 @@ import com.tanpu.community.api.beans.qo.ThemeQo; ...@@ -11,13 +11,13 @@ import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.vo.ImagesDTO; import com.tanpu.community.api.beans.vo.ImagesDTO;
import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp; import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp;
import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp; import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew;
import com.tanpu.community.api.beans.vo.feign.product.FundInfoBaseResp; import com.tanpu.community.api.beans.vo.feign.product.FundInfoBaseResp;
import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO; import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp; import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp;
import com.tanpu.community.api.enums.RelTypeEnum; import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.dao.entity.community.FileRecordEntity; import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.dao.entity.community.TopicEntity; import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.feign.course.FeignClientForCourse; import com.tanpu.community.feign.course.FeignClientForCourse;
import com.tanpu.community.feign.fatools.FeignClientForFatools; import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.feign.product.FeignClientForProducts; import com.tanpu.community.feign.product.FeignClientForProducts;
...@@ -34,8 +34,11 @@ import javax.annotation.Resource; ...@@ -34,8 +34,11 @@ import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* 批量调用Feign查询接口
*/
@Service @Service
public class ProductService { public class BatchFeignCallService {
@Resource @Resource
...@@ -93,7 +96,7 @@ public class ProductService { ...@@ -93,7 +96,7 @@ public class ProductService {
// 话题标题 // 话题标题
Map<String, String> topicMap = Maps.newHashMap(); Map<String, String> topicMap = Maps.newHashMap();
// 图片信息 // 图片信息
Map<String, UserInfoEntity> userMap = Maps.newHashMap(); Map<String, UserInfoNew> userMap = Maps.newHashMap();
// 批量查询资源信息 // 批量查询资源信息
this.getResInfo(shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap, topicMap, userMap, themeQos); this.getResInfo(shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap, topicMap, userMap, themeQos);
//逐个装入 //逐个装入
...@@ -117,7 +120,7 @@ public class ProductService { ...@@ -117,7 +120,7 @@ public class ProductService {
Map<String, FundInfoBaseResp> fundMap, Map<String, FundInfoBaseResp> fundMap,
Map<String, FileRecordEntity> imgMap, Map<String, FileRecordEntity> imgMap,
Map<String, String> topicMap, Map<String, String> topicMap,
Map<String, UserInfoEntity> userMap, Map<String, UserInfoNew> userMap,
List<ThemeQo> themeQos List<ThemeQo> themeQos
) { ) {
// 白名单基金id // 白名单基金id
...@@ -238,12 +241,12 @@ public class ProductService { ...@@ -238,12 +241,12 @@ public class ProductService {
} }
if (!CollectionUtils.isEmpty(userIds)) { if (!CollectionUtils.isEmpty(userIds)) {
// 查询用户信息 // 查询用户信息
List<UserInfoEntity> userInfos = List<UserInfoNew> queryUsersListNew = feignClientForFatools.queryUserListNew(setToList(userIds));
userInfoService.queryUserByIds(setToList(userIds));
if (!CollectionUtils.isEmpty(userIds)) { if (!CollectionUtils.isEmpty(userIds)) {
userMap.putAll(userInfos.stream().collect(Collectors userMap.putAll(queryUsersListNew.stream().collect(Collectors
.toMap(UserInfoEntity::getId, o -> o))); .toMap(UserInfoNew::getUserId, o -> o)));
} }
} }
this.getFundInfo(tanpuFundIds, fundIds, publicFundIds, ifaFundIds, notNetFundIds, fundMap); this.getFundInfo(tanpuFundIds, fundIds, publicFundIds, ifaFundIds, notNetFundIds, fundMap);
} }
...@@ -369,16 +372,26 @@ public class ProductService { ...@@ -369,16 +372,26 @@ public class ProductService {
Map<String, ZhiboListResp> zhiboMap, Map<String, ZhiboListResp> zhiboMap,
Map<String, FundInfoBaseResp> fundMap, Map<String, FundInfoBaseResp> fundMap,
Map<String, FileRecordEntity> imgUrlMap, Map<String, FileRecordEntity> imgUrlMap,
Map<String, UserInfoEntity> userMap, Map<String, UserInfoNew> userMap,
Map<String, String> topicMap) { Map<String, String> topicMap) {
for (ThemeQo themeQo : themeQos) { for (ThemeQo themeQo : themeQos) {
if (!StringUtils.isEmpty(themeQo.getTopicId()) && topicMap.containsKey(themeQo.getTopicId())) { if (!StringUtils.isEmpty(themeQo.getTopicId()) && topicMap.containsKey(themeQo.getTopicId())) {
//话题标题
themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId())); themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId()));
} }
if (!StringUtils.isEmpty(themeQo.getAuthorId()) && userMap.containsKey(themeQo.getAuthorId())) { if (!StringUtils.isEmpty(themeQo.getAuthorId()) && userMap.containsKey(themeQo.getAuthorId())) {
themeQo.setNickName(userMap.get(themeQo.getAuthorId()).getUiUsernameMp()); //用户信息
themeQo.setUserImg(userMap.get(themeQo.getAuthorId()).getUiHeadimgMp()); UserInfoNew userInfo = userMap.get(themeQo.getAuthorId());
themeQo.setUserIntroduction(userMap.get(themeQo.getAuthorId()).getUiIntroductionMp()); //昵称头像简介
themeQo.setNickName(userInfo.getNickName());
themeQo.setUserImg(userInfo.getHeadImageUrl());
themeQo.setUserIntroduction(userInfo.getIntroduction());
//认证标签相关
themeQo.setUserType(userInfo.getUserType());
themeQo.setLevelGrade(userInfo.getLevelGrade());
themeQo.setUserInvestorType(userInfo.getUserInvestorType());
themeQo.setBelongUserOrgId(userInfo.getBelongUserOrgId());
themeQo.setBelongUserOrgName(userInfo.getBelongUserOrgName());
} }
if (themeQo.getContent() == null) { if (themeQo.getContent() == null) {
continue; continue;
......
...@@ -5,7 +5,6 @@ import com.tanpu.common.exception.BizException; ...@@ -5,7 +5,6 @@ import com.tanpu.common.exception.BizException;
import com.tanpu.common.uuid.UuidGenHelper; import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.api.enums.CommentTypeEnum; import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.api.enums.DeleteTagEnum; import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.StatusEnum;
import com.tanpu.community.dao.entity.community.CommentEntity; import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.mapper.community.CommentMapper; import com.tanpu.community.dao.mapper.community.CommentMapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -66,13 +65,13 @@ public class CommentService { ...@@ -66,13 +65,13 @@ public class CommentService {
LambdaQueryWrapper<CommentEntity> queryWrapper = new LambdaQueryWrapper<CommentEntity>() LambdaQueryWrapper<CommentEntity> queryWrapper = new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getThemeId, themeId) .eq(CommentEntity::getThemeId, themeId)
.eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()) .eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode())
.eq(CommentEntity::getIsBlock, StatusEnum.FALSE.getCode())
.orderByDesc(CommentEntity::getCreateTime); .orderByDesc(CommentEntity::getCreateTime);
if (parentId == null) { //二级评论,暂未开放,注意“”与null的区别
queryWrapper.isNull(CommentEntity::getParentId); // if (parentId == null) {
} else { // queryWrapper.isNull(CommentEntity::getParentId);
queryWrapper.eq(CommentEntity::getParentId, parentId); // } else {
} // queryWrapper.eq(CommentEntity::getParentId, parentId);
// }
return commentMapper.selectList(queryWrapper); return commentMapper.selectList(queryWrapper);
} }
......
package com.tanpu.community.service; package com.tanpu.community.service;
import com.tanpu.community.api.beans.qo.ThemeAnalysDO; import com.tanpu.community.api.beans.qo.ThemeAnalysDO;
import com.tanpu.community.api.beans.qo.TopicHotQo; import com.tanpu.community.api.beans.qo.TopicRankQo;
import com.tanpu.community.api.enums.CollectionTypeEnum; import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.TopicStatusEnum; import com.tanpu.community.api.enums.TopicStatusEnum;
import com.tanpu.community.dao.entity.community.ThemeEntity; import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.dao.entity.community.TopicEntity; import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.util.ConvertUtil; import com.tanpu.community.util.ConvertUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -27,11 +28,15 @@ public class RankService { ...@@ -27,11 +28,15 @@ public class RankService {
private VisitSummaryService visitSummaryService; private VisitSummaryService visitSummaryService;
public List<String> rankThemeList = new ArrayList<>(); private List<ThemeAnalysDO> rankThemeList = new ArrayList<>();
public List<TopicHotQo> rankTopicList = new ArrayList<>(); private List<TopicRankQo> rankTopicList = new ArrayList<>();
private List<TopicRankQo> rankTopicListTop4 = new ArrayList<>();
/**
* 计算主题热度排行
*/
public void rankThemes() { public void rankThemes() {
List<ThemeEntity> themeEntities = themeService.queryAll(); List<ThemeEntity> themeEntities = themeService.queryAll();
List<ThemeAnalysDO> themeAnalysDOS = ConvertUtil.themeEntityToAnalysDOs(themeEntities); List<ThemeAnalysDO> themeAnalysDOS = ConvertUtil.themeEntityToAnalysDOs(themeEntities);
...@@ -48,8 +53,10 @@ public class RankService { ...@@ -48,8 +53,10 @@ public class RankService {
theme.setCollectCount(bookCount); theme.setCollectCount(bookCount);
theme.setViewCount(viewCount); theme.setViewCount(viewCount);
} }
Map<ThemeAnalysDO, Double> map = themeAnalysDOS.stream().collect(Collectors.toMap(o -> o, ThemeAnalysDO::getRank)); //打分
rankThemeList = map.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).map(e -> e.getKey().getThemeId()).collect(Collectors.toList()); Map<ThemeAnalysDO, Double> map = themeAnalysDOS.stream().collect(Collectors.toMap(o -> o, ThemeAnalysDO::getScore));
//排序
rankThemeList = map.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).map(e -> e.getKey()).collect(Collectors.toList());
} }
...@@ -60,12 +67,17 @@ public class RankService { ...@@ -60,12 +67,17 @@ public class RankService {
*/ */
public void rankTopics() { public void rankTopics() {
List<TopicEntity> topicEntities = topicService.queryAll(); List<TopicEntity> topicEntities = topicService.queryAll();
List<TopicHotQo> topicHotQos = ConvertUtil.topicEntityToHotQos(topicEntities); List<TopicRankQo> topicRankQos = ConvertUtil.topicEntityToHotQos(topicEntities);
if (topicHotQos.size() == 0) { if (topicRankQos.size() == 0) {
return; return;
} }
for (TopicHotQo topic : topicHotQos) { for (TopicRankQo topic : topicRankQos) {
List<String> themeIds = themeService.queryThemeIdsByTopic(topic.getTopicId()); List<String> themeIds = themeService.queryThemeIdsByTopic(topic.getTopicId());
if (CollectionUtils.isEmpty(themeIds)){
topic.setViewCount(0);
topic.setDisscussCount(0);
continue;
}
//浏览量 //浏览量
Integer topicPV = visitSummaryService.queryTopicDetailVisit(topic.getTopicId()); Integer topicPV = visitSummaryService.queryTopicDetailVisit(topic.getTopicId());
Integer themePV = visitSummaryService.queryThemeVisit(themeIds); Integer themePV = visitSummaryService.queryThemeVisit(themeIds);
...@@ -74,20 +86,69 @@ public class RankService { ...@@ -74,20 +86,69 @@ public class RankService {
Integer commentCount = commentService.getCommentCountByThemeIds(themeIds); Integer commentCount = commentService.getCommentCountByThemeIds(themeIds);
topic.setDisscussCount(themeIds.size() + commentCount); topic.setDisscussCount(themeIds.size() + commentCount);
} }
Map<TopicHotQo, Integer> map = topicHotQos.stream().collect(Collectors.toMap(o -> o, TopicHotQo::getRank)); Map<TopicRankQo, Integer> map = topicRankQos.stream().collect(Collectors.toMap(o -> o, TopicRankQo::getRank));
List<TopicHotQo> rankList = map.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).map(e -> e.getKey()).limit(4).collect(Collectors.toList()); List<TopicRankQo> rankList = map.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).map(Map.Entry::getKey).collect(Collectors.toList());
rankList.get(0).setType(TopicStatusEnum.HOTTEST.getCode()); rankList.get(0).setType(TopicStatusEnum.HOTTEST.getCode());
rankTopicList = rankList; this.rankTopicList = rankList;
this.rankTopicListTop4 = rankList.stream().limit(4).collect(Collectors.toList());
return; return;
} }
/**
* 最新和热门主题集合
* @param hotCount
* @param newCount
* @return
*/
public List<String> getHotAndNewThemes(Integer hotCount, Integer newCount) { public List<String> getHotAndNewThemes(Integer hotCount, Integer newCount) {
Set<String> hotThemeIds = this.rankThemeList.stream().limit(hotCount).collect(Collectors.toSet()); Set<String> hotThemeIds = this.rankThemeList.stream().limit(hotCount).map(ThemeAnalysDO::getThemeId).collect(Collectors.toSet());
Set<String> newThemeIds = themeService.selectExcludeUser(null, null, newCount) Set<String> newThemeIds = themeService.selectExcludeUser(null, null, newCount)
.stream().map(ThemeEntity::getThemeId).collect(Collectors.toSet()); .stream().map(ThemeEntity::getThemeId).collect(Collectors.toSet());
hotThemeIds.addAll(newThemeIds); hotThemeIds.addAll(newThemeIds);
return new ArrayList<>(hotThemeIds); return new ArrayList<>(hotThemeIds);
} }
/**
* 话题详情
* @param topicId 话题Id
* @return
*/
public TopicRankQo getTopicDetail(String topicId){
if (this.rankTopicList.size()==0){
rankTopics();
}
List<TopicRankQo> matchTopic = this.rankTopicList.stream().filter(o -> o.getTopicId().equals(topicId)).limit(1).collect(Collectors.toList());
matchTopic.add(new TopicRankQo());
return matchTopic.get(0);
}
public List<ThemeAnalysDO> getRankThemeList() {
if (this.rankThemeList.size()==0){
rankThemes();
}
return rankThemeList;
}
public List<TopicRankQo> getRankTopicList() {
if (this.rankTopicList.size()==0){
this.rankTopics();
}
return rankTopicList;
}
public List<TopicRankQo> getRankTopicListTop4() {
if (this.rankTopicList.size()==0){
this.rankTopics();
}
return rankTopicListTop4;
}
public List<ThemeAnalysDO> getRankThemeList(String topicId) {
if (this.rankThemeList.size()==0){
this.rankThemes();
}
return rankThemeList.stream().filter(o->o.getTopicId().equals(topicId)).collect(Collectors.toList());
}
} }
...@@ -41,14 +41,17 @@ public class VisitSummaryService { ...@@ -41,14 +41,17 @@ public class VisitSummaryService {
public Integer queryThemeVisit(String theme) { public Integer queryThemeVisit(String theme) {
return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>() return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>()
.eq(VisitSummaryEntity::getRefId, theme) .eq(VisitSummaryEntity::getRefId, theme)
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.TOPIC_PAGE_VIEW.getCode())); .eq(VisitSummaryEntity::getRefType, VisitTypeEnum.THEME_PAGE_VIEW.getCode()));
} }
// 查询主题 浏览量 // 查询主题 浏览量
public Integer queryThemeVisit(List<String> themes) { public Integer queryThemeVisit(List<String> themes) {
if (CollectionUtils.isEmpty(themes)){
return 0;
}
return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>() return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>()
.in(VisitSummaryEntity::getRefId, themes) .in(VisitSummaryEntity::getRefId, themes)
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.TOPIC_PAGE_VIEW.getCode())); .eq(VisitSummaryEntity::getRefType, VisitTypeEnum.THEME_PAGE_VIEW.getCode()));
} }
// 更新访问时长 // 更新访问时长
......
...@@ -9,6 +9,7 @@ import com.tanpu.community.api.beans.vo.TopicDTO; ...@@ -9,6 +9,7 @@ import com.tanpu.community.api.beans.vo.TopicDTO;
import com.tanpu.community.api.beans.qo.*; import com.tanpu.community.api.beans.qo.*;
import com.tanpu.community.api.beans.req.theme.CreateThemeReq; import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeContentReq; import com.tanpu.community.api.beans.req.theme.ThemeContentReq;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew;
import com.tanpu.community.api.enums.DeleteTagEnum; import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.RelTypeEnum; import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.api.enums.TopicStatusEnum; import com.tanpu.community.api.enums.TopicStatusEnum;
...@@ -20,7 +21,6 @@ import org.springframework.util.StringUtils; ...@@ -20,7 +21,6 @@ import org.springframework.util.StringUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.time.temporal.TemporalField;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -102,17 +102,17 @@ public class ConvertUtil { ...@@ -102,17 +102,17 @@ public class ConvertUtil {
return topicDTO; return topicDTO;
} }
public static TopicHotQo topicEntityToHotQo(TopicEntity topicEntity) { public static TopicRankQo topicEntityToHotQo(TopicEntity topicEntity) {
TopicHotQo topicHotQo = new TopicHotQo(); TopicRankQo topicRankQo = new TopicRankQo();
BeanUtils.copyProperties(topicEntity, topicHotQo); BeanUtils.copyProperties(topicEntity, topicRankQo);
//2小时内发帖,添加新话题标签 //2小时内发帖,添加新话题标签
if(TimeUtil.calMinuteTillNow(topicEntity.getCreateTime())<120){ if(TimeUtil.calMinuteTillNow(topicEntity.getCreateTime())<120){
topicHotQo.setType(TopicStatusEnum.NEWEST.getCode()); topicRankQo.setType(TopicStatusEnum.NEWEST.getCode());
} }
return topicHotQo; return topicRankQo;
} }
public static List<TopicHotQo> topicEntityToHotQos(List<TopicEntity> topicEntities) { public static List<TopicRankQo> topicEntityToHotQos(List<TopicEntity> topicEntities) {
if (topicEntities==null){ if (topicEntities==null){
return Collections.emptyList(); return Collections.emptyList();
} }
...@@ -247,6 +247,22 @@ public class ConvertUtil { ...@@ -247,6 +247,22 @@ public class ConvertUtil {
.build(); .build();
} }
public static FollowQo userInfoNew2FollowQo(UserInfoNew entity) {
if (entity == null) {
return null;
}
return FollowQo.builder().userId(entity.getUserId())
.nickName(entity.getNickName())
.headImg(entity.getHeadImageUrl())
.introduction(entity.getIntroduction())
.userType(entity.getUserType())
.levelGrade(entity.getLevelGrade())
.userInvestorType(entity.getUserInvestorType())
.belongUserOrgId(entity.getBelongUserOrgId())
.belongUserOrgName(entity.getBelongUserOrgName())
.build();
}
public static FormerThemeQo themeQo2FormerThemeQo(ThemeQo formerTheme) { public static FormerThemeQo themeQo2FormerThemeQo(ThemeQo formerTheme) {
if (formerTheme == null) { if (formerTheme == null) {
return null; return null;
......
package com.tanpu.community.util;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.constant.ErrorCodeConstant;
import com.tencentcloudapi.cms.v20190321.CmsClient;
import com.tencentcloudapi.cms.v20190321.models.ImageModerationRequest;
import com.tencentcloudapi.cms.v20190321.models.ImageModerationResponse;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.tms.v20200713.TmsClient;
import com.tencentcloudapi.tms.v20200713.models.TextModerationRequest;
import com.tencentcloudapi.tms.v20200713.models.TextModerationResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Base64;
/**
* 腾讯云工具类
*/
@Slf4j
@Configuration
public class TencentcloudUtils {
/**
* 腾讯云的SecretId
*/
private static String secretId;
/**
* 腾讯云的SecretKey
*/
private static String secretKey;
/**
* 腾讯云地区
*/
private static String region;
private static TmsClient tmsClient;
private static CmsClient cmsClient;
@Value("${tencent.cloud.secretId}")
public void setSecretId(String secretId) {
TencentcloudUtils.secretId = secretId;
}
@Value("${tencent.cloud.secretKey}")
public void setSecretKey(String secretKey) {
TencentcloudUtils.secretKey = secretKey;
}
@Value("${tencent.cloud.region}")
public void setRegion(String region) {
TencentcloudUtils.region = region;
}
public static TmsClient getTmsClient() {
if (tmsClient == null) {
tmsClient = new TmsClient(new Credential(secretId, secretKey), region);
}
return tmsClient;
}
public static CmsClient getCmsClient() {
if (cmsClient == null) {
cmsClient = new CmsClient(new Credential(secretId, secretKey), region);
}
return cmsClient;
}
/**
* 文本内容安全
*
* @param text
* @return
*/
public static CommonResp textModeration(String text) {
TextModerationRequest req = new TextModerationRequest();
req.setContent(Base64.getEncoder().encodeToString(text.getBytes(StandardCharsets.UTF_8)));
TextModerationResponse res = null;
try {
res = getTmsClient().TextModeration(req);
// suggestion Block 不通过
if (res.getSuggestion().equals("Block")) {
// TODO: 2021/7/20
return CommonResp.error();
// return CommonResp.error(CommonResp.CONTENT_ILLEGAL, getTextLabel(res.getLabel(), res.getKeywords()));
}
} catch (TencentCloudSDKException e) {
log.error("调用腾文本内容安全异常");
e.printStackTrace();
return CommonResp.failed("文本检查异常");
}
return CommonResp.success();
}
/**
* 图片内容检测
*
* @param imageUrl
* @return
*/
public static CommonResp imageModeration(String imageUrl) {
ImageModerationRequest req = new ImageModerationRequest();
req.setFileUrl(imageUrl);
ImageModerationResponse res = null;
try {
res = getCmsClient().ImageModeration(req);
if (res.getData() != null && res.getData().getEvilType() != 100) {
return CommonResp.error(ErrorCodeConstant.CONTENT_ILLEGAL, getImageLabel(res.getData().getEvilType()));
}
} catch (TencentCloudSDKException e) {
log.error("调用腾讯图片内容检测异常");
e.printStackTrace();
return CommonResp.failed("图片检查异常");
}
return CommonResp.success();
}
public static void main(String[] args) {
final Base64.Encoder encoder = Base64.getEncoder();
Credential cred = new Credential("AKIDTjjV2IhK4ZKBm8z5g14vPedNSJuFnTIq", "PaVBZfeQwDVXKr7TZOzM6c9VZNwGJGyA");
TmsClient client = new TmsClient(cred, "ap-shanghai");
CmsClient cmsClient = new CmsClient(cred, "ap-shanghai");
TextModerationRequest req = new TextModerationRequest();
req.setContent(encoder.encodeToString("卖毒品".getBytes(StandardCharsets.UTF_8)));
ImageModerationRequest imgReq = new ImageModerationRequest();
imgReq.setFileUrl("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.08lr.cn%2Fuploads%2Fallimg%2F170513%2F1-1F513164126.jpg&refer=http%3A%2F%2Fwww.08lr.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1617540249&t=2506e9bd61a31ea3bf89d07f4fe49744");
try {
TextModerationResponse res = client.TextModeration(req);
ImageModerationResponse imgRes = cmsClient.ImageModeration(imgReq);
System.out.println(Arrays.toString(res.getKeywords()));
System.out.println(imgRes.getData());
} catch (Exception e) {
e.printStackTrace();
}
}
public static String getTextLabel(String label, String[] keywords) {
StringBuilder message = new StringBuilder("该内容包含");
if (label.equals("Porn")) {
message.append("色情");
} else if (label.equals("Abuse")) {
message.append("谩骂");
} else if (label.equals("Ad")) {
message.append("广告");
} else if (label.equals("Polity")) {
message.append("政治");
} else if (label.equals("Illegal")) {
message.append("违法");
}
message.append("等敏感词");
if (keywords != null && keywords.length > 0) {
message.append(" ");
message.append(Arrays.toString(keywords));
}
return message.toString();
}
public static String getImageLabel(Long label) {
StringBuilder message = new StringBuilder("该图片可能包含");
if (label.equals(20002)) {
message.append("色情");
} else if (label.equals(20007)) {
message.append("谩骂");
} else if (label.equals(20001) || label.equals(24001)) {
message.append("政治");
} else if (label.equals(20006)) {
message.append("违法");
} else if (label.equals(20103)) {
message.append("性感");
}
message.append("敏感内容");
return message.toString();
}
}
apollo.bootstrap.enabled: false apollo.bootstrap.enabled: false
#app.id: tanpu-community #app.id: tanpu-community
...@@ -98,3 +97,9 @@ es: ...@@ -98,3 +97,9 @@ es:
port: 9200 port: 9200
userName: 1 userName: 1
userPasswd: 2 userPasswd: 2
tencent:
cloud:
secretId: AKIDTjjV2IhK4ZKBm8z5g14vPedNSJuFnTIq
secretKey: PaVBZfeQwDVXKr7TZOzM6c9VZNwGJGyA
region: ap-shanghai
\ No newline at end of file
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
<result column="theme_id" property="themeId" /> <result column="theme_id" property="themeId" />
<result column="parent_id" property="parentId" /> <result column="parent_id" property="parentId" />
<result column="reply_id" property="replyId" /> <result column="reply_id" property="replyId" />
<result column="is_block" property="isBlock" /> <result column="is_pass" property="isPass" />
<result column="report_status" property="reportStatus" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" /> <result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" /> <result column="delete_tag" property="deleteTag" />
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tanpu.community.dao.mapper.community.ReportLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.ReportLogEntity">
<id column="id" property="id" />
<result column="user_id" property="userId" />
<result column="report_type" property="reportType" />
<result column="target_id" property="targetId" />
<result column="target_user_id" property="targetUserId" />
<result column="report_time" property="reportTime" />
<result column="deal_result" property="dealResult" />
<result column="deal_user_id" property="dealUserId" />
<result column="deal_time" property="dealTime" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
</mapper>
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
<result column="author_id" property="authorId" /> <result column="author_id" property="authorId" />
<result column="former_theme_id" property="formerThemeId" /> <result column="former_theme_id" property="formerThemeId" />
<result column="topic_id" property="topicId" /> <result column="topic_id" property="topicId" />
<result column="is_pass" property="isPass" />
<result column="report_status" property="reportStatus" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" /> <result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" /> <result column="delete_tag" property="deleteTag" />
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.user.UserInfoEntity"> <resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.user.UserInfoEntity">
<id column="id" property="id" /> <id column="id" property="id" />
<result column="user_type" property="userType" />
<result column="ui_openid" property="uiOpenid" /> <result column="ui_openid" property="uiOpenid" />
<result column="ui_unionId" property="uiUnionid" /> <result column="ui_unionId" property="uiUnionid" />
<result column="ui_telphone" property="uiTelphone" /> <result column="ui_telphone" property="uiTelphone" />
......
...@@ -168,3 +168,21 @@ CREATE TABLE `visit_summary` ( ...@@ -168,3 +168,21 @@ CREATE TABLE `visit_summary` (
INDEX `idx_visitor` (`visitor_id`), INDEX `idx_visitor` (`visitor_id`),
INDEX `idx_author` (`author_id`) INDEX `idx_author` (`author_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='浏览记录'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='浏览记录';
CREATE TABLE `report_log` (
`id` int(32) auto_increment PRIMARY KEY COMMENT 'id',
`user_id` varchar(64) NOT NULL COMMENT '举报发起人',
`report_type` int(4) NOT NULL COMMENT '举报类型,1:主题,2:评论 3、用户',
`target_id` varchar(64) NOT NULL COMMENT '举报对象id',
`target_user_id` varchar(64) NOT NULL COMMENT '举报对象作者id',
`report_time` datetime NOT NULL COMMENT '上报时间',
`deal_result` int(4) COMMENT '处理结果 0:无操作 1:屏蔽 2:删除 ',
`deal_user_id` int(4) COMMENT '处理管理员',
`deal_time` datetime 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',
INDEX `uk_user` (`user_id`),
INDEX `uk_report_target_id` (`target_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='举报记录';
\ 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