提交 8a1556fe 编写于 作者: F fengyw

增加课程的评论和收藏功能

上级 d77916c3
......@@ -16,7 +16,7 @@ public enum VodPlatformEnum {
/**
* 私有云
*/
PRIVATE(1, "私有化", "pri%"),
PRIVATEY(1, "私有云", "priy%"),
/**
* 保利威
......@@ -26,7 +26,12 @@ public enum VodPlatformEnum {
/**
* 百家云
*/
BJYUN(3, "百家云(待实现)", "baijy%");
BAIJY(3, "百家云(待实现)", "baijy%"),
/**
* 百家云
*/
BOKECC(4, "获得场景(待实现)", "bokecc%");
/**
* 编码
......
......@@ -2,19 +2,23 @@ package com.roncoo.education.common.video;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import com.roncoo.education.common.core.enums.VodPlatformEnum;
import com.roncoo.education.common.core.tools.JSUtil;
import com.roncoo.education.common.video.impl.polyv.PolyvVodUtil;
import com.roncoo.education.common.video.impl.polyv.vod.resp.PolyvVideoInfoResp;
import com.roncoo.education.common.video.impl.priyun.PrivateYunVodUtil;
import com.roncoo.education.common.video.impl.priyun.resp.PrivateYunInfoResp;
import com.roncoo.education.common.video.impl.priyun.resp.PrivateYunPlayTokenRes;
import com.roncoo.education.common.video.impl.priyun.resp.PrivateYunVideoClarityResp;
import com.roncoo.education.common.video.impl.priyun.resp.PrivateYunVideoInfoResp;
import com.roncoo.education.common.video.req.VideoConfig;
import com.roncoo.education.common.video.req.VodPlayConfigReq;
import com.roncoo.education.common.video.resp.InfoResp;
import com.roncoo.education.common.video.resp.VodInfoResp;
import lombok.extern.slf4j.Slf4j;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
......@@ -35,6 +39,10 @@ public final class VodUtil {
* @param req
*/
public static void init(VideoConfig req) {
if (VodPlatformEnum.PRIVATEY.getCode().equals(req.getVodPlatform())) {
// 无需初始化
return;
}
if (VodPlatformEnum.POLYV.getCode().equals(req.getVodPlatform())) {
// 设置视频回调地址
String callbackUrl = req.getWebsiteDomain() + "gateway/course/api/callback/polyv/upload";
......@@ -44,11 +52,30 @@ public final class VodUtil {
PolyvVodUtil.setPlaysafe(req.getPolyvUserId(), req.getPolyvSecretKey(), "1", "web");
// 设置授权播放和防录屏跑马灯地址
String marqueeUrl = req.getWebsiteDomain() + "gateway/course/api/callback/polyv/vod/auth";
PolyvVodUtil.setMarquee(req.getPolyvAppId(), req.getPolyvAppSecret(), marqueeUrl);
} else if (VodPlatformEnum.PRIVATE.getCode().equals(req.getVodPlatform())) {
//String marqueeUrl = req.getWebsiteDomain() + "gateway/course/api/callback/polyv/vod/auth";
//PolyvVodUtil.setMarquee(req.getPolyvAppId(), req.getPolyvAppSecret(), marqueeUrl);
return;
}
}
public static InfoResp getInfo(VideoConfig req) {
InfoResp infoResp = new InfoResp();
if (VodPlatformEnum.PRIVATEY.getCode().equals(req.getVodPlatform())) {
// 无需初始化
PrivateYunInfoResp privateYunInfoResp = PrivateYunVodUtil.getInfo(req.getPriYunUrl(), req.getPriYunAccessKeyId(), req.getPriYunAccessKeySecret());
infoResp.setUsedSpace(BigDecimal.valueOf(privateYunInfoResp.getStorage()).divide(BigDecimal.valueOf(1024 * 1024 * 1024)).setScale(2, BigDecimal.ROUND_HALF_UP));
}
if (VodPlatformEnum.POLYV.getCode().equals(req.getVodPlatform())) {
JSONObject result = PolyvVodUtil.getUserMain(req.getPolyvUserId(), req.getPolyvSecretKey());
infoResp.setTotalSpace(result.getBigDecimal("totalSpace").divide(BigDecimal.valueOf(1024 * 1024 * 1024)).setScale(2, BigDecimal.ROUND_HALF_UP));
infoResp.setUsedSpace(result.getBigDecimal("usedSpace").divide(BigDecimal.valueOf(1024 * 1024 * 1024)).setScale(2, BigDecimal.ROUND_HALF_UP));
infoResp.setTotalFlow(result.getBigDecimal("totalFlow").divide(BigDecimal.valueOf(1024 * 1024 * 1024)).setScale(2, BigDecimal.ROUND_HALF_UP));
infoResp.setUsedFlow(result.getBigDecimal("usedFlow").divide(BigDecimal.valueOf(1024 * 1024 * 1024)).setScale(2, BigDecimal.ROUND_HALF_UP));
//infoResp.setUniqueNo(result.getStr("email"));
return infoResp;
}
return infoResp;
}
/**
......@@ -57,13 +84,14 @@ public final class VodUtil {
* @return json
*/
public static String getUploadConfig(VideoConfig req) {
if (VodPlatformEnum.POLYV.getCode().equals(req.getVodPlatform())) {
return JSUtil.toJsonString(PolyvVodUtil.getUploadConfig(req.getPolyvUserId(), req.getPolyvSecretKey(), req.getPolyvWriteToken()));
} else if (VodPlatformEnum.PRIVATE.getCode().equals(req.getVodPlatform())) {
if (VodPlatformEnum.PRIVATEY.getCode().equals(req.getVodPlatform())) {
// 上传回调地址
String callbackUrl = req.getWebsiteDomain() + "gateway/course/api/callback/priyun/vod/upload";
return JSUtil.toJsonString(PrivateYunVodUtil.getUploadConfig(req.getPriYunAccessKeyId(), req.getPriYunAccessKeySecret(), req.getPriYunUrl(), callbackUrl, ""));
}
if (VodPlatformEnum.POLYV.getCode().equals(req.getVodPlatform())) {
return JSUtil.toJsonString(PolyvVodUtil.getUploadConfig(req.getPolyvUserId(), req.getPolyvSecretKey(), req.getPolyvWriteToken()));
}
return "";
}
......@@ -78,6 +106,15 @@ public final class VodUtil {
VodInfoResp resp = new VodInfoResp();
resp.setVodPlatform(req.getVodPlatform());
resp.setVid(vid);
if (VodPlatformEnum.PRIVATEY.getCode().equals(req.getVodPlatform())) {
PrivateYunVideoInfoResp videoInfoResp = PrivateYunVodUtil.getVideoInfo(req.getPriYunUrl(), req.getPriYunAccessKeyId(), req.getPriYunAccessKeySecret(), vid, "");
if (ObjectUtil.isNotNull(videoInfoResp)) {
resp.setDuration(Integer.valueOf(videoInfoResp.getVideoDuration()));
resp.setCoverUrl(videoInfoResp.getVideoThumbnail());
resp.setFileSize(Long.valueOf(videoInfoResp.getVideoSize()));
}
return resp;
}
if (VodPlatformEnum.POLYV.getCode().equals(req.getVodPlatform())) {
List<PolyvVideoInfoResp> responseList = PolyvVodUtil.getVideoInfo(Collections.singletonList(vid), req.getPolyvUserId(), req.getPolyvSecretKey());
if (CollectionUtil.isEmpty(responseList)) {
......@@ -93,13 +130,7 @@ public final class VodUtil {
} else {
log.warn("保利威-getVideoInfo={}", JSUtil.toJsonString(basicInfo));
}
} else if (VodPlatformEnum.PRIVATE.getCode().equals(req.getVodPlatform())) {
PrivateYunVideoInfoResp videoInfoResp = PrivateYunVodUtil.getVideoInfo(req.getPriYunUrl(), req.getPriYunAccessKeyId(), req.getPriYunAccessKeySecret(), vid, "");
if (ObjectUtil.isNotNull(videoInfoResp)) {
resp.setDuration(Integer.valueOf(videoInfoResp.getVideoDuration()));
resp.setCoverUrl(videoInfoResp.getVideoThumbnail());
resp.setFileSize(Long.valueOf(videoInfoResp.getVideoSize()));
}
return resp;
}
return resp;
}
......@@ -112,10 +143,13 @@ public final class VodUtil {
* @return
*/
public static void deleteVideo(VideoConfig req, String vid) {
if (VodPlatformEnum.PRIVATEY.getCode().equals(req.getVodPlatform())) {
PrivateYunVodUtil.delete(req.getPriYunUrl(), req.getPriYunAccessKeyId(), req.getPriYunAccessKeySecret(), vid, "");
return;
}
if (VodPlatformEnum.POLYV.getCode().equals(req.getVodPlatform())) {
PolyvVodUtil.delete(vid, req.getPolyvUserId(), req.getPolyvSecretKey());
} else if (VodPlatformEnum.PRIVATE.getCode().equals(req.getVodPlatform())) {
PrivateYunVodUtil.delete(req.getPriYunUrl(), req.getPriYunAccessKeyId(), req.getPriYunAccessKeySecret(), vid, "");
return;
}
}
......@@ -127,10 +161,7 @@ public final class VodUtil {
* @return
*/
public static String getPlayConfig(VideoConfig req, VodPlayConfigReq playConfigReq) {
if (VodPlatformEnum.POLYV.getCode().equals(req.getVodPlatform())) {
// 返回播放配置
return JSUtil.toJsonString(PolyvVodUtil.getSignForPlay(req.getPolyvUserId(), req.getPolyvSecretKey(), playConfigReq));
} else if (VodPlatformEnum.PRIVATE.getCode().equals(req.getVodPlatform())) {
if (VodPlatformEnum.PRIVATEY.getCode().equals(req.getVodPlatform())) {
// 播放授权地址
String authUrl = req.getWebsiteDomain() + "gateway/course/api/callback/priyun/auth";
PrivateYunPlayTokenRes tokenResponse = PrivateYunVodUtil.token(req.getPriYunUrl(), authUrl, req.getPriYunAccessKeyId(), req.getPriYunAccessKeySecret(), playConfigReq.getVid(), "", playConfigReq.getExpiresIn().toString(), playConfigReq.getViewerId());
......@@ -141,6 +172,10 @@ public final class VodUtil {
}
return JSUtil.toJsonString(playUrls);
}
if (VodPlatformEnum.POLYV.getCode().equals(req.getVodPlatform())) {
// 返回播放配置
return JSUtil.toJsonString(PolyvVodUtil.getSignForPlay(req.getPolyvUserId(), req.getPolyvSecretKey(), playConfigReq));
}
return "";
}
}
......@@ -9,6 +9,7 @@ import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.roncoo.education.common.video.impl.priyun.resp.PrivateYunConfigResp;
import com.roncoo.education.common.video.impl.priyun.resp.PrivateYunInfoResp;
import com.roncoo.education.common.video.impl.priyun.resp.PrivateYunPlayTokenRes;
import com.roncoo.education.common.video.impl.priyun.resp.PrivateYunVideoInfoResp;
import lombok.extern.slf4j.Slf4j;
......@@ -19,7 +20,7 @@ import java.util.SortedMap;
import java.util.TreeMap;
/**
* 私有点播工具类
* 私有点播工具类
*
* @author wujing
*/
......@@ -34,10 +35,38 @@ public final class PrivateYunVodUtil {
private PrivateYunVodUtil() {
}
public static PrivateYunConfigResp getUploadConfig(String vcloudAccessKeyId, String vcloudAccessKeySecret, String vcloudUrl, String callbackUrl, String state) {
/**
* 查询视频云信息
*
* @param url 点播私有云域名路径
* @param accessKeyId 私有云配置accessKeyId
* @param secretKey 私有云配置accessKeyIdsecretKey
* @return
*/
public static PrivateYunInfoResp getInfo(String url, String accessKeyId, String secretKey) {
String requestUrl = url + "v1/video/info";
Map<String, String> paramMap = new HashMap<>();
paramMap.put("accessKeyId", accessKeyId);
paramMap.put("signatureNonce", String.valueOf(System.currentTimeMillis()));
// 签名
paramMap.put("sign", getSign(paramMap, secretKey));
// 请求
String result = HttpUtil.post(requestUrl, JSONUtil.toJsonStr(paramMap));
log.info("私有云--查询账号信息响应结果:{}", result);
JSONObject resultJson = JSONUtil.parseObj(result);
if (SUCCESS_CODE.equals(resultJson.getInt("code"))) {
return JSONUtil.toBean(resultJson.getStr("data"), PrivateYunInfoResp.class);
}
log.info("私有云--查询账号信息失败:{}", result);
return null;
}
public static PrivateYunConfigResp getUploadConfig(String vcloudAccessKeyId, String vcloudAccessKeySecret, String url, String callbackUrl, String state) {
PrivateYunConfigResp privateVodConfig = new PrivateYunConfigResp();
privateVodConfig.setAccessKeyId(vcloudAccessKeyId);
privateVodConfig.setUploadUrl(vcloudUrl + "v1/upload/");
privateVodConfig.setUploadUrl(url + "v1/upload/");
privateVodConfig.setCallbackUrl(callbackUrl);
privateVodConfig.setState(state);
privateVodConfig.setSignatureNonce(String.valueOf(System.currentTimeMillis()));
......@@ -52,15 +81,15 @@ public final class PrivateYunVodUtil {
/**
* 查询视频信息
*
* @param vcloudUrl 点播私有化域名路径
* @param accessKeyId 私有配置accessKeyId
* @param secretKey 私有配置accessKeyIdsecretKey
* @param url 点播私有云域名路径
* @param accessKeyId 私有配置accessKeyId
* @param secretKey 私有配置accessKeyIdsecretKey
* @param videoVid 视频vid
* @param state 自定义字段(企业ID)
* @return
*/
public static PrivateYunVideoInfoResp getVideoInfo(String vcloudUrl, String accessKeyId, String secretKey, String videoVid, String state) {
String requestUrl = vcloudUrl + "v1/video/detail";
public static PrivateYunVideoInfoResp getVideoInfo(String url, String accessKeyId, String secretKey, String videoVid, String state) {
String requestUrl = url + "v1/video/detail";
Map<String, String> paramMap = new HashMap<>();
paramMap.put("accessKeyId", accessKeyId);
paramMap.put("signatureNonce", String.valueOf(System.currentTimeMillis()));
......@@ -70,29 +99,29 @@ public final class PrivateYunVodUtil {
paramMap.put("state", state);
// 请求
String result = HttpUtil.post(requestUrl, JSONUtil.toJsonStr(paramMap));
log.info("私有化视--查询视频信息响应结果:{}", result);
log.info("私有--查询视频信息响应结果:{}", result);
JSONObject resultJson = JSONUtil.parseObj(result);
if (SUCCESS_CODE.equals(resultJson.getInt("code"))) {
return JSONUtil.toBean(resultJson.getStr("data"), PrivateYunVideoInfoResp.class);
}
log.info("私有化视--查询视频信息失败:{}", result);
log.info("私有--查询视频信息失败:{}", result);
return null;
}
/**
* 删除视频
*
* @param vcloudUrl 点播私有化域名路径
* @param accessKeyId 私有配置accessKeyId
* @param secretKey 私有配置accessKeyIdsecretKey
* @param url 点播私有云域名路径
* @param accessKeyId 私有配置accessKeyId
* @param secretKey 私有配置accessKeyIdsecretKey
* @param videoVid 视频vid
* @param state 自定义字段(企业ID)
* @return
*/
public static String delete(String vcloudUrl, String accessKeyId, String secretKey, String videoVid, String state) {
String requestUrl = vcloudUrl + "v1/video/delete";
public static String delete(String url, String accessKeyId, String secretKey, String videoVid, String state) {
String requestUrl = url + "v1/video/delete";
Map<String, String> paramMap = new HashMap<>();
paramMap.put("accessKeyId", accessKeyId);
paramMap.put("signatureNonce", String.valueOf(System.currentTimeMillis()));
......@@ -102,14 +131,14 @@ public final class PrivateYunVodUtil {
paramMap.put("state", state);
// 请求
String result = HttpUtil.post(requestUrl, JSONUtil.toJsonStr(paramMap));
log.info("私有化视--删除视频响应结果:{}", result);
log.info("私有--删除视频响应结果:{}", result);
JSONObject resultJson = JSONUtil.parseObj(result);
if (SUCCESS_CODE.equals(resultJson.getInt("code"))) {
return resultJson.getStr("msg");
}
log.info("私有化视--删除视频响应结果失败:{}", result);
log.info("私有--删除视频响应结果失败:{}", result);
return resultJson.getStr("data");
}
......@@ -117,18 +146,18 @@ public final class PrivateYunVodUtil {
/**
* token接口
*
* @param vcloudUrl 点播私有化域名路径
* @param url 点播私有云域名路径
* @param authUrl 授权地址,请求播放时调用该接口
* @param accessKeyId 私有配置accessKeyId
* @param secretKey 私有配置accessKeyIdsecretKey
* @param accessKeyId 私有配置accessKeyId
* @param secretKey 私有配置accessKeyIdsecretKey
* @param videoVid 视频vid
* @param state 自定义字段(企业ID)
* @param expires 过期时间,单位:S(默认0,不过期)
* @param viewId 观看者id,建议不同的观看者使用不同的id
* @return
*/
public static PrivateYunPlayTokenRes token(String vcloudUrl, String authUrl, String accessKeyId, String secretKey, String videoVid, String state, String expires, String viewId) {
String requestUrl = vcloudUrl + "v1/video/token";
public static PrivateYunPlayTokenRes token(String url, String authUrl, String accessKeyId, String secretKey, String videoVid, String state, String expires, String viewId) {
String requestUrl = url + "v1/video/token";
Map<String, String> paramMap = new HashMap<>();
paramMap.put("accessKeyId", accessKeyId);
paramMap.put("signatureNonce", String.valueOf(System.currentTimeMillis()));
......@@ -141,14 +170,14 @@ public final class PrivateYunVodUtil {
paramMap.put("authUrl", authUrl);
// 请求
String result = HttpUtil.post(requestUrl, JSONUtil.toJsonStr(paramMap));
log.info("私有化视--获取token响应结果:{}", result);
log.info("私有--获取token响应结果:{}", result);
JSONObject resultJson = JSONUtil.parseObj(result);
if (SUCCESS_CODE.equals(resultJson.getInt("code"))) {
return JSONUtil.toBean(resultJson.getStr("data"), PrivateYunPlayTokenRes.class);
}
log.info("私有化视--获取token响应结果:{}", result);
log.info("私有--获取token响应结果:{}", result);
return null;
}
......
package com.roncoo.education.common.video.impl.priyun.resp;
import lombok.Data;
import java.io.Serializable;
/**
* 查询视频信息
*
* @author LYQ
*/
@Data
public class PrivateYunInfoResp implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 存储使用空间,单位:KB
*/
private Long storage;
/**
* 视频总数量
*/
private Long count;
}
......@@ -62,15 +62,15 @@ public class VideoConfig implements Serializable {
private String polyvAppSecret;
/**
* 私有,Url
* 私有,Url
*/
private String priYunUrl;
/**
* 私有,AccessKeyId
* 私有,AccessKeyId
*/
private String priYunAccessKeyId;
/**
* 私有,AccessKeySecret
* 私有,AccessKeySecret
*/
private String priYunAccessKeySecret;
}
package com.roncoo.education.system.service.admin.resp;
package com.roncoo.education.common.video.resp;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* <p>
* 录播信息
* </p>
* 查询账号信息
*
* @author wujing
* @author fengyw
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "StatisticsVodRESP", description = "点播信息")
public class StatVodResp implements Serializable {
public class InfoResp implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 2222356652726536710L;
@ApiModelProperty(value = "用户总空间,单位G")
private BigDecimal totalSpace = BigDecimal.ZERO;
/**
* 账号
*/
private String uniqueNo;
@ApiModelProperty(value = "已用空间,单位G")
/**
* 总空间,单位:GB
*/
private BigDecimal totalSpace = BigDecimal.ZERO;
/**
* 使用空间,单位:GB
*/
private BigDecimal usedSpace = BigDecimal.ZERO;
@ApiModelProperty(value = "用户总流量,单位G")
/**
* 总流量,单位:GB
*/
private BigDecimal totalFlow = BigDecimal.ZERO;
@ApiModelProperty(value = "已用流量,单位G")
/**
* 使用流量,单位:GB
*/
private BigDecimal usedFlow = BigDecimal.ZERO;
private String email;
}
package com.roncoo.education.course.dao;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollect;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollectExample;
import java.util.List;
/**
* 课程收藏 服务类
*
* @author wujing
* @date 2023-03-24
*/
public interface UserCourseCollectDao {
/**
* 保存课程收藏
*
* @param record 课程收藏
* @return 影响记录数
*/
int save(UserCourseCollect record);
/**
* 根据ID删除课程收藏
*
* @param id 主键ID
* @return 影响记录数
*/
int deleteById(Long id);
/**
* 修改课程收藏
*
* @param record 课程收藏
* @return 影响记录数
*/
int updateById(UserCourseCollect record);
/**
* 根据ID获取课程收藏
*
* @param id 主键ID
* @return 课程收藏
*/
UserCourseCollect getById(Long id);
/**
* 课程收藏--分页查询
*
* @param pageCurrent 当前页
* @param pageSize 分页大小
* @param example 查询条件
* @return 分页结果
*/
Page<UserCourseCollect> page(int pageCurrent, int pageSize, UserCourseCollectExample example);
/**
* 课程收藏--条件列出
*
* @param example 查询条件
* @return 课程收藏列表
*/
List<UserCourseCollect> listByExample(UserCourseCollectExample example);
/**
* 课程收藏--条件统计
*
* @param example 统计条件
* @return 课程收藏数量
*/
int countByExample(UserCourseCollectExample example);
UserCourseCollect getByCouserIdAndUserId(Long courseId, Long userId);
}
package com.roncoo.education.course.dao;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseComment;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCommentExample;
import java.util.List;
/**
* 课程评论 服务类
*
* @author wujing
* @date 2023-03-24
*/
public interface UserCourseCommentDao {
/**
* 保存课程评论
*
* @param record 课程评论
* @return 影响记录数
*/
int save(UserCourseComment record);
/**
* 根据ID删除课程评论
*
* @param id 主键ID
* @return 影响记录数
*/
int deleteById(Long id);
/**
* 修改课程评论
*
* @param record 课程评论
* @return 影响记录数
*/
int updateById(UserCourseComment record);
/**
* 根据ID获取课程评论
*
* @param id 主键ID
* @return 课程评论
*/
UserCourseComment getById(Long id);
/**
* 课程评论--分页查询
*
* @param pageCurrent 当前页
* @param pageSize 分页大小
* @param example 查询条件
* @return 分页结果
*/
Page<UserCourseComment> page(int pageCurrent, int pageSize, UserCourseCommentExample example);
/**
* 课程评论--条件列出
*
* @param example 查询条件
* @return 课程评论列表
*/
List<UserCourseComment> listByExample(UserCourseCommentExample example);
/**
* 课程评论--条件统计
*
* @param example 统计条件
* @return 课程评论数量
*/
int countByExample(UserCourseCommentExample example);
List<UserCourseComment> listByCourseIdAndStatusId(Long courseId, Integer statusId);
}
package com.roncoo.education.course.dao.impl;
import cn.hutool.core.collection.CollUtil;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.PageUtil;
import com.roncoo.education.common.core.tools.IdWorker;
import com.roncoo.education.course.dao.UserCourseCollectDao;
import com.roncoo.education.course.dao.impl.mapper.UserCourseCollectMapper;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollect;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollectExample;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 课程收藏 服务实现类
*
* @author wujing
* @date 2023-03-24
*/
@Repository
@RequiredArgsConstructor
public class UserCourseCollectDaoImpl implements UserCourseCollectDao {
@NotNull
private final UserCourseCollectMapper mapper;
@Override
public int save(UserCourseCollect record) {
if (record.getId() == null) {
record.setId(IdWorker.getId());
}
return this.mapper.insertSelective(record);
}
@Override
public int deleteById(Long id) {
return this.mapper.deleteByPrimaryKey(id);
}
@Override
public int updateById(UserCourseCollect record) {
record.setGmtCreate(null);
record.setGmtModified(null);
return this.mapper.updateByPrimaryKeySelective(record);
}
@Override
public UserCourseCollect getById(Long id) {
return this.mapper.selectByPrimaryKey(id);
}
@Override
public Page<UserCourseCollect> page(int pageCurrent, int pageSize, UserCourseCollectExample example) {
int count = this.mapper.countByExample(example);
pageSize = PageUtil.checkPageSize(pageSize);
pageCurrent = PageUtil.checkPageCurrent(count, pageSize, pageCurrent);
int totalPage = PageUtil.countTotalPage(count, pageSize);
example.setLimitStart(PageUtil.countOffset(pageCurrent, pageSize));
example.setPageSize(pageSize);
return new Page<>(count, totalPage, pageCurrent, pageSize, this.mapper.selectByExample(example));
}
@Override
public List<UserCourseCollect> listByExample(UserCourseCollectExample example) {
return this.mapper.selectByExample(example);
}
@Override
public int countByExample(UserCourseCollectExample example) {
return this.mapper.countByExample(example);
}
@Override
public UserCourseCollect getByCouserIdAndUserId(Long courseId, Long userId) {
UserCourseCollectExample example = new UserCourseCollectExample();
example.createCriteria().andCourseIdEqualTo(courseId).andUserIdEqualTo(userId);
List<UserCourseCollect> list = this.mapper.selectByExample(example);
if (CollUtil.isNotEmpty(list)) {
return list.get(0);
}
return null;
}
}
package com.roncoo.education.course.dao.impl;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.PageUtil;
import com.roncoo.education.common.core.tools.IdWorker;
import com.roncoo.education.course.dao.UserCourseCommentDao;
import com.roncoo.education.course.dao.impl.mapper.UserCourseCommentMapper;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseComment;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCommentExample;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 课程评论 服务实现类
*
* @author wujing
* @date 2023-03-24
*/
@Repository
@RequiredArgsConstructor
public class UserCourseCommentDaoImpl implements UserCourseCommentDao {
@NotNull
private final UserCourseCommentMapper mapper;
@Override
public int save(UserCourseComment record) {
if (record.getId() == null) {
record.setId(IdWorker.getId());
}
return this.mapper.insertSelective(record);
}
@Override
public int deleteById(Long id) {
return this.mapper.deleteByPrimaryKey(id);
}
@Override
public int updateById(UserCourseComment record) {
record.setGmtCreate(null);
record.setGmtModified(null);
return this.mapper.updateByPrimaryKeySelective(record);
}
@Override
public UserCourseComment getById(Long id) {
return this.mapper.selectByPrimaryKey(id);
}
@Override
public Page<UserCourseComment> page(int pageCurrent, int pageSize, UserCourseCommentExample example) {
int count = this.mapper.countByExample(example);
pageSize = PageUtil.checkPageSize(pageSize);
pageCurrent = PageUtil.checkPageCurrent(count, pageSize, pageCurrent);
int totalPage = PageUtil.countTotalPage(count, pageSize);
example.setLimitStart(PageUtil.countOffset(pageCurrent, pageSize));
example.setPageSize(pageSize);
return new Page<>(count, totalPage, pageCurrent, pageSize, this.mapper.selectByExample(example));
}
@Override
public List<UserCourseComment> listByExample(UserCourseCommentExample example) {
return this.mapper.selectByExample(example);
}
@Override
public int countByExample(UserCourseCommentExample example) {
return this.mapper.countByExample(example);
}
@Override
public List<UserCourseComment> listByCourseIdAndStatusId(Long courseId, Integer statusId) {
UserCourseCommentExample example = new UserCourseCommentExample();
example.createCriteria().andCourseIdEqualTo(courseId).andStatusIdEqualTo(statusId);
return this.mapper.selectByExample(example);
}
}
package com.roncoo.education.course.dao.impl.mapper;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollect;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollectExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface UserCourseCollectMapper {
int countByExample(UserCourseCollectExample example);
int deleteByExample(UserCourseCollectExample example);
int deleteByPrimaryKey(Long id);
int insert(UserCourseCollect record);
int insertSelective(UserCourseCollect record);
List<UserCourseCollect> selectByExample(UserCourseCollectExample example);
UserCourseCollect selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UserCourseCollect record, @Param("example") UserCourseCollectExample example);
int updateByExample(@Param("record") UserCourseCollect record, @Param("example") UserCourseCollectExample example);
int updateByPrimaryKeySelective(UserCourseCollect record);
int updateByPrimaryKey(UserCourseCollect record);
}
\ No newline at end of file
package com.roncoo.education.course.dao.impl.mapper;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseComment;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCommentExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface UserCourseCommentMapper {
int countByExample(UserCourseCommentExample example);
int deleteByExample(UserCourseCommentExample example);
int deleteByPrimaryKey(Long id);
int insert(UserCourseComment record);
int insertSelective(UserCourseComment record);
List<UserCourseComment> selectByExample(UserCourseCommentExample example);
UserCourseComment selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UserCourseComment record, @Param("example") UserCourseCommentExample example);
int updateByExample(@Param("record") UserCourseComment record, @Param("example") UserCourseCommentExample example);
int updateByPrimaryKeySelective(UserCourseComment record);
int updateByPrimaryKey(UserCourseComment record);
}
\ No newline at end of file
package com.roncoo.education.course.dao.impl.mapper.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
public class UserCourseCollect implements Serializable {
private Long id;
private LocalDateTime gmtCreate;
private LocalDateTime gmtModified;
private Integer statusId;
private Integer sort;
private Long userId;
private Long courseId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public LocalDateTime getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(LocalDateTime gmtCreate) {
this.gmtCreate = gmtCreate;
}
public LocalDateTime getGmtModified() {
return gmtModified;
}
public void setGmtModified(LocalDateTime gmtModified) {
this.gmtModified = gmtModified;
}
public Integer getStatusId() {
return statusId;
}
public void setStatusId(Integer statusId) {
this.statusId = statusId;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getCourseId() {
return courseId;
}
public void setCourseId(Long courseId) {
this.courseId = courseId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", gmtCreate=").append(gmtCreate);
sb.append(", gmtModified=").append(gmtModified);
sb.append(", statusId=").append(statusId);
sb.append(", sort=").append(sort);
sb.append(", userId=").append(userId);
sb.append(", courseId=").append(courseId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.roncoo.education.course.dao.impl.mapper.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
public class UserCourseComment implements Serializable {
private Long id;
private LocalDateTime gmtCreate;
private LocalDateTime gmtModified;
private Integer statusId;
private Integer sort;
private Long userId;
private Long courseId;
private Long commentId;
private String commentText;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public LocalDateTime getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(LocalDateTime gmtCreate) {
this.gmtCreate = gmtCreate;
}
public LocalDateTime getGmtModified() {
return gmtModified;
}
public void setGmtModified(LocalDateTime gmtModified) {
this.gmtModified = gmtModified;
}
public Integer getStatusId() {
return statusId;
}
public void setStatusId(Integer statusId) {
this.statusId = statusId;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getCourseId() {
return courseId;
}
public void setCourseId(Long courseId) {
this.courseId = courseId;
}
public Long getCommentId() {
return commentId;
}
public void setCommentId(Long commentId) {
this.commentId = commentId;
}
public String getCommentText() {
return commentText;
}
public void setCommentText(String commentText) {
this.commentText = commentText == null ? null : commentText.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", gmtCreate=").append(gmtCreate);
sb.append(", gmtModified=").append(gmtModified);
sb.append(", statusId=").append(statusId);
sb.append(", sort=").append(sort);
sb.append(", userId=").append(userId);
sb.append(", courseId=").append(courseId);
sb.append(", commentId=").append(commentId);
sb.append(", commentText=").append(commentText);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.roncoo.education.course.service.admin;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.course.service.admin.biz.AdminUserCourseCollectBiz;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCollectEditReq;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCollectPageReq;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCollectSaveReq;
import com.roncoo.education.course.service.admin.resp.AdminUserCourseCollectPageResp;
import com.roncoo.education.course.service.admin.resp.AdminUserCourseCollectViewResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/**
* ADMIN-课程收藏
*
* @author wujing
*/
@Api(tags = "ADMIN-课程收藏")
@RestController
@RequiredArgsConstructor
@RequestMapping("/course/admin/user/course/collect")
public class AdminUserCourseCollectController {
@NotNull
private final AdminUserCourseCollectBiz biz;
@ApiOperation(value = "课程收藏分页", notes = "课程收藏分页")
@PostMapping(value = "/page")
public Result<Page<AdminUserCourseCollectPageResp>> page(@RequestBody AdminUserCourseCollectPageReq req) {
return biz.page(req);
}
@ApiOperation(value = "课程收藏添加", notes = "课程收藏添加")
@PostMapping(value = "/save")
public Result<String> save(@RequestBody @Valid AdminUserCourseCollectSaveReq req) {
return biz.save(req);
}
@ApiOperation(value = "课程收藏查看", notes = "课程收藏查看")
@ApiImplicitParam(name = "id", value = "主键ID", dataTypeClass = Long.class, paramType = "query", required = true)
@GetMapping(value = "/view")
public Result<AdminUserCourseCollectViewResp> view(@RequestParam Long id) {
return biz.view(id);
}
@ApiOperation(value = "课程收藏修改", notes = "课程收藏修改")
@PutMapping(value = "/edit")
public Result<String> edit(@RequestBody @Valid AdminUserCourseCollectEditReq req) {
return biz.edit(req);
}
@ApiOperation(value = "课程收藏删除", notes = "课程收藏删除")
@ApiImplicitParam(name = "id", value = "主键ID", dataTypeClass = Long.class, paramType = "query", required = true)
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam Long id) {
return biz.delete(id);
}
}
package com.roncoo.education.course.service.admin;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.course.service.admin.biz.AdminUserCourseCommentBiz;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCommentEditReq;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCommentPageReq;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCommentSaveReq;
import com.roncoo.education.course.service.admin.resp.AdminUserCourseCommentPageResp;
import com.roncoo.education.course.service.admin.resp.AdminUserCourseCommentViewResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/**
* ADMIN-课程评论
*
* @author wujing
*/
@Api(tags = "ADMIN-课程评论")
@RestController
@RequiredArgsConstructor
@RequestMapping("/course/admin/user/course/comment")
public class AdminUserCourseCommentController {
@NotNull
private final AdminUserCourseCommentBiz biz;
@ApiOperation(value = "课程评论分页", notes = "课程评论分页")
@PostMapping(value = "/page")
public Result<Page<AdminUserCourseCommentPageResp>> page(@RequestBody AdminUserCourseCommentPageReq req) {
return biz.page(req);
}
@ApiOperation(value = "课程评论添加", notes = "课程评论添加")
@PostMapping(value = "/save")
public Result<String> save(@RequestBody @Valid AdminUserCourseCommentSaveReq req) {
return biz.save(req);
}
@ApiOperation(value = "课程评论查看", notes = "课程评论查看")
@ApiImplicitParam(name = "id", value = "主键ID", dataTypeClass = Long.class, paramType = "query", required = true)
@GetMapping(value = "/view")
public Result<AdminUserCourseCommentViewResp> view(@RequestParam Long id) {
return biz.view(id);
}
@ApiOperation(value = "课程评论修改", notes = "课程评论修改")
@PutMapping(value = "/edit")
public Result<String> edit(@RequestBody @Valid AdminUserCourseCommentEditReq req) {
return biz.edit(req);
}
@ApiOperation(value = "课程评论删除", notes = "课程评论删除")
@ApiImplicitParam(name = "id", value = "主键ID", dataTypeClass = Long.class, paramType = "query", required = true)
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam Long id) {
return biz.delete(id);
}
}
package com.roncoo.education.course.service.admin.biz;
import com.roncoo.education.common.service.BaseBiz;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.PageUtil;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.common.core.tools.BeanUtil;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCollectEditReq;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCollectPageReq;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCollectSaveReq;
import com.roncoo.education.course.service.admin.resp.AdminUserCourseCollectPageResp;
import com.roncoo.education.course.service.admin.resp.AdminUserCourseCollectViewResp;
import com.roncoo.education.course.dao.UserCourseCollectDao;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollect;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollectExample;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollectExample.Criteria;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
/**
* ADMIN-课程收藏
*
* @author wujing
*/
@Component
@RequiredArgsConstructor
public class AdminUserCourseCollectBiz extends BaseBiz {
@NotNull
private final UserCourseCollectDao dao;
/**
* 课程收藏分页
*
* @param req 课程收藏分页查询参数
* @return 课程收藏分页查询结果
*/
public Result<Page<AdminUserCourseCollectPageResp>> page(AdminUserCourseCollectPageReq req) {
UserCourseCollectExample example = new UserCourseCollectExample();
Criteria c = example.createCriteria();
Page<UserCourseCollect> page = dao.page(req.getPageCurrent(), req.getPageSize(), example);
Page<AdminUserCourseCollectPageResp> respPage = PageUtil.transform(page, AdminUserCourseCollectPageResp.class);
return Result.success(respPage);
}
/**
* 课程收藏添加
*
* @param req 课程收藏
* @return 添加结果
*/
public Result<String> save(AdminUserCourseCollectSaveReq req) {
UserCourseCollect record = BeanUtil.copyProperties(req, UserCourseCollect.class);
if (dao.save(record) > 0) {
return Result.success("操作成功");
}
return Result.error("操作失败");
}
/**
* 课程收藏查看
*
* @param id 主键ID
* @return 课程收藏
*/
public Result<AdminUserCourseCollectViewResp> view(Long id) {
return Result.success(BeanUtil.copyProperties(dao.getById(id), AdminUserCourseCollectViewResp.class));
}
/**
* 课程收藏修改
*
* @param req 课程收藏修改对象
* @return 修改结果
*/
public Result<String> edit(AdminUserCourseCollectEditReq req) {
UserCourseCollect record = BeanUtil.copyProperties(req, UserCourseCollect.class);
if (dao.updateById(record) > 0) {
return Result.success("操作成功");
}
return Result.error("操作失败");
}
/**
* 课程收藏删除
*
* @param id ID主键
* @return 删除结果
*/
public Result<String> delete(Long id) {
if (dao.deleteById(id) > 0) {
return Result.success("操作成功");
}
return Result.error("操作失败");
}
}
package com.roncoo.education.course.service.admin.biz;
import com.roncoo.education.common.service.BaseBiz;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.PageUtil;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.common.core.tools.BeanUtil;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCommentEditReq;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCommentPageReq;
import com.roncoo.education.course.service.admin.req.AdminUserCourseCommentSaveReq;
import com.roncoo.education.course.service.admin.resp.AdminUserCourseCommentPageResp;
import com.roncoo.education.course.service.admin.resp.AdminUserCourseCommentViewResp;
import com.roncoo.education.course.dao.UserCourseCommentDao;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseComment;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCommentExample;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCommentExample.Criteria;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
/**
* ADMIN-课程评论
*
* @author wujing
*/
@Component
@RequiredArgsConstructor
public class AdminUserCourseCommentBiz extends BaseBiz {
@NotNull
private final UserCourseCommentDao dao;
/**
* 课程评论分页
*
* @param req 课程评论分页查询参数
* @return 课程评论分页查询结果
*/
public Result<Page<AdminUserCourseCommentPageResp>> page(AdminUserCourseCommentPageReq req) {
UserCourseCommentExample example = new UserCourseCommentExample();
Criteria c = example.createCriteria();
Page<UserCourseComment> page = dao.page(req.getPageCurrent(), req.getPageSize(), example);
Page<AdminUserCourseCommentPageResp> respPage = PageUtil.transform(page, AdminUserCourseCommentPageResp.class);
return Result.success(respPage);
}
/**
* 课程评论添加
*
* @param req 课程评论
* @return 添加结果
*/
public Result<String> save(AdminUserCourseCommentSaveReq req) {
UserCourseComment record = BeanUtil.copyProperties(req, UserCourseComment.class);
if (dao.save(record) > 0) {
return Result.success("操作成功");
}
return Result.error("操作失败");
}
/**
* 课程评论查看
*
* @param id 主键ID
* @return 课程评论
*/
public Result<AdminUserCourseCommentViewResp> view(Long id) {
return Result.success(BeanUtil.copyProperties(dao.getById(id), AdminUserCourseCommentViewResp.class));
}
/**
* 课程评论修改
*
* @param req 课程评论修改对象
* @return 修改结果
*/
public Result<String> edit(AdminUserCourseCommentEditReq req) {
UserCourseComment record = BeanUtil.copyProperties(req, UserCourseComment.class);
if (dao.updateById(record) > 0) {
return Result.success("操作成功");
}
return Result.error("操作失败");
}
/**
* 课程评论删除
*
* @param id ID主键
* @return 删除结果
*/
public Result<String> delete(Long id) {
if (dao.deleteById(id) > 0) {
return Result.success("操作成功");
}
return Result.error("操作失败");
}
}
package com.roncoo.education.course.service.admin.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* ADMIN-课程收藏
* </p>
*
* @author wujing
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AdminUserCourseCollectEditReq", description = "ADMIN-课程收藏修改")
public class AdminUserCourseCollectEditReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
}
package com.roncoo.education.course.service.admin.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* ADMIN-课程收藏
* </p>
*
* @author wujing
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AdminUserCourseCollectPageReq", description = "ADMIN-课程收藏分页")
public class AdminUserCourseCollectPageReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
@ApiModelProperty(value = "当前页")
private int pageCurrent = 1;
@ApiModelProperty(value = "每页条数")
private int pageSize = 20;
}
package com.roncoo.education.course.service.admin.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* ADMIN-课程收藏
* </p>
*
* @author wujing
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AdminUserCourseCollectSaveReq", description = "ADMIN-课程收藏添加")
public class AdminUserCourseCollectSaveReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
}
package com.roncoo.education.course.service.admin.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* ADMIN-课程评论
* </p>
*
* @author wujing
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AdminUserCourseCommentEditReq", description = "ADMIN-课程评论修改")
public class AdminUserCourseCommentEditReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
@ApiModelProperty(value = "评论ID")
private Long commentId;
@ApiModelProperty(value = "评论内容")
private String commentText;
}
package com.roncoo.education.course.service.admin.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* ADMIN-课程评论
* </p>
*
* @author wujing
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AdminUserCourseCommentPageReq", description = "ADMIN-课程评论分页")
public class AdminUserCourseCommentPageReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
@ApiModelProperty(value = "评论ID")
private Long commentId;
@ApiModelProperty(value = "评论内容")
private String commentText;
@ApiModelProperty(value = "当前页")
private int pageCurrent = 1;
@ApiModelProperty(value = "每页条数")
private int pageSize = 20;
}
package com.roncoo.education.course.service.admin.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* ADMIN-课程评论
* </p>
*
* @author wujing
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AdminUserCourseCommentSaveReq", description = "ADMIN-课程评论添加")
public class AdminUserCourseCommentSaveReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
@ApiModelProperty(value = "评论ID")
private Long commentId;
@ApiModelProperty(value = "评论内容")
private String commentText;
}
package com.roncoo.education.course.service.admin.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* ADMIN-课程收藏
* </p>
*
* @author wujing
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AdminUserCourseCollectPageResp", description = "ADMIN-课程收藏分页")
public class AdminUserCourseCollectPageResp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
}
package com.roncoo.education.course.service.admin.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* ADMIN-课程收藏
* </p>
*
* @author wujing
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AdminUserCourseCollectViewResp", description = "ADMIN-课程收藏查看")
public class AdminUserCourseCollectViewResp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
}
package com.roncoo.education.course.service.admin.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* ADMIN-课程评论
* </p>
*
* @author wujing
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AdminUserCourseCommentPageResp", description = "ADMIN-课程评论分页")
public class AdminUserCourseCommentPageResp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
@ApiModelProperty(value = "评论ID")
private Long commentId;
@ApiModelProperty(value = "评论内容")
private String commentText;
}
package com.roncoo.education.course.service.admin.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* ADMIN-课程评论
* </p>
*
* @author wujing
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AdminUserCourseCommentViewResp", description = "ADMIN-课程评论查看")
public class AdminUserCourseCommentViewResp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
@ApiModelProperty(value = "评论ID")
private Long commentId;
@ApiModelProperty(value = "评论内容")
private String commentText;
}
......@@ -48,7 +48,7 @@ public class AdminVodConfigResp {
}
/**
* 私有
* 私有
*/
@Data
@NoArgsConstructor
......
package com.roncoo.education.course.service.auth;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.course.service.auth.biz.AuthUserCourseCollectBiz;
import com.roncoo.education.course.service.auth.req.AuthUserCourseCollectReq;
import com.roncoo.education.course.service.auth.req.AuthUserCourseCommentPageReq;
import com.roncoo.education.course.service.auth.resp.AuthUserCourseCommentResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
/**
* AUTH-课程收藏
*
* @author wujing
* @date 2023-03-24
*/
@Api(tags = "AUTH-课程收藏")
@RestController
@RequiredArgsConstructor
@RequestMapping("/course/auth/user/course/collect")
public class AuthUserCourseCollectController {
@NotNull
private final AuthUserCourseCollectBiz biz;
/**
* 课程评论列表
*
* @author fengyw
*/
@ApiOperation(value = "课程评论列出", notes = "根据条件进行课程评论分页")
@RequestMapping(value = "/page", method = RequestMethod.POST)
public Result<Page<AuthUserCourseCommentResp>> listForPage(@RequestBody AuthUserCourseCommentPageReq req) {
return biz.listForPage(req);
}
/**
* 课程评论添加
*
* @param req
* @return
*/
@ApiOperation(value = "课程收藏添加", notes = "用户进行课程收藏")
@RequestMapping(value = "/add", method = RequestMethod.POST)
public Result<String> add(@RequestBody AuthUserCourseCollectReq req) {
return biz.add(req);
}
}
package com.roncoo.education.course.service.auth;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.course.service.auth.biz.AuthUserCourseCommentBiz;
import com.roncoo.education.course.service.auth.req.AuthUserCourseCommentPageReq;
import com.roncoo.education.course.service.auth.req.AuthUserCourseCommentReq;
import com.roncoo.education.course.service.auth.resp.AuthUserCourseCommentResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
/**
* AUTH-课程评论
*
* @author wujing
* @date 2023-03-24
*/
@Api(tags = "AUTH-课程评论")
@RestController
@RequiredArgsConstructor
@RequestMapping("/course/auth/user/course/comment")
public class AuthUserCourseCommentController {
@NotNull
private final AuthUserCourseCommentBiz biz;
/**
* 课程评论列表
*
* @author fengyw
*/
@ApiOperation(value = "课程评论列出", notes = "根据条件进行课程评论分页")
@RequestMapping(value = "/page", method = RequestMethod.POST)
public Result<Page<AuthUserCourseCommentResp>> listForPage(@RequestBody AuthUserCourseCommentPageReq req) {
return biz.listForPage(req);
}
/**
* 课程评论添加
*
* @param req
* @return
*/
@ApiOperation(value = "课程评论添加", notes = "用户进行课程评论")
@RequestMapping(value = "/add", method = RequestMethod.POST)
public Result<String> add(@RequestBody AuthUserCourseCommentReq req) {
return biz.add(req);
}
}
package com.roncoo.education.course.service.auth.biz;
import com.roncoo.education.common.config.ThreadContext;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.common.core.tools.BeanUtil;
import com.roncoo.education.common.service.BaseBiz;
import com.roncoo.education.course.dao.UserCourseCollectDao;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollect;
import com.roncoo.education.course.service.auth.req.AuthUserCourseCollectReq;
import com.roncoo.education.course.service.auth.req.AuthUserCourseCommentPageReq;
import com.roncoo.education.course.service.auth.resp.AuthUserCourseCommentResp;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
/**
* AUTH-课程收藏
*
* @author wujing
*/
@Component
@RequiredArgsConstructor
public class AuthUserCourseCollectBiz extends BaseBiz {
@NotNull
private final UserCourseCollectDao dao;
public Result<Page<AuthUserCourseCommentResp>> listForPage(AuthUserCourseCommentPageReq req) {
return null;
}
public Result<String> add(AuthUserCourseCollectReq req) {
UserCourseCollect userCourseCollect = BeanUtil.copyProperties(req, UserCourseCollect.class);
userCourseCollect.setUserId(ThreadContext.userId());
dao.save(userCourseCollect);
return Result.success("课程收藏成功");
}
}
package com.roncoo.education.course.service.auth.biz;
import com.roncoo.education.common.config.ThreadContext;
import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.common.core.tools.BeanUtil;
import com.roncoo.education.common.service.BaseBiz;
import com.roncoo.education.course.dao.UserCourseCommentDao;
import com.roncoo.education.course.dao.impl.mapper.entity.UserCourseComment;
import com.roncoo.education.course.service.auth.req.AuthUserCourseCommentPageReq;
import com.roncoo.education.course.service.auth.req.AuthUserCourseCommentReq;
import com.roncoo.education.course.service.auth.resp.AuthUserCourseCommentResp;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
/**
* AUTH-课程评论
*
* @author wujing
*/
@Component
@RequiredArgsConstructor
public class AuthUserCourseCommentBiz extends BaseBiz {
@NotNull
private final UserCourseCommentDao dao;
public Result<Page<AuthUserCourseCommentResp>> listForPage(AuthUserCourseCommentPageReq req) {
return null;
}
public Result<String> add(AuthUserCourseCommentReq req) {
UserCourseComment userCourseComment = BeanUtil.copyProperties(req, UserCourseComment.class);
userCourseComment.setUserId(ThreadContext.userId());
dao.save(userCourseComment);
return Result.success("评论成功");
}
}
package com.roncoo.education.course.service.auth.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* API-AUTH-课程收藏
* </p>
*
* @author wujing
* @date 2023-03-24
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AuthUserCourseCollectPageReq", description = "API-AUTH-课程收藏")
public class AuthUserCourseCollectPageReq implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 当前页
*/
@ApiModelProperty(value = "当前页")
private Integer pageCurrent = 1;
/**
* 每页条数
*/
@ApiModelProperty(value = "每页条数")
private Integer pageSize = 20;
}
package com.roncoo.education.course.service.auth.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* API-AUTH-课程收藏
* </p>
*
* @author wujing
* @date 2023-03-24
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AuthUserCourseCollectReq", description = "API-AUTH-课程收藏")
public class AuthUserCourseCollectReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "课程ID")
private Long courseId;
}
package com.roncoo.education.course.service.auth.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* API-AUTH-课程评论
* </p>
*
* @author wujing
* @date 2023-03-24
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AuthUserCourseCommentPageReq", description = "API-AUTH-课程评论")
public class AuthUserCourseCommentPageReq implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 当前页
*/
@ApiModelProperty(value = "当前页")
private Integer pageCurrent = 1;
/**
* 每页条数
*/
@ApiModelProperty(value = "每页条数")
private Integer pageSize = 20;
}
package com.roncoo.education.course.service.auth.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* API-AUTH-课程评论
* </p>
*
* @author wujing
* @date 2023-03-24
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AuthUserCourseCommentReq", description = "API-AUTH-课程评论")
public class AuthUserCourseCommentReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "课程ID")
private Long courseId;
@ApiModelProperty(value = "评论ID,被评论的ID", required = false)
private Long commentId;
@ApiModelProperty(value = "评论内容")
private String commentText;
}
package com.roncoo.education.course.service.auth.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* API-AUTH-课程收藏
* </p>
*
* @author wujing
* @date 2023-03-24
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AuthUserCourseCollectResp", description = "API-AUTH-课程收藏")
public class AuthUserCourseCollectResp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
}
package com.roncoo.education.course.service.auth.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* API-AUTH-课程评论
* </p>
*
* @author wujing
* @date 2023-03-24
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "AuthUserCourseCommentResp", description = "API-AUTH-课程评论")
public class AuthUserCourseCommentResp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
@ApiModelProperty(value = "评论ID")
private Long commentId;
@ApiModelProperty(value = "评论内容")
private String commentText;
}
......@@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -43,6 +44,10 @@ public class CourseBiz extends BaseBiz {
@NotNull
private final CourseChapterPeriodDao periodDao;
@NotNull
private final UserCourseCommentDao userCourseCommentDao;
@NotNull
private final UserCourseCollectDao userCourseCollectDao;
@NotNull
private final ResourceDao resourceDao;
@NotNull
private final IFeignLecturer feignLecturer;
......@@ -83,6 +88,12 @@ public class CourseBiz extends BaseBiz {
if (CollUtil.isNotEmpty(userStudyList)) {
userStudyProgressMap = userStudyList.stream().collect(Collectors.toMap(UserStudy::getPeriodId, UserStudy::getProgress));
}
// 课程收藏状态
UserCourseCollect userCourseCollect = userCourseCollectDao.getByCouserIdAndUserId(req.getCourseId(), userId);
if (ObjectUtil.isNotEmpty(userCourseCollect)) {
courseResp.setCourseCollect(Boolean.TRUE);
}
}
// 获取讲师信息
LecturerViewVO lecturerViewVO = feignLecturer.getById(course.getLecturerId());
......@@ -113,6 +124,24 @@ public class CourseBiz extends BaseBiz {
}
}
}
// 课程评论信息
List<UserCourseComment> userCourseCommentList = userCourseCommentDao.listByCourseIdAndStatusId(course.getId(), StatusIdEnum.YES.getCode());
if (CollUtil.isNotEmpty(userCourseCommentList)) {
courseResp.setCourseCommentRespList(filter(userCourseCommentList, 0L));
}
return Result.success(courseResp);
}
private List<CourseCommentResp> filter(List<UserCourseComment> userCourseComments, Long commentId) {
List<UserCourseComment> list = userCourseComments.stream().filter(item -> item.getCommentId().compareTo(commentId) == 0).collect(Collectors.toList());
if (CollUtil.isNotEmpty(list)) {
List<CourseCommentResp> resps = BeanUtil.copyProperties(list, CourseCommentResp.class);
for (CourseCommentResp resp : resps) {
resp.setCourseCommentRespList(filter(userCourseComments, resp.getCommentId()));
}
return resps;
}
return new ArrayList<>();
}
}
package com.roncoo.education.course.service.biz.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
* 课程评论
* </p>
*
* @author wujing
* @date 2023-03-24
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "CourseCommentResp", description = "课程评论")
public class CourseCommentResp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private LocalDateTime gmtCreate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private LocalDateTime gmtModified;
@ApiModelProperty(value = "状态(1:正常,0:禁用)")
private Integer statusId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "课程ID")
private Long courseId;
@ApiModelProperty(value = "评论ID")
private Long commentId;
@ApiModelProperty(value = "评论内容")
private String commentText;
@ApiModelProperty(value = "课程评论")
private List<CourseCommentResp> courseCommentRespList;
}
......@@ -75,4 +75,10 @@ public class CourseResp implements Serializable {
@ApiModelProperty(value = "章节信息")
private List<CourseChapterResp> chapterRespList;
@ApiModelProperty(value = "课程收藏状态")
private Boolean courseCollect = false;
@ApiModelProperty(value = "课程评论")
private List<CourseCommentResp> courseCommentRespList;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.roncoo.education.course.dao.impl.mapper.UserCourseCollectMapper">
<resultMap id="BaseResultMap" type="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollect">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="status_id" jdbcType="TINYINT" property="statusId" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="course_id" jdbcType="BIGINT" property="courseId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, gmt_create, gmt_modified, status_id, sort, user_id, course_id
</sql>
<select id="selectByExample" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollectExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from user_course_collect
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limitStart >= 0">
limit ${limitStart} , ${pageSize}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_course_collect
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from user_course_collect
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollectExample">
delete from user_course_collect
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollect">
insert into user_course_collect (id, gmt_create, gmt_modified,
status_id, sort, user_id,
course_id)
values (#{id,jdbcType=BIGINT}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP},
#{statusId,jdbcType=TINYINT}, #{sort,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT},
#{courseId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollect">
insert into user_course_collect
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="gmtCreate != null">
gmt_create,
</if>
<if test="gmtModified != null">
gmt_modified,
</if>
<if test="statusId != null">
status_id,
</if>
<if test="sort != null">
sort,
</if>
<if test="userId != null">
user_id,
</if>
<if test="courseId != null">
course_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="gmtCreate != null">
#{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
#{gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="statusId != null">
#{statusId,jdbcType=TINYINT},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="courseId != null">
#{courseId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollectExample" resultType="java.lang.Integer">
select count(*) from user_course_collect
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update user_course_collect
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.gmtCreate != null">
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="record.gmtModified != null">
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="record.statusId != null">
status_id = #{record.statusId,jdbcType=TINYINT},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.courseId != null">
course_id = #{record.courseId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update user_course_collect
set id = #{record.id,jdbcType=BIGINT},
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
status_id = #{record.statusId,jdbcType=TINYINT},
sort = #{record.sort,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=BIGINT},
course_id = #{record.courseId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollect">
update user_course_collect
<set>
<if test="gmtCreate != null">
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="statusId != null">
status_id = #{statusId,jdbcType=TINYINT},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="courseId != null">
course_id = #{courseId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCollect">
update user_course_collect
set gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
status_id = #{statusId,jdbcType=TINYINT},
sort = #{sort,jdbcType=INTEGER},
user_id = #{userId,jdbcType=BIGINT},
course_id = #{courseId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.roncoo.education.course.dao.impl.mapper.UserCourseCommentMapper">
<resultMap id="BaseResultMap" type="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseComment">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="status_id" jdbcType="TINYINT" property="statusId" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="course_id" jdbcType="BIGINT" property="courseId" />
<result column="comment_id" jdbcType="BIGINT" property="commentId" />
<result column="comment_text" jdbcType="VARCHAR" property="commentText" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, gmt_create, gmt_modified, status_id, sort, user_id, course_id, comment_id, comment_text
</sql>
<select id="selectByExample" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCommentExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from user_course_comment
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limitStart >= 0">
limit ${limitStart} , ${pageSize}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_course_comment
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from user_course_comment
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCommentExample">
delete from user_course_comment
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseComment">
insert into user_course_comment (id, gmt_create, gmt_modified,
status_id, sort, user_id,
course_id, comment_id, comment_text
)
values (#{id,jdbcType=BIGINT}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP},
#{statusId,jdbcType=TINYINT}, #{sort,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT},
#{courseId,jdbcType=BIGINT}, #{commentId,jdbcType=BIGINT}, #{commentText,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseComment">
insert into user_course_comment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="gmtCreate != null">
gmt_create,
</if>
<if test="gmtModified != null">
gmt_modified,
</if>
<if test="statusId != null">
status_id,
</if>
<if test="sort != null">
sort,
</if>
<if test="userId != null">
user_id,
</if>
<if test="courseId != null">
course_id,
</if>
<if test="commentId != null">
comment_id,
</if>
<if test="commentText != null">
comment_text,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="gmtCreate != null">
#{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
#{gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="statusId != null">
#{statusId,jdbcType=TINYINT},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="courseId != null">
#{courseId,jdbcType=BIGINT},
</if>
<if test="commentId != null">
#{commentId,jdbcType=BIGINT},
</if>
<if test="commentText != null">
#{commentText,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseCommentExample" resultType="java.lang.Integer">
select count(*) from user_course_comment
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update user_course_comment
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.gmtCreate != null">
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="record.gmtModified != null">
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="record.statusId != null">
status_id = #{record.statusId,jdbcType=TINYINT},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.courseId != null">
course_id = #{record.courseId,jdbcType=BIGINT},
</if>
<if test="record.commentId != null">
comment_id = #{record.commentId,jdbcType=BIGINT},
</if>
<if test="record.commentText != null">
comment_text = #{record.commentText,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update user_course_comment
set id = #{record.id,jdbcType=BIGINT},
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
status_id = #{record.statusId,jdbcType=TINYINT},
sort = #{record.sort,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=BIGINT},
course_id = #{record.courseId,jdbcType=BIGINT},
comment_id = #{record.commentId,jdbcType=BIGINT},
comment_text = #{record.commentText,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseComment">
update user_course_comment
<set>
<if test="gmtCreate != null">
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="statusId != null">
status_id = #{statusId,jdbcType=TINYINT},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="courseId != null">
course_id = #{courseId,jdbcType=BIGINT},
</if>
<if test="commentId != null">
comment_id = #{commentId,jdbcType=BIGINT},
</if>
<if test="commentText != null">
comment_text = #{commentText,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.roncoo.education.course.dao.impl.mapper.entity.UserCourseComment">
update user_course_comment
set gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
status_id = #{statusId,jdbcType=TINYINT},
sort = #{sort,jdbcType=INTEGER},
user_id = #{userId,jdbcType=BIGINT},
course_id = #{courseId,jdbcType=BIGINT},
comment_id = #{commentId,jdbcType=BIGINT},
comment_text = #{commentText,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.roncoo.education.system.service.admin;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.common.video.resp.InfoResp;
import com.roncoo.education.system.service.admin.biz.AdminStatBiz;
import com.roncoo.education.system.service.admin.resp.StatVodResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -25,7 +25,7 @@ public class AdminStatController {
@ApiOperation(value = "点播", notes = "点播空间和流量的统计")
@GetMapping(value = "/vod")
public Result<StatVodResp> vod() {
public Result<InfoResp> vod() {
return biz.vod();
}
......
package com.roncoo.education.system.service.admin.biz;
import cn.hutool.json.JSONObject;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.common.core.enums.VodPlatformEnum;
import com.roncoo.education.common.service.BaseBiz;
import com.roncoo.education.common.video.impl.polyv.PolyvVodUtil;
import com.roncoo.education.system.dao.SysConfigDao;
import com.roncoo.education.common.video.VodUtil;
import com.roncoo.education.common.video.resp.InfoResp;
import com.roncoo.education.system.feign.interfaces.vo.VodConfig;
import com.roncoo.education.system.service.admin.resp.StatVodResp;
import com.roncoo.education.system.service.biz.SysConfigCommonBiz;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
/**
* 点播直播统计
*
......@@ -24,26 +19,12 @@ import java.math.BigDecimal;
@Component
public class AdminStatBiz extends BaseBiz {
@Autowired
private SysConfigDao dao;
@Autowired
private SysConfigCommonBiz sysConfigCommonBiz;
public Result<StatVodResp> vod() {
StatVodResp resp = new StatVodResp();
public Result<InfoResp> vod() {
VodConfig vodConfig = sysConfigCommonBiz.getSysConfig(VodConfig.class);
try {
if (VodPlatformEnum.POLYV.getCode().equals(vodConfig.getVodPlatform())) {
JSONObject result = PolyvVodUtil.getUserMain(vodConfig.getPolyvUserId(), vodConfig.getPolyvSecretKey());
resp.setTotalSpace(result.getBigDecimal("totalSpace").divide(BigDecimal.valueOf(1024 * 1024 * 1024)).setScale(2, BigDecimal.ROUND_HALF_UP));
resp.setUsedSpace(result.getBigDecimal("usedSpace").divide(BigDecimal.valueOf(1024 * 1024 * 1024)).setScale(2, BigDecimal.ROUND_HALF_UP));
resp.setTotalFlow(result.getBigDecimal("totalFlow").divide(BigDecimal.valueOf(1024 * 1024 * 1024)).setScale(2, BigDecimal.ROUND_HALF_UP));
resp.setUsedFlow(result.getBigDecimal("usedFlow").divide(BigDecimal.valueOf(1024 * 1024 * 1024)).setScale(2, BigDecimal.ROUND_HALF_UP));
// resp.setEmail(result.getStr("email"));
}
} catch (Exception e) {
log.error("获取异常", e);
}
InfoResp resp = VodUtil.getInfo(vodConfig);
return Result.success(resp);
}
}
......@@ -46,13 +46,13 @@ public class ControllerGenerator {
List<FileOutConfig> focList = new ArrayList<>();
// service.dao
//focList.addAll(serviceDaoList());
focList.addAll(serviceDaoList());
// service.api
//focList.addAll(serviceApiList());
// service.auth
//focList.addAll(serviceAuthList());
focList.addAll(serviceAuthList());
// service.admin
focList.addAll(serviceAdminList());
......
## mysql
#db.url=jdbc:mysql://10.65.3.98:3306/os_course?useUnicode=true&characterEncoding=utf-8&useSSL=false
db.url=jdbc:mysql://10.65.3.98:3306/os_course?useUnicode=true&characterEncoding=utf-8&useSSL=false
db.username=roncoo
db.password=RonCoo.123
author=wujing
projectPath=D:/ws-opens/roncoo-education/roncoo-education-course
projectName=roncoo-education-course-service
packagePrefix=com.roncoo.education
packageName=course
tableNames=user_course_comment
#db.url=jdbc:mysql://10.65.3.98:3306/os_system?useUnicode=true&characterEncoding=utf-8&useSSL=false
#db.username=roncoo
#db.password=RonCoo.123
#author=wujing
#projectPath=D:/ws-opens/roncoo-education/roncoo-education-course
#projectName=roncoo-education-course-service
#projectPath=D:/ws-opens/roncoo-education/roncoo-education-system
#projectName=roncoo-education-system-service
#packagePrefix=com.roncoo.education
#packageName=course
#packageName=system
#tableNames=%
#db.url=jdbc:mysql://10.65.3.98:3306/os_system?useUnicode=true&characterEncoding=utf-8&useSSL=false
#db.url=jdbc:mysql://10.65.3.98:3306/os_user?useUnicode=true&characterEncoding=utf-8&useSSL=false
#db.username=roncoo
#db.password=RonCoo.123
#author=wujing
#projectPath=D:/ws-opens/roncoo-education/roncoo-education-system
#projectName=roncoo-education-system-service
#projectPath=D:/ws-opens/roncoo-education/roncoo-education-user
#projectName=roncoo-education-user-service
#packagePrefix=com.roncoo.education
#packageName=system
#packageName=user
#tableNames=%
db.url=jdbc:mysql://10.65.3.98:3306/os_user?useUnicode=true&characterEncoding=utf-8&useSSL=false
db.username=roncoo
db.password=RonCoo.123
author=wujing
projectPath=D:/ws-opens/roncoo-education/roncoo-education-user
projectName=roncoo-education-user-service
packagePrefix=com.roncoo.education
packageName=user
tableNames=%
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册