|
|
@@ -1,15 +1,28 @@
|
|
|
package com.yonge.cooleshow.admin.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.yonge.cooleshow.admin.io.request.coupon.CouponIssueVo;
|
|
|
+import com.yonge.cooleshow.admin.io.request.course.CourseRelationVo;
|
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
+import com.yonge.cooleshow.biz.dal.dto.AdjustModel;
|
|
|
+import com.yonge.cooleshow.biz.dal.dto.VideoLessonGroupDetailDto;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.VideoGroupSearch;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonSearch;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.course.CourseTypeEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.queryInfo.CourseRelationQueryInfo;
|
|
|
import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupDetailService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupService;
|
|
|
+import com.yonge.cooleshow.biz.dal.valid.UpdateGroup;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.course.CourseRelationWrapper;
|
|
|
+import com.yonge.cooleshow.common.enums.YesOrNoEnum;
|
|
|
import com.yonge.toolset.base.util.StringUtil;
|
|
|
import com.yonge.toolset.mybatis.support.PageUtil;
|
|
|
import com.yonge.cooleshow.biz.dal.valid.AddGroup;
|
|
|
@@ -22,16 +35,21 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.validation.Valid;
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import static com.yonge.cooleshow.common.entity.HttpResponseResult.succeed;
|
|
|
+
|
|
|
/**
|
|
|
* @Author: cy
|
|
|
* @Date: 2022/4/2
|
|
|
@@ -115,6 +133,18 @@ public class VideoLessonController extends BaseController {
|
|
|
return succeed(PageUtil.pageInfo(lessonGroupService.queryGroupHistoryList(PageUtil.getPage(search), search)));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "老师详情-视频课详情-推荐/赠送内容", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
|
+ @PostMapping(value = "/queryRelationMusicAlbum", consumes = "application/json", produces = "application/json")
|
|
|
+ public HttpResponseResult<PageInfo<CourseRelationWrapper.MusicAlbumInfo>> queryRelationMusicAlbum(@RequestBody CourseRelationVo.CourseRelationQuery query) {
|
|
|
+
|
|
|
+ query.setCourseType(CourseTypeEnum.VIDEO);
|
|
|
+ IPage<CourseRelationWrapper.MusicAlbumInfo> iPage = lessonGroupService
|
|
|
+ .queryRelationMusicAlbum(PageUtil.getPage(query), CourseRelationQueryInfo.from(query.jsonString()));
|
|
|
+ return succeed(PageUtil.pageInfo(iPage));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @Description: 审核-根据视频课组id查视频课详情
|
|
|
* @Author: cy
|
|
|
@@ -175,9 +205,15 @@ public class VideoLessonController extends BaseController {
|
|
|
if (shelvesVo.getShelvesFlag() == 0 && StringUtil.isEmpty(shelvesVo.getShelvesReason())) {
|
|
|
return failed( "下架必须要有下架原因");
|
|
|
}
|
|
|
+ VideoLessonGroup videoLessonGroup = lessonGroupService.getById(shelvesVo.getId());
|
|
|
+ if (videoLessonGroup.getAuditStatus() ==null || !videoLessonGroup.getAuditStatus().equals(AuthStatusEnum.PASS)) {
|
|
|
+ return failed("审核通过才能上架");
|
|
|
+ }
|
|
|
|
|
|
shelvesVo.setShelvesId(user.getId());
|
|
|
- shelvesVo.setShelvesTime(new Date());
|
|
|
+ if (shelvesVo.getShelvesFlag() == 1) {
|
|
|
+ shelvesVo.setShelvesTime(new Date());
|
|
|
+ }
|
|
|
shelvesVo.setClientType(ClientEnum.SYSTEM);
|
|
|
lessonGroupService.updateShelves(shelvesVo);
|
|
|
return succeed();
|
|
|
@@ -188,4 +224,123 @@ public class VideoLessonController extends BaseController {
|
|
|
public HttpResponseResult<CountVideoGroupVo> countVideoGroup() {
|
|
|
return succeed(lessonGroupService.countVideoGroup());
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 新增视频课组&视频课
|
|
|
+ * @Author: cy
|
|
|
+ * @Date: 2022/4/1
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "新增视频课组&视频课", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
|
+ @PostMapping(value = "/add", consumes = "application/json", produces = "application/json")
|
|
|
+ public HttpResponseResult<Object> add( @RequestBody VideoLessonVo lessonVo) {
|
|
|
+
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
+ if (user == null || null == user.getId()) {
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ }
|
|
|
+ lessonVo.setUserBy(user.getId());
|
|
|
+ if (lessonVo.getLessonGroup().getTeacherId() == null) {
|
|
|
+ return failed("请设置所属老师");
|
|
|
+ }
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserById(lessonVo.getLessonGroup().getTeacherId());
|
|
|
+
|
|
|
+ if (sysUser == null || sysUser.getId() == null) {
|
|
|
+ return failed("用户信息获取失败");
|
|
|
+ }
|
|
|
+ if (lessonVo.getLessonGroup().getDraftFlag().equals(YesOrNoEnum.NO) && CollectionUtils.isEmpty(lessonVo.getLessonList())) {
|
|
|
+ return failed("课程不能为空");
|
|
|
+ }
|
|
|
+ Long add = lessonGroupService.add(lessonVo, sysUser);
|
|
|
+ return succeed(add);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 修改视频课组&视频课
|
|
|
+ * @Author: cy
|
|
|
+ * @Date: 2022/4/7
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "修改视频课组&视频课", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
|
+ @PostMapping(value = "/update", consumes = "application/json", produces = "application/json")
|
|
|
+ public HttpResponseResult<Object> update(@RequestBody VideoLessonVo lessonVo) {
|
|
|
+
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
+ if (user == null || null == user.getId()) {
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ }
|
|
|
+ lessonVo.setUserBy(user.getId());
|
|
|
+
|
|
|
+ if (lessonVo.getLessonGroup().getTeacherId() == null) {
|
|
|
+ return failed("请设置所属老师");
|
|
|
+ }
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserById(lessonVo.getLessonGroup().getTeacherId());
|
|
|
+
|
|
|
+ if (sysUser == null || sysUser.getId() == null) {
|
|
|
+ return failed("用户信息获取失败");
|
|
|
+ }
|
|
|
+ if (lessonVo.getLessonGroup().getDraftFlag().equals(YesOrNoEnum.NO) && CollectionUtils.isEmpty(lessonVo.getLessonList())) {
|
|
|
+ return failed("课程不能为空");
|
|
|
+ }
|
|
|
+ return succeed(lessonGroupService.update(lessonVo, sysUser));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 置顶
|
|
|
+ */
|
|
|
+ @PostMapping("/top/{id}")
|
|
|
+ @ApiOperation(value = "置顶", notes = "传入id")
|
|
|
+ public HttpResponseResult<Boolean> top(@ApiParam(value = "视频课编号", required = true) @PathVariable Long id) {
|
|
|
+ if (StringUtil.isEmpty(id)) {
|
|
|
+ return failed("参数不能为空");
|
|
|
+ }
|
|
|
+ return status(lessonGroupService.top(id));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 根据组id查询视频课&视频课组
|
|
|
+ * @Author: cy
|
|
|
+ * @Date: 2022/4/2
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "根据组id查询视频课&视频课组")
|
|
|
+ @GetMapping(value = "/selectVideoLesson")
|
|
|
+ public HttpResponseResult<VideoLessonStudentVo> selectVideoLesson(@NotNull(message = "视频组id不能为空") Long groupId) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null || sysUser.getId() == null) {
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ }
|
|
|
+
|
|
|
+ VideoLessonStudentVo videoLessonStudentVo = lessonGroupService.selectVideoLesson(groupId);
|
|
|
+ if (videoLessonStudentVo.getLessonGroup().getTeacherId().equals(sysUser.getId())) {
|
|
|
+ videoLessonStudentVo.setMyself(true);
|
|
|
+ } else {
|
|
|
+ videoLessonStudentVo.setMyself(false);
|
|
|
+ }
|
|
|
+ if (videoLessonStudentVo.getLessonGroup() != null && sysUser.getId().equals(videoLessonStudentVo.getLessonGroup().getId())) {
|
|
|
+ videoLessonStudentVo.setAlreadyBuy(true);
|
|
|
+ } else {
|
|
|
+ videoLessonStudentVo.setAlreadyBuy(false);
|
|
|
+ }
|
|
|
+ return succeed(videoLessonStudentVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置排序值 和加精
|
|
|
+ */
|
|
|
+ @PostMapping("/adjust")
|
|
|
+ @ApiOperation(value = "视频课调整排序")
|
|
|
+ public HttpResponseResult<Boolean> adjust(@RequestBody @Valid AdjustModel model) {
|
|
|
+
|
|
|
+ VideoLessonGroup videoLessonGroup = new VideoLessonGroup();
|
|
|
+ videoLessonGroup.setId(model.getId());
|
|
|
+ videoLessonGroup.setSortNumber(model.getSort());
|
|
|
+
|
|
|
+ lessonGroupService.updateById(videoLessonGroup);
|
|
|
+
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
}
|