|
@@ -1,10 +1,10 @@
|
|
package com.yonge.cooleshow.website.controller;
|
|
package com.yonge.cooleshow.website.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
-import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonGroupSearch;
|
|
import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonGroupSearch;
|
|
import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
|
|
import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
|
|
|
|
+import com.yonge.cooleshow.biz.dal.service.SysUserService;
|
|
import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupService;
|
|
import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupService;
|
|
import com.yonge.cooleshow.biz.dal.valid.AddGroup;
|
|
import com.yonge.cooleshow.biz.dal.valid.AddGroup;
|
|
import com.yonge.cooleshow.biz.dal.valid.UpdateGroup;
|
|
import com.yonge.cooleshow.biz.dal.valid.UpdateGroup;
|
|
@@ -19,16 +19,10 @@ import com.yonge.toolset.mybatis.support.PageUtil;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
import javax.validation.constraints.NotNull;
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -41,53 +35,28 @@ import javax.validation.constraints.NotNull;
|
|
@RequestMapping("${app-config.url.website:}/videoLessonGroup")
|
|
@RequestMapping("${app-config.url.website:}/videoLessonGroup")
|
|
@Api(tags = "视频课组")
|
|
@Api(tags = "视频课组")
|
|
public class VideoGroupController extends BaseController {
|
|
public class VideoGroupController extends BaseController {
|
|
- @Autowired
|
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
|
+ @Resource
|
|
private VideoLessonGroupService videoLessonGroupService;
|
|
private VideoLessonGroupService videoLessonGroupService;
|
|
|
|
|
|
- /**
|
|
|
|
- * @Description: 查询视频课组
|
|
|
|
- * @Author: cy
|
|
|
|
- * @Date: 2022/3/31
|
|
|
|
- */
|
|
|
|
@ApiOperation(value = "查询视频课组")
|
|
@ApiOperation(value = "查询视频课组")
|
|
@PostMapping(value = "/page")
|
|
@PostMapping(value = "/page")
|
|
public HttpResponseResult<PageInfo<VideoLessonGroupVo>> page(@RequestBody VideoLessonGroupSearch query) {
|
|
public HttpResponseResult<PageInfo<VideoLessonGroupVo>> page(@RequestBody VideoLessonGroupSearch query) {
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- query.setTeacherId(sysUser.getId());
|
|
|
|
|
|
+ query.setTeacherId(sysUserService.getUserId());
|
|
IPage<VideoLessonGroupVo> pages = videoLessonGroupService.selectPage(PageUtil.getPage(query), query);
|
|
IPage<VideoLessonGroupVo> pages = videoLessonGroupService.selectPage(PageUtil.getPage(query), query);
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @Description: 新增视频课组
|
|
|
|
- * @Author: cy
|
|
|
|
- * @Date: 2022/3/31
|
|
|
|
- */
|
|
|
|
@ApiOperation(value = "新增视频课组", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
@ApiOperation(value = "新增视频课组", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
@PostMapping(value = "/create", consumes = "application/json", produces = "application/json")
|
|
@PostMapping(value = "/create", consumes = "application/json", produces = "application/json")
|
|
public HttpResponseResult<Object> create(@Validated @RequestBody VideoLessonGroup videoLessonGroup) {
|
|
public HttpResponseResult<Object> create(@Validated @RequestBody VideoLessonGroup videoLessonGroup) {
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
- if (sysUser == null) {
|
|
|
|
- return failed("用户信息获取失败");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- videoLessonGroup.setTeacherId(sysUser.getId());
|
|
|
|
|
|
+ videoLessonGroup.setTeacherId(sysUserService.getUserId());
|
|
videoLessonGroupService.save(videoLessonGroup);
|
|
videoLessonGroupService.save(videoLessonGroup);
|
|
return succeed();
|
|
return succeed();
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @Description: 修改视频课组
|
|
|
|
- * @Author: cy
|
|
|
|
- * @Date: 2022/3/31
|
|
|
|
- */
|
|
|
|
@ApiOperation(value = "修改视频课组", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
@ApiOperation(value = "修改视频课组", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
@PostMapping(value = "/updateGroup", consumes = "application/json", produces = "application/json")
|
|
@PostMapping(value = "/updateGroup", consumes = "application/json", produces = "application/json")
|
|
public HttpResponseResult<Object> update(@Validated @RequestBody VideoLessonGroupUpVo lessonGroupUpVo) {
|
|
public HttpResponseResult<Object> update(@Validated @RequestBody VideoLessonGroupUpVo lessonGroupUpVo) {
|
|
@@ -95,11 +64,6 @@ public class VideoGroupController extends BaseController {
|
|
return succeed();
|
|
return succeed();
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @Description: 删除视频课组
|
|
|
|
- * @Author: cy
|
|
|
|
- * @Date: 2022/3/31
|
|
|
|
- */
|
|
|
|
@ApiOperation(value = "删除视频课组", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
@ApiOperation(value = "删除视频课组", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
@PostMapping("/delete/{id}")
|
|
@PostMapping("/delete/{id}")
|
|
public Object delete(@PathVariable Long id) {
|
|
public Object delete(@PathVariable Long id) {
|
|
@@ -107,19 +71,10 @@ public class VideoGroupController extends BaseController {
|
|
return succeed();
|
|
return succeed();
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @Description: 新增视频课组&视频课
|
|
|
|
- * @Author: cy
|
|
|
|
- * @Date: 2022/4/1
|
|
|
|
- */
|
|
|
|
@ApiOperation(value = "新增视频课组&视频课", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
@ApiOperation(value = "新增视频课组&视频课", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
@PostMapping(value = "/add", consumes = "application/json", produces = "application/json")
|
|
@PostMapping(value = "/add", consumes = "application/json", produces = "application/json")
|
|
public HttpResponseResult<Object> add(@Validated(AddGroup.class) @RequestBody VideoLessonVo lessonVo) {
|
|
public HttpResponseResult<Object> add(@Validated(AddGroup.class) @RequestBody VideoLessonVo lessonVo) {
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
-
|
|
|
|
- if (sysUser == null||sysUser.getId()==null) {
|
|
|
|
- return failed("用户信息获取失败");
|
|
|
|
- }
|
|
|
|
|
|
+ SysUser sysUser = sysUserService.getUser();
|
|
lessonVo.setUserBy(sysUser.getId());
|
|
lessonVo.setUserBy(sysUser.getId());
|
|
if ( CollectionUtils.isEmpty(lessonVo.getLessonList())) {
|
|
if ( CollectionUtils.isEmpty(lessonVo.getLessonList())) {
|
|
return failed("课程不能为空");
|
|
return failed("课程不能为空");
|
|
@@ -128,30 +83,16 @@ public class VideoGroupController extends BaseController {
|
|
return succeed();
|
|
return succeed();
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @Description: 根据组id查询视频课&视频课组
|
|
|
|
- * @Author: cy
|
|
|
|
- * @Date: 2022/4/2
|
|
|
|
- */
|
|
|
|
@ApiOperation(value = "根据组id查询视频课&视频课组")
|
|
@ApiOperation(value = "根据组id查询视频课&视频课组")
|
|
@GetMapping(value="/selectVideoLesson")
|
|
@GetMapping(value="/selectVideoLesson")
|
|
public HttpResponseResult<VideoLessonStudentVo> selectVideoLesson(@NotNull(message = "视频组id不能为空") Long groupId) {
|
|
public HttpResponseResult<VideoLessonStudentVo> selectVideoLesson(@NotNull(message = "视频组id不能为空") Long groupId) {
|
|
return succeed(videoLessonGroupService.selectVideoLesson(groupId));
|
|
return succeed(videoLessonGroupService.selectVideoLesson(groupId));
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @Description: 修改视频课组&视频课
|
|
|
|
- * @Author: cy
|
|
|
|
- * @Date: 2022/4/7
|
|
|
|
- */
|
|
|
|
@ApiOperation(value = "修改视频课组&视频课", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
@ApiOperation(value = "修改视频课组&视频课", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
@PostMapping(value = "/update", consumes = "application/json", produces = "application/json")
|
|
@PostMapping(value = "/update", consumes = "application/json", produces = "application/json")
|
|
public HttpResponseResult<Object> update(@Validated(UpdateGroup.class) @RequestBody VideoLessonVo lessonVo) {
|
|
public HttpResponseResult<Object> update(@Validated(UpdateGroup.class) @RequestBody VideoLessonVo lessonVo) {
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
-
|
|
|
|
- if (sysUser == null||sysUser.getId()==null) {
|
|
|
|
- return failed("用户信息获取失败");
|
|
|
|
- }
|
|
|
|
|
|
+ SysUser sysUser = sysUserService.getUser();
|
|
lessonVo.setUserBy(sysUser.getId());
|
|
lessonVo.setUserBy(sysUser.getId());
|
|
if ( CollectionUtils.isEmpty(lessonVo.getLessonList())) {
|
|
if ( CollectionUtils.isEmpty(lessonVo.getLessonList())) {
|
|
return failed("课程不能为空");
|
|
return failed("课程不能为空");
|