|
|
@@ -2,6 +2,7 @@ package com.fs.course.controller;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
@@ -12,13 +13,12 @@ import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
|
+import com.fs.course.domain.FsDepVideoShow;
|
|
|
import com.fs.course.domain.FsUserCourse;
|
|
|
import com.fs.course.domain.FsUserCourseVideo;
|
|
|
+import com.fs.course.mapper.FsDepVideoShowMapper;
|
|
|
import com.fs.course.mapper.FsUserCourseVideoMapper;
|
|
|
-import com.fs.course.param.BatchEditCoverParam;
|
|
|
-import com.fs.course.param.BatchRedUpdate;
|
|
|
-import com.fs.course.param.BatchVideoSvae;
|
|
|
-import com.fs.course.param.CourseVideoUpdates;
|
|
|
+import com.fs.course.param.*;
|
|
|
import com.fs.course.service.IFsUserCourseService;
|
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
|
import com.fs.course.vo.FsUserCourseVideoChooseVO;
|
|
|
@@ -29,6 +29,7 @@ import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -59,7 +60,10 @@ public class FsUserCourseVideoController extends BaseController
|
|
|
|
|
|
@Autowired
|
|
|
private ISysConfigService configService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private FsDepVideoShowMapper fsDepVideoShowMapper;
|
|
|
+ @Value("${cloud_host.company_name}")
|
|
|
+ private String companyName;
|
|
|
/**
|
|
|
* 查询课堂视频列表
|
|
|
*/
|
|
|
@@ -138,17 +142,56 @@ public class FsUserCourseVideoController extends BaseController
|
|
|
// 设置项目ID
|
|
|
FsUserCourse fsUserCourse = fsUserCourseService.selectFsUserCourseByCourseId(fsUserCourseVideo.getCourseId());
|
|
|
fsUserCourseVideo.setProjectId(fsUserCourse.getProject());
|
|
|
- return toAjax(fsUserCourseVideoService.insertFsUserCourseVideo(fsUserCourseVideo));
|
|
|
+ int result = fsUserCourseVideoService.insertFsUserCourseVideo(fsUserCourseVideo);
|
|
|
+ if ("北京卓美".equals(companyName) && result > 0 && fsUserCourseVideo.getShowProduct() != null) {
|
|
|
+ // 先检查是否存在相同记录
|
|
|
+ QueryWrapper<FsDepVideoShow> queryWrapper = new QueryWrapper<>();
|
|
|
+ Long videoId = fsUserCourseVideo.getVideoId();
|
|
|
+ queryWrapper.eq("video_id", videoId);
|
|
|
+ FsDepVideoShow fsDepVideoShow = fsDepVideoShowMapper.selectOne(queryWrapper);
|
|
|
+ if (fsDepVideoShow != null) {
|
|
|
+ // 更新现有记录
|
|
|
+ fsDepVideoShow.setIsShow(fsUserCourseVideo.getShowProduct().toString());
|
|
|
+ fsDepVideoShowMapper.updateByVideoId(fsDepVideoShow);
|
|
|
+ } else {
|
|
|
+ // 插入新记录
|
|
|
+ fsDepVideoShow = new FsDepVideoShow();
|
|
|
+ fsDepVideoShow.setVideoId(videoId);
|
|
|
+ fsDepVideoShow.setIsShow(fsUserCourseVideo.getShowProduct().toString());
|
|
|
+ fsDepVideoShow.setDepId(loginUser.getDeptId());
|
|
|
+ fsDepVideoShowMapper.insertFsDepVideoShowByVideoId(fsDepVideoShow);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return toAjax(result);
|
|
|
}
|
|
|
-
|
|
|
/**
|
|
|
* 修改课堂视频
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('course:userCourseVideo:edit')")
|
|
|
@Log(title = "课堂视频", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@RequestBody FsUserCourseVideo fsUserCourseVideo)
|
|
|
- {
|
|
|
+ public AjaxResult edit(@RequestBody FsUserCourseVideo fsUserCourseVideo) {
|
|
|
+ if ("北京卓美".equals(companyName)) {
|
|
|
+ Integer showProduct = fsUserCourseVideo.getShowProduct();
|
|
|
+ if (showProduct != null) {
|
|
|
+ // 先检查是否存在相同记录
|
|
|
+ QueryWrapper<FsDepVideoShow> queryWrapper = new QueryWrapper<>();
|
|
|
+ Long videoId = fsUserCourseVideo.getVideoId();
|
|
|
+ queryWrapper.eq("video_id", videoId);
|
|
|
+ FsDepVideoShow fsDepVideoShow = fsDepVideoShowMapper.selectOne(queryWrapper);
|
|
|
+ if (fsDepVideoShow != null) {
|
|
|
+ // 更新现有记录
|
|
|
+ fsDepVideoShow.setIsShow(showProduct.toString());
|
|
|
+ fsDepVideoShowMapper.updateByVideoId(fsDepVideoShow);
|
|
|
+ } else {
|
|
|
+ // 插入新记录
|
|
|
+ fsDepVideoShow = new FsDepVideoShow();
|
|
|
+ fsDepVideoShow.setIsShow(showProduct.toString());
|
|
|
+ fsDepVideoShow.setVideoId(videoId);
|
|
|
+ fsDepVideoShowMapper.insertFsDepVideoShowByVideoId(fsDepVideoShow);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return toAjax(fsUserCourseVideoService.updateFsUserCourseVideo(fsUserCourseVideo));
|
|
|
}
|
|
|
|