|
|
@@ -11,6 +11,8 @@ import com.fs.common.core.domain.model.LoginUser;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
+import com.fs.config.cloud.CloudHostProper;
|
|
|
+import com.fs.course.business.FsVideoResourceBusinessService;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.domain.FsVideoResource;
|
|
|
import com.fs.course.service.IFsVideoResourceService;
|
|
|
@@ -19,7 +21,6 @@ import com.fs.framework.web.service.TokenService;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -37,11 +38,13 @@ public class FsVideoResourceController extends BaseController {
|
|
|
|
|
|
private final IFsVideoResourceService fsVideoResourceService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private TokenService tokenService;
|
|
|
+ private final TokenService tokenService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ISysConfigService configService;
|
|
|
+ private final ISysConfigService configService;
|
|
|
+
|
|
|
+ private final CloudHostProper cloudHostProper;
|
|
|
+
|
|
|
+ private final FsVideoResourceBusinessService videoResourceBusinessService;
|
|
|
|
|
|
/**
|
|
|
* 查询视频素材库列表
|
|
|
@@ -53,8 +56,7 @@ public class FsVideoResourceController extends BaseController {
|
|
|
@RequestParam(required = false) Integer typeId,
|
|
|
@RequestParam(required = false) Integer typeSubId,
|
|
|
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
|
|
- @RequestParam(required = false, defaultValue = "10") Integer pageSize)
|
|
|
- {
|
|
|
+ @RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
params.put("resourceName", resourceName);
|
|
|
params.put("fileName", fileName);
|
|
|
@@ -63,7 +65,7 @@ public class FsVideoResourceController extends BaseController {
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
String json = configService.selectConfigByKey("course.config");
|
|
|
CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
- if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
params.put("userId", loginUser.getUser().getUserId());
|
|
|
}
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
@@ -77,8 +79,7 @@ public class FsVideoResourceController extends BaseController {
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('course:videoResource:query')")
|
|
|
@GetMapping(value = "/{id}")
|
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
- {
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
return AjaxResult.success(fsVideoResourceService.getById(id));
|
|
|
}
|
|
|
|
|
|
@@ -88,13 +89,12 @@ public class FsVideoResourceController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('course:videoResource:add')")
|
|
|
@Log(title = "视频素材库", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
- public AjaxResult add(@RequestBody FsVideoResource fsVideoResource)
|
|
|
- {
|
|
|
+ public AjaxResult add(@RequestBody FsVideoResource fsVideoResource) {
|
|
|
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()){
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
fsVideoResource.setUserId(userId);
|
|
|
}
|
|
|
fsVideoResource.setCreateTime(LocalDateTime.now());
|
|
|
@@ -108,8 +108,12 @@ public class FsVideoResourceController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('course:videoResource:edit')")
|
|
|
@Log(title = "视频素材库", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@RequestBody FsVideoResource fsVideoResource)
|
|
|
- {
|
|
|
+ public AjaxResult edit(@RequestBody FsVideoResource fsVideoResource) {
|
|
|
+ if (("今正科技".equals(cloudHostProper.getCompanyName()))) {
|
|
|
+ // 同步资源到课程
|
|
|
+ videoResourceBusinessService.edit(fsVideoResource);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
fsVideoResourceService.updateById(fsVideoResource);
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
@@ -120,8 +124,7 @@ public class FsVideoResourceController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('course:videoResource:remove')")
|
|
|
@Log(title = "视频素材库", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{ids}")
|
|
|
- public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
- {
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
Wrapper<FsVideoResource> updateWrapper = Wrappers.<FsVideoResource>lambdaUpdate()
|
|
|
.set(FsVideoResource::getIsDel, 1)
|
|
|
.in(FsVideoResource::getId, Arrays.asList(ids));
|
|
|
@@ -131,6 +134,7 @@ public class FsVideoResourceController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 批量修改视频分类
|
|
|
+ *
|
|
|
* @param typeId
|
|
|
* @param typeSubId
|
|
|
* @param ids
|
|
|
@@ -142,13 +146,13 @@ public class FsVideoResourceController extends BaseController {
|
|
|
public AjaxResult batchUpdateClass(@RequestParam("typeId") Long typeId,
|
|
|
@RequestParam("typeSubId") Long typeSubId,
|
|
|
@RequestParam("ids") String ids) {
|
|
|
- if(typeId == null || typeId <= 0){
|
|
|
+ if (typeId == null || typeId <= 0) {
|
|
|
return AjaxResult.error("请选择分类");
|
|
|
}
|
|
|
- if(typeSubId == null || typeSubId <= 0){
|
|
|
+ if (typeSubId == null || typeSubId <= 0) {
|
|
|
return AjaxResult.error("请选择子分类");
|
|
|
}
|
|
|
- if(ids == null || ids.isEmpty()){
|
|
|
+ if (ids == null || ids.isEmpty()) {
|
|
|
return AjaxResult.error("请选择要修改的分类");
|
|
|
}
|
|
|
|
|
|
@@ -178,12 +182,12 @@ public class FsVideoResourceController extends BaseController {
|
|
|
String json = configService.selectConfigByKey("course.config");
|
|
|
CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
|
- list.forEach(v ->{
|
|
|
+ list.forEach(v -> {
|
|
|
v.setCreateTime(LocalDateTime.now());
|
|
|
- if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
v.setUserId(userId);
|
|
|
}
|
|
|
- } );
|
|
|
+ });
|
|
|
fsVideoResourceService.saveBatch(list);
|
|
|
return AjaxResult.success();
|
|
|
}
|