first commit
This commit is contained in:
@@ -0,0 +1,521 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.common.auth.CredentialsProviderFactory;
|
||||
import com.aliyun.oss.common.auth.DefaultCredentialProvider;
|
||||
import com.aliyun.oss.model.ListObjectsRequest;
|
||||
import com.aliyun.oss.model.OSSObjectSummary;
|
||||
import com.aliyun.oss.model.ObjectListing;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.qcloud.cos.COSClient;
|
||||
import com.qcloud.cos.ClientConfig;
|
||||
import com.qcloud.cos.auth.BasicCOSCredentials;
|
||||
import com.qcloud.cos.auth.COSCredentials;
|
||||
import com.qcloud.cos.exception.CosClientException;
|
||||
import com.qcloud.cos.exception.CosServiceException;
|
||||
import com.qcloud.cos.http.HttpProtocol;
|
||||
import com.qcloud.cos.model.COSObjectSummary;
|
||||
import com.qcloud.cos.region.Region;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.entity.CourseDetails;
|
||||
import com.sqx.modules.course.service.CourseDetailsService;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import com.volcengine.tos.TOSV2;
|
||||
import com.volcengine.tos.TOSV2ClientBuilder;
|
||||
import com.volcengine.tos.model.object.ListObjectsType2Input;
|
||||
import com.volcengine.tos.model.object.ListObjectsType2Output;
|
||||
import com.volcengine.tos.model.object.ListedCommonPrefix;
|
||||
import com.volcengine.tos.model.object.ListedObjectV2;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@RestController
|
||||
@Api(value = "读取短剧", tags = {"读取短剧"})
|
||||
@Slf4j
|
||||
@RequestMapping(value = "/aliossCourse")
|
||||
public class AliossCourseController {
|
||||
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseDetailsService courseDetailsService;
|
||||
@Autowired
|
||||
private CommonInfoService commonInfoService;
|
||||
static boolean flag=false;
|
||||
Pattern pattern = Pattern.compile("\\d+"); // 正则表达式匹配一个或多个数字
|
||||
/**
|
||||
* 创建线程池
|
||||
*/
|
||||
private ExecutorService newCachedThreadPool = new ThreadPoolExecutor(30, 100, 0L,
|
||||
TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<>(1024),
|
||||
Executors.defaultThreadFactory(),
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
|
||||
@GetMapping("/sysnAliOssCourse")
|
||||
@ApiOperation("同步短剧")
|
||||
public Result sysnAliOssCourse(Integer type,String filePath, Integer freeNum, BigDecimal coursePrice,Integer maxGood,Integer minGood){
|
||||
if(flag){
|
||||
return Result.error("短剧正在同步中!");
|
||||
}
|
||||
Map<String, Object> alioss = null;
|
||||
//读取oss或cos短剧信息
|
||||
if(type==1){
|
||||
alioss = alioss(filePath);
|
||||
}else if(type==2){
|
||||
alioss = txCos(filePath);
|
||||
}else{
|
||||
alioss = dyOss(filePath);
|
||||
}
|
||||
|
||||
if(alioss==null){
|
||||
return Result.error("读取oss短剧失败,请检查配置!");
|
||||
}
|
||||
Map<String, List<String>> videoFile=(Map<String, List<String>>)alioss.get("videoFile");
|
||||
if(videoFile==null || videoFile.size()==0){
|
||||
return Result.error("读取oss短剧失败,请检查配置!");
|
||||
}
|
||||
Map<String, String> imageFile=(Map<String, String>)alioss.get("imageFile");
|
||||
|
||||
flag=true;
|
||||
newCachedThreadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String url =null;
|
||||
Random rand = new Random();
|
||||
if(type==1){
|
||||
url = commonInfoService.findOne(73).getValue();
|
||||
if(StringUtils.isEmpty(url)){
|
||||
url = commonInfoService.findOne(72).getValue();
|
||||
}
|
||||
}else if(type==2){
|
||||
url = commonInfoService.findOne(883).getValue();
|
||||
if(StringUtils.isEmpty(url)){
|
||||
url = commonInfoService.findOne(804).getValue();
|
||||
}
|
||||
}else{
|
||||
url = commonInfoService.findOne(891).getValue();
|
||||
}
|
||||
|
||||
for (String key : videoFile.keySet()) {
|
||||
// System.err.println("短剧名称: " + key);
|
||||
String image = url+"/"+imageFile.get(key);
|
||||
String value = commonInfoService.findOne(887).getValue();
|
||||
String[] split = value.split(",");
|
||||
int min = 0; // 指定范围的最小值(包含)
|
||||
int max = split.length-1; // 指定范围的最大值(包含)
|
||||
int randomNum1 = min + rand.nextInt(max - min + 1);
|
||||
int randomNum2 = min + rand.nextInt(max - min + 1);
|
||||
int randomNum3 = min + rand.nextInt(max - min + 1);
|
||||
String courseLabel=split[randomNum1]+","+split[randomNum2]+","+split[randomNum3];
|
||||
Course course = courseService.getOne(new QueryWrapper<Course>().eq("title", key).eq("is_delete",0));
|
||||
if(course==null){
|
||||
course=new Course();
|
||||
course.setTitle(key);
|
||||
course.setTitleImg(image);
|
||||
course.setPrice(coursePrice);
|
||||
course.setCourseLabel(courseLabel);
|
||||
course.setPayNum(0);
|
||||
course.setImg(image);
|
||||
course.setDetails(key);
|
||||
course.setIsDelete(0);
|
||||
course.setCreateTime(DateUtils.format(new Date()));
|
||||
course.setUpdateTime(course.getCreateTime());
|
||||
course.setIsRecommend(0);
|
||||
course.setStatus(1);
|
||||
course.setIsPrice(1);
|
||||
course.setViewCounts(0);
|
||||
course.setIsOver(1);
|
||||
courseService.save(course);
|
||||
}else{
|
||||
course.setTitleImg(image);
|
||||
course.setImg(image);
|
||||
courseService.updateById(course);
|
||||
}
|
||||
List<String> valueList = videoFile.get(key);
|
||||
valueList.sort(Comparator.comparingInt(this::extractNumberFromFileName));
|
||||
int i=1;
|
||||
int priceNum=valueList.size()-freeNum;
|
||||
BigDecimal courseDetailsPrice = BigDecimal.ZERO;
|
||||
if(priceNum>0){
|
||||
courseDetailsPrice = coursePrice.divide(BigDecimal.valueOf(priceNum), 2, BigDecimal.ROUND_UP);
|
||||
}
|
||||
for(String str:valueList){
|
||||
String[] splits = str.split("/");
|
||||
String fileName=splits[splits.length-1];
|
||||
String substring = fileName.substring(0, fileName.lastIndexOf("."));
|
||||
Matcher matcher = pattern.matcher(substring);
|
||||
Integer num=0;
|
||||
if(matcher.find()){
|
||||
num = Integer.parseInt(matcher.group());
|
||||
}
|
||||
String courseDetailsName=key+"-第"+num+"集";
|
||||
|
||||
CourseDetails courseDetails = courseDetailsService.getOne(new QueryWrapper<CourseDetails>()
|
||||
.eq("course_id",course.getCourseId()).eq("course_details_name", courseDetailsName));
|
||||
if(courseDetails==null){
|
||||
int goodNum = minGood + rand.nextInt(maxGood - minGood + 1);
|
||||
courseDetails=new CourseDetails();
|
||||
courseDetails.setCourseId(course.getCourseId());
|
||||
courseDetails.setCourseDetailsName(courseDetailsName);
|
||||
courseDetails.setVideoUrl(url+"/"+str);
|
||||
courseDetails.setCreateTime(DateUtils.format(new Date()));
|
||||
courseDetails.setTitleImg(image);
|
||||
courseDetails.setContent(courseDetailsName);
|
||||
courseDetails.setGoodNum(goodNum);
|
||||
if(i<=freeNum){
|
||||
courseDetails.setPrice(BigDecimal.ZERO);
|
||||
courseDetails.setIsPrice(2);
|
||||
}else{
|
||||
courseDetails.setPrice(courseDetailsPrice);
|
||||
courseDetails.setIsPrice(1);
|
||||
}
|
||||
courseDetails.setSort(num);
|
||||
courseDetailsService.insert(courseDetails);
|
||||
}else{
|
||||
int goodNum = minGood + rand.nextInt(maxGood - minGood + 1);
|
||||
courseDetails.setCourseId(course.getCourseId());
|
||||
courseDetails.setCourseDetailsName(courseDetailsName);
|
||||
courseDetails.setVideoUrl(url+"/"+str);
|
||||
courseDetails.setCreateTime(DateUtils.format(new Date()));
|
||||
courseDetails.setTitleImg(image);
|
||||
courseDetails.setContent(courseDetailsName);
|
||||
courseDetails.setGoodNum(goodNum);
|
||||
if(i<=freeNum){
|
||||
courseDetails.setPrice(BigDecimal.ZERO);
|
||||
courseDetails.setIsPrice(2);
|
||||
}else{
|
||||
courseDetails.setPrice(courseDetailsPrice);
|
||||
courseDetails.setIsPrice(1);
|
||||
}
|
||||
courseDetails.setSort(num);
|
||||
courseDetailsService.updateById(courseDetails);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("同步短剧出错:"+e.getMessage(),e);
|
||||
}finally {
|
||||
flag=false;
|
||||
}
|
||||
}
|
||||
|
||||
public int extractNumberFromFileName(String fileUrl) {
|
||||
String[] split = fileUrl.split("/");
|
||||
String fileName=split[split.length-1];
|
||||
String substring = fileName.substring(0, fileName.lastIndexOf("."));
|
||||
Matcher matcher = pattern.matcher(substring);
|
||||
Integer num=0;
|
||||
if(matcher.find()){
|
||||
num = Integer.parseInt(matcher.group());
|
||||
}
|
||||
return num;
|
||||
}
|
||||
});
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Map<String,Object> alioss(String keyPrefix) {
|
||||
// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。
|
||||
String endpoint = commonInfoService.findOne(68).getValue();
|
||||
// 从环境变量中获取访问凭证。运行本代码示例之前,请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
|
||||
DefaultCredentialProvider defaultCredentialProvider = CredentialsProviderFactory.newDefaultCredentialProvider(commonInfoService.findOne(69).getValue(), commonInfoService.findOne(70).getValue());
|
||||
// 填写Bucket名称,例如examplebucket。
|
||||
String bucketName = commonInfoService.findOne(71).getValue();
|
||||
// 指定前缀,例如exampledir/object。
|
||||
|
||||
// 创建OSSClient实例。
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, defaultCredentialProvider);
|
||||
// 设置每页列举200个文件。
|
||||
int maxKeys = 200;
|
||||
List<String> filePaths=new ArrayList<>();
|
||||
try {
|
||||
String nextMarker = null;
|
||||
ObjectListing objectListing;
|
||||
do {
|
||||
objectListing = ossClient.listObjects(new ListObjectsRequest(bucketName).withMarker(nextMarker).withMaxKeys(maxKeys).withPrefix(keyPrefix));
|
||||
List<OSSObjectSummary> sums = objectListing.getObjectSummaries();
|
||||
for (OSSObjectSummary s : sums) {
|
||||
filePaths.add(s.getKey());
|
||||
}
|
||||
nextMarker = objectListing.getNextMarker();
|
||||
|
||||
} while (objectListing.isTruncated());
|
||||
|
||||
Map<String, List<String>> videoFile = new HashMap<>();
|
||||
Map<String, String> imageFile = new HashMap<>();
|
||||
for (String filePath : filePaths) {
|
||||
if(filePath.contains(".")){
|
||||
String[] split = filePath.split("/");
|
||||
String directory = split[split.length-2];
|
||||
String extension = filePath.substring(filePath.lastIndexOf('.') + 1);
|
||||
switch (extension) {
|
||||
case "mp4":
|
||||
case "avi":
|
||||
case "wmv":
|
||||
case "flv":
|
||||
case "m3u8":
|
||||
case "mov":
|
||||
List<String> videoList = videoFile.get(directory);
|
||||
if(videoList==null){
|
||||
videoList=new ArrayList<>();
|
||||
}
|
||||
videoList.add(filePath);
|
||||
videoFile.put(directory,videoList);
|
||||
break;
|
||||
default:
|
||||
String image = imageFile.get(directory);
|
||||
if(StringUtils.isEmpty(image)){
|
||||
imageFile.put(directory,filePath);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
result.put("videoFile",videoFile);
|
||||
result.put("imageFile",imageFile);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("阿里云读取oss报错:"+e.getMessage(),e);
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,Object> txCos(String keyPrefix) {
|
||||
COSClient cosClient = createCOSClient();
|
||||
// 存储桶的命名格式为 BucketName-APPID,此处填写的存储桶名称必须为此格式
|
||||
String bucketName = commonInfoService.findOne(803).getValue();
|
||||
|
||||
com.qcloud.cos.model.ListObjectsRequest listObjectsRequest = new com.qcloud.cos.model.ListObjectsRequest();
|
||||
// 设置 bucket 名称
|
||||
listObjectsRequest.setBucketName(bucketName);
|
||||
// 设置列出的对象名以 prefix 为前缀
|
||||
listObjectsRequest.setPrefix(keyPrefix);
|
||||
// 保存列出的结果
|
||||
com.qcloud.cos.model.ObjectListing objectListing = null;
|
||||
String nextMarker = null;
|
||||
List<String> filePaths=new ArrayList<>();
|
||||
do {
|
||||
listObjectsRequest.setMarker(nextMarker);
|
||||
listObjectsRequest.setMaxKeys(100);
|
||||
try {
|
||||
objectListing = cosClient.listObjects(listObjectsRequest);
|
||||
} catch (CosServiceException e) {
|
||||
e.printStackTrace();
|
||||
} catch (CosClientException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
List<COSObjectSummary> cosObjectSummaries = objectListing.getObjectSummaries();
|
||||
|
||||
for (COSObjectSummary cosObjectSummary : cosObjectSummaries) {
|
||||
// 对象的 key
|
||||
String key = cosObjectSummary.getKey();
|
||||
filePaths.add(key);
|
||||
}
|
||||
nextMarker = objectListing.getNextMarker();
|
||||
} while (objectListing.isTruncated());
|
||||
|
||||
|
||||
// 确认本进程不再使用 cosClient 实例之后,关闭即可
|
||||
cosClient.shutdown();
|
||||
|
||||
Map<String, List<String>> videoFile = new HashMap<>();
|
||||
Map<String, String> imageFile = new HashMap<>();
|
||||
for (String filePath : filePaths) {
|
||||
if(filePath.contains(".")){
|
||||
String[] split = filePath.split("/");
|
||||
String directory = split[split.length-2];
|
||||
String extension = filePath.substring(filePath.lastIndexOf('.') + 1);
|
||||
switch (extension) {
|
||||
case "mp4":
|
||||
case "avi":
|
||||
case "wmv":
|
||||
case "flv":
|
||||
case "m3u8":
|
||||
case "mov":
|
||||
List<String> videoList = videoFile.get(directory);
|
||||
if(videoList==null){
|
||||
videoList=new ArrayList<>();
|
||||
}
|
||||
videoList.add(filePath);
|
||||
videoFile.put(directory,videoList);
|
||||
break;
|
||||
default:
|
||||
String image = imageFile.get(directory);
|
||||
if(StringUtils.isEmpty(image)){
|
||||
imageFile.put(directory,filePath);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
result.put("videoFile",videoFile);
|
||||
result.put("imageFile",imageFile);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// 创建 COSClient 实例,这个实例用来后续调用请求
|
||||
public COSClient createCOSClient() {
|
||||
// 设置用户身份信息。
|
||||
// SECRETID 和 SECRETKEY 请登录访问管理控制台 https://console.cloud.tencent.com/cam/capi 进行查看和管理
|
||||
String secretId = commonInfoService.findOne(800).getValue();//用户的 SecretId,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参见 https://cloud.tencent.com/document/product/598/37140
|
||||
String secretKey = commonInfoService.findOne(801).getValue();//用户的 SecretKey,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参见 https://cloud.tencent.com/document/product/598/37140
|
||||
COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
|
||||
|
||||
|
||||
// ClientConfig 中包含了后续请求 COS 的客户端设置:
|
||||
ClientConfig clientConfig = new ClientConfig();
|
||||
|
||||
|
||||
// 设置 bucket 的地域
|
||||
// COS_REGION 请参见 https://cloud.tencent.com/document/product/436/6224
|
||||
clientConfig.setRegion(new Region(commonInfoService.findOne(802).getValue()));
|
||||
|
||||
|
||||
// 设置请求协议, http 或者 https
|
||||
// 5.6.53 及更低的版本,建议设置使用 https 协议
|
||||
// 5.6.54 及更高版本,默认使用了 https
|
||||
clientConfig.setHttpProtocol(HttpProtocol.https);
|
||||
|
||||
|
||||
// 以下的设置,是可选的:
|
||||
|
||||
|
||||
// 设置 socket 读取超时,默认 30s
|
||||
clientConfig.setSocketTimeout(30*1000);
|
||||
// 设置建立连接超时,默认 30s
|
||||
clientConfig.setConnectionTimeout(30*1000);
|
||||
|
||||
|
||||
// 如果需要的话,设置 http 代理,ip 以及 port
|
||||
// clientConfig.setHttpProxyIp("httpProxyIp");
|
||||
// clientConfig.setHttpProxyPort(80);
|
||||
|
||||
|
||||
// 生成 cos 客户端。
|
||||
return new COSClient(cred, clientConfig);
|
||||
}
|
||||
|
||||
public Map<String,Object> dyOss(String keyPrefix) {
|
||||
String endpoint = "tos-cn-beijing.volces.com";
|
||||
String region = "cn-beijing";
|
||||
String accessKey = commonInfoService.findOne(888).getValue();
|
||||
String secretKey = commonInfoService.findOne(889).getValue();
|
||||
|
||||
String bucketName = commonInfoService.findOne(890).getValue();
|
||||
|
||||
String delimiter = "/";
|
||||
|
||||
TOSV2 tos = new TOSV2ClientBuilder().build(region, endpoint, accessKey, secretKey);
|
||||
try{
|
||||
String continuationToken = null;
|
||||
boolean isTruncated = true;
|
||||
Map<String, List<String>> videoFile = new HashMap<>();
|
||||
Map<String, String> imageFile = new HashMap<>();
|
||||
while (isTruncated) {
|
||||
ListObjectsType2Input input = new ListObjectsType2Input().setBucket(bucketName)
|
||||
.setDelimiter(delimiter).setContinuationToken(continuationToken).setPrefix(keyPrefix+"/");
|
||||
ListObjectsType2Output output = tos.listObjectsType2(input);
|
||||
if (output.getCommonPrefixes() != null) {
|
||||
for (int i = 0; i < output.getCommonPrefixes().size(); i++) {
|
||||
|
||||
|
||||
ListedCommonPrefix commonPrefix = output.getCommonPrefixes().get(i);
|
||||
//System.err.println("Listed commonPrefix is " + commonPrefix.getPrefix());
|
||||
Map<String, Object> stringObjectMap = listCommonPrefix(bucketName, delimiter, commonPrefix.getPrefix(), tos,videoFile,imageFile);
|
||||
videoFile = (Map<String, List<String>>)stringObjectMap.get("videoFile");
|
||||
imageFile = (Map<String, String>)stringObjectMap.get("imageFile");
|
||||
}
|
||||
}
|
||||
isTruncated = output.isTruncated();
|
||||
continuationToken = output.getNextContinuationToken();
|
||||
}
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
result.put("videoFile",videoFile);
|
||||
result.put("imageFile",imageFile);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("抖音云同步文件出错:"+e.getMessage(),e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Map<String,Object> listCommonPrefix(String bucketName, String delimiter, String prefix, TOSV2 tos,
|
||||
Map<String, List<String>> videoFile,Map<String, String> imageFile) {
|
||||
boolean isTruncated = true;
|
||||
String continuationToken = null;
|
||||
List<String> videoList=new ArrayList<>();
|
||||
String image=null;
|
||||
String[] split = prefix.split("/");
|
||||
System.err.println(split[split.length-1]);
|
||||
while (isTruncated) {
|
||||
ListObjectsType2Input input = new ListObjectsType2Input().setBucket(bucketName)
|
||||
.setDelimiter(delimiter).setContinuationToken(continuationToken).setPrefix(prefix);
|
||||
ListObjectsType2Output output = tos.listObjectsType2(input);
|
||||
if (output.getContents() != null) {
|
||||
for (int i = 0; i < output.getContents().size(); i++) {
|
||||
ListedObjectV2 object = output.getContents().get(i);
|
||||
if(object.getSize()>0){
|
||||
String extension = object.getKey().substring(object.getKey().lastIndexOf('.') + 1);
|
||||
switch (extension) {
|
||||
case "mp4":
|
||||
case "avi":
|
||||
case "wmv":
|
||||
case "flv":
|
||||
case "m3u8":
|
||||
case "mov":
|
||||
videoList.add(object.getKey());
|
||||
break;
|
||||
default:
|
||||
image=object.getKey();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
isTruncated = output.isTruncated();
|
||||
continuationToken = output.getNextContinuationToken();
|
||||
}
|
||||
videoFile.put(split[split.length-1],videoList);
|
||||
imageFile.put(split[split.length-1],image);
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
result.put("videoFile",videoFile);
|
||||
result.put("imageFile",imageFile);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseClassification;
|
||||
import com.sqx.modules.course.service.CourseClassificationService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "短剧分类信息", tags = {"短剧分类信息"})
|
||||
@RequestMapping(value = "/courseClassification")
|
||||
public class CourseClassificationController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseClassificationService courseClassificationService;
|
||||
|
||||
@GetMapping("/selectCourseClassification")
|
||||
@ApiOperation("查询短剧分类信息")
|
||||
public Result selectCourseClassification(Integer page, Integer limit, String classificationName) {
|
||||
return courseClassificationService.selectCourseClassification(page, limit, classificationName);
|
||||
}
|
||||
|
||||
@PostMapping("/insertCourseClassification")
|
||||
@ApiOperation("添加短剧分类信息")
|
||||
public Result insertCourseClassification(@RequestBody CourseClassification courseClassification) {
|
||||
return courseClassificationService.insertCourseClassification(courseClassification);
|
||||
}
|
||||
|
||||
@PostMapping("/updateCourseClassification")
|
||||
@ApiOperation("修改短剧分类信息")
|
||||
public Result updateCourseClassification(@RequestBody CourseClassification courseClassification) {
|
||||
return courseClassificationService.updateCourseClassification(courseClassification);
|
||||
}
|
||||
|
||||
@GetMapping("/updateDelete")
|
||||
@ApiOperation("假删除")
|
||||
public Result updateDelete(Long id) {
|
||||
return courseClassificationService.updateDelete(id);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCourseClassificationById")
|
||||
@ApiOperation("根据id查询短剧分类信息")
|
||||
public CourseClassification selectCourseClassificationById(Long id) {
|
||||
return courseClassificationService.selectCourseClassificationById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.service.CourseCollectService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Api(value = "短剧收藏", tags = {"短剧收藏"})
|
||||
@RequestMapping(value = "/courseCollect")
|
||||
@AllArgsConstructor
|
||||
public class CourseCollectController {
|
||||
|
||||
private CourseCollectService courseCollectService;
|
||||
|
||||
@GetMapping("/selectByUserId")
|
||||
@ApiOperation("查询收藏短剧信息")
|
||||
public Result selectByUserId(Integer page, Integer limit, Long userId,Integer classify){
|
||||
return courseCollectService.selectByUserId(page,limit,userId,classify);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseComment;
|
||||
import com.sqx.modules.course.service.CourseCommentService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "短剧信息", tags = {"短剧评论信息"})
|
||||
@RequestMapping(value = "/courseComment")
|
||||
public class CourseCommentController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseCommentService courseCommentService;
|
||||
|
||||
@GetMapping("/selectCourseComment")
|
||||
@ApiOperation("查看评论")
|
||||
public Result selectCourseComment(Integer page, Integer limit, Long courseId) {
|
||||
return courseCommentService.selectCourseComment(page, limit, courseId,1L);
|
||||
}
|
||||
|
||||
@PostMapping("/insertCourseComment")
|
||||
@ApiOperation("添加评论")
|
||||
public Result insertCourseComment(@RequestBody CourseComment courseComment){
|
||||
return courseCommentService.insertCourseComment(courseComment);
|
||||
}
|
||||
@PostMapping("/deleteCourseComment")
|
||||
@ApiOperation("删除评论")
|
||||
public Result deleteCourseComment(Long courseCommentId) {
|
||||
return courseCommentService.deleteCourseComment(courseCommentId);
|
||||
}
|
||||
@GetMapping("/selectCourseCommentUser")
|
||||
@ApiOperation("我的评论")
|
||||
public Result selectCourseCommentUser(Integer page, Integer limit,Long userId) {
|
||||
return courseCommentService.selectCourseCommentUser(page,limit,userId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import com.sqx.modules.course.service.CourseUserService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import com.sqx.modules.utils.SenInfoCheckUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(value = "短剧信息", tags = {"短剧信息"})
|
||||
@RequestMapping(value = "/course")
|
||||
public class CourseController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseUserService courseUserService;
|
||||
|
||||
|
||||
@GetMapping("/selectCourse")
|
||||
@ApiOperation("查询短剧信息")
|
||||
public Result selectCourse(@ApiParam("页") Integer page,@ApiParam("条") Integer limit,@ApiParam("分类id") Long classifyId,
|
||||
@ApiParam("搜索内容") String title,Integer isRecommend,Integer status,Long bannerId,Integer sort,
|
||||
Integer isPrice,Integer over,Integer wxCourse,Integer dyCourse,Integer wxShow,Integer dyShow) {
|
||||
return courseService.selectCourse(page, limit, classifyId, title,isRecommend,status,bannerId,sort,null,
|
||||
isPrice,1,over,wxCourse,dyCourse,wxShow,dyShow);
|
||||
}
|
||||
|
||||
@PostMapping("/insertCourse")
|
||||
@ApiOperation("添加短剧信息")
|
||||
public Result insertCourse(@RequestBody Course course) {
|
||||
return courseService.insertCourse(course);
|
||||
}
|
||||
|
||||
@PostMapping("/updateCourse")
|
||||
@ApiOperation("修改短剧信息")
|
||||
public Result updateCourse(@RequestBody Course course) {
|
||||
return courseService.updateCourse(course);
|
||||
}
|
||||
|
||||
@GetMapping("/updateDelete")
|
||||
@ApiOperation("假删除")
|
||||
public Result updateDelete(Long id) {
|
||||
return courseService.updateDelete(id);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCourseById")
|
||||
@ApiOperation("根据id查询短剧详细信息")
|
||||
public Result selectCourseById(Integer page,Integer limit,Long id,Integer good) {
|
||||
return courseService.selectCourseById(page,limit,id,good);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/selectCourseUserbyid")
|
||||
@ApiOperation("我的短剧")
|
||||
public Result selectCourseUser(Integer page, Integer limit, Long userId) {
|
||||
return courseUserService.selectCourseUser(page, limit, userId);
|
||||
}
|
||||
|
||||
@GetMapping("/updateCourse")
|
||||
@ApiOperation("修改状态")
|
||||
public Result updateCourse(Long courseId){
|
||||
Course byId = courseService.getById(courseId);
|
||||
if(byId!=null){
|
||||
if(byId.getStatus().equals(1)){
|
||||
byId.setStatus(2);
|
||||
}else{
|
||||
byId.setStatus(1);
|
||||
}
|
||||
courseService.updateById(byId);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/synCourse")
|
||||
@ApiOperation("采集视频")
|
||||
public Result synCourse(){
|
||||
return courseService.synCourse();
|
||||
}
|
||||
|
||||
@PostMapping("/updateCourseDetails")
|
||||
@ApiOperation("批量修改集")
|
||||
public Result updateCourseDetails(String ids, BigDecimal price,String content,String titleImg){
|
||||
return courseService.updateCourseDetails(ids,price,content,titleImg);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/updateCourseStatus")
|
||||
@ApiOperation("批量上下架剧")
|
||||
public Result updateCourseStatus(String ids, Integer status){
|
||||
return courseService.updateCourseStatus(ids,status);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteCourseByIds")
|
||||
@ApiOperation("批量删除剧")
|
||||
public Result deleteCourseByIds(String ids){
|
||||
return courseService.deleteCourseByIds(ids);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteCourseDetailsByIds")
|
||||
@ApiOperation("批量删除集")
|
||||
public Result deleteCourseDetailsByIds(String ids){
|
||||
return courseService.deleteCourseDetailsByIds(ids);
|
||||
}
|
||||
|
||||
@PostMapping("/dyVideoUpload")
|
||||
@ApiOperation("抖音短剧上传")
|
||||
public Result dyVideoUpload(Long courseId){
|
||||
return courseService.dyVideoUpload(courseId);
|
||||
}
|
||||
|
||||
@PostMapping("/dyVideoAudit")
|
||||
@ApiOperation("抖音短剧送审")
|
||||
public Result dyVideoAudit(Long courseId){
|
||||
return courseService.dyVideoAudit(courseId);
|
||||
}
|
||||
|
||||
@PostMapping("/dyVideoUp")
|
||||
@ApiOperation("抖音短剧上线")
|
||||
public Result dyVideoUp(Long courseId){
|
||||
return courseService.dyVideoUp(courseId);
|
||||
}
|
||||
|
||||
@PostMapping("/setDyNotifyUrl")
|
||||
@ApiOperation("设置抖音视频回调地址")
|
||||
public Result setDyNotifyUrl(String url){
|
||||
return courseService.setDyNotifyUrl(url);
|
||||
}
|
||||
|
||||
@PostMapping("/uploadCourseDetails")
|
||||
@ApiOperation("单个集上传")
|
||||
public Result uploadCourseDetails(Long courseDetailsId){
|
||||
return courseService.uploadCourseDetails(courseDetailsId);
|
||||
}
|
||||
|
||||
@PostMapping("/updateDyCourse")
|
||||
@ApiOperation("修改抖音短剧")
|
||||
public Result updateDyCourse(@RequestBody Course course){
|
||||
return courseService.updateDyCourse(course);
|
||||
}
|
||||
|
||||
@GetMapping("/sysWxCourse")
|
||||
@ApiOperation("同步微信已提交审核的短剧")
|
||||
public Result sysWxCourse(Integer freeNum, BigDecimal coursePrice,Integer maxGood,Integer minGood){
|
||||
return courseService.sysWxCourse(freeNum, coursePrice, maxGood, minGood);
|
||||
}
|
||||
|
||||
@PostMapping("/uploadWxCourse")
|
||||
@ApiOperation("提交微信备案审核")
|
||||
public Result uploadWxCourse(Long courseId,Integer qualificationType,String registrationNumber,
|
||||
String qualificationCertificateMaterialId,String costOfProduction,String costCommitmentLetterMaterialId){
|
||||
return courseService.uploadWxCourse(courseId, qualificationType, registrationNumber, qualificationCertificateMaterialId, costOfProduction, costCommitmentLetterMaterialId);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getWxToken")
|
||||
@ApiOperation("获取微信小程序token")
|
||||
public Result getWxToken(){
|
||||
return Result.success().put("data",SenInfoCheckUtil.getMpToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* 剧导入列表--导入
|
||||
* @param file
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation(value = "剧导入列表--导入")
|
||||
@PostMapping(value = "/courseListExcelIn")
|
||||
public Result courseListExcelIn(@ApiParam(name = "file", value = "excel文件") @RequestPart MultipartFile file) throws Exception {
|
||||
try {
|
||||
if (file == null) {
|
||||
return Result.error("文件不能为空!");
|
||||
}
|
||||
return courseService.courseListExcelIn(file);
|
||||
} catch (Exception e) {
|
||||
log.error("剧导入列表--导入异常:", e);
|
||||
}
|
||||
|
||||
// 返回结果
|
||||
return Result.error("导入失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseDetails;
|
||||
import com.sqx.modules.course.service.CourseDetailsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(value = "短剧视频信息", tags = {"短剧视频信息"})
|
||||
@RequestMapping(value = "/courseDetails")
|
||||
public class CourseDetailsController {
|
||||
@Autowired
|
||||
private CourseDetailsService courseDetailsService;
|
||||
|
||||
@PostMapping("/insertCourseDetails")
|
||||
@ApiOperation("添加短剧视频信息")
|
||||
public Result insertCourseDetails(@RequestBody CourseDetails courseDetails) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
courseDetails.setCreateTime(sdf.format(new Date()));
|
||||
courseDetailsService.insert(courseDetails);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/updateCourseDetails")
|
||||
@ApiOperation("修改短剧视频信息")
|
||||
public Result updateCourseDetails(@RequestBody CourseDetails courseDetails) {
|
||||
courseDetailsService.updateCourseDetails(courseDetails);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/deleteCourseDetails")
|
||||
@ApiOperation("删除短剧视频信息")
|
||||
public Result deleteCourseDetails(String ids) {
|
||||
courseDetailsService.deleteCourseDetails(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 集导入列表--导入
|
||||
* @param file 上传文件
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation(value = "集导入列表--导入")
|
||||
@PostMapping(value = "/courseDetailsListExcelIn")
|
||||
public Result courseDetailsListExcelIn(@ApiParam(name = "file", value = "excel文件") @RequestPart MultipartFile file, Long courseId) throws Exception {
|
||||
try {
|
||||
if (file == null) {
|
||||
return Result.error("文件不能为空!");
|
||||
}
|
||||
return courseDetailsService.courseDetailsListExcelIn(file,courseId);
|
||||
} catch (Exception e) {
|
||||
log.error("集导入列表--导入异常:", e);
|
||||
}
|
||||
|
||||
// 返回结果
|
||||
return Result.error("导入失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.response.ClassificationResponse;
|
||||
import com.sqx.modules.course.response.CurriculumResponse;
|
||||
import com.sqx.modules.course.service.CourseClassificationService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 教育首页面展示
|
||||
*
|
||||
* @author liyuan
|
||||
* @since 2021-07-15
|
||||
*/
|
||||
@RestController
|
||||
@Api(value = "App短剧分类信息", tags = {"App短剧分类信息"})
|
||||
@RequestMapping(value = "/app/courseClassification")
|
||||
@Slf4j
|
||||
public class AppClassificationController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseClassificationService courseClassificationService;
|
||||
|
||||
@GetMapping("/selectClassification")
|
||||
@ApiOperation("查询短剧信息")
|
||||
public Result selectClassification() {
|
||||
return Result.success().put("data", courseClassificationService.selectClassification());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询短剧的分类信息 (未删除)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryClassification", method = RequestMethod.GET)
|
||||
public Result queryClassification() {
|
||||
try {
|
||||
List<ClassificationResponse> classificationResponses = courseClassificationService.queryClassification();
|
||||
return Result.success().put("data", classificationResponses);
|
||||
} catch (Exception e) {
|
||||
log.error("系统发生异常!");
|
||||
return Result.error("系统发生异常!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.course.entity.CourseCollect;
|
||||
import com.sqx.modules.course.service.CourseCollectService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "app短剧收藏", tags = {"app短剧收藏"})
|
||||
@RequestMapping(value = "/app/courseCollect")
|
||||
public class AppCourseCollectController extends AbstractController {
|
||||
|
||||
@Autowired
|
||||
private CourseCollectService courseCollectService;
|
||||
|
||||
@Login
|
||||
@PostMapping("/insertCourseCollect")
|
||||
@ApiOperation("app收藏短剧信息")
|
||||
public Result insertCourseCollect(@RequestBody CourseCollect courseCollect,@RequestAttribute("userId") Long userId){
|
||||
courseCollect.setUserId(userId);
|
||||
return courseCollectService.insertCourseCollect(courseCollect);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/selectByUserId")
|
||||
@ApiOperation("app查询收藏短剧信息")
|
||||
public Result selectByUserId(Integer page, Integer limit,@RequestAttribute("userId") Long userId,Integer classify){
|
||||
return courseCollectService.selectByUserId(page,limit,userId,classify);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.course.entity.CourseComment;
|
||||
import com.sqx.modules.course.service.CourseCommentService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 修改部分代码逻辑
|
||||
*
|
||||
* @author liyuan
|
||||
* @since 2021-07-16
|
||||
*/
|
||||
@RestController
|
||||
@Api(value = "短剧评论信息", tags = {"短剧评论信息"})
|
||||
@RequestMapping(value = "/app/courseComment")
|
||||
public class AppCourseCommentController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseCommentService courseCommentService;
|
||||
|
||||
@Login
|
||||
@PostMapping("/insertCourseComment")
|
||||
@ApiOperation("添加评论")
|
||||
public Result insertCourseComment(@RequestBody CourseComment courseComment, @RequestAttribute("userId") Long userId) {
|
||||
courseComment.setUserId(userId);
|
||||
return courseCommentService.insertCourseComment(courseComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 有赞时取消点赞 没赞时点赞
|
||||
*
|
||||
* @param courseCommentId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Login
|
||||
@GetMapping("/updateGoodsNum")
|
||||
@ApiOperation("点赞评论")
|
||||
public Result updateGoodsNum(Long courseCommentId, @RequestAttribute("userId") Long userId) {
|
||||
return courseCommentService.updateGoodsNum(courseCommentId, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看短剧下的所有评论内容 时间 评论人 评论人图像 评论点赞次数
|
||||
*
|
||||
* @param page
|
||||
* @param limit
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@Login
|
||||
@GetMapping("/selectCourseComment")
|
||||
@ApiOperation("查看评论")
|
||||
public Result selectCourseComment(Integer page, Integer limit, Long courseId, @RequestAttribute("userId") Long userId) {
|
||||
return courseCommentService.selectCourseComment(page, limit, courseId,userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除评论(删除评论的信息 删除评论的点赞关联 )
|
||||
*
|
||||
* @param courseCommentId
|
||||
* @return
|
||||
*/
|
||||
@Login
|
||||
@GetMapping("/deleteCourseComment")
|
||||
@ApiOperation("删除评论")
|
||||
public Result deleteCourseComment(Long courseCommentId) {
|
||||
return courseCommentService.deleteCourseComment(courseCommentId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.course.service.CourseDetailsService;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@RestController
|
||||
@Api(value = "APP短剧信息", tags = {"APP短剧信息"})
|
||||
@RequestMapping(value = "/app/course")
|
||||
public class AppCourseController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseDetailsService courseDetailsService;
|
||||
|
||||
@GetMapping("/selectCourse")
|
||||
@ApiOperation("查询短剧信息")
|
||||
public Result selectCourse(@ApiParam("页") Integer page, @ApiParam("条") Integer limit, @ApiParam("分类id") Long classifyId,
|
||||
@ApiParam("搜索内容") String title, Long bannerId, Integer sort, String token, Integer isPrice,
|
||||
Integer over,Integer wxCourse,Integer dyCourse,Integer wxShow,Integer dyShow, HttpServletRequest request) {
|
||||
if(StringUtils.isEmpty(token)){
|
||||
token = request.getHeader("Token");
|
||||
if(StringUtils.isBlank(token)){
|
||||
token = request.getParameter("Token");
|
||||
}
|
||||
}
|
||||
return courseService.selectCourse(page, limit, classifyId, title,null,1,bannerId,sort,token,isPrice,
|
||||
null, over,wxCourse,dyCourse,wxShow,dyShow);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/selectCourseDetailsById")
|
||||
@ApiOperation("根据id查询短剧详情")
|
||||
public Result selectCourseDetailsById(Long id,String token,String courseDetailsId){
|
||||
return courseDetailsService.selectCourseDetailsById(id,token,courseDetailsId);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCourseDetailsList")
|
||||
@ApiOperation("查询推荐视频")
|
||||
public Result selectCourseDetailsList(Integer page,Integer limit,String token,String randomNum,Integer wxShow,Integer dyShow){
|
||||
return courseDetailsService.selectCourseDetailsList(page, limit, token,randomNum,wxShow,dyShow);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/selectCourseTitle")
|
||||
@ApiOperation("模糊根据短剧标题查询短剧")
|
||||
public Result selectCourseTitle(@ApiParam("页") Integer page, @ApiParam("条") Integer limit, @ApiParam("分类id") Long classifyId,
|
||||
@ApiParam("搜索内容") String title,Long bannerId,Integer sort,String token, Integer isPrice,Integer over,
|
||||
Integer wxCourse,Integer dyCourse,Integer wxShow,Integer dyShow) {
|
||||
return courseService.selectCourse(page, limit, classifyId, title,null,1,bannerId,sort,token,isPrice,
|
||||
null, over,wxCourse,dyCourse,wxShow,dyShow);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCourseTitles")
|
||||
@ApiOperation("模糊根据短剧标题查询短剧")
|
||||
public Result selectCourseTitles(@ApiParam("页") Integer page, @ApiParam("条") Integer limit, @ApiParam("分类id") Long classifyId,
|
||||
@ApiParam("搜索内容") String title,Long bannerId,Integer sort,String token, Integer isPrice,Integer over,
|
||||
Integer wxCourse,Integer dyCourse,Integer wxShow,Integer dyShow) {
|
||||
return courseService.selectCourse(page, limit, classifyId, title,null,1,bannerId,sort,token,isPrice,
|
||||
null, over,wxCourse,dyCourse,wxShow,dyShow);
|
||||
}
|
||||
|
||||
@Login
|
||||
@PostMapping("/courseNotify")
|
||||
@ApiOperation("看广告解锁视频")
|
||||
public Result courseNotify(@RequestAttribute Long userId, Long courseId, Long courseDetailsId){
|
||||
return courseService.courseNotify(userId, courseId, courseDetailsId);
|
||||
}
|
||||
|
||||
@PostMapping("/notifyUrl")
|
||||
@ApiOperation("抖音视频回调")
|
||||
public JSONObject notifyUrl(@RequestBody JSONObject jsonObject){
|
||||
return courseService.notifyUrl(jsonObject);
|
||||
}
|
||||
|
||||
@PostMapping("/selectWxVideoUrl")
|
||||
@ApiOperation("查询微信短剧播放链接")
|
||||
public Result selectWxVideoUrl(@RequestBody JSONObject jsonObject){
|
||||
String wxCourseDetailsIds = jsonObject.getString("wxCourseDetailsIds");
|
||||
return courseService.selectWxVideoUrl(wxCourseDetailsIds);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.course.service.CourseUserService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@RestController
|
||||
@Api(value = "我的短剧", tags = {"我的短剧"})
|
||||
@RequestMapping(value = "/app/CourseUser")
|
||||
public class AppCourseUserController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseUserService courseUserService;
|
||||
|
||||
@Login
|
||||
@GetMapping("/selectCourseUser")
|
||||
@ApiOperation("App我的短剧")
|
||||
public Result selectCourseUser(Integer page, Integer limit, Long userId) {
|
||||
return courseUserService.selectCourseUser(page, limit, userId);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/updateTime")
|
||||
@ApiOperation("修改时间")
|
||||
public void updateTime(Long courseId) {
|
||||
courseUserService.updateTime(courseId);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/selectLatelyCourse")
|
||||
@ApiOperation("最近学习")
|
||||
public Result selectLatelyCourse(Integer page, Integer limit, Long userId) {
|
||||
return courseUserService.selectLatelyCourse(page, limit, userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.course.entity.CommentGood;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CommentGoodDao extends BaseMapper<CommentGood> {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.CourseClassification;
|
||||
import com.sqx.modules.course.response.ClassificationResponse;
|
||||
import com.sqx.modules.course.response.CurriculumResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CourseClassificationDao extends BaseMapper<CourseClassification> {
|
||||
|
||||
IPage<Map<String, Object>> selectCourseClassificationPage(Page<Map<String, Object>> pages, @Param("classificationName") String classificationName);
|
||||
|
||||
IPage<Map<String, Object>> selectCourseClassificationList(@Param("classificationName") String classificationName);
|
||||
|
||||
int updateDelete(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 查询短剧的分类信息
|
||||
*/
|
||||
List<ClassificationResponse> queryClassification();
|
||||
|
||||
/**
|
||||
* 查询推荐短剧信息
|
||||
*/
|
||||
List<CurriculumResponse> queryCurriculum(String limit);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.entity.CourseCollect;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Mapper
|
||||
public interface CourseCollectDao extends BaseMapper<CourseCollect> {
|
||||
|
||||
IPage<Course> selectCourseByCollect(Page<Course> page, @Param("userId") Long userId,@Param("classify") Integer classify);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.CourseComment;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CourseCommentDao extends BaseMapper<CourseComment> {
|
||||
|
||||
int updateCourseComment(@Param("type") Integer type, @Param("courseCommentId") Long courseCommentId);
|
||||
|
||||
IPage<CourseComment> selectCourseComment(Page<CourseComment> page, @Param("courseId") Long courseId,@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 删除评论的点赞关联
|
||||
* @param courseCommentId
|
||||
* @return
|
||||
*/
|
||||
int deleteCommentGood(@Param("courseCommentId") Long courseCommentId);
|
||||
|
||||
IPage<Map<String,Object>> selectCourseCommentByUserId(Page<Map<String,Object>> page,@Param("userId") Long userId);
|
||||
|
||||
|
||||
}
|
||||
43
src/main/java/com/sqx/modules/course/dao/CourseDao.java
Normal file
43
src/main/java/com/sqx/modules/course/dao/CourseDao.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CourseDao extends BaseMapper<Course> {
|
||||
|
||||
int updateDelete(@Param("id") Long id);
|
||||
|
||||
IPage<Map<String, Object>> selectCourse(Page<Map<String, Object>> pages, @Param("classifyId") Long classifyId,
|
||||
@Param("title") String title,@Param("isRecommend") Integer isRecommend,
|
||||
@Param("status") Integer status,@Param("bannerId") Long bannerId,
|
||||
@Param("sort") Integer sort,@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,@Param("userId") Long userId,
|
||||
@Param("isPrice") Integer isPrice,@Param("over") Integer over,
|
||||
@Param("wxCourse") Integer wxCourse,@Param("dyCourse") Integer dyCourse,
|
||||
@Param("wxShow") Integer wxShow,@Param("dyShow") Integer dyShow);
|
||||
|
||||
IPage<Map<String, Object>> selectCourseAdmin(Page<Map<String, Object>> pages, @Param("classifyId") Long classifyId,
|
||||
@Param("title") String title,@Param("isRecommend") Integer isRecommend,
|
||||
@Param("status") Integer status,@Param("bannerId") Long bannerId,
|
||||
@Param("sort") Integer sort,@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,@Param("userId") Long userId,
|
||||
@Param("isPrice") Integer isPrice,@Param("over") Integer over,
|
||||
@Param("wxCourse") Integer wxCourse,@Param("dyCourse") Integer dyCourse,
|
||||
@Param("wxShow") Integer wxShow,@Param("dyShow") Integer dyShow);
|
||||
|
||||
/**
|
||||
* 根据title 模糊查询短剧
|
||||
* @param pages
|
||||
* @param title
|
||||
* @return
|
||||
*/
|
||||
IPage<Map<String, Object>> selectCourseTitle(Page<Map<String, Object>> pages, @Param("title")String title);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.CourseDetails;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CourseDetailsDao extends BaseMapper<CourseDetails> {
|
||||
|
||||
List<CourseDetails> findByCourseId(@Param("id") Long id,@Param("userId") Long userId);
|
||||
|
||||
IPage<CourseDetails> selectCoursePageByCourseId(Page<CourseDetails> page, @Param("id") Long id,@Param("good") Integer good);
|
||||
|
||||
List<CourseDetails> findByCourseIdNotUrl(@Param("id") Long id,@Param("userId") Long userId);
|
||||
|
||||
int deleteCourseDetails(String[] ids);
|
||||
|
||||
IPage<CourseDetails> selectCourseDetailsList(Page<CourseDetails> page,String randomNum,Integer wxShow,Integer dyShow);
|
||||
|
||||
}
|
||||
41
src/main/java/com/sqx/modules/course/dao/CourseUserDao.java
Normal file
41
src/main/java/com/sqx/modules/course/dao/CourseUserDao.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.entity.CourseUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CourseUserDao extends BaseMapper<CourseUser> {
|
||||
|
||||
IPage<Course> selectLatelyCourse(Page<Course> pages, @Param("userId") Long userId);
|
||||
|
||||
IPage<Course> selectCourseByCourseUser(Page<Course> pages, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 查询用户是否订购
|
||||
*
|
||||
* @param id
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
CourseUser selectCourseUser(@Param("id") Long id, @Param("userId") Long userId);
|
||||
|
||||
List<CourseUser> selectCourseUserList(@Param("id") Long id, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*
|
||||
* @param courseUser
|
||||
* @return
|
||||
*/
|
||||
int updateCourseTime(@Param("courseUser") CourseUser courseUser);
|
||||
|
||||
int deleteCourseUserByVipUser(Long userId);
|
||||
|
||||
}
|
||||
42
src/main/java/com/sqx/modules/course/entity/CommentGood.java
Normal file
42
src/main/java/com/sqx/modules/course/entity/CommentGood.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description comment_good 评论点赞
|
||||
* @author fang
|
||||
* @date 2021-06-23
|
||||
*/
|
||||
@Data
|
||||
public class CommentGood implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 评论点赞id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long commentGoodId;
|
||||
|
||||
/**
|
||||
* 评论id
|
||||
*/
|
||||
private Long courseCommentId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
public CommentGood() {}
|
||||
}
|
||||
332
src/main/java/com/sqx/modules/course/entity/Course.java
Normal file
332
src/main/java/com/sqx/modules/course/entity/Course.java
Normal file
@@ -0,0 +1,332 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.sqx.modules.orders.entity.Orders;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description course 短剧
|
||||
* @author fang
|
||||
* @date 2021-03-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("course")
|
||||
public class Course implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 短剧id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
private String bannerImg;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 封面图
|
||||
*/
|
||||
@TableField("title_img")
|
||||
private String titleImg;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 上下架 1上架 2下架
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否完结 0未完结 1已完结
|
||||
*/
|
||||
private Integer isOver;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@TableField("classify_id")
|
||||
private Long classifyId;
|
||||
/**
|
||||
* 短剧分类对象
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private CourseClassification courseClassification;
|
||||
|
||||
/**
|
||||
* 购买次数
|
||||
*/
|
||||
@TableField("pay_num")
|
||||
private Integer payNum;
|
||||
|
||||
/**
|
||||
* 短剧标签
|
||||
*/
|
||||
@TableField("course_label")
|
||||
private String courseLabel;
|
||||
|
||||
@TableField("course_label_ids")
|
||||
private String courseLabelIds;
|
||||
|
||||
/**
|
||||
* 内容图
|
||||
*/
|
||||
private String img;
|
||||
|
||||
/**
|
||||
* 短剧介绍
|
||||
*/
|
||||
private String details;
|
||||
|
||||
/**
|
||||
* 删除标识 0未删除 1已删除
|
||||
*/
|
||||
@TableField("is_delete")
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("update_time")
|
||||
private String updateTime;
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
@TableField("msg_url")
|
||||
private String msgUrl;
|
||||
/**
|
||||
* 上传方式0OSS-1本地
|
||||
*/
|
||||
@TableField("msg_type")
|
||||
private Integer msgType;
|
||||
|
||||
/**
|
||||
* 是否是推荐商品
|
||||
*/
|
||||
@TableField("is_recommend")
|
||||
private Integer isRecommend;
|
||||
/**
|
||||
* 首页金刚区分类
|
||||
*/
|
||||
private Integer bannerId;
|
||||
|
||||
/**
|
||||
* 是否收费 1是 2免费
|
||||
*/
|
||||
private Integer isPrice;
|
||||
|
||||
/**
|
||||
* 短剧目录
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<CourseDetails> listsDetail;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 短剧分类 1短剧 2链接 3文档
|
||||
*/
|
||||
private Integer courseType;
|
||||
|
||||
/**
|
||||
* 播放量
|
||||
*/
|
||||
private Integer viewCounts;
|
||||
|
||||
/**
|
||||
* 抖音封面图id
|
||||
*/
|
||||
private String dyImgId;
|
||||
|
||||
/**
|
||||
* 抖音短剧id
|
||||
*/
|
||||
private String dyCourseId;
|
||||
|
||||
/**
|
||||
* 抖音提审状态 1已提交 2已通过 3已拒绝 4已上线
|
||||
*/
|
||||
private Integer dyStatus;
|
||||
|
||||
/**
|
||||
* 抖音审核内容
|
||||
*/
|
||||
private String dyStatusContent;
|
||||
|
||||
/**
|
||||
* 当前版本号
|
||||
*/
|
||||
private String dyVersion;
|
||||
|
||||
/**
|
||||
* 资质 许可证号
|
||||
*/
|
||||
private String licenseNum;
|
||||
|
||||
/**
|
||||
* 资质 登记号
|
||||
*/
|
||||
private String registrationNum;
|
||||
|
||||
/**
|
||||
* 资质 普通备案号
|
||||
*/
|
||||
private String ordinaryRecordNum;
|
||||
|
||||
/**
|
||||
* 资质 重点备案号
|
||||
*/
|
||||
private String keyRecordNum;
|
||||
|
||||
/**
|
||||
* 微信短剧id
|
||||
*/
|
||||
private String wxCourseId;
|
||||
|
||||
/**
|
||||
* 微信是否显示 1是
|
||||
*/
|
||||
private Integer wxShow;
|
||||
|
||||
/**
|
||||
* 抖音是否显示 1是
|
||||
*/
|
||||
private Integer dyShow;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
*平均单集时长,单位分钟
|
||||
*/
|
||||
private Integer duration;
|
||||
|
||||
/**
|
||||
*制作机构
|
||||
*/
|
||||
private String productionOrganisation;
|
||||
|
||||
/**
|
||||
* 导演
|
||||
*/
|
||||
private String director;
|
||||
|
||||
/**
|
||||
* 制作人
|
||||
*/
|
||||
private String producer;
|
||||
|
||||
/**
|
||||
* 演员
|
||||
*/
|
||||
private String actor;
|
||||
|
||||
/**
|
||||
* 内容梗概(1000 汉字以内)
|
||||
*/
|
||||
private String summary;
|
||||
|
||||
/**
|
||||
* 成本配置比例情况图片
|
||||
*/
|
||||
private String costDistributionUri;
|
||||
|
||||
/**
|
||||
*承诺书
|
||||
*/
|
||||
private String assuranceUri;
|
||||
|
||||
/**
|
||||
*制作成本类型
|
||||
* - 10:30万以下
|
||||
* - 20:30~100万
|
||||
* - 30:100万以
|
||||
*/
|
||||
private Integer playletProductionCost;
|
||||
|
||||
/**
|
||||
* 剧目资质:1-取得《网络剧片发行许可证》或重点节目备案号;2-未取得《网络剧片发行许可证》或重点节目备案,且制作成本小于30万元
|
||||
* 注:
|
||||
* 1、
|
||||
* (1)剧目资质=1:需上传“网络剧片发行许可证”或“广电备案系统截图”,平台会在视频播放环节展示备案号水印;
|
||||
* (2)剧目资质=2:制作成本在30万以内,需上传《成本配置比例情况报告》。剧目经平台审核后由平台下发备案号(备案号仅适用微信小程序平台)并在视频播放环节展示备案号水印。
|
||||
* 2、2024年5月27日前发起提审的剧目可支持修改,且同一剧目仅支持修改一次。
|
||||
*/
|
||||
private Integer qualificationType;
|
||||
|
||||
/**
|
||||
* 剧目备案号,当qualification_type=1时必填。根据提供的剧目资质证明文件填写对应的网络剧片发行许可证编号或剧目备案号。如:(沪)网剧审字(2023)第001号 或 V123456788888888
|
||||
*/
|
||||
private String registrationNumber;
|
||||
|
||||
/**
|
||||
* 剧目资质证明文件,当qualification_type=1时必填。请提供网络剧片发行许可证或广电备案系统截图
|
||||
*/
|
||||
private String qualificationCertificateMaterialId;
|
||||
|
||||
/**
|
||||
* 剧目制作成本(单位:万元),当qualification_type=2时必填。请填写“1-29” 的整数(如非整数将截断取整),数值需与《成本配置比例情况报告》中对应剧目制作成本一致。
|
||||
*/
|
||||
private String costOfProduction;
|
||||
|
||||
/**
|
||||
* 《成本配置比例情况报告》material_id,当qualification_type=2时必填
|
||||
*/
|
||||
private String costCommitmentLetterMaterialId;
|
||||
|
||||
private Integer wxCourseStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String remark;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String avatar;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String courseCount;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer isMyCourse;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Orders orders;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String courseDetailsName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long courseDetailsId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer courseDetailsCount;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer isCollect;
|
||||
|
||||
public Course() {}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
* @description CourseClassification 短剧分类
|
||||
* @author wang
|
||||
* @date 2021-03-29
|
||||
*/
|
||||
@Data
|
||||
@TableName("course_classification")
|
||||
public class CourseClassification implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long classificationId;
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String classificationName;
|
||||
/**
|
||||
* 是否删除0正常1已删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description course_collect 收藏
|
||||
* @author fang
|
||||
* @date 2021-03-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("course_collect")
|
||||
public class CourseCollect implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 收藏id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long courseCollectId;
|
||||
|
||||
/**
|
||||
* 短剧id
|
||||
*/
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 集id
|
||||
*/
|
||||
private Long courseDetailsId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 分类 1收藏 2点赞 3历史记录
|
||||
*/
|
||||
private Integer classify;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
@TableField(exist = false)
|
||||
private Integer type;
|
||||
|
||||
|
||||
|
||||
public CourseCollect() {}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description course_comment 短剧评论
|
||||
* @author fang
|
||||
* @date 2021-03-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("course_comment")
|
||||
public class CourseComment implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 短剧评论id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long courseCommentId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
@TableField(exist = false)
|
||||
private UserEntity userEntity;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String userName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String avatar;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer isCommentGood;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer isGood;
|
||||
|
||||
/**
|
||||
* 短剧id
|
||||
*/
|
||||
private Long courseId;
|
||||
/**
|
||||
* 短剧
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Course course;
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
private Integer goodsNum;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
public CourseComment() {}
|
||||
}
|
||||
149
src/main/java/com/sqx/modules/course/entity/CourseDetails.java
Normal file
149
src/main/java/com/sqx/modules/course/entity/CourseDetails.java
Normal file
@@ -0,0 +1,149 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description course_details 短剧目录
|
||||
* @author fang
|
||||
* @date 2021-03-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("course_details")
|
||||
public class CourseDetails implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 短剧目录id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long courseDetailsId;
|
||||
|
||||
/**
|
||||
* 短剧id
|
||||
*/
|
||||
private Long courseId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Course course;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 封面图
|
||||
*/
|
||||
private String titleImg;
|
||||
|
||||
/**
|
||||
* 介绍
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 短剧名称
|
||||
*/
|
||||
private String courseDetailsName;
|
||||
|
||||
/**
|
||||
* 视频地址
|
||||
*/
|
||||
private String videoUrl;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
private Integer goodNum;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 是否推荐 1是 2否
|
||||
*/
|
||||
private Integer good;
|
||||
|
||||
/**
|
||||
* 是否收费 1是 2免费
|
||||
*/
|
||||
private Integer isPrice;
|
||||
|
||||
/**
|
||||
* 抖音视频id
|
||||
*/
|
||||
private String dyCourseDetailsId;
|
||||
|
||||
/**
|
||||
* 视频上传状态 1上传中 2上传成功 3上传失败
|
||||
*/
|
||||
private Integer dyUrlStatus;
|
||||
|
||||
/**
|
||||
* 抖音封面图id
|
||||
*/
|
||||
private String dyImgId;
|
||||
|
||||
/**
|
||||
* 抖音集id
|
||||
*/
|
||||
private String dyEpisodeId;
|
||||
|
||||
/**
|
||||
* 抖音提审状态 1已提交 2已通过 3已拒绝 4已上线
|
||||
*/
|
||||
private Integer dyStatus;
|
||||
|
||||
/**
|
||||
* 抖音审核内容
|
||||
*/
|
||||
private String dyStatusContent;
|
||||
|
||||
/**
|
||||
* 当前版本号
|
||||
*/
|
||||
private String dyVersion;
|
||||
|
||||
/**
|
||||
* 微信视频id
|
||||
*/
|
||||
private String wxCourseDetailsId;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 是否允许广告解锁 1是
|
||||
*/
|
||||
private Integer advertising;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer isCollect;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer isGood;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer courseDetailsCount;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String wxUrl;
|
||||
|
||||
public CourseDetails() {}
|
||||
}
|
||||
71
src/main/java/com/sqx/modules/course/entity/CourseUser.java
Normal file
71
src/main/java/com/sqx/modules/course/entity/CourseUser.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description course_user 用户短剧
|
||||
* @author fang
|
||||
* @date 2021-03-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("course_user")
|
||||
public class CourseUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 我的短剧id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long courseUserId;
|
||||
|
||||
/**
|
||||
* 短剧id
|
||||
*/
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 集数id
|
||||
*/
|
||||
private Long courseDetailsId;
|
||||
|
||||
/**
|
||||
* 分类 1整集/2单集
|
||||
*/
|
||||
private Integer classify;
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String avatar;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String courseCount;
|
||||
|
||||
public CourseUser() {}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sqx.modules.course.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 查询短剧分类信息的返回参数
|
||||
* @author liyuan
|
||||
* @since 2021-07-15
|
||||
*/
|
||||
@Data
|
||||
public class ClassificationResponse {
|
||||
|
||||
/**
|
||||
* 短剧分类id
|
||||
*/
|
||||
@TableField("classification_id")
|
||||
private int classificationId;
|
||||
/**
|
||||
* 短剧名称
|
||||
*/
|
||||
@TableField("classification_name")
|
||||
private String classificationName;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.sqx.modules.course.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 查询推荐短剧信息的返回参数
|
||||
*
|
||||
* @author liyuan
|
||||
* @since 2021-07-15
|
||||
*/
|
||||
@Data
|
||||
public class CurriculumResponse {
|
||||
|
||||
/**
|
||||
* 短剧id
|
||||
*/
|
||||
@TableField("course_id")
|
||||
private int courseId;
|
||||
/**
|
||||
* 短剧的封面图
|
||||
*/
|
||||
@TableField("title_img")
|
||||
private String titleImg;
|
||||
/**
|
||||
* 短剧标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 短剧价钱
|
||||
*/
|
||||
private String price;
|
||||
/**
|
||||
* 短剧购买量
|
||||
*/
|
||||
@TableField("pay_num")
|
||||
private int payNum;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.sqx.modules.course.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.modules.course.entity.CommentGood;
|
||||
|
||||
public interface CommentGoodService extends IService<CommentGood> {
|
||||
|
||||
CommentGood selectCommentGoodByCommentIdAndUserId(Long commentId,Long userId);
|
||||
|
||||
int deleteCommentGoodById(Long id);
|
||||
|
||||
int insertCommentGood(CommentGood commentGood);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.sqx.modules.course.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseClassification;
|
||||
import com.sqx.modules.course.response.ClassificationResponse;
|
||||
import com.sqx.modules.course.response.CurriculumResponse;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface CourseClassificationService extends IService<CourseClassification> {
|
||||
Result insertCourseClassification(CourseClassification course);
|
||||
|
||||
Result updateCourseClassification(CourseClassification course);
|
||||
|
||||
Result updateDelete(Long id);
|
||||
|
||||
Result selectCourseClassification(Integer page, Integer limit, String classificationName);
|
||||
|
||||
CourseClassification selectCourseClassificationById(Long id);
|
||||
|
||||
List<Map<String, Object>> selectClassification();
|
||||
|
||||
/**
|
||||
*查询短剧的分类信息
|
||||
* @return
|
||||
*/
|
||||
List<ClassificationResponse> queryClassification();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.sqx.modules.course.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseCollect;
|
||||
|
||||
public interface CourseCollectService extends IService<CourseCollect> {
|
||||
|
||||
Result insertCourseCollect(CourseCollect courseCollect);
|
||||
|
||||
Result selectByUserId(Integer page, Integer limit, Long userId,Integer classify);
|
||||
|
||||
CourseCollect selectCourseCollectUserIdAnd(Long userId,Long courseId,Integer classify,Long courseDetailsId);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.sqx.modules.course.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseComment;
|
||||
|
||||
public interface CourseCommentService extends IService<CourseComment> {
|
||||
Result insertCourseComment(CourseComment courseComment);
|
||||
|
||||
Result updateGoodsNum(Long courseCommentId, Long userId);
|
||||
|
||||
Result selectCourseComment(Integer page, Integer limit, Long courseId,Long userId);
|
||||
|
||||
Result deleteCourseComment(Long courseCommentId);
|
||||
|
||||
/**
|
||||
* 查询用户的评论
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Result selectCourseCommentUser(Integer page, Integer limit,Long userId);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.sqx.modules.course.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseDetails;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface CourseDetailsService extends IService<CourseDetails> {
|
||||
Result insert(CourseDetails courseDetails);
|
||||
|
||||
Result updateCourseDetails(CourseDetails courseDetails);
|
||||
|
||||
Result deleteCourseDetails(String ids);
|
||||
|
||||
Result selectCourseDetailsById(Long id,String token,String courseDetailsId);
|
||||
|
||||
Result selectCourseDetailsList(Integer page,Integer limit,String token,String randomNum,Integer wxShow,Integer dyShow);
|
||||
|
||||
Result courseDetailsListExcelIn(MultipartFile file, Long courseId) throws IOException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.sqx.modules.course.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public interface CourseService extends IService<Course> {
|
||||
Result insertCourse(Course course);
|
||||
|
||||
Result updateCourse(Course course);
|
||||
|
||||
Result updateDelete(Long id);
|
||||
|
||||
Result selectCourse(Integer page, Integer limit, Long classifyId, String title, Integer isRecommend,
|
||||
Integer status, Long bannerId, Integer sort, String token, Integer isPrice, Integer admin, Integer over,
|
||||
Integer wxCourse,Integer dyCourse,Integer wxShow,Integer dyShow);
|
||||
|
||||
Result selectCourseById(Integer page,Integer limit,Long id,Integer good);
|
||||
|
||||
Result selectCourseTitle(Integer page, Integer limit, String title, Long userId);
|
||||
|
||||
Result synCourse();
|
||||
|
||||
Result updateCourseDetails(String ids, BigDecimal price,String content,String titleImg);
|
||||
|
||||
Result updateCourseStatus(String ids, Integer status);
|
||||
|
||||
Result deleteCourseByIds(String ids);
|
||||
|
||||
Result deleteCourseDetailsByIds(String ids);
|
||||
|
||||
Result courseNotify(Long userId, Long courseId, Long courseDetailsId);
|
||||
|
||||
Result dyVideoUpload(Long courseId);
|
||||
|
||||
Result dyVideoAudit(Long courseId);
|
||||
|
||||
Result dyVideoUp(Long courseId);
|
||||
|
||||
Result setDyNotifyUrl(String notifyUrl);
|
||||
|
||||
JSONObject notifyUrl(JSONObject jsonObject);
|
||||
|
||||
Result uploadCourseDetails(Long courseDetailsId);
|
||||
|
||||
Result updateDyCourse(Course course);
|
||||
|
||||
Result sysWxCourse(Integer freeNum, BigDecimal coursePrice,Integer maxGood,Integer minGood);
|
||||
|
||||
Result selectWxVideoUrl(String wxCourseDetailsIds);
|
||||
|
||||
Result uploadWxCourse(Long courseId,Integer qualificationType,String registrationNumber,
|
||||
String qualificationCertificateMaterialId,String costOfProduction,String costCommitmentLetterMaterialId);
|
||||
|
||||
Result courseListExcelIn(MultipartFile file) throws IOException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.sqx.modules.course.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseUser;
|
||||
|
||||
|
||||
public interface CourseUserService extends IService<CourseUser> {
|
||||
|
||||
void updateTime(Long courseId);
|
||||
|
||||
Result selectCourseUser(Integer page, Integer limit, Long userId);
|
||||
|
||||
Result selectLatelyCourse(Integer page, Integer limit, Long userId);
|
||||
|
||||
Result insertCourseUser(CourseUser courseUser);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.sqx.modules.course.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.modules.course.dao.CommentGoodDao;
|
||||
import com.sqx.modules.course.entity.CommentGood;
|
||||
import com.sqx.modules.course.service.CommentGoodService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CommentGoodServiceImpl extends ServiceImpl<CommentGoodDao, CommentGood> implements CommentGoodService {
|
||||
|
||||
@Override
|
||||
public CommentGood selectCommentGoodByCommentIdAndUserId(Long commentId,Long userId){
|
||||
return baseMapper.selectOne(new QueryWrapper<CommentGood>().eq("course_comment_id",commentId).eq("user_id",userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteCommentGoodById(Long id){
|
||||
return baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertCommentGood(CommentGood commentGood){
|
||||
return baseMapper.insert(commentGood);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.sqx.modules.course.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.dao.CourseClassificationDao;
|
||||
import com.sqx.modules.course.entity.CourseClassification;
|
||||
import com.sqx.modules.course.response.ClassificationResponse;
|
||||
import com.sqx.modules.course.service.CourseClassificationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class CourseClassificationServiceImpl extends ServiceImpl<CourseClassificationDao, CourseClassification> implements CourseClassificationService {
|
||||
@Override
|
||||
public Result insertCourseClassification(CourseClassification course) {
|
||||
course.setIsDelete(0);
|
||||
baseMapper.insert(course);
|
||||
return Result.success("操作成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateCourseClassification(CourseClassification course) {
|
||||
baseMapper.updateById(course);
|
||||
return Result.success("操作成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateDelete(Long id) {
|
||||
baseMapper.updateDelete(id);
|
||||
return Result.success("操作成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectCourseClassification(Integer page, Integer limit, String classificationName) {
|
||||
if(page==null || limit==null){
|
||||
return Result.success().put("data", new PageUtils(baseMapper.selectCourseClassificationList( classificationName)));
|
||||
}
|
||||
Page<Map<String, Object>> pages = new Page<>(page, limit);
|
||||
return Result.success().put("data", new PageUtils(baseMapper.selectCourseClassificationPage(pages, classificationName)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseClassification selectCourseClassificationById(Long id) {
|
||||
return baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> selectClassification() {
|
||||
return baseMapper.selectMaps(new QueryWrapper<CourseClassification>().eq("is_delete",0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询短剧的分类信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ClassificationResponse> queryClassification() {
|
||||
return baseMapper.queryClassification();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.sqx.modules.course.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.dao.CourseClassificationDao;
|
||||
import com.sqx.modules.course.dao.CourseCollectDao;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.entity.CourseCollect;
|
||||
import com.sqx.modules.course.entity.CourseDetails;
|
||||
import com.sqx.modules.course.service.CourseCollectService;
|
||||
import com.sqx.modules.course.service.CourseDetailsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
@Service
|
||||
public class CourseCollectServiceImpl extends ServiceImpl<CourseCollectDao, CourseCollect> implements CourseCollectService {
|
||||
|
||||
@Autowired
|
||||
private CourseClassificationDao courseClassificationDao;
|
||||
@Autowired
|
||||
private CourseDetailsService courseDetailsService;
|
||||
|
||||
private ReentrantReadWriteLock reentrantReadWriteLock=new ReentrantReadWriteLock(true);
|
||||
|
||||
@Override
|
||||
public Result insertCourseCollect(CourseCollect courseCollect) {
|
||||
reentrantReadWriteLock.writeLock().lock();
|
||||
try {
|
||||
CourseCollect courseCollect1 = selectCourseCollectUserIdAnd(courseCollect.getUserId(), courseCollect.getCourseId(),courseCollect.getClassify(),courseCollect.getCourseDetailsId());
|
||||
if (courseCollect.getType() == 1) {
|
||||
if(courseCollect1==null){
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
courseCollect.setCreateTime(df.format(new Date()));
|
||||
courseCollect.setUpdateTime(courseCollect.getCreateTime());
|
||||
baseMapper.insert(courseCollect);
|
||||
if(courseCollect.getClassify()==2){
|
||||
CourseDetails courseDetails = courseDetailsService.getById(courseCollect.getCourseDetailsId());
|
||||
courseDetails.setGoodNum(courseDetails.getGoodNum()+1);
|
||||
courseDetailsService.updateById(courseDetails);
|
||||
}
|
||||
}else{
|
||||
courseCollect1.setUpdateTime(DateUtils.format(new Date()));
|
||||
baseMapper.updateById(courseCollect1);
|
||||
}
|
||||
} else {
|
||||
if(courseCollect1!=null){
|
||||
baseMapper.deleteById(courseCollect1.getCourseCollectId());
|
||||
if(courseCollect.getClassify()==2){
|
||||
CourseDetails courseDetails = courseDetailsService.getById(courseCollect.getCourseDetailsId());
|
||||
courseDetails.setGoodNum(courseDetails.getGoodNum()-1);
|
||||
courseDetailsService.updateById(courseDetails);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success("操作成功!");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("收藏短剧出错了!"+e.getMessage());
|
||||
}finally {
|
||||
reentrantReadWriteLock.writeLock().unlock();
|
||||
}
|
||||
return Result.error("系统繁忙,请稍后再试!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectByUserId(Integer page, Integer limit, Long userId,Integer classify) {
|
||||
Page<Course> pages=new Page<>(page,limit);
|
||||
IPage<Course> courseIPage = baseMapper.selectCourseByCollect(pages, userId,classify);
|
||||
List<Course> courses = courseIPage.getRecords();
|
||||
if (courses != null && courses.size() > 0) {
|
||||
for (Course course : courses) {
|
||||
course.setCourseClassification(courseClassificationDao.selectById(course.getClassifyId()));
|
||||
}
|
||||
}
|
||||
return Result.success().put("data",courseIPage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CourseCollect selectCourseCollectUserIdAnd(Long userId,Long courseId,Integer classify,Long courseDetailsId){
|
||||
return baseMapper.selectOne(new QueryWrapper<CourseCollect>().eq(courseDetailsId!=null,"course_details_id",courseDetailsId).eq("user_id",userId).eq("classify",classify).eq("course_id",courseId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.sqx.modules.course.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.dao.CourseCommentDao;
|
||||
import com.sqx.modules.course.dao.CourseDao;
|
||||
import com.sqx.modules.course.entity.CommentGood;
|
||||
import com.sqx.modules.course.entity.CourseComment;
|
||||
import com.sqx.modules.course.service.CommentGoodService;
|
||||
import com.sqx.modules.course.service.CourseCommentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class CourseCommentServiceImpl extends ServiceImpl<CourseCommentDao, CourseComment> implements CourseCommentService {
|
||||
|
||||
@Autowired
|
||||
private CommentGoodService commentGoodService;
|
||||
@Autowired
|
||||
private CourseDao courseDao;
|
||||
|
||||
@Override
|
||||
public Result insertCourseComment(CourseComment courseComment) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
courseComment.setCreateTime(df.format(new Date()));
|
||||
baseMapper.insert(courseComment);
|
||||
return Result.success("操作成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateGoodsNum(Long courseCommentId, Long userId) {
|
||||
//先判断自己有没有点过赞
|
||||
CommentGood commentGood = commentGoodService.selectCommentGoodByCommentIdAndUserId(courseCommentId, userId);
|
||||
if (commentGood != null) {
|
||||
//取消点赞
|
||||
commentGoodService.deleteCommentGoodById(commentGood.getCommentGoodId());
|
||||
//取消点赞的标识
|
||||
int type = 0;
|
||||
//取消点赞,评论点赞数量减一
|
||||
baseMapper.updateCourseComment(type, courseCommentId);
|
||||
|
||||
} else {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
commentGood = new CommentGood();
|
||||
commentGood.setCourseCommentId(courseCommentId);
|
||||
commentGood.setUserId(userId);
|
||||
commentGood.setCreateTime(df.format(new Date()));
|
||||
commentGoodService.insertCommentGood(commentGood);
|
||||
//点赞标识
|
||||
int type = 1;
|
||||
//点赞成功 评论点赞数量加一
|
||||
baseMapper.updateCourseComment(type, courseCommentId);
|
||||
|
||||
}
|
||||
return Result.success("操作成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectCourseComment(Integer page, Integer limit, Long courseId,Long userId) {
|
||||
Page<CourseComment> courseCommentPage = new Page<>(page, limit);
|
||||
return Result.success().put("data", new PageUtils(baseMapper.selectCourseComment(courseCommentPage, courseId,userId)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result deleteCourseComment(Long courseCommentId) {
|
||||
//删除评论
|
||||
baseMapper.deleteById(courseCommentId);
|
||||
//删除评论与点赞的关联
|
||||
baseMapper.deleteCommentGood(courseCommentId);
|
||||
return Result.success("操作成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectCourseCommentUser(Integer page, Integer limit,Long userId) {
|
||||
Page<Map<String,Object>> pages=new Page(page,limit);
|
||||
return Result.success().put("data",new PageUtils(baseMapper.selectCourseCommentByUserId(pages,userId)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
package com.sqx.modules.course.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.app.utils.JwtUtils;
|
||||
import com.sqx.modules.course.dao.CourseCollectDao;
|
||||
import com.sqx.modules.course.dao.CourseDao;
|
||||
import com.sqx.modules.course.dao.CourseDetailsDao;
|
||||
import com.sqx.modules.course.dao.CourseUserDao;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.entity.CourseCollect;
|
||||
import com.sqx.modules.course.entity.CourseDetails;
|
||||
import com.sqx.modules.course.entity.CourseUser;
|
||||
import com.sqx.modules.course.service.CourseDetailsService;
|
||||
import com.sqx.modules.course.vo.CourseDetailsIn;
|
||||
import com.sqx.modules.orders.service.OrdersService;
|
||||
import com.sqx.modules.utils.EasyPoi.ExcelUtils;
|
||||
import com.sqx.modules.utils.HttpClientUtil;
|
||||
import com.sqx.modules.utils.SenInfoCheckUtil;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, CourseDetails> implements CourseDetailsService {
|
||||
|
||||
@Autowired
|
||||
private CourseDao courseDao;
|
||||
@Autowired
|
||||
private CourseCollectDao courseCollectDao;
|
||||
@Autowired
|
||||
private JwtUtils jwtUtils;
|
||||
@Autowired
|
||||
private CourseUserDao courseUserDao;
|
||||
@Autowired
|
||||
private OrdersService ordersService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
|
||||
@Override
|
||||
public Result insert(CourseDetails courseDetails) {
|
||||
if(courseDetails.getGoodNum()==null){
|
||||
courseDetails.setGoodNum(0);
|
||||
}
|
||||
baseMapper.insert(courseDetails);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateCourseDetails(CourseDetails courseDetails) {
|
||||
baseMapper.updateById(courseDetails);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result deleteCourseDetails(String ids) {
|
||||
String[] split = ids.split(",");
|
||||
baseMapper.deleteCourseDetails(split);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectCourseDetailsById(Long id,String token,String courseDetailsId){
|
||||
Course bean = courseDao.selectById(id);
|
||||
if(bean.getViewCounts()==null){
|
||||
bean.setViewCounts(1);
|
||||
}else{
|
||||
bean.setViewCounts(bean.getViewCounts()+1);
|
||||
}
|
||||
courseDao.updateById(bean);
|
||||
Long userId=null;
|
||||
if(StringUtils.isNotEmpty(token)){
|
||||
Claims claims = jwtUtils.getClaimByToken(token);
|
||||
if(claims != null && !jwtUtils.isTokenExpired(claims.getExpiration())){
|
||||
userId=Long.parseLong(claims.getSubject());
|
||||
}
|
||||
}
|
||||
bean.setIsCollect(0);
|
||||
if (userId != null) {
|
||||
bean.setIsCollect(courseCollectDao.selectCount(new QueryWrapper<CourseCollect>().eq("user_id",userId).eq("classify",1).eq("course_id",bean.getCourseId())));
|
||||
UserEntity userEntity = userService.selectUserById(userId);
|
||||
//查询用户是否购买了整集
|
||||
CourseUser courseUser = courseUserDao.selectCourseUser(id, userId);
|
||||
if (courseUser != null || (userEntity.getMember()!=null && userEntity.getMember()==2)) {
|
||||
bean.setListsDetail(baseMapper.findByCourseId(id,userId));
|
||||
}else{
|
||||
bean.setListsDetail(baseMapper.findByCourseIdNotUrl(id,userId));
|
||||
//查询用户是否单独购买了集
|
||||
List<CourseUser> courseUsers = courseUserDao.selectCourseUserList(id, userId);
|
||||
if(courseUsers.size()>0){
|
||||
for (CourseUser courseUser1:courseUsers){
|
||||
for (CourseDetails courseDetails:bean.getListsDetail()) {
|
||||
if(courseUser1.getCourseDetailsId().equals(courseDetails.getCourseDetailsId())){
|
||||
CourseDetails courseDetails1 = baseMapper.selectById(courseDetails.getCourseDetailsId());
|
||||
courseDetails.setVideoUrl(courseDetails1.getVideoUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*for (CourseDetails courseDetails:bean.getListsDetail()){
|
||||
courseDetails.setIsCollect(courseCollectDao.selectCount(new QueryWrapper<CourseCollect>()
|
||||
.eq("user_id", userId).eq("course_details_id", courseDetails.getCourseDetailsId()).eq("classify",1)));
|
||||
courseDetails.setIsGood(courseCollectDao.selectCount(new QueryWrapper<CourseCollect>()
|
||||
.eq("user_id", userId).eq("course_details_id", courseDetails.getCourseDetailsId()).eq("classify",2)));
|
||||
}*/
|
||||
|
||||
} else {
|
||||
bean.setListsDetail(baseMapper.findByCourseIdNotUrl(id,null));
|
||||
}
|
||||
if(courseDetailsId!=null){
|
||||
if (bean.getListsDetail().size()>0){
|
||||
for (CourseDetails courseDetails:bean.getListsDetail()){
|
||||
if(courseDetails.getCourseDetailsId().equals(Long.parseLong(courseDetailsId))){
|
||||
//微信内
|
||||
String url="https://api.weixin.qq.com/wxa/sec/vod/getmedialink?access_token="+ SenInfoCheckUtil.getMpToken();
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("media_id",courseDetails.getWxCourseDetailsId());
|
||||
jsonObject.put("t",(new Date().getTime()/1000)+7200);
|
||||
String s = HttpClientUtil.doPostJson(url, jsonObject.toJSONString());
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(s);
|
||||
String errcode = jsonObject1.getString("errcode");
|
||||
if(!"0".equals(errcode)){
|
||||
return Result.error("获取微信播放链接失败:"+jsonObject1.getString("errmsg"));
|
||||
}
|
||||
JSONObject media_info = jsonObject1.getJSONObject("media_info");
|
||||
String mp4_url = media_info.getString("mp4_url");
|
||||
courseDetails.setWxUrl(mp4_url);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success().put("data",bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectCourseDetailsList(Integer page,Integer limit,String token,String randomNum,Integer wxShow,Integer dyShow){
|
||||
Long userId=null;
|
||||
if(StringUtils.isNotEmpty(token)){
|
||||
Claims claims = jwtUtils.getClaimByToken(token);
|
||||
if(claims != null && !jwtUtils.isTokenExpired(claims.getExpiration())){
|
||||
userId=Long.parseLong(claims.getSubject());
|
||||
}
|
||||
}
|
||||
IPage<CourseDetails> courseDetailsIPage = baseMapper.selectCourseDetailsList(new Page<>(page, limit),randomNum,wxShow,dyShow);
|
||||
|
||||
if (userId != null) {
|
||||
List<CourseDetails> records = courseDetailsIPage.getRecords();
|
||||
for (CourseDetails courseDetails:records){
|
||||
courseDetails.setIsCollect(courseCollectDao.selectCount(new QueryWrapper<CourseCollect>()
|
||||
.eq("user_id", userId).eq("course_details_id", courseDetails.getCourseDetailsId()).eq("classify",1)));
|
||||
courseDetails.setIsGood(courseCollectDao.selectCount(new QueryWrapper<CourseCollect>()
|
||||
.eq("user_id", userId).eq("course_details_id", courseDetails.getCourseDetailsId()).eq("classify",2)));
|
||||
courseDetails.setCourse(courseDao.selectById(courseDetails.getCourseId()));
|
||||
courseDetails.setTitle(courseDetails.getCourse().getTitle());
|
||||
courseDetails.setCourseDetailsCount(baseMapper.selectCount(new QueryWrapper<CourseDetails>().eq("course_id",courseDetails.getCourseId())));
|
||||
}
|
||||
}
|
||||
return Result.success().put("data",new PageUtils(courseDetailsIPage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result courseDetailsListExcelIn(MultipartFile file, Long courseId) throws IOException {
|
||||
Course course = courseDao.selectById(courseId);
|
||||
if (course==null){
|
||||
return Result.error("所选剧不存在");
|
||||
}
|
||||
List<CourseDetailsIn> courseDetailsList = ExcelUtils.importExcel(file, 2, 1, CourseDetailsIn.class);
|
||||
if (CollectionUtils.isEmpty(courseDetailsList)) {
|
||||
return Result.error("Excel数据为空,excel转化失败!");
|
||||
}
|
||||
//当前行索引(Excel的数据从第几行开始,就填写几)
|
||||
int index = 4;
|
||||
//失败条数
|
||||
int repeat = 0;
|
||||
//成功条数
|
||||
int successIndex = 0;
|
||||
//空数据
|
||||
int emptyCount=0;
|
||||
for (CourseDetailsIn courseDetailsIn : courseDetailsList) {
|
||||
if(courseDetailsIn.getCourseDetailsName()==null){
|
||||
emptyCount++;
|
||||
continue;
|
||||
}
|
||||
if (courseDetailsIn.getIsPrice()!=2){
|
||||
if (courseDetailsIn.getPrice() == null || courseDetailsIn.getPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return Result.error("第【" + index + "】行数据为收费,但并没有设置价格");
|
||||
}
|
||||
}
|
||||
index++;
|
||||
Integer count = baseMapper.selectCount(new QueryWrapper<CourseDetails>().eq("course_details_name", courseDetailsIn.getCourseDetailsName()).eq("course_id", courseId));
|
||||
if (count <= 0) {
|
||||
CourseDetails courseDetails = new CourseDetails();
|
||||
courseDetails.setCourseId(courseId);
|
||||
courseDetails.setCreateTime(DateUtils.format(new Date()));
|
||||
BeanUtils.copyProperties(courseDetailsIn, courseDetails);
|
||||
int result = baseMapper.insert(courseDetails);
|
||||
if (result > 0) {
|
||||
successIndex++;
|
||||
}else {
|
||||
repeat++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return Result.success("导入成功,共新增【" + successIndex + "】条,失败【" + (courseDetailsList.size() - successIndex - emptyCount) + "】条,其中过滤重复数据【" + repeat + "】条");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
package com.sqx.modules.course.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.dao.CourseClassificationDao;
|
||||
import com.sqx.modules.course.dao.CourseUserDao;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.entity.CourseUser;
|
||||
import com.sqx.modules.course.service.CourseUserService;
|
||||
import com.sqx.modules.orders.entity.Orders;
|
||||
import com.sqx.modules.orders.service.OrdersService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CourseUserServiceImpl extends ServiceImpl<CourseUserDao, CourseUser> implements CourseUserService {
|
||||
@Autowired
|
||||
private CourseClassificationDao courseClassificationDao;
|
||||
@Autowired
|
||||
private OrdersService ordersService;
|
||||
|
||||
@Override
|
||||
public void updateTime(Long courseId) {
|
||||
QueryWrapper<CourseUser> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("course_id", courseId);
|
||||
CourseUser bean = baseMapper.selectOne(queryWrapper);
|
||||
SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
bean.setUpdateTime(df1.format(new Date()));
|
||||
UpdateWrapper<CourseUser> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("course_id", courseId);
|
||||
baseMapper.update(bean, updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectCourseUser(Integer page, Integer limit, Long userId) {
|
||||
Page<Course> courseUserPage = new Page<>(page, limit);
|
||||
IPage<Course> iPage = baseMapper.selectCourseByCourseUser(courseUserPage, userId);
|
||||
|
||||
List<Course> courses = iPage.getRecords();
|
||||
if (courses != null && courses.size() > 0) {
|
||||
for (Course course : courses) {
|
||||
Orders orders = ordersService.selectOrdersByCourseIdAndUserId(userId, course.getCourseId());
|
||||
if(orders!=null){
|
||||
course.setOrders(orders);
|
||||
}
|
||||
course.setCourseClassification(courseClassificationDao.selectById(course.getClassifyId()));
|
||||
}
|
||||
}
|
||||
return Result.success().put("data", new PageUtils(iPage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectLatelyCourse(Integer page, Integer limit, Long userId) {
|
||||
Page<Course> pages = new Page<>(page, limit);
|
||||
IPage<Course> iPage = baseMapper.selectLatelyCourse(pages, userId);
|
||||
List<Course> courses = iPage.getRecords();
|
||||
if (courses != null && courses.size() > 0) {
|
||||
for (Course course : courses) {
|
||||
Orders orders = ordersService.selectOrdersByCourseIdAndUserId(userId, course.getCourseId());
|
||||
if(orders!=null){
|
||||
course.setOrders(orders);
|
||||
}
|
||||
course.setCourseClassification(courseClassificationDao.selectById(course.getClassifyId()));
|
||||
}
|
||||
}
|
||||
return Result.success().put("data", new PageUtils(iPage));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result insertCourseUser(CourseUser courseUser) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
courseUser.setCreateTime(df.format(new Date()));
|
||||
baseMapper.insert(courseUser);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
46
src/main/java/com/sqx/modules/course/vo/CourseDetailsIn.java
Normal file
46
src/main/java/com/sqx/modules/course/vo/CourseDetailsIn.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.sqx.modules.course.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
//导入集模板
|
||||
@Data
|
||||
public class CourseDetailsIn implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@Excel(name = "名称", orderNum = "1")
|
||||
private String courseDetailsName;
|
||||
|
||||
@Excel(name = "封面图", orderNum = "2")
|
||||
private String titleImg;
|
||||
|
||||
@Excel(name = "视频地址", orderNum = "3")
|
||||
private String videoUrl;
|
||||
|
||||
@Excel(name = "介绍", orderNum = "4")
|
||||
private String content;
|
||||
|
||||
@Excel(name = "点赞数", orderNum = "5")
|
||||
private Integer goodNum;
|
||||
|
||||
@Excel(name = "价格", orderNum = "6")
|
||||
private BigDecimal price;
|
||||
|
||||
@Excel(name = "是否收费", orderNum = "7", replace = {"否_2", "是_1"})
|
||||
private Integer isPrice;
|
||||
|
||||
@Excel(name = "是否是推荐", orderNum = "8", replace = {"否_2", "是_1", "否_null"})
|
||||
private Integer good;
|
||||
|
||||
@Excel(name = "语种类型", orderNum = "9")
|
||||
private String languageType;
|
||||
|
||||
@Excel(name = "排序", orderNum = "15")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
53
src/main/java/com/sqx/modules/course/vo/CourseIn.java
Normal file
53
src/main/java/com/sqx/modules/course/vo/CourseIn.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.sqx.modules.course.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
//导入集模板
|
||||
@Data
|
||||
public class CourseIn implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "标题", orderNum = "1")
|
||||
private String title;
|
||||
|
||||
@Excel(name = "短剧介绍", orderNum = "3")
|
||||
private String details;
|
||||
|
||||
@Excel(name = "封面图", orderNum = "4")
|
||||
private String titleImg;
|
||||
|
||||
@Excel(name = "是否收费", orderNum = "5", replace = {"免费_2", "收费_1"})
|
||||
private Integer isPrice;
|
||||
|
||||
@Excel(name = "短剧标签", orderNum = "6")
|
||||
private String courseLabel;
|
||||
|
||||
@Excel(name = "价格", orderNum = "8")
|
||||
private BigDecimal price;
|
||||
|
||||
@Excel(name = "购买次数", orderNum = "9")
|
||||
private Integer payNum;
|
||||
|
||||
@Excel(name = "播放量", orderNum = "10")
|
||||
private Integer viewCounts;
|
||||
|
||||
@Excel(name = "是否是推荐", orderNum = "11", replace = {"否_0", "是_1"})
|
||||
private Integer is_recommend;
|
||||
|
||||
@Excel(name = "上下架", orderNum = "12", replace = {"上架_1", "下架_2"})
|
||||
private Integer status;
|
||||
|
||||
@Excel(name = "是否完结", orderNum = "13", replace = {"否_0", "是_1"})
|
||||
private Integer over;
|
||||
|
||||
@Excel(name = "状态", orderNum = "14", replace = {"使用中_0", "已删除_1"})
|
||||
private Integer isDelete;
|
||||
|
||||
@Excel(name = "排序", orderNum = "15")
|
||||
private Integer sort;
|
||||
}
|
||||
Reference in New Issue
Block a user