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

add 用户天学习记录

he2802 3 éve
szülő
commit
595318afdd

+ 11 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/order/OrderGoodsController.java

@@ -3,10 +3,12 @@ package com.zhongzheng.controller.order;
 import java.util.List;
 import java.util.Arrays;
 
+import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.order.bo.OrderGoodsEditBo;
 import com.zhongzheng.modules.order.bo.OrderGoodsQueryBo;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -122,4 +124,13 @@ public class OrderGoodsController extends BaseController {
     public AjaxResult<Void> remove(@PathVariable Long[] orderGoodsIds) {
         return toAjax(iOrderGoodsService.deleteWithValidByIds(Arrays.asList(orderGoodsIds), true) ? 1 : 0);
     }*/
+
+    @ApiOperation("查询购买商品的用户列表")
+    @PreAuthorize("@ss.hasPermi('system:invoice:list')")
+    @GetMapping("/buyGoodsUserList")
+    public TableDataInfo<OrderGoodsVo> selectBuyGoodsUserList(OrderGoodsQueryBo bo) {
+        startPage();
+        List<OrderGoodsVo> list = iOrderGoodsService.selectBuyGoodsUserList(bo);
+        return getDataTable(list);
+    }
 }

+ 10 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserStudyRecordController.java

@@ -15,6 +15,7 @@ import com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo;
 import com.zhongzheng.modules.user.domain.UserStudyRecord;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.service.IUserStudyRecordService;
+import com.zhongzheng.modules.user.vo.SectionStudyRecordVo;
 import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -124,4 +125,13 @@ public class UserStudyRecordController extends BaseController {
         return AjaxResult.success(iUserStudyRecordService.menuAllList(bo));
     }
 
+    @ApiOperation("查询用户每天学习记录列表")
+    @GetMapping("/listUserRecord")
+    public TableDataInfo<SectionStudyRecordVo> listUserRecord(UserStudyRecordQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
+        List<SectionStudyRecordVo> list = iUserStudyRecordService.listUserRecord(bo);
+        return getDataTable(list);
+    }
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsQueryBo.java

@@ -154,4 +154,7 @@ GoodsQueryBo extends BaseEntity {
 
 	@ApiModelProperty("获取有课程的视频商品 1获取 ")
 	private Long haveCourse;
+
+	@ApiModelProperty("排序模式 1默认 2价格从低到高 3价格从高到低")
+	private Integer sortType;
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/mapper/OrderGoodsMapper.java

@@ -31,4 +31,5 @@ public interface OrderGoodsMapper extends BaseMapper<OrderGoods> {
     List<OrderGoodsVo> rebuyInfo(OrderGoodsQueryBo bo);
     OrderGoodsVo gradeGoods(OrderGoodsQueryBo bo);
     List<OrderGoodsVo> selectCanInvoiceList(OrderGoodsQueryBo bo);
+    List<OrderGoodsVo> selectBuyGoodsUserList(OrderGoodsQueryBo bo);
 }

+ 46 - 38
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderGoodsService.java

@@ -19,55 +19,63 @@ import java.util.Map;
  * @date 2021-11-08
  */
 public interface IOrderGoodsService extends IService<OrderGoods> {
-	/**
-	 * 查询单个
-	 * @return
-	 */
-	OrderGoodsVo queryById(Long orderGoodsId);
+    /**
+     * 查询单个
+     *
+     * @return
+     */
+    OrderGoodsVo queryById(Long orderGoodsId);
 
-	OrderGoodsVo selectDetail(OrderGoodsQueryBo bo);
+    OrderGoodsVo selectDetail(OrderGoodsQueryBo bo);
 
-	List<OrderGoodsVo> selectList(OrderGoodsQueryBo bo);
-	/**
-	 * 查询列表
-	 */
-	List<OrderGoodsVo> queryList(OrderGoodsQueryBo bo);
-	List<OrderGoodsVo> rebuyInfo(OrderGoodsQueryBo bo);
+    List<OrderGoodsVo> selectList(OrderGoodsQueryBo bo);
 
+    /**
+     * 查询列表
+     */
+    List<OrderGoodsVo> queryList(OrderGoodsQueryBo bo);
 
-	/**
-	 * 根据新增业务对象插入订单商品
-	 * @param bo 订单商品新增业务对象
-	 * @return
-	 */
-	Boolean insertByAddBo(OrderGoodsAddBo bo);
+    List<OrderGoodsVo> rebuyInfo(OrderGoodsQueryBo bo);
 
-	Long getBuyGoodsHistory(OrderGoodsQueryBo bo);
 
-	Long getBuyGoodsReadyPay(OrderGoodsQueryBo bo);
+    /**
+     * 根据新增业务对象插入订单商品
+     *
+     * @param bo 订单商品新增业务对象
+     * @return
+     */
+    Boolean insertByAddBo(OrderGoodsAddBo bo);
 
-	List<OrderGoodsVo> selectCanInvoiceList(OrderGoodsQueryBo bo);
+    Long getBuyGoodsHistory(OrderGoodsQueryBo bo);
 
-	/**
-	 * 根据编辑业务对象修改订单商品
-	 * @param bo 订单商品编辑业务对象
-	 * @return
-	 */
-	Boolean updateByEditBo(OrderGoodsEditBo bo);
+    Long getBuyGoodsReadyPay(OrderGoodsQueryBo bo);
 
-	/**
-	 * 校验并删除数据
-	 * @param ids 主键集合
-	 * @param isValid 是否校验,true-删除前校验,false-不校验
-	 * @return
-	 */
-	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+    List<OrderGoodsVo> selectCanInvoiceList(OrderGoodsQueryBo bo);
 
-	List<OrderGoodsVo> selectOrderGoods();
+    /**
+     * 根据编辑业务对象修改订单商品
+     *
+     * @param bo 订单商品编辑业务对象
+     * @return
+     */
+    Boolean updateByEditBo(OrderGoodsEditBo bo);
 
-	List<OrderGoodsVo> selectOrderTwoGoods();
+    /**
+     * 校验并删除数据
+     *
+     * @param ids     主键集合
+     * @param isValid 是否校验,true-删除前校验,false-不校验
+     * @return
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
-	List<OrderGoodsVo> sendGoods();
+    List<OrderGoodsVo> selectOrderGoods();
 
-	OrderGoodsVo gradeGoods(OrderGoodsQueryBo bo);
+    List<OrderGoodsVo> selectOrderTwoGoods();
+
+    List<OrderGoodsVo> sendGoods();
+
+    OrderGoodsVo gradeGoods(OrderGoodsQueryBo bo);
+
+    List<OrderGoodsVo> selectBuyGoodsUserList(OrderGoodsQueryBo bo);
 }

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

@@ -242,6 +242,11 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
         return baseMapper.gradeGoods(bo);
     }
 
+    @Override
+    public List<OrderGoodsVo> selectBuyGoodsUserList(OrderGoodsQueryBo bo) {
+        return this.baseMapper.selectBuyGoodsUserList(bo);
+    }
+
     public boolean joinGrade(Long orderGoodsId, Long gradeId, Long userId, Long goodsId) {
         ClassGradeVo classGradeVo = iClassGradeService.queryById(gradeId);
         if (classGradeVo == null) {

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderGoodsVo.java

@@ -148,4 +148,6 @@ public class OrderGoodsVo {
 	@Excel(name = "商品订单状态")
 	@ApiModelProperty("商品订单状态 -1关闭 0待支付 1已支付 2已退款")
 	private Integer orderGoodsStatus;
+	@ApiModelProperty("用户名称")
+	private String realname;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordMapper.java

@@ -78,4 +78,6 @@ public interface UserStudyRecordMapper extends BaseMapper<UserStudyRecord> {
     List<ClassPeriodVo> listModuleChapter(UserStudyRecordQueryBo bo);
 
     Integer getStudyStatus(ClassPeriodVo bo);
+
+    List<SectionStudyRecordVo> listUserRecord(UserStudyRecordQueryBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserStudyRecordService.java

@@ -83,4 +83,6 @@ public interface IUserStudyRecordService extends IService<UserStudyRecord> {
 	boolean checkStudyOrder1(UserStudyRecordQueryBo entity);
 
 	List<ClassPeriodVo> menuAllList(UserStudyRecordQueryBo bo);
+
+	List<SectionStudyRecordVo> listUserRecord(UserStudyRecordQueryBo bo);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -491,6 +491,11 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         return sectionList;
     }
 
+    @Override
+    public List<SectionStudyRecordVo> listUserRecord(UserStudyRecordQueryBo bo) {
+        return this.baseMapper.listUserRecord(bo);
+    }
+
 
     //判断当前未看完的节是否是点击播放的节
     private boolean compareSection(UserStudyRecordVo recordVo,UserStudyRecordQueryBo entity){

+ 20 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/SectionStudyRecordVo.java

@@ -57,5 +57,24 @@ public class SectionStudyRecordVo {
 
     @ApiModelProperty("试卷已做数量")
     private Long examRecordNum;
-
+    @ApiModelProperty("日期")
+    private String date;
+
+    @ApiModelProperty("节封面")
+    private String coverUrl;
+
+    @ApiModelProperty("模块ID")
+    private Long moduleId;
+
+    @ApiModelProperty("章ID")
+    private Long chapterId;
+
+    @ApiModelProperty("绑定课程")
+    private Long courseId;
+    @ApiModelProperty("绑定的商品")
+    private Long goodsId;
+    @ApiModelProperty("商品名称")
+    private String goodsName;
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
 }

+ 10 - 1
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -231,7 +231,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             AND qb.subject_id = #{subjectId}
             )
         </if>
-        ORDER BY g.create_time DESC
+        <if test="sortType != null and sortType == 2">
+            ORDER BY g.stand_price
+        </if>
+        <if test="sortType != null and sortType == 3">
+            ORDER BY g.stand_price DESC
+        </if>
+        <if test="sortType == null or sortType == 1">
+            ORDER BY g.create_time DESC
+        </if>
+
     </select>
 
     <select id="selectDetail" parameterType="Long" resultMap="GoodsResultVo">

+ 21 - 5
zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml

@@ -51,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime" column="create_time"/>
         <result property="remark" column="remark"/>
         <result property="userId" column="user_id"/>
+        <result property="realname" column="realname"/>
         <result property="rebuyOrderGoodsId" column="rebuy_order_goods_id"/>
 
         <result property="code" column="code"/>
@@ -153,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where 1=1
         and og.`status` = 1
         and og.refund_status in (0,1,3)
-        and og.pay_status in (2,3)
+        and og.pay_status in (2,3,4)
         AND (SELECT COUNT(1) FROM inform_user iu where iu.user_id = o.user_id and iu.goods_id = og.goods_id and system_status = 1) &lt; 1
     </select>
 
@@ -167,7 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where 1=1
         and og.`status` = 1
         and og.refund_status in (0,1,3)
-        and og.pay_status in (2,3)
+        and og.pay_status in (2,3,4)
         AND (SELECT COUNT(1) FROM inform_user iu where iu.user_id = o.user_id and iu.goods_id = og.goods_id  and system_status = 3) &lt; 1
 
     </select>
@@ -182,7 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where 1=1
         and og.`status` = 1
         and og.refund_status in (0,1,3)
-        and og.pay_status in (2,3)
+        and og.pay_status in (2,3,4)
         and (SELECT COUNT(1) FROM user_exam_goods ueg where ueg.user_id = o.user_id and og.goods_id = ueg.goods_id) &lt; 1
         and (SELECT COUNT(1) FROM exam_number en LEFT JOIN exam_number_goods eng on en.exam_number_id = eng.exam_number_id where eng.goods_id = og.goods_id and en.`status` = 1) > 0
     </select>
@@ -223,7 +224,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 LEFT JOIN `order` o on og.order_sn = o.order_sn
                 LEFT JOIN class_grade_user cgu ON cgu.grade_id = cg.grade_id and cgu.user_id = #{userId}
         WHERE
-            o.user_id = #{userId} and og.goods_id = #{goodsId} and og.pay_status in (2,3) and  og.order_goods_id !=  #{orderGoodsId} and cgu.period_plush = 1
+            o.user_id = #{userId} and og.goods_id = #{goodsId} and og.pay_status in (2,3,4) and  og.order_goods_id !=  #{orderGoodsId} and cgu.period_plush = 1
     </select>
 
     <select id="gradeGoods" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
@@ -233,7 +234,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             order_goods og
                 LEFT JOIN `order` o on og.order_sn = o.order_sn
         WHERE
-            o.user_id = #{userId} and og.grade_id = #{gradeId} and og.pay_status in (2,3) and og.refund_status !=2
+            o.user_id = #{userId} and og.grade_id = #{gradeId} and og.pay_status in (2,3,4) and og.refund_status !=2
     </select>
 
     <select id="selectCanInvoiceList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
@@ -286,4 +287,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
     </select>
 
+    <select id="selectBuyGoodsUserList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo" resultMap="OrderGoodsResultVo">
+        SELECT
+            DISTINCT u.user_id,
+            u.realname
+        FROM
+            order_goods og
+                LEFT JOIN `order` o ON og.order_sn = o.order_sn
+                LEFT JOIN `user` u ON o.user_id = u.user_id
+        WHERE
+            og.`status` = 1
+          AND og.refund_status IN ( 0, 1, 3 )
+          AND og.pay_status IN ( 2, 3, 4 )
+          AND og.goods_id = #{goodsId}
+    </select>
+
 </mapper>

+ 46 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -69,6 +69,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
         <result property="examNum" column="exam_num"/>
         <result property="examRecordNum" column="exam_record_num"/>
+
+        <result property="date" column="date"/>
+        <result property="coverUrl" column="cover_url"/>
+        <result property="goodsId" column="goods_id"/>
+        <result property="goodsName" column="goods_name"/>
+        <result property="courseId" column="course_id"/>
+        <result property="moduleId" column="module_id"/>
+        <result property="chapterId" column="chapter_id"/>
+        <result property="gradeId" column="grade_id"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.user.vo.ExamStudyRecordVo" id="ExamStudyRecordVoResult">
@@ -1159,4 +1168,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND `status` = 1
           AND current_status = 1
     </select>
+
+    <select id="listUserRecord" parameterType="com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo" resultMap="SectionStudyRecordVoResult">
+        SELECT
+            cs.`name` as section_name,
+            cs.cover_url,
+            cs.duration_time,
+            r.*,
+            g.goods_name
+        FROM
+            (
+                SELECT
+                    from_unixtime( usr.update_time, '%Y-%m-%d' ) date,
+		section_id,
+		MAX( usr.video_current_time ) video_current_time,
+		usr.goods_id,
+		usr.course_id,
+		usr.module_id,
+		usr.chapter_id,
+        usr.grade_id
+                FROM
+                    user_study_record usr
+                WHERE
+                    usr.user_id = #{userId}
+                GROUP BY
+                    from_unixtime( usr.update_time, '%Y-%m-%d' ),
+                    usr.section_id,
+                    usr.goods_id,
+                    usr.course_id,
+                    usr.module_id,
+                    usr.chapter_id,
+                    usr.grade_id
+            ) r
+                LEFT JOIN course_section cs ON r.section_id = cs.section_id
+                LEFT JOIN goods g ON g.goods_id = r.goods_id
+        ORDER BY
+            r.date DESC
+    </select>
 </mapper>