he2802 2 years ago
parent
commit
6994149a47

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

@@ -956,14 +956,14 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
         }
         ClassGrade gradeOld = iClassGradeService.getOne(new LambdaQueryWrapper<ClassGrade>()
                 .eq(ClassGrade::getGradeId, bo.getGradeId()));
-        ClassGrade gradeNew = BeanUtil.toBean(gradeOld, ClassGrade.class);
+      /*  ClassGrade gradeNew = BeanUtil.toBean(gradeOld, ClassGrade.class);
         gradeNew.setGradeId(null);
         gradeNew.setFirstChoiceGrade(gradeOld.getGradeId());
         gradeNew.setCreateTime(DateUtils.getNowTime());
         gradeNew.setUpdateTime(DateUtils.getNowTime());
         gradeNew.setGradeCode(ServletUtils.getEncoded("BJ"));
         gradeNew.setClassName(gradeNew.getClassName()+"(优选)");
-        iClassGradeService.save(gradeNew);
+        iClassGradeService.save(gradeNew);*/
 
 
 
@@ -1016,12 +1016,12 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
         iGoodsCourseService.save(goodsCourseNew);
 
         orderGoods.setGoodsId(goodsNew.getGoodsId());
-        orderGoods.setGradeId(gradeNew.getGradeId());
+   //     orderGoods.setGradeId(gradeNew.getGradeId());
         updateById(orderGoods);
 
         ClassGradeGoodsAddBo gradeGoodsAddBo = new ClassGradeGoodsAddBo();
         gradeGoodsAddBo.setGoodsId(goodsNew.getGoodsId());
-        gradeGoodsAddBo.setGradeId(gradeNew.getGradeId());
+        gradeGoodsAddBo.setGradeId(gradeOld.getGradeId());//
         iClassGradeGoodsService.insertByAddBo(gradeGoodsAddBo);
 
         LambdaUpdateWrapper<UserExamGoods> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
@@ -1036,16 +1036,16 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
         objectLambdaUpdateWrapper2.set(UserExamGoodsSupplement::getUpdateTime,DateUtils.getNowTime());
         iUserExamGoodsSupplementService.update(null, objectLambdaUpdateWrapper2);
 
-        LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper3 = Wrappers.lambdaUpdate();
+      /*  LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper3 = Wrappers.lambdaUpdate();
         objectLambdaUpdateWrapper3.eq(ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId());
         objectLambdaUpdateWrapper3.eq(ClassGradeUser::getUserId, bo.getUserId());
         objectLambdaUpdateWrapper3.set(ClassGradeUser::getGradeId, gradeNew.getGradeId());
         objectLambdaUpdateWrapper3.set(ClassGradeUser::getUpdateTime,DateUtils.getNowTime());
-        iClassGradeUserService.update(null, objectLambdaUpdateWrapper3);
+        iClassGradeUserService.update(null, objectLambdaUpdateWrapper3);*/
 
         bo.setGoodsId(goodsNew.getGoodsId());
         bo.setCourseId(goodsCourseNew.getCourseId());
-        bo.setGradeId(gradeNew.getGradeId());
+    //    bo.setGradeId(gradeNew.getGradeId());
         return bo;
     }
 }

+ 13 - 17
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -442,9 +442,9 @@
             (SELECT COUNT(1) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where  ups.period_status =1  and (ups.`status` =3 or ups.`status` =0) and up.grade_id = cgu.grade_id and up.user_id = cgu.user_id) as rebuild,
             (case WHEN (SELECT COUNT(1) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where up.grade_id = cgu.grade_id AND ups.period_status =1 and ups.`status` =3 and up.user_id = cgu.user_id ) >0 then 1 ELSE 0 end) as rebuild_status,
             cgu.grade_id,
-            (case WHEN (SELECT COUNT(1) FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) >0 then 1 ELSE 0 end) as apply_status,
-            (case WHEN (SELECT COUNT(1) FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) >0 then 1 ELSE 0 end) as before_status,
-            (SELECT eb.before_name FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) as before_name,
+            (case WHEN (SELECT COUNT(1) FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = og.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) >0 then 1 ELSE 0 end) as apply_status,
+            (case WHEN (SELECT COUNT(1) FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = og.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) >0 then 1 ELSE 0 end) as before_status,
+            (SELECT eb.before_name FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = og.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) as before_name,
             cgu.order_goods_id,
             og.service_start_time,
             og.service_end_time,
@@ -465,9 +465,9 @@
             g.external_link_status
         FROM
             class_grade_user cgu
-                LEFT JOIN class_grade_goods cgg ON cgu.grade_id = cgg.grade_id
+                LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
                 LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
-                LEFT JOIN goods g on g.goods_id=cgg.goods_id
+                LEFT JOIN goods g on g.goods_id=og.goods_id
                 LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
                 LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
                 LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
@@ -780,8 +780,7 @@
         where
         m.type in (1,3)
         and c.goods_id = #{goodsId}) as exam_num,
-        (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
-        = ubr.goods_id where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.order_goods_id = cgu.order_goods_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
+        (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr  where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.order_goods_id = cgu.order_goods_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
             cgu.grade_id,
             cg.class_start_time,
             cg.class_end_time,
@@ -802,7 +801,7 @@
         FROM
             class_grade_user cgu
                 LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
-                LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
+                LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
         WHERE
             1=1
         <if test="gradeId != null and gradeId != ''">
@@ -811,7 +810,7 @@
         <if test="orderGoodsId != null and orderGoodsId != ''">
             and cgu.order_goods_id = #{orderGoodsId}
         </if>
-          and cg.`status` =1 and cgg.goods_id = #{goodsId} and cgu.change_grade = 0 and cgu.user_id=#{userId}
+          and cg.`status` =1 and og.goods_id = #{goodsId} and cgu.change_grade = 0 and cgu.user_id=#{userId}
         order by cg.create_time desc LIMIT 1
     </select>
 
@@ -824,8 +823,7 @@
         where
         m.type in (1,3)
         and c.goods_id = #{goodsId}) as exam_num,
-        (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
-        = ubr.goods_id where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
+        (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr  where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.order_goods_id = cgu.order_goods_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
         cgu.grade_id,
         cg.class_start_time,
         cg.class_end_time,
@@ -845,15 +843,15 @@
         FROM
         class_grade_user cgu
         LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
-        LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
+        LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
         WHERE
         1=1 and cgu.tenant_id = #{tenantId}
           and cg.tenant_id = #{tenantId}
-          and cgg.tenant_id = #{tenantId}
+          and og.tenant_id = #{tenantId}
         <if test="gradeId != null and gradeId != ''">
             and cg.grade_id = #{gradeId}
         </if>
-        and cg.`status` =1 and cgg.goods_id = #{goodsId} and cgu.change_grade = 0 and cgu.user_id=#{userId}
+        and cg.`status` =1 and og.goods_id = #{goodsId} and cgu.change_grade = 0 and cgu.user_id=#{userId}
         order by cg.create_time desc LIMIT 1
     </select>
 
@@ -878,15 +876,13 @@
         where
         m.type in (1,3)
         and c.goods_id = #{goodsId}) as exam_num,
-        (SELECT ifnull(COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id),0) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
-        = ubr.goods_id where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
+        (SELECT ifnull(COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id),0) FROM user_bank_record ubr  where ubr.`status`=1 and ubr.report_status=1 and ubr.order_goods_id = cgu.order_goods_id and ubr.grade_id = cg.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
         cgu.grade_id,
         cgu.user_id,
         cgu.order_goods_id
         FROM
         class_grade_user cgu
         LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
-        LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
         WHERE
         1=1
         <if test="gradeId != null and gradeId != ''">