From 39518349b9b4b2e2fd0bf153623c8d88301c539e Mon Sep 17 00:00:00 2001
From: lisy <linlangsur163@163.com>
Date: 星期四, 03 八月 2023 21:35:53 +0800
Subject: [PATCH] 修复了开始上课的冗余勋章列表查询bug
---
cloud-server-activity/src/main/java/com/dsh/activity/controller/BenefitVideoController.java | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 107 insertions(+), 4 deletions(-)
diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/BenefitVideoController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/BenefitVideoController.java
index 971a10f..82ed7d6 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/BenefitVideoController.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/BenefitVideoController.java
@@ -3,12 +3,19 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.activity.entity.BenefitsVideos;
+import com.dsh.activity.model.BenefitsVideoClassificationListVo;
+import com.dsh.activity.model.BenefitsVideosInfoVo;
+import com.dsh.activity.model.BenefitsVideosListVo;
import com.dsh.activity.service.BenefitsVideosService;
+import com.dsh.activity.util.ResultUtil;
+import com.dsh.activity.util.TokenUtil;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
-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 java.util.List;
@RestController
@RequestMapping("")
@@ -18,6 +25,10 @@
@Autowired
private BenefitsVideosService bfvService;
+ @Autowired
+ private TokenUtil tokenUtil;
+
+
@PostMapping("base/benefitVideo/getList")
@@ -26,4 +37,96 @@
}
+
+
+ @ResponseBody
+ @PostMapping("/api/benefitsVideo/queryClassificationBenefitsVideosList")
+ @ApiOperation(value = "获取视频列表", tags = {"APP-线上课得积分", "APP-看视频得奖励"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "位置(1=线上课得积分,2=看视频得奖励)", name = "position", dataType = "int", required = true),
+ @ApiImplicitParam(value = "搜索内容", name = "search", dataType = "string", required = false),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResultUtil<List<BenefitsVideoClassificationListVo>> queryClassificationBenefitsVideosList(Integer position, String search){
+ try {
+ Integer uid = tokenUtil.getUserIdFormRedis();
+ if(null == uid){
+ return ResultUtil.tokenErr();
+ }
+ List<BenefitsVideoClassificationListVo> listVos = bfvService.queryClassificationBenefitsVideosList(uid, position, search);
+ return ResultUtil.success(listVos);
+ }catch (Exception e){
+ e.printStackTrace();
+ return ResultUtil.runErr();
+ }
+ }
+
+
+ @ResponseBody
+ @PostMapping("/api/benefitsVideo/queryBenefitsVideosList")
+ @ApiOperation(value = "获取视频列表", tags = {"APP-线上课得积分", "APP-看视频得奖励"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "视频分类id", name = "classificationId", dataType = "int", required = true),
+ @ApiImplicitParam(value = "页码,首页1", name = "pageSize", dataType = "int", required = true),
+ @ApiImplicitParam(value = "页条数", name = "pageNo", dataType = "int", required = true),
+ @ApiImplicitParam(value = "搜索内容", name = "search", dataType = "string", required = false),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResultUtil<List<BenefitsVideosListVo>> queryBenefitsVideosList(Integer classificationId, String search, Integer pageSize, Integer pageNo){
+ try {
+ Integer uid = tokenUtil.getUserIdFormRedis();
+ if(null == uid){
+ return ResultUtil.tokenErr();
+ }
+ List<BenefitsVideosListVo> benefitsVideosListVos = bfvService.queryBenefitsVideosList(uid, classificationId, search, pageSize, pageNo);
+ return ResultUtil.success(benefitsVideosListVos);
+ }catch (Exception e){
+ e.printStackTrace();
+ return ResultUtil.runErr();
+ }
+ }
+
+
+
+ @ResponseBody
+ @PostMapping("/api/benefitsVideo/queryBenefitsVideosInfo")
+ @ApiOperation(value = "获取视频详情", tags = {"APP-线上课得积分", "APP-看视频得奖励"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "视频id", name = "id", dataType = "int", required = true),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResultUtil<BenefitsVideosInfoVo> queryBenefitsVideosInfo(Integer id){
+ try {
+ Integer uid = tokenUtil.getUserIdFormRedis();
+ if(null == uid){
+ return ResultUtil.tokenErr();
+ }
+ BenefitsVideosInfoVo benefitsVideosInfoVo = bfvService.queryBenefitsVideosInfo(uid, id);
+ return ResultUtil.success(benefitsVideosInfoVo);
+ }catch (Exception e){
+ e.printStackTrace();
+ return ResultUtil.runErr();
+ }
+ }
+
+ @ResponseBody
+ @PostMapping("/api/benefitsVideo/receiveAward")
+ @ApiOperation(value = "观看视频结束后领取奖励", tags = {"APP-线上课得积分", "APP-看视频得奖励"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "视频id", name = "id", dataType = "int", required = true),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResultUtil receiveAward(Integer id) {
+ try {
+ Integer uid = tokenUtil.getUserIdFormRedis();
+ if(null == uid){
+ return ResultUtil.tokenErr();
+ }
+ bfvService.receiveAward(uid, id);
+ return ResultUtil.success();
+ }catch (Exception e){
+ e.printStackTrace();
+ return ResultUtil.runErr();
+ }
+ }
}
--
Gitblit v1.7.1