yangdamao 1 жил өмнө
parent
commit
35efb0dda8

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

@@ -2643,10 +2643,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     @Override
     public boolean arrangeGrade(String goodsName, Long goodsId, Long orderGoodsId, Long gradeId, Long userId, String orderSn, Long businessId) {
         //查询该学员有没有有效期内同商品班级 有就不允许添加
-       /* Integer classNum = baseMapper.selectUserClass(goodsId,userId);
-        if (classNum > 0){、。
-            throw new CustomException("该学员已在此商品有效期内的班级,无法加入新的有效期班级,请查看该学员此商品下的班级");
-        }*/
+//       Integer classNum = baseMapper.selectUserClass(goodsId,userId);
+//        if (classNum > 0){
+//            throw new CustomException("该学员已在此商品有效期内的班级,无法加入新的有效期班级,请查看该学员此商品下的班级");
+//        }
         OrderGoods orderGoods = iOrderGoodsService.getById(orderGoodsId);
         String businessFull = iGoodsService.getGoodsBusinessName(goodsId);
         Goods goods = iGoodsService.getById(goodsId);
@@ -2697,6 +2697,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                         .eq(sevenFlag,ClassGradeUser::getOrderGoodsId,orderGoodsId)
                         .eq(ClassGradeUser::getUserId, userId)
                         .last("limit 1"));
+                if (ObjectUtils.isNotNull(gradeUser) && gradeUser.getStatus() == 1){
+                    throw new CustomException("学员已在此班级报名,请选择其他班级!");
+                }
                 //不在此班级内
                 if (Validator.isEmpty(gradeUser)) {
                     //班级还有剩位,直接锁定班级