yangdamao hace 2 años
padre
commit
13e035fba9

+ 4 - 2
zhongzheng-api/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -328,10 +328,12 @@ public class GoodsController extends BaseController {
      */
     @ApiOperation("获取用户所有购买商品")
     @PostMapping("/user/all")
-    public AjaxResult<List<GoodsListAllVo>> getUserGoodsListAll(@RequestBody UserGoodsListAllBo bo) {
+    public TableDataInfo<GoodsListAllVo> getUserGoodsListAll(@RequestBody UserGoodsListAllBo bo) {
+        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
-        return AjaxResult.success(iGoodsService.getUserGoodsListAll(bo));
+        List<GoodsListAllVo> result = iGoodsService.getUserGoodsListAll(bo);
+        return getDataTable(result);
     }
 
 

+ 10 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/UserGoodsListAllBo.java

@@ -23,4 +23,14 @@ public class UserGoodsListAllBo implements Serializable {
 
     @ApiModelProperty("用户ID")
     private Long userId;
+
+    /** 分页大小 */
+    @ApiModelProperty("分页大小")
+    private Integer pageSize;
+    /** 当前页数 */
+    @ApiModelProperty("当前页数")
+    private Integer pageNum;
+
+    @ApiModelProperty("商品类型 1视频2题库 6直播")
+    private Integer goodsType;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java

@@ -64,4 +64,6 @@ public interface GoodsMapper extends BaseMapper<Goods> {
     List<GoodsListAllVo> getUserGoodsListAll(UserGoodsListAllBo bo);
 
     Long getCourseExamNum(@Param("goodsId") Long goodsId);
+
+    Long getUserStudyNum(@Param("userId")Long userId,@Param("orderGoodsId") Long orderGoodsId);
 }

+ 8 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -1600,7 +1600,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
 
             if (CollectionUtils.isNotEmpty(recordList)){
                 //保存记录
-                iSysGoodsCopyRecordService.saveBatch(recordList);
+//                iSysGoodsCopyRecordService.saveBatch(recordList);
             }
 
             //规格模板商品重新绑定
@@ -1704,7 +1704,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         record.setCreateTime(DateUtils.getNowTime());
         record.setUpdateTime(DateUtils.getNowTime());
         record.setTenantId(newTenantId);
-        array.add(record);
+        iSysGoodsCopyRecordService.save(record);
+//        array.add(record);
     }
 
     private void disposeGoodsAttached(Long oldGoodsId,Long newGoodsId,Long newTenantId,List<SysGoodsCopyRecord> array){
@@ -1760,7 +1761,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                     course.setCourseId(null);
                     course.setTenantId(newTenantId);
                     course.setEducationTypeId(getNewEducationTypeId(course.getEducationTypeId(),newTenantId,array));
-                    course.setProjectId(getNewProjectTypeId(course.getProjectId(),newTenantId,array));
+                    course.setBusinessId(getNewBusinessId(course.getBusinessId(),newTenantId,array));
                     course.setSubjectId(getNewSubjectId(course.getSubjectId(), newTenantId,array));
                     course.setProjectId(getNewProjectTypeId(course.getProjectId(), newTenantId,array));
                     course.setMajorId(getNewMajorId(course.getMajorId(),newTenantId,array));
@@ -3976,8 +3977,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                         sectionNum = baseMapper.getSectionNum(vo.getGoodsId());
                         vo.setGoodsCourseMsg(String.format("%s课程 %s节 %s学时",courseCount,sectionNum,vo.getClassHours()));
                     }
-                    //学习进度
-                   Long examNum = baseMapper.getCourseExamNum(vo.getGoodsId());
+                    //商品试卷总节数
+                    Long examNum = baseMapper.getCourseExamNum(vo.getGoodsId());
+                   //当前用户学习进度
+                    Long userStudyNum = baseMapper.getUserStudyNum(bo.getUserId(),vo.getOrderGoodsId());
 
             }
 

+ 9 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -857,6 +857,9 @@
         WHERE
         og.pay_status IN ( 2, 3, 4 )
         AND og.refund_status != 2
+        <if test="goodsType != null and goodsType != ''">
+            AND g.goods_type = #{goodsType}
+        </if>
         <if test="goodsName != null and goodsName != ''">
             AND g.goods_name like concat('%', #{goodsName}, '%')
         </if>
@@ -880,4 +883,10 @@
             cme.type != 2
 	AND gc.goods_id = #{goodsId}
     </select>
+
+    <select id="getUserStudyNum" parameterType="java.lang.Long" resultType="java.lang.Long">
+        SELECT COUNT(*) FROM
+            (SELECT COUNT(*) num FROM user_study_record WHERE user_id = #{userId} AND order_goods_id = #{orderGoodsId} GROUP BY course_id,module_id,chapter_id,section_id UNION ALL
+             SELECT COUNT(*) num FROM user_bank_record WHERE user_id = #{userId} AND order_goods_id = #{orderGoodsId} AND type != 2 GROUP BY course_id,module_id,chapter_id,exam_id) a
+    </select>
 </mapper>