Commit 27a98eb2 authored by 张辰's avatar 张辰

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

# Conflicts:
#	community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
#	community-service/src/main/java/com/tanpu/community/cache/RedisCache.java
#	community-service/src/main/java/com/tanpu/community/service/ThemeService.java
parents c36d9d45 c6557a6e
......@@ -10,7 +10,7 @@ public final class CommunityConstant {
public static final String PACKAGE_BASE = "com.tanpu.community";
public static final String OSS_PREFIX_URL ="https://tamp-sit.oss-cn-shanghai.aliyuncs.com/";
public static final String OSS_PREFIX_URL ="http://tamperfeodev.oss-cn-shanghai.aliyuncs.com/";
@Value("${aliyun.oss.bucketName}")
public String OSS_BUCKET_NAME;
......
package com.tanpu.community.api.beans.qo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class MyCommentThemeQo extends ThemeQo{
@ApiModelProperty(value = "评论内容")
private String comment;
}
package com.tanpu.community.api.beans.qo;
import io.swagger.annotations.ApiModelProperty;
public class ThemeAnalysDO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "UUID")
private String themeId;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "类型")
private Integer themeType;
@ApiModelProperty(value = "文本内容")
private String content;
@ApiModelProperty(value = "作者id")
private String authorId;
@ApiModelProperty(value = "被转发的主题")
private String formerThemeId;
@ApiModelProperty(value = "所属的话题")
private String topicId;
@ApiModelProperty(value = "转发量")
private Integer forwardCount;
@ApiModelProperty(value = "评论量")
private Integer commentCount;
@ApiModelProperty(value = "点赞量")
private Integer likeCount;
@ApiModelProperty(value = "距今时间")
private Long timeTillNow;
}
......@@ -17,7 +17,7 @@ import java.util.List;
@NoArgsConstructor
public class ThemeContentQo {
@ApiModelProperty(value = "RelTypeEnum类型,8:文本,88:产品 3:直播 6:短视频 2:课程,9:图片 10:多图(讨论)")
@ApiModelProperty(value = "RelTypeEnum类型,108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,新版课程-音频,109:单图(长文) 110:多图(讨论)")
private String type;
@ApiModelProperty(value = "文本的值是内容,附件的值为id")
......
......@@ -51,11 +51,17 @@ public class ThemeQo implements Serializable {
@ApiModelProperty(value = "用户头像")
public String userImg;
@ApiModelProperty(value = "用户简介")
private String userIntroduction;
@ApiModelProperty(value = "当前用户是否关注该作者")
public boolean follow;
@ApiModelProperty(value = "作者认证")
public String authLabel;
private Integer authLabel;
@ApiModelProperty(value = "认证机构")
private String authOrg;
@ApiModelProperty(value = "发表时间")
public String upToNowTime;
......@@ -75,6 +81,9 @@ public class ThemeQo implements Serializable {
@ApiModelProperty(value = "当前用户是否转发")
public boolean hasForward;
@ApiModelProperty(value = "当前用户是否收藏")
private boolean hasCollect;
@ApiModelProperty(value = "图片九宫格")
public List<ImagesDTO> imgList;
......
......@@ -16,4 +16,18 @@ public class TopicHotQo {
@ApiModelProperty(value = "类型 1:热 2:新")
private Integer type;
@ApiModelProperty(value = "阅读量")
private Integer viewCount;
@ApiModelProperty(value = "讨论量")
private Integer disscussCount;
/**
* TODO 热度计算算法
* @return
*/
public Integer getRank(){
return this.viewCount+this.disscussCount*5;
}
}
package com.tanpu.community.api.beans.req;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@Data
public class HomePageReq {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "头像url")
@NotEmpty(message = "头像不能为空")
private String headImg;
@ApiModelProperty(value = "昵称")
@NotEmpty(message = "用户昵称不能为空")
private String nickName;
@ApiModelProperty(value = "个人简介")
@NotEmpty(message = "个人简介不能为空")
private String introduction;
@ApiModelProperty(value = "性别")
private Integer sex;
@ApiModelProperty(value = "地址")
private String location;
}
......@@ -5,19 +5,15 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@ApiModel(value = "评论查询")
@Data
public class QueryCommentReq {
@NotEmpty(message = "主题id不能为空")
@ApiModelProperty(value = "主题Id")
private String themeId;
@NotEmpty(message = "page不能为空")
@ApiModelProperty(value = "分页")
private Pageable page;
}
......@@ -15,4 +15,5 @@ public class ReportThemeReq {
private String reason;
}
package com.tanpu.community.api.beans.req.theme;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
public class ThemeSearchReq {
@ApiModelProperty(value = "搜索关键字")
private String keyword;
@ApiModelProperty(value = "当前浏览的最后一个themeId,可以为空")
private String lastId="";
@NotNull(message = "PageSize不能为空")
@ApiModelProperty(value = "页面大小")
private Integer pageSize;
}
......@@ -7,7 +7,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "创建主题")
@ApiModel(value = "创建主题返回值")
@Data
@Builder
@NoArgsConstructor
......
package com.tanpu.community.api.beans.resp;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.math.BigDecimal;
/**
* @description:
* @author: zejia zj wu
* @create: 2021-07-19 15:47
**/
@Data
@Builder
@ApiModel(description = "客户信息")
public class Customer {
@ApiModelProperty("用户id")
private String userId;//用户id
@ApiModelProperty("姓名")
private String userName;//
@ApiModelProperty("手机号")
private String phone;//
@ApiModelProperty("总资产")
private BigDecimal totalMarket;
}
package com.tanpu.community.api.beans.resp;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "文件上传返回")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FileUploadResp {
@ApiModelProperty(value = "文件id")
private String fileId;
@ApiModelProperty(value = "文件url")
private String url;
@ApiModelProperty(value = "图片高度")
private Integer imgHeight;
@ApiModelProperty(value = "图片宽度")
private Integer imgWidth;
@ApiModelProperty(value = "类型:1:图片")
private Integer fileType;
@ApiModelProperty(value = "文件名称")
private String fileName;
@ApiModelProperty(value = "阿里云key")
private String fileOssKey;
@ApiModelProperty(value = "预签名url")
private String previewUrl;
}
......@@ -19,8 +19,7 @@ public class ImagesDTO {
@ApiModelProperty("关联id")
private String relId;
@ApiModelProperty("图片url")
private String remark;
@ApiModelProperty("图片宽度")
......
package com.tanpu.community.api.beans.vo.feign.fatools;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @description: 用户信息 圈子使用
* @author: zejia zj wu
* @create: 2021-07-15 14:37
**/
@Data
@Builder
@ApiModel(description = "用户信息 圈子使用")
public class UserInfoNew implements Serializable {
@ApiModelProperty("主页等级 1普通主页 2首席投顾主页 3机构主页")
private Integer personalCenterType;
@ApiModelProperty("是否显示关注按钮 0不显示 1显示")
private Integer isShowFollowButton;
@ApiModelProperty("关注按钮状态 0未关注 1已关注")
private Integer showFollowStatus;
@ApiModelProperty("粉丝数")
private Integer fansNumber = 0;
@ApiModelProperty("关注数")
private Integer followNumber = 0;
@ApiModelProperty("课程数")
private Integer courseNumber = 0;
@ApiModelProperty("基金数")
private Integer fundNumber = 0;
@ApiModelProperty("成立时间")
private long founded;
@ApiModelProperty("备案编号")
private String recordNumber = "-";
@ApiModelProperty("团队成员")
private List<UserInfoOrg> userInfoOrgList;
//↓↓↓↓ 通用 ↓↓↓↓
@ApiModelProperty("用户id")
private String userId;//用户id
@ApiModelProperty("昵称")
private String nickName;//昵称
@ApiModelProperty("地址")
private String address;//地址
@ApiModelProperty("性别 0:男 1:女")
private String gender;//性别 0:男 1:女
@ApiModelProperty("个人简介")
private String introduction;//个人简介
@ApiModelProperty("头像")
private String headImageUrl;//头像
@ApiModelProperty("全新用户等级体系 详见 UserLevelEnum")
private Integer levelGrade;
@ApiModelProperty("当levelGrade=10有值 1投资萌新 2投资达人")
private String userInvestorType;
@ApiModelProperty("用户类型 1普通账号 2机构账号 3机构人员")
private Integer userType;
@ApiModelProperty("专家投顾 认证信息")
private String certInfo;
// 机构人员
@ApiModelProperty("认证职位")
private String certPosition;
@ApiModelProperty("名片是否已通过上传(是否展示工作室入口) 0不通过 1通过")
private Integer ocrStatus;
@ApiModelProperty("所属机构id")
private String belongUserOrgId;
@ApiModelProperty("所属机构名")
private String belongUserOrgName;
//工作室相关
@ApiModelProperty("工作室名")
private String workshopName;//工作室名
@ApiModelProperty("工作室简介")
private String workshopIntroduction;//工作室简介
//↓↓↓↓↓首席投顾↓↓↓↓↓↓
@ApiModelProperty(value = "姓名")
private String userName;
@ApiModelProperty(value = "头像背图url")
private String backImageUrl;
@ApiModelProperty(value = "是否展示专访视频 0不展示 1展示")
private Integer interviewVideoIsShow;
@ApiModelProperty(value = "专访视频 标题")
private String interviewVideoTitle;
@ApiModelProperty(value = "专访视频 url")
private String interviewVideoUrl;
@ApiModelProperty(value = "个人简介")
private String personalProfile;
@ApiModelProperty(value = "管理规模")
private String managementScale;
@ApiModelProperty(value = "从业年限 (单位:年)")
private String workingYears;
@ApiModelProperty(value = "投资理念")
private String investmentPhilosophy;
@ApiModelProperty(value = "擅长领域")
private String areasOfExpertise;
@ApiModelProperty(value = "证书 json")
private String credentials;
@ApiModelProperty(value = "成功案例客户id")
private String clientId;
//↓↓↓↓ 机构 ↓↓↓↓
@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;
}
\ No newline at end of file
package com.tanpu.community.api.beans.vo.feign.fatools;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
/**
* @description: 机构人员信息
* @author: zejia zj wu
* @create: 2021-07-18 20:06
**/
@Data
@Builder
@ApiModel(description = "用户信息 机构人员信息")
public class UserInfoOrg {
@ApiModelProperty("用户id")
private String userId;//用户id
@ApiModelProperty("昵称")
private String nickName;//昵称
@ApiModelProperty("个人简介")
private String introduction;//个人简介
@ApiModelProperty("头像")
private String headImageUrl;//头像
@ApiModelProperty("认证职位")
private String certPosition;
@ApiModelProperty("是否已关注 0未关注 1已关注")
private Integer isFollower = 0;
}
......@@ -5,7 +5,8 @@ public enum ThemeTypeEnum {
DISCUSSION(1,"讨论无标题"),
LONG_TEXT(2,"长文有标题"),
FORWARD(3,"转发");
FORWARD(3,"转发"),
RES_COMMENT(4,"回复,仅回显数据使用");
private Integer code;
private String type;
......
......@@ -2,7 +2,8 @@ package com.tanpu.community.api.enums;
public enum VisitTypeEnum {
TOPIC_PAGE_VIEW(1,"进入话题页"),
THEME_PAGE_VIEW(2,"进入主题正文");
THEME_PAGE_VIEW(2,"进入主题正文"),
FOLLOW_THEME_VIEW(3,"查看关注主题");
private Integer code;
private String type;
......
package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.constant.ErrorCodeConstant;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.api.beans.resp.FileUploadResp;
import com.tanpu.community.manager.FileManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
@RestController
@Slf4j
@RequestMapping(value = "/api/file")
......@@ -22,7 +18,7 @@ public class FileController {
@PostMapping("/uploadFile")
@ResponseBody
public CommonResp<FileRecordEntity> uploadToRemote(@RequestParam(value = "file") MultipartFile file) {
public CommonResp<FileUploadResp> uploadToRemote(@RequestParam(value = "file") MultipartFile file) {
return CommonResp.success(fileManager.uploadFile(file));
}
}
......@@ -5,11 +5,12 @@ import com.tanpu.common.auth.AuthLogin;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.community.api.beans.qo.FollowQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.HomePageReq;
import com.tanpu.community.api.beans.req.homepage.FollowRelReq;
import com.tanpu.community.api.beans.req.homepage.QueryFollowReq;
import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.resp.Customer;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew;
import com.tanpu.community.manager.HomePageManager;
import com.tanpu.community.manager.ThemeManager;
import io.swagger.annotations.ApiOperation;
......@@ -35,15 +36,25 @@ public class HomePageController {
@Resource
private UserHolder userHolder;
@PostMapping(value = "/editInfo")
@ApiOperation("编辑圈子个人资料")
@ResponseBody
public CommonResp<String> editUserInfo(@Validated @RequestBody HomePageReq req){
String userId="liujm";
// homePageManager.editUserInfo(req,userId);
return CommonResp.success("修改成功");
// 用户信息查询 (供圈子服务调用)
@ApiOperation(value = "个人中心 查询")
@GetMapping(value = "/queryUserInfoNew")
@AuthLogin
public CommonResp<UserInfoNew> queryUsersListNew(@RequestParam("userId") String userId){
String userIdMyself = userHolder.getUserId();
return CommonResp.success(homePageManager.queryUsersListNew(userIdMyself,userId));
}
// 理财师客户列表查询 (供圈子服务调用)
@ApiOperation(value = "个人中心 理财师客户列表查询")
@GetMapping(value = "/queryUserCustomerList")
@AuthLogin
public CommonResp<List<Customer>> queryUserCustomerList(){
String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryUserCustomerList(userId));
}
@PostMapping(value = "/followList")
@ApiOperation("查询关注/粉丝列表")
@ResponseBody
......@@ -71,13 +82,4 @@ public class HomePageController {
return CommonResp.success(themeManager.queryThemesByUser(req,userId));
}
// @PostMapping(value = "/commentThemeList")
// @ApiOperation("用户评论过的帖子列表")
// @ResponseBody
// public CommonResp<List<ThemeQo>> commentThemeList(@RequestBody QueryRecordThemeReq req){
// String userId="123";
//
// return CommonResp.success(themeManager.queryThemesByUser(req,userId));
// }
}
......@@ -30,10 +30,17 @@ public class MetricsController {
@ApiOperation("浏览主题")
@GetMapping("/view/theme")
public CommonResp pageViewTheme(@RequestParam String themeId){
visitSummaryManager.addThemePageView(themeId);
visitSummaryManager.addFollowThemeView(themeId);
return CommonResp.success();
}
@AuthLogin
@ApiOperation("浏览关注主题")
@GetMapping("/view/follow")
public CommonResp pageViewTheme(){
visitSummaryManager.addFollowThemeView();
return CommonResp.success();
}
}
......@@ -35,9 +35,6 @@ public class ThemeController {
@ResponseBody
public CommonResp<CreateThemeResp> publishTheme(@Validated @RequestBody CreateThemeReq req) {
String userId = userHolder.getUserId();
if(StringUtils.isEmpty(userId)){
throw new BizException("用户为空");
}
return CommonResp.success(themeManager.publishTheme(req, userId));
}
......@@ -54,6 +51,16 @@ public class ThemeController {
return CommonResp.success(result);
}
@AuthLogin
@ApiOperation("主题搜索")
@PostMapping(value = "/search")
@ResponseBody
public CommonResp<List<ThemeQo>> searchInterestList(@Validated @RequestBody ThemeSearchReq req) {
String userId = userHolder.getUserId();
List<ThemeQo> result = themeManager.searchThemes(req, userId);
return CommonResp.success(result);
}
@AuthLogin
@ApiOperation("主题正文")
@GetMapping(value = "/detail")
......@@ -68,10 +75,9 @@ public class ThemeController {
@ApiOperation("转发主题")
@PostMapping(value = "/forward")
@ResponseBody
public CommonResp forwardTheme(@Validated @RequestBody ForwardThemeReq forwardThemeReq) {
public CommonResp<CreateThemeResp> forwardTheme(@Validated @RequestBody ForwardThemeReq forwardThemeReq) {
String userId = userHolder.getUserId();
themeManager.forward(forwardThemeReq, userId);
return CommonResp.success();
return CommonResp.success(themeManager.forward(forwardThemeReq, userId));
}
@AuthLogin
......@@ -130,4 +136,13 @@ public class ThemeController {
return CommonResp.success();
}
@AuthLogin
@ApiOperation("关注主题更新数量")
@GetMapping(value = "/updateCount")
@ResponseBody
public CommonResp<Integer> updateCount() {
String userId = userHolder.getUserId();
return CommonResp.success(themeManager.getFollowUpdateCount(userId));
}
}
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.fund", sqlSessionTemplateRef = "fundSqlSessionTemplate")
public class FundDataSourceConfig {
@ConfigurationProperties(prefix = "spring.datasource.fund")
@Bean(name = "fundDataSource")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "fundSqlSessionFactory")
public SqlSessionFactory sqlSessionFactory(@Qualifier("fundDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(
"classpath*:mapper/fund/*.xml"));
return bean.getObject();
}
@Bean(name = "fundTransactionManager")
public DataSourceTransactionManager fundTransactionManager(@Qualifier("fundDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean(name = "fundSqlSessionTemplate")
public SqlSessionTemplate fundSqlSessionTemplate(@Qualifier("fundSqlSessionFactory") 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.jydb", sqlSessionTemplateRef = "jydbSqlSessionTemplate")
public class JydbDataSourceConfig {
@ConfigurationProperties(prefix = "spring.datasource.jydb")
@Bean(name = "jydbDataSource")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "jydbSqlSessionFactory")
public SqlSessionFactory sqlSessionFactory(@Qualifier("jydbDataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(
"classpath*:mapper/jydb/*.xml"));
return bean.getObject();
}
@Bean(name = "jydbTransactionManager")
public DataSourceTransactionManager jydbTransactionManager(@Qualifier("jydbDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean(name = "jydbSqlSessionTemplate")
public SqlSessionTemplate jydbSqlSessionTemplate(@Qualifier("jydbSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
......@@ -3,7 +3,6 @@ package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tanpu.community.api.CommunityConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -58,7 +57,7 @@ public class FileRecordEntity implements Serializable {
private String extInfo;
public String getUrl(){
return CommunityConstant.OSS_PREFIX_URL+ fileOssKey;
return getPreviewUrl().substring(0,getPreviewUrl().indexOf("?"));
}
......
......@@ -16,12 +16,12 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-19
*/
@TableName("visit_summary")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel(value="VisitSummaryEntity对象", description="浏览记录")
public class VisitSummaryEntity implements Serializable {
......@@ -42,18 +42,14 @@ public class VisitSummaryEntity implements Serializable {
@ApiModelProperty(value = "关联目标ID")
private String refId;
@ApiModelProperty(value = "关联目标类型")
@ApiModelProperty(value = "关联目标类型 1:进入话题页 2:进入主题正文 3、用户查看首页-关注")
private Integer refType;
@ApiModelProperty(value = "浏览时间 单位秒")
private Integer duration;
private String createBy;
private LocalDateTime createTime;
private String updateBy;
private LocalDateTime updateTime;
private Integer deleteTag;
......@@ -115,14 +111,6 @@ public class VisitSummaryEntity implements Serializable {
this.duration = duration;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
......@@ -131,14 +119,6 @@ public class VisitSummaryEntity implements Serializable {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
......@@ -165,9 +145,7 @@ public class VisitSummaryEntity implements Serializable {
", refId=" + refId +
", refType=" + refType +
", duration=" + duration +
", createBy=" + createBy +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
......
package com.tanpu.community.dao.entity.jydb;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Builder;
import lombok.Data;
@ApiModel(value="com-tanpu-community-dao-entity-jydb-MfInvestadvisoroutline")
@Data
@Builder
@TableName(value = "mf_investadvisoroutline")
public class MfInvestadvisoroutline implements Serializable {
/**
* ID
*/
@TableField(value = "ID")
@ApiModelProperty(value="ID")
private Long id;
/**
* 基金公司代码
*/
@TableField(value = "InvestAdvisorCode")
@ApiModelProperty(value="基金公司代码")
private Integer investadvisorcode;
/**
* 基金管理人名称
*/
@TableField(value = "InvestAdvisorName")
@ApiModelProperty(value="基金管理人名称")
private String investadvisorname;
/**
* 基金管理人简称
*/
@TableField(value = "InvestAdvisorAbbrName")
@ApiModelProperty(value="基金管理人简称")
private String investadvisorabbrname;
/**
* 法人代表
*/
@TableField(value = "LegalRepr")
@ApiModelProperty(value="法人代表")
private String legalrepr;
/**
* 总经理
*/
@TableField(value = "GeneralManager")
@ApiModelProperty(value="总经理")
private String generalmanager;
/**
* 公司成立日期
*/
@TableField(value = "EstablishmentDate")
@ApiModelProperty(value="公司成立日期")
private Date establishmentdate;
/**
* 组织形式
*/
@TableField(value = "OrganizationForm")
@ApiModelProperty(value="组织形式")
private String organizationform;
/**
* 注册资本(元)
*/
@TableField(value = "RegCapital")
@ApiModelProperty(value="注册资本(元)")
private BigDecimal regcapital;
/**
* 公司注册地址
*/
@TableField(value = "RegAddr")
@ApiModelProperty(value="公司注册地址")
private String regaddr;
/**
* 公司办公地址
*/
@TableField(value = "OfficeAddr")
@ApiModelProperty(value="公司办公地址")
private String officeaddr;
/**
* 邮编
*/
@TableField(value = "ZipCode")
@ApiModelProperty(value="邮编")
private String zipcode;
/**
* 邮箱
*/
@TableField(value = "Email")
@ApiModelProperty(value="邮箱")
private String email;
/**
* 公司联系地址
*/
@TableField(value = "ContactAddr")
@ApiModelProperty(value="公司联系地址")
private String contactaddr;
/**
* 电话
*/
@TableField(value = "Tel")
@ApiModelProperty(value="电话")
private String tel;
/**
* 传真
*/
@TableField(value = "Fax")
@ApiModelProperty(value="传真")
private String fax;
/**
* 公司网址
*/
@TableField(value = "WebSite")
@ApiModelProperty(value="公司网址")
private String website;
/**
* 联系人
*/
@TableField(value = "LinkMan")
@ApiModelProperty(value="联系人")
private String linkman;
/**
* 简历
*/
@TableField(value = "Background")
@ApiModelProperty(value="简历")
private String background;
/**
* 所属地区
*/
@TableField(value = "Region")
@ApiModelProperty(value="所属地区")
private Integer region;
/**
* 修改日期
*/
@TableField(value = "XGRQ")
@ApiModelProperty(value="修改日期")
private Date xgrq;
/**
* JSID
*/
@TableField(value = "JSID")
@ApiModelProperty(value="JSID")
private Long jsid;
/**
* 客服热线
*/
@TableField(value = "ServiceLine")
@ApiModelProperty(value="客服热线")
private String serviceline;
/**
* 存续截止日
*/
@TableField(value = "MaturityEndDate")
@ApiModelProperty(value="存续截止日")
private Date maturityenddate;
/**
* 注册登记代码
*/
@TableField(value = "TACode")
@ApiModelProperty(value="注册登记代码")
private String tacode;
/**
* 证监会标识码
*/
@TableField(value = "CSRCCode")
@ApiModelProperty(value="证监会标识码")
private String csrccode;
private static final long serialVersionUID = 1L;
public static final String COL_ID = "ID";
public static final String COL_INVESTADVISORCODE = "InvestAdvisorCode";
public static final String COL_INVESTADVISORNAME = "InvestAdvisorName";
public static final String COL_INVESTADVISORABBRNAME = "InvestAdvisorAbbrName";
public static final String COL_LEGALREPR = "LegalRepr";
public static final String COL_GENERALMANAGER = "GeneralManager";
public static final String COL_ESTABLISHMENTDATE = "EstablishmentDate";
public static final String COL_ORGANIZATIONFORM = "OrganizationForm";
public static final String COL_REGCAPITAL = "RegCapital";
public static final String COL_REGADDR = "RegAddr";
public static final String COL_OFFICEADDR = "OfficeAddr";
public static final String COL_ZIPCODE = "ZipCode";
public static final String COL_EMAIL = "Email";
public static final String COL_CONTACTADDR = "ContactAddr";
public static final String COL_TEL = "Tel";
public static final String COL_FAX = "Fax";
public static final String COL_WEBSITE = "WebSite";
public static final String COL_LINKMAN = "LinkMan";
public static final String COL_BACKGROUND = "Background";
public static final String COL_REGION = "Region";
public static final String COL_XGRQ = "XGRQ";
public static final String COL_JSID = "JSID";
public static final String COL_SERVICELINE = "ServiceLine";
public static final String COL_MATURITYENDDATE = "MaturityEndDate";
public static final String COL_TACODE = "TACode";
public static final String COL_CSRCCODE = "CSRCCode";
}
\ No newline at end of file
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-07-07
* @since 2021-07-19
*/
public interface VisitSummaryMapper extends BaseMapper<VisitSummaryEntity> {
......
package com.tanpu.community.dao.mapper.fund;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanpu.community.dao.entity.fund.CompanyInfo;
public interface CompanyInfoMapper extends BaseMapper<CompanyInfo> {
}
\ No newline at end of file
package com.tanpu.community.dao.mapper.fund;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanpu.community.dao.entity.fund.FundInfo;
public interface FundInfoMapper extends BaseMapper<FundInfo> {
}
\ No newline at end of file
package com.tanpu.community.dao.mapper.jydb;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanpu.community.dao.entity.jydb.MfAdvisorscalerank;
public interface MfAdvisorscalerankMapper extends BaseMapper<MfAdvisorscalerank> {
}
\ No newline at end of file
package com.tanpu.community.dao.mapper.jydb;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanpu.community.dao.entity.jydb.MfInvestadvisoroutline;
public interface MfInvestadvisoroutlineMapper extends BaseMapper<MfInvestadvisoroutline> {
}
\ No newline at end of file
......@@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
//@FeignClient(value = "service-course", contextId = "course", fallbackFactory = FeignBackClientForProducts.class, url = "${tamp-course-order-svc:}")
@FeignClient(value = "service-course", contextId = "course", fallbackFactory = FeignBackClientForProducts.class, url = "http://172.20.1.249:8060/course")
//@FeignClient(value = "service-course", contextId = "course", fallbackFactory = FeignBackClientForCourse.class, url = "${tamp-course-order-svc:}")
@FeignClient(value = "service-course", contextId = "course", fallbackFactory = FeignBackClientForCourse.class, url = "http://172.20.1.249:8060/course")
public interface FeignClientForCourse {
......
package com.tanpu.community.feign.diagnose;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.resp.Customer;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
@Slf4j
@Component
public class FeignBackClientForDiagnose implements FallbackFactory<FeignClientForDiagnose> {
@Override
public FeignClientForDiagnose create(Throwable throwable) {
return new FeignClientForDiagnose() {
@Override
public CommonResp<List<Customer>> getIfaCustomerList(String ifaId) {
log.error("请求信息", throwable);
log.error("FeignClientForDiagnose.getIfaCustomerList-查询理财师客户的id:{}", ifaId);
return CommonResp.failed("getIfaCustomerList");
}
};
}
}
package com.tanpu.community.feign.diagnose;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.resp.Customer;
import com.tanpu.community.api.beans.vo.feign.course.CourseDetailExt;
import com.tanpu.community.api.beans.vo.feign.course.CoursePackageDetail;
import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp;
import com.tanpu.community.feign.product.FeignBackClientForProducts;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
//@FeignClient(value = "service-diagnose", contextId = "diagnose", fallbackFactory = FeignBackClientForDiagnose.class, url = "${tamp-diagnose-svc:}")
@FeignClient(value = "service-diagnose", contextId = "diagnose", fallbackFactory = FeignBackClientForDiagnose.class, path = "http://172.20.1.249:8201/diagnose")
public interface FeignClientForDiagnose {
@ApiOperation("查询理财师关联客户信息")
@GetMapping("/ifa/customer/simplelist")
CommonResp<List<Customer>> getIfaCustomerList(@ApiParam("理财师ID") @RequestParam("ifaId") String ifaId);
}
package com.tanpu.community.feign.fatools;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.user.FileQueryResp;
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.fatools.UserInfoOrg;
import com.tanpu.community.api.beans.vo.feign.user.FileQueryResp;
import com.tanpu.community.api.beans.vo.feign.user.UserInfoVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -33,4 +35,14 @@ public interface FeignClientForFatools {
@ApiOperation(value = "查询附件")
@GetMapping(value = "/file/queryFileMap")
Map<String, FileQueryResp> queryFileMap(@RequestParam("ids") List<String> ids);
// 用户信息查询 (供圈子服务调用)
@ApiOperation(value = "查询用户信息")
@GetMapping(value = "/queryUserInfoNew")
CommonResp<UserInfoNew> queryUsersListNew(@RequestParam("userId") String userId);
@ApiOperation(value = "根据机构用户id 查询旗下机构用户信息")
@GetMapping(value = "/getUsetInfoByOrgUserId")
CommonResp<List<UserInfoOrg>> getUsetInfoByOrgUserId(@RequestParam("orgUserId") String orgUserId);
}
package com.tanpu.community.feign.fatools;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.user.FileQueryResp;
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.fatools.UserInfoOrg;
import com.tanpu.community.api.beans.vo.feign.user.FileQueryResp;
import com.tanpu.community.api.beans.vo.feign.user.UserInfoVo;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
......@@ -42,6 +44,18 @@ public class FeignbackForFatools implements FallbackFactory<FeignClientForFatool
log.info("FeignbackForFatools.getNotRelaySet", throwable);
return CommonResp.error();
}
@Override
public CommonResp<UserInfoNew> queryUsersListNew(String userId) {
log.info("FeignbackForFatools.queryUsersListNew", throwable);
return CommonResp.error();
}
@Override
public CommonResp<List<UserInfoOrg>> getUsetInfoByOrgUserId(String orgUserId) {
log.info("FeignbackForFatools.getUsetInfoByOrgUserId", throwable);
return CommonResp.error();
}
};
}
......
......@@ -30,6 +30,13 @@ public class FeignBackClientForTanpuroom implements FallbackFactory<FeignClientF
log.error("FeignBackClientForTanpuroom.getShortVideoBaseInfo-查询课程req:{}", req);
return null;
}
@Override
public CommonResp<Integer> myOrderCount(String userId) {
log.error("请求信息", throwable);
log.error("FeignBackClientForTanpuroom.myOrderCount-userId:{}", userId);
return null;
}
};
}
}
......@@ -5,6 +5,7 @@ import com.tanpu.community.api.beans.vo.feign.course.CurriCulumInfoDetailDto;
import com.tanpu.community.api.beans.vo.feign.course.CurriculumDetailVo;
import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -25,4 +26,8 @@ public interface FeignClientForTanpuroom {
@ApiOperation(value = "查询精品课详情")
@PostMapping(value = "/curriculumInfos/detail", produces = {"application/json"})
CommonResp<CurriculumDetailVo> queryCurriculumDetail(@RequestBody CurriCulumInfoDetailDto req);
@ApiOperation("已购总数")
@GetMapping("/my/order/count")
CommonResp<Integer> myOrderCount(@ApiParam(value = "userId", required = true) @RequestParam("userId") String userId);
}
......@@ -2,8 +2,10 @@ package com.tanpu.community.manager;
import com.tanpu.common.constant.ErrorCodeConstant;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.resp.FileUploadResp;
import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.service.OSSFileService;
import com.tanpu.community.util.ConvertUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -22,7 +24,7 @@ public class FileManager {
@Autowired
private OSSFileService ossFileService;
public FileRecordEntity uploadFile(MultipartFile file) {
public FileUploadResp uploadFile(MultipartFile file) {
if (file == null) {
throw new BizException(ErrorCodeConstant.FILE_UPLOAD_FAIL);
}
......@@ -39,7 +41,8 @@ public class FileManager {
if (data.length == 0 || StringUtils.isEmpty(originalName)){
throw new BizException("上传文件为空");
}
return ossFileService.uploadFile(data, originalName);
FileRecordEntity fileRecordEntity = ossFileService.uploadFile(data, originalName);
return ConvertUtil.fileRecordEntity2Resp(fileRecordEntity);
}
public Map<String,String> getFileUrlByIds(List<String> fileIds){
......
......@@ -30,6 +30,7 @@ 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.stream.Collectors;
......@@ -56,14 +57,11 @@ public class ThemeManager {
@Autowired
private ThemeAttachmentService themeAttachmentService;
@Autowired
private HomePageService homePageService;
@Resource
private ProductService productService;
@Autowired
private OSSFileService ossFileService;
private VisitSummaryService visitSummaryService;
@Autowired
private ESService esService;
......@@ -91,27 +89,44 @@ public class ThemeManager {
BeanUtils.copyProperties(req, themeEntity);
themeEntity.setAuthorId(userId);
themeEntity.setContent(JsonUtil.toJson(req.getContent()));
if (StringUtils.isEmpty(req.getEditThemeId())) {
//新建
themeService.insertTheme(themeEntity);
} else {
//修改
themeService.update(themeEntity, req.getEditThemeId());
themeEntity.setThemeId(req.getEditThemeId());
}
//保存附件表
List<ThemeAttachmentEntity> themeAttachments = ConvertUtil.themeReqToAttachmentList(req, themeEntity.getThemeId());
if (StringUtils.isNotEmpty(req.getEditThemeId())) {
//修改需要刪除
themeAttachmentService.deleteByThemeId(req.getEditThemeId());
}
themeAttachmentService.insertList(themeAttachments);
return CreateThemeResp.builder().themeId(themeEntity.getThemeId()).build();
}
// 返回推荐主题文章
/**
* 返回主题列表
* @param req
* @param userId
* @return
*/
public List<ThemeQo> queryThemes(ThemeListReq req, String userId) {
List<ThemeEntity> themeEntities = new ArrayList<>();
if (ThemeListTypeEnum.RECOMMEND.getCode().equals(req.getType())) {
// TODO:推荐
themeEntities = themeService.selectAll(req.getLastId(), req.getPageSize());
themeEntities = themeService.selectExcludeUser(userId,req.getLastId(), req.getPageSize());
Set<String> recomondThemeIds;
Set<String> hotThemeIds;
Set<String> newThemeIds;
} else if (ThemeListTypeEnum.FOLLOW.getCode().equals(req.getType())) {
//根据关注列表查询
List<String> fansList = followRelService.queryFansByFollowerId(userId);
......@@ -130,6 +145,13 @@ public class ThemeManager {
return convertEntityToQo(themeEntities, userId);
}
public List<ThemeQo> searchThemes(ThemeSearchReq req, String userId) {
List<ThemeEntity> themeEntities= themeService.search(req.getKeyword(),req.getLastId(), req.getPageSize());
return convertEntityToQo(themeEntities, userId);
}
// 返回用户发布、回复、收藏的主题列表
public List<ThemeQo> queryThemesByUser(QueryRecordThemeReq req, String userId) {
......@@ -173,6 +195,7 @@ public class ThemeManager {
.content(Arrays.asList(commentContent))
.formerTheme(f)
.commentId(commentEntity.getCommentId())
.themeType(ThemeTypeEnum.RES_COMMENT.getCode())
.build();
commentThemeList.add(commentThemeQo);
......@@ -225,9 +248,9 @@ public class ThemeManager {
}
//转发
public void forward(ForwardThemeReq req, String userId) {
public CreateThemeResp forward(ForwardThemeReq req, String userId) {
ThemeEntity targetTheme = themeService.queryByThemeId(req.getFormerThemeId());
ThemeEntity newTheme = ThemeEntity.builder()
ThemeEntity themeEntity = ThemeEntity.builder()
.content(JsonUtil.toJson(req.getContent()))
.topicId(req.getTopicId())
.formerThemeId(req.getFormerThemeId())
......@@ -237,11 +260,14 @@ public class ThemeManager {
if (StringUtils.isEmpty(req.getEditThemeId()) || req.getEditThemeId() == req.getFormerThemeId()) {
//新建
themeService.insertTheme(newTheme);
themeService.insertTheme(themeEntity);
} else {
//修改
themeService.update(newTheme, req.getEditThemeId());
themeService.update(themeEntity, req.getEditThemeId());
themeEntity.setThemeId(req.getEditThemeId());
}
return CreateThemeResp.builder().themeId(themeEntity.getThemeId()).build();
}
......@@ -306,12 +332,15 @@ public class ThemeManager {
//是否转发
Integer forwardCountByUser = themeService.getForwardCountByUser(themeId, userId);
themeQo.setHasForward(forwardCountByUser > 0);
//是否收藏
CollectionEntity collectionEntity = collectionService.getNotDeleteTargetCollection(themeId, userId, CollectionTypeEnum.COLLECT_THEME);
themeQo.setHasCollect(collectionEntity != null);
//点赞,收藏,转发
Integer likeCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME);
Integer bookCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.COLLECT_THEME);
// Integer bookCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.COLLECT_THEME);
Integer commentCount = commentService.getCommentCountByThemeId(themeId);
Integer forwardCount = themeService.getForwardCountById(themeId);
themeQo.setCommentCount(bookCount);
themeQo.setCommentCount(commentCount);
themeQo.setLikeCount(likeCount);
themeQo.setForwardCount(forwardCount);
}
......@@ -322,15 +351,15 @@ public class ThemeManager {
String formerThemeId = themeQo.getFormerThemeId();
if (StringUtils.isNotEmpty(formerThemeId)) {
ThemeQo formerTheme = ConvertUtil.themeEntityToQo2(themeService.queryByThemeId(formerThemeId));
if (formerTheme == null) {
throw new BizException("转发主题Id错误,id:" + formerThemeId);
}
//单个查询详情
// productService.getAttachDetail(formerTheme);
if (formerTheme != null) {
//单个查询详情
productService.getAttachDetail(formerTheme);
FormerThemeQo f = ConvertUtil.themeQo2FormerThemeQo(formerTheme);
themeQo.setFormerTheme(f);
}
}
}
......@@ -344,4 +373,9 @@ public class ThemeManager {
//TODO
}
public Integer getFollowUpdateCount(String userId) {
LocalDateTime lastViewTime = visitSummaryService.queryLatestViewFollow(userId);
List<String> fansList = followRelService.queryFansByFollowerId(userId);
return themeService.queryCountFromLastTime(fansList, lastViewTime);
}
}
......@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Service
public class TopicManager {
......@@ -107,6 +108,18 @@ public class TopicManager {
public List<TopicHotQo> getHotTopicTitles() {
List<TopicEntity> topicEntities = topicService.queryAll();
List<TopicHotQo> topicHotQos = ConvertUtil.topicEntityToHotQos(topicEntities);
for (TopicHotQo topic : topicHotQos) {
List<String> themeIds = themeService.queryThemeIdsByTopic(topic.getTopicId());
//浏览量
Integer topicPV = visitSummaryService.queryTopicDetailVisit(topic.getTopicId());
Integer themePV = visitSummaryService.queryThemeVisit(themeIds);
topic.setViewCount(topicPV + themePV);
//讨论数=发布主题贴数+回复总数
Integer commentCount = commentService.getCommentCountByThemeIds(themeIds);
topic.setDisscussCount(themeIds.size() + commentCount);
}
topicHotQos.stream().collect(Collectors.toMap(TopicHotQo::getRank, o->o));
//TODO 添加类型:热 新 顶
topicHotQos.get(0).setType(1);
topicHotQos.get(2).setType(2);
......
......@@ -22,9 +22,14 @@ public class VisitSummaryManager {
visitSummaryService.addPageView(userId, topicId, VisitTypeEnum.TOPIC_PAGE_VIEW);
}
public void addThemePageView(String themeId) {
public void addFollowThemeView(String themeId) {
String userId = userHolder.getUserId();
visitSummaryService.addPageView(userId, themeId, VisitTypeEnum.TOPIC_PAGE_VIEW);
visitSummaryService.addPageView(userId, themeId, VisitTypeEnum.THEME_PAGE_VIEW);
}
public void addFollowThemeView() {
String userId = userHolder.getUserId();
visitSummaryService.addPageView(userId, userId, VisitTypeEnum.FOLLOW_THEME_VIEW);
}
}
......@@ -49,6 +49,13 @@ public class CommentService {
.size();
}
//统计主题集合的评论量
public Integer getCommentCountByThemeId(String themeId) {
return commentMapper.selectList((new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getThemeId, themeId)))
.size();
}
public Set<String> getCommentUserCount(List<String> themeIds) {
return commentMapper.selectList((new LambdaQueryWrapper<CommentEntity>()
.in(CommentEntity::getThemeId, themeIds)))
......
......@@ -76,11 +76,12 @@ public class OSSFileService {
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+id + "." + suffix;
ossHelper.writeFile(bucketName, key, data, fileSuffix);
//落库
FileRecordEntity record = new FileRecordEntity();
record.setFileId(uuidGenHelper.getUuidStr());
record.setDeleteTag(BizStatus.DeleteTag.tag_init);
......@@ -96,8 +97,10 @@ public class OSSFileService {
fileRecordMapper.insert(record);
return record;
}else {
throw new BizException("文件格式暂不支持:"+suffix);
}
throw new BizException("文件格式中暂不支持");
}
......
......@@ -5,15 +5,15 @@ import com.google.common.collect.Sets;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.enums.fund.ProductTypeEnum;
import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.vo.ImagesDTO;
import com.tanpu.community.api.beans.qo.AttachmentDetailVo;
import com.tanpu.community.api.beans.qo.ThemeContentQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
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.ShortVideoBaseInfoResp;
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.course.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp;
import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp;
import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.dao.entity.community.TopicEntity;
......@@ -225,6 +225,7 @@ public class ProductService {
imgMap.putAll(fileRecordEntities.stream().collect(Collectors
.toMap(FileRecordEntity::getFileId, o -> o)));
}
}
if (!CollectionUtils.isEmpty(topicIds)) {
// 查询话题标题
......@@ -377,6 +378,7 @@ public class ProductService {
if (!StringUtils.isEmpty(themeQo.getAuthorId()) && userMap.containsKey(themeQo.getAuthorId())) {
themeQo.setNickName(userMap.get(themeQo.getAuthorId()).getUiUsernameMp());
themeQo.setUserImg(userMap.get(themeQo.getAuthorId()).getUiHeadimgMp());
themeQo.setUserIntroduction(userMap.get(themeQo.getAuthorId()).getUiIntroductionMp());
}
if (themeQo.getContent() == null) {
continue;
......@@ -415,7 +417,7 @@ public class ProductService {
.product(product).build());
}
} else if (themeContent.getType().equals(RelTypeEnum.SINGLE_IMG.type)) {
//
//单图封装到imglist列表中
if (imgUrlMap.containsKey(themeContent.getValue())) {
FileRecordEntity imgEntity = imgUrlMap.get(themeContent.getValue());
String extInfo = imgEntity.getExtInfo();
......@@ -429,7 +431,7 @@ public class ProductService {
themeContent.setImgList(Collections.singletonList(imagesDTO));
}
}
}else if (themeContent.getType().equals(RelTypeEnum.MULTIPLE_IMAGE.type)) {
} else if (themeContent.getType().equals(RelTypeEnum.MULTIPLE_IMAGE.type)) {
//多图写入图片宽高
List<ImagesDTO> imgList = themeContent.getImgList();
for (ImagesDTO imagesDTO : imgList) {
......
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.dao.entity.community.ThemeAttachmentEntity;
import com.tanpu.community.dao.mapper.community.ThemeAttachmentMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
......@@ -17,14 +18,21 @@ public class ThemeAttachmentService {
public List<ThemeAttachmentEntity> selectByThemeId(String themeId){
return themeAttachmentMapper.selectList(new LambdaQueryWrapper<ThemeAttachmentEntity>()
.eq(ThemeAttachmentEntity::getThemeId,themeId));
.eq(ThemeAttachmentEntity::getThemeId,themeId)
.eq(ThemeAttachmentEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED));
}
@Transactional
public void insertList(List<ThemeAttachmentEntity> themeAttachments) {
for (ThemeAttachmentEntity themeAttachment : themeAttachments) {
themeAttachmentMapper.insert(themeAttachment);
}
return;
}
public int deleteByThemeId(String themeId) {
ThemeAttachmentEntity target = ThemeAttachmentEntity.builder().deleteTag(DeleteTagEnum.DELETED.getCode()).build();
LambdaUpdateWrapper<ThemeAttachmentEntity> update = new LambdaUpdateWrapper<ThemeAttachmentEntity>().eq(ThemeAttachmentEntity::getThemeId, themeId);
return themeAttachmentMapper.update(target,update);
}
}
......@@ -5,10 +5,12 @@ import com.tanpu.community.api.enums.VisitTypeEnum;
import com.tanpu.community.dao.entity.community.VisitSummaryEntity;
import com.tanpu.community.dao.mapper.community.VisitSummaryMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Slf4j
......@@ -24,6 +26,7 @@ public class VisitSummaryService {
.visitorId(userId)
.refId(targetId)
.refType(type.getCode())
.duration(0)
.build());
}
......@@ -31,25 +34,37 @@ public class VisitSummaryService {
public Integer queryTopicDetailVisit(String topicId) {
return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>()
.eq(VisitSummaryEntity::getRefId, topicId)
.eq(VisitSummaryEntity::getRefType,VisitTypeEnum.TOPIC_PAGE_VIEW.getCode()));
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.TOPIC_PAGE_VIEW.getCode()));
}
// 查询主题 浏览量
public Integer queryThemeVisit(String theme) {
return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>()
.eq(VisitSummaryEntity::getRefId, theme)
.eq(VisitSummaryEntity::getRefType,VisitTypeEnum.TOPIC_PAGE_VIEW.getCode()));
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.TOPIC_PAGE_VIEW.getCode()));
}
// 查询主题 浏览量
public Integer queryThemeVisit(List<String> themes) {
return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>()
.in(VisitSummaryEntity::getRefId, themes)
.eq(VisitSummaryEntity::getRefType,VisitTypeEnum.TOPIC_PAGE_VIEW.getCode()));
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.TOPIC_PAGE_VIEW.getCode()));
}
// 更新访问时长
public void updateDurByIdent(String ident, Integer dur) {
// visitSummaryMapper.updateDurByIdent(ident, dur);
}
public LocalDateTime queryLatestViewFollow(String userId) {
List<VisitSummaryEntity> visitSummaryEntities = visitSummaryMapper.selectList(new LambdaQueryWrapper<VisitSummaryEntity>()
.eq(VisitSummaryEntity::getVisitorId, userId)
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.FOLLOW_THEME_VIEW.getCode())
.orderByDesc(VisitSummaryEntity::getCreateTime));
if (CollectionUtils.isEmpty(visitSummaryEntities)) {
return null;
} else {
return visitSummaryEntities.get(0).getCreateTime();
}
}
}
......@@ -2,6 +2,7 @@ package com.tanpu.community.util;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.resp.FileUploadResp;
import com.tanpu.community.api.beans.vo.ImagesDTO;
import com.tanpu.community.api.beans.vo.TopicDTO;
import com.tanpu.community.api.beans.qo.*;
......@@ -12,9 +13,11 @@ import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.dao.entity.community.*;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import org.springframework.beans.BeanUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class ConvertUtil {
......@@ -163,26 +166,40 @@ public class ConvertUtil {
.themeId(themeId)
.build());
}
} else {
} else if ((content.getType().equals(RelTypeEnum.SINGLE_IMG.type))) {
if (StringUtils.isEmpty(content.getValue())){
list.add(ThemeAttachmentEntity.builder()
.attachType(Integer.valueOf(content.getType()))
.attachId(content.getValue())
.themeId(themeId)
.build());
}else {
List<ImagesDTO> imgList = content.getImgList();
for (ImagesDTO imagesDTO : imgList) {
list.add(ThemeAttachmentEntity.builder()
.attachType(Integer.valueOf(RelTypeEnum.SINGLE_IMG.type))
.attachId(imagesDTO.getRelId())
.themeId(themeId)
.build());
}
}
} else {
}
}
}
return list;
}
public static FollowQo homePageEntity2FollowQo(UserInfoEntity entity) {
public static FollowQo userInfoEntity2FollowQo(UserInfoEntity entity) {
if (entity == null) {
return null;
}
return FollowQo.builder().userId(entity.getId())
.nickName(entity.getUiUsernameMp())
.headImg(entity.getUiHeadimgMp())
.introduction(entity.getUiIntroduction())
.introduction(entity.getUiIntroductionMp())
.build();
}
......@@ -202,6 +219,18 @@ public class ConvertUtil {
.build();
}
public static FileUploadResp fileRecordEntity2Resp(FileRecordEntity entity){
FileUploadResp resp = new FileUploadResp();
BeanUtils.copyProperties(entity,resp);
String extInfo = entity.getExtInfo();
if (!StringUtils.isEmpty(extInfo)) {
Map<String, Object> extMap = JsonUtil.toMap(extInfo);
resp.setImgHeight((Integer) extMap.get("height"));
resp.setImgWidth((Integer) extMap.get("width"));
}
return resp;
}
}
......@@ -46,6 +46,22 @@ spring.datasource:
maxActive: 2
minIdle: 2
initialSize: 2
jydb:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://tamper.mysql.polardb.rds.aliyuncs.com:3306/jydb?autoReconnect=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false
username: jydb
password: '@juyuan123'
maxActive: 2
minIdle: 2
initialSize: 2
fund:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://tamper.mysql.polardb.rds.aliyuncs.com:3306/tamp_fund?autoReconnect=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false
username: tamp
password: "@imeng123"
maxActive: 2
minIdle: 2
initialSize: 2
spring.redis:
host: 118.190.63.109
......
......@@ -11,9 +11,7 @@
<result column="ref_id" property="refId" />
<result column="ref_type" property="refType" />
<result column="duration" property="duration" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
......
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