yangdamao 2 年之前
父節點
當前提交
5494e3287b

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsSectionNumVo.java

@@ -14,4 +14,6 @@ public class GoodsSectionNumVo implements Serializable {
     private Long sectionNum;
     private Long sectionNum;
 
 
     private Long recordNum;
     private Long recordNum;
+
+    private Long studyStatus;
 }
 }

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

@@ -45,6 +45,7 @@ import com.zhongzheng.modules.goods.service.IGoodsQuestionRelService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.service.IQuestionMerchantService;
 import com.zhongzheng.modules.goods.service.IQuestionMerchantService;
 import com.zhongzheng.modules.goods.vo.GoodsSectionListVo;
 import com.zhongzheng.modules.goods.vo.GoodsSectionListVo;
+import com.zhongzheng.modules.goods.vo.GoodsSectionNumVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.domain.ClassGradeGoods;
 import com.zhongzheng.modules.grade.domain.ClassGradeGoods;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
@@ -586,11 +587,17 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
             subjectStudyRecordQueryBo.setUserId(bo.getUserId());
             subjectStudyRecordQueryBo.setUserId(bo.getUserId());
             subjectStudyRecordQueryBo.setOrderGoodsId(goodsVo.getOrderGoodsId());
             subjectStudyRecordQueryBo.setOrderGoodsId(goodsVo.getOrderGoodsId());
             subjectStudyRecordQueryBo.setGradeId(goodsVo.getGradeId());
             subjectStudyRecordQueryBo.setGradeId(goodsVo.getGradeId());
-            List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
-            for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
-                secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
-                studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
-                studyStatus = studyStatus + subjectStudyRecordVo.getStudyStatus();
+//            List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
+//            for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
+//                secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
+//                studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
+//                studyStatus = studyStatus + subjectStudyRecordVo.getStudyStatus();
+//            }
+            GoodsSectionNumVo vo = iUserStudyRecordService.getGoodsSectionNum(subjectStudyRecordQueryBo);
+            if (ObjectUtils.isNotNull(vo)){
+                secLong = vo.getSectionNum();
+                studyLong = vo.getRecordNum();
+                studyStatus = studyStatus + vo.getStudyStatus().intValue();
             }
             }
             goodsVo.setSecAllNum(secLong);
             goodsVo.setSecAllNum(secLong);
             goodsVo.setStuAllNum(studyLong);
             goodsVo.setStuAllNum(studyLong);

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

@@ -1879,6 +1879,7 @@
                         ELSE 0
                         ELSE 0
                         END
                         END
                 ) AS section_num ,
                 ) AS section_num ,
+            (SELECT count(*) from user_study_record usr where usr.user_id = #{userId} and usr.grade_id = #{gradeId} and usr.order_goods_id = #{orderGoodsId} and usr.current_status = 1 ) as study_status,
             (select COUNT(DISTINCT course_id,module_id,chapter_id,section_id)
             (select COUNT(DISTINCT course_id,module_id,chapter_id,section_id)
                                         FROM user_study_record c where 1=1
                                         FROM user_study_record c where 1=1
                                         and c.current_status=1
                                         and c.current_status=1