Forráskód Böngészése

applet教学视频接口

wwl 3 éve
szülő
commit
23c9875be5

+ 54 - 0
zzjs-admin/src/main/java/com/miaxis/app/controller/teachingVideo/AppletTeachingVideoInfoController.java

@@ -0,0 +1,54 @@
+package com.miaxis.app.controller.teachingVideo;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.miaxis.common.constant.Constants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.teachingVideo.domain.TeachingVideoTypeInfo;
+import com.miaxis.teachingVideo.service.ITeachingVideoInfoService;
+import com.miaxis.teachingVideo.service.ITeachingVideoTypeInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 【教学视频】Controller
+ * @author wwl
+ * @version 1.0
+ * @date 2021/7/7 14:49
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping(Constants.STUDENT_PREFIX+"/teachingVideo/info")
+@Api(tags={"【小程序-教学视频】"})
+public class AppletTeachingVideoInfoController extends BaseController {
+
+    private final ITeachingVideoInfoService teachingVideoInfoService;
+
+    private final ITeachingVideoTypeInfoService videoTypeInfoService;
+
+
+    @GetMapping("/typeList")
+    @ApiOperation("查询教学视频一级分类列表")
+    public Response typeList(){
+        return Response.success(videoTypeInfoService.list(new QueryWrapper<TeachingVideoTypeInfo>().eq("pid",0).eq("status",0).orderByAsc("type_sort")));
+    }
+
+    /**
+     * 查询教学视频列表
+     */
+    @GetMapping("/list/{pid}")
+    @ApiOperation("查询教学视频列表")
+    public Response list(@ApiParam(name = "pid", value = "分类id", required = true)
+                             @PathVariable("pid") String pid){
+        return teachingVideoInfoService.queryTeachingVideoInfoList(pid);
+    }
+
+
+
+}

+ 0 - 5
zzjs-service/src/main/java/com/miaxis/fulu/vo/FuluCommodityInfoAppletVo.java

@@ -1,15 +1,10 @@
 package com.miaxis.fulu.vo;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.miaxis.common.core.domain.BaseBusinessEntity;
-import com.miaxis.fulu.domain.FuluCommodityInfo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  *  福禄商品对象applet返回参

+ 3 - 3
zzjs-service/src/main/java/com/miaxis/teachingVideo/dto/TeachingVideoInfoDto.java

@@ -1,12 +1,12 @@
 package com.miaxis.teachingVideo.dto;
 
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.miaxis.common.core.domain.BaseBusinessEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.io.Serializable;
+
 /**
  * 教学视频对象入参
  * @author wwl
@@ -15,7 +15,7 @@ import lombok.Data;
  */
 @Data
 @ApiModel(value = "TeachingVideoInfoDto", description = "教学视频对象入参")
-public class TeachingVideoInfoDto extends BaseBusinessEntity {
+public class TeachingVideoInfoDto implements Serializable {
 
     @ApiModelProperty(value = "主键")
     private Long id;

+ 9 - 0
zzjs-service/src/main/java/com/miaxis/teachingVideo/mapper/TeachingVideoInfoMapper.java

@@ -2,6 +2,8 @@ package com.miaxis.teachingVideo.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.miaxis.teachingVideo.domain.TeachingVideoInfo;
+import com.miaxis.teachingVideo.domain.TeachingVideoTypeInfo;
+import com.miaxis.teachingVideo.vo.TeachingVideoInfoAppletVo;
 import com.miaxis.teachingVideo.vo.TeachingVideoInfoVo;
 
 import java.util.List;
@@ -28,4 +30,11 @@ public interface TeachingVideoInfoMapper extends BaseMapper<TeachingVideoInfo> {
      * @return
      */
     TeachingVideoInfoVo getTeachingVideoDetailsById(Long id);
+
+    /**
+     * 根据视频分类查询教学视频列表
+     * @param pid
+     * @return
+     */
+    List<TeachingVideoInfoAppletVo> getTeachingVideoDetailsByTypeIds(String pid);
 }

+ 7 - 0
zzjs-service/src/main/java/com/miaxis/teachingVideo/service/ITeachingVideoInfoService.java

@@ -67,4 +67,11 @@ public interface ITeachingVideoInfoService extends IService<TeachingVideoInfo> {
      */
     Response removeOffShelfByIds(Long[] ids);
 
+    /**
+     * applet
+     * 查询教学视频列表
+     * @param pid
+     * @return
+     */
+    Response queryTeachingVideoInfoList(String pid);
 }

+ 39 - 0
zzjs-service/src/main/java/com/miaxis/teachingVideo/service/impl/TeachingVideoInfoServiceImpl.java

@@ -2,6 +2,7 @@ package com.miaxis.teachingVideo.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.miaxis.common.core.domain.Response;
@@ -11,9 +12,13 @@ import com.miaxis.common.utils.bean.BeanUtils;
 import com.miaxis.file.domain.FileInfo;
 import com.miaxis.file.service.IFileInfoService;
 import com.miaxis.teachingVideo.domain.TeachingVideoInfo;
+import com.miaxis.teachingVideo.domain.TeachingVideoTypeInfo;
 import com.miaxis.teachingVideo.dto.TeachingVideoInfoDto;
 import com.miaxis.teachingVideo.mapper.TeachingVideoInfoMapper;
 import com.miaxis.teachingVideo.service.ITeachingVideoInfoService;
+import com.miaxis.teachingVideo.service.ITeachingVideoTypeInfoService;
+import com.miaxis.teachingVideo.vo.AppletTeachingVideoVo;
+import com.miaxis.teachingVideo.vo.TeachingVideoInfoAppletVo;
 import com.miaxis.teachingVideo.vo.TeachingVideoInfoVo;
 import com.tencentcloudapi.vod.v20180717.VodClient;
 import com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosRequest;
@@ -23,7 +28,10 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 教学视频Service业务层处理
@@ -41,6 +49,8 @@ public class TeachingVideoInfoServiceImpl extends ServiceImpl<TeachingVideoInfoM
 
     private final VodClient vodClient;
 
+    private final ITeachingVideoTypeInfoService videoTypeInfoService;
+
     /**
      * 查询教学视频列表
      *
@@ -278,4 +288,33 @@ public class TeachingVideoInfoServiceImpl extends ServiceImpl<TeachingVideoInfoM
         return Response.success();
     }
 
+    /**
+     * applet
+     * 查询教学视频列表
+     * @param pid
+     * @return
+     */
+    @Override
+    public Response queryTeachingVideoInfoList(String pid) {
+
+        ArrayList<AppletTeachingVideoVo> appletVideoVos = new ArrayList<>();
+
+        //获取pid下的二级分类id
+        List<TeachingVideoTypeInfo> typeInfos = videoTypeInfoService.list(new QueryWrapper<TeachingVideoTypeInfo>().eq("pid", pid).eq("status", 0).orderByAsc("type_sort"));
+        List<TeachingVideoInfoAppletVo> appletVos = teachingVideoInfoMapper.getTeachingVideoDetailsByTypeIds(pid);
+
+        for (TeachingVideoTypeInfo typeInfo : typeInfos) {
+            AppletTeachingVideoVo videoVo = new AppletTeachingVideoVo();
+            videoVo.setTypeName(typeInfo.getTypeName());
+            videoVo.setList(appletVos
+                    .parallelStream()
+                    .filter(f -> f.getTeachingVideoTypeId().toString().equals(typeInfo.getId().toString()))
+                    .collect(Collectors.toList()));
+            appletVideoVos.add(videoVo);
+        }
+
+        return Response.success(appletVideoVos);
+    }
+
+
 }

+ 31 - 0
zzjs-service/src/main/java/com/miaxis/teachingVideo/vo/AppletTeachingVideoVo.java

@@ -0,0 +1,31 @@
+package com.miaxis.teachingVideo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * applet
+ * 教学视频对象返回参
+ * @author wwl
+ * @version 1.0
+ * @date 2021/7/7 14:43
+ */
+@Data
+@ApiModel(value = "AppletTeachingVideoVo", description = "教学视频对象返回参")
+public class AppletTeachingVideoVo implements Serializable {
+
+    @ApiModelProperty(value = "教学视频分类名称")
+    private String typeName;
+
+    @ApiModelProperty(value = "数据集合")
+    private List<TeachingVideoInfoAppletVo> list;
+
+
+
+
+}

+ 54 - 0
zzjs-service/src/main/java/com/miaxis/teachingVideo/vo/TeachingVideoInfoAppletVo.java

@@ -0,0 +1,54 @@
+package com.miaxis.teachingVideo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * applet
+ * 教学视频对象返回参
+ * @author wwl
+ * @version 1.0
+ * @date 2021/7/7 16:43
+ */
+@Data
+@ApiModel(value = "TeachingVideoInfoAppletVo", description = "教学视频对象返回参")
+public class TeachingVideoInfoAppletVo implements Serializable {
+
+    @TableId(value = "id")
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    @ApiModelProperty(value = "视频文件访问地址")
+    private String fileUrl;
+
+    @ApiModelProperty(value = "封面图片访问地址")
+    private String coverFileUrl;
+
+    @TableField("title")
+    @ApiModelProperty(value = "视频标题")
+    private String title;
+
+    @TableField("video_describe")
+    @ApiModelProperty(value = "视频描述")
+    private String videoDescribe;
+
+    @TableField("video_duration")
+    @ApiModelProperty(value = "视频时长")
+    private String videoDuration;
+
+    @TableField("video_size")
+    @ApiModelProperty(value = "视频大小(单位:MB)")
+    private BigDecimal videoSize;
+
+    @TableField("teaching_video_type_id")
+    @ApiModelProperty(value = "教学视频分类id (关联teaching_video_type_info表)")
+    private Long teachingVideoTypeId;
+
+
+}

+ 20 - 0
zzjs-service/src/main/resources/mapper/teachingVideo/TeachingVideoInfoMapper.xml

@@ -89,4 +89,24 @@
         where vi.id = #{id}
     </select>
 
+
+    <select id="getTeachingVideoDetailsByTypeIds" resultType="com.miaxis.teachingVideo.vo.TeachingVideoInfoAppletVo">
+        select
+        vi.id,
+        vi.title,
+        vi.video_describe,
+        vi.video_duration,
+        vi.video_size,
+        vi.teaching_video_type_id,
+        f1.file_url as fileUrl,
+        f2.file_url as coverFileUrl
+        from teaching_video_info vi
+        LEFT JOIN file_info f1 on f1.file_id = vi.file_id
+        LEFT JOIN file_info f2 on f2.file_id = vi.cover_file_id
+        WHERE
+	      vi.teaching_video_type_id IN ( SELECT ti.id FROM teaching_video_type_info ti WHERE ti.pid = #{pid} )
+          AND vi.`shelf_status` = 0
+          AND vi.`status` = 0
+    </select>
+
 </mapper>