Commit 02259a59 authored by 刘基明's avatar 刘基明

产品、短视频、直播详情Tab

parent 882eec9e
......@@ -68,4 +68,5 @@ public class ThemeDTO {
private Integer deleteTag;
private Object attachmentInfo;
}
......@@ -21,13 +21,13 @@ public class CodeAutoGenerator {
String author = "xudong";
String mysqlUserName = "tamp_admin";
String mysqlPassword = "@imeng123";
String jdbcUrl = "jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_community";
String[] tables = new String[]{"topic"};
String jdbcUrl = "jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_user";
String[] tables = new String[]{"curriculum_res"};
// String[] tables = new String[]{"visit_summary", "black_list","collection","comment","fans_rel","file_record","home_page","theme","topic"};
String basePackage = "com.tanpu.community";
String mapperPackage = "dao.mapper.community";
String entityPackage = "dao.entity.community";
String xmlPath = "D:\\code\\backend\\tanpu-community\\community-service\\src\\main\\resources\\mapper\\community";
String mapperPackage = "dao.mapper.user";
String entityPackage = "dao.entity.user";
String xmlPath = "D:\\code\\backend\\tanpu-community\\community-service\\src\\main\\resources\\mapper\\user";
AutoGenerator autoGenerator = new AutoGenerator();
//全局配置
GlobalConfig gc = new GlobalConfig();
......
package com.tanpu.community.dao.entity.user;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
* 课程资源
* </p>
*
* @author xudong
* @since 2021-06-23
*/
@TableName("curriculum_res")
@ApiModel(value="CurriculumResEntity对象", description="课程资源")
public class CurriculumResEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private String id;
@ApiModelProperty(value = "课程名称")
private String title;
@ApiModelProperty(value = "课程音视频")
private String audio;
@ApiModelProperty(value = "音/视频类型 1:音频 2:视频 3:小视频")
private Integer audioType;
@ApiModelProperty(value = "讲师id")
private String teacherId;
@ApiModelProperty(value = "讲师姓名")
private String teacherName;
@ApiModelProperty(value = "文稿内容")
private String content;
@ApiModelProperty(value = "时长")
private Integer duration;
@ApiModelProperty(value = "文件大小KB")
private Integer fileSize;
@ApiModelProperty(value = "组织id")
private String orgId;
@ApiModelProperty(value = "房间密码")
private String roomPwd;
@ApiModelProperty(value = "白名单 1:白名单 2:黑名单")
private Integer whiteList;
@ApiModelProperty(value = "创建人")
private String createBy;
@ApiModelProperty(value = "阅读数")
private Integer readNum;
@ApiModelProperty(value = "阅读基础数")
private Integer readBaseNum;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新人")
private String updateBy;
@ApiModelProperty(value = "更新时间")
private LocalDateTime updateTime;
@ApiModelProperty(value = "删除标识")
private Integer deleteTag;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "简介")
private String info;
@ApiModelProperty(value = "封面")
private String cover;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAudio() {
return audio;
}
public void setAudio(String audio) {
this.audio = audio;
}
public Integer getAudioType() {
return audioType;
}
public void setAudioType(Integer audioType) {
this.audioType = audioType;
}
public String getTeacherId() {
return teacherId;
}
public void setTeacherId(String teacherId) {
this.teacherId = teacherId;
}
public String getTeacherName() {
return teacherName;
}
public void setTeacherName(String teacherName) {
this.teacherName = teacherName;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public Integer getFileSize() {
return fileSize;
}
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getRoomPwd() {
return roomPwd;
}
public void setRoomPwd(String roomPwd) {
this.roomPwd = roomPwd;
}
public Integer getWhiteList() {
return whiteList;
}
public void setWhiteList(Integer whiteList) {
this.whiteList = whiteList;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Integer getReadNum() {
return readNum;
}
public void setReadNum(Integer readNum) {
this.readNum = readNum;
}
public Integer getReadBaseNum() {
return readBaseNum;
}
public void setReadBaseNum(Integer readBaseNum) {
this.readBaseNum = readBaseNum;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public Integer getDeleteTag() {
return deleteTag;
}
public void setDeleteTag(Integer deleteTag) {
this.deleteTag = deleteTag;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
@Override
public String toString() {
return "CurriculumResEntity{" +
"id=" + id +
", title=" + title +
", audio=" + audio +
", audioType=" + audioType +
", teacherId=" + teacherId +
", teacherName=" + teacherName +
", content=" + content +
", duration=" + duration +
", fileSize=" + fileSize +
", orgId=" + orgId +
", roomPwd=" + roomPwd +
", whiteList=" + whiteList +
", createBy=" + createBy +
", readNum=" + readNum +
", readBaseNum=" + readBaseNum +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
", status=" + status +
", sort=" + sort +
", info=" + info +
", cover=" + cover +
"}";
}
}
package com.tanpu.community.dao.mapper.user;
import com.tanpu.community.dao.entity.user.CurriculumResEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 课程资源 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-06-23
*/
public interface CurriculumResMapper extends BaseMapper<CurriculumResEntity> {
}
package com.tanpu.community.dao.mapper.user;
import com.tanpu.community.dao.entity.user.FinProResEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author xudong
* @since 2021-06-23
*/
public interface FinProResMapper extends BaseMapper<FinProResEntity> {
}
package com.tanpu.community.dao.mapper.zhibo;
import com.tanpu.community.dao.entity.zhibo.ZhiboThemeEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 直播间信息表 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-06-23
*/
public interface ZhiboThemeMapper extends BaseMapper<ZhiboThemeEntity> {
}
......@@ -4,12 +4,15 @@ import com.tanpu.community.api.beans.ThemeDTO;
import com.tanpu.community.api.constants.BlockTypeEnum;
import com.tanpu.community.api.constants.CollectionTypeEnum;
import com.tanpu.community.api.constants.CommentTypeEnum;
import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.dao.entity.community.BlackListEntity;
import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.entity.community.FansRelEntity;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.dao.entity.user.CurriculumResEntity;
import com.tanpu.community.dao.entity.user.FinProResEntity;
import com.tanpu.community.dao.entity.zhibo.ZhiboThemeEntity;
import com.tanpu.community.service.*;
import com.tanpu.community.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -37,16 +40,47 @@ public class ThemeManager {
@Autowired
private BlackListService blackListService;
@Autowired
private FinProResService finProResService;
@Autowired
private RedisService redisService;
@Autowired
private ZhiboService zhiboService;
@Autowired
private CurriculumResService curriculumResService;
// 返回推荐主题文章
public List<ThemeDTO> selectHotThemes() {
// TODO:根据算法计算推荐主题
List<ThemeEntity> themeEntities = themeService.selectAll();
List<ThemeDTO> themeDTOS = ConvertUtil.themeEntitiesToDTOs(themeEntities);
for (ThemeDTO themeDTO : themeDTOS) {
switch (themeDTO.getAttachType()) {
//附件类型 1:产品 2:直播 3:短视频 4:课程
//TODO ENTITY 转 DTO
case 1:
FinProResEntity finProResEntity = finProResService.selectById(themeDTO.getAttachment());
themeDTO.setAttachmentInfo(finProResEntity);
break;
case 2:
ZhiboThemeEntity zhiboThemeEntity = zhiboService.selectByid(themeDTO.getAttachment());
themeDTO.setAttachmentInfo(zhiboThemeEntity);
break;
case 3:
CurriculumResEntity curriculumResEntity = curriculumResService.selectById(themeDTO.getAttachment());
themeDTO.setAttachmentInfo(curriculumResEntity);
break;
case 4:
//todo 课程详情
break;
default:
break;
}
themeDTO.setUpToNowTime(calUpToNowTime(themeDTO.getCreateTime()));
//TODO 添加用户名、头像、认证
}
......
package com.tanpu.community.service;
import com.tanpu.community.dao.entity.user.CurriculumResEntity;
import com.tanpu.community.dao.mapper.user.CurriculumResMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 短视频详情
*/
@Service
public class CurriculumResService {
@Resource
private CurriculumResMapper curriculumResMapper;
public CurriculumResEntity selectById(String id) {
return curriculumResMapper.selectById(id);
}
}
package com.tanpu.community.service;
import com.tanpu.community.dao.entity.user.FinProResEntity;
import com.tanpu.community.dao.mapper.user.FinProResMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 产品详情
*/
@Service
public class FinProResService {
@Resource
private FinProResMapper finProResMapper;
public FinProResEntity selectById(String id){
return finProResMapper.selectById(id);
}
}
package com.tanpu.community.service;
import com.tanpu.community.dao.entity.zhibo.ZhiboThemeEntity;
import com.tanpu.community.dao.mapper.zhibo.ZhiboThemeMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 直播详情
*/
@Service
public class ZhiboService {
@Resource
private ZhiboThemeMapper zhiboThemeMapper;
public ZhiboThemeEntity selectByid(String id) {
return zhiboThemeMapper.selectById(id);
}
}
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