Просмотр исходного кода

提交:直播提醒列表接口

yangdamao 3 лет назад
Родитель
Сommit
7f4f84ac22

+ 14 - 8
zhongzheng-api/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -2,11 +2,11 @@ package com.zhongzheng.controller.goods;
 
 import cn.hutool.core.lang.Validator;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.zhongzheng.common.annotation.Log;
 import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.core.page.PageDomain;
 import com.zhongzheng.common.core.page.TableDataInfo;
-import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.core.page.TableSupport;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.framework.web.service.WxTokenService;
 import com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo;
@@ -19,14 +19,12 @@ import com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo;
 import com.zhongzheng.modules.collect.service.ICollectQuestionService;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.course.service.ICourseSectionService;
-import com.zhongzheng.modules.course.vo.CourseModuleFreeExamVo;
+import com.zhongzheng.modules.course.vo.CourseLiveVo;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
 import com.zhongzheng.modules.goods.bo.*;
 import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
-import com.zhongzheng.modules.goods.service.IGoodsAuditionConfigService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
-import com.zhongzheng.modules.goods.vo.GoodsUserQuestionVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.UserPeriodQueryBo;
 import com.zhongzheng.modules.grade.service.IUserPeriodService;
@@ -37,16 +35,13 @@ import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.user.bo.UserExamRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo;
-import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.service.IUserExamRecordService;
 import com.zhongzheng.modules.user.service.IUserExamWrongRecordService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import io.swagger.models.auth.In;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.*;
@@ -227,4 +222,15 @@ public class GoodsController extends BaseController {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         return AjaxResult.success(iCourseSectionService.livingSectionList(loginUser.getUser().getUserId()));
     }
+
+    /**
+     * 获取直播提醒列表
+     */
+    @ApiOperation("获取直播提醒列表")
+    @GetMapping("/getLiveList")
+    public TableDataInfo<CourseLiveVo> liveList() {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        PageDomain pageDomain = TableSupport.getPageDomain();
+        return iOrderGoodsService.getLiveList(pageDomain,loginUser.getUser().getUserId());
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMenuMapper.java

@@ -30,4 +30,6 @@ public interface CourseMenuMapper extends BaseMapper<CourseMenu> {
     Integer learningCheck(@Param("sectionId") Long id,@Param("gradeId") Long gradeId,@Param("userId")Long userId,@Param("courseId")Long courseId);
 
     Integer auditCheck(@Param("sectionId") Long id,@Param("gradeId") Long gradeId,@Param("userId")Long userId,@Param("courseId")Long courseId);
+
+    List<Long> getSectionIds(@Param("chapterIds") List<Long> chapterIds);
 }

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseMenuService.java

@@ -57,4 +57,13 @@ public interface ICourseMenuService extends IService<CourseMenu> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
 	List<CourseUserMenuVo> menuList(CourseMenuQueryBo bo);
+
+	/**
+	 * 获取节ID
+	 * @author yangdamao
+	 * @date 2022/7/14 9:44
+	 * @param chapterIds
+	 * @return java.util.List<java.lang.Long>
+	 */
+	List<Long> getSectionIds(List<Long> chapterIds);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseMenuServiceImpl.java

@@ -270,4 +270,9 @@ public class CourseMenuServiceImpl extends ServiceImpl<CourseMenuMapper, CourseM
         }
         return courseMenuVos;
     }
+
+    @Override
+    public List<Long> getSectionIds(List<Long> chapterIds) {
+        return baseMapper.getSectionIds(chapterIds);
+    }
 }

+ 92 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseLiveVo.java

@@ -0,0 +1,92 @@
+package com.zhongzheng.modules.course.vo;
+
+import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author yangdamao
+ * @date 2022年07月14日 8:41
+ */
+@Data
+@ApiModel("直播提醒列表")
+public class CourseLiveVo implements Serializable {
+
+    /** 节ID */
+    @ApiModelProperty("节ID")
+    private Long sectionId;
+
+    @ApiModelProperty("名称")
+    private String name;
+
+    @ApiModelProperty("排序")
+    private Long sort;
+
+    @ApiModelProperty("前缀名称")
+    private String prefixName;
+
+    @ApiModelProperty("状态 1正常 0关闭")
+    private Integer status;
+
+    @ApiModelProperty("节类型 1录播 2直播 3回放")
+    private Integer sectionType;
+
+    @ApiModelProperty("发布状态 1发布 0未发布")
+    private Integer publishStatus;
+
+    @ApiModelProperty("直播流地址")
+    private String liveUrl;
+
+    @ApiModelProperty("直播开始时间")
+    private Long liveStartTime;
+
+    @ApiModelProperty("直播结束时间")
+    private Long liveEndTime;
+
+    @ApiModelProperty("录播和回放的url地址")
+    private String recordingUrl;
+
+    @ApiModelProperty("节时长(秒)")
+    private Long durationTime;
+
+    @ApiModelProperty("封面地址")
+    private String coverUrl;
+
+    @ApiModelProperty("编码")
+    private String code;
+
+    @ApiModelProperty("添加时间")
+    private Long createTime;
+
+    @ApiModelProperty("修改时间")
+    private Long updateTime;
+
+    @ApiModelProperty("保利威直播场次ID")
+    private String sessionId;
+
+    @ApiModelProperty("保利威真实直播开始时间")
+    private Long realLiveStartTime;
+
+    @ApiModelProperty("保利威真实直播结束时间")
+    private Long realLiveEndTime;
+
+    @ApiModelProperty("保利威真实直播时长,单位秒")
+    private Long realDuration;
+
+    @ApiModelProperty("课程id")
+    private Long courseId;
+
+    @ApiModelProperty("商品ID")
+    private Long goodsId;
+
+    @ApiModelProperty("讲师ID")
+    private Long teacherId;
+
+    @ApiModelProperty("订单ID")
+    private Long orderId;
+}

+ 2 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/mapper/OrderGoodsMapper.java

@@ -1,16 +1,12 @@
 package com.zhongzheng.modules.order.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zhongzheng.modules.bank.bo.QuestionQueryBo;
-import com.zhongzheng.modules.bank.vo.QuestionVo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
-import com.zhongzheng.modules.order.bo.OrderAddBo;
 import com.zhongzheng.modules.order.bo.OrderGoodsQueryBo;
 import com.zhongzheng.modules.order.domain.OrderGoods;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * 订单商品Mapper接口
@@ -48,4 +44,6 @@ public interface OrderGoodsMapper extends BaseMapper<OrderGoods> {
     List<OrderGoodsVo> listUserSubjectGoods(GoodsQueryBo bo);
 
     List<OrderGoodsVo> selectBuyUserList(Long mockMajorSubjectId);
+
+    List<Long> getCourseIdByLive(Long userId);
 }

+ 12 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderGoodsService.java

@@ -1,6 +1,9 @@
 package com.zhongzheng.modules.order.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.common.core.page.PageDomain;
+import com.zhongzheng.common.core.page.TableDataInfo;
+import com.zhongzheng.modules.course.vo.CourseLiveVo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.order.bo.*;
 import com.zhongzheng.modules.order.domain.OrderGoods;
@@ -89,4 +92,13 @@ public interface IOrderGoodsService extends IService<OrderGoods> {
     List<OrderGoodsVo> selectBuyUserList(Long mockMajorSubjectId);
 
 
+    /**
+     *
+     * @author 获取直播提醒列表
+     * @date 2022/7/14 8:52
+     * @param pageDomain
+     * @param userId
+     * @return com.zhongzheng.common.core.page.TableDataInfo<com.zhongzheng.modules.course.vo.CourseLiveVo>
+     */
+    TableDataInfo<CourseLiveVo> getLiveList(PageDomain pageDomain,Long userId);
 }

+ 76 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsServiceImpl.java

@@ -3,12 +3,24 @@ package com.zhongzheng.modules.order.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpStatus;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.zhongzheng.common.core.page.PageDomain;
+import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
 import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
+import com.zhongzheng.modules.course.domain.CourseChapterSection;
+import com.zhongzheng.modules.course.domain.CourseMenu;
+import com.zhongzheng.modules.course.domain.CourseSection;
+import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
+import com.zhongzheng.modules.course.service.ICourseChapterService;
+import com.zhongzheng.modules.course.service.ICourseMenuService;
+import com.zhongzheng.modules.course.service.ICourseSectionService;
+import com.zhongzheng.modules.course.vo.CourseLiveVo;
 import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.goods.service.IGoodsCourseService;
@@ -36,6 +48,7 @@ import com.zhongzheng.modules.user.service.IUserExamGoodsService;
 import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.service.IUserStudyRecordService;
 import com.zhongzheng.modules.user.service.IUserSubscribeService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -90,6 +103,14 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
     @Autowired
     private IUserSubscribeService iUserSubscribeService;
 
+    @Autowired
+    private ICourseMenuService courseMenuService;
+
+    @Autowired
+    private ICourseChapterSectionService courseChapterSectionService;
+
+    @Autowired
+    private ICourseSectionService courseSectionService;
 
     @Override
     public OrderGoodsVo queryById(Long orderGoodsId) {
@@ -452,6 +473,61 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
         return baseMapper.selectBuyUserList(mockMajorSubjectId);
     }
 
+    @Override
+    public TableDataInfo<CourseLiveVo> getLiveList(PageDomain pageDomain, Long userId) {
+        //获取所有直播课程ID
+        List<Long> courseIds = orderGoodsMapper.getCourseIdByLive(userId);
+        if (CollectionUtils.isEmpty(courseIds)){
+            return new TableDataInfo<>();
+        }
+        //课程目录
+        List<CourseMenu> menus = courseMenuService.list(new LambdaQueryWrapper<CourseMenu>()
+                .in(CourseMenu::getCourseId, courseIds));
+        if (CollectionUtils.isEmpty(menus)){
+            return new TableDataInfo<>();
+        }
+
+        //节ID
+        List<Long> sectionIds = menus.stream().filter(x -> x.getType() == 3).map(CourseMenu::getMenuId).collect(Collectors.toList());
+        //章ID
+        List<Long> chapterIds = menus.stream().filter(x -> x.getType() == 2).map(CourseMenu::getMenuId).collect(Collectors.toList());
+        if (!CollectionUtils.isEmpty(chapterIds)){
+            List<CourseChapterSection> chapterSections = courseChapterSectionService.list(new LambdaQueryWrapper<CourseChapterSection>()
+                    .in(CourseChapterSection::getChapterId, chapterIds));
+            if (!CollectionUtils.isEmpty(chapterSections)){
+                List<Long> ids = chapterSections.stream().map(CourseChapterSection::getSectionId).collect(Collectors.toList());
+                sectionIds.addAll(ids);
+            }
+        }
+        //模块ID
+        List<Long> moduleIds = menus.stream().filter(x -> x.getType() == 1).map(CourseMenu::getMenuId).collect(Collectors.toList());
+        if (!CollectionUtils.isEmpty(moduleIds)){
+            List<Long> ids = courseMenuService.getSectionIds(moduleIds);
+            if (!CollectionUtils.isEmpty(ids)){
+                sectionIds.addAll(ids);
+            }
+        }
+        if (CollectionUtils.isEmpty(sectionIds)){
+            return new TableDataInfo<>();
+        }
+
+        //分页查询节直播信息
+        com.baomidou.mybatisplus.extension.plugins.pagination.Page<CourseSection> page = courseSectionService.page(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageDomain.getPageNum(), pageDomain.getPageSize()),
+                new LambdaQueryWrapper<CourseSection>()
+                        .in(CourseSection::getSectionId, sectionIds)
+                        .orderByAsc(CourseSection::getLiveStartTime));
+        if (CollectionUtils.isEmpty(page.getRecords())){
+            return new TableDataInfo<>();
+        }
+        List<CourseLiveVo> list = page.getRecords().stream().map(item -> BeanUtil.copyProperties(item, CourseLiveVo.class)).collect(Collectors.toList());
+        TableDataInfo<CourseLiveVo> info = new TableDataInfo<>();
+        info.setTotal(page.getTotal());
+        info.setRows(list);
+        info.setCode(HttpStatus.HTTP_OK);
+        info.setMsg("查询成功");
+        return info;
+    }
+
     public boolean joinGrade(Long orderGoodsId, Long gradeId, Long userId, Long goodsId) {
         ClassGradeVo classGradeVo = iClassGradeService.queryById(gradeId);
         if (classGradeVo == null) {

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserImportAddBo.java

@@ -24,6 +24,10 @@ public class UserImportAddBo {
     @Excel(name = "*学员身份证号码")
     @ApiModelProperty("身份证号")
     private String idCard;
+    /** 身份证号 */
+    @Excel(name = "*所在公司")
+    @ApiModelProperty("所在公司")
+    private String company;
     /** 手机号码 */
     @Excel(name = "*手机号码")
     @ApiModelProperty("手机号码")

+ 16 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMenuMapper.xml

@@ -264,4 +264,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND ups.period_status =1
           and ups.record_end_time is not null
     </select>
+    <select id="getSectionIds" parameterType="Integer"  resultType="Integer">
+        SELECT
+            cs.section_id
+        FROM
+            course_module_chapter cm
+                LEFT JOIN course_chapter_section cs ON cm.chapter_id = cs.chapter_id
+        WHERE
+             1=1
+             <if test="chapterIds != null and chapterIds.size() > 0">
+             AND cm.module_id IN
+                 <foreach item="id" index="index" collection="chapterIds"
+                          open="(" separator="," close=")">
+                     # {id}
+                 </foreach>
+             </if>
+    </select>
 </mapper>

+ 16 - 0
zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml

@@ -457,4 +457,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			and og.`status` = 1
 			and mmsg.mock_major_subject_id = #{mockMajorSubjectId}
     </select>
+    <select id="getCourseIdByLive" parameterType="java.lang.Long" resultType="java.lang.Long">
+        SELECT
+            gc.course_id
+        FROM
+            `order` o
+                LEFT JOIN order_goods og ON o.order_sn = og.order_sn
+                LEFT JOIN goods g ON og.goods_id = g.goods_id
+                INNER JOIN goods_course gc ON g.goods_id = gc.goods_id
+        WHERE
+            o.user_id = #{userId}
+          AND o.order_status = 1
+          AND o.pay_status = 2
+          AND o.`status` = 1
+          AND g.`status` = 1
+          AND g.goods_type = 6
+    </select>
 </mapper>