|
@@ -2,13 +2,17 @@ package com.fs.course.controller;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.domain.model.LoginUser;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
+import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.vo.FsUserCourseListPVO;
|
|
|
import com.fs.framework.web.service.TokenService;
|
|
|
import com.fs.his.utils.RedisCacheUtil;
|
|
|
import com.fs.his.vo.OptionsVO;
|
|
|
+import com.fs.system.service.ISysConfigService;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -44,6 +48,12 @@ public class FsUserCourseController extends BaseController
|
|
|
@Autowired
|
|
|
private RedisCacheUtil redisCacheUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TokenService tokenService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysConfigService configService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询课程列表
|
|
|
*/
|
|
@@ -52,6 +62,13 @@ public class FsUserCourseController extends BaseController
|
|
|
public TableDataInfo list(FsUserCourse fsUserCourse)
|
|
|
{
|
|
|
startPage();
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long userId = loginUser.getUser().getUserId();
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
|
|
|
+ fsUserCourse.setUserId(userId);
|
|
|
+ }
|
|
|
List<FsUserCourseListPVO> list = fsUserCourseService.selectFsUserCourseListPVO(fsUserCourse);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
@@ -64,6 +81,13 @@ public class FsUserCourseController extends BaseController
|
|
|
public TableDataInfo publicList(FsUserCourse fsUserCourse)
|
|
|
{
|
|
|
startPage();
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long userId = loginUser.getUser().getUserId();
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
|
|
|
+ fsUserCourse.setUserId(userId);
|
|
|
+ }
|
|
|
List<FsUserCourseListPVO> list = fsUserCourseService.selectFsUserCourseListPVO(fsUserCourse);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
@@ -76,6 +100,13 @@ public class FsUserCourseController extends BaseController
|
|
|
@GetMapping("/export")
|
|
|
public AjaxResult export(FsUserCourse fsUserCourse)
|
|
|
{
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long userId = loginUser.getUser().getUserId();
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
|
|
|
+ fsUserCourse.setUserId(userId);
|
|
|
+ }
|
|
|
List<FsUserCourse> list = fsUserCourseService.selectFsUserCourseList(fsUserCourse);
|
|
|
ExcelUtil<FsUserCourse> util = new ExcelUtil<FsUserCourse>(FsUserCourse.class);
|
|
|
return util.exportExcel(list, "课程数据");
|
|
@@ -89,6 +120,13 @@ public class FsUserCourseController extends BaseController
|
|
|
@GetMapping("/publicExport")
|
|
|
public AjaxResult publicExport(FsUserCourse fsUserCourse)
|
|
|
{
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long userId = loginUser.getUser().getUserId();
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
|
|
|
+ fsUserCourse.setUserId(userId);
|
|
|
+ }
|
|
|
List<FsUserCourse> list = fsUserCourseService.selectFsUserCourseList(fsUserCourse);
|
|
|
ExcelUtil<FsUserCourse> util = new ExcelUtil<FsUserCourse>(FsUserCourse.class);
|
|
|
return util.exportExcel(list, "课程数据");
|
|
@@ -122,6 +160,13 @@ public class FsUserCourseController extends BaseController
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody FsUserCourse fsUserCourse)
|
|
|
{
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long userId = loginUser.getUser().getUserId();
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
|
|
|
+ fsUserCourse.setUserId(userId);
|
|
|
+ }
|
|
|
fsUserCourseService.insertFsUserCourse(fsUserCourse);
|
|
|
redisCacheUtil.delRedisKey("getCourseList");
|
|
|
|
|
@@ -136,6 +181,13 @@ public class FsUserCourseController extends BaseController
|
|
|
@PostMapping("/public")
|
|
|
public AjaxResult publicAdd(@RequestBody FsUserCourse fsUserCourse)
|
|
|
{
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long userId = loginUser.getUser().getUserId();
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
|
|
|
+ fsUserCourse.setUserId(userId);
|
|
|
+ }
|
|
|
fsUserCourseService.insertFsUserCourse(fsUserCourse);
|
|
|
redisCacheUtil.delRedisKey("getCourseList");
|
|
|
|