Commit 690f911e authored by 刘基明's avatar 刘基明

主题接口修改

parent 99a46b20
package com.tanpu.community.api.beans.qo; package com.tanpu.community.api.beans.qo;
import com.tanpu.community.api.beans.vo.feign.CourseDetailExt; import com.tanpu.community.api.beans.vo.feign.*;
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 io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
@Data @Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "附件对象") @ApiModel(value = "附件对象")
public class AttachmentDetailVo { public class AttachmentDetailVo {
...@@ -22,6 +25,6 @@ public class AttachmentDetailVo { ...@@ -22,6 +25,6 @@ public class AttachmentDetailVo {
private ShortVideoBaseInfoResp shortVideoBaseInfoResp; private ShortVideoBaseInfoResp shortVideoBaseInfoResp;
@ApiModelProperty(value = "课程") @ApiModelProperty(value = "课程")
private CourseDetailExt courseDetailExt; private CoursePackageDetail coursePackageDetail;
} }
package com.tanpu.community.api.beans.qo; package com.tanpu.community.api.beans.qo;
import com.tanpu.community.api.beans.ImagesDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
@ApiModel(value = "主题内容") @ApiModel(value = "主题内容")
public class ThemeContentQo { public class ThemeContentQo {
@ApiModelProperty(value = "类型,0:文本,1:产品 2:直播 3:短视频 4:课程,5:图片 6:图片列表(讨论)") @ApiModelProperty(value = "RelTypeEnum类型,8:文本,88:产品 3:直播 6:短视频 2:课程,9:图片 10:多图(讨论)")
private Integer type; private String type;
@ApiModelProperty(value = "文本的值是内容,附件的值为id") @ApiModelProperty(value = "文本的值是内容,附件的值为id")
private String value; private String value;
@ApiModelProperty(value = "类型为6时,传入图片列表")
private String[] imgList; @ApiModelProperty(value = "产品类型,0 公募,1 私募,2 白名单,3 私有")
private Integer productType;
@ApiModelProperty(value = "产品推荐语")
private String remark;
@ApiModelProperty(value = "讨论中的图片列表")
private List<ImagesDTO> imgList;
@ApiModelProperty(value = "对象详情") @ApiModelProperty(value = "对象详情")
private AttachmentDetailVo detail; private AttachmentDetailVo detail;
......
package com.tanpu.community.api.beans.req.theme; package com.tanpu.community.api.beans.req.theme;
import com.tanpu.community.api.beans.ImagesDTO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
@Data @Data
...@@ -13,7 +13,7 @@ public class CreateThemeReq { ...@@ -13,7 +13,7 @@ public class CreateThemeReq {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@NotEmpty(message = "类型不能为空") @NotNull(message = "类型不能为空")
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题") @ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题")
private Integer themeType; private Integer themeType;
...@@ -28,6 +28,5 @@ public class CreateThemeReq { ...@@ -28,6 +28,5 @@ public class CreateThemeReq {
@ApiModelProperty(value = "所属的话题id") @ApiModelProperty(value = "所属的话题id")
private String topicId; private String topicId;
@ApiModelProperty(value = "讨论中的图片列表")
private List<ImagesDTO> imgList;
} }
package com.tanpu.community.api.beans.req.theme; package com.tanpu.community.api.beans.req.theme;
import com.tanpu.community.api.beans.ImagesDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
@ApiModel(value = "主题内容") @ApiModel(value = "主题内容")
public class ThemeContentReq { public class ThemeContentReq {
@ApiModelProperty(value = "RelTypeEnum类型,8:文本,88:产品 3:直播 3:短视频 4:课程,5:图片 6:图片列表(讨论)") @ApiModelProperty(value = "RelTypeEnum类型,8:文本,88:产品 3:直播 6:短视频 2:课程,9:图片 10:多图(讨论)")
private Integer type; private String type;
@ApiModelProperty(value = "文本的值是内容,附件的值为id") @ApiModelProperty(value = "文本的值是内容,附件的值为id")
private String value; private String value;
...@@ -20,4 +23,7 @@ public class ThemeContentReq { ...@@ -20,4 +23,7 @@ public class ThemeContentReq {
@ApiModelProperty(value = "产品推荐语") @ApiModelProperty(value = "产品推荐语")
private String remark; private String remark;
@ApiModelProperty(value = "讨论中的图片列表")
private List<ImagesDTO> imgList;
} }
package com.tanpu.community.api.beans.vo.feign;
import com.tanpu.community.api.beans.vo.feign.pay.Price;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author: zhoupeng
* <p>
* =========================================
* =========================================
* ======== ========
* ======= ========== ======= =======
* ====== ===== == ==== ======
* ===== ===== == === =====
* ===== ===== == === =====
* ===== ===== == === =====
* ====== ========== == ======
* ======= =======
* =========================================
* =========================================
* <p>
* @email: zhoupeng_08@163.com
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel("课程基础属性 BaseCoursePackage")
@Data
public class BaseCoursePackage extends Price {
@ApiModelProperty("包名称")
private String packageName;
@ApiModelProperty("副标题")
private String twoTitle;
@ApiModelProperty("结构类型 1:目录 2:资源")
private Integer courseType;
@ApiModelProperty("包id")
private String packageId;
@ApiModelProperty("标签信息")
private List<Type> tagTypes;
@ApiModelProperty("总期数")
private Integer totalNum;
@ApiModelProperty("多少人已学习")
private Integer readNum;
@ApiModelProperty("试听数量")
private Integer everySelectNum = 0;
@ApiModelProperty("是否收藏 0:没收藏 1:收藏")
private Integer isFavorite;
@ApiModelProperty("是否引用讲师头像 0否 1是;bgStatus=0时,直接展示squareImg;bgStatus=1时,将squareImg与bgImg叠加展示")
private Integer bgStatus;
@ApiModelProperty("方图")
private String squareImg;
@ApiModelProperty("背景图地址")
private String bgImg;
@ApiModelProperty("发刊词状态 1:有发刊词 2:没有发刊词")
private Integer progressionStatus;
@ApiModelProperty("发刊词")
private String progressionId;
@ApiModelProperty("发刊词名称")
private String progressionName;
@ApiModelProperty("发刊词地址")
private String progressionUrl;
@ApiModelProperty("发刊词资源类型 音/视频")
private Integer progressionResType;
@ApiModelProperty("是否学习过 0: 否 1:是")
private Integer progressIsListen;
@ApiModelProperty("发刊词的课程id")
private String progressionContext;
@ApiModelProperty("发刊词数量")
private Integer progressionReadNum;
@ApiModelProperty("发刊词数量")
private Integer progressionLengthTime;
@ApiModelProperty("试听类型 1:任意选择课程 2:指定课程")
private Integer auditionType;
@ApiModelProperty("试听设置 0:无试听 1:有试听")
private Integer auditionSetting;
@ApiModelProperty("发刊词mp3Url")
private String progressionMp3Url;
}
package com.tanpu.community.api.beans.vo.feign;
import com.tanpu.community.api.beans.vo.feign.pay.GroupBuyConfig;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author: zhoupeng
* <p>
* =========================================
* =========================================
* ======== ========
* ======= ========== ======= =======
* ====== ===== == ==== ======
* ===== ===== == === =====
* ===== ===== == === =====
* ===== ===== == === =====
* ====== ========== == ======
* ======= =======
* =========================================
* =========================================
* <p>
* @email: zhoupeng_08@163.com
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("课程章节详情")
public class CoursePackageDetail extends BaseCoursePackage {
@ApiModelProperty("课程亮点")
private String courseSparkle;
@ApiModelProperty("购买须知")
private String buyNotice;
@ApiModelProperty("课程表")
private String courseTable;
@ApiModelProperty("已学过列表")
private List<String> listenedIds;
@ApiModelProperty("试听id")
private List<String> listerIds;
@ApiModelProperty("喜欢")
private List<LikeCourse> likeCourses;
@ApiModelProperty("已试听课程数量")
private Integer selectNums = 0;
@ApiModelProperty("是否正在参与拼团活动 0不参加 1参加")
private Integer isJoinGroupBuy = 0;
@ApiModelProperty("拼团活动配置信息")
private GroupBuyConfig groupBuyConfig;
}
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author: zhoupeng
* <p>
* =========================================
* =========================================
* ======== ========
* ======= ========== ======= =======
* ====== ===== == ==== ======
* ===== ===== == === =====
* ===== ===== == === =====
* ===== ===== == === =====
* ====== ========== == ======
* ======= =======
* =========================================
* =========================================
* <p>
* @email: zhoupeng_08@163.com
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class LikeCourse extends BaseCoursePackage {
private String coursePackageId;
private String coursePackageMainTitle;
@ApiModelProperty("讲师名称")
private String name;
}
package com.tanpu.community.api.beans.vo.feign.pay;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @description: 拼团配置
* @author: zejia zj wu
* @create: 2021-06-21 15:43
**/
@ApiModel(value = "拼团配置")
@Data
public class GroupBuyConfig implements Serializable {
/**
* 唯一主键
*/
@ApiModelProperty(value = "唯一主键")
private Integer id;
/**
* 拼团配置id
*/
@ApiModelProperty(value = "拼团配置id")
private String groupBuyConfigId;
/**
* 资源id
*/
@ApiModelProperty(value = "资源id")
private String resId;
/**
* 资源类型 300新版课程包
*/
@ApiModelProperty(value = "资源类型 300新版课程包")
private Integer resType;
/**
* 拼团价
*/
@ApiModelProperty(value = "拼团价")
private Integer groupBuyPrice;
/**
* 活动开始时间
*/
@ApiModelProperty(value = "活动开始时间")
private Long timeStart;
/**
* 活动结束时间
*/
@ApiModelProperty(value = "活动结束时间")
private Long timeEnd;
/**
* 拼团时限 单位小时
*/
@ApiModelProperty(value = "拼团时限 单位小时")
private Long timeLimit;
/**
* 拼团规定人数
*/
@ApiModelProperty(value = "拼团规定人数")
private Integer peopleNumber;
/**
* 是否开启 在线拼团 0不开启 1开启
*/
@ApiModelProperty(value = "是否开启 在线拼团 0不开启 1开启")
private Integer isShow;
/**
* 拼团规则总述
*/
@ApiModelProperty(value = "拼团规则总述")
private String ruleMain;
/**
* 拼团规则详细
*/
@ApiModelProperty(value = "拼团规则详细")
private String ruleDetail;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Long createTime;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
private Long updateTime;
/**
* 删除标识
*/
@ApiModelProperty(value = "删除标识")
private Integer deleteTag;
@ApiModelProperty(value = "拼团标识 1未参与 2拼团进行中 3拼团成功 4拼团失败")
private Integer groupBuyStatus;
private static final long serialVersionUID = 1L;
}
package com.tanpu.community.api.beans.vo.feign.pay;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "支付详情")
public class PayDetailVO {
private String id;
private String title;
private String cover;
private String info;
private Integer score;
private Long price;
/**
* 划线价
*/
private Long crossedPrice;
private Integer availableScore;
private Integer balance;
/**
* 1:免费 2:积分 3现金
*/
private Integer chargeMode;
/**
* 类型:1:栏目 3:直播 4:视频 5 音频 7:直播课件
*/
private Integer relType;
}
package com.tanpu.community.api.beans.vo.feign.pay;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @author: zhoupeng
* <p>
* =========================================
* =========================================
* ======== ========
* ======= ========== ======= =======
* ====== ===== == ==== ======
* ===== ===== == === =====
* ===== ===== == === =====
* ===== ===== == === =====
* ====== ========== == ======
* ======= =======
* =========================================
* =========================================
* <p>
* @email: zhoupeng_08@163.com
*/
@Data
@SuperBuilder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
public class Price {
@ApiModelProperty("资源id")
private String resId;
@ApiModelProperty("是不是白名单 0:不是 1:是白名单")
private Integer isWhite;
@ApiModelProperty("价格")
private String totalPrice;
@ApiModelProperty("积分")
private String totalScore;
@ApiModelProperty("付费模式 1:免费 2:积分 3:现金")
private Integer chargeMode;
@ApiModelProperty("划线价格")
private String discountPrice;
@ApiModelProperty("划线积分")
private String discountScore;
@ApiModelProperty("促销时间")
private Time3Type time3Type;
@ApiModelProperty("会员打折价")
private String memberDiscountPrice;
@ApiModelProperty("会员促销时间")
private Time3Type memberTime3Type;
@ApiModelProperty("报名信息 0:不需要 1:需要")
private Integer bmStatus;
@ApiModelProperty("报名信息 0:没有 1:已报名")
private Integer bmInfo;
@ApiModelProperty("审批状态 0:待审批 1:审批通过 2:审批失败")
private Integer spStatus;
@ApiModelProperty("action")
private String action;
@ApiModelProperty("报名信息")
private ResBmInfoResp resBmInfoResp;
/*@ApiModelProperty("会员身分")
private Integer memberLevel;
@ApiModelProperty("1:不上浮包含 2:上浮包含等级")
private Integer rose;*/
@ApiModelProperty("最终价格")
private String finalPrice;
@ApiModelProperty("最终积分")
private String finalScore;
@ApiModelProperty("最终身份")
private Integer finalLevel;
@ApiModelProperty("最终付费模式 1:免费 2:积分 3:现金")
private Integer finalChargeMode;
@ApiModelProperty("需不需要支付 2:不需要 1:需要")
private Integer isNeedBuy;
@ApiModelProperty("有没有支付 2:已购买 1:未购买")
private Integer isBuy;
@ApiModelProperty("是否正在参与拼团活动 0不参加 1参加")
private Integer isJoinGroupBuy = 0;
@ApiModelProperty("拼团活动配置信息")
private GroupBuyConfig groupBuyConfig;
}
package com.tanpu.community.api.beans.vo.feign.pay;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.Date;
/**
* @author: zhoupeng
* <p>
* =========================================
* =========================================
* ======== ========
* ======= ========== ======= =======
* ====== ===== == ==== ======
* ===== ===== == === =====
* ===== ===== == === =====
* ===== ===== == === =====
* ====== ========== == ======
* ======= =======
* =========================================
* =========================================
* <p>
* @email: zhoupeng_08@163.com
*/
@Data
@ApiModel("报名信息")
public class ResBmInfoResp {
private String id;
private String resId;
private Integer resType;
private String operUser;
private String bmRemark;
private String wechat;
private String wechatQrCode;
private String title;
private String bmRemind;
private String bmNotice;
private String templateId;
private Date createTime;
private String createBy;
private Date updateTime;
private String updateBy;
private Integer deleteTag;
}
package com.tanpu.community.api.beans.vo.feign.pay;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author: zhoupeng
* <p>
* =========================================
* =========================================
* ======== ========
* ======= ========== ======= =======
* ====== ===== == ==== ======
* ===== ===== == === =====
* ===== ===== == === =====
* ===== ===== == === =====
* ====== ========== == ======
* ======= =======
* =========================================
* =========================================
* <p>
* @email: zhoupeng_08@163.com
*/
@ApiModel("时间对象")
@Data
public class Time3Type {
@ApiModelProperty("开始时间")
private Long begin;
@ApiModelProperty("结束时间")
private Long end;
}
...@@ -42,6 +42,9 @@ public enum RelTypeEnum { ...@@ -42,6 +42,9 @@ public enum RelTypeEnum {
*/ */
TEXT(8, "文本"), TEXT(8, "文本"),
SINGLE_IMG(9, "单图"),
MULTIPLE_IMAGE(10, "多图"),
FUND(88, "产品"), FUND(88, "产品"),
PINGLUN(99, "评论"), PINGLUN(99, "评论"),
......
...@@ -2,7 +2,6 @@ package com.tanpu.community.controller; ...@@ -2,7 +2,6 @@ package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.qo.MainTextQo;
import com.tanpu.community.api.beans.qo.ThemeQo; import com.tanpu.community.api.beans.qo.ThemeQo;
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.ForwardThemeReq; import com.tanpu.community.api.beans.req.theme.ForwardThemeReq;
...@@ -60,10 +59,10 @@ public class ThemeController { ...@@ -60,10 +59,10 @@ public class ThemeController {
@ApiOperation("主题正文") @ApiOperation("主题正文")
@GetMapping(value = "/detail") @GetMapping(value = "/detail")
@ResponseBody @ResponseBody
public CommonResp<MainTextQo> getThemeMainText(@RequestParam String topicId) { public CommonResp<ThemeQo> getThemeMainText(@RequestParam String topicId) {
String userId = "liujm"; String userId = "liujm";
MainTextQo mainTextQo = themeManager.getMainText(topicId,userId); ThemeQo themeQo = themeManager.getDetail(topicId,userId);
return CommonResp.success(mainTextQo); return CommonResp.success(themeQo);
} }
@ApiOperation("转发主题") @ApiOperation("转发主题")
......
...@@ -2,6 +2,7 @@ package com.tanpu.community.feign.course; ...@@ -2,6 +2,7 @@ package com.tanpu.community.feign.course;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.CourseDetailExt; import com.tanpu.community.api.beans.vo.feign.CourseDetailExt;
import com.tanpu.community.api.beans.vo.feign.CoursePackageDetail;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -18,6 +19,13 @@ public class FeignBackClientForCourse implements FallbackFactory<FeignClientForC ...@@ -18,6 +19,13 @@ public class FeignBackClientForCourse implements FallbackFactory<FeignClientForC
log.error("FeignClientForCourse.getCourseIdDetailInfo-查询课程id:{},package:{}", id,packageId); log.error("FeignClientForCourse.getCourseIdDetailInfo-查询课程id:{},package:{}", id,packageId);
return null; return null;
} }
@Override
public CommonResp<CoursePackageDetail> getCoursePackageDetailInfo(String id) {
log.error("请求信息", throwable);
log.error("FeignClientForCourse.getCoursePackageDetailInfo-查询课程包id:{}", id);
return null;
}
}; };
} }
} }
...@@ -2,6 +2,7 @@ package com.tanpu.community.feign.course; ...@@ -2,6 +2,7 @@ package com.tanpu.community.feign.course;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.CourseDetailExt; import com.tanpu.community.api.beans.vo.feign.CourseDetailExt;
import com.tanpu.community.api.beans.vo.feign.CoursePackageDetail;
import com.tanpu.community.feign.product.FeignBackClientForProducts; import com.tanpu.community.feign.product.FeignBackClientForProducts;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
...@@ -20,4 +21,8 @@ public interface FeignClientForCourse { ...@@ -20,4 +21,8 @@ public interface FeignClientForCourse {
CommonResp<CourseDetailExt> getCourseIdDetailInfo(@ApiParam("课程详情id") @RequestParam("id") String id, CommonResp<CourseDetailExt> getCourseIdDetailInfo(@ApiParam("课程详情id") @RequestParam("id") String id,
@ApiParam("课程包id") @RequestParam("packageId") String packageId); @ApiParam("课程包id") @RequestParam("packageId") String packageId);
@ApiOperation("详情页信息")
@GetMapping("/course/detail")
CommonResp<CoursePackageDetail> getCoursePackageDetailInfo(@ApiParam(value = "课程包id", required = true) @RequestParam("id") String id);
} }
...@@ -2,33 +2,30 @@ package com.tanpu.community.manager; ...@@ -2,33 +2,30 @@ package com.tanpu.community.manager;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.common.exception.BizException; import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.req.theme.ForwardThemeReq; import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.qo.AttachmentQo; import com.tanpu.community.api.beans.qo.AttachmentDetailVo;
import com.tanpu.community.api.beans.qo.MainTextQo; import com.tanpu.community.api.beans.qo.ThemeContentQo;
import com.tanpu.community.api.beans.qo.ThemeQo; import com.tanpu.community.api.beans.qo.ThemeQo;
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.ForwardThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeListByTopicReq; import com.tanpu.community.api.beans.req.theme.ThemeListByTopicReq;
import com.tanpu.community.api.beans.req.theme.ThemeListReq; import com.tanpu.community.api.beans.req.theme.ThemeListReq;
import com.tanpu.community.api.enums.BlockTypeEnum; import com.tanpu.community.api.beans.vo.feign.CoursePackageDetail;
import com.tanpu.community.api.enums.CollectionTypeEnum; import com.tanpu.community.api.beans.vo.feign.ProductInfoVO;
import com.tanpu.community.api.enums.ThemeListTypeEnum; import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import com.tanpu.community.api.enums.ThemeTypeEnum; import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO;
import com.tanpu.community.api.enums.*;
import com.tanpu.community.dao.entity.community.BlackListEntity; import com.tanpu.community.dao.entity.community.BlackListEntity;
import com.tanpu.community.dao.entity.community.HomePageEntity; import com.tanpu.community.dao.entity.community.HomePageEntity;
import com.tanpu.community.dao.entity.community.ThemeAttachmentEntity; import com.tanpu.community.dao.entity.community.ThemeAttachmentEntity;
import com.tanpu.community.dao.entity.community.ThemeEntity; import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.feign.course.FeignClientForCourse; import com.tanpu.community.feign.course.FeignClientForCourse;
import com.tanpu.community.api.beans.vo.feign.CourseDetailExt;
import com.tanpu.community.feign.product.FeignClientForProducts; import com.tanpu.community.feign.product.FeignClientForProducts;
import com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom; import com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import com.tanpu.community.feign.zhibo.FeignClientForZhibo; import com.tanpu.community.feign.zhibo.FeignClientForZhibo;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO;
import com.tanpu.community.service.*; import com.tanpu.community.service.*;
import com.tanpu.community.service.other.*; import com.tanpu.community.service.other.*;
import com.tanpu.community.util.ConvertUtil; import com.tanpu.community.util.ConvertUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; 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;
...@@ -37,7 +34,10 @@ import javax.annotation.Resource; ...@@ -37,7 +34,10 @@ import javax.annotation.Resource;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Service @Service
public class ThemeManager { public class ThemeManager {
...@@ -97,6 +97,7 @@ public class ThemeManager { ...@@ -97,6 +97,7 @@ public class ThemeManager {
ThemeEntity themeEntity = new ThemeEntity(); ThemeEntity themeEntity = new ThemeEntity();
BeanUtils.copyProperties(req, themeEntity); BeanUtils.copyProperties(req, themeEntity);
themeEntity.setAuthorId(userId); themeEntity.setAuthorId(userId);
themeEntity.setContent(JsonUtil.toJson(req.getContent()));
themeService.insertTheme(themeEntity); themeService.insertTheme(themeEntity);
...@@ -131,17 +132,16 @@ public class ThemeManager { ...@@ -131,17 +132,16 @@ public class ThemeManager {
return themeQos; return themeQos;
} }
//返回正文 //查询正文
public MainTextQo getMainText(String themeId, String userId) { public ThemeQo getDetail(String themeId, String userId) {
ThemeEntity themeEntity = themeService.queryByThemeId(themeId); ThemeEntity themeEntity = themeService.queryByThemeId(themeId);
if (themeEntity == null) { if (themeEntity == null) {
throw new BizException("找不到帖子id:" + themeId); throw new BizException("找不到帖子id:" + themeId);
} }
MainTextQo mainTextQo = new MainTextQo(); ThemeQo themeQo = ConvertUtil.themeEntityToQo(themeEntity);
BeanUtils.copyProperties(themeEntity, mainTextQo); buildMainTestExtraInfo(themeQo, userId);
buildMainTestExtraInfo(mainTextQo, userId); return themeQo;
return mainTextQo;
} }
// 点赞 // 点赞
...@@ -224,12 +224,11 @@ public class ThemeManager { ...@@ -224,12 +224,11 @@ public class ThemeManager {
private void buildThemeQoExtraInfo(String userId, ThemeQo themeQO) { private void buildThemeQoExtraInfo(String userId, ThemeQo themeQO) {
//附件列表 //附件列表
String themeId = themeQO.getThemeId(); String themeId = themeQO.getThemeId();
List<ThemeAttachmentEntity> attachments = themeAttachmentService.selectByThemeId(themeId); List<ThemeContentQo> content = themeQO.getContent();
if (!CollectionUtils.isEmpty(attachments)) { for (ThemeContentQo themeContentQo : content) {
ThemeAttachmentEntity attachmentEntity = attachments.get(0); transferAttachment(themeContentQo,userId);
AttachmentQo attachmentQo = AttachmentQo.builder().type(attachmentEntity.getAttachType()).attachment(transferAttachment(attachmentEntity, userId)).build();
//TODO CONTENT添加附件detail
} }
//迄今时间 //迄今时间
themeQO.setUpToNowTime(calUpToNowTime(themeQO.getCreateTime())); themeQO.setUpToNowTime(calUpToNowTime(themeQO.getCreateTime()));
//是否关注作者 //是否关注作者
...@@ -250,71 +249,55 @@ public class ThemeManager { ...@@ -250,71 +249,55 @@ public class ThemeManager {
} }
//组装正文详情 //组装正文详情
private void buildMainTestExtraInfo(MainTextQo maintTextQo, String userId) { private void buildMainTestExtraInfo(ThemeQo themeQo, String userId) {
//附件列表 //附件列表
List<ThemeAttachmentEntity> attachments = themeAttachmentService.selectByThemeId(maintTextQo.getThemeId()); String themeId = themeQo.getThemeId();
if (!CollectionUtils.isEmpty(attachments)) { List<ThemeContentQo> content = themeQo.getContent();
List<AttachmentQo> attachmentQos = new ArrayList<>(); for (ThemeContentQo themeContentQo : content) {
attachments.forEach(o -> attachmentQos.add(AttachmentQo.builder() transferAttachment(themeContentQo,userId);
.type(o.getAttachType())
.attachment(transferAttachment(o, userId))
.build()));
} }
//迄今时间 //迄今时间
maintTextQo.setUpToNowTime(calUpToNowTime(maintTextQo.getCreateTime())); themeQo.setUpToNowTime(calUpToNowTime(themeQo.getCreateTime()));
//用户信息:头像、昵称 //用户信息:头像、昵称
HomePageEntity author = homePageService.selectByUserId(userId); HomePageEntity author = homePageService.selectByUserId(userId);
maintTextQo.setUserImg(author.getHeadImg()); themeQo.setUserImg(author.getHeadImg());
maintTextQo.setNickName(author.getNickName()); themeQo.setNickName(author.getNickName());
return; return;
} }
public Object transferAttachment(ThemeAttachmentEntity themeAttachment, String userId) { public void transferAttachment(ThemeContentQo themeContentQo, String userId) {
String attachmentId = themeAttachment.getAttachId(); String type = themeContentQo.getType();
switch (themeAttachment.getAttachType()) { if (RelTypeEnum.FUND.type.equals(type)){
//附件类型 1:产品 2:直播 3:短视频 4:课程 //产品
//TODO ENTITY 转 DTO String productId = themeContentQo.getValue();
case 1: CommonResp<ProductInfoVO> productDetailInfo = feignClientForProducts.getProductDetailInfo(productId);
CommonResp<ProductInfoVO> productDetailInfo = feignClientForProducts.getProductDetailInfo(attachmentId); themeContentQo.setDetail(AttachmentDetailVo.builder().productInfoVO(productDetailInfo.getData()).build());
return productDetailInfo.getData();
// return finProResService.selectById(themeAttachment.getAttchId()); }else if (RelTypeEnum.LIVE.type.equals(type)){
//直播
case 2: String zhiboId = themeContentQo.getValue();
CommonResp<ZhiboDetailVO> zhiboDetailVOCommonResp = feignClientForZhibo.queryZhiboDetail(attachmentId); CommonResp<ZhiboDetailVO> zhiboDetailVOCommonResp = feignClientForZhibo.queryZhiboDetail(zhiboId);
return zhiboDetailVOCommonResp.getData(); themeContentQo.setDetail(AttachmentDetailVo.builder().zhiboDetailVO(zhiboDetailVOCommonResp.getData()).build());
// return zhiboService.selectByid(themeAttachment.getAttchId());
case 3: }else if (RelTypeEnum.SHORT_VIDEO.type.equals(type)){
String[] attachmentIds = new String[]{attachmentId}; //短视频
String videoId = themeContentQo.getValue();
String[] attachmentIds = new String[]{videoId};
CommonResp<List<ShortVideoBaseInfoResp>> shortVideoBaseInfo = CommonResp<List<ShortVideoBaseInfoResp>> shortVideoBaseInfo =
feignClientForTanpuroom.getShortVideoBaseInfo(Arrays.asList(attachmentIds)); feignClientForTanpuroom.getShortVideoBaseInfo(Arrays.asList(attachmentIds));
return shortVideoBaseInfo.getData().get(0); themeContentQo.setDetail(AttachmentDetailVo.builder().shortVideoBaseInfoResp(shortVideoBaseInfo.getData().get(0)).build());
// CurriculumResEntity curriculumResEntity = curriculumResService.selectShortVideo(themeAttachment.getAttchId());
// return curriculumResEntity; }else if (RelTypeEnum.PACKAGE.type.equals(type)){
case 4: //课程
String[] split = attachmentId.split(","); String packageId = themeContentQo.getValue();
if (split.length != 2) { CommonResp<CoursePackageDetail> courseIdDetailInfo = feignClientForCourse.getCoursePackageDetailInfo(packageId);
throw new BizException("课程id格式错误:" + attachmentId); themeContentQo.setDetail(AttachmentDetailVo.builder().coursePackageDetail(courseIdDetailInfo.getData()).build());
} }
String courseId = split[0];
String packageId = split[1];
CommonResp<CourseDetailExt> courseIdDetailInfo = feignClientForCourse.getCourseIdDetailInfo(courseId, packageId);
return courseIdDetailInfo.getData();
// CurriCulumInfoDetailDto curriCulumInfoDetailDto = CurriCulumInfoDetailDto.builder().curriculumId(attachmentId).userId(userId).build();
// CommonResp<CurriculumDetailVo> curriculumDetailVoCommonResp = feignClientForTanpuroom.queryCurriculumDetail(curriCulumInfoDetailDto);
// return curriculumDetailVoCommonResp.getData();
// curriculumResEntity = curriculumResService.selectById(themeAttachment.getAttchId());
//
// OrderFlowEntity orderFlowEntity = orderFlowService.queryByUserAndProId(themeAttachment.getThemeId(), userId);
// return curriculumResEntity;
default:
return null;
} }
}
//计算迄今时间 //计算迄今时间
......
package com.tanpu.community.util; package com.tanpu.community.util;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.TopicDO; import com.tanpu.community.api.beans.TopicDO;
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;
...@@ -15,9 +17,11 @@ import java.util.stream.Collectors; ...@@ -15,9 +17,11 @@ import java.util.stream.Collectors;
public class ConvertUtil { public class ConvertUtil {
public static ThemeQo themeEntityToDTO(ThemeEntity themeEntity) { public static ThemeQo themeEntityToQo(ThemeEntity themeEntity) {
ThemeQo themeQO = new ThemeQo(); ThemeQo themeQO = new ThemeQo();
BeanUtils.copyProperties(themeEntity, themeQO); BeanUtils.copyProperties(themeEntity, themeQO);
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() {});
themeQO.setContent(themeContentQos);
return themeQO; return themeQO;
} }
...@@ -29,7 +33,7 @@ public class ConvertUtil { ...@@ -29,7 +33,7 @@ public class ConvertUtil {
} }
public static List<ThemeQo> themeEntitiesToDTOs(List<ThemeEntity> themeEntities) { public static List<ThemeQo> themeEntitiesToDTOs(List<ThemeEntity> themeEntities) {
return themeEntities.stream().map(ConvertUtil::themeEntityToDTO).collect(Collectors.toList()); return themeEntities.stream().map(ConvertUtil::themeEntityToQo).collect(Collectors.toList());
} }
......
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