Commit 108f9fda authored by 刘基明's avatar 刘基明

接口修改

parent 2814329d
......@@ -15,16 +15,13 @@ import lombok.NoArgsConstructor;
@ApiModel(value = "附件对象")
public class AttachmentDetailVo {
@ApiModelProperty(value = "产品")
private ProductInfoVO productInfoVO;
@ApiModelProperty(value = "直播")
private ZhiboDetailVO zhiboDetailVO;
@ApiModelProperty(value = "短视频")
private ShortVideoBaseInfoResp shortVideoBaseInfoResp;
@ApiModelProperty(value = "课程")
private CoursePackageDetail coursePackageDetail;
@ApiModelProperty("直播信息")
private ZhiboListResp zhibo;
@ApiModelProperty("产品信息")
private ProductInfoVO product;
@ApiModelProperty("短视频")
private ShortVideoBaseInfoResp shortVideo;
@ApiModelProperty("新版课程")
private CoursePackageDetail course;
}
......@@ -40,7 +40,7 @@ public class CommentQo {
private String userImg;
@ApiModelProperty(value = "当前用户是否点赞")
private boolean isLiked;
private boolean hasLiked;
@ApiModelProperty(value = "2级评论")
private List<CommentLv2Qo> commentLv2Qos;
......
......@@ -60,10 +60,10 @@ public class ThemeQo {
@ApiModelProperty(value = "点赞量")
private Integer likeCount;
@ApiModelProperty(value = "当前用户是否点赞该主题")
@ApiModelProperty(value = "当前用户是否点赞")
private boolean hasLiked;
@ApiModelProperty(value = "当前用户是否转发该主题")
@ApiModelProperty(value = "当前用户是否转发")
private boolean hasForward;
@ApiModelProperty(value = "图片九宫格")
......
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
@ApiModel
......@@ -20,7 +21,7 @@ public class CreateCommentReq {
@ApiModelProperty(value = "回复对象的id(非对评论回复时,此项为空)")
private String replyId;
@NotEmpty(message = "评论内容不能为空")
@NotBlank(message = "评论内容不能为空")
@ApiModelProperty(value = "评论内容")
private String comment;
......
package com.tanpu.community.api.beans.req.comment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "点赞/取消点赞评论")
@Data
public class LikeCommentReq {
@ApiModelProperty(value = "评论Id")
private String commentId;
@ApiModelProperty(value = "类型,1:点赞 2:取消点赞")
private Integer type;
}
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel("课程基本信息")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CourseSimpleResp {
@ApiModelProperty("课程id")
private String courseId;
@ApiModelProperty("课程包Id")
private String coursePackageId;
@ApiModelProperty("课程包名称")
private String packageName;
@ApiModelProperty("课程名称")
private String title;
@ApiModelProperty("讲师名称")
private String lecturerName;
@ApiModelProperty("多少人已学习")
private Integer readNum;
@ApiModelProperty("是否引用讲师头像 0否 1是;bgStatus=0时,直接展示squareImg;bgStatus=1时,将squareImg与bgImg叠加展示")
private Integer bgStatus;
@ApiModelProperty("方图")
private String squareImg;
@ApiModelProperty("背景图地址")
private String bgImg;
@ApiModelProperty("播放地址")
private String url;
@ApiModelProperty("1:音频 2:视频")
private Integer type;
}
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* 基金基础信息(精简)
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class FundInfoBaseResp {
/**
* 基金id
*/
@ApiModelProperty("基金id")
private String fundId;
@ApiModelProperty("基金名称")
private String productName;
@ApiModelProperty("产品类型")
private Integer productType;
/**
* 私募基金类型:1-信托计划,2-有限合伙,3-券商资管,4-公募专户,5-单账户,6-证券投资基金,7-海外基金,8-期货资管,9-保险资管、10-创业投资基金、11-股权投资基金、12-银行理财、13-类固收信托、-1其他投资基金
* 公募基金类型:1-混合型、2-债券型、3-定开债券、4-联接基金、5-货币型、6-债券指数、7-保本型、8-理财型、9-QDII、10-股票指数、11-QDII-指数、12-股票型、13-固定收益、14-分级杠杆、15-ETF-场内、16-QDII-ETF、17-债券创新-场内、18-封闭式
*/
private Integer fundType;
/**
* 开放日
*/
@ApiModelProperty("开放日")
private String openDay;
/**
* 融智策略分类,1-股票策略,2-宏观策略,3-管理期货,4-事件驱动,5-相对价值策略,6-固定收益策略,7-组合基金,8-复合策略,-1-其它策略
*/
private Integer strategy;
/**
* 融智子策略分类:1010-主观多头 1020-股票多空 1030-量化多头 2010-宏观策略 3010-主观趋势 3020-主观套利 3030-量化趋势 3040-量化套利 3050-管理期货复合 4010-并购重组 4020-定向增发 4030-大宗交易 4040-事件驱动复合 5010-股票市场中性 5020-套利 5030-相对价值复合 6010-纯债策略 6020-强债策略 6030-固收复合 7010-MOM 7020-FOF 8010-主观多策略 8020-量化多策略 -1-其他策略'
*/
@ApiModelProperty("子策略")
private Integer substrategy;
/**
* 风险等级 1:低风险 2:中低风险 3:中等风险 4:中高风险 5:高风险
*/
@ApiModelProperty("风险等级")
private Integer riskLevel;
@ApiModelProperty("是否可预约 0:不可预约 1:可预约")
private Integer isAppoint;
@ApiModelProperty("成立以来收益率")
private String retIncep;
@ApiModelProperty("起投金额 单位:万")
private String money;
@ApiModelProperty("推荐理由")
private String remark;
private String ratioId;
}
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.ToString;
@ApiModel("直播列表返回结果集合")
@Data
@Builder
@ToString
public class ZhiboListResp {
@ApiModelProperty(value = "直播间ID")
private String id;
@ApiModelProperty(value = "直播标题")
private String title;
@ApiModelProperty(value = "列表缩略图")
private String sourceImg;
@ApiModelProperty(value = "讲师")
private String managerName;
@ApiModelProperty(value = "直播状态", notes = "1:未开始 2:直播中 3:已结束")
private String ztStatus;
@ApiModelProperty(value = "开播时间")
private Long ztStarttime;
@ApiModelProperty(value = "母直播间Id")
private String parentId;
@ApiModelProperty("讲师信息")
private String bgImg;
private String squareImg;
@ApiModelProperty("0:不使用 1:使用讲师图")
private Integer bgStatus;
@ApiModelProperty("包含课件数量 0:无课件")
private Long courseWareNum = 0L;
@ApiModelProperty("图片地址")
private String img;
@ApiModelProperty("访问人次")
private Integer readNum;
@ApiModelProperty("预约人数")
private Integer appointNum;
}
......@@ -4,6 +4,7 @@ package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp;
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.LikeCommentReq;
import com.tanpu.community.api.beans.req.comment.QueryCommentReq;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.manager.CommentManager;
......@@ -35,28 +36,28 @@ public class CommentController {
@ApiOperation("查看评论")
@PostMapping(value = "/queryComment")
@ResponseBody
public CommonResp<Page<CommentQo>> queryComment(@RequestBody QueryCommentReq req){
public CommonResp<Page<CommentQo>> queryComment(@RequestBody QueryCommentReq req) {
//todo
String userId = "liujm";
List<CommentQo> result = commentManager.queryComments(req.getThemeId(),userId);
List<CommentQo> result = commentManager.queryComments(req.getThemeId(), userId);
return CommonResp.success(PageUtils.page(req.getPage(), result));
}
@ApiOperation("点赞评论")
@GetMapping(value = "/likeComment")
@PostMapping(value = "/likeComment")
@ResponseBody
public CommonResp<Void> likeComment(@RequestParam String commentId){
//todo
public CommonResp<Void> likeComment(@RequestBody LikeCommentReq req) {
String userId = "liujm";
commentManager.likeComment(req, userId);
return CommonResp.success();
}
@ApiOperation("举报评论")
@GetMapping(value = "/reportComment")
@ResponseBody
public CommonResp<Void> reportComment(@RequestParam String commentId){
public CommonResp<Void> reportComment(@RequestParam String commentId) {
//todo
String userId = "liujm";
return CommonResp.success();
return CommonResp.failed("功能暂未开放");
}
}
......@@ -91,7 +91,7 @@ public class ThemeController {
@GetMapping(value = "/share")
@ResponseBody
public CommonResp<Void> shareTheme(String themeId) {
return CommonResp.success();
return CommonResp.failed("功能暂未开放");
}
@ApiOperation("屏蔽")
......
......@@ -22,6 +22,7 @@ public interface FeignClientForCourse {
@ApiParam("课程包id") @RequestParam("packageId") String packageId);
@ApiOperation("详情页信息")
@GetMapping("/course/detail")
CommonResp<CoursePackageDetail> getCoursePackageDetailInfo(@ApiParam(value = "课程包id", required = true) @RequestParam("id") String id);
......
......@@ -2,6 +2,7 @@ package com.tanpu.community.feign.zhibo;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO;
import com.tanpu.community.api.beans.vo.feign.ZhiboListResp;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -23,4 +24,8 @@ public interface FeignClientForZhibo {
@ApiOperation(value = "根据id获取直播信息")
@PostMapping("/theme/zhibo/detail")
CommonResp<List<ZhiboDetailVO>> getZhiBoByIds(@RequestBody List<String> ids);
@ApiOperation(value = "根据Id查询直播基本信息")
@PostMapping(value = "/theme/simpleList", produces = {"application/json"})
CommonResp<List<ZhiboListResp>> simpleList(@RequestBody List<String> idList);
}
......@@ -2,6 +2,7 @@ package com.tanpu.community.feign.zhibo;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO;
import com.tanpu.community.api.beans.vo.feign.ZhiboListResp;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
......@@ -30,6 +31,12 @@ public class FeignbackForZhibo implements FallbackFactory<FeignClientForZhibo> {
return null;
}
@Override
public CommonResp<List<ZhiboListResp>> simpleList(List<String> idList) {
log.error("请求信息", throwable);
log.error("FeignClientForZhiboTheme.simpleList探普学堂-查询直播ids:{}", idList);
return null;
}
};
......
package com.tanpu.community.manager;
import com.tanpu.common.util.JsonUtil;
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.LikeCommentReq;
import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.dao.entity.community.CommentEntity;
......@@ -36,13 +36,14 @@ public class CommentManager {
.parentId(req.getParentId())
.replyId(req.getReplyId())
.authorId(userId)
.content(JsonUtil.toJson(req.getComment()))
.content(req.getComment())
.commentType(CommentTypeEnum.THEME.getCode())
.build();
commentService.insertComment(commentEntity);
}
//查询
public List<CommentQo> queryComments(String themeId,String userId) {
List<CommentEntity> commentEntities = commentService.selectByThemeIdAndParentId(themeId, null);
List<CommentQo> commentQos = ConvertUtil.commentEntity2Qos(commentEntities);
......@@ -59,9 +60,9 @@ public class CommentManager {
//是否点赞及点赞数
String commentId = commentQo.getCommentId();
if (likeCommentList.contains(commentId)){
commentQo.setLiked(true);
commentQo.setHasLiked(true);
}else {
commentQo.setLiked(false);
commentQo.setHasLiked(false);
}
Integer countByTypeAndId = collectionService.getCountByTypeAndId(commentId,CollectionTypeEnum.LIKE_COMMENT);
commentQo.setLikeCount(countByTypeAndId);
......@@ -74,4 +75,15 @@ public class CommentManager {
return commentQos;
}
//点赞评论/取消点赞
public void likeComment(LikeCommentReq req, String userId) {
//todo 枚举值
if (1==req.getType()){
collectionService.addIfNotExist(req.getCommentId(), userId, CollectionTypeEnum.LIKE_COMMENT);
}else if (2==req.getType()) {
collectionService.delete(req.getCommentId(), userId, CollectionTypeEnum.LIKE_COMMENT);
}
}
}
......@@ -9,10 +9,7 @@ import com.tanpu.community.api.beans.qo.ThemeContentQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.theme.*;
import com.tanpu.community.api.beans.vo.feign.CoursePackageDetail;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO;
import com.tanpu.community.api.beans.vo.feign.*;
import com.tanpu.community.api.constants.CommunityConstant;
import com.tanpu.community.api.enums.*;
import com.tanpu.community.dao.entity.community.*;
......@@ -324,13 +321,14 @@ public class ThemeManager {
//产品
String productId = themeContentQo.getValue();
CommonResp<ProductInfoVO> productDetailInfo = feignClientForProducts.getProductDetailInfo(productId);
themeContentQo.setDetail(AttachmentDetailVo.builder().productInfoVO(productDetailInfo.getData()).build());
themeContentQo.setDetail(AttachmentDetailVo.builder().product(productDetailInfo.getData()).build());
} else if (RelTypeEnum.LIVE.type.equals(type)) {
//直播
String zhiboId = themeContentQo.getValue();
CommonResp<ZhiboDetailVO> zhiboDetailVOCommonResp = feignClientForZhibo.queryZhiboDetail(zhiboId);
themeContentQo.setDetail(AttachmentDetailVo.builder().zhiboDetailVO(zhiboDetailVOCommonResp.getData()).build());
String[] roomIds = new String[]{zhiboId};
CommonResp<List<ZhiboListResp>> zhiboDetailVOCommonResp = feignClientForZhibo.simpleList(Arrays.asList(roomIds));
themeContentQo.setDetail(AttachmentDetailVo.builder().zhibo(zhiboDetailVOCommonResp.getData().get(0)).build());
} else if (RelTypeEnum.SHORT_VIDEO.type.equals(type)) {
//短视频
......@@ -338,13 +336,13 @@ public class ThemeManager {
String[] attachmentIds = new String[]{videoId};
CommonResp<List<ShortVideoBaseInfoResp>> shortVideoBaseInfo =
feignClientForTanpuroom.getShortVideoBaseInfo(Arrays.asList(attachmentIds));
themeContentQo.setDetail(AttachmentDetailVo.builder().shortVideoBaseInfoResp(shortVideoBaseInfo.getData().get(0)).build());
themeContentQo.setDetail(AttachmentDetailVo.builder().shortVideo(shortVideoBaseInfo.getData().get(0)).build());
} else if (RelTypeEnum.NEW_COURSE_WARE.type.equals(type)) {
//课程
String packageId = themeContentQo.getValue();
CommonResp<CoursePackageDetail> courseIdDetailInfo = feignClientForCourse.getCoursePackageDetailInfo(packageId);
themeContentQo.setDetail(AttachmentDetailVo.builder().coursePackageDetail(courseIdDetailInfo.getData()).build());
themeContentQo.setDetail(AttachmentDetailVo.builder().course(courseIdDetailInfo.getData()).build());
} else if (RelTypeEnum.SINGLE_IMG.type.equals(type)) {
//单图,根据id传入url
String imgId = themeContentQo.getValue();
......
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